@layers-app/editor 0.5.1 → 0.5.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 (240) hide show
  1. package/dist/index.cjs +2 -0
  2. package/dist/index.d.ts +315 -0
  3. package/dist/index.js +13 -0
  4. package/dist/layers.-TbWEgSf.js +425 -0
  5. package/dist/layers.0aivjg14.js +202 -0
  6. package/dist/layers.1kchl9Fg.js +33 -0
  7. package/dist/layers.2RmTpOSe.js +65 -0
  8. package/dist/layers.37cL7YbN.js +40 -0
  9. package/dist/layers.4q_x5roN.js +5 -0
  10. package/dist/layers.52famHy6.js +1 -0
  11. package/dist/layers.68ma6K6f.js +1 -0
  12. package/dist/layers.6HZckrJk.js +1 -0
  13. package/dist/layers.7JqFgE4-.js +15 -0
  14. package/dist/layers.8xliMm_4.js +14 -0
  15. package/dist/layers.9pNaFvaX.js +1 -0
  16. package/dist/layers.A7FX8Cpf.js +220 -0
  17. package/dist/layers.B-MfAaIy.js +1 -0
  18. package/dist/layers.B17DijoR.js +6 -0
  19. package/dist/layers.B1970UjZ.js +282 -0
  20. package/dist/layers.B19hGmey.js +1 -0
  21. package/dist/layers.B1IP0xF5.js +122 -0
  22. package/dist/layers.B1TVCKFc.js +423 -0
  23. package/dist/layers.B2wb1BnV.js +1 -0
  24. package/dist/layers.B3D4g2HH.js +1 -0
  25. package/dist/layers.B3QZKSP7.js +4 -0
  26. package/dist/layers.B4cctrKy.js +2235 -0
  27. package/dist/layers.B5eIpqUm.js +5 -0
  28. package/dist/layers.B5fhqRqQ.js +32 -0
  29. package/dist/layers.B5o5YNLY.js +41 -0
  30. package/dist/layers.B7QKbjTP.js +1 -0
  31. package/dist/layers.B7R5e9nb.js +39 -0
  32. package/dist/layers.B9H_VqGH.js +38 -0
  33. package/dist/layers.B9gDt0mt.js +2 -0
  34. package/dist/layers.BAtv1CM7.js +1 -0
  35. package/dist/layers.BAx1rxXM.js +1 -0
  36. package/dist/layers.BBu8KTxD.js +40 -0
  37. package/dist/layers.BC0UHUHZ.js +6 -0
  38. package/dist/layers.BEsDNARG.js +2966 -0
  39. package/dist/layers.BIFfWqjp.js +6 -0
  40. package/dist/layers.BIRO82v2.js +1 -0
  41. package/dist/layers.BIXkxpJg.js +7 -0
  42. package/dist/layers.BIeVwYKL.js +1 -0
  43. package/dist/layers.BJDrjORS.js +244 -0
  44. package/dist/layers.BJWQnQ1b.js +931 -0
  45. package/dist/layers.BKA3G4tE.js +8 -0
  46. package/dist/layers.BKcOrB7G.js +8 -0
  47. package/dist/layers.BLd2spTm.js +1 -0
  48. package/dist/layers.BLomL8Y1.js +40 -0
  49. package/dist/layers.BOGcxS4S.js +11 -0
  50. package/dist/layers.BPpqQ2zl.js +10 -0
  51. package/dist/layers.BQGV7_aP.js +7 -0
  52. package/dist/layers.BQvMgKOV.js +257 -0
  53. package/dist/layers.BRVeeDcH.js +802 -0
  54. package/dist/layers.BSB9eX8_.js +96 -0
  55. package/dist/layers.BSDp4pjf.js +160 -0
  56. package/dist/layers.BSTBZrFn.js +1 -0
  57. package/dist/layers.BWwCeuKP.js +39 -0
  58. package/dist/layers.BXYVnzZo.js +10 -0
  59. package/dist/layers.BYxlPasW.js +9 -0
  60. package/dist/layers.B_C8Ox8-.js +320 -0
  61. package/dist/layers.B_rZy9ZE.js +10 -0
  62. package/dist/layers.BbCfEXyj.js +55 -0
  63. package/dist/layers.Becl7PvM.js +1 -0
  64. package/dist/layers.BekArbNQ.js +501 -0
  65. package/dist/layers.BgOa2ZQq.js +7 -0
  66. package/dist/layers.BhZmc2PE.js +1 -0
  67. package/dist/layers.BhaSD27u.js +8 -0
  68. package/dist/layers.BiJ8hfRt.js +1510 -0
  69. package/dist/layers.Bm7EN78W.js +5 -0
  70. package/dist/layers.BocrFl_z.js +1265 -0
  71. package/dist/layers.BpilXLfW.js +6 -0
  72. package/dist/layers.BrBnUsI5.js +41 -0
  73. package/dist/layers.BrhJtZkc.js +84 -0
  74. package/dist/layers.Bsxy-Zmv.js +7 -0
  75. package/dist/layers.Bu9go6nF.js +10 -0
  76. package/dist/layers.BuJFmhxG.js +1 -0
  77. package/dist/layers.BuNBio9d.js +10 -0
  78. package/dist/layers.BufbpNF2.js +35 -0
  79. package/dist/layers.Bv6t74Ng.js +37 -0
  80. package/dist/layers.Bw7AFM_C.js +39 -0
  81. package/dist/layers.ByEhw12k.js +40 -0
  82. package/dist/layers.Bz8CGnnD.js +32 -0
  83. package/dist/layers.BzfTuld3.js +304 -0
  84. package/dist/layers.C-f2Ts9u.js +32 -0
  85. package/dist/layers.C0Lgw_Sx.js +11688 -0
  86. package/dist/layers.C0xLKPSB.js +7 -0
  87. package/dist/layers.C8_lu5UH.js +23 -0
  88. package/dist/layers.C8d9V9GQ.js +1619 -0
  89. package/dist/layers.C9KUAI3S.js +9 -0
  90. package/dist/layers.C9Qm4iyY.js +51 -0
  91. package/dist/layers.CAAtHbGC.js +1034 -0
  92. package/dist/layers.CBTk7340.js +41 -0
  93. package/dist/layers.CCGTXI7t.js +37 -0
  94. package/dist/layers.CDnEPiFS.js +13 -0
  95. package/dist/layers.CF0jHwg8.js +36 -0
  96. package/dist/layers.CFEmW02q.js +189 -0
  97. package/dist/layers.CFpY72SE.js +1 -0
  98. package/dist/layers.CG-pQKxy.js +32 -0
  99. package/dist/layers.CHZsXQcr.js +1 -0
  100. package/dist/layers.CIBiA4cp.js +9 -0
  101. package/dist/layers.CJ5oFhK5.js +9 -0
  102. package/dist/layers.CLG-12Ft.js +803 -0
  103. package/dist/layers.CLQVPEWO.js +70 -0
  104. package/dist/layers.CNAZOY0z.js +42 -0
  105. package/dist/layers.CNAp0agL.js +11 -0
  106. package/dist/layers.CNNAjKqx.js +42 -0
  107. package/dist/layers.CO0NalVl.js +1283 -0
  108. package/dist/layers.COTtcXWr.js +38 -0
  109. package/dist/layers.COsJBDU8.js +11 -0
  110. package/dist/layers.CPdjh9hT.js +373 -0
  111. package/dist/layers.CSFyrYzY.js +118 -0
  112. package/dist/layers.CX_ayh7E.js +42 -0
  113. package/dist/layers.CeNyh2LV.js +41 -0
  114. package/dist/layers.Ce_CBSin.js +9 -0
  115. package/dist/layers.CfjCZzg8.js +33 -0
  116. package/dist/layers.CfsQNfbN.js +35 -0
  117. package/dist/layers.CgqehJlq.js +268 -0
  118. package/dist/layers.CildyhOW.js +1 -0
  119. package/dist/layers.CjBfNqWg.js +207 -0
  120. package/dist/layers.CjZ_56YO.js +39 -0
  121. package/dist/layers.CqVTtuYm.js +6 -0
  122. package/dist/layers.Ct7y2KbU.js +1 -0
  123. package/dist/layers.CtASemAs.js +1 -0
  124. package/dist/layers.CvCe_XZO.js +44 -0
  125. package/dist/layers.CvF4WyAB.js +8 -0
  126. package/dist/layers.CvgnifSj.js +10 -0
  127. package/dist/layers.CyGuH0wW.js +84 -0
  128. package/dist/layers.Cyzu9PKQ.js +1 -0
  129. package/dist/layers.CzZCiNn3.js +1 -0
  130. package/dist/layers.Cz_HcKZR.js +9 -0
  131. package/dist/layers.CzqAzeMM.js +295 -0
  132. package/dist/layers.D-0DKizI.js +36 -0
  133. package/dist/layers.D-4uOpUj.js +2479 -0
  134. package/dist/layers.D-P1auk3.js +40 -0
  135. package/dist/layers.D-z4IZwp.js +139 -0
  136. package/dist/layers.D0zn4_Mx.js +1 -0
  137. package/dist/layers.D176Y7Vo.js +437 -0
  138. package/dist/layers.D1TLKJdE.js +2 -0
  139. package/dist/layers.D4SM8Ihn.js +10 -0
  140. package/dist/layers.D4T8fTcj.js +1223 -0
  141. package/dist/layers.D7jGxypv.js +8 -0
  142. package/dist/layers.D819V-1U.js +5 -0
  143. package/dist/layers.D92dwfZm.js +9 -0
  144. package/dist/layers.D9oxm2Q3.js +36 -0
  145. package/dist/layers.DAUiVpfA.js +41 -0
  146. package/dist/layers.DAgjLyi0.js +21938 -0
  147. package/dist/layers.DG5DkMsX.js +4 -0
  148. package/dist/layers.DG5nJvev.js +41 -0
  149. package/dist/layers.DGIvTJgm.js +1 -0
  150. package/dist/layers.DGKHsEgL.js +37 -0
  151. package/dist/layers.DJINSxsc.js +1 -0
  152. package/dist/layers.DJJF7QHv.js +39 -0
  153. package/dist/layers.DLK9DV2V.js +40 -0
  154. package/dist/layers.DLNMmOF6.js +10 -0
  155. package/dist/layers.DLwuMfdd.js +84 -0
  156. package/dist/layers.DMkBISW1.js +1 -0
  157. package/dist/layers.DN9HoVxI.js +18 -0
  158. package/dist/layers.DO3jf13r.js +139 -0
  159. package/dist/layers.DOrgOHBr.js +1 -0
  160. package/dist/layers.DRi0nv8t.js +769 -0
  161. package/dist/layers.DTEtUQ-N.js +11 -0
  162. package/dist/layers.DXM-M_t4.js +904 -0
  163. package/dist/layers.DZ4rueAA.js +1126 -0
  164. package/dist/layers.DZAc2rlA.js +19 -0
  165. package/dist/layers.DZAwluRX.js +7 -0
  166. package/dist/layers.D__Ge0jR.js +1580 -0
  167. package/dist/layers.D_qBxnuW.js +6 -0
  168. package/dist/layers.Da7N3t0o.js +59 -0
  169. package/dist/layers.DbCde96z.js +61 -0
  170. package/dist/layers.DbaKVP5e.js +1 -0
  171. package/dist/layers.Deuxf8WS.js +37 -0
  172. package/dist/layers.DgQ6wjQ6.js +1089 -0
  173. package/dist/layers.Dhs3Sikn.js +230 -0
  174. package/dist/layers.DizdRJDv.js +10 -0
  175. package/dist/layers.DjUOC4st.js +16 -0
  176. package/dist/layers.DkRaFpYI.js +39 -0
  177. package/dist/layers.Dn0j_OK5.js +8 -0
  178. package/dist/layers.DneF9QFl.js +39 -0
  179. package/dist/layers.DnohNr8z.js +2 -0
  180. package/dist/layers.DtjaV33P.js +4 -0
  181. package/dist/layers.DtwPvqvM.js +1359 -0
  182. package/dist/layers.DuQS64hQ.js +35 -0
  183. package/dist/layers.DvcL-c1J.js +10 -0
  184. package/dist/layers.DwGEUGi4.js +1 -0
  185. package/dist/layers.Dwf-cmfl.js +1 -0
  186. package/dist/layers.DxA6ocdw.js +70 -0
  187. package/dist/layers.DxuaZtRi.js +116 -0
  188. package/dist/layers.Dy1naDTQ.js +14 -0
  189. package/dist/layers.DyVeJ5nq.js +41 -0
  190. package/dist/layers.Dz5Fekdu.js +8 -0
  191. package/dist/layers.DzTjTsrg.js +52 -0
  192. package/dist/layers.DzWSztoe.js +8 -0
  193. package/dist/layers.DzWUGmmi.js +21763 -0
  194. package/dist/layers.Fv2UzX_J.js +40 -0
  195. package/dist/layers.GGg0Uela.js +48146 -0
  196. package/dist/layers.HISmbvvZ.js +41 -0
  197. package/dist/layers.J-SBicA2.js +39 -0
  198. package/dist/layers.JWCLFILJ.js +1 -0
  199. package/dist/layers.Jy2BJnrD.js +7 -0
  200. package/dist/layers.KNG61fVD.js +32 -0
  201. package/dist/layers.KZKDnGbd.js +9166 -0
  202. package/dist/layers.Kcxw1ZN5.js +8 -0
  203. package/dist/layers.LG7pZboq.js +42 -0
  204. package/dist/layers.N7uLiJJF.js +791 -0
  205. package/dist/layers.P0mMn9V6.js +4 -0
  206. package/dist/layers.RY1Pc_vI.js +39 -0
  207. package/dist/layers.T5F5IY6f.js +38 -0
  208. package/dist/layers.UBsT16id.js +9 -0
  209. package/dist/layers.Ww9bBIaA.js +32 -0
  210. package/dist/layers.YUbPYUxB.js +1088 -0
  211. package/dist/layers.YejPlmok.js +34 -0
  212. package/dist/layers.YsjMDe1Z.js +8 -0
  213. package/dist/layers._IMfh4Om.js +1 -0
  214. package/dist/layers.b0h5ZBmD.js +61 -0
  215. package/dist/layers.cXShihLV.js +793 -0
  216. package/dist/layers.dBCFbDUQ.js +5 -0
  217. package/dist/layers.dsZSDggl.js +1 -0
  218. package/dist/layers.dzPD2Tq6.js +8 -0
  219. package/dist/layers.fdHV7i_n.js +47540 -0
  220. package/dist/layers.g0MJEmgM.js +36 -0
  221. package/dist/layers.g6KGAlYG.js +7 -0
  222. package/dist/layers.gAwY5NlW.js +6 -0
  223. package/dist/layers.hJXmn9h9.js +3 -0
  224. package/dist/layers.hMr_bHrn.js +1 -0
  225. package/dist/layers.hweLqW3I.js +261 -0
  226. package/dist/layers.ifrGR0tH.js +1 -0
  227. package/dist/layers.jS5D2j9k.js +186 -0
  228. package/dist/layers.k5zSy7kx.js +40 -0
  229. package/dist/layers.ku7sc5w7.js +40 -0
  230. package/dist/layers.l0OsrJxT.js +9 -0
  231. package/dist/layers.lCpg7dOn.js +21 -0
  232. package/dist/layers.mcrEJ5IL.js +1 -0
  233. package/dist/layers.mkPf05Ff.js +960 -0
  234. package/dist/layers.n8BNeBDu.js +40 -0
  235. package/dist/layers.nesKhKqv.js +9 -0
  236. package/dist/layers.o8uxn2z6.js +6 -0
  237. package/dist/layers.qKFGZSrv.js +42 -0
  238. package/dist/layers.tehvhFRL.js +11 -0
  239. package/dist/layers.yaVCGcoo.js +7 -0
  240. package/package.json +1 -1
