dsh-visualkit 0.0.0-stage → 0.0.2

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 (283) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/LICENSE +26 -0
  3. package/README.md +443 -2
  4. package/THIRD_PARTY.md +55 -0
  5. package/cordis.patch.yml +29 -0
  6. package/data/assets/README.md +38 -0
  7. package/data/assets/icons/brands/bilibili.svg +1 -0
  8. package/data/assets/icons/brands/discord.svg +1 -0
  9. package/data/assets/icons/brands/neteasecloudmusic.svg +1 -0
  10. package/data/assets/icons/brands/qq.svg +1 -0
  11. package/data/assets/icons/brands/sinaweibo.svg +1 -0
  12. package/data/assets/icons/brands/steam.svg +1 -0
  13. package/data/assets/icons/brands/telegram.svg +1 -0
  14. package/data/assets/icons/brands/tiktok.svg +1 -0
  15. package/data/assets/icons/brands/twitch.svg +1 -0
  16. package/data/assets/icons/brands/wechat.svg +1 -0
  17. package/data/assets/icons/brands/x.svg +1 -0
  18. package/data/assets/icons/brands/youtube.svg +1 -0
  19. package/data/assets/icons/lucide/bell.svg +1 -0
  20. package/data/assets/icons/lucide/calendar.svg +1 -0
  21. package/data/assets/icons/lucide/clock.svg +1 -0
  22. package/data/assets/icons/lucide/gamepad-2.svg +1 -0
  23. package/data/assets/icons/lucide/gift.svg +1 -0
  24. package/data/assets/icons/lucide/heart.svg +1 -0
  25. package/data/assets/icons/lucide/mic.svg +1 -0
  26. package/data/assets/icons/lucide/play.svg +1 -0
  27. package/data/assets/icons/lucide/star.svg +1 -0
  28. package/data/assets/icons/lucide/video.svg +1 -0
  29. package/data/assets/icons/phosphor/LICENSE +21 -0
  30. package/data/assets/icons/phosphor/atom-duotone.svg +1 -0
  31. package/data/assets/icons/phosphor/binary-duotone.svg +1 -0
  32. package/data/assets/icons/phosphor/blueprint-duotone.svg +1 -0
  33. package/data/assets/icons/phosphor/circuitry-duotone.svg +1 -0
  34. package/data/assets/icons/phosphor/cloud-arrow-up-duotone.svg +1 -0
  35. package/data/assets/icons/phosphor/code-duotone.svg +1 -0
  36. package/data/assets/icons/phosphor/compass-duotone.svg +1 -0
  37. package/data/assets/icons/phosphor/cpu-duotone.svg +1 -0
  38. package/data/assets/icons/phosphor/cube-duotone.svg +1 -0
  39. package/data/assets/icons/phosphor/database-duotone.svg +1 -0
  40. package/data/assets/icons/phosphor/flask-duotone.svg +1 -0
  41. package/data/assets/icons/phosphor/frame-corners-duotone.svg +1 -0
  42. package/data/assets/icons/phosphor/function-duotone.svg +1 -0
  43. package/data/assets/icons/phosphor/hard-drives-duotone.svg +1 -0
  44. package/data/assets/icons/phosphor/hexagon-duotone.svg +1 -0
  45. package/data/assets/icons/phosphor/infinity-duotone.svg +1 -0
  46. package/data/assets/icons/phosphor/lightning-duotone.svg +1 -0
  47. package/data/assets/icons/phosphor/magic-wand-duotone.svg +1 -0
  48. package/data/assets/icons/phosphor/moon-stars-duotone.svg +1 -0
  49. package/data/assets/icons/phosphor/paint-brush-duotone.svg +1 -0
  50. package/data/assets/icons/phosphor/pen-nib-duotone.svg +1 -0
  51. package/data/assets/icons/phosphor/planet-duotone.svg +1 -0
  52. package/data/assets/icons/phosphor/rocket-launch-duotone.svg +1 -0
  53. package/data/assets/icons/phosphor/ruler-duotone.svg +1 -0
  54. package/data/assets/icons/phosphor/selection-plus-duotone.svg +1 -0
  55. package/data/assets/icons/phosphor/shapes-duotone.svg +1 -0
  56. package/data/assets/icons/phosphor/sparkle-duotone.svg +1 -0
  57. package/data/assets/icons/phosphor/sun-horizon-duotone.svg +1 -0
  58. package/data/assets/icons/phosphor/terminal-window-duotone.svg +1 -0
  59. package/data/assets/icons/phosphor/triangle-duotone.svg +1 -0
  60. package/data/assets/icons/phosphor/waveform-duotone.svg +1 -0
  61. package/data/assets/icons/tabler/alarm.svg +1 -0
  62. package/data/assets/icons/tabler/badge-ad.svg +1 -0
  63. package/data/assets/icons/tabler/bell.svg +1 -0
  64. package/data/assets/icons/tabler/bolt.svg +1 -0
  65. package/data/assets/icons/tabler/brand-bilibili.svg +1 -0
  66. package/data/assets/icons/tabler/brand-discord.svg +1 -0
  67. package/data/assets/icons/tabler/brand-qq.svg +1 -0
  68. package/data/assets/icons/tabler/brand-twitch.svg +1 -0
  69. package/data/assets/icons/tabler/brand-wechat.svg +1 -0
  70. package/data/assets/icons/tabler/brand-weibo.svg +1 -0
  71. package/data/assets/icons/tabler/brand-youtube.svg +1 -0
  72. package/data/assets/icons/tabler/broadcast.svg +1 -0
  73. package/data/assets/icons/tabler/calendar-event.svg +1 -0
  74. package/data/assets/icons/tabler/calendar-week.svg +1 -0
  75. package/data/assets/icons/tabler/clock-hour-3.svg +1 -0
  76. package/data/assets/icons/tabler/coin.svg +1 -0
  77. package/data/assets/icons/tabler/crown.svg +1 -0
  78. package/data/assets/icons/tabler/currency-yen.svg +1 -0
  79. package/data/assets/icons/tabler/device-gamepad-2.svg +1 -0
  80. package/data/assets/icons/tabler/diamond.svg +1 -0
  81. package/data/assets/icons/tabler/flame.svg +1 -0
  82. package/data/assets/icons/tabler/gift.svg +1 -0
  83. package/data/assets/icons/tabler/headphones.svg +1 -0
  84. package/data/assets/icons/tabler/heart-filled.svg +1 -0
  85. package/data/assets/icons/tabler/heart.svg +1 -0
  86. package/data/assets/icons/tabler/live-view.svg +1 -0
  87. package/data/assets/icons/tabler/microphone.svg +1 -0
  88. package/data/assets/icons/tabler/mood-smile.svg +1 -0
  89. package/data/assets/icons/tabler/mood-tongue.svg +1 -0
  90. package/data/assets/icons/tabler/movie.svg +1 -0
  91. package/data/assets/icons/tabler/player-play.svg +1 -0
  92. package/data/assets/icons/tabler/playlist.svg +1 -0
  93. package/data/assets/icons/tabler/rocket.svg +1 -0
  94. package/data/assets/icons/tabler/sparkles.svg +1 -0
  95. package/data/assets/icons/tabler/star-filled.svg +1 -0
  96. package/data/assets/icons/tabler/star.svg +1 -0
  97. package/data/assets/icons/tabler/tag.svg +1 -0
  98. package/data/assets/icons/tabler/thumb-up.svg +1 -0
  99. package/data/assets/icons/tabler/ticket.svg +1 -0
  100. package/data/assets/icons/tabler/video.svg +1 -0
  101. package/data/assets/illustrations/openpeeps/LICENSE +8 -0
  102. package/data/assets/illustrations/openpeeps/peep-10.svg +29 -0
  103. package/data/assets/illustrations/openpeeps/peep-100.svg +32 -0
  104. package/data/assets/illustrations/openpeeps/peep-101.svg +25 -0
  105. package/data/assets/illustrations/openpeeps/peep-102.svg +28 -0
  106. package/data/assets/illustrations/openpeeps/peep-103.svg +32 -0
  107. package/data/assets/illustrations/openpeeps/peep-105.svg +25 -0
  108. package/data/assets/illustrations/openpeeps/peep-12.svg +29 -0
  109. package/data/assets/illustrations/openpeeps/peep-13.svg +27 -0
  110. package/data/assets/illustrations/openpeeps/peep-16.svg +27 -0
  111. package/data/assets/illustrations/openpeeps/peep-17.svg +31 -0
  112. package/data/assets/illustrations/openpeeps/peep-22.svg +29 -0
  113. package/data/assets/illustrations/openpeeps/peep-25.svg +29 -0
  114. package/data/assets/illustrations/openpeeps/peep-26.svg +29 -0
  115. package/data/assets/illustrations/openpeeps/peep-27.svg +29 -0
  116. package/data/assets/illustrations/openpeeps/peep-30.svg +29 -0
  117. package/data/assets/illustrations/openpeeps/peep-31.svg +27 -0
  118. package/data/assets/illustrations/openpeeps/peep-34.svg +29 -0
  119. package/data/assets/illustrations/openpeeps/peep-38.svg +29 -0
  120. package/data/assets/illustrations/openpeeps/peep-39.svg +31 -0
  121. package/data/assets/illustrations/openpeeps/peep-4.svg +29 -0
  122. package/data/assets/illustrations/openpeeps/peep-41.svg +29 -0
  123. package/data/assets/illustrations/openpeeps/peep-44.svg +29 -0
  124. package/data/assets/illustrations/openpeeps/peep-47.svg +26 -0
  125. package/data/assets/illustrations/openpeeps/peep-48.svg +29 -0
  126. package/data/assets/illustrations/openpeeps/peep-50.svg +31 -0
  127. package/data/assets/illustrations/openpeeps/peep-51.svg +29 -0
  128. package/data/assets/illustrations/openpeeps/peep-53.svg +27 -0
  129. package/data/assets/illustrations/openpeeps/peep-54.svg +26 -0
  130. package/data/assets/illustrations/openpeeps/peep-55.svg +29 -0
  131. package/data/assets/illustrations/openpeeps/peep-56.svg +27 -0
  132. package/data/assets/illustrations/openpeeps/peep-58.svg +29 -0
  133. package/data/assets/illustrations/openpeeps/peep-61.svg +27 -0
  134. package/data/assets/illustrations/openpeeps/peep-64.svg +27 -0
  135. package/data/assets/illustrations/openpeeps/peep-68.svg +27 -0
  136. package/data/assets/illustrations/openpeeps/peep-69.svg +27 -0
  137. package/data/assets/illustrations/openpeeps/peep-7.svg +31 -0
  138. package/data/assets/illustrations/openpeeps/peep-72.svg +29 -0
  139. package/data/assets/illustrations/openpeeps/peep-76.svg +31 -0
  140. package/data/assets/illustrations/openpeeps/peep-77.svg +27 -0
  141. package/data/assets/illustrations/openpeeps/peep-80.svg +27 -0
  142. package/data/assets/illustrations/openpeeps/peep-81.svg +29 -0
  143. package/data/assets/illustrations/openpeeps/peep-83.svg +29 -0
  144. package/data/assets/manifest.json +1 -0
  145. package/data/assets/parts//342/206/223/346/212/225/345/275/261.png +0 -0
  146. package/data/assets/parts//344/270/211/350/247/222/345/217/221/345/244/2711.png +0 -0
  147. package/data/assets/parts//344/270/211/350/247/222/345/217/221/345/244/2712.png +0 -0
  148. package/data/assets/parts//344/270/211/350/247/222/345/217/221/345/244/2713.png +0 -0
  149. package/data/assets/parts//344/270/211/350/247/222/345/217/221/345/244/2714.png +0 -0
  150. package/data/assets/parts//345/217/214/351/251/254/345/260/276.png +0 -0
  151. package/data/assets/parts//345/217/214/351/251/254/345/260/2761.png +0 -0
  152. package/data/assets/parts//345/217/2211.png +0 -0
  153. package/data/assets/parts//345/217/2212.png +0 -0
  154. package/data/assets/parts//345/217/2213.png +0 -0
  155. package/data/assets/parts//345/217/221/345/234/210.png +0 -0
  156. package/data/assets/parts//345/217/221/345/244/2711.png +0 -0
  157. package/data/assets/parts//345/217/221/345/244/2712.png +0 -0
  158. package/data/assets/parts//345/217/243/346/260/264/345/267/276/345/211/215.png +0 -0
  159. package/data/assets/parts//345/217/243/346/260/264/345/267/276/345/220/216.png +0 -0
  160. package/data/assets/parts//345/217/263/344/270/212/347/234/274/347/235/221.png +0 -0
  161. package/data/assets/parts//345/217/263/346/211/213.png +0 -0
  162. package/data/assets/parts//345/217/263/346/211/2131.png +0 -0
  163. package/data/assets/parts//345/217/263/347/234/274/347/220/203.png +0 -0
  164. package/data/assets/parts//345/217/263/347/234/274/347/231/275.png +0 -0
  165. package/data/assets/parts//345/217/263/350/205/277.png +0 -0
  166. package/data/assets/parts//345/221/206/346/257/233.png +0 -0
  167. package/data/assets/parts//345/230/264/345/267/264.png +0 -0
  168. package/data/assets/parts//345/260/276/345/267/264.png +0 -0
  169. package/data/assets/parts//345/267/246/344/270/212/347/234/274/347/235/221.png +0 -0
  170. package/data/assets/parts//345/267/246/345/217/214/347/234/274/347/232/256.png +0 -0
  171. package/data/assets/parts//345/267/246/346/211/213.png +0 -0
  172. package/data/assets/parts//345/267/246/346/211/2131.png +0 -0
  173. package/data/assets/parts//345/267/246/347/234/274/347/220/203.png +0 -0
  174. package/data/assets/parts//345/267/246/347/234/274/347/231/275.png +0 -0
  175. package/data/assets/parts//345/267/246/350/205/277.png +0 -0
  176. package/data/assets/parts//346/212/225/345/275/261.png +0 -0
  177. package/data/assets/parts//347/234/211/346/257/233.png +0 -0
  178. package/data/assets/parts//347/234/274/347/275/251.png +0 -0
  179. package/data/assets/parts//350/200/263/346/234/2651.png +0 -0
  180. package/data/assets/parts//350/200/263/346/234/2652.png +0 -0
  181. package/data/assets/parts//350/204/221/345/243/263.png +0 -0
  182. package/data/assets/parts//350/241/243/346/234/215/345/211/215.png +0 -0
  183. package/data/assets/parts//350/241/243/346/234/215/345/220/216.png +0 -0
  184. package/data/assets/parts//350/241/243/346/234/215/351/273/221.png +0 -0
  185. package/data/assets/parts//350/241/243/346/234/215/351/273/2211.png +0 -0
  186. package/data/assets/parts//350/272/253/344/275/223.png +0 -0
  187. package/data/assets/parts//351/223/201/346/235/277.png +0 -0
  188. package/data/assets/parts//351/273/221/347/234/274/345/234/210.png +0 -0
  189. package/data/assets/parts//351/273/221/347/234/274/345/234/2102.png +0 -0
  190. package/data/assets/patterns/checker.svg +1 -0
  191. package/data/assets/patterns/circles-overlap.svg +1 -0
  192. package/data/assets/patterns/crosshatch.svg +1 -0
  193. package/data/assets/patterns/diagonal.svg +1 -0
  194. package/data/assets/patterns/dots.svg +1 -0
  195. package/data/assets/patterns/grid.svg +1 -0
  196. package/data/assets/patterns/halftone.svg +1 -0
  197. package/data/assets/patterns/plus.svg +1 -0
  198. package/data/assets/patterns/scales.svg +1 -0
  199. package/data/assets/patterns/triangles.svg +1 -0
  200. package/data/assets/patterns/waves.svg +1 -0
  201. package/data/assets/patterns/zigzag.svg +1 -0
  202. package/data/assets/stickers/openmoji/1F375.svg +12 -0
  203. package/data/assets/stickers/openmoji/1F9E8.svg +21 -0
  204. package/data/assets/stickers/twemoji/1f389.svg +1 -0
  205. package/data/assets/stickers/twemoji/1f3a4.svg +1 -0
  206. package/data/assets/stickers/twemoji/1f3a7.svg +1 -0
  207. package/data/assets/stickers/twemoji/1f3ae.svg +1 -0
  208. package/data/assets/stickers/twemoji/1f44b.svg +1 -0
  209. package/data/assets/stickers/twemoji/1f44d.svg +1 -0
  210. package/data/assets/stickers/twemoji/1f494.svg +1 -0
  211. package/data/assets/stickers/twemoji/1f4a2.svg +1 -0
  212. package/data/assets/stickers/twemoji/1f4a8.svg +1 -0
  213. package/data/assets/stickers/twemoji/1f4b5.svg +1 -0
  214. package/data/assets/stickers/twemoji/1f4d6.svg +1 -0
  215. package/data/assets/stickers/twemoji/1f525.svg +1 -0
  216. package/data/assets/stickers/twemoji/1f600.svg +1 -0
  217. package/data/assets/stickers/twemoji/1f602.svg +1 -0
  218. package/data/assets/stickers/twemoji/1f60d.svg +1 -0
  219. package/data/assets/stickers/twemoji/1f62d.svg +1 -0
  220. package/data/assets/stickers/twemoji/1f680.svg +1 -0
  221. package/data/assets/stickers/twemoji/1f979.svg +1 -0
  222. package/data/assets/stickers/twemoji/1f97a.svg +1 -0
  223. package/data/assets/stickers/twemoji/26a1.svg +1 -0
  224. package/data/assets/stickers/twemoji/2705.svg +1 -0
  225. package/data/assets/stickers/twemoji/274c.svg +1 -0
  226. package/data/assets/stickers/twemoji/2764.svg +1 -0
  227. package/data/assets/stickers/twemoji/2b50.svg +1 -0
  228. package/data/assets/stickers/twemoji_1f525.svg +1 -0
  229. package/data/assets/stickers/twemoji_1f600.svg +1 -0
  230. package/data/assets/stickers/twemoji_1f979.svg +1 -0
  231. package/data/assets/stickers/twemoji_2764.svg +1 -0
  232. package/data/assets/textures/grain-dark.png +0 -0
  233. package/data/assets/textures/grain-light.png +0 -0
  234. package/data/assets/textures/grain-warm.png +0 -0
  235. package/data/lucide-icons.json +1 -0
  236. package/data/packs/tabler.icons.json +1 -0
  237. package/icon.svg +26 -0
  238. package/lib/assets.js +228 -0
  239. package/lib/audit.js +284 -0
  240. package/lib/contrast-render.js +213 -0
  241. package/lib/css-rewrite.js +379 -0
  242. package/lib/detect.js +701 -0
  243. package/lib/diff.js +153 -0
  244. package/lib/emit.js +557 -0
  245. package/lib/html-context.js +315 -0
  246. package/lib/icon-render.js +107 -0
  247. package/lib/icondb.js +402 -0
  248. package/lib/image-normalize.js +140 -0
  249. package/lib/index.js +1289 -0
  250. package/lib/layouts/common.js +48 -0
  251. package/lib/layouts/image.js +1010 -0
  252. package/lib/layouts/index.js +10 -0
  253. package/lib/layouts/intent.js +66 -0
  254. package/lib/layouts/metrics-text.js +91 -0
  255. package/lib/layouts/png.js +75 -0
  256. package/lib/layouts/rules-contrast.js +575 -0
  257. package/lib/layouts/rules-punct.js +486 -0
  258. package/lib/layouts/rules-structure.js +182 -0
  259. package/lib/layouts/source.js +1961 -0
  260. package/lib/layouts/svg.js +1204 -0
  261. package/lib/morphcore.js +139 -0
  262. package/lib/preview.js +225 -0
  263. package/lib/render-html.js +255 -0
  264. package/lib/render.js +486 -0
  265. package/lib/rules.js +267 -0
  266. package/lib/shadow.js +83 -0
  267. package/lib/skip.js +56 -0
  268. package/lib/style.js +688 -0
  269. package/lib/svg.js +729 -0
  270. package/lib/taste-image.js +323 -0
  271. package/lib/taste.js +219 -0
  272. package/locale/en.json +6 -0
  273. package/locale/zh.json +6 -0
  274. package/package.json +92 -4
  275. package/vendor/morphicons-adapters.iife.js +903 -0
  276. package/vendor/morphicons.iife.js +2441 -0
  277. package/vendor/resvg/LICENSE +373 -0
  278. package/vendor/resvg/index.d.ts +98 -0
  279. package/vendor/resvg/index.js +23 -0
  280. package/vendor/resvg/js-binding.d.ts +52 -0
  281. package/vendor/resvg/js-binding.js +1 -0
  282. package/vendor/resvg/package.json +138 -0
  283. package/vendor/resvg/resvgjs.win32-x64-msvc.node +0 -0
