@flyfish-group/file-viewer3 1.0.26 → 2.0.0

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 (359) hide show
  1. package/README.en.md +3 -388
  2. package/README.md +3 -364
  3. package/dist/file-viewer3.css +1 -2
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +2 -0
  6. package/package.json +22 -126
  7. package/dist/components/3MFLoader.js +0 -527
  8. package/dist/components/AMFLoader.js +0 -188
  9. package/dist/components/ArchiveViewer.js +0 -526
  10. package/dist/components/AudioViewer.js +0 -66
  11. package/dist/components/CadViewer.js +0 -9040
  12. package/dist/components/CodeViewer.js +0 -151
  13. package/dist/components/ColladaLoader.js +0 -2282
  14. package/dist/components/DrawingViewer.js +0 -295
  15. package/dist/components/EdaViewer.js +0 -630
  16. package/dist/components/EmailViewer.js +0 -276
  17. package/dist/components/EpubViewer.js +0 -172
  18. package/dist/components/FBXLoader.js +0 -1574
  19. package/dist/components/GLTFLoader.js +0 -1383
  20. package/dist/components/ImageViewer.js +0 -1519
  21. package/dist/components/KMZLoader.js +0 -45
  22. package/dist/components/MarkdownViewer.js +0 -1476
  23. package/dist/components/ModelViewer.js +0 -797
  24. package/dist/components/OBJLoader.js +0 -287
  25. package/dist/components/OfdViewer.js +0 -133
  26. package/dist/components/PCDLoader.js +0 -141
  27. package/dist/components/PLYLoader.js +0 -305
  28. package/dist/components/PdfView.js +0 -27667
  29. package/dist/components/PptxRender.js +0 -11217
  30. package/dist/components/STLLoader.js +0 -83
  31. package/dist/components/TDSLoader.js +0 -228
  32. package/dist/components/TypstViewer.js +0 -1697
  33. package/dist/components/USDLoader.js +0 -2526
  34. package/dist/components/UmdViewer.js +0 -1873
  35. package/dist/components/VRMLLoader.js +0 -6422
  36. package/dist/components/VTKLoader.js +0 -337
  37. package/dist/components/XYZLoader.js +0 -30
  38. package/dist/components/XlsxTable.js +0 -7879
  39. package/dist/components/__vite-browser-external.js +0 -7
  40. package/dist/components/_plugin-vue_export-helper.js +0 -8
  41. package/dist/components/ar-SA-G6X2FPQ2.js +0 -523
  42. package/dist/components/arc.js +0 -79
  43. package/dist/components/architecture-7EHR7CIX.js +0 -3
  44. package/dist/components/architectureDiagram-3BPJPVTR.js +0 -4096
  45. package/dist/components/archive.js +0 -24
  46. package/dist/components/asyncToGenerator.js +0 -29
  47. package/dist/components/audio.js +0 -19
  48. package/dist/components/az-AZ-76LH7QW2.js +0 -523
  49. package/dist/components/bash.js +0 -169
  50. package/dist/components/bg-BG-XCXSNQG7.js +0 -523
  51. package/dist/components/blockDiagram-GPEHLZMM.js +0 -3357
  52. package/dist/components/bn-BD-2XOGV67Q.js +0 -523
  53. package/dist/components/c4Diagram-AAUBKEIU.js +0 -2957
  54. package/dist/components/ca-ES-6MX7JW3Y.js +0 -523
  55. package/dist/components/cad.js +0 -23
  56. package/dist/components/cfb.js +0 -1174
  57. package/dist/components/channel.js +0 -5
  58. package/dist/components/chunk-2J33WTMH.js +0 -26
  59. package/dist/components/chunk-3OPIFGDE.js +0 -4167
  60. package/dist/components/chunk-4BX2VUAB.js +0 -19
  61. package/dist/components/chunk-55IACEB6.js +0 -9
  62. package/dist/components/chunk-5ZQYHXKU.js +0 -669
  63. package/dist/components/chunk-6U3AYISY.js +0 -624
  64. package/dist/components/chunk-727SXJPM.js +0 -3356
  65. package/dist/components/chunk-AGHRB4JF.js +0 -324
  66. package/dist/components/chunk-AQP2D5EJ.js +0 -2055
  67. package/dist/components/chunk-BSJP7CBP.js +0 -83
  68. package/dist/components/chunk-CSCIHK7Q.js +0 -3500
  69. package/dist/components/chunk-EIO257PC.js +0 -1836
  70. package/dist/components/chunk-FMBD7UC4.js +0 -5
  71. package/dist/components/chunk-K2UTITRG.js +0 -17627
  72. package/dist/components/chunk-KSCS5N6A.js +0 -572
  73. package/dist/components/chunk-L5ZTLDWV.js +0 -40
  74. package/dist/components/chunk-LZXEDZCA.js +0 -60
  75. package/dist/components/chunk-ND2GUHAM.js +0 -61
  76. package/dist/components/chunk-NNHCCRGN.js +0 -20425
  77. package/dist/components/chunk-NZK2D7GU.js +0 -68
  78. package/dist/components/chunk-O5CBEL6O.js +0 -1894
  79. package/dist/components/chunk-QZHKN3VN.js +0 -12
  80. package/dist/components/chunk-SRAX5OIU.js +0 -22
  81. package/dist/components/chunk-WU5MYG2G.js +0 -14
  82. package/dist/components/chunk-XPW4576I.js +0 -1146
  83. package/dist/components/chunk-Z3N5DIM6.js +0 -59
  84. package/dist/components/chunk-ZUYEQ4TG.js +0 -22
  85. package/dist/components/chunk.js +0 -23
  86. package/dist/components/classDiagram-4FO5ZUOK.js +0 -29
  87. package/dist/components/classDiagram-v2-Q7XG4LA2.js +0 -29
  88. package/dist/components/compiler.js +0 -2
  89. package/dist/components/core.js +0 -845
  90. package/dist/components/cose-bilkent-S5V4N54A.js +0 -2268
  91. package/dist/components/cpp.js +0 -225
  92. package/dist/components/cs-CZ-2BRQDIVT.js +0 -523
  93. package/dist/components/csharp.js +0 -260
  94. package/dist/components/css.js +0 -140
  95. package/dist/components/cytoscape.esm.js +0 -18114
  96. package/dist/components/da-DK-5WZEPLOC.js +0 -523
  97. package/dist/components/dagre-BM42HDAG.js +0 -325
  98. package/dist/components/dagre.js +0 -1936
  99. package/dist/components/de-DE-XR44H4JA.js +0 -523
  100. package/dist/components/defaultLocale.js +0 -201
  101. package/dist/components/defineProperty.js +0 -50
  102. package/dist/components/diagram-2AECGRRQ.js +0 -229
  103. package/dist/components/diagram-5GNKFQAL.js +0 -108
  104. package/dist/components/diagram-KO2AKTUF.js +0 -443
  105. package/dist/components/diagram-LMA3HP47.js +0 -139
  106. package/dist/components/diagram-OG6HWLK6.js +0 -541
  107. package/dist/components/diff.js +0 -39
  108. package/dist/components/directory-open-01563666.js +0 -26
  109. package/dist/components/directory-open-4ed118d0.js +0 -83
  110. package/dist/components/dist.js +0 -50
  111. package/dist/components/dist2.js +0 -3291
  112. package/dist/components/dist3.js +0 -1593
  113. package/dist/components/documentSearch.js +0 -378
  114. package/dist/components/docx-preview.js +0 -3113
  115. package/dist/components/drawing.js +0 -19
  116. package/dist/components/ebook.js +0 -16
  117. package/dist/components/eda.js +0 -20
  118. package/dist/components/el-GR-BZB4AONW.js +0 -523
  119. package/dist/components/email.js +0 -21
  120. package/dist/components/en-B4ZKOASM.js +0 -3
  121. package/dist/components/erDiagram-TEJ5UH35.js +0 -1719
  122. package/dist/components/es-ES-U4NZUMDT.js +0 -523
  123. package/dist/components/eu-ES-A7QVB2H4.js +0 -523
  124. package/dist/components/eventmodeling-FCH6USID.js +0 -3
  125. package/dist/components/fa-IR-HGAKTJCU.js +0 -523
  126. package/dist/components/fflate.module.js +0 -323
  127. package/dist/components/fi-FI-Z5N7JZ37.js +0 -523
  128. package/dist/components/file-open-002ab408.js +0 -38
  129. package/dist/components/file-open-7c801643.js +0 -24
  130. package/dist/components/file-save-3189631c.js +0 -40
  131. package/dist/components/file-save-745eba88.js +0 -36
  132. package/dist/components/flowDiagram-I6XJVG4X.js +0 -4181
  133. package/dist/components/fr-FR-RHASNOE6.js +0 -523
  134. package/dist/components/ganttDiagram-6RSMTGT7.js +0 -2182
  135. package/dist/components/gitGraph-WXDBUCRP.js +0 -3
  136. package/dist/components/gitGraphDiagram-PVQCEYII.js +0 -788
  137. package/dist/components/gl-ES-HMX3MZ6V.js +0 -523
  138. package/dist/components/global-compiler.js +0 -23
  139. package/dist/components/global-renderer.js +0 -23
  140. package/dist/components/go.js +0 -140
  141. package/dist/components/graphlib.js +0 -1267
  142. package/dist/components/he-IL-6SHJWFNN.js +0 -523
  143. package/dist/components/hi-IN-IWLTKZ5I.js +0 -523
  144. package/dist/components/hu-HU-A5ZG7DT2.js +0 -523
  145. package/dist/components/id-ID-SAP4L64H.js +0 -523
  146. package/dist/components/image-GAAHSSAO.js +0 -3
  147. package/dist/components/image-blob-reduce.esm.js +0 -1429
  148. package/dist/components/image.js +0 -17
  149. package/dist/components/info-J43DQDTF.js +0 -3
  150. package/dist/components/infoDiagram-5YYISTIA.js +0 -26
  151. package/dist/components/ini.js +0 -88
  152. package/dist/components/init.js +0 -15
  153. package/dist/components/ishikawaDiagram-YF4QCWOH.js +0 -718
  154. package/dist/components/it-IT-JPQ66NNP.js +0 -523
  155. package/dist/components/ja-JP-DBVTYXUO.js +0 -523
  156. package/dist/components/java.js +0 -169
  157. package/dist/components/javascript.js +0 -436
  158. package/dist/components/journeyDiagram-JHISSGLW.js +0 -885
  159. package/dist/components/json.js +0 -36
  160. package/dist/components/jszip.min.js +0 -3033
  161. package/dist/components/kaa-6HZHGXH3.js +0 -523
  162. package/dist/components/kab-KAB-ZGHBKWFO.js +0 -523
  163. package/dist/components/kanban-definition-UN3LZRKU.js +0 -986
  164. package/dist/components/katex.js +0 -21979
  165. package/dist/components/kk-KZ-P5N5QNE5.js +0 -523
  166. package/dist/components/km-KH-HSX4SM5Z.js +0 -523
  167. package/dist/components/ko-KR-MTYHY66A.js +0 -523
  168. package/dist/components/ku-TR-6OUDTVRD.js +0 -523
  169. package/dist/components/lib.js +0 -4877
  170. package/dist/components/libarchive.js +0 -360
  171. package/dist/components/linear.js +0 -289
  172. package/dist/components/lt-LT-XHIRWOB4.js +0 -523
  173. package/dist/components/lv-LV-5QDEKY6T.js +0 -523
  174. package/dist/components/markdown.js +0 -181
  175. package/dist/components/md.js +0 -17
  176. package/dist/components/mermaid-parser.core.js +0 -328
  177. package/dist/components/mindmap-definition-RKZ34NQL.js +0 -1016
  178. package/dist/components/model.js +0 -21
  179. package/dist/components/mp4.js +0 -12
  180. package/dist/components/mr-IN-CRQNXWMA.js +0 -523
  181. package/dist/components/my-MM-5M5IBNSE.js +0 -523
  182. package/dist/components/nb-NO-T6EIAALU.js +0 -523
  183. package/dist/components/nestedRender.js +0 -158
  184. package/dist/components/nl-NL-IS3SIHDZ.js +0 -523
  185. package/dist/components/nn-NO-6E72VCQL.js +0 -523
  186. package/dist/components/objectSpread2.js +0 -29
  187. package/dist/components/objectWithoutProperties.js +0 -28
  188. package/dist/components/oc-FR-POXYY2M6.js +0 -523
  189. package/dist/components/ofd.js +0 -5261
  190. package/dist/components/ofd2.js +0 -16
  191. package/dist/components/ordinal.js +0 -65
  192. package/dist/components/pa-IN-N4M65BXN.js +0 -523
  193. package/dist/components/packet-YPE3B663.js +0 -3
  194. package/dist/components/pdf.js +0 -24
  195. package/dist/components/percentages-BXMCSKIN.js +0 -3
  196. package/dist/components/php.js +0 -294
  197. package/dist/components/pica.js +0 -1009
  198. package/dist/components/pie-LRSECV5Y.js +0 -3
  199. package/dist/components/pie.js +0 -47
  200. package/dist/components/pieDiagram-4H26LBE5.js +0 -130
  201. package/dist/components/pl-PL-T2D74RX3.js +0 -523
  202. package/dist/components/postal-mime.js +0 -3146
  203. package/dist/components/pptx.js +0 -15
  204. package/dist/components/printLayout.js +0 -42
  205. package/dist/components/prod.js +0 -21770
  206. package/dist/components/pt-BR-5N22H2LF.js +0 -523
  207. package/dist/components/pt-PT-UZXXM6DQ.js +0 -523
  208. package/dist/components/python.js +0 -238
  209. package/dist/components/quadrantDiagram-W4KKPZXB.js +0 -1988
  210. package/dist/components/radar-GUYGQ44K.js +0 -3
  211. package/dist/components/renderer.js +0 -2
  212. package/dist/components/requirementDiagram-4Y6WPE33.js +0 -2230
  213. package/dist/components/ro-RO-JPDTUUEW.js +0 -523
  214. package/dist/components/rough.esm.js +0 -1355
  215. package/dist/components/roundRect.js +0 -90
  216. package/dist/components/ru-RU-B4JR7IUQ.js +0 -523
  217. package/dist/components/rust.js +0 -169
  218. package/dist/components/sankeyDiagram-5OEKKPKP.js +0 -972
  219. package/dist/components/sequenceDiagram-3UESZ5HK.js +0 -4255
  220. package/dist/components/shared.js +0 -175
  221. package/dist/components/shared2.js +0 -4
  222. package/dist/components/si-LK-N5RQ5JYF.js +0 -523
  223. package/dist/components/sk-SK-C5VTKIMK.js +0 -523
  224. package/dist/components/sl-SI-NN7IZMDC.js +0 -523
  225. package/dist/components/sourceLoading.js +0 -134
  226. package/dist/components/sql.js +0 -118
  227. package/dist/components/src.js +0 -2664
  228. package/dist/components/src2.js +0 -10722
  229. package/dist/components/stateDiagram-AJRCARHV.js +0 -217
  230. package/dist/components/stateDiagram-v2-BHNVJYJU.js +0 -27
  231. package/dist/components/subset-shared.chunk.js +0 -3
  232. package/dist/components/subset-worker.chunk.js +0 -21
  233. package/dist/components/sv-SE-XGPEYMSR.js +0 -523
  234. package/dist/components/ta-IN-2NMHFXQM.js +0 -523
  235. package/dist/components/text.js +0 -20
  236. package/dist/components/th-TH-HPSO5L25.js +0 -523
  237. package/dist/components/three.module.js +0 -13134
  238. package/dist/components/time.js +0 -910
  239. package/dist/components/timeline-definition-PNZ67QCA.js +0 -1084
  240. package/dist/components/tr-TR-DEFEU3FU.js +0 -523
  241. package/dist/components/treeView-BLDUP644.js +0 -3
  242. package/dist/components/treemap-LRROVOQU.js +0 -3
  243. package/dist/components/typescript.js +0 -521
  244. package/dist/components/typst.js +0 -25
  245. package/dist/components/uk-UA-QMV73CPH.js +0 -523
  246. package/dist/components/umd.js +0 -16
  247. package/dist/components/use.js +0 -422
  248. package/dist/components/util.js +0 -49
  249. package/dist/components/vennDiagram-CIIHVFJN.js +0 -1880
  250. package/dist/components/vi-VN-M7AON7JQ.js +0 -523
  251. package/dist/components/viewerZoom.js +0 -92
  252. package/dist/components/wardley-L42UT6IY.js +0 -3
  253. package/dist/components/wardleyDiagram-YWT4CUSO.js +0 -656
  254. package/dist/components/wasm-pack-shim.js +0 -1711
  255. package/dist/components/wasm-pack-shim2.js +0 -934
  256. package/dist/components/wasm.js +0 -97
  257. package/dist/components/word.js +0 -3055
  258. package/dist/components/worker-ref.js +0 -16
  259. package/dist/components/xlsx.js +0 -21
  260. package/dist/components/xml.js +0 -166
  261. package/dist/components/xychartDiagram-2RQKCTM6.js +0 -2015
  262. package/dist/components/yaml.js +0 -144
  263. package/dist/components/zh-CN-LNUGB5OW.js +0 -523
  264. package/dist/components/zh-HK-E62DVLB3.js +0 -523
  265. package/dist/components/zh-TW-RAJ6MFWO.js +0 -523
  266. package/dist/index.mjs +0 -3293
  267. package/dist/src/App.vue.d.ts +0 -3
  268. package/dist/src/compare/CompareApp.vue.d.ts +0 -3
  269. package/dist/src/compare/main.d.ts +0 -0
  270. package/dist/src/compare/useSynchronizedScroll.d.ts +0 -7
  271. package/dist/src/components/HelloWorld.vue.d.ts +0 -3
  272. package/dist/src/components/utils.d.ts +0 -4
  273. package/dist/src/main.d.ts +0 -0
  274. package/dist/src/package/common/printCapability.d.ts +0 -27
  275. package/dist/src/package/common/printLayout.d.ts +0 -16
  276. package/dist/src/package/common/sourceLoading.d.ts +0 -10
  277. package/dist/src/package/common/type.d.ts +0 -544
  278. package/dist/src/package/common/util.d.ts +0 -5
  279. package/dist/src/package/common/worker-ref.d.ts +0 -12
  280. package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +0 -75
  281. package/dist/src/package/components/FileViewer/exportDocumentTemplate.d.ts +0 -9
  282. package/dist/src/package/components/FileViewer/hooks/useViewerDocumentFeatures.d.ts +0 -29
  283. package/dist/src/package/components/FileViewer/hooks/useViewerExport.d.ts +0 -21
  284. package/dist/src/package/components/FileViewer/hooks/useViewerWatermark.d.ts +0 -8
  285. package/dist/src/package/components/FileViewer/hooks/useViewerZoom.d.ts +0 -34
  286. package/dist/src/package/components/FileViewer/index.d.ts +0 -2
  287. package/dist/src/package/components/FileViewer/util.d.ts +0 -3
  288. package/dist/src/package/index.d.ts +0 -22
  289. package/dist/src/package/use/documentLocation.d.ts +0 -15
  290. package/dist/src/package/use/documentSearch.d.ts +0 -234
  291. package/dist/src/package/use/index.d.ts +0 -5
  292. package/dist/src/package/use/loading.d.ts +0 -33
  293. package/dist/src/package/use/viewerZoom.d.ts +0 -42
  294. package/dist/src/package/use/worker.d.ts +0 -24
  295. package/dist/src/package/vendors/archive/ArchiveViewer.vue.d.ts +0 -9
  296. package/dist/src/package/vendors/archive/cache.d.ts +0 -10
  297. package/dist/src/package/vendors/archive/fallback.d.ts +0 -9
  298. package/dist/src/package/vendors/archive/index.d.ts +0 -3
  299. package/dist/src/package/vendors/archive/shared.d.ts +0 -24
  300. package/dist/src/package/vendors/audio/AudioViewer.vue.d.ts +0 -7
  301. package/dist/src/package/vendors/audio/index.d.ts +0 -7
  302. package/dist/src/package/vendors/cad/CadViewer.vue.d.ts +0 -9
  303. package/dist/src/package/vendors/cad/index.d.ts +0 -8
  304. package/dist/src/package/vendors/drawing/DrawingViewer.vue.d.ts +0 -15
  305. package/dist/src/package/vendors/drawing/index.d.ts +0 -7
  306. package/dist/src/package/vendors/ebook/EpubViewer.vue.d.ts +0 -6
  307. package/dist/src/package/vendors/ebook/index.d.ts +0 -7
  308. package/dist/src/package/vendors/eda/EdaViewer.vue.d.ts +0 -8
  309. package/dist/src/package/vendors/eda/index.d.ts +0 -2
  310. package/dist/src/package/vendors/eda/parser.d.ts +0 -77
  311. package/dist/src/package/vendors/email/EmailViewer.vue.d.ts +0 -10
  312. package/dist/src/package/vendors/email/index.d.ts +0 -2
  313. package/dist/src/package/vendors/image/ImageViewer.vue.d.ts +0 -6
  314. package/dist/src/package/vendors/image/index.d.ts +0 -4
  315. package/dist/src/package/vendors/md/MarkdownViewer.vue.d.ts +0 -6
  316. package/dist/src/package/vendors/md/index.d.ts +0 -4
  317. package/dist/src/package/vendors/model/ModelViewer.vue.d.ts +0 -8
  318. package/dist/src/package/vendors/model/index.d.ts +0 -3
  319. package/dist/src/package/vendors/model/shared.d.ts +0 -1
  320. package/dist/src/package/vendors/mp4/index.d.ts +0 -4
  321. package/dist/src/package/vendors/nestedRender.d.ts +0 -10
  322. package/dist/src/package/vendors/ofd/OfdViewer.vue.d.ts +0 -6
  323. package/dist/src/package/vendors/ofd/index.d.ts +0 -7
  324. package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +0 -10
  325. package/dist/src/package/vendors/pdf/index.d.ts +0 -2
  326. package/dist/src/package/vendors/pdf/worker/index.d.ts +0 -4
  327. package/dist/src/package/vendors/pdf/worker/pdf.worker.d.ts +0 -0
  328. package/dist/src/package/vendors/pptx/PptxRender.vue.d.ts +0 -9
  329. package/dist/src/package/vendors/pptx/index.d.ts +0 -6
  330. package/dist/src/package/vendors/pptx/options.d.ts +0 -39
  331. package/dist/src/package/vendors/pptx/support/chart.d.ts +0 -4
  332. package/dist/src/package/vendors/pptx/worker/index.d.ts +0 -4
  333. package/dist/src/package/vendors/renders.d.ts +0 -3
  334. package/dist/src/package/vendors/text/CodeViewer.vue.d.ts +0 -7
  335. package/dist/src/package/vendors/text/index.d.ts +0 -10
  336. package/dist/src/package/vendors/typst/TypstViewer.vue.d.ts +0 -15
  337. package/dist/src/package/vendors/typst/index.d.ts +0 -8
  338. package/dist/src/package/vendors/umd/UmdViewer.vue.d.ts +0 -6
  339. package/dist/src/package/vendors/umd/index.d.ts +0 -7
  340. package/dist/src/package/vendors/umd/parser.d.ts +0 -30
  341. package/dist/src/package/vendors/word/doc.d.ts +0 -5
  342. package/dist/src/package/vendors/word/docx.d.ts +0 -5
  343. package/dist/src/package/vendors/word/docx.worker.d.ts +0 -1
  344. package/dist/src/package/vendors/word/index.d.ts +0 -3
  345. package/dist/src/package/vendors/xlsx/XlsxTable.state.d.ts +0 -80
  346. package/dist/src/package/vendors/xlsx/XlsxTable.view.d.ts +0 -25
  347. package/dist/src/package/vendors/xlsx/XlsxTable.vue.d.ts +0 -6
  348. package/dist/src/package/vendors/xlsx/index.d.ts +0 -6
  349. package/dist/src/package/vendors/xlsx/util.d.ts +0 -3
  350. package/dist/src/package/vendors/xlsx/worker/index.d.ts +0 -4
  351. package/dist/src/package/vendors/xlsx/worker/sheetjs/SheetJsModel.d.ts +0 -73
  352. package/dist/src/package/vendors/xlsx/worker/sheetjs/color.d.ts +0 -2
  353. package/dist/src/package/vendors/xlsx/worker/sheetjs/index.d.ts +0 -4
  354. package/dist/src/package/vendors/xlsx/worker/sheetjs/sheet.worker.d.ts +0 -1
  355. package/dist/style.css +0 -1
  356. package/dist/wasm/cad/dwfv-render.wasm +0 -0
  357. package/dist/wasm/cad/dwg-worker.js +0 -24
  358. package/dist/wasm/cad/libredwg-web.js +0 -15
  359. package/dist/wasm/cad/libredwg-web.wasm +0 -0
