umwd-components 0.1.813 → 0.1.815

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 (429) hide show
  1. package/dist/cjs/_virtual/_commonjs-dynamic-modules.js +6 -0
  2. package/dist/cjs/_virtual/aes.js +6 -0
  3. package/dist/cjs/_virtual/b64.js +6 -0
  4. package/dist/cjs/_virtual/blowfish.js +6 -0
  5. package/dist/cjs/_virtual/cipher-core.js +6 -0
  6. package/dist/cjs/_virtual/clone.js +6 -0
  7. package/dist/cjs/_virtual/common.js +6 -0
  8. package/dist/cjs/_virtual/context.js +6 -0
  9. package/dist/cjs/_virtual/core2.js +6 -0
  10. package/dist/cjs/_virtual/decode.js +6 -0
  11. package/dist/cjs/_virtual/deflate.js +6 -0
  12. package/dist/cjs/_virtual/dictionary-browser.js +6 -0
  13. package/dist/cjs/_virtual/dictionary.js +6 -0
  14. package/dist/cjs/_virtual/en-us.js +6 -0
  15. package/dist/cjs/_virtual/enc-base64.js +6 -0
  16. package/dist/cjs/_virtual/enc-base64url.js +6 -0
  17. package/dist/cjs/_virtual/enc-utf16.js +6 -0
  18. package/dist/cjs/_virtual/events.js +6 -0
  19. package/dist/cjs/_virtual/evpkdf.js +6 -0
  20. package/dist/cjs/_virtual/format-hex.js +6 -0
  21. package/dist/cjs/_virtual/hmac.js +6 -0
  22. package/dist/cjs/_virtual/huffman.js +6 -0
  23. package/dist/cjs/_virtual/hyphen.js +6 -0
  24. package/dist/cjs/_virtual/index10.js +6 -0
  25. package/dist/cjs/_virtual/index5.js +6 -0
  26. package/dist/cjs/_virtual/index6.js +6 -0
  27. package/dist/cjs/_virtual/index7.js +6 -0
  28. package/dist/cjs/_virtual/index8.js +6 -0
  29. package/dist/cjs/_virtual/index9.js +6 -0
  30. package/dist/cjs/_virtual/inflate.js +6 -0
  31. package/dist/cjs/_virtual/inherits_browser.js +6 -0
  32. package/dist/cjs/_virtual/lib-typedarrays.js +6 -0
  33. package/dist/cjs/_virtual/md5.js +6 -0
  34. package/dist/cjs/_virtual/mode-cfb.js +6 -0
  35. package/dist/cjs/_virtual/mode-ctr-gladman.js +6 -0
  36. package/dist/cjs/_virtual/mode-ctr.js +6 -0
  37. package/dist/cjs/_virtual/mode-ecb.js +6 -0
  38. package/dist/cjs/_virtual/mode-ofb.js +6 -0
  39. package/dist/cjs/_virtual/pad-ansix923.js +6 -0
  40. package/dist/cjs/_virtual/pad-iso10126.js +6 -0
  41. package/dist/cjs/_virtual/pad-iso97971.js +6 -0
  42. package/dist/cjs/_virtual/pad-nopadding.js +6 -0
  43. package/dist/cjs/_virtual/pad-zeropadding.js +6 -0
  44. package/dist/cjs/_virtual/pbkdf2.js +6 -0
  45. package/dist/cjs/_virtual/prefix.js +6 -0
  46. package/dist/cjs/_virtual/rabbit-legacy.js +6 -0
  47. package/dist/cjs/_virtual/rabbit.js +6 -0
  48. package/dist/cjs/_virtual/rc4.js +6 -0
  49. package/dist/cjs/_virtual/ripemd160.js +6 -0
  50. package/dist/cjs/_virtual/scheduler.development.js +6 -0
  51. package/dist/cjs/_virtual/scheduler.production.js +6 -0
  52. package/dist/cjs/_virtual/sha1.js +6 -0
  53. package/dist/cjs/_virtual/sha224.js +6 -0
  54. package/dist/cjs/_virtual/sha256.js +6 -0
  55. package/dist/cjs/_virtual/sha3.js +6 -0
  56. package/dist/cjs/_virtual/sha384.js +6 -0
  57. package/dist/cjs/_virtual/sha512.js +6 -0
  58. package/dist/cjs/_virtual/streams.js +6 -0
  59. package/dist/cjs/_virtual/transform.js +6 -0
  60. package/dist/cjs/_virtual/trees.js +6 -0
  61. package/dist/cjs/_virtual/tripledes.js +6 -0
  62. package/dist/cjs/_virtual/x64-core.js +6 -0
  63. package/dist/cjs/node_modules/@react-pdf/fns/lib/index.js +6 -0
  64. package/dist/cjs/node_modules/@react-pdf/font/lib/index.browser.js +6 -0
  65. package/dist/cjs/node_modules/@react-pdf/image/lib/index.browser.js +6 -0
  66. package/dist/cjs/node_modules/@react-pdf/layout/lib/index.js +6 -0
  67. package/dist/cjs/node_modules/@react-pdf/pdfkit/lib/pdfkit.browser.js +6 -0
  68. package/dist/cjs/node_modules/@react-pdf/png-js/lib/png-js.browser.js +6 -0
  69. package/dist/cjs/node_modules/@react-pdf/primitives/lib/index.js +6 -0
  70. package/dist/cjs/node_modules/@react-pdf/reconciler/lib/index.js +6 -0
  71. package/dist/cjs/node_modules/@react-pdf/reconciler/lib/reconciler-23.js +14 -0
  72. package/dist/cjs/node_modules/@react-pdf/reconciler/lib/reconciler-31.js +26 -0
  73. package/dist/cjs/node_modules/@react-pdf/render/lib/index.js +6 -0
  74. package/dist/cjs/node_modules/@react-pdf/renderer/lib/react-pdf.browser.js +6 -0
  75. package/dist/cjs/node_modules/@react-pdf/stylesheet/lib/index.js +6 -0
  76. package/dist/cjs/node_modules/@react-pdf/textkit/lib/textkit.js +13 -0
  77. package/dist/cjs/node_modules/@swc/helpers/esm/_define_property.js +6 -0
  78. package/dist/cjs/node_modules/abs-svg-path/index.js +6 -0
  79. package/dist/cjs/node_modules/base64-js/index.js +6 -0
  80. package/dist/cjs/node_modules/bidi-js/dist/bidi.js +6 -0
  81. package/dist/cjs/node_modules/brotli/dec/bit_reader.js +6 -0
  82. package/dist/cjs/node_modules/brotli/dec/context.js +6 -0
  83. package/dist/cjs/node_modules/brotli/dec/decode.js +6 -0
  84. package/dist/cjs/node_modules/brotli/dec/dictionary-browser.js +6 -0
  85. package/dist/cjs/node_modules/brotli/dec/dictionary.bin.js +6 -0
  86. package/dist/cjs/node_modules/brotli/dec/dictionary.js +6 -0
  87. package/dist/cjs/node_modules/brotli/dec/huffman.js +6 -0
  88. package/dist/cjs/node_modules/brotli/dec/prefix.js +6 -0
  89. package/dist/cjs/node_modules/brotli/dec/streams.js +6 -0
  90. package/dist/cjs/node_modules/brotli/dec/transform.js +6 -0
  91. package/dist/cjs/node_modules/brotli/decompress.js +6 -0
  92. package/dist/cjs/node_modules/clone/clone.js +6 -0
  93. package/dist/cjs/node_modules/color-name/index.js +6 -0
  94. package/dist/cjs/node_modules/color-string/index.js +6 -0
  95. package/dist/cjs/node_modules/crypto-js/aes.js +6 -0
  96. package/dist/cjs/node_modules/crypto-js/blowfish.js +6 -0
  97. package/dist/cjs/node_modules/crypto-js/cipher-core.js +6 -0
  98. package/dist/cjs/node_modules/crypto-js/core.js +6 -0
  99. package/dist/cjs/node_modules/crypto-js/enc-base64.js +6 -0
  100. package/dist/cjs/node_modules/crypto-js/enc-base64url.js +6 -0
  101. package/dist/cjs/node_modules/crypto-js/enc-utf16.js +6 -0
  102. package/dist/cjs/node_modules/crypto-js/evpkdf.js +6 -0
  103. package/dist/cjs/node_modules/crypto-js/format-hex.js +6 -0
  104. package/dist/cjs/node_modules/crypto-js/hmac.js +6 -0
  105. package/dist/cjs/node_modules/crypto-js/index.js +6 -0
  106. package/dist/cjs/node_modules/crypto-js/lib-typedarrays.js +6 -0
  107. package/dist/cjs/node_modules/crypto-js/md5.js +6 -0
  108. package/dist/cjs/node_modules/crypto-js/mode-cfb.js +6 -0
  109. package/dist/cjs/node_modules/crypto-js/mode-ctr-gladman.js +12 -0
  110. package/dist/cjs/node_modules/crypto-js/mode-ctr.js +6 -0
  111. package/dist/cjs/node_modules/crypto-js/mode-ecb.js +6 -0
  112. package/dist/cjs/node_modules/crypto-js/mode-ofb.js +6 -0
  113. package/dist/cjs/node_modules/crypto-js/pad-ansix923.js +6 -0
  114. package/dist/cjs/node_modules/crypto-js/pad-iso10126.js +6 -0
  115. package/dist/cjs/node_modules/crypto-js/pad-iso97971.js +6 -0
  116. package/dist/cjs/node_modules/crypto-js/pad-nopadding.js +6 -0
  117. package/dist/cjs/node_modules/crypto-js/pad-zeropadding.js +6 -0
  118. package/dist/cjs/node_modules/crypto-js/pbkdf2.js +6 -0
  119. package/dist/cjs/node_modules/crypto-js/rabbit-legacy.js +6 -0
  120. package/dist/cjs/node_modules/crypto-js/rabbit.js +6 -0
  121. package/dist/cjs/node_modules/crypto-js/rc4.js +6 -0
  122. package/dist/cjs/node_modules/crypto-js/ripemd160.js +17 -0
  123. package/dist/cjs/node_modules/crypto-js/sha1.js +6 -0
  124. package/dist/cjs/node_modules/crypto-js/sha224.js +6 -0
  125. package/dist/cjs/node_modules/crypto-js/sha256.js +6 -0
  126. package/dist/cjs/node_modules/crypto-js/sha3.js +6 -0
  127. package/dist/cjs/node_modules/crypto-js/sha384.js +6 -0
  128. package/dist/cjs/node_modules/crypto-js/sha512.js +6 -0
  129. package/dist/cjs/node_modules/crypto-js/tripledes.js +6 -0
  130. package/dist/cjs/node_modules/crypto-js/x64-core.js +6 -0
  131. package/dist/cjs/node_modules/dfa/index.js +6 -0
  132. package/dist/cjs/node_modules/emoji-regex/index.js +6 -0
  133. package/dist/cjs/node_modules/events/events.js +6 -0
  134. package/dist/cjs/node_modules/fast-deep-equal/index.js +6 -0
  135. package/dist/cjs/node_modules/fontkit/dist/browser-module.js +6 -0
  136. package/dist/cjs/node_modules/hsl-to-hex/index.js +6 -0
  137. package/dist/cjs/node_modules/hsl-to-rgb-for-reals/converter.js +6 -0
  138. package/dist/cjs/node_modules/hyphen/hyphen.js +6 -0
  139. package/dist/cjs/node_modules/hyphen/patterns/en-us.js +6 -0
  140. package/dist/cjs/node_modules/inherits/inherits_browser.js +6 -0
  141. package/dist/cjs/node_modules/jay-peg/src/index.js +6 -0
  142. package/dist/cjs/node_modules/jay-peg/src/markers/dac.js +6 -0
  143. package/dist/cjs/node_modules/jay-peg/src/markers/dht.js +6 -0
  144. package/dist/cjs/node_modules/jay-peg/src/markers/dqt.js +6 -0
  145. package/dist/cjs/node_modules/jay-peg/src/markers/dri.js +6 -0
  146. package/dist/cjs/node_modules/jay-peg/src/markers/eoi.js +6 -0
  147. package/dist/cjs/node_modules/jay-peg/src/markers/exif.js +6 -0
  148. package/dist/cjs/node_modules/jay-peg/src/markers/jfif.js +6 -0
  149. package/dist/cjs/node_modules/jay-peg/src/markers/sof.js +6 -0
  150. package/dist/cjs/node_modules/jay-peg/src/markers/soi.js +6 -0
  151. package/dist/cjs/node_modules/jay-peg/src/markers/sos.js +6 -0
  152. package/dist/cjs/node_modules/jay-peg/src/markers/utils.js +6 -0
  153. package/dist/cjs/node_modules/linebreak/dist/module.js +6 -0
  154. package/dist/cjs/node_modules/linebreak/node_modules/base64-js/lib/b64.js +6 -0
  155. package/dist/cjs/node_modules/media-engine/src/index.js +6 -0
  156. package/dist/cjs/node_modules/media-engine/src/operators.js +6 -0
  157. package/dist/cjs/node_modules/media-engine/src/parser.js +6 -0
  158. package/dist/cjs/node_modules/media-engine/src/queries.js +6 -0
  159. package/dist/cjs/node_modules/normalize-svg-path/index.js +6 -0
  160. package/dist/cjs/node_modules/object-assign/index.js +2 -2
  161. package/dist/cjs/node_modules/pako/lib/utils/common.js +6 -0
  162. package/dist/cjs/node_modules/pako/lib/zlib/adler32.js +6 -0
  163. package/dist/cjs/node_modules/pako/lib/zlib/constants.js +6 -0
  164. package/dist/cjs/node_modules/pako/lib/zlib/crc32.js +6 -0
  165. package/dist/cjs/node_modules/pako/lib/zlib/deflate.js +6 -0
  166. package/dist/cjs/node_modules/pako/lib/zlib/inffast.js +6 -0
  167. package/dist/cjs/node_modules/pako/lib/zlib/inflate.js +6 -0
  168. package/dist/cjs/node_modules/pako/lib/zlib/inftrees.js +6 -0
  169. package/dist/cjs/node_modules/pako/lib/zlib/messages.js +6 -0
  170. package/dist/cjs/node_modules/pako/lib/zlib/trees.js +6 -0
  171. package/dist/cjs/node_modules/pako/lib/zlib/zstream.js +6 -0
  172. package/dist/cjs/node_modules/parse-svg-path/index.js +6 -0
  173. package/dist/cjs/node_modules/postcss-value-parser/lib/parse.js +6 -0
  174. package/dist/cjs/node_modules/postcss-value-parser/lib/unit.js +6 -0
  175. package/dist/cjs/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  176. package/dist/cjs/node_modules/prop-types/index.js +1 -1
  177. package/dist/cjs/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  178. package/dist/cjs/node_modules/queue/index.js +6 -0
  179. package/dist/cjs/node_modules/restructure/src/Array.js +6 -0
  180. package/dist/cjs/node_modules/restructure/src/Base.js +6 -0
  181. package/dist/cjs/node_modules/restructure/src/Bitfield.js +6 -0
  182. package/dist/cjs/node_modules/restructure/src/Buffer.js +6 -0
  183. package/dist/cjs/node_modules/restructure/src/DecodeStream.js +6 -0
  184. package/dist/cjs/node_modules/restructure/src/EncodeStream.js +6 -0
  185. package/dist/cjs/node_modules/restructure/src/LazyArray.js +6 -0
  186. package/dist/cjs/node_modules/restructure/src/Number.js +6 -0
  187. package/dist/cjs/node_modules/restructure/src/Optional.js +6 -0
  188. package/dist/cjs/node_modules/restructure/src/Pointer.js +6 -0
  189. package/dist/cjs/node_modules/restructure/src/Reserved.js +6 -0
  190. package/dist/cjs/node_modules/restructure/src/String.js +6 -0
  191. package/dist/cjs/node_modules/restructure/src/Struct.js +6 -0
  192. package/dist/cjs/node_modules/restructure/src/VersionedStruct.js +6 -0
  193. package/dist/cjs/node_modules/restructure/src/utils.js +6 -0
  194. package/dist/cjs/node_modules/safe-buffer/index.js +1 -1
  195. package/dist/cjs/node_modules/scheduler/cjs/scheduler.development.js +15 -0
  196. package/dist/cjs/node_modules/scheduler/cjs/scheduler.production.js +15 -0
  197. package/dist/cjs/node_modules/scheduler/index.js +6 -0
  198. package/dist/cjs/node_modules/simple-swizzle/index.js +6 -0
  199. package/dist/cjs/node_modules/simple-swizzle/node_modules/is-arrayish/index.js +6 -0
  200. package/dist/cjs/node_modules/svg-arc-to-cubic-bezier/modules/index.js +6 -0
  201. package/dist/cjs/node_modules/tiny-inflate/index.js +6 -0
  202. package/dist/cjs/node_modules/tslib/tslib.es6.js +6 -0
  203. package/dist/cjs/node_modules/unicode-properties/dist/module.js +6 -0
  204. package/dist/cjs/node_modules/unicode-trie/index.js +6 -0
  205. package/dist/cjs/node_modules/unicode-trie/swap.js +6 -0
  206. package/dist/cjs/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js +6 -0
  207. package/dist/cjs/node_modules/yoga-layout/dist/src/generated/YGEnums.js +6 -0
  208. package/dist/cjs/node_modules/yoga-layout/dist/src/load.js +6 -0
  209. package/dist/cjs/node_modules/yoga-layout/dist/src/wrapAssembly.js +6 -0
  210. package/dist/cjs/src/components/e-commerce/invoice/CreateInvoiceForm.js +1 -1
  211. package/dist/cjs/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
  212. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  213. package/dist/esm/_virtual/_commonjs-dynamic-modules.js +11 -0
  214. package/dist/esm/_virtual/aes.js +9 -0
  215. package/dist/esm/_virtual/b64.js +9 -0
  216. package/dist/esm/_virtual/blowfish.js +9 -0
  217. package/dist/esm/_virtual/cipher-core.js +9 -0
  218. package/dist/esm/_virtual/clone.js +9 -0
  219. package/dist/esm/_virtual/common.js +9 -0
  220. package/dist/esm/_virtual/context.js +9 -0
  221. package/dist/esm/_virtual/core2.js +9 -0
  222. package/dist/esm/_virtual/decode.js +9 -0
  223. package/dist/esm/_virtual/deflate.js +9 -0
  224. package/dist/esm/_virtual/dictionary-browser.js +9 -0
  225. package/dist/esm/_virtual/dictionary.js +9 -0
  226. package/dist/esm/_virtual/en-us.js +9 -0
  227. package/dist/esm/_virtual/enc-base64.js +9 -0
  228. package/dist/esm/_virtual/enc-base64url.js +9 -0
  229. package/dist/esm/_virtual/enc-utf16.js +9 -0
  230. package/dist/esm/_virtual/events.js +9 -0
  231. package/dist/esm/_virtual/evpkdf.js +9 -0
  232. package/dist/esm/_virtual/format-hex.js +9 -0
  233. package/dist/esm/_virtual/hmac.js +9 -0
  234. package/dist/esm/_virtual/huffman.js +9 -0
  235. package/dist/esm/_virtual/hyphen.js +9 -0
  236. package/dist/esm/_virtual/index10.js +9 -0
  237. package/dist/esm/_virtual/index2.js +2 -2
  238. package/dist/esm/_virtual/index3.js +2 -2
  239. package/dist/esm/_virtual/index4.js +2 -2
  240. package/dist/esm/_virtual/index5.js +9 -0
  241. package/dist/esm/_virtual/index6.js +9 -0
  242. package/dist/esm/_virtual/index7.js +9 -0
  243. package/dist/esm/_virtual/index8.js +9 -0
  244. package/dist/esm/_virtual/index9.js +9 -0
  245. package/dist/esm/_virtual/inflate.js +9 -0
  246. package/dist/esm/_virtual/inherits_browser.js +9 -0
  247. package/dist/esm/_virtual/lib-typedarrays.js +9 -0
  248. package/dist/esm/_virtual/md5.js +9 -0
  249. package/dist/esm/_virtual/mode-cfb.js +9 -0
  250. package/dist/esm/_virtual/mode-ctr-gladman.js +9 -0
  251. package/dist/esm/_virtual/mode-ctr.js +9 -0
  252. package/dist/esm/_virtual/mode-ecb.js +9 -0
  253. package/dist/esm/_virtual/mode-ofb.js +9 -0
  254. package/dist/esm/_virtual/pad-ansix923.js +9 -0
  255. package/dist/esm/_virtual/pad-iso10126.js +9 -0
  256. package/dist/esm/_virtual/pad-iso97971.js +9 -0
  257. package/dist/esm/_virtual/pad-nopadding.js +9 -0
  258. package/dist/esm/_virtual/pad-zeropadding.js +9 -0
  259. package/dist/esm/_virtual/pbkdf2.js +9 -0
  260. package/dist/esm/_virtual/prefix.js +9 -0
  261. package/dist/esm/_virtual/rabbit-legacy.js +9 -0
  262. package/dist/esm/_virtual/rabbit.js +9 -0
  263. package/dist/esm/_virtual/rc4.js +9 -0
  264. package/dist/esm/_virtual/ripemd160.js +9 -0
  265. package/dist/esm/_virtual/scheduler.development.js +9 -0
  266. package/dist/esm/_virtual/scheduler.production.js +9 -0
  267. package/dist/esm/_virtual/sha1.js +9 -0
  268. package/dist/esm/_virtual/sha224.js +9 -0
  269. package/dist/esm/_virtual/sha256.js +9 -0
  270. package/dist/esm/_virtual/sha3.js +9 -0
  271. package/dist/esm/_virtual/sha384.js +9 -0
  272. package/dist/esm/_virtual/sha512.js +9 -0
  273. package/dist/esm/_virtual/streams.js +9 -0
  274. package/dist/esm/_virtual/transform.js +9 -0
  275. package/dist/esm/_virtual/trees.js +9 -0
  276. package/dist/esm/_virtual/tripledes.js +9 -0
  277. package/dist/esm/_virtual/x64-core.js +9 -0
  278. package/dist/esm/node_modules/@react-pdf/fns/lib/index.js +254 -0
  279. package/dist/esm/node_modules/@react-pdf/font/lib/index.browser.js +481 -0
  280. package/dist/esm/node_modules/@react-pdf/image/lib/index.browser.js +2217 -0
  281. package/dist/esm/node_modules/@react-pdf/layout/lib/index.js +2982 -0
  282. package/dist/esm/node_modules/@react-pdf/pdfkit/lib/pdfkit.browser.js +47429 -0
  283. package/dist/esm/node_modules/@react-pdf/png-js/lib/png-js.browser.js +12606 -0
  284. package/dist/esm/node_modules/@react-pdf/primitives/lib/index.js +37 -0
  285. package/dist/esm/node_modules/@react-pdf/reconciler/lib/index.js +16 -0
  286. package/dist/esm/node_modules/@react-pdf/reconciler/lib/reconciler-23.js +22 -0
  287. package/dist/esm/node_modules/@react-pdf/reconciler/lib/reconciler-31.js +30 -0
  288. package/dist/esm/node_modules/@react-pdf/render/lib/index.js +2081 -0
  289. package/dist/esm/node_modules/@react-pdf/renderer/lib/react-pdf.browser.js +472 -0
  290. package/dist/esm/node_modules/@react-pdf/stylesheet/lib/index.js +771 -0
  291. package/dist/esm/node_modules/@react-pdf/textkit/lib/textkit.js +2854 -0
  292. package/dist/esm/node_modules/@swc/helpers/esm/_define_property.js +15 -0
  293. package/dist/esm/node_modules/abs-svg-path/index.js +78 -0
  294. package/dist/esm/node_modules/base64-js/index.js +158 -0
  295. package/dist/esm/node_modules/bidi-js/dist/bidi.js +1008 -0
  296. package/dist/esm/node_modules/brotli/dec/bit_reader.js +132 -0
  297. package/dist/esm/node_modules/brotli/dec/context.js +255 -0
  298. package/dist/esm/node_modules/brotli/dec/decode.js +965 -0
  299. package/dist/esm/node_modules/brotli/dec/dictionary-browser.js +35 -0
  300. package/dist/esm/node_modules/brotli/dec/dictionary.bin.js +17 -0
  301. package/dist/esm/node_modules/brotli/dec/dictionary.js +54 -0
  302. package/dist/esm/node_modules/brotli/dec/huffman.js +133 -0
  303. package/dist/esm/node_modules/brotli/dec/prefix.js +70 -0
  304. package/dist/esm/node_modules/brotli/dec/streams.js +44 -0
  305. package/dist/esm/node_modules/brotli/dec/transform.js +264 -0
  306. package/dist/esm/node_modules/brotli/decompress.js +14 -0
  307. package/dist/esm/node_modules/clone/clone.js +272 -0
  308. package/dist/esm/node_modules/color-name/index.js +158 -0
  309. package/dist/esm/node_modules/color-string/index.js +259 -0
  310. package/dist/esm/node_modules/crypto-js/aes.js +251 -0
  311. package/dist/esm/node_modules/crypto-js/blowfish.js +488 -0
  312. package/dist/esm/node_modules/crypto-js/cipher-core.js +909 -0
  313. package/dist/esm/node_modules/crypto-js/core.js +820 -0
  314. package/dist/esm/node_modules/crypto-js/enc-base64.js +149 -0
  315. package/dist/esm/node_modules/crypto-js/enc-base64url.js +161 -0
  316. package/dist/esm/node_modules/crypto-js/enc-utf16.js +162 -0
  317. package/dist/esm/node_modules/crypto-js/evpkdf.js +149 -0
  318. package/dist/esm/node_modules/crypto-js/format-hex.js +80 -0
  319. package/dist/esm/node_modules/crypto-js/hmac.js +156 -0
  320. package/dist/esm/node_modules/crypto-js/index.js +61 -0
  321. package/dist/esm/node_modules/crypto-js/lib-typedarrays.js +89 -0
  322. package/dist/esm/node_modules/crypto-js/md5.js +277 -0
  323. package/dist/esm/node_modules/crypto-js/mode-cfb.js +94 -0
  324. package/dist/esm/node_modules/crypto-js/mode-ctr-gladman.js +130 -0
  325. package/dist/esm/node_modules/crypto-js/mode-ctr.js +72 -0
  326. package/dist/esm/node_modules/crypto-js/mode-ecb.js +54 -0
  327. package/dist/esm/node_modules/crypto-js/mode-ofb.js +68 -0
  328. package/dist/esm/node_modules/crypto-js/pad-ansix923.js +63 -0
  329. package/dist/esm/node_modules/crypto-js/pad-iso10126.js +58 -0
  330. package/dist/esm/node_modules/crypto-js/pad-iso97971.js +54 -0
  331. package/dist/esm/node_modules/crypto-js/pad-nopadding.js +44 -0
  332. package/dist/esm/node_modules/crypto-js/pad-zeropadding.js +61 -0
  333. package/dist/esm/node_modules/crypto-js/pbkdf2.js +160 -0
  334. package/dist/esm/node_modules/crypto-js/rabbit-legacy.js +207 -0
  335. package/dist/esm/node_modules/crypto-js/rabbit.js +209 -0
  336. package/dist/esm/node_modules/crypto-js/rc4.js +156 -0
  337. package/dist/esm/node_modules/crypto-js/ripemd160.js +280 -0
  338. package/dist/esm/node_modules/crypto-js/sha1.js +163 -0
  339. package/dist/esm/node_modules/crypto-js/sha224.js +94 -0
  340. package/dist/esm/node_modules/crypto-js/sha256.js +212 -0
  341. package/dist/esm/node_modules/crypto-js/sha3.js +340 -0
  342. package/dist/esm/node_modules/crypto-js/sha384.js +98 -0
  343. package/dist/esm/node_modules/crypto-js/sha512.js +340 -0
  344. package/dist/esm/node_modules/crypto-js/tripledes.js +796 -0
  345. package/dist/esm/node_modules/crypto-js/x64-core.js +317 -0
  346. package/dist/esm/node_modules/dfa/index.js +101 -0
  347. package/dist/esm/node_modules/emoji-regex/index.js +12 -0
  348. package/dist/esm/node_modules/events/events.js +485 -0
  349. package/dist/esm/node_modules/fast-deep-equal/index.js +56 -0
  350. package/dist/esm/node_modules/fontkit/dist/browser-module.js +13295 -0
  351. package/dist/esm/node_modules/hsl-to-hex/index.js +72 -0
  352. package/dist/esm/node_modules/hsl-to-rgb-for-reals/converter.js +66 -0
  353. package/dist/esm/node_modules/hyphen/hyphen.js +424 -0
  354. package/dist/esm/node_modules/hyphen/patterns/en-us.js +48 -0
  355. package/dist/esm/node_modules/inherits/inherits_browser.js +39 -0
  356. package/dist/esm/node_modules/jay-peg/src/index.js +68 -0
  357. package/dist/esm/node_modules/jay-peg/src/markers/dac.js +25 -0
  358. package/dist/esm/node_modules/jay-peg/src/markers/dht.js +52 -0
  359. package/dist/esm/node_modules/jay-peg/src/markers/dqt.js +26 -0
  360. package/dist/esm/node_modules/jay-peg/src/markers/dri.js +17 -0
  361. package/dist/esm/node_modules/jay-peg/src/markers/eoi.js +17 -0
  362. package/dist/esm/node_modules/jay-peg/src/markers/exif.js +327 -0
  363. package/dist/esm/node_modules/jay-peg/src/markers/jfif.js +24 -0
  364. package/dist/esm/node_modules/jay-peg/src/markers/sof.js +32 -0
  365. package/dist/esm/node_modules/jay-peg/src/markers/soi.js +11 -0
  366. package/dist/esm/node_modules/jay-peg/src/markers/sos.js +57 -0
  367. package/dist/esm/node_modules/jay-peg/src/markers/utils.js +71 -0
  368. package/dist/esm/node_modules/linebreak/dist/module.js +1340 -0
  369. package/dist/esm/node_modules/linebreak/node_modules/base64-js/lib/b64.js +137 -0
  370. package/dist/esm/node_modules/media-engine/src/index.js +26 -0
  371. package/dist/esm/node_modules/media-engine/src/operators.js +36 -0
  372. package/dist/esm/node_modules/media-engine/src/parser.js +147 -0
  373. package/dist/esm/node_modules/media-engine/src/queries.js +64 -0
  374. package/dist/esm/node_modules/normalize-svg-path/index.js +126 -0
  375. package/dist/esm/node_modules/object-assign/index.js +69 -74
  376. package/dist/esm/node_modules/pako/lib/utils/common.js +114 -0
  377. package/dist/esm/node_modules/pako/lib/zlib/adler32.js +57 -0
  378. package/dist/esm/node_modules/pako/lib/zlib/constants.js +78 -0
  379. package/dist/esm/node_modules/pako/lib/zlib/crc32.js +65 -0
  380. package/dist/esm/node_modules/pako/lib/zlib/deflate.js +1880 -0
  381. package/dist/esm/node_modules/pako/lib/zlib/inffast.js +351 -0
  382. package/dist/esm/node_modules/pako/lib/zlib/inflate.js +1557 -0
  383. package/dist/esm/node_modules/pako/lib/zlib/inftrees.js +352 -0
  384. package/dist/esm/node_modules/pako/lib/zlib/messages.js +38 -0
  385. package/dist/esm/node_modules/pako/lib/zlib/trees.js +1232 -0
  386. package/dist/esm/node_modules/pako/lib/zlib/zstream.js +57 -0
  387. package/dist/esm/node_modules/parse-svg-path/index.js +68 -0
  388. package/dist/esm/node_modules/postcss-value-parser/lib/parse.js +333 -0
  389. package/dist/esm/node_modules/postcss-value-parser/lib/unit.js +132 -0
  390. package/dist/esm/node_modules/prop-types/factoryWithTypeCheckers.js +2 -2
  391. package/dist/esm/node_modules/prop-types/index.js +1 -1
  392. package/dist/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  393. package/dist/esm/node_modules/queue/index.js +211 -0
  394. package/dist/esm/node_modules/restructure/src/Array.js +112 -0
  395. package/dist/esm/node_modules/restructure/src/Base.js +25 -0
  396. package/dist/esm/node_modules/restructure/src/Bitfield.js +47 -0
  397. package/dist/esm/node_modules/restructure/src/Buffer.js +44 -0
  398. package/dist/esm/node_modules/restructure/src/DecodeStream.js +93 -0
  399. package/dist/esm/node_modules/restructure/src/EncodeStream.js +137 -0
  400. package/dist/esm/node_modules/restructure/src/LazyArray.js +82 -0
  401. package/dist/esm/node_modules/restructure/src/Number.js +80 -0
  402. package/dist/esm/node_modules/restructure/src/Optional.js +52 -0
  403. package/dist/esm/node_modules/restructure/src/Pointer.js +175 -0
  404. package/dist/esm/node_modules/restructure/src/Reserved.js +31 -0
  405. package/dist/esm/node_modules/restructure/src/String.js +161 -0
  406. package/dist/esm/node_modules/restructure/src/Struct.js +121 -0
  407. package/dist/esm/node_modules/restructure/src/VersionedStruct.js +147 -0
  408. package/dist/esm/node_modules/restructure/src/utils.js +42 -0
  409. package/dist/esm/node_modules/safe-buffer/index.js +1 -1
  410. package/dist/esm/node_modules/scheduler/cjs/scheduler.development.js +382 -0
  411. package/dist/esm/node_modules/scheduler/cjs/scheduler.production.js +359 -0
  412. package/dist/esm/node_modules/scheduler/index.js +21 -0
  413. package/dist/esm/node_modules/simple-swizzle/index.js +40 -0
  414. package/dist/esm/node_modules/simple-swizzle/node_modules/is-arrayish/index.js +17 -0
  415. package/dist/esm/node_modules/svg-arc-to-cubic-bezier/modules/index.js +189 -0
  416. package/dist/esm/node_modules/tiny-inflate/index.js +387 -0
  417. package/dist/esm/node_modules/tslib/tslib.es6.js +36 -0
  418. package/dist/esm/node_modules/unicode-properties/dist/module.js +132 -0
  419. package/dist/esm/node_modules/unicode-trie/index.js +150 -0
  420. package/dist/esm/node_modules/unicode-trie/swap.js +33 -0
  421. package/dist/esm/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js +81 -0
  422. package/dist/esm/node_modules/yoga-layout/dist/src/generated/YGEnums.js +217 -0
  423. package/dist/esm/node_modules/yoga-layout/dist/src/load.js +24 -0
  424. package/dist/esm/node_modules/yoga-layout/dist/src/wrapAssembly.js +130 -0
  425. package/dist/esm/src/components/e-commerce/invoice/CreateInvoiceForm.js +1 -2
  426. package/dist/esm/src/components/e-commerce/invoice/InvoicePDF.js +3 -3
  427. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  428. package/dist/esm/types/components/e-commerce/invoice/InvoicePDF.d.ts +1 -4
  429. package/package.json +4 -3