@@ -0,0 +1,903 @@
1
+ /*!
2
+ * morphicons adapters v2.0.2(svgToIcon + fitIcon)— vendored 产物(非手写)
3
+ * License: MIT © Guillermo (guillermolg.com)
4
+ * 构建(2026-11-07):
5
+ * npm install morphicons@2.0.2 esbuild
6
+ * entry.mjs: export { svgToIcon, canvasTarget, maskTarget } from "morphicons/adapters"; export { fitIcon } from "morphicons";
7
+ * npx esbuild entry.mjs --bundle --format=iife --global-name=MorphIconsAdapters --outfile=vendor/morphicons-adapters.iife.js
8
+ * 说明:2.0 把 fitIcon 移到核心导出,adapters 子路径只有 svgToIcon/canvasTarget/maskTarget;
9
+ * 为保持 uilab 侧「adapters = svgToIcon + fitIcon」的既有装载契约,entry 里一并再导出 fitIcon。
10
+ */
11
+ var MorphIconsAdapters = (() => {
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // adapters-entry.mjs
31
+ var adapters_entry_exports = {};
32
+ __export(adapters_entry_exports, {
33
+ canvasTarget: () => canvasTarget,
34
+ fitIcon: () => fitIcon,
35
+ maskTarget: () => maskTarget,
36
+ svgToIcon: () => svgToIcon
37
+ });
38
+
39
+ // node_modules/morphicons/dist/normalize-CYnN3Npw.js
40
+ var COMMANDS = "MmLlHhVvCcSsQqTtAaZz";
41
+ function parsePath(d) {
42
+ const subs = [];
43
+ const n = d.length;
44
+ let i = 0;
45
+ let cx = 0;
46
+ let cy = 0;
47
+ let sx = 0;
48
+ let sy = 0;
49
+ let cur = null;
50
+ let cmd = "";
51
+ let px = 0;
52
+ let py = 0;
53
+ let prev = "";
54
+ let started = false;
55
+ const err = (msg) => {
56
+ throw new Error(`morphicons: ${msg} at d[${i}]`);
57
+ };
58
+ const isDigit = (c) => c >= 48 && c <= 57;
59
+ const skip = () => {
60
+ while (i < n) {
61
+ const c = d.charCodeAt(i);
62
+ if (c === 32 || c === 9 || c === 10 || c === 13 || c === 12 || c === 44) i++;
63
+ else break;
64
+ }
65
+ };
66
+ const num = () => {
67
+ skip();
68
+ const start = i;
69
+ if (i < n && (d[i] === "+" || d[i] === "-")) i++;
70
+ let dig = false;
71
+ while (i < n && isDigit(d.charCodeAt(i))) {
72
+ i++;
73
+ dig = true;
74
+ }
75
+ if (i < n && d[i] === ".") {
76
+ i++;
77
+ while (i < n && isDigit(d.charCodeAt(i))) {
78
+ i++;
79
+ dig = true;
80
+ }
81
+ }
82
+ if (!dig) err("expected number");
83
+ if (i < n && (d[i] === "e" || d[i] === "E")) {
84
+ const save = i;
85
+ i++;
86
+ if (i < n && (d[i] === "+" || d[i] === "-")) i++;
87
+ let ed = false;
88
+ while (i < n && isDigit(d.charCodeAt(i))) {
89
+ i++;
90
+ ed = true;
91
+ }
92
+ if (!ed) i = save;
93
+ }
94
+ return Number(d.slice(start, i));
95
+ };
96
+ const flag = () => {
97
+ skip();
98
+ const c = d[i];
99
+ if (c === "0" || c === "1") {
100
+ i++;
101
+ return c === "1" ? 1 : 0;
102
+ }
103
+ return err("expected arc flag (0|1)");
104
+ };
105
+ const open = () => {
106
+ if (!started) err("path must start with M/m");
107
+ if (!cur) {
108
+ cur = {
109
+ x0: cx,
110
+ y0: cy,
111
+ segs: [],
112
+ closed: false
113
+ };
114
+ subs.push(cur);
115
+ }
116
+ return cur;
117
+ };
118
+ let rel = false;
119
+ const nx = () => num() + (rel ? cx : 0);
120
+ const ny = () => num() + (rel ? cy : 0);
121
+ while (true) {
122
+ skip();
123
+ if (i >= n) break;
124
+ const ch = d[i];
125
+ if (COMMANDS.includes(ch)) {
126
+ cmd = ch;
127
+ i++;
128
+ } else if (cmd === "") err("path must start with M/m");
129
+ else if (cmd === "M") cmd = "L";
130
+ else if (cmd === "m") cmd = "l";
131
+ else if (cmd === "Z" || cmd === "z") err("stray data after Z");
132
+ rel = cmd >= "a";
133
+ switch (rel ? cmd.toUpperCase() : cmd) {
134
+ case "M": {
135
+ started = true;
136
+ const x = nx();
137
+ const y = ny();
138
+ cx = x;
139
+ cy = y;
140
+ sx = x;
141
+ sy = y;
142
+ cur = {
143
+ x0: x,
144
+ y0: y,
145
+ segs: [],
146
+ closed: false
147
+ };
148
+ subs.push(cur);
149
+ prev = "";
150
+ break;
151
+ }
152
+ case "L": {
153
+ const x = nx();
154
+ const y = ny();
155
+ open().segs.push([
156
+ "L",
157
+ x,
158
+ y
159
+ ]);
160
+ cx = x;
161
+ cy = y;
162
+ prev = "";
163
+ break;
164
+ }
165
+ case "H": {
166
+ const x = nx();
167
+ open().segs.push([
168
+ "L",
169
+ x,
170
+ cy
171
+ ]);
172
+ cx = x;
173
+ prev = "";
174
+ break;
175
+ }
176
+ case "V": {
177
+ const y = ny();
178
+ open().segs.push([
179
+ "L",
180
+ cx,
181
+ y
182
+ ]);
183
+ cy = y;
184
+ prev = "";
185
+ break;
186
+ }
187
+ case "C":
188
+ case "S": {
189
+ let x1;
190
+ let y1;
191
+ if (cmd === "C" || cmd === "c") {
192
+ x1 = nx();
193
+ y1 = ny();
194
+ } else {
195
+ x1 = prev === "C" ? 2 * cx - px : cx;
196
+ y1 = prev === "C" ? 2 * cy - py : cy;
197
+ }
198
+ const x2 = nx();
199
+ const y2 = ny();
200
+ const x = nx();
201
+ const y = ny();
202
+ open().segs.push([
203
+ "C",
204
+ x1,
205
+ y1,
206
+ x2,
207
+ y2,
208
+ x,
209
+ y
210
+ ]);
211
+ px = x2;
212
+ py = y2;
213
+ cx = x;
214
+ cy = y;
215
+ prev = "C";
216
+ break;
217
+ }
218
+ case "Q":
219
+ case "T": {
220
+ let x1;
221
+ let y1;
222
+ if (cmd === "Q" || cmd === "q") {
223
+ x1 = nx();
224
+ y1 = ny();
225
+ } else {
226
+ x1 = prev === "Q" ? 2 * cx - px : cx;
227
+ y1 = prev === "Q" ? 2 * cy - py : cy;
228
+ }
229
+ const x = nx();
230
+ const y = ny();
231
+ open().segs.push([
232
+ "Q",
233
+ x1,
234
+ y1,
235
+ x,
236
+ y
237
+ ]);
238
+ px = x1;
239
+ py = y1;
240
+ cx = x;
241
+ cy = y;
242
+ prev = "Q";
243
+ break;
244
+ }
245
+ case "A": {
246
+ const rx = num();
247
+ const ry = num();
248
+ const rot = num();
249
+ const large = flag();
250
+ const sweep = flag();
251
+ const x = nx();
252
+ const y = ny();
253
+ open().segs.push([
254
+ "A",
255
+ rx,
256
+ ry,
257
+ rot,
258
+ large,
259
+ sweep,
260
+ x,
261
+ y
262
+ ]);
263
+ cx = x;
264
+ cy = y;
265
+ prev = "";
266
+ break;
267
+ }
268
+ case "Z":
269
+ if (cur) {
270
+ cur.closed = true;
271
+ cur = null;
272
+ }
273
+ cx = sx;
274
+ cy = sy;
275
+ prev = "";
276
+ break;
277
+ default:
278
+ err(`unsupported command "${cmd}"`);
279
+ }
280
+ }
281
+ return subs.filter((s) => s.segs.length > 0);
282
+ }
283
+ function fmtCanon(v) {
284
+ return String(Math.round(v * 1e4) / 1e4);
285
+ }
286
+ function cubicsToPathD(paths) {
287
+ let d = "";
288
+ for (const { pts, closed } of paths) {
289
+ d += `M${fmtCanon(pts[0])} ${fmtCanon(pts[1])}`;
290
+ for (let i = 2; i < pts.length; i += 6) d += `C${fmtCanon(pts[i])} ${fmtCanon(pts[i + 1])} ${fmtCanon(pts[i + 2])} ${fmtCanon(pts[i + 3])} ${fmtCanon(pts[i + 4])} ${fmtCanon(pts[i + 5])}`;
291
+ if (closed) d += "Z";
292
+ }
293
+ return d;
294
+ }
295
+ var KAPPA = 4 / 3 * Math.tan(Math.PI / 8);
296
+ var TAU = 2 * Math.PI;
297
+ function builder(x0, y0) {
298
+ const pts = [x0, y0];
299
+ let cx = x0;
300
+ let cy = y0;
301
+ const cubic = (x1, y1, x2, y2, x, y) => {
302
+ pts.push(x1, y1, x2, y2, x, y);
303
+ cx = x;
304
+ cy = y;
305
+ };
306
+ const line = (x, y) => {
307
+ if (Math.abs(x - cx) < 1e-12 && Math.abs(y - cy) < 1e-12) return;
308
+ cubic(cx + (x - cx) / 3, cy + (y - cy) / 3, cx + 2 * (x - cx) / 3, cy + 2 * (y - cy) / 3, x, y);
309
+ };
310
+ const quad = (x1, y1, x, y) => {
311
+ cubic(cx + 2 / 3 * (x1 - cx), cy + 2 / 3 * (y1 - cy), x + 2 / 3 * (x1 - x), y + 2 / 3 * (y1 - y), x, y);
312
+ };
313
+ const arc = (rx0, ry0, rotDeg, large, sweep, x, y) => {
314
+ const x1 = cx;
315
+ const y1 = cy;
316
+ if (Math.abs(x - x1) < 1e-12 && Math.abs(y - y1) < 1e-12) return;
317
+ let rx = Math.abs(rx0);
318
+ let ry = Math.abs(ry0);
319
+ if (rx < 1e-12 || ry < 1e-12) {
320
+ line(x, y);
321
+ return;
322
+ }
323
+ const phi = rotDeg * Math.PI / 180;
324
+ const cosP = Math.cos(phi);
325
+ const sinP = Math.sin(phi);
326
+ const hx = (x1 - x) / 2;
327
+ const hy = (y1 - y) / 2;
328
+ const x1p = cosP * hx + sinP * hy;
329
+ const y1p = -sinP * hx + cosP * hy;
330
+ const lam = x1p * x1p / (rx * rx) + y1p * y1p / (ry * ry);
331
+ if (lam > 1) {
332
+ const s = Math.sqrt(lam);
333
+ rx *= s;
334
+ ry *= s;
335
+ }
336
+ const rx2 = rx * rx;
337
+ const ry2 = ry * ry;
338
+ const xp2 = x1p * x1p;
339
+ const yp2 = y1p * y1p;
340
+ let rad = (rx2 * ry2 - rx2 * yp2 - ry2 * xp2) / (rx2 * yp2 + ry2 * xp2);
341
+ if (rad < 0) rad = 0;
342
+ const co = (large === sweep ? -1 : 1) * Math.sqrt(rad);
343
+ const cxp = co * rx * y1p / ry;
344
+ const cyp = -co * ry * x1p / rx;
345
+ const ccx = cosP * cxp - sinP * cyp + (x1 + x) / 2;
346
+ const ccy = sinP * cxp + cosP * cyp + (y1 + y) / 2;
347
+ const th1 = Math.atan2((y1p - cyp) / ry, (x1p - cxp) / rx);
348
+ let dth = Math.atan2((-y1p - cyp) / ry, (-x1p - cxp) / rx) - th1;
349
+ if (sweep === 0 && dth > 0) dth -= TAU;
350
+ else if (sweep === 1 && dth < 0) dth += TAU;
351
+ const slices = Math.max(1, Math.ceil(Math.abs(dth) / (Math.PI / 2) - 1e-9));
352
+ const delta = dth / slices;
353
+ const alpha = 4 / 3 * Math.tan(delta / 4);
354
+ const ex = (t) => ccx + rx * Math.cos(t) * cosP - ry * Math.sin(t) * sinP;
355
+ const ey = (t) => ccy + rx * Math.cos(t) * sinP + ry * Math.sin(t) * cosP;
356
+ const dx = (t) => -rx * Math.sin(t) * cosP - ry * Math.cos(t) * sinP;
357
+ const dy = (t) => -rx * Math.sin(t) * sinP + ry * Math.cos(t) * cosP;
358
+ let t0 = th1;
359
+ let p0x = x1;
360
+ let p0y = y1;
361
+ for (let s = 1; s <= slices; s++) {
362
+ const t1 = th1 + delta * s;
363
+ const p1x = s === slices ? x : ex(t1);
364
+ const p1y = s === slices ? y : ey(t1);
365
+ cubic(p0x + alpha * dx(t0), p0y + alpha * dy(t0), p1x - alpha * dx(t1), p1y - alpha * dy(t1), p1x, p1y);
366
+ t0 = t1;
367
+ p0x = p1x;
368
+ p0y = p1y;
369
+ }
370
+ };
371
+ const finish = (closed) => {
372
+ if (closed) line(pts[0], pts[1]);
373
+ if (pts.length < 8) return null;
374
+ return {
375
+ pts: Float64Array.from(pts),
376
+ closed
377
+ };
378
+ };
379
+ return [
380
+ cubic,
381
+ line,
382
+ quad,
383
+ arc,
384
+ finish
385
+ ];
386
+ }
387
+ function lowerSubpath(raw) {
388
+ const [cubic, line, quad, arc, finish] = builder(raw.x0, raw.y0);
389
+ for (const s of raw.segs) switch (s[0]) {
390
+ case "L":
391
+ line(s[1], s[2]);
392
+ break;
393
+ case "C":
394
+ cubic(s[1], s[2], s[3], s[4], s[5], s[6]);
395
+ break;
396
+ case "Q":
397
+ quad(s[1], s[2], s[3], s[4]);
398
+ break;
399
+ case "A":
400
+ arc(s[1], s[2], s[3], s[4], s[5], s[6], s[7]);
401
+ }
402
+ return finish(raw.closed);
403
+ }
404
+ function attrNum(attrs, key, fallback = 0) {
405
+ const v = attrs[key];
406
+ if (v === void 0) return fallback;
407
+ const x = typeof v === "number" ? v : Number(v);
408
+ return Number.isFinite(x) ? x : fallback;
409
+ }
410
+ function parsePoints(v) {
411
+ const s = String(v ?? "").trim();
412
+ if (!s) return [];
413
+ const nums = s.split(/[\s,]+/).map(Number);
414
+ if (nums.some((x) => !Number.isFinite(x))) throw new Error(`morphicons: invalid points: "${s}"`);
415
+ return nums;
416
+ }
417
+ function polyPath(nums, closed) {
418
+ if (nums.length < 4) return null;
419
+ const [, line, , , finish] = builder(nums[0], nums[1]);
420
+ for (let i = 2; i + 1 < nums.length; i += 2) line(nums[i], nums[i + 1]);
421
+ return finish(closed);
422
+ }
423
+ function ellipsePath(cx, cy, rx, ry) {
424
+ if (rx < 1e-12 || ry < 1e-12) return null;
425
+ const kx = KAPPA * rx;
426
+ const ky = KAPPA * ry;
427
+ const e = cx + rx;
428
+ const w = cx - rx;
429
+ const s = cy + ry;
430
+ const n = cy - ry;
431
+ const [cubic, , , , finish] = builder(e, cy);
432
+ cubic(e, cy + ky, cx + kx, s, cx, s);
433
+ cubic(cx - kx, s, w, cy + ky, w, cy);
434
+ cubic(w, cy - ky, cx - kx, n, cx, n);
435
+ cubic(cx + kx, n, e, cy - ky, e, cy);
436
+ return finish(true);
437
+ }
438
+ function rectPath(attrs) {
439
+ const x = attrNum(attrs, "x");
440
+ const y = attrNum(attrs, "y");
441
+ const w = attrNum(attrs, "width");
442
+ const h = attrNum(attrs, "height");
443
+ if (w < 1e-12 || h < 1e-12) return null;
444
+ let rx = attrNum(attrs, "rx", NaN);
445
+ let ry = attrNum(attrs, "ry", NaN);
446
+ if (Number.isNaN(rx)) rx = Number.isNaN(ry) ? 0 : ry;
447
+ if (Number.isNaN(ry)) ry = rx;
448
+ rx = Math.min(Math.max(rx, 0), w / 2);
449
+ ry = Math.min(Math.max(ry, 0), h / 2);
450
+ if (rx < 1e-12 || ry < 1e-12) return polyPath([
451
+ x,
452
+ y,
453
+ x + w,
454
+ y,
455
+ x + w,
456
+ y + h,
457
+ x,
458
+ y + h
459
+ ], true);
460
+ const xa = x + rx;
461
+ const xb = x + w - rx;
462
+ const xr = x + w;
463
+ const ya = y + ry;
464
+ const yb = y + h - ry;
465
+ const yd = y + h;
466
+ const kx = KAPPA * rx;
467
+ const ky = KAPPA * ry;
468
+ const [cubic, line, , , finish] = builder(xa, y);
469
+ line(xb, y);
470
+ cubic(xb + kx, y, xr, ya - ky, xr, ya);
471
+ line(xr, yb);
472
+ cubic(xr, yb + ky, xb + kx, yd, xb, yd);
473
+ line(xa, yd);
474
+ cubic(xa - kx, yd, x, yb + ky, x, yb);
475
+ line(x, ya);
476
+ cubic(x, ya - ky, xa - kx, y, xa, y);
477
+ return finish(true);
478
+ }
479
+ function iconToCubics(input) {
480
+ const out = [];
481
+ const push = (p) => {
482
+ if (p) out.push(p);
483
+ };
484
+ if (typeof input === "string") {
485
+ for (const s of parsePath(input)) push(lowerSubpath(s));
486
+ return out;
487
+ }
488
+ for (const [tag, attrs] of input) switch (tag) {
489
+ case "path":
490
+ for (const s of parsePath(String(attrs.d ?? ""))) push(lowerSubpath(s));
491
+ break;
492
+ case "line": {
493
+ const [, line, , , finish] = builder(attrNum(attrs, "x1"), attrNum(attrs, "y1"));
494
+ line(attrNum(attrs, "x2"), attrNum(attrs, "y2"));
495
+ push(finish(false));
496
+ break;
497
+ }
498
+ case "circle": {
499
+ const r = attrNum(attrs, "r");
500
+ push(ellipsePath(attrNum(attrs, "cx"), attrNum(attrs, "cy"), r, r));
501
+ break;
502
+ }
503
+ case "ellipse":
504
+ push(ellipsePath(attrNum(attrs, "cx"), attrNum(attrs, "cy"), attrNum(attrs, "rx"), attrNum(attrs, "ry")));
505
+ break;
506
+ case "rect":
507
+ push(rectPath(attrs));
508
+ break;
509
+ case "polyline":
510
+ push(polyPath(parsePoints(attrs.points), false));
511
+ break;
512
+ case "polygon":
513
+ push(polyPath(parsePoints(attrs.points), true));
514
+ break;
515
+ default:
516
+ throw new Error(`morphicons: unsupported tag <${tag}>`);
517
+ }
518
+ return out;
519
+ }
520
+ function parseViewBox(vb) {
521
+ const v = typeof vb === "number" ? [
522
+ 0,
523
+ 0,
524
+ vb,
525
+ vb
526
+ ] : typeof vb === "string" ? vb.trim().split(/[\s,]+/).map(Number) : vb;
527
+ const [minX, minY, w, h] = v;
528
+ if (v.length !== 4 || !(w > 0) || !(h > 0) || !Number.isFinite(minX) || !Number.isFinite(minY)) throw new Error(`morphicons: invalid viewBox "${String(vb)}"`);
529
+ return [
530
+ minX,
531
+ minY,
532
+ w,
533
+ h
534
+ ];
535
+ }
536
+ function fitIcon(input, viewBox, grid = 24) {
537
+ const [minX, minY, w, h] = parseViewBox(viewBox);
538
+ const s = Math.min(grid / w, grid / h);
539
+ const tx = (grid - w * s) / 2 - minX * s;
540
+ const ty = (grid - h * s) / 2 - minY * s;
541
+ const paths = iconToCubics(input);
542
+ for (const { pts } of paths) for (let i = 0; i < pts.length; i += 2) {
543
+ pts[i] = pts[i] * s + tx;
544
+ pts[i + 1] = pts[i + 1] * s + ty;
545
+ }
546
+ return cubicsToPathD(paths);
547
+ }
548
+
549
+ // node_modules/morphicons/dist/adapters.js
550
+ function canvasTarget(surface, opts = {}) {
551
+ if (typeof Path2D === "undefined") throw new Error("morphicons: canvasTarget needs Path2D (browser or worker)");
552
+ const ctx = "getContext" in surface ? surface.getContext("2d") : surface;
553
+ if (!ctx) throw new Error("morphicons: canvasTarget needs a 2D context");
554
+ const vb = (opts.viewBox ?? "0 0 24 24").trim().split(/[\s,]+/).map(Number);
555
+ const [mx, my, vw, vh] = [
556
+ vb[0] || 0,
557
+ vb[1] || 0,
558
+ vb[2] || 24,
559
+ vb[3] || vb[2] || 24
560
+ ];
561
+ const stroke = opts.strokeWidth ?? 2;
562
+ const clear = opts.clear !== false;
563
+ let color = opts.color;
564
+ let cssPending = color === void 0 && "style" in ctx.canvas;
565
+ return { setAttribute(name, value) {
566
+ if (name !== "d") return;
567
+ if (cssPending) {
568
+ cssPending = false;
569
+ color = getComputedStyle?.(ctx.canvas).color || void 0;
570
+ }
571
+ const c = ctx.canvas;
572
+ const s = Math.min(c.width / vw, c.height / vh);
573
+ if (clear) {
574
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
575
+ ctx.clearRect(0, 0, c.width, c.height);
576
+ }
577
+ ctx.setTransform(s, 0, 0, s, (c.width - vw * s) / 2 - mx * s, (c.height - vh * s) / 2 - my * s);
578
+ ctx.lineWidth = stroke;
579
+ ctx.lineCap = "round";
580
+ ctx.lineJoin = "round";
581
+ if (color !== void 0) ctx.strokeStyle = color;
582
+ ctx.stroke(new Path2D(value));
583
+ opts.onWrite?.();
584
+ } };
585
+ }
586
+ var SVG_NS = "http://www.w3.org/2000/svg";
587
+ var seq = 0;
588
+ var host = null;
589
+ function maskTarget(el, opts = {}) {
590
+ if (typeof document === "undefined") throw new Error("morphicons: maskTarget needs a DOM (client-side only)");
591
+ const doc = document;
592
+ if (!host) {
593
+ host = doc.createElementNS(SVG_NS, "svg");
594
+ host.setAttribute("width", "0");
595
+ host.setAttribute("height", "0");
596
+ host.setAttribute("aria-hidden", "true");
597
+ host.setAttribute("style", "position:absolute");
598
+ doc.body.appendChild(host);
599
+ }
600
+ const vb = (opts.viewBox ?? "0 0 24 24").trim().split(/[\s,]+/).map(Number);
601
+ const [mx, my, w, h] = [
602
+ vb[0] || 0,
603
+ vb[1] || 0,
604
+ vb[2] || 24,
605
+ vb[3] || vb[2] || 24
606
+ ];
607
+ const makeLayer = () => {
608
+ const id = `morphicons-mask-${++seq}`;
609
+ const mask = doc.createElementNS(SVG_NS, "mask");
610
+ mask.setAttribute("id", id);
611
+ mask.setAttribute("maskContentUnits", "objectBoundingBox");
612
+ const g = doc.createElementNS(SVG_NS, "g");
613
+ g.setAttribute("transform", `scale(${1 / w} ${1 / h}) translate(${-mx} ${-my})`);
614
+ const path = doc.createElementNS(SVG_NS, "path");
615
+ path.setAttribute("fill", "none");
616
+ path.setAttribute("stroke", "#fff");
617
+ path.setAttribute("stroke-width", String(opts.strokeWidth ?? 2));
618
+ path.setAttribute("stroke-linecap", "round");
619
+ path.setAttribute("stroke-linejoin", "round");
620
+ g.appendChild(path);
621
+ mask.appendChild(g);
622
+ if (host) host.appendChild(mask);
623
+ return {
624
+ url: `url(#${id})`,
625
+ mask,
626
+ path
627
+ };
628
+ };
629
+ const layers = [makeLayer(), makeLayer()];
630
+ let front = 0;
631
+ const s = el.style;
632
+ s.maskImage = s.webkitMaskImage = layers[0].url;
633
+ if (opts.paint !== false) s.backgroundColor = "currentColor";
634
+ return {
635
+ setAttribute(name, d) {
636
+ if (name !== "d") return;
637
+ front = 1 - front;
638
+ const layer = layers[front];
639
+ layer.path.setAttribute("d", d);
640
+ s.maskImage = s.webkitMaskImage = layer.url;
641
+ },
642
+ dispose() {
643
+ layers[0].mask.remove();
644
+ layers[1].mask.remove();
645
+ }
646
+ };
647
+ }
648
+ var SVG_CONTAINER = /<(defs|mask|clipPath|symbol)\b[^>]*>[\s\S]*?<\/\1>/gi;
649
+ var SVG_TAG = /<(\/?)([a-zA-Z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/g;
650
+ var SVG_ATTR = /([\w:-]+)\s*=\s*"([^"]*)"|([\w:-]+)\s*=\s*'([^']*)'/g;
651
+ var SVG_VIEWBOX = /<svg\b[^>]*\bviewBox\s*=\s*["']([^"']+)["']/i;
652
+ var SVG_GEOMETRY = /* @__PURE__ */ new Set([
653
+ "path",
654
+ "line",
655
+ "circle",
656
+ "ellipse",
657
+ "rect",
658
+ "polyline",
659
+ "polygon"
660
+ ]);
661
+ var SVG_GROUP = /* @__PURE__ */ new Set([
662
+ "svg",
663
+ "g",
664
+ "a"
665
+ ]);
666
+ var SVG_SKIP = /* @__PURE__ */ new Set([
667
+ "title",
668
+ "desc",
669
+ "defs",
670
+ "mask",
671
+ "clippath",
672
+ "symbol"
673
+ ]);
674
+ var PAINT = [
675
+ "fill",
676
+ "stroke",
677
+ "stroke-width",
678
+ "fill-rule",
679
+ "opacity",
680
+ "fill-opacity",
681
+ "visibility",
682
+ "display"
683
+ ];
684
+ function readSvgAttrs(raw) {
685
+ const attrs = {};
686
+ SVG_ATTR.lastIndex = 0;
687
+ let m;
688
+ while ((m = SVG_ATTR.exec(raw)) !== null) {
689
+ const name = m[1] ?? m[3];
690
+ if (name) attrs[name] = m[2] ?? m[4] ?? "";
691
+ }
692
+ return attrs;
693
+ }
694
+ function paintOf(parent, attrs) {
695
+ const out = { ...parent };
696
+ for (const k of PAINT) if (attrs[k] !== void 0) out[k] = String(attrs[k]);
697
+ for (const decl of String(attrs.style ?? "").split(";")) {
698
+ const i = decl.indexOf(":");
699
+ const k = decl.slice(0, i).trim().toLowerCase();
700
+ if (i > 0 && PAINT.includes(k)) out[k] = decl.slice(i + 1).trim();
701
+ }
702
+ return out;
703
+ }
704
+ var mul = (m, n) => [
705
+ m[0] * n[0] + m[2] * n[1],
706
+ m[1] * n[0] + m[3] * n[1],
707
+ m[0] * n[2] + m[2] * n[3],
708
+ m[1] * n[2] + m[3] * n[3],
709
+ m[0] * n[4] + m[2] * n[5] + m[4],
710
+ m[1] * n[4] + m[3] * n[5] + m[5]
711
+ ];
712
+ function parseTransform(v) {
713
+ const s = String(v ?? "").trim();
714
+ if (!s) return null;
715
+ let m = [
716
+ 1,
717
+ 0,
718
+ 0,
719
+ 1,
720
+ 0,
721
+ 0
722
+ ];
723
+ for (const [, fn, args] of s.matchAll(/(\w+)\s*\(([^)]*)\)/g)) {
724
+ const a = args.trim().split(/[\s,]+/).map(Number);
725
+ const rad = (a[0] ?? 0) * Math.PI / 180;
726
+ let t;
727
+ switch (fn) {
728
+ case "matrix":
729
+ t = [
730
+ a[0],
731
+ a[1],
732
+ a[2],
733
+ a[3],
734
+ a[4],
735
+ a[5]
736
+ ];
737
+ break;
738
+ case "translate":
739
+ t = [
740
+ 1,
741
+ 0,
742
+ 0,
743
+ 1,
744
+ a[0],
745
+ a[1] ?? 0
746
+ ];
747
+ break;
748
+ case "scale":
749
+ t = [
750
+ a[0],
751
+ 0,
752
+ 0,
753
+ a[1] ?? a[0],
754
+ 0,
755
+ 0
756
+ ];
757
+ break;
758
+ case "rotate": {
759
+ const c = Math.cos(rad);
760
+ const n = Math.sin(rad);
761
+ const [cx = 0, cy = 0] = [a[1], a[2]];
762
+ t = [
763
+ c,
764
+ n,
765
+ -n,
766
+ c,
767
+ cx - c * cx + n * cy,
768
+ cy - n * cx - c * cy
769
+ ];
770
+ break;
771
+ }
772
+ case "skewX":
773
+ t = [
774
+ 1,
775
+ 0,
776
+ Math.tan(rad),
777
+ 1,
778
+ 0,
779
+ 0
780
+ ];
781
+ break;
782
+ case "skewY":
783
+ t = [
784
+ 1,
785
+ Math.tan(rad),
786
+ 0,
787
+ 1,
788
+ 0,
789
+ 0
790
+ ];
791
+ break;
792
+ default:
793
+ throw new Error(`morphicons: unsupported transform "${fn}"`);
794
+ }
795
+ if (t.some((x) => !Number.isFinite(x))) throw new Error(`morphicons: invalid transform "${s}"`);
796
+ m = mul(m, t);
797
+ }
798
+ return m;
799
+ }
800
+ function bake(tag, attrs, m) {
801
+ const paths = iconToCubics([[tag, attrs]]);
802
+ for (const { pts } of paths) for (let i = 0; i < pts.length; i += 2) {
803
+ const x = pts[i];
804
+ const y = pts[i + 1];
805
+ pts[i] = m[0] * x + m[2] * y + m[4];
806
+ pts[i + 1] = m[1] * x + m[3] * y + m[5];
807
+ }
808
+ return cubicsToPathD(paths);
809
+ }
810
+ function stripComments(markup) {
811
+ let out = markup;
812
+ let prev;
813
+ do {
814
+ prev = out;
815
+ out = out.replace(/<!--[\s\S]*?-->/g, "");
816
+ } while (out !== prev);
817
+ const open = out.indexOf("<!--");
818
+ return open === -1 ? out : out.slice(0, open);
819
+ }
820
+ var painted = (v) => v !== void 0 && v.trim().toLowerCase() !== "none";
821
+ function svgToIcon(markup) {
822
+ if (markup.trimStart().charCodeAt(0) !== 60) throw new Error("morphicons: svgToIcon expects SVG markup \u2014 a d string or IconNode is already an IconInput");
823
+ const clean = stripComments(markup);
824
+ if (/<style\b/i.test(clean)) throw new Error("morphicons: unsupported SVG element <style>");
825
+ const body = clean.replace(SVG_CONTAINER, "");
826
+ const found = [];
827
+ const stack = [{
828
+ paint: {},
829
+ m: null
830
+ }];
831
+ SVG_TAG.lastIndex = 0;
832
+ let mt;
833
+ while ((mt = SVG_TAG.exec(body)) !== null) {
834
+ const tag = mt[2].toLowerCase();
835
+ const top = stack[stack.length - 1];
836
+ if (mt[1]) {
837
+ if (SVG_GROUP.has(tag) && stack.length > 1) stack.pop();
838
+ continue;
839
+ }
840
+ if (SVG_SKIP.has(tag)) continue;
841
+ const attrs = readSvgAttrs(mt[3]);
842
+ const own = parseTransform(attrs.transform);
843
+ const m = own ? top.m ? mul(top.m, own) : own : top.m;
844
+ const paint = paintOf(top.paint, attrs);
845
+ if (top.paint.display === "none") paint.display = "none";
846
+ if (SVG_GROUP.has(tag)) {
847
+ if (!mt[4]) stack.push({
848
+ paint,
849
+ m
850
+ });
851
+ continue;
852
+ }
853
+ if (!SVG_GEOMETRY.has(tag)) throw new Error(`morphicons: unsupported SVG element <${tag}>`);
854
+ if (paint.display === "none" || /^(hidden|collapse)$/.test(paint.visibility ?? "")) continue;
855
+ found.push({
856
+ tag,
857
+ attrs,
858
+ paint,
859
+ m
860
+ });
861
+ }
862
+ if (found.length === 0) throw new Error("morphicons: no morphable geometry in SVG");
863
+ const fills = found.map(({ paint }) => paint.fill !== void 0 ? painted(paint.fill) : !painted(paint.stroke));
864
+ const vb = SVG_VIEWBOX.exec(clean);
865
+ if (!fills.some(Boolean)) {
866
+ const node = found.map(({ tag, attrs, m }) => {
867
+ if (!m) return [tag, attrs];
868
+ const { transform: _, ...rest } = attrs;
869
+ return ["path", {
870
+ ...rest,
871
+ d: bake(tag, attrs, m)
872
+ }];
873
+ });
874
+ return vb ? fitIcon(node, vb[1]) : node;
875
+ }
876
+ let scale = 1;
877
+ if (vb) {
878
+ const [, , w, h] = vb[1].trim().split(/[\s,]+/).map(Number);
879
+ scale = Math.min(24 / w, 24 / h);
880
+ }
881
+ return found.map(({ tag, attrs, paint, m }, i) => {
882
+ const d = m ? bake(tag, attrs, m) : tag === "path" ? String(attrs.d ?? "") : bake(tag, attrs, [
883
+ 1,
884
+ 0,
885
+ 0,
886
+ 1,
887
+ 0,
888
+ 0
889
+ ]);
890
+ const out = {
891
+ d: vb ? fitIcon(d, vb[1]) : d,
892
+ fill: fills[i] ? "currentColor" : "none",
893
+ stroke: painted(paint.stroke) ? "currentColor" : "none"
894
+ };
895
+ if (painted(paint.stroke)) out["stroke-width"] = String(Number.parseFloat(paint["stroke-width"] ?? "1") * scale);
896
+ if (paint["fill-rule"]) out["fill-rule"] = paint["fill-rule"];
897
+ if (paint.opacity) out.opacity = paint.opacity;
898
+ if (paint["fill-opacity"]) out["fill-opacity"] = paint["fill-opacity"];
899
+ return ["path", out];
900
+ });
901
+ }
902
+ return __toCommonJS(adapters_entry_exports);
903
+ })();