vue-data-ui 2.6.19 → 2.6.21

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 (171) hide show
  1. package/README.md +8 -0
  2. package/dist/{Arrow-QMACp9z-.cjs → Arrow-C1pcd-am.cjs} +1 -1
  3. package/dist/{Arrow-DTtLZwne.js → Arrow-DQaZQgi6.js} +1 -1
  4. package/dist/{BaseIcon-BpRuwiFD.cjs → BaseIcon-BQwivF_K.cjs} +1 -1
  5. package/dist/{BaseIcon-nz-vbP7I.js → BaseIcon-DH34CAFx.js} +1 -1
  6. package/dist/{DataTable-Dr-djTUz.cjs → DataTable-D5572vAU.cjs} +1 -1
  7. package/dist/{DataTable-pNLWbeCL.js → DataTable-DfMqgTjL.js} +2 -2
  8. package/dist/{Legend-BHbX2C8f.cjs → Legend-CoREnR30.cjs} +1 -1
  9. package/dist/{Legend-s9DRKvJo.js → Legend-PL8rU0J1.js} +2 -2
  10. package/dist/{PackageVersion-hltZM-fb.js → PackageVersion-1Y7SXTrk.js} +1 -1
  11. package/dist/{PackageVersion-DsoqDgVf.cjs → PackageVersion-JsuXjgR_.cjs} +1 -1
  12. package/dist/PenAndPaper-7lGhxIH8.cjs +1 -0
  13. package/dist/{PenAndPaper-qmkn1GhB.js → PenAndPaper-BYhUvcy4.js} +20 -16
  14. package/dist/{PenAndPaper.vue_vue_type_style_index_0_scoped_c968a401_lang-z17A_S1M.js → PenAndPaper.vue_vue_type_style_index_0_scoped_3cea7589_lang-AmNwJZI7.js} +3 -3
  15. package/dist/{PenAndPaper.vue_vue_type_style_index_0_scoped_c968a401_lang-lH7bkq1z.cjs → PenAndPaper.vue_vue_type_style_index_0_scoped_3cea7589_lang-NplvneD1.cjs} +1 -1
  16. package/dist/{Shape-YhMDtuHk.cjs → Shape-HtDeeGqp.cjs} +1 -1
  17. package/dist/{Shape-C3y6rj0O.js → Shape-Ov27sl2L.js} +1 -1
  18. package/dist/{Slicer-BIW17-XH.js → Slicer-6F4tHrZR.js} +3 -3
  19. package/dist/{Slicer-BA8XF-Ak.cjs → Slicer-COXIFuZ-.cjs} +1 -1
  20. package/dist/{Title-dsg3PqUg.js → Title-1PWD04Gh.js} +1 -1
  21. package/dist/{Title-DWqgN4Kv.cjs → Title-Pgt1Ixvo.cjs} +1 -1
  22. package/dist/{Tooltip-DRFQIslg.js → Tooltip-BTO5NGkn.js} +1 -1
  23. package/dist/{Tooltip-B6T_qzJD.cjs → Tooltip-te_h24w6.cjs} +1 -1
  24. package/dist/{index-3OrObUP-.cjs → index-DM-Bs-Ua.cjs} +1 -1
  25. package/dist/{index-DvAaY6OP.js → index-DUnEDLbc.js} +1 -1
  26. package/dist/index.es-DvaaoatM.cjs +18 -0
  27. package/dist/index.es-RWt7DWPC.js +6645 -0
  28. package/dist/{jspdf.es.min-C5v1xtPn.cjs → jspdf.es.min-Rw70uifz.cjs} +23 -23
  29. package/dist/{jspdf.es.min-DKXYalZb.js → jspdf.es.min-eTA26cmm.js} +476 -470
  30. package/dist/{pdf-CHXlEvWj.cjs → pdf-DSkQT5iH.cjs} +1 -1
  31. package/dist/{pdf-70oZh5Jp.js → pdf-DVWl3Adn.js} +1 -1
  32. package/dist/style.css +1 -1
  33. package/dist/{useNestedProp-CGzX7c5Q.js → useNestedProp-CEMeoM-f.js} +1 -1
  34. package/dist/{useNestedProp-B53Yi1Rk.cjs → useNestedProp-CYy5g-mh.cjs} +1 -1
  35. package/dist/usePrinter-DbpIk44f.cjs +1 -0
  36. package/dist/{usePrinter-D_2jA4x8.js → usePrinter-Undaynpo.js} +73 -71
  37. package/dist/useResponsive-N8jl0-aC.cjs +1 -0
  38. package/dist/{useResponsive-BWapHhVH.js → useResponsive-vZgZwV-S.js} +65 -64
  39. package/dist/{vue-data-ui-CTjgYwlW.cjs → vue-data-ui-BapofDyJ.cjs} +1 -1
  40. package/dist/{vue-data-ui-DMl9rAwQ.js → vue-data-ui-DnaIYz0z.js} +61 -61
  41. package/dist/vue-data-ui.cjs +1 -1
  42. package/dist/vue-data-ui.js +1 -1
  43. package/dist/{vue-ui-3d-bar-DBVRoMwv.js → vue-ui-3d-bar-DLYaW0-y.js} +105 -98
  44. package/dist/{vue-ui-3d-bar-OwVsZokU.cjs → vue-ui-3d-bar-DansBM76.cjs} +2 -2
  45. package/dist/{vue-ui-accordion-LbUarYuf.js → vue-ui-accordion-C8Couc_G.js} +3 -3
  46. package/dist/{vue-ui-accordion-BmScSwW2.cjs → vue-ui-accordion-ZIsT4At8.cjs} +1 -1
  47. package/dist/{vue-ui-age-pyramid-DQ5dL4yb.cjs → vue-ui-age-pyramid-BSXnW9GF.cjs} +1 -1
  48. package/dist/{vue-ui-age-pyramid-rmfEfmj7.js → vue-ui-age-pyramid-BdruKMmo.js} +76 -69
  49. package/dist/{vue-ui-annotator-nS_RSspz.cjs → vue-ui-annotator-B7Go0M7W.cjs} +1 -1
  50. package/dist/{vue-ui-annotator-FlMkU7Kj.js → vue-ui-annotator-DVfdPMa7.js} +2 -2
  51. package/dist/{vue-ui-bullet-esfPgi-9.js → vue-ui-bullet-CkCJgmoJ.js} +145 -138
  52. package/dist/{vue-ui-bullet-BGTTcXBJ.cjs → vue-ui-bullet-N9ud2cQ7.cjs} +4 -4
  53. package/dist/{vue-ui-candlestick-RHrlnUqs.js → vue-ui-candlestick-C9B13qeU.js} +116 -109
  54. package/dist/{vue-ui-candlestick-BUEGFHg_.cjs → vue-ui-candlestick-DPIs9tEW.cjs} +2 -2
  55. package/dist/{vue-ui-carousel-table-6uP-Kk9U.js → vue-ui-carousel-table-BLo52Rqu.js} +130 -123
  56. package/dist/{vue-ui-carousel-table-DCcPnWRU.cjs → vue-ui-carousel-table-DgcY4j9y.cjs} +1 -1
  57. package/dist/{vue-ui-chestnut-B7Ep4Lho.cjs → vue-ui-chestnut-C9Zw_bey.cjs} +2 -2
  58. package/dist/{vue-ui-chestnut-Dh4y5s_v.js → vue-ui-chestnut-D8oXG8Tf.js} +131 -124
  59. package/dist/vue-ui-circle-pack-CrEdkNM7.js +648 -0
  60. package/dist/vue-ui-circle-pack-DYW-e2E5.cjs +1 -0
  61. package/dist/{vue-ui-cursor-D-IzE_jd.cjs → vue-ui-cursor-CtSijliN.cjs} +1 -1
  62. package/dist/{vue-ui-cursor-C21WgpGu.js → vue-ui-cursor-DkW4pJcP.js} +2 -2
  63. package/dist/{vue-ui-dashboard-T0LqYCqM.js → vue-ui-dashboard-5_Du0Yr2.js} +3 -3
  64. package/dist/{vue-ui-dashboard-DQ_wht4B.cjs → vue-ui-dashboard-Dh5vRbdI.cjs} +1 -1
  65. package/dist/{vue-ui-digits-CwV6mhHZ.cjs → vue-ui-digits-DEmYk7sS.cjs} +1 -1
  66. package/dist/{vue-ui-digits-CLFrlUIW.js → vue-ui-digits-DhA1bHdz.js} +2 -2
  67. package/dist/{vue-ui-donut-dVplEheX.js → vue-ui-donut-B-G7gRdV.js} +118 -111
  68. package/dist/{vue-ui-donut-b_UXDeKJ.cjs → vue-ui-donut-BrZxaijU.cjs} +1 -1
  69. package/dist/{vue-ui-donut-evolution-Bl50EWBG.js → vue-ui-donut-evolution-B4almlBq.js} +164 -157
  70. package/dist/{vue-ui-donut-evolution-VxNtQWGH.cjs → vue-ui-donut-evolution-CTbXi7wk.cjs} +1 -1
  71. package/dist/{vue-ui-dumbbell-B-7s7x7a.cjs → vue-ui-dumbbell-CAIlnhsM.cjs} +2 -2
  72. package/dist/{vue-ui-dumbbell-Bp685TTG.js → vue-ui-dumbbell-kZGa__IU.js} +75 -68
  73. package/dist/{vue-ui-flow-CHbfoU97.js → vue-ui-flow-Bc31ZN1W.js} +177 -170
  74. package/dist/{vue-ui-flow-DJqOVlD7.cjs → vue-ui-flow-D2UNbwlp.cjs} +1 -1
  75. package/dist/{vue-ui-funnel-B77giO54.cjs → vue-ui-funnel-DfCz1GNN.cjs} +1 -1
  76. package/dist/{vue-ui-funnel-Bhv0XRzJ.js → vue-ui-funnel-V7hu2Iib.js} +129 -122
  77. package/dist/{vue-ui-galaxy-Dt4dx9bS.cjs → vue-ui-galaxy-CNBC7IbU.cjs} +1 -1
  78. package/dist/{vue-ui-galaxy-DMA8AX8h.js → vue-ui-galaxy-DLCcy7Kq.js} +77 -70
  79. package/dist/{vue-ui-gauge-CBlurlZk.js → vue-ui-gauge-CZMHtEcr.js} +153 -146
  80. package/dist/{vue-ui-gauge-Bh3iSbSd.cjs → vue-ui-gauge-D8IglqIF.cjs} +1 -1
  81. package/dist/{vue-ui-gizmo-CHhJKge-.js → vue-ui-gizmo-BuAVBMBp.js} +3 -3
  82. package/dist/{vue-ui-gizmo-BMrnNfYR.cjs → vue-ui-gizmo-fyC414Iv.cjs} +1 -1
  83. package/dist/vue-ui-heatmap-CDOry_F1.cjs +1 -0
  84. package/dist/{vue-ui-heatmap-CB4852rp.js → vue-ui-heatmap-hUfFzGck.js} +139 -132
  85. package/dist/{vue-ui-history-plot-AwmdEhYL.js → vue-ui-history-plot-C79l8rPm.js} +122 -115
  86. package/dist/{vue-ui-history-plot-BG7r0ZF7.cjs → vue-ui-history-plot-CIXgvWpk.cjs} +1 -1
  87. package/dist/{vue-ui-kpi-DcxE4Vv7.js → vue-ui-kpi-C3tHthXH.js} +3 -3
  88. package/dist/{vue-ui-kpi-BYCMEzBt.cjs → vue-ui-kpi-yiWxNLJ-.cjs} +1 -1
  89. package/dist/{vue-ui-mini-loader-CdDRH8Rb.js → vue-ui-mini-loader-1p1jAKx_.js} +2 -2
  90. package/dist/{vue-ui-mini-loader-DOqUfxRJ.cjs → vue-ui-mini-loader-26yCYjxn.cjs} +1 -1
  91. package/dist/{vue-ui-molecule-C-Z0Ywq1.cjs → vue-ui-molecule-Bw0dYLfu.cjs} +1 -1
  92. package/dist/{vue-ui-molecule-BskBKGbQ.js → vue-ui-molecule-COQ-yrBr.js} +249 -242
  93. package/dist/{vue-ui-mood-radar-BAPZ1LyF.js → vue-ui-mood-radar-CwfGiQ43.js} +111 -104
  94. package/dist/{vue-ui-mood-radar-BIrQKfVf.cjs → vue-ui-mood-radar-Cyde9hnR.cjs} +1 -1
  95. package/dist/{vue-ui-nested-donuts-BB2Kgb5F.js → vue-ui-nested-donuts-BVaW7w1U.js} +117 -110
  96. package/dist/{vue-ui-nested-donuts-7YjtP-jC.cjs → vue-ui-nested-donuts-Y07lLGRa.cjs} +2 -2
  97. package/dist/{vue-ui-onion-BWb18zcN.cjs → vue-ui-onion-DkXss-B_.cjs} +2 -2
  98. package/dist/{vue-ui-onion-BjMfXAZK.js → vue-ui-onion-h6DP9kOi.js} +143 -136
  99. package/dist/{vue-ui-parallel-coordinate-plot-D6Vs-5Vh.cjs → vue-ui-parallel-coordinate-plot-CkI21cq2.cjs} +2 -2
  100. package/dist/{vue-ui-parallel-coordinate-plot-ryqdfkHL.js → vue-ui-parallel-coordinate-plot-O5cwKbzH.js} +113 -106
  101. package/dist/{vue-ui-quadrant-Cr4ypLzT.js → vue-ui-quadrant-CfywvXnV.js} +112 -105
  102. package/dist/{vue-ui-quadrant-BmsHBpKo.cjs → vue-ui-quadrant-F6w-QJE_.cjs} +1 -1
  103. package/dist/{vue-ui-quick-chart-45IEXHb0.cjs → vue-ui-quick-chart-BeMHD_Kz.cjs} +3 -3
  104. package/dist/{vue-ui-quick-chart-C9dIHRYi.js → vue-ui-quick-chart-C1AwFGSr.js} +195 -188
  105. package/dist/{vue-ui-radar-Nr5JmVlk.cjs → vue-ui-radar-BejYh3DW.cjs} +1 -1
  106. package/dist/{vue-ui-radar-T6xdl9ic.js → vue-ui-radar-DDKXLi5o.js} +101 -94
  107. package/dist/{vue-ui-rating-C5AaiBqZ.js → vue-ui-rating-BrGbM0Op.js} +2 -2
  108. package/dist/{vue-ui-rating-CFIhZlG-.cjs → vue-ui-rating-C40ktvn7.cjs} +1 -1
  109. package/dist/{vue-ui-relation-circle-Cw-DcsRY.cjs → vue-ui-relation-circle-C4qT13SI.cjs} +1 -1
  110. package/dist/{vue-ui-relation-circle-BktS594K.js → vue-ui-relation-circle-DrtdiTMX.js} +103 -96
  111. package/dist/{vue-ui-rings-_evAK3j7.js → vue-ui-rings-C4IdhEUE.js} +169 -162
  112. package/dist/{vue-ui-rings-2j5fsO_o.cjs → vue-ui-rings-Cd8WyeDZ.cjs} +2 -2
  113. package/dist/{vue-ui-scatter-C5ePnByD.js → vue-ui-scatter-BS8sgyMi.js} +85 -78
  114. package/dist/{vue-ui-scatter-W1_ChsfO.cjs → vue-ui-scatter-MmvIeu4D.cjs} +1 -1
  115. package/dist/{vue-ui-screenshot-B6ASKPJf.cjs → vue-ui-screenshot-BB51-eRL.cjs} +1 -1
  116. package/dist/{vue-ui-screenshot-DM-PQM2g.js → vue-ui-screenshot-tnFPT1vi.js} +1 -1
  117. package/dist/{vue-ui-skeleton-WoggMoff.js → vue-ui-skeleton-DieABKlo.js} +3 -3
  118. package/dist/{vue-ui-skeleton-DaowWOKJ.cjs → vue-ui-skeleton-DlC-U64G.cjs} +1 -1
  119. package/dist/{vue-ui-smiley-gulDZ8i7.js → vue-ui-smiley-C32wVXgu.js} +2 -2
  120. package/dist/{vue-ui-smiley-hlaNlq2y.cjs → vue-ui-smiley-DSxKw3ud.cjs} +1 -1
  121. package/dist/{vue-ui-spark-trend-LbApLsdt.js → vue-ui-spark-trend-B_x1dX38.js} +5 -5
  122. package/dist/{vue-ui-spark-trend-BcrMflk6.cjs → vue-ui-spark-trend-vexkCCy9.cjs} +1 -1
  123. package/dist/{vue-ui-sparkbar-BdfaDBkw.cjs → vue-ui-sparkbar-CsOEiHDQ.cjs} +1 -1
  124. package/dist/{vue-ui-sparkbar-CnL6FbaE.js → vue-ui-sparkbar-ZSbB6Llo.js} +4 -4
  125. package/dist/{vue-ui-sparkgauge-CHv1q1cO.cjs → vue-ui-sparkgauge-Bdh7X--h.cjs} +1 -1
  126. package/dist/{vue-ui-sparkgauge-Du7PRJyB.js → vue-ui-sparkgauge-Cf3bDk98.js} +4 -4
  127. package/dist/{vue-ui-sparkhistogram-CyEyZvbD.js → vue-ui-sparkhistogram-CrZy1xf0.js} +5 -5
  128. package/dist/{vue-ui-sparkhistogram-CBqKXnvX.cjs → vue-ui-sparkhistogram-fALwb3uK.cjs} +1 -1
  129. package/dist/{vue-ui-sparkline-DRHE0kK8.cjs → vue-ui-sparkline-D4WDvcZR.cjs} +1 -1
  130. package/dist/{vue-ui-sparkline-BMNXPHhB.js → vue-ui-sparkline-DTW_lXgp.js} +5 -5
  131. package/dist/{vue-ui-sparkstackbar-D6wuDd8h.cjs → vue-ui-sparkstackbar-DBPLhUoi.cjs} +1 -1
  132. package/dist/{vue-ui-sparkstackbar-D33lwh8d.js → vue-ui-sparkstackbar-Db2Ndf0k.js} +5 -5
  133. package/dist/{vue-ui-stackbar-CnxGAca-.cjs → vue-ui-stackbar-B3eaSIoO.cjs} +3 -3
  134. package/dist/{vue-ui-stackbar-C5yoqQAY.js → vue-ui-stackbar-DbF3ZJTD.js} +211 -204
  135. package/dist/{vue-ui-strip-plot-Cg1B7i3X.js → vue-ui-strip-plot-CpkH2Gfd.js} +83 -76
  136. package/dist/{vue-ui-strip-plot-DDTTc2jA.cjs → vue-ui-strip-plot-DiCVf5u-.cjs} +1 -1
  137. package/dist/{vue-ui-table-BGfZl0wF.js → vue-ui-table-D6zWwikN.js} +1 -1
  138. package/dist/{vue-ui-table-TV5Coa0A.cjs → vue-ui-table-K13fqkDI.cjs} +1 -1
  139. package/dist/{vue-ui-table-heatmap-Jjx8L8St.cjs → vue-ui-table-heatmap-BgenCoVa.cjs} +1 -1
  140. package/dist/{vue-ui-table-heatmap-D0j2OFv0.js → vue-ui-table-heatmap-EAevgnzN.js} +63 -56
  141. package/dist/{vue-ui-table-sparkline-D0_FhhN5.cjs → vue-ui-table-sparkline-3JMqr89P.cjs} +1 -1
  142. package/dist/{vue-ui-table-sparkline-C2sUG_7S.js → vue-ui-table-sparkline-s_oWe6MG.js} +90 -83
  143. package/dist/{vue-ui-thermometer-Bw35Fw8v.cjs → vue-ui-thermometer--mYRly4x.cjs} +1 -1
  144. package/dist/{vue-ui-thermometer-CdLZ8te2.js → vue-ui-thermometer-Bo3l_0Kf.js} +113 -106
  145. package/dist/{vue-ui-timer-1-kXQ5_q.js → vue-ui-timer-C9EuUurN.js} +6 -6
  146. package/dist/{vue-ui-timer-Deg5YPx0.cjs → vue-ui-timer-Djh-ZDNe.cjs} +1 -1
  147. package/dist/{vue-ui-tiremarks-uSgVLSbo.cjs → vue-ui-tiremarks-CKv_KApZ.cjs} +1 -1
  148. package/dist/{vue-ui-tiremarks-BHTSw0fa.js → vue-ui-tiremarks-DgdpEDJ1.js} +76 -69
  149. package/dist/{vue-ui-treemap-7W_lvbV0.cjs → vue-ui-treemap-AkNJjd2c.cjs} +1 -1
  150. package/dist/{vue-ui-treemap-C2u5sEzh.js → vue-ui-treemap-D13sISL0.js} +144 -137
  151. package/dist/{vue-ui-vertical-bar-BlzOi8LC.cjs → vue-ui-vertical-bar-CQlvpdJl.cjs} +3 -3
  152. package/dist/{vue-ui-vertical-bar-U3LQF-NS.js → vue-ui-vertical-bar-DfegzHj4.js} +120 -113
  153. package/dist/{vue-ui-waffle-DUXvINoC.cjs → vue-ui-waffle-Dve1LWVt.cjs} +1 -1
  154. package/dist/{vue-ui-waffle-qAheWwiI.js → vue-ui-waffle-f72Lq8_D.js} +78 -71
  155. package/dist/{vue-ui-wheel-DIoKCgCS.cjs → vue-ui-wheel-BG1GcVvN.cjs} +1 -1
  156. package/dist/{vue-ui-wheel-CuLQchDK.js → vue-ui-wheel-BxefMdit.js} +105 -98
  157. package/dist/{vue-ui-word-cloud-B-nFH7hZ.js → vue-ui-word-cloud-BYY4K2G4.js} +123 -116
  158. package/dist/{vue-ui-word-cloud-BSvmRQ5n.cjs → vue-ui-word-cloud-CRRR7H7h.cjs} +1 -1
  159. package/dist/{vue-ui-xy-DXMoSF2C.js → vue-ui-xy-BS0_aTIH.js} +73 -66
  160. package/dist/{vue-ui-xy-BGsFH9wE.cjs → vue-ui-xy-DGYZFgdd.cjs} +2 -2
  161. package/dist/{vue-ui-xy-canvas-CTymfSH6.js → vue-ui-xy-canvas-Bl2v7Z3U.js} +200 -193
  162. package/dist/{vue-ui-xy-canvas-i13v43UX.cjs → vue-ui-xy-canvas-R_pPaj0X.cjs} +2 -2
  163. package/package.json +2 -7
  164. package/dist/PenAndPaper-Dbw8Fph9.cjs +0 -1
  165. package/dist/index-Dwoe0gcF.cjs +0 -15
  166. package/dist/index-Fl-W8YeZ.js +0 -3971
  167. package/dist/usePrinter-bPnqqKha.cjs +0 -1
  168. package/dist/useResponsive-YQYQrAZ_.cjs +0 -1
  169. package/dist/vue-ui-circle-pack-Ce1oEvgz.cjs +0 -1
  170. package/dist/vue-ui-circle-pack-CrgnQ_jY.js +0 -663
  171. package/dist/vue-ui-heatmap-DvItO4xs.cjs +0 -1
