@unicom-cloud/utils 0.1.30 → 0.1.32

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 (287) hide show
  1. package/case-name/index.js +1 -1
  2. package/caseName.js +1 -1
  3. package/class-name/index.js +6 -5
  4. package/className.js +1 -1
  5. package/clipboard-copy/index.js +1 -1
  6. package/clipboardCopy.js +1 -1
  7. package/constant/address.js +1 -1
  8. package/constant/chineseCharacters.js +1 -1
  9. package/constant/constellations.js +1 -1
  10. package/constant/domain.js +1 -1
  11. package/constant/emoji.js +1 -1
  12. package/constant/identity.js +1 -1
  13. package/constant/index.js +1 -1
  14. package/constant/isMobile.js +7 -0
  15. package/constant/keyboardCode.js +1 -1
  16. package/constant/licensePlate.js +1 -1
  17. package/constant/name.js +1 -1
  18. package/constant/platform.js +18 -17
  19. package/constant/protocol.js +1 -1
  20. package/constant/string.js +1 -1
  21. package/constant/ui.js +1 -1
  22. package/constant.js +1 -1
  23. package/content-disposition/index.js +1 -1
  24. package/contentDisposition.js +1 -1
  25. package/cookie/index.js +1 -1
  26. package/cookie/src/api.js +1 -1
  27. package/cookie/src/assign.js +1 -1
  28. package/cookie/src/converter.js +1 -1
  29. package/cookie.js +1 -1
  30. package/date/convertTime.js +1 -1
  31. package/date/convertToDuration.js +1 -1
  32. package/date/index.js +1 -1
  33. package/date.js +1 -1
  34. package/decimal/decimal.js +1 -1
  35. package/decimal/index.js +1 -1
  36. package/decimal.js +1 -1
  37. package/dom-helpers/activeElement.js +1 -1
  38. package/dom-helpers/addClass.js +1 -1
  39. package/dom-helpers/addEventListener.js +1 -1
  40. package/dom-helpers/animate.js +1 -1
  41. package/dom-helpers/animationFrame.js +1 -1
  42. package/dom-helpers/attribute.js +1 -1
  43. package/dom-helpers/camelize.js +1 -1
  44. package/dom-helpers/camelizeStyle.js +1 -1
  45. package/dom-helpers/canUseDOM.js +1 -1
  46. package/dom-helpers/childElements.js +1 -1
  47. package/dom-helpers/childNodes.js +1 -1
  48. package/dom-helpers/clear.js +1 -1
  49. package/dom-helpers/closest.js +1 -1
  50. package/dom-helpers/collectElements.js +1 -1
  51. package/dom-helpers/collectSiblings.js +1 -1
  52. package/dom-helpers/contains.js +1 -1
  53. package/dom-helpers/css.js +1 -1
  54. package/dom-helpers/filterEventHandler.js +1 -1
  55. package/dom-helpers/getComputedStyle.js +1 -1
  56. package/dom-helpers/getScrollAccessor.js +1 -1
  57. package/dom-helpers/hasClass.js +1 -1
  58. package/dom-helpers/height.js +1 -1
  59. package/dom-helpers/hyphenate.js +1 -1
  60. package/dom-helpers/hyphenateStyle.js +1 -1
  61. package/dom-helpers/index.js +1 -1
  62. package/dom-helpers/insertAfter.js +1 -1
  63. package/dom-helpers/isDocument.js +1 -1
  64. package/dom-helpers/isInput.js +1 -1
  65. package/dom-helpers/isTransform.js +1 -1
  66. package/dom-helpers/isVisible.js +1 -1
  67. package/dom-helpers/isWindow.js +1 -1
  68. package/dom-helpers/listen.js +1 -1
  69. package/dom-helpers/matches.js +1 -1
  70. package/dom-helpers/nextUntil.js +1 -1
  71. package/dom-helpers/offset.js +1 -1
  72. package/dom-helpers/offsetParent.js +1 -1
  73. package/dom-helpers/ownerDocument.js +1 -1
  74. package/dom-helpers/ownerWindow.js +1 -1
  75. package/dom-helpers/parents.js +1 -1
  76. package/dom-helpers/position.js +1 -1
  77. package/dom-helpers/prepend.js +1 -1
  78. package/dom-helpers/querySelectorAll.js +1 -1
  79. package/dom-helpers/reflow.js +1 -1
  80. package/dom-helpers/remove.js +1 -1
  81. package/dom-helpers/removeClass.js +1 -1
  82. package/dom-helpers/removeEventListener.js +1 -1
  83. package/dom-helpers/scrollLeft.js +1 -1
  84. package/dom-helpers/scrollParent.js +1 -1
  85. package/dom-helpers/scrollTo.js +1 -1
  86. package/dom-helpers/scrollTop.js +1 -1
  87. package/dom-helpers/scrollbarSize.js +1 -1
  88. package/dom-helpers/siblings.js +1 -1
  89. package/dom-helpers/text.js +1 -1
  90. package/dom-helpers/toggleClass.js +1 -1
  91. package/dom-helpers/transitionEnd.js +1 -1
  92. package/dom-helpers/triggerEvent.js +1 -1
  93. package/dom-helpers/types.js +1 -1
  94. package/dom-helpers/width.js +1 -1
  95. package/domHelpers.js +1 -1
  96. package/emitter/index.js +1 -1
  97. package/emitter/src/index.js +1 -1
  98. package/emitter.js +1 -1
  99. package/file/fileToURL.js +1 -1
  100. package/file/index.js +1 -1
  101. package/file/saveAs.js +1 -1
  102. package/file.js +1 -1
  103. package/idb/index.js +1 -1
  104. package/idb.js +1 -1
  105. package/index.js +1 -1
  106. package/invariant/index.js +1 -1
  107. package/invariant.js +1 -1
  108. package/is/index.js +1 -1
  109. package/is.js +1 -1
  110. package/lunar/index.js +1 -1
  111. package/lunar/lib/Holiday.js +1 -1
  112. package/lunar/lib/HolidayUtil.js +1 -1
  113. package/lunar/lib/I18n.js +1 -1
  114. package/lunar/lib/JieQi.js +1 -1
  115. package/lunar/lib/Lunar.js +1 -1
  116. package/lunar/lib/LunarMonth.js +1 -1
  117. package/lunar/lib/LunarTime.js +1 -1
  118. package/lunar/lib/LunarUtil.js +1 -1
  119. package/lunar/lib/LunarYear.js +1 -1
  120. package/lunar/lib/ShouXingUtil.js +1 -1
  121. package/lunar/lib/Solar.js +1 -1
  122. package/lunar/lib/SolarHalfYear.js +1 -1
  123. package/lunar/lib/SolarMonth.js +1 -1
  124. package/lunar/lib/SolarSeason.js +1 -1
  125. package/lunar/lib/SolarUtil.js +1 -1
  126. package/lunar/lib/SolarWeek.js +1 -1
  127. package/lunar/lib/SolarYear.js +1 -1
  128. package/lunar/lib/index.js +1 -1
  129. package/lunar.js +1 -1
  130. package/math/index.js +1 -1
  131. package/math.js +1 -1
  132. package/md5/index.js +1 -1
  133. package/md5.js +1 -1
  134. package/mock/MockWebSocket.js +1 -1
  135. package/mock/MockXMLHttpRequest.js +1 -1
  136. package/mock/index.js +1 -1
  137. package/mock.js +1 -1
  138. package/normalize-wheel/ExecutionEnvironment.js +1 -1
  139. package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
  140. package/normalize-wheel/index.js +1 -1
  141. package/normalize-wheel/isEventSupported.js +1 -1
  142. package/normalizeWheel.js +1 -1
  143. package/number-to-chinese/index.js +1 -1
  144. package/numberToChinese.js +1 -1
  145. package/nzh/cn.js +1 -1
  146. package/nzh/hk.js +1 -1
  147. package/nzh/index.js +1 -1
  148. package/nzh/nzh.js +1 -1
  149. package/nzh/src/autoGet.js +1 -1
  150. package/nzh/src/index.js +1 -1
  151. package/nzh/src/langs/cn_b.js +1 -1
  152. package/nzh/src/langs/cn_s.js +1 -1
  153. package/nzh/src/langs/hk_b.js +1 -1
  154. package/nzh/src/langs/hk_s.js +1 -1
  155. package/nzh/src/utils.js +1 -1
  156. package/nzh.js +1 -1
  157. package/object-keys-sort/index.js +1 -1
  158. package/object-prototype-to-string-call/index.js +1 -1
  159. package/objectKeysSort.js +1 -1
  160. package/objectPrototypeToStringCall.js +1 -1
  161. package/package.json +1 -1
  162. package/pinyin/index.js +1 -1
  163. package/pinyin/simplified.js +1 -1
  164. package/pinyin/src/core.js +1 -1
  165. package/pinyin/src/simplified.js +1 -1
  166. package/pinyin/src/simplified_dict.js +1 -1
  167. package/pinyin/src/traditional.js +1 -1
  168. package/pinyin/src/traditional_dict.js +1 -1
  169. package/pinyin/traditional.js +1 -1
  170. package/pinyin.js +1 -1
  171. package/query-string/base.js +1 -1
  172. package/query-string/index.js +1 -1
  173. package/query-string/splitOnFirst.js +1 -1
  174. package/queryString.js +1 -1
  175. package/random/address.js +1 -1
  176. package/random/constellation.js +1 -1
  177. package/random/image.js +1 -1
  178. package/random/index.js +1 -1
  179. package/random/licensePlate.js +1 -1
  180. package/random/name.js +1 -1
  181. package/random/number.js +1 -1
  182. package/random/text.js +1 -1
  183. package/random/time.js +1 -1
  184. package/random/web.js +1 -1
  185. package/random.js +1 -1
  186. package/screenfull/index.js +1 -1
  187. package/screenfull.js +1 -1
  188. package/sleep/index.js +1 -1
  189. package/sleep.js +1 -1
  190. package/snapdom/index.js +1 -1
  191. package/snapdom/src/api/preCache.js +1 -1
  192. package/snapdom/src/api/snapdom.js +198 -153
  193. package/snapdom/src/core/cache.js +1 -1
  194. package/snapdom/src/core/capture.js +121 -326
  195. package/snapdom/src/core/clone.js +117 -266
  196. package/snapdom/src/core/context.js +1 -1
  197. package/snapdom/src/core/plugins.js +1 -1
  198. package/snapdom/src/core/prepare.js +48 -157
  199. package/snapdom/src/exporters/download.js +9 -10
  200. package/snapdom/src/exporters/toBlob.js +10 -15
  201. package/snapdom/src/exporters/toCanvas.js +72 -65
  202. package/snapdom/src/exporters/toImg.js +1 -1
  203. package/snapdom/src/modules/CSSVar.js +1 -1
  204. package/snapdom/src/modules/background.js +1 -1
  205. package/snapdom/src/modules/changeCSS.js +1 -1
  206. package/snapdom/src/modules/counter.js +1 -1
  207. package/snapdom/src/modules/fonts.js +118 -112
  208. package/snapdom/src/modules/iconFonts.js +133 -69
  209. package/snapdom/src/modules/images.js +36 -33
  210. package/snapdom/src/modules/lineClamp.js +1 -1
  211. package/snapdom/src/modules/pseudo.js +275 -161
  212. package/snapdom/src/modules/rasterize.js +6 -7
  213. package/snapdom/src/modules/snapFetch.js +1 -1
  214. package/snapdom/src/modules/styles.js +89 -67
  215. package/snapdom/src/modules/svgDefs.js +73 -60
  216. package/snapdom/src/utils/browser.js +13 -8
  217. package/snapdom/src/utils/capture.helpers.js +131 -0
  218. package/snapdom/src/utils/clone.helpers.js +283 -0
  219. package/snapdom/src/utils/css.js +1 -1
  220. package/snapdom/src/utils/helpers.js +1 -1
  221. package/snapdom/src/utils/image.js +15 -24
  222. package/snapdom/src/utils/prepare.helpers.js +8 -0
  223. package/snapdom/src/utils/transforms.helpers.js +211 -0
  224. package/snapdom.js +1 -1
  225. package/string/index.js +1 -1
  226. package/string.js +1 -1
  227. package/tinycolor/index.js +1 -1
  228. package/tinycolor/src/conversion.js +1 -1
  229. package/tinycolor/src/css-color-names.js +1 -1
  230. package/tinycolor/src/format-input.js +1 -1
  231. package/tinycolor/src/from-ratio.js +1 -1
  232. package/tinycolor/src/index.js +1 -1
  233. package/tinycolor/src/random.js +1 -1
  234. package/tinycolor/src/readability.js +1 -1
  235. package/tinycolor/src/to-ms-filter.js +1 -1
  236. package/tinycolor/src/utils.js +1 -1
  237. package/tinycolor.js +1 -1
  238. package/tree/index.js +1 -1
  239. package/tree/search/index.js +1 -1
  240. package/tree.js +1 -1
  241. package/tween/index.js +1 -1
  242. package/tween/src/easing.js +1 -1
  243. package/tween/src/tween.js +1 -1
  244. package/tween.js +1 -1
  245. package/types/constant/isMobile.d.ts +3 -0
  246. package/types/snapdom/src/api/snapdom.d.ts +10 -79
  247. package/types/snapdom/src/exporters/toCanvas.d.ts +11 -3
  248. package/types/snapdom/src/exporters/toJpg.d.ts +1 -0
  249. package/types/snapdom/src/exporters/toPng.d.ts +6 -0
  250. package/types/snapdom/src/exporters/toSvg.d.ts +1 -0
  251. package/types/snapdom/src/exporters/toWebp.d.ts +1 -0
  252. package/types/snapdom/src/modules/iconFonts.d.ts +7 -20
  253. package/types/snapdom/src/modules/pseudo.d.ts +18 -0
  254. package/types/snapdom/src/modules/rasterize.d.ts +6 -10
  255. package/types/snapdom/src/utils/browser.d.ts +0 -3
  256. package/types/snapdom/src/utils/capture.helpers.d.ts +45 -0
  257. package/types/snapdom/src/utils/clone.helpers.d.ts +97 -0
  258. package/types/snapdom/src/utils/image.d.ts +0 -8
  259. package/types/snapdom/src/utils/index.d.ts +1 -1
  260. package/types/snapdom/src/utils/prepare.helpers.d.ts +9 -0
  261. package/types/snapdom/src/utils/transforms.helpers.d.ts +118 -0
  262. package/ui-color/compareColorByRange.js +1 -1
  263. package/ui-color/index.js +1 -1
  264. package/uiColor.js +1 -1
  265. package/url-toolkit/index.js +1 -1
  266. package/url-toolkit/src/url-toolkit.js +1 -1
  267. package/urlToolkit.js +1 -1
  268. package/validate/index.js +1 -1
  269. package/validate/src/index.js +1 -1
  270. package/validate/src/locale/en-US.js +1 -1
  271. package/validate/src/locale/zh-CN.js +1 -1
  272. package/validate/src/message.js +1 -1
  273. package/validate/src/rules/array.js +1 -1
  274. package/validate/src/rules/base.js +1 -1
  275. package/validate/src/rules/boolean.js +1 -1
  276. package/validate/src/rules/custom.js +1 -1
  277. package/validate/src/rules/number.js +1 -1
  278. package/validate/src/rules/object.js +1 -1
  279. package/validate/src/rules/string.js +1 -1
  280. package/validate/src/rules/type.js +1 -1
  281. package/validate/src/utils.js +1 -1
  282. package/validate.js +1 -1
  283. package/version/index.js +1 -1
  284. package/version.js +1 -1
  285. package/xlsx/index.js +1 -1
  286. package/xlsx/xlsx.js +1 -1
  287. package/xlsx.js +1 -1