@@ -0,0 +1,1880 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import { __exports as deflate$1 } from '../../../../_virtual/deflate.js';
8
+ import '../utils/common.js';
9
+ import './trees.js';
10
+ import { a as adler32_1 } from './adler32.js';
11
+ import { c as crc32_1 } from './crc32.js';
12
+ import { m as messages } from './messages.js';
13
+ import { __exports as common } from '../../../../_virtual/common.js';
14
+ import { __exports as trees$1 } from '../../../../_virtual/trees.js';
15
+
16
+ // (C) 1995-2013 Jean-loup Gailly and Mark Adler
17
+ // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
18
+ //
19
+ // This software is provided 'as-is', without any express or implied
20
+ // warranty. In no event will the authors be held liable for any damages
21
+ // arising from the use of this software.
22
+ //
23
+ // Permission is granted to anyone to use this software for any purpose,
24
+ // including commercial applications, and to alter it and redistribute it
25
+ // freely, subject to the following restrictions:
26
+ //
27
+ // 1. The origin of this software must not be misrepresented; you must not
28
+ // claim that you wrote the original software. If you use this software
29
+ // in a product, an acknowledgment in the product documentation would be
30
+ // appreciated but is not required.
31
+ // 2. Altered source versions must be plainly marked as such, and must not be
32
+ // misrepresented as being the original software.
33
+ // 3. This notice may not be removed or altered from any source distribution.
34
+
35
+ var utils = common;
36
+ var trees = trees$1;
37
+ var adler32 = adler32_1;
38
+ var crc32 = crc32_1;
39
+ var msg = messages;
40
+
41
+ /* Public constants ==========================================================*/
42
+ /* ===========================================================================*/
43
+
44
+
45
+ /* Allowed flush values; see deflate() and inflate() below for details */
46
+ var Z_NO_FLUSH = 0;
47
+ var Z_PARTIAL_FLUSH = 1;
48
+ //var Z_SYNC_FLUSH = 2;
49
+ var Z_FULL_FLUSH = 3;
50
+ var Z_FINISH = 4;
51
+ var Z_BLOCK = 5;
52
+ //var Z_TREES = 6;
53
+
54
+
55
+ /* Return codes for the compression/decompression functions. Negative values
56
+ * are errors, positive values are used for special but normal events.
57
+ */
58
+ var Z_OK = 0;
59
+ var Z_STREAM_END = 1;
60
+ //var Z_NEED_DICT = 2;
61
+ //var Z_ERRNO = -1;
62
+ var Z_STREAM_ERROR = -2;
63
+ var Z_DATA_ERROR = -3;
64
+ //var Z_MEM_ERROR = -4;
65
+ var Z_BUF_ERROR = -5;
66
+ //var Z_VERSION_ERROR = -6;
67
+
68
+
69
+ /* compression levels */
70
+ //var Z_NO_COMPRESSION = 0;
71
+ //var Z_BEST_SPEED = 1;
72
+ //var Z_BEST_COMPRESSION = 9;
73
+ var Z_DEFAULT_COMPRESSION = -1;
74
+
75
+
76
+ var Z_FILTERED = 1;
77
+ var Z_HUFFMAN_ONLY = 2;
78
+ var Z_RLE = 3;
79
+ var Z_FIXED = 4;
80
+ var Z_DEFAULT_STRATEGY = 0;
81
+
82
+ /* Possible values of the data_type field (though see inflate()) */
83
+ //var Z_BINARY = 0;
84
+ //var Z_TEXT = 1;
85
+ //var Z_ASCII = 1; // = Z_TEXT
86
+ var Z_UNKNOWN = 2;
87
+
88
+
89
+ /* The deflate compression method */
90
+ var Z_DEFLATED = 8;
91
+
92
+ /*============================================================================*/
93
+
94
+
95
+ var MAX_MEM_LEVEL = 9;
96
+ /* Maximum value for memLevel in deflateInit2 */
97
+ var MAX_WBITS = 15;
98
+ /* 32K LZ77 window */
99
+ var DEF_MEM_LEVEL = 8;
100
+
101
+
102
+ var LENGTH_CODES = 29;
103
+ /* number of length codes, not counting the special END_BLOCK code */
104
+ var LITERALS = 256;
105
+ /* number of literal bytes 0..255 */
106
+ var L_CODES = LITERALS + 1 + LENGTH_CODES;
107
+ /* number of Literal or Length codes, including the END_BLOCK code */
108
+ var D_CODES = 30;
109
+ /* number of distance codes */
110
+ var BL_CODES = 19;
111
+ /* number of codes used to transfer the bit lengths */
112
+ var HEAP_SIZE = 2 * L_CODES + 1;
113
+ /* maximum heap size */
114
+ var MAX_BITS = 15;
115
+ /* All codes must not exceed MAX_BITS bits */
116
+
117
+ var MIN_MATCH = 3;
118
+ var MAX_MATCH = 258;
119
+ var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
120
+
121
+ var PRESET_DICT = 0x20;
122
+
123
+ var INIT_STATE = 42;
124
+ var EXTRA_STATE = 69;
125
+ var NAME_STATE = 73;
126
+ var COMMENT_STATE = 91;
127
+ var HCRC_STATE = 103;
128
+ var BUSY_STATE = 113;
129
+ var FINISH_STATE = 666;
130
+
131
+ var BS_NEED_MORE = 1; /* block not completed, need more input or more output */
132
+ var BS_BLOCK_DONE = 2; /* block flush performed */
133
+ var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
134
+ var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
135
+
136
+ var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
137
+
138
+ function err(strm, errorCode) {
139
+ strm.msg = msg[errorCode];
140
+ return errorCode;
141
+ }
142
+
143
+ function rank(f) {
144
+ return ((f) << 1) - ((f) > 4 ? 9 : 0);
145
+ }
146
+
147
+ function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
148
+
149
+
150
+ /* =========================================================================
151
+ * Flush as much pending output as possible. All deflate() output goes
152
+ * through this function so some applications may wish to modify it
153
+ * to avoid allocating a large strm->output buffer and copying into it.
154
+ * (See also read_buf()).
155
+ */
156
+ function flush_pending(strm) {
157
+ var s = strm.state;
158
+
159
+ //_tr_flush_bits(s);
160
+ var len = s.pending;
161
+ if (len > strm.avail_out) {
162
+ len = strm.avail_out;
163
+ }
164
+ if (len === 0) { return; }
165
+
166
+ utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
167
+ strm.next_out += len;
168
+ s.pending_out += len;
169
+ strm.total_out += len;
170
+ strm.avail_out -= len;
171
+ s.pending -= len;
172
+ if (s.pending === 0) {
173
+ s.pending_out = 0;
174
+ }
175
+ }
176
+
177
+
178
+ function flush_block_only(s, last) {
179
+ trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
180
+ s.block_start = s.strstart;
181
+ flush_pending(s.strm);
182
+ }
183
+
184
+
185
+ function put_byte(s, b) {
186
+ s.pending_buf[s.pending++] = b;
187
+ }
188
+
189
+
190
+ /* =========================================================================
191
+ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
192
+ * IN assertion: the stream state is correct and there is enough room in
193
+ * pending_buf.
194
+ */
195
+ function putShortMSB(s, b) {
196
+ // put_byte(s, (Byte)(b >> 8));
197
+ // put_byte(s, (Byte)(b & 0xff));
198
+ s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
199
+ s.pending_buf[s.pending++] = b & 0xff;
200
+ }
201
+
202
+
203
+ /* ===========================================================================
204
+ * Read a new buffer from the current input stream, update the adler32
205
+ * and total number of bytes read. All deflate() input goes through
206
+ * this function so some applications may wish to modify it to avoid
207
+ * allocating a large strm->input buffer and copying from it.
208
+ * (See also flush_pending()).
209
+ */
210
+ function read_buf(strm, buf, start, size) {
211
+ var len = strm.avail_in;
212
+
213
+ if (len > size) { len = size; }
214
+ if (len === 0) { return 0; }
215
+
216
+ strm.avail_in -= len;
217
+
218
+ // zmemcpy(buf, strm->next_in, len);
219
+ utils.arraySet(buf, strm.input, strm.next_in, len, start);
220
+ if (strm.state.wrap === 1) {
221
+ strm.adler = adler32(strm.adler, buf, len, start);
222
+ }
223
+
224
+ else if (strm.state.wrap === 2) {
225
+ strm.adler = crc32(strm.adler, buf, len, start);
226
+ }
227
+
228
+ strm.next_in += len;
229
+ strm.total_in += len;
230
+
231
+ return len;
232
+ }
233
+
234
+
235
+ /* ===========================================================================
236
+ * Set match_start to the longest match starting at the given string and
237
+ * return its length. Matches shorter or equal to prev_length are discarded,
238
+ * in which case the result is equal to prev_length and match_start is
239
+ * garbage.
240
+ * IN assertions: cur_match is the head of the hash chain for the current
241
+ * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
242
+ * OUT assertion: the match length is not greater than s->lookahead.
243
+ */
244
+ function longest_match(s, cur_match) {
245
+ var chain_length = s.max_chain_length; /* max hash chain length */
246
+ var scan = s.strstart; /* current string */
247
+ var match; /* matched string */
248
+ var len; /* length of current match */
249
+ var best_len = s.prev_length; /* best match length so far */
250
+ var nice_match = s.nice_match; /* stop if match long enough */
251
+ var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
252
+ s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
253
+
254
+ var _win = s.window; // shortcut
255
+
256
+ var wmask = s.w_mask;
257
+ var prev = s.prev;
258
+
259
+ /* Stop when cur_match becomes <= limit. To simplify the code,
260
+ * we prevent matches with the string of window index 0.
261
+ */
262
+
263
+ var strend = s.strstart + MAX_MATCH;
264
+ var scan_end1 = _win[scan + best_len - 1];
265
+ var scan_end = _win[scan + best_len];
266
+
267
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
268
+ * It is easy to get rid of this optimization if necessary.
269
+ */
270
+ // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
271
+
272
+ /* Do not waste too much time if we already have a good match: */
273
+ if (s.prev_length >= s.good_match) {
274
+ chain_length >>= 2;
275
+ }
276
+ /* Do not look for matches beyond the end of the input. This is necessary
277
+ * to make deflate deterministic.
278
+ */
279
+ if (nice_match > s.lookahead) { nice_match = s.lookahead; }
280
+
281
+ // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
282
+
283
+ do {
284
+ // Assert(cur_match < s->strstart, "no future");
285
+ match = cur_match;
286
+
287
+ /* Skip to next match if the match length cannot increase
288
+ * or if the match length is less than 2. Note that the checks below
289
+ * for insufficient lookahead only occur occasionally for performance
290
+ * reasons. Therefore uninitialized memory will be accessed, and
291
+ * conditional jumps will be made that depend on those values.
292
+ * However the length of the match is limited to the lookahead, so
293
+ * the output of deflate is not affected by the uninitialized values.
294
+ */
295
+
296
+ if (_win[match + best_len] !== scan_end ||
297
+ _win[match + best_len - 1] !== scan_end1 ||
298
+ _win[match] !== _win[scan] ||
299
+ _win[++match] !== _win[scan + 1]) {
300
+ continue;
301
+ }
302
+
303
+ /* The check at best_len-1 can be removed because it will be made
304
+ * again later. (This heuristic is not always a win.)
305
+ * It is not necessary to compare scan[2] and match[2] since they
306
+ * are always equal when the other bytes match, given that
307
+ * the hash keys are equal and that HASH_BITS >= 8.
308
+ */
309
+ scan += 2;
310
+ match++;
311
+ // Assert(*scan == *match, "match[2]?");
312
+
313
+ /* We check for insufficient lookahead only every 8th comparison;
314
+ * the 256th check will be made at strstart+258.
315
+ */
316
+ do {
317
+ /*jshint noempty:false*/
318
+ } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
319
+ _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
320
+ _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
321
+ _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
322
+ scan < strend);
323
+
324
+ // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
325
+
326
+ len = MAX_MATCH - (strend - scan);
327
+ scan = strend - MAX_MATCH;
328
+
329
+ if (len > best_len) {
330
+ s.match_start = cur_match;
331
+ best_len = len;
332
+ if (len >= nice_match) {
333
+ break;
334
+ }
335
+ scan_end1 = _win[scan + best_len - 1];
336
+ scan_end = _win[scan + best_len];
337
+ }
338
+ } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
339
+
340
+ if (best_len <= s.lookahead) {
341
+ return best_len;
342
+ }
343
+ return s.lookahead;
344
+ }
345
+
346
+
347
+ /* ===========================================================================
348
+ * Fill the window when the lookahead becomes insufficient.
349
+ * Updates strstart and lookahead.
350
+ *
351
+ * IN assertion: lookahead < MIN_LOOKAHEAD
352
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
353
+ * At least one byte has been read, or avail_in == 0; reads are
354
+ * performed for at least two bytes (required for the zip translate_eol
355
+ * option -- not supported here).
356
+ */
357
+ function fill_window(s) {
358
+ var _w_size = s.w_size;
359
+ var p, n, m, more, str;
360
+
361
+ //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
362
+
363
+ do {
364
+ more = s.window_size - s.lookahead - s.strstart;
365
+
366
+ // JS ints have 32 bit, block below not needed
367
+ /* Deal with !@#$% 64K limit: */
368
+ //if (sizeof(int) <= 2) {
369
+ // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
370
+ // more = wsize;
371
+ //
372
+ // } else if (more == (unsigned)(-1)) {
373
+ // /* Very unlikely, but possible on 16 bit machine if
374
+ // * strstart == 0 && lookahead == 1 (input done a byte at time)
375
+ // */
376
+ // more--;
377
+ // }
378
+ //}
379
+
380
+
381
+ /* If the window is almost full and there is insufficient lookahead,
382
+ * move the upper half to the lower one to make room in the upper half.
383
+ */
384
+ if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
385
+
386
+ utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
387
+ s.match_start -= _w_size;
388
+ s.strstart -= _w_size;
389
+ /* we now have strstart >= MAX_DIST */
390
+ s.block_start -= _w_size;
391
+
392
+ /* Slide the hash table (could be avoided with 32 bit values
393
+ at the expense of memory usage). We slide even when level == 0
394
+ to keep the hash table consistent if we switch back to level > 0
395
+ later. (Using level 0 permanently is not an optimal usage of
396
+ zlib, so we don't care about this pathological case.)
397
+ */
398
+
399
+ n = s.hash_size;
400
+ p = n;
401
+ do {
402
+ m = s.head[--p];
403
+ s.head[p] = (m >= _w_size ? m - _w_size : 0);
404
+ } while (--n);
405
+
406
+ n = _w_size;
407
+ p = n;
408
+ do {
409
+ m = s.prev[--p];
410
+ s.prev[p] = (m >= _w_size ? m - _w_size : 0);
411
+ /* If n is not on any hash chain, prev[n] is garbage but
412
+ * its value will never be used.
413
+ */
414
+ } while (--n);
415
+
416
+ more += _w_size;
417
+ }
418
+ if (s.strm.avail_in === 0) {
419
+ break;
420
+ }
421
+
422
+ /* If there was no sliding:
423
+ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
424
+ * more == window_size - lookahead - strstart
425
+ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
426
+ * => more >= window_size - 2*WSIZE + 2
427
+ * In the BIG_MEM or MMAP case (not yet supported),
428
+ * window_size == input_size + MIN_LOOKAHEAD &&
429
+ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
430
+ * Otherwise, window_size == 2*WSIZE so more >= 2.
431
+ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
432
+ */
433
+ //Assert(more >= 2, "more < 2");
434
+ n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
435
+ s.lookahead += n;
436
+
437
+ /* Initialize the hash value now that we have some input: */
438
+ if (s.lookahead + s.insert >= MIN_MATCH) {
439
+ str = s.strstart - s.insert;
440
+ s.ins_h = s.window[str];
441
+
442
+ /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
443
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
444
+ //#if MIN_MATCH != 3
445
+ // Call update_hash() MIN_MATCH-3 more times
446
+ //#endif
447
+ while (s.insert) {
448
+ /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
449
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
450
+
451
+ s.prev[str & s.w_mask] = s.head[s.ins_h];
452
+ s.head[s.ins_h] = str;
453
+ str++;
454
+ s.insert--;
455
+ if (s.lookahead + s.insert < MIN_MATCH) {
456
+ break;
457
+ }
458
+ }
459
+ }
460
+ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
461
+ * but this is not important since only literal bytes will be emitted.
462
+ */
463
+
464
+ } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
465
+
466
+ /* If the WIN_INIT bytes after the end of the current data have never been
467
+ * written, then zero those bytes in order to avoid memory check reports of
468
+ * the use of uninitialized (or uninitialised as Julian writes) bytes by
469
+ * the longest match routines. Update the high water mark for the next
470
+ * time through here. WIN_INIT is set to MAX_MATCH since the longest match
471
+ * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
472
+ */
473
+ // if (s.high_water < s.window_size) {
474
+ // var curr = s.strstart + s.lookahead;
475
+ // var init = 0;
476
+ //
477
+ // if (s.high_water < curr) {
478
+ // /* Previous high water mark below current data -- zero WIN_INIT
479
+ // * bytes or up to end of window, whichever is less.
480
+ // */
481
+ // init = s.window_size - curr;
482
+ // if (init > WIN_INIT)
483
+ // init = WIN_INIT;
484
+ // zmemzero(s->window + curr, (unsigned)init);
485
+ // s->high_water = curr + init;
486
+ // }
487
+ // else if (s->high_water < (ulg)curr + WIN_INIT) {
488
+ // /* High water mark at or above current data, but below current data
489
+ // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
490
+ // * to end of window, whichever is less.
491
+ // */
492
+ // init = (ulg)curr + WIN_INIT - s->high_water;
493
+ // if (init > s->window_size - s->high_water)
494
+ // init = s->window_size - s->high_water;
495
+ // zmemzero(s->window + s->high_water, (unsigned)init);
496
+ // s->high_water += init;
497
+ // }
498
+ // }
499
+ //
500
+ // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
501
+ // "not enough room for search");
502
+ }
503
+
504
+ /* ===========================================================================
505
+ * Copy without compression as much as possible from the input stream, return
506
+ * the current block state.
507
+ * This function does not insert new strings in the dictionary since
508
+ * uncompressible data is probably not useful. This function is used
509
+ * only for the level=0 compression option.
510
+ * NOTE: this function should be optimized to avoid extra copying from
511
+ * window to pending_buf.
512
+ */
513
+ function deflate_stored(s, flush) {
514
+ /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
515
+ * to pending_buf_size, and each stored block has a 5 byte header:
516
+ */
517
+ var max_block_size = 0xffff;
518
+
519
+ if (max_block_size > s.pending_buf_size - 5) {
520
+ max_block_size = s.pending_buf_size - 5;
521
+ }
522
+
523
+ /* Copy as much as possible from input to output: */
524
+ for (;;) {
525
+ /* Fill the window as much as possible: */
526
+ if (s.lookahead <= 1) {
527
+
528
+ //Assert(s->strstart < s->w_size+MAX_DIST(s) ||
529
+ // s->block_start >= (long)s->w_size, "slide too late");
530
+ // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
531
+ // s.block_start >= s.w_size)) {
532
+ // throw new Error("slide too late");
533
+ // }
534
+
535
+ fill_window(s);
536
+ if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
537
+ return BS_NEED_MORE;
538
+ }
539
+
540
+ if (s.lookahead === 0) {
541
+ break;
542
+ }
543
+ /* flush the current block */
544
+ }
545
+ //Assert(s->block_start >= 0L, "block gone");
546
+ // if (s.block_start < 0) throw new Error("block gone");
547
+
548
+ s.strstart += s.lookahead;
549
+ s.lookahead = 0;
550
+
551
+ /* Emit a stored block if pending_buf will be full: */
552
+ var max_start = s.block_start + max_block_size;
553
+
554
+ if (s.strstart === 0 || s.strstart >= max_start) {
555
+ /* strstart == 0 is possible when wraparound on 16-bit machine */
556
+ s.lookahead = s.strstart - max_start;
557
+ s.strstart = max_start;
558
+ /*** FLUSH_BLOCK(s, 0); ***/
559
+ flush_block_only(s, false);
560
+ if (s.strm.avail_out === 0) {
561
+ return BS_NEED_MORE;
562
+ }
563
+ /***/
564
+
565
+
566
+ }
567
+ /* Flush if we may have to slide, otherwise block_start may become
568
+ * negative and the data will be gone:
569
+ */
570
+ if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
571
+ /*** FLUSH_BLOCK(s, 0); ***/
572
+ flush_block_only(s, false);
573
+ if (s.strm.avail_out === 0) {
574
+ return BS_NEED_MORE;
575
+ }
576
+ /***/
577
+ }
578
+ }
579
+
580
+ s.insert = 0;
581
+
582
+ if (flush === Z_FINISH) {
583
+ /*** FLUSH_BLOCK(s, 1); ***/
584
+ flush_block_only(s, true);
585
+ if (s.strm.avail_out === 0) {
586
+ return BS_FINISH_STARTED;
587
+ }
588
+ /***/
589
+ return BS_FINISH_DONE;
590
+ }
591
+
592
+ if (s.strstart > s.block_start) {
593
+ /*** FLUSH_BLOCK(s, 0); ***/
594
+ flush_block_only(s, false);
595
+ if (s.strm.avail_out === 0) {
596
+ return BS_NEED_MORE;
597
+ }
598
+ /***/
599
+ }
600
+
601
+ return BS_NEED_MORE;
602
+ }
603
+
604
+ /* ===========================================================================
605
+ * Compress as much as possible from the input stream, return the current
606
+ * block state.
607
+ * This function does not perform lazy evaluation of matches and inserts
608
+ * new strings in the dictionary only for unmatched strings or for short
609
+ * matches. It is used only for the fast compression options.
610
+ */
611
+ function deflate_fast(s, flush) {
612
+ var hash_head; /* head of the hash chain */
613
+ var bflush; /* set if current block must be flushed */
614
+
615
+ for (;;) {
616
+ /* Make sure that we always have enough lookahead, except
617
+ * at the end of the input file. We need MAX_MATCH bytes
618
+ * for the next match, plus MIN_MATCH bytes to insert the
619
+ * string following the next match.
620
+ */
621
+ if (s.lookahead < MIN_LOOKAHEAD) {
622
+ fill_window(s);
623
+ if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
624
+ return BS_NEED_MORE;
625
+ }
626
+ if (s.lookahead === 0) {
627
+ break; /* flush the current block */
628
+ }
629
+ }
630
+
631
+ /* Insert the string window[strstart .. strstart+2] in the
632
+ * dictionary, and set hash_head to the head of the hash chain:
633
+ */
634
+ hash_head = 0/*NIL*/;
635
+ if (s.lookahead >= MIN_MATCH) {
636
+ /*** INSERT_STRING(s, s.strstart, hash_head); ***/
637
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
638
+ hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
639
+ s.head[s.ins_h] = s.strstart;
640
+ /***/
641
+ }
642
+
643
+ /* Find the longest match, discarding those <= prev_length.
644
+ * At this point we have always match_length < MIN_MATCH
645
+ */
646
+ if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
647
+ /* To simplify the code, we prevent matches with the string
648
+ * of window index 0 (in particular we have to avoid a match
649
+ * of the string with itself at the start of the input file).
650
+ */
651
+ s.match_length = longest_match(s, hash_head);
652
+ /* longest_match() sets match_start */
653
+ }
654
+ if (s.match_length >= MIN_MATCH) {
655
+ // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
656
+
657
+ /*** _tr_tally_dist(s, s.strstart - s.match_start,
658
+ s.match_length - MIN_MATCH, bflush); ***/
659
+ bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
660
+
661
+ s.lookahead -= s.match_length;
662
+
663
+ /* Insert new strings in the hash table only if the match length
664
+ * is not too large. This saves time but degrades compression.
665
+ */
666
+ if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
667
+ s.match_length--; /* string at strstart already in table */
668
+ do {
669
+ s.strstart++;
670
+ /*** INSERT_STRING(s, s.strstart, hash_head); ***/
671
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
672
+ hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
673
+ s.head[s.ins_h] = s.strstart;
674
+ /***/
675
+ /* strstart never exceeds WSIZE-MAX_MATCH, so there are
676
+ * always MIN_MATCH bytes ahead.
677
+ */
678
+ } while (--s.match_length !== 0);
679
+ s.strstart++;
680
+ } else
681
+ {
682
+ s.strstart += s.match_length;
683
+ s.match_length = 0;
684
+ s.ins_h = s.window[s.strstart];
685
+ /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
686
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
687
+
688
+ //#if MIN_MATCH != 3
689
+ // Call UPDATE_HASH() MIN_MATCH-3 more times
690
+ //#endif
691
+ /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
692
+ * matter since it will be recomputed at next deflate call.
693
+ */
694
+ }
695
+ } else {
696
+ /* No match, output a literal byte */
697
+ //Tracevv((stderr,"%c", s.window[s.strstart]));
698
+ /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
699
+ bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
700
+
701
+ s.lookahead--;
702
+ s.strstart++;
703
+ }
704
+ if (bflush) {
705
+ /*** FLUSH_BLOCK(s, 0); ***/
706
+ flush_block_only(s, false);
707
+ if (s.strm.avail_out === 0) {
708
+ return BS_NEED_MORE;
709
+ }
710
+ /***/
711
+ }
712
+ }
713
+ s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
714
+ if (flush === Z_FINISH) {
715
+ /*** FLUSH_BLOCK(s, 1); ***/
716
+ flush_block_only(s, true);
717
+ if (s.strm.avail_out === 0) {
718
+ return BS_FINISH_STARTED;
719
+ }
720
+ /***/
721
+ return BS_FINISH_DONE;
722
+ }
723
+ if (s.last_lit) {
724
+ /*** FLUSH_BLOCK(s, 0); ***/
725
+ flush_block_only(s, false);
726
+ if (s.strm.avail_out === 0) {
727
+ return BS_NEED_MORE;
728
+ }
729
+ /***/
730
+ }
731
+ return BS_BLOCK_DONE;
732
+ }
733
+
734
+ /* ===========================================================================
735
+ * Same as above, but achieves better compression. We use a lazy
736
+ * evaluation for matches: a match is finally adopted only if there is
737
+ * no better match at the next window position.
738
+ */
739
+ function deflate_slow(s, flush) {
740
+ var hash_head; /* head of hash chain */
741
+ var bflush; /* set if current block must be flushed */
742
+
743
+ var max_insert;
744
+
745
+ /* Process the input block. */
746
+ for (;;) {
747
+ /* Make sure that we always have enough lookahead, except
748
+ * at the end of the input file. We need MAX_MATCH bytes
749
+ * for the next match, plus MIN_MATCH bytes to insert the
750
+ * string following the next match.
751
+ */
752
+ if (s.lookahead < MIN_LOOKAHEAD) {
753
+ fill_window(s);
754
+ if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
755
+ return BS_NEED_MORE;
756
+ }
757
+ if (s.lookahead === 0) { break; } /* flush the current block */
758
+ }
759
+
760
+ /* Insert the string window[strstart .. strstart+2] in the
761
+ * dictionary, and set hash_head to the head of the hash chain:
762
+ */
763
+ hash_head = 0/*NIL*/;
764
+ if (s.lookahead >= MIN_MATCH) {
765
+ /*** INSERT_STRING(s, s.strstart, hash_head); ***/
766
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
767
+ hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
768
+ s.head[s.ins_h] = s.strstart;
769
+ /***/
770
+ }
771
+
772
+ /* Find the longest match, discarding those <= prev_length.
773
+ */
774
+ s.prev_length = s.match_length;
775
+ s.prev_match = s.match_start;
776
+ s.match_length = MIN_MATCH - 1;
777
+
778
+ if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
779
+ s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
780
+ /* To simplify the code, we prevent matches with the string
781
+ * of window index 0 (in particular we have to avoid a match
782
+ * of the string with itself at the start of the input file).
783
+ */
784
+ s.match_length = longest_match(s, hash_head);
785
+ /* longest_match() sets match_start */
786
+
787
+ if (s.match_length <= 5 &&
788
+ (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
789
+
790
+ /* If prev_match is also MIN_MATCH, match_start is garbage
791
+ * but we will ignore the current match anyway.
792
+ */
793
+ s.match_length = MIN_MATCH - 1;
794
+ }
795
+ }
796
+ /* If there was a match at the previous step and the current
797
+ * match is not better, output the previous match:
798
+ */
799
+ if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
800
+ max_insert = s.strstart + s.lookahead - MIN_MATCH;
801
+ /* Do not insert strings in hash table beyond this. */
802
+
803
+ //check_match(s, s.strstart-1, s.prev_match, s.prev_length);
804
+
805
+ /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
806
+ s.prev_length - MIN_MATCH, bflush);***/
807
+ bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
808
+ /* Insert in hash table all strings up to the end of the match.
809
+ * strstart-1 and strstart are already inserted. If there is not
810
+ * enough lookahead, the last two strings are not inserted in
811
+ * the hash table.
812
+ */
813
+ s.lookahead -= s.prev_length - 1;
814
+ s.prev_length -= 2;
815
+ do {
816
+ if (++s.strstart <= max_insert) {
817
+ /*** INSERT_STRING(s, s.strstart, hash_head); ***/
818
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
819
+ hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
820
+ s.head[s.ins_h] = s.strstart;
821
+ /***/
822
+ }
823
+ } while (--s.prev_length !== 0);
824
+ s.match_available = 0;
825
+ s.match_length = MIN_MATCH - 1;
826
+ s.strstart++;
827
+
828
+ if (bflush) {
829
+ /*** FLUSH_BLOCK(s, 0); ***/
830
+ flush_block_only(s, false);
831
+ if (s.strm.avail_out === 0) {
832
+ return BS_NEED_MORE;
833
+ }
834
+ /***/
835
+ }
836
+
837
+ } else if (s.match_available) {
838
+ /* If there was no match at the previous position, output a
839
+ * single literal. If there was a match but the current match
840
+ * is longer, truncate the previous match to a single literal.
841
+ */
842
+ //Tracevv((stderr,"%c", s->window[s->strstart-1]));
843
+ /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
844
+ bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
845
+
846
+ if (bflush) {
847
+ /*** FLUSH_BLOCK_ONLY(s, 0) ***/
848
+ flush_block_only(s, false);
849
+ /***/
850
+ }
851
+ s.strstart++;
852
+ s.lookahead--;
853
+ if (s.strm.avail_out === 0) {
854
+ return BS_NEED_MORE;
855
+ }
856
+ } else {
857
+ /* There is no previous match to compare with, wait for
858
+ * the next step to decide.
859
+ */
860
+ s.match_available = 1;
861
+ s.strstart++;
862
+ s.lookahead--;
863
+ }
864
+ }
865
+ //Assert (flush != Z_NO_FLUSH, "no flush?");
866
+ if (s.match_available) {
867
+ //Tracevv((stderr,"%c", s->window[s->strstart-1]));
868
+ /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
869
+ bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
870
+
871
+ s.match_available = 0;
872
+ }
873
+ s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
874
+ if (flush === Z_FINISH) {
875
+ /*** FLUSH_BLOCK(s, 1); ***/
876
+ flush_block_only(s, true);
877
+ if (s.strm.avail_out === 0) {
878
+ return BS_FINISH_STARTED;
879
+ }
880
+ /***/
881
+ return BS_FINISH_DONE;
882
+ }
883
+ if (s.last_lit) {
884
+ /*** FLUSH_BLOCK(s, 0); ***/
885
+ flush_block_only(s, false);
886
+ if (s.strm.avail_out === 0) {
887
+ return BS_NEED_MORE;
888
+ }
889
+ /***/
890
+ }
891
+
892
+ return BS_BLOCK_DONE;
893
+ }
894
+
895
+
896
+ /* ===========================================================================
897
+ * For Z_RLE, simply look for runs of bytes, generate matches only of distance
898
+ * one. Do not maintain a hash table. (It will be regenerated if this run of
899
+ * deflate switches away from Z_RLE.)
900
+ */
901
+ function deflate_rle(s, flush) {
902
+ var bflush; /* set if current block must be flushed */
903
+ var prev; /* byte at distance one to match */
904
+ var scan, strend; /* scan goes up to strend for length of run */
905
+
906
+ var _win = s.window;
907
+
908
+ for (;;) {
909
+ /* Make sure that we always have enough lookahead, except
910
+ * at the end of the input file. We need MAX_MATCH bytes
911
+ * for the longest run, plus one for the unrolled loop.
912
+ */
913
+ if (s.lookahead <= MAX_MATCH) {
914
+ fill_window(s);
915
+ if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
916
+ return BS_NEED_MORE;
917
+ }
918
+ if (s.lookahead === 0) { break; } /* flush the current block */
919
+ }
920
+
921
+ /* See how many times the previous byte repeats */
922
+ s.match_length = 0;
923
+ if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
924
+ scan = s.strstart - 1;
925
+ prev = _win[scan];
926
+ if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
927
+ strend = s.strstart + MAX_MATCH;
928
+ do {
929
+ /*jshint noempty:false*/
930
+ } while (prev === _win[++scan] && prev === _win[++scan] &&
931
+ prev === _win[++scan] && prev === _win[++scan] &&
932
+ prev === _win[++scan] && prev === _win[++scan] &&
933
+ prev === _win[++scan] && prev === _win[++scan] &&
934
+ scan < strend);
935
+ s.match_length = MAX_MATCH - (strend - scan);
936
+ if (s.match_length > s.lookahead) {
937
+ s.match_length = s.lookahead;
938
+ }
939
+ }
940
+ //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
941
+ }
942
+
943
+ /* Emit match if have run of MIN_MATCH or longer, else emit literal */
944
+ if (s.match_length >= MIN_MATCH) {
945
+ //check_match(s, s.strstart, s.strstart - 1, s.match_length);
946
+
947
+ /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
948
+ bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
949
+
950
+ s.lookahead -= s.match_length;
951
+ s.strstart += s.match_length;
952
+ s.match_length = 0;
953
+ } else {
954
+ /* No match, output a literal byte */
955
+ //Tracevv((stderr,"%c", s->window[s->strstart]));
956
+ /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
957
+ bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
958
+
959
+ s.lookahead--;
960
+ s.strstart++;
961
+ }
962
+ if (bflush) {
963
+ /*** FLUSH_BLOCK(s, 0); ***/
964
+ flush_block_only(s, false);
965
+ if (s.strm.avail_out === 0) {
966
+ return BS_NEED_MORE;
967
+ }
968
+ /***/
969
+ }
970
+ }
971
+ s.insert = 0;
972
+ if (flush === Z_FINISH) {
973
+ /*** FLUSH_BLOCK(s, 1); ***/
974
+ flush_block_only(s, true);
975
+ if (s.strm.avail_out === 0) {
976
+ return BS_FINISH_STARTED;
977
+ }
978
+ /***/
979
+ return BS_FINISH_DONE;
980
+ }
981
+ if (s.last_lit) {
982
+ /*** FLUSH_BLOCK(s, 0); ***/
983
+ flush_block_only(s, false);
984
+ if (s.strm.avail_out === 0) {
985
+ return BS_NEED_MORE;
986
+ }
987
+ /***/
988
+ }
989
+ return BS_BLOCK_DONE;
990
+ }
991
+
992
+ /* ===========================================================================
993
+ * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
994
+ * (It will be regenerated if this run of deflate switches away from Huffman.)
995
+ */
996
+ function deflate_huff(s, flush) {
997
+ var bflush; /* set if current block must be flushed */
998
+
999
+ for (;;) {
1000
+ /* Make sure that we have a literal to write. */
1001
+ if (s.lookahead === 0) {
1002
+ fill_window(s);
1003
+ if (s.lookahead === 0) {
1004
+ if (flush === Z_NO_FLUSH) {
1005
+ return BS_NEED_MORE;
1006
+ }
1007
+ break; /* flush the current block */
1008
+ }
1009
+ }
1010
+
1011
+ /* Output a literal byte */
1012
+ s.match_length = 0;
1013
+ //Tracevv((stderr,"%c", s->window[s->strstart]));
1014
+ /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
1015
+ bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
1016
+ s.lookahead--;
1017
+ s.strstart++;
1018
+ if (bflush) {
1019
+ /*** FLUSH_BLOCK(s, 0); ***/
1020
+ flush_block_only(s, false);
1021
+ if (s.strm.avail_out === 0) {
1022
+ return BS_NEED_MORE;
1023
+ }
1024
+ /***/
1025
+ }
1026
+ }
1027
+ s.insert = 0;
1028
+ if (flush === Z_FINISH) {
1029
+ /*** FLUSH_BLOCK(s, 1); ***/
1030
+ flush_block_only(s, true);
1031
+ if (s.strm.avail_out === 0) {
1032
+ return BS_FINISH_STARTED;
1033
+ }
1034
+ /***/
1035
+ return BS_FINISH_DONE;
1036
+ }
1037
+ if (s.last_lit) {
1038
+ /*** FLUSH_BLOCK(s, 0); ***/
1039
+ flush_block_only(s, false);
1040
+ if (s.strm.avail_out === 0) {
1041
+ return BS_NEED_MORE;
1042
+ }
1043
+ /***/
1044
+ }
1045
+ return BS_BLOCK_DONE;
1046
+ }
1047
+
1048
+ /* Values for max_lazy_match, good_match and max_chain_length, depending on
1049
+ * the desired pack level (0..9). The values given below have been tuned to
1050
+ * exclude worst case performance for pathological files. Better values may be
1051
+ * found for specific files.
1052
+ */
1053
+ function Config(good_length, max_lazy, nice_length, max_chain, func) {
1054
+ this.good_length = good_length;
1055
+ this.max_lazy = max_lazy;
1056
+ this.nice_length = nice_length;
1057
+ this.max_chain = max_chain;
1058
+ this.func = func;
1059
+ }
1060
+
1061
+ var configuration_table;
1062
+
1063
+ configuration_table = [
1064
+ /* good lazy nice chain */
1065
+ new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
1066
+ new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
1067
+ new Config(4, 5, 16, 8, deflate_fast), /* 2 */
1068
+ new Config(4, 6, 32, 32, deflate_fast), /* 3 */
1069
+
1070
+ new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
1071
+ new Config(8, 16, 32, 32, deflate_slow), /* 5 */
1072
+ new Config(8, 16, 128, 128, deflate_slow), /* 6 */
1073
+ new Config(8, 32, 128, 256, deflate_slow), /* 7 */
1074
+ new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
1075
+ new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
1076
+ ];
1077
+
1078
+
1079
+ /* ===========================================================================
1080
+ * Initialize the "longest match" routines for a new zlib stream
1081
+ */
1082
+ function lm_init(s) {
1083
+ s.window_size = 2 * s.w_size;
1084
+
1085
+ /*** CLEAR_HASH(s); ***/
1086
+ zero(s.head); // Fill with NIL (= 0);
1087
+
1088
+ /* Set the default configuration parameters:
1089
+ */
1090
+ s.max_lazy_match = configuration_table[s.level].max_lazy;
1091
+ s.good_match = configuration_table[s.level].good_length;
1092
+ s.nice_match = configuration_table[s.level].nice_length;
1093
+ s.max_chain_length = configuration_table[s.level].max_chain;
1094
+
1095
+ s.strstart = 0;
1096
+ s.block_start = 0;
1097
+ s.lookahead = 0;
1098
+ s.insert = 0;
1099
+ s.match_length = s.prev_length = MIN_MATCH - 1;
1100
+ s.match_available = 0;
1101
+ s.ins_h = 0;
1102
+ }
1103
+
1104
+
1105
+ function DeflateState() {
1106
+ this.strm = null; /* pointer back to this zlib stream */
1107
+ this.status = 0; /* as the name implies */
1108
+ this.pending_buf = null; /* output still pending */
1109
+ this.pending_buf_size = 0; /* size of pending_buf */
1110
+ this.pending_out = 0; /* next pending byte to output to the stream */
1111
+ this.pending = 0; /* nb of bytes in the pending buffer */
1112
+ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
1113
+ this.gzhead = null; /* gzip header information to write */
1114
+ this.gzindex = 0; /* where in extra, name, or comment */
1115
+ this.method = Z_DEFLATED; /* can only be DEFLATED */
1116
+ this.last_flush = -1; /* value of flush param for previous deflate call */
1117
+
1118
+ this.w_size = 0; /* LZ77 window size (32K by default) */
1119
+ this.w_bits = 0; /* log2(w_size) (8..16) */
1120
+ this.w_mask = 0; /* w_size - 1 */
1121
+
1122
+ this.window = null;
1123
+ /* Sliding window. Input bytes are read into the second half of the window,
1124
+ * and move to the first half later to keep a dictionary of at least wSize
1125
+ * bytes. With this organization, matches are limited to a distance of
1126
+ * wSize-MAX_MATCH bytes, but this ensures that IO is always
1127
+ * performed with a length multiple of the block size.
1128
+ */
1129
+
1130
+ this.window_size = 0;
1131
+ /* Actual size of window: 2*wSize, except when the user input buffer
1132
+ * is directly used as sliding window.
1133
+ */
1134
+
1135
+ this.prev = null;
1136
+ /* Link to older string with same hash index. To limit the size of this
1137
+ * array to 64K, this link is maintained only for the last 32K strings.
1138
+ * An index in this array is thus a window index modulo 32K.
1139
+ */
1140
+
1141
+ this.head = null; /* Heads of the hash chains or NIL. */
1142
+
1143
+ this.ins_h = 0; /* hash index of string to be inserted */
1144
+ this.hash_size = 0; /* number of elements in hash table */
1145
+ this.hash_bits = 0; /* log2(hash_size) */
1146
+ this.hash_mask = 0; /* hash_size-1 */
1147
+
1148
+ this.hash_shift = 0;
1149
+ /* Number of bits by which ins_h must be shifted at each input
1150
+ * step. It must be such that after MIN_MATCH steps, the oldest
1151
+ * byte no longer takes part in the hash key, that is:
1152
+ * hash_shift * MIN_MATCH >= hash_bits
1153
+ */
1154
+
1155
+ this.block_start = 0;
1156
+ /* Window position at the beginning of the current output block. Gets
1157
+ * negative when the window is moved backwards.
1158
+ */
1159
+
1160
+ this.match_length = 0; /* length of best match */
1161
+ this.prev_match = 0; /* previous match */
1162
+ this.match_available = 0; /* set if previous match exists */
1163
+ this.strstart = 0; /* start of string to insert */
1164
+ this.match_start = 0; /* start of matching string */
1165
+ this.lookahead = 0; /* number of valid bytes ahead in window */
1166
+
1167
+ this.prev_length = 0;
1168
+ /* Length of the best match at previous step. Matches not greater than this
1169
+ * are discarded. This is used in the lazy match evaluation.
1170
+ */
1171
+
1172
+ this.max_chain_length = 0;
1173
+ /* To speed up deflation, hash chains are never searched beyond this
1174
+ * length. A higher limit improves compression ratio but degrades the
1175
+ * speed.
1176
+ */
1177
+
1178
+ this.max_lazy_match = 0;
1179
+ /* Attempt to find a better match only when the current match is strictly
1180
+ * smaller than this value. This mechanism is used only for compression
1181
+ * levels >= 4.
1182
+ */
1183
+ // That's alias to max_lazy_match, don't use directly
1184
+ //this.max_insert_length = 0;
1185
+ /* Insert new strings in the hash table only if the match length is not
1186
+ * greater than this length. This saves time but degrades compression.
1187
+ * max_insert_length is used only for compression levels <= 3.
1188
+ */
1189
+
1190
+ this.level = 0; /* compression level (1..9) */
1191
+ this.strategy = 0; /* favor or force Huffman coding*/
1192
+
1193
+ this.good_match = 0;
1194
+ /* Use a faster search when the previous match is longer than this */
1195
+
1196
+ this.nice_match = 0; /* Stop searching when current match exceeds this */
1197
+
1198
+ /* used by trees.c: */
1199
+
1200
+ /* Didn't use ct_data typedef below to suppress compiler warning */
1201
+
1202
+ // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
1203
+ // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
1204
+ // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
1205
+
1206
+ // Use flat array of DOUBLE size, with interleaved fata,
1207
+ // because JS does not support effective
1208
+ this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
1209
+ this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
1210
+ this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
1211
+ zero(this.dyn_ltree);
1212
+ zero(this.dyn_dtree);
1213
+ zero(this.bl_tree);
1214
+
1215
+ this.l_desc = null; /* desc. for literal tree */
1216
+ this.d_desc = null; /* desc. for distance tree */
1217
+ this.bl_desc = null; /* desc. for bit length tree */
1218
+
1219
+ //ush bl_count[MAX_BITS+1];
1220
+ this.bl_count = new utils.Buf16(MAX_BITS + 1);
1221
+ /* number of codes at each bit length for an optimal tree */
1222
+
1223
+ //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
1224
+ this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */
1225
+ zero(this.heap);
1226
+
1227
+ this.heap_len = 0; /* number of elements in the heap */
1228
+ this.heap_max = 0; /* element of largest frequency */
1229
+ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
1230
+ * The same heap array is used to build all trees.
1231
+ */
1232
+
1233
+ this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
1234
+ zero(this.depth);
1235
+ /* Depth of each subtree used as tie breaker for trees of equal frequency
1236
+ */
1237
+
1238
+ this.l_buf = 0; /* buffer index for literals or lengths */
1239
+
1240
+ this.lit_bufsize = 0;
1241
+ /* Size of match buffer for literals/lengths. There are 4 reasons for
1242
+ * limiting lit_bufsize to 64K:
1243
+ * - frequencies can be kept in 16 bit counters
1244
+ * - if compression is not successful for the first block, all input
1245
+ * data is still in the window so we can still emit a stored block even
1246
+ * when input comes from standard input. (This can also be done for
1247
+ * all blocks if lit_bufsize is not greater than 32K.)
1248
+ * - if compression is not successful for a file smaller than 64K, we can
1249
+ * even emit a stored file instead of a stored block (saving 5 bytes).
1250
+ * This is applicable only for zip (not gzip or zlib).
1251
+ * - creating new Huffman trees less frequently may not provide fast
1252
+ * adaptation to changes in the input data statistics. (Take for
1253
+ * example a binary file with poorly compressible code followed by
1254
+ * a highly compressible string table.) Smaller buffer sizes give
1255
+ * fast adaptation but have of course the overhead of transmitting
1256
+ * trees more frequently.
1257
+ * - I can't count above 4
1258
+ */
1259
+
1260
+ this.last_lit = 0; /* running index in l_buf */
1261
+
1262
+ this.d_buf = 0;
1263
+ /* Buffer index for distances. To simplify the code, d_buf and l_buf have
1264
+ * the same number of elements. To use different lengths, an extra flag
1265
+ * array would be necessary.
1266
+ */
1267
+
1268
+ this.opt_len = 0; /* bit length of current block with optimal trees */
1269
+ this.static_len = 0; /* bit length of current block with static trees */
1270
+ this.matches = 0; /* number of string matches in current block */
1271
+ this.insert = 0; /* bytes at end of window left to insert */
1272
+
1273
+
1274
+ this.bi_buf = 0;
1275
+ /* Output buffer. bits are inserted starting at the bottom (least
1276
+ * significant bits).
1277
+ */
1278
+ this.bi_valid = 0;
1279
+ /* Number of valid bits in bi_buf. All bits above the last valid bit
1280
+ * are always zero.
1281
+ */
1282
+
1283
+ // Used for window memory init. We safely ignore it for JS. That makes
1284
+ // sense only for pointers and memory check tools.
1285
+ //this.high_water = 0;
1286
+ /* High water mark offset in window for initialized bytes -- bytes above
1287
+ * this are set to zero in order to avoid memory check warnings when
1288
+ * longest match routines access bytes past the input. This is then
1289
+ * updated to the new high water mark.
1290
+ */
1291
+ }
1292
+
1293
+
1294
+ function deflateResetKeep(strm) {
1295
+ var s;
1296
+
1297
+ if (!strm || !strm.state) {
1298
+ return err(strm, Z_STREAM_ERROR);
1299
+ }
1300
+
1301
+ strm.total_in = strm.total_out = 0;
1302
+ strm.data_type = Z_UNKNOWN;
1303
+
1304
+ s = strm.state;
1305
+ s.pending = 0;
1306
+ s.pending_out = 0;
1307
+
1308
+ if (s.wrap < 0) {
1309
+ s.wrap = -s.wrap;
1310
+ /* was made negative by deflate(..., Z_FINISH); */
1311
+ }
1312
+ s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
1313
+ strm.adler = (s.wrap === 2) ?
1314
+ 0 // crc32(0, Z_NULL, 0)
1315
+ :
1316
+ 1; // adler32(0, Z_NULL, 0)
1317
+ s.last_flush = Z_NO_FLUSH;
1318
+ trees._tr_init(s);
1319
+ return Z_OK;
1320
+ }
1321
+
1322
+
1323
+ function deflateReset(strm) {
1324
+ var ret = deflateResetKeep(strm);
1325
+ if (ret === Z_OK) {
1326
+ lm_init(strm.state);
1327
+ }
1328
+ return ret;
1329
+ }
1330
+
1331
+
1332
+ function deflateSetHeader(strm, head) {
1333
+ if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1334
+ if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
1335
+ strm.state.gzhead = head;
1336
+ return Z_OK;
1337
+ }
1338
+
1339
+
1340
+ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
1341
+ if (!strm) { // === Z_NULL
1342
+ return Z_STREAM_ERROR;
1343
+ }
1344
+ var wrap = 1;
1345
+
1346
+ if (level === Z_DEFAULT_COMPRESSION) {
1347
+ level = 6;
1348
+ }
1349
+
1350
+ if (windowBits < 0) { /* suppress zlib wrapper */
1351
+ wrap = 0;
1352
+ windowBits = -windowBits;
1353
+ }
1354
+
1355
+ else if (windowBits > 15) {
1356
+ wrap = 2; /* write gzip wrapper instead */
1357
+ windowBits -= 16;
1358
+ }
1359
+
1360
+
1361
+ if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
1362
+ windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
1363
+ strategy < 0 || strategy > Z_FIXED) {
1364
+ return err(strm, Z_STREAM_ERROR);
1365
+ }
1366
+
1367
+
1368
+ if (windowBits === 8) {
1369
+ windowBits = 9;
1370
+ }
1371
+ /* until 256-byte window bug fixed */
1372
+
1373
+ var s = new DeflateState();
1374
+
1375
+ strm.state = s;
1376
+ s.strm = strm;
1377
+
1378
+ s.wrap = wrap;
1379
+ s.gzhead = null;
1380
+ s.w_bits = windowBits;
1381
+ s.w_size = 1 << s.w_bits;
1382
+ s.w_mask = s.w_size - 1;
1383
+
1384
+ s.hash_bits = memLevel + 7;
1385
+ s.hash_size = 1 << s.hash_bits;
1386
+ s.hash_mask = s.hash_size - 1;
1387
+ s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
1388
+
1389
+ s.window = new utils.Buf8(s.w_size * 2);
1390
+ s.head = new utils.Buf16(s.hash_size);
1391
+ s.prev = new utils.Buf16(s.w_size);
1392
+
1393
+ // Don't need mem init magic for JS.
1394
+ //s.high_water = 0; /* nothing written to s->window yet */
1395
+
1396
+ s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
1397
+
1398
+ s.pending_buf_size = s.lit_bufsize * 4;
1399
+
1400
+ //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
1401
+ //s->pending_buf = (uchf *) overlay;
1402
+ s.pending_buf = new utils.Buf8(s.pending_buf_size);
1403
+
1404
+ // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
1405
+ //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
1406
+ s.d_buf = 1 * s.lit_bufsize;
1407
+
1408
+ //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
1409
+ s.l_buf = (1 + 2) * s.lit_bufsize;
1410
+
1411
+ s.level = level;
1412
+ s.strategy = strategy;
1413
+ s.method = method;
1414
+
1415
+ return deflateReset(strm);
1416
+ }
1417
+
1418
+ function deflateInit(strm, level) {
1419
+ return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
1420
+ }
1421
+
1422
+
1423
+ function deflate(strm, flush) {
1424
+ var old_flush, s;
1425
+ var beg, val; // for gzip header write only
1426
+
1427
+ if (!strm || !strm.state ||
1428
+ flush > Z_BLOCK || flush < 0) {
1429
+ return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
1430
+ }
1431
+
1432
+ s = strm.state;
1433
+
1434
+ if (!strm.output ||
1435
+ (!strm.input && strm.avail_in !== 0) ||
1436
+ (s.status === FINISH_STATE && flush !== Z_FINISH)) {
1437
+ return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
1438
+ }
1439
+
1440
+ s.strm = strm; /* just in case */
1441
+ old_flush = s.last_flush;
1442
+ s.last_flush = flush;
1443
+
1444
+ /* Write the header */
1445
+ if (s.status === INIT_STATE) {
1446
+
1447
+ if (s.wrap === 2) { // GZIP header
1448
+ strm.adler = 0; //crc32(0L, Z_NULL, 0);
1449
+ put_byte(s, 31);
1450
+ put_byte(s, 139);
1451
+ put_byte(s, 8);
1452
+ if (!s.gzhead) { // s->gzhead == Z_NULL
1453
+ put_byte(s, 0);
1454
+ put_byte(s, 0);
1455
+ put_byte(s, 0);
1456
+ put_byte(s, 0);
1457
+ put_byte(s, 0);
1458
+ put_byte(s, s.level === 9 ? 2 :
1459
+ (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
1460
+ 4 : 0));
1461
+ put_byte(s, OS_CODE);
1462
+ s.status = BUSY_STATE;
1463
+ }
1464
+ else {
1465
+ put_byte(s, (s.gzhead.text ? 1 : 0) +
1466
+ (s.gzhead.hcrc ? 2 : 0) +
1467
+ (!s.gzhead.extra ? 0 : 4) +
1468
+ (!s.gzhead.name ? 0 : 8) +
1469
+ (!s.gzhead.comment ? 0 : 16)
1470
+ );
1471
+ put_byte(s, s.gzhead.time & 0xff);
1472
+ put_byte(s, (s.gzhead.time >> 8) & 0xff);
1473
+ put_byte(s, (s.gzhead.time >> 16) & 0xff);
1474
+ put_byte(s, (s.gzhead.time >> 24) & 0xff);
1475
+ put_byte(s, s.level === 9 ? 2 :
1476
+ (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
1477
+ 4 : 0));
1478
+ put_byte(s, s.gzhead.os & 0xff);
1479
+ if (s.gzhead.extra && s.gzhead.extra.length) {
1480
+ put_byte(s, s.gzhead.extra.length & 0xff);
1481
+ put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
1482
+ }
1483
+ if (s.gzhead.hcrc) {
1484
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
1485
+ }
1486
+ s.gzindex = 0;
1487
+ s.status = EXTRA_STATE;
1488
+ }
1489
+ }
1490
+ else // DEFLATE header
1491
+ {
1492
+ var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
1493
+ var level_flags = -1;
1494
+
1495
+ if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
1496
+ level_flags = 0;
1497
+ } else if (s.level < 6) {
1498
+ level_flags = 1;
1499
+ } else if (s.level === 6) {
1500
+ level_flags = 2;
1501
+ } else {
1502
+ level_flags = 3;
1503
+ }
1504
+ header |= (level_flags << 6);
1505
+ if (s.strstart !== 0) { header |= PRESET_DICT; }
1506
+ header += 31 - (header % 31);
1507
+
1508
+ s.status = BUSY_STATE;
1509
+ putShortMSB(s, header);
1510
+
1511
+ /* Save the adler32 of the preset dictionary: */
1512
+ if (s.strstart !== 0) {
1513
+ putShortMSB(s, strm.adler >>> 16);
1514
+ putShortMSB(s, strm.adler & 0xffff);
1515
+ }
1516
+ strm.adler = 1; // adler32(0L, Z_NULL, 0);
1517
+ }
1518
+ }
1519
+
1520
+ //#ifdef GZIP
1521
+ if (s.status === EXTRA_STATE) {
1522
+ if (s.gzhead.extra/* != Z_NULL*/) {
1523
+ beg = s.pending; /* start of bytes to update crc */
1524
+
1525
+ while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
1526
+ if (s.pending === s.pending_buf_size) {
1527
+ if (s.gzhead.hcrc && s.pending > beg) {
1528
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1529
+ }
1530
+ flush_pending(strm);
1531
+ beg = s.pending;
1532
+ if (s.pending === s.pending_buf_size) {
1533
+ break;
1534
+ }
1535
+ }
1536
+ put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
1537
+ s.gzindex++;
1538
+ }
1539
+ if (s.gzhead.hcrc && s.pending > beg) {
1540
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1541
+ }
1542
+ if (s.gzindex === s.gzhead.extra.length) {
1543
+ s.gzindex = 0;
1544
+ s.status = NAME_STATE;
1545
+ }
1546
+ }
1547
+ else {
1548
+ s.status = NAME_STATE;
1549
+ }
1550
+ }
1551
+ if (s.status === NAME_STATE) {
1552
+ if (s.gzhead.name/* != Z_NULL*/) {
1553
+ beg = s.pending; /* start of bytes to update crc */
1554
+ //int val;
1555
+
1556
+ do {
1557
+ if (s.pending === s.pending_buf_size) {
1558
+ if (s.gzhead.hcrc && s.pending > beg) {
1559
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1560
+ }
1561
+ flush_pending(strm);
1562
+ beg = s.pending;
1563
+ if (s.pending === s.pending_buf_size) {
1564
+ val = 1;
1565
+ break;
1566
+ }
1567
+ }
1568
+ // JS specific: little magic to add zero terminator to end of string
1569
+ if (s.gzindex < s.gzhead.name.length) {
1570
+ val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
1571
+ } else {
1572
+ val = 0;
1573
+ }
1574
+ put_byte(s, val);
1575
+ } while (val !== 0);
1576
+
1577
+ if (s.gzhead.hcrc && s.pending > beg) {
1578
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1579
+ }
1580
+ if (val === 0) {
1581
+ s.gzindex = 0;
1582
+ s.status = COMMENT_STATE;
1583
+ }
1584
+ }
1585
+ else {
1586
+ s.status = COMMENT_STATE;
1587
+ }
1588
+ }
1589
+ if (s.status === COMMENT_STATE) {
1590
+ if (s.gzhead.comment/* != Z_NULL*/) {
1591
+ beg = s.pending; /* start of bytes to update crc */
1592
+ //int val;
1593
+
1594
+ do {
1595
+ if (s.pending === s.pending_buf_size) {
1596
+ if (s.gzhead.hcrc && s.pending > beg) {
1597
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1598
+ }
1599
+ flush_pending(strm);
1600
+ beg = s.pending;
1601
+ if (s.pending === s.pending_buf_size) {
1602
+ val = 1;
1603
+ break;
1604
+ }
1605
+ }
1606
+ // JS specific: little magic to add zero terminator to end of string
1607
+ if (s.gzindex < s.gzhead.comment.length) {
1608
+ val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
1609
+ } else {
1610
+ val = 0;
1611
+ }
1612
+ put_byte(s, val);
1613
+ } while (val !== 0);
1614
+
1615
+ if (s.gzhead.hcrc && s.pending > beg) {
1616
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1617
+ }
1618
+ if (val === 0) {
1619
+ s.status = HCRC_STATE;
1620
+ }
1621
+ }
1622
+ else {
1623
+ s.status = HCRC_STATE;
1624
+ }
1625
+ }
1626
+ if (s.status === HCRC_STATE) {
1627
+ if (s.gzhead.hcrc) {
1628
+ if (s.pending + 2 > s.pending_buf_size) {
1629
+ flush_pending(strm);
1630
+ }
1631
+ if (s.pending + 2 <= s.pending_buf_size) {
1632
+ put_byte(s, strm.adler & 0xff);
1633
+ put_byte(s, (strm.adler >> 8) & 0xff);
1634
+ strm.adler = 0; //crc32(0L, Z_NULL, 0);
1635
+ s.status = BUSY_STATE;
1636
+ }
1637
+ }
1638
+ else {
1639
+ s.status = BUSY_STATE;
1640
+ }
1641
+ }
1642
+ //#endif
1643
+
1644
+ /* Flush as much pending output as possible */
1645
+ if (s.pending !== 0) {
1646
+ flush_pending(strm);
1647
+ if (strm.avail_out === 0) {
1648
+ /* Since avail_out is 0, deflate will be called again with
1649
+ * more output space, but possibly with both pending and
1650
+ * avail_in equal to zero. There won't be anything to do,
1651
+ * but this is not an error situation so make sure we
1652
+ * return OK instead of BUF_ERROR at next call of deflate:
1653
+ */
1654
+ s.last_flush = -1;
1655
+ return Z_OK;
1656
+ }
1657
+
1658
+ /* Make sure there is something to do and avoid duplicate consecutive
1659
+ * flushes. For repeated and useless calls with Z_FINISH, we keep
1660
+ * returning Z_STREAM_END instead of Z_BUF_ERROR.
1661
+ */
1662
+ } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
1663
+ flush !== Z_FINISH) {
1664
+ return err(strm, Z_BUF_ERROR);
1665
+ }
1666
+
1667
+ /* User must not provide more input after the first FINISH: */
1668
+ if (s.status === FINISH_STATE && strm.avail_in !== 0) {
1669
+ return err(strm, Z_BUF_ERROR);
1670
+ }
1671
+
1672
+ /* Start a new block or continue the current one.
1673
+ */
1674
+ if (strm.avail_in !== 0 || s.lookahead !== 0 ||
1675
+ (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
1676
+ var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
1677
+ (s.strategy === Z_RLE ? deflate_rle(s, flush) :
1678
+ configuration_table[s.level].func(s, flush));
1679
+
1680
+ if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
1681
+ s.status = FINISH_STATE;
1682
+ }
1683
+ if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
1684
+ if (strm.avail_out === 0) {
1685
+ s.last_flush = -1;
1686
+ /* avoid BUF_ERROR next call, see above */
1687
+ }
1688
+ return Z_OK;
1689
+ /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
1690
+ * of deflate should use the same flush parameter to make sure
1691
+ * that the flush is complete. So we don't have to output an
1692
+ * empty block here, this will be done at next call. This also
1693
+ * ensures that for a very small output buffer, we emit at most
1694
+ * one empty block.
1695
+ */
1696
+ }
1697
+ if (bstate === BS_BLOCK_DONE) {
1698
+ if (flush === Z_PARTIAL_FLUSH) {
1699
+ trees._tr_align(s);
1700
+ }
1701
+ else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
1702
+
1703
+ trees._tr_stored_block(s, 0, 0, false);
1704
+ /* For a full flush, this empty block will be recognized
1705
+ * as a special marker by inflate_sync().
1706
+ */
1707
+ if (flush === Z_FULL_FLUSH) {
1708
+ /*** CLEAR_HASH(s); ***/ /* forget history */
1709
+ zero(s.head); // Fill with NIL (= 0);
1710
+
1711
+ if (s.lookahead === 0) {
1712
+ s.strstart = 0;
1713
+ s.block_start = 0;
1714
+ s.insert = 0;
1715
+ }
1716
+ }
1717
+ }
1718
+ flush_pending(strm);
1719
+ if (strm.avail_out === 0) {
1720
+ s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
1721
+ return Z_OK;
1722
+ }
1723
+ }
1724
+ }
1725
+ //Assert(strm->avail_out > 0, "bug2");
1726
+ //if (strm.avail_out <= 0) { throw new Error("bug2");}
1727
+
1728
+ if (flush !== Z_FINISH) { return Z_OK; }
1729
+ if (s.wrap <= 0) { return Z_STREAM_END; }
1730
+
1731
+ /* Write the trailer */
1732
+ if (s.wrap === 2) {
1733
+ put_byte(s, strm.adler & 0xff);
1734
+ put_byte(s, (strm.adler >> 8) & 0xff);
1735
+ put_byte(s, (strm.adler >> 16) & 0xff);
1736
+ put_byte(s, (strm.adler >> 24) & 0xff);
1737
+ put_byte(s, strm.total_in & 0xff);
1738
+ put_byte(s, (strm.total_in >> 8) & 0xff);
1739
+ put_byte(s, (strm.total_in >> 16) & 0xff);
1740
+ put_byte(s, (strm.total_in >> 24) & 0xff);
1741
+ }
1742
+ else
1743
+ {
1744
+ putShortMSB(s, strm.adler >>> 16);
1745
+ putShortMSB(s, strm.adler & 0xffff);
1746
+ }
1747
+
1748
+ flush_pending(strm);
1749
+ /* If avail_out is zero, the application will call deflate again
1750
+ * to flush the rest.
1751
+ */
1752
+ if (s.wrap > 0) { s.wrap = -s.wrap; }
1753
+ /* write the trailer only once! */
1754
+ return s.pending !== 0 ? Z_OK : Z_STREAM_END;
1755
+ }
1756
+
1757
+ function deflateEnd(strm) {
1758
+ var status;
1759
+
1760
+ if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
1761
+ return Z_STREAM_ERROR;
1762
+ }
1763
+
1764
+ status = strm.state.status;
1765
+ if (status !== INIT_STATE &&
1766
+ status !== EXTRA_STATE &&
1767
+ status !== NAME_STATE &&
1768
+ status !== COMMENT_STATE &&
1769
+ status !== HCRC_STATE &&
1770
+ status !== BUSY_STATE &&
1771
+ status !== FINISH_STATE
1772
+ ) {
1773
+ return err(strm, Z_STREAM_ERROR);
1774
+ }
1775
+
1776
+ strm.state = null;
1777
+
1778
+ return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
1779
+ }
1780
+
1781
+
1782
+ /* =========================================================================
1783
+ * Initializes the compression dictionary from the given byte
1784
+ * sequence without producing any compressed output.
1785
+ */
1786
+ function deflateSetDictionary(strm, dictionary) {
1787
+ var dictLength = dictionary.length;
1788
+
1789
+ var s;
1790
+ var str, n;
1791
+ var wrap;
1792
+ var avail;
1793
+ var next;
1794
+ var input;
1795
+ var tmpDict;
1796
+
1797
+ if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
1798
+ return Z_STREAM_ERROR;
1799
+ }
1800
+
1801
+ s = strm.state;
1802
+ wrap = s.wrap;
1803
+
1804
+ if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
1805
+ return Z_STREAM_ERROR;
1806
+ }
1807
+
1808
+ /* when using zlib wrappers, compute Adler-32 for provided dictionary */
1809
+ if (wrap === 1) {
1810
+ /* adler32(strm->adler, dictionary, dictLength); */
1811
+ strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
1812
+ }
1813
+
1814
+ s.wrap = 0; /* avoid computing Adler-32 in read_buf */
1815
+
1816
+ /* if dictionary would fill window, just replace the history */
1817
+ if (dictLength >= s.w_size) {
1818
+ if (wrap === 0) { /* already empty otherwise */
1819
+ /*** CLEAR_HASH(s); ***/
1820
+ zero(s.head); // Fill with NIL (= 0);
1821
+ s.strstart = 0;
1822
+ s.block_start = 0;
1823
+ s.insert = 0;
1824
+ }
1825
+ /* use the tail */
1826
+ // dictionary = dictionary.slice(dictLength - s.w_size);
1827
+ tmpDict = new utils.Buf8(s.w_size);
1828
+ utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
1829
+ dictionary = tmpDict;
1830
+ dictLength = s.w_size;
1831
+ }
1832
+ /* insert dictionary into window and hash */
1833
+ avail = strm.avail_in;
1834
+ next = strm.next_in;
1835
+ input = strm.input;
1836
+ strm.avail_in = dictLength;
1837
+ strm.next_in = 0;
1838
+ strm.input = dictionary;
1839
+ fill_window(s);
1840
+ while (s.lookahead >= MIN_MATCH) {
1841
+ str = s.strstart;
1842
+ n = s.lookahead - (MIN_MATCH - 1);
1843
+ do {
1844
+ /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
1845
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
1846
+
1847
+ s.prev[str & s.w_mask] = s.head[s.ins_h];
1848
+
1849
+ s.head[s.ins_h] = str;
1850
+ str++;
1851
+ } while (--n);
1852
+ s.strstart = str;
1853
+ s.lookahead = MIN_MATCH - 1;
1854
+ fill_window(s);
1855
+ }
1856
+ s.strstart += s.lookahead;
1857
+ s.block_start = s.strstart;
1858
+ s.insert = s.lookahead;
1859
+ s.lookahead = 0;
1860
+ s.match_length = s.prev_length = MIN_MATCH - 1;
1861
+ s.match_available = 0;
1862
+ strm.next_in = next;
1863
+ strm.input = input;
1864
+ strm.avail_in = avail;
1865
+ s.wrap = wrap;
1866
+ return Z_OK;
1867
+ }
1868
+
1869
+
1870
+ deflate$1.deflateInit = deflateInit;
1871
+ deflate$1.deflateInit2 = deflateInit2;
1872
+ deflate$1.deflateReset = deflateReset;
1873
+ deflate$1.deflateResetKeep = deflateResetKeep;
1874
+ deflate$1.deflateSetHeader = deflateSetHeader;
1875
+ deflate$1.deflate = deflate;
1876
+ deflate$1.deflateEnd = deflateEnd;
1877
+ deflate$1.deflateSetDictionary = deflateSetDictionary;
1878
+ deflate$1.deflateInfo = 'pako deflate (from Nodeca project)';
1879
+
1880
+ export { deflate$1 as default };