@@ -1,1429 +0,0 @@
1
- //#region node_modules/.pnpm/image-blob-reduce@3.0.1/node_modules/image-blob-reduce/dist/image-blob-reduce.esm.mjs
2
- var e = function(e) {
3
- for (var t, n = 1; n < arguments.length; n++) for (var r in t = Object(arguments[n]), t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
4
- return e;
5
- };
6
- function t(e, t) {
7
- var n = {};
8
- return t.forEach(function(t) {
9
- Object.prototype.hasOwnProperty.call(e, t) && (n[t] = e[t]);
10
- }), n;
11
- }
12
- function n(e) {
13
- return t(e, [
14
- "alpha",
15
- "unsharpAmount",
16
- "unsharpRadius",
17
- "unsharpThreshold",
18
- "cancelToken"
19
- ]);
20
- }
21
- var r = {
22
- assign: e,
23
- pick: t,
24
- pick_pica_resize_options: n
25
- };
26
- function i(e) {
27
- var t = { exports: {} };
28
- return e(t, t.exports), t.exports;
29
- }
30
- function a(e) {
31
- throw Error("Could not dynamically require \"" + e + "\". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.");
32
- }
33
- var o = i(function(e, t) {
34
- (function(t) {
35
- e.exports = t();
36
- })(function() {
37
- return (function() {
38
- function e(t, n, r) {
39
- function i(s, c) {
40
- if (!n[s]) {
41
- if (!t[s]) {
42
- var l = typeof a == "function" && a;
43
- if (!c && l) return l(s, !0);
44
- if (o) return o(s, !0);
45
- var u = /* @__PURE__ */ Error("Cannot find module '" + s + "'");
46
- throw u.code = "MODULE_NOT_FOUND", u;
47
- }
48
- var d = n[s] = { exports: {} };
49
- t[s][0].call(d.exports, function(e) {
50
- var n = t[s][1][e];
51
- return i(n || e);
52
- }, d, d.exports, e, t, n, r);
53
- }
54
- return n[s].exports;
55
- }
56
- for (var o = typeof a == "function" && a, s = 0; s < r.length; s++) i(r[s]);
57
- return i;
58
- }
59
- return e;
60
- })()({
61
- 1: [function(e, t, n) {
62
- var r = e("inherits"), i = e("multimath"), a = e("./mm_unsharp_mask"), o = e("./mm_resize");
63
- function s(e) {
64
- var t = e || [], n = {
65
- js: t.indexOf("js") >= 0,
66
- wasm: t.indexOf("wasm") >= 0
67
- };
68
- i.call(this, n), this.features = {
69
- js: n.js,
70
- wasm: n.wasm && this.has_wasm()
71
- }, this.use(a), this.use(o);
72
- }
73
- r(s, i), s.prototype.resizeAndUnsharp = function(e, t) {
74
- var n = this.resize(e, t);
75
- return e.unsharpAmount && this.unsharp_mask(n, e.toWidth, e.toHeight, e.unsharpAmount, e.unsharpRadius, e.unsharpThreshold), n;
76
- }, t.exports = s;
77
- }, {
78
- "./mm_resize": 4,
79
- "./mm_unsharp_mask": 9,
80
- inherits: 19,
81
- multimath: 20
82
- }],
83
- 2: [function(e, t, n) {
84
- function r(e) {
85
- return e < 0 ? 0 : e > 255 ? 255 : e;
86
- }
87
- function i(e, t, n, i, a, o) {
88
- var s, c, l, u, d, f, p, m, h, g, _, v = 0, y = 0;
89
- for (h = 0; h < i; h++) {
90
- for (d = 0, g = 0; g < a; g++) {
91
- for (f = o[d++], p = o[d++], m = v + f * 4 | 0, s = c = l = u = 0; p > 0; p--) _ = o[d++], u = u + _ * e[m + 3] | 0, l = l + _ * e[m + 2] | 0, c = c + _ * e[m + 1] | 0, s = s + _ * e[m] | 0, m = m + 4 | 0;
92
- t[y + 3] = r(u + 8192 >> 14), t[y + 2] = r(l + 8192 >> 14), t[y + 1] = r(c + 8192 >> 14), t[y] = r(s + 8192 >> 14), y = y + i * 4 | 0;
93
- }
94
- y = (h + 1) * 4 | 0, v = (h + 1) * n * 4 | 0;
95
- }
96
- }
97
- function a(e, t, n, i, a, o) {
98
- var s, c, l, u, d, f, p, m, h, g, _, v = 0, y = 0;
99
- for (h = 0; h < i; h++) {
100
- for (d = 0, g = 0; g < a; g++) {
101
- for (f = o[d++], p = o[d++], m = v + f * 4 | 0, s = c = l = u = 0; p > 0; p--) _ = o[d++], u = u + _ * e[m + 3] | 0, l = l + _ * e[m + 2] | 0, c = c + _ * e[m + 1] | 0, s = s + _ * e[m] | 0, m = m + 4 | 0;
102
- t[y + 3] = r(u + 8192 >> 14), t[y + 2] = r(l + 8192 >> 14), t[y + 1] = r(c + 8192 >> 14), t[y] = r(s + 8192 >> 14), y = y + i * 4 | 0;
103
- }
104
- y = (h + 1) * 4 | 0, v = (h + 1) * n * 4 | 0;
105
- }
106
- }
107
- t.exports = {
108
- convolveHorizontally: i,
109
- convolveVertically: a
110
- };
111
- }, {}],
112
- 3: [function(e, t, n) {
113
- t.exports = "AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEXA2AAAGAGf39/f39/AGAHf39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgYGAX8AQQALB1cFEV9fd2FzbV9jYWxsX2N0b3JzAAAIY29udm9sdmUAAQpjb252b2x2ZUhWAAIMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAK7AMDAwABC8YDAQ9/AkAgA0UNACAERQ0AA0AgDCENQQAhE0EAIQcDQCAHQQJqIQYCfyAHQQF0IAVqIgcuAQIiFEUEQEGAwAAhCEGAwAAhCUGAwAAhCkGAwAAhCyAGDAELIBIgBy4BAGohCEEAIQsgFCEHQQAhDiAGIQlBACEPQQAhEANAIAUgCUEBdGouAQAiESAAIAhBAnRqKAIAIgpBGHZsIBBqIRAgCkH/AXEgEWwgC2ohCyAKQRB2Qf8BcSARbCAPaiEPIApBCHZB/wFxIBFsIA5qIQ4gCEEBaiEIIAlBAWohCSAHQQFrIgcNAAsgC0GAQGshCCAOQYBAayEJIA9BgEBrIQogEEGAQGshCyAGIBRqCyEHIAEgDUECdGogCUEOdSIGQf8BIAZB/wFIGyIGQQAgBkEAShtBCHRBgP4DcSAKQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EQdEGAgPwHcSALQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobcjYCACADIA1qIQ0gE0EBaiITIARHDQALIAxBAWoiDCACbCESIAMgDEcNAAsLCx4AQQAgAiADIAQgBSAAEAEgAkEAIAQgBSAGIAEQAQs=";
114
- }, {}],
115
- 4: [function(e, t, n) {
116
- t.exports = {
117
- name: "resize",
118
- fn: e("./resize"),
119
- wasm_fn: e("./resize_wasm"),
120
- wasm_src: e("./convolve_wasm_base64")
121
- };
122
- }, {
123
- "./convolve_wasm_base64": 3,
124
- "./resize": 5,
125
- "./resize_wasm": 8
126
- }],
127
- 5: [function(e, t, n) {
128
- var r = e("./resize_filter_gen"), i = e("./convolve").convolveHorizontally, a = e("./convolve").convolveVertically;
129
- function o(e, t, n) {
130
- for (var r = 3, i = t * n * 4 | 0; r < i;) e[r] = 255, r = r + 4 | 0;
131
- }
132
- t.exports = function(e) {
133
- var t = e.src, n = e.width, s = e.height, c = e.toWidth, l = e.toHeight, u = e.scaleX || e.toWidth / e.width, d = e.scaleY || e.toHeight / e.height, f = e.offsetX || 0, p = e.offsetY || 0, m = e.dest || new Uint8Array(c * l * 4), h = e.quality === void 0 ? 3 : e.quality, g = e.alpha || !1, _ = r(h, n, c, u, f), v = r(h, s, l, d, p), y = new Uint8Array(c * s * 4);
134
- return i(t, y, n, s, c, _), a(y, m, s, c, l, v), g || o(m, c, l), m;
135
- };
136
- }, {
137
- "./convolve": 2,
138
- "./resize_filter_gen": 6
139
- }],
140
- 6: [function(e, t, n) {
141
- var r = e("./resize_filter_info"), i = 14;
142
- function a(e) {
143
- return Math.round(e * ((1 << i) - 1));
144
- }
145
- t.exports = function(e, t, n, i, o) {
146
- var s = r[e].filter, c = 1 / i, l = Math.min(1, i), u = r[e].win / l, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O = Math.floor((u + 1) * 2), k = new Int16Array((O + 2) * n), A = 0, j = !k.subarray || !k.set;
147
- for (d = 0; d < n; d++) {
148
- for (f = (d + .5) * c + o, p = Math.max(0, Math.floor(f - u)), m = Math.min(t - 1, Math.ceil(f + u)), h = m - p + 1, g = new Float32Array(h), _ = new Int16Array(h), v = 0, y = p, b = 0; y <= m; y++, b++) x = s((y + .5 - f) * l), v += x, g[b] = x;
149
- for (S = 0, b = 0; b < g.length; b++) C = g[b] / v, S += C, _[b] = a(C);
150
- for (_[n >> 1] += a(1 - S), w = 0; w < _.length && _[w] === 0;) w++;
151
- if (w < _.length) {
152
- for (T = _.length - 1; T > 0 && _[T] === 0;) T--;
153
- if (E = p + w, D = T - w + 1, k[A++] = E, k[A++] = D, !j) k.set(_.subarray(w, T + 1), A), A += D;
154
- else for (b = w; b <= T; b++) k[A++] = _[b];
155
- } else k[A++] = 0, k[A++] = 0;
156
- }
157
- return k;
158
- };
159
- }, { "./resize_filter_info": 7 }],
160
- 7: [function(e, t, n) {
161
- t.exports = [
162
- {
163
- win: .5,
164
- filter: function(e) {
165
- return +(e >= -.5 && e < .5);
166
- }
167
- },
168
- {
169
- win: 1,
170
- filter: function(e) {
171
- if (e <= -1 || e >= 1) return 0;
172
- if (e > -1.1920929e-7 && e < 1.1920929e-7) return 1;
173
- var t = e * Math.PI;
174
- return Math.sin(t) / t * (.54 + .46 * Math.cos(t / 1));
175
- }
176
- },
177
- {
178
- win: 2,
179
- filter: function(e) {
180
- if (e <= -2 || e >= 2) return 0;
181
- if (e > -1.1920929e-7 && e < 1.1920929e-7) return 1;
182
- var t = e * Math.PI;
183
- return Math.sin(t) / t * Math.sin(t / 2) / (t / 2);
184
- }
185
- },
186
- {
187
- win: 3,
188
- filter: function(e) {
189
- if (e <= -3 || e >= 3) return 0;
190
- if (e > -1.1920929e-7 && e < 1.1920929e-7) return 1;
191
- var t = e * Math.PI;
192
- return Math.sin(t) / t * Math.sin(t / 3) / (t / 3);
193
- }
194
- }
195
- ];
196
- }, {}],
197
- 8: [function(e, t, n) {
198
- var r = e("./resize_filter_gen");
199
- function i(e, t, n) {
200
- for (var r = 3, i = t * n * 4 | 0; r < i;) e[r] = 255, r = r + 4 | 0;
201
- }
202
- function a(e) {
203
- return new Uint8Array(e.buffer, 0, e.byteLength);
204
- }
205
- var o = !0;
206
- try {
207
- o = new Uint32Array(new Uint8Array([
208
- 1,
209
- 0,
210
- 0,
211
- 0
212
- ]).buffer)[0] === 1;
213
- } catch (e) {}
214
- function s(e, t, n) {
215
- if (o) {
216
- t.set(a(e), n);
217
- return;
218
- }
219
- for (var r = n, i = 0; i < e.length; i++) {
220
- var s = e[i];
221
- t[r++] = s & 255, t[r++] = s >> 8 & 255;
222
- }
223
- }
224
- t.exports = function(e) {
225
- var t = e.src, n = e.width, a = e.height, o = e.toWidth, c = e.toHeight, l = e.scaleX || e.toWidth / e.width, u = e.scaleY || e.toHeight / e.height, d = e.offsetX || 0, f = e.offsetY || 0, p = e.dest || new Uint8Array(o * c * 4), m = e.quality === void 0 ? 3 : e.quality, h = e.alpha || !1, g = r(m, n, o, l, d), _ = r(m, a, c, u, f), v = this.__align(0 + Math.max(t.byteLength, p.byteLength)), y = this.__align(v + a * o * 4), b = this.__align(y + g.byteLength), x = b + _.byteLength, S = this.__instance("resize", x), C = new Uint8Array(this.__memory.buffer), w = new Uint32Array(this.__memory.buffer), T = new Uint32Array(t.buffer);
226
- return w.set(T), s(g, C, y), s(_, C, b), (S.exports.convolveHV || S.exports._convolveHV)(y, b, v, n, a, o, c), new Uint32Array(p.buffer).set(new Uint32Array(this.__memory.buffer, 0, c * o)), h || i(p, o, c), p;
227
- };
228
- }, { "./resize_filter_gen": 6 }],
229
- 9: [function(e, t, n) {
230
- t.exports = {
231
- name: "unsharp_mask",
232
- fn: e("./unsharp_mask"),
233
- wasm_fn: e("./unsharp_mask_wasm"),
234
- wasm_src: e("./unsharp_mask_wasm_base64")
235
- };
236
- }, {
237
- "./unsharp_mask": 10,
238
- "./unsharp_mask_wasm": 11,
239
- "./unsharp_mask_wasm_base64": 12
240
- }],
241
- 10: [function(e, t, n) {
242
- var r = e("glur/mono16");
243
- function i(e, t, n) {
244
- for (var r = t * n, i = new Uint16Array(r), a, o, s, c, l = 0; l < r; l++) a = e[4 * l], o = e[4 * l + 1], s = e[4 * l + 2], c = a >= o && a >= s ? a : o >= s && o >= a ? o : s, i[l] = c << 8;
245
- return i;
246
- }
247
- t.exports = function(e, t, n, a, o, s) {
248
- var c, l, u, d, f;
249
- if (!(a === 0 || o < .5)) {
250
- o > 2 && (o = 2);
251
- var p = i(e, t, n), m = new Uint16Array(p);
252
- r(m, t, n, o);
253
- for (var h = a / 100 * 4096 + .5 | 0, g = s << 8, _ = t * n, v = 0; v < _; v++) c = p[v], d = c - m[v], Math.abs(d) >= g && (l = c + (h * d + 2048 >> 12), l = l > 65280 ? 65280 : l, l = l < 0 ? 0 : l, c = c === 0 ? 1 : c, u = (l << 12) / c | 0, f = v * 4, e[f] = e[f] * u + 2048 >> 12, e[f + 1] = e[f + 1] * u + 2048 >> 12, e[f + 2] = e[f + 2] * u + 2048 >> 12);
254
- }
255
- };
256
- }, { "glur/mono16": 18 }],
257
- 11: [function(e, t, n) {
258
- t.exports = function(e, t, n, r, i, a) {
259
- if (!(r === 0 || i < .5)) {
260
- i > 2 && (i = 2);
261
- var o = t * n, s = o * 4, c = o * 2, l = o * 2, u = Math.max(t, n) * 4, d = 32, f = 0, p = s, m = p + c, h = m + l, g = h + l, _ = g + u, v = this.__instance("unsharp_mask", s + c + l * 2 + u + d, { exp: Math.exp }), y = new Uint32Array(e.buffer);
262
- new Uint32Array(this.__memory.buffer).set(y);
263
- var b = v.exports.hsv_v16 || v.exports._hsv_v16;
264
- b(f, p, t, n), b = v.exports.blurMono16 || v.exports._blurMono16, b(p, m, h, g, _, t, n, i), b = v.exports.unsharp || v.exports._unsharp, b(f, f, p, m, t, n, r, a), y.set(new Uint32Array(this.__memory.buffer, 0, o));
265
- }
266
- };
267
- }, {}],
268
- 12: [function(e, t, n) {
269
- t.exports = "AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAPoqCgoCIOtjgCACACQQRqIQcgAEECaiEGIAhFDQAgCEEBIAhBAUgbIgpBf3MhCwJ/IAQgCmtBAXFFBEAgDiENIAgMAQsgAiANIA4gEKIgFCASIAAvAQK4Ig+ioKCgIg22OAIEIAJBCGohByAAQQRqIQYgDiEMIARBAmsLIQIgC0EAIARrRg0AA0AgByAMIBGiIA0gEKIgDyAToiASIAYvAQC4Ig6ioKCgIgy2OAIAIAcgDSARoiAMIBCiIA4gE6IgEiAGLwECuCIPoqCgoCINtjgCBCAHQQhqIQcgBkEEaiEGIAJBAkohACACQQJrIQIgAA0ACwsCQCAJDQAgASAFIAhsQQF0aiIAAn8gBkECay8BACICuCINIBW7IhKiIA0gFrsiE6KgIA0gAyoCHLuiIgwgEKKgIAwgEaKgIg8gB0EEayIHKgIAu6AiDkQAAAAAAADwQWMgDkQAAAAAAAAAAGZxBEAgDqsMAQtBAAs7AQAgCEUNACAGQQRrIQZBACAFa0EBdCEBA0ACfyANIBKiIAJB//8DcbgiDSAToqAgDyIOIBCioCAMIBGioCIPIAdBBGsiByoCALugIgxEAAAAAAAA8EFjIAxEAAAAAAAAAABmcQRAIAyrDAELQQALIQMgBi8BACECIAAgAWoiACADOwEAIAZBAmshBiAIQQFKIQMgDiEMIAhBAWshCCADDQALCwvRAgIBfwd8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIglEAAAAAAAAAMCiEAAiDLaMOAIUIAQgCZoQACIKIAqgIg22OAIQIAREAAAAAAAA8D8gCqEiCyALoiAKIAkgCaCiRAAAAAAAAPA/oCAMoaMiC7Y4AgAgBCAMIAuaoiIOtjgCDCAEIAogCUQAAAAAAADwP6AgC6KiIg+2OAIIIAQgCiAJRAAAAAAAAPC/oCALoqIiCbY4AgQgBCAOIA+gIAxEAAAAAAAA8D8gDaGgIgqjtjgCHCAEIAsgCaAgCqO2OAIYIAYEQANAIAAgBSAIbEEBdGogAiAIQQF0aiADIAQgBSAGEAMgCEEBaiIIIAZHDQALCyAFRQ0AQQAhCANAIAIgBiAIbEEBdGogASAIQQF0aiADIAQgBiAFEAMgCEEBaiIIIAVHDQALCwtxAQN/IAIgA2wiBQRAA0AgASAAKAIAIgRBEHZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL";
270
- }, {}],
271
- 13: [function(e, t, n) {
272
- var r = 100;
273
- function i(e, t) {
274
- this.create = e, this.available = [], this.acquired = {}, this.lastId = 1, this.timeoutId = 0, this.idle = t || 2e3;
275
- }
276
- i.prototype.acquire = function() {
277
- var e = this, t;
278
- return this.available.length === 0 ? (t = this.create(), t.id = this.lastId++, t.release = function() {
279
- return e.release(t);
280
- }) : t = this.available.pop(), this.acquired[t.id] = t, t;
281
- }, i.prototype.release = function(e) {
282
- var t = this;
283
- delete this.acquired[e.id], e.lastUsed = Date.now(), this.available.push(e), this.timeoutId === 0 && (this.timeoutId = setTimeout(function() {
284
- return t.gc();
285
- }, r));
286
- }, i.prototype.gc = function() {
287
- var e = this, t = Date.now();
288
- this.available = this.available.filter(function(n) {
289
- return t - n.lastUsed > e.idle ? (n.destroy(), !1) : !0;
290
- }), this.available.length === 0 ? this.timeoutId = 0 : this.timeoutId = setTimeout(function() {
291
- return e.gc();
292
- }, r);
293
- }, t.exports = i;
294
- }, {}],
295
- 14: [function(e, t, n) {
296
- var r = 2;
297
- t.exports = function(e, t, n, i, a, o) {
298
- var s = n / e, c = i / t, l = (2 * o + r + 1) / a;
299
- if (l > .5) return [[n, i]];
300
- var u = Math.ceil(Math.log(Math.min(s, c)) / Math.log(l));
301
- if (u <= 1) return [[n, i]];
302
- for (var d = [], f = 0; f < u; f++) {
303
- var p = Math.round(Math.pow(Math.pow(e, u - f - 1) * Math.pow(n, f + 1), 1 / u)), m = Math.round(Math.pow(Math.pow(t, u - f - 1) * Math.pow(i, f + 1), 1 / u));
304
- d.push([p, m]);
305
- }
306
- return d;
307
- };
308
- }, {}],
309
- 15: [function(e, t, n) {
310
- var r = 1e-5;
311
- function i(e) {
312
- var t = Math.round(e);
313
- return Math.abs(e - t) < r ? t : Math.floor(e);
314
- }
315
- function a(e) {
316
- var t = Math.round(e);
317
- return Math.abs(e - t) < r ? t : Math.ceil(e);
318
- }
319
- t.exports = function(e) {
320
- var t = e.toWidth / e.width, n = e.toHeight / e.height, r = i(e.srcTileSize * t) - 2 * e.destTileBorder, o = i(e.srcTileSize * n) - 2 * e.destTileBorder;
321
- if (r < 1 || o < 1) throw Error("Internal error in pica: target tile width/height is too small.");
322
- var s, c, l, u, d, f, p = [], m;
323
- for (u = 0; u < e.toHeight; u += o) for (l = 0; l < e.toWidth; l += r) s = l - e.destTileBorder, s < 0 && (s = 0), d = l + r + e.destTileBorder - s, s + d >= e.toWidth && (d = e.toWidth - s), c = u - e.destTileBorder, c < 0 && (c = 0), f = u + o + e.destTileBorder - c, c + f >= e.toHeight && (f = e.toHeight - c), m = {
324
- toX: s,
325
- toY: c,
326
- toWidth: d,
327
- toHeight: f,
328
- toInnerX: l,
329
- toInnerY: u,
330
- toInnerWidth: r,
331
- toInnerHeight: o,
332
- offsetX: s / t - i(s / t),
333
- offsetY: c / n - i(c / n),
334
- scaleX: t,
335
- scaleY: n,
336
- x: i(s / t),
337
- y: i(c / n),
338
- width: a(d / t),
339
- height: a(f / n)
340
- }, p.push(m);
341
- return p;
342
- };
343
- }, {}],
344
- 16: [function(e, t, n) {
345
- function r(e) {
346
- return Object.prototype.toString.call(e);
347
- }
348
- t.exports.isCanvas = function(e) {
349
- var t = r(e);
350
- return t === "[object HTMLCanvasElement]" || t === "[object OffscreenCanvas]" || t === "[object Canvas]";
351
- }, t.exports.isImage = function(e) {
352
- return r(e) === "[object HTMLImageElement]";
353
- }, t.exports.isImageBitmap = function(e) {
354
- return r(e) === "[object ImageBitmap]";
355
- }, t.exports.limiter = function(e) {
356
- var t = 0, n = [];
357
- function r() {
358
- t < e && n.length && (t++, n.shift()());
359
- }
360
- return function(e) {
361
- return new Promise(function(i, a) {
362
- n.push(function() {
363
- e().then(function(e) {
364
- i(e), t--, r();
365
- }, function(e) {
366
- a(e), t--, r();
367
- });
368
- }), r();
369
- });
370
- };
371
- }, t.exports.cib_quality_name = function(e) {
372
- switch (e) {
373
- case 0: return "pixelated";
374
- case 1: return "low";
375
- case 2: return "medium";
376
- }
377
- return "high";
378
- }, t.exports.cib_support = function(e) {
379
- return Promise.resolve().then(function() {
380
- if (typeof createImageBitmap > "u") return !1;
381
- var t = e(100, 100);
382
- return createImageBitmap(t, 0, 0, 100, 100, {
383
- resizeWidth: 10,
384
- resizeHeight: 10,
385
- resizeQuality: "high"
386
- }).then(function(e) {
387
- var n = e.width === 10;
388
- return e.close(), t = null, n;
389
- });
390
- }).catch(function() {
391
- return !1;
392
- });
393
- }, t.exports.worker_offscreen_canvas_support = function() {
394
- return new Promise(function(e, t) {
395
- if (typeof OffscreenCanvas > "u") {
396
- e(!1);
397
- return;
398
- }
399
- function n(e) {
400
- if (typeof createImageBitmap > "u") {
401
- e.postMessage(!1);
402
- return;
403
- }
404
- Promise.resolve().then(function() {
405
- var e = new OffscreenCanvas(10, 10);
406
- return e.getContext("2d").rect(0, 0, 1, 1), createImageBitmap(e, 0, 0, 1, 1);
407
- }).then(function() {
408
- return e.postMessage(!0);
409
- }, function() {
410
- return e.postMessage(!1);
411
- });
412
- }
413
- var r = btoa(`(${n.toString()})(self);`), i = new Worker(`data:text/javascript;base64,${r}`);
414
- i.onmessage = function(t) {
415
- return e(t.data);
416
- }, i.onerror = t;
417
- }).then(function(e) {
418
- return e;
419
- }, function() {
420
- return !1;
421
- });
422
- }, t.exports.can_use_canvas = function(e) {
423
- var t = !1;
424
- try {
425
- var n = e(2, 1).getContext("2d"), r = n.createImageData(2, 1);
426
- r.data[0] = 12, r.data[1] = 23, r.data[2] = 34, r.data[3] = 255, r.data[4] = 45, r.data[5] = 56, r.data[6] = 67, r.data[7] = 255, n.putImageData(r, 0, 0), r = null, r = n.getImageData(0, 0, 2, 1), r.data[0] === 12 && r.data[1] === 23 && r.data[2] === 34 && r.data[3] === 255 && r.data[4] === 45 && r.data[5] === 56 && r.data[6] === 67 && r.data[7] === 255 && (t = !0);
427
- } catch (e) {}
428
- return t;
429
- }, t.exports.cib_can_use_region = function() {
430
- return new Promise(function(e) {
431
- if (typeof createImageBitmap > "u") {
432
- e(!1);
433
- return;
434
- }
435
- var t = new Image();
436
- t.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", t.onload = function() {
437
- createImageBitmap(t, 0, 0, t.width, t.height).then(function(n) {
438
- n.width === t.width && n.height === t.height ? e(!0) : e(!1);
439
- }, function() {
440
- return e(!1);
441
- });
442
- }, t.onerror = function() {
443
- return e(!1);
444
- };
445
- });
446
- };
447
- }, {}],
448
- 17: [function(e, t, n) {
449
- t.exports = function() {
450
- var t = e("./mathlib"), n;
451
- onmessage = function(e) {
452
- var r = e.data.opts, i = !1;
453
- if (!r.src && r.srcBitmap) {
454
- var a = new OffscreenCanvas(r.width, r.height), o = a.getContext("2d", { alpha: !!r.alpha });
455
- o.drawImage(r.srcBitmap, 0, 0), r.src = o.getImageData(0, 0, r.width, r.height).data, a.width = a.height = 0, a = null, r.srcBitmap.close(), r.srcBitmap = null, i = !0;
456
- }
457
- n || (n = new t(e.data.features));
458
- var s = n.resizeAndUnsharp(r);
459
- if (i) {
460
- var c = new ImageData(new Uint8ClampedArray(s), r.toWidth, r.toHeight), l = new OffscreenCanvas(r.toWidth, r.toHeight);
461
- l.getContext("2d", { alpha: !!r.alpha }).putImageData(c, 0, 0), createImageBitmap(l).then(function(e) {
462
- postMessage({ bitmap: e }, [e]);
463
- });
464
- } else postMessage({ data: s }, [s.buffer]);
465
- };
466
- };
467
- }, { "./mathlib": 1 }],
468
- 18: [function(e, t, n) {
469
- var r, i, a, o, s, c, l, u;
470
- function d(e) {
471
- e < .5 && (e = .5);
472
- var t = Math.exp(.726 * .726) / e, n = Math.exp(-t), d = Math.exp(-2 * t), f = (1 - n) * (1 - n) / (1 + 2 * t * n - d);
473
- return r = f, i = f * (t - 1) * n, a = f * (t + 1) * n, o = -f * d, s = 2 * n, c = -d, l = (r + i) / (1 - s - c), u = (a + o) / (1 - s - c), new Float32Array([
474
- r,
475
- i,
476
- a,
477
- o,
478
- s,
479
- c,
480
- l,
481
- u
482
- ]);
483
- }
484
- function f(e, t, n, r, i, a) {
485
- var o, s, c, l, u, d, f, p, m, h, g, _, v, y;
486
- for (m = 0; m < a; m++) {
487
- for (d = m * i, f = m, p = 0, o = e[d], u = o * r[6], l = u, g = r[0], _ = r[1], v = r[4], y = r[5], h = 0; h < i; h++) s = e[d], c = s * g + o * _ + l * v + u * y, u = l, l = c, o = s, n[p] = l, p++, d++;
488
- for (d--, p--, f += a * (i - 1), o = e[d], u = o * r[7], l = u, s = o, g = r[2], _ = r[3], h = i - 1; h >= 0; h--) c = s * g + o * _ + l * v + u * y, u = l, l = c, o = s, s = e[d], t[f] = n[p] + l, d--, p--, f -= a;
489
- }
490
- }
491
- function p(e, t, n, r) {
492
- if (r) {
493
- var i = new Uint16Array(e.length), a = new Float32Array(Math.max(t, n)), o = d(r);
494
- f(e, i, a, o, t, n), f(i, e, a, o, n, t);
495
- }
496
- }
497
- t.exports = p;
498
- }, {}],
499
- 19: [function(e, t, n) {
500
- typeof Object.create == "function" ? t.exports = function(e, t) {
501
- t && (e.super_ = t, e.prototype = Object.create(t.prototype, { constructor: {
502
- value: e,
503
- enumerable: !1,
504
- writable: !0,
505
- configurable: !0
506
- } }));
507
- } : t.exports = function(e, t) {
508
- if (t) {
509
- e.super_ = t;
510
- var n = function() {};
511
- n.prototype = t.prototype, e.prototype = new n(), e.prototype.constructor = e;
512
- }
513
- };
514
- }, {}],
515
- 20: [function(e, t, n) {
516
- var r = e("object-assign"), i = e("./lib/base64decode"), a = e("./lib/wa_detect"), o = {
517
- js: !0,
518
- wasm: !0
519
- };
520
- function s(e) {
521
- if (!(this instanceof s)) return new s(e);
522
- var t = r({}, o, e || {});
523
- if (this.options = t, this.__cache = {}, this.__init_promise = null, this.__modules = t.modules || {}, this.__memory = null, this.__wasm = {}, this.__isLE = new Uint32Array(new Uint8Array([
524
- 1,
525
- 0,
526
- 0,
527
- 0
528
- ]).buffer)[0] === 1, !this.options.js && !this.options.wasm) throw Error("mathlib: at least \"js\" or \"wasm\" should be enabled");
529
- }
530
- s.prototype.has_wasm = a, s.prototype.use = function(e) {
531
- return this.__modules[e.name] = e, this.options.wasm && this.has_wasm() && e.wasm_fn ? this[e.name] = e.wasm_fn : this[e.name] = e.fn, this;
532
- }, s.prototype.init = function() {
533
- if (this.__init_promise) return this.__init_promise;
534
- if (!this.options.js && this.options.wasm && !this.has_wasm()) return Promise.reject(/* @__PURE__ */ Error("mathlib: only \"wasm\" was enabled, but it's not supported"));
535
- var e = this;
536
- return this.__init_promise = Promise.all(Object.keys(e.__modules).map(function(t) {
537
- var n = e.__modules[t];
538
- return !e.options.wasm || !e.has_wasm() || !n.wasm_fn || e.__wasm[t] ? null : WebAssembly.compile(e.__base64decode(n.wasm_src)).then(function(n) {
539
- e.__wasm[t] = n;
540
- });
541
- })).then(function() {
542
- return e;
543
- }), this.__init_promise;
544
- }, s.prototype.__base64decode = i, s.prototype.__reallocate = function(e) {
545
- if (!this.__memory) return this.__memory = new WebAssembly.Memory({ initial: Math.ceil(e / (64 * 1024)) }), this.__memory;
546
- var t = this.__memory.buffer.byteLength;
547
- return t < e && this.__memory.grow(Math.ceil((e - t) / (64 * 1024))), this.__memory;
548
- }, s.prototype.__instance = function(e, t, n) {
549
- if (t && this.__reallocate(t), !this.__wasm[e]) {
550
- var i = this.__modules[e];
551
- this.__wasm[e] = new WebAssembly.Module(this.__base64decode(i.wasm_src));
552
- }
553
- if (!this.__cache[e]) {
554
- var a = {
555
- memoryBase: 0,
556
- memory: this.__memory,
557
- tableBase: 0,
558
- table: new WebAssembly.Table({
559
- initial: 0,
560
- element: "anyfunc"
561
- })
562
- };
563
- this.__cache[e] = new WebAssembly.Instance(this.__wasm[e], { env: r(a, n || {}) });
564
- }
565
- return this.__cache[e];
566
- }, s.prototype.__align = function(e, t) {
567
- t = t || 8;
568
- var n = e % t;
569
- return e + (n ? t - n : 0);
570
- }, t.exports = s;
571
- }, {
572
- "./lib/base64decode": 21,
573
- "./lib/wa_detect": 22,
574
- "object-assign": 23
575
- }],
576
- 21: [function(e, t, n) {
577
- var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
578
- t.exports = function(e) {
579
- for (var t = e.replace(/[\r\n=]/g, ""), n = t.length, i = new Uint8Array(n * 3 >> 2), a = 0, o = 0, s = 0; s < n; s++) s % 4 == 0 && s && (i[o++] = a >> 16 & 255, i[o++] = a >> 8 & 255, i[o++] = a & 255), a = a << 6 | r.indexOf(t.charAt(s));
580
- var c = n % 4 * 6;
581
- return c === 0 ? (i[o++] = a >> 16 & 255, i[o++] = a >> 8 & 255, i[o++] = a & 255) : c === 18 ? (i[o++] = a >> 10 & 255, i[o++] = a >> 2 & 255) : c === 12 && (i[o++] = a >> 4 & 255), i;
582
- };
583
- }, {}],
584
- 22: [function(e, t, n) {
585
- var r;
586
- t.exports = function() {
587
- if (r !== void 0 || (r = !1, typeof WebAssembly > "u")) return r;
588
- try {
589
- var e = new Uint8Array([
590
- 0,
591
- 97,
592
- 115,
593
- 109,
594
- 1,
595
- 0,
596
- 0,
597
- 0,
598
- 1,
599
- 6,
600
- 1,
601
- 96,
602
- 1,
603
- 127,
604
- 1,
605
- 127,
606
- 3,
607
- 2,
608
- 1,
609
- 0,
610
- 5,
611
- 3,
612
- 1,
613
- 0,
614
- 1,
615
- 7,
616
- 8,
617
- 1,
618
- 4,
619
- 116,
620
- 101,
621
- 115,
622
- 116,
623
- 0,
624
- 0,
625
- 10,
626
- 16,
627
- 1,
628
- 14,
629
- 0,
630
- 32,
631
- 0,
632
- 65,
633
- 1,
634
- 54,
635
- 2,
636
- 0,
637
- 32,
638
- 0,
639
- 40,
640
- 2,
641
- 0,
642
- 11
643
- ]), t = new WebAssembly.Module(e);
644
- return new WebAssembly.Instance(t, {}).exports.test(4) !== 0 && (r = !0), r;
645
- } catch (e) {}
646
- return r;
647
- };
648
- }, {}],
649
- 23: [function(e, t, n) {
650
- var r = Object.getOwnPropertySymbols, i = Object.prototype.hasOwnProperty, a = Object.prototype.propertyIsEnumerable;
651
- function o(e) {
652
- if (e == null) throw TypeError("Object.assign cannot be called with null or undefined");
653
- return Object(e);
654
- }
655
- function s() {
656
- try {
657
- if (!Object.assign) return !1;
658
- var e = /* @__PURE__ */ new String("abc");
659
- if (e[5] = "de", Object.getOwnPropertyNames(e)[0] === "5") return !1;
660
- for (var t = {}, n = 0; n < 10; n++) t["_" + String.fromCharCode(n)] = n;
661
- if (Object.getOwnPropertyNames(t).map(function(e) {
662
- return t[e];
663
- }).join("") !== "0123456789") return !1;
664
- var r = {};
665
- return "abcdefghijklmnopqrst".split("").forEach(function(e) {
666
- r[e] = e;
667
- }), Object.keys(Object.assign({}, r)).join("") === "abcdefghijklmnopqrst";
668
- } catch (e) {
669
- return !1;
670
- }
671
- }
672
- t.exports = s() ? Object.assign : function(e, t) {
673
- for (var n, s = o(e), c, l = 1; l < arguments.length; l++) {
674
- for (var u in n = Object(arguments[l]), n) i.call(n, u) && (s[u] = n[u]);
675
- if (r) {
676
- c = r(n);
677
- for (var d = 0; d < c.length; d++) a.call(n, c[d]) && (s[c[d]] = n[c[d]]);
678
- }
679
- }
680
- return s;
681
- };
682
- }, {}],
683
- 24: [function(e, t, n) {
684
- var r = arguments[3], i = arguments[4], a = arguments[5], o = JSON.stringify;
685
- t.exports = function(e, t) {
686
- for (var n, s = Object.keys(a), c = 0, l = s.length; c < l; c++) {
687
- var u = s[c], d = a[u].exports;
688
- if (d === e || d && d.default === e) {
689
- n = u;
690
- break;
691
- }
692
- }
693
- if (!n) {
694
- n = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);
695
- for (var f = {}, c = 0, l = s.length; c < l; c++) {
696
- var u = s[c];
697
- f[u] = u;
698
- }
699
- i[n] = ["function(require,module,exports){" + e + "(self); }", f];
700
- }
701
- var p = Math.floor(Math.pow(16, 8) * Math.random()).toString(16), m = {};
702
- m[n] = n, i[p] = ["function(require,module,exports){var f = require(" + o(n) + ");(f.default ? f.default : f)(self);}", m];
703
- var h = {};
704
- g(p);
705
- function g(e) {
706
- for (var t in h[e] = !0, i[e][1]) {
707
- var n = i[e][1][t];
708
- h[n] || g(n);
709
- }
710
- }
711
- var _ = "(" + r + ")({" + Object.keys(h).map(function(e) {
712
- return o(e) + ":[" + i[e][0] + "," + o(i[e][1]) + "]";
713
- }).join(",") + "},{},[" + o(p) + "])", v = window.URL || window.webkitURL || window.mozURL || window.msURL, y = new Blob([_], { type: "text/javascript" });
714
- if (t && t.bare) return y;
715
- var b = v.createObjectURL(y), x = new Worker(b);
716
- return x.objectURL = b, x;
717
- };
718
- }, {}],
719
- "/index.js": [function(e, t, n) {
720
- function r(e, t) {
721
- return c(e) || s(e, t) || a(e, t) || i();
722
- }
723
- function i() {
724
- throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
725
- }
726
- function a(e, t) {
727
- if (e) {
728
- if (typeof e == "string") return o(e, t);
729
- var n = Object.prototype.toString.call(e).slice(8, -1);
730
- if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set") return Array.from(e);
731
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return o(e, t);
732
- }
733
- }
734
- function o(e, t) {
735
- (t == null || t > e.length) && (t = e.length);
736
- for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
737
- return r;
738
- }
739
- function s(e, t) {
740
- var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
741
- if (n != null) {
742
- var r = [], i = !0, a = !1, o, s;
743
- try {
744
- for (n = n.call(e); !(i = (o = n.next()).done) && (r.push(o.value), !(t && r.length === t)); i = !0);
745
- } catch (e) {
746
- a = !0, s = e;
747
- } finally {
748
- try {
749
- !i && n.return != null && n.return();
750
- } finally {
751
- if (a) throw s;
752
- }
753
- }
754
- return r;
755
- }
756
- }
757
- function c(e) {
758
- if (Array.isArray(e)) return e;
759
- }
760
- var l = e("object-assign"), u = e("webworkify"), d = e("./lib/mathlib"), f = e("./lib/pool"), p = e("./lib/utils"), m = e("./lib/worker"), h = e("./lib/stepper"), g = e("./lib/tiler"), _ = {}, v = !1;
761
- try {
762
- typeof navigator < "u" && navigator.userAgent && (v = navigator.userAgent.indexOf("Safari") >= 0);
763
- } catch (e) {}
764
- var y = 1;
765
- typeof navigator < "u" && (y = Math.min(navigator.hardwareConcurrency || 1, 4));
766
- var b = {
767
- tile: 1024,
768
- concurrency: y,
769
- features: [
770
- "js",
771
- "wasm",
772
- "ww"
773
- ],
774
- idle: 2e3,
775
- createCanvas: function(e, t) {
776
- var n = document.createElement("canvas");
777
- return n.width = e, n.height = t, n;
778
- }
779
- }, x = {
780
- quality: 3,
781
- alpha: !1,
782
- unsharpAmount: 0,
783
- unsharpRadius: 0,
784
- unsharpThreshold: 0
785
- }, S = !1, C = !1, w = !1, T = !1, E = !1;
786
- function D() {
787
- return {
788
- value: u(m),
789
- destroy: function() {
790
- if (this.value.terminate(), typeof window < "u") {
791
- var e = window.URL || window.webkitURL || window.mozURL || window.msURL;
792
- e && e.revokeObjectURL && this.value.objectURL && e.revokeObjectURL(this.value.objectURL);
793
- }
794
- }
795
- };
796
- }
797
- function O(e) {
798
- if (!(this instanceof O)) return new O(e);
799
- this.options = l({}, b, e || {});
800
- var t = `lk_${this.options.concurrency}`;
801
- this.__limit = _[t] || p.limiter(this.options.concurrency), _[t] || (_[t] = this.__limit), this.features = {
802
- js: !1,
803
- wasm: !1,
804
- cib: !1,
805
- ww: !1
806
- }, this.__workersPool = null, this.__requested_features = [], this.__mathlib = null;
807
- }
808
- O.prototype.init = function() {
809
- var t = this;
810
- if (this.__initPromise) return this.__initPromise;
811
- if (typeof ImageData < "u" && typeof Uint8ClampedArray < "u") try {
812
- new ImageData(new Uint8ClampedArray(400), 10, 10), S = !0;
813
- } catch (e) {}
814
- typeof ImageBitmap < "u" && (ImageBitmap.prototype && ImageBitmap.prototype.close ? C = !0 : this.debug("ImageBitmap does not support .close(), disabled"));
815
- var n = this.options.features.slice();
816
- if (n.indexOf("all") >= 0 && (n = [
817
- "cib",
818
- "wasm",
819
- "js",
820
- "ww"
821
- ]), this.__requested_features = n, this.__mathlib = new d(n), n.indexOf("ww") >= 0 && typeof window < "u" && "Worker" in window) try {
822
- e("webworkify")(function() {}).terminate(), this.features.ww = !0;
823
- var r = `wp_${JSON.stringify(this.options)}`;
824
- _[r] ? this.__workersPool = _[r] : (this.__workersPool = new f(D, this.options.idle), _[r] = this.__workersPool);
825
- } catch (e) {}
826
- var i = this.__mathlib.init().then(function(e) {
827
- l(t.features, e.features);
828
- }), a = C ? p.cib_support(this.options.createCanvas).then(function(e) {
829
- if (t.features.cib && n.indexOf("cib") < 0) {
830
- t.debug("createImageBitmap() resize supported, but disabled by config");
831
- return;
832
- }
833
- n.indexOf("cib") >= 0 && (t.features.cib = e);
834
- }) : Promise.resolve(!1);
835
- w = p.can_use_canvas(this.options.createCanvas);
836
- var o = C && S && n.indexOf("ww") !== -1 ? p.worker_offscreen_canvas_support() : Promise.resolve(!1);
837
- o = o.then(function(e) {
838
- T = e;
839
- });
840
- var s = p.cib_can_use_region().then(function(e) {
841
- E = e;
842
- });
843
- return this.__initPromise = Promise.all([
844
- i,
845
- a,
846
- o,
847
- s
848
- ]).then(function() {
849
- return t;
850
- }), this.__initPromise;
851
- }, O.prototype.__invokeResize = function(e, t) {
852
- var n = this;
853
- return t.__mathCache = t.__mathCache || {}, Promise.resolve().then(function() {
854
- return n.features.ww ? new Promise(function(r, i) {
855
- var a = n.__workersPool.acquire();
856
- t.cancelToken && t.cancelToken.catch(function(e) {
857
- return i(e);
858
- }), a.value.onmessage = function(e) {
859
- a.release(), e.data.err ? i(e.data.err) : r(e.data);
860
- };
861
- var o = [];
862
- e.src && o.push(e.src.buffer), e.srcBitmap && o.push(e.srcBitmap), a.value.postMessage({
863
- opts: e,
864
- features: n.__requested_features,
865
- preload: { wasm_nodule: n.__mathlib.__ }
866
- }, o);
867
- }) : { data: n.__mathlib.resizeAndUnsharp(e, t.__mathCache) };
868
- });
869
- }, O.prototype.__extractTileData = function(e, t, n, r, i) {
870
- if (this.features.ww && T && (p.isCanvas(t) || E)) return this.debug("Create tile for OffscreenCanvas"), createImageBitmap(r.srcImageBitmap || t, e.x, e.y, e.width, e.height).then(function(e) {
871
- return i.srcBitmap = e, i;
872
- });
873
- if (p.isCanvas(t)) return r.srcCtx || (r.srcCtx = t.getContext("2d", { alpha: !!n.alpha })), this.debug("Get tile pixel data"), i.src = r.srcCtx.getImageData(e.x, e.y, e.width, e.height).data, i;
874
- this.debug("Draw tile imageBitmap/image to temporary canvas");
875
- var a = this.options.createCanvas(e.width, e.height), o = a.getContext("2d", { alpha: !!n.alpha });
876
- return o.globalCompositeOperation = "copy", o.drawImage(r.srcImageBitmap || t, e.x, e.y, e.width, e.height, 0, 0, e.width, e.height), this.debug("Get tile pixel data"), i.src = o.getImageData(0, 0, e.width, e.height).data, a.width = a.height = 0, i;
877
- }, O.prototype.__landTileData = function(e, t, n) {
878
- var r;
879
- if (this.debug("Convert raw rgba tile result to ImageData"), t.bitmap) return n.toCtx.drawImage(t.bitmap, e.toX, e.toY), null;
880
- if (S) r = new ImageData(new Uint8ClampedArray(t.data), e.toWidth, e.toHeight);
881
- else if (r = n.toCtx.createImageData(e.toWidth, e.toHeight), r.data.set) r.data.set(t.data);
882
- else for (var i = r.data.length - 1; i >= 0; i--) r.data[i] = t.data[i];
883
- return this.debug("Draw tile"), v ? n.toCtx.putImageData(r, e.toX, e.toY, e.toInnerX - e.toX, e.toInnerY - e.toY, e.toInnerWidth + 1e-5, e.toInnerHeight + 1e-5) : n.toCtx.putImageData(r, e.toX, e.toY, e.toInnerX - e.toX, e.toInnerY - e.toY, e.toInnerWidth, e.toInnerHeight), null;
884
- }, O.prototype.__tileAndResize = function(e, t, n) {
885
- var r = this, i = {
886
- srcCtx: null,
887
- srcImageBitmap: null,
888
- isImageBitmapReused: !1,
889
- toCtx: null
890
- }, a = function(t) {
891
- return r.__limit(function() {
892
- if (n.canceled) return n.cancelToken;
893
- var a = {
894
- width: t.width,
895
- height: t.height,
896
- toWidth: t.toWidth,
897
- toHeight: t.toHeight,
898
- scaleX: t.scaleX,
899
- scaleY: t.scaleY,
900
- offsetX: t.offsetX,
901
- offsetY: t.offsetY,
902
- quality: n.quality,
903
- alpha: n.alpha,
904
- unsharpAmount: n.unsharpAmount,
905
- unsharpRadius: n.unsharpRadius,
906
- unsharpThreshold: n.unsharpThreshold
907
- };
908
- return r.debug("Invoke resize math"), Promise.resolve(a).then(function(a) {
909
- return r.__extractTileData(t, e, n, i, a);
910
- }).then(function(e) {
911
- return r.debug("Invoke resize math"), r.__invokeResize(e, n);
912
- }).then(function(e) {
913
- return n.canceled ? n.cancelToken : (i.srcImageData = null, r.__landTileData(t, e, i));
914
- });
915
- });
916
- };
917
- return Promise.resolve().then(function() {
918
- if (i.toCtx = t.getContext("2d", { alpha: !!n.alpha }), p.isCanvas(e)) return null;
919
- if (p.isImageBitmap(e)) return i.srcImageBitmap = e, i.isImageBitmapReused = !0, null;
920
- if (p.isImage(e)) return C ? (r.debug("Decode image via createImageBitmap"), createImageBitmap(e).then(function(e) {
921
- i.srcImageBitmap = e;
922
- }).catch(function(e) {
923
- return null;
924
- })) : null;
925
- throw Error("Pica: \".from\" should be Image, Canvas or ImageBitmap");
926
- }).then(function() {
927
- if (n.canceled) return n.cancelToken;
928
- r.debug("Calculate tiles");
929
- var e = g({
930
- width: n.width,
931
- height: n.height,
932
- srcTileSize: r.options.tile,
933
- toWidth: n.toWidth,
934
- toHeight: n.toHeight,
935
- destTileBorder: n.__destTileBorder
936
- }).map(function(e) {
937
- return a(e);
938
- });
939
- function o(e) {
940
- e.srcImageBitmap && (e.isImageBitmapReused || e.srcImageBitmap.close(), e.srcImageBitmap = null);
941
- }
942
- return r.debug("Process tiles"), Promise.all(e).then(function() {
943
- return r.debug("Finished!"), o(i), t;
944
- }, function(e) {
945
- throw o(i), e;
946
- });
947
- });
948
- }, O.prototype.__processStages = function(e, t, n, i) {
949
- var a = this;
950
- if (i.canceled) return i.cancelToken;
951
- var o = r(e.shift(), 2), s = o[0], c = o[1], u = e.length === 0;
952
- i = l({}, i, {
953
- toWidth: s,
954
- toHeight: c,
955
- quality: u ? i.quality : Math.min(1, i.quality)
956
- });
957
- var d;
958
- return u || (d = this.options.createCanvas(s, c)), this.__tileAndResize(t, u ? n : d, i).then(function() {
959
- return u ? n : (i.width = s, i.height = c, a.__processStages(e, d, n, i));
960
- }).then(function(e) {
961
- return d && (d.width = d.height = 0), e;
962
- });
963
- }, O.prototype.__resizeViaCreateImageBitmap = function(e, t, n) {
964
- var r = this, i = t.getContext("2d", { alpha: !!n.alpha });
965
- return this.debug("Resize via createImageBitmap()"), createImageBitmap(e, {
966
- resizeWidth: n.toWidth,
967
- resizeHeight: n.toHeight,
968
- resizeQuality: p.cib_quality_name(n.quality)
969
- }).then(function(e) {
970
- if (n.canceled) return n.cancelToken;
971
- if (!n.unsharpAmount) return i.drawImage(e, 0, 0), e.close(), i = null, r.debug("Finished!"), t;
972
- r.debug("Unsharp result");
973
- var a = r.options.createCanvas(n.toWidth, n.toHeight), o = a.getContext("2d", { alpha: !!n.alpha });
974
- o.drawImage(e, 0, 0), e.close();
975
- var s = o.getImageData(0, 0, n.toWidth, n.toHeight);
976
- return r.__mathlib.unsharp_mask(s.data, n.toWidth, n.toHeight, n.unsharpAmount, n.unsharpRadius, n.unsharpThreshold), i.putImageData(s, 0, 0), a.width = a.height = 0, s = o = a = i = null, r.debug("Finished!"), t;
977
- });
978
- }, O.prototype.resize = function(e, t, n) {
979
- var r = this;
980
- this.debug("Start resize...");
981
- var i = l({}, x);
982
- return isNaN(n) ? n && (i = l(i, n)) : i = l(i, { quality: n }), i.toWidth = t.width, i.toHeight = t.height, i.width = e.naturalWidth || e.width, i.height = e.naturalHeight || e.height, t.width === 0 || t.height === 0 ? Promise.reject(/* @__PURE__ */ Error(`Invalid output size: ${t.width}x${t.height}`)) : (i.unsharpRadius > 2 && (i.unsharpRadius = 2), i.canceled = !1, i.cancelToken && (i.cancelToken = i.cancelToken.then(function(e) {
983
- throw i.canceled = !0, e;
984
- }, function(e) {
985
- throw i.canceled = !0, e;
986
- })), i.__destTileBorder = Math.ceil(Math.max(3, 2.5 * i.unsharpRadius | 0)), this.init().then(function() {
987
- if (i.canceled) return i.cancelToken;
988
- if (r.features.cib) return r.__resizeViaCreateImageBitmap(e, t, i);
989
- if (!w) {
990
- var n = /* @__PURE__ */ Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");
991
- throw n.code = "ERR_GET_IMAGE_DATA", n;
992
- }
993
- var a = h(i.width, i.height, i.toWidth, i.toHeight, r.options.tile, i.__destTileBorder);
994
- return r.__processStages(a, e, t, i);
995
- }));
996
- }, O.prototype.resizeBuffer = function(e) {
997
- var t = this, n = l({}, x, e);
998
- return this.init().then(function() {
999
- return t.__mathlib.resizeAndUnsharp(n);
1000
- });
1001
- }, O.prototype.toBlob = function(e, t, n) {
1002
- return t = t || "image/png", new Promise(function(r) {
1003
- if (e.toBlob) {
1004
- e.toBlob(function(e) {
1005
- return r(e);
1006
- }, t, n);
1007
- return;
1008
- }
1009
- if (e.convertToBlob) {
1010
- r(e.convertToBlob({
1011
- type: t,
1012
- quality: n
1013
- }));
1014
- return;
1015
- }
1016
- for (var i = atob(e.toDataURL(t, n).split(",")[1]), a = i.length, o = new Uint8Array(a), s = 0; s < a; s++) o[s] = i.charCodeAt(s);
1017
- r(new Blob([o], { type: t }));
1018
- });
1019
- }, O.prototype.debug = function() {}, t.exports = O;
1020
- }, {
1021
- "./lib/mathlib": 1,
1022
- "./lib/pool": 13,
1023
- "./lib/stepper": 14,
1024
- "./lib/tiler": 15,
1025
- "./lib/utils": 16,
1026
- "./lib/worker": 17,
1027
- "object-assign": 23,
1028
- webworkify: 24
1029
- }]
1030
- }, {}, [])("/index.js");
1031
- });
1032
- }), s = i(function(e) {
1033
- function t(e, t) {
1034
- var n = Error(e);
1035
- return n.code = t, n;
1036
- }
1037
- function n(e) {
1038
- for (var t = e.toString(16).toUpperCase(), n = 2 - t.length; n > 0; n--) t = "0" + t;
1039
- return "0x" + t;
1040
- }
1041
- function r(e) {
1042
- try {
1043
- return unescape(encodeURIComponent(e));
1044
- } catch (t) {
1045
- return e;
1046
- }
1047
- }
1048
- function i(e) {
1049
- try {
1050
- return decodeURIComponent(escape(e));
1051
- } catch (t) {
1052
- return e;
1053
- }
1054
- }
1055
- function a(e) {
1056
- return Object.prototype.toString.call(e) === "[object Uint8Array]";
1057
- }
1058
- function o(e, n, r) {
1059
- this.input = e.subarray(n, r), this.start = n;
1060
- var i = String.fromCharCode.apply(null, this.input.subarray(0, 4));
1061
- if (i !== "II*\0" && i !== "MM\0*") throw t("invalid TIFF signature", "EBADDATA");
1062
- this.big_endian = i[0] === "M";
1063
- }
1064
- o.prototype.each = function(e) {
1065
- this.aborted = !1;
1066
- var t = this.read_uint32(4);
1067
- for (this.ifds_to_read = [{
1068
- id: 0,
1069
- offset: t
1070
- }]; this.ifds_to_read.length > 0 && !this.aborted;) {
1071
- var n = this.ifds_to_read.shift();
1072
- n.offset && this.scan_ifd(n.id, n.offset, e);
1073
- }
1074
- }, o.prototype.filter = function(e) {
1075
- var n = {};
1076
- n.ifd0 = {
1077
- id: 0,
1078
- entries: []
1079
- }, this.each(function(t) {
1080
- e(t) === !1 && !t.is_subifd_link || t.is_subifd_link && t.count !== 1 && t.format !== 4 || (n["ifd" + t.ifd] || (n["ifd" + t.ifd] = {
1081
- id: t.ifd,
1082
- entries: []
1083
- }), n["ifd" + t.ifd].entries.push(t));
1084
- }), delete n.ifd1;
1085
- var r = 8;
1086
- Object.keys(n).forEach(function(e) {
1087
- r += 2, n[e].entries.forEach(function(e) {
1088
- r += 12 + (e.data_length > 4 ? Math.ceil(e.data_length / 2) * 2 : 0);
1089
- }), r += 4;
1090
- }), this.output = new Uint8Array(r), this.output[0] = this.output[1] = (this.big_endian ? "M" : "I").charCodeAt(0), this.write_uint16(2, 42);
1091
- var i = 8, a = this;
1092
- if (this.write_uint32(4, i), Object.keys(n).forEach(function(e) {
1093
- n[e].written_offset = i;
1094
- var t = i, r = t + 2 + n[e].entries.length * 12 + 4;
1095
- i = r, a.write_uint16(t, n[e].entries.length), n[e].entries.sort(function(e, t) {
1096
- return e.tag - t.tag;
1097
- }).forEach(function(e, r) {
1098
- var o = t + 2 + r * 12;
1099
- a.write_uint16(o, e.tag), a.write_uint16(o + 2, e.format), a.write_uint32(o + 4, e.count), e.is_subifd_link ? n["ifd" + e.tag] && (n["ifd" + e.tag].link_offset = o + 8) : e.data_length <= 4 ? a.output.set(a.input.subarray(e.data_offset - a.start, e.data_offset - a.start + 4), o + 8) : (a.write_uint32(o + 8, i), a.output.set(a.input.subarray(e.data_offset - a.start, e.data_offset - a.start + e.data_length), i), i += Math.ceil(e.data_length / 2) * 2);
1100
- });
1101
- var o = n["ifd" + (n[e].id + 1)];
1102
- o && (o.link_offset = r - 4);
1103
- }), Object.keys(n).forEach(function(e) {
1104
- n[e].written_offset && n[e].link_offset && a.write_uint32(n[e].link_offset, n[e].written_offset);
1105
- }), this.output.length !== i) throw t("internal error: incorrect buffer size allocated");
1106
- return this.output;
1107
- }, o.prototype.read_uint16 = function(e) {
1108
- var n = this.input;
1109
- if (e + 2 > n.length) throw t("unexpected EOF", "EBADDATA");
1110
- return this.big_endian ? n[e] * 256 + n[e + 1] : n[e] + n[e + 1] * 256;
1111
- }, o.prototype.read_uint32 = function(e) {
1112
- var n = this.input;
1113
- if (e + 4 > n.length) throw t("unexpected EOF", "EBADDATA");
1114
- return this.big_endian ? n[e] * 16777216 + n[e + 1] * 65536 + n[e + 2] * 256 + n[e + 3] : n[e] + n[e + 1] * 256 + n[e + 2] * 65536 + n[e + 3] * 16777216;
1115
- }, o.prototype.write_uint16 = function(e, t) {
1116
- var n = this.output;
1117
- this.big_endian ? (n[e] = t >>> 8 & 255, n[e + 1] = t & 255) : (n[e] = t & 255, n[e + 1] = t >>> 8 & 255);
1118
- }, o.prototype.write_uint32 = function(e, t) {
1119
- var n = this.output;
1120
- this.big_endian ? (n[e] = t >>> 24 & 255, n[e + 1] = t >>> 16 & 255, n[e + 2] = t >>> 8 & 255, n[e + 3] = t & 255) : (n[e] = t & 255, n[e + 1] = t >>> 8 & 255, n[e + 2] = t >>> 16 & 255, n[e + 3] = t >>> 24 & 255);
1121
- }, o.prototype.is_subifd_link = function(e, t) {
1122
- return e === 0 && t === 34665 || e === 0 && t === 34853 || e === 34665 && t === 40965;
1123
- }, o.prototype.exif_format_length = function(e) {
1124
- switch (e) {
1125
- case 1:
1126
- case 2:
1127
- case 6:
1128
- case 7: return 1;
1129
- case 3:
1130
- case 8: return 2;
1131
- case 4:
1132
- case 9:
1133
- case 11: return 4;
1134
- case 5:
1135
- case 10:
1136
- case 12: return 8;
1137
- default: return 0;
1138
- }
1139
- }, o.prototype.exif_format_read = function(e, t) {
1140
- var n;
1141
- switch (e) {
1142
- case 1:
1143
- case 2: return n = this.input[t], n;
1144
- case 6: return n = this.input[t], n | (n & 128) * 33554430;
1145
- case 3: return n = this.read_uint16(t), n;
1146
- case 8: return n = this.read_uint16(t), n | (n & 32768) * 131070;
1147
- case 4: return n = this.read_uint32(t), n;
1148
- case 9: return n = this.read_uint32(t), n | 0;
1149
- case 5:
1150
- case 10:
1151
- case 11:
1152
- case 12: return null;
1153
- case 7: return null;
1154
- default: return null;
1155
- }
1156
- }, o.prototype.scan_ifd = function(e, n, r) {
1157
- var a = this.read_uint16(n);
1158
- n += 2;
1159
- for (var o = 0; o < a; o++) {
1160
- var s = this.read_uint16(n), c = this.read_uint16(n + 2), l = this.read_uint32(n + 4), u = this.exif_format_length(c), d = l * u, f = d <= 4 ? n + 8 : this.read_uint32(n + 8), p = !1;
1161
- if (f + d > this.input.length) throw t("unexpected EOF", "EBADDATA");
1162
- for (var m = [], h = f, g = 0; g < l; g++, h += u) {
1163
- var _ = this.exif_format_read(c, h);
1164
- if (_ === null) {
1165
- m = null;
1166
- break;
1167
- }
1168
- m.push(_);
1169
- }
1170
- if (Array.isArray(m) && c === 2) {
1171
- try {
1172
- m = i(String.fromCharCode.apply(null, m));
1173
- } catch (e) {
1174
- m = null;
1175
- }
1176
- m && m[m.length - 1] === "\0" && (m = m.slice(0, -1));
1177
- }
1178
- if (this.is_subifd_link(e, s) && Array.isArray(m) && Number.isInteger(m[0]) && m[0] > 0 && (this.ifds_to_read.push({
1179
- id: s,
1180
- offset: m[0]
1181
- }), p = !0), r({
1182
- is_big_endian: this.big_endian,
1183
- ifd: e,
1184
- tag: s,
1185
- format: c,
1186
- count: l,
1187
- entry_offset: n + this.start,
1188
- data_length: d,
1189
- data_offset: f + this.start,
1190
- value: m,
1191
- is_subifd_link: p
1192
- }) === !1) {
1193
- this.aborted = !0;
1194
- return;
1195
- }
1196
- n += 12;
1197
- }
1198
- e === 0 && this.ifds_to_read.push({
1199
- id: 1,
1200
- offset: this.read_uint32(n)
1201
- });
1202
- }, e.exports.is_jpeg = function(e) {
1203
- return e.length >= 4 && e[0] === 255 && e[1] === 216 && e[2] === 255;
1204
- }, e.exports.jpeg_segments_each = function(r, i) {
1205
- if (!a(r)) throw t("Invalid argument (jpeg_bin), Uint8Array expected", "EINVAL");
1206
- if (typeof i != "function") throw t("Invalid argument (on_segment), Function expected", "EINVAL");
1207
- if (!e.exports.is_jpeg(r)) throw t("Unknown file format", "ENOTJPEG");
1208
- for (var o = 0, s = r.length, c = !1;;) {
1209
- var l, u;
1210
- if (o + 1 >= s) throw t("Unexpected EOF", "EBADDATA");
1211
- var d = r[o], f = r[o + 1];
1212
- if (d === 255 && f === 255) l = 255, u = 1;
1213
- else if (d === 255 && f !== 0) {
1214
- if (l = f, u = 2, !(208 <= l && l <= 217 || l === 1)) {
1215
- if (o + 3 >= s) throw t("Unexpected EOF", "EBADDATA");
1216
- if (u += r[o + 2] * 256 + r[o + 3], u < 2) throw t("Invalid segment length", "EBADDATA");
1217
- if (o + u - 1 >= s) throw t("Unexpected EOF", "EBADDATA");
1218
- }
1219
- c && (l >= 208 && l <= 215 || (c = !1)), l === 218 && (c = !0);
1220
- } else if (c) for (var p = o + 1;; p++) {
1221
- if (p >= s) throw t("Unexpected EOF", "EBADDATA");
1222
- if (r[p] === 255) {
1223
- if (p + 1 >= s) throw t("Unexpected EOF", "EBADDATA");
1224
- if (r[p + 1] !== 0) {
1225
- l = 0, u = p - o;
1226
- break;
1227
- }
1228
- }
1229
- }
1230
- else throw t("Unexpected byte at segment start: " + n(d) + " (offset " + n(o) + ")", "EBADDATA");
1231
- if (i({
1232
- code: l,
1233
- offset: o,
1234
- length: u
1235
- }) === !1 || l === 217) break;
1236
- o += u;
1237
- }
1238
- }, e.exports.jpeg_segments_filter = function(n, r) {
1239
- if (!a(n)) throw t("Invalid argument (jpeg_bin), Uint8Array expected", "EINVAL");
1240
- if (typeof r != "function") throw t("Invalid argument (on_segment), Function expected", "EINVAL");
1241
- var i = [], o = 0;
1242
- e.exports.jpeg_segments_each(n, function(e) {
1243
- var t = r(e);
1244
- if (a(t)) i.push({ data: t }), o += t.length;
1245
- else if (Array.isArray(t)) t.filter(a).forEach(function(e) {
1246
- i.push({ data: e }), o += e.length;
1247
- });
1248
- else if (t !== !1) {
1249
- var n = {
1250
- start: e.offset,
1251
- end: e.offset + e.length
1252
- };
1253
- i.length > 0 && i[i.length - 1].end === n.start ? i[i.length - 1].end = n.end : i.push(n), o += e.length;
1254
- }
1255
- });
1256
- var s = new Uint8Array(o), c = 0;
1257
- return i.forEach(function(e) {
1258
- var t = e.data || n.subarray(e.start, e.end);
1259
- s.set(t, c), c += t.length;
1260
- }), s;
1261
- }, e.exports.jpeg_exif_tags_each = function(n, r) {
1262
- if (!a(n)) throw t("Invalid argument (jpeg_bin), Uint8Array expected", "EINVAL");
1263
- if (typeof r != "function") throw t("Invalid argument (on_exif_entry), Function expected", "EINVAL");
1264
- e.exports.jpeg_segments_each(n, function(e) {
1265
- if (e.code === 218) return !1;
1266
- if (e.code === 225 && e.length >= 10 && n[e.offset + 4] === 69 && n[e.offset + 5] === 120 && n[e.offset + 6] === 105 && n[e.offset + 7] === 102 && n[e.offset + 8] === 0 && n[e.offset + 9] === 0) return new o(n, e.offset + 10, e.offset + e.length).each(r), !1;
1267
- });
1268
- }, e.exports.jpeg_exif_tags_filter = function(n, r) {
1269
- if (!a(n)) throw t("Invalid argument (jpeg_bin), Uint8Array expected", "EINVAL");
1270
- if (typeof r != "function") throw t("Invalid argument (on_exif_entry), Function expected", "EINVAL");
1271
- var i = !1;
1272
- return e.exports.jpeg_segments_filter(n, function(e) {
1273
- if (!i && (e.code === 218 && (i = !0), e.code === 225 && e.length >= 10 && n[e.offset + 4] === 69 && n[e.offset + 5] === 120 && n[e.offset + 6] === 105 && n[e.offset + 7] === 102 && n[e.offset + 8] === 0 && n[e.offset + 9] === 0)) {
1274
- var t = new o(n, e.offset + 10, e.offset + e.length).filter(r);
1275
- if (!t) return !1;
1276
- var a = new Uint8Array(10);
1277
- return a.set(n.slice(e.offset, e.offset + 10)), a[2] = t.length + 8 >>> 8 & 255, a[3] = t.length + 8 & 255, i = !0, [a, t];
1278
- }
1279
- });
1280
- }, e.exports.jpeg_add_comment = function(t, n) {
1281
- var i = !1, a = 0;
1282
- return e.exports.jpeg_segments_filter(t, function(e) {
1283
- if (a++, !(a === 1 && e.code === 216) && !(a === 2 && e.code === 224) && !i) {
1284
- n = r(n);
1285
- var o = new Uint8Array(5 + n.length), s = 0;
1286
- return o[s++] = 255, o[s++] = 254, o[s++] = n.length + 3 >>> 8 & 255, o[s++] = n.length + 3 & 255, n.split("").forEach(function(e) {
1287
- o[s++] = e.charCodeAt(0) & 255;
1288
- }), o[s++] = 0, i = !0, [o, t.subarray(e.offset, e.offset + e.length)];
1289
- }
1290
- });
1291
- };
1292
- });
1293
- function c(e) {
1294
- return this._getUint8Array(e.blob).then(function(t) {
1295
- if (e.is_jpeg = s.is_jpeg(t), !e.is_jpeg) return Promise.resolve(e);
1296
- e.orig_blob = e.blob;
1297
- try {
1298
- var n, r;
1299
- if (s.jpeg_exif_tags_each(t, function(t) {
1300
- if (t.ifd === 0 && t.tag === 274 && Array.isArray(t.value)) return e.orientation = t.value[0] || 1, n = t.is_big_endian, r = t.data_offset, !1;
1301
- }), r) {
1302
- var i = n ? new Uint8Array([0, 1]) : new Uint8Array([1, 0]);
1303
- e.blob = new Blob([
1304
- t.slice(0, r),
1305
- i,
1306
- t.slice(r + 2)
1307
- ], { type: "image/jpeg" });
1308
- }
1309
- } catch (e) {}
1310
- return e;
1311
- });
1312
- }
1313
- function l(e) {
1314
- if (!e.is_jpeg) return Promise.resolve(e);
1315
- var t = e.orientation - 1;
1316
- if (!t) return Promise.resolve(e);
1317
- var n = t & 4 ? this.pica.options.createCanvas(e.out_canvas.height, e.out_canvas.width) : this.pica.options.createCanvas(e.out_canvas.width, e.out_canvas.height), r = n.getContext("2d");
1318
- return r.save(), t & 1 && r.transform(-1, 0, 0, 1, n.width, 0), t & 2 && r.transform(-1, 0, 0, -1, n.width, n.height), t & 4 && r.transform(0, 1, 1, 0, 0, 0), r.drawImage(e.out_canvas, 0, 0), r.restore(), e.out_canvas.width = e.out_canvas.height = 0, e.out_canvas = n, Promise.resolve(e);
1319
- }
1320
- function u(e) {
1321
- return e.is_jpeg ? Promise.all([this._getUint8Array(e.blob), this._getUint8Array(e.out_blob)]).then(function(t) {
1322
- var n = t[0], r = t[1];
1323
- if (!s.is_jpeg(n)) return Promise.resolve(e);
1324
- var i = [];
1325
- return s.jpeg_segments_each(n, function(e) {
1326
- if (e.code === 218) return !1;
1327
- i.push(e);
1328
- }), i = i.filter(function(e) {
1329
- return e.code === 226 ? !1 : e.code >= 224 && e.code < 240 || e.code === 254;
1330
- }).map(function(e) {
1331
- return n.slice(e.offset, e.offset + e.length);
1332
- }), e.out_blob = new Blob([r.slice(0, 2)].concat(i, [r.slice(20)]), { type: "image/jpeg" }), e;
1333
- }) : Promise.resolve(e);
1334
- }
1335
- function d(e) {
1336
- e.before("_blob_to_image", c), e.after("_transform", l), e.after("_create_blob", u);
1337
- }
1338
- var f = {
1339
- jpeg_patch_exif: c,
1340
- jpeg_rotate_canvas: l,
1341
- jpeg_attach_orig_segments: u,
1342
- assign: d
1343
- };
1344
- function p(e) {
1345
- if (!(this instanceof p)) return new p(e);
1346
- e = e || {}, this.pica = e.pica || o({}), this.initialized = !1, this.utils = r;
1347
- }
1348
- p.prototype.use = function(e) {
1349
- var t = [this].concat(Array.prototype.slice.call(arguments, 1));
1350
- return e.apply(e, t), this;
1351
- }, p.prototype.init = function() {
1352
- this.use(f.assign);
1353
- }, p.prototype.toBlob = function(e, t) {
1354
- var n = {
1355
- blob: e,
1356
- opts: r.assign({ max: Infinity }, t)
1357
- };
1358
- return this.initialized || (this.init(), this.initialized = !0), Promise.resolve(n).then(this._blob_to_image).then(this._calculate_size).then(this._transform).then(this._cleanup).then(this._create_blob).then(function(e) {
1359
- return e.out_canvas.width = e.out_canvas.height = 0, e.out_blob;
1360
- });
1361
- }, p.prototype.toCanvas = function(e, t) {
1362
- var n = {
1363
- blob: e,
1364
- opts: r.assign({ max: Infinity }, t)
1365
- };
1366
- return this.initialized || (this.init(), this.initialized = !0), Promise.resolve(n).then(this._blob_to_image).then(this._calculate_size).then(this._transform).then(this._cleanup).then(function(e) {
1367
- return e.out_canvas;
1368
- });
1369
- }, p.prototype.before = function(e, t) {
1370
- if (!this[e]) throw Error("Method \"" + e + "\" does not exist");
1371
- if (typeof t != "function") throw Error("Invalid argument \"fn\", function expected");
1372
- var n = this[e], r = this;
1373
- return this[e] = function(e) {
1374
- return t.call(r, e).then(function(e) {
1375
- return n.call(r, e);
1376
- });
1377
- }, this;
1378
- }, p.prototype.after = function(e, t) {
1379
- if (!this[e]) throw Error("Method \"" + e + "\" does not exist");
1380
- if (typeof t != "function") throw Error("Invalid argument \"fn\", function expected");
1381
- var n = this[e], r = this;
1382
- return this[e] = function(e) {
1383
- return n.call(r, e).then(function(e) {
1384
- return t.call(r, e);
1385
- });
1386
- }, this;
1387
- }, p.prototype._blob_to_image = function(e) {
1388
- var t = window.URL || window.webkitURL || window.mozURL || window.msURL;
1389
- return e.image = document.createElement("img"), e.image_url = t.createObjectURL(e.blob), e.image.src = e.image_url, new Promise(function(t, n) {
1390
- e.image.onerror = function() {
1391
- n(/* @__PURE__ */ Error("ImageBlobReduce: failed to create Image() from blob"));
1392
- }, e.image.onload = function() {
1393
- t(e);
1394
- };
1395
- });
1396
- }, p.prototype._calculate_size = function(e) {
1397
- var t = e.opts.max / Math.max(e.image.width, e.image.height);
1398
- return t > 1 && (t = 1), e.transform_width = Math.max(Math.round(e.image.width * t), 1), e.transform_height = Math.max(Math.round(e.image.height * t), 1), e.scale_factor = t, Promise.resolve(e);
1399
- }, p.prototype._transform = function(e) {
1400
- e.out_canvas = this.pica.options.createCanvas(e.transform_width, e.transform_height), e.transform_width = null, e.transform_height = null;
1401
- var t = { alpha: e.blob.type === "image/png" };
1402
- return this.utils.assign(t, this.utils.pick_pica_resize_options(e.opts)), this.pica.resize(e.image, e.out_canvas, t).then(function() {
1403
- return e;
1404
- });
1405
- }, p.prototype._cleanup = function(e) {
1406
- e.image.src = "", e.image = null;
1407
- var t = window.URL || window.webkitURL || window.mozURL || window.msURL;
1408
- return t.revokeObjectURL && t.revokeObjectURL(e.image_url), e.image_url = null, Promise.resolve(e);
1409
- }, p.prototype._create_blob = function(e) {
1410
- return this.pica.toBlob(e.out_canvas, e.blob.type).then(function(t) {
1411
- return e.out_blob = t, e;
1412
- });
1413
- }, p.prototype._getUint8Array = function(e) {
1414
- return e.arrayBuffer ? e.arrayBuffer().then(function(e) {
1415
- return new Uint8Array(e);
1416
- }) : new Promise(function(t, n) {
1417
- var r = new FileReader();
1418
- r.readAsArrayBuffer(e), r.onload = function() {
1419
- t(new Uint8Array(r.result));
1420
- }, r.onerror = function() {
1421
- n(/* @__PURE__ */ Error("ImageBlobReduce: failed to load data from input blob")), r.abort();
1422
- }, r.onabort = function() {
1423
- n(/* @__PURE__ */ Error("ImageBlobReduce: failed to load data from input blob (aborted)"));
1424
- };
1425
- });
1426
- }, p.pica = o;
1427
- var m = p;
1428
- //#endregion
1429
- export { m as default };