@@ -0,0 +1,1034 @@
1
+ import { n as X } from "./layers.fdHV7i_n.js";
2
+ import { c as T } from "./layers.BpilXLfW.js";
3
+ function N(H, Y) {
4
+ for (var d = 0; d < Y.length; d++) {
5
+ const I = Y[d];
6
+ if (typeof I != "string" && !Array.isArray(I)) {
7
+ for (const G in I)
8
+ if (G !== "default" && !(G in H)) {
9
+ const v = Object.getOwnPropertyDescriptor(I, G);
10
+ v && Object.defineProperty(H, G, v.get ? v : {
11
+ enumerable: !0,
12
+ get: () => I[G]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(H, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var W = { exports: {} };
20
+ /*!
21
+
22
+ pica
23
+ https://github.com/nodeca/pica
24
+
25
+ */
26
+ var z;
27
+ function Z() {
28
+ return z || (z = 1, (function(H, Y) {
29
+ (function(d) {
30
+ H.exports = d();
31
+ })(function() {
32
+ return (/* @__PURE__ */ (function() {
33
+ function d(I, G, v) {
34
+ function o(a, t) {
35
+ if (!G[a]) {
36
+ if (!I[a]) {
37
+ var e = typeof T == "function" && T;
38
+ if (!t && e) return e(a, !0);
39
+ if (A) return A(a, !0);
40
+ var i = new Error("Cannot find module '" + a + "'");
41
+ throw i.code = "MODULE_NOT_FOUND", i;
42
+ }
43
+ var h = G[a] = { exports: {} };
44
+ I[a][0].call(h.exports, function(c) {
45
+ var f = I[a][1][c];
46
+ return o(f || c);
47
+ }, h, h.exports, d, I, G, v);
48
+ }
49
+ return G[a].exports;
50
+ }
51
+ for (var A = typeof T == "function" && T, n = 0; n < v.length; n++) o(v[n]);
52
+ return o;
53
+ }
54
+ return d;
55
+ })())({ 1: [function(d, I, G) {
56
+ var v = d("inherits"), o = d("multimath"), A = d("./mm_unsharp_mask"), n = d("./mm_resize");
57
+ function a(t) {
58
+ var e = t || [], i = {
59
+ js: e.indexOf("js") >= 0,
60
+ wasm: e.indexOf("wasm") >= 0
61
+ };
62
+ o.call(this, i), this.features = {
63
+ js: i.js,
64
+ wasm: i.wasm && this.has_wasm()
65
+ }, this.use(A), this.use(n);
66
+ }
67
+ v(a, o), a.prototype.resizeAndUnsharp = function(e, i) {
68
+ var h = this.resize(e, i);
69
+ return e.unsharpAmount && this.unsharp_mask(h, e.toWidth, e.toHeight, e.unsharpAmount, e.unsharpRadius, e.unsharpThreshold), h;
70
+ }, I.exports = a;
71
+ }, { "./mm_resize": 4, "./mm_unsharp_mask": 9, inherits: 19, multimath: 20 }], 2: [function(d, I, G) {
72
+ function v(n) {
73
+ return n < 0 ? 0 : n > 255 ? 255 : n;
74
+ }
75
+ function o(n, a, t, e, i, h) {
76
+ var c, f, _, p, m, w, B, y, E, R, b, F = 0, D = 0;
77
+ for (E = 0; E < e; E++) {
78
+ for (m = 0, R = 0; R < i; R++) {
79
+ for (w = h[m++], B = h[m++], y = F + w * 4 | 0, c = f = _ = p = 0; B > 0; B--)
80
+ b = h[m++], p = p + b * n[y + 3] | 0, _ = _ + b * n[y + 2] | 0, f = f + b * n[y + 1] | 0, c = c + b * n[y] | 0, y = y + 4 | 0;
81
+ a[D + 3] = v(
82
+ p + 8192 >> 14
83
+ /*FIXED_FRAC_BITS*/
84
+ ), a[D + 2] = v(
85
+ _ + 8192 >> 14
86
+ /*FIXED_FRAC_BITS*/
87
+ ), a[D + 1] = v(
88
+ f + 8192 >> 14
89
+ /*FIXED_FRAC_BITS*/
90
+ ), a[D] = v(
91
+ c + 8192 >> 14
92
+ /*FIXED_FRAC_BITS*/
93
+ ), D = D + e * 4 | 0;
94
+ }
95
+ D = (E + 1) * 4 | 0, F = (E + 1) * t * 4 | 0;
96
+ }
97
+ }
98
+ function A(n, a, t, e, i, h) {
99
+ var c, f, _, p, m, w, B, y, E, R, b, F = 0, D = 0;
100
+ for (E = 0; E < e; E++) {
101
+ for (m = 0, R = 0; R < i; R++) {
102
+ for (w = h[m++], B = h[m++], y = F + w * 4 | 0, c = f = _ = p = 0; B > 0; B--)
103
+ b = h[m++], p = p + b * n[y + 3] | 0, _ = _ + b * n[y + 2] | 0, f = f + b * n[y + 1] | 0, c = c + b * n[y] | 0, y = y + 4 | 0;
104
+ a[D + 3] = v(
105
+ p + 8192 >> 14
106
+ /*FIXED_FRAC_BITS*/
107
+ ), a[D + 2] = v(
108
+ _ + 8192 >> 14
109
+ /*FIXED_FRAC_BITS*/
110
+ ), a[D + 1] = v(
111
+ f + 8192 >> 14
112
+ /*FIXED_FRAC_BITS*/
113
+ ), a[D] = v(
114
+ c + 8192 >> 14
115
+ /*FIXED_FRAC_BITS*/
116
+ ), D = D + e * 4 | 0;
117
+ }
118
+ D = (E + 1) * 4 | 0, F = (E + 1) * t * 4 | 0;
119
+ }
120
+ }
121
+ I.exports = {
122
+ convolveHorizontally: o,
123
+ convolveVertically: A
124
+ };
125
+ }, {}], 3: [function(d, I, G) {
126
+ I.exports = "AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEXA2AAAGAGf39/f39/AGAHf39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgYGAX8AQQALB1cFEV9fd2FzbV9jYWxsX2N0b3JzAAAIY29udm9sdmUAAQpjb252b2x2ZUhWAAIMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAK7AMDAwABC8YDAQ9/AkAgA0UNACAERQ0AA0AgDCENQQAhE0EAIQcDQCAHQQJqIQYCfyAHQQF0IAVqIgcuAQIiFEUEQEGAwAAhCEGAwAAhCUGAwAAhCkGAwAAhCyAGDAELIBIgBy4BAGohCEEAIQsgFCEHQQAhDiAGIQlBACEPQQAhEANAIAUgCUEBdGouAQAiESAAIAhBAnRqKAIAIgpBGHZsIBBqIRAgCkH/AXEgEWwgC2ohCyAKQRB2Qf8BcSARbCAPaiEPIApBCHZB/wFxIBFsIA5qIQ4gCEEBaiEIIAlBAWohCSAHQQFrIgcNAAsgC0GAQGshCCAOQYBAayEJIA9BgEBrIQogEEGAQGshCyAGIBRqCyEHIAEgDUECdGogCUEOdSIGQf8BIAZB/wFIGyIGQQAgBkEAShtBCHRBgP4DcSAKQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EQdEGAgPwHcSALQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobcjYCACADIA1qIQ0gE0EBaiITIARHDQALIAxBAWoiDCACbCESIAMgDEcNAAsLCx4AQQAgAiADIAQgBSAAEAEgAkEAIAQgBSAGIAEQAQs=";
127
+ }, {}], 4: [function(d, I, G) {
128
+ I.exports = {
129
+ name: "resize",
130
+ fn: d("./resize"),
131
+ wasm_fn: d("./resize_wasm"),
132
+ wasm_src: d("./convolve_wasm_base64")
133
+ };
134
+ }, { "./convolve_wasm_base64": 3, "./resize": 5, "./resize_wasm": 8 }], 5: [function(d, I, G) {
135
+ var v = d("./resize_filter_gen"), o = d("./convolve").convolveHorizontally, A = d("./convolve").convolveVertically;
136
+ function n(a, t, e) {
137
+ for (var i = 3, h = t * e * 4 | 0; i < h; )
138
+ a[i] = 255, i = i + 4 | 0;
139
+ }
140
+ I.exports = function(t) {
141
+ var e = t.src, i = t.width, h = t.height, c = t.toWidth, f = t.toHeight, _ = t.scaleX || t.toWidth / t.width, p = t.scaleY || t.toHeight / t.height, m = t.offsetX || 0, w = t.offsetY || 0, B = t.dest || new Uint8Array(c * f * 4), y = typeof t.quality > "u" ? 3 : t.quality, E = t.alpha || !1, R = v(y, i, c, _, m), b = v(y, h, f, p, w), F = new Uint8Array(c * h * 4);
142
+ return o(e, F, i, h, c, R), A(F, B, h, c, f, b), E || n(B, c, f), B;
143
+ };
144
+ }, { "./convolve": 2, "./resize_filter_gen": 6 }], 6: [function(d, I, G) {
145
+ var v = d("./resize_filter_info"), o = 14;
146
+ function A(n) {
147
+ return Math.round(n * ((1 << o) - 1));
148
+ }
149
+ I.exports = function(a, t, e, i, h) {
150
+ var c = v[a].filter, f = 1 / i, _ = Math.min(1, i), p = v[a].win / _, m, w, B, y, E, R, b, F, D, x, S, j, k, r, u, s, l, g = Math.floor((p + 1) * 2), M = new Int16Array((g + 2) * e), C = 0, Q = !M.subarray || !M.set;
151
+ for (m = 0; m < e; m++) {
152
+ for (w = (m + 0.5) * f + h, B = Math.max(0, Math.floor(w - p)), y = Math.min(t - 1, Math.ceil(w + p)), E = y - B + 1, R = new Float32Array(E), b = new Int16Array(E), F = 0, D = B, x = 0; D <= y; D++, x++)
153
+ S = c((D + 0.5 - w) * _), F += S, R[x] = S;
154
+ for (j = 0, x = 0; x < R.length; x++)
155
+ k = R[x] / F, j += k, b[x] = A(k);
156
+ for (b[e >> 1] += A(1 - j), r = 0; r < b.length && b[r] === 0; )
157
+ r++;
158
+ if (r < b.length) {
159
+ for (u = b.length - 1; u > 0 && b[u] === 0; )
160
+ u--;
161
+ if (s = B + r, l = u - r + 1, M[C++] = s, M[C++] = l, !Q)
162
+ M.set(b.subarray(r, u + 1), C), C += l;
163
+ else
164
+ for (x = r; x <= u; x++)
165
+ M[C++] = b[x];
166
+ } else
167
+ M[C++] = 0, M[C++] = 0;
168
+ }
169
+ return M;
170
+ };
171
+ }, { "./resize_filter_info": 7 }], 7: [function(d, I, G) {
172
+ I.exports = [{
173
+ // Nearest neibor (Box)
174
+ win: 0.5,
175
+ filter: function(o) {
176
+ return o >= -0.5 && o < 0.5 ? 1 : 0;
177
+ }
178
+ }, {
179
+ // Hamming
180
+ win: 1,
181
+ filter: function(o) {
182
+ if (o <= -1 || o >= 1)
183
+ return 0;
184
+ if (o > -11920929e-14 && o < 11920929e-14)
185
+ return 1;
186
+ var A = o * Math.PI;
187
+ return Math.sin(A) / A * (0.54 + 0.46 * Math.cos(A / 1));
188
+ }
189
+ }, {
190
+ // Lanczos, win = 2
191
+ win: 2,
192
+ filter: function(o) {
193
+ if (o <= -2 || o >= 2)
194
+ return 0;
195
+ if (o > -11920929e-14 && o < 11920929e-14)
196
+ return 1;
197
+ var A = o * Math.PI;
198
+ return Math.sin(A) / A * Math.sin(A / 2) / (A / 2);
199
+ }
200
+ }, {
201
+ // Lanczos, win = 3
202
+ win: 3,
203
+ filter: function(o) {
204
+ if (o <= -3 || o >= 3)
205
+ return 0;
206
+ if (o > -11920929e-14 && o < 11920929e-14)
207
+ return 1;
208
+ var A = o * Math.PI;
209
+ return Math.sin(A) / A * Math.sin(A / 3) / (A / 3);
210
+ }
211
+ }];
212
+ }, {}], 8: [function(d, I, G) {
213
+ var v = d("./resize_filter_gen");
214
+ function o(t, e, i) {
215
+ for (var h = 3, c = e * i * 4 | 0; h < c; )
216
+ t[h] = 255, h = h + 4 | 0;
217
+ }
218
+ function A(t) {
219
+ return new Uint8Array(t.buffer, 0, t.byteLength);
220
+ }
221
+ var n = !0;
222
+ try {
223
+ n = new Uint32Array(new Uint8Array([1, 0, 0, 0]).buffer)[0] === 1;
224
+ } catch {
225
+ }
226
+ function a(t, e, i) {
227
+ if (n) {
228
+ e.set(A(t), i);
229
+ return;
230
+ }
231
+ for (var h = i, c = 0; c < t.length; c++) {
232
+ var f = t[c];
233
+ e[h++] = f & 255, e[h++] = f >> 8 & 255;
234
+ }
235
+ }
236
+ I.exports = function(e) {
237
+ var i = e.src, h = e.width, c = e.height, f = e.toWidth, _ = e.toHeight, p = e.scaleX || e.toWidth / e.width, m = e.scaleY || e.toHeight / e.height, w = e.offsetX || 0, B = e.offsetY || 0, y = e.dest || new Uint8Array(f * _ * 4), E = typeof e.quality > "u" ? 3 : e.quality, R = e.alpha || !1, b = v(E, h, f, p, w), F = v(E, c, _, m, B), D = 0, x = this.__align(D + Math.max(i.byteLength, y.byteLength)), S = this.__align(x + c * f * 4), j = this.__align(S + b.byteLength), k = j + F.byteLength, r = this.__instance("resize", k), u = new Uint8Array(this.__memory.buffer), s = new Uint32Array(this.__memory.buffer), l = new Uint32Array(i.buffer);
238
+ s.set(l), a(b, u, S), a(F, u, j);
239
+ var g = r.exports.convolveHV || r.exports._convolveHV;
240
+ g(S, j, x, h, c, f, _);
241
+ var M = new Uint32Array(y.buffer);
242
+ return M.set(new Uint32Array(this.__memory.buffer, 0, _ * f)), R || o(y, f, _), y;
243
+ };
244
+ }, { "./resize_filter_gen": 6 }], 9: [function(d, I, G) {
245
+ I.exports = {
246
+ name: "unsharp_mask",
247
+ fn: d("./unsharp_mask"),
248
+ wasm_fn: d("./unsharp_mask_wasm"),
249
+ wasm_src: d("./unsharp_mask_wasm_base64")
250
+ };
251
+ }, { "./unsharp_mask": 10, "./unsharp_mask_wasm": 11, "./unsharp_mask_wasm_base64": 12 }], 10: [function(d, I, G) {
252
+ var v = d("glur/mono16");
253
+ function o(A, n, a) {
254
+ for (var t = n * a, e = new Uint16Array(t), i, h, c, f, _ = 0; _ < t; _++)
255
+ i = A[4 * _], h = A[4 * _ + 1], c = A[4 * _ + 2], f = i >= h && i >= c ? i : h >= c && h >= i ? h : c, e[_] = f << 8;
256
+ return e;
257
+ }
258
+ I.exports = function(n, a, t, e, i, h) {
259
+ var c, f, _, p, m;
260
+ if (!(e === 0 || i < 0.5)) {
261
+ i > 2 && (i = 2);
262
+ var w = o(n, a, t), B = new Uint16Array(w);
263
+ v(B, a, t, i);
264
+ for (var y = e / 100 * 4096 + 0.5 | 0, E = h << 8, R = a * t, b = 0; b < R; b++)
265
+ c = w[b], p = c - B[b], Math.abs(p) >= E && (f = c + (y * p + 2048 >> 12), f = f > 65280 ? 65280 : f, f = f < 0 ? 0 : f, c = c !== 0 ? c : 1, _ = (f << 12) / c | 0, m = b * 4, n[m] = n[m] * _ + 2048 >> 12, n[m + 1] = n[m + 1] * _ + 2048 >> 12, n[m + 2] = n[m + 2] * _ + 2048 >> 12);
266
+ }
267
+ };
268
+ }, { "glur/mono16": 18 }], 11: [function(d, I, G) {
269
+ I.exports = function(o, A, n, a, t, e) {
270
+ if (!(a === 0 || t < 0.5)) {
271
+ t > 2 && (t = 2);
272
+ var i = A * n, h = i * 4, c = i * 2, f = i * 2, _ = Math.max(A, n) * 4, p = 32, m = 0, w = h, B = w + c, y = B + f, E = y + f, R = E + _, b = this.__instance("unsharp_mask", h + c + f * 2 + _ + p, {
273
+ exp: Math.exp
274
+ }), F = new Uint32Array(o.buffer), D = new Uint32Array(this.__memory.buffer);
275
+ D.set(F);
276
+ var x = b.exports.hsv_v16 || b.exports._hsv_v16;
277
+ x(m, w, A, n), x = b.exports.blurMono16 || b.exports._blurMono16, x(w, B, y, E, R, A, n, t), x = b.exports.unsharp || b.exports._unsharp, x(m, m, w, B, A, n, a, e), F.set(new Uint32Array(this.__memory.buffer, 0, i));
278
+ }
279
+ };
280
+ }, {}], 12: [function(d, I, G) {
281
+ I.exports = "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";
282
+ }, {}], 13: [function(d, I, G) {
283
+ var v = 100;
284
+ function o(A, n) {
285
+ this.create = A, this.available = [], this.acquired = {}, this.lastId = 1, this.timeoutId = 0, this.idle = n || 2e3;
286
+ }
287
+ o.prototype.acquire = function() {
288
+ var A = this, n;
289
+ return this.available.length !== 0 ? n = this.available.pop() : (n = this.create(), n.id = this.lastId++, n.release = function() {
290
+ return A.release(n);
291
+ }), this.acquired[n.id] = n, n;
292
+ }, o.prototype.release = function(A) {
293
+ var n = this;
294
+ delete this.acquired[A.id], A.lastUsed = Date.now(), this.available.push(A), this.timeoutId === 0 && (this.timeoutId = setTimeout(function() {
295
+ return n.gc();
296
+ }, v));
297
+ }, o.prototype.gc = function() {
298
+ var A = this, n = Date.now();
299
+ this.available = this.available.filter(function(a) {
300
+ return n - a.lastUsed > A.idle ? (a.destroy(), !1) : !0;
301
+ }), this.available.length !== 0 ? this.timeoutId = setTimeout(function() {
302
+ return A.gc();
303
+ }, v) : this.timeoutId = 0;
304
+ }, I.exports = o;
305
+ }, {}], 14: [function(d, I, G) {
306
+ var v = 2;
307
+ I.exports = function(A, n, a, t, e, i) {
308
+ var h = a / A, c = t / n, f = (2 * i + v + 1) / e;
309
+ if (f > 0.5) return [[a, t]];
310
+ var _ = Math.ceil(Math.log(Math.min(h, c)) / Math.log(f));
311
+ if (_ <= 1) return [[a, t]];
312
+ for (var p = [], m = 0; m < _; m++) {
313
+ var w = Math.round(Math.pow(Math.pow(A, _ - m - 1) * Math.pow(a, m + 1), 1 / _)), B = Math.round(Math.pow(Math.pow(n, _ - m - 1) * Math.pow(t, m + 1), 1 / _));
314
+ p.push([w, B]);
315
+ }
316
+ return p;
317
+ };
318
+ }, {}], 15: [function(d, I, G) {
319
+ var v = 1e-5;
320
+ function o(n) {
321
+ var a = Math.round(n);
322
+ return Math.abs(n - a) < v ? a : Math.floor(n);
323
+ }
324
+ function A(n) {
325
+ var a = Math.round(n);
326
+ return Math.abs(n - a) < v ? a : Math.ceil(n);
327
+ }
328
+ I.exports = function(a) {
329
+ var t = a.toWidth / a.width, e = a.toHeight / a.height, i = o(a.srcTileSize * t) - 2 * a.destTileBorder, h = o(a.srcTileSize * e) - 2 * a.destTileBorder;
330
+ if (i < 1 || h < 1)
331
+ throw new Error("Internal error in pica: target tile width/height is too small.");
332
+ var c, f, _, p, m, w, B = [], y;
333
+ for (p = 0; p < a.toHeight; p += h)
334
+ for (_ = 0; _ < a.toWidth; _ += i)
335
+ c = _ - a.destTileBorder, c < 0 && (c = 0), m = _ + i + a.destTileBorder - c, c + m >= a.toWidth && (m = a.toWidth - c), f = p - a.destTileBorder, f < 0 && (f = 0), w = p + h + a.destTileBorder - f, f + w >= a.toHeight && (w = a.toHeight - f), y = {
336
+ toX: c,
337
+ toY: f,
338
+ toWidth: m,
339
+ toHeight: w,
340
+ toInnerX: _,
341
+ toInnerY: p,
342
+ toInnerWidth: i,
343
+ toInnerHeight: h,
344
+ offsetX: c / t - o(c / t),
345
+ offsetY: f / e - o(f / e),
346
+ scaleX: t,
347
+ scaleY: e,
348
+ x: o(c / t),
349
+ y: o(f / e),
350
+ width: A(m / t),
351
+ height: A(w / e)
352
+ }, B.push(y);
353
+ return B;
354
+ };
355
+ }, {}], 16: [function(d, I, G) {
356
+ function v(o) {
357
+ return Object.prototype.toString.call(o);
358
+ }
359
+ I.exports.isCanvas = function(A) {
360
+ var n = v(A);
361
+ return n === "[object HTMLCanvasElement]" || n === "[object OffscreenCanvas]" || n === "[object Canvas]";
362
+ }, I.exports.isImage = function(A) {
363
+ return v(A) === "[object HTMLImageElement]";
364
+ }, I.exports.isImageBitmap = function(A) {
365
+ return v(A) === "[object ImageBitmap]";
366
+ }, I.exports.limiter = function(A) {
367
+ var n = 0, a = [];
368
+ function t() {
369
+ n < A && a.length && (n++, a.shift()());
370
+ }
371
+ return function(i) {
372
+ return new Promise(function(h, c) {
373
+ a.push(function() {
374
+ i().then(function(f) {
375
+ h(f), n--, t();
376
+ }, function(f) {
377
+ c(f), n--, t();
378
+ });
379
+ }), t();
380
+ });
381
+ };
382
+ }, I.exports.cib_quality_name = function(A) {
383
+ switch (A) {
384
+ case 0:
385
+ return "pixelated";
386
+ case 1:
387
+ return "low";
388
+ case 2:
389
+ return "medium";
390
+ }
391
+ return "high";
392
+ }, I.exports.cib_support = function(A) {
393
+ return Promise.resolve().then(function() {
394
+ if (typeof createImageBitmap > "u")
395
+ return !1;
396
+ var n = A(100, 100);
397
+ return createImageBitmap(n, 0, 0, 100, 100, {
398
+ resizeWidth: 10,
399
+ resizeHeight: 10,
400
+ resizeQuality: "high"
401
+ }).then(function(a) {
402
+ var t = a.width === 10;
403
+ return a.close(), n = null, t;
404
+ });
405
+ }).catch(function() {
406
+ return !1;
407
+ });
408
+ }, I.exports.worker_offscreen_canvas_support = function() {
409
+ return new Promise(function(A, n) {
410
+ if (typeof OffscreenCanvas > "u") {
411
+ A(!1);
412
+ return;
413
+ }
414
+ function a(i) {
415
+ if (typeof createImageBitmap > "u") {
416
+ i.postMessage(!1);
417
+ return;
418
+ }
419
+ Promise.resolve().then(function() {
420
+ var h = new OffscreenCanvas(10, 10), c = h.getContext("2d");
421
+ return c.rect(0, 0, 1, 1), createImageBitmap(h, 0, 0, 1, 1);
422
+ }).then(function() {
423
+ return i.postMessage(!0);
424
+ }, function() {
425
+ return i.postMessage(!1);
426
+ });
427
+ }
428
+ var t = btoa("(".concat(a.toString(), ")(self);")), e = new Worker("data:text/javascript;base64,".concat(t));
429
+ e.onmessage = function(i) {
430
+ return A(i.data);
431
+ }, e.onerror = n;
432
+ }).then(function(A) {
433
+ return A;
434
+ }, function() {
435
+ return !1;
436
+ });
437
+ }, I.exports.can_use_canvas = function(A) {
438
+ var n = !1;
439
+ try {
440
+ var a = A(2, 1), t = a.getContext("2d"), e = t.createImageData(2, 1);
441
+ e.data[0] = 12, e.data[1] = 23, e.data[2] = 34, e.data[3] = 255, e.data[4] = 45, e.data[5] = 56, e.data[6] = 67, e.data[7] = 255, t.putImageData(e, 0, 0), e = null, e = t.getImageData(0, 0, 2, 1), e.data[0] === 12 && e.data[1] === 23 && e.data[2] === 34 && e.data[3] === 255 && e.data[4] === 45 && e.data[5] === 56 && e.data[6] === 67 && e.data[7] === 255 && (n = !0);
442
+ } catch {
443
+ }
444
+ return n;
445
+ }, I.exports.cib_can_use_region = function() {
446
+ return new Promise(function(A) {
447
+ if (typeof createImageBitmap > "u") {
448
+ A(!1);
449
+ return;
450
+ }
451
+ var n = new Image();
452
+ n.src = "data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z", n.onload = function() {
453
+ createImageBitmap(n, 0, 0, n.width, n.height).then(function(a) {
454
+ a.width === n.width && a.height === n.height ? A(!0) : A(!1);
455
+ }, function() {
456
+ return A(!1);
457
+ });
458
+ }, n.onerror = function() {
459
+ return A(!1);
460
+ };
461
+ });
462
+ };
463
+ }, {}], 17: [function(d, I, G) {
464
+ I.exports = function() {
465
+ var v = d("./mathlib"), o;
466
+ onmessage = function(n) {
467
+ var a = n.data.opts;
468
+ if (!a.src && a.srcBitmap) {
469
+ var t = new OffscreenCanvas(a.width, a.height), e = t.getContext("2d", {
470
+ alpha: !!a.alpha
471
+ });
472
+ e.drawImage(a.srcBitmap, 0, 0), a.src = e.getImageData(0, 0, a.width, a.height).data, t.width = t.height = 0, t = null, a.srcBitmap.close(), a.srcBitmap = null;
473
+ }
474
+ o || (o = new v(n.data.features));
475
+ var i = o.resizeAndUnsharp(a);
476
+ postMessage({
477
+ data: i
478
+ }, [i.buffer]);
479
+ };
480
+ };
481
+ }, { "./mathlib": 1 }], 18: [function(d, I, G) {
482
+ var v, o, A, n, a, t, e, i;
483
+ function h(_) {
484
+ _ < 0.5 && (_ = 0.5);
485
+ var p = Math.exp(0.726 * 0.726) / _, m = Math.exp(-p), w = Math.exp(-2 * p), B = (1 - m) * (1 - m) / (1 + 2 * p * m - w);
486
+ return v = B, o = B * (p - 1) * m, A = B * (p + 1) * m, n = -B * w, a = 2 * m, t = -w, e = (v + o) / (1 - a - t), i = (A + n) / (1 - a - t), new Float32Array([v, o, A, n, a, t, e, i]);
487
+ }
488
+ function c(_, p, m, w, B, y) {
489
+ var E, R, b, F, D, x, S, j, k, r, u, s, l, g;
490
+ for (k = 0; k < y; k++) {
491
+ for (x = k * B, S = k, j = 0, E = _[x], D = E * w[6], F = D, u = w[0], s = w[1], l = w[4], g = w[5], r = 0; r < B; r++)
492
+ R = _[x], b = R * u + E * s + F * l + D * g, D = F, F = b, E = R, m[j] = F, j++, x++;
493
+ for (x--, j--, S += y * (B - 1), E = _[x], D = E * w[7], F = D, R = E, u = w[2], s = w[3], r = B - 1; r >= 0; r--)
494
+ b = R * u + E * s + F * l + D * g, D = F, F = b, E = R, R = _[x], p[S] = m[j] + F, x--, j--, S -= y;
495
+ }
496
+ }
497
+ function f(_, p, m, w) {
498
+ if (w) {
499
+ var B = new Uint16Array(_.length), y = new Float32Array(Math.max(p, m)), E = h(w);
500
+ c(_, B, y, E, p, m), c(B, _, y, E, m, p);
501
+ }
502
+ }
503
+ I.exports = f;
504
+ }, {}], 19: [function(d, I, G) {
505
+ typeof Object.create == "function" ? I.exports = function(o, A) {
506
+ A && (o.super_ = A, o.prototype = Object.create(A.prototype, {
507
+ constructor: {
508
+ value: o,
509
+ enumerable: !1,
510
+ writable: !0,
511
+ configurable: !0
512
+ }
513
+ }));
514
+ } : I.exports = function(o, A) {
515
+ if (A) {
516
+ o.super_ = A;
517
+ var n = function() {
518
+ };
519
+ n.prototype = A.prototype, o.prototype = new n(), o.prototype.constructor = o;
520
+ }
521
+ };
522
+ }, {}], 20: [function(d, I, G) {
523
+ var v = d("object-assign"), o = d("./lib/base64decode"), A = d("./lib/wa_detect"), n = {
524
+ js: !0,
525
+ wasm: !0
526
+ };
527
+ function a(t) {
528
+ if (!(this instanceof a)) return new a(t);
529
+ var e = v({}, n, t || {});
530
+ if (this.options = e, this.__cache = {}, this.__init_promise = null, this.__modules = e.modules || {}, this.__memory = null, this.__wasm = {}, this.__isLE = new Uint32Array(new Uint8Array([1, 0, 0, 0]).buffer)[0] === 1, !this.options.js && !this.options.wasm)
531
+ throw new Error('mathlib: at least "js" or "wasm" should be enabled');
532
+ }
533
+ a.prototype.has_wasm = A, a.prototype.use = function(t) {
534
+ return this.__modules[t.name] = t, this.options.wasm && this.has_wasm() && t.wasm_fn ? this[t.name] = t.wasm_fn : this[t.name] = t.fn, this;
535
+ }, a.prototype.init = function() {
536
+ if (this.__init_promise) return this.__init_promise;
537
+ if (!this.options.js && this.options.wasm && !this.has_wasm())
538
+ return Promise.reject(new Error(`mathlib: only "wasm" was enabled, but it's not supported`));
539
+ var t = this;
540
+ return this.__init_promise = Promise.all(Object.keys(t.__modules).map(function(e) {
541
+ var i = t.__modules[e];
542
+ return !t.options.wasm || !t.has_wasm() || !i.wasm_fn || t.__wasm[e] ? null : WebAssembly.compile(t.__base64decode(i.wasm_src)).then(function(h) {
543
+ t.__wasm[e] = h;
544
+ });
545
+ })).then(function() {
546
+ return t;
547
+ }), this.__init_promise;
548
+ }, a.prototype.__base64decode = o, a.prototype.__reallocate = function(e) {
549
+ if (!this.__memory)
550
+ return this.__memory = new WebAssembly.Memory({
551
+ initial: Math.ceil(e / (64 * 1024))
552
+ }), this.__memory;
553
+ var i = this.__memory.buffer.byteLength;
554
+ return i < e && this.__memory.grow(Math.ceil((e - i) / (64 * 1024))), this.__memory;
555
+ }, a.prototype.__instance = function(e, i, h) {
556
+ if (i && this.__reallocate(i), !this.__wasm[e]) {
557
+ var c = this.__modules[e];
558
+ this.__wasm[e] = new WebAssembly.Module(this.__base64decode(c.wasm_src));
559
+ }
560
+ if (!this.__cache[e]) {
561
+ var f = {
562
+ memoryBase: 0,
563
+ memory: this.__memory,
564
+ tableBase: 0,
565
+ table: new WebAssembly.Table({ initial: 0, element: "anyfunc" })
566
+ };
567
+ this.__cache[e] = new WebAssembly.Instance(this.__wasm[e], {
568
+ env: v(f, h || {})
569
+ });
570
+ }
571
+ return this.__cache[e];
572
+ }, a.prototype.__align = function(e, i) {
573
+ i = i || 8;
574
+ var h = e % i;
575
+ return e + (h ? i - h : 0);
576
+ }, I.exports = a;
577
+ }, { "./lib/base64decode": 21, "./lib/wa_detect": 22, "object-assign": 23 }], 21: [function(d, I, G) {
578
+ var v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
579
+ I.exports = function(A) {
580
+ for (var n = A.replace(/[\r\n=]/g, ""), a = n.length, t = new Uint8Array(a * 3 >> 2), e = 0, i = 0, h = 0; h < a; h++)
581
+ h % 4 === 0 && h && (t[i++] = e >> 16 & 255, t[i++] = e >> 8 & 255, t[i++] = e & 255), e = e << 6 | v.indexOf(n.charAt(h));
582
+ var c = a % 4 * 6;
583
+ return c === 0 ? (t[i++] = e >> 16 & 255, t[i++] = e >> 8 & 255, t[i++] = e & 255) : c === 18 ? (t[i++] = e >> 10 & 255, t[i++] = e >> 2 & 255) : c === 12 && (t[i++] = e >> 4 & 255), t;
584
+ };
585
+ }, {}], 22: [function(d, I, G) {
586
+ var v;
587
+ I.exports = function() {
588
+ if (typeof v < "u" || (v = !1, typeof WebAssembly > "u")) return v;
589
+ try {
590
+ var A = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127, 3, 2, 1, 0, 5, 3, 1, 0, 1, 7, 8, 1, 4, 116, 101, 115, 116, 0, 0, 10, 16, 1, 14, 0, 32, 0, 65, 1, 54, 2, 0, 32, 0, 40, 2, 0, 11]), n = new WebAssembly.Module(A), a = new WebAssembly.Instance(n, {});
591
+ return a.exports.test(4) !== 0 && (v = !0), v;
592
+ } catch {
593
+ }
594
+ return v;
595
+ };
596
+ }, {}], 23: [function(d, I, G) {
597
+ var v = Object.getOwnPropertySymbols, o = Object.prototype.hasOwnProperty, A = Object.prototype.propertyIsEnumerable;
598
+ function n(t) {
599
+ if (t == null)
600
+ throw new TypeError("Object.assign cannot be called with null or undefined");
601
+ return Object(t);
602
+ }
603
+ function a() {
604
+ try {
605
+ if (!Object.assign)
606
+ return !1;
607
+ var t = new String("abc");
608
+ if (t[5] = "de", Object.getOwnPropertyNames(t)[0] === "5")
609
+ return !1;
610
+ for (var e = {}, i = 0; i < 10; i++)
611
+ e["_" + String.fromCharCode(i)] = i;
612
+ var h = Object.getOwnPropertyNames(e).map(function(f) {
613
+ return e[f];
614
+ });
615
+ if (h.join("") !== "0123456789")
616
+ return !1;
617
+ var c = {};
618
+ return "abcdefghijklmnopqrst".split("").forEach(function(f) {
619
+ c[f] = f;
620
+ }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
621
+ } catch {
622
+ return !1;
623
+ }
624
+ }
625
+ I.exports = a() ? Object.assign : function(t, e) {
626
+ for (var i, h = n(t), c, f = 1; f < arguments.length; f++) {
627
+ i = Object(arguments[f]);
628
+ for (var _ in i)
629
+ o.call(i, _) && (h[_] = i[_]);
630
+ if (v) {
631
+ c = v(i);
632
+ for (var p = 0; p < c.length; p++)
633
+ A.call(i, c[p]) && (h[c[p]] = i[c[p]]);
634
+ }
635
+ }
636
+ return h;
637
+ };
638
+ }, {}], 24: [function(d, I, G) {
639
+ var v = arguments[3], o = arguments[4], A = arguments[5], n = JSON.stringify;
640
+ I.exports = function(a, t) {
641
+ for (var e, i = Object.keys(A), h = 0, c = i.length; h < c; h++) {
642
+ var f = i[h], _ = A[f].exports;
643
+ if (_ === a || _ && _.default === a) {
644
+ e = f;
645
+ break;
646
+ }
647
+ }
648
+ if (!e) {
649
+ e = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);
650
+ for (var p = {}, h = 0, c = i.length; h < c; h++) {
651
+ var f = i[h];
652
+ p[f] = f;
653
+ }
654
+ o[e] = [
655
+ "function(require,module,exports){" + a + "(self); }",
656
+ p
657
+ ];
658
+ }
659
+ var m = Math.floor(Math.pow(16, 8) * Math.random()).toString(16), w = {};
660
+ w[e] = e, o[m] = [
661
+ "function(require,module,exports){var f = require(" + n(e) + ");(f.default ? f.default : f)(self);}",
662
+ w
663
+ ];
664
+ var B = {};
665
+ y(m);
666
+ function y(x) {
667
+ B[x] = !0;
668
+ for (var S in o[x][1]) {
669
+ var j = o[x][1][S];
670
+ B[j] || y(j);
671
+ }
672
+ }
673
+ var E = "(" + v + ")({" + Object.keys(B).map(function(x) {
674
+ return n(x) + ":[" + o[x][0] + "," + n(o[x][1]) + "]";
675
+ }).join(",") + "},{},[" + n(m) + "])", R = window.URL || window.webkitURL || window.mozURL || window.msURL, b = new Blob([E], { type: "text/javascript" });
676
+ if (t && t.bare)
677
+ return b;
678
+ var F = R.createObjectURL(b), D = new Worker(F);
679
+ return D.objectURL = F, D;
680
+ };
681
+ }, {}], "/index.js": [function(d, I, G) {
682
+ function v(r, u) {
683
+ return t(r) || a(r, u) || A(r, u) || o();
684
+ }
685
+ function o() {
686
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
687
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
688
+ }
689
+ function A(r, u) {
690
+ if (r) {
691
+ if (typeof r == "string") return n(r, u);
692
+ var s = Object.prototype.toString.call(r).slice(8, -1);
693
+ if (s === "Object" && r.constructor && (s = r.constructor.name), s === "Map" || s === "Set") return Array.from(r);
694
+ if (s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)) return n(r, u);
695
+ }
696
+ }
697
+ function n(r, u) {
698
+ (u == null || u > r.length) && (u = r.length);
699
+ for (var s = 0, l = new Array(u); s < u; s++)
700
+ l[s] = r[s];
701
+ return l;
702
+ }
703
+ function a(r, u) {
704
+ var s = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
705
+ if (s != null) {
706
+ var l = [], g = !0, M = !1, C, Q;
707
+ try {
708
+ for (s = s.call(r); !(g = (C = s.next()).done) && (l.push(C.value), !(u && l.length === u)); g = !0)
709
+ ;
710
+ } catch (U) {
711
+ M = !0, Q = U;
712
+ } finally {
713
+ try {
714
+ !g && s.return != null && s.return();
715
+ } finally {
716
+ if (M) throw Q;
717
+ }
718
+ }
719
+ return l;
720
+ }
721
+ }
722
+ function t(r) {
723
+ if (Array.isArray(r)) return r;
724
+ }
725
+ var e = d("object-assign"), i = d("webworkify"), h = d("./lib/mathlib"), c = d("./lib/pool"), f = d("./lib/utils"), _ = d("./lib/worker"), p = d("./lib/stepper"), m = d("./lib/tiler"), w = {}, B = !1;
726
+ try {
727
+ typeof navigator < "u" && navigator.userAgent && (B = navigator.userAgent.indexOf("Safari") >= 0);
728
+ } catch {
729
+ }
730
+ var y = 1;
731
+ typeof navigator < "u" && (y = Math.min(navigator.hardwareConcurrency || 1, 4));
732
+ var E = {
733
+ tile: 1024,
734
+ concurrency: y,
735
+ features: ["js", "wasm", "ww"],
736
+ idle: 2e3,
737
+ createCanvas: function(u, s) {
738
+ var l = document.createElement("canvas");
739
+ return l.width = u, l.height = s, l;
740
+ }
741
+ }, R = {
742
+ quality: 3,
743
+ alpha: !1,
744
+ unsharpAmount: 0,
745
+ unsharpRadius: 0,
746
+ unsharpThreshold: 0
747
+ }, b = !1, F = !1, D = !1, x = !1, S = !1;
748
+ function j() {
749
+ return {
750
+ value: i(_),
751
+ destroy: function() {
752
+ if (this.value.terminate(), typeof window < "u") {
753
+ var u = window.URL || window.webkitURL || window.mozURL || window.msURL;
754
+ u && u.revokeObjectURL && this.value.objectURL && u.revokeObjectURL(this.value.objectURL);
755
+ }
756
+ }
757
+ };
758
+ }
759
+ function k(r) {
760
+ if (!(this instanceof k)) return new k(r);
761
+ this.options = e({}, E, r || {});
762
+ var u = "lk_".concat(this.options.concurrency);
763
+ this.__limit = w[u] || f.limiter(this.options.concurrency), w[u] || (w[u] = this.__limit), this.features = {
764
+ js: !1,
765
+ // pure JS implementation, can be disabled for testing
766
+ wasm: !1,
767
+ // webassembly implementation for heavy functions
768
+ cib: !1,
769
+ // resize via createImageBitmap (only FF at this moment)
770
+ ww: !1
771
+ // webworkers
772
+ }, this.__workersPool = null, this.__requested_features = [], this.__mathlib = null;
773
+ }
774
+ k.prototype.init = function() {
775
+ var r = this;
776
+ if (this.__initPromise) return this.__initPromise;
777
+ if (typeof ImageData < "u" && typeof Uint8ClampedArray < "u")
778
+ try {
779
+ new ImageData(new Uint8ClampedArray(400), 10, 10), b = !0;
780
+ } catch {
781
+ }
782
+ typeof ImageBitmap < "u" && (ImageBitmap.prototype && ImageBitmap.prototype.close ? F = !0 : this.debug("ImageBitmap does not support .close(), disabled"));
783
+ var u = this.options.features.slice();
784
+ if (u.indexOf("all") >= 0 && (u = ["cib", "wasm", "js", "ww"]), this.__requested_features = u, this.__mathlib = new h(u), u.indexOf("ww") >= 0 && typeof window < "u" && "Worker" in window)
785
+ try {
786
+ var s = d("webworkify")(function() {
787
+ });
788
+ s.terminate(), this.features.ww = !0;
789
+ var l = "wp_".concat(JSON.stringify(this.options));
790
+ w[l] ? this.__workersPool = w[l] : (this.__workersPool = new c(j, this.options.idle), w[l] = this.__workersPool);
791
+ } catch {
792
+ }
793
+ var g = this.__mathlib.init().then(function(U) {
794
+ e(r.features, U.features);
795
+ }), M;
796
+ F ? M = f.cib_support(this.options.createCanvas).then(function(U) {
797
+ if (r.features.cib && u.indexOf("cib") < 0) {
798
+ r.debug("createImageBitmap() resize supported, but disabled by config");
799
+ return;
800
+ }
801
+ u.indexOf("cib") >= 0 && (r.features.cib = U);
802
+ }) : M = Promise.resolve(!1), D = f.can_use_canvas(this.options.createCanvas);
803
+ var C;
804
+ F && b && u.indexOf("ww") !== -1 ? C = f.worker_offscreen_canvas_support() : C = Promise.resolve(!1), C = C.then(function(U) {
805
+ x = U;
806
+ });
807
+ var Q = f.cib_can_use_region().then(function(U) {
808
+ S = U;
809
+ });
810
+ return this.__initPromise = Promise.all([g, M, C, Q]).then(function() {
811
+ return r;
812
+ }), this.__initPromise;
813
+ }, k.prototype.__invokeResize = function(r, u) {
814
+ var s = this;
815
+ return u.__mathCache = u.__mathCache || {}, Promise.resolve().then(function() {
816
+ return s.features.ww ? new Promise(function(l, g) {
817
+ var M = s.__workersPool.acquire();
818
+ u.cancelToken && u.cancelToken.catch(function(Q) {
819
+ return g(Q);
820
+ }), M.value.onmessage = function(Q) {
821
+ M.release(), Q.data.err ? g(Q.data.err) : l(Q.data);
822
+ };
823
+ var C = [];
824
+ r.src && C.push(r.src.buffer), r.srcBitmap && C.push(r.srcBitmap), M.value.postMessage({
825
+ opts: r,
826
+ features: s.__requested_features,
827
+ preload: {
828
+ wasm_nodule: s.__mathlib.__
829
+ }
830
+ }, C);
831
+ }) : {
832
+ data: s.__mathlib.resizeAndUnsharp(r, u.__mathCache)
833
+ };
834
+ });
835
+ }, k.prototype.__extractTileData = function(r, u, s, l, g) {
836
+ if (this.features.ww && x && // createImageBitmap doesn't work for images (Image, ImageBitmap) with Exif orientation in Chrome,
837
+ // can use canvas because canvas doesn't have orientation;
838
+ // see https://bugs.chromium.org/p/chromium/issues/detail?id=1220671
839
+ (f.isCanvas(u) || S))
840
+ return this.debug("Create tile for OffscreenCanvas"), createImageBitmap(l.srcImageBitmap || u, r.x, r.y, r.width, r.height).then(function(Q) {
841
+ return g.srcBitmap = Q, g;
842
+ });
843
+ if (f.isCanvas(u))
844
+ return l.srcCtx || (l.srcCtx = u.getContext("2d", {
845
+ alpha: !!s.alpha
846
+ })), this.debug("Get tile pixel data"), g.src = l.srcCtx.getImageData(r.x, r.y, r.width, r.height).data, g;
847
+ this.debug("Draw tile imageBitmap/image to temporary canvas");
848
+ var M = this.options.createCanvas(r.width, r.height), C = M.getContext("2d", {
849
+ alpha: !!s.alpha
850
+ });
851
+ return C.globalCompositeOperation = "copy", C.drawImage(l.srcImageBitmap || u, r.x, r.y, r.width, r.height, 0, 0, r.width, r.height), this.debug("Get tile pixel data"), g.src = C.getImageData(0, 0, r.width, r.height).data, M.width = M.height = 0, g;
852
+ }, k.prototype.__landTileData = function(r, u, s) {
853
+ var l;
854
+ if (this.debug("Convert raw rgba tile result to ImageData"), u.bitmap)
855
+ return s.toCtx.drawImage(u.bitmap, r.toX, r.toY), null;
856
+ if (b)
857
+ l = new ImageData(new Uint8ClampedArray(u.data), r.toWidth, r.toHeight);
858
+ else if (l = s.toCtx.createImageData(r.toWidth, r.toHeight), l.data.set)
859
+ l.data.set(u.data);
860
+ else
861
+ for (var g = l.data.length - 1; g >= 0; g--)
862
+ l.data[g] = u.data[g];
863
+ return this.debug("Draw tile"), B ? s.toCtx.putImageData(l, r.toX, r.toY, r.toInnerX - r.toX, r.toInnerY - r.toY, r.toInnerWidth + 1e-5, r.toInnerHeight + 1e-5) : s.toCtx.putImageData(l, r.toX, r.toY, r.toInnerX - r.toX, r.toInnerY - r.toY, r.toInnerWidth, r.toInnerHeight), null;
864
+ }, k.prototype.__tileAndResize = function(r, u, s) {
865
+ var l = this, g = {
866
+ srcCtx: null,
867
+ srcImageBitmap: null,
868
+ isImageBitmapReused: !1,
869
+ toCtx: null
870
+ }, M = function(Q) {
871
+ return l.__limit(function() {
872
+ if (s.canceled) return s.cancelToken;
873
+ var U = {
874
+ width: Q.width,
875
+ height: Q.height,
876
+ toWidth: Q.toWidth,
877
+ toHeight: Q.toHeight,
878
+ scaleX: Q.scaleX,
879
+ scaleY: Q.scaleY,
880
+ offsetX: Q.offsetX,
881
+ offsetY: Q.offsetY,
882
+ quality: s.quality,
883
+ alpha: s.alpha,
884
+ unsharpAmount: s.unsharpAmount,
885
+ unsharpRadius: s.unsharpRadius,
886
+ unsharpThreshold: s.unsharpThreshold
887
+ };
888
+ return l.debug("Invoke resize math"), Promise.resolve(U).then(function(O) {
889
+ return l.__extractTileData(Q, r, s, g, O);
890
+ }).then(function(O) {
891
+ return l.debug("Invoke resize math"), l.__invokeResize(O, s);
892
+ }).then(function(O) {
893
+ return s.canceled ? s.cancelToken : (g.srcImageData = null, l.__landTileData(Q, O, g));
894
+ });
895
+ });
896
+ };
897
+ return Promise.resolve().then(function() {
898
+ if (g.toCtx = u.getContext("2d", {
899
+ alpha: !!s.alpha
900
+ }), f.isCanvas(r)) return null;
901
+ if (f.isImageBitmap(r))
902
+ return g.srcImageBitmap = r, g.isImageBitmapReused = !0, null;
903
+ if (f.isImage(r))
904
+ return F ? (l.debug("Decode image via createImageBitmap"), createImageBitmap(r).then(function(C) {
905
+ g.srcImageBitmap = C;
906
+ }).catch(function(C) {
907
+ return null;
908
+ })) : null;
909
+ throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap');
910
+ }).then(function() {
911
+ if (s.canceled) return s.cancelToken;
912
+ l.debug("Calculate tiles");
913
+ var C = m({
914
+ width: s.width,
915
+ height: s.height,
916
+ srcTileSize: l.options.tile,
917
+ toWidth: s.toWidth,
918
+ toHeight: s.toHeight,
919
+ destTileBorder: s.__destTileBorder
920
+ }), Q = C.map(function(O) {
921
+ return M(O);
922
+ });
923
+ function U(O) {
924
+ O.srcImageBitmap && (O.isImageBitmapReused || O.srcImageBitmap.close(), O.srcImageBitmap = null);
925
+ }
926
+ return l.debug("Process tiles"), Promise.all(Q).then(function() {
927
+ return l.debug("Finished!"), U(g), u;
928
+ }, function(O) {
929
+ throw U(g), O;
930
+ });
931
+ });
932
+ }, k.prototype.__processStages = function(r, u, s, l) {
933
+ var g = this;
934
+ if (l.canceled) return l.cancelToken;
935
+ var M = r.shift(), C = v(M, 2), Q = C[0], U = C[1], O = r.length === 0;
936
+ l = e({}, l, {
937
+ toWidth: Q,
938
+ toHeight: U,
939
+ // only use user-defined quality for the last stage,
940
+ // use simpler (Hamming) filter for the first stages where
941
+ // scale factor is large enough (more than 2-3)
942
+ quality: O ? l.quality : Math.min(1, l.quality)
943
+ });
944
+ var P;
945
+ return O || (P = this.options.createCanvas(Q, U)), this.__tileAndResize(u, O ? s : P, l).then(function() {
946
+ return O ? s : (l.width = Q, l.height = U, g.__processStages(r, P, s, l));
947
+ }).then(function(q) {
948
+ return P && (P.width = P.height = 0), q;
949
+ });
950
+ }, k.prototype.__resizeViaCreateImageBitmap = function(r, u, s) {
951
+ var l = this, g = u.getContext("2d", {
952
+ alpha: !!s.alpha
953
+ });
954
+ return this.debug("Resize via createImageBitmap()"), createImageBitmap(r, {
955
+ resizeWidth: s.toWidth,
956
+ resizeHeight: s.toHeight,
957
+ resizeQuality: f.cib_quality_name(s.quality)
958
+ }).then(function(M) {
959
+ if (s.canceled) return s.cancelToken;
960
+ if (!s.unsharpAmount)
961
+ return g.drawImage(M, 0, 0), M.close(), g = null, l.debug("Finished!"), u;
962
+ l.debug("Unsharp result");
963
+ var C = l.options.createCanvas(s.toWidth, s.toHeight), Q = C.getContext("2d", {
964
+ alpha: !!s.alpha
965
+ });
966
+ Q.drawImage(M, 0, 0), M.close();
967
+ var U = Q.getImageData(0, 0, s.toWidth, s.toHeight);
968
+ return l.__mathlib.unsharp_mask(U.data, s.toWidth, s.toHeight, s.unsharpAmount, s.unsharpRadius, s.unsharpThreshold), g.putImageData(U, 0, 0), C.width = C.height = 0, U = Q = C = g = null, l.debug("Finished!"), u;
969
+ });
970
+ }, k.prototype.resize = function(r, u, s) {
971
+ var l = this;
972
+ this.debug("Start resize...");
973
+ var g = e({}, R);
974
+ if (isNaN(s) ? s && (g = e(g, s)) : g = e(g, {
975
+ quality: s
976
+ }), g.toWidth = u.width, g.toHeight = u.height, g.width = r.naturalWidth || r.width, g.height = r.naturalHeight || r.height, u.width === 0 || u.height === 0)
977
+ return Promise.reject(new Error("Invalid output size: ".concat(u.width, "x").concat(u.height)));
978
+ g.unsharpRadius > 2 && (g.unsharpRadius = 2), g.canceled = !1, g.cancelToken && (g.cancelToken = g.cancelToken.then(function(C) {
979
+ throw g.canceled = !0, C;
980
+ }, function(C) {
981
+ throw g.canceled = !0, C;
982
+ }));
983
+ var M = 3;
984
+ return g.__destTileBorder = Math.ceil(Math.max(M, 2.5 * g.unsharpRadius | 0)), this.init().then(function() {
985
+ if (g.canceled) return g.cancelToken;
986
+ if (l.features.cib)
987
+ return l.__resizeViaCreateImageBitmap(r, u, g);
988
+ if (!D) {
989
+ var C = new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");
990
+ throw C.code = "ERR_GET_IMAGE_DATA", C;
991
+ }
992
+ var Q = p(g.width, g.height, g.toWidth, g.toHeight, l.options.tile, g.__destTileBorder);
993
+ return l.__processStages(Q, r, u, g);
994
+ });
995
+ }, k.prototype.resizeBuffer = function(r) {
996
+ var u = this, s = e({}, R, r);
997
+ return this.init().then(function() {
998
+ return u.__mathlib.resizeAndUnsharp(s);
999
+ });
1000
+ }, k.prototype.toBlob = function(r, u, s) {
1001
+ return u = u || "image/png", new Promise(function(l) {
1002
+ if (r.toBlob) {
1003
+ r.toBlob(function(U) {
1004
+ return l(U);
1005
+ }, u, s);
1006
+ return;
1007
+ }
1008
+ if (r.convertToBlob) {
1009
+ l(r.convertToBlob({
1010
+ type: u,
1011
+ quality: s
1012
+ }));
1013
+ return;
1014
+ }
1015
+ for (var g = atob(r.toDataURL(u, s).split(",")[1]), M = g.length, C = new Uint8Array(M), Q = 0; Q < M; Q++)
1016
+ C[Q] = g.charCodeAt(Q);
1017
+ l(new Blob([C], {
1018
+ type: u
1019
+ }));
1020
+ });
1021
+ }, k.prototype.debug = function() {
1022
+ }, I.exports = k;
1023
+ }, { "./lib/mathlib": 1, "./lib/pool": 13, "./lib/stepper": 14, "./lib/tiler": 15, "./lib/utils": 16, "./lib/worker": 17, "object-assign": 23, webworkify: 24 }] }, {}, [])("/index.js");
1024
+ });
1025
+ })(W)), W.exports;
1026
+ }
1027
+ var L = Z();
1028
+ const K = /* @__PURE__ */ X(L), $ = /* @__PURE__ */ N({
1029
+ __proto__: null,
1030
+ default: K
1031
+ }, [L]);
1032
+ export {
1033
+ $ as p
1034
+ };