vue-data-ui 3.29.2 → 3.29.3

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 (159) hide show
  1. package/dist/{PackageVersion-C1vtZkKc.js → PackageVersion-DAF5ApGl.js} +1 -1
  2. package/dist/{XyAnalysisOptions-CD0cCtt5.js → XyAnalysisOptions-Cyt8w5B3.js} +1 -1
  3. package/dist/components/vue-ui-3d-bar.js +1 -1
  4. package/dist/components/vue-ui-accordion.js +1 -1
  5. package/dist/components/vue-ui-age-pyramid.js +1 -1
  6. package/dist/components/vue-ui-annotator.js +1 -1
  7. package/dist/components/vue-ui-bullet.js +1 -1
  8. package/dist/components/vue-ui-bump.js +1 -1
  9. package/dist/components/vue-ui-candlestick.js +1 -1
  10. package/dist/components/vue-ui-carousel-table.js +1 -1
  11. package/dist/components/vue-ui-chestnut.js +1 -1
  12. package/dist/components/vue-ui-chord.js +1 -1
  13. package/dist/components/vue-ui-circle-pack.js +1 -1
  14. package/dist/components/vue-ui-cursor.js +1 -1
  15. package/dist/components/vue-ui-dag.js +1 -1
  16. package/dist/components/vue-ui-dashboard.js +1 -1
  17. package/dist/components/vue-ui-digits.js +1 -1
  18. package/dist/components/vue-ui-donut-evolution.js +1 -1
  19. package/dist/components/vue-ui-donut.js +1 -1
  20. package/dist/components/vue-ui-dumbbell.js +1 -1
  21. package/dist/components/vue-ui-flow.js +1 -1
  22. package/dist/components/vue-ui-funnel.js +1 -1
  23. package/dist/components/vue-ui-galaxy.js +1 -1
  24. package/dist/components/vue-ui-gauge.js +1 -1
  25. package/dist/components/vue-ui-geo.js +1 -1
  26. package/dist/components/vue-ui-gizmo.js +1 -1
  27. package/dist/components/vue-ui-graph.js +1 -1
  28. package/dist/components/vue-ui-heatmap.js +1 -1
  29. package/dist/components/vue-ui-hill.js +1 -1
  30. package/dist/components/vue-ui-history-plot.js +1 -1
  31. package/dist/components/vue-ui-horizontal-bar.js +1 -1
  32. package/dist/components/vue-ui-kpi.js +1 -1
  33. package/dist/components/vue-ui-label.js +1 -1
  34. package/dist/components/vue-ui-mini-loader.js +1 -1
  35. package/dist/components/vue-ui-molecule.js +1 -1
  36. package/dist/components/vue-ui-mood-radar.js +1 -1
  37. package/dist/components/vue-ui-nested-donuts.js +1 -1
  38. package/dist/components/vue-ui-onion.js +1 -1
  39. package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
  40. package/dist/components/vue-ui-quadrant.js +1 -1
  41. package/dist/components/vue-ui-quick-chart.js +1 -1
  42. package/dist/components/vue-ui-radar.js +1 -1
  43. package/dist/components/vue-ui-rating.js +1 -1
  44. package/dist/components/vue-ui-relation-circle.js +1 -1
  45. package/dist/components/vue-ui-ridgeline.js +1 -1
  46. package/dist/components/vue-ui-rings.js +1 -1
  47. package/dist/components/vue-ui-scatter.js +1 -1
  48. package/dist/components/vue-ui-skeleton.js +1 -1
  49. package/dist/components/vue-ui-smiley.js +1 -1
  50. package/dist/components/vue-ui-spark-trend.js +1 -1
  51. package/dist/components/vue-ui-sparkbar.js +1 -1
  52. package/dist/components/vue-ui-sparkgauge.js +1 -1
  53. package/dist/components/vue-ui-sparkhistogram.js +1 -1
  54. package/dist/components/vue-ui-sparkline.js +1 -1
  55. package/dist/components/vue-ui-sparkstackbar.js +1 -1
  56. package/dist/components/vue-ui-stackbar.js +1 -1
  57. package/dist/components/vue-ui-stackline.js +1 -1
  58. package/dist/components/vue-ui-strip-plot.js +1 -1
  59. package/dist/components/vue-ui-table-heatmap.js +1 -1
  60. package/dist/components/vue-ui-table-sparkline.js +1 -1
  61. package/dist/components/vue-ui-table.js +1 -1
  62. package/dist/components/vue-ui-thermometer.js +1 -1
  63. package/dist/components/vue-ui-timer.js +1 -1
  64. package/dist/components/vue-ui-tiremarks.js +1 -1
  65. package/dist/components/vue-ui-treemap.js +1 -1
  66. package/dist/components/vue-ui-vertical-bar.js +1 -1
  67. package/dist/components/vue-ui-waffle.js +1 -1
  68. package/dist/components/vue-ui-wheel.js +1 -1
  69. package/dist/components/vue-ui-word-cloud.js +1 -1
  70. package/dist/components/vue-ui-world.js +1 -1
  71. package/dist/components/vue-ui-xy-canvas.js +1 -1
  72. package/dist/components/vue-ui-xy.js +1 -1
  73. package/dist/package-Dd1ZNT5Q.js +1 -0
  74. package/dist/{render-common-DNKT42_W.js → render-common-B7aQrXBR.js} +1 -1
  75. package/dist/ssr/vue-ui-donut.js +1 -1
  76. package/dist/ssr/vue-ui-xy.js +1 -1
  77. package/dist/ssr.js +1 -1
  78. package/dist/style.css +1 -1
  79. package/dist/types/vue-data-ui.d.ts +9 -0
  80. package/dist/{useConfig-CXhXxWjB.js → useConfig-B8qvYKdK.js} +1 -1
  81. package/dist/{useObjectBindings-BCep9t8A.js → useObjectBindings-CztjiAzG.js} +1 -1
  82. package/dist/utils.js +1 -1
  83. package/dist/vue-data-ui-BmTsLaNH.js +1 -0
  84. package/dist/vue-data-ui.js +1 -1
  85. package/dist/{vue-ui-3d-bar-CNym5PLY.js → vue-ui-3d-bar-D3pDUYiG.js} +1 -1
  86. package/dist/{vue-ui-accordion-D3uT1Ynv.js → vue-ui-accordion-BpTfjWvH.js} +1 -1
  87. package/dist/{vue-ui-age-pyramid-zD6anIub.js → vue-ui-age-pyramid-bJmGRZ59.js} +1 -1
  88. package/dist/{vue-ui-annotator-aP1DFNt9.js → vue-ui-annotator-C-gyszpf.js} +1 -1
  89. package/dist/{vue-ui-bullet-CxhIb-XU.js → vue-ui-bullet-5ZNUgPS7.js} +1 -1
  90. package/dist/{vue-ui-bump-B8WYM1RE.js → vue-ui-bump-DYGbmTko.js} +1 -1
  91. package/dist/{vue-ui-candlestick-CwG1H80q.js → vue-ui-candlestick-BwETH5d4.js} +1 -1
  92. package/dist/{vue-ui-carousel-table-CdrxVrHZ.js → vue-ui-carousel-table-_V-HWzd-.js} +1 -1
  93. package/dist/{vue-ui-chestnut-CZG6Ep36.js → vue-ui-chestnut-Cg8m6-N6.js} +1 -1
  94. package/dist/{vue-ui-chord-DQS4tBWQ.js → vue-ui-chord-CaJ-uclL.js} +1 -1
  95. package/dist/{vue-ui-circle-pack-BGbhvnE5.js → vue-ui-circle-pack-BiVPm8ii.js} +1 -1
  96. package/dist/{vue-ui-cursor-DTRAPWBW.js → vue-ui-cursor-jkuEvFtX.js} +1 -1
  97. package/dist/{vue-ui-dag-BGNC8uRQ.js → vue-ui-dag-wkBDTIcz.js} +1 -1
  98. package/dist/{vue-ui-dashboard-DtPlz7y-.js → vue-ui-dashboard-CDekEQNH.js} +1 -1
  99. package/dist/{vue-ui-digits-gtQiZcOT.js → vue-ui-digits-ByjwG9Hv.js} +1 -1
  100. package/dist/{vue-ui-donut-COELw22T.js → vue-ui-donut-BB7BW0dE.js} +1 -1
  101. package/dist/{vue-ui-donut-_wqSXunY.js → vue-ui-donut-BV3btR0S.js} +1 -1
  102. package/dist/{vue-ui-donut-evolution-CdztIQSl.js → vue-ui-donut-evolution-CPIVtWxh.js} +1 -1
  103. package/dist/{vue-ui-dumbbell-CpLMoEet.js → vue-ui-dumbbell-bTQpX8A6.js} +1 -1
  104. package/dist/{vue-ui-flow-DwG1MX2V.js → vue-ui-flow-BRC3pGzL.js} +1 -1
  105. package/dist/{vue-ui-funnel-CisiLlR9.js → vue-ui-funnel-7RjzjVqE.js} +1 -1
  106. package/dist/{vue-ui-galaxy-HndquOs-.js → vue-ui-galaxy-D91dIUfs.js} +1 -1
  107. package/dist/{vue-ui-gauge-CVxKlU2U.js → vue-ui-gauge-DM3p5s8H.js} +1 -1
  108. package/dist/{vue-ui-geo-0PDP2JjE.js → vue-ui-geo-BUQL79cU.js} +1 -1
  109. package/dist/{vue-ui-gizmo-mFeK8xP1.js → vue-ui-gizmo-CoET_abC.js} +1 -1
  110. package/dist/{vue-ui-graph-Duw5qG0a.js → vue-ui-graph-CCLd8bTj.js} +1 -1
  111. package/dist/{vue-ui-heatmap-DZM9MvfE.js → vue-ui-heatmap-BvVHrOcc.js} +1 -1
  112. package/dist/{vue-ui-hill-BGQSrcHM.js → vue-ui-hill-BkcY-Zbf.js} +1 -1
  113. package/dist/{vue-ui-history-plot-EGeDhkdS.js → vue-ui-history-plot-DVoOwR1y.js} +1 -1
  114. package/dist/{vue-ui-horizontal-bar-CtONqcjG.js → vue-ui-horizontal-bar-Khi_qtla.js} +1 -1
  115. package/dist/{vue-ui-kpi-BSRfwYk9.js → vue-ui-kpi-BPL64spX.js} +1 -1
  116. package/dist/{vue-ui-label-W0ITGnQa.js → vue-ui-label-OvoE3A_k.js} +1 -1
  117. package/dist/{vue-ui-mini-loader-BBsXG6nD.js → vue-ui-mini-loader-DyefvJIr.js} +1 -1
  118. package/dist/{vue-ui-molecule-DOQ8dsme.js → vue-ui-molecule-B7KJzavj.js} +1 -1
  119. package/dist/{vue-ui-mood-radar-BJeSC-Op.js → vue-ui-mood-radar-6q5OUW6D.js} +1 -1
  120. package/dist/{vue-ui-nested-donuts-DUUmc8K7.js → vue-ui-nested-donuts-C137tg5U.js} +1 -1
  121. package/dist/{vue-ui-onion-B8M1x8Jc.js → vue-ui-onion-ClMux968.js} +1 -1
  122. package/dist/{vue-ui-parallel-coordinate-plot-Dv0eO4ZI.js → vue-ui-parallel-coordinate-plot-JbfDQzwN.js} +1 -1
  123. package/dist/{vue-ui-quadrant-_QcgE234.js → vue-ui-quadrant-BPKWN3Ac.js} +1 -1
  124. package/dist/{vue-ui-quick-chart-DzJx0LBu.js → vue-ui-quick-chart-BvqQnNn1.js} +1 -1
  125. package/dist/{vue-ui-radar-C-idGMCp.js → vue-ui-radar-DIdTBEet.js} +1 -1
  126. package/dist/{vue-ui-rating-CwD4CB9M.js → vue-ui-rating-CFu9LjID.js} +1 -1
  127. package/dist/{vue-ui-relation-circle-Dl2XO5DU.js → vue-ui-relation-circle-5Noti3DC.js} +1 -1
  128. package/dist/{vue-ui-ridgeline-SG44P21X.js → vue-ui-ridgeline-DUrvAa8z.js} +1 -1
  129. package/dist/{vue-ui-rings-b8Ms_mTp.js → vue-ui-rings-B-cJIyAX.js} +1 -1
  130. package/dist/{vue-ui-scatter-KPiaTVuv.js → vue-ui-scatter-DcchOWYi.js} +1 -1
  131. package/dist/{vue-ui-skeleton-Dg0tACvE.js → vue-ui-skeleton-DtHam8Oi.js} +1 -1
  132. package/dist/{vue-ui-smiley-B34VeonG.js → vue-ui-smiley-C8ES41OS.js} +1 -1
  133. package/dist/{vue-ui-spark-trend-C3EXOm2F.js → vue-ui-spark-trend-m_ybZFN7.js} +1 -1
  134. package/dist/{vue-ui-sparkbar-CCjgG6pR.js → vue-ui-sparkbar-CVJo0I__.js} +1 -1
  135. package/dist/{vue-ui-sparkgauge-DnxHmWiH.js → vue-ui-sparkgauge-UXQOQCQ6.js} +1 -1
  136. package/dist/{vue-ui-sparkhistogram--QcZmUje.js → vue-ui-sparkhistogram-DVyAev-n.js} +1 -1
  137. package/dist/{vue-ui-sparkline-D1BPdZdr.js → vue-ui-sparkline-DXJpSvr5.js} +1 -1
  138. package/dist/{vue-ui-sparkstackbar-CxF1OSDL.js → vue-ui-sparkstackbar-CI7LeTy9.js} +1 -1
  139. package/dist/{vue-ui-stackbar-yKTDxwXp.js → vue-ui-stackbar-BAdE_agj.js} +1 -1
  140. package/dist/{vue-ui-stackline-BPdR_8x0.js → vue-ui-stackline-CEcCgYrY.js} +1 -1
  141. package/dist/{vue-ui-strip-plot-CAmBydR2.js → vue-ui-strip-plot-D2JTssjF.js} +1 -1
  142. package/dist/{vue-ui-table-BKfGLJgN.js → vue-ui-table-CcBJ_hPp.js} +1 -1
  143. package/dist/{vue-ui-table-heatmap-CpviNfWA.js → vue-ui-table-heatmap-CwV82zwm.js} +1 -1
  144. package/dist/{vue-ui-table-sparkline-CVomhgHC.js → vue-ui-table-sparkline-D1OPXi2z.js} +1 -1
  145. package/dist/{vue-ui-thermometer-DNRR87NF.js → vue-ui-thermometer-D2LlLcEV.js} +1 -1
  146. package/dist/{vue-ui-timer-Bx5D4QsO.js → vue-ui-timer-Ca8KPZNl.js} +2 -2
  147. package/dist/{vue-ui-tiremarks-CnZqIcFq.js → vue-ui-tiremarks-BsKJi3S0.js} +1 -1
  148. package/dist/{vue-ui-treemap-D7k9vWC9.js → vue-ui-treemap-5HkhmOD4.js} +1 -1
  149. package/dist/{vue-ui-waffle-BHcDq09N.js → vue-ui-waffle-2BJYwpwv.js} +1 -1
  150. package/dist/{vue-ui-wheel-Cd3P9Nq4.js → vue-ui-wheel-Dr-mMZrH.js} +1 -1
  151. package/dist/vue-ui-word-cloud-CF_k1x_e.js +4 -0
  152. package/dist/{vue-ui-world-bZ7gOrS1.js → vue-ui-world-BuzOXOPx.js} +1 -1
  153. package/dist/{vue-ui-xy-Y_MKCMGp.js → vue-ui-xy-Cr5w4DsW.js} +1 -1
  154. package/dist/{vue-ui-xy-BTGZ1NSt.js → vue-ui-xy-Cwkavs_B.js} +3 -3
  155. package/dist/{vue-ui-xy-canvas-C8Xi5Bad.js → vue-ui-xy-canvas-DnWzhq9y.js} +1 -1
  156. package/package.json +2 -2
  157. package/dist/package-BPQ4kSL9.js +0 -1
  158. package/dist/vue-data-ui-CeZQZazG.js +0 -1
  159. package/dist/vue-ui-word-cloud-B7iGPkGe.js +0 -4
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,t as n}from"./userOptionsSlots-CWtXN5Q6.js";import{n as r}from"./resolveChartConfig-0IvbmIE_.js";import{$ as i,D as a,Ht as o,Jt as ee,S as te,X as ne,at as re,i as ie,m as ae,nt as oe,w as se,yt as ce,zt as le}from"./lib-rPeBMZrn.js";import{n as ue,t as de}from"./useHints-C-TwxM0Y.js";import{t as fe}from"./useConfig-CXhXxWjB.js";import{t as pe}from"./usePrinter-DVf3YcG5.js";import{t as me}from"./useUserOptionState-CXlFnwPv.js";import{t as he}from"./vClickOutside-BxNzkY17.js";import{t as ge}from"./vue_ui_table_sparkline-DZQYAsyS.js";import{t as _e}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as s,computed as c,createBlock as ve,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createSlots as ye,createVNode as f,defineAsyncComponent as p,mergeProps as be,nextTick as xe,normalizeClass as m,normalizeStyle as h,onBeforeUnmount as Se,onMounted as Ce,openBlock as g,ref as _,renderList as v,renderSlot as we,shallowRef as Te,toDisplayString as y,unref as b,useCssVars as Ee,useSlots as De,watch as Oe,withCtx as ke,withDirectives as Ae}from"vue";var je=/* @__PURE__ */ e({default:()=>Ge}),Me=[`id`],Ne={style:{"z-index":`1`,"padding-right":`24px`}},Pe={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Fe={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Ie=[`onClick`],Le=[`onClick`],Re=[`data-cell`],ze=[`data-cell`,`onPointerenter`],Be=[`data-cell`],Ve=[`data-cell`],He=[`data-cell`],Ue=[`data-cell`],We={key:1,ref:`source`,dir:`auto`},Ge=/*#__PURE__*/ _e({__name:`vue-ui-table-sparkline`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`copyAlt`],setup(e,{expose:_e,emit:je}){Ee(e=>({v5fe3988e:e.tdo}));let Ge=p(()=>import(`./vue-ui-sparkline-D1BPdZdr.js`).then(e=>e.n)),x=p(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Ke=p(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),{vue_ui_table_sparkline:qe}=fe(),S=e,Je=je,C=_(ne()),Ye=_(0),w=_(0),T=_(null),Xe=De(),Ze=_(!1),E=c({get:()=>et(),set:e=>e}),D=c(()=>E.value.userOptions),O=c(()=>E.value.sparkline),k=c(()=>E.value.thead),A=c(()=>E.value.tbody),j=c(()=>E.value.title);Ce(()=>{Xe[`chart-background`]&&E.value.debug&&console.warn(`VueUiTableSparkline does not support the #chart-background slot.`)}),ue({config:()=>E.value,dataset:()=>S.dataset,component:`VueUiTableSparkline`,rules:[de.emptyArray,{test:e=>e.some(e=>e?.values&&e.values.length>500),message:[`👀 One or more series have > 500 datapoints. Consider if you really need this level of detail.`,``,`▶️ Use larger time scales, or aggregated values`]},{test:e=>e.some(e=>e?.values&&e.values.length>1095),message:[`👀 One or more series have > 1095 datapoints. Above this threshold, the dataset is computed through an LTTB algorithm, to preserve the shape of the data without increasing the number of datapoints.`,``,`▶️ If you need this level of detail, you can change config.downsample.threshold and set a higher value. Note that performance will be impacted.`]}]});let M=c(()=>E.value.userOptions.useCursorPointer),{userOptionsVisible:N,setUserOptionsVisibility:Qe,keepUserOptionState:$e}=me({config:E.value});function et(){return r(S.config,qe,ge)}Oe(()=>S.config,e=>{E.value=et(),N.value=!E.value.userOptions.showOnChartHover,ct(),w.value+=1},{deep:!0}),Oe(()=>S.dataset,e=>{U.value=H.value,w.value+=1},{deep:!0});let{isPrinting:tt,isImaging:nt,generatePdf:rt,generateImage:it}=pe({elementId:`table_${C.value}`,fileName:j.value.text||`vue-ui-table-sparkline`,options:E.value.userOptions.print}),at=c(()=>se(E.value.customPalette)),P=_(null),F=_(!1),ot=c(()=>E.value.responsiveBreakpoint);Ce(()=>{ct()});let st=_(E.value.colNames),I=Te(null);function ct(){le(S.dataset)&&re({componentName:`VueUiTableSparkline`,type:`dataset`}),I.value&&I.value.disconnect(),I.value=new ResizeObserver(e=>{e.forEach(e=>{F.value=e.contentRect.width<ot.value})}),P.value&&I.value.observe(P.value),st.value=[];for(let e=0;e<pt.value;e+=1)st.value.push(E.value.colNames[e]||`col ${e}`)}Se(()=>{I.value&&I.value.disconnect()});function L(e){if([null,void 0].includes(e))return null;let t=Number(e);return Number.isFinite(t)?t:null}function R(e){return typeof e==`number`&&Number.isFinite(e)}function lt(e=[]){return e.map(L).filter(R)}function z(e,t,n){let r=L(e),i=L(t),a=R(r),o=R(i);return a&&o?n===-1?r-i:i-r:a?-1:+!!o}function B(e,t,n={}){let r=L(e);return r===null?`-`:ie(E.value.formatter,r,i({p:E.value.prefix,v:r,s:E.value.suffix,r:t}),n)}let V=c(()=>(S.dataset.forEach((e,t)=>{ce({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{re({componentName:`VueUiTableSparkline`,type:`datasetSerieAttribute`,property:e,index:t})})}),S.dataset.map((e,t)=>{let n=e.values||[],r=lt(n),i=r.length?r.reduce((e,t)=>e+t,0):null,a=r.length?i/r.length:null,ee=r.length?ae(r):null;return{...e,values:n,color:te(e.color)||at.value[t]||o[t]||o[t%o.length],sum:i,average:a,median:ee,sparklineDataset:n.map((e,t)=>({period:E.value.colNames[t]||`col ${t}`,value:L(e)}))}})));function ut(e){let t=(e[0]?.values||[]).map((t,n)=>e.map(e=>e?.values?.[n]??null)).map(e=>e.map((e,t)=>[e,t]).sort((e,t)=>z(e[0],t[0],1)).map(e=>e[1]));return e.map((e,n)=>({...e,values:e.values||[],orders:t[n]}))}let H=c(()=>ut(V.value)),U=_(H.value),dt=c(()=>Math.max(...U.value.map(e=>(e.values||[]).length))),W=_(void 0),G=_(!1),K=_(void 0),ft=_(1);function q(){G.value=!1,K.value=void 0,Z.value=void 0,ft.value=1,$.value.forEach(e=>e.state=1),X.value={name:1,sum:1,average:1,median:1},U.value=H.value}function J(e,t,n){if([`name`,`sum`,`average`,`median`].includes(e.type)){mt(e.type,t,n);return}if(!bt(t))return;if(Q.value=t,Z.value=void 0,![null,void 0].includes(K.value)&&t!==K.value&&(K.value=void 0,q()),$.value[t].state===n&&K.value===t){K.value=void 0,q();return}G.value=!0,K.value=t;let r=H.value.map(e=>e.values?.[t]??null),i=n;$.value[t].state=i,ft.value=i,t===W.value?W.value=void 0:W.value=t;let a=r.map((e,t)=>[t,e]).sort((e,t)=>z(e[1],t[1],i)).map(e=>e[0]).map(e=>H.value[e]);U.value=a,w.value+=1}let pt=c(()=>Math.max(...S.dataset.map(e=>(e.values||[]).length))),Y=c(()=>{let e=st.value.map(e=>({type:`reg`,value:e}));if(!e.length)for(let t=0;t<pt.value;t+=1)e.push({type:`reg`,value:`col ${t+1}`});E.value.showTotal&&(e=[...e,{type:`sum`,value:E.value.translations.total}]);let t;return t=E.value.showAverage&&E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average},{type:`median`,value:E.value.translations.median}]:E.value.showAverage&&!E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average}]:!E.value.showAverage&&E.value.showMedian?[...e,{type:`median`,value:E.value.translations.median}]:e,E.value.showSparklines?[...t,{type:`chart`,value:E.value.translations.chart}]:t}),X=_({name:1,sum:1,average:1,median:1}),Z=_(void 0);function mt(e,t,n){if(!U.value||U.value.length===0||!xt(e))return;if(Z.value!==e&&(Z.value=void 0),![null,void 0].includes(K.value)&&t!==K.value&&q(),K.value=void 0,X.value[e]===n&&Z.value){Z.value=void 0,q();return}Z.value=e,G.value=!0,X.value[e]=n,[null,void 0].includes(t)||($.value[t].state=X.value[e]);let r=X.value[e],i=[...U.value].sort((t,n)=>{let i=t[e],a=n[e];return typeof i==`string`&&typeof a==`string`?r===-1?i.localeCompare(a):a.localeCompare(i):z(i,a,r)});U.value=i}let Q=_(void 0),ht=_(void 0);function gt({dataIndex:e,serieIndex:t}){Q.value=e,ht.value=t,T.value[e]&&!F.value&&T.value[e].scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}let _t=_(!1);function vt(e){_t.value=e,Ye.value+=1}function yt(e=null){xe(()=>{let t=[E.value.translations.serie].concat(Y.value),n=V.value.map((e,t)=>[[e.name],e.values,[e.sum],[e.average],[e.median]]),r=[t].concat(n),i=a(r);e?e(i):oe({csvContent:i,title:j.value.text||`vue-ui-table-sparkline`})})}function bt(e){return E.value.sortedDataColumnIndices.includes(e)}function xt(e){return e.type===`name`||e===`name`?E.value.sortedSeriesName:e.type===`sum`||e===`sum`?E.value.sortedSum:e.type===`average`||e===`average`?E.value.sortedAverage:e.type===`median`||e===`median`?E.value.sortedMedian:!1}function St(e,t,n){return[`sum`,`average`,`median`].includes(t.type)?Z.value===t.type&&X.value[t.type]===n?1:.3:e===K.value&&$.value[e].state===n?1:.3}function Ct(){E.value.resetSortOnClickOutside&&q()}let $=c({get:()=>Y.value.map(e=>({state:1})),set:e=>e});function wt(e){e?.stage===`start`?Ze.value=!0:e?.stage===`end`?Ze.value=!1:it()}async function Tt(){Je(`copyAlt`,{config:E.value,dataset:V.value}),E.value.userOptions.callbacks.altCopy?await Promise.resolve(E.value.userOptions.callbacks.altCopy({config:E.value,dataset:V.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}return _e({generatePdf:rt,generateImage:it,generateCsv:yt,restoreOrder:q,copyAlt:Tt}),(e,r)=>(g(),u(`div`,{ref_key:`tableContainer`,ref:P,class:m({"vue-data-ui-component":!0,"vue-ui-table-sparkline":!0,"vue-ui-responsive":F.value}),style:{overflow:`hidden`},id:`table_${C.value}`,onMouseenter:r[3]||=()=>b(Qe)(!0),onMouseleave:r[4]||=()=>b(Qe)(!1)},[j.value.text?(g(),u(`div`,{key:0,class:`vue-ui-table-sparkline-caption`,style:h({backgroundColor:j.value.backgroundColor})},[d(`div`,{class:`atom-title`,style:h({fontSize:`${j.value.fontSize}px`,fontWeight:j.value.bold?`bold`:`normal`,color:j.value.color,textAlign:j.value.textAlign})},y(j.value.text),5),j.value.subtitle.text?(g(),u(`div`,{key:0,class:`atom-subtitle`,style:h({fontSize:`${j.value.subtitle.fontSize}px`,fontWeight:j.value.subtitle.bold?`bold`:`normal`,color:j.value.subtitle.color,textAlign:j.value.textAlign})},y(j.value.subtitle.text),5)):l(``,!0)],4)):l(``,!0),d(`div`,{style:{overflow:`auto`},onPointerleave:r[2]||=e=>{ht.value=void 0,Q.value=void 0}},[d(`table`,{class:`vue-ui-data-table`,style:h({fontFamily:E.value.fontFamily,position:`relative`})},[d(`thead`,Ne,[Ae((g(),u(`tr`,{role:`row`,class:`vue-ui-data-table__thead-row`,style:h({backgroundColor:k.value.backgroundColor,color:k.value.color})},[d(`th`,{role:`cell`,style:h({backgroundColor:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`}),class:`sticky-col-first`},[d(`div`,{style:h({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[d(`span`,null,y(E.value.translations.serie),1),U.value.length>1&&E.value.sortedSeriesName?(g(),u(`div`,Pe,[d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:r[0]||=e=>J({type:`name`},null,-1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:h({opacity:Z.value===`name`&&X.value.name===-1?1:.3})},null,8,[`stroke`,`style`])],4),d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:r[1]||=e=>J({type:`name`},null,1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:h({opacity:Z.value===`name`&&X.value.name===1?1:.3})},null,8,[`stroke`,`style`])],4)])):l(``,!0)],4)],4),(g(!0),u(s,null,v(Y.value,(r,i)=>(g(),u(`th`,{role:`cell`,style:h({background:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`,minWidth:i===Y.value.length-1?`${O.value.dimensions.width}px`:`48px`,paddingRight:i===Y.value.length-1&&D.value.show?`36px`:``}),class:m({"sticky-col":i===Y.value.length-1&&E.value.showSparklines})},[d(`div`,{style:h({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[d(`span`,null,y(r.value),1),U.value.length>1&&(bt(i)||xt(r))?(g(),u(`div`,Fe,[d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:()=>J(r,i,-1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:h({opacity:St(i,r,-1)})},null,8,[`stroke`,`style`])],12,Ie),d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:()=>J(r,i,1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:h({opacity:St(i,r,1)})},null,8,[`stroke`,`style`])],12,Le)])):l(``,!0)],4),D.value.show&&i===Y.value.length-1&&(b($e)||b(N))?(g(),ve(b(Ke),{ref_for:!0,ref:`details`,key:`user_option_${Ye.value}`,backgroundColor:k.value.backgroundColor,color:k.value.color,isPrinting:b(tt),isImaging:b(nt),uid:C.value,hasPdf:D.value.buttons.pdf,hasXls:D.value.buttons.csv,hasImg:D.value.buttons.img,hasFullscreen:D.value.buttons.fullscreen,hasAltCopy:D.value.buttons.altCopy,isFullscreen:_t.value,titles:{...D.value.buttonTitles},chartElement:P.value,position:D.value.position,callbacks:D.value.callbacks,printScale:D.value.print.scale,isCursorPointer:M.value,onToggleFullscreen:vt,onGeneratePdf:b(rt),onGenerateImage:wt,onGenerateCsv:yt,onCopyAlt:Tt,style:h({visibility:b($e)?b(N)?`visible`:`hidden`:`visible`})},ye({_:2},[v(b(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionFullscreen optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:ke(r=>[we(e.$slots,t,be({ref_for:!0},b(n)(t,r)),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasPdf`,`hasXls`,`hasImg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`style`])):l(``,!0)],6))),256))],4)),[[b(he),Ct]])]),d(`tbody`,null,[(g(!0),u(s,null,v(U.value,(e,t)=>(g(),u(`tr`,{role:`row`,style:h({backgroundColor:A.value.backgroundColor,color:A.value.color}),class:m({"vue-ui-data-table__tbody__row":!0,"vue-ui-data-table__tbody__row-even":t%2==0,"vue-ui-data-table__tbody__row-odd":t%2!=0})},[d(`td`,{role:`cell`,style:h({backgroundColor:A.value.backgroundColor,border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.serie,class:`vue-ui-data-table__tbody__td sticky-col-first`},[d(`div`,{dir:`auto`,style:h({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`6px`,justifyContent:A.value.textAlign})},[A.value.showColorMarker?(g(),u(`span`,{key:0,style:h({color:e.color})},`⬤`,4)):l(``,!0),d(`span`,null,y(e.name??`-`),1)],4)],12,Re),(g(!0),u(s,null,v(dt.value,(n,r)=>(g(),u(`td`,{dir:`auto`,role:`cell`,ref_for:!0,ref_key:`TD`,ref:T,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,background:Q.value!==void 0&&r===Q.value?A.value.selectedColor.useSerieColor?b(ee)(e.color,20):A.value.selectedColor.fallback:``}),"data-cell":Y.value[r]?Y.value[r].value:``,class:`vue-ui-data-table__tbody__td`,onPointerenter:e=>{ht.value=t,Q.value=r}},y(B(e.values[r],E.value.roundingValues,{datapoint:e,seriesIndex:t,datapointIndex:r})),45,ze))),256)),E.value.showTotal?(g(),u(`td`,{key:0,dir:`auto`,role:`cell`,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.total,class:`vue-ui-data-table__tbody__td`},y(B(e.sum,E.value.roundingTotal,{datapoint:e.sum,seriesIndex:t})),13,Be)):l(``,!0),E.value.showAverage?(g(),u(`td`,{key:1,dir:`auto`,role:`cell`,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.average,class:`vue-ui-data-table__tbody__td`},y(B(e.average,E.value.roundingAverage,{datapoint:e.average,seriesIndex:t})),13,Ve)):l(``,!0),E.value.showMedian?(g(),u(`td`,{key:2,dir:`auto`,role:`cell`,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.median,class:`vue-ui-data-table__tbody__td`},y(B(e.median,E.value.roundingMedian,{datapoint:e.median,seriesIndex:t})),13,He)):l(``,!0),E.value.showSparklines?(g(),u(`td`,{key:3,role:`cell`,"data-cell":E.value.translations.chart,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,backgroundColor:A.value.backgroundColor,padding:`0`}),class:`vue-ui-data-table__tbody__td sticky-col`},[f(b(Ge),{onHoverIndex:({index:e})=>gt({dataIndex:e,serieIndex:t}),"height-ratio":O.value.dimensions.heightRatio,"forced-padding":30,dataset:e.sparklineDataset,showInfo:!1,selectedIndex:Q.value,config:{type:O.value.type,style:{backgroundColor:`transparent`,animation:{show:O.value.animation.show&&!b(tt)&&!b(nt),animationFrames:O.value.animation.animationFrames},padding:{right:12},line:{color:e.color,smooth:O.value.smooth,cutNullValues:O.value.cutNullValues,strokeWidth:O.value.strokeWidth},bar:{color:e.color},area:{color:e.color,opacity:O.value.showArea?16:0,useGradient:O.value.useGradient},verticalIndicator:{color:e.color},plot:{radius:9,stroke:A.value.backgroundColor,strokeWidth:3}}}},null,8,[`onHoverIndex`,`height-ratio`,`dataset`,`selectedIndex`,`config`])],12,Ue)):l(``,!0)],6))),256))])],4)],32),e.$slots.source?(g(),u(`div`,We,[we(e.$slots,`source`,{},void 0,!0)],512)):l(``,!0)],42,Me))}},[[`__scopeId`,`data-v-bb68c573`]]);export{je as n,Ge as t};
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,t as n}from"./userOptionsSlots-CWtXN5Q6.js";import{n as r}from"./resolveChartConfig-0IvbmIE_.js";import{$ as i,D as a,Ht as o,Jt as ee,S as te,X as ne,at as re,i as ie,m as ae,nt as oe,w as se,yt as ce,zt as le}from"./lib-rPeBMZrn.js";import{n as ue,t as de}from"./useHints-C-TwxM0Y.js";import{t as fe}from"./useConfig-B8qvYKdK.js";import{t as pe}from"./usePrinter-DVf3YcG5.js";import{t as me}from"./useUserOptionState-CXlFnwPv.js";import{t as he}from"./vClickOutside-BxNzkY17.js";import{t as ge}from"./vue_ui_table_sparkline-DZQYAsyS.js";import{t as _e}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as s,computed as c,createBlock as ve,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createSlots as ye,createVNode as f,defineAsyncComponent as p,mergeProps as be,nextTick as xe,normalizeClass as m,normalizeStyle as h,onBeforeUnmount as Se,onMounted as Ce,openBlock as g,ref as _,renderList as v,renderSlot as we,shallowRef as Te,toDisplayString as y,unref as b,useCssVars as Ee,useSlots as De,watch as Oe,withCtx as ke,withDirectives as Ae}from"vue";var je=/* @__PURE__ */ e({default:()=>Ge}),Me=[`id`],Ne={style:{"z-index":`1`,"padding-right":`24px`}},Pe={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Fe={key:0,style:{display:`flex`,flexDirection:`row`,alignItems:`center`}},Ie=[`onClick`],Le=[`onClick`],Re=[`data-cell`],ze=[`data-cell`,`onPointerenter`],Be=[`data-cell`],Ve=[`data-cell`],He=[`data-cell`],Ue=[`data-cell`],We={key:1,ref:`source`,dir:`auto`},Ge=/*#__PURE__*/ _e({__name:`vue-ui-table-sparkline`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`copyAlt`],setup(e,{expose:_e,emit:je}){Ee(e=>({v5fe3988e:e.tdo}));let Ge=p(()=>import(`./vue-ui-sparkline-DXJpSvr5.js`).then(e=>e.n)),x=p(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Ke=p(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),{vue_ui_table_sparkline:qe}=fe(),S=e,Je=je,C=_(ne()),Ye=_(0),w=_(0),T=_(null),Xe=De(),Ze=_(!1),E=c({get:()=>et(),set:e=>e}),D=c(()=>E.value.userOptions),O=c(()=>E.value.sparkline),k=c(()=>E.value.thead),A=c(()=>E.value.tbody),j=c(()=>E.value.title);Ce(()=>{Xe[`chart-background`]&&E.value.debug&&console.warn(`VueUiTableSparkline does not support the #chart-background slot.`)}),ue({config:()=>E.value,dataset:()=>S.dataset,component:`VueUiTableSparkline`,rules:[de.emptyArray,{test:e=>e.some(e=>e?.values&&e.values.length>500),message:[`👀 One or more series have > 500 datapoints. Consider if you really need this level of detail.`,``,`▶️ Use larger time scales, or aggregated values`]},{test:e=>e.some(e=>e?.values&&e.values.length>1095),message:[`👀 One or more series have > 1095 datapoints. Above this threshold, the dataset is computed through an LTTB algorithm, to preserve the shape of the data without increasing the number of datapoints.`,``,`▶️ If you need this level of detail, you can change config.downsample.threshold and set a higher value. Note that performance will be impacted.`]}]});let M=c(()=>E.value.userOptions.useCursorPointer),{userOptionsVisible:N,setUserOptionsVisibility:Qe,keepUserOptionState:$e}=me({config:E.value});function et(){return r(S.config,qe,ge)}Oe(()=>S.config,e=>{E.value=et(),N.value=!E.value.userOptions.showOnChartHover,ct(),w.value+=1},{deep:!0}),Oe(()=>S.dataset,e=>{U.value=H.value,w.value+=1},{deep:!0});let{isPrinting:tt,isImaging:nt,generatePdf:rt,generateImage:it}=pe({elementId:`table_${C.value}`,fileName:j.value.text||`vue-ui-table-sparkline`,options:E.value.userOptions.print}),at=c(()=>se(E.value.customPalette)),P=_(null),F=_(!1),ot=c(()=>E.value.responsiveBreakpoint);Ce(()=>{ct()});let st=_(E.value.colNames),I=Te(null);function ct(){le(S.dataset)&&re({componentName:`VueUiTableSparkline`,type:`dataset`}),I.value&&I.value.disconnect(),I.value=new ResizeObserver(e=>{e.forEach(e=>{F.value=e.contentRect.width<ot.value})}),P.value&&I.value.observe(P.value),st.value=[];for(let e=0;e<pt.value;e+=1)st.value.push(E.value.colNames[e]||`col ${e}`)}Se(()=>{I.value&&I.value.disconnect()});function L(e){if([null,void 0].includes(e))return null;let t=Number(e);return Number.isFinite(t)?t:null}function R(e){return typeof e==`number`&&Number.isFinite(e)}function lt(e=[]){return e.map(L).filter(R)}function z(e,t,n){let r=L(e),i=L(t),a=R(r),o=R(i);return a&&o?n===-1?r-i:i-r:a?-1:+!!o}function B(e,t,n={}){let r=L(e);return r===null?`-`:ie(E.value.formatter,r,i({p:E.value.prefix,v:r,s:E.value.suffix,r:t}),n)}let V=c(()=>(S.dataset.forEach((e,t)=>{ce({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{re({componentName:`VueUiTableSparkline`,type:`datasetSerieAttribute`,property:e,index:t})})}),S.dataset.map((e,t)=>{let n=e.values||[],r=lt(n),i=r.length?r.reduce((e,t)=>e+t,0):null,a=r.length?i/r.length:null,ee=r.length?ae(r):null;return{...e,values:n,color:te(e.color)||at.value[t]||o[t]||o[t%o.length],sum:i,average:a,median:ee,sparklineDataset:n.map((e,t)=>({period:E.value.colNames[t]||`col ${t}`,value:L(e)}))}})));function ut(e){let t=(e[0]?.values||[]).map((t,n)=>e.map(e=>e?.values?.[n]??null)).map(e=>e.map((e,t)=>[e,t]).sort((e,t)=>z(e[0],t[0],1)).map(e=>e[1]));return e.map((e,n)=>({...e,values:e.values||[],orders:t[n]}))}let H=c(()=>ut(V.value)),U=_(H.value),dt=c(()=>Math.max(...U.value.map(e=>(e.values||[]).length))),W=_(void 0),G=_(!1),K=_(void 0),ft=_(1);function q(){G.value=!1,K.value=void 0,Z.value=void 0,ft.value=1,$.value.forEach(e=>e.state=1),X.value={name:1,sum:1,average:1,median:1},U.value=H.value}function J(e,t,n){if([`name`,`sum`,`average`,`median`].includes(e.type)){mt(e.type,t,n);return}if(!bt(t))return;if(Q.value=t,Z.value=void 0,![null,void 0].includes(K.value)&&t!==K.value&&(K.value=void 0,q()),$.value[t].state===n&&K.value===t){K.value=void 0,q();return}G.value=!0,K.value=t;let r=H.value.map(e=>e.values?.[t]??null),i=n;$.value[t].state=i,ft.value=i,t===W.value?W.value=void 0:W.value=t;let a=r.map((e,t)=>[t,e]).sort((e,t)=>z(e[1],t[1],i)).map(e=>e[0]).map(e=>H.value[e]);U.value=a,w.value+=1}let pt=c(()=>Math.max(...S.dataset.map(e=>(e.values||[]).length))),Y=c(()=>{let e=st.value.map(e=>({type:`reg`,value:e}));if(!e.length)for(let t=0;t<pt.value;t+=1)e.push({type:`reg`,value:`col ${t+1}`});E.value.showTotal&&(e=[...e,{type:`sum`,value:E.value.translations.total}]);let t;return t=E.value.showAverage&&E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average},{type:`median`,value:E.value.translations.median}]:E.value.showAverage&&!E.value.showMedian?[...e,{type:`average`,value:E.value.translations.average}]:!E.value.showAverage&&E.value.showMedian?[...e,{type:`median`,value:E.value.translations.median}]:e,E.value.showSparklines?[...t,{type:`chart`,value:E.value.translations.chart}]:t}),X=_({name:1,sum:1,average:1,median:1}),Z=_(void 0);function mt(e,t,n){if(!U.value||U.value.length===0||!xt(e))return;if(Z.value!==e&&(Z.value=void 0),![null,void 0].includes(K.value)&&t!==K.value&&q(),K.value=void 0,X.value[e]===n&&Z.value){Z.value=void 0,q();return}Z.value=e,G.value=!0,X.value[e]=n,[null,void 0].includes(t)||($.value[t].state=X.value[e]);let r=X.value[e],i=[...U.value].sort((t,n)=>{let i=t[e],a=n[e];return typeof i==`string`&&typeof a==`string`?r===-1?i.localeCompare(a):a.localeCompare(i):z(i,a,r)});U.value=i}let Q=_(void 0),ht=_(void 0);function gt({dataIndex:e,serieIndex:t}){Q.value=e,ht.value=t,T.value[e]&&!F.value&&T.value[e].scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}let _t=_(!1);function vt(e){_t.value=e,Ye.value+=1}function yt(e=null){xe(()=>{let t=[E.value.translations.serie].concat(Y.value),n=V.value.map((e,t)=>[[e.name],e.values,[e.sum],[e.average],[e.median]]),r=[t].concat(n),i=a(r);e?e(i):oe({csvContent:i,title:j.value.text||`vue-ui-table-sparkline`})})}function bt(e){return E.value.sortedDataColumnIndices.includes(e)}function xt(e){return e.type===`name`||e===`name`?E.value.sortedSeriesName:e.type===`sum`||e===`sum`?E.value.sortedSum:e.type===`average`||e===`average`?E.value.sortedAverage:e.type===`median`||e===`median`?E.value.sortedMedian:!1}function St(e,t,n){return[`sum`,`average`,`median`].includes(t.type)?Z.value===t.type&&X.value[t.type]===n?1:.3:e===K.value&&$.value[e].state===n?1:.3}function Ct(){E.value.resetSortOnClickOutside&&q()}let $=c({get:()=>Y.value.map(e=>({state:1})),set:e=>e});function wt(e){e?.stage===`start`?Ze.value=!0:e?.stage===`end`?Ze.value=!1:it()}async function Tt(){Je(`copyAlt`,{config:E.value,dataset:V.value}),E.value.userOptions.callbacks.altCopy?await Promise.resolve(E.value.userOptions.callbacks.altCopy({config:E.value,dataset:V.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}return _e({generatePdf:rt,generateImage:it,generateCsv:yt,restoreOrder:q,copyAlt:Tt}),(e,r)=>(g(),u(`div`,{ref_key:`tableContainer`,ref:P,class:m({"vue-data-ui-component":!0,"vue-ui-table-sparkline":!0,"vue-ui-responsive":F.value}),style:{overflow:`hidden`},id:`table_${C.value}`,onMouseenter:r[3]||=()=>b(Qe)(!0),onMouseleave:r[4]||=()=>b(Qe)(!1)},[j.value.text?(g(),u(`div`,{key:0,class:`vue-ui-table-sparkline-caption`,style:h({backgroundColor:j.value.backgroundColor})},[d(`div`,{class:`atom-title`,style:h({fontSize:`${j.value.fontSize}px`,fontWeight:j.value.bold?`bold`:`normal`,color:j.value.color,textAlign:j.value.textAlign})},y(j.value.text),5),j.value.subtitle.text?(g(),u(`div`,{key:0,class:`atom-subtitle`,style:h({fontSize:`${j.value.subtitle.fontSize}px`,fontWeight:j.value.subtitle.bold?`bold`:`normal`,color:j.value.subtitle.color,textAlign:j.value.textAlign})},y(j.value.subtitle.text),5)):l(``,!0)],4)):l(``,!0),d(`div`,{style:{overflow:`auto`},onPointerleave:r[2]||=e=>{ht.value=void 0,Q.value=void 0}},[d(`table`,{class:`vue-ui-data-table`,style:h({fontFamily:E.value.fontFamily,position:`relative`})},[d(`thead`,Ne,[Ae((g(),u(`tr`,{role:`row`,class:`vue-ui-data-table__thead-row`,style:h({backgroundColor:k.value.backgroundColor,color:k.value.color})},[d(`th`,{role:`cell`,style:h({backgroundColor:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`}),class:`sticky-col-first`},[d(`div`,{style:h({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[d(`span`,null,y(E.value.translations.serie),1),U.value.length>1&&E.value.sortedSeriesName?(g(),u(`div`,Pe,[d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:r[0]||=e=>J({type:`name`},null,-1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:h({opacity:Z.value===`name`&&X.value.name===-1?1:.3})},null,8,[`stroke`,`style`])],4),d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:r[1]||=e=>J({type:`name`},null,1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:h({opacity:Z.value===`name`&&X.value.name===1?1:.3})},null,8,[`stroke`,`style`])],4)])):l(``,!0)],4)],4),(g(!0),u(s,null,v(Y.value,(r,i)=>(g(),u(`th`,{role:`cell`,style:h({background:k.value.backgroundColor,border:k.value.outline,textAlign:k.value.textAlign,fontWeight:k.value.bold?`bold`:`normal`,minWidth:i===Y.value.length-1?`${O.value.dimensions.width}px`:`48px`,paddingRight:i===Y.value.length-1&&D.value.show?`36px`:``}),class:m({"sticky-col":i===Y.value.length-1&&E.value.showSparklines})},[d(`div`,{style:h({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`3px`,justifyContent:k.value.textAlign})},[d(`span`,null,y(r.value),1),U.value.length>1&&(bt(i)||xt(r))?(g(),u(`div`,Fe,[d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-down`,onClick:()=>J(r,i,-1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowBottom`,stroke:k.value.color,style:h({opacity:St(i,r,-1)})},null,8,[`stroke`,`style`])],12,Ie),d(`button`,{class:`vue-ui-table-sparkline-sorting-button vue-ui-table-sparkline-sorting-button-up`,onClick:()=>J(r,i,1),style:h({cursor:M.value?`pointer`:`default`})},[f(b(x),{size:12,name:`arrowTop`,stroke:k.value.color,style:h({opacity:St(i,r,1)})},null,8,[`stroke`,`style`])],12,Le)])):l(``,!0)],4),D.value.show&&i===Y.value.length-1&&(b($e)||b(N))?(g(),ve(b(Ke),{ref_for:!0,ref:`details`,key:`user_option_${Ye.value}`,backgroundColor:k.value.backgroundColor,color:k.value.color,isPrinting:b(tt),isImaging:b(nt),uid:C.value,hasPdf:D.value.buttons.pdf,hasXls:D.value.buttons.csv,hasImg:D.value.buttons.img,hasFullscreen:D.value.buttons.fullscreen,hasAltCopy:D.value.buttons.altCopy,isFullscreen:_t.value,titles:{...D.value.buttonTitles},chartElement:P.value,position:D.value.position,callbacks:D.value.callbacks,printScale:D.value.print.scale,isCursorPointer:M.value,onToggleFullscreen:vt,onGeneratePdf:b(rt),onGenerateImage:wt,onGenerateCsv:yt,onCopyAlt:Tt,style:h({visibility:b($e)?b(N)?`visible`:`hidden`:`visible`})},ye({_:2},[v(b(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionFullscreen optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:ke(r=>[we(e.$slots,t,be({ref_for:!0},b(n)(t,r)),void 0,!0)])}))]),1032,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasPdf`,`hasXls`,`hasImg`,`hasFullscreen`,`hasAltCopy`,`isFullscreen`,`titles`,`chartElement`,`position`,`callbacks`,`printScale`,`isCursorPointer`,`onGeneratePdf`,`style`])):l(``,!0)],6))),256))],4)),[[b(he),Ct]])]),d(`tbody`,null,[(g(!0),u(s,null,v(U.value,(e,t)=>(g(),u(`tr`,{role:`row`,style:h({backgroundColor:A.value.backgroundColor,color:A.value.color}),class:m({"vue-ui-data-table__tbody__row":!0,"vue-ui-data-table__tbody__row-even":t%2==0,"vue-ui-data-table__tbody__row-odd":t%2!=0})},[d(`td`,{role:`cell`,style:h({backgroundColor:A.value.backgroundColor,border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.serie,class:`vue-ui-data-table__tbody__td sticky-col-first`},[d(`div`,{dir:`auto`,style:h({display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`6px`,justifyContent:A.value.textAlign})},[A.value.showColorMarker?(g(),u(`span`,{key:0,style:h({color:e.color})},`⬤`,4)):l(``,!0),d(`span`,null,y(e.name??`-`),1)],4)],12,Re),(g(!0),u(s,null,v(dt.value,(n,r)=>(g(),u(`td`,{dir:`auto`,role:`cell`,ref_for:!0,ref_key:`TD`,ref:T,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,background:Q.value!==void 0&&r===Q.value?A.value.selectedColor.useSerieColor?b(ee)(e.color,20):A.value.selectedColor.fallback:``}),"data-cell":Y.value[r]?Y.value[r].value:``,class:`vue-ui-data-table__tbody__td`,onPointerenter:e=>{ht.value=t,Q.value=r}},y(B(e.values[r],E.value.roundingValues,{datapoint:e,seriesIndex:t,datapointIndex:r})),45,ze))),256)),E.value.showTotal?(g(),u(`td`,{key:0,dir:`auto`,role:`cell`,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.total,class:`vue-ui-data-table__tbody__td`},y(B(e.sum,E.value.roundingTotal,{datapoint:e.sum,seriesIndex:t})),13,Be)):l(``,!0),E.value.showAverage?(g(),u(`td`,{key:1,dir:`auto`,role:`cell`,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.average,class:`vue-ui-data-table__tbody__td`},y(B(e.average,E.value.roundingAverage,{datapoint:e.average,seriesIndex:t})),13,Ve)):l(``,!0),E.value.showMedian?(g(),u(`td`,{key:2,dir:`auto`,role:`cell`,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign}),"data-cell":E.value.translations.median,class:`vue-ui-data-table__tbody__td`},y(B(e.median,E.value.roundingMedian,{datapoint:e.median,seriesIndex:t})),13,He)):l(``,!0),E.value.showSparklines?(g(),u(`td`,{key:3,role:`cell`,"data-cell":E.value.translations.chart,style:h({border:A.value.outline,fontSize:`${A.value.fontSize}px`,fontWeight:A.value.bold?`bold`:`normal`,textAlign:A.value.textAlign,backgroundColor:A.value.backgroundColor,padding:`0`}),class:`vue-ui-data-table__tbody__td sticky-col`},[f(b(Ge),{onHoverIndex:({index:e})=>gt({dataIndex:e,serieIndex:t}),"height-ratio":O.value.dimensions.heightRatio,"forced-padding":30,dataset:e.sparklineDataset,showInfo:!1,selectedIndex:Q.value,config:{type:O.value.type,style:{backgroundColor:`transparent`,animation:{show:O.value.animation.show&&!b(tt)&&!b(nt),animationFrames:O.value.animation.animationFrames},padding:{right:12},line:{color:e.color,smooth:O.value.smooth,cutNullValues:O.value.cutNullValues,strokeWidth:O.value.strokeWidth},bar:{color:e.color},area:{color:e.color,opacity:O.value.showArea?16:0,useGradient:O.value.useGradient},verticalIndicator:{color:e.color},plot:{radius:9,stroke:A.value.backgroundColor,strokeWidth:3}}}},null,8,[`onHoverIndex`,`height-ratio`,`dataset`,`selectedIndex`,`config`])],12,Ue)):l(``,!0)],6))),256))])],4)],32),e.$slots.source?(g(),u(`div`,We,[we(e.$slots,`source`,{},void 0,!0)],512)):l(``,!0)],42,Me))}},[[`__scopeId`,`data-v-bb68c573`]]);export{je as n,Ge as t};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useAnimationFrame-D8gcRfnW.js";import{n,r,t as i}from"./userOptionsSlots-CWtXN5Q6.js";import{n as a,r as ee,t as te}from"./annotationSlots-OLiW25XN.js";import{n as ne}from"./resolveChartConfig-0IvbmIE_.js";import{$ as re,Ht as o,Jt as ie,S as s,X as ae,at as oe,b as c,i as se,in as ce,t as le,w as ue,yt as de,zt as fe}from"./lib-rPeBMZrn.js";import{c as pe}from"./canvas-lib-22VpOI4_.js";import{n as me,t as he}from"./useHints-C-TwxM0Y.js";import{t as ge}from"./useConfig-CXhXxWjB.js";import{t as _e}from"./useLoading-DoqqfnmS.js";import{t as ve}from"./usePrinter-DVf3YcG5.js";import{t as ye}from"./useResponsive-CENUxfEL.js";import{t as be}from"./useChartExport-BZts4KFb.js";import{t as xe}from"./useUserOptionState-CXlFnwPv.js";import{t as Se}from"./useChartAccessibility-DOMuYJfm.js";import{t as Ce}from"./usePrefersMotion-XLHwega2.js";import{t as we}from"./useAutoSizeLabelsInsideViewbox-AIRF0PlD.js";import{t as Te}from"./vue_ui_thermometer-DsLnfqd2.js";import{n as Ee}from"./Title-BliHuXfT.js";import{t as De}from"./img-D4RQwASc.js";import{t as Oe}from"./BaseScanner-m6QR9rwD.js";import{t as ke}from"./DefGrad-DKMq1REY.js";import{t as Ae}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as l,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as m,createSlots as je,createVNode as Me,defineAsyncComponent as h,guardReactiveProps as g,mergeProps as Ne,normalizeClass as _,normalizeProps as v,normalizeStyle as Pe,onBeforeUnmount as Fe,onMounted as Ie,openBlock as y,ref as b,renderList as x,renderSlot as S,toDisplayString as C,toRefs as Le,unref as w,useCssVars as Re,watch as ze,withCtx as Be}from"vue";var Ve=/* @__PURE__ */ e({default:()=>T}),He=[`id`],Ue={key:1,ref:`noTitle`,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},We=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],Ge=[`id`],Ke=[`id`],qe=[`width`,`height`],Je=[`id`],Ye=[`x`,`y`,`width`,`height`,`rx`,`ry`],Xe=[`clip-path`],Ze=[`x`,`y`,`height`,`width`],Qe=[`x`,`y`,`height`,`width`,`fill`],$e=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],et=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],tt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],nt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],rt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],it=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],at=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],ot=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],st=[`x`,`y`,`height`,`width`],ct=[`aria-label`],lt=[`x`,`y`,`height`],ut=[`y`,`x`,`fill`,`font-size`,`font-weight`],dt={key:4,class:`vue-data-ui-watermark`},T=/*#__PURE__*/ Ae({__name:`vue-ui-thermometer`,props:{dataset:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:Ae,emit:Ve}){Re(e=>({fdaea97c:zt.value,dee374e8:Rt.value,v77c7cd79:Lt.value}));let T=h(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),ft=h(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),pt=h(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),{vue_ui_thermometer:mt}=ge(),ht=Ce(),E=e,gt=Ve,D=b(ae()),O=b(null),_t=b(0),vt=b(0),yt=b(null),bt=b(null),k=b(null),A=b(null),xt=t(),j=0;function St(){j+=1,xt.cancel(),k.value?.disconnect(),k.value=null,A.value=null}Fe(St);let Ct=u(()=>!!E.dataset&&Object.keys(E.dataset).length);Ie(()=>{Ot()});let M=b(V()),N=u(()=>M.value.userOptions),P=u(()=>M.value.style.chart.graduations),F=u(()=>M.value.style.chart);me({config:()=>M.value,dataset:()=>E.dataset,component:`VueUiThermometer`,rules:[he.noHint]});let wt=b(F.value.thermometer.width),I=b(F.value.height),L=b(F.value.width),Tt=u(()=>M.value.userOptions.useCursorPointer),Et=u(()=>ce({defaultConfig:{userOptions:{show:!1},style:{chart:{animation:{use:!1},backgroundColor:`#99999930`,graduations:{stroke:`#6A6A6A`}}}},userConfig:M.value.skeletonConfig??{}})),{loading:R,FINAL_DATASET:z}=_e({...Le(E),FINAL_CONFIG:M,prepareConfig:V,skeletonDataset:E.config?.skeletonDataset??{value:0,from:-100,to:100,steps:20,colors:{from:`#A1A1A1`,to:`#CACACA`}},skeletonConfig:ce({defaultConfig:M.value,userConfig:Et.value})}),Dt=u(()=>M.value.debug);function Ot(){if(St(),fe(E.dataset)?oe({componentName:`VueUiThermometer`,type:`dataset`,debug:Dt.value}):de({datasetObject:E.dataset,requiredAttributes:[`value`,`from`,`to`]}).forEach(e=>{oe({componentName:`VueUiThermometer`,type:`datasetAttribute`,property:e,debug:Dt.value})}),M.value.responsive&&O.value){let e=j,t=pe(()=>{if(e!==j||xt.isDisposed())return;let{width:t,height:n}=ye({chart:O.value,title:M.value.style.title.text?yt.value:null,source:bt.value});xt.request(()=>{I.value=Math.max(.1,n-12),L.value=t,Gt()})});k.value=new ResizeObserver(t),A.value=O.value,k.value.observe(A.value)}Gt()}let{userOptionsVisible:kt,setUserOptionsVisibility:At,keepUserOptionState:jt}=xe({config:M.value}),{svgRef:B}=Se({config:M.value.style.title});function V(){return ne(E.config,mt,Te)}ze(()=>E.config,e=>{M.value=V(),kt.value=!M.value.userOptions.showOnChartHover,wt.value=F.value.thermometer.width,I.value=F.value.height,L.value=F.value.width,Ot(),vt.value+=1},{deep:!0});let{isPrinting:H,isImaging:U,generatePdf:Mt,generateImage:Nt}=ve({elementId:`thermometer__${D.value}`,fileName:M.value.style.title.text||`vue-ui-thermometer`,options:M.value.userOptions.print}),Pt=u(()=>M.value.userOptions.show&&!M.value.style.title.text),W=u(()=>ue(M.value.customPalette)),G=u(()=>z.value.steps||10);function K(e,t,n){let r=[],i=Ft(e),a=Ft(t);for(let e=0;e<n;e+=1){let t=q(i.red,a.red,e,n),ee=q(i.green,a.green,e,n),te=q(i.blue,a.blue,e,n),ne=`#${J(t)}${J(ee)}${J(te)}`;r.push(ne)}return r}function Ft(e){let t=e.slice(1);return{red:parseInt(t.slice(0,2),16),green:parseInt(t.slice(2,4),16),blue:parseInt(t.slice(4,6),16)}}function q(e,t,n,r){return Math.round(e+(t-e)*n/r)}function J(e){return e.toString(16).padStart(2,`0`)}let Y=u(()=>{let e=Math.max(.1,L.value),t=Math.max(.1,I.value),n=F.value.padding;return{width:e,left:e/2-F.value.thermometer.width/2,right:e/2+F.value.thermometer.width/2,top:n.top,bottom:t-n.bottom-n.top,height:t,thermoHeight:t-n.top-n.bottom,thermoWidth:F.value.thermometer.width}}),It=u(()=>Y.value),X=u(()=>{let e=c(z.value.from)<0?Math.abs(c(z.value.from)):c(z.value.from),t=c(z.value.to)<0?Math.abs(c(z.value.to)):c(z.value.to),n=0;return n=c(z.value.to)>0?e+t:e>t?e-t:t-e,(1-(Math.abs(c(z.value.from))+c(z.value.value))/n)*Y.value.thermoHeight}),Lt=u(()=>`${X.value}px`),Rt=u(()=>`${Y.value.thermoHeight}px`),zt=u(()=>ht.value?`0ms`:`${F.value.animation.speedMs}ms`),Bt=u(()=>{if(z.value.colors){if(!z.value.colors.from)return K(W.value[0]||o[0],s(z.value.colors.to),G.value||10);if(!z.value.colors.to)return K(s(z.value.colors.from),W.value[1]||o[1],G.value||10)}else return K(W.value[1]||o[1],W.value[0]||o[0],G.value||10);return K(s(z.value.colors.from),s(z.value.colors.to),G.value||10)}),Vt=u(()=>{let e=[],t=0,n=Y.value.thermoHeight;for(let r=0;r<n-1;r+=n/G.value)e.push({x:Y.value.left,y:Y.value.top+r,qYLess:Y.value.top+r+n/G.value/4,halfY:Y.value.top+r+n/G.value/2,qYMore:Y.value.top+r+n/G.value/4*3,color:Bt.value[t],height:Math.max(.1,n/G.value)}),t+=1;return e}),Z=b(!1);function Ht(e){Z.value=e,_t.value+=1}let Q=b(!1);function Ut(){Q.value=!Q.value}async function Wt({scale:e=2}={}){if(!O.value)return;let{width:t,height:n}=O.value.getBoundingClientRect(),r=t/n,{imageUri:i,base64:a}=await De({domElement:O.value,base64:!0,img:!0,scale:e});return{imageUri:i,base64:a,title:M.value.style.title.text,width:t,height:n,aspectRatio:r}}let $=u({get:()=>F.value.label.fontSize,set:e=>e}),{autoSizeLabels:Gt}=we({svgRef:B,fontSize:F.value.label.fontSize,minFontSize:F.value.label.minFontSize,sizeRef:$,labelClass:`.vue-ui-thermometer-label`}),Kt=u(()=>F.value.backgroundColor),qt=u(()=>M.value.style.title),{isCallbackImaging:Jt,isCallbackSvg:Yt,generateSvg:Xt,onGenerateImage:Zt}=be({svg:B,title:qt,legend:null,legendItems:null,backgroundColor:Kt,getSvgCallback:()=>M.value.userOptions.callbacks.svg,generateImage:Nt});async function Qt(){gt(`copyAlt`,{config:M.value,dataset:z.value}),M.value.userOptions.callbacks.altCopy?await Promise.resolve(M.value.userOptions.callbacks.altCopy({config:M.value,dataset:z.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let $t=u(()=>`${D.value}-title`),en=u(()=>`${D.value}-desc`),tn=u(()=>se(F.value.label.formatter,z.value.value,re({p:F.value.label.prefix,v:z.value.value,s:F.value.label.suffix,r:F.value.label.rounding}),{datapoint:z.value})),nn=u(()=>M.value.style.title.text||``),rn=u(()=>{if(R.value)return`...`;let e=c(z.value.from),t=c(z.value.to);return`Thermometer value: ${tn.value}. Range: ${e} to ${t}.`});return Ae({getImage:Wt,generatePdf:Mt,generateImage:Nt,generateSvg:Xt,toggleAnnotator:Ut,toggleFullscreen:Ht,copyAlt:Qt}),(e,t)=>(y(),p(`div`,{ref_key:`thermoChart`,ref:O,class:_(`vue-data-ui-component vue-ui-thermometer ${Z.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:Pe(`width:100%;background:${F.value.backgroundColor};color:${F.value.color};font-family:${M.value.style.fontFamily}`),id:`thermometer__${D.value}`,onMouseenter:t[0]||=()=>w(At)(!0),onMouseleave:t[1]||=()=>w(At)(!1)},[N.value.buttons.annotator?(y(),d(w(ft),Ne({key:0},w(ee)(N.value.annotator),{svgRef:w(B),backgroundColor:F.value.backgroundColor,color:F.value.color,active:Q.value,isCursorPointer:Tt.value,palette:N.value.annotatorPalette,onClose:Ut}),je({_:2},[x(w(te),t=>({name:t,fn:Be(n=>[S(e.$slots,t,v(g(w(a)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),Pt.value?(y(),p(`div`,Ue,null,512)):f(``,!0),M.value.style.title.text?(y(),p(`div`,{key:2,ref_key:`chartTitle`,ref:yt,style:`width:100%`},[(y(),d(Ee,{key:`title_${vt.value}`,config:{title:{cy:`thermometer-div-title`,...M.value.style.title},subtitle:{cy:`thermometer-div-subtitle`,...M.value.style.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),N.value.show&&Ct.value&&(w(jt)||w(kt))?(y(),d(w(pt),Ne({ref:`details`,key:`user_options_${_t.value}`,backgroundColor:F.value.backgroundColor,color:F.value.color,isImaging:w(U),isPrinting:w(H),uid:D.value,hasXls:!1,isFullscreen:Z.value,chartElement:O.value},w(r)(N.value,`pdf img svg fullscreen altCopy annotator`),{isAnnotation:Q.value,isCursorPointer:Tt.value,onToggleFullscreen:Ht,onGeneratePdf:w(Mt),onGenerateImage:w(Zt),onGenerateSvg:w(Xt),onToggleAnnotator:Ut,onCopyAlt:Qt,style:{visibility:w(jt)?w(kt)?`visible`:`hidden`:`visible`}}),je({_:2},[x(w(n)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Be(n=>[S(e.$slots,t,v(g(w(i)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isImaging`,`isPrinting`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),(y(),p(`svg`,{ref_key:`svgRef`,ref:B,xmlns:w(le),class:_({"vue-data-ui-fullscreen--on":Z.value,"vue-data-ui-fulscreen--off":!Z.value}),width:`100%`,viewBox:`0 0 ${Y.value.width} ${Y.value.height}`,style:`background:transparent`,"aria-labelledby":$t.value,"aria-describedby":en.value},[m(`title`,{id:$t.value},C(nn.value),9,Ge),m(`desc`,{id:en.value},C(rn.value),9,Ke),Me(w(T)),S(e.$slots,`svg-underlayer`,{svg:{...It.value,isPrintingImg:w(H)||w(U)||w(Jt),isPrintingSvg:w(Yt)}},void 0,!0),e.$slots[`chart-background`]?(y(),p(`foreignObject`,{key:0,x:0,y:0,width:Y.value.width,height:Y.value.height,style:{pointerEvents:`none`}},[S(e.$slots,`chart-background`,{},void 0,!0)],8,qe)):f(``,!0),m(`defs`,null,[m(`clipPath`,{id:`vueUiPill-${D.value}`,clipPathUnits:`userSpaceOnUse`},[m(`rect`,{x:Y.value.left,y:Y.value.top,width:Y.value.thermoWidth,height:Y.value.thermoHeight,rx:Y.value.thermoWidth/2,ry:Y.value.thermoWidth/2},null,8,Ye)],8,Je),(y(!0),p(l,null,x(Vt.value,(e,t)=>(y(),d(ke,{t:`linear`,id:`vueUiThermometerGradient_${t}_${D.value}`,key:`t_${t}_${D.value}`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,stops:[[`0%`,e.color,1],[`50%`,w(ie)(e.color,100-P.value.gradient.intensity),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128))]),m(`g`,{"clip-path":`url(#vueUiPill-${D.value})`},[m(`rect`,{x:Y.value.left,y:Y.value.top,height:Y.value.thermoHeight,width:Y.value.thermoWidth,fill:`#FFFFFF`},null,8,Ze),(y(!0),p(l,null,x(Vt.value,(e,t)=>(y(),p(`g`,{key:`graduation_${t}`},[m(`rect`,{x:e.x,y:e.y,height:e.height,width:Y.value.thermoWidth,fill:P.value.gradient.show?`url(#vueUiThermometerGradient_${t}_${D.value})`:e.color,"shape-rendering":`crispEdges`},null,8,Qe),P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:0,x1:e.x,x2:e.x+10,y1:e.y,y2:e.y,"stroke-width":P.value.strokeWidth,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,$e)):f(``,!0),P.value.showIntermediate?(y(),p(l,{key:1},[P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:0,x1:e.x,x2:e.x+5,y1:e.halfY,y2:e.halfY,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,et)):f(``,!0),P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:1,x1:e.x,x2:e.x+2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,tt)):f(``,!0),P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:2,x1:e.x,x2:e.x+2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,nt)):f(``,!0)],64)):f(``,!0),P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:2,x1:Y.value.right,x2:Y.value.right-10,y1:e.y,y2:e.y,"stroke-width":P.value.strokeWidth,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,rt)):f(``,!0),P.value.showIntermediate?(y(),p(l,{key:3},[P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:0,x1:Y.value.right,x2:Y.value.right-5,y1:e.halfY,y2:e.halfY,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,it)):f(``,!0),P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:1,x1:Y.value.right,x2:Y.value.right-2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,at)):f(``,!0),P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:2,x1:Y.value.right,x2:Y.value.right-2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,ot)):f(``,!0)],64)):f(``,!0)]))),128)),m(`rect`,{class:_({"vue-ui-thermometer-temperature":F.value.animation.use}),x:Y.value.left,y:Y.value.top,height:X.value,width:Y.value.thermoWidth,fill:`#FFFFFF66`},null,10,st)],8,Xe),F.value.label.show?(y(),p(`g`,{key:1,role:`status`,"aria-live":`polite`,"aria-label":w(R)?`Loading data`:tn.value},[w(R)?(y(),p(`rect`,{key:0,x:Y.value.left-60,y:X.value+Y.value.top-$.value/2,width:50,height:$.value,fill:`#6A6A6A40`,rx:`3`},null,8,lt)):(y(),p(`text`,{key:1,"aria-hidden":`true`,class:_({"vue-ui-thermometer-temperature-value":F.value.animation.use,"vue-ui-thermometer-label":!0}),y:X.value+Y.value.top+$.value/3,x:Y.value.left-10,"text-anchor":`end`,fill:F.value.label.color,"font-size":$.value,"font-weight":F.value.label.bold?`bold`:`normal`},C(tn.value),11,ut))],8,ct)):f(``,!0),S(e.$slots,`svg`,{svg:{...It.value,isPrintingImg:w(H)||w(U)||w(Jt),isPrintingSvg:w(Yt)}},void 0,!0)],10,We)),e.$slots.watermark?(y(),p(`div`,dt,[S(e.$slots,`watermark`,v(g({isPrinting:w(H)||w(U)||w(Jt)||w(Yt)})),void 0,!0)])):f(``,!0),e.$slots.source?(y(),p(`div`,{key:5,ref_key:`source`,ref:bt,dir:`auto`},[S(e.$slots,`source`,{},void 0,!0)],512)):f(``,!0),S(e.$slots,`skeleton`,{},()=>[w(R)?(y(),d(Oe,{key:0})):f(``,!0)],!0)],46,He))}},[[`__scopeId`,`data-v-e6779ee0`]]);export{Ve as n,T as t};
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useAnimationFrame-D8gcRfnW.js";import{n,r,t as i}from"./userOptionsSlots-CWtXN5Q6.js";import{n as a,r as ee,t as te}from"./annotationSlots-OLiW25XN.js";import{n as ne}from"./resolveChartConfig-0IvbmIE_.js";import{$ as re,Ht as o,Jt as ie,S as s,X as ae,at as oe,b as c,i as se,in as ce,t as le,w as ue,yt as de,zt as fe}from"./lib-rPeBMZrn.js";import{c as pe}from"./canvas-lib-22VpOI4_.js";import{n as me,t as he}from"./useHints-C-TwxM0Y.js";import{t as ge}from"./useConfig-B8qvYKdK.js";import{t as _e}from"./useLoading-DoqqfnmS.js";import{t as ve}from"./usePrinter-DVf3YcG5.js";import{t as ye}from"./useResponsive-CENUxfEL.js";import{t as be}from"./useChartExport-BZts4KFb.js";import{t as xe}from"./useUserOptionState-CXlFnwPv.js";import{t as Se}from"./useChartAccessibility-DOMuYJfm.js";import{t as Ce}from"./usePrefersMotion-XLHwega2.js";import{t as we}from"./useAutoSizeLabelsInsideViewbox-AIRF0PlD.js";import{t as Te}from"./vue_ui_thermometer-DsLnfqd2.js";import{n as Ee}from"./Title-BliHuXfT.js";import{t as De}from"./img-D4RQwASc.js";import{t as Oe}from"./BaseScanner-m6QR9rwD.js";import{t as ke}from"./DefGrad-DKMq1REY.js";import{t as Ae}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as l,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as m,createSlots as je,createVNode as Me,defineAsyncComponent as h,guardReactiveProps as g,mergeProps as Ne,normalizeClass as _,normalizeProps as v,normalizeStyle as Pe,onBeforeUnmount as Fe,onMounted as Ie,openBlock as y,ref as b,renderList as x,renderSlot as S,toDisplayString as C,toRefs as Le,unref as w,useCssVars as Re,watch as ze,withCtx as Be}from"vue";var Ve=/* @__PURE__ */ e({default:()=>T}),He=[`id`],Ue={key:1,ref:`noTitle`,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},We=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],Ge=[`id`],Ke=[`id`],qe=[`width`,`height`],Je=[`id`],Ye=[`x`,`y`,`width`,`height`,`rx`,`ry`],Xe=[`clip-path`],Ze=[`x`,`y`,`height`,`width`],Qe=[`x`,`y`,`height`,`width`,`fill`],$e=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],et=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],tt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],nt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],rt=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],it=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],at=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],ot=[`x1`,`x2`,`y1`,`y2`,`stroke-width`,`stroke`],st=[`x`,`y`,`height`,`width`],ct=[`aria-label`],lt=[`x`,`y`,`height`],ut=[`y`,`x`,`fill`,`font-size`,`font-weight`],dt={key:4,class:`vue-data-ui-watermark`},T=/*#__PURE__*/ Ae({__name:`vue-ui-thermometer`,props:{dataset:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:Ae,emit:Ve}){Re(e=>({fdaea97c:zt.value,dee374e8:Rt.value,v77c7cd79:Lt.value}));let T=h(()=>import(`./PackageVersion-DAF5ApGl.js`).then(e=>e.t)),ft=h(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),pt=h(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),{vue_ui_thermometer:mt}=ge(),ht=Ce(),E=e,gt=Ve,D=b(ae()),O=b(null),_t=b(0),vt=b(0),yt=b(null),bt=b(null),k=b(null),A=b(null),xt=t(),j=0;function St(){j+=1,xt.cancel(),k.value?.disconnect(),k.value=null,A.value=null}Fe(St);let Ct=u(()=>!!E.dataset&&Object.keys(E.dataset).length);Ie(()=>{Ot()});let M=b(V()),N=u(()=>M.value.userOptions),P=u(()=>M.value.style.chart.graduations),F=u(()=>M.value.style.chart);me({config:()=>M.value,dataset:()=>E.dataset,component:`VueUiThermometer`,rules:[he.noHint]});let wt=b(F.value.thermometer.width),I=b(F.value.height),L=b(F.value.width),Tt=u(()=>M.value.userOptions.useCursorPointer),Et=u(()=>ce({defaultConfig:{userOptions:{show:!1},style:{chart:{animation:{use:!1},backgroundColor:`#99999930`,graduations:{stroke:`#6A6A6A`}}}},userConfig:M.value.skeletonConfig??{}})),{loading:R,FINAL_DATASET:z}=_e({...Le(E),FINAL_CONFIG:M,prepareConfig:V,skeletonDataset:E.config?.skeletonDataset??{value:0,from:-100,to:100,steps:20,colors:{from:`#A1A1A1`,to:`#CACACA`}},skeletonConfig:ce({defaultConfig:M.value,userConfig:Et.value})}),Dt=u(()=>M.value.debug);function Ot(){if(St(),fe(E.dataset)?oe({componentName:`VueUiThermometer`,type:`dataset`,debug:Dt.value}):de({datasetObject:E.dataset,requiredAttributes:[`value`,`from`,`to`]}).forEach(e=>{oe({componentName:`VueUiThermometer`,type:`datasetAttribute`,property:e,debug:Dt.value})}),M.value.responsive&&O.value){let e=j,t=pe(()=>{if(e!==j||xt.isDisposed())return;let{width:t,height:n}=ye({chart:O.value,title:M.value.style.title.text?yt.value:null,source:bt.value});xt.request(()=>{I.value=Math.max(.1,n-12),L.value=t,Gt()})});k.value=new ResizeObserver(t),A.value=O.value,k.value.observe(A.value)}Gt()}let{userOptionsVisible:kt,setUserOptionsVisibility:At,keepUserOptionState:jt}=xe({config:M.value}),{svgRef:B}=Se({config:M.value.style.title});function V(){return ne(E.config,mt,Te)}ze(()=>E.config,e=>{M.value=V(),kt.value=!M.value.userOptions.showOnChartHover,wt.value=F.value.thermometer.width,I.value=F.value.height,L.value=F.value.width,Ot(),vt.value+=1},{deep:!0});let{isPrinting:H,isImaging:U,generatePdf:Mt,generateImage:Nt}=ve({elementId:`thermometer__${D.value}`,fileName:M.value.style.title.text||`vue-ui-thermometer`,options:M.value.userOptions.print}),Pt=u(()=>M.value.userOptions.show&&!M.value.style.title.text),W=u(()=>ue(M.value.customPalette)),G=u(()=>z.value.steps||10);function K(e,t,n){let r=[],i=Ft(e),a=Ft(t);for(let e=0;e<n;e+=1){let t=q(i.red,a.red,e,n),ee=q(i.green,a.green,e,n),te=q(i.blue,a.blue,e,n),ne=`#${J(t)}${J(ee)}${J(te)}`;r.push(ne)}return r}function Ft(e){let t=e.slice(1);return{red:parseInt(t.slice(0,2),16),green:parseInt(t.slice(2,4),16),blue:parseInt(t.slice(4,6),16)}}function q(e,t,n,r){return Math.round(e+(t-e)*n/r)}function J(e){return e.toString(16).padStart(2,`0`)}let Y=u(()=>{let e=Math.max(.1,L.value),t=Math.max(.1,I.value),n=F.value.padding;return{width:e,left:e/2-F.value.thermometer.width/2,right:e/2+F.value.thermometer.width/2,top:n.top,bottom:t-n.bottom-n.top,height:t,thermoHeight:t-n.top-n.bottom,thermoWidth:F.value.thermometer.width}}),It=u(()=>Y.value),X=u(()=>{let e=c(z.value.from)<0?Math.abs(c(z.value.from)):c(z.value.from),t=c(z.value.to)<0?Math.abs(c(z.value.to)):c(z.value.to),n=0;return n=c(z.value.to)>0?e+t:e>t?e-t:t-e,(1-(Math.abs(c(z.value.from))+c(z.value.value))/n)*Y.value.thermoHeight}),Lt=u(()=>`${X.value}px`),Rt=u(()=>`${Y.value.thermoHeight}px`),zt=u(()=>ht.value?`0ms`:`${F.value.animation.speedMs}ms`),Bt=u(()=>{if(z.value.colors){if(!z.value.colors.from)return K(W.value[0]||o[0],s(z.value.colors.to),G.value||10);if(!z.value.colors.to)return K(s(z.value.colors.from),W.value[1]||o[1],G.value||10)}else return K(W.value[1]||o[1],W.value[0]||o[0],G.value||10);return K(s(z.value.colors.from),s(z.value.colors.to),G.value||10)}),Vt=u(()=>{let e=[],t=0,n=Y.value.thermoHeight;for(let r=0;r<n-1;r+=n/G.value)e.push({x:Y.value.left,y:Y.value.top+r,qYLess:Y.value.top+r+n/G.value/4,halfY:Y.value.top+r+n/G.value/2,qYMore:Y.value.top+r+n/G.value/4*3,color:Bt.value[t],height:Math.max(.1,n/G.value)}),t+=1;return e}),Z=b(!1);function Ht(e){Z.value=e,_t.value+=1}let Q=b(!1);function Ut(){Q.value=!Q.value}async function Wt({scale:e=2}={}){if(!O.value)return;let{width:t,height:n}=O.value.getBoundingClientRect(),r=t/n,{imageUri:i,base64:a}=await De({domElement:O.value,base64:!0,img:!0,scale:e});return{imageUri:i,base64:a,title:M.value.style.title.text,width:t,height:n,aspectRatio:r}}let $=u({get:()=>F.value.label.fontSize,set:e=>e}),{autoSizeLabels:Gt}=we({svgRef:B,fontSize:F.value.label.fontSize,minFontSize:F.value.label.minFontSize,sizeRef:$,labelClass:`.vue-ui-thermometer-label`}),Kt=u(()=>F.value.backgroundColor),qt=u(()=>M.value.style.title),{isCallbackImaging:Jt,isCallbackSvg:Yt,generateSvg:Xt,onGenerateImage:Zt}=be({svg:B,title:qt,legend:null,legendItems:null,backgroundColor:Kt,getSvgCallback:()=>M.value.userOptions.callbacks.svg,generateImage:Nt});async function Qt(){gt(`copyAlt`,{config:M.value,dataset:z.value}),M.value.userOptions.callbacks.altCopy?await Promise.resolve(M.value.userOptions.callbacks.altCopy({config:M.value,dataset:z.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let $t=u(()=>`${D.value}-title`),en=u(()=>`${D.value}-desc`),tn=u(()=>se(F.value.label.formatter,z.value.value,re({p:F.value.label.prefix,v:z.value.value,s:F.value.label.suffix,r:F.value.label.rounding}),{datapoint:z.value})),nn=u(()=>M.value.style.title.text||``),rn=u(()=>{if(R.value)return`...`;let e=c(z.value.from),t=c(z.value.to);return`Thermometer value: ${tn.value}. Range: ${e} to ${t}.`});return Ae({getImage:Wt,generatePdf:Mt,generateImage:Nt,generateSvg:Xt,toggleAnnotator:Ut,toggleFullscreen:Ht,copyAlt:Qt}),(e,t)=>(y(),p(`div`,{ref_key:`thermoChart`,ref:O,class:_(`vue-data-ui-component vue-ui-thermometer ${Z.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:Pe(`width:100%;background:${F.value.backgroundColor};color:${F.value.color};font-family:${M.value.style.fontFamily}`),id:`thermometer__${D.value}`,onMouseenter:t[0]||=()=>w(At)(!0),onMouseleave:t[1]||=()=>w(At)(!1)},[N.value.buttons.annotator?(y(),d(w(ft),Ne({key:0},w(ee)(N.value.annotator),{svgRef:w(B),backgroundColor:F.value.backgroundColor,color:F.value.color,active:Q.value,isCursorPointer:Tt.value,palette:N.value.annotatorPalette,onClose:Ut}),je({_:2},[x(w(te),t=>({name:t,fn:Be(n=>[S(e.$slots,t,v(g(w(a)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),Pt.value?(y(),p(`div`,Ue,null,512)):f(``,!0),M.value.style.title.text?(y(),p(`div`,{key:2,ref_key:`chartTitle`,ref:yt,style:`width:100%`},[(y(),d(Ee,{key:`title_${vt.value}`,config:{title:{cy:`thermometer-div-title`,...M.value.style.title},subtitle:{cy:`thermometer-div-subtitle`,...M.value.style.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),N.value.show&&Ct.value&&(w(jt)||w(kt))?(y(),d(w(pt),Ne({ref:`details`,key:`user_options_${_t.value}`,backgroundColor:F.value.backgroundColor,color:F.value.color,isImaging:w(U),isPrinting:w(H),uid:D.value,hasXls:!1,isFullscreen:Z.value,chartElement:O.value},w(r)(N.value,`pdf img svg fullscreen altCopy annotator`),{isAnnotation:Q.value,isCursorPointer:Tt.value,onToggleFullscreen:Ht,onGeneratePdf:w(Mt),onGenerateImage:w(Zt),onGenerateSvg:w(Xt),onToggleAnnotator:Ut,onCopyAlt:Qt,style:{visibility:w(jt)?w(kt)?`visible`:`hidden`:`visible`}}),je({_:2},[x(w(n)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Be(n=>[S(e.$slots,t,v(g(w(i)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isImaging`,`isPrinting`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),(y(),p(`svg`,{ref_key:`svgRef`,ref:B,xmlns:w(le),class:_({"vue-data-ui-fullscreen--on":Z.value,"vue-data-ui-fulscreen--off":!Z.value}),width:`100%`,viewBox:`0 0 ${Y.value.width} ${Y.value.height}`,style:`background:transparent`,"aria-labelledby":$t.value,"aria-describedby":en.value},[m(`title`,{id:$t.value},C(nn.value),9,Ge),m(`desc`,{id:en.value},C(rn.value),9,Ke),Me(w(T)),S(e.$slots,`svg-underlayer`,{svg:{...It.value,isPrintingImg:w(H)||w(U)||w(Jt),isPrintingSvg:w(Yt)}},void 0,!0),e.$slots[`chart-background`]?(y(),p(`foreignObject`,{key:0,x:0,y:0,width:Y.value.width,height:Y.value.height,style:{pointerEvents:`none`}},[S(e.$slots,`chart-background`,{},void 0,!0)],8,qe)):f(``,!0),m(`defs`,null,[m(`clipPath`,{id:`vueUiPill-${D.value}`,clipPathUnits:`userSpaceOnUse`},[m(`rect`,{x:Y.value.left,y:Y.value.top,width:Y.value.thermoWidth,height:Y.value.thermoHeight,rx:Y.value.thermoWidth/2,ry:Y.value.thermoWidth/2},null,8,Ye)],8,Je),(y(!0),p(l,null,x(Vt.value,(e,t)=>(y(),d(ke,{t:`linear`,id:`vueUiThermometerGradient_${t}_${D.value}`,key:`t_${t}_${D.value}`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,stops:[[`0%`,e.color,1],[`50%`,w(ie)(e.color,100-P.value.gradient.intensity),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128))]),m(`g`,{"clip-path":`url(#vueUiPill-${D.value})`},[m(`rect`,{x:Y.value.left,y:Y.value.top,height:Y.value.thermoHeight,width:Y.value.thermoWidth,fill:`#FFFFFF`},null,8,Ze),(y(!0),p(l,null,x(Vt.value,(e,t)=>(y(),p(`g`,{key:`graduation_${t}`},[m(`rect`,{x:e.x,y:e.y,height:e.height,width:Y.value.thermoWidth,fill:P.value.gradient.show?`url(#vueUiThermometerGradient_${t}_${D.value})`:e.color,"shape-rendering":`crispEdges`},null,8,Qe),P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:0,x1:e.x,x2:e.x+10,y1:e.y,y2:e.y,"stroke-width":P.value.strokeWidth,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,$e)):f(``,!0),P.value.showIntermediate?(y(),p(l,{key:1},[P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:0,x1:e.x,x2:e.x+5,y1:e.halfY,y2:e.halfY,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,et)):f(``,!0),P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:1,x1:e.x,x2:e.x+2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,tt)):f(``,!0),P.value.show&&[`both`,`left`].includes(P.value.sides)?(y(),p(`line`,{key:2,x1:e.x,x2:e.x+2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,nt)):f(``,!0)],64)):f(``,!0),P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:2,x1:Y.value.right,x2:Y.value.right-10,y1:e.y,y2:e.y,"stroke-width":P.value.strokeWidth,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,rt)):f(``,!0),P.value.showIntermediate?(y(),p(l,{key:3},[P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:0,x1:Y.value.right,x2:Y.value.right-5,y1:e.halfY,y2:e.halfY,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,it)):f(``,!0),P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:1,x1:Y.value.right,x2:Y.value.right-2.5,y1:e.qYLess,y2:e.qYLess,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,at)):f(``,!0),P.value.show&&[`both`,`right`].includes(P.value.sides)?(y(),p(`line`,{key:2,x1:Y.value.right,x2:Y.value.right-2.5,y1:e.qYMore,y2:e.qYMore,"stroke-width":P.value.strokeWidth/2,stroke:P.value.stroke,"stroke-linecap":`round`},null,8,ot)):f(``,!0)],64)):f(``,!0)]))),128)),m(`rect`,{class:_({"vue-ui-thermometer-temperature":F.value.animation.use}),x:Y.value.left,y:Y.value.top,height:X.value,width:Y.value.thermoWidth,fill:`#FFFFFF66`},null,10,st)],8,Xe),F.value.label.show?(y(),p(`g`,{key:1,role:`status`,"aria-live":`polite`,"aria-label":w(R)?`Loading data`:tn.value},[w(R)?(y(),p(`rect`,{key:0,x:Y.value.left-60,y:X.value+Y.value.top-$.value/2,width:50,height:$.value,fill:`#6A6A6A40`,rx:`3`},null,8,lt)):(y(),p(`text`,{key:1,"aria-hidden":`true`,class:_({"vue-ui-thermometer-temperature-value":F.value.animation.use,"vue-ui-thermometer-label":!0}),y:X.value+Y.value.top+$.value/3,x:Y.value.left-10,"text-anchor":`end`,fill:F.value.label.color,"font-size":$.value,"font-weight":F.value.label.bold?`bold`:`normal`},C(tn.value),11,ut))],8,ct)):f(``,!0),S(e.$slots,`svg`,{svg:{...It.value,isPrintingImg:w(H)||w(U)||w(Jt),isPrintingSvg:w(Yt)}},void 0,!0)],10,We)),e.$slots.watermark?(y(),p(`div`,dt,[S(e.$slots,`watermark`,v(g({isPrinting:w(H)||w(U)||w(Jt)||w(Yt)})),void 0,!0)])):f(``,!0),e.$slots.source?(y(),p(`div`,{key:5,ref_key:`source`,ref:bt,dir:`auto`},[S(e.$slots,`source`,{},void 0,!0)],512)):f(``,!0),S(e.$slots,`skeleton`,{},()=>[w(R)?(y(),d(Oe,{key:0})):f(``,!0)],!0)],46,He))}},[[`__scopeId`,`data-v-e6779ee0`]]);export{Ve as n,T as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useNestedProp-DnGoh-XS.js";import{X as n,rn as r,t as i}from"./lib-rPeBMZrn.js";import{c as a}from"./canvas-lib-22VpOI4_.js";import{t as o}from"./useResponsive-CENUxfEL.js";import{n as s,t as c}from"./useHints-C-TwxM0Y.js";import{t as l}from"./useConfig-CXhXxWjB.js";import{t as u}from"./useChartAccessibility-DOMuYJfm.js";import{n as d}from"./Title-BliHuXfT.js";import{t as f}from"./BaseIcon-CoY0vuL3.js";import{t as ee}from"./DefGrad-DKMq1REY.js";import{t as te}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{computed as p,createBlock as ne,createCommentVNode as m,createElementBlock as h,createElementVNode as g,createVNode as _,defineAsyncComponent as re,guardReactiveProps as v,mergeProps as ie,normalizeProps as y,normalizeStyle as b,onBeforeUnmount as ae,onMounted as oe,openBlock as x,ref as S,renderSlot as C,shallowRef as se,toDisplayString as ce,unref as w,watch as le}from"vue";var ue=class{constructor(e,t,n,r=!0,i=!0){this.interval=t,this.elapsed=0,this.isPaused=!1;let a=new Blob([`
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useNestedProp-DnGoh-XS.js";import{X as n,rn as r,t as i}from"./lib-rPeBMZrn.js";import{c as a}from"./canvas-lib-22VpOI4_.js";import{t as o}from"./useResponsive-CENUxfEL.js";import{n as s,t as c}from"./useHints-C-TwxM0Y.js";import{t as l}from"./useConfig-B8qvYKdK.js";import{t as u}from"./useChartAccessibility-DOMuYJfm.js";import{n as d}from"./Title-BliHuXfT.js";import{t as f}from"./BaseIcon-CoY0vuL3.js";import{t as ee}from"./DefGrad-DKMq1REY.js";import{t as te}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{computed as p,createBlock as ne,createCommentVNode as m,createElementBlock as h,createElementVNode as g,createVNode as _,defineAsyncComponent as re,guardReactiveProps as v,mergeProps as ie,normalizeProps as y,normalizeStyle as b,onBeforeUnmount as ae,onMounted as oe,openBlock as x,ref as S,renderSlot as C,shallowRef as se,toDisplayString as ce,unref as w,watch as le}from"vue";var ue=class{constructor(e,t,n,r=!0,i=!0){this.interval=t,this.elapsed=0,this.isPaused=!1;let a=new Blob([`
2
2
  let interval;
3
3
  let elapsed = 0;
4
4
  let paused = false;
@@ -62,4 +62,4 @@ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useNestedProp
62
62
  break;
63
63
  }
64
64
  };
65
- `],{type:`application/javascript`}),o=URL.createObjectURL(a),s;try{s=new Worker(o)}finally{URL.revokeObjectURL(o)}let c=!1,l=/* @__PURE__ */ new Set,u=e=>{c||s.postMessage(e)};this.destroy=()=>{c||(c=!0,l.forEach(e=>s.removeEventListener(`message`,e)),l.clear(),s.onmessage=null,s.onerror=null,s.terminate())};function d(e){let t=Math.floor(e/1e3),n=Math.floor(e%1e3/10),a=Math.floor(t/3600),o=Math.floor(t%3600/60),s=t%60,c=``;return i&&(c+=String(a).padStart(2,`0`)+`:`),c+=String(o).padStart(2,`0`)+`:`,c+=String(s).padStart(2,`0`),r&&(c+=`.`+String(n).padStart(2,`0`)),c}this.start=()=>{this.isPaused=!1,u({action:`start`,data:{interval:this.interval}})},this.pause=()=>{this.isPaused?this.resume():(this.isPaused=!0,u({action:`pause`}))},this.resume=()=>{this.isPaused&&=(u({action:`resume`}),!1)},this.stop=()=>{u({action:`stop`}),this.isPaused=!1},this.reset=()=>{u({action:`reset`}),this.elapsed=0,this.isPaused=!1},this.restart=()=>{this.stop(),this.start()},this.lap=()=>new Promise(e=>{u({action:`lap`});let t=n=>{if(l.delete(t),c)return;let{elapsed:r,timestamp:i,action:a}=n.data;if(a===`lap`){let t=d(r);e({timestamp:i||0,elapsed:r,formatted:t})}};c||(l.add(t),s.addEventListener(`message`,t,{once:!0}))}),s.onmessage=t=>{if(c)return;let{elapsed:n,timestamp:r}=t.data;this.elapsed=n,e({timestamp:r||0,elapsed:this.elapsed,formatted:d(this.elapsed)})},s.onerror=e=>{c||n&&n(e)}}},T=/* @__PURE__ */ e({default:()=>E}),de=[`xmlns`,`viewBox`],fe=[`width`,`height`],pe={key:1},me=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],he=[`d`,`stroke`,`stroke-width`],ge=[`r`,`fill`,`stroke`,`stroke-width`],_e=[`r`,`fill`,`stroke`,`stroke-width`],ve=[`x`,`y`],ye={key:5},be=[`x`,`y`,`font-size`,`fill`,`font-weight`],xe={key:0,class:`vue-ui-timer-controls`},Se=[`title`],Ce=[`title`],we=[`title`],Te=[`title`],Ee=[`title`],E=/*#__PURE__*/ te({__name:`vue-ui-timer`,props:{config:{type:Object,default(){return{}}}},emits:[`start`,`pause`,`reset`,`restart`,`lap`],setup(e,{expose:te,emit:T}){let E=re(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),{vue_ui_timer:De}=l(),D=e,O=T,k=S(null),A=S(null),j=S(null),M=se(null),N=se(null),P=S(n()),Oe=S(0);oe(()=>{ke()});function ke(){if(F.value.responsive){let e=a(()=>{let{width:e,height:t}=o({chart:k.value,title:F.value.style.title.text?A.value:null,legend:j.value});requestAnimationFrame(()=>{B.value.width=e,B.value.height=t,F.value.responsiveProportionalSizing?(B.value.tracker.core=r({relator:Math.min(e,t),adjuster:F.value.style.width,source:6*L.value.radiusRatio,threshold:1,fallback:1}),B.value.tracker.aura=r({relator:Math.min(e,t),adjuster:F.value.style.width,source:12*L.value.aura.radiusRatio,threshold:1,fallback:1}),B.value.label=r({relator:Math.min(e,t),adjuster:F.value.style.width,source:I.value.label.fontSize,threshold:10,fallback:10})):B.value.label=I.value.label.fontSize})});M.value&&(N.value&&M.value.unobserve(N.value),M.value.disconnect()),M.value=new ResizeObserver(e),N.value=k.value.parentNode,M.value.observe(N.value)}}ae(()=>{H.destroy(),M.value&&(N.value&&M.value.unobserve(N.value),M.value.disconnect())});let F=p({get:()=>je(),set:e=>e}),I=p(()=>F.value.stopwatch),L=p(()=>F.value.stopwatch.tracker),R=p(()=>F.value.stopwatch.legend);s({config:()=>F.value,dataset:()=>[],component:`VueUiTimer`,rules:[c.noHint]});let z=p(()=>F.value.useCursorPointer),{svgRef:Ae}=u({config:F.value.style.title});function je(){return t({userConfig:D.config,defaultConfig:De})}le(()=>D.config,e=>{F.value=je(),ke(),Oe.value+=1},{deep:!0});let Me=p(()=>{if(I.value.showHours&&I.value.showHundredth)return`00:00:00.00`;if(I.value.showHours&&!I.value.showHundredth)return`00:00:00`;if(!I.value.showHours&&I.value.showHundredth)return`00:00.00`;if(!I.value.showHours&&!I.value.showHundredth)return`00:00`}),B=S({height:F.value.style.height,width:F.value.style.width,tracker:{core:6*L.value.radiusRatio,aura:12*L.value.aura.radiusRatio},label:I.value.label.fontSize}),V=S(0),H=new ue(e=>Ne(e),10,``,I.value.showHundredth,I.value.showHours),U=S(!0),W=S(!1),G=S(!1);function K(){O(`start`),U.value&&H.start(),U.value=!1,W.value=!0}function q(){W.value&&=(O(`reset`),H.stop(),X.value=[],U.value=!0,!1)}function J(){G.value=!G.value,O(`pause`,V.value),H.pause()}function Y(){W.value&&(G.value=!1,O(`restart`),X.value=[],H.restart())}let X=S([]);async function Z(){if(!W.value||G.value)return;let e=await H.lap();e&&(X.value.push(e),O(`lap`,X.value))}function Ne({timestamp:e,elapsed:t,formatted:n}){V.value={timestamp:e,elapsed:t,formatted:n}}let Q=p(()=>Math.min(B.value.width,B.value.height)/2.5*I.value.track.radiusRatio);function Pe(e,t){return e*(360/(t*1e3))%360}function Fe(e){let t=Math.PI/180*e;return{cx:B.value.width/2+Q.value*Math.cos(t),cy:B.value.height/2+Q.value*Math.sin(t)}}let $=p(()=>{let e=Pe(V.value.elapsed,I.value.cycleSeconds),{cx:t,cy:n}=Fe(e-90),r=+(e>180);return{cx:t||B.value.width/2,cy:n||B.value.height/2-Q.value,largeArcFlag:r,sweepFlag:1}});return te({start:K,pause:J,reset:q,restart:Y,lap:Z}),(e,t)=>(x(),h(`div`,{ref_key:`timerChart`,ref:k,class:`vue-data-ui-component vue-ui-timer`,style:b({fontFamily:F.value.style.fontFamily,width:`100%`,height:F.value.responsive?`100%`:`auto`,textAlign:`center`})},[F.value.style.title.text?(x(),h(`div`,{key:0,ref_key:`chartTitle`,ref:A,style:b({width:`100%`,background:F.value.style.backgroundColor})},[(x(),ne(d,{key:`title_${Oe.value}`,config:{title:{cy:`title`,...F.value.style.title},subtitle:{cy:`subtitle`,...F.value.style.title.subtitle}}},null,8,[`config`]))],4)):m(``,!0),(x(),h(`svg`,{ref_key:`svgRef`,ref:Ae,xmlns:w(i),viewBox:`0 0 ${B.value.width<=0?10:B.value.width} ${B.value.height<=0?10:B.value.height}`,style:b({maxWidth:`100%`,overflow:`visible`,background:F.value.style.backgroundColor})},[_(w(E)),e.$slots[`chart-background`]?(x(),h(`foreignObject`,{key:0,x:0,y:0,width:B.value.width<=0?10:B.value.width,height:B.value.height<=0?10:B.value.height,style:{pointerEvents:`none`}},[C(e.$slots,`chart-background`,{},void 0,!0)],8,fe)):m(``,!0),L.value.gradient.show?(x(),h(`defs`,pe,[_(ee,{t:`radial`,id:`tracker_gradient_${P.value}`,cx:`50%`,cy:`50%`,r:`50%`,fx:`50%`,fy:`50%`,stops:[[`0%`,L.value.gradient.color,1],[`100%`,L.value.fill,1]]},null,8,[`id`,`stops`])])):m(``,!0),g(`circle`,{cx:B.value.width/2,cy:B.value.height/2,r:Q.value,fill:I.value.track.fill,stroke:I.value.track.stroke,"stroke-width":I.value.track.strokeWidth},null,8,me),I.value.cycleTrack.show?(x(),h(`path`,{key:2,d:`M ${B.value.width/2},${B.value.height/2-Q.value} A ${Q.value},${Q.value} 0 ${$.value.largeArcFlag},${$.value.sweepFlag} ${$.value.cx},${$.value.cy}`,stroke:I.value.cycleTrack.stroke,"stroke-width":I.value.cycleTrack.strokeWidth,"stroke-linecap":`round`,fill:`none`},null,8,he)):m(``,!0),g(`circle`,ie($.value,{r:B.value.tracker.core,fill:L.value.gradient.show?`url(#tracker_gradient_${P.value})`:L.value.fill,stroke:L.value.stroke,"stroke-width":L.value.strokeWidth}),null,16,ge),L.value.aura.show?(x(),h(`circle`,ie({key:3},$.value,{r:B.value.tracker.aura,fill:`${L.value.aura.fill}`,opacity:.2,stroke:L.value.aura.stroke,"stroke-width":L.value.aura.strokeWidth}),null,16,_e)):m(``,!0),e.$slots.time?(x(),h(`foreignObject`,{key:4,x:B.value.width/2,y:B.value.height/2,height:`0.1`,width:`0.1`,style:{overflow:`visible`}},[C(e.$slots,`time`,y(v({...V.value,...B.value})),void 0,!0)],8,ve)):e.$slots.timeSvg?(x(),h(`g`,ye,[C(e.$slots,`timeSvg`,y(v({...V.value,...B.value})),void 0,!0)])):(x(),h(`text`,{key:6,x:B.value.width/2,y:B.value.height/2+B.value.label/4,"font-size":B.value.label,"text-anchor":`middle`,fill:I.value.label.color,"font-weight":I.value.label.bold?`bold`:`normal`,style:{"font-variant-numeric":`tabular-nums !important`}},ce(V.value.formatted||Me.value),9,be))],12,de)),g(`div`,{ref_key:`chartLegend`,ref:j,style:b({width:`100%`,backgroundColor:R.value.backgroundColor})},[e.$slots.controls?m(``,!0):(x(),h(`div`,xe,[R.value.buttons.start?(x(),h(`button`,{key:0,title:R.value.buttonTitles.start,onClick:K,class:`vue-ui-timer-button`,style:b({opacity:W.value?.2:1,cursor:W.value?`default`:z.value?`pointer`:`default`})},[_(f,{name:`play`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Se)):m(``,!0),R.value.buttons.pause?(x(),h(`button`,{key:1,title:G.value?R.value.buttonTitles.resume:R.value.buttonTitles.pause,onClick:J,class:`vue-ui-timer-button`,style:b({opacity:W.value?1:.2,cursor:W.value&&z.value?`pointer`:`default`})},[_(f,{name:`pause`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Ce)):m(``,!0),R.value.buttons.reset?(x(),h(`button`,{key:2,title:R.value.buttonTitles.reset,onClick:q,class:`vue-ui-timer-button`,style:b({opacity:W.value?1:.2,cursor:W.value&&z.value?`pointer`:`default`})},[_(f,{name:`stop`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,we)):m(``,!0),R.value.buttons.restart?(x(),h(`button`,{key:3,title:R.value.buttonTitles.restart,onClick:Y,class:`vue-ui-timer-button`,style:b({opacity:W.value?1:.2,cursor:W.value&&z.value?`pointer`:`default`})},[_(f,{name:`restart`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Te)):m(``,!0),R.value.buttons.lap?(x(),h(`button`,{key:4,title:R.value.buttonTitles.lap,onClick:Z,class:`vue-ui-timer-button`,style:b({opacity:W.value&&!G.value?1:.2,cursor:W.value&&!G.value&&z.value?`pointer`:`default`})},[_(f,{name:`lap`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Ee)):m(``,!0)])),C(e.$slots,`controls`,y(v({start:K,pause:J,reset:q,restart:Y,lap:Z,laps:X.value,isRunning:W.value,isPaused:G.value,...V.value})),void 0,!0),C(e.$slots,`laps`,y(v({laps:X.value,lap:Z,isRunning:W.value,isPaused:G.value,...V.value})),void 0,!0)],4)],4))}},[[`__scopeId`,`data-v-3660ed59`]]);export{T as n,E as t};
65
+ `],{type:`application/javascript`}),o=URL.createObjectURL(a),s;try{s=new Worker(o)}finally{URL.revokeObjectURL(o)}let c=!1,l=/* @__PURE__ */ new Set,u=e=>{c||s.postMessage(e)};this.destroy=()=>{c||(c=!0,l.forEach(e=>s.removeEventListener(`message`,e)),l.clear(),s.onmessage=null,s.onerror=null,s.terminate())};function d(e){let t=Math.floor(e/1e3),n=Math.floor(e%1e3/10),a=Math.floor(t/3600),o=Math.floor(t%3600/60),s=t%60,c=``;return i&&(c+=String(a).padStart(2,`0`)+`:`),c+=String(o).padStart(2,`0`)+`:`,c+=String(s).padStart(2,`0`),r&&(c+=`.`+String(n).padStart(2,`0`)),c}this.start=()=>{this.isPaused=!1,u({action:`start`,data:{interval:this.interval}})},this.pause=()=>{this.isPaused?this.resume():(this.isPaused=!0,u({action:`pause`}))},this.resume=()=>{this.isPaused&&=(u({action:`resume`}),!1)},this.stop=()=>{u({action:`stop`}),this.isPaused=!1},this.reset=()=>{u({action:`reset`}),this.elapsed=0,this.isPaused=!1},this.restart=()=>{this.stop(),this.start()},this.lap=()=>new Promise(e=>{u({action:`lap`});let t=n=>{if(l.delete(t),c)return;let{elapsed:r,timestamp:i,action:a}=n.data;if(a===`lap`){let t=d(r);e({timestamp:i||0,elapsed:r,formatted:t})}};c||(l.add(t),s.addEventListener(`message`,t,{once:!0}))}),s.onmessage=t=>{if(c)return;let{elapsed:n,timestamp:r}=t.data;this.elapsed=n,e({timestamp:r||0,elapsed:this.elapsed,formatted:d(this.elapsed)})},s.onerror=e=>{c||n&&n(e)}}},T=/* @__PURE__ */ e({default:()=>E}),de=[`xmlns`,`viewBox`],fe=[`width`,`height`],pe={key:1},me=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],he=[`d`,`stroke`,`stroke-width`],ge=[`r`,`fill`,`stroke`,`stroke-width`],_e=[`r`,`fill`,`stroke`,`stroke-width`],ve=[`x`,`y`],ye={key:5},be=[`x`,`y`,`font-size`,`fill`,`font-weight`],xe={key:0,class:`vue-ui-timer-controls`},Se=[`title`],Ce=[`title`],we=[`title`],Te=[`title`],Ee=[`title`],E=/*#__PURE__*/ te({__name:`vue-ui-timer`,props:{config:{type:Object,default(){return{}}}},emits:[`start`,`pause`,`reset`,`restart`,`lap`],setup(e,{expose:te,emit:T}){let E=re(()=>import(`./PackageVersion-DAF5ApGl.js`).then(e=>e.t)),{vue_ui_timer:De}=l(),D=e,O=T,k=S(null),A=S(null),j=S(null),M=se(null),N=se(null),P=S(n()),Oe=S(0);oe(()=>{ke()});function ke(){if(F.value.responsive){let e=a(()=>{let{width:e,height:t}=o({chart:k.value,title:F.value.style.title.text?A.value:null,legend:j.value});requestAnimationFrame(()=>{B.value.width=e,B.value.height=t,F.value.responsiveProportionalSizing?(B.value.tracker.core=r({relator:Math.min(e,t),adjuster:F.value.style.width,source:6*L.value.radiusRatio,threshold:1,fallback:1}),B.value.tracker.aura=r({relator:Math.min(e,t),adjuster:F.value.style.width,source:12*L.value.aura.radiusRatio,threshold:1,fallback:1}),B.value.label=r({relator:Math.min(e,t),adjuster:F.value.style.width,source:I.value.label.fontSize,threshold:10,fallback:10})):B.value.label=I.value.label.fontSize})});M.value&&(N.value&&M.value.unobserve(N.value),M.value.disconnect()),M.value=new ResizeObserver(e),N.value=k.value.parentNode,M.value.observe(N.value)}}ae(()=>{H.destroy(),M.value&&(N.value&&M.value.unobserve(N.value),M.value.disconnect())});let F=p({get:()=>je(),set:e=>e}),I=p(()=>F.value.stopwatch),L=p(()=>F.value.stopwatch.tracker),R=p(()=>F.value.stopwatch.legend);s({config:()=>F.value,dataset:()=>[],component:`VueUiTimer`,rules:[c.noHint]});let z=p(()=>F.value.useCursorPointer),{svgRef:Ae}=u({config:F.value.style.title});function je(){return t({userConfig:D.config,defaultConfig:De})}le(()=>D.config,e=>{F.value=je(),ke(),Oe.value+=1},{deep:!0});let Me=p(()=>{if(I.value.showHours&&I.value.showHundredth)return`00:00:00.00`;if(I.value.showHours&&!I.value.showHundredth)return`00:00:00`;if(!I.value.showHours&&I.value.showHundredth)return`00:00.00`;if(!I.value.showHours&&!I.value.showHundredth)return`00:00`}),B=S({height:F.value.style.height,width:F.value.style.width,tracker:{core:6*L.value.radiusRatio,aura:12*L.value.aura.radiusRatio},label:I.value.label.fontSize}),V=S(0),H=new ue(e=>Ne(e),10,``,I.value.showHundredth,I.value.showHours),U=S(!0),W=S(!1),G=S(!1);function K(){O(`start`),U.value&&H.start(),U.value=!1,W.value=!0}function q(){W.value&&=(O(`reset`),H.stop(),X.value=[],U.value=!0,!1)}function J(){G.value=!G.value,O(`pause`,V.value),H.pause()}function Y(){W.value&&(G.value=!1,O(`restart`),X.value=[],H.restart())}let X=S([]);async function Z(){if(!W.value||G.value)return;let e=await H.lap();e&&(X.value.push(e),O(`lap`,X.value))}function Ne({timestamp:e,elapsed:t,formatted:n}){V.value={timestamp:e,elapsed:t,formatted:n}}let Q=p(()=>Math.min(B.value.width,B.value.height)/2.5*I.value.track.radiusRatio);function Pe(e,t){return e*(360/(t*1e3))%360}function Fe(e){let t=Math.PI/180*e;return{cx:B.value.width/2+Q.value*Math.cos(t),cy:B.value.height/2+Q.value*Math.sin(t)}}let $=p(()=>{let e=Pe(V.value.elapsed,I.value.cycleSeconds),{cx:t,cy:n}=Fe(e-90),r=+(e>180);return{cx:t||B.value.width/2,cy:n||B.value.height/2-Q.value,largeArcFlag:r,sweepFlag:1}});return te({start:K,pause:J,reset:q,restart:Y,lap:Z}),(e,t)=>(x(),h(`div`,{ref_key:`timerChart`,ref:k,class:`vue-data-ui-component vue-ui-timer`,style:b({fontFamily:F.value.style.fontFamily,width:`100%`,height:F.value.responsive?`100%`:`auto`,textAlign:`center`})},[F.value.style.title.text?(x(),h(`div`,{key:0,ref_key:`chartTitle`,ref:A,style:b({width:`100%`,background:F.value.style.backgroundColor})},[(x(),ne(d,{key:`title_${Oe.value}`,config:{title:{cy:`title`,...F.value.style.title},subtitle:{cy:`subtitle`,...F.value.style.title.subtitle}}},null,8,[`config`]))],4)):m(``,!0),(x(),h(`svg`,{ref_key:`svgRef`,ref:Ae,xmlns:w(i),viewBox:`0 0 ${B.value.width<=0?10:B.value.width} ${B.value.height<=0?10:B.value.height}`,style:b({maxWidth:`100%`,overflow:`visible`,background:F.value.style.backgroundColor})},[_(w(E)),e.$slots[`chart-background`]?(x(),h(`foreignObject`,{key:0,x:0,y:0,width:B.value.width<=0?10:B.value.width,height:B.value.height<=0?10:B.value.height,style:{pointerEvents:`none`}},[C(e.$slots,`chart-background`,{},void 0,!0)],8,fe)):m(``,!0),L.value.gradient.show?(x(),h(`defs`,pe,[_(ee,{t:`radial`,id:`tracker_gradient_${P.value}`,cx:`50%`,cy:`50%`,r:`50%`,fx:`50%`,fy:`50%`,stops:[[`0%`,L.value.gradient.color,1],[`100%`,L.value.fill,1]]},null,8,[`id`,`stops`])])):m(``,!0),g(`circle`,{cx:B.value.width/2,cy:B.value.height/2,r:Q.value,fill:I.value.track.fill,stroke:I.value.track.stroke,"stroke-width":I.value.track.strokeWidth},null,8,me),I.value.cycleTrack.show?(x(),h(`path`,{key:2,d:`M ${B.value.width/2},${B.value.height/2-Q.value} A ${Q.value},${Q.value} 0 ${$.value.largeArcFlag},${$.value.sweepFlag} ${$.value.cx},${$.value.cy}`,stroke:I.value.cycleTrack.stroke,"stroke-width":I.value.cycleTrack.strokeWidth,"stroke-linecap":`round`,fill:`none`},null,8,he)):m(``,!0),g(`circle`,ie($.value,{r:B.value.tracker.core,fill:L.value.gradient.show?`url(#tracker_gradient_${P.value})`:L.value.fill,stroke:L.value.stroke,"stroke-width":L.value.strokeWidth}),null,16,ge),L.value.aura.show?(x(),h(`circle`,ie({key:3},$.value,{r:B.value.tracker.aura,fill:`${L.value.aura.fill}`,opacity:.2,stroke:L.value.aura.stroke,"stroke-width":L.value.aura.strokeWidth}),null,16,_e)):m(``,!0),e.$slots.time?(x(),h(`foreignObject`,{key:4,x:B.value.width/2,y:B.value.height/2,height:`0.1`,width:`0.1`,style:{overflow:`visible`}},[C(e.$slots,`time`,y(v({...V.value,...B.value})),void 0,!0)],8,ve)):e.$slots.timeSvg?(x(),h(`g`,ye,[C(e.$slots,`timeSvg`,y(v({...V.value,...B.value})),void 0,!0)])):(x(),h(`text`,{key:6,x:B.value.width/2,y:B.value.height/2+B.value.label/4,"font-size":B.value.label,"text-anchor":`middle`,fill:I.value.label.color,"font-weight":I.value.label.bold?`bold`:`normal`,style:{"font-variant-numeric":`tabular-nums !important`}},ce(V.value.formatted||Me.value),9,be))],12,de)),g(`div`,{ref_key:`chartLegend`,ref:j,style:b({width:`100%`,backgroundColor:R.value.backgroundColor})},[e.$slots.controls?m(``,!0):(x(),h(`div`,xe,[R.value.buttons.start?(x(),h(`button`,{key:0,title:R.value.buttonTitles.start,onClick:K,class:`vue-ui-timer-button`,style:b({opacity:W.value?.2:1,cursor:W.value?`default`:z.value?`pointer`:`default`})},[_(f,{name:`play`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Se)):m(``,!0),R.value.buttons.pause?(x(),h(`button`,{key:1,title:G.value?R.value.buttonTitles.resume:R.value.buttonTitles.pause,onClick:J,class:`vue-ui-timer-button`,style:b({opacity:W.value?1:.2,cursor:W.value&&z.value?`pointer`:`default`})},[_(f,{name:`pause`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Ce)):m(``,!0),R.value.buttons.reset?(x(),h(`button`,{key:2,title:R.value.buttonTitles.reset,onClick:q,class:`vue-ui-timer-button`,style:b({opacity:W.value?1:.2,cursor:W.value&&z.value?`pointer`:`default`})},[_(f,{name:`stop`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,we)):m(``,!0),R.value.buttons.restart?(x(),h(`button`,{key:3,title:R.value.buttonTitles.restart,onClick:Y,class:`vue-ui-timer-button`,style:b({opacity:W.value?1:.2,cursor:W.value&&z.value?`pointer`:`default`})},[_(f,{name:`restart`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Te)):m(``,!0),R.value.buttons.lap?(x(),h(`button`,{key:4,title:R.value.buttonTitles.lap,onClick:Z,class:`vue-ui-timer-button`,style:b({opacity:W.value&&!G.value?1:.2,cursor:W.value&&!G.value&&z.value?`pointer`:`default`})},[_(f,{name:`lap`,stroke:R.value.buttons.iconColor},null,8,[`stroke`])],12,Ee)):m(``,!0)])),C(e.$slots,`controls`,y(v({start:K,pause:J,reset:q,restart:Y,lap:Z,laps:X.value,isRunning:W.value,isPaused:G.value,...V.value})),void 0,!0),C(e.$slots,`laps`,y(v({laps:X.value,lap:Z,isRunning:W.value,isPaused:G.value,...V.value})),void 0,!0)],4)],4))}},[[`__scopeId`,`data-v-3660ed59`]]);export{T as n,E as t};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useAnimationFrame-D8gcRfnW.js";import{n,r,t as i}from"./userOptionsSlots-CWtXN5Q6.js";import{n as a,r as o,t as s}from"./annotationSlots-OLiW25XN.js";import{t as c}from"./chartImage-DPGnEuYM.js";import{t as l}from"./resolveChartConfig-0IvbmIE_.js";import{$ as ee,X as te,Yt as ne,at as re,b as ie,i as ae,in as oe,t as se,zt as ce}from"./lib-rPeBMZrn.js";import{c as le}from"./canvas-lib-22VpOI4_.js";import{n as ue,t as de}from"./useHints-C-TwxM0Y.js";import{t as fe}from"./useConfig-CXhXxWjB.js";import{t as pe}from"./useLoading-DoqqfnmS.js";import{t as me}from"./usePrinter-DVf3YcG5.js";import{t as he}from"./useResponsive-CENUxfEL.js";import{t as ge}from"./useChartExport-BZts4KFb.js";import{t as _e}from"./useUserOptionState-CXlFnwPv.js";import{t as ve}from"./useChartAccessibility-DOMuYJfm.js";import{t as ye}from"./usePrefersMotion-XLHwega2.js";import{t as be}from"./vue_ui_tiremarks-v9pVlb9O.js";import{n as xe}from"./Title-BliHuXfT.js";import{t as Se}from"./BaseScanner-m6QR9rwD.js";import{t as Ce}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as we,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as Te,createSlots as Ee,createVNode as De,defineAsyncComponent as Oe,guardReactiveProps as ke,mergeProps as Ae,normalizeClass as m,normalizeProps as h,normalizeStyle as je,onBeforeUnmount as Me,onMounted as Ne,openBlock as g,ref as _,renderList as v,renderSlot as y,toDisplayString as b,toRefs as Pe,unref as x,watch as S,withCtx as Fe}from"vue";var Ie=/* @__PURE__ */ e({default:()=>C}),Le=[`id`],Re=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],ze=[`id`],Be=[`id`],Ve=[`width`,`height`],He={key:1},Ue=[`d`,`stroke-width`,`stroke`],We={key:2},Ge=[`x1`,`y1`,`x2`,`y2`,`stroke-width`,`stroke`],Ke=[`aria-label`],qe=[`x`,`y`,`height`],Je=[`x`,`y`,`font-size`,`fill`,`font-weight`,`text-anchor`],Ye={key:4,class:`vue-data-ui-watermark`},C=/*#__PURE__*/ Ce({__name:`vue-ui-tiremarks`,props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:Ce,emit:Ie}){let C=Oe(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Xe=Oe(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Ze=Oe(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),{vue_ui_tiremarks:Qe}=fe(),w=ye(),T=e,$e=Ie,et=u(()=>!!T.dataset&&Object.keys(T.dataset).length),E=_(te()),D=_(null),tt=_(null),nt=_(null),rt=_(null),it=_(0),at=_(0),O=_(null),k=_(null),A=t(),j=0;function ot(){j+=1,A.cancel(),O.value?.disconnect(),O.value=null,k.value=null}Me(ot);let M=_(ft()),N=u(()=>M.value.userOptions),P=u(()=>M.value.style.chart.layout),F=u(()=>M.value.style.chart);ue({config:()=>M.value,dataset:()=>T.dataset,component:`VueUiTiremarks`,rules:[de.noHint]});let st=u(()=>M.value.userOptions.useCursorPointer),ct=u(()=>oe({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,animation:{use:!1},layout:{activeColor:`#6A6A6A80`,inactiveColor:`#CACACA80`,ticks:{gradient:{show:!1}}}}}},userConfig:M.value.skeletonConfig??{}})),{loading:I,FINAL_DATASET:L}=pe({...Pe(T),FINAL_CONFIG:M,prepareConfig:ft,skeletonDataset:T.config?.skeletonDataset??{percentage:50},skeletonConfig:oe({defaultConfig:M.value,userConfig:ct.value})}),{userOptionsVisible:R,setUserOptionsVisibility:lt,keepUserOptionState:ut}=_e({config:M.value}),{svgRef:dt}=ve({config:F.value.title});function ft(){return l(T.config,Qe,be)}S(()=>T.config,e=>{M.value=ft(),R.value=!M.value.userOptions.showOnChartHover,K.value=F.value.width,q.value=F.value.height,vt(),at.value+=1},{deep:!0});let{isPrinting:z,isImaging:B,generatePdf:pt,generateImage:mt}=me({elementId:E.value,fileName:F.value.title.text||`vue-ui-tiremarks`,options:M.value.userOptions.print}),ht=u(()=>M.value.userOptions.show&&!F.value.title.text),V=_(F.value.animation.use&&!w.value?0:ie(L.value.percentage));S(()=>L.value,e=>{F.value.animation.use&&!w.value?gt(e.percentage):(H.cancel(),V.value=e.percentage||0)},{deep:!0}),Ne(()=>{vt()});let H=t();function gt(e){if(H.cancel(),H.isDisposed())return;let t=F.value.animation.speed,n=Math.abs(e-V.value)/(t*120);if(!F.value.animation.use||w.value||!Number.isFinite(n)||n<=0){V.value=e;return}function r(){V.value<e?V.value=Math.min(V.value+n,e):V.value>e&&(V.value=Math.max(V.value-n,e)),V.value!==e&&H.request(r)}r()}let _t=u(()=>M.value.debug);function vt(){if(ot(),ce(T.dataset)&&re({componentName:`VueUiTiremarks`,type:`dataset`,debug:_t.value}),M.value.responsive&&D.value?.parentNode){let e=j,t=le(()=>{if(e!==j||A.isDisposed())return;let{width:t,height:n}=he({chart:D.value,title:F.value.title.text?nt.value:null,source:rt.value});A.request(()=>{K.value=Math.max(.1,t),q.value=Math.max(.1,n-12)})});O.value=new ResizeObserver(t),k.value=D.value.parentNode,O.value.observe(k.value)}gt(L.value.percentage||0)}let U=u(()=>P.value.display===`vertical`),W=u(()=>{let e=F.value.percentage.show,t={top:e?48:12,left:e?64:16,right:e?64:16,bottom:e?48:12};return U.value?{top:F.value.percentage.verticalPosition===`top`?t.top:3,left:3,right:3,bottom:F.value.percentage.verticalPosition===`bottom`?t.bottom:3}:{top:0,bottom:0,left:F.value.percentage.horizontalPosition===`left`?t.left:16,right:F.value.percentage.horizontalPosition===`right`?t.right:10}}),G=u(()=>Object.values(W.value).reduce((e,t)=>e+t,0)),K=_(F.value.width),q=_(F.value.height),J=u(()=>({height:q.value,width:K.value})),yt=u(()=>({horizontal:{x:X.value.x+(F.value.percentage.horizontalPosition===`left`?6:3),y:J.value.height/2-X.value.fontSize/2},vertical:{x:J.value.width/2-20,y:X.value.y-X.value.fontSize/2}})[P.value.display]),Y=u(()=>U.value?{mark:(J.value.height-G.value)/100*.5,space:(J.value.height-G.value)/100*.5}:{mark:(J.value.width-G.value)/100*.5,space:(J.value.width-G.value)/100*.5}),bt=u(()=>{let e=[];for(let t=0;t<100;t+=1){let n=P.value.ticks.gradient.show?ne(P.value.activeColor,t/100*(P.value.ticks.gradient.shiftHueIntensity/100)):P.value.activeColor;if(U.value){let r=P.value.crescendo?(100-t)*(J.value.width-W.value.left-W.value.right)/100/3:0,i=W.value.left+4+r,a=J.value.width-W.value.right-4-r,o=J.value.height-W.value.bottom-t*Y.value.mark-t*Y.value.space-Y.value.mark,s=J.value.height-W.value.bottom-t*Y.value.mark-t*Y.value.space-Y.value.mark,c=(a-i)/P.value.curveAngleX,l=P.value.curveAngleY*((1+t)/100);e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o-l}, ${a-c} ${s-l}, ${a} ${s}`,color:n})}else{let r=P.value.crescendo?(100-t)*(J.value.height-W.value.top-W.value.bottom)/100/3:0,i=W.value.left+t*Y.value.mark+t*Y.value.space-Y.value.mark,a=i,o=W.value.top+4+r,s=J.value.height-W.value.bottom-4-r,c=P.value.curveAngleY*((1+t)/100),l=(s-o)/P.value.curveAngleX;e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o+l}, ${a+c} ${s-l}, ${a} ${s}`,color:n})}}return e}),X=u(()=>{let e,t,n,r=F.value.percentage.fontSize/3;return U.value?F.value.percentage.verticalPosition===`top`?(e=J.value.width/2,t=W.value.top/2,n=`middle`):F.value.percentage.verticalPosition===`bottom`&&(e=J.value.width/2,t=J.value.height-W.value.bottom/2+r,n=`middle`):F.value.percentage.horizontalPosition===`left`?(e=4,t=J.value.height/2+r,n=`start`):F.value.percentage.horizontalPosition===`right`&&(e=J.value.width-W.value.right+8,t=J.value.height/2+r,n=`start`),{x:e,y:t,textAnchor:n,bold:F.value.percentage.bold,fontSize:F.value.percentage.fontSize,fill:F.value.percentage.color}}),Z=_(!1);function xt(e){Z.value=e,it.value+=1}let Q=_(!1);function St(){Q.value=!Q.value}let Ct=c(D,()=>F.value.title.text),wt=u(()=>F.value.backgroundColor),Tt=u(()=>F.value.title),{isCallbackImaging:$,isCallbackSvg:Et,generateSvg:Dt,onGenerateImage:Ot}=ge({svg:dt,title:Tt,legend:null,legendItems:null,backgroundColor:wt,getSvgCallback:()=>M.value.userOptions.callbacks.svg,generateImage:mt});async function kt(){$e(`copyAlt`,{config:M.value,dataset:L.value}),M.value.userOptions.callbacks.altCopy?await Promise.resolve(M.value.userOptions.callbacks.altCopy({config:M.value,dataset:L.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let At=u(()=>`${E.value}-title`),jt=u(()=>`${E.value}-desc`),Mt=u(()=>ae(F.value.percentage.formatter,V.value,ee({v:V.value,s:`%`,r:F.value.percentage.rounding}))),Nt=u(()=>F.value.title.text||``),Pt=u(()=>I.value?`Loading data`:`Value: ${Mt.value}`);return Ce({getImage:Ct,generatePdf:pt,generateImage:mt,generateSvg:Dt,toggleAnnotator:St,toggleFullscreen:xt,copyAlt:kt}),S(w,e=>{e&&(H.cancel(),V.value=L.value.percentage||0)}),(e,t)=>(g(),p(`div`,{ref_key:`tiremarksChart`,ref:D,class:m(`vue-data-ui-component vue-ui-tiremarks ${M.value.useCssAnimation?``:`vue-ui-dna`}`),style:je(`font-family:${M.value.style.fontFamily};width:100%; text-align:center;background:${F.value.backgroundColor}`),id:E.value,onMouseenter:t[0]||=()=>x(lt)(!0),onMouseleave:t[1]||=()=>x(lt)(!1)},[N.value.buttons.annotator?(g(),d(x(C),Ae({key:0},x(o)(N.value.annotator),{svgRef:x(dt),backgroundColor:F.value.backgroundColor,color:F.value.color,active:Q.value,isCursorPointer:st.value,palette:N.value.annotatorPalette,onClose:St}),Ee({_:2},[v(x(s),t=>({name:t,fn:Fe(n=>[y(e.$slots,t,h(ke(x(a)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),ht.value?(g(),p(`div`,{key:1,ref_key:`noTitle`,ref:tt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):f(``,!0),F.value.title.text?(g(),p(`div`,{key:2,ref_key:`chartTitle`,ref:nt,style:`width:100%;background:transparent;padding-bottom:12px`},[(g(),d(xe,{key:`title_${at.value}`,config:{title:{cy:`wheel-title`,...F.value.title},subtitle:{cy:`wheel-subtitle`,...F.value.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),N.value.show&&et.value&&(x(ut)||x(R))?(g(),d(x(Xe),Ae({ref:`details`,key:`user_options_${it.value}`,backgroundColor:F.value.backgroundColor,color:F.value.color,isPrinting:x(z),isImaging:x(B),uid:E.value,hasXls:!1,isFullscreen:Z.value,chartElement:D.value},x(r)(N.value,`pdf img svg fullscreen altCopy annotator`),{isAnnotation:Q.value,isCursorPointer:st.value,onToggleFullscreen:xt,onGeneratePdf:x(pt),onGenerateImage:x(Ot),onGenerateSvg:x(Dt),onToggleAnnotator:St,onCopyAlt:kt,style:{visibility:x(ut)?x(R)?`visible`:`hidden`:`visible`}}),Ee({_:2},[v(x(n)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Fe(n=>[y(e.$slots,t,h(ke(x(i)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),(g(),p(`svg`,{ref_key:`svgRef`,ref:dt,xmlns:x(se),class:m({"vue-data-ui-fullscreen--on":Z.value,"vue-data-ui-fulscreen--off":!Z.value}),viewBox:`0 0 ${K.value} ${q.value}`,style:je(`max-width:100%; overflow: visible; background:transparent;color:${F.value.color}`),role:`img`,"aria-labelledby":At.value,"aria-describedby":jt.value},[Te(`title`,{id:At.value},b(Nt.value),9,ze),Te(`desc`,{id:jt.value},b(Pt.value),9,Be),De(x(Ze)),y(e.$slots,`svg-underlayer`,{svg:{...J.value,isPrintingImg:x(z)||x(B)||x($),isPrintingSvg:x(Et)}},void 0,!0),e.$slots[`chart-background`]?(g(),p(`foreignObject`,{key:0,x:0,y:0,width:J.value.width,height:J.value.height,style:{pointerEvents:`none`}},[y(e.$slots,`chart-background`,{},void 0,!0)],8,Ve)):f(``,!0),P.value.curved?(g(),p(`g`,He,[(g(!0),p(we,null,v(bt.value,(e,t)=>(g(),p(`path`,{d:e.curve,"stroke-width":Y.value.mark,stroke:V.value>=t?e.color:P.value.inactiveColor,"stroke-linecap":`round`,fill:`none`,class:m({"vue-ui-tick-animated":F.value.animation.use&&!x(w)&&t<=V.value})},null,10,Ue))),256))])):(g(),p(`g`,We,[(g(!0),p(we,null,v(bt.value,(e,t)=>(g(),p(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,"stroke-width":Y.value.mark,stroke:V.value>=t?e.color:P.value.inactiveColor,"stroke-linecap":`round`},null,8,Ge))),256))])),F.value.percentage.show?(g(),p(`g`,{key:3,role:`status`,"aria-live":`polite`,"aria-label":x(I)?`...`:`${Mt.value}`},[x(I)?(g(),p(`rect`,{key:0,x:yt.value.x,y:yt.value.y,width:40,height:X.value.fontSize,fill:`#6A6A6A80`,rx:3},null,8,qe)):(g(),p(`text`,{key:1,"aria-hidden":`true`,x:X.value.x,y:X.value.y,"font-size":X.value.fontSize,fill:P.value.ticks.gradient.show&&F.value.percentage.useGradientColor?x(ne)(P.value.activeColor,V.value/100*(P.value.ticks.gradient.shiftHueIntensity/100)):F.value.percentage.color,"font-weight":X.value.bold?`bold`:`normal`,"text-anchor":X.value.textAnchor},b(Mt.value),9,Je))],8,Ke)):f(``,!0),y(e.$slots,`svg`,{svg:{...J.value,isPrintingImg:x(z)||x(B)||x($),isPrintingSvg:x(Et)}},void 0,!0)],14,Re)),e.$slots.watermark?(g(),p(`div`,Ye,[y(e.$slots,`watermark`,h(ke({isPrinting:x(z)||x(B)||x($)||x(Et)})),void 0,!0)])):f(``,!0),e.$slots.source?(g(),p(`div`,{key:5,ref_key:`source`,ref:rt,dir:`auto`},[y(e.$slots,`source`,{},void 0,!0)],512)):f(``,!0),y(e.$slots,`skeleton`,{},()=>[x(I)?(g(),d(Se,{key:0})):f(``,!0)],!0)],46,Le))}},[[`__scopeId`,`data-v-72a361b1`]]);export{Ie as n,C as t};
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useAnimationFrame-D8gcRfnW.js";import{n,r,t as i}from"./userOptionsSlots-CWtXN5Q6.js";import{n as a,r as o,t as s}from"./annotationSlots-OLiW25XN.js";import{t as c}from"./chartImage-DPGnEuYM.js";import{t as l}from"./resolveChartConfig-0IvbmIE_.js";import{$ as ee,X as te,Yt as ne,at as re,b as ie,i as ae,in as oe,t as se,zt as ce}from"./lib-rPeBMZrn.js";import{c as le}from"./canvas-lib-22VpOI4_.js";import{n as ue,t as de}from"./useHints-C-TwxM0Y.js";import{t as fe}from"./useConfig-B8qvYKdK.js";import{t as pe}from"./useLoading-DoqqfnmS.js";import{t as me}from"./usePrinter-DVf3YcG5.js";import{t as he}from"./useResponsive-CENUxfEL.js";import{t as ge}from"./useChartExport-BZts4KFb.js";import{t as _e}from"./useUserOptionState-CXlFnwPv.js";import{t as ve}from"./useChartAccessibility-DOMuYJfm.js";import{t as ye}from"./usePrefersMotion-XLHwega2.js";import{t as be}from"./vue_ui_tiremarks-v9pVlb9O.js";import{n as xe}from"./Title-BliHuXfT.js";import{t as Se}from"./BaseScanner-m6QR9rwD.js";import{t as Ce}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as we,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as Te,createSlots as Ee,createVNode as De,defineAsyncComponent as Oe,guardReactiveProps as ke,mergeProps as Ae,normalizeClass as m,normalizeProps as h,normalizeStyle as je,onBeforeUnmount as Me,onMounted as Ne,openBlock as g,ref as _,renderList as v,renderSlot as y,toDisplayString as b,toRefs as Pe,unref as x,watch as S,withCtx as Fe}from"vue";var Ie=/* @__PURE__ */ e({default:()=>C}),Le=[`id`],Re=[`xmlns`,`viewBox`,`aria-labelledby`,`aria-describedby`],ze=[`id`],Be=[`id`],Ve=[`width`,`height`],He={key:1},Ue=[`d`,`stroke-width`,`stroke`],We={key:2},Ge=[`x1`,`y1`,`x2`,`y2`,`stroke-width`,`stroke`],Ke=[`aria-label`],qe=[`x`,`y`,`height`],Je=[`x`,`y`,`font-size`,`fill`,`font-weight`,`text-anchor`],Ye={key:4,class:`vue-data-ui-watermark`},C=/*#__PURE__*/ Ce({__name:`vue-ui-tiremarks`,props:{config:{type:Object,default(){return{}}},dataset:{type:Object,default(){return{}}}},emits:[`copyAlt`],setup(e,{expose:Ce,emit:Ie}){let C=Oe(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Xe=Oe(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Ze=Oe(()=>import(`./PackageVersion-DAF5ApGl.js`).then(e=>e.t)),{vue_ui_tiremarks:Qe}=fe(),w=ye(),T=e,$e=Ie,et=u(()=>!!T.dataset&&Object.keys(T.dataset).length),E=_(te()),D=_(null),tt=_(null),nt=_(null),rt=_(null),it=_(0),at=_(0),O=_(null),k=_(null),A=t(),j=0;function ot(){j+=1,A.cancel(),O.value?.disconnect(),O.value=null,k.value=null}Me(ot);let M=_(ft()),N=u(()=>M.value.userOptions),P=u(()=>M.value.style.chart.layout),F=u(()=>M.value.style.chart);ue({config:()=>M.value,dataset:()=>T.dataset,component:`VueUiTiremarks`,rules:[de.noHint]});let st=u(()=>M.value.userOptions.useCursorPointer),ct=u(()=>oe({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,animation:{use:!1},layout:{activeColor:`#6A6A6A80`,inactiveColor:`#CACACA80`,ticks:{gradient:{show:!1}}}}}},userConfig:M.value.skeletonConfig??{}})),{loading:I,FINAL_DATASET:L}=pe({...Pe(T),FINAL_CONFIG:M,prepareConfig:ft,skeletonDataset:T.config?.skeletonDataset??{percentage:50},skeletonConfig:oe({defaultConfig:M.value,userConfig:ct.value})}),{userOptionsVisible:R,setUserOptionsVisibility:lt,keepUserOptionState:ut}=_e({config:M.value}),{svgRef:dt}=ve({config:F.value.title});function ft(){return l(T.config,Qe,be)}S(()=>T.config,e=>{M.value=ft(),R.value=!M.value.userOptions.showOnChartHover,K.value=F.value.width,q.value=F.value.height,vt(),at.value+=1},{deep:!0});let{isPrinting:z,isImaging:B,generatePdf:pt,generateImage:mt}=me({elementId:E.value,fileName:F.value.title.text||`vue-ui-tiremarks`,options:M.value.userOptions.print}),ht=u(()=>M.value.userOptions.show&&!F.value.title.text),V=_(F.value.animation.use&&!w.value?0:ie(L.value.percentage));S(()=>L.value,e=>{F.value.animation.use&&!w.value?gt(e.percentage):(H.cancel(),V.value=e.percentage||0)},{deep:!0}),Ne(()=>{vt()});let H=t();function gt(e){if(H.cancel(),H.isDisposed())return;let t=F.value.animation.speed,n=Math.abs(e-V.value)/(t*120);if(!F.value.animation.use||w.value||!Number.isFinite(n)||n<=0){V.value=e;return}function r(){V.value<e?V.value=Math.min(V.value+n,e):V.value>e&&(V.value=Math.max(V.value-n,e)),V.value!==e&&H.request(r)}r()}let _t=u(()=>M.value.debug);function vt(){if(ot(),ce(T.dataset)&&re({componentName:`VueUiTiremarks`,type:`dataset`,debug:_t.value}),M.value.responsive&&D.value?.parentNode){let e=j,t=le(()=>{if(e!==j||A.isDisposed())return;let{width:t,height:n}=he({chart:D.value,title:F.value.title.text?nt.value:null,source:rt.value});A.request(()=>{K.value=Math.max(.1,t),q.value=Math.max(.1,n-12)})});O.value=new ResizeObserver(t),k.value=D.value.parentNode,O.value.observe(k.value)}gt(L.value.percentage||0)}let U=u(()=>P.value.display===`vertical`),W=u(()=>{let e=F.value.percentage.show,t={top:e?48:12,left:e?64:16,right:e?64:16,bottom:e?48:12};return U.value?{top:F.value.percentage.verticalPosition===`top`?t.top:3,left:3,right:3,bottom:F.value.percentage.verticalPosition===`bottom`?t.bottom:3}:{top:0,bottom:0,left:F.value.percentage.horizontalPosition===`left`?t.left:16,right:F.value.percentage.horizontalPosition===`right`?t.right:10}}),G=u(()=>Object.values(W.value).reduce((e,t)=>e+t,0)),K=_(F.value.width),q=_(F.value.height),J=u(()=>({height:q.value,width:K.value})),yt=u(()=>({horizontal:{x:X.value.x+(F.value.percentage.horizontalPosition===`left`?6:3),y:J.value.height/2-X.value.fontSize/2},vertical:{x:J.value.width/2-20,y:X.value.y-X.value.fontSize/2}})[P.value.display]),Y=u(()=>U.value?{mark:(J.value.height-G.value)/100*.5,space:(J.value.height-G.value)/100*.5}:{mark:(J.value.width-G.value)/100*.5,space:(J.value.width-G.value)/100*.5}),bt=u(()=>{let e=[];for(let t=0;t<100;t+=1){let n=P.value.ticks.gradient.show?ne(P.value.activeColor,t/100*(P.value.ticks.gradient.shiftHueIntensity/100)):P.value.activeColor;if(U.value){let r=P.value.crescendo?(100-t)*(J.value.width-W.value.left-W.value.right)/100/3:0,i=W.value.left+4+r,a=J.value.width-W.value.right-4-r,o=J.value.height-W.value.bottom-t*Y.value.mark-t*Y.value.space-Y.value.mark,s=J.value.height-W.value.bottom-t*Y.value.mark-t*Y.value.space-Y.value.mark,c=(a-i)/P.value.curveAngleX,l=P.value.curveAngleY*((1+t)/100);e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o-l}, ${a-c} ${s-l}, ${a} ${s}`,color:n})}else{let r=P.value.crescendo?(100-t)*(J.value.height-W.value.top-W.value.bottom)/100/3:0,i=W.value.left+t*Y.value.mark+t*Y.value.space-Y.value.mark,a=i,o=W.value.top+4+r,s=J.value.height-W.value.bottom-4-r,c=P.value.curveAngleY*((1+t)/100),l=(s-o)/P.value.curveAngleX;e.push({x1:i,x2:a,y1:o,y2:s,curve:`M ${i} ${o} C ${i+c} ${o+l}, ${a+c} ${s-l}, ${a} ${s}`,color:n})}}return e}),X=u(()=>{let e,t,n,r=F.value.percentage.fontSize/3;return U.value?F.value.percentage.verticalPosition===`top`?(e=J.value.width/2,t=W.value.top/2,n=`middle`):F.value.percentage.verticalPosition===`bottom`&&(e=J.value.width/2,t=J.value.height-W.value.bottom/2+r,n=`middle`):F.value.percentage.horizontalPosition===`left`?(e=4,t=J.value.height/2+r,n=`start`):F.value.percentage.horizontalPosition===`right`&&(e=J.value.width-W.value.right+8,t=J.value.height/2+r,n=`start`),{x:e,y:t,textAnchor:n,bold:F.value.percentage.bold,fontSize:F.value.percentage.fontSize,fill:F.value.percentage.color}}),Z=_(!1);function xt(e){Z.value=e,it.value+=1}let Q=_(!1);function St(){Q.value=!Q.value}let Ct=c(D,()=>F.value.title.text),wt=u(()=>F.value.backgroundColor),Tt=u(()=>F.value.title),{isCallbackImaging:$,isCallbackSvg:Et,generateSvg:Dt,onGenerateImage:Ot}=ge({svg:dt,title:Tt,legend:null,legendItems:null,backgroundColor:wt,getSvgCallback:()=>M.value.userOptions.callbacks.svg,generateImage:mt});async function kt(){$e(`copyAlt`,{config:M.value,dataset:L.value}),M.value.userOptions.callbacks.altCopy?await Promise.resolve(M.value.userOptions.callbacks.altCopy({config:M.value,dataset:L.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let At=u(()=>`${E.value}-title`),jt=u(()=>`${E.value}-desc`),Mt=u(()=>ae(F.value.percentage.formatter,V.value,ee({v:V.value,s:`%`,r:F.value.percentage.rounding}))),Nt=u(()=>F.value.title.text||``),Pt=u(()=>I.value?`Loading data`:`Value: ${Mt.value}`);return Ce({getImage:Ct,generatePdf:pt,generateImage:mt,generateSvg:Dt,toggleAnnotator:St,toggleFullscreen:xt,copyAlt:kt}),S(w,e=>{e&&(H.cancel(),V.value=L.value.percentage||0)}),(e,t)=>(g(),p(`div`,{ref_key:`tiremarksChart`,ref:D,class:m(`vue-data-ui-component vue-ui-tiremarks ${M.value.useCssAnimation?``:`vue-ui-dna`}`),style:je(`font-family:${M.value.style.fontFamily};width:100%; text-align:center;background:${F.value.backgroundColor}`),id:E.value,onMouseenter:t[0]||=()=>x(lt)(!0),onMouseleave:t[1]||=()=>x(lt)(!1)},[N.value.buttons.annotator?(g(),d(x(C),Ae({key:0},x(o)(N.value.annotator),{svgRef:x(dt),backgroundColor:F.value.backgroundColor,color:F.value.color,active:Q.value,isCursorPointer:st.value,palette:N.value.annotatorPalette,onClose:St}),Ee({_:2},[v(x(s),t=>({name:t,fn:Fe(n=>[y(e.$slots,t,h(ke(x(a)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),ht.value?(g(),p(`div`,{key:1,ref_key:`noTitle`,ref:tt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):f(``,!0),F.value.title.text?(g(),p(`div`,{key:2,ref_key:`chartTitle`,ref:nt,style:`width:100%;background:transparent;padding-bottom:12px`},[(g(),d(xe,{key:`title_${at.value}`,config:{title:{cy:`wheel-title`,...F.value.title},subtitle:{cy:`wheel-subtitle`,...F.value.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),N.value.show&&et.value&&(x(ut)||x(R))?(g(),d(x(Xe),Ae({ref:`details`,key:`user_options_${it.value}`,backgroundColor:F.value.backgroundColor,color:F.value.color,isPrinting:x(z),isImaging:x(B),uid:E.value,hasXls:!1,isFullscreen:Z.value,chartElement:D.value},x(r)(N.value,`pdf img svg fullscreen altCopy annotator`),{isAnnotation:Q.value,isCursorPointer:st.value,onToggleFullscreen:xt,onGeneratePdf:x(pt),onGenerateImage:x(Ot),onGenerateSvg:x(Dt),onToggleAnnotator:St,onCopyAlt:kt,style:{visibility:x(ut)?x(R)?`visible`:`hidden`:`visible`}}),Ee({_:2},[v(x(n)(e.$slots,`menuIcon optionPdf optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Fe(n=>[y(e.$slots,t,h(ke(x(i)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),(g(),p(`svg`,{ref_key:`svgRef`,ref:dt,xmlns:x(se),class:m({"vue-data-ui-fullscreen--on":Z.value,"vue-data-ui-fulscreen--off":!Z.value}),viewBox:`0 0 ${K.value} ${q.value}`,style:je(`max-width:100%; overflow: visible; background:transparent;color:${F.value.color}`),role:`img`,"aria-labelledby":At.value,"aria-describedby":jt.value},[Te(`title`,{id:At.value},b(Nt.value),9,ze),Te(`desc`,{id:jt.value},b(Pt.value),9,Be),De(x(Ze)),y(e.$slots,`svg-underlayer`,{svg:{...J.value,isPrintingImg:x(z)||x(B)||x($),isPrintingSvg:x(Et)}},void 0,!0),e.$slots[`chart-background`]?(g(),p(`foreignObject`,{key:0,x:0,y:0,width:J.value.width,height:J.value.height,style:{pointerEvents:`none`}},[y(e.$slots,`chart-background`,{},void 0,!0)],8,Ve)):f(``,!0),P.value.curved?(g(),p(`g`,He,[(g(!0),p(we,null,v(bt.value,(e,t)=>(g(),p(`path`,{d:e.curve,"stroke-width":Y.value.mark,stroke:V.value>=t?e.color:P.value.inactiveColor,"stroke-linecap":`round`,fill:`none`,class:m({"vue-ui-tick-animated":F.value.animation.use&&!x(w)&&t<=V.value})},null,10,Ue))),256))])):(g(),p(`g`,We,[(g(!0),p(we,null,v(bt.value,(e,t)=>(g(),p(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,"stroke-width":Y.value.mark,stroke:V.value>=t?e.color:P.value.inactiveColor,"stroke-linecap":`round`},null,8,Ge))),256))])),F.value.percentage.show?(g(),p(`g`,{key:3,role:`status`,"aria-live":`polite`,"aria-label":x(I)?`...`:`${Mt.value}`},[x(I)?(g(),p(`rect`,{key:0,x:yt.value.x,y:yt.value.y,width:40,height:X.value.fontSize,fill:`#6A6A6A80`,rx:3},null,8,qe)):(g(),p(`text`,{key:1,"aria-hidden":`true`,x:X.value.x,y:X.value.y,"font-size":X.value.fontSize,fill:P.value.ticks.gradient.show&&F.value.percentage.useGradientColor?x(ne)(P.value.activeColor,V.value/100*(P.value.ticks.gradient.shiftHueIntensity/100)):F.value.percentage.color,"font-weight":X.value.bold?`bold`:`normal`,"text-anchor":X.value.textAnchor},b(Mt.value),9,Je))],8,Ke)):f(``,!0),y(e.$slots,`svg`,{svg:{...J.value,isPrintingImg:x(z)||x(B)||x($),isPrintingSvg:x(Et)}},void 0,!0)],14,Re)),e.$slots.watermark?(g(),p(`div`,Ye,[y(e.$slots,`watermark`,h(ke({isPrinting:x(z)||x(B)||x($)||x(Et)})),void 0,!0)])):f(``,!0),e.$slots.source?(g(),p(`div`,{key:5,ref_key:`source`,ref:rt,dir:`auto`},[y(e.$slots,`source`,{},void 0,!0)],512)):f(``,!0),y(e.$slots,`skeleton`,{},()=>[x(I)?(g(),d(Se,{key:0})):f(``,!0)],!0)],46,Le))}},[[`__scopeId`,`data-v-72a361b1`]]);export{Ie as n,C as t};
@@ -1 +1 @@
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}from"./annotationViewport-X8fvs7pz.js";import{n as c,t as l}from"./tableIntegration-CNoJ1CIY.js";import{t as u}from"./chartImage-DPGnEuYM.js";import{n as d}from"./resolveChartConfig-0IvbmIE_.js";import{$ as f,D as ee,Dt as te,Ft as ne,Ht as p,S as m,X as re,Zt as ie,at as ae,et as oe,i as se,in as ce,nt as le,r as ue,t as de,w as fe,zt as pe}from"./lib-rPeBMZrn.js";import{n as me,t as he}from"./useHints-C-TwxM0Y.js";import{t as ge}from"./useConfig-CXhXxWjB.js";import{t as _e}from"./useLoading-DoqqfnmS.js";import{t as ve}from"./usePrinter-DVf3YcG5.js";import{t as ye}from"./useResponsive-CENUxfEL.js";import{t as be}from"./useChartExport-BZts4KFb.js";import{t as xe}from"./useTransitions-ChGGrtrv.js";import{t as Se}from"./useUserOptionState-CXlFnwPv.js";import{t as Ce}from"./useChartAccessibility-DOMuYJfm.js";import{t as we}from"./usePanZoom-DlEcNgCv.js";import{n as Te}from"./Title-BliHuXfT.js";import{t as Ee}from"./vue_ui_treemap-Bgcc2FKO.js";import{t as De}from"./Legend-W9YVYVX-.js";import{t as Oe}from"./BaseIcon-CoY0vuL3.js";import{t as ke}from"./BaseScanner-m6QR9rwD.js";import{t as Ae}from"./A11yDataTable-DWNlWXzs.js";import{t as je}from"./BaseLegendToggle-VzX69MCo.js";import{t as Me}from"./DefGrad-DKMq1REY.js";import{t as Ne}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as h,Teleport as Pe,computed as g,createBlock as _,createCommentVNode as v,createElementBlock as y,createElementVNode as b,createSlots as Fe,createTextVNode as Ie,createVNode as Le,defineAsyncComponent as Re,guardReactiveProps as x,mergeProps as ze,nextTick as Be,normalizeClass as Ve,normalizeProps as S,normalizeStyle as C,onBeforeUnmount as He,onMounted as Ue,openBlock as w,ref as T,renderList as We,renderSlot as E,resolveDynamicComponent as Ge,shallowRef as Ke,toDisplayString as qe,toRefs as Je,unref as D,useCssVars as Ye,useSlots as Xe,watch as Ze,withCtx as O,withKeys as Qe,withModifiers as $e}from"vue";function et(e,t){let n=e.length;if(n===0)throw Error(`Max aspect ratio cannot be computed: ${e} is an empty array`);{let r=1/0,i=-1/0,a=0;for(let t=0;t<n;t+=1){let n=e[t].normalizedValue;n<r&&(r=n),n>i&&(i=n),a+=n}return Math.max(t**2*i/a**2,a**2/(t**2*r))}}function tt(e){let{xOffset:t,yOffset:n,width:r,height:i}=e;return{x0:t,y0:n,x1:t+r,y1:n+i}}function nt(e,t,n){if(e.length===0)return!0;{let r=e.concat(t);return et(e,n)>=et(r,n)}}function rt(e){let t=[],n=e.length;for(let r=0;r<n;r+=1){let n=e[r],i=n.length;for(let e=0;e<i;e+=1)t.push(n[e])}return t}function it(e,t){return ut({...t,children:e})}function at(e){return(e.x1-e.x0)*(e.y1-e.y0)}function ot(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=lt(t),o=e.length,s=e.map(e=>e.normalizedValue||0).reduce((e,t)=>e+t,0),c=s/r,l=s/n,u=i,d=a,f=[];if(n>=r){for(let t=0;t<o;t+=1){let n=e[t],r=d+n.normalizedValue/c,i={x0:u,y0:d,x1:u+c,y1:r},a=Object.assign({},n,i);d=r,f.push(a)}return f}for(let t=0;t<o;t+=1){let n=e[t],r=u+n.normalizedValue/l,i={x0:u,y0:d,x1:r,y1:d+l},a=Object.assign({},n,i);u=r,f.push(a)}return f}function st(e){let t=lt(e),n=t.width,r=t.height;return Math.min(n,r)}function ct(e,t){let n=e.length,r=t/e.map(e=>e.value??0).reduce((e,t)=>e+t,0),i=[],a,o;for(let t=0;t<n;t+=1)o=e[t],a=Object.assign({},o,{normalizedValue:o.value*(r||0)}),i.push(a);return i}function lt(e){let{x0:t,y0:n,x1:r,y1:i}=e;return{xOffset:t,yOffset:n,width:r-t,height:i-n}}function k(e,t,n,r){let i=e,a=t,o=n,s=r;for(;;){let e=i.length;if(e===0){let e=ot(a,o);return s.concat(e)}let t=st(o),n=i[0],r=i.slice(1,e);if(nt(a,n,t)){let e=a.concat(n);i=r,a=e,o=o,s=s}else{let e=a.length,t=0;for(let n=0;n<e;n+=1)t+=a[n].normalizedValue;let n=dt(o,t),r=ot(a,o),c=s.concat(r);i=i,a=[],o=n,s=c}}}function ut(e){if(e.children===void 0||!e.children.length)return[e];{let t=k(ct(e.children,at(e)),[],e,[]),n=t.length,r=[];for(let e=0;e<n;e+=1)r.push(ut(t[e]));return rt(r)}}function dt(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=lt(e);if(n>=r){let e=t/r,o=n-e;return tt({xOffset:i+e,yOffset:a,width:o,height:r})}{let e=t/n,o=r-e;return tt({xOffset:i,yOffset:a+e,width:n,height:o})}}var ft=/* @__PURE__ */ e({default:()=>Vt}),pt=[`id`],mt=[`id`],ht=[`id`],gt=[`tabindex`,`onClick`,`onKeydown`,`data-last-crumb`,`onMouseenter`,`onFocus`],_t={class:`vue-ui-treemap-crumb-unit`},vt={class:`vue-ui-treemap-crumb-unit-label`},yt={key:0,style:{width:`24px`,display:`flex`,"align-items":`center`}},bt={key:0,class:`vue-ui-treemap-crumb-unit-arrow`},xt={style:{position:`relative`}},St=[`xmlns`,`aria-describedby`,`viewBox`],Ct={key:0},wt=[`x`,`y`,`height`,`width`,`fill`,`rx`,`stroke`,`stroke-width`,`onClick`,`onMouseenter`,`onMouseleave`],Tt=[`id`],Et=[`x`,`y`,`width`,`height`],Dt=[`clip-path`],Ot=[`transform`],kt=[`transform`],At=[`x`,`y`,`fill`,`font-size`,`font-family`,`font-weight`],jt={key:0},Mt=[`x`,`y`,`height`,`width`],Nt={style:{width:`100%`,height:`100%`,overflow:`hidden`},class:`vue-ui-treemap-cell`},Pt={key:0,"data-dom-to-png-ignore":``,class:`reset-wrapper`},Ft={key:1,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},It={key:6,class:`vue-data-ui-watermark`},Lt=[`id`],Rt=[`onClick`],zt={style:{display:`flex`,"align-items":`center`}},Bt=4,Vt=/*#__PURE__*/ Ne({__name:`vue-ui-treemap`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:Ne,emit:et}){Ye(e=>({c4fef8dc:Mi.value}));let tt=Re(()=>import(`./DataTable-KeuZB1JM.js`)),nt=Re(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),rt=Re(()=>import(`./vue-ui-accordion-D3uT1Ynv.js`).then(e=>e.n)),at=Re(()=>import(`./Tooltip-B432XpvC.js`)),ot=Re(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),st=Re(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),ct=Re(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_treemap:lt}=ge(),k=e,ut=et,dt=Xe(),ft=g(()=>!!k.dataset&&k.dataset.length),Vt=g(()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),A=T(re()),Ht=T(!1),Ut=T(``),Wt=T(!1),Gt=T(0),j=T([]),M=Ke(null),Kt=Ke(null),qt=Ke(null),Jt=Ke(null),Yt=Ke(null),Xt=T(0),Zt=T(0),Qt=T(0),N=T([]),$t=T(null),en=T(!1),tn=T(null),nn=T(null),P=T(null),rn=T({x:0,y:0}),an=T(`pointer`),on=T(!1),F=T(_n()),sn=g(()=>F.value.userOptions),I=g(()=>F.value.style.chart.tooltip),L=g(()=>F.value.style.chart.legend),R=g(()=>F.value.style.chart.layout.labels),z=g(()=>F.value.style.chart.layout),B=g(()=>F.value.style.chart);me({config:()=>F.value,dataset:()=>k.dataset,component:`VueUiTreemap`,rules:[he.emptyArray,{test:e=>e.length===1&&e[0]?.children&&e[0].children.length<6&&e[0].children.length>0||e.flatMap(e=>e?.children?.length??0).reduce((e,t)=>e+t,0)<6,message:[`👀 The number of data points is < 6. Consider:`,``,`▶️ Using another type of chart instead to better show proportions: VueUiDonut, VueUiWaffle`]},{test:e=>e.length===1&&e[0]?.children&&e[0].children.length===0,message:[`👀 There is a series defined in the dataset but it has no children items.`,``,`▶️ Add children items to your series.`]}]});let{transitionEnabled:cn}=xe({config:()=>F.value.transitions,dataset:()=>k.dataset}),V=g(()=>F.value.userOptions.useCursorPointer),ln=g(()=>ce({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#999999`,layout:{labels:{showDefaultLabels:!1},rects:{stroke:`#6A6A6A`}},legend:{backgroundColor:`transparent`}}}},userConfig:F.value.skeletonConfig??{}})),{loading:un,FINAL_DATASET:dn,manualLoading:fn}=_e({...Je(k),FINAL_CONFIG:F,prepareConfig:_n,skeletonDataset:k.config?.skeletonDataset??[{name:`_`,value:53,color:`#CACACA90`,children:[{name:`_`,value:21},{name:`_`,value:13},{name:`_`,value:8},{name:`_`,value:5},{name:`_`,value:3},{name:`_`,value:2},{name:`_`,value:1}]}],skeletonConfig:ce({defaultConfig:F.value,userConfig:ln.value})}),{userOptionsVisible:pn,setUserOptionsVisibility:mn,keepUserOptionState:hn}=Se({config:F.value}),{svgRef:gn}=Ce({config:B.value.title});function _n(){return d(k.config,lt,Ee)}let vn=ie(k.config);Ze(()=>k.config,(e,t)=>{let n=ie(e),r=n!==vn;vn=n;let i=_n();r?(un.value||(F.value=i),pn.value=!F.value.userOptions.showOnChartHover,Xt.value+=1,Zt.value+=1,Qt.value+=1,H.value.showTable=F.value.table.show,H.value.showTooltip=I.value.show,H.value.showZoom=B.value.zoom?.show??!1):(F.value.style.chart.tooltip=i.style.chart.tooltip,H.value.showTooltip=F.value.style.chart.tooltip.show)},{deep:!0});let{isPrinting:yn,isImaging:bn,generatePdf:xn,generateImage:Sn}=ve({elementId:`treemap_${A.value}`,fileName:B.value.title.text||`vue-ui-treemap`,options:F.value.userOptions.print}),Cn=g(()=>F.value.userOptions.show&&!B.value.title.text),wn=g(()=>fe(F.value.customPalette)),H=T({showTable:F.value.table.show,showTooltip:I.value.show,showZoom:B.value.zoom?.show??!1});Ze(F,()=>{H.value={showTable:F.value.table.show,showTooltip:I.value.show,showZoom:B.value.zoom?.show??!1}},{immediate:!0});let Tn=T({height:B.value.height,width:B.value.width});function En(e){let t=M.value,n=Tn.value.height;return!t||!n?e:e*(n/t.getBoundingClientRect().height)}function Dn(){if(!$t.value||X.value.length<=1)return 0;let e=$t.value,t=getComputedStyle(e);return En(e.offsetHeight+parseFloat(t.marginTop||`0`)+parseFloat(t.marginBottom||`0`)+parseFloat(t.paddingTop||`0`)+parseFloat(t.paddingBottom||`0`))}let U=g(()=>{let e=B.value.padding,t=Tn.value.width,n=Tn.value.height,r=Dn(),i=e.left,a=t-e.right,o=e.top,s=n-e.bottom-r;return{left:i,top:o,right:a,bottom:s,width:a-i,height:Math.max(0,s-o),vbWidth:t,vbHeight:n-r,offsetY:r}}),W=T(oe(dn.value)),On=T(W.value),kn=Ke(/* @__PURE__ */ new Map);Ze(()=>j.value,()=>{Pn(),Qt.value+=1,Zt.value+=1},{deep:!0});function An(e){Array.isArray(e)&&e.forEach((e,t)=>{e.id||=re(),e.sourceColor===void 0&&(e.sourceColor=m(e.color)||null);let n=e.sourceColor||kn.value.get(e.id)||wn.value[t]||p[t]||p[t%p.length];n=m(n),kn.value.set(e.id,n),e.color=n,jn(e,n)})}function jn(e,t){Array.isArray(e.children)&&e.children.forEach(n=>{n.id||=re(),n.parentId=e.id,n.sourceColor===void 0&&(n.sourceColor=m(n.color)||null);let r=n.sourceColor||t;n.color=r,jn(n,r)})}let Mn=g(()=>{let e=/* @__PURE__ */ new Map;function t(n){for(let r of n)e.set(r.id,r),Array.isArray(r.children)&&t(r.children)}return t(W.value),e});function G(e){return Mn.value.get(e)??null}function Nn(e){let t=G(e);for(;t?.parentId;)t=G(t.parentId);return t?.id??null}function Pn(){let e=W.value.filter(e=>!j.value.includes(e.id));if(!N.value.length){On.value=e;return}let t=N.value[N.value.length-1],n=G(t);if(!n){N.value=[],On.value=e;return}let r=Nn(n.id);r&&j.value.includes(r)?(N.value=[],On.value=e):On.value=[n]}Ze(()=>dn.value,()=>{W.value=oe(dn.value),An(W.value),Pn(),Qt.value+=1,Zt.value+=1},{deep:!0,immediate:!0,flush:`post`});let Fn=Ke(null),In=null,Ln=null,Rn=!1;function zn(){Fn.value?.disconnect(),Fn.value=null,In!==null&&cancelAnimationFrame(In),In=null}function Bn(){if(zn(),Rn||!M.value)return;if(!F.value.responsive){Tn.value={width:B.value.width,height:B.value.height};return}let e=()=>{!Rn&&F.value.responsive&&In===null&&(In=requestAnimationFrame(()=>{if(In=null,Rn)return;let{width:e,height:t}=ye({chart:M.value,title:B.value.title.text?Kt.value:null,legend:L.value.show?qt.value:null,source:Jt.value,noTitle:Yt.value});Tn.value={width:e,height:t-12}}))};Fn.value=new ResizeObserver(e),Fn.value.observe(M.value.parentNode),e()}Ze([()=>F.value.responsive,()=>B.value.width,()=>B.value.height],Bn,{flush:`post`}),Ue(()=>{en.value=!0,Hn()});let Vn=g(()=>F.value.debug);Ue(()=>{dt[`chart-background`]&&Vn.value&&console.warn(`VueUiTreemap does not support the #chart-background slot.`)});function Hn(){pe(k.dataset)&&ae({componentName:`VueUiTreemap`,type:`dataset`,debug:Vn.value}),An(W.value),pe(k.dataset)||(fn.value=F.value.loading),Bn()}He(()=>{Rn=!0,zn(),clearTimeout(Ln)});let Un=g(()=>On.value.map((e,t)=>({...e,color:m(e.color)||wn.value[t]||p[t]||p[t%p.length]})).filter(e=>!j.value.includes(e.id))),Wn=g(()=>W.value.filter(e=>!j.value.includes(e.id)).map(e=>e.value||0).reduce((e,t)=>e+t,0)),Gn=g(()=>{let e=[...Un.value];return z.value.sorted?e.sort((e,t)=>t.value-e.value):e});function Kn(e,t){return e.value/t}function qn(e,t,n){let r=z.value.rects.colorRatio-Kn(t,n);return ne(e,r<0?0:r)}function Jn(e){return Array.isArray(e.children)&&e.children.length>0}function Yn(e){return[...e].sort((e,t)=>{let n=Jn(e),r=Jn(t);if(n!==r)return n-r;let i=Number(e.value)||0;return(Number(t.value)||0)-i})}function Xn(e,t,n,r,i){return Yn(e).map((e,a)=>{let o=e.sourceColor||m(e.color)||m(t)||wn.value[a]||p[a]||p[a%p.length],s=e.sourceColor?e.sourceColor:qn(o,e,r),c=Kn(e,r),l=i??e.parentId??e.id,u=Array.isArray(e.children)&&e.children.length&&e.children.reduce((e,t)=>e+(Number(t.value)||0),0)||1;return{...e,color:s,proportion:c,parentName:n,rootId:l,children:Array.isArray(e.children)&&e.children.length?Xn(e.children,o,e.name,u,l):void 0}})}function Zn(e){let t=lr(e),n=Qn(e),r=t*.55,i=t*.55,a=t*1.05,o=t*1.05,s=t*.35,c=n?a+o+s:t*.45,l=e.x0+r,u=e.x1-r,d=e.y0+c,f=e.y1-i;return u<=l||f<=d?null:{x0:l,y0:d,x1:u,y1:f}}function Qn(e){return R.value.hideUnderProportion===0||$n(e)}function $n(e){let t=Number(R.value.hideUnderProportion);return!Number.isFinite(t)||t<=0||e.proportion>t}function er(e,t,n=0,r=null){if(!Array.isArray(e)||!e.length)return[];let i=e.map(e=>{let{children:t,...n}=e;return{...n}}),a=new Map(e.map(e=>[e.id,Array.isArray(e.children)?e.children:[]])),o=new Map(e.map(e=>[e.id,e])),s=it(i,t),c=[];for(let e of s){let t=a.get(e.id)||[],i=o.get(e.id),s={...e,depth:n,parentId:r??e.parentId??null,color:i?.color??e.color??null,children:t,isVisibleNode:!0,showLabel:Qn(e)};if(c.push(s),t.length){let r=Zn(s);r&&c.push(...er(t,r,n+1,e.id))}}return c}let K=g(()=>{let e=Gn.value,t=e.map(e=>Number(e.value)||0).reduce((e,t)=>e+t,0)||1;return er(e.map((e,n)=>{let r=e.children?e.children.reduce((e,t)=>e+(Number(t.value)||0),0):e.value,{children:i,...a}=e,o=e.sourceColor||m(e.color)||kn.value.get(e.id)||wn.value[n]||p[n]||p[n%p.length],s=e.sourceColor?e.sourceColor:qn(o,e,t);return{...a,id:e.id||re(),parentId:e.parentId??null,name:e.name,value:e.value,color:s,proportion:(Number(e.value)||0)/t,children:Array.isArray(e.children)&&e.children.length?Xn(e.children,o,e.name,r||1):void 0}}),{x0:U.value.left,y0:U.value.top,x1:U.value.left+U.value.width,y1:U.value.top+U.value.height})});function tr(e){return(Z.value&&Z.value.id===e.id?z.value.rects.selected.strokeWidth:z.value.rects.strokeWidth)*qr.value}function q({y0:e,y1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function J({x0:e,x1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function nr(){let e=R.value,t=Number(e.minFontSize),n=Number(e.fontSize),r=Math.max(0,Math.min(Number.isFinite(t)?t:0,Number.isFinite(n)?n:0));return{lowerBound:r,upperBound:Math.max(r,Number.isFinite(n)?n:r)}}function rr(e){let t=Math.min(4,Math.max(e*.25,.5));return{paddingX:t,paddingTop:t}}function ir(e,t){let{paddingX:n,paddingTop:r}=rr(t),i=t*1.1;return{x:e.x0+n,y:e.y0+r,width:Math.max(J(e)-n*2,0),height:Math.max(q(e)-r*2,0),lineHeight:i}}function ar(e,t){return se(R.value.formatter,e.value,f({p:R.value.prefix,v:e.value,s:R.value.suffix,r:I.value.roundingValue}),{datapoint:e,seriesIndex:t})}function or(e,t){let n=ar(e,t);return Array.isArray(e.children)&&e.children.length?[`${e.name} (${n})`]:[`${e.name}`,n].filter(e=>`${e}`.length)}function sr(e,t,n){let r=ir(e,t);return!n.length||r.width<=0||r.height<=0||n.length*r.lineHeight>r.height?!1:n.every((e,n)=>wi(e,t,n===0?500:400)<=r.width)}function cr(e,t,n,r){let i=Math.max(1,...t.map(e=>String(e).length)),a=Math.min(18,Math.max(10,Math.ceil(i*.7))),o=Math.max(1,t.length),s=Math.max(J(e)-1,1e-4),c=Math.max(q(e)-1,1e-4),l=s/(a*.58),u=c/(o*1.35);return Math.max(n,Math.min(r,l,u))}function lr(e,t,n=or(e,t)){let{lowerBound:r,upperBound:i}=nr(),a=Math.max(1e-4,Math.min(J(e),q(e))),o=Math.max(r,Math.min(i,a*.9)),s=Math.min(o,cr(e,n,r,i));if(sr(e,s,n)||!sr(e,r,n))return s;let c=r,l=s,u=r;for(let t=0;t<8;t+=1){let t=(c+l)/2;sr(e,t,n)?(u=t,c=t):l=t}let d=Math.max(r,s*.7);return u>=d?u:s}function ur(e){Wt.value=e,Gt.value+=1}let Y=g(()=>({x:0,y:0,width:U.value.vbWidth,height:U.value.vbHeight}));function dr(e){let t=[],n=G(e);for(;n&&n.parentId;){let e=G(n.parentId);if(!e)break;t.unshift(e.id),n=e}return t}let fr=g(()=>N.value.length>0);function pr(){On.value=W.value.slice(),N.value=[],ut(`selectDatapoint`,void 0)}function mr(){return N.value[N.value.length-1]??null}function hr(e,t,n){N.value=[...dr(e.id),e.id],On.value=[e],F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:t??e,seriesIndex:n}),ut(`selectDatapoint`,t??e)}function gr(e,t){let n=mr();if(!n){pr();return}let r=G(n);if(!r?.parentId){F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:e,seriesIndex:t}),pr();return}let i=G(r.parentId);i?(N.value=[...dr(i.id),i.id],On.value=[i],F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:e,seriesIndex:t}),ut(`selectDatapoint`,e)):pr()}function _r(e,t){if(!e){pr();return}let n=G(e.id);n&&(mr()===n.id?gr(e,t):hr(n,e,t))}function vr(e){return e?mr()===e.id:!1}let X=g(()=>{let e=[{id:null,label:`All`}];if(N.value.length>0){let t=G(N.value[N.value.length-1]),n=[];for(;t;)n.unshift(t),t=t.parentId?G(t.parentId):null;for(let t of n)e.push({id:t.id,label:t.name,node:t})}return e}),Z=Ke(null),yr=g(()=>W.value.reduce((e,t)=>e+t.value,0));function br(e){let t=L.value,n=t.showValue?se(R.value.formatter,e.value,f({p:R.value.prefix,v:e.value,s:R.value.suffix,r:t.roundingValue}),{datapoint:e}):``,r=``;return t.showPercentage&&(r=j.value.includes(e.id)?`- %`:`${isNaN(e.value/Wn.value)?`-`:(e.value/Wn.value*100).toFixed(t.roundingPercentage)}%`,t.showValue&&(r=` (${r})`)),`${e.name}${t.showPercentage||t.showValue?`: `:``}${n}${r}`}let xr=g(()=>W.value.map((e,t)=>({...e,color:m(e.color)||wn.value[t]||p[t]||p[t%p.length],shape:`square`})).sort((e,t)=>t.value-e.value).map((e,t)=>({...e,proportion:e.value/yr.value,isSegregated:j.value.includes(e.id),segregate:()=>Tr(e),opacity:j.value.includes(e.id)?.5:1,display:br(e)}))),Sr=g(()=>({cy:`treemap-div-legend`,backgroundColor:L.value.backgroundColor,color:L.value.color,fontSize:L.value.fontSize,paddingBottom:12,fontWeight:L.value.bold?`bold`:``})),Cr=g(()=>j.value.length===xr.value.length);function wr(){j.value.length?j.value=[]:xr.value.forEach(e=>{j.value.push(e.id)}),ut(`selectLegend`,W.value.filter(e=>!j.value.includes(e.id)))}function Tr(e){Z.value=null,j.value.includes(e.id)?j.value=j.value.filter(t=>t!==e.id):j.value.length<k.dataset.length-1&&j.value.push(e.id),ut(`selectLegend`,W.value.filter(e=>!j.value.includes(e.id)))}function Er(e){return W.value.length?W.value.find(t=>t.name===e)||(Vn.value&&console.warn(`VueUiTreemap - Series name not found "${e}"`),null):(Vn.value&&console.warn(`VueUiTreemap - There are no series to show.`),null)}function Dr(e){let t=Er(e);t!==null&&j.value.includes(t.id)&&Tr({id:t.id})}function Or(e){let t=Er(e);t!==null&&(j.value.includes(t.id)||Tr({id:t.id}))}function kr({datapoint:e,seriesIndex:t}){Z.value=null,Ht.value=!1,P.value=null,an.value=`pointer`,F.value.events.datapointLeave&&F.value.events.datapointLeave({datapoint:e,seriesIndex:t})}let Ar=T(null);function jr({datapoint:e,seriesIndex:t,triggerMode:n=`pointer`}){if(Cr.value||n===`pointer`&&Vr.value)return;F.value.events.datapointEnter&&F.value.events.datapointEnter({datapoint:e,seriesIndex:t}),P.value=t,an.value=n,Z.value=e,Ar.value={datapoint:e,seriesIndex:t,config:F.value,series:Un.value};let r=I.value.customFormat,i=te(r)?r(Ar.value):void 0;if(typeof i==`string`)Ut.value=i;else{let n=``;n+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${I.value.borderColor};padding-bottom:6px;margin-bottom:3px;">${e.name}</div>`,n+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" fill="${e.color}"/></svg>`,n+=`<b>${se(R.value.formatter,e.value,f({p:R.value.prefix,v:e.value,s:R.value.suffix,r:I.value.roundingValue}),{datapoint:e,seriesIndex:t})}</b>`,Ut.value=`<div>${n}</div>`}Ht.value=!0}let Q=g(()=>({head:K.value.map(e=>({name:e.name,color:e.color})),body:K.value.map(e=>e.value)}));function Mr(e=null){Be(()=>{let t=Q.value.head.map((e,t)=>[[e.name],[Q.value.body[t]],[isNaN(Q.value.body[t]/Wn.value)?`-`:Q.value.body[t]/Wn.value*100]]),n=[[B.value.title.text],[B.value.title.subtitle.text],[[``],[`val`],[`%`]]].concat(t),r=ee(n);e?e(r):le({csvContent:r,title:B.value.title.text||`vue-ui-treemap`})})}let Nr=g(()=>{let e=[F.value.table.columnNames.series,F.value.table.columnNames.value,F.value.table.columnNames.percentage],t=Q.value.head.map((e,t)=>{let n=se(R.value.formatter,Q.value.body[t],f({p:R.value.prefix,v:Q.value.body[t],s:R.value.suffix,r:F.value.table.td.roundingValue}));return[{color:e.color,name:e.name,shape:`square`},n,isNaN(Q.value.body[t]/Wn.value)?`-`:f({v:Q.value.body[t]/Wn.value*100,s:`%`,r:F.value.table.td.roundingPercentage})]}),n={th:{backgroundColor:F.value.table.th.backgroundColor,color:F.value.table.th.color,outline:F.value.table.th.outline},td:{backgroundColor:F.value.table.td.backgroundColor,color:F.value.table.td.color,outline:F.value.table.td.outline},breakpoint:F.value.table.responsiveBreakpoint};return{colNames:[F.value.table.columnNames.series,F.value.table.columnNames.value],head:e,body:t,config:n}});function Pr(){return K.value}function Fr(){H.value.showTable=!H.value.showTable}function Ir(){H.value.showTooltip=!H.value.showTooltip}function Lr(){H.value.showZoom=!H.value.showZoom}let Rr=T(!1);function zr(){Rr.value=!Rr.value}let Br=g(()=>!Rr.value&&H.value.showZoom),Vr=T(null),Hr=T(!1),{viewBox:$,resetZoom:Ur,isZoom:Wr,setInitialViewBox:Gr,scale:Kr}=we(gn,{x:Y.value.x,y:Y.value.y,width:Math.max(10,Y.value.width),height:Math.max(10,Y.value.height)},1,Br),qr=g(()=>1/Kr.value),Jr=g(()=>Math.min(1,R.value.fontSizeZoomFactor/Math.max(Kr.value,1e-4))),Yr=g(()=>`scale(${Jr.value})`),Xr=g(()=>H.value.showZoom||Wr.value);Ze([()=>Y.value.x,()=>Y.value.y,()=>Y.value.width,()=>Y.value.height],()=>{Be(()=>{Gr({x:Y.value.x,y:Y.value.y,width:Math.max(10,Y.value.width),height:Math.max(10,Y.value.height)})})},{immediate:!0});function Zr(e){Br.value&&(e.button===void 0||e.button===0)&&(Vr.value={x:e.clientX,y:e.clientY},Hr.value=!1)}function Qr(e){if(!Br.value||!Vr.value)return;let t=e.clientX-Vr.value.x,n=e.clientY-Vr.value.y;Math.hypot(t,n)>Bt&&(Hr.value=!0)}function $r(){Vr.value=null,Hr.value&&(clearTimeout(Ln),Ln=window.setTimeout(()=>{Hr.value=!1,Ln=null},0))}function ei(e,t){Hr.value||_r(e,t)}let ti=T(null);function ni(e){ti.value=e}function ri(){ti.value=null}let ii=u(M,()=>B.value.title.text),ai=g(()=>l({config:F,style:B,mutableConfig:H,dialog:ct,accordion:rt,isFullscreen:Wt,parent:M,maxWidth:800,isCursorPointer:V}));Ze(()=>H.value.showTable,e=>c(e,F,tn));function oi(){H.value.showTable=!1,nn.value&&nn.value.setTableIconState(!1)}let si=g(()=>xr.value.map(e=>({...e,name:e.display}))),ci=g(()=>B.value.backgroundColor),li=g(()=>B.value.title),{isCallbackImaging:ui,isCallbackSvg:di,generateSvg:fi,onGenerateImage:pi}=be({svg:gn,title:li,legend:L,legendItems:si,backgroundColor:ci,getSvgCallback:()=>F.value.userOptions.callbacks.svg,generateImage:Sn});function mi(e,t,n){let r=lr(e,t,n),{paddingX:i,paddingTop:a}=rr(r);return{fontSize:r,paddingX:i,paddingTop:a,lineHeight:r*1.1}}function hi(e){return ue(e.color??B.value.backgroundColor)}function gi({availableHeight:e,lineHeight:t,lineIndex:n}){if(n===0)return 1/0;let r=e/(n+1);return r<1e-4?-1/0:t<=0?1/0:r/t}function _i(){return Number(R.value.hideUnderProportion)===0}function vi(e){let t=Jr.value;return e.alwaysShowAllLines?`scale(${Math.min(t,e.allLinesScaleCap)})`:Yr.value}function yi({rect:e,seriesIndex:t}){if(!e||!R.value.showDefaultLabels||!Qn(e))return null;let n=or(e,t).map(e=>String(e??``)),{fontSize:r,paddingX:i,paddingTop:a,lineHeight:o}=mi(e,t,n),s=hi(e),c=ir(e,r);if(!n.some(Boolean)||c.width<=0||c.height<=0)return null;let l=_i(),u=l?Math.max(1e-4,Math.min(1,c.height/Math.max(n.length*o,1e-4))):1,d=`treemap_clip_${A.value}_${e.id}`,f=e.x0,ee=e.y0,te=Math.max(J(e),0),ne=Math.max(q(e),0);return{key:bi(e),clipId:d,clipX:f,clipY:ee,clipWidth:te,clipHeight:ne,translate:`translate(${e.x0}, ${e.y0})`,alwaysShowAllLines:l,allLinesScaleCap:u,lines:n.map((t,n)=>({key:`${e.id}_${n}`,text:t,x:i,y:a+o*n,maxZoomFactor:gi({availableHeight:c.height,lineHeight:o,lineIndex:n}),fill:s,fontSize:r,fontFamily:F.value.style.fontFamily,fontWeight:n===0?500:400}))}}function bi(e){return`${e.id}`}let xi=g(()=>dt.rect||un.value||!R.value.showDefaultLabels||Cr.value?[]:K.value.map((e,t)=>e.showLabel?yi({rect:e,seriesIndex:t}):null).filter(Boolean)),Si;function Ci(){return typeof document>`u`?null:(Si||=document.createElement(`canvas`),Si.getContext(`2d`))}function wi(e,t,n=400){let r=Ci();return r?(r.font=`${n} ${t}px ${F.value.style.fontFamily}`,r.measureText(String(e)).width):e.length*t*.6}function Ti(e){let t=z.value.rects.borderRadius,n=J(e),r=q(e);return Math.min(t,Math.min(n,r)/6)}async function Ei(){ut(`copyAlt`,{config:F.value,dataset:K.value}),F.value.userOptions.callbacks.altCopy?await Promise.resolve(F.value.userOptions.callbacks.altCopy({config:F.value,dataset:K.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Di(){P.value=null,on.value=!0}function Oi(){P.value=null,an.value=`pointer`,Ht.value=!1,Z.value=null,on.value=!1}function ki(e){if(!gn.value||Rr.value||document.activeElement!==gn.value||!K.value.length||Cr.value)return;let t=[`ArrowLeft`,`ArrowUp`].includes(e.key),n=[`ArrowRight`,`ArrowDown`].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){P.value=null,an.value=`pointer`,Ht.value=!1,Z.value=null;return}if(r){if(P.value===null)return;let e=K.value[P.value];if(!e)return;_r(e,P.value);return}let a=P.value,o=Z.value?K.value.findIndex(e=>e.id===Z.value.id):null,s=a!==null&&a>=0&&a<K.value.length,c=o!==null&&o>=0&&o<K.value.length;s?n?(a+=1,a>=K.value.length&&(a=0)):t&&(--a,a<0&&(a=K.value.length-1)):c?(a=n?o+1:o-1,a>=K.value.length&&(a=0),a<0&&(a=K.value.length-1)):a=n?0:K.value.length-1;let l=K.value[a];l&&(Ai(a),jr({datapoint:l,seriesIndex:a,triggerMode:`keyboard`}))}function Ai(e){if(!Number.isFinite(e)||!gn.value)return;let t=K.value[e];if(!t)return;let n=t.x0+J(t)/2,r=t.y0+q(t)/2,i=gn.value.getBoundingClientRect();rn.value={x:i.left+(n-$.value.x)/$.value.width*i.width,y:i.top+(r-$.value.y)/$.value.height*i.height}}let ji=g(()=>({headers:Nr.value?.colNames??[],rows:Nr.value?.body??[]})),Mi=g(()=>B.value.color);Ne({getData:Pr,getImage:ii,generateCsv:Mr,generateImage:Sn,generateSvg:fi,generatePdf:xn,hideSeries:Or,showSeries:Dr,toggleTable:Fr,toggleTooltip:Ir,toggleZoom:Lr,toggleAnnotator:zr,toggleFullscreen:ur,resetZoom:Ur,copyAlt:Ei});let Ni=g(()=>s(F.value.userOptions?.annotator?.followZoom,$.value));return(e,s)=>(w(),y(`div`,{ref_key:`treemapChart`,ref:M,class:Ve(`vue-data-ui-component vue-ui-treemap ${Wt.value?`vue-data-ui-wrapper-fullscreen`:``} ${F.value.useCssAnimation?``:`vue-ui-dna`}`),style:C(`font-family:${F.value.style.fontFamily};width:100%; ${F.value.responsive?`height: 100%;`:``} text-align:center;background:${B.value.backgroundColor}`),id:`treemap_${A.value}`,onMouseenter:s[3]||=()=>D(mn)(!0),onMouseleave:s[4]||=()=>D(mn)(!1)},[b(`div`,{id:`chart-instructions-${A.value}`,class:`sr-only`},[b(`p`,null,qe(F.value.a11y.translations.keyboardNavigation),1)],8,mt),F.value.a11y.includeTable&&ji.value?.rows?.length?(w(),_(Ae,{key:0,uid:A.value,head:ji.value.headers,body:ji.value.rows,notice:F.value.a11y.translations.tableAvailable,caption:F.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):v(``,!0),sn.value.buttons.annotator?(w(),_(D(nt),ze({key:1},D(a)(sn.value.annotator),{svgRef:D(gn),followZoom:F.value.userOptions?.annotator?.followZoom,annotationViewport:Ni.value,backgroundColor:B.value.backgroundColor,color:B.value.color,active:Rr.value,isCursorPointer:V.value,palette:sn.value.annotatorPalette,onClose:zr}),Fe({_:2},[We(D(o),t=>({name:t,fn:O(n=>[E(e.$slots,t,S(x(D(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`followZoom`,`annotationViewport`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):v(``,!0),Cn.value?(w(),y(`div`,{key:2,ref_key:`noTitle`,ref:Yt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):v(``,!0),B.value.title.text?(w(),y(`div`,{key:3,ref_key:`chartTitle`,ref:Kt,style:C(`width:100%;background:${B.value.backgroundColor};padding-bottom:6px`)},[(w(),_(Te,{key:`title_${Xt.value}`,config:{title:{cy:`treemap-div-title`,...B.value.title},subtitle:{cy:`treemap-div-subtitle`,...B.value.title.subtitle}}},null,8,[`config`]))],4)):v(``,!0),b(`div`,{id:`legend-top-${A.value}`},null,8,ht),sn.value.show&&ft.value&&(D(hn)||D(pn))?(w(),_(D(ot),ze({ref_key:`userOptionsRef`,ref:nn,key:`user_option_${Gt.value}`,backgroundColor:B.value.backgroundColor,color:B.value.color,isPrinting:D(yn),isImaging:D(bn),uid:A.value,hasTooltip:sn.value.buttons.tooltip&&I.value.show,isFullscreen:Wt.value,isTooltip:H.value.showTooltip,chartElement:M.value},D(n)(sn.value,`pdf csv img svg table fullscreen altCopy annotator zoom`),{isAnnotation:Rr.value,tableDialog:F.value.table.useDialog,isCursorPointer:V.value,isZoom:H.value.showZoom,onToggleFullscreen:ur,onGeneratePdf:D(xn),onGenerateCsv:Mr,onGenerateImage:D(pi),onGenerateSvg:D(fi),onToggleTable:Fr,onToggleTooltip:Ir,onToggleAnnotator:zr,onToggleZoom:Lr,onCopyAlt:Ei,style:{visibility:D(hn)?D(pn)?`visible`:`hidden`:`visible`}}),Fe({_:2},[We(D(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionZoom optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:O(n=>[E(e.$slots,t,S(x(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasTooltip`,`isFullscreen`,`isTooltip`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`isZoom`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):v(``,!0),X.value.length>1?(w(),y(`nav`,{key:5,class:`vue-ui-treemap-breadcrumbs`,"data-dom-to-png-ignore":``,ref_key:`breadcrumbsNav`,ref:$t},[(w(!0),y(h,null,We(X.value,(t,n)=>(w(),y(`span`,{role:`button`,tabindex:n<X.value.length-1?0:void 0,key:t.id||`root`,onClick:e=>n===X.value.length-1?()=>{}:_r(t.node),onKeydown:[Qe($e(e=>n===X.value.length-1?void 0:_r(t.node),[`prevent`]),[`enter`]),Qe($e(e=>n===X.value.length-1?void 0:_r(t.node),[`prevent`]),[`space`])],class:`vue-ui-treemap-crumb`,"data-last-crumb":n===X.value.length-1,style:C({color:B.value.color,cursor:V.value?`pointer`:`default`}),onMouseenter:e=>ni(n),onMouseleave:ri,onFocus:e=>ni(n),onBlur:ri},[b(`span`,_t,[b(`span`,vt,[E(e.$slots,`breadcrumb-label`,ze({ref_for:!0},{crumb:t,isRoot:n===0,isFocus:ti.value===n}),()=>[n===0?(w(),y(`div`,yt,[Le(Oe,{name:ti.value===0?`homeFilled`:`home`,stroke:B.value.color},null,8,[`name`,`stroke`])])):(w(),y(h,{key:1},[Ie(qe(t.label),1)],64))],!0)]),n<X.value.length-1?(w(),y(`span`,bt,[E(e.$slots,`breadcrumb-arrow`,{},()=>[s[5]||=Ie(` › `,-1)],!0)])):v(``,!0)])],44,gt))),128))],512)):v(``,!0),b(`div`,xt,[(w(),y(`svg`,{ref_key:`svgRef`,ref:gn,xmlns:D(de),"aria-describedby":`chart-instructions-${A.value}`,class:Ve({"vue-data-ui-fullscreen--on":Wt.value,"vue-data-ui-fulscreen--off":!Wt.value,"vue-data-ui-zoom-plus":!fr.value,"vue-data-ui-zoom-minus":fr.value,"vue-data-ui-no-transition":!D(cn),loading:D(un)}),viewBox:`${D($).x} ${D($).y} ${D($).width<=0?10:D($).width} ${D($).height<=0?10:D($).height}`,style:C(`max-width:100%; overflow:${Xr.value?`hidden`:`visible`}; background:transparent;color:${B.value.color}`),tabindex:`0`,onFocus:Di,onBlur:Oi,onKeydown:ki,onPointerdown:Zr,onPointermove:Qr,onPointerup:$r,onPointercancel:$r,onPointerleave:$r},[Le(D(st)),E(e.$slots,`svg-underlayer`,S(x({svg:U.value,isZoom:fr.value,rect:Z.value,config:F.value,isPrintingImg:D(yn)||D(bn)||D(ui),isPrintingSvg:D(di)})),void 0,!0),(w(!0),y(h,null,We(K.value,(e,t)=>(w(),y(`g`,{key:`tgrad_${e.id}`},[z.value.rects.gradient.show?(w(),y(`defs`,Ct,[Le(Me,{t:`radial`,id:`tgrad_${e.id}`,gradientTransform:`translate(-1, -1.000001) scale(2, 2)`,stops:[[`18%`,e.color,1],[`100%`,D(ne)(e.color,z.value.rects.gradient.intensity/100),1]]},null,8,[`id`,`stops`])])):v(``,!0)]))),128)),b(`g`,null,[(w(!0),y(h,null,We(K.value,(e,t)=>(w(),y(`g`,{key:`rect_${e.id}_${e.depth}`},[b(`rect`,{x:e.x0,y:e.y0,height:q(e),width:J(e),fill:Vt.value?e.color??B.value.backgroundColor:z.value.rects.gradient.show?Cr.value?B.value.backgroundColor:`url(#tgrad_${e.id})`:e.color??B.value.backgroundColor,rx:D(Kr)>1?Ti(e)*qr.value:Ti(e),stroke:Z.value&&Z.value.id===e.id?z.value.rects.selected.stroke:z.value.rects.stroke,"stroke-width":tr(e),onClick:$e(n=>ei(e,t),[`stop`]),onMouseenter:()=>jr({datapoint:e,seriesIndex:t,triggerMode:`pointer`}),onMouseleave:n=>kr({datapoint:e,seriesIndex:t}),style:C(`opacity:${Z.value?Z.value.id===e.id?1:z.value.rects.selected.unselectedOpacity:1}`),class:Ve([`vue-ui-treemap-rect`,D(cn)?`vue-data-ui-transition`:``,vr(e)?`vue-data-ui-zoom-minus`:`vue-data-ui-zoom-plus`])},null,46,wt)]))),128)),(w(!0),y(h,null,We(xi.value,e=>(w(),y(`g`,{key:e.key,style:{"pointer-events":`none`}},[b(`defs`,null,[b(`clipPath`,{id:e.clipId,clipPathUnits:`userSpaceOnUse`},[b(`rect`,{class:Ve({"vue-data-ui-transition":D(cn)}),x:e.clipX,y:e.clipY,width:e.clipWidth,height:e.clipHeight},null,10,Et)],8,Tt)]),b(`g`,{"clip-path":`url(#${e.clipId})`},[b(`g`,{transform:e.translate},[b(`g`,{class:Ve({"vue-data-ui-transition":D(cn)}),transform:vi(e)},[(w(!0),y(h,null,We(e.lines,t=>(w(),y(h,{key:t.key},[t.text&&(e.alwaysShowAllLines||Jr.value<=t.maxZoomFactor)?(w(),y(`text`,{key:0,x:t.x,y:t.y,fill:t.fill,"font-size":t.fontSize,"font-family":t.fontFamily,"font-weight":t.fontWeight,class:Ve({"vue-data-ui-transition":D(cn)}),"text-anchor":`start`,"dominant-baseline":`text-before-edge`},qe(t.text),11,At)):v(``,!0)],64))),128))],10,kt)],8,Ot)],8,Dt)]))),128)),e.$slots.rect?(w(),y(`g`,jt,[(w(!0),y(h,null,We(K.value,(t,n)=>(w(),y(`g`,{key:`slot_${t.id}_${t.depth}`},[(w(),y(`foreignObject`,{x:t.x0,y:t.y0,height:q(t),width:J(t),class:`vue-ui-treemap-cell-foreignObject`,style:{"pointer-events":`none`,overflow:`hidden`}},[b(`div`,Nt,[D(un)?v(``,!0):E(e.$slots,`rect`,ze({ref_for:!0},{rect:{...t,height:q(t),width:J(t),isSelected:!Z.value||Z.value.id===t.id},shouldShow:$n(t)||fr.value,fontSize:lr(t,n),isZoom:fr.value,textColor:D(ue)(t.color)}),void 0,!0,0)])],8,Mt))]))),128))])):v(``,!0)]),E(e.$slots,`svg`,S(x({svg:U.value,isZoom:fr.value,rect:Z.value,config:F.value,isPrintingImg:D(yn)||D(bn)||D(ui),isPrintingSvg:D(di)})),void 0,!0)],46,St)),D(Wr)?(w(),y(`div`,Pt,[E(e.$slots,`reset-action`,{reset:D(Ur)},()=>[b(`button`,{"data-cy-reset":``,tabindex:`0`,role:`button`,class:`vue-data-ui-refresh-button`,style:C({background:B.value.backgroundColor,cursor:V.value?`pointer`:`default`}),onClick:s[0]||=e=>D(Ur)(!0)},[Le(Oe,{name:`refresh`,stroke:B.value.color},null,8,[`stroke`])],4)],!0)])):v(``,!0),e.$slots.hint?(w(),y(`div`,Ft,[E(e.$slots,`hint`,S(x({hint:F.value.a11y.translations.keyboardNavigation,isVisible:on.value})),void 0,!0)])):v(``,!0)]),e.$slots.watermark?(w(),y(`div`,It,[E(e.$slots,`watermark`,S(x({isPrinting:D(yn)||D(bn)||D(ui)||D(di)})),void 0,!0)])):v(``,!0),b(`div`,{id:`legend-bottom-${A.value}`},null,8,Lt),en.value&&(L.value.show||e.$slots.legend)?(w(),_(Pe,{key:7,to:L.value.position===`top`?`#legend-top-${A.value}`:`#legend-bottom-${A.value}`},[b(`div`,{ref_key:`chartLegend`,ref:qt},[E(e.$slots,`legend`,{legend:xr.value},()=>[L.value.show?(w(),_(De,{key:`legend_${Qt.value}`,legendSet:xr.value,config:Sr.value,id:`treemap_legend_${A.value}`,isCursorPointer:V.value,onClickMarker:s[1]||=({legend:e})=>Tr(e)},{item:O(({legend:e,index:t})=>[D(un)?v(``,!0):(w(),y(`div`,{key:0,onClick:t=>Tr(e),style:C(`opacity:${j.value.includes(e.id)?.5:1}`)},qe(e.display),13,Rt))]),legendToggle:O(()=>[xr.value.length>2&&L.value.selectAllToggle.show&&!D(un)?(w(),_(je,{key:0,backgroundColor:L.value.selectAllToggle.backgroundColor,color:L.value.selectAllToggle.color,fontSize:L.value.fontSize,checked:j.value.length>0,isCursorPointer:V.value,onToggle:wr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):v(``,!0)]),_:1},8,[`legendSet`,`config`,`id`,`isCursorPointer`])):v(``,!0)],!0)],512)],8,[`to`])):v(``,!0),e.$slots.source?(w(),y(`div`,{key:8,ref_key:`source`,ref:Jt,dir:`auto`},[E(e.$slots,`source`,{},void 0,!0)],512)):v(``,!0),Le(D(at),{teleportTo:I.value.teleportTo,show:H.value.showTooltip&&Ht.value,backgroundColor:I.value.backgroundColor,color:I.value.color,fontSize:I.value.fontSize,borderRadius:I.value.borderRadius,borderColor:I.value.borderColor,borderWidth:I.value.borderWidth,backgroundOpacity:I.value.backgroundOpacity,position:I.value.position,offsetX:I.value.offsetX,offsetY:I.value.offsetY,parent:M.value,content:Ut.value,isFullscreen:Wt.value,isCustom:D(te)(I.value.customFormat),smooth:I.value.smooth,backdropFilter:I.value.backdropFilter,smoothForce:I.value.smoothForce,smoothSnapThreshold:I.value.smoothSnapThreshold,isA11yMode:an.value===`keyboard`,a11yPosition:rn.value},{"tooltip-before":O(()=>[E(e.$slots,`tooltip-before`,S(x({...Ar.value})),void 0,!0)]),tooltip:O(()=>[E(e.$slots,`tooltip`,S(x({...Ar.value})),void 0,!0)]),"tooltip-after":O(()=>[E(e.$slots,`tooltip-after`,S(x({...Ar.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`fontSize`,`borderRadius`,`borderColor`,`borderWidth`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isFullscreen`,`isCustom`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),ft.value&&sn.value.buttons.table?(w(),_(Ge(ai.value.component),ze({key:9},ai.value.props,{ref_key:`tableUnit`,ref:tn,onClose:oi}),Fe({content:O(()=>[(w(),_(D(tt),{key:`table_${Zt.value}`,colNames:Nr.value.colNames,head:Nr.value.head,body:Nr.value.body,config:Nr.value.config,title:F.value.table.useDialog?``:ai.value.title,withCloseButton:!F.value.table.useDialog,isCursorPointer:V.value,onClose:oi},{th:O(({th:e})=>[b(`div`,zt,qe(e),1)]),td:O(({td:e})=>[Ie(qe(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`]))]),_:2},[F.value.table.useDialog?{name:`title`,fn:O(()=>[Ie(qe(ai.value.title),1)]),key:`0`}:void 0,F.value.table.useDialog?{name:`actions`,fn:O(()=>[b(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[2]||=e=>Mr(sn.value.callbacks.csv),style:C({cursor:V.value?`pointer`:`default`})},[Le(Oe,{name:`fileCsv`,stroke:ai.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):v(``,!0),E(e.$slots,`skeleton`,{},()=>[D(un)?(w(),_(ke,{key:0})):v(``,!0)],!0)],46,pt))}},[[`__scopeId`,`data-v-a6c888bf`]]);export{ft as n,Vt as t};
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}from"./annotationViewport-X8fvs7pz.js";import{n as c,t as l}from"./tableIntegration-CNoJ1CIY.js";import{t as u}from"./chartImage-DPGnEuYM.js";import{n as d}from"./resolveChartConfig-0IvbmIE_.js";import{$ as f,D as ee,Dt as te,Ft as ne,Ht as p,S as m,X as re,Zt as ie,at as ae,et as oe,i as se,in as ce,nt as le,r as ue,t as de,w as fe,zt as pe}from"./lib-rPeBMZrn.js";import{n as me,t as he}from"./useHints-C-TwxM0Y.js";import{t as ge}from"./useConfig-B8qvYKdK.js";import{t as _e}from"./useLoading-DoqqfnmS.js";import{t as ve}from"./usePrinter-DVf3YcG5.js";import{t as ye}from"./useResponsive-CENUxfEL.js";import{t as be}from"./useChartExport-BZts4KFb.js";import{t as xe}from"./useTransitions-ChGGrtrv.js";import{t as Se}from"./useUserOptionState-CXlFnwPv.js";import{t as Ce}from"./useChartAccessibility-DOMuYJfm.js";import{t as we}from"./usePanZoom-DlEcNgCv.js";import{n as Te}from"./Title-BliHuXfT.js";import{t as Ee}from"./vue_ui_treemap-Bgcc2FKO.js";import{t as De}from"./Legend-W9YVYVX-.js";import{t as Oe}from"./BaseIcon-CoY0vuL3.js";import{t as ke}from"./BaseScanner-m6QR9rwD.js";import{t as Ae}from"./A11yDataTable-DWNlWXzs.js";import{t as je}from"./BaseLegendToggle-VzX69MCo.js";import{t as Me}from"./DefGrad-DKMq1REY.js";import{t as Ne}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as h,Teleport as Pe,computed as g,createBlock as _,createCommentVNode as v,createElementBlock as y,createElementVNode as b,createSlots as Fe,createTextVNode as Ie,createVNode as Le,defineAsyncComponent as Re,guardReactiveProps as x,mergeProps as ze,nextTick as Be,normalizeClass as Ve,normalizeProps as S,normalizeStyle as C,onBeforeUnmount as He,onMounted as Ue,openBlock as w,ref as T,renderList as We,renderSlot as E,resolveDynamicComponent as Ge,shallowRef as Ke,toDisplayString as qe,toRefs as Je,unref as D,useCssVars as Ye,useSlots as Xe,watch as Ze,withCtx as O,withKeys as Qe,withModifiers as $e}from"vue";function et(e,t){let n=e.length;if(n===0)throw Error(`Max aspect ratio cannot be computed: ${e} is an empty array`);{let r=1/0,i=-1/0,a=0;for(let t=0;t<n;t+=1){let n=e[t].normalizedValue;n<r&&(r=n),n>i&&(i=n),a+=n}return Math.max(t**2*i/a**2,a**2/(t**2*r))}}function tt(e){let{xOffset:t,yOffset:n,width:r,height:i}=e;return{x0:t,y0:n,x1:t+r,y1:n+i}}function nt(e,t,n){if(e.length===0)return!0;{let r=e.concat(t);return et(e,n)>=et(r,n)}}function rt(e){let t=[],n=e.length;for(let r=0;r<n;r+=1){let n=e[r],i=n.length;for(let e=0;e<i;e+=1)t.push(n[e])}return t}function it(e,t){return ut({...t,children:e})}function at(e){return(e.x1-e.x0)*(e.y1-e.y0)}function ot(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=lt(t),o=e.length,s=e.map(e=>e.normalizedValue||0).reduce((e,t)=>e+t,0),c=s/r,l=s/n,u=i,d=a,f=[];if(n>=r){for(let t=0;t<o;t+=1){let n=e[t],r=d+n.normalizedValue/c,i={x0:u,y0:d,x1:u+c,y1:r},a=Object.assign({},n,i);d=r,f.push(a)}return f}for(let t=0;t<o;t+=1){let n=e[t],r=u+n.normalizedValue/l,i={x0:u,y0:d,x1:r,y1:d+l},a=Object.assign({},n,i);u=r,f.push(a)}return f}function st(e){let t=lt(e),n=t.width,r=t.height;return Math.min(n,r)}function ct(e,t){let n=e.length,r=t/e.map(e=>e.value??0).reduce((e,t)=>e+t,0),i=[],a,o;for(let t=0;t<n;t+=1)o=e[t],a=Object.assign({},o,{normalizedValue:o.value*(r||0)}),i.push(a);return i}function lt(e){let{x0:t,y0:n,x1:r,y1:i}=e;return{xOffset:t,yOffset:n,width:r-t,height:i-n}}function k(e,t,n,r){let i=e,a=t,o=n,s=r;for(;;){let e=i.length;if(e===0){let e=ot(a,o);return s.concat(e)}let t=st(o),n=i[0],r=i.slice(1,e);if(nt(a,n,t)){let e=a.concat(n);i=r,a=e,o=o,s=s}else{let e=a.length,t=0;for(let n=0;n<e;n+=1)t+=a[n].normalizedValue;let n=dt(o,t),r=ot(a,o),c=s.concat(r);i=i,a=[],o=n,s=c}}}function ut(e){if(e.children===void 0||!e.children.length)return[e];{let t=k(ct(e.children,at(e)),[],e,[]),n=t.length,r=[];for(let e=0;e<n;e+=1)r.push(ut(t[e]));return rt(r)}}function dt(e,t){let{width:n,height:r,xOffset:i,yOffset:a}=lt(e);if(n>=r){let e=t/r,o=n-e;return tt({xOffset:i+e,yOffset:a,width:o,height:r})}{let e=t/n,o=r-e;return tt({xOffset:i,yOffset:a+e,width:n,height:o})}}var ft=/* @__PURE__ */ e({default:()=>Vt}),pt=[`id`],mt=[`id`],ht=[`id`],gt=[`tabindex`,`onClick`,`onKeydown`,`data-last-crumb`,`onMouseenter`,`onFocus`],_t={class:`vue-ui-treemap-crumb-unit`},vt={class:`vue-ui-treemap-crumb-unit-label`},yt={key:0,style:{width:`24px`,display:`flex`,"align-items":`center`}},bt={key:0,class:`vue-ui-treemap-crumb-unit-arrow`},xt={style:{position:`relative`}},St=[`xmlns`,`aria-describedby`,`viewBox`],Ct={key:0},wt=[`x`,`y`,`height`,`width`,`fill`,`rx`,`stroke`,`stroke-width`,`onClick`,`onMouseenter`,`onMouseleave`],Tt=[`id`],Et=[`x`,`y`,`width`,`height`],Dt=[`clip-path`],Ot=[`transform`],kt=[`transform`],At=[`x`,`y`,`fill`,`font-size`,`font-family`,`font-weight`],jt={key:0},Mt=[`x`,`y`,`height`,`width`],Nt={style:{width:`100%`,height:`100%`,overflow:`hidden`},class:`vue-ui-treemap-cell`},Pt={key:0,"data-dom-to-png-ignore":``,class:`reset-wrapper`},Ft={key:1,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},It={key:6,class:`vue-data-ui-watermark`},Lt=[`id`],Rt=[`onClick`],zt={style:{display:`flex`,"align-items":`center`}},Bt=4,Vt=/*#__PURE__*/ Ne({__name:`vue-ui-treemap`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:Ne,emit:et}){Ye(e=>({c4fef8dc:Mi.value}));let tt=Re(()=>import(`./DataTable-KeuZB1JM.js`)),nt=Re(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),rt=Re(()=>import(`./vue-ui-accordion-BpTfjWvH.js`).then(e=>e.n)),at=Re(()=>import(`./Tooltip-B432XpvC.js`)),ot=Re(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),st=Re(()=>import(`./PackageVersion-DAF5ApGl.js`).then(e=>e.t)),ct=Re(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_treemap:lt}=ge(),k=e,ut=et,dt=Xe(),ft=g(()=>!!k.dataset&&k.dataset.length),Vt=g(()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),A=T(re()),Ht=T(!1),Ut=T(``),Wt=T(!1),Gt=T(0),j=T([]),M=Ke(null),Kt=Ke(null),qt=Ke(null),Jt=Ke(null),Yt=Ke(null),Xt=T(0),Zt=T(0),Qt=T(0),N=T([]),$t=T(null),en=T(!1),tn=T(null),nn=T(null),P=T(null),rn=T({x:0,y:0}),an=T(`pointer`),on=T(!1),F=T(_n()),sn=g(()=>F.value.userOptions),I=g(()=>F.value.style.chart.tooltip),L=g(()=>F.value.style.chart.legend),R=g(()=>F.value.style.chart.layout.labels),z=g(()=>F.value.style.chart.layout),B=g(()=>F.value.style.chart);me({config:()=>F.value,dataset:()=>k.dataset,component:`VueUiTreemap`,rules:[he.emptyArray,{test:e=>e.length===1&&e[0]?.children&&e[0].children.length<6&&e[0].children.length>0||e.flatMap(e=>e?.children?.length??0).reduce((e,t)=>e+t,0)<6,message:[`👀 The number of data points is < 6. Consider:`,``,`▶️ Using another type of chart instead to better show proportions: VueUiDonut, VueUiWaffle`]},{test:e=>e.length===1&&e[0]?.children&&e[0].children.length===0,message:[`👀 There is a series defined in the dataset but it has no children items.`,``,`▶️ Add children items to your series.`]}]});let{transitionEnabled:cn}=xe({config:()=>F.value.transitions,dataset:()=>k.dataset}),V=g(()=>F.value.userOptions.useCursorPointer),ln=g(()=>ce({defaultConfig:{userOptions:{show:!1},style:{chart:{backgroundColor:`#999999`,layout:{labels:{showDefaultLabels:!1},rects:{stroke:`#6A6A6A`}},legend:{backgroundColor:`transparent`}}}},userConfig:F.value.skeletonConfig??{}})),{loading:un,FINAL_DATASET:dn,manualLoading:fn}=_e({...Je(k),FINAL_CONFIG:F,prepareConfig:_n,skeletonDataset:k.config?.skeletonDataset??[{name:`_`,value:53,color:`#CACACA90`,children:[{name:`_`,value:21},{name:`_`,value:13},{name:`_`,value:8},{name:`_`,value:5},{name:`_`,value:3},{name:`_`,value:2},{name:`_`,value:1}]}],skeletonConfig:ce({defaultConfig:F.value,userConfig:ln.value})}),{userOptionsVisible:pn,setUserOptionsVisibility:mn,keepUserOptionState:hn}=Se({config:F.value}),{svgRef:gn}=Ce({config:B.value.title});function _n(){return d(k.config,lt,Ee)}let vn=ie(k.config);Ze(()=>k.config,(e,t)=>{let n=ie(e),r=n!==vn;vn=n;let i=_n();r?(un.value||(F.value=i),pn.value=!F.value.userOptions.showOnChartHover,Xt.value+=1,Zt.value+=1,Qt.value+=1,H.value.showTable=F.value.table.show,H.value.showTooltip=I.value.show,H.value.showZoom=B.value.zoom?.show??!1):(F.value.style.chart.tooltip=i.style.chart.tooltip,H.value.showTooltip=F.value.style.chart.tooltip.show)},{deep:!0});let{isPrinting:yn,isImaging:bn,generatePdf:xn,generateImage:Sn}=ve({elementId:`treemap_${A.value}`,fileName:B.value.title.text||`vue-ui-treemap`,options:F.value.userOptions.print}),Cn=g(()=>F.value.userOptions.show&&!B.value.title.text),wn=g(()=>fe(F.value.customPalette)),H=T({showTable:F.value.table.show,showTooltip:I.value.show,showZoom:B.value.zoom?.show??!1});Ze(F,()=>{H.value={showTable:F.value.table.show,showTooltip:I.value.show,showZoom:B.value.zoom?.show??!1}},{immediate:!0});let Tn=T({height:B.value.height,width:B.value.width});function En(e){let t=M.value,n=Tn.value.height;return!t||!n?e:e*(n/t.getBoundingClientRect().height)}function Dn(){if(!$t.value||X.value.length<=1)return 0;let e=$t.value,t=getComputedStyle(e);return En(e.offsetHeight+parseFloat(t.marginTop||`0`)+parseFloat(t.marginBottom||`0`)+parseFloat(t.paddingTop||`0`)+parseFloat(t.paddingBottom||`0`))}let U=g(()=>{let e=B.value.padding,t=Tn.value.width,n=Tn.value.height,r=Dn(),i=e.left,a=t-e.right,o=e.top,s=n-e.bottom-r;return{left:i,top:o,right:a,bottom:s,width:a-i,height:Math.max(0,s-o),vbWidth:t,vbHeight:n-r,offsetY:r}}),W=T(oe(dn.value)),On=T(W.value),kn=Ke(/* @__PURE__ */ new Map);Ze(()=>j.value,()=>{Pn(),Qt.value+=1,Zt.value+=1},{deep:!0});function An(e){Array.isArray(e)&&e.forEach((e,t)=>{e.id||=re(),e.sourceColor===void 0&&(e.sourceColor=m(e.color)||null);let n=e.sourceColor||kn.value.get(e.id)||wn.value[t]||p[t]||p[t%p.length];n=m(n),kn.value.set(e.id,n),e.color=n,jn(e,n)})}function jn(e,t){Array.isArray(e.children)&&e.children.forEach(n=>{n.id||=re(),n.parentId=e.id,n.sourceColor===void 0&&(n.sourceColor=m(n.color)||null);let r=n.sourceColor||t;n.color=r,jn(n,r)})}let Mn=g(()=>{let e=/* @__PURE__ */ new Map;function t(n){for(let r of n)e.set(r.id,r),Array.isArray(r.children)&&t(r.children)}return t(W.value),e});function G(e){return Mn.value.get(e)??null}function Nn(e){let t=G(e);for(;t?.parentId;)t=G(t.parentId);return t?.id??null}function Pn(){let e=W.value.filter(e=>!j.value.includes(e.id));if(!N.value.length){On.value=e;return}let t=N.value[N.value.length-1],n=G(t);if(!n){N.value=[],On.value=e;return}let r=Nn(n.id);r&&j.value.includes(r)?(N.value=[],On.value=e):On.value=[n]}Ze(()=>dn.value,()=>{W.value=oe(dn.value),An(W.value),Pn(),Qt.value+=1,Zt.value+=1},{deep:!0,immediate:!0,flush:`post`});let Fn=Ke(null),In=null,Ln=null,Rn=!1;function zn(){Fn.value?.disconnect(),Fn.value=null,In!==null&&cancelAnimationFrame(In),In=null}function Bn(){if(zn(),Rn||!M.value)return;if(!F.value.responsive){Tn.value={width:B.value.width,height:B.value.height};return}let e=()=>{!Rn&&F.value.responsive&&In===null&&(In=requestAnimationFrame(()=>{if(In=null,Rn)return;let{width:e,height:t}=ye({chart:M.value,title:B.value.title.text?Kt.value:null,legend:L.value.show?qt.value:null,source:Jt.value,noTitle:Yt.value});Tn.value={width:e,height:t-12}}))};Fn.value=new ResizeObserver(e),Fn.value.observe(M.value.parentNode),e()}Ze([()=>F.value.responsive,()=>B.value.width,()=>B.value.height],Bn,{flush:`post`}),Ue(()=>{en.value=!0,Hn()});let Vn=g(()=>F.value.debug);Ue(()=>{dt[`chart-background`]&&Vn.value&&console.warn(`VueUiTreemap does not support the #chart-background slot.`)});function Hn(){pe(k.dataset)&&ae({componentName:`VueUiTreemap`,type:`dataset`,debug:Vn.value}),An(W.value),pe(k.dataset)||(fn.value=F.value.loading),Bn()}He(()=>{Rn=!0,zn(),clearTimeout(Ln)});let Un=g(()=>On.value.map((e,t)=>({...e,color:m(e.color)||wn.value[t]||p[t]||p[t%p.length]})).filter(e=>!j.value.includes(e.id))),Wn=g(()=>W.value.filter(e=>!j.value.includes(e.id)).map(e=>e.value||0).reduce((e,t)=>e+t,0)),Gn=g(()=>{let e=[...Un.value];return z.value.sorted?e.sort((e,t)=>t.value-e.value):e});function Kn(e,t){return e.value/t}function qn(e,t,n){let r=z.value.rects.colorRatio-Kn(t,n);return ne(e,r<0?0:r)}function Jn(e){return Array.isArray(e.children)&&e.children.length>0}function Yn(e){return[...e].sort((e,t)=>{let n=Jn(e),r=Jn(t);if(n!==r)return n-r;let i=Number(e.value)||0;return(Number(t.value)||0)-i})}function Xn(e,t,n,r,i){return Yn(e).map((e,a)=>{let o=e.sourceColor||m(e.color)||m(t)||wn.value[a]||p[a]||p[a%p.length],s=e.sourceColor?e.sourceColor:qn(o,e,r),c=Kn(e,r),l=i??e.parentId??e.id,u=Array.isArray(e.children)&&e.children.length&&e.children.reduce((e,t)=>e+(Number(t.value)||0),0)||1;return{...e,color:s,proportion:c,parentName:n,rootId:l,children:Array.isArray(e.children)&&e.children.length?Xn(e.children,o,e.name,u,l):void 0}})}function Zn(e){let t=lr(e),n=Qn(e),r=t*.55,i=t*.55,a=t*1.05,o=t*1.05,s=t*.35,c=n?a+o+s:t*.45,l=e.x0+r,u=e.x1-r,d=e.y0+c,f=e.y1-i;return u<=l||f<=d?null:{x0:l,y0:d,x1:u,y1:f}}function Qn(e){return R.value.hideUnderProportion===0||$n(e)}function $n(e){let t=Number(R.value.hideUnderProportion);return!Number.isFinite(t)||t<=0||e.proportion>t}function er(e,t,n=0,r=null){if(!Array.isArray(e)||!e.length)return[];let i=e.map(e=>{let{children:t,...n}=e;return{...n}}),a=new Map(e.map(e=>[e.id,Array.isArray(e.children)?e.children:[]])),o=new Map(e.map(e=>[e.id,e])),s=it(i,t),c=[];for(let e of s){let t=a.get(e.id)||[],i=o.get(e.id),s={...e,depth:n,parentId:r??e.parentId??null,color:i?.color??e.color??null,children:t,isVisibleNode:!0,showLabel:Qn(e)};if(c.push(s),t.length){let r=Zn(s);r&&c.push(...er(t,r,n+1,e.id))}}return c}let K=g(()=>{let e=Gn.value,t=e.map(e=>Number(e.value)||0).reduce((e,t)=>e+t,0)||1;return er(e.map((e,n)=>{let r=e.children?e.children.reduce((e,t)=>e+(Number(t.value)||0),0):e.value,{children:i,...a}=e,o=e.sourceColor||m(e.color)||kn.value.get(e.id)||wn.value[n]||p[n]||p[n%p.length],s=e.sourceColor?e.sourceColor:qn(o,e,t);return{...a,id:e.id||re(),parentId:e.parentId??null,name:e.name,value:e.value,color:s,proportion:(Number(e.value)||0)/t,children:Array.isArray(e.children)&&e.children.length?Xn(e.children,o,e.name,r||1):void 0}}),{x0:U.value.left,y0:U.value.top,x1:U.value.left+U.value.width,y1:U.value.top+U.value.height})});function tr(e){return(Z.value&&Z.value.id===e.id?z.value.rects.selected.strokeWidth:z.value.rects.strokeWidth)*qr.value}function q({y0:e,y1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function J({x0:e,x1:t}){return t-e<=0?1e-4:Math.round((t-e)*1e4)/1e4}function nr(){let e=R.value,t=Number(e.minFontSize),n=Number(e.fontSize),r=Math.max(0,Math.min(Number.isFinite(t)?t:0,Number.isFinite(n)?n:0));return{lowerBound:r,upperBound:Math.max(r,Number.isFinite(n)?n:r)}}function rr(e){let t=Math.min(4,Math.max(e*.25,.5));return{paddingX:t,paddingTop:t}}function ir(e,t){let{paddingX:n,paddingTop:r}=rr(t),i=t*1.1;return{x:e.x0+n,y:e.y0+r,width:Math.max(J(e)-n*2,0),height:Math.max(q(e)-r*2,0),lineHeight:i}}function ar(e,t){return se(R.value.formatter,e.value,f({p:R.value.prefix,v:e.value,s:R.value.suffix,r:I.value.roundingValue}),{datapoint:e,seriesIndex:t})}function or(e,t){let n=ar(e,t);return Array.isArray(e.children)&&e.children.length?[`${e.name} (${n})`]:[`${e.name}`,n].filter(e=>`${e}`.length)}function sr(e,t,n){let r=ir(e,t);return!n.length||r.width<=0||r.height<=0||n.length*r.lineHeight>r.height?!1:n.every((e,n)=>wi(e,t,n===0?500:400)<=r.width)}function cr(e,t,n,r){let i=Math.max(1,...t.map(e=>String(e).length)),a=Math.min(18,Math.max(10,Math.ceil(i*.7))),o=Math.max(1,t.length),s=Math.max(J(e)-1,1e-4),c=Math.max(q(e)-1,1e-4),l=s/(a*.58),u=c/(o*1.35);return Math.max(n,Math.min(r,l,u))}function lr(e,t,n=or(e,t)){let{lowerBound:r,upperBound:i}=nr(),a=Math.max(1e-4,Math.min(J(e),q(e))),o=Math.max(r,Math.min(i,a*.9)),s=Math.min(o,cr(e,n,r,i));if(sr(e,s,n)||!sr(e,r,n))return s;let c=r,l=s,u=r;for(let t=0;t<8;t+=1){let t=(c+l)/2;sr(e,t,n)?(u=t,c=t):l=t}let d=Math.max(r,s*.7);return u>=d?u:s}function ur(e){Wt.value=e,Gt.value+=1}let Y=g(()=>({x:0,y:0,width:U.value.vbWidth,height:U.value.vbHeight}));function dr(e){let t=[],n=G(e);for(;n&&n.parentId;){let e=G(n.parentId);if(!e)break;t.unshift(e.id),n=e}return t}let fr=g(()=>N.value.length>0);function pr(){On.value=W.value.slice(),N.value=[],ut(`selectDatapoint`,void 0)}function mr(){return N.value[N.value.length-1]??null}function hr(e,t,n){N.value=[...dr(e.id),e.id],On.value=[e],F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:t??e,seriesIndex:n}),ut(`selectDatapoint`,t??e)}function gr(e,t){let n=mr();if(!n){pr();return}let r=G(n);if(!r?.parentId){F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:e,seriesIndex:t}),pr();return}let i=G(r.parentId);i?(N.value=[...dr(i.id),i.id],On.value=[i],F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:e,seriesIndex:t}),ut(`selectDatapoint`,e)):pr()}function _r(e,t){if(!e){pr();return}let n=G(e.id);n&&(mr()===n.id?gr(e,t):hr(n,e,t))}function vr(e){return e?mr()===e.id:!1}let X=g(()=>{let e=[{id:null,label:`All`}];if(N.value.length>0){let t=G(N.value[N.value.length-1]),n=[];for(;t;)n.unshift(t),t=t.parentId?G(t.parentId):null;for(let t of n)e.push({id:t.id,label:t.name,node:t})}return e}),Z=Ke(null),yr=g(()=>W.value.reduce((e,t)=>e+t.value,0));function br(e){let t=L.value,n=t.showValue?se(R.value.formatter,e.value,f({p:R.value.prefix,v:e.value,s:R.value.suffix,r:t.roundingValue}),{datapoint:e}):``,r=``;return t.showPercentage&&(r=j.value.includes(e.id)?`- %`:`${isNaN(e.value/Wn.value)?`-`:(e.value/Wn.value*100).toFixed(t.roundingPercentage)}%`,t.showValue&&(r=` (${r})`)),`${e.name}${t.showPercentage||t.showValue?`: `:``}${n}${r}`}let xr=g(()=>W.value.map((e,t)=>({...e,color:m(e.color)||wn.value[t]||p[t]||p[t%p.length],shape:`square`})).sort((e,t)=>t.value-e.value).map((e,t)=>({...e,proportion:e.value/yr.value,isSegregated:j.value.includes(e.id),segregate:()=>Tr(e),opacity:j.value.includes(e.id)?.5:1,display:br(e)}))),Sr=g(()=>({cy:`treemap-div-legend`,backgroundColor:L.value.backgroundColor,color:L.value.color,fontSize:L.value.fontSize,paddingBottom:12,fontWeight:L.value.bold?`bold`:``})),Cr=g(()=>j.value.length===xr.value.length);function wr(){j.value.length?j.value=[]:xr.value.forEach(e=>{j.value.push(e.id)}),ut(`selectLegend`,W.value.filter(e=>!j.value.includes(e.id)))}function Tr(e){Z.value=null,j.value.includes(e.id)?j.value=j.value.filter(t=>t!==e.id):j.value.length<k.dataset.length-1&&j.value.push(e.id),ut(`selectLegend`,W.value.filter(e=>!j.value.includes(e.id)))}function Er(e){return W.value.length?W.value.find(t=>t.name===e)||(Vn.value&&console.warn(`VueUiTreemap - Series name not found "${e}"`),null):(Vn.value&&console.warn(`VueUiTreemap - There are no series to show.`),null)}function Dr(e){let t=Er(e);t!==null&&j.value.includes(t.id)&&Tr({id:t.id})}function Or(e){let t=Er(e);t!==null&&(j.value.includes(t.id)||Tr({id:t.id}))}function kr({datapoint:e,seriesIndex:t}){Z.value=null,Ht.value=!1,P.value=null,an.value=`pointer`,F.value.events.datapointLeave&&F.value.events.datapointLeave({datapoint:e,seriesIndex:t})}let Ar=T(null);function jr({datapoint:e,seriesIndex:t,triggerMode:n=`pointer`}){if(Cr.value||n===`pointer`&&Vr.value)return;F.value.events.datapointEnter&&F.value.events.datapointEnter({datapoint:e,seriesIndex:t}),P.value=t,an.value=n,Z.value=e,Ar.value={datapoint:e,seriesIndex:t,config:F.value,series:Un.value};let r=I.value.customFormat,i=te(r)?r(Ar.value):void 0;if(typeof i==`string`)Ut.value=i;else{let n=``;n+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${I.value.borderColor};padding-bottom:6px;margin-bottom:3px;">${e.name}</div>`,n+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" fill="${e.color}"/></svg>`,n+=`<b>${se(R.value.formatter,e.value,f({p:R.value.prefix,v:e.value,s:R.value.suffix,r:I.value.roundingValue}),{datapoint:e,seriesIndex:t})}</b>`,Ut.value=`<div>${n}</div>`}Ht.value=!0}let Q=g(()=>({head:K.value.map(e=>({name:e.name,color:e.color})),body:K.value.map(e=>e.value)}));function Mr(e=null){Be(()=>{let t=Q.value.head.map((e,t)=>[[e.name],[Q.value.body[t]],[isNaN(Q.value.body[t]/Wn.value)?`-`:Q.value.body[t]/Wn.value*100]]),n=[[B.value.title.text],[B.value.title.subtitle.text],[[``],[`val`],[`%`]]].concat(t),r=ee(n);e?e(r):le({csvContent:r,title:B.value.title.text||`vue-ui-treemap`})})}let Nr=g(()=>{let e=[F.value.table.columnNames.series,F.value.table.columnNames.value,F.value.table.columnNames.percentage],t=Q.value.head.map((e,t)=>{let n=se(R.value.formatter,Q.value.body[t],f({p:R.value.prefix,v:Q.value.body[t],s:R.value.suffix,r:F.value.table.td.roundingValue}));return[{color:e.color,name:e.name,shape:`square`},n,isNaN(Q.value.body[t]/Wn.value)?`-`:f({v:Q.value.body[t]/Wn.value*100,s:`%`,r:F.value.table.td.roundingPercentage})]}),n={th:{backgroundColor:F.value.table.th.backgroundColor,color:F.value.table.th.color,outline:F.value.table.th.outline},td:{backgroundColor:F.value.table.td.backgroundColor,color:F.value.table.td.color,outline:F.value.table.td.outline},breakpoint:F.value.table.responsiveBreakpoint};return{colNames:[F.value.table.columnNames.series,F.value.table.columnNames.value],head:e,body:t,config:n}});function Pr(){return K.value}function Fr(){H.value.showTable=!H.value.showTable}function Ir(){H.value.showTooltip=!H.value.showTooltip}function Lr(){H.value.showZoom=!H.value.showZoom}let Rr=T(!1);function zr(){Rr.value=!Rr.value}let Br=g(()=>!Rr.value&&H.value.showZoom),Vr=T(null),Hr=T(!1),{viewBox:$,resetZoom:Ur,isZoom:Wr,setInitialViewBox:Gr,scale:Kr}=we(gn,{x:Y.value.x,y:Y.value.y,width:Math.max(10,Y.value.width),height:Math.max(10,Y.value.height)},1,Br),qr=g(()=>1/Kr.value),Jr=g(()=>Math.min(1,R.value.fontSizeZoomFactor/Math.max(Kr.value,1e-4))),Yr=g(()=>`scale(${Jr.value})`),Xr=g(()=>H.value.showZoom||Wr.value);Ze([()=>Y.value.x,()=>Y.value.y,()=>Y.value.width,()=>Y.value.height],()=>{Be(()=>{Gr({x:Y.value.x,y:Y.value.y,width:Math.max(10,Y.value.width),height:Math.max(10,Y.value.height)})})},{immediate:!0});function Zr(e){Br.value&&(e.button===void 0||e.button===0)&&(Vr.value={x:e.clientX,y:e.clientY},Hr.value=!1)}function Qr(e){if(!Br.value||!Vr.value)return;let t=e.clientX-Vr.value.x,n=e.clientY-Vr.value.y;Math.hypot(t,n)>Bt&&(Hr.value=!0)}function $r(){Vr.value=null,Hr.value&&(clearTimeout(Ln),Ln=window.setTimeout(()=>{Hr.value=!1,Ln=null},0))}function ei(e,t){Hr.value||_r(e,t)}let ti=T(null);function ni(e){ti.value=e}function ri(){ti.value=null}let ii=u(M,()=>B.value.title.text),ai=g(()=>l({config:F,style:B,mutableConfig:H,dialog:ct,accordion:rt,isFullscreen:Wt,parent:M,maxWidth:800,isCursorPointer:V}));Ze(()=>H.value.showTable,e=>c(e,F,tn));function oi(){H.value.showTable=!1,nn.value&&nn.value.setTableIconState(!1)}let si=g(()=>xr.value.map(e=>({...e,name:e.display}))),ci=g(()=>B.value.backgroundColor),li=g(()=>B.value.title),{isCallbackImaging:ui,isCallbackSvg:di,generateSvg:fi,onGenerateImage:pi}=be({svg:gn,title:li,legend:L,legendItems:si,backgroundColor:ci,getSvgCallback:()=>F.value.userOptions.callbacks.svg,generateImage:Sn});function mi(e,t,n){let r=lr(e,t,n),{paddingX:i,paddingTop:a}=rr(r);return{fontSize:r,paddingX:i,paddingTop:a,lineHeight:r*1.1}}function hi(e){return ue(e.color??B.value.backgroundColor)}function gi({availableHeight:e,lineHeight:t,lineIndex:n}){if(n===0)return 1/0;let r=e/(n+1);return r<1e-4?-1/0:t<=0?1/0:r/t}function _i(){return Number(R.value.hideUnderProportion)===0}function vi(e){let t=Jr.value;return e.alwaysShowAllLines?`scale(${Math.min(t,e.allLinesScaleCap)})`:Yr.value}function yi({rect:e,seriesIndex:t}){if(!e||!R.value.showDefaultLabels||!Qn(e))return null;let n=or(e,t).map(e=>String(e??``)),{fontSize:r,paddingX:i,paddingTop:a,lineHeight:o}=mi(e,t,n),s=hi(e),c=ir(e,r);if(!n.some(Boolean)||c.width<=0||c.height<=0)return null;let l=_i(),u=l?Math.max(1e-4,Math.min(1,c.height/Math.max(n.length*o,1e-4))):1,d=`treemap_clip_${A.value}_${e.id}`,f=e.x0,ee=e.y0,te=Math.max(J(e),0),ne=Math.max(q(e),0);return{key:bi(e),clipId:d,clipX:f,clipY:ee,clipWidth:te,clipHeight:ne,translate:`translate(${e.x0}, ${e.y0})`,alwaysShowAllLines:l,allLinesScaleCap:u,lines:n.map((t,n)=>({key:`${e.id}_${n}`,text:t,x:i,y:a+o*n,maxZoomFactor:gi({availableHeight:c.height,lineHeight:o,lineIndex:n}),fill:s,fontSize:r,fontFamily:F.value.style.fontFamily,fontWeight:n===0?500:400}))}}function bi(e){return`${e.id}`}let xi=g(()=>dt.rect||un.value||!R.value.showDefaultLabels||Cr.value?[]:K.value.map((e,t)=>e.showLabel?yi({rect:e,seriesIndex:t}):null).filter(Boolean)),Si;function Ci(){return typeof document>`u`?null:(Si||=document.createElement(`canvas`),Si.getContext(`2d`))}function wi(e,t,n=400){let r=Ci();return r?(r.font=`${n} ${t}px ${F.value.style.fontFamily}`,r.measureText(String(e)).width):e.length*t*.6}function Ti(e){let t=z.value.rects.borderRadius,n=J(e),r=q(e);return Math.min(t,Math.min(n,r)/6)}async function Ei(){ut(`copyAlt`,{config:F.value,dataset:K.value}),F.value.userOptions.callbacks.altCopy?await Promise.resolve(F.value.userOptions.callbacks.altCopy({config:F.value,dataset:K.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Di(){P.value=null,on.value=!0}function Oi(){P.value=null,an.value=`pointer`,Ht.value=!1,Z.value=null,on.value=!1}function ki(e){if(!gn.value||Rr.value||document.activeElement!==gn.value||!K.value.length||Cr.value)return;let t=[`ArrowLeft`,`ArrowUp`].includes(e.key),n=[`ArrowRight`,`ArrowDown`].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){P.value=null,an.value=`pointer`,Ht.value=!1,Z.value=null;return}if(r){if(P.value===null)return;let e=K.value[P.value];if(!e)return;_r(e,P.value);return}let a=P.value,o=Z.value?K.value.findIndex(e=>e.id===Z.value.id):null,s=a!==null&&a>=0&&a<K.value.length,c=o!==null&&o>=0&&o<K.value.length;s?n?(a+=1,a>=K.value.length&&(a=0)):t&&(--a,a<0&&(a=K.value.length-1)):c?(a=n?o+1:o-1,a>=K.value.length&&(a=0),a<0&&(a=K.value.length-1)):a=n?0:K.value.length-1;let l=K.value[a];l&&(Ai(a),jr({datapoint:l,seriesIndex:a,triggerMode:`keyboard`}))}function Ai(e){if(!Number.isFinite(e)||!gn.value)return;let t=K.value[e];if(!t)return;let n=t.x0+J(t)/2,r=t.y0+q(t)/2,i=gn.value.getBoundingClientRect();rn.value={x:i.left+(n-$.value.x)/$.value.width*i.width,y:i.top+(r-$.value.y)/$.value.height*i.height}}let ji=g(()=>({headers:Nr.value?.colNames??[],rows:Nr.value?.body??[]})),Mi=g(()=>B.value.color);Ne({getData:Pr,getImage:ii,generateCsv:Mr,generateImage:Sn,generateSvg:fi,generatePdf:xn,hideSeries:Or,showSeries:Dr,toggleTable:Fr,toggleTooltip:Ir,toggleZoom:Lr,toggleAnnotator:zr,toggleFullscreen:ur,resetZoom:Ur,copyAlt:Ei});let Ni=g(()=>s(F.value.userOptions?.annotator?.followZoom,$.value));return(e,s)=>(w(),y(`div`,{ref_key:`treemapChart`,ref:M,class:Ve(`vue-data-ui-component vue-ui-treemap ${Wt.value?`vue-data-ui-wrapper-fullscreen`:``} ${F.value.useCssAnimation?``:`vue-ui-dna`}`),style:C(`font-family:${F.value.style.fontFamily};width:100%; ${F.value.responsive?`height: 100%;`:``} text-align:center;background:${B.value.backgroundColor}`),id:`treemap_${A.value}`,onMouseenter:s[3]||=()=>D(mn)(!0),onMouseleave:s[4]||=()=>D(mn)(!1)},[b(`div`,{id:`chart-instructions-${A.value}`,class:`sr-only`},[b(`p`,null,qe(F.value.a11y.translations.keyboardNavigation),1)],8,mt),F.value.a11y.includeTable&&ji.value?.rows?.length?(w(),_(Ae,{key:0,uid:A.value,head:ji.value.headers,body:ji.value.rows,notice:F.value.a11y.translations.tableAvailable,caption:F.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):v(``,!0),sn.value.buttons.annotator?(w(),_(D(nt),ze({key:1},D(a)(sn.value.annotator),{svgRef:D(gn),followZoom:F.value.userOptions?.annotator?.followZoom,annotationViewport:Ni.value,backgroundColor:B.value.backgroundColor,color:B.value.color,active:Rr.value,isCursorPointer:V.value,palette:sn.value.annotatorPalette,onClose:zr}),Fe({_:2},[We(D(o),t=>({name:t,fn:O(n=>[E(e.$slots,t,S(x(D(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`followZoom`,`annotationViewport`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):v(``,!0),Cn.value?(w(),y(`div`,{key:2,ref_key:`noTitle`,ref:Yt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):v(``,!0),B.value.title.text?(w(),y(`div`,{key:3,ref_key:`chartTitle`,ref:Kt,style:C(`width:100%;background:${B.value.backgroundColor};padding-bottom:6px`)},[(w(),_(Te,{key:`title_${Xt.value}`,config:{title:{cy:`treemap-div-title`,...B.value.title},subtitle:{cy:`treemap-div-subtitle`,...B.value.title.subtitle}}},null,8,[`config`]))],4)):v(``,!0),b(`div`,{id:`legend-top-${A.value}`},null,8,ht),sn.value.show&&ft.value&&(D(hn)||D(pn))?(w(),_(D(ot),ze({ref_key:`userOptionsRef`,ref:nn,key:`user_option_${Gt.value}`,backgroundColor:B.value.backgroundColor,color:B.value.color,isPrinting:D(yn),isImaging:D(bn),uid:A.value,hasTooltip:sn.value.buttons.tooltip&&I.value.show,isFullscreen:Wt.value,isTooltip:H.value.showTooltip,chartElement:M.value},D(n)(sn.value,`pdf csv img svg table fullscreen altCopy annotator zoom`),{isAnnotation:Rr.value,tableDialog:F.value.table.useDialog,isCursorPointer:V.value,isZoom:H.value.showZoom,onToggleFullscreen:ur,onGeneratePdf:D(xn),onGenerateCsv:Mr,onGenerateImage:D(pi),onGenerateSvg:D(fi),onToggleTable:Fr,onToggleTooltip:Ir,onToggleAnnotator:zr,onToggleZoom:Lr,onCopyAlt:Ei,style:{visibility:D(hn)?D(pn)?`visible`:`hidden`:`visible`}}),Fe({_:2},[We(D(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionZoom optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:O(n=>[E(e.$slots,t,S(x(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasTooltip`,`isFullscreen`,`isTooltip`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`isZoom`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):v(``,!0),X.value.length>1?(w(),y(`nav`,{key:5,class:`vue-ui-treemap-breadcrumbs`,"data-dom-to-png-ignore":``,ref_key:`breadcrumbsNav`,ref:$t},[(w(!0),y(h,null,We(X.value,(t,n)=>(w(),y(`span`,{role:`button`,tabindex:n<X.value.length-1?0:void 0,key:t.id||`root`,onClick:e=>n===X.value.length-1?()=>{}:_r(t.node),onKeydown:[Qe($e(e=>n===X.value.length-1?void 0:_r(t.node),[`prevent`]),[`enter`]),Qe($e(e=>n===X.value.length-1?void 0:_r(t.node),[`prevent`]),[`space`])],class:`vue-ui-treemap-crumb`,"data-last-crumb":n===X.value.length-1,style:C({color:B.value.color,cursor:V.value?`pointer`:`default`}),onMouseenter:e=>ni(n),onMouseleave:ri,onFocus:e=>ni(n),onBlur:ri},[b(`span`,_t,[b(`span`,vt,[E(e.$slots,`breadcrumb-label`,ze({ref_for:!0},{crumb:t,isRoot:n===0,isFocus:ti.value===n}),()=>[n===0?(w(),y(`div`,yt,[Le(Oe,{name:ti.value===0?`homeFilled`:`home`,stroke:B.value.color},null,8,[`name`,`stroke`])])):(w(),y(h,{key:1},[Ie(qe(t.label),1)],64))],!0)]),n<X.value.length-1?(w(),y(`span`,bt,[E(e.$slots,`breadcrumb-arrow`,{},()=>[s[5]||=Ie(` › `,-1)],!0)])):v(``,!0)])],44,gt))),128))],512)):v(``,!0),b(`div`,xt,[(w(),y(`svg`,{ref_key:`svgRef`,ref:gn,xmlns:D(de),"aria-describedby":`chart-instructions-${A.value}`,class:Ve({"vue-data-ui-fullscreen--on":Wt.value,"vue-data-ui-fulscreen--off":!Wt.value,"vue-data-ui-zoom-plus":!fr.value,"vue-data-ui-zoom-minus":fr.value,"vue-data-ui-no-transition":!D(cn),loading:D(un)}),viewBox:`${D($).x} ${D($).y} ${D($).width<=0?10:D($).width} ${D($).height<=0?10:D($).height}`,style:C(`max-width:100%; overflow:${Xr.value?`hidden`:`visible`}; background:transparent;color:${B.value.color}`),tabindex:`0`,onFocus:Di,onBlur:Oi,onKeydown:ki,onPointerdown:Zr,onPointermove:Qr,onPointerup:$r,onPointercancel:$r,onPointerleave:$r},[Le(D(st)),E(e.$slots,`svg-underlayer`,S(x({svg:U.value,isZoom:fr.value,rect:Z.value,config:F.value,isPrintingImg:D(yn)||D(bn)||D(ui),isPrintingSvg:D(di)})),void 0,!0),(w(!0),y(h,null,We(K.value,(e,t)=>(w(),y(`g`,{key:`tgrad_${e.id}`},[z.value.rects.gradient.show?(w(),y(`defs`,Ct,[Le(Me,{t:`radial`,id:`tgrad_${e.id}`,gradientTransform:`translate(-1, -1.000001) scale(2, 2)`,stops:[[`18%`,e.color,1],[`100%`,D(ne)(e.color,z.value.rects.gradient.intensity/100),1]]},null,8,[`id`,`stops`])])):v(``,!0)]))),128)),b(`g`,null,[(w(!0),y(h,null,We(K.value,(e,t)=>(w(),y(`g`,{key:`rect_${e.id}_${e.depth}`},[b(`rect`,{x:e.x0,y:e.y0,height:q(e),width:J(e),fill:Vt.value?e.color??B.value.backgroundColor:z.value.rects.gradient.show?Cr.value?B.value.backgroundColor:`url(#tgrad_${e.id})`:e.color??B.value.backgroundColor,rx:D(Kr)>1?Ti(e)*qr.value:Ti(e),stroke:Z.value&&Z.value.id===e.id?z.value.rects.selected.stroke:z.value.rects.stroke,"stroke-width":tr(e),onClick:$e(n=>ei(e,t),[`stop`]),onMouseenter:()=>jr({datapoint:e,seriesIndex:t,triggerMode:`pointer`}),onMouseleave:n=>kr({datapoint:e,seriesIndex:t}),style:C(`opacity:${Z.value?Z.value.id===e.id?1:z.value.rects.selected.unselectedOpacity:1}`),class:Ve([`vue-ui-treemap-rect`,D(cn)?`vue-data-ui-transition`:``,vr(e)?`vue-data-ui-zoom-minus`:`vue-data-ui-zoom-plus`])},null,46,wt)]))),128)),(w(!0),y(h,null,We(xi.value,e=>(w(),y(`g`,{key:e.key,style:{"pointer-events":`none`}},[b(`defs`,null,[b(`clipPath`,{id:e.clipId,clipPathUnits:`userSpaceOnUse`},[b(`rect`,{class:Ve({"vue-data-ui-transition":D(cn)}),x:e.clipX,y:e.clipY,width:e.clipWidth,height:e.clipHeight},null,10,Et)],8,Tt)]),b(`g`,{"clip-path":`url(#${e.clipId})`},[b(`g`,{transform:e.translate},[b(`g`,{class:Ve({"vue-data-ui-transition":D(cn)}),transform:vi(e)},[(w(!0),y(h,null,We(e.lines,t=>(w(),y(h,{key:t.key},[t.text&&(e.alwaysShowAllLines||Jr.value<=t.maxZoomFactor)?(w(),y(`text`,{key:0,x:t.x,y:t.y,fill:t.fill,"font-size":t.fontSize,"font-family":t.fontFamily,"font-weight":t.fontWeight,class:Ve({"vue-data-ui-transition":D(cn)}),"text-anchor":`start`,"dominant-baseline":`text-before-edge`},qe(t.text),11,At)):v(``,!0)],64))),128))],10,kt)],8,Ot)],8,Dt)]))),128)),e.$slots.rect?(w(),y(`g`,jt,[(w(!0),y(h,null,We(K.value,(t,n)=>(w(),y(`g`,{key:`slot_${t.id}_${t.depth}`},[(w(),y(`foreignObject`,{x:t.x0,y:t.y0,height:q(t),width:J(t),class:`vue-ui-treemap-cell-foreignObject`,style:{"pointer-events":`none`,overflow:`hidden`}},[b(`div`,Nt,[D(un)?v(``,!0):E(e.$slots,`rect`,ze({ref_for:!0},{rect:{...t,height:q(t),width:J(t),isSelected:!Z.value||Z.value.id===t.id},shouldShow:$n(t)||fr.value,fontSize:lr(t,n),isZoom:fr.value,textColor:D(ue)(t.color)}),void 0,!0,0)])],8,Mt))]))),128))])):v(``,!0)]),E(e.$slots,`svg`,S(x({svg:U.value,isZoom:fr.value,rect:Z.value,config:F.value,isPrintingImg:D(yn)||D(bn)||D(ui),isPrintingSvg:D(di)})),void 0,!0)],46,St)),D(Wr)?(w(),y(`div`,Pt,[E(e.$slots,`reset-action`,{reset:D(Ur)},()=>[b(`button`,{"data-cy-reset":``,tabindex:`0`,role:`button`,class:`vue-data-ui-refresh-button`,style:C({background:B.value.backgroundColor,cursor:V.value?`pointer`:`default`}),onClick:s[0]||=e=>D(Ur)(!0)},[Le(Oe,{name:`refresh`,stroke:B.value.color},null,8,[`stroke`])],4)],!0)])):v(``,!0),e.$slots.hint?(w(),y(`div`,Ft,[E(e.$slots,`hint`,S(x({hint:F.value.a11y.translations.keyboardNavigation,isVisible:on.value})),void 0,!0)])):v(``,!0)]),e.$slots.watermark?(w(),y(`div`,It,[E(e.$slots,`watermark`,S(x({isPrinting:D(yn)||D(bn)||D(ui)||D(di)})),void 0,!0)])):v(``,!0),b(`div`,{id:`legend-bottom-${A.value}`},null,8,Lt),en.value&&(L.value.show||e.$slots.legend)?(w(),_(Pe,{key:7,to:L.value.position===`top`?`#legend-top-${A.value}`:`#legend-bottom-${A.value}`},[b(`div`,{ref_key:`chartLegend`,ref:qt},[E(e.$slots,`legend`,{legend:xr.value},()=>[L.value.show?(w(),_(De,{key:`legend_${Qt.value}`,legendSet:xr.value,config:Sr.value,id:`treemap_legend_${A.value}`,isCursorPointer:V.value,onClickMarker:s[1]||=({legend:e})=>Tr(e)},{item:O(({legend:e,index:t})=>[D(un)?v(``,!0):(w(),y(`div`,{key:0,onClick:t=>Tr(e),style:C(`opacity:${j.value.includes(e.id)?.5:1}`)},qe(e.display),13,Rt))]),legendToggle:O(()=>[xr.value.length>2&&L.value.selectAllToggle.show&&!D(un)?(w(),_(je,{key:0,backgroundColor:L.value.selectAllToggle.backgroundColor,color:L.value.selectAllToggle.color,fontSize:L.value.fontSize,checked:j.value.length>0,isCursorPointer:V.value,onToggle:wr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):v(``,!0)]),_:1},8,[`legendSet`,`config`,`id`,`isCursorPointer`])):v(``,!0)],!0)],512)],8,[`to`])):v(``,!0),e.$slots.source?(w(),y(`div`,{key:8,ref_key:`source`,ref:Jt,dir:`auto`},[E(e.$slots,`source`,{},void 0,!0)],512)):v(``,!0),Le(D(at),{teleportTo:I.value.teleportTo,show:H.value.showTooltip&&Ht.value,backgroundColor:I.value.backgroundColor,color:I.value.color,fontSize:I.value.fontSize,borderRadius:I.value.borderRadius,borderColor:I.value.borderColor,borderWidth:I.value.borderWidth,backgroundOpacity:I.value.backgroundOpacity,position:I.value.position,offsetX:I.value.offsetX,offsetY:I.value.offsetY,parent:M.value,content:Ut.value,isFullscreen:Wt.value,isCustom:D(te)(I.value.customFormat),smooth:I.value.smooth,backdropFilter:I.value.backdropFilter,smoothForce:I.value.smoothForce,smoothSnapThreshold:I.value.smoothSnapThreshold,isA11yMode:an.value===`keyboard`,a11yPosition:rn.value},{"tooltip-before":O(()=>[E(e.$slots,`tooltip-before`,S(x({...Ar.value})),void 0,!0)]),tooltip:O(()=>[E(e.$slots,`tooltip`,S(x({...Ar.value})),void 0,!0)]),"tooltip-after":O(()=>[E(e.$slots,`tooltip-after`,S(x({...Ar.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`fontSize`,`borderRadius`,`borderColor`,`borderWidth`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isFullscreen`,`isCustom`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),ft.value&&sn.value.buttons.table?(w(),_(Ge(ai.value.component),ze({key:9},ai.value.props,{ref_key:`tableUnit`,ref:tn,onClose:oi}),Fe({content:O(()=>[(w(),_(D(tt),{key:`table_${Zt.value}`,colNames:Nr.value.colNames,head:Nr.value.head,body:Nr.value.body,config:Nr.value.config,title:F.value.table.useDialog?``:ai.value.title,withCloseButton:!F.value.table.useDialog,isCursorPointer:V.value,onClose:oi},{th:O(({th:e})=>[b(`div`,zt,qe(e),1)]),td:O(({td:e})=>[Ie(qe(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`]))]),_:2},[F.value.table.useDialog?{name:`title`,fn:O(()=>[Ie(qe(ai.value.title),1)]),key:`0`}:void 0,F.value.table.useDialog?{name:`actions`,fn:O(()=>[b(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[2]||=e=>Mr(sn.value.callbacks.csv),style:C({cursor:V.value?`pointer`:`default`})},[Le(Oe,{name:`fileCsv`,stroke:ai.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):v(``,!0),E(e.$slots,`skeleton`,{},()=>[D(un)?(w(),_(ke,{key:0})):v(``,!0)],!0)],46,pt))}},[[`__scopeId`,`data-v-a6c888bf`]]);export{ft as n,Vt as t};