@@ -1,3971 +0,0 @@
1
- var ts = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
- function _e(l) {
3
- return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
4
- }
5
- var vt = { exports: {} }, gt = { exports: {} }, es = gt.exports, me;
6
- function ss() {
7
- return me || (me = 1, (function() {
8
- var l, t, e, s, i, n;
9
- typeof performance < "u" && performance !== null && performance.now ? gt.exports = function() {
10
- return performance.now();
11
- } : typeof process < "u" && process !== null && process.hrtime ? (gt.exports = function() {
12
- return (l() - i) / 1e6;
13
- }, t = process.hrtime, l = function() {
14
- var a;
15
- return a = t(), a[0] * 1e9 + a[1];
16
- }, s = l(), n = process.uptime() * 1e9, i = s - n) : Date.now ? (gt.exports = function() {
17
- return Date.now() - e;
18
- }, e = Date.now()) : (gt.exports = function() {
19
- return (/* @__PURE__ */ new Date()).getTime() - e;
20
- }, e = (/* @__PURE__ */ new Date()).getTime());
21
- }).call(es)), gt.exports;
22
- }
23
- var xe;
24
- function is() {
25
- if (xe) return vt.exports;
26
- xe = 1;
27
- for (var l = ss(), t = typeof window > "u" ? ts : window, e = ["moz", "webkit"], s = "AnimationFrame", i = t["request" + s], n = t["cancel" + s] || t["cancelRequest" + s], a = 0; !i && a < e.length; a++)
28
- i = t[e[a] + "Request" + s], n = t[e[a] + "Cancel" + s] || t[e[a] + "CancelRequest" + s];
29
- if (!i || !n) {
30
- var r = 0, o = 0, h = [], u = 1e3 / 60;
31
- i = function(f) {
32
- if (h.length === 0) {
33
- var g = l(), c = Math.max(0, u - (g - r));
34
- r = c + g, setTimeout(function() {
35
- var d = h.slice(0);
36
- h.length = 0;
37
- for (var p = 0; p < d.length; p++)
38
- if (!d[p].cancelled)
39
- try {
40
- d[p].callback(r);
41
- } catch (y) {
42
- setTimeout(function() {
43
- throw y;
44
- }, 0);
45
- }
46
- }, Math.round(c));
47
- }
48
- return h.push({
49
- handle: ++o,
50
- callback: f,
51
- cancelled: !1
52
- }), o;
53
- }, n = function(f) {
54
- for (var g = 0; g < h.length; g++)
55
- h[g].handle === f && (h[g].cancelled = !0);
56
- };
57
- }
58
- return vt.exports = function(f) {
59
- return i.call(t, f);
60
- }, vt.exports.cancel = function() {
61
- n.apply(t, arguments);
62
- }, vt.exports.polyfill = function(f) {
63
- f || (f = t), f.requestAnimationFrame = i, f.cancelAnimationFrame = n;
64
- }, vt.exports;
65
- }
66
- var ns = is();
67
- const jt = /* @__PURE__ */ _e(ns);
68
- var Kt, be;
69
- function rs() {
70
- return be || (be = 1, Kt = function(l) {
71
- this.ok = !1, this.alpha = 1, l.charAt(0) == "#" && (l = l.substr(1, 6)), l = l.replace(/ /g, ""), l = l.toLowerCase();
72
- var t = {
73
- aliceblue: "f0f8ff",
74
- antiquewhite: "faebd7",
75
- aqua: "00ffff",
76
- aquamarine: "7fffd4",
77
- azure: "f0ffff",
78
- beige: "f5f5dc",
79
- bisque: "ffe4c4",
80
- black: "000000",
81
- blanchedalmond: "ffebcd",
82
- blue: "0000ff",
83
- blueviolet: "8a2be2",
84
- brown: "a52a2a",
85
- burlywood: "deb887",
86
- cadetblue: "5f9ea0",
87
- chartreuse: "7fff00",
88
- chocolate: "d2691e",
89
- coral: "ff7f50",
90
- cornflowerblue: "6495ed",
91
- cornsilk: "fff8dc",
92
- crimson: "dc143c",
93
- cyan: "00ffff",
94
- darkblue: "00008b",
95
- darkcyan: "008b8b",
96
- darkgoldenrod: "b8860b",
97
- darkgray: "a9a9a9",
98
- darkgreen: "006400",
99
- darkkhaki: "bdb76b",
100
- darkmagenta: "8b008b",
101
- darkolivegreen: "556b2f",
102
- darkorange: "ff8c00",
103
- darkorchid: "9932cc",
104
- darkred: "8b0000",
105
- darksalmon: "e9967a",
106
- darkseagreen: "8fbc8f",
107
- darkslateblue: "483d8b",
108
- darkslategray: "2f4f4f",
109
- darkturquoise: "00ced1",
110
- darkviolet: "9400d3",
111
- deeppink: "ff1493",
112
- deepskyblue: "00bfff",
113
- dimgray: "696969",
114
- dodgerblue: "1e90ff",
115
- feldspar: "d19275",
116
- firebrick: "b22222",
117
- floralwhite: "fffaf0",
118
- forestgreen: "228b22",
119
- fuchsia: "ff00ff",
120
- gainsboro: "dcdcdc",
121
- ghostwhite: "f8f8ff",
122
- gold: "ffd700",
123
- goldenrod: "daa520",
124
- gray: "808080",
125
- green: "008000",
126
- greenyellow: "adff2f",
127
- honeydew: "f0fff0",
128
- hotpink: "ff69b4",
129
- indianred: "cd5c5c",
130
- indigo: "4b0082",
131
- ivory: "fffff0",
132
- khaki: "f0e68c",
133
- lavender: "e6e6fa",
134
- lavenderblush: "fff0f5",
135
- lawngreen: "7cfc00",
136
- lemonchiffon: "fffacd",
137
- lightblue: "add8e6",
138
- lightcoral: "f08080",
139
- lightcyan: "e0ffff",
140
- lightgoldenrodyellow: "fafad2",
141
- lightgrey: "d3d3d3",
142
- lightgreen: "90ee90",
143
- lightpink: "ffb6c1",
144
- lightsalmon: "ffa07a",
145
- lightseagreen: "20b2aa",
146
- lightskyblue: "87cefa",
147
- lightslateblue: "8470ff",
148
- lightslategray: "778899",
149
- lightsteelblue: "b0c4de",
150
- lightyellow: "ffffe0",
151
- lime: "00ff00",
152
- limegreen: "32cd32",
153
- linen: "faf0e6",
154
- magenta: "ff00ff",
155
- maroon: "800000",
156
- mediumaquamarine: "66cdaa",
157
- mediumblue: "0000cd",
158
- mediumorchid: "ba55d3",
159
- mediumpurple: "9370d8",
160
- mediumseagreen: "3cb371",
161
- mediumslateblue: "7b68ee",
162
- mediumspringgreen: "00fa9a",
163
- mediumturquoise: "48d1cc",
164
- mediumvioletred: "c71585",
165
- midnightblue: "191970",
166
- mintcream: "f5fffa",
167
- mistyrose: "ffe4e1",
168
- moccasin: "ffe4b5",
169
- navajowhite: "ffdead",
170
- navy: "000080",
171
- oldlace: "fdf5e6",
172
- olive: "808000",
173
- olivedrab: "6b8e23",
174
- orange: "ffa500",
175
- orangered: "ff4500",
176
- orchid: "da70d6",
177
- palegoldenrod: "eee8aa",
178
- palegreen: "98fb98",
179
- paleturquoise: "afeeee",
180
- palevioletred: "d87093",
181
- papayawhip: "ffefd5",
182
- peachpuff: "ffdab9",
183
- peru: "cd853f",
184
- pink: "ffc0cb",
185
- plum: "dda0dd",
186
- powderblue: "b0e0e6",
187
- purple: "800080",
188
- rebeccapurple: "663399",
189
- red: "ff0000",
190
- rosybrown: "bc8f8f",
191
- royalblue: "4169e1",
192
- saddlebrown: "8b4513",
193
- salmon: "fa8072",
194
- sandybrown: "f4a460",
195
- seagreen: "2e8b57",
196
- seashell: "fff5ee",
197
- sienna: "a0522d",
198
- silver: "c0c0c0",
199
- skyblue: "87ceeb",
200
- slateblue: "6a5acd",
201
- slategray: "708090",
202
- snow: "fffafa",
203
- springgreen: "00ff7f",
204
- steelblue: "4682b4",
205
- tan: "d2b48c",
206
- teal: "008080",
207
- thistle: "d8bfd8",
208
- tomato: "ff6347",
209
- turquoise: "40e0d0",
210
- violet: "ee82ee",
211
- violetred: "d02090",
212
- wheat: "f5deb3",
213
- white: "ffffff",
214
- whitesmoke: "f5f5f5",
215
- yellow: "ffff00",
216
- yellowgreen: "9acd32"
217
- };
218
- l = t[l] || l;
219
- for (var e = [
220
- {
221
- re: /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,
222
- example: ["rgba(123, 234, 45, 0.8)", "rgba(255,234,245,1.0)"],
223
- process: function(o) {
224
- return [
225
- parseInt(o[1]),
226
- parseInt(o[2]),
227
- parseInt(o[3]),
228
- parseFloat(o[4])
229
- ];
230
- }
231
- },
232
- {
233
- re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
234
- example: ["rgb(123, 234, 45)", "rgb(255,234,245)"],
235
- process: function(o) {
236
- return [
237
- parseInt(o[1]),
238
- parseInt(o[2]),
239
- parseInt(o[3])
240
- ];
241
- }
242
- },
243
- {
244
- re: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
245
- example: ["#00ff00", "336699"],
246
- process: function(o) {
247
- return [
248
- parseInt(o[1], 16),
249
- parseInt(o[2], 16),
250
- parseInt(o[3], 16)
251
- ];
252
- }
253
- },
254
- {
255
- re: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
256
- example: ["#fb0", "f0f"],
257
- process: function(o) {
258
- return [
259
- parseInt(o[1] + o[1], 16),
260
- parseInt(o[2] + o[2], 16),
261
- parseInt(o[3] + o[3], 16)
262
- ];
263
- }
264
- }
265
- ], s = 0; s < e.length; s++) {
266
- var i = e[s].re, n = e[s].process, a = i.exec(l);
267
- if (a) {
268
- var r = n(a);
269
- this.r = r[0], this.g = r[1], this.b = r[2], r.length > 3 && (this.alpha = r[3]), this.ok = !0;
270
- }
271
- }
272
- this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r, this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g, this.b = this.b < 0 || isNaN(this.b) ? 0 : this.b > 255 ? 255 : this.b, this.alpha = this.alpha < 0 ? 0 : this.alpha > 1 || isNaN(this.alpha) ? 1 : this.alpha, this.toRGB = function() {
273
- return "rgb(" + this.r + ", " + this.g + ", " + this.b + ")";
274
- }, this.toRGBA = function() {
275
- return "rgba(" + this.r + ", " + this.g + ", " + this.b + ", " + this.alpha + ")";
276
- }, this.toHex = function() {
277
- var o = this.r.toString(16), h = this.g.toString(16), u = this.b.toString(16);
278
- return o.length == 1 && (o = "0" + o), h.length == 1 && (h = "0" + h), u.length == 1 && (u = "0" + u), "#" + o + h + u;
279
- }, this.getHelpXML = function() {
280
- for (var o = new Array(), h = 0; h < e.length; h++)
281
- for (var u = e[h].example, f = 0; f < u.length; f++)
282
- o[o.length] = u[f];
283
- for (var g in t)
284
- o[o.length] = g;
285
- var c = document.createElement("ul");
286
- c.setAttribute("id", "rgbcolor-examples");
287
- for (var h = 0; h < o.length; h++)
288
- try {
289
- var d = document.createElement("li"), p = new RGBColor(o[h]), y = document.createElement("div");
290
- y.style.cssText = "margin: 3px; border: 1px solid black; background:" + p.toHex() + "; color:" + p.toHex(), y.appendChild(document.createTextNode("test"));
291
- var x = document.createTextNode(
292
- " " + o[h] + " -> " + p.toRGB() + " -> " + p.toHex()
293
- );
294
- d.appendChild(y), d.appendChild(x), c.appendChild(d);
295
- } catch {
296
- }
297
- return c;
298
- };
299
- }), Kt;
300
- }
301
- var as = rs();
302
- const se = /* @__PURE__ */ _e(as);
303
- /*! *****************************************************************************
304
- Copyright (c) Microsoft Corporation.
305
-
306
- Permission to use, copy, modify, and/or distribute this software for any
307
- purpose with or without fee is hereby granted.
308
-
309
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
310
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
311
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
312
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
313
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
314
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
315
- PERFORMANCE OF THIS SOFTWARE.
316
- ***************************************************************************** */
317
- var Fe = function(l, t) {
318
- return (Fe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, s) {
319
- e.__proto__ = s;
320
- } || function(e, s) {
321
- for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (e[i] = s[i]);
322
- })(l, t);
323
- };
324
- function ze(l, t) {
325
- if (typeof t != "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
326
- function e() {
327
- this.constructor = l;
328
- }
329
- Fe(l, t), l.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
330
- }
331
- function os(l) {
332
- var t = "";
333
- Array.isArray(l) || (l = [l]);
334
- for (var e = 0; e < l.length; e++) {
335
- var s = l[e];
336
- if (s.type === m.CLOSE_PATH) t += "z";
337
- else if (s.type === m.HORIZ_LINE_TO) t += (s.relative ? "h" : "H") + s.x;
338
- else if (s.type === m.VERT_LINE_TO) t += (s.relative ? "v" : "V") + s.y;
339
- else if (s.type === m.MOVE_TO) t += (s.relative ? "m" : "M") + s.x + " " + s.y;
340
- else if (s.type === m.LINE_TO) t += (s.relative ? "l" : "L") + s.x + " " + s.y;
341
- else if (s.type === m.CURVE_TO) t += (s.relative ? "c" : "C") + s.x1 + " " + s.y1 + " " + s.x2 + " " + s.y2 + " " + s.x + " " + s.y;
342
- else if (s.type === m.SMOOTH_CURVE_TO) t += (s.relative ? "s" : "S") + s.x2 + " " + s.y2 + " " + s.x + " " + s.y;
343
- else if (s.type === m.QUAD_TO) t += (s.relative ? "q" : "Q") + s.x1 + " " + s.y1 + " " + s.x + " " + s.y;
344
- else if (s.type === m.SMOOTH_QUAD_TO) t += (s.relative ? "t" : "T") + s.x + " " + s.y;
345
- else {
346
- if (s.type !== m.ARC) throw new Error('Unexpected command type "' + s.type + '" at index ' + e + ".");
347
- t += (s.relative ? "a" : "A") + s.rX + " " + s.rY + " " + s.xRot + " " + +s.lArcFlag + " " + +s.sweepFlag + " " + s.x + " " + s.y;
348
- }
349
- }
350
- return t;
351
- }
352
- function ie(l, t) {
353
- var e = l[0], s = l[1];
354
- return [e * Math.cos(t) - s * Math.sin(t), e * Math.sin(t) + s * Math.cos(t)];
355
- }
356
- function K() {
357
- for (var l = [], t = 0; t < arguments.length; t++) l[t] = arguments[t];
358
- for (var e = 0; e < l.length; e++) if (typeof l[e] != "number") throw new Error("assertNumbers arguments[" + e + "] is not a number. " + typeof l[e] + " == typeof " + l[e]);
359
- return !0;
360
- }
361
- var rt = Math.PI;
362
- function Jt(l, t, e) {
363
- l.lArcFlag = l.lArcFlag === 0 ? 0 : 1, l.sweepFlag = l.sweepFlag === 0 ? 0 : 1;
364
- var s = l.rX, i = l.rY, n = l.x, a = l.y;
365
- s = Math.abs(l.rX), i = Math.abs(l.rY);
366
- var r = ie([(t - n) / 2, (e - a) / 2], -l.xRot / 180 * rt), o = r[0], h = r[1], u = Math.pow(o, 2) / Math.pow(s, 2) + Math.pow(h, 2) / Math.pow(i, 2);
367
- 1 < u && (s *= Math.sqrt(u), i *= Math.sqrt(u)), l.rX = s, l.rY = i;
368
- var f = Math.pow(s, 2) * Math.pow(h, 2) + Math.pow(i, 2) * Math.pow(o, 2), g = (l.lArcFlag !== l.sweepFlag ? 1 : -1) * Math.sqrt(Math.max(0, (Math.pow(s, 2) * Math.pow(i, 2) - f) / f)), c = s * h / i * g, d = -i * o / s * g, p = ie([c, d], l.xRot / 180 * rt);
369
- l.cX = p[0] + (t + n) / 2, l.cY = p[1] + (e + a) / 2, l.phi1 = Math.atan2((h - d) / i, (o - c) / s), l.phi2 = Math.atan2((-h - d) / i, (-o - c) / s), l.sweepFlag === 0 && l.phi2 > l.phi1 && (l.phi2 -= 2 * rt), l.sweepFlag === 1 && l.phi2 < l.phi1 && (l.phi2 += 2 * rt), l.phi1 *= 180 / rt, l.phi2 *= 180 / rt;
370
- }
371
- function ve(l, t, e) {
372
- K(l, t, e);
373
- var s = l * l + t * t - e * e;
374
- if (0 > s) return [];
375
- if (s === 0) return [[l * e / (l * l + t * t), t * e / (l * l + t * t)]];
376
- var i = Math.sqrt(s);
377
- return [[(l * e + t * i) / (l * l + t * t), (t * e - l * i) / (l * l + t * t)], [(l * e - t * i) / (l * l + t * t), (t * e + l * i) / (l * l + t * t)]];
378
- }
379
- var D, et = Math.PI / 180;
380
- function Ae(l, t, e) {
381
- return (1 - e) * l + e * t;
382
- }
383
- function Se(l, t, e, s) {
384
- return l + Math.cos(s / 180 * rt) * t + Math.sin(s / 180 * rt) * e;
385
- }
386
- function Te(l, t, e, s) {
387
- var i = 1e-6, n = t - l, a = e - t, r = 3 * n + 3 * (s - e) - 6 * a, o = 6 * (a - n), h = 3 * n;
388
- return Math.abs(r) < i ? [-h / o] : function(u, f, g) {
389
- var c = u * u / 4 - f;
390
- if (c < -1e-6) return [];
391
- if (c <= g) return [-u / 2];
392
- var d = Math.sqrt(c);
393
- return [-u / 2 - d, -u / 2 + d];
394
- }(o / r, h / r, i);
395
- }
396
- function we(l, t, e, s, i) {
397
- var n = 1 - i;
398
- return l * (n * n * n) + t * (3 * n * n * i) + e * (3 * n * i * i) + s * (i * i * i);
399
- }
400
- (function(l) {
401
- function t() {
402
- return i(function(r, o, h) {
403
- return r.relative && (r.x1 !== void 0 && (r.x1 += o), r.y1 !== void 0 && (r.y1 += h), r.x2 !== void 0 && (r.x2 += o), r.y2 !== void 0 && (r.y2 += h), r.x !== void 0 && (r.x += o), r.y !== void 0 && (r.y += h), r.relative = !1), r;
404
- });
405
- }
406
- function e() {
407
- var r = NaN, o = NaN, h = NaN, u = NaN;
408
- return i(function(f, g, c) {
409
- return f.type & m.SMOOTH_CURVE_TO && (f.type = m.CURVE_TO, r = isNaN(r) ? g : r, o = isNaN(o) ? c : o, f.x1 = f.relative ? g - r : 2 * g - r, f.y1 = f.relative ? c - o : 2 * c - o), f.type & m.CURVE_TO ? (r = f.relative ? g + f.x2 : f.x2, o = f.relative ? c + f.y2 : f.y2) : (r = NaN, o = NaN), f.type & m.SMOOTH_QUAD_TO && (f.type = m.QUAD_TO, h = isNaN(h) ? g : h, u = isNaN(u) ? c : u, f.x1 = f.relative ? g - h : 2 * g - h, f.y1 = f.relative ? c - u : 2 * c - u), f.type & m.QUAD_TO ? (h = f.relative ? g + f.x1 : f.x1, u = f.relative ? c + f.y1 : f.y1) : (h = NaN, u = NaN), f;
410
- });
411
- }
412
- function s() {
413
- var r = NaN, o = NaN;
414
- return i(function(h, u, f) {
415
- if (h.type & m.SMOOTH_QUAD_TO && (h.type = m.QUAD_TO, r = isNaN(r) ? u : r, o = isNaN(o) ? f : o, h.x1 = h.relative ? u - r : 2 * u - r, h.y1 = h.relative ? f - o : 2 * f - o), h.type & m.QUAD_TO) {
416
- r = h.relative ? u + h.x1 : h.x1, o = h.relative ? f + h.y1 : h.y1;
417
- var g = h.x1, c = h.y1;
418
- h.type = m.CURVE_TO, h.x1 = ((h.relative ? 0 : u) + 2 * g) / 3, h.y1 = ((h.relative ? 0 : f) + 2 * c) / 3, h.x2 = (h.x + 2 * g) / 3, h.y2 = (h.y + 2 * c) / 3;
419
- } else r = NaN, o = NaN;
420
- return h;
421
- });
422
- }
423
- function i(r) {
424
- var o = 0, h = 0, u = NaN, f = NaN;
425
- return function(g) {
426
- if (isNaN(u) && !(g.type & m.MOVE_TO)) throw new Error("path must start with moveto");
427
- var c = r(g, o, h, u, f);
428
- return g.type & m.CLOSE_PATH && (o = u, h = f), g.x !== void 0 && (o = g.relative ? o + g.x : g.x), g.y !== void 0 && (h = g.relative ? h + g.y : g.y), g.type & m.MOVE_TO && (u = o, f = h), c;
429
- };
430
- }
431
- function n(r, o, h, u, f, g) {
432
- return K(r, o, h, u, f, g), i(function(c, d, p, y) {
433
- var x = c.x1, S = c.x2, b = c.relative && !isNaN(y), v = c.x !== void 0 ? c.x : b ? 0 : d, E = c.y !== void 0 ? c.y : b ? 0 : p;
434
- function C(Z) {
435
- return Z * Z;
436
- }
437
- c.type & m.HORIZ_LINE_TO && o !== 0 && (c.type = m.LINE_TO, c.y = c.relative ? 0 : p), c.type & m.VERT_LINE_TO && h !== 0 && (c.type = m.LINE_TO, c.x = c.relative ? 0 : d), c.x !== void 0 && (c.x = c.x * r + E * h + (b ? 0 : f)), c.y !== void 0 && (c.y = v * o + c.y * u + (b ? 0 : g)), c.x1 !== void 0 && (c.x1 = c.x1 * r + c.y1 * h + (b ? 0 : f)), c.y1 !== void 0 && (c.y1 = x * o + c.y1 * u + (b ? 0 : g)), c.x2 !== void 0 && (c.x2 = c.x2 * r + c.y2 * h + (b ? 0 : f)), c.y2 !== void 0 && (c.y2 = S * o + c.y2 * u + (b ? 0 : g));
438
- var T = r * u - o * h;
439
- if (c.xRot !== void 0 && (r !== 1 || o !== 0 || h !== 0 || u !== 1)) if (T === 0) delete c.rX, delete c.rY, delete c.xRot, delete c.lArcFlag, delete c.sweepFlag, c.type = m.LINE_TO;
440
- else {
441
- var N = c.xRot * Math.PI / 180, R = Math.sin(N), F = Math.cos(N), z = 1 / C(c.rX), _ = 1 / C(c.rY), X = C(F) * z + C(R) * _, B = 2 * R * F * (z - _), L = C(R) * z + C(F) * _, H = X * u * u - B * o * u + L * o * o, U = B * (r * u + o * h) - 2 * (X * h * u + L * r * o), G = X * h * h - B * r * h + L * r * r, k = (Math.atan2(U, H - G) + Math.PI) % Math.PI / 2, O = Math.sin(k), Y = Math.cos(k);
442
- c.rX = Math.abs(T) / Math.sqrt(H * C(Y) + U * O * Y + G * C(O)), c.rY = Math.abs(T) / Math.sqrt(H * C(O) - U * O * Y + G * C(Y)), c.xRot = 180 * k / Math.PI;
443
- }
444
- return c.sweepFlag !== void 0 && 0 > T && (c.sweepFlag = +!c.sweepFlag), c;
445
- });
446
- }
447
- function a() {
448
- return function(r) {
449
- var o = {};
450
- for (var h in r) o[h] = r[h];
451
- return o;
452
- };
453
- }
454
- l.ROUND = function(r) {
455
- function o(h) {
456
- return Math.round(h * r) / r;
457
- }
458
- return r === void 0 && (r = 1e13), K(r), function(h) {
459
- return h.x1 !== void 0 && (h.x1 = o(h.x1)), h.y1 !== void 0 && (h.y1 = o(h.y1)), h.x2 !== void 0 && (h.x2 = o(h.x2)), h.y2 !== void 0 && (h.y2 = o(h.y2)), h.x !== void 0 && (h.x = o(h.x)), h.y !== void 0 && (h.y = o(h.y)), h.rX !== void 0 && (h.rX = o(h.rX)), h.rY !== void 0 && (h.rY = o(h.rY)), h;
460
- };
461
- }, l.TO_ABS = t, l.TO_REL = function() {
462
- return i(function(r, o, h) {
463
- return r.relative || (r.x1 !== void 0 && (r.x1 -= o), r.y1 !== void 0 && (r.y1 -= h), r.x2 !== void 0 && (r.x2 -= o), r.y2 !== void 0 && (r.y2 -= h), r.x !== void 0 && (r.x -= o), r.y !== void 0 && (r.y -= h), r.relative = !0), r;
464
- });
465
- }, l.NORMALIZE_HVZ = function(r, o, h) {
466
- return r === void 0 && (r = !0), o === void 0 && (o = !0), h === void 0 && (h = !0), i(function(u, f, g, c, d) {
467
- if (isNaN(c) && !(u.type & m.MOVE_TO)) throw new Error("path must start with moveto");
468
- return o && u.type & m.HORIZ_LINE_TO && (u.type = m.LINE_TO, u.y = u.relative ? 0 : g), h && u.type & m.VERT_LINE_TO && (u.type = m.LINE_TO, u.x = u.relative ? 0 : f), r && u.type & m.CLOSE_PATH && (u.type = m.LINE_TO, u.x = u.relative ? c - f : c, u.y = u.relative ? d - g : d), u.type & m.ARC && (u.rX === 0 || u.rY === 0) && (u.type = m.LINE_TO, delete u.rX, delete u.rY, delete u.xRot, delete u.lArcFlag, delete u.sweepFlag), u;
469
- });
470
- }, l.NORMALIZE_ST = e, l.QT_TO_C = s, l.INFO = i, l.SANITIZE = function(r) {
471
- r === void 0 && (r = 0), K(r);
472
- var o = NaN, h = NaN, u = NaN, f = NaN;
473
- return i(function(g, c, d, p, y) {
474
- var x = Math.abs, S = !1, b = 0, v = 0;
475
- if (g.type & m.SMOOTH_CURVE_TO && (b = isNaN(o) ? 0 : c - o, v = isNaN(h) ? 0 : d - h), g.type & (m.CURVE_TO | m.SMOOTH_CURVE_TO) ? (o = g.relative ? c + g.x2 : g.x2, h = g.relative ? d + g.y2 : g.y2) : (o = NaN, h = NaN), g.type & m.SMOOTH_QUAD_TO ? (u = isNaN(u) ? c : 2 * c - u, f = isNaN(f) ? d : 2 * d - f) : g.type & m.QUAD_TO ? (u = g.relative ? c + g.x1 : g.x1, f = g.relative ? d + g.y1 : g.y2) : (u = NaN, f = NaN), g.type & m.LINE_COMMANDS || g.type & m.ARC && (g.rX === 0 || g.rY === 0 || !g.lArcFlag) || g.type & m.CURVE_TO || g.type & m.SMOOTH_CURVE_TO || g.type & m.QUAD_TO || g.type & m.SMOOTH_QUAD_TO) {
476
- var E = g.x === void 0 ? 0 : g.relative ? g.x : g.x - c, C = g.y === void 0 ? 0 : g.relative ? g.y : g.y - d;
477
- b = isNaN(u) ? g.x1 === void 0 ? b : g.relative ? g.x : g.x1 - c : u - c, v = isNaN(f) ? g.y1 === void 0 ? v : g.relative ? g.y : g.y1 - d : f - d;
478
- var T = g.x2 === void 0 ? 0 : g.relative ? g.x : g.x2 - c, N = g.y2 === void 0 ? 0 : g.relative ? g.y : g.y2 - d;
479
- x(E) <= r && x(C) <= r && x(b) <= r && x(v) <= r && x(T) <= r && x(N) <= r && (S = !0);
480
- }
481
- return g.type & m.CLOSE_PATH && x(c - p) <= r && x(d - y) <= r && (S = !0), S ? [] : g;
482
- });
483
- }, l.MATRIX = n, l.ROTATE = function(r, o, h) {
484
- o === void 0 && (o = 0), h === void 0 && (h = 0), K(r, o, h);
485
- var u = Math.sin(r), f = Math.cos(r);
486
- return n(f, u, -u, f, o - o * f + h * u, h - o * u - h * f);
487
- }, l.TRANSLATE = function(r, o) {
488
- return o === void 0 && (o = 0), K(r, o), n(1, 0, 0, 1, r, o);
489
- }, l.SCALE = function(r, o) {
490
- return o === void 0 && (o = r), K(r, o), n(r, 0, 0, o, 0, 0);
491
- }, l.SKEW_X = function(r) {
492
- return K(r), n(1, 0, Math.atan(r), 1, 0, 0);
493
- }, l.SKEW_Y = function(r) {
494
- return K(r), n(1, Math.atan(r), 0, 1, 0, 0);
495
- }, l.X_AXIS_SYMMETRY = function(r) {
496
- return r === void 0 && (r = 0), K(r), n(-1, 0, 0, 1, r, 0);
497
- }, l.Y_AXIS_SYMMETRY = function(r) {
498
- return r === void 0 && (r = 0), K(r), n(1, 0, 0, -1, 0, r);
499
- }, l.A_TO_C = function() {
500
- return i(function(r, o, h) {
501
- return m.ARC === r.type ? function(u, f, g) {
502
- var c, d, p, y;
503
- u.cX || Jt(u, f, g);
504
- for (var x = Math.min(u.phi1, u.phi2), S = Math.max(u.phi1, u.phi2) - x, b = Math.ceil(S / 90), v = new Array(b), E = f, C = g, T = 0; T < b; T++) {
505
- var N = Ae(u.phi1, u.phi2, T / b), R = Ae(u.phi1, u.phi2, (T + 1) / b), F = R - N, z = 4 / 3 * Math.tan(F * et / 4), _ = [Math.cos(N * et) - z * Math.sin(N * et), Math.sin(N * et) + z * Math.cos(N * et)], X = _[0], B = _[1], L = [Math.cos(R * et), Math.sin(R * et)], H = L[0], U = L[1], G = [H + z * Math.sin(R * et), U - z * Math.cos(R * et)], k = G[0], O = G[1];
506
- v[T] = { relative: u.relative, type: m.CURVE_TO };
507
- var Y = function(Z, tt) {
508
- var nt = ie([Z * u.rX, tt * u.rY], u.xRot), yt = nt[0], wt = nt[1];
509
- return [u.cX + yt, u.cY + wt];
510
- };
511
- c = Y(X, B), v[T].x1 = c[0], v[T].y1 = c[1], d = Y(k, O), v[T].x2 = d[0], v[T].y2 = d[1], p = Y(H, U), v[T].x = p[0], v[T].y = p[1], u.relative && (v[T].x1 -= E, v[T].y1 -= C, v[T].x2 -= E, v[T].y2 -= C, v[T].x -= E, v[T].y -= C), E = (y = [v[T].x, v[T].y])[0], C = y[1];
512
- }
513
- return v;
514
- }(r, r.relative ? 0 : o, r.relative ? 0 : h) : r;
515
- });
516
- }, l.ANNOTATE_ARCS = function() {
517
- return i(function(r, o, h) {
518
- return r.relative && (o = 0, h = 0), m.ARC === r.type && Jt(r, o, h), r;
519
- });
520
- }, l.CLONE = a, l.CALCULATE_BOUNDS = function() {
521
- var r = function(g) {
522
- var c = {};
523
- for (var d in g) c[d] = g[d];
524
- return c;
525
- }, o = t(), h = s(), u = e(), f = i(function(g, c, d) {
526
- var p = u(h(o(r(g))));
527
- function y(O) {
528
- O > f.maxX && (f.maxX = O), O < f.minX && (f.minX = O);
529
- }
530
- function x(O) {
531
- O > f.maxY && (f.maxY = O), O < f.minY && (f.minY = O);
532
- }
533
- if (p.type & m.DRAWING_COMMANDS && (y(c), x(d)), p.type & m.HORIZ_LINE_TO && y(p.x), p.type & m.VERT_LINE_TO && x(p.y), p.type & m.LINE_TO && (y(p.x), x(p.y)), p.type & m.CURVE_TO) {
534
- y(p.x), x(p.y);
535
- for (var S = 0, b = Te(c, p.x1, p.x2, p.x); S < b.length; S++)
536
- 0 < (k = b[S]) && 1 > k && y(we(c, p.x1, p.x2, p.x, k));
537
- for (var v = 0, E = Te(d, p.y1, p.y2, p.y); v < E.length; v++)
538
- 0 < (k = E[v]) && 1 > k && x(we(d, p.y1, p.y2, p.y, k));
539
- }
540
- if (p.type & m.ARC) {
541
- y(p.x), x(p.y), Jt(p, c, d);
542
- for (var C = p.xRot / 180 * Math.PI, T = Math.cos(C) * p.rX, N = Math.sin(C) * p.rX, R = -Math.sin(C) * p.rY, F = Math.cos(C) * p.rY, z = p.phi1 < p.phi2 ? [p.phi1, p.phi2] : -180 > p.phi2 ? [p.phi2 + 360, p.phi1 + 360] : [p.phi2, p.phi1], _ = z[0], X = z[1], B = function(O) {
543
- var Y = O[0], Z = O[1], tt = 180 * Math.atan2(Z, Y) / Math.PI;
544
- return tt < _ ? tt + 360 : tt;
545
- }, L = 0, H = ve(R, -T, 0).map(B); L < H.length; L++)
546
- (k = H[L]) > _ && k < X && y(Se(p.cX, T, R, k));
547
- for (var U = 0, G = ve(F, -N, 0).map(B); U < G.length; U++) {
548
- var k;
549
- (k = G[U]) > _ && k < X && x(Se(p.cY, N, F, k));
550
- }
551
- }
552
- return g;
553
- });
554
- return f.minX = 1 / 0, f.maxX = -1 / 0, f.minY = 1 / 0, f.maxY = -1 / 0, f;
555
- };
556
- })(D || (D = {}));
557
- var j, Ue = function() {
558
- function l() {
559
- }
560
- return l.prototype.round = function(t) {
561
- return this.transform(D.ROUND(t));
562
- }, l.prototype.toAbs = function() {
563
- return this.transform(D.TO_ABS());
564
- }, l.prototype.toRel = function() {
565
- return this.transform(D.TO_REL());
566
- }, l.prototype.normalizeHVZ = function(t, e, s) {
567
- return this.transform(D.NORMALIZE_HVZ(t, e, s));
568
- }, l.prototype.normalizeST = function() {
569
- return this.transform(D.NORMALIZE_ST());
570
- }, l.prototype.qtToC = function() {
571
- return this.transform(D.QT_TO_C());
572
- }, l.prototype.aToC = function() {
573
- return this.transform(D.A_TO_C());
574
- }, l.prototype.sanitize = function(t) {
575
- return this.transform(D.SANITIZE(t));
576
- }, l.prototype.translate = function(t, e) {
577
- return this.transform(D.TRANSLATE(t, e));
578
- }, l.prototype.scale = function(t, e) {
579
- return this.transform(D.SCALE(t, e));
580
- }, l.prototype.rotate = function(t, e, s) {
581
- return this.transform(D.ROTATE(t, e, s));
582
- }, l.prototype.matrix = function(t, e, s, i, n, a) {
583
- return this.transform(D.MATRIX(t, e, s, i, n, a));
584
- }, l.prototype.skewX = function(t) {
585
- return this.transform(D.SKEW_X(t));
586
- }, l.prototype.skewY = function(t) {
587
- return this.transform(D.SKEW_Y(t));
588
- }, l.prototype.xSymmetry = function(t) {
589
- return this.transform(D.X_AXIS_SYMMETRY(t));
590
- }, l.prototype.ySymmetry = function(t) {
591
- return this.transform(D.Y_AXIS_SYMMETRY(t));
592
- }, l.prototype.annotateArcs = function() {
593
- return this.transform(D.ANNOTATE_ARCS());
594
- }, l;
595
- }(), hs = function(l) {
596
- return l === " " || l === " " || l === "\r" || l === `
597
- `;
598
- }, Ce = function(l) {
599
- return 48 <= l.charCodeAt(0) && l.charCodeAt(0) <= 57;
600
- }, ls = function(l) {
601
- function t() {
602
- var e = l.call(this) || this;
603
- return e.curNumber = "", e.curCommandType = -1, e.curCommandRelative = !1, e.canParseCommandOrComma = !0, e.curNumberHasExp = !1, e.curNumberHasExpDigits = !1, e.curNumberHasDecimal = !1, e.curArgs = [], e;
604
- }
605
- return ze(t, l), t.prototype.finish = function(e) {
606
- if (e === void 0 && (e = []), this.parse(" ", e), this.curArgs.length !== 0 || !this.canParseCommandOrComma) throw new SyntaxError("Unterminated command at the path end.");
607
- return e;
608
- }, t.prototype.parse = function(e, s) {
609
- var i = this;
610
- s === void 0 && (s = []);
611
- for (var n = function(f) {
612
- s.push(f), i.curArgs.length = 0, i.canParseCommandOrComma = !0;
613
- }, a = 0; a < e.length; a++) {
614
- var r = e[a], o = !(this.curCommandType !== m.ARC || this.curArgs.length !== 3 && this.curArgs.length !== 4 || this.curNumber.length !== 1 || this.curNumber !== "0" && this.curNumber !== "1"), h = Ce(r) && (this.curNumber === "0" && r === "0" || o);
615
- if (!Ce(r) || h) if (r !== "e" && r !== "E") if (r !== "-" && r !== "+" || !this.curNumberHasExp || this.curNumberHasExpDigits) if (r !== "." || this.curNumberHasExp || this.curNumberHasDecimal || o) {
616
- if (this.curNumber && this.curCommandType !== -1) {
617
- var u = Number(this.curNumber);
618
- if (isNaN(u)) throw new SyntaxError("Invalid number ending at " + a);
619
- if (this.curCommandType === m.ARC) {
620
- if (this.curArgs.length === 0 || this.curArgs.length === 1) {
621
- if (0 > u) throw new SyntaxError('Expected positive number, got "' + u + '" at index "' + a + '"');
622
- } else if ((this.curArgs.length === 3 || this.curArgs.length === 4) && this.curNumber !== "0" && this.curNumber !== "1") throw new SyntaxError('Expected a flag, got "' + this.curNumber + '" at index "' + a + '"');
623
- }
624
- this.curArgs.push(u), this.curArgs.length === us[this.curCommandType] && (m.HORIZ_LINE_TO === this.curCommandType ? n({ type: m.HORIZ_LINE_TO, relative: this.curCommandRelative, x: u }) : m.VERT_LINE_TO === this.curCommandType ? n({ type: m.VERT_LINE_TO, relative: this.curCommandRelative, y: u }) : this.curCommandType === m.MOVE_TO || this.curCommandType === m.LINE_TO || this.curCommandType === m.SMOOTH_QUAD_TO ? (n({ type: this.curCommandType, relative: this.curCommandRelative, x: this.curArgs[0], y: this.curArgs[1] }), m.MOVE_TO === this.curCommandType && (this.curCommandType = m.LINE_TO)) : this.curCommandType === m.CURVE_TO ? n({ type: m.CURVE_TO, relative: this.curCommandRelative, x1: this.curArgs[0], y1: this.curArgs[1], x2: this.curArgs[2], y2: this.curArgs[3], x: this.curArgs[4], y: this.curArgs[5] }) : this.curCommandType === m.SMOOTH_CURVE_TO ? n({ type: m.SMOOTH_CURVE_TO, relative: this.curCommandRelative, x2: this.curArgs[0], y2: this.curArgs[1], x: this.curArgs[2], y: this.curArgs[3] }) : this.curCommandType === m.QUAD_TO ? n({ type: m.QUAD_TO, relative: this.curCommandRelative, x1: this.curArgs[0], y1: this.curArgs[1], x: this.curArgs[2], y: this.curArgs[3] }) : this.curCommandType === m.ARC && n({ type: m.ARC, relative: this.curCommandRelative, rX: this.curArgs[0], rY: this.curArgs[1], xRot: this.curArgs[2], lArcFlag: this.curArgs[3], sweepFlag: this.curArgs[4], x: this.curArgs[5], y: this.curArgs[6] })), this.curNumber = "", this.curNumberHasExpDigits = !1, this.curNumberHasExp = !1, this.curNumberHasDecimal = !1, this.canParseCommandOrComma = !0;
625
- }
626
- if (!hs(r)) if (r === "," && this.canParseCommandOrComma) this.canParseCommandOrComma = !1;
627
- else if (r !== "+" && r !== "-" && r !== ".") if (h) this.curNumber = r, this.curNumberHasDecimal = !1;
628
- else {
629
- if (this.curArgs.length !== 0) throw new SyntaxError("Unterminated command at index " + a + ".");
630
- if (!this.canParseCommandOrComma) throw new SyntaxError('Unexpected character "' + r + '" at index ' + a + ". Command cannot follow comma");
631
- if (this.canParseCommandOrComma = !1, r !== "z" && r !== "Z") if (r === "h" || r === "H") this.curCommandType = m.HORIZ_LINE_TO, this.curCommandRelative = r === "h";
632
- else if (r === "v" || r === "V") this.curCommandType = m.VERT_LINE_TO, this.curCommandRelative = r === "v";
633
- else if (r === "m" || r === "M") this.curCommandType = m.MOVE_TO, this.curCommandRelative = r === "m";
634
- else if (r === "l" || r === "L") this.curCommandType = m.LINE_TO, this.curCommandRelative = r === "l";
635
- else if (r === "c" || r === "C") this.curCommandType = m.CURVE_TO, this.curCommandRelative = r === "c";
636
- else if (r === "s" || r === "S") this.curCommandType = m.SMOOTH_CURVE_TO, this.curCommandRelative = r === "s";
637
- else if (r === "q" || r === "Q") this.curCommandType = m.QUAD_TO, this.curCommandRelative = r === "q";
638
- else if (r === "t" || r === "T") this.curCommandType = m.SMOOTH_QUAD_TO, this.curCommandRelative = r === "t";
639
- else {
640
- if (r !== "a" && r !== "A") throw new SyntaxError('Unexpected character "' + r + '" at index ' + a + ".");
641
- this.curCommandType = m.ARC, this.curCommandRelative = r === "a";
642
- }
643
- else s.push({ type: m.CLOSE_PATH }), this.canParseCommandOrComma = !0, this.curCommandType = -1;
644
- }
645
- else this.curNumber = r, this.curNumberHasDecimal = r === ".";
646
- } else this.curNumber += r, this.curNumberHasDecimal = !0;
647
- else this.curNumber += r;
648
- else this.curNumber += r, this.curNumberHasExp = !0;
649
- else this.curNumber += r, this.curNumberHasExpDigits = this.curNumberHasExp;
650
- }
651
- return s;
652
- }, t.prototype.transform = function(e) {
653
- return Object.create(this, { parse: { value: function(s, i) {
654
- i === void 0 && (i = []);
655
- for (var n = 0, a = Object.getPrototypeOf(this).parse.call(this, s); n < a.length; n++) {
656
- var r = a[n], o = e(r);
657
- Array.isArray(o) ? i.push.apply(i, o) : i.push(o);
658
- }
659
- return i;
660
- } } });
661
- }, t;
662
- }(Ue), m = function(l) {
663
- function t(e) {
664
- var s = l.call(this) || this;
665
- return s.commands = typeof e == "string" ? t.parse(e) : e, s;
666
- }
667
- return ze(t, l), t.prototype.encode = function() {
668
- return t.encode(this.commands);
669
- }, t.prototype.getBounds = function() {
670
- var e = D.CALCULATE_BOUNDS();
671
- return this.transform(e), e;
672
- }, t.prototype.transform = function(e) {
673
- for (var s = [], i = 0, n = this.commands; i < n.length; i++) {
674
- var a = e(n[i]);
675
- Array.isArray(a) ? s.push.apply(s, a) : s.push(a);
676
- }
677
- return this.commands = s, this;
678
- }, t.encode = function(e) {
679
- return os(e);
680
- }, t.parse = function(e) {
681
- var s = new ls(), i = [];
682
- return s.parse(e, i), s.finish(i), i;
683
- }, t.CLOSE_PATH = 1, t.MOVE_TO = 2, t.HORIZ_LINE_TO = 4, t.VERT_LINE_TO = 8, t.LINE_TO = 16, t.CURVE_TO = 32, t.SMOOTH_CURVE_TO = 64, t.QUAD_TO = 128, t.SMOOTH_QUAD_TO = 256, t.ARC = 512, t.LINE_COMMANDS = t.LINE_TO | t.HORIZ_LINE_TO | t.VERT_LINE_TO, t.DRAWING_COMMANDS = t.HORIZ_LINE_TO | t.VERT_LINE_TO | t.LINE_TO | t.CURVE_TO | t.SMOOTH_CURVE_TO | t.QUAD_TO | t.SMOOTH_QUAD_TO | t.ARC, t;
684
- }(Ue), us = ((j = {})[m.MOVE_TO] = 2, j[m.LINE_TO] = 2, j[m.HORIZ_LINE_TO] = 1, j[m.VERT_LINE_TO] = 1, j[m.CLOSE_PATH] = 0, j[m.QUAD_TO] = 4, j[m.SMOOTH_QUAD_TO] = 2, j[m.CURVE_TO] = 6, j[m.SMOOTH_CURVE_TO] = 4, j[m.ARC] = 7, j);
685
- function It(l) {
686
- "@babel/helpers - typeof";
687
- return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? It = function(t) {
688
- return typeof t;
689
- } : It = function(t) {
690
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
691
- }, It(l);
692
- }
693
- function cs(l, t) {
694
- if (!(l instanceof t))
695
- throw new TypeError("Cannot call a class as a function");
696
- }
697
- var fs = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259], gs = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24];
698
- function ds(l, t, e, s, i) {
699
- if (typeof l == "string" && (l = document.getElementById(l)), !l || It(l) !== "object" || !("getContext" in l))
700
- throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");
701
- var n = l.getContext("2d");
702
- try {
703
- return n.getImageData(t, e, s, i);
704
- } catch (a) {
705
- throw new Error("unable to access image data: " + a);
706
- }
707
- }
708
- function ps(l, t, e, s, i, n) {
709
- if (!(isNaN(n) || n < 1)) {
710
- n |= 0;
711
- var a = ds(l, t, e, s, i);
712
- a = ys(a, t, e, s, i, n), l.getContext("2d").putImageData(a, t, e);
713
- }
714
- }
715
- function ys(l, t, e, s, i, n) {
716
- for (var a = l.data, r = 2 * n + 1, o = s - 1, h = i - 1, u = n + 1, f = u * (u + 1) / 2, g = new Ee(), c = g, d, p = 1; p < r; p++)
717
- c = c.next = new Ee(), p === u && (d = c);
718
- c.next = g;
719
- for (var y = null, x = null, S = 0, b = 0, v = fs[n], E = gs[n], C = 0; C < i; C++) {
720
- c = g;
721
- for (var T = a[b], N = a[b + 1], R = a[b + 2], F = a[b + 3], z = 0; z < u; z++)
722
- c.r = T, c.g = N, c.b = R, c.a = F, c = c.next;
723
- for (var _ = 0, X = 0, B = 0, L = 0, H = u * T, U = u * N, G = u * R, k = u * F, O = f * T, Y = f * N, Z = f * R, tt = f * F, nt = 1; nt < u; nt++) {
724
- var yt = b + ((o < nt ? o : nt) << 2), wt = a[yt], he = a[yt + 1], le = a[yt + 2], ue = a[yt + 3], Ct = u - nt;
725
- O += (c.r = wt) * Ct, Y += (c.g = he) * Ct, Z += (c.b = le) * Ct, tt += (c.a = ue) * Ct, _ += wt, X += he, B += le, L += ue, c = c.next;
726
- }
727
- y = g, x = d;
728
- for (var Ft = 0; Ft < s; Ft++) {
729
- var zt = tt * v >>> E;
730
- if (a[b + 3] = zt, zt !== 0) {
731
- var Ut = 255 / zt;
732
- a[b] = (O * v >>> E) * Ut, a[b + 1] = (Y * v >>> E) * Ut, a[b + 2] = (Z * v >>> E) * Ut;
733
- } else
734
- a[b] = a[b + 1] = a[b + 2] = 0;
735
- O -= H, Y -= U, Z -= G, tt -= k, H -= y.r, U -= y.g, G -= y.b, k -= y.a;
736
- var ht = Ft + n + 1;
737
- ht = S + (ht < o ? ht : o) << 2, _ += y.r = a[ht], X += y.g = a[ht + 1], B += y.b = a[ht + 2], L += y.a = a[ht + 3], O += _, Y += X, Z += B, tt += L, y = y.next;
738
- var Et = x, ce = Et.r, fe = Et.g, ge = Et.b, de = Et.a;
739
- H += ce, U += fe, G += ge, k += de, _ -= ce, X -= fe, B -= ge, L -= de, x = x.next, b += 4;
740
- }
741
- S += s;
742
- }
743
- for (var mt = 0; mt < s; mt++) {
744
- b = mt << 2;
745
- var lt = a[b], ut = a[b + 1], ct = a[b + 2], q = a[b + 3], Xt = u * lt, Ht = u * ut, Yt = u * ct, Wt = u * q, Pt = f * lt, Mt = f * ut, Nt = f * ct, Ot = f * q;
746
- c = g;
747
- for (var pe = 0; pe < u; pe++)
748
- c.r = lt, c.g = ut, c.b = ct, c.a = q, c = c.next;
749
- for (var ye = s, qt = 0, Qt = 0, Gt = 0, $t = 0, Vt = 1; Vt <= n; Vt++) {
750
- b = ye + mt << 2;
751
- var kt = u - Vt;
752
- Pt += (c.r = lt = a[b]) * kt, Mt += (c.g = ut = a[b + 1]) * kt, Nt += (c.b = ct = a[b + 2]) * kt, Ot += (c.a = q = a[b + 3]) * kt, $t += lt, qt += ut, Qt += ct, Gt += q, c = c.next, Vt < h && (ye += s);
753
- }
754
- b = mt, y = g, x = d;
755
- for (var Zt = 0; Zt < i; Zt++) {
756
- var Q = b << 2;
757
- a[Q + 3] = q = Ot * v >>> E, q > 0 ? (q = 255 / q, a[Q] = (Pt * v >>> E) * q, a[Q + 1] = (Mt * v >>> E) * q, a[Q + 2] = (Nt * v >>> E) * q) : a[Q] = a[Q + 1] = a[Q + 2] = 0, Pt -= Xt, Mt -= Ht, Nt -= Yt, Ot -= Wt, Xt -= y.r, Ht -= y.g, Yt -= y.b, Wt -= y.a, Q = mt + ((Q = Zt + u) < h ? Q : h) * s << 2, Pt += $t += y.r = a[Q], Mt += qt += y.g = a[Q + 1], Nt += Qt += y.b = a[Q + 2], Ot += Gt += y.a = a[Q + 3], y = y.next, Xt += lt = x.r, Ht += ut = x.g, Yt += ct = x.b, Wt += q = x.a, $t -= lt, qt -= ut, Qt -= ct, Gt -= q, x = x.next, b += s;
758
- }
759
- }
760
- return l;
761
- }
762
- var Ee = (
763
- /**
764
- * Set properties.
765
- */
766
- function l() {
767
- cs(this, l), this.r = 0, this.g = 0, this.b = 0, this.a = 0, this.next = null;
768
- }
769
- );
770
- function ms() {
771
- let { DOMParser: l } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
772
- const t = {
773
- window: null,
774
- ignoreAnimation: !0,
775
- ignoreMouse: !0,
776
- DOMParser: l,
777
- createCanvas(e, s) {
778
- return new OffscreenCanvas(e, s);
779
- },
780
- async createImage(e) {
781
- const i = await (await fetch(e)).blob();
782
- return await createImageBitmap(i);
783
- }
784
- };
785
- return (typeof globalThis.DOMParser < "u" || typeof l > "u") && Reflect.deleteProperty(t, "DOMParser"), t;
786
- }
787
- function xs(l) {
788
- let { DOMParser: t, canvas: e, fetch: s } = l;
789
- return {
790
- window: null,
791
- ignoreAnimation: !0,
792
- ignoreMouse: !0,
793
- DOMParser: t,
794
- fetch: s,
795
- createCanvas: e.createCanvas,
796
- createImage: e.loadImage
797
- };
798
- }
799
- var Ei = /* @__PURE__ */ Object.freeze({
800
- __proto__: null,
801
- offscreen: ms,
802
- node: xs
803
- });
804
- function bt(l) {
805
- return l.replace(/(?!\u3000)\s+/gm, " ");
806
- }
807
- function bs(l) {
808
- return l.replace(/^[\n \t]+/, "");
809
- }
810
- function vs(l) {
811
- return l.replace(/[\n \t]+$/, "");
812
- }
813
- function $(l) {
814
- const t = l.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);
815
- return t ? t.map(parseFloat) : [];
816
- }
817
- function As(l) {
818
- const t = $(l);
819
- return [
820
- t[0] || 0,
821
- t[1] || 0,
822
- t[2] || 0,
823
- t[3] || 0,
824
- t[4] || 0,
825
- t[5] || 0
826
- ];
827
- }
828
- const Ss = /^[A-Z-]+$/;
829
- function Ts(l) {
830
- return Ss.test(l) ? l.toLowerCase() : l;
831
- }
832
- function Xe(l) {
833
- const t = /url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(l);
834
- return t && (t[2] || t[3] || t[4]) || "";
835
- }
836
- function ws(l) {
837
- if (!l.startsWith("rgb"))
838
- return l;
839
- let t = 3;
840
- return l.replace(
841
- /\d+(\.\d+)?/g,
842
- (s, i) => t-- && i ? String(Math.round(parseFloat(s))) : s
843
- );
844
- }
845
- const Cs = /(\[[^\]]+\])/g, Es = /(#[^\s+>~.[:]+)/g, Ps = /(\.[^\s+>~.[:]+)/g, Ms = /(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi, Ns = /(:[\w-]+\([^)]*\))/gi, Os = /(:[^\s+>~.[:]+)/g, Vs = /([^\s+>~.[:]+)/g;
846
- function ft(l, t) {
847
- const e = t.exec(l);
848
- return e ? [
849
- l.replace(t, " "),
850
- e.length
851
- ] : [
852
- l,
853
- 0
854
- ];
855
- }
856
- function ks(l) {
857
- const t = [
858
- 0,
859
- 0,
860
- 0
861
- ];
862
- let e = l.replace(/:not\(([^)]*)\)/g, " $1 ").replace(/{[\s\S]*/gm, " "), s = 0;
863
- return [e, s] = ft(e, Cs), t[1] += s, [e, s] = ft(e, Es), t[0] += s, [e, s] = ft(e, Ps), t[1] += s, [e, s] = ft(e, Ms), t[2] += s, [e, s] = ft(e, Ns), t[1] += s, [e, s] = ft(e, Os), t[1] += s, e = e.replace(/[*\s+>~]/g, " ").replace(/[#.]/g, " "), [e, s] = ft(e, Vs), t[2] += s, t.join("");
864
- }
865
- const xt = 1e-8;
866
- function Pe(l) {
867
- return Math.sqrt(Math.pow(l[0], 2) + Math.pow(l[1], 2));
868
- }
869
- function ne(l, t) {
870
- return (l[0] * t[0] + l[1] * t[1]) / (Pe(l) * Pe(t));
871
- }
872
- function Me(l, t) {
873
- return (l[0] * t[1] < l[1] * t[0] ? -1 : 1) * Math.acos(ne(l, t));
874
- }
875
- function Ne(l) {
876
- return l * l * l;
877
- }
878
- function Oe(l) {
879
- return 3 * l * l * (1 - l);
880
- }
881
- function Ve(l) {
882
- return 3 * l * (1 - l) * (1 - l);
883
- }
884
- function ke(l) {
885
- return (1 - l) * (1 - l) * (1 - l);
886
- }
887
- function Re(l) {
888
- return l * l;
889
- }
890
- function Le(l) {
891
- return 2 * l * (1 - l);
892
- }
893
- function Ie(l) {
894
- return (1 - l) * (1 - l);
895
- }
896
- class A {
897
- static empty(t) {
898
- return new A(t, "EMPTY", "");
899
- }
900
- split() {
901
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : " ";
902
- const { document: e, name: s } = this;
903
- return bt(this.getString()).trim().split(t).map(
904
- (i) => new A(e, s, i)
905
- );
906
- }
907
- hasValue(t) {
908
- const e = this.value;
909
- return e !== null && e !== "" && (t || e !== 0) && typeof e < "u";
910
- }
911
- isString(t) {
912
- const { value: e } = this, s = typeof e == "string";
913
- return !s || !t ? s : t.test(e);
914
- }
915
- isUrlDefinition() {
916
- return this.isString(/^url\(/);
917
- }
918
- isPixels() {
919
- if (!this.hasValue())
920
- return !1;
921
- const t = this.getString();
922
- switch (!0) {
923
- case t.endsWith("px"):
924
- case /^[0-9]+$/.test(t):
925
- return !0;
926
- default:
927
- return !1;
928
- }
929
- }
930
- setValue(t) {
931
- return this.value = t, this;
932
- }
933
- getValue(t) {
934
- return typeof t > "u" || this.hasValue() ? this.value : t;
935
- }
936
- getNumber(t) {
937
- if (!this.hasValue())
938
- return typeof t > "u" ? 0 : parseFloat(t);
939
- const { value: e } = this;
940
- let s = parseFloat(e);
941
- return this.isString(/%$/) && (s /= 100), s;
942
- }
943
- getString(t) {
944
- return typeof t > "u" || this.hasValue() ? typeof this.value > "u" ? "" : String(this.value) : String(t);
945
- }
946
- getColor(t) {
947
- let e = this.getString(t);
948
- return this.isNormalizedColor || (this.isNormalizedColor = !0, e = ws(e), this.value = e), e;
949
- }
950
- getDpi() {
951
- return 96;
952
- }
953
- getRem() {
954
- return this.document.rootEmSize;
955
- }
956
- getEm() {
957
- return this.document.emSize;
958
- }
959
- getUnits() {
960
- return this.getString().replace(/[0-9.-]/g, "");
961
- }
962
- getPixels(t) {
963
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
964
- if (!this.hasValue())
965
- return 0;
966
- const [s, i] = typeof t == "boolean" ? [
967
- void 0,
968
- t
969
- ] : [
970
- t
971
- ], { viewPort: n } = this.document.screen;
972
- switch (!0) {
973
- case this.isString(/vmin$/):
974
- return this.getNumber() / 100 * Math.min(n.computeSize("x"), n.computeSize("y"));
975
- case this.isString(/vmax$/):
976
- return this.getNumber() / 100 * Math.max(n.computeSize("x"), n.computeSize("y"));
977
- case this.isString(/vw$/):
978
- return this.getNumber() / 100 * n.computeSize("x");
979
- case this.isString(/vh$/):
980
- return this.getNumber() / 100 * n.computeSize("y");
981
- case this.isString(/rem$/):
982
- return this.getNumber() * this.getRem();
983
- case this.isString(/em$/):
984
- return this.getNumber() * this.getEm();
985
- case this.isString(/ex$/):
986
- return this.getNumber() * this.getEm() / 2;
987
- case this.isString(/px$/):
988
- return this.getNumber();
989
- case this.isString(/pt$/):
990
- return this.getNumber() * this.getDpi() * (1 / 72);
991
- case this.isString(/pc$/):
992
- return this.getNumber() * 15;
993
- case this.isString(/cm$/):
994
- return this.getNumber() * this.getDpi() / 2.54;
995
- case this.isString(/mm$/):
996
- return this.getNumber() * this.getDpi() / 25.4;
997
- case this.isString(/in$/):
998
- return this.getNumber() * this.getDpi();
999
- case (this.isString(/%$/) && i):
1000
- return this.getNumber() * this.getEm();
1001
- case this.isString(/%$/):
1002
- return this.getNumber() * n.computeSize(s);
1003
- default: {
1004
- const a = this.getNumber();
1005
- return e && a < 1 ? a * n.computeSize(s) : a;
1006
- }
1007
- }
1008
- }
1009
- getMilliseconds() {
1010
- return this.hasValue() ? this.isString(/ms$/) ? this.getNumber() : this.getNumber() * 1e3 : 0;
1011
- }
1012
- getRadians() {
1013
- if (!this.hasValue())
1014
- return 0;
1015
- switch (!0) {
1016
- case this.isString(/deg$/):
1017
- return this.getNumber() * (Math.PI / 180);
1018
- case this.isString(/grad$/):
1019
- return this.getNumber() * (Math.PI / 200);
1020
- case this.isString(/rad$/):
1021
- return this.getNumber();
1022
- default:
1023
- return this.getNumber() * (Math.PI / 180);
1024
- }
1025
- }
1026
- getDefinition() {
1027
- const t = this.getString(), e = /#([^)'"]+)/.exec(t), s = (e == null ? void 0 : e[1]) || t;
1028
- return this.document.definitions.get(s);
1029
- }
1030
- getFillStyleDefinition(t, e) {
1031
- let s = this.getDefinition();
1032
- if (!s)
1033
- return null;
1034
- if (typeof s.createGradient == "function" && "getBoundingBox" in t)
1035
- return s.createGradient(this.document.ctx, t, e);
1036
- if (typeof s.createPattern == "function") {
1037
- if (s.getHrefAttribute().hasValue()) {
1038
- const i = s.getAttribute("patternTransform");
1039
- s = s.getHrefAttribute().getDefinition(), s && i.hasValue() && s.getAttribute("patternTransform", !0).setValue(i.value);
1040
- }
1041
- if (s)
1042
- return s.createPattern(this.document.ctx, t, e);
1043
- }
1044
- return null;
1045
- }
1046
- getTextBaseline() {
1047
- if (!this.hasValue())
1048
- return null;
1049
- const t = this.getString();
1050
- return A.textBaselineMapping[t] || null;
1051
- }
1052
- addOpacity(t) {
1053
- let e = this.getColor();
1054
- const s = e.length;
1055
- let i = 0;
1056
- for (let n = 0; n < s && (e[n] === "," && i++, i !== 3); n++)
1057
- ;
1058
- if (t.hasValue() && this.isString() && i !== 3) {
1059
- const n = new se(e);
1060
- n.ok && (n.alpha = t.getNumber(), e = n.toRGBA());
1061
- }
1062
- return new A(this.document, this.name, e);
1063
- }
1064
- constructor(t, e, s) {
1065
- this.document = t, this.name = e, this.value = s, this.isNormalizedColor = !1;
1066
- }
1067
- }
1068
- A.textBaselineMapping = {
1069
- baseline: "alphabetic",
1070
- "before-edge": "top",
1071
- "text-before-edge": "top",
1072
- middle: "middle",
1073
- central: "middle",
1074
- "after-edge": "bottom",
1075
- "text-after-edge": "bottom",
1076
- ideographic: "ideographic",
1077
- alphabetic: "alphabetic",
1078
- hanging: "hanging",
1079
- mathematical: "alphabetic"
1080
- };
1081
- class St {
1082
- clear() {
1083
- this.viewPorts = [];
1084
- }
1085
- setCurrent(t, e) {
1086
- this.viewPorts.push({
1087
- width: t,
1088
- height: e
1089
- });
1090
- }
1091
- removeCurrent() {
1092
- this.viewPorts.pop();
1093
- }
1094
- getRoot() {
1095
- const [t] = this.viewPorts;
1096
- return t || De();
1097
- }
1098
- getCurrent() {
1099
- const { viewPorts: t } = this, e = t[t.length - 1];
1100
- return e || De();
1101
- }
1102
- get width() {
1103
- return this.getCurrent().width;
1104
- }
1105
- get height() {
1106
- return this.getCurrent().height;
1107
- }
1108
- computeSize(t) {
1109
- return typeof t == "number" ? t : t === "x" ? this.width : t === "y" ? this.height : Math.sqrt(Math.pow(this.width, 2) + Math.pow(this.height, 2)) / Math.sqrt(2);
1110
- }
1111
- constructor() {
1112
- this.viewPorts = [];
1113
- }
1114
- }
1115
- St.DEFAULT_VIEWPORT_WIDTH = 800;
1116
- St.DEFAULT_VIEWPORT_HEIGHT = 600;
1117
- function De() {
1118
- return {
1119
- width: St.DEFAULT_VIEWPORT_WIDTH,
1120
- height: St.DEFAULT_VIEWPORT_HEIGHT
1121
- };
1122
- }
1123
- class V {
1124
- static parse(t) {
1125
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
1126
- const [s = e, i = e] = $(t);
1127
- return new V(s, i);
1128
- }
1129
- static parseScale(t) {
1130
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
1131
- const [s = e, i = s] = $(t);
1132
- return new V(s, i);
1133
- }
1134
- static parsePath(t) {
1135
- const e = $(t), s = e.length, i = [];
1136
- for (let n = 0; n < s; n += 2)
1137
- i.push(new V(e[n], e[n + 1]));
1138
- return i;
1139
- }
1140
- angleTo(t) {
1141
- return Math.atan2(t.y - this.y, t.x - this.x);
1142
- }
1143
- applyTransform(t) {
1144
- const { x: e, y: s } = this, i = e * t[0] + s * t[2] + t[4], n = e * t[1] + s * t[3] + t[5];
1145
- this.x = i, this.y = n;
1146
- }
1147
- constructor(t, e) {
1148
- this.x = t, this.y = e;
1149
- }
1150
- }
1151
- class Rs {
1152
- isWorking() {
1153
- return this.working;
1154
- }
1155
- start() {
1156
- if (this.working)
1157
- return;
1158
- const { screen: t, onClick: e, onMouseMove: s } = this, i = t.ctx.canvas;
1159
- i.onclick = e, i.onmousemove = s, this.working = !0;
1160
- }
1161
- stop() {
1162
- if (!this.working)
1163
- return;
1164
- const t = this.screen.ctx.canvas;
1165
- this.working = !1, t.onclick = null, t.onmousemove = null;
1166
- }
1167
- hasEvents() {
1168
- return this.working && this.events.length > 0;
1169
- }
1170
- runEvents() {
1171
- if (!this.working)
1172
- return;
1173
- const { screen: t, events: e, eventElements: s } = this, { style: i } = t.ctx.canvas;
1174
- let n;
1175
- i && (i.cursor = ""), e.forEach((a, r) => {
1176
- let { run: o } = a;
1177
- for (n = s[r]; n; )
1178
- o(n), n = n.parent;
1179
- }), this.events = [], this.eventElements = [];
1180
- }
1181
- checkPath(t, e) {
1182
- if (!this.working || !e)
1183
- return;
1184
- const { events: s, eventElements: i } = this;
1185
- s.forEach((n, a) => {
1186
- let { x: r, y: o } = n;
1187
- !i[a] && e.isPointInPath && e.isPointInPath(r, o) && (i[a] = t);
1188
- });
1189
- }
1190
- checkBoundingBox(t, e) {
1191
- if (!this.working || !e)
1192
- return;
1193
- const { events: s, eventElements: i } = this;
1194
- s.forEach((n, a) => {
1195
- let { x: r, y: o } = n;
1196
- !i[a] && e.isPointInBox(r, o) && (i[a] = t);
1197
- });
1198
- }
1199
- mapXY(t, e) {
1200
- const { window: s, ctx: i } = this.screen, n = new V(t, e);
1201
- let a = i.canvas;
1202
- for (; a; )
1203
- n.x -= a.offsetLeft, n.y -= a.offsetTop, a = a.offsetParent;
1204
- return s != null && s.scrollX && (n.x += s.scrollX), s != null && s.scrollY && (n.y += s.scrollY), n;
1205
- }
1206
- onClick(t) {
1207
- const { x: e, y: s } = this.mapXY(t.clientX, t.clientY);
1208
- this.events.push({
1209
- type: "onclick",
1210
- x: e,
1211
- y: s,
1212
- run(i) {
1213
- i.onClick && i.onClick();
1214
- }
1215
- });
1216
- }
1217
- onMouseMove(t) {
1218
- const { x: e, y: s } = this.mapXY(t.clientX, t.clientY);
1219
- this.events.push({
1220
- type: "onmousemove",
1221
- x: e,
1222
- y: s,
1223
- run(i) {
1224
- i.onMouseMove && i.onMouseMove();
1225
- }
1226
- });
1227
- }
1228
- constructor(t) {
1229
- this.screen = t, this.working = !1, this.events = [], this.eventElements = [], this.onClick = this.onClick.bind(this), this.onMouseMove = this.onMouseMove.bind(this);
1230
- }
1231
- }
1232
- const He = typeof window < "u" ? window : null, Ye = typeof fetch < "u" ? fetch.bind(void 0) : void 0;
1233
- class it {
1234
- wait(t) {
1235
- this.waits.push(t);
1236
- }
1237
- ready() {
1238
- return this.readyPromise ? this.readyPromise : Promise.resolve();
1239
- }
1240
- isReady() {
1241
- if (this.isReadyLock)
1242
- return !0;
1243
- const t = this.waits.every(
1244
- (e) => e()
1245
- );
1246
- return t && (this.waits = [], this.resolveReady && this.resolveReady()), this.isReadyLock = t, t;
1247
- }
1248
- setDefaults(t) {
1249
- t.strokeStyle = "rgba(0,0,0,0)", t.lineCap = "butt", t.lineJoin = "miter", t.miterLimit = 4;
1250
- }
1251
- setViewBox(t) {
1252
- let { document: e, ctx: s, aspectRatio: i, width: n, desiredWidth: a, height: r, desiredHeight: o, minX: h = 0, minY: u = 0, refX: f, refY: g, clip: c = !1, clipX: d = 0, clipY: p = 0 } = t;
1253
- const y = bt(i).replace(/^defer\s/, ""), [x, S] = y.split(" "), b = x || "xMidYMid", v = S || "meet", E = n / a, C = r / o, T = Math.min(E, C), N = Math.max(E, C);
1254
- let R = a, F = o;
1255
- v === "meet" && (R *= T, F *= T), v === "slice" && (R *= N, F *= N);
1256
- const z = new A(e, "refX", f), _ = new A(e, "refY", g), X = z.hasValue() && _.hasValue();
1257
- if (X && s.translate(-T * z.getPixels("x"), -T * _.getPixels("y")), c) {
1258
- const B = T * d, L = T * p;
1259
- s.beginPath(), s.moveTo(B, L), s.lineTo(n, L), s.lineTo(n, r), s.lineTo(B, r), s.closePath(), s.clip();
1260
- }
1261
- if (!X) {
1262
- const B = v === "meet" && T === C, L = v === "slice" && N === C, H = v === "meet" && T === E, U = v === "slice" && N === E;
1263
- b.startsWith("xMid") && (B || L) && s.translate(n / 2 - R / 2, 0), b.endsWith("YMid") && (H || U) && s.translate(0, r / 2 - F / 2), b.startsWith("xMax") && (B || L) && s.translate(n - R, 0), b.endsWith("YMax") && (H || U) && s.translate(0, r - F);
1264
- }
1265
- switch (!0) {
1266
- case b === "none":
1267
- s.scale(E, C);
1268
- break;
1269
- case v === "meet":
1270
- s.scale(T, T);
1271
- break;
1272
- case v === "slice":
1273
- s.scale(N, N);
1274
- break;
1275
- }
1276
- s.translate(-h, -u);
1277
- }
1278
- start(t) {
1279
- let { enableRedraw: e = !1, ignoreMouse: s = !1, ignoreAnimation: i = !1, ignoreDimensions: n = !1, ignoreClear: a = !1, forceRedraw: r, scaleWidth: o, scaleHeight: h, offsetX: u, offsetY: f } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1280
- const { mouse: g } = this, c = 1e3 / it.FRAMERATE;
1281
- if (this.isReadyLock = !1, this.frameDuration = c, this.readyPromise = new Promise((S) => {
1282
- this.resolveReady = S;
1283
- }), this.isReady() && this.render(t, n, a, o, h, u, f), !e)
1284
- return;
1285
- let d = Date.now(), p = d, y = 0;
1286
- const x = () => {
1287
- d = Date.now(), y = d - p, y >= c && (p = d - y % c, this.shouldUpdate(i, r) && (this.render(t, n, a, o, h, u, f), g.runEvents())), this.intervalId = jt(x);
1288
- };
1289
- s || g.start(), this.intervalId = jt(x);
1290
- }
1291
- stop() {
1292
- this.intervalId && (jt.cancel(this.intervalId), this.intervalId = null), this.mouse.stop();
1293
- }
1294
- shouldUpdate(t, e) {
1295
- if (!t) {
1296
- const { frameDuration: s } = this;
1297
- if (this.animations.reduce(
1298
- (n, a) => a.update(s) || n,
1299
- !1
1300
- ))
1301
- return !0;
1302
- }
1303
- return !!(typeof e == "function" && e() || !this.isReadyLock && this.isReady() || this.mouse.hasEvents());
1304
- }
1305
- render(t, e, s, i, n, a, r) {
1306
- const { viewPort: o, ctx: h, isFirstRender: u } = this, f = h.canvas;
1307
- o.clear(), f.width && f.height && o.setCurrent(f.width, f.height);
1308
- const g = t.getStyle("width"), c = t.getStyle("height");
1309
- !e && (u || typeof i != "number" && typeof n != "number") && (g.hasValue() && (f.width = g.getPixels("x"), f.style && (f.style.width = "".concat(f.width, "px"))), c.hasValue() && (f.height = c.getPixels("y"), f.style && (f.style.height = "".concat(f.height, "px"))));
1310
- let d = f.clientWidth || f.width, p = f.clientHeight || f.height;
1311
- if (e && g.hasValue() && c.hasValue() && (d = g.getPixels("x"), p = c.getPixels("y")), o.setCurrent(d, p), typeof a == "number" && t.getAttribute("x", !0).setValue(a), typeof r == "number" && t.getAttribute("y", !0).setValue(r), typeof i == "number" || typeof n == "number") {
1312
- const y = $(t.getAttribute("viewBox").getString());
1313
- let x = 0, S = 0;
1314
- if (typeof i == "number") {
1315
- const v = t.getStyle("width");
1316
- v.hasValue() ? x = v.getPixels("x") / i : y[2] && !isNaN(y[2]) && (x = y[2] / i);
1317
- }
1318
- if (typeof n == "number") {
1319
- const v = t.getStyle("height");
1320
- v.hasValue() ? S = v.getPixels("y") / n : y[3] && !isNaN(y[3]) && (S = y[3] / n);
1321
- }
1322
- x || (x = S), S || (S = x), t.getAttribute("width", !0).setValue(i), t.getAttribute("height", !0).setValue(n);
1323
- const b = t.getStyle("transform", !0, !0);
1324
- b.setValue("".concat(b.getString(), " scale(").concat(1 / x, ", ").concat(1 / S, ")"));
1325
- }
1326
- s || h.clearRect(0, 0, d, p), t.render(h), u && (this.isFirstRender = !1);
1327
- }
1328
- constructor(t, { fetch: e = Ye, window: s = He } = {}) {
1329
- if (this.ctx = t, this.viewPort = new St(), this.mouse = new Rs(this), this.animations = [], this.waits = [], this.frameDuration = 0, this.isReadyLock = !1, this.isFirstRender = !0, this.intervalId = null, this.window = s, !e)
1330
- throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");
1331
- this.fetch = e;
1332
- }
1333
- }
1334
- it.defaultWindow = He;
1335
- it.defaultFetch = Ye;
1336
- it.FRAMERATE = 30;
1337
- it.MAX_VIRTUAL_PIXELS = 3e4;
1338
- const { defaultFetch: Ls } = it, Is = typeof DOMParser < "u" ? DOMParser : void 0;
1339
- class te {
1340
- async parse(t) {
1341
- return t.startsWith("<") ? this.parseFromString(t) : this.load(t);
1342
- }
1343
- parseFromString(t) {
1344
- const e = new this.DOMParser();
1345
- try {
1346
- return this.checkDocument(e.parseFromString(t, "image/svg+xml"));
1347
- } catch {
1348
- return this.checkDocument(e.parseFromString(t, "text/xml"));
1349
- }
1350
- }
1351
- checkDocument(t) {
1352
- const e = t.getElementsByTagName("parsererror")[0];
1353
- if (e)
1354
- throw new Error(e.textContent || "Unknown parse error");
1355
- return t;
1356
- }
1357
- async load(t) {
1358
- const s = await (await this.fetch(t)).text();
1359
- return this.parseFromString(s);
1360
- }
1361
- constructor({ fetch: t = Ls, DOMParser: e = Is } = {}) {
1362
- if (!t)
1363
- throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");
1364
- if (!e)
1365
- throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");
1366
- this.fetch = t, this.DOMParser = e;
1367
- }
1368
- }
1369
- class Ds {
1370
- apply(t) {
1371
- const { x: e, y: s } = this.point;
1372
- t.translate(e || 0, s || 0);
1373
- }
1374
- unapply(t) {
1375
- const { x: e, y: s } = this.point;
1376
- t.translate(-1 * e || 0, -1 * s || 0);
1377
- }
1378
- applyToPoint(t) {
1379
- const { x: e, y: s } = this.point;
1380
- t.applyTransform([
1381
- 1,
1382
- 0,
1383
- 0,
1384
- 1,
1385
- e || 0,
1386
- s || 0
1387
- ]);
1388
- }
1389
- constructor(t, e) {
1390
- this.type = "translate", this.point = V.parse(e);
1391
- }
1392
- }
1393
- class Bs {
1394
- apply(t) {
1395
- const { cx: e, cy: s, originX: i, originY: n, angle: a } = this, r = e + i.getPixels("x"), o = s + n.getPixels("y");
1396
- t.translate(r, o), t.rotate(a.getRadians()), t.translate(-r, -o);
1397
- }
1398
- unapply(t) {
1399
- const { cx: e, cy: s, originX: i, originY: n, angle: a } = this, r = e + i.getPixels("x"), o = s + n.getPixels("y");
1400
- t.translate(r, o), t.rotate(-1 * a.getRadians()), t.translate(-r, -o);
1401
- }
1402
- applyToPoint(t) {
1403
- const { cx: e, cy: s, angle: i } = this, n = i.getRadians();
1404
- t.applyTransform([
1405
- 1,
1406
- 0,
1407
- 0,
1408
- 1,
1409
- e || 0,
1410
- s || 0
1411
- // this.p.y
1412
- ]), t.applyTransform([
1413
- Math.cos(n),
1414
- Math.sin(n),
1415
- -Math.sin(n),
1416
- Math.cos(n),
1417
- 0,
1418
- 0
1419
- ]), t.applyTransform([
1420
- 1,
1421
- 0,
1422
- 0,
1423
- 1,
1424
- -e || 0,
1425
- -s || 0
1426
- // -this.p.y
1427
- ]);
1428
- }
1429
- constructor(t, e, s) {
1430
- this.type = "rotate";
1431
- const i = $(e);
1432
- this.angle = new A(t, "angle", i[0]), this.originX = s[0], this.originY = s[1], this.cx = i[1] || 0, this.cy = i[2] || 0;
1433
- }
1434
- }
1435
- class _s {
1436
- apply(t) {
1437
- const { scale: { x: e, y: s }, originX: i, originY: n } = this, a = i.getPixels("x"), r = n.getPixels("y");
1438
- t.translate(a, r), t.scale(e, s || e), t.translate(-a, -r);
1439
- }
1440
- unapply(t) {
1441
- const { scale: { x: e, y: s }, originX: i, originY: n } = this, a = i.getPixels("x"), r = n.getPixels("y");
1442
- t.translate(a, r), t.scale(1 / e, 1 / s || e), t.translate(-a, -r);
1443
- }
1444
- applyToPoint(t) {
1445
- const { x: e, y: s } = this.scale;
1446
- t.applyTransform([
1447
- e || 0,
1448
- 0,
1449
- 0,
1450
- s || 0,
1451
- 0,
1452
- 0
1453
- ]);
1454
- }
1455
- constructor(t, e, s) {
1456
- this.type = "scale";
1457
- const i = V.parseScale(e);
1458
- (i.x === 0 || i.y === 0) && (i.x = xt, i.y = xt), this.scale = i, this.originX = s[0], this.originY = s[1];
1459
- }
1460
- }
1461
- class We {
1462
- apply(t) {
1463
- const { originX: e, originY: s, matrix: i } = this, n = e.getPixels("x"), a = s.getPixels("y");
1464
- t.translate(n, a), t.transform(i[0], i[1], i[2], i[3], i[4], i[5]), t.translate(-n, -a);
1465
- }
1466
- unapply(t) {
1467
- const { originX: e, originY: s, matrix: i } = this, n = i[0], a = i[2], r = i[4], o = i[1], h = i[3], u = i[5], f = 0, g = 0, c = 1, d = 1 / (n * (h * c - u * g) - a * (o * c - u * f) + r * (o * g - h * f)), p = e.getPixels("x"), y = s.getPixels("y");
1468
- t.translate(p, y), t.transform(d * (h * c - u * g), d * (u * f - o * c), d * (r * g - a * c), d * (n * c - r * f), d * (a * u - r * h), d * (r * o - n * u)), t.translate(-p, -y);
1469
- }
1470
- applyToPoint(t) {
1471
- t.applyTransform(this.matrix);
1472
- }
1473
- constructor(t, e, s) {
1474
- this.type = "matrix", this.matrix = As(e), this.originX = s[0], this.originY = s[1];
1475
- }
1476
- }
1477
- class qe extends We {
1478
- constructor(t, e, s) {
1479
- super(t, e, s), this.type = "skew", this.angle = new A(t, "angle", e);
1480
- }
1481
- }
1482
- class Fs extends qe {
1483
- constructor(t, e, s) {
1484
- super(t, e, s), this.type = "skewX", this.matrix = [
1485
- 1,
1486
- 0,
1487
- Math.tan(this.angle.getRadians()),
1488
- 1,
1489
- 0,
1490
- 0
1491
- ];
1492
- }
1493
- }
1494
- class zs extends qe {
1495
- constructor(t, e, s) {
1496
- super(t, e, s), this.type = "skewY", this.matrix = [
1497
- 1,
1498
- Math.tan(this.angle.getRadians()),
1499
- 0,
1500
- 1,
1501
- 0,
1502
- 0
1503
- ];
1504
- }
1505
- }
1506
- function Us(l) {
1507
- return bt(l).trim().replace(/\)([a-zA-Z])/g, ") $1").replace(/\)(\s?,\s?)/g, ") ").split(/\s(?=[a-z])/);
1508
- }
1509
- function Xs(l) {
1510
- const [t = "", e = ""] = l.split("(");
1511
- return [
1512
- t.trim(),
1513
- e.trim().replace(")", "")
1514
- ];
1515
- }
1516
- class dt {
1517
- static fromElement(t, e) {
1518
- const s = e.getStyle("transform", !1, !0);
1519
- if (s.hasValue()) {
1520
- const [i, n = i] = e.getStyle("transform-origin", !1, !0).split();
1521
- if (i && n) {
1522
- const a = [
1523
- i,
1524
- n
1525
- ];
1526
- return new dt(t, s.getString(), a);
1527
- }
1528
- }
1529
- return null;
1530
- }
1531
- apply(t) {
1532
- this.transforms.forEach(
1533
- (e) => e.apply(t)
1534
- );
1535
- }
1536
- unapply(t) {
1537
- this.transforms.forEach(
1538
- (e) => e.unapply(t)
1539
- );
1540
- }
1541
- // TODO: applyToPoint unused ... remove?
1542
- applyToPoint(t) {
1543
- this.transforms.forEach(
1544
- (e) => e.applyToPoint(t)
1545
- );
1546
- }
1547
- constructor(t, e, s) {
1548
- this.document = t, this.transforms = [], Us(e).forEach((n) => {
1549
- if (n === "none")
1550
- return;
1551
- const [a, r] = Xs(n), o = dt.transformTypes[a];
1552
- o && this.transforms.push(new o(this.document, r, s));
1553
- });
1554
- }
1555
- }
1556
- dt.transformTypes = {
1557
- translate: Ds,
1558
- rotate: Bs,
1559
- scale: _s,
1560
- matrix: We,
1561
- skewX: Fs,
1562
- skewY: zs
1563
- };
1564
- class M {
1565
- getAttribute(t) {
1566
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
1567
- const s = this.attributes.get(t);
1568
- if (!s && e) {
1569
- const i = new A(this.document, t, "");
1570
- return this.attributes.set(t, i), i;
1571
- }
1572
- return s || A.empty(this.document);
1573
- }
1574
- getHrefAttribute() {
1575
- let t;
1576
- for (const [e, s] of this.attributes)
1577
- if (e === "href" || e.endsWith(":href")) {
1578
- t = s;
1579
- break;
1580
- }
1581
- return t || A.empty(this.document);
1582
- }
1583
- getStyle(t) {
1584
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
1585
- const i = this.styles.get(t);
1586
- if (i)
1587
- return i;
1588
- const n = this.getAttribute(t);
1589
- if (n.hasValue())
1590
- return this.styles.set(t, n), n;
1591
- if (!s) {
1592
- const { parent: a } = this;
1593
- if (a) {
1594
- const r = a.getStyle(t);
1595
- if (r.hasValue())
1596
- return r;
1597
- }
1598
- }
1599
- if (e) {
1600
- const a = new A(this.document, t, "");
1601
- return this.styles.set(t, a), a;
1602
- }
1603
- return A.empty(this.document);
1604
- }
1605
- render(t) {
1606
- if (!(this.getStyle("display").getString() === "none" || this.getStyle("visibility").getString() === "hidden")) {
1607
- if (t.save(), this.getStyle("mask").hasValue()) {
1608
- const e = this.getStyle("mask").getDefinition();
1609
- e && (this.applyEffects(t), e.apply(t, this));
1610
- } else if (this.getStyle("filter").getValue("none") !== "none") {
1611
- const e = this.getStyle("filter").getDefinition();
1612
- e && (this.applyEffects(t), e.apply(t, this));
1613
- } else
1614
- this.setContext(t), this.renderChildren(t), this.clearContext(t);
1615
- t.restore();
1616
- }
1617
- }
1618
- setContext(t) {
1619
- }
1620
- applyEffects(t) {
1621
- const e = dt.fromElement(this.document, this);
1622
- e && e.apply(t);
1623
- const s = this.getStyle("clip-path", !1, !0);
1624
- if (s.hasValue()) {
1625
- const i = s.getDefinition();
1626
- i && i.apply(t);
1627
- }
1628
- }
1629
- clearContext(t) {
1630
- }
1631
- renderChildren(t) {
1632
- this.children.forEach((e) => {
1633
- e.render(t);
1634
- });
1635
- }
1636
- addChild(t) {
1637
- const e = t instanceof M ? t : this.document.createElement(t);
1638
- e.parent = this, M.ignoreChildTypes.includes(e.type) || this.children.push(e);
1639
- }
1640
- matchesSelector(t) {
1641
- var e;
1642
- const { node: s } = this;
1643
- if (typeof s.matches == "function")
1644
- return s.matches(t);
1645
- const i = (e = s.getAttribute) === null || e === void 0 ? void 0 : e.call(s, "class");
1646
- return !i || i === "" ? !1 : i.split(" ").some(
1647
- (n) => ".".concat(n) === t
1648
- );
1649
- }
1650
- addStylesFromStyleDefinition() {
1651
- const { styles: t, stylesSpecificity: e } = this.document;
1652
- for (const [s, i] of t)
1653
- if (!s.startsWith("@") && this.matchesSelector(s)) {
1654
- const n = e.get(s);
1655
- if (i)
1656
- for (const [a, r] of i) {
1657
- let o = this.stylesSpecificity.get(a);
1658
- typeof o > "u" && (o = "000"), n && n >= o && (r && this.styles.set(a, r), this.stylesSpecificity.set(a, n));
1659
- }
1660
- }
1661
- }
1662
- removeStyles(t, e) {
1663
- return e.reduce((i, n) => {
1664
- const a = t.getStyle(n);
1665
- if (!a.hasValue())
1666
- return i;
1667
- const r = a.getString();
1668
- return a.setValue(""), [
1669
- ...i,
1670
- [
1671
- n,
1672
- r
1673
- ]
1674
- ];
1675
- }, []);
1676
- }
1677
- restoreStyles(t, e) {
1678
- e.forEach((s) => {
1679
- let [i, n] = s;
1680
- t.getStyle(i, !0).setValue(n);
1681
- });
1682
- }
1683
- isFirstChild() {
1684
- var t;
1685
- return ((t = this.parent) === null || t === void 0 ? void 0 : t.children.indexOf(this)) === 0;
1686
- }
1687
- constructor(t, e, s = !1) {
1688
- if (this.document = t, this.node = e, this.captureTextNodes = s, this.type = "", this.attributes = /* @__PURE__ */ new Map(), this.styles = /* @__PURE__ */ new Map(), this.stylesSpecificity = /* @__PURE__ */ new Map(), this.animationFrozen = !1, this.animationFrozenValue = "", this.parent = null, this.children = [], !e || e.nodeType !== 1)
1689
- return;
1690
- Array.from(e.attributes).forEach((a) => {
1691
- const r = Ts(a.nodeName);
1692
- this.attributes.set(r, new A(t, r, a.value));
1693
- }), this.addStylesFromStyleDefinition(), this.getAttribute("style").hasValue() && this.getAttribute("style").getString().split(";").map(
1694
- (r) => r.trim()
1695
- ).forEach((r) => {
1696
- if (!r)
1697
- return;
1698
- const [o, h] = r.split(":").map(
1699
- (u) => u.trim()
1700
- );
1701
- o && this.styles.set(o, new A(t, o, h));
1702
- });
1703
- const { definitions: i } = t, n = this.getAttribute("id");
1704
- n.hasValue() && (i.has(n.getString()) || i.set(n.getString(), this)), Array.from(e.childNodes).forEach((a) => {
1705
- if (a.nodeType === 1)
1706
- this.addChild(a);
1707
- else if (s && (a.nodeType === 3 || a.nodeType === 4)) {
1708
- const r = t.createTextNode(a);
1709
- r.getText().length > 0 && this.addChild(r);
1710
- }
1711
- });
1712
- }
1713
- }
1714
- M.ignoreChildTypes = [
1715
- "title"
1716
- ];
1717
- class Hs extends M {
1718
- constructor(t, e, s) {
1719
- super(t, e, s);
1720
- }
1721
- }
1722
- function Ys(l) {
1723
- const t = l.trim();
1724
- return /^('|")/.test(t) ? t : '"'.concat(t, '"');
1725
- }
1726
- function Ws(l) {
1727
- return typeof process > "u" ? l : l.trim().split(",").map(Ys).join(",");
1728
- }
1729
- function qs(l) {
1730
- if (!l)
1731
- return "";
1732
- const t = l.trim().toLowerCase();
1733
- switch (t) {
1734
- case "normal":
1735
- case "italic":
1736
- case "oblique":
1737
- case "inherit":
1738
- case "initial":
1739
- case "unset":
1740
- return t;
1741
- default:
1742
- return /^oblique\s+(-|)\d+deg$/.test(t) ? t : "";
1743
- }
1744
- }
1745
- function Qs(l) {
1746
- if (!l)
1747
- return "";
1748
- const t = l.trim().toLowerCase();
1749
- switch (t) {
1750
- case "normal":
1751
- case "bold":
1752
- case "lighter":
1753
- case "bolder":
1754
- case "inherit":
1755
- case "initial":
1756
- case "unset":
1757
- return t;
1758
- default:
1759
- return /^[\d.]+$/.test(t) ? t : "";
1760
- }
1761
- }
1762
- class W {
1763
- static parse() {
1764
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", e = arguments.length > 1 ? arguments[1] : void 0, s = "", i = "", n = "", a = "", r = "";
1765
- const o = bt(t).trim().split(" "), h = {
1766
- fontSize: !1,
1767
- fontStyle: !1,
1768
- fontWeight: !1,
1769
- fontVariant: !1
1770
- };
1771
- return o.forEach((u) => {
1772
- switch (!0) {
1773
- case (!h.fontStyle && W.styles.includes(u)):
1774
- u !== "inherit" && (s = u), h.fontStyle = !0;
1775
- break;
1776
- case (!h.fontVariant && W.variants.includes(u)):
1777
- u !== "inherit" && (i = u), h.fontStyle = !0, h.fontVariant = !0;
1778
- break;
1779
- case (!h.fontWeight && W.weights.includes(u)):
1780
- u !== "inherit" && (n = u), h.fontStyle = !0, h.fontVariant = !0, h.fontWeight = !0;
1781
- break;
1782
- case !h.fontSize:
1783
- u !== "inherit" && (a = u.split("/")[0] || ""), h.fontStyle = !0, h.fontVariant = !0, h.fontWeight = !0, h.fontSize = !0;
1784
- break;
1785
- default:
1786
- u !== "inherit" && (r += u);
1787
- }
1788
- }), new W(s, i, n, a, r, e);
1789
- }
1790
- toString() {
1791
- return [
1792
- qs(this.fontStyle),
1793
- this.fontVariant,
1794
- Qs(this.fontWeight),
1795
- this.fontSize,
1796
- // Wrap fontFamily only on nodejs and only for canvas.ctx
1797
- Ws(this.fontFamily)
1798
- ].join(" ").trim();
1799
- }
1800
- constructor(t, e, s, i, n, a) {
1801
- const r = a ? typeof a == "string" ? W.parse(a) : a : {};
1802
- this.fontFamily = n || r.fontFamily, this.fontSize = i || r.fontSize, this.fontStyle = t || r.fontStyle, this.fontWeight = s || r.fontWeight, this.fontVariant = e || r.fontVariant;
1803
- }
1804
- }
1805
- W.styles = "normal|italic|oblique|inherit";
1806
- W.variants = "normal|small-caps|inherit";
1807
- W.weights = "normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";
1808
- class J {
1809
- get x() {
1810
- return this.x1;
1811
- }
1812
- get y() {
1813
- return this.y1;
1814
- }
1815
- get width() {
1816
- return this.x2 - this.x1;
1817
- }
1818
- get height() {
1819
- return this.y2 - this.y1;
1820
- }
1821
- addPoint(t, e) {
1822
- typeof t < "u" && ((isNaN(this.x1) || isNaN(this.x2)) && (this.x1 = t, this.x2 = t), t < this.x1 && (this.x1 = t), t > this.x2 && (this.x2 = t)), typeof e < "u" && ((isNaN(this.y1) || isNaN(this.y2)) && (this.y1 = e, this.y2 = e), e < this.y1 && (this.y1 = e), e > this.y2 && (this.y2 = e));
1823
- }
1824
- addX(t) {
1825
- this.addPoint(t, 0);
1826
- }
1827
- addY(t) {
1828
- this.addPoint(0, t);
1829
- }
1830
- addBoundingBox(t) {
1831
- if (!t)
1832
- return;
1833
- const { x1: e, y1: s, x2: i, y2: n } = t;
1834
- this.addPoint(e, s), this.addPoint(i, n);
1835
- }
1836
- sumCubic(t, e, s, i, n) {
1837
- return Math.pow(1 - t, 3) * e + 3 * Math.pow(1 - t, 2) * t * s + 3 * (1 - t) * Math.pow(t, 2) * i + Math.pow(t, 3) * n;
1838
- }
1839
- bezierCurveAdd(t, e, s, i, n) {
1840
- const a = 6 * e - 12 * s + 6 * i, r = -3 * e + 9 * s - 9 * i + 3 * n, o = 3 * s - 3 * e;
1841
- if (r === 0) {
1842
- if (a === 0)
1843
- return;
1844
- const g = -o / a;
1845
- 0 < g && g < 1 && (t ? this.addX(this.sumCubic(g, e, s, i, n)) : this.addY(this.sumCubic(g, e, s, i, n)));
1846
- return;
1847
- }
1848
- const h = Math.pow(a, 2) - 4 * o * r;
1849
- if (h < 0)
1850
- return;
1851
- const u = (-a + Math.sqrt(h)) / (2 * r);
1852
- 0 < u && u < 1 && (t ? this.addX(this.sumCubic(u, e, s, i, n)) : this.addY(this.sumCubic(u, e, s, i, n)));
1853
- const f = (-a - Math.sqrt(h)) / (2 * r);
1854
- 0 < f && f < 1 && (t ? this.addX(this.sumCubic(f, e, s, i, n)) : this.addY(this.sumCubic(f, e, s, i, n)));
1855
- }
1856
- // from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
1857
- addBezierCurve(t, e, s, i, n, a, r, o) {
1858
- this.addPoint(t, e), this.addPoint(r, o), this.bezierCurveAdd(!0, t, s, n, r), this.bezierCurveAdd(!1, e, i, a, o);
1859
- }
1860
- addQuadraticCurve(t, e, s, i, n, a) {
1861
- const r = t + 0.6666666666666666 * (s - t), o = e + 2 / 3 * (i - e), h = r + 1 / 3 * (n - t), u = o + 1 / 3 * (a - e);
1862
- this.addBezierCurve(t, e, r, h, o, u, n, a);
1863
- }
1864
- isPointInBox(t, e) {
1865
- const { x1: s, y1: i, x2: n, y2: a } = this;
1866
- return s <= t && t <= n && i <= e && e <= a;
1867
- }
1868
- constructor(t = Number.NaN, e = Number.NaN, s = Number.NaN, i = Number.NaN) {
1869
- this.x1 = t, this.y1 = e, this.x2 = s, this.y2 = i, this.addPoint(t, e), this.addPoint(s, i);
1870
- }
1871
- }
1872
- class pt extends M {
1873
- calculateOpacity() {
1874
- let t = 1, e = this;
1875
- for (; e; ) {
1876
- const s = e.getStyle("opacity", !1, !0);
1877
- s.hasValue(!0) && (t *= s.getNumber()), e = e.parent;
1878
- }
1879
- return t;
1880
- }
1881
- setContext(t) {
1882
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
1883
- if (!e) {
1884
- const s = this.getStyle("fill"), i = this.getStyle("fill-opacity"), n = this.getStyle("stroke"), a = this.getStyle("stroke-opacity");
1885
- if (s.isUrlDefinition()) {
1886
- const c = s.getFillStyleDefinition(this, i);
1887
- c && (t.fillStyle = c);
1888
- } else if (s.hasValue()) {
1889
- s.getString() === "currentColor" && s.setValue(this.getStyle("color").getColor());
1890
- const c = s.getColor();
1891
- c !== "inherit" && (t.fillStyle = c === "none" ? "rgba(0,0,0,0)" : c);
1892
- }
1893
- if (i.hasValue()) {
1894
- const c = new A(this.document, "fill", t.fillStyle).addOpacity(i).getColor();
1895
- t.fillStyle = c;
1896
- }
1897
- if (n.isUrlDefinition()) {
1898
- const c = n.getFillStyleDefinition(this, a);
1899
- c && (t.strokeStyle = c);
1900
- } else if (n.hasValue()) {
1901
- n.getString() === "currentColor" && n.setValue(this.getStyle("color").getColor());
1902
- const c = n.getString();
1903
- c !== "inherit" && (t.strokeStyle = c === "none" ? "rgba(0,0,0,0)" : c);
1904
- }
1905
- if (a.hasValue()) {
1906
- const c = new A(this.document, "stroke", t.strokeStyle).addOpacity(a).getString();
1907
- t.strokeStyle = c;
1908
- }
1909
- const r = this.getStyle("stroke-width");
1910
- if (r.hasValue()) {
1911
- const c = r.getPixels();
1912
- t.lineWidth = c || xt;
1913
- }
1914
- const o = this.getStyle("stroke-linecap"), h = this.getStyle("stroke-linejoin"), u = this.getStyle("stroke-miterlimit"), f = this.getStyle("stroke-dasharray"), g = this.getStyle("stroke-dashoffset");
1915
- if (o.hasValue() && (t.lineCap = o.getString()), h.hasValue() && (t.lineJoin = h.getString()), u.hasValue() && (t.miterLimit = u.getNumber()), f.hasValue() && f.getString() !== "none") {
1916
- const c = $(f.getString());
1917
- typeof t.setLineDash < "u" ? t.setLineDash(c) : typeof t.webkitLineDash < "u" ? t.webkitLineDash = c : typeof t.mozDash < "u" && !(c.length === 1 && c[0] === 0) && (t.mozDash = c);
1918
- const d = g.getPixels();
1919
- typeof t.lineDashOffset < "u" ? t.lineDashOffset = d : typeof t.webkitLineDashOffset < "u" ? t.webkitLineDashOffset = d : typeof t.mozDashOffset < "u" && (t.mozDashOffset = d);
1920
- }
1921
- }
1922
- if (this.modifiedEmSizeStack = !1, typeof t.font < "u") {
1923
- const s = this.getStyle("font"), i = this.getStyle("font-style"), n = this.getStyle("font-variant"), a = this.getStyle("font-weight"), r = this.getStyle("font-size"), o = this.getStyle("font-family"), h = new W(i.getString(), n.getString(), a.getString(), r.hasValue() ? "".concat(r.getPixels(!0), "px") : "", o.getString(), W.parse(s.getString(), t.font));
1924
- i.setValue(h.fontStyle), n.setValue(h.fontVariant), a.setValue(h.fontWeight), r.setValue(h.fontSize), o.setValue(h.fontFamily), t.font = h.toString(), r.isPixels() && (this.document.emSize = r.getPixels(), this.modifiedEmSizeStack = !0);
1925
- }
1926
- e || (this.applyEffects(t), t.globalAlpha = this.calculateOpacity());
1927
- }
1928
- clearContext(t) {
1929
- super.clearContext(t), this.modifiedEmSizeStack && this.document.popEmSize();
1930
- }
1931
- constructor(...t) {
1932
- super(...t), this.modifiedEmSizeStack = !1;
1933
- }
1934
- }
1935
- class ot extends pt {
1936
- setContext(t) {
1937
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
1938
- super.setContext(t, e);
1939
- const s = this.getStyle("dominant-baseline").getTextBaseline() || this.getStyle("alignment-baseline").getTextBaseline();
1940
- s && (t.textBaseline = s);
1941
- }
1942
- initializeCoordinates() {
1943
- this.x = 0, this.y = 0, this.leafTexts = [], this.textChunkStart = 0, this.minX = Number.POSITIVE_INFINITY, this.maxX = Number.NEGATIVE_INFINITY;
1944
- }
1945
- getBoundingBox(t) {
1946
- if (this.type !== "text")
1947
- return this.getTElementBoundingBox(t);
1948
- this.initializeCoordinates(), this.adjustChildCoordinatesRecursive(t);
1949
- let e = null;
1950
- return this.children.forEach((s, i) => {
1951
- const n = this.getChildBoundingBox(t, this, this, i);
1952
- e ? e.addBoundingBox(n) : e = n;
1953
- }), e;
1954
- }
1955
- getFontSize() {
1956
- const { document: t, parent: e } = this, s = W.parse(t.ctx.font).fontSize;
1957
- return e.getStyle("font-size").getNumber(s);
1958
- }
1959
- getTElementBoundingBox(t) {
1960
- const e = this.getFontSize();
1961
- return new J(this.x, this.y - e, this.x + this.measureText(t), this.y);
1962
- }
1963
- getGlyph(t, e, s) {
1964
- const i = e[s];
1965
- let n;
1966
- if (t.isArabic) {
1967
- var a;
1968
- const r = e.length, o = e[s - 1], h = e[s + 1];
1969
- let u = "isolated";
1970
- (s === 0 || o === " ") && s < r - 1 && h !== " " && (u = "terminal"), s > 0 && o !== " " && s < r - 1 && h !== " " && (u = "medial"), s > 0 && o !== " " && (s === r - 1 || h === " ") && (u = "initial"), n = ((a = t.arabicGlyphs.get(i)) === null || a === void 0 ? void 0 : a.get(u)) || t.glyphs.get(i);
1971
- } else
1972
- n = t.glyphs.get(i);
1973
- return n || (n = t.missingGlyph), n;
1974
- }
1975
- getText() {
1976
- return "";
1977
- }
1978
- getTextFromNode(t) {
1979
- const e = t || this.node, s = Array.from(e.parentNode.childNodes), i = s.indexOf(e), n = s.length - 1;
1980
- let a = bt(
1981
- // textNode.value
1982
- // || textNode.text
1983
- e.textContent || ""
1984
- );
1985
- return i === 0 && (a = bs(a)), i === n && (a = vs(a)), a;
1986
- }
1987
- renderChildren(t) {
1988
- if (this.type !== "text") {
1989
- this.renderTElementChildren(t);
1990
- return;
1991
- }
1992
- this.initializeCoordinates(), this.adjustChildCoordinatesRecursive(t), this.children.forEach((s, i) => {
1993
- this.renderChild(t, this, this, i);
1994
- });
1995
- const { mouse: e } = this.document.screen;
1996
- e.isWorking() && e.checkBoundingBox(this, this.getBoundingBox(t));
1997
- }
1998
- renderTElementChildren(t) {
1999
- const { document: e, parent: s } = this, i = this.getText(), n = s.getStyle("font-family").getDefinition();
2000
- if (n) {
2001
- const { unitsPerEm: o } = n.fontFace, h = W.parse(e.ctx.font), u = s.getStyle("font-size").getNumber(h.fontSize), f = s.getStyle("font-style").getString(h.fontStyle), g = u / o, c = n.isRTL ? i.split("").reverse().join("") : i, d = $(s.getAttribute("dx").getString()), p = c.length;
2002
- for (let y = 0; y < p; y++) {
2003
- const x = this.getGlyph(n, c, y);
2004
- t.translate(this.x, this.y), t.scale(g, -g);
2005
- const S = t.lineWidth;
2006
- t.lineWidth = t.lineWidth * o / u, f === "italic" && t.transform(1, 0, 0.4, 1, 0, 0), x.render(t), f === "italic" && t.transform(1, 0, -0.4, 1, 0, 0), t.lineWidth = S, t.scale(1 / g, -1 / g), t.translate(-this.x, -this.y), this.x += u * (x.horizAdvX || n.horizAdvX) / o, typeof d[y] < "u" && !isNaN(d[y]) && (this.x += d[y]);
2007
- }
2008
- return;
2009
- }
2010
- const { x: a, y: r } = this;
2011
- t.fillStyle && t.fillText(i, a, r), t.strokeStyle && t.strokeText(i, a, r);
2012
- }
2013
- applyAnchoring() {
2014
- if (this.textChunkStart >= this.leafTexts.length)
2015
- return;
2016
- const t = this.leafTexts[this.textChunkStart], e = t.getStyle("text-anchor").getString("start"), s = !1;
2017
- let i = 0;
2018
- e === "start" || e === "end" && s ? i = t.x - this.minX : e === "end" || e === "start" && s ? i = t.x - this.maxX : i = t.x - (this.minX + this.maxX) / 2;
2019
- for (let n = this.textChunkStart; n < this.leafTexts.length; n++)
2020
- this.leafTexts[n].x += i;
2021
- this.minX = Number.POSITIVE_INFINITY, this.maxX = Number.NEGATIVE_INFINITY, this.textChunkStart = this.leafTexts.length;
2022
- }
2023
- adjustChildCoordinatesRecursive(t) {
2024
- this.children.forEach((e, s) => {
2025
- this.adjustChildCoordinatesRecursiveCore(t, this, this, s);
2026
- }), this.applyAnchoring();
2027
- }
2028
- adjustChildCoordinatesRecursiveCore(t, e, s, i) {
2029
- const n = s.children[i];
2030
- n.children.length > 0 ? n.children.forEach((a, r) => {
2031
- e.adjustChildCoordinatesRecursiveCore(t, e, n, r);
2032
- }) : this.adjustChildCoordinates(t, e, s, i);
2033
- }
2034
- adjustChildCoordinates(t, e, s, i) {
2035
- const n = s.children[i];
2036
- if (typeof n.measureText != "function")
2037
- return n;
2038
- t.save(), n.setContext(t, !0);
2039
- const a = n.getAttribute("x"), r = n.getAttribute("y"), o = n.getAttribute("dx"), h = n.getAttribute("dy"), u = n.getStyle("font-family").getDefinition(), f = !!(u != null && u.isRTL);
2040
- i === 0 && (a.hasValue() || a.setValue(n.getInheritedAttribute("x")), r.hasValue() || r.setValue(n.getInheritedAttribute("y")), o.hasValue() || o.setValue(n.getInheritedAttribute("dx")), h.hasValue() || h.setValue(n.getInheritedAttribute("dy")));
2041
- const g = n.measureText(t);
2042
- return f && (e.x -= g), a.hasValue() ? (e.applyAnchoring(), n.x = a.getPixels("x"), o.hasValue() && (n.x += o.getPixels("x"))) : (o.hasValue() && (e.x += o.getPixels("x")), n.x = e.x), e.x = n.x, f || (e.x += g), r.hasValue() ? (n.y = r.getPixels("y"), h.hasValue() && (n.y += h.getPixels("y"))) : (h.hasValue() && (e.y += h.getPixels("y")), n.y = e.y), e.y = n.y, e.leafTexts.push(n), e.minX = Math.min(e.minX, n.x, n.x + g), e.maxX = Math.max(e.maxX, n.x, n.x + g), n.clearContext(t), t.restore(), n;
2043
- }
2044
- getChildBoundingBox(t, e, s, i) {
2045
- const n = s.children[i];
2046
- if (typeof n.getBoundingBox != "function")
2047
- return null;
2048
- const a = n.getBoundingBox(t);
2049
- return a && n.children.forEach((r, o) => {
2050
- const h = e.getChildBoundingBox(t, e, n, o);
2051
- a.addBoundingBox(h);
2052
- }), a;
2053
- }
2054
- renderChild(t, e, s, i) {
2055
- const n = s.children[i];
2056
- n.render(t), n.children.forEach((a, r) => {
2057
- e.renderChild(t, e, n, r);
2058
- });
2059
- }
2060
- measureText(t) {
2061
- const { measureCache: e } = this;
2062
- if (~e)
2063
- return e;
2064
- const s = this.getText(), i = this.measureTargetText(t, s);
2065
- return this.measureCache = i, i;
2066
- }
2067
- measureTargetText(t, e) {
2068
- if (!e.length)
2069
- return 0;
2070
- const { parent: s } = this, i = s.getStyle("font-family").getDefinition();
2071
- if (i) {
2072
- const a = this.getFontSize(), r = i.isRTL ? e.split("").reverse().join("") : e, o = $(s.getAttribute("dx").getString()), h = r.length;
2073
- let u = 0;
2074
- for (let f = 0; f < h; f++) {
2075
- const g = this.getGlyph(i, r, f);
2076
- u += (g.horizAdvX || i.horizAdvX) * a / i.fontFace.unitsPerEm, typeof o[f] < "u" && !isNaN(o[f]) && (u += o[f]);
2077
- }
2078
- return u;
2079
- }
2080
- if (!t.measureText)
2081
- return e.length * 10;
2082
- t.save(), this.setContext(t, !0);
2083
- const { width: n } = t.measureText(e);
2084
- return this.clearContext(t), t.restore(), n;
2085
- }
2086
- /**
2087
- * Inherits positional attributes from {@link TextElement} parent(s). Attributes
2088
- * are only inherited from a parent to its first child.
2089
- * @param name - The attribute name.
2090
- * @returns The attribute value or null.
2091
- */
2092
- getInheritedAttribute(t) {
2093
- let e = this;
2094
- for (; e instanceof ot && e.isFirstChild() && e.parent; ) {
2095
- const s = e.parent.getAttribute(t);
2096
- if (s.hasValue(!0))
2097
- return s.getString("0");
2098
- e = e.parent;
2099
- }
2100
- return null;
2101
- }
2102
- constructor(t, e, s) {
2103
- super(t, e, new.target === ot ? !0 : s), this.type = "text", this.x = 0, this.y = 0, this.leafTexts = [], this.textChunkStart = 0, this.minX = Number.POSITIVE_INFINITY, this.maxX = Number.NEGATIVE_INFINITY, this.measureCache = -1;
2104
- }
2105
- }
2106
- class Dt extends ot {
2107
- getText() {
2108
- return this.text;
2109
- }
2110
- constructor(t, e, s) {
2111
- super(t, e, new.target === Dt ? !0 : s), this.type = "tspan", this.text = this.children.length > 0 ? "" : this.getTextFromNode();
2112
- }
2113
- }
2114
- class Gs extends Dt {
2115
- constructor(...t) {
2116
- super(...t), this.type = "textNode";
2117
- }
2118
- }
2119
- class w extends m {
2120
- reset() {
2121
- this.i = -1, this.command = null, this.previousCommand = null, this.start = new V(0, 0), this.control = new V(0, 0), this.current = new V(0, 0), this.points = [], this.angles = [];
2122
- }
2123
- isEnd() {
2124
- const { i: t, commands: e } = this;
2125
- return t >= e.length - 1;
2126
- }
2127
- next() {
2128
- const t = this.commands[++this.i];
2129
- return this.previousCommand = this.command, this.command = t, t;
2130
- }
2131
- getPoint() {
2132
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "x", e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "y";
2133
- const s = new V(this.command[t], this.command[e]);
2134
- return this.makeAbsolute(s);
2135
- }
2136
- getAsControlPoint(t, e) {
2137
- const s = this.getPoint(t, e);
2138
- return this.control = s, s;
2139
- }
2140
- getAsCurrentPoint(t, e) {
2141
- const s = this.getPoint(t, e);
2142
- return this.current = s, s;
2143
- }
2144
- getReflectedControlPoint() {
2145
- const t = this.previousCommand.type;
2146
- if (t !== m.CURVE_TO && t !== m.SMOOTH_CURVE_TO && t !== m.QUAD_TO && t !== m.SMOOTH_QUAD_TO)
2147
- return this.current;
2148
- const { current: { x: e, y: s }, control: { x: i, y: n } } = this;
2149
- return new V(2 * e - i, 2 * s - n);
2150
- }
2151
- makeAbsolute(t) {
2152
- if (this.command.relative) {
2153
- const { x: e, y: s } = this.current;
2154
- t.x += e, t.y += s;
2155
- }
2156
- return t;
2157
- }
2158
- addMarker(t, e, s) {
2159
- const { points: i, angles: n } = this;
2160
- s && n.length > 0 && !n[n.length - 1] && (n[n.length - 1] = i[i.length - 1].angleTo(s)), this.addMarkerAngle(t, e ? e.angleTo(t) : null);
2161
- }
2162
- addMarkerAngle(t, e) {
2163
- this.points.push(t), this.angles.push(e);
2164
- }
2165
- getMarkerPoints() {
2166
- return this.points;
2167
- }
2168
- getMarkerAngles() {
2169
- const { angles: t } = this, e = t.length;
2170
- for (let s = 0; s < e; s++)
2171
- if (!t[s]) {
2172
- for (let i = s + 1; i < e; i++)
2173
- if (t[i]) {
2174
- t[s] = t[i];
2175
- break;
2176
- }
2177
- }
2178
- return t;
2179
- }
2180
- constructor(t) {
2181
- super(t.replace(/([+\-.])\s+/gm, "$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g, "")), this.control = new V(0, 0), this.start = new V(0, 0), this.current = new V(0, 0), this.command = null, this.commands = this.commands, this.i = -1, this.previousCommand = null, this.points = [], this.angles = [];
2182
- }
2183
- }
2184
- class P extends pt {
2185
- path(t) {
2186
- const { pathParser: e } = this, s = new J();
2187
- for (e.reset(), t && t.beginPath(); !e.isEnd(); )
2188
- switch (e.next().type) {
2189
- case w.MOVE_TO:
2190
- this.pathM(t, s);
2191
- break;
2192
- case w.LINE_TO:
2193
- this.pathL(t, s);
2194
- break;
2195
- case w.HORIZ_LINE_TO:
2196
- this.pathH(t, s);
2197
- break;
2198
- case w.VERT_LINE_TO:
2199
- this.pathV(t, s);
2200
- break;
2201
- case w.CURVE_TO:
2202
- this.pathC(t, s);
2203
- break;
2204
- case w.SMOOTH_CURVE_TO:
2205
- this.pathS(t, s);
2206
- break;
2207
- case w.QUAD_TO:
2208
- this.pathQ(t, s);
2209
- break;
2210
- case w.SMOOTH_QUAD_TO:
2211
- this.pathT(t, s);
2212
- break;
2213
- case w.ARC:
2214
- this.pathA(t, s);
2215
- break;
2216
- case w.CLOSE_PATH:
2217
- this.pathZ(t, s);
2218
- break;
2219
- }
2220
- return s;
2221
- }
2222
- getBoundingBox(t) {
2223
- return this.path();
2224
- }
2225
- getMarkers() {
2226
- const { pathParser: t } = this, e = t.getMarkerPoints(), s = t.getMarkerAngles();
2227
- return e.map(
2228
- (n, a) => [
2229
- n,
2230
- s[a]
2231
- ]
2232
- );
2233
- }
2234
- renderChildren(t) {
2235
- this.path(t), this.document.screen.mouse.checkPath(this, t);
2236
- const e = this.getStyle("fill-rule");
2237
- t.fillStyle !== "" && (e.getString("inherit") !== "inherit" ? t.fill(e.getString()) : t.fill()), t.strokeStyle !== "" && (this.getAttribute("vector-effect").getString() === "non-scaling-stroke" ? (t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.stroke(), t.restore()) : t.stroke());
2238
- const s = this.getMarkers();
2239
- if (s) {
2240
- const i = s.length - 1, n = this.getStyle("marker-start"), a = this.getStyle("marker-mid"), r = this.getStyle("marker-end");
2241
- if (n.isUrlDefinition()) {
2242
- const o = n.getDefinition(), [h, u] = s[0];
2243
- o.render(t, h, u);
2244
- }
2245
- if (a.isUrlDefinition()) {
2246
- const o = a.getDefinition();
2247
- for (let h = 1; h < i; h++) {
2248
- const [u, f] = s[h];
2249
- o.render(t, u, f);
2250
- }
2251
- }
2252
- if (r.isUrlDefinition()) {
2253
- const o = r.getDefinition(), [h, u] = s[i];
2254
- o.render(t, h, u);
2255
- }
2256
- }
2257
- }
2258
- static pathM(t) {
2259
- const e = t.getAsCurrentPoint();
2260
- return t.start = t.current, {
2261
- point: e
2262
- };
2263
- }
2264
- pathM(t, e) {
2265
- const { pathParser: s } = this, { point: i } = P.pathM(s), { x: n, y: a } = i;
2266
- s.addMarker(i), e.addPoint(n, a), t && t.moveTo(n, a);
2267
- }
2268
- static pathL(t) {
2269
- const { current: e } = t, s = t.getAsCurrentPoint();
2270
- return {
2271
- current: e,
2272
- point: s
2273
- };
2274
- }
2275
- pathL(t, e) {
2276
- const { pathParser: s } = this, { current: i, point: n } = P.pathL(s), { x: a, y: r } = n;
2277
- s.addMarker(n, i), e.addPoint(a, r), t && t.lineTo(a, r);
2278
- }
2279
- static pathH(t) {
2280
- const { current: e, command: s } = t, i = new V((s.relative ? e.x : 0) + s.x, e.y);
2281
- return t.current = i, {
2282
- current: e,
2283
- point: i
2284
- };
2285
- }
2286
- pathH(t, e) {
2287
- const { pathParser: s } = this, { current: i, point: n } = P.pathH(s), { x: a, y: r } = n;
2288
- s.addMarker(n, i), e.addPoint(a, r), t && t.lineTo(a, r);
2289
- }
2290
- static pathV(t) {
2291
- const { current: e, command: s } = t, i = new V(e.x, (s.relative ? e.y : 0) + s.y);
2292
- return t.current = i, {
2293
- current: e,
2294
- point: i
2295
- };
2296
- }
2297
- pathV(t, e) {
2298
- const { pathParser: s } = this, { current: i, point: n } = P.pathV(s), { x: a, y: r } = n;
2299
- s.addMarker(n, i), e.addPoint(a, r), t && t.lineTo(a, r);
2300
- }
2301
- static pathC(t) {
2302
- const { current: e } = t, s = t.getPoint("x1", "y1"), i = t.getAsControlPoint("x2", "y2"), n = t.getAsCurrentPoint();
2303
- return {
2304
- current: e,
2305
- point: s,
2306
- controlPoint: i,
2307
- currentPoint: n
2308
- };
2309
- }
2310
- pathC(t, e) {
2311
- const { pathParser: s } = this, { current: i, point: n, controlPoint: a, currentPoint: r } = P.pathC(s);
2312
- s.addMarker(r, a, n), e.addBezierCurve(i.x, i.y, n.x, n.y, a.x, a.y, r.x, r.y), t && t.bezierCurveTo(n.x, n.y, a.x, a.y, r.x, r.y);
2313
- }
2314
- static pathS(t) {
2315
- const { current: e } = t, s = t.getReflectedControlPoint(), i = t.getAsControlPoint("x2", "y2"), n = t.getAsCurrentPoint();
2316
- return {
2317
- current: e,
2318
- point: s,
2319
- controlPoint: i,
2320
- currentPoint: n
2321
- };
2322
- }
2323
- pathS(t, e) {
2324
- const { pathParser: s } = this, { current: i, point: n, controlPoint: a, currentPoint: r } = P.pathS(s);
2325
- s.addMarker(r, a, n), e.addBezierCurve(i.x, i.y, n.x, n.y, a.x, a.y, r.x, r.y), t && t.bezierCurveTo(n.x, n.y, a.x, a.y, r.x, r.y);
2326
- }
2327
- static pathQ(t) {
2328
- const { current: e } = t, s = t.getAsControlPoint("x1", "y1"), i = t.getAsCurrentPoint();
2329
- return {
2330
- current: e,
2331
- controlPoint: s,
2332
- currentPoint: i
2333
- };
2334
- }
2335
- pathQ(t, e) {
2336
- const { pathParser: s } = this, { current: i, controlPoint: n, currentPoint: a } = P.pathQ(s);
2337
- s.addMarker(a, n, n), e.addQuadraticCurve(i.x, i.y, n.x, n.y, a.x, a.y), t && t.quadraticCurveTo(n.x, n.y, a.x, a.y);
2338
- }
2339
- static pathT(t) {
2340
- const { current: e } = t, s = t.getReflectedControlPoint();
2341
- t.control = s;
2342
- const i = t.getAsCurrentPoint();
2343
- return {
2344
- current: e,
2345
- controlPoint: s,
2346
- currentPoint: i
2347
- };
2348
- }
2349
- pathT(t, e) {
2350
- const { pathParser: s } = this, { current: i, controlPoint: n, currentPoint: a } = P.pathT(s);
2351
- s.addMarker(a, n, n), e.addQuadraticCurve(i.x, i.y, n.x, n.y, a.x, a.y), t && t.quadraticCurveTo(n.x, n.y, a.x, a.y);
2352
- }
2353
- static pathA(t) {
2354
- const { current: e, command: s } = t;
2355
- let { rX: i, rY: n, xRot: a, lArcFlag: r, sweepFlag: o } = s;
2356
- const h = a * (Math.PI / 180), u = t.getAsCurrentPoint(), f = new V(Math.cos(h) * (e.x - u.x) / 2 + Math.sin(h) * (e.y - u.y) / 2, -Math.sin(h) * (e.x - u.x) / 2 + Math.cos(h) * (e.y - u.y) / 2), g = Math.pow(f.x, 2) / Math.pow(i, 2) + Math.pow(f.y, 2) / Math.pow(n, 2);
2357
- g > 1 && (i *= Math.sqrt(g), n *= Math.sqrt(g));
2358
- let c = (r === o ? -1 : 1) * Math.sqrt((Math.pow(i, 2) * Math.pow(n, 2) - Math.pow(i, 2) * Math.pow(f.y, 2) - Math.pow(n, 2) * Math.pow(f.x, 2)) / (Math.pow(i, 2) * Math.pow(f.y, 2) + Math.pow(n, 2) * Math.pow(f.x, 2)));
2359
- isNaN(c) && (c = 0);
2360
- const d = new V(c * i * f.y / n, c * -n * f.x / i), p = new V((e.x + u.x) / 2 + Math.cos(h) * d.x - Math.sin(h) * d.y, (e.y + u.y) / 2 + Math.sin(h) * d.x + Math.cos(h) * d.y), y = Me([
2361
- 1,
2362
- 0
2363
- ], [
2364
- (f.x - d.x) / i,
2365
- (f.y - d.y) / n
2366
- ]), x = [
2367
- (f.x - d.x) / i,
2368
- (f.y - d.y) / n
2369
- ], S = [
2370
- (-f.x - d.x) / i,
2371
- (-f.y - d.y) / n
2372
- ];
2373
- let b = Me(x, S);
2374
- return ne(x, S) <= -1 && (b = Math.PI), ne(x, S) >= 1 && (b = 0), {
2375
- currentPoint: u,
2376
- rX: i,
2377
- rY: n,
2378
- sweepFlag: o,
2379
- xAxisRotation: h,
2380
- centp: p,
2381
- a1: y,
2382
- ad: b
2383
- };
2384
- }
2385
- pathA(t, e) {
2386
- const { pathParser: s } = this, { currentPoint: i, rX: n, rY: a, sweepFlag: r, xAxisRotation: o, centp: h, a1: u, ad: f } = P.pathA(s), g = 1 - r ? 1 : -1, c = u + g * (f / 2), d = new V(h.x + n * Math.cos(c), h.y + a * Math.sin(c));
2387
- if (s.addMarkerAngle(d, c - g * Math.PI / 2), s.addMarkerAngle(i, c - g * Math.PI), e.addPoint(i.x, i.y), t && !isNaN(u) && !isNaN(f)) {
2388
- const p = n > a ? n : a, y = n > a ? 1 : n / a, x = n > a ? a / n : 1;
2389
- t.translate(h.x, h.y), t.rotate(o), t.scale(y, x), t.arc(0, 0, p, u, u + f, !!(1 - r)), t.scale(1 / y, 1 / x), t.rotate(-o), t.translate(-h.x, -h.y);
2390
- }
2391
- }
2392
- static pathZ(t) {
2393
- t.current = t.start;
2394
- }
2395
- pathZ(t, e) {
2396
- P.pathZ(this.pathParser), t && e.x1 !== e.x2 && e.y1 !== e.y2 && t.closePath();
2397
- }
2398
- constructor(t, e, s) {
2399
- super(t, e, s), this.type = "path", this.pathParser = new w(this.getAttribute("d").getString());
2400
- }
2401
- }
2402
- class Tt extends pt {
2403
- setContext(t) {
2404
- var e;
2405
- const { document: s } = this, { screen: i, window: n } = s, a = t.canvas;
2406
- if (i.setDefaults(t), "style" in a && typeof t.font < "u" && n && typeof n.getComputedStyle < "u") {
2407
- t.font = n.getComputedStyle(a).getPropertyValue("font");
2408
- const S = new A(s, "fontSize", W.parse(t.font).fontSize);
2409
- S.hasValue() && (s.rootEmSize = S.getPixels("y"), s.emSize = s.rootEmSize);
2410
- }
2411
- this.getAttribute("x").hasValue() || this.getAttribute("x", !0).setValue(0), this.getAttribute("y").hasValue() || this.getAttribute("y", !0).setValue(0);
2412
- let { width: r, height: o } = i.viewPort;
2413
- this.getStyle("width").hasValue() || this.getStyle("width", !0).setValue("100%"), this.getStyle("height").hasValue() || this.getStyle("height", !0).setValue("100%"), this.getStyle("color").hasValue() || this.getStyle("color", !0).setValue("black");
2414
- const h = this.getAttribute("refX"), u = this.getAttribute("refY"), f = this.getAttribute("viewBox"), g = f.hasValue() ? $(f.getString()) : null, c = !this.root && this.getStyle("overflow").getValue("hidden") !== "visible";
2415
- let d = 0, p = 0, y = 0, x = 0;
2416
- g && (d = g[0], p = g[1]), this.root || (r = this.getStyle("width").getPixels("x"), o = this.getStyle("height").getPixels("y"), this.type === "marker" && (y = d, x = p, d = 0, p = 0)), i.viewPort.setCurrent(r, o), this.node && (!this.parent || ((e = this.node.parentNode) === null || e === void 0 ? void 0 : e.nodeName) === "foreignObject") && this.getStyle("transform", !1, !0).hasValue() && !this.getStyle("transform-origin", !1, !0).hasValue() && this.getStyle("transform-origin", !0, !0).setValue("50% 50%"), super.setContext(t), t.translate(this.getAttribute("x").getPixels("x"), this.getAttribute("y").getPixels("y")), g && (r = g[2], o = g[3]), s.setViewBox({
2417
- ctx: t,
2418
- aspectRatio: this.getAttribute("preserveAspectRatio").getString(),
2419
- width: i.viewPort.width,
2420
- desiredWidth: r,
2421
- height: i.viewPort.height,
2422
- desiredHeight: o,
2423
- minX: d,
2424
- minY: p,
2425
- refX: h.getValue(),
2426
- refY: u.getValue(),
2427
- clip: c,
2428
- clipX: y,
2429
- clipY: x
2430
- }), g && (i.viewPort.removeCurrent(), i.viewPort.setCurrent(r, o));
2431
- }
2432
- clearContext(t) {
2433
- super.clearContext(t), this.document.screen.viewPort.removeCurrent();
2434
- }
2435
- /**
2436
- * Resize SVG to fit in given size.
2437
- * @param width
2438
- * @param height
2439
- * @param preserveAspectRatio
2440
- */
2441
- resize(t) {
2442
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
2443
- const i = this.getAttribute("width", !0), n = this.getAttribute("height", !0), a = this.getAttribute("viewBox"), r = this.getAttribute("style"), o = i.getNumber(0), h = n.getNumber(0);
2444
- if (s)
2445
- if (typeof s == "string")
2446
- this.getAttribute("preserveAspectRatio", !0).setValue(s);
2447
- else {
2448
- const u = this.getAttribute("preserveAspectRatio");
2449
- u.hasValue() && u.setValue(u.getString().replace(/^\s*(\S.*\S)\s*$/, "$1"));
2450
- }
2451
- if (i.setValue(t), n.setValue(e), a.hasValue() || a.setValue("0 0 ".concat(o || t, " ").concat(h || e)), r.hasValue()) {
2452
- const u = this.getStyle("width"), f = this.getStyle("height");
2453
- u.hasValue() && u.setValue("".concat(t, "px")), f.hasValue() && f.setValue("".concat(e, "px"));
2454
- }
2455
- }
2456
- constructor(...t) {
2457
- super(...t), this.type = "svg", this.root = !1;
2458
- }
2459
- }
2460
- class Qe extends P {
2461
- path(t) {
2462
- const e = this.getAttribute("x").getPixels("x"), s = this.getAttribute("y").getPixels("y"), i = this.getStyle("width", !1, !0).getPixels("x"), n = this.getStyle("height", !1, !0).getPixels("y"), a = this.getAttribute("rx"), r = this.getAttribute("ry");
2463
- let o = a.getPixels("x"), h = r.getPixels("y");
2464
- if (a.hasValue() && !r.hasValue() && (h = o), r.hasValue() && !a.hasValue() && (o = h), o = Math.min(o, i / 2), h = Math.min(h, n / 2), t) {
2465
- const u = 4 * ((Math.sqrt(2) - 1) / 3);
2466
- t.beginPath(), n > 0 && i > 0 && (t.moveTo(e + o, s), t.lineTo(e + i - o, s), t.bezierCurveTo(e + i - o + u * o, s, e + i, s + h - u * h, e + i, s + h), t.lineTo(e + i, s + n - h), t.bezierCurveTo(e + i, s + n - h + u * h, e + i - o + u * o, s + n, e + i - o, s + n), t.lineTo(e + o, s + n), t.bezierCurveTo(e + o - u * o, s + n, e, s + n - h + u * h, e, s + n - h), t.lineTo(e, s + h), t.bezierCurveTo(e, s + h - u * h, e + o - u * o, s, e + o, s), t.closePath());
2467
- }
2468
- return new J(e, s, e + i, s + n);
2469
- }
2470
- getMarkers() {
2471
- return null;
2472
- }
2473
- constructor(...t) {
2474
- super(...t), this.type = "rect";
2475
- }
2476
- }
2477
- class $s extends P {
2478
- path(t) {
2479
- const e = this.getAttribute("cx").getPixels("x"), s = this.getAttribute("cy").getPixels("y"), i = this.getAttribute("r").getPixels();
2480
- return t && i > 0 && (t.beginPath(), t.arc(e, s, i, 0, Math.PI * 2, !1), t.closePath()), new J(e - i, s - i, e + i, s + i);
2481
- }
2482
- getMarkers() {
2483
- return null;
2484
- }
2485
- constructor(...t) {
2486
- super(...t), this.type = "circle";
2487
- }
2488
- }
2489
- class Zs extends P {
2490
- path(t) {
2491
- const e = 4 * ((Math.sqrt(2) - 1) / 3), s = this.getAttribute("rx").getPixels("x"), i = this.getAttribute("ry").getPixels("y"), n = this.getAttribute("cx").getPixels("x"), a = this.getAttribute("cy").getPixels("y");
2492
- return t && s > 0 && i > 0 && (t.beginPath(), t.moveTo(n + s, a), t.bezierCurveTo(n + s, a + e * i, n + e * s, a + i, n, a + i), t.bezierCurveTo(n - e * s, a + i, n - s, a + e * i, n - s, a), t.bezierCurveTo(n - s, a - e * i, n - e * s, a - i, n, a - i), t.bezierCurveTo(n + e * s, a - i, n + s, a - e * i, n + s, a), t.closePath()), new J(n - s, a - i, n + s, a + i);
2493
- }
2494
- getMarkers() {
2495
- return null;
2496
- }
2497
- constructor(...t) {
2498
- super(...t), this.type = "ellipse";
2499
- }
2500
- }
2501
- class js extends P {
2502
- getPoints() {
2503
- return [
2504
- new V(this.getAttribute("x1").getPixels("x"), this.getAttribute("y1").getPixels("y")),
2505
- new V(this.getAttribute("x2").getPixels("x"), this.getAttribute("y2").getPixels("y"))
2506
- ];
2507
- }
2508
- path(t) {
2509
- const [{ x: e, y: s }, { x: i, y: n }] = this.getPoints();
2510
- return t && (t.beginPath(), t.moveTo(e, s), t.lineTo(i, n)), new J(e, s, i, n);
2511
- }
2512
- getMarkers() {
2513
- const [t, e] = this.getPoints(), s = t.angleTo(e);
2514
- return [
2515
- [
2516
- t,
2517
- s
2518
- ],
2519
- [
2520
- e,
2521
- s
2522
- ]
2523
- ];
2524
- }
2525
- constructor(...t) {
2526
- super(...t), this.type = "line";
2527
- }
2528
- }
2529
- class Ge extends P {
2530
- path(t) {
2531
- const { points: e } = this, [{ x: s, y: i }] = e, n = new J(s, i);
2532
- return t && (t.beginPath(), t.moveTo(s, i)), e.forEach((a) => {
2533
- let { x: r, y: o } = a;
2534
- n.addPoint(r, o), t && t.lineTo(r, o);
2535
- }), n;
2536
- }
2537
- getMarkers() {
2538
- const { points: t } = this, e = t.length - 1, s = [];
2539
- return t.forEach((i, n) => {
2540
- n !== e && s.push([
2541
- i,
2542
- i.angleTo(t[n + 1])
2543
- ]);
2544
- }), s.length > 0 && s.push([
2545
- t[t.length - 1],
2546
- s[s.length - 1][1]
2547
- ]), s;
2548
- }
2549
- constructor(t, e, s) {
2550
- super(t, e, s), this.type = "polyline", this.points = [], this.points = V.parsePath(this.getAttribute("points").getString());
2551
- }
2552
- }
2553
- class Ks extends Ge {
2554
- path(t) {
2555
- const e = super.path(t), [{ x: s, y: i }] = this.points;
2556
- return t && (t.lineTo(s, i), t.closePath()), e;
2557
- }
2558
- constructor(...t) {
2559
- super(...t), this.type = "polygon";
2560
- }
2561
- }
2562
- class Js extends M {
2563
- createPattern(t, e, s) {
2564
- const i = this.getStyle("width").getPixels("x", !0), n = this.getStyle("height").getPixels("y", !0), a = new Tt(this.document, null);
2565
- a.attributes.set("viewBox", new A(this.document, "viewBox", this.getAttribute("viewBox").getValue())), a.attributes.set("width", new A(this.document, "width", "".concat(i, "px"))), a.attributes.set("height", new A(this.document, "height", "".concat(n, "px"))), a.attributes.set("transform", new A(this.document, "transform", this.getAttribute("patternTransform").getValue())), a.children = this.children;
2566
- const r = this.document.createCanvas(i, n), o = r.getContext("2d"), h = this.getAttribute("x"), u = this.getAttribute("y");
2567
- h.hasValue() && u.hasValue() && o.translate(h.getPixels("x", !0), u.getPixels("y", !0)), s.hasValue() ? this.styles.set("fill-opacity", s) : this.styles.delete("fill-opacity");
2568
- for (let g = -1; g <= 1; g++)
2569
- for (let c = -1; c <= 1; c++)
2570
- o.save(), a.attributes.set("x", new A(this.document, "x", g * r.width)), a.attributes.set("y", new A(this.document, "y", c * r.height)), a.render(o), o.restore();
2571
- return t.createPattern(r, "repeat");
2572
- }
2573
- constructor(...t) {
2574
- super(...t), this.type = "pattern";
2575
- }
2576
- }
2577
- class ti extends M {
2578
- render(t, e, s) {
2579
- if (!e)
2580
- return;
2581
- const { x: i, y: n } = e, a = this.getAttribute("orient").getString("auto"), r = this.getAttribute("markerUnits").getString("strokeWidth");
2582
- t.translate(i, n), a === "auto" && t.rotate(s), r === "strokeWidth" && t.scale(t.lineWidth, t.lineWidth), t.save();
2583
- const o = new Tt(this.document);
2584
- o.type = this.type, o.attributes.set("viewBox", new A(this.document, "viewBox", this.getAttribute("viewBox").getValue())), o.attributes.set("refX", new A(this.document, "refX", this.getAttribute("refX").getValue())), o.attributes.set("refY", new A(this.document, "refY", this.getAttribute("refY").getValue())), o.attributes.set("width", new A(this.document, "width", this.getAttribute("markerWidth").getValue())), o.attributes.set("height", new A(this.document, "height", this.getAttribute("markerHeight").getValue())), o.attributes.set("overflow", new A(this.document, "overflow", this.getAttribute("overflow").getValue())), o.attributes.set("fill", new A(this.document, "fill", this.getAttribute("fill").getColor("black"))), o.attributes.set("stroke", new A(this.document, "stroke", this.getAttribute("stroke").getValue("none"))), o.children = this.children, o.render(t), t.restore(), r === "strokeWidth" && t.scale(1 / t.lineWidth, 1 / t.lineWidth), a === "auto" && t.rotate(-s), t.translate(-i, -n);
2585
- }
2586
- constructor(...t) {
2587
- super(...t), this.type = "marker";
2588
- }
2589
- }
2590
- class ei extends M {
2591
- render() {
2592
- }
2593
- constructor(...t) {
2594
- super(...t), this.type = "defs";
2595
- }
2596
- }
2597
- class re extends pt {
2598
- getBoundingBox(t) {
2599
- const e = new J();
2600
- return this.children.forEach((s) => {
2601
- e.addBoundingBox(s.getBoundingBox(t));
2602
- }), e;
2603
- }
2604
- constructor(...t) {
2605
- super(...t), this.type = "g";
2606
- }
2607
- }
2608
- class $e extends M {
2609
- getGradientUnits() {
2610
- return this.getAttribute("gradientUnits").getString("objectBoundingBox");
2611
- }
2612
- createGradient(t, e, s) {
2613
- let i = this;
2614
- this.getHrefAttribute().hasValue() && (i = this.getHrefAttribute().getDefinition(), this.inheritStopContainer(i));
2615
- const { stops: n } = i, a = this.getGradient(t, e);
2616
- if (!a)
2617
- return this.addParentOpacity(s, n[n.length - 1].color);
2618
- if (n.forEach((r) => {
2619
- a.addColorStop(r.offset, this.addParentOpacity(s, r.color));
2620
- }), this.getAttribute("gradientTransform").hasValue()) {
2621
- const { document: r } = this, { MAX_VIRTUAL_PIXELS: o } = it, { viewPort: h } = r.screen, u = h.getRoot(), f = new Qe(r);
2622
- f.attributes.set("x", new A(r, "x", -o / 3)), f.attributes.set("y", new A(r, "y", -o / 3)), f.attributes.set("width", new A(r, "width", o)), f.attributes.set("height", new A(r, "height", o));
2623
- const g = new re(r);
2624
- g.attributes.set("transform", new A(r, "transform", this.getAttribute("gradientTransform").getValue())), g.children = [
2625
- f
2626
- ];
2627
- const c = new Tt(r);
2628
- c.attributes.set("x", new A(r, "x", 0)), c.attributes.set("y", new A(r, "y", 0)), c.attributes.set("width", new A(r, "width", u.width)), c.attributes.set("height", new A(r, "height", u.height)), c.children = [
2629
- g
2630
- ];
2631
- const d = r.createCanvas(u.width, u.height), p = d.getContext("2d");
2632
- return p.fillStyle = a, c.render(p), p.createPattern(d, "no-repeat");
2633
- }
2634
- return a;
2635
- }
2636
- inheritStopContainer(t) {
2637
- this.attributesToInherit.forEach((e) => {
2638
- !this.getAttribute(e).hasValue() && t.getAttribute(e).hasValue() && this.getAttribute(e, !0).setValue(t.getAttribute(e).getValue());
2639
- });
2640
- }
2641
- addParentOpacity(t, e) {
2642
- return t.hasValue() ? new A(this.document, "color", e).addOpacity(t).getColor() : e;
2643
- }
2644
- constructor(t, e, s) {
2645
- super(t, e, s), this.attributesToInherit = [
2646
- "gradientUnits"
2647
- ], this.stops = [];
2648
- const { stops: i, children: n } = this;
2649
- n.forEach((a) => {
2650
- a.type === "stop" && i.push(a);
2651
- });
2652
- }
2653
- }
2654
- class si extends $e {
2655
- getGradient(t, e) {
2656
- const s = this.getGradientUnits() === "objectBoundingBox", i = s ? e.getBoundingBox(t) : null;
2657
- if (s && !i)
2658
- return null;
2659
- !this.getAttribute("x1").hasValue() && !this.getAttribute("y1").hasValue() && !this.getAttribute("x2").hasValue() && !this.getAttribute("y2").hasValue() && (this.getAttribute("x1", !0).setValue(0), this.getAttribute("y1", !0).setValue(0), this.getAttribute("x2", !0).setValue(1), this.getAttribute("y2", !0).setValue(0));
2660
- const n = s ? i.x + i.width * this.getAttribute("x1").getNumber() : this.getAttribute("x1").getPixels("x"), a = s ? i.y + i.height * this.getAttribute("y1").getNumber() : this.getAttribute("y1").getPixels("y"), r = s ? i.x + i.width * this.getAttribute("x2").getNumber() : this.getAttribute("x2").getPixels("x"), o = s ? i.y + i.height * this.getAttribute("y2").getNumber() : this.getAttribute("y2").getPixels("y");
2661
- return n === r && a === o ? null : t.createLinearGradient(n, a, r, o);
2662
- }
2663
- constructor(t, e, s) {
2664
- super(t, e, s), this.type = "linearGradient", this.attributesToInherit.push("x1", "y1", "x2", "y2");
2665
- }
2666
- }
2667
- class ii extends $e {
2668
- getGradient(t, e) {
2669
- const s = this.getGradientUnits() === "objectBoundingBox", i = e.getBoundingBox(t);
2670
- if (s && !i)
2671
- return null;
2672
- this.getAttribute("cx").hasValue() || this.getAttribute("cx", !0).setValue("50%"), this.getAttribute("cy").hasValue() || this.getAttribute("cy", !0).setValue("50%"), this.getAttribute("r").hasValue() || this.getAttribute("r", !0).setValue("50%");
2673
- const n = s ? i.x + i.width * this.getAttribute("cx").getNumber() : this.getAttribute("cx").getPixels("x"), a = s ? i.y + i.height * this.getAttribute("cy").getNumber() : this.getAttribute("cy").getPixels("y");
2674
- let r = n, o = a;
2675
- this.getAttribute("fx").hasValue() && (r = s ? i.x + i.width * this.getAttribute("fx").getNumber() : this.getAttribute("fx").getPixels("x")), this.getAttribute("fy").hasValue() && (o = s ? i.y + i.height * this.getAttribute("fy").getNumber() : this.getAttribute("fy").getPixels("y"));
2676
- const h = s ? (i.width + i.height) / 2 * this.getAttribute("r").getNumber() : this.getAttribute("r").getPixels(), u = this.getAttribute("fr").getPixels();
2677
- return t.createRadialGradient(r, o, u, n, a, h);
2678
- }
2679
- constructor(t, e, s) {
2680
- super(t, e, s), this.type = "radialGradient", this.attributesToInherit.push("cx", "cy", "r", "fx", "fy", "fr");
2681
- }
2682
- }
2683
- class ni extends M {
2684
- constructor(t, e, s) {
2685
- super(t, e, s), this.type = "stop";
2686
- const i = Math.max(0, Math.min(1, this.getAttribute("offset").getNumber())), n = this.getStyle("stop-opacity");
2687
- let a = this.getStyle("stop-color", !0);
2688
- a.getString() === "" && a.setValue("#000"), n.hasValue() && (a = a.addOpacity(n)), this.offset = i, this.color = a.getColor();
2689
- }
2690
- }
2691
- class ae extends M {
2692
- getProperty() {
2693
- const t = this.getAttribute("attributeType").getString(), e = this.getAttribute("attributeName").getString();
2694
- return t === "CSS" ? this.parent.getStyle(e, !0) : this.parent.getAttribute(e, !0);
2695
- }
2696
- calcValue() {
2697
- const { initialUnits: t } = this, { progress: e, from: s, to: i } = this.getProgress();
2698
- let n = s.getNumber() + (i.getNumber() - s.getNumber()) * e;
2699
- return t === "%" && (n *= 100), "".concat(n).concat(t);
2700
- }
2701
- update(t) {
2702
- const { parent: e } = this, s = this.getProperty();
2703
- if (this.initialValue || (this.initialValue = s.getString(), this.initialUnits = s.getUnits()), this.duration > this.maxDuration) {
2704
- const n = this.getAttribute("fill").getString("remove");
2705
- if (this.getAttribute("repeatCount").getString() === "indefinite" || this.getAttribute("repeatDur").getString() === "indefinite")
2706
- this.duration = 0;
2707
- else if (n === "freeze" && !this.frozen)
2708
- this.frozen = !0, e && s && (e.animationFrozen = !0, e.animationFrozenValue = s.getString());
2709
- else if (n === "remove" && !this.removed)
2710
- return this.removed = !0, e && s && s.setValue(e.animationFrozen ? e.animationFrozenValue : this.initialValue), !0;
2711
- return !1;
2712
- }
2713
- this.duration += t;
2714
- let i = !1;
2715
- if (this.begin < this.duration) {
2716
- let n = this.calcValue();
2717
- const a = this.getAttribute("type");
2718
- if (a.hasValue()) {
2719
- const r = a.getString();
2720
- n = "".concat(r, "(").concat(n, ")");
2721
- }
2722
- s.setValue(n), i = !0;
2723
- }
2724
- return i;
2725
- }
2726
- getProgress() {
2727
- const { document: t, values: e } = this;
2728
- let s = (this.duration - this.begin) / (this.maxDuration - this.begin), i, n;
2729
- if (e.hasValue()) {
2730
- const a = s * (e.getValue().length - 1), r = Math.floor(a), o = Math.ceil(a);
2731
- let h;
2732
- h = e.getValue()[r], i = new A(t, "from", h ? parseFloat(h) : 0), h = e.getValue()[o], n = new A(t, "to", h ? parseFloat(h) : 0), s = (a - r) / (o - r);
2733
- } else
2734
- i = this.from, n = this.to;
2735
- return {
2736
- progress: s,
2737
- from: i,
2738
- to: n
2739
- };
2740
- }
2741
- constructor(t, e, s) {
2742
- super(t, e, s), this.type = "animate", this.duration = 0, this.initialUnits = "", this.removed = !1, this.frozen = !1, t.screen.animations.push(this), this.begin = this.getAttribute("begin").getMilliseconds(), this.maxDuration = this.begin + this.getAttribute("dur").getMilliseconds(), this.from = this.getAttribute("from"), this.to = this.getAttribute("to"), this.values = new A(t, "values", null);
2743
- const i = this.getAttribute("values");
2744
- i.hasValue() && this.values.setValue(i.getString().split(";"));
2745
- }
2746
- }
2747
- class ri extends ae {
2748
- calcValue() {
2749
- const { progress: t, from: e, to: s } = this.getProgress(), i = new se(e.getColor()), n = new se(s.getColor());
2750
- if (i.ok && n.ok) {
2751
- const a = i.r + (n.r - i.r) * t, r = i.g + (n.g - i.g) * t, o = i.b + (n.b - i.b) * t;
2752
- return "rgb(".concat(Math.floor(a), ", ").concat(Math.floor(r), ", ").concat(Math.floor(o), ")");
2753
- }
2754
- return this.getAttribute("from").getColor();
2755
- }
2756
- constructor(...t) {
2757
- super(...t), this.type = "animateColor";
2758
- }
2759
- }
2760
- class ai extends ae {
2761
- calcValue() {
2762
- const { progress: t, from: e, to: s } = this.getProgress(), i = $(e.getString()), n = $(s.getString());
2763
- return i.map((r, o) => {
2764
- const h = n[o];
2765
- return r + (h - r) * t;
2766
- }).join(" ");
2767
- }
2768
- constructor(...t) {
2769
- super(...t), this.type = "animateTransform";
2770
- }
2771
- }
2772
- class Ze extends M {
2773
- constructor(t, e, s) {
2774
- super(t, e, s), this.type = "font-face", this.ascent = this.getAttribute("ascent").getNumber(), this.descent = this.getAttribute("descent").getNumber(), this.unitsPerEm = this.getAttribute("units-per-em").getNumber();
2775
- }
2776
- }
2777
- class oe extends P {
2778
- constructor(t, e, s) {
2779
- super(t, e, s), this.type = "glyph", this.horizAdvX = this.getAttribute("horiz-adv-x").getNumber(), this.unicode = this.getAttribute("unicode").getString(), this.arabicForm = this.getAttribute("arabic-form").getString();
2780
- }
2781
- }
2782
- class je extends oe {
2783
- constructor(...t) {
2784
- super(...t), this.type = "missing-glyph", this.horizAdvX = 0;
2785
- }
2786
- }
2787
- class oi extends M {
2788
- render() {
2789
- }
2790
- constructor(t, e, s) {
2791
- super(t, e, s), this.type = "font", this.isArabic = !1, this.glyphs = /* @__PURE__ */ new Map(), this.arabicGlyphs = /* @__PURE__ */ new Map(), this.isRTL = !1, this.horizAdvX = this.getAttribute("horiz-adv-x").getNumber();
2792
- const { definitions: i } = t, { children: n } = this;
2793
- for (const a of n)
2794
- if (a instanceof Ze) {
2795
- this.fontFace = a;
2796
- const r = a.getStyle("font-family");
2797
- r.hasValue() && i.set(r.getString(), this);
2798
- } else if (a instanceof je)
2799
- this.missingGlyph = a;
2800
- else if (a instanceof oe)
2801
- if (a.arabicForm) {
2802
- this.isRTL = !0, this.isArabic = !0;
2803
- let r = this.arabicGlyphs.get(a.unicode);
2804
- typeof r > "u" && (r = /* @__PURE__ */ new Map(), this.arabicGlyphs.set(a.unicode, r)), r.set(a.arabicForm, a);
2805
- } else
2806
- this.glyphs.set(a.unicode, a);
2807
- }
2808
- }
2809
- class hi extends ot {
2810
- getText() {
2811
- const t = this.getHrefAttribute().getDefinition();
2812
- if (t) {
2813
- const e = t.children[0];
2814
- if (e)
2815
- return e.getText();
2816
- }
2817
- return "";
2818
- }
2819
- constructor(...t) {
2820
- super(...t), this.type = "tref";
2821
- }
2822
- }
2823
- class li extends ot {
2824
- getText() {
2825
- return this.text;
2826
- }
2827
- renderChildren(t) {
2828
- if (this.hasText) {
2829
- super.renderChildren(t);
2830
- const { document: e, x: s, y: i } = this, { mouse: n } = e.screen, a = new A(e, "fontSize", W.parse(e.ctx.font).fontSize);
2831
- n.isWorking() && n.checkBoundingBox(this, new J(s, i - a.getPixels("y"), s + this.measureText(t), i));
2832
- } else if (this.children.length > 0) {
2833
- const e = new re(this.document);
2834
- e.children = this.children, e.parent = this, e.render(t);
2835
- }
2836
- }
2837
- onClick() {
2838
- const { window: t } = this.document;
2839
- t && t.open(this.getHrefAttribute().getString());
2840
- }
2841
- onMouseMove() {
2842
- const t = this.document.ctx;
2843
- t.canvas.style.cursor = "pointer";
2844
- }
2845
- constructor(t, e, s) {
2846
- super(t, e, s), this.type = "a";
2847
- const { childNodes: i } = e, n = i[0], a = i.length > 0 && Array.from(i).every(
2848
- (r) => r.nodeType === 3
2849
- );
2850
- this.hasText = a, this.text = a ? this.getTextFromNode(n) : "";
2851
- }
2852
- }
2853
- class ui extends ot {
2854
- getText() {
2855
- return this.text;
2856
- }
2857
- path(t) {
2858
- const { dataArray: e } = this;
2859
- t && t.beginPath(), e.forEach((s) => {
2860
- let { type: i, points: n } = s;
2861
- switch (i) {
2862
- case w.LINE_TO:
2863
- t && t.lineTo(n[0], n[1]);
2864
- break;
2865
- case w.MOVE_TO:
2866
- t && t.moveTo(n[0], n[1]);
2867
- break;
2868
- case w.CURVE_TO:
2869
- t && t.bezierCurveTo(n[0], n[1], n[2], n[3], n[4], n[5]);
2870
- break;
2871
- case w.QUAD_TO:
2872
- t && t.quadraticCurveTo(n[0], n[1], n[2], n[3]);
2873
- break;
2874
- case w.ARC: {
2875
- const [a, r, o, h, u, f, g, c] = n, d = o > h ? o : h, p = o > h ? 1 : o / h, y = o > h ? h / o : 1;
2876
- t && (t.translate(a, r), t.rotate(g), t.scale(p, y), t.arc(0, 0, d, u, u + f, !!(1 - c)), t.scale(1 / p, 1 / y), t.rotate(-g), t.translate(-a, -r));
2877
- break;
2878
- }
2879
- case w.CLOSE_PATH:
2880
- t && t.closePath();
2881
- break;
2882
- }
2883
- });
2884
- }
2885
- renderChildren(t) {
2886
- this.setTextData(t), t.save();
2887
- const e = this.parent.getStyle("text-decoration").getString(), s = this.getFontSize(), { glyphInfo: i } = this, n = t.fillStyle;
2888
- e === "underline" && t.beginPath(), i.forEach((a, r) => {
2889
- const { p0: o, p1: h, rotation: u, text: f } = a;
2890
- t.save(), t.translate(o.x, o.y), t.rotate(u), t.fillStyle && t.fillText(f, 0, 0), t.strokeStyle && t.strokeText(f, 0, 0), t.restore(), e === "underline" && (r === 0 && t.moveTo(o.x, o.y + s / 8), t.lineTo(h.x, h.y + s / 5));
2891
- }), e === "underline" && (t.lineWidth = s / 20, t.strokeStyle = n, t.stroke(), t.closePath()), t.restore();
2892
- }
2893
- getLetterSpacingAt() {
2894
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
2895
- return this.letterSpacingCache[t] || 0;
2896
- }
2897
- findSegmentToFitChar(t, e, s, i, n, a, r, o, h) {
2898
- let u = a, f = this.measureText(t, o);
2899
- o === " " && e === "justify" && s < i && (f += (i - s) / n), h > -1 && (u += this.getLetterSpacingAt(h));
2900
- const g = this.textHeight / 20, c = this.getEquidistantPointOnPath(u, g, 0), d = this.getEquidistantPointOnPath(u + f, g, 0), p = {
2901
- p0: c,
2902
- p1: d
2903
- }, y = c && d ? Math.atan2(d.y - c.y, d.x - c.x) : 0;
2904
- if (r) {
2905
- const x = Math.cos(Math.PI / 2 + y) * r, S = Math.cos(-y) * r;
2906
- p.p0 = {
2907
- ...c,
2908
- x: c.x + x,
2909
- y: c.y + S
2910
- }, p.p1 = {
2911
- ...d,
2912
- x: d.x + x,
2913
- y: d.y + S
2914
- };
2915
- }
2916
- return u += f, {
2917
- offset: u,
2918
- segment: p,
2919
- rotation: y
2920
- };
2921
- }
2922
- measureText(t, e) {
2923
- const { measuresCache: s } = this, i = e || this.getText();
2924
- if (s.has(i))
2925
- return s.get(i);
2926
- const n = this.measureTargetText(t, i);
2927
- return s.set(i, n), n;
2928
- }
2929
- // This method supposes what all custom fonts already loaded.
2930
- // If some font will be loaded after this method call, <textPath> will not be rendered correctly.
2931
- // You need to call this method manually to update glyphs cache.
2932
- setTextData(t) {
2933
- if (this.glyphInfo)
2934
- return;
2935
- const e = this.getText(), s = e.split(""), i = e.split(" ").length - 1, n = this.parent.getAttribute("dx").split().map(
2936
- (b) => b.getPixels("x")
2937
- ), a = this.parent.getAttribute("dy").getPixels("y"), r = this.parent.getStyle("text-anchor").getString("start"), o = this.getStyle("letter-spacing"), h = this.parent.getStyle("letter-spacing");
2938
- let u = 0;
2939
- !o.hasValue() || o.getValue() === "inherit" ? u = h.getPixels() : o.hasValue() && o.getValue() !== "initial" && o.getValue() !== "unset" && (u = o.getPixels());
2940
- const f = [], g = e.length;
2941
- this.letterSpacingCache = f;
2942
- for (let b = 0; b < g; b++)
2943
- f.push(typeof n[b] < "u" ? n[b] : u);
2944
- const c = f.reduce(
2945
- (b, v, E) => E === 0 ? 0 : b + v || 0,
2946
- 0
2947
- ), d = this.measureText(t), p = Math.max(d + c, 0);
2948
- this.textWidth = d, this.textHeight = this.getFontSize(), this.glyphInfo = [];
2949
- const y = this.getPathLength(), x = this.getStyle("startOffset").getNumber(0) * y;
2950
- let S = 0;
2951
- (r === "middle" || r === "center") && (S = -p / 2), (r === "end" || r === "right") && (S = -p), S += x, s.forEach((b, v) => {
2952
- const { offset: E, segment: C, rotation: T } = this.findSegmentToFitChar(t, r, p, y, i, S, a, b, v);
2953
- S = E, !(!C.p0 || !C.p1) && this.glyphInfo.push({
2954
- // transposeX: midpoint.x,
2955
- // transposeY: midpoint.y,
2956
- text: s[v],
2957
- p0: C.p0,
2958
- p1: C.p1,
2959
- rotation: T
2960
- });
2961
- });
2962
- }
2963
- parsePathData(t) {
2964
- if (this.pathLength = -1, !t)
2965
- return [];
2966
- const e = [], { pathParser: s } = t;
2967
- for (s.reset(); !s.isEnd(); ) {
2968
- const { current: i } = s, n = i ? i.x : 0, a = i ? i.y : 0, r = s.next();
2969
- let o = r.type, h = [];
2970
- switch (r.type) {
2971
- case w.MOVE_TO:
2972
- this.pathM(s, h);
2973
- break;
2974
- case w.LINE_TO:
2975
- o = this.pathL(s, h);
2976
- break;
2977
- case w.HORIZ_LINE_TO:
2978
- o = this.pathH(s, h);
2979
- break;
2980
- case w.VERT_LINE_TO:
2981
- o = this.pathV(s, h);
2982
- break;
2983
- case w.CURVE_TO:
2984
- this.pathC(s, h);
2985
- break;
2986
- case w.SMOOTH_CURVE_TO:
2987
- o = this.pathS(s, h);
2988
- break;
2989
- case w.QUAD_TO:
2990
- this.pathQ(s, h);
2991
- break;
2992
- case w.SMOOTH_QUAD_TO:
2993
- o = this.pathT(s, h);
2994
- break;
2995
- case w.ARC:
2996
- h = this.pathA(s);
2997
- break;
2998
- case w.CLOSE_PATH:
2999
- P.pathZ(s);
3000
- break;
3001
- }
3002
- r.type !== w.CLOSE_PATH ? e.push({
3003
- type: o,
3004
- points: h,
3005
- start: {
3006
- x: n,
3007
- y: a
3008
- },
3009
- pathLength: this.calcLength(n, a, o, h)
3010
- }) : e.push({
3011
- type: w.CLOSE_PATH,
3012
- points: [],
3013
- pathLength: 0
3014
- });
3015
- }
3016
- return e;
3017
- }
3018
- pathM(t, e) {
3019
- const { x: s, y: i } = P.pathM(t).point;
3020
- e.push(s, i);
3021
- }
3022
- pathL(t, e) {
3023
- const { x: s, y: i } = P.pathL(t).point;
3024
- return e.push(s, i), w.LINE_TO;
3025
- }
3026
- pathH(t, e) {
3027
- const { x: s, y: i } = P.pathH(t).point;
3028
- return e.push(s, i), w.LINE_TO;
3029
- }
3030
- pathV(t, e) {
3031
- const { x: s, y: i } = P.pathV(t).point;
3032
- return e.push(s, i), w.LINE_TO;
3033
- }
3034
- pathC(t, e) {
3035
- const { point: s, controlPoint: i, currentPoint: n } = P.pathC(t);
3036
- e.push(s.x, s.y, i.x, i.y, n.x, n.y);
3037
- }
3038
- pathS(t, e) {
3039
- const { point: s, controlPoint: i, currentPoint: n } = P.pathS(t);
3040
- return e.push(s.x, s.y, i.x, i.y, n.x, n.y), w.CURVE_TO;
3041
- }
3042
- pathQ(t, e) {
3043
- const { controlPoint: s, currentPoint: i } = P.pathQ(t);
3044
- e.push(s.x, s.y, i.x, i.y);
3045
- }
3046
- pathT(t, e) {
3047
- const { controlPoint: s, currentPoint: i } = P.pathT(t);
3048
- return e.push(s.x, s.y, i.x, i.y), w.QUAD_TO;
3049
- }
3050
- pathA(t) {
3051
- let { rX: e, rY: s, sweepFlag: i, xAxisRotation: n, centp: a, a1: r, ad: o } = P.pathA(t);
3052
- return i === 0 && o > 0 && (o -= 2 * Math.PI), i === 1 && o < 0 && (o += 2 * Math.PI), [
3053
- a.x,
3054
- a.y,
3055
- e,
3056
- s,
3057
- r,
3058
- o,
3059
- n,
3060
- i
3061
- ];
3062
- }
3063
- calcLength(t, e, s, i) {
3064
- let n = 0, a = null, r = null, o = 0;
3065
- switch (s) {
3066
- case w.LINE_TO:
3067
- return this.getLineLength(t, e, i[0], i[1]);
3068
- case w.CURVE_TO:
3069
- for (n = 0, a = this.getPointOnCubicBezier(0, t, e, i[0], i[1], i[2], i[3], i[4], i[5]), o = 0.01; o <= 1; o += 0.01)
3070
- r = this.getPointOnCubicBezier(o, t, e, i[0], i[1], i[2], i[3], i[4], i[5]), n += this.getLineLength(a.x, a.y, r.x, r.y), a = r;
3071
- return n;
3072
- case w.QUAD_TO:
3073
- for (n = 0, a = this.getPointOnQuadraticBezier(0, t, e, i[0], i[1], i[2], i[3]), o = 0.01; o <= 1; o += 0.01)
3074
- r = this.getPointOnQuadraticBezier(o, t, e, i[0], i[1], i[2], i[3]), n += this.getLineLength(a.x, a.y, r.x, r.y), a = r;
3075
- return n;
3076
- case w.ARC: {
3077
- n = 0;
3078
- const h = i[4], u = i[5], f = i[4] + u;
3079
- let g = Math.PI / 180;
3080
- if (Math.abs(h - f) < g && (g = Math.abs(h - f)), a = this.getPointOnEllipticalArc(i[0], i[1], i[2], i[3], h, 0), u < 0)
3081
- for (o = h - g; o > f; o -= g)
3082
- r = this.getPointOnEllipticalArc(i[0], i[1], i[2], i[3], o, 0), n += this.getLineLength(a.x, a.y, r.x, r.y), a = r;
3083
- else
3084
- for (o = h + g; o < f; o += g)
3085
- r = this.getPointOnEllipticalArc(i[0], i[1], i[2], i[3], o, 0), n += this.getLineLength(a.x, a.y, r.x, r.y), a = r;
3086
- return r = this.getPointOnEllipticalArc(i[0], i[1], i[2], i[3], f, 0), n += this.getLineLength(a.x, a.y, r.x, r.y), n;
3087
- }
3088
- }
3089
- return 0;
3090
- }
3091
- getPointOnLine(t, e, s, i, n) {
3092
- let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : e, r = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : s;
3093
- const o = (n - s) / (i - e + xt);
3094
- let h = Math.sqrt(t * t / (1 + o * o));
3095
- i < e && (h *= -1);
3096
- let u = o * h, f = null;
3097
- if (i === e)
3098
- f = {
3099
- x: a,
3100
- y: r + u
3101
- };
3102
- else if ((r - s) / (a - e + xt) === o)
3103
- f = {
3104
- x: a + h,
3105
- y: r + u
3106
- };
3107
- else {
3108
- let g = 0, c = 0;
3109
- const d = this.getLineLength(e, s, i, n);
3110
- if (d < xt)
3111
- return null;
3112
- let p = (a - e) * (i - e) + (r - s) * (n - s);
3113
- p /= d * d, g = e + p * (i - e), c = s + p * (n - s);
3114
- const y = this.getLineLength(a, r, g, c), x = Math.sqrt(t * t - y * y);
3115
- h = Math.sqrt(x * x / (1 + o * o)), i < e && (h *= -1), u = o * h, f = {
3116
- x: g + h,
3117
- y: c + u
3118
- };
3119
- }
3120
- return f;
3121
- }
3122
- getPointOnPath(t) {
3123
- const e = this.getPathLength();
3124
- let s = 0, i = null;
3125
- if (t < -5e-5 || t - 5e-5 > e)
3126
- return null;
3127
- const { dataArray: n } = this;
3128
- for (const a of n) {
3129
- if (a && (a.pathLength < 5e-5 || s + a.pathLength + 5e-5 < t)) {
3130
- s += a.pathLength;
3131
- continue;
3132
- }
3133
- const r = t - s;
3134
- let o = 0;
3135
- switch (a.type) {
3136
- case w.LINE_TO:
3137
- i = this.getPointOnLine(r, a.start.x, a.start.y, a.points[0], a.points[1], a.start.x, a.start.y);
3138
- break;
3139
- case w.ARC: {
3140
- const h = a.points[4], u = a.points[5], f = a.points[4] + u;
3141
- if (o = h + r / a.pathLength * u, u < 0 && o < f || u >= 0 && o > f)
3142
- break;
3143
- i = this.getPointOnEllipticalArc(a.points[0], a.points[1], a.points[2], a.points[3], o, a.points[6]);
3144
- break;
3145
- }
3146
- case w.CURVE_TO:
3147
- o = r / a.pathLength, o > 1 && (o = 1), i = this.getPointOnCubicBezier(o, a.start.x, a.start.y, a.points[0], a.points[1], a.points[2], a.points[3], a.points[4], a.points[5]);
3148
- break;
3149
- case w.QUAD_TO:
3150
- o = r / a.pathLength, o > 1 && (o = 1), i = this.getPointOnQuadraticBezier(o, a.start.x, a.start.y, a.points[0], a.points[1], a.points[2], a.points[3]);
3151
- break;
3152
- }
3153
- if (i)
3154
- return i;
3155
- break;
3156
- }
3157
- return null;
3158
- }
3159
- getLineLength(t, e, s, i) {
3160
- return Math.sqrt((s - t) * (s - t) + (i - e) * (i - e));
3161
- }
3162
- getPathLength() {
3163
- return this.pathLength === -1 && (this.pathLength = this.dataArray.reduce(
3164
- (t, e) => e.pathLength > 0 ? t + e.pathLength : t,
3165
- 0
3166
- )), this.pathLength;
3167
- }
3168
- getPointOnCubicBezier(t, e, s, i, n, a, r, o, h) {
3169
- const u = o * Ne(t) + a * Oe(t) + i * Ve(t) + e * ke(t), f = h * Ne(t) + r * Oe(t) + n * Ve(t) + s * ke(t);
3170
- return {
3171
- x: u,
3172
- y: f
3173
- };
3174
- }
3175
- getPointOnQuadraticBezier(t, e, s, i, n, a, r) {
3176
- const o = a * Re(t) + i * Le(t) + e * Ie(t), h = r * Re(t) + n * Le(t) + s * Ie(t);
3177
- return {
3178
- x: o,
3179
- y: h
3180
- };
3181
- }
3182
- getPointOnEllipticalArc(t, e, s, i, n, a) {
3183
- const r = Math.cos(a), o = Math.sin(a), h = {
3184
- x: s * Math.cos(n),
3185
- y: i * Math.sin(n)
3186
- };
3187
- return {
3188
- x: t + (h.x * r - h.y * o),
3189
- y: e + (h.x * o + h.y * r)
3190
- };
3191
- }
3192
- // TODO need some optimisations. possibly build cache only for curved segments?
3193
- buildEquidistantCache(t, e) {
3194
- const s = this.getPathLength(), i = e || 0.25, n = t || s / 100;
3195
- if (!this.equidistantCache || this.equidistantCache.step !== n || this.equidistantCache.precision !== i) {
3196
- this.equidistantCache = {
3197
- step: n,
3198
- precision: i,
3199
- points: []
3200
- };
3201
- let a = 0;
3202
- for (let r = 0; r <= s; r += i) {
3203
- const o = this.getPointOnPath(r), h = this.getPointOnPath(r + i);
3204
- !o || !h || (a += this.getLineLength(o.x, o.y, h.x, h.y), a >= n && (this.equidistantCache.points.push({
3205
- x: o.x,
3206
- y: o.y,
3207
- distance: r
3208
- }), a -= n));
3209
- }
3210
- }
3211
- }
3212
- getEquidistantPointOnPath(t, e, s) {
3213
- if (this.buildEquidistantCache(e, s), t < 0 || t - this.getPathLength() > 5e-5)
3214
- return null;
3215
- const i = Math.round(t / this.getPathLength() * (this.equidistantCache.points.length - 1));
3216
- return this.equidistantCache.points[i] || null;
3217
- }
3218
- constructor(t, e, s) {
3219
- super(t, e, s), this.type = "textPath", this.textWidth = 0, this.textHeight = 0, this.pathLength = -1, this.glyphInfo = null, this.letterSpacingCache = [], this.measuresCache = /* @__PURE__ */ new Map([
3220
- [
3221
- "",
3222
- 0
3223
- ]
3224
- ]);
3225
- const i = this.getHrefAttribute().getDefinition();
3226
- this.text = this.getTextFromNode(), this.dataArray = this.parsePathData(i);
3227
- }
3228
- }
3229
- const ci = /^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;
3230
- class fi extends pt {
3231
- async loadImage(t) {
3232
- try {
3233
- const e = await this.document.createImage(t);
3234
- this.image = e;
3235
- } catch (e) {
3236
- console.error('Error while loading image "'.concat(t, '":'), e);
3237
- }
3238
- this.loaded = !0;
3239
- }
3240
- async loadSvg(t) {
3241
- const e = ci.exec(t);
3242
- if (e) {
3243
- const s = e[5];
3244
- s && (e[4] === "base64" ? this.image = atob(s) : this.image = decodeURIComponent(s));
3245
- } else
3246
- try {
3247
- const i = await (await this.document.fetch(t)).text();
3248
- this.image = i;
3249
- } catch (s) {
3250
- console.error('Error while loading image "'.concat(t, '":'), s);
3251
- }
3252
- this.loaded = !0;
3253
- }
3254
- renderChildren(t) {
3255
- const { document: e, image: s, loaded: i } = this, n = this.getAttribute("x").getPixels("x"), a = this.getAttribute("y").getPixels("y"), r = this.getStyle("width").getPixels("x"), o = this.getStyle("height").getPixels("y");
3256
- if (!(!i || !s || !r || !o)) {
3257
- if (t.save(), t.translate(n, a), typeof s == "string") {
3258
- const h = e.canvg.forkString(t, s, {
3259
- ignoreMouse: !0,
3260
- ignoreAnimation: !0,
3261
- ignoreDimensions: !0,
3262
- ignoreClear: !0,
3263
- offsetX: 0,
3264
- offsetY: 0,
3265
- scaleWidth: r,
3266
- scaleHeight: o
3267
- }), { documentElement: u } = h.document;
3268
- u && (u.parent = this), h.render();
3269
- } else
3270
- e.setViewBox({
3271
- ctx: t,
3272
- aspectRatio: this.getAttribute("preserveAspectRatio").getString(),
3273
- width: r,
3274
- desiredWidth: s.width,
3275
- height: o,
3276
- desiredHeight: s.height
3277
- }), this.loaded && (!("complete" in s) || s.complete) && t.drawImage(s, 0, 0);
3278
- t.restore();
3279
- }
3280
- }
3281
- getBoundingBox() {
3282
- const t = this.getAttribute("x").getPixels("x"), e = this.getAttribute("y").getPixels("y"), s = this.getStyle("width").getPixels("x"), i = this.getStyle("height").getPixels("y");
3283
- return new J(t, e, t + s, e + i);
3284
- }
3285
- constructor(t, e, s) {
3286
- super(t, e, s), this.type = "image", this.loaded = !1;
3287
- const i = this.getHrefAttribute().getString();
3288
- if (!i)
3289
- return;
3290
- const n = i.endsWith(".svg") || /^\s*data:image\/svg\+xml/i.test(i);
3291
- t.images.push(this), n ? this.loadSvg(i) : this.loadImage(i);
3292
- }
3293
- }
3294
- class gi extends pt {
3295
- render(t) {
3296
- }
3297
- constructor(...t) {
3298
- super(...t), this.type = "symbol";
3299
- }
3300
- }
3301
- class di {
3302
- async load(t, e) {
3303
- try {
3304
- const { document: s } = this, n = (await s.canvg.parser.load(e)).getElementsByTagName("font");
3305
- Array.from(n).forEach((a) => {
3306
- const r = s.createElement(a);
3307
- s.definitions.set(t, r);
3308
- });
3309
- } catch (s) {
3310
- console.error('Error while loading font "'.concat(e, '":'), s);
3311
- }
3312
- this.loaded = !0;
3313
- }
3314
- constructor(t) {
3315
- this.document = t, this.loaded = !1, t.fonts.push(this);
3316
- }
3317
- }
3318
- class Ke extends M {
3319
- constructor(t, e, s) {
3320
- super(t, e, s), this.type = "style", bt(
3321
- Array.from(e.childNodes).map(
3322
- (a) => a.textContent
3323
- ).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, "").replace(/@import.*;/g, "")
3324
- // remove imports
3325
- ).split("}").forEach((a) => {
3326
- const r = a.trim();
3327
- if (!r)
3328
- return;
3329
- const o = r.split("{"), h = o[0].split(","), u = o[1].split(";");
3330
- h.forEach((f) => {
3331
- const g = f.trim();
3332
- if (!g)
3333
- return;
3334
- const c = t.styles.get(g) || /* @__PURE__ */ new Map();
3335
- if (u.forEach((d) => {
3336
- const p = d.indexOf(":"), y = d.substr(0, p).trim(), x = d.substr(p + 1, d.length - p).trim();
3337
- y && x && c.set(y, new A(t, y, x));
3338
- }), t.styles.set(g, c), t.stylesSpecificity.set(g, ks(g)), g === "@font-face") {
3339
- const d = c.get("font-family").getString().replace(/"|'/g, "");
3340
- c.get("src").getString().split(",").forEach((y) => {
3341
- if (y.indexOf('format("svg")') > 0) {
3342
- const x = Xe(y);
3343
- x && new di(t).load(d, x);
3344
- }
3345
- });
3346
- }
3347
- });
3348
- });
3349
- }
3350
- }
3351
- Ke.parseExternalUrl = Xe;
3352
- class pi extends pt {
3353
- setContext(t) {
3354
- super.setContext(t);
3355
- const e = this.getAttribute("x"), s = this.getAttribute("y");
3356
- e.hasValue() && t.translate(e.getPixels("x"), 0), s.hasValue() && t.translate(0, s.getPixels("y"));
3357
- }
3358
- path(t) {
3359
- const { element: e } = this;
3360
- e && e.path(t);
3361
- }
3362
- renderChildren(t) {
3363
- const { document: e, element: s } = this;
3364
- if (s) {
3365
- let i = s;
3366
- if (s.type === "symbol" && (i = new Tt(e), i.attributes.set("viewBox", new A(e, "viewBox", s.getAttribute("viewBox").getString())), i.attributes.set("preserveAspectRatio", new A(e, "preserveAspectRatio", s.getAttribute("preserveAspectRatio").getString())), i.attributes.set("overflow", new A(e, "overflow", s.getAttribute("overflow").getString())), i.children = s.children, s.styles.set("opacity", new A(e, "opacity", this.calculateOpacity()))), i.type === "svg") {
3367
- const a = this.getStyle("width", !1, !0), r = this.getStyle("height", !1, !0);
3368
- a.hasValue() && i.attributes.set("width", new A(e, "width", a.getString())), r.hasValue() && i.attributes.set("height", new A(e, "height", r.getString()));
3369
- }
3370
- const n = i.parent;
3371
- i.parent = this, i.render(t), i.parent = n;
3372
- }
3373
- }
3374
- getBoundingBox(t) {
3375
- const { element: e } = this;
3376
- return e ? e.getBoundingBox(t) : null;
3377
- }
3378
- elementTransform() {
3379
- const { document: t, element: e } = this;
3380
- return e ? dt.fromElement(t, e) : null;
3381
- }
3382
- get element() {
3383
- return this.cachedElement || (this.cachedElement = this.getHrefAttribute().getDefinition()), this.cachedElement;
3384
- }
3385
- constructor(...t) {
3386
- super(...t), this.type = "use";
3387
- }
3388
- }
3389
- function Rt(l, t, e, s, i, n) {
3390
- return l[e * s * 4 + t * 4 + n];
3391
- }
3392
- function Lt(l, t, e, s, i, n, a) {
3393
- l[e * s * 4 + t * 4 + n] = a;
3394
- }
3395
- function I(l, t, e) {
3396
- return l[t] * e;
3397
- }
3398
- function st(l, t, e, s) {
3399
- return t + Math.cos(l) * e + Math.sin(l) * s;
3400
- }
3401
- class Je extends M {
3402
- apply(t, e, s, i, n) {
3403
- const { includeOpacity: a, matrix: r } = this, o = t.getImageData(0, 0, i, n);
3404
- for (let h = 0; h < n; h++)
3405
- for (let u = 0; u < i; u++) {
3406
- const f = Rt(o.data, u, h, i, n, 0), g = Rt(o.data, u, h, i, n, 1), c = Rt(o.data, u, h, i, n, 2), d = Rt(o.data, u, h, i, n, 3);
3407
- let p = I(r, 0, f) + I(r, 1, g) + I(r, 2, c) + I(r, 3, d) + I(r, 4, 1), y = I(r, 5, f) + I(r, 6, g) + I(r, 7, c) + I(r, 8, d) + I(r, 9, 1), x = I(r, 10, f) + I(r, 11, g) + I(r, 12, c) + I(r, 13, d) + I(r, 14, 1), S = I(r, 15, f) + I(r, 16, g) + I(r, 17, c) + I(r, 18, d) + I(r, 19, 1);
3408
- a && (p = 0, y = 0, x = 0, S *= d / 255), Lt(o.data, u, h, i, n, 0, p), Lt(o.data, u, h, i, n, 1, y), Lt(o.data, u, h, i, n, 2, x), Lt(o.data, u, h, i, n, 3, S);
3409
- }
3410
- t.clearRect(0, 0, i, n), t.putImageData(o, 0, 0);
3411
- }
3412
- constructor(t, e, s) {
3413
- super(t, e, s), this.type = "feColorMatrix";
3414
- let i = $(this.getAttribute("values").getString());
3415
- switch (this.getAttribute("type").getString("matrix")) {
3416
- case "saturate": {
3417
- const n = i[0];
3418
- i = [
3419
- 0.213 + 0.787 * n,
3420
- 0.715 - 0.715 * n,
3421
- 0.072 - 0.072 * n,
3422
- 0,
3423
- 0,
3424
- 0.213 - 0.213 * n,
3425
- 0.715 + 0.285 * n,
3426
- 0.072 - 0.072 * n,
3427
- 0,
3428
- 0,
3429
- 0.213 - 0.213 * n,
3430
- 0.715 - 0.715 * n,
3431
- 0.072 + 0.928 * n,
3432
- 0,
3433
- 0,
3434
- 0,
3435
- 0,
3436
- 0,
3437
- 1,
3438
- 0,
3439
- 0,
3440
- 0,
3441
- 0,
3442
- 0,
3443
- 1
3444
- ];
3445
- break;
3446
- }
3447
- case "hueRotate": {
3448
- const n = i[0] * Math.PI / 180;
3449
- i = [
3450
- st(n, 0.213, 0.787, -0.213),
3451
- st(n, 0.715, -0.715, -0.715),
3452
- st(n, 0.072, -0.072, 0.928),
3453
- 0,
3454
- 0,
3455
- st(n, 0.213, -0.213, 0.143),
3456
- st(n, 0.715, 0.285, 0.14),
3457
- st(n, 0.072, -0.072, -0.283),
3458
- 0,
3459
- 0,
3460
- st(n, 0.213, -0.213, -0.787),
3461
- st(n, 0.715, -0.715, 0.715),
3462
- st(n, 0.072, 0.928, 0.072),
3463
- 0,
3464
- 0,
3465
- 0,
3466
- 0,
3467
- 0,
3468
- 1,
3469
- 0,
3470
- 0,
3471
- 0,
3472
- 0,
3473
- 0,
3474
- 1
3475
- ];
3476
- break;
3477
- }
3478
- case "luminanceToAlpha":
3479
- i = [
3480
- 0,
3481
- 0,
3482
- 0,
3483
- 0,
3484
- 0,
3485
- 0,
3486
- 0,
3487
- 0,
3488
- 0,
3489
- 0,
3490
- 0,
3491
- 0,
3492
- 0,
3493
- 0,
3494
- 0,
3495
- 0.2125,
3496
- 0.7154,
3497
- 0.0721,
3498
- 0,
3499
- 0,
3500
- 0,
3501
- 0,
3502
- 0,
3503
- 0,
3504
- 1
3505
- ];
3506
- break;
3507
- }
3508
- this.matrix = i, this.includeOpacity = this.getAttribute("includeOpacity").hasValue();
3509
- }
3510
- }
3511
- class Bt extends M {
3512
- apply(t, e) {
3513
- const { document: s } = this;
3514
- let i = this.getAttribute("x").getPixels("x"), n = this.getAttribute("y").getPixels("y"), a = this.getStyle("width").getPixels("x"), r = this.getStyle("height").getPixels("y");
3515
- if (!a && !r) {
3516
- const c = new J();
3517
- this.children.forEach((d) => {
3518
- c.addBoundingBox(d.getBoundingBox(t));
3519
- }), i = Math.floor(c.x1), n = Math.floor(c.y1), a = Math.floor(c.width), r = Math.floor(c.height);
3520
- }
3521
- const o = this.removeStyles(e, Bt.ignoreStyles), h = s.createCanvas(i + a, n + r), u = h.getContext("2d");
3522
- s.screen.setDefaults(u), this.renderChildren(u), new Je(s, {
3523
- nodeType: 1,
3524
- childNodes: [],
3525
- attributes: [
3526
- {
3527
- nodeName: "type",
3528
- value: "luminanceToAlpha"
3529
- },
3530
- {
3531
- nodeName: "includeOpacity",
3532
- value: "true"
3533
- }
3534
- ]
3535
- }).apply(u, 0, 0, i + a, n + r);
3536
- const f = s.createCanvas(i + a, n + r), g = f.getContext("2d");
3537
- s.screen.setDefaults(g), e.render(g), g.globalCompositeOperation = "destination-in", g.fillStyle = u.createPattern(h, "no-repeat"), g.fillRect(0, 0, i + a, n + r), t.fillStyle = g.createPattern(f, "no-repeat"), t.fillRect(0, 0, i + a, n + r), this.restoreStyles(e, o);
3538
- }
3539
- render(t) {
3540
- }
3541
- constructor(...t) {
3542
- super(...t), this.type = "mask";
3543
- }
3544
- }
3545
- Bt.ignoreStyles = [
3546
- "mask",
3547
- "transform",
3548
- "clip-path"
3549
- ];
3550
- const Be = () => {
3551
- };
3552
- class yi extends M {
3553
- apply(t) {
3554
- const { document: e } = this, s = Reflect.getPrototypeOf(t), { beginPath: i, closePath: n } = t;
3555
- s && (s.beginPath = Be, s.closePath = Be), Reflect.apply(i, t, []), this.children.forEach((a) => {
3556
- if (!("path" in a))
3557
- return;
3558
- let r = "elementTransform" in a ? a.elementTransform() : null;
3559
- r || (r = dt.fromElement(e, a)), r && r.apply(t), a.path(t), s && (s.closePath = n), r && r.unapply(t);
3560
- }), Reflect.apply(n, t, []), t.clip(), s && (s.beginPath = i, s.closePath = n);
3561
- }
3562
- render(t) {
3563
- }
3564
- constructor(...t) {
3565
- super(...t), this.type = "clipPath";
3566
- }
3567
- }
3568
- class _t extends M {
3569
- apply(t, e) {
3570
- const { document: s, children: i } = this, n = "getBoundingBox" in e ? e.getBoundingBox(t) : null;
3571
- if (!n)
3572
- return;
3573
- let a = 0, r = 0;
3574
- i.forEach((x) => {
3575
- const S = x.extraFilterDistance || 0;
3576
- a = Math.max(a, S), r = Math.max(r, S);
3577
- });
3578
- const o = Math.floor(n.width), h = Math.floor(n.height), u = o + 2 * a, f = h + 2 * r;
3579
- if (u < 1 || f < 1)
3580
- return;
3581
- const g = Math.floor(n.x), c = Math.floor(n.y), d = this.removeStyles(e, _t.ignoreStyles), p = s.createCanvas(u, f), y = p.getContext("2d");
3582
- s.screen.setDefaults(y), y.translate(-g + a, -c + r), e.render(y), i.forEach((x) => {
3583
- typeof x.apply == "function" && x.apply(y, 0, 0, u, f);
3584
- }), t.drawImage(p, 0, 0, u, f, g - a, c - r, u, f), this.restoreStyles(e, d);
3585
- }
3586
- render(t) {
3587
- }
3588
- constructor(...t) {
3589
- super(...t), this.type = "filter";
3590
- }
3591
- }
3592
- _t.ignoreStyles = [
3593
- "filter",
3594
- "transform",
3595
- "clip-path"
3596
- ];
3597
- class mi extends M {
3598
- apply(t, e, s, i, n) {
3599
- }
3600
- constructor(t, e, s) {
3601
- super(t, e, s), this.type = "feDropShadow", this.addStylesFromStyleDefinition();
3602
- }
3603
- }
3604
- class xi extends M {
3605
- apply(t, e, s, i, n) {
3606
- }
3607
- constructor(...t) {
3608
- super(...t), this.type = "feMorphology";
3609
- }
3610
- }
3611
- class bi extends M {
3612
- apply(t, e, s, i, n) {
3613
- }
3614
- constructor(...t) {
3615
- super(...t), this.type = "feComposite";
3616
- }
3617
- }
3618
- class vi extends M {
3619
- apply(t, e, s, i, n) {
3620
- const { document: a, blurRadius: r } = this, o = a.window ? a.window.document.body : null, h = t.canvas;
3621
- h.id = a.getUniqueId(), o && (h.style.display = "none", o.appendChild(h)), ps(h, e, s, i, n, r), o && o.removeChild(h);
3622
- }
3623
- constructor(t, e, s) {
3624
- super(t, e, s), this.type = "feGaussianBlur", this.blurRadius = Math.floor(this.getAttribute("stdDeviation").getNumber()), this.extraFilterDistance = this.blurRadius;
3625
- }
3626
- }
3627
- class Ai extends M {
3628
- constructor(...t) {
3629
- super(...t), this.type = "title";
3630
- }
3631
- }
3632
- class Si extends M {
3633
- constructor(...t) {
3634
- super(...t), this.type = "desc";
3635
- }
3636
- }
3637
- const Ti = {
3638
- svg: Tt,
3639
- rect: Qe,
3640
- circle: $s,
3641
- ellipse: Zs,
3642
- line: js,
3643
- polyline: Ge,
3644
- polygon: Ks,
3645
- path: P,
3646
- pattern: Js,
3647
- marker: ti,
3648
- defs: ei,
3649
- linearGradient: si,
3650
- radialGradient: ii,
3651
- stop: ni,
3652
- animate: ae,
3653
- animateColor: ri,
3654
- animateTransform: ai,
3655
- font: oi,
3656
- "font-face": Ze,
3657
- "missing-glyph": je,
3658
- glyph: oe,
3659
- text: ot,
3660
- tspan: Dt,
3661
- tref: hi,
3662
- a: li,
3663
- textPath: ui,
3664
- image: fi,
3665
- g: re,
3666
- symbol: gi,
3667
- style: Ke,
3668
- use: pi,
3669
- mask: Bt,
3670
- clipPath: yi,
3671
- filter: _t,
3672
- feDropShadow: mi,
3673
- feMorphology: xi,
3674
- feComposite: bi,
3675
- feColorMatrix: Je,
3676
- feGaussianBlur: vi,
3677
- title: Ai,
3678
- desc: Si
3679
- };
3680
- function wi(l, t) {
3681
- const e = document.createElement("canvas");
3682
- return e.width = l, e.height = t, e;
3683
- }
3684
- async function Ci(l) {
3685
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
3686
- const e = document.createElement("img");
3687
- return t && (e.crossOrigin = "Anonymous"), new Promise((s, i) => {
3688
- e.onload = () => {
3689
- s(e);
3690
- }, e.onerror = (n, a, r, o, h) => {
3691
- i(h);
3692
- }, e.src = l;
3693
- });
3694
- }
3695
- const ee = 12;
3696
- class at {
3697
- bindCreateImage(t, e) {
3698
- return typeof e == "boolean" ? (s, i) => t(s, typeof i == "boolean" ? i : e) : t;
3699
- }
3700
- get window() {
3701
- return this.screen.window;
3702
- }
3703
- get fetch() {
3704
- return this.screen.fetch;
3705
- }
3706
- get ctx() {
3707
- return this.screen.ctx;
3708
- }
3709
- get emSize() {
3710
- const { emSizeStack: t } = this;
3711
- return t[t.length - 1] || ee;
3712
- }
3713
- set emSize(t) {
3714
- const { emSizeStack: e } = this;
3715
- e.push(t);
3716
- }
3717
- popEmSize() {
3718
- const { emSizeStack: t } = this;
3719
- t.pop();
3720
- }
3721
- getUniqueId() {
3722
- return "canvg".concat(++this.uniqueId);
3723
- }
3724
- isImagesLoaded() {
3725
- return this.images.every(
3726
- (t) => t.loaded
3727
- );
3728
- }
3729
- isFontsLoaded() {
3730
- return this.fonts.every(
3731
- (t) => t.loaded
3732
- );
3733
- }
3734
- createDocumentElement(t) {
3735
- const e = this.createElement(t.documentElement);
3736
- return e.root = !0, e.addStylesFromStyleDefinition(), this.documentElement = e, e;
3737
- }
3738
- createElement(t) {
3739
- const e = t.nodeName.replace(/^[^:]+:/, ""), s = at.elementTypes[e];
3740
- return s ? new s(this, t) : new Hs(this, t);
3741
- }
3742
- createTextNode(t) {
3743
- return new Gs(this, t);
3744
- }
3745
- setViewBox(t) {
3746
- this.screen.setViewBox({
3747
- document: this,
3748
- ...t
3749
- });
3750
- }
3751
- constructor(t, { rootEmSize: e = ee, emSize: s = ee, createCanvas: i = at.createCanvas, createImage: n = at.createImage, anonymousCrossOrigin: a } = {}) {
3752
- this.canvg = t, this.definitions = /* @__PURE__ */ new Map(), this.styles = /* @__PURE__ */ new Map(), this.stylesSpecificity = /* @__PURE__ */ new Map(), this.images = [], this.fonts = [], this.emSizeStack = [], this.uniqueId = 0, this.screen = t.screen, this.rootEmSize = e, this.emSize = s, this.createCanvas = i, this.createImage = this.bindCreateImage(n, a), this.screen.wait(
3753
- () => this.isImagesLoaded()
3754
- ), this.screen.wait(
3755
- () => this.isFontsLoaded()
3756
- );
3757
- }
3758
- }
3759
- at.createCanvas = wi;
3760
- at.createImage = Ci;
3761
- at.elementTypes = Ti;
3762
- class At {
3763
- /**
3764
- * Create Canvg instance from SVG source string or URL.
3765
- * @param ctx - Rendering context.
3766
- * @param svg - SVG source string or URL.
3767
- * @param options - Rendering options.
3768
- * @returns Canvg instance.
3769
- */
3770
- static async from(t, e) {
3771
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3772
- const n = await new te(s).parse(e);
3773
- return new At(t, n, s);
3774
- }
3775
- /**
3776
- * Create Canvg instance from SVG source string.
3777
- * @param ctx - Rendering context.
3778
- * @param svg - SVG source string.
3779
- * @param options - Rendering options.
3780
- * @returns Canvg instance.
3781
- */
3782
- static fromString(t, e) {
3783
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3784
- const n = new te(s).parseFromString(e);
3785
- return new At(t, n, s);
3786
- }
3787
- /**
3788
- * Create new Canvg instance with inherited options.
3789
- * @param ctx - Rendering context.
3790
- * @param svg - SVG source string or URL.
3791
- * @param options - Rendering options.
3792
- * @returns Canvg instance.
3793
- */
3794
- fork(t, e) {
3795
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3796
- return At.from(t, e, {
3797
- ...this.options,
3798
- ...s
3799
- });
3800
- }
3801
- /**
3802
- * Create new Canvg instance with inherited options.
3803
- * @param ctx - Rendering context.
3804
- * @param svg - SVG source string.
3805
- * @param options - Rendering options.
3806
- * @returns Canvg instance.
3807
- */
3808
- forkString(t, e) {
3809
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3810
- return At.fromString(t, e, {
3811
- ...this.options,
3812
- ...s
3813
- });
3814
- }
3815
- /**
3816
- * Document is ready promise.
3817
- * @returns Ready promise.
3818
- */
3819
- ready() {
3820
- return this.screen.ready();
3821
- }
3822
- /**
3823
- * Document is ready value.
3824
- * @returns Is ready or not.
3825
- */
3826
- isReady() {
3827
- return this.screen.isReady();
3828
- }
3829
- /**
3830
- * Render only first frame, ignoring animations and mouse.
3831
- * @param options - Rendering options.
3832
- */
3833
- async render() {
3834
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3835
- this.start({
3836
- enableRedraw: !0,
3837
- ignoreAnimation: !0,
3838
- ignoreMouse: !0,
3839
- ...t
3840
- }), await this.ready(), this.stop();
3841
- }
3842
- /**
3843
- * Start rendering.
3844
- * @param options - Render options.
3845
- */
3846
- start() {
3847
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3848
- const { documentElement: e, screen: s, options: i } = this;
3849
- s.start(e, {
3850
- enableRedraw: !0,
3851
- ...i,
3852
- ...t
3853
- });
3854
- }
3855
- /**
3856
- * Stop rendering.
3857
- */
3858
- stop() {
3859
- this.screen.stop();
3860
- }
3861
- /**
3862
- * Resize SVG to fit in given size.
3863
- * @param width
3864
- * @param height
3865
- * @param preserveAspectRatio
3866
- */
3867
- resize(t) {
3868
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
3869
- this.documentElement.resize(t, e, s);
3870
- }
3871
- /**
3872
- * Main constructor.
3873
- * @param ctx - Rendering context.
3874
- * @param svg - SVG Document.
3875
- * @param options - Rendering options.
3876
- */
3877
- constructor(t, e, s = {}) {
3878
- this.parser = new te(s), this.screen = new it(t, s), this.options = s;
3879
- const i = new at(this, s), n = i.createDocumentElement(e);
3880
- this.document = i, this.documentElement = n;
3881
- }
3882
- }
3883
- export {
3884
- li as AElement,
3885
- ri as AnimateColorElement,
3886
- ae as AnimateElement,
3887
- ai as AnimateTransformElement,
3888
- J as BoundingBox,
3889
- Ne as CB1,
3890
- Oe as CB2,
3891
- Ve as CB3,
3892
- ke as CB4,
3893
- At as Canvg,
3894
- $s as CircleElement,
3895
- yi as ClipPathElement,
3896
- ei as DefsElement,
3897
- Si as DescElement,
3898
- at as Document,
3899
- M as Element,
3900
- Zs as EllipseElement,
3901
- Je as FeColorMatrixElement,
3902
- bi as FeCompositeElement,
3903
- mi as FeDropShadowElement,
3904
- vi as FeGaussianBlurElement,
3905
- xi as FeMorphologyElement,
3906
- _t as FilterElement,
3907
- W as Font,
3908
- oi as FontElement,
3909
- Ze as FontFaceElement,
3910
- re as GElement,
3911
- oe as GlyphElement,
3912
- $e as GradientElement,
3913
- fi as ImageElement,
3914
- js as LineElement,
3915
- si as LinearGradientElement,
3916
- ti as MarkerElement,
3917
- Bt as MaskElement,
3918
- We as Matrix,
3919
- je as MissingGlyphElement,
3920
- Rs as Mouse,
3921
- xt as PSEUDO_ZERO,
3922
- te as Parser,
3923
- P as PathElement,
3924
- w as PathParser,
3925
- Js as PatternElement,
3926
- V as Point,
3927
- Ks as PolygonElement,
3928
- Ge as PolylineElement,
3929
- A as Property,
3930
- Re as QB1,
3931
- Le as QB2,
3932
- Ie as QB3,
3933
- ii as RadialGradientElement,
3934
- Qe as RectElement,
3935
- pt as RenderedElement,
3936
- Bs as Rotate,
3937
- Tt as SVGElement,
3938
- di as SVGFontLoader,
3939
- _s as Scale,
3940
- it as Screen,
3941
- qe as Skew,
3942
- Fs as SkewX,
3943
- zs as SkewY,
3944
- ni as StopElement,
3945
- Ke as StyleElement,
3946
- gi as SymbolElement,
3947
- hi as TRefElement,
3948
- Dt as TSpanElement,
3949
- ot as TextElement,
3950
- ui as TextPathElement,
3951
- Ai as TitleElement,
3952
- dt as Transform,
3953
- Ds as Translate,
3954
- Hs as UnknownElement,
3955
- pi as UseElement,
3956
- St as ViewPort,
3957
- bt as compressSpaces,
3958
- Ti as elements,
3959
- ks as getSelectorSpecificity,
3960
- Ts as normalizeAttributeName,
3961
- ws as normalizeColor,
3962
- Xe as parseExternalUrl,
3963
- Ei as presets,
3964
- As as toMatrixValue,
3965
- $ as toNumbers,
3966
- bs as trimLeft,
3967
- vs as trimRight,
3968
- Pe as vectorMagnitude,
3969
- Me as vectorsAngle,
3970
- ne as vectorsRatio
3971
- };