@@ -1,374 +1,169 @@
1
- /* 2025-11-19 09:08:12 */
2
- import { applyCachePolicy as St, cache as Z } from "./cache.js";
3
- import { inlineBackgroundImages as vt } from "../modules/background.js";
4
- import { collectUsedFontVariants as Ct, collectUsedCodepoints as Ft, ensureFontsReady as $t, embedCustomFonts as Tt } from "../modules/fonts.js";
5
- import { ligatureIconToImage as Pt } from "../modules/iconFonts.js";
6
- import { inlineImages as At } from "../modules/images.js";
7
- import { lineClamp as Bt } from "../modules/lineClamp.js";
8
- import { idle as D, isSafari as q } from "../utils/browser.js";
9
- import { collectUsedTagNames as Xt, generateDedupedBaseCSS as Ot } from "../utils/css.js";
10
- import { runHook as E } from "./plugins.js";
11
- import { prepareClone as Yt } from "./prepare.js";
12
- function Ht(n, t) {
13
- if (!n || !t || !t.style) return;
14
- const o = getComputedStyle(n);
1
+ /* 2025-11-27 12:11:03 */
2
+ import { applyCachePolicy as Se, cache as j } from "./cache.js";
3
+ import { inlineBackgroundImages as ye } from "../modules/background.js";
4
+ import { collectUsedFontVariants as ve, collectUsedCodepoints as Ce, ensureFontsReady as Me, embedCustomFonts as Fe } from "../modules/fonts.js";
5
+ import { ligatureIconToImage as Te } from "../modules/iconFonts.js";
6
+ import { inlineImages as Be } from "../modules/images.js";
7
+ import { lineClamp as He } from "../modules/lineClamp.js";
8
+ import { stripRootShadows as Pe, sanitizeCloneForXHTML as Ne, shrinkAutoSizeBoxes as Oe, limitDecimals as t, estimateKeptHeight as Ae } from "../utils/capture.helpers.js";
9
+ import { idle as M, isSafari as X } from "../utils/browser.js";
10
+ import { collectUsedTagNames as Ee, generateDedupedBaseCSS as We } from "../utils/css.js";
11
+ import { normalizeRootTransforms as Re, bboxWithOriginFull as ae, readIndividualTransforms as Xe, readTotalTransformMatrix as ze, parseTransformOriginPx as $e, parseBoxShadow as De, parseFilterBlur as Ie, parseOutline as Ye, parseFilterDropShadows as Ue, hasBBoxAffectingTransform as Le } from "../utils/transforms.helpers.js";
12
+ import { runHook as F } from "./plugins.js";
13
+ import { prepareClone as ke } from "./prepare.js";
14
+ async function lt(T, l) {
15
+ if (!T) throw new Error("Element cannot be null or undefined");
16
+ Se(l.cache);
17
+ const x = l.fast, B = l.outerTransforms !== !1, K = !!l.outerShadows;
18
+ let e = { element: T, options: l, plugins: l.plugins }, p, _, q, V = "", H = "", G, z, d = null;
19
+ await F("beforeSnap", e), await F("beforeClone", e);
20
+ const ie = He(e.element);
15
21
  try {
16
- t.style.boxShadow = "none";
17
- } catch {
18
- }
19
- try {
20
- t.style.textShadow = "none";
21
- } catch {
22
- }
23
- try {
24
- t.style.outline = "none";
25
- } catch {
26
- }
27
- const m = (o.filter || "").replace(/\bblur\([^()]*\)\s*/gi, "").replace(/\bdrop-shadow\([^()]*\)\s*/gi, "").trim().replace(/\s+/g, " ");
28
- try {
29
- t.style.filter = m.length ? m : "none";
30
- } catch {
31
- }
32
- }
33
- async function re(n, t) {
34
- if (!n) throw new Error("Element cannot be null or undefined");
35
- St(t.cache);
36
- const o = t.fast, i = t.outerTransforms !== !1, m = !!t.outerShadows;
37
- let e = { element: n, options: t, plugins: t.plugins }, r, l, s, c = "", f = "", h, b, u = null;
38
- await E("beforeSnap", e), await E("beforeClone", e);
39
- const g = Bt(e.element);
40
- try {
41
- ({ clone: r, classCSS: l, styleCache: s } = await Yt(
22
+ ({ clone: p, classCSS: _, styleCache: q } = await ke(
42
23
  e.element,
43
24
  e.options
44
- )), !i && r && (u = It(e.element, r)), !m && r && Ht(e.element, r);
25
+ )), !B && p && (d = Re(e.element, p)), !K && p && Pe(e.element, p);
45
26
  } finally {
46
- g();
27
+ ie();
47
28
  }
48
- e = { clone: r, classCSS: l, styleCache: s, ...e }, await E("afterClone", e);
29
+ if (e = { clone: p, classCSS: _, styleCache: q, ...e }, await F("afterClone", e), Ne(e.clone), e.options?.excludeMode === "remove")
30
+ try {
31
+ Oe(e.element, e.clone, e.styleCache);
32
+ } catch (a) {
33
+ console.warn("[snapdom] shrink pass failed:", a);
34
+ }
49
35
  try {
50
- await Pt(e.clone, e.element);
36
+ await Te(e.clone, e.element);
51
37
  } catch {
52
38
  }
53
- await new Promise((d) => {
54
- D(
39
+ await new Promise((a) => {
40
+ M(
55
41
  async () => {
56
- await At(e.clone, e.options), d();
42
+ await Be(e.clone, e.options), a();
57
43
  },
58
- { fast: o }
44
+ { fast: x }
59
45
  );
60
- }), await new Promise((d) => {
61
- D(
46
+ }), await new Promise((a) => {
47
+ M(
62
48
  async () => {
63
- await vt(
49
+ await ye(
64
50
  e.element,
65
51
  e.clone,
66
52
  e.styleCache,
67
53
  e.options
68
- ), d();
54
+ ), a();
69
55
  },
70
- { fast: o }
56
+ { fast: x }
71
57
  );
72
- }), t.embedFonts && await new Promise((d) => {
73
- D(
58
+ }), l.embedFonts && await new Promise((a) => {
59
+ M(
74
60
  async () => {
75
- const p = Ct(e.element), v = Ft(e.element);
76
- if (q()) {
77
- const y = new Set(
78
- Array.from(p).map((x) => String(x).split("__")[0]).filter(Boolean)
61
+ const n = ve(e.element), P = Ce(e.element);
62
+ if (X()) {
63
+ const s = new Set(
64
+ Array.from(n).map((o) => String(o).split("__")[0]).filter(Boolean)
79
65
  );
80
- await $t(y, 1);
66
+ await Me(s, 1);
81
67
  }
82
- c = await Tt({
83
- required: p,
84
- usedCodepoints: v,
68
+ V = await Fe({
69
+ required: n,
70
+ usedCodepoints: P,
85
71
  exclude: e.options.excludeFonts,
86
72
  useProxy: e.options.useProxy
87
- }), d();
73
+ }), a();
88
74
  },
89
- { fast: o }
75
+ { fast: x }
90
76
  );
91
77
  });
92
- const w = Xt(e.clone).sort(), M = w.join(",");
93
- Z.baseStyle.has(M) ? f = Z.baseStyle.get(M) : await new Promise((d) => {
94
- D(
78
+ const J = Ee(e.clone).sort(), $ = J.join(",");
79
+ j.baseStyle.has($) ? H = j.baseStyle.get($) : await new Promise((a) => {
80
+ M(
95
81
  () => {
96
- f = Ot(w), Z.baseStyle.set(M, f), d();
82
+ H = We(J), j.baseStyle.set($, H), a();
97
83
  },
98
- { fast: o }
84
+ { fast: x }
99
85
  );
100
- }), e = { fontsCSS: c, baseCSS: f, ...e }, await E("beforeRender", e), await new Promise((d) => {
101
- D(
86
+ }), e = { fontsCSS: V, baseCSS: H, ...e }, await F("beforeRender", e), await new Promise((a) => {
87
+ M(
102
88
  () => {
103
- const p = getComputedStyle(e.element), v = e.element.getBoundingClientRect(), y = Math.max(
89
+ const n = getComputedStyle(e.element), P = e.element.getBoundingClientRect();
90
+ let s = Math.max(
104
91
  1,
105
- a(
106
- e.element.offsetWidth || parseFloat(p.width) || v.width || 1
92
+ t(
93
+ e.element.offsetWidth || parseFloat(n.width) || P.width || 1
107
94
  )
108
- ), x = Math.max(
95
+ ), o = Math.max(
109
96
  1,
110
- a(
111
- e.element.offsetHeight || parseFloat(p.height) || v.height || 1
97
+ t(
98
+ e.element.offsetHeight || parseFloat(n.height) || P.height || 1
112
99
  )
113
- ), tt = (O, $ = NaN) => {
114
- const Y = typeof O == "string" ? parseFloat(O) : O;
115
- return Number.isFinite(Y) ? Y : $;
116
- }, K = tt(e.options.width), G = tt(e.options.height);
117
- let T = y, P = x;
118
- const H = Number.isFinite(K), W = Number.isFinite(G), et = x > 0 ? y / x : 1;
119
- H && W ? (T = Math.max(1, a(K)), P = Math.max(1, a(G))) : H ? (T = Math.max(1, a(K)), P = Math.max(1, a(T / (et || 1)))) : W ? (P = Math.max(1, a(G)), T = Math.max(1, a(P * (et || 1)))) : (T = y, P = x);
120
- let A = 0, B = 0, I = y, N = x;
121
- if (!i && u && Number.isFinite(u.a)) {
122
- const O = {
123
- a: u.a,
124
- b: u.b || 0,
125
- c: u.c || 0,
126
- d: u.d || 1,
100
+ );
101
+ if (e.options?.excludeMode === "remove") {
102
+ const i = Ae(e.element, e.options);
103
+ Number.isFinite(i) && i > 0 && (o = Math.max(1, Math.min(o, t(i + 1))));
104
+ }
105
+ const Q = (i, r = NaN) => {
106
+ const w = typeof i == "string" ? parseFloat(i) : i;
107
+ return Number.isFinite(w) ? w : r;
108
+ }, I = Q(e.options.width), Y = Q(e.options.height);
109
+ let f = s, h = o;
110
+ const S = Number.isFinite(I), y = Number.isFinite(Y), Z = o > 0 ? s / o : 1;
111
+ S && y ? (f = Math.max(1, t(I)), h = Math.max(1, t(Y))) : S ? (f = Math.max(1, t(I)), h = Math.max(1, t(f / (Z || 1)))) : y ? (h = Math.max(1, t(Y)), f = Math.max(1, t(h * (Z || 1)))) : (f = s, h = o);
112
+ let g = 0, u = 0, v = s, C = o;
113
+ if (!B && d && Number.isFinite(d.a)) {
114
+ const i = {
115
+ a: d.a,
116
+ b: d.b || 0,
117
+ c: d.c || 0,
118
+ d: d.d || 1,
127
119
  e: 0,
128
120
  f: 0
129
- }, $ = it(y, x, O, 0, 0);
130
- A = a($.minX), B = a($.minY), I = a($.maxX), N = a($.maxY);
131
- } else if (i && Ut(e.element)) {
132
- const $ = p.transform && p.transform !== "none" ? p.transform : "", Y = kt(e.element), Q = _t({
133
- baseTransform: $,
134
- rotate: Y.rotate || "0deg",
135
- scale: Y.scale,
136
- translate: Y.translate
137
- }), { ox: bt, oy: wt } = jt(p, y, x), Mt = Q.is2D ? Q : new DOMMatrix(Q.toString()), _ = it(y, x, Mt, bt, wt);
138
- A = a(_.minX), B = a(_.minY), I = a(_.maxX), N = a(_.maxY);
121
+ }, r = ae(s, o, i, 0, 0);
122
+ g = t(r.minX), u = t(r.minY), v = t(r.maxX), C = t(r.maxY);
123
+ } else if (B && je(e.element)) {
124
+ const r = n.transform && n.transform !== "none" ? n.transform : "", w = Xe(e.element), k = ze({
125
+ baseTransform: r,
126
+ rotate: w.rotate || "0deg",
127
+ scale: w.scale,
128
+ translate: w.translate
129
+ }), { ox: be, oy: we } = $e(n, s, o), xe = k.is2D ? k : new DOMMatrix(k.toString()), R = ae(s, o, xe, be, we);
130
+ g = t(R.minX), u = t(R.minY), v = t(R.maxX), C = t(R.maxY);
139
131
  }
140
- const U = Nt(p), k = Dt(p), L = Et(p), j = Wt(p), z = m ? {
141
- top: a(
142
- U.top + k.top + L.top + j.bleed.top
132
+ const N = De(n), O = Ie(n), A = Ye(n), E = Ue(n), W = K ? {
133
+ top: t(
134
+ N.top + O.top + A.top + E.bleed.top
143
135
  ),
144
- right: a(
145
- U.right + k.right + L.right + j.bleed.right
136
+ right: t(
137
+ N.right + O.right + A.right + E.bleed.right
146
138
  ),
147
- bottom: a(
148
- U.bottom + k.bottom + L.bottom + j.bleed.bottom
139
+ bottom: t(
140
+ N.bottom + O.bottom + A.bottom + E.bleed.bottom
149
141
  ),
150
- left: a(
151
- U.left + k.left + L.left + j.bleed.left
142
+ left: t(
143
+ N.left + O.left + A.left + E.bleed.left
152
144
  )
153
145
  } : { top: 0, right: 0, bottom: 0, left: 0 };
154
- A = a(A - z.left), B = a(B - z.top), I = a(I + z.right), N = a(N + z.bottom);
155
- const nt = Math.max(1, a(I - A)), at = Math.max(1, a(N - B)), ct = H || W ? a(T / y) : 1, mt = W || H ? a(P / x) : 1, ut = Math.max(1, a(nt * ct)), ft = Math.max(1, a(at * mt)), ot = "http://www.w3.org/2000/svg", ht = q() ? 1 : 0, C = a(ht + (i ? 0 : 1)), F = document.createElementNS(ot, "foreignObject"), dt = a(A), pt = a(B);
156
- F.setAttribute("x", String(a(-(dt - C)))), F.setAttribute("y", String(a(-(pt - C)))), F.setAttribute("width", String(a(y + C * 2))), F.setAttribute("height", String(a(x + C * 2))), F.style.overflow = "visible";
157
- const st = document.createElement("style");
158
- st.textContent = e.baseCSS + e.fontsCSS + "svg{overflow:visible;} foreignObject{overflow:visible;}" + e.classCSS, F.appendChild(st);
159
- const X = document.createElement("div");
160
- X.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), X.style.width = `${a(y)}px`, X.style.height = `${a(x)}px`, X.style.overflow = "visible", e.clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), X.appendChild(e.clone), F.appendChild(X);
161
- const xt = new XMLSerializer().serializeToString(F), V = a(nt + C * 2), J = a(at + C * 2), rt = H || W;
162
- t.meta = { w0: y, h0: x, vbW: V, vbH: J, targetW: T, targetH: P };
163
- const gt = q() && rt ? V : a(ut + C * 2), yt = q() && rt ? J : a(ft + C * 2);
164
- b = `<svg xmlns="${ot}" width="${gt}" height="${yt}" viewBox="0 0 ${V} ${J}">` + xt + "</svg>", h = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(b)}`, e = { svgString: b, dataURL: h, ...e }, d();
146
+ g = t(g - W.left), u = t(u - W.top), v = t(v + W.right), C = t(C + W.bottom);
147
+ const ee = Math.max(1, t(v - g)), te = Math.max(1, t(C - u)), re = S || y ? t(f / s) : 1, le = y || S ? t(h / o) : 1, me = Math.max(1, t(ee * re)), ce = Math.max(1, t(te * le)), oe = "http://www.w3.org/2000/svg", de = X() ? 1 : 0, m = t(de + (B ? 0 : 1)), c = document.createElementNS(oe, "foreignObject"), fe = t(g), he = t(u);
148
+ c.setAttribute("x", String(t(-(fe - m)))), c.setAttribute("y", String(t(-(he - m)))), c.setAttribute("width", String(t(s + m * 2))), c.setAttribute("height", String(t(o + m * 2))), c.style.overflow = "visible";
149
+ const ne = document.createElement("style");
150
+ ne.textContent = e.baseCSS + e.fontsCSS + "svg{overflow:visible;} foreignObject{overflow:visible;}" + e.classCSS, c.appendChild(ne);
151
+ const b = document.createElement("div");
152
+ b.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), b.style.width = `${t(s)}px`, b.style.height = `${t(o)}px`, b.style.overflow = "visible", e.clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), b.appendChild(e.clone), c.appendChild(b);
153
+ const pe = new XMLSerializer().serializeToString(c), U = t(ee + m * 2), L = t(te + m * 2), se = S || y;
154
+ l.meta = { w0: s, h0: o, vbW: U, vbH: L, targetW: f, targetH: h };
155
+ const ge = X() && se ? U : t(me + m * 2), ue = X() && se ? L : t(ce + m * 2);
156
+ z = `<svg xmlns="${oe}" width="${ge}" height="${ue}" viewBox="0 0 ${U} ${L}">` + pe + "</svg>", G = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(z)}`, e = { svgString: z, dataURL: G, ...e }, a();
165
157
  },
166
- { fast: o }
158
+ { fast: x }
167
159
  );
168
- }), await E("afterRender", e);
169
- const S = document.getElementById("snapdom-sandbox");
170
- return S && S.style.position === "absolute" && S.remove(), e.dataURL;
171
- }
172
- const a = (n, t = 3) => Number.isFinite(n) ? Math.round(n * 10 ** t) / 10 ** t : n;
173
- function Wt(n) {
174
- const t = `${n.filter || ""} ${n.webkitFilter || ""}`.trim();
175
- if (!t || t === "none")
176
- return { bleed: { top: 0, right: 0, bottom: 0, left: 0 }, has: !1 };
177
- const o = t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi) || [];
178
- let i = 0, m = 0, e = 0, r = 0, l = !1;
179
- for (const s of o) {
180
- l = !0;
181
- const c = s.match(/-?\d+(?:\.\d+)?px/gi)?.map((w) => parseFloat(w)) || [], [f = 0, h = 0, b = 0] = c, u = Math.abs(f) + b, g = Math.abs(h) + b;
182
- m = Math.max(m, u + Math.max(f, 0)), r = Math.max(r, u + Math.max(-f, 0)), e = Math.max(e, g + Math.max(h, 0)), i = Math.max(i, g + Math.max(-h, 0));
183
- }
184
- return {
185
- bleed: {
186
- top: a(i),
187
- right: a(m),
188
- bottom: a(e),
189
- left: a(r)
190
- },
191
- has: l
192
- };
193
- }
194
- function It(n, t) {
195
- if (!n || !t || !t.style) return null;
196
- const o = getComputedStyle(n);
197
- try {
198
- t.style.transformOrigin = "0 0";
199
- } catch {
200
- }
201
- try {
202
- "translate" in t.style && (t.style.translate = "none"), "rotate" in t.style && (t.style.rotate = "none");
203
- } catch {
204
- }
205
- const i = o.transform || "none";
206
- if (i === "none")
207
- try {
208
- const e = lt(n);
209
- if (e.a === 1 && e.b === 0 && e.c === 0 && e.d === 1)
210
- return t.style.transform = "none", { a: 1, b: 0, c: 0, d: 1 };
211
- } catch {
212
- }
213
- const m = i.match(/^matrix\(\s*([^)]+)\)$/i);
214
- if (m) {
215
- const e = m[1].split(",").map((r) => parseFloat(r.trim()));
216
- if (e.length === 6 && e.every(Number.isFinite)) {
217
- const [r, l, s, c] = e, f = Math.sqrt(r * r + l * l) || 0;
218
- let h = 0, b = 0, u = 0, g = 0, w = 0, M = 0;
219
- f > 0 && (h = r / f, b = l / f, u = h * s + b * c, g = s - h * u, w = c - b * u, M = Math.sqrt(g * g + w * w) || 0, M > 0 ? u = u / M : u = 0);
220
- const S = f, d = 0, p = u * M, v = M;
221
- try {
222
- t.style.transform = `matrix(${S}, ${d}, ${p}, ${v}, 0, 0)`;
223
- } catch {
224
- }
225
- return { a: S, b: d, c: p, d: v };
226
- }
227
- }
228
- try {
229
- const e = String(i).trim();
230
- return t.style.transform = e + " translate(0px, 0px) rotate(0deg)", null;
231
- } catch {
232
- return null;
233
- }
234
- }
235
- function Nt(n) {
236
- const t = n.boxShadow || "";
237
- if (!t || t === "none") return { top: 0, right: 0, bottom: 0, left: 0 };
238
- const o = t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map((l) => l.trim());
239
- let i = 0, m = 0, e = 0, r = 0;
240
- for (const l of o) {
241
- const s = l.match(/-?\d+(\.\d+)?px/g)?.map((w) => parseFloat(w)) || [];
242
- if (s.length < 2) continue;
243
- const [c, f, h = 0, b = 0] = s, u = Math.abs(c) + h + b, g = Math.abs(f) + h + b;
244
- m = Math.max(m, u + Math.max(c, 0)), r = Math.max(r, u + Math.max(-c, 0)), e = Math.max(e, g + Math.max(f, 0)), i = Math.max(i, g + Math.max(-f, 0));
245
- }
246
- return {
247
- top: Math.ceil(i),
248
- right: Math.ceil(m),
249
- bottom: Math.ceil(e),
250
- left: Math.ceil(r)
251
- };
252
- }
253
- function Dt(n) {
254
- const t = (n.filter || "").match(/blur\(\s*([0-9.]+)px\s*\)/), o = t ? Math.ceil(parseFloat(t[1]) || 0) : 0;
255
- return { top: o, right: o, bottom: o, left: o };
256
- }
257
- function Et(n) {
258
- if ((n.outlineStyle || "none") === "none")
259
- return { top: 0, right: 0, bottom: 0, left: 0 };
260
- const t = Math.ceil(parseFloat(n.outlineWidth || "0") || 0);
261
- return { top: t, right: t, bottom: t, left: t };
262
- }
263
- function it(n, t, o, i, m) {
264
- const e = o.a, r = o.b, l = o.c, s = o.d, c = o.e || 0, f = o.f || 0;
265
- function h(S, d) {
266
- let p = S - i, v = d - m, y = e * p + l * v, x = r * p + s * v;
267
- return y += i + c, x += m + f, [y, x];
268
- }
269
- const b = [h(0, 0), h(n, 0), h(0, t), h(n, t)];
270
- let u = 1 / 0, g = 1 / 0, w = -1 / 0, M = -1 / 0;
271
- for (const [S, d] of b)
272
- S < u && (u = S), d < g && (g = d), S > w && (w = S), d > M && (M = d);
273
- return {
274
- minX: u,
275
- minY: g,
276
- maxX: w,
277
- maxY: M,
278
- width: w - u,
279
- height: M - g
280
- };
281
- }
282
- function Ut(n) {
283
- return Lt(n);
284
- }
285
- function lt(n) {
286
- const t = getComputedStyle(n).transform;
287
- if (!t || t === "none") return new DOMMatrix();
288
- try {
289
- return new DOMMatrix(t);
290
- } catch {
291
- return new WebKitCSSMatrix(t);
292
- }
293
- }
294
- function kt(n) {
295
- const t = { rotate: "0deg", scale: null, translate: null }, o = typeof n.computedStyleMap == "function" ? n.computedStyleMap() : null;
296
- if (o) {
297
- const m = (s) => {
298
- try {
299
- return typeof o.has == "function" && !o.has(s) || typeof o.get != "function" ? null : o.get(s);
300
- } catch {
301
- return null;
302
- }
303
- }, e = m("rotate");
304
- if (e)
305
- if (e.angle) {
306
- const s = e.angle;
307
- t.rotate = s.unit === "rad" ? s.value * 180 / Math.PI + "deg" : s.value + s.unit;
308
- } else e.unit ? t.rotate = e.unit === "rad" ? e.value * 180 / Math.PI + "deg" : e.value + e.unit : t.rotate = String(e);
309
- else {
310
- const s = getComputedStyle(n);
311
- t.rotate = s.rotate && s.rotate !== "none" ? s.rotate : "0deg";
312
- }
313
- const r = m("scale");
314
- if (r) {
315
- const s = "x" in r && r.x?.value != null ? r.x.value : Array.isArray(r) ? r[0]?.value : Number(r) || 1, c = "y" in r && r.y?.value != null ? r.y.value : Array.isArray(r) ? r[1]?.value : s;
316
- t.scale = `${s} ${c}`;
317
- } else {
318
- const s = getComputedStyle(n);
319
- t.scale = s.scale && s.scale !== "none" ? s.scale : null;
320
- }
321
- const l = m("translate");
322
- if (l) {
323
- const s = "x" in l && "value" in l.x ? l.x.value : Array.isArray(l) ? l[0]?.value : 0, c = "y" in l && "value" in l.y ? l.y.value : Array.isArray(l) ? l[1]?.value : 0, f = "x" in l && l.x?.unit ? l.x.unit : "px", h = "y" in l && l.y?.unit ? l.y.unit : "px";
324
- t.translate = `${s}${f} ${c}${h}`;
325
- } else {
326
- const s = getComputedStyle(n);
327
- t.translate = s.translate && s.translate !== "none" ? s.translate : null;
328
- }
329
- return t;
330
- }
331
- const i = getComputedStyle(n);
332
- return t.rotate = i.rotate && i.rotate !== "none" ? i.rotate : "0deg", t.scale = i.scale && i.scale !== "none" ? i.scale : null, t.translate = i.translate && i.translate !== "none" ? i.translate : null, t;
333
- }
334
- function Lt(n) {
335
- const t = getComputedStyle(n), o = t.transform || "none";
336
- if (o !== "none" && !/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(o)) return !0;
337
- const m = t.rotate && t.rotate !== "none" && t.rotate !== "0deg", e = t.scale && t.scale !== "none" && t.scale !== "1", r = t.translate && t.translate !== "none" && t.translate !== "0px 0px";
338
- return !!(m || e || r);
339
- }
340
- function jt(n, t, o) {
341
- const i = (n.transformOrigin || "0 0").trim().split(/\s+/), [m, e] = [i[0] || "0", i[1] || "0"], r = (l, s) => {
342
- const c = l.toLowerCase();
343
- return c === "left" || c === "top" ? 0 : c === "center" ? s / 2 : c === "right" || c === "bottom" ? s : c.endsWith("px") ? parseFloat(c) || 0 : c.endsWith("%") ? (parseFloat(c) || 0) * s / 100 : /^-?\d+(\.\d+)?$/.test(c) && parseFloat(c) || 0;
344
- };
345
- return {
346
- ox: r(m, t),
347
- oy: r(e, o)
348
- };
349
- }
350
- var R = null;
351
- function zt() {
352
- if (R) return R;
353
- const n = document.createElement("div");
354
- return n.id = "snapdom-measure-slot", n.setAttribute("aria-hidden", "true"), Object.assign(n.style, {
355
- position: "absolute",
356
- left: "-99999px",
357
- top: "0px",
358
- width: "0px",
359
- height: "0px",
360
- overflow: "hidden",
361
- opacity: "0",
362
- pointerEvents: "none",
363
- contain: "size layout style"
364
- }), document.documentElement.appendChild(n), R = n, n;
160
+ }), await F("afterRender", e);
161
+ const D = document.getElementById("snapdom-sandbox");
162
+ return D && D.style.position === "absolute" && D.remove(), e.dataURL;
365
163
  }
366
- function _t(n) {
367
- const t = zt(), o = document.createElement("div");
368
- o.style.transformOrigin = "0 0", n.baseTransform && (o.style.transform = n.baseTransform), n.rotate && (o.style.rotate = n.rotate), n.scale && (o.style.scale = n.scale), n.translate && (o.style.translate = n.translate), t.appendChild(o);
369
- const i = lt(o);
370
- return t.removeChild(o), i;
164
+ function je(T) {
165
+ return Le(T);
371
166
  }
372
167
  export {
373
- re as captureDOM
168
+ lt as captureDOM
374
169
  };