@smallwei/avue 3.9.2 → 3.9.4

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 (674) hide show
  1. package/README.md +12 -2
  2. package/dist/avue.js +14252 -5548
  3. package/dist/avue.js.map +1 -1
  4. package/dist/avue.min.js +2 -2
  5. package/dist/index.css +1 -1
  6. package/es/_virtual/_commonjs-dynamic-modules.mjs +1 -1
  7. package/es/_virtual/_commonjsHelpers.mjs +1 -1
  8. package/es/_virtual/axios.mjs +1 -1
  9. package/es/_virtual/axios2.mjs +1 -1
  10. package/es/_virtual/countUp.min.mjs +1 -1
  11. package/es/_virtual/countUp.min2.mjs +1 -1
  12. package/es/_virtual/dayjs.min.mjs +1 -1
  13. package/es/_virtual/dayjs.min2.mjs +1 -1
  14. package/es/index.css +1 -1
  15. package/es/locale/browser/en.mjs +299 -289
  16. package/es/locale/browser/zh-cn.mjs +299 -289
  17. package/es/locale/browser/zh.mjs +299 -289
  18. package/es/node_modules/.pnpm/countup.js@1.9.3/node_modules/countup.js/dist/countUp.min.mjs +1 -1
  19. package/es/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.mjs +1 -1
  20. package/es/node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs +2235 -0
  21. package/es/node_modules/axios/dist/axios.mjs +1 -1
  22. package/es/packages/core/common/event.mjs +1 -1
  23. package/es/packages/core/common/init.mjs +88 -13
  24. package/es/packages/core/common/props.mjs +1 -1
  25. package/es/packages/core/components/dialog-form/index.mjs +1 -1
  26. package/es/packages/core/components/dialog-form/index2.mjs +1 -1
  27. package/es/packages/core/components/dialog-form/index3.mjs +1 -1
  28. package/es/packages/core/components/dialog-form/index4.mjs +1 -1
  29. package/es/packages/core/components/form/custom.mjs +1 -1
  30. package/es/packages/core/components/form/index.mjs +1 -1
  31. package/es/packages/core/components/form/index2.mjs +1 -1
  32. package/es/packages/core/components/form/index3.mjs +1 -1
  33. package/es/packages/core/components/icon/index.mjs +1 -1
  34. package/es/packages/core/components/icon/index2.mjs +22 -1
  35. package/es/packages/core/components/icon/index3.mjs +19 -17
  36. package/es/packages/core/components/image-preview/index.mjs +1 -1
  37. package/es/packages/core/components/image-preview/index2.mjs +1 -1
  38. package/es/packages/core/components/image-preview/index3.mjs +1 -1
  39. package/es/packages/core/components/image-preview/index4.mjs +1 -1
  40. package/es/packages/core/directive/contextmenu.mjs +230 -89
  41. package/es/packages/core/directive/permission.mjs +1 -1
  42. package/es/packages/data/box/index.mjs +1 -1
  43. package/es/packages/data/box/index2.mjs +1 -1
  44. package/es/packages/data/box/index3.mjs +1 -1
  45. package/es/packages/data/card/index.mjs +1 -1
  46. package/es/packages/data/card/index2.mjs +1 -1
  47. package/es/packages/data/card/index3.mjs +1 -1
  48. package/es/packages/data/cardText/index.mjs +1 -1
  49. package/es/packages/data/cardText/index2.mjs +1 -1
  50. package/es/packages/data/cardText/index3.mjs +1 -1
  51. package/es/packages/data/countdown/index.mjs +1 -1
  52. package/es/packages/data/countdown/index2.mjs +1 -1
  53. package/es/packages/data/countdown/index3.mjs +1 -1
  54. package/es/packages/data/dashboard/index.mjs +1 -1
  55. package/es/packages/data/dashboard/index2.mjs +1 -1
  56. package/es/packages/data/dashboard/index3.mjs +1 -1
  57. package/es/packages/data/display/index.mjs +1 -1
  58. package/es/packages/data/display/index2.mjs +1 -1
  59. package/es/packages/data/display/index3.mjs +1 -1
  60. package/es/packages/data/icons/index.mjs +1 -1
  61. package/es/packages/data/icons/index2.mjs +1 -1
  62. package/es/packages/data/icons/index3.mjs +1 -1
  63. package/es/packages/data/imgText/index.mjs +1 -1
  64. package/es/packages/data/imgText/index2.mjs +1 -1
  65. package/es/packages/data/imgText/index3.mjs +1 -1
  66. package/es/packages/data/list/index.mjs +1 -1
  67. package/es/packages/data/list/index2.mjs +6 -1
  68. package/es/packages/data/list/index3.mjs +9 -6
  69. package/es/packages/data/notice/index.mjs +1 -1
  70. package/es/packages/data/notice/index2.mjs +1 -1
  71. package/es/packages/data/notice/index3.mjs +1 -1
  72. package/es/packages/data/operaText/index.mjs +1 -1
  73. package/es/packages/data/operaText/index2.mjs +1 -1
  74. package/es/packages/data/operaText/index3.mjs +1 -1
  75. package/es/packages/data/panel/index.mjs +1 -1
  76. package/es/packages/data/panel/index2.mjs +1 -1
  77. package/es/packages/data/panel/index3.mjs +1 -1
  78. package/es/packages/data/pay/index.mjs +1 -1
  79. package/es/packages/data/pay/index2.mjs +1 -1
  80. package/es/packages/data/pay/index3.mjs +1 -1
  81. package/es/packages/data/price/index.mjs +1 -1
  82. package/es/packages/data/price/index2.mjs +1 -1
  83. package/es/packages/data/price/index3.mjs +1 -1
  84. package/es/packages/data/product/index.mjs +1 -1
  85. package/es/packages/data/product/index2.mjs +1 -1
  86. package/es/packages/data/product/index3.mjs +1 -1
  87. package/es/packages/data/profile/index.mjs +1 -1
  88. package/es/packages/data/profile/index2.mjs +1 -1
  89. package/es/packages/data/profile/index3.mjs +1 -1
  90. package/es/packages/data/progress/index.mjs +1 -1
  91. package/es/packages/data/progress/index2.mjs +1 -1
  92. package/es/packages/data/progress/index3.mjs +1 -1
  93. package/es/packages/data/rank/index.mjs +1 -1
  94. package/es/packages/data/rank/index2.mjs +1 -1
  95. package/es/packages/data/rank/index3.mjs +1 -1
  96. package/es/packages/data/rotate/index.mjs +1 -1
  97. package/es/packages/data/rotate/index2.mjs +1 -1
  98. package/es/packages/data/rotate/index3.mjs +1 -1
  99. package/es/packages/data/statistic/index.mjs +1 -1
  100. package/es/packages/data/statistic/index2.mjs +15 -1
  101. package/es/packages/data/statistic/index3.mjs +9 -6
  102. package/es/packages/data/tabs/index.mjs +1 -1
  103. package/es/packages/data/tabs/index2.mjs +1 -1
  104. package/es/packages/data/tabs/index3.mjs +1 -1
  105. package/es/packages/data/task/index.mjs +1 -1
  106. package/es/packages/data/task/index2.mjs +1 -1
  107. package/es/packages/data/task/index3.mjs +1 -1
  108. package/es/packages/data/weather/index.mjs +1 -1
  109. package/es/packages/data/weather/index2.mjs +6 -1
  110. package/es/packages/data/weather/index3.mjs +7 -6
  111. package/es/packages/element-plus/array/index.mjs +1 -1
  112. package/es/packages/element-plus/array/index2.mjs +1 -1
  113. package/es/packages/element-plus/array/index3.mjs +1 -1
  114. package/es/packages/element-plus/article/index.mjs +1 -1
  115. package/es/packages/element-plus/article/index2.mjs +185 -20
  116. package/es/packages/element-plus/article/index3.mjs +98 -36
  117. package/es/packages/element-plus/captcha/index.mjs +8 -0
  118. package/es/packages/element-plus/captcha/index2.mjs +913 -0
  119. package/es/packages/element-plus/captcha/index3.mjs +519 -0
  120. package/es/packages/element-plus/cascader/index.mjs +1 -1
  121. package/es/packages/element-plus/cascader/index2.mjs +1 -1
  122. package/es/packages/element-plus/cascader/index3.mjs +1 -1
  123. package/es/packages/element-plus/chat/index.mjs +1 -1
  124. package/es/packages/element-plus/chat/index2.mjs +249 -203
  125. package/es/packages/element-plus/chat/index3.mjs +340 -264
  126. package/es/packages/element-plus/checkbox/index.mjs +1 -1
  127. package/es/packages/element-plus/checkbox/index2.mjs +1 -1
  128. package/es/packages/element-plus/checkbox/index3.mjs +1 -1
  129. package/es/packages/element-plus/comment/index.mjs +1 -1
  130. package/es/packages/element-plus/comment/index2.mjs +105 -32
  131. package/es/packages/element-plus/comment/index3.mjs +61 -22
  132. package/es/packages/element-plus/count-up/index.mjs +1 -1
  133. package/es/packages/element-plus/count-up/index2.mjs +1 -1
  134. package/es/packages/element-plus/count-up/index3.mjs +1 -1
  135. package/es/packages/element-plus/crud/column/column-default.mjs +1 -1
  136. package/es/packages/element-plus/crud/column/column-default2.mjs +1 -1
  137. package/es/packages/element-plus/crud/column/column-default3.mjs +1 -1
  138. package/es/packages/element-plus/crud/column/column-dynamic.mjs +1 -1
  139. package/es/packages/element-plus/crud/column/column-dynamic2.mjs +1 -1
  140. package/es/packages/element-plus/crud/column/column-dynamic3.mjs +1 -1
  141. package/es/packages/element-plus/crud/column/column-menu.mjs +1 -1
  142. package/es/packages/element-plus/crud/column/column-menu2.mjs +1 -1
  143. package/es/packages/element-plus/crud/column/column-menu3.mjs +1 -1
  144. package/es/packages/element-plus/crud/column/column-slot.mjs +1 -1
  145. package/es/packages/element-plus/crud/column/column-slot2.mjs +4 -4
  146. package/es/packages/element-plus/crud/column/column-slot3.mjs +1 -1
  147. package/es/packages/element-plus/crud/column/column.mjs +1 -1
  148. package/es/packages/element-plus/crud/column/column2.mjs +1 -1
  149. package/es/packages/element-plus/crud/column/column3.mjs +1 -1
  150. package/es/packages/element-plus/crud/column/menu.mjs +1 -1
  151. package/es/packages/element-plus/crud/column/menu2.mjs +1 -1
  152. package/es/packages/element-plus/crud/column/menu3.mjs +1 -1
  153. package/es/packages/element-plus/crud/config.mjs +1 -1
  154. package/es/packages/element-plus/crud/dialog/dialog-column.mjs +1 -1
  155. package/es/packages/element-plus/crud/dialog/dialog-column2.mjs +118 -40
  156. package/es/packages/element-plus/crud/dialog/dialog-column3.mjs +154 -72
  157. package/es/packages/element-plus/crud/dialog/dialog-excel.mjs +1 -1
  158. package/es/packages/element-plus/crud/dialog/dialog-excel2.mjs +2 -2
  159. package/es/packages/element-plus/crud/dialog/dialog-excel3.mjs +1 -1
  160. package/es/packages/element-plus/crud/dialog/dialog-filter.mjs +1 -1
  161. package/es/packages/element-plus/crud/dialog/dialog-filter2.mjs +1 -1
  162. package/es/packages/element-plus/crud/dialog/dialog-filter3.mjs +1 -1
  163. package/es/packages/element-plus/crud/dialog/dialog-form.mjs +1 -1
  164. package/es/packages/element-plus/crud/dialog/dialog-form2.mjs +1 -1
  165. package/es/packages/element-plus/crud/dialog/dialog-form3.mjs +1 -1
  166. package/es/packages/element-plus/crud/grid/index.mjs +1 -1
  167. package/es/packages/element-plus/crud/grid/index2.mjs +1 -1
  168. package/es/packages/element-plus/crud/grid/index3.mjs +1 -1
  169. package/es/packages/element-plus/crud/grid/item.mjs +1 -1
  170. package/es/packages/element-plus/crud/grid/item2.mjs +1 -1
  171. package/es/packages/element-plus/crud/grid/item3.mjs +1 -1
  172. package/es/packages/element-plus/crud/index.mjs +1 -1
  173. package/es/packages/element-plus/crud/index2.mjs +6 -3
  174. package/es/packages/element-plus/crud/index3.mjs +51 -20
  175. package/es/packages/element-plus/crud/menu/header-menu.mjs +1 -1
  176. package/es/packages/element-plus/crud/menu/header-menu2.mjs +14 -2
  177. package/es/packages/element-plus/crud/menu/header-menu3.mjs +123 -63
  178. package/es/packages/element-plus/crud/menu/header-search.mjs +1 -1
  179. package/es/packages/element-plus/crud/menu/header-search2.mjs +2 -1
  180. package/es/packages/element-plus/crud/menu/header-search3.mjs +1 -1
  181. package/es/packages/element-plus/crud/menu/table-page.mjs +1 -1
  182. package/es/packages/element-plus/crud/menu/table-page2.mjs +1 -1
  183. package/es/packages/element-plus/crud/menu/table-page3.mjs +1 -1
  184. package/es/packages/element-plus/date/index.mjs +1 -1
  185. package/es/packages/element-plus/date/index2.mjs +1 -1
  186. package/es/packages/element-plus/date/index3.mjs +1 -1
  187. package/es/packages/element-plus/draggable/index.mjs +1 -1
  188. package/es/packages/element-plus/draggable/index2.mjs +342 -294
  189. package/es/packages/element-plus/draggable/index3.mjs +37 -39
  190. package/es/packages/element-plus/dynamic/index.mjs +1 -1
  191. package/es/packages/element-plus/dynamic/index2.mjs +1 -1
  192. package/es/packages/element-plus/dynamic/index3.mjs +1 -1
  193. package/es/packages/element-plus/file-manager/index.mjs +8 -0
  194. package/es/packages/element-plus/file-manager/index2.mjs +574 -0
  195. package/es/packages/element-plus/file-manager/index3.mjs +814 -0
  196. package/es/packages/element-plus/filter-builder/index.mjs +8 -0
  197. package/es/packages/element-plus/filter-builder/index2.mjs +208 -0
  198. package/es/packages/element-plus/filter-builder/index3.mjs +290 -0
  199. package/es/packages/element-plus/flow/index.mjs +1 -1
  200. package/es/packages/element-plus/flow/index2.mjs +274 -232
  201. package/es/packages/element-plus/flow/index3.mjs +30 -19
  202. package/es/packages/element-plus/flow/node.mjs +1 -1
  203. package/es/packages/element-plus/flow/node2.mjs +23 -37
  204. package/es/packages/element-plus/flow/node3.mjs +20 -17
  205. package/es/packages/element-plus/form/config.mjs +1 -1
  206. package/es/packages/element-plus/form/index.mjs +1 -1
  207. package/es/packages/element-plus/form/index2.mjs +11 -8
  208. package/es/packages/element-plus/form/index3.mjs +20 -7
  209. package/es/packages/element-plus/form/menu.mjs +1 -1
  210. package/es/packages/element-plus/form/menu2.mjs +1 -1
  211. package/es/packages/element-plus/form/menu3.mjs +1 -1
  212. package/es/packages/element-plus/group/index.mjs +1 -1
  213. package/es/packages/element-plus/group/index2.mjs +6 -1
  214. package/es/packages/element-plus/group/index3.mjs +8 -5
  215. package/es/packages/element-plus/{card → iframe}/index.mjs +2 -2
  216. package/es/packages/element-plus/iframe/index2.mjs +190 -0
  217. package/es/packages/element-plus/iframe/index3.mjs +64 -0
  218. package/es/packages/element-plus/input/index.mjs +1 -1
  219. package/es/packages/element-plus/input/index2.mjs +1 -1
  220. package/es/packages/element-plus/input/index3.mjs +1 -1
  221. package/es/packages/element-plus/input-color/index.mjs +1 -1
  222. package/es/packages/element-plus/input-color/index2.mjs +1 -1
  223. package/es/packages/element-plus/input-color/index3.mjs +1 -1
  224. package/es/packages/element-plus/input-cron/index.mjs +1 -1
  225. package/es/packages/element-plus/input-cron/index2.mjs +7 -2
  226. package/es/packages/element-plus/input-cron/index3.mjs +8 -4
  227. package/es/packages/element-plus/input-icon/index.mjs +1 -1
  228. package/es/packages/element-plus/input-icon/index2.mjs +1 -1
  229. package/es/packages/element-plus/input-icon/index3.mjs +1 -1
  230. package/es/packages/element-plus/input-map/index.mjs +1 -1
  231. package/es/packages/element-plus/input-map/index2.mjs +1 -1
  232. package/es/packages/element-plus/input-map/index3.mjs +1 -1
  233. package/es/packages/element-plus/input-number/index.mjs +1 -1
  234. package/es/packages/element-plus/input-number/index2.mjs +1 -1
  235. package/es/packages/element-plus/input-number/index3.mjs +1 -1
  236. package/es/packages/element-plus/input-otp/index.mjs +8 -0
  237. package/es/packages/element-plus/input-otp/index2.mjs +67 -0
  238. package/es/packages/element-plus/input-otp/index3.mjs +41 -0
  239. package/es/packages/element-plus/input-table/index.mjs +1 -1
  240. package/es/packages/element-plus/input-table/index2.mjs +1 -1
  241. package/es/packages/element-plus/input-table/index3.mjs +1 -1
  242. package/es/packages/element-plus/input-tag/index.mjs +1 -1
  243. package/es/packages/element-plus/input-tag/index2.mjs +1 -1
  244. package/es/packages/element-plus/input-tag/index3.mjs +1 -1
  245. package/es/packages/element-plus/input-tree/index.mjs +1 -1
  246. package/es/packages/element-plus/input-tree/index2.mjs +1 -1
  247. package/es/packages/element-plus/input-tree/index3.mjs +1 -1
  248. package/es/packages/element-plus/license/index.mjs +1 -1
  249. package/es/packages/element-plus/license/index2.mjs +216 -106
  250. package/es/packages/element-plus/license/index3.mjs +45 -10
  251. package/es/packages/element-plus/login/index.mjs +1 -1
  252. package/es/packages/element-plus/login/index2.mjs +76 -50
  253. package/es/packages/element-plus/login/index3.mjs +57 -46
  254. package/es/packages/element-plus/mention/index.mjs +1 -1
  255. package/es/packages/element-plus/mention/index2.mjs +32 -8
  256. package/es/packages/element-plus/mention/index3.mjs +1 -1
  257. package/es/packages/element-plus/{verify → qrcode}/index.mjs +2 -2
  258. package/es/packages/element-plus/qrcode/index2.mjs +274 -0
  259. package/es/packages/element-plus/qrcode/index3.mjs +57 -0
  260. package/es/packages/element-plus/radio/index.mjs +1 -1
  261. package/es/packages/element-plus/radio/index2.mjs +1 -1
  262. package/es/packages/element-plus/radio/index3.mjs +1 -1
  263. package/es/packages/element-plus/rate/index.mjs +1 -1
  264. package/es/packages/element-plus/rate/index2.mjs +1 -1
  265. package/es/packages/element-plus/rate/index3.mjs +1 -1
  266. package/es/packages/element-plus/search/index.mjs +1 -1
  267. package/es/packages/element-plus/search/index2.mjs +1 -1
  268. package/es/packages/element-plus/search/index3.mjs +1 -1
  269. package/es/packages/element-plus/select/index.mjs +1 -1
  270. package/es/packages/element-plus/select/index2.mjs +31 -6
  271. package/es/packages/element-plus/select/index3.mjs +1 -1
  272. package/es/packages/element-plus/sign/index.mjs +1 -1
  273. package/es/packages/element-plus/sign/index2.mjs +266 -183
  274. package/es/packages/element-plus/sign/index3.mjs +71 -11
  275. package/es/packages/element-plus/slider/index.mjs +1 -1
  276. package/es/packages/element-plus/slider/index2.mjs +1 -1
  277. package/es/packages/element-plus/slider/index3.mjs +1 -1
  278. package/es/packages/element-plus/switch/index.mjs +1 -1
  279. package/es/packages/element-plus/switch/index2.mjs +1 -1
  280. package/es/packages/element-plus/switch/index3.mjs +1 -1
  281. package/es/packages/element-plus/tabs/index.mjs +1 -1
  282. package/es/packages/element-plus/tabs/index2.mjs +6 -1
  283. package/es/packages/element-plus/tabs/index3.mjs +23 -8
  284. package/es/packages/element-plus/text-ellipsis/index.mjs +1 -1
  285. package/es/packages/element-plus/text-ellipsis/index2.mjs +1 -1
  286. package/es/packages/element-plus/text-ellipsis/index3.mjs +1 -1
  287. package/es/packages/element-plus/time/index.mjs +1 -1
  288. package/es/packages/element-plus/time/index2.mjs +1 -1
  289. package/es/packages/element-plus/time/index3.mjs +1 -1
  290. package/es/packages/element-plus/title/index.mjs +1 -1
  291. package/es/packages/element-plus/title/index2.mjs +1 -1
  292. package/es/packages/element-plus/title/index3.mjs +1 -1
  293. package/es/packages/element-plus/tree/index.mjs +1 -1
  294. package/es/packages/element-plus/tree/index2.mjs +1 -1
  295. package/es/packages/element-plus/tree/index3.mjs +1 -1
  296. package/es/packages/element-plus/upload/index.mjs +1 -1
  297. package/es/packages/element-plus/upload/index2.mjs +1 -1
  298. package/es/packages/element-plus/upload/index3.mjs +1 -1
  299. package/es/packages/element-plus/video/index.mjs +1 -1
  300. package/es/packages/element-plus/video/index2.mjs +183 -32
  301. package/es/packages/element-plus/video/index3.mjs +65 -29
  302. package/es/src/core/column-state.mjs +1 -1
  303. package/es/src/core/create.mjs +1 -1
  304. package/es/src/core/dataformat.mjs +1 -1
  305. package/es/src/core/detail.mjs +1 -1
  306. package/es/src/core/dic.mjs +108 -136
  307. package/es/src/core/locale.mjs +1 -1
  308. package/es/src/core/option.mjs +3 -1
  309. package/es/src/core/packages.mjs +4 -4
  310. package/es/src/core/slot.mjs +1 -1
  311. package/es/src/global/variable.mjs +2 -2
  312. package/es/src/icon.mjs +1 -1
  313. package/es/src/index.mjs +13 -5
  314. package/es/src/locale/index.mjs +1 -1
  315. package/es/src/locale/lang/en.mjs +12 -2
  316. package/es/src/locale/lang/zh-cn.mjs +12 -2
  317. package/es/src/locale/lang/zh.mjs +12 -2
  318. package/es/src/plugin/ali/index.mjs +1 -1
  319. package/es/src/plugin/clipboard/index.mjs +42 -57
  320. package/es/src/plugin/export/_blob.mjs +1 -1
  321. package/es/src/plugin/export/_export2Excel.mjs +1 -1
  322. package/es/src/plugin/export/index.mjs +122 -67
  323. package/es/src/plugin/logs/index.mjs +1 -1
  324. package/es/src/plugin/print/index.mjs +205 -128
  325. package/es/src/plugin/qiniu/index.mjs +1 -1
  326. package/es/src/plugin/screenshot/index.mjs +26 -4
  327. package/es/src/plugin/video/index.mjs +117 -28
  328. package/es/src/plugin/watermark/index.mjs +58 -102
  329. package/es/src/plugin/watermark/watermark.mjs +123 -80
  330. package/es/src/ui/data/index.mjs +1 -1
  331. package/es/src/ui/element-plus/index.mjs +100 -88
  332. package/es/src/ui/index.mjs +1 -1
  333. package/es/src/utils/bem.mjs +1 -1
  334. package/es/src/utils/mock.mjs +1 -1
  335. package/es/src/utils/print.mjs +216 -0
  336. package/es/src/utils/util.mjs +1 -1
  337. package/es/src/utils/validate.mjs +1 -1
  338. package/es/src/version.mjs +2 -2
  339. package/lib/_virtual/_commonjsHelpers.js +1 -1
  340. package/lib/_virtual/dayjs.min.js +1 -1
  341. package/lib/_virtual/dayjs.min2.js +1 -1
  342. package/lib/index.css +1 -1
  343. package/lib/locale/browser/en.js +299 -289
  344. package/lib/locale/browser/zh-cn.js +299 -289
  345. package/lib/locale/browser/zh.js +299 -289
  346. package/lib/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js +1 -1
  347. package/lib/node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.js +2240 -0
  348. package/lib/packages/core/common/event.js +1 -1
  349. package/lib/packages/core/common/init.js +87 -12
  350. package/lib/packages/core/common/props.js +1 -1
  351. package/lib/packages/core/components/dialog-form/index.js +1 -1
  352. package/lib/packages/core/components/dialog-form/index2.js +1 -1
  353. package/lib/packages/core/components/dialog-form/index3.js +1 -1
  354. package/lib/packages/core/components/dialog-form/index4.js +1 -1
  355. package/lib/packages/core/components/form/custom.js +1 -1
  356. package/lib/packages/core/components/form/index.js +1 -1
  357. package/lib/packages/core/components/form/index2.js +1 -1
  358. package/lib/packages/core/components/form/index3.js +1 -1
  359. package/lib/packages/core/components/icon/index.js +1 -1
  360. package/lib/packages/core/components/icon/index2.js +22 -1
  361. package/lib/packages/core/components/icon/index3.js +18 -16
  362. package/lib/packages/core/components/image-preview/index.js +1 -1
  363. package/lib/packages/core/components/image-preview/index2.js +1 -1
  364. package/lib/packages/core/components/image-preview/index3.js +1 -1
  365. package/lib/packages/core/components/image-preview/index4.js +1 -1
  366. package/lib/packages/core/directive/contextmenu.js +230 -89
  367. package/lib/packages/core/directive/permission.js +1 -1
  368. package/lib/packages/data/box/index.js +1 -1
  369. package/lib/packages/data/box/index2.js +1 -1
  370. package/lib/packages/data/box/index3.js +1 -1
  371. package/lib/packages/data/card/index.js +1 -1
  372. package/lib/packages/data/card/index2.js +1 -1
  373. package/lib/packages/data/card/index3.js +1 -1
  374. package/lib/packages/data/cardText/index.js +1 -1
  375. package/lib/packages/data/cardText/index2.js +1 -1
  376. package/lib/packages/data/cardText/index3.js +1 -1
  377. package/lib/packages/data/countdown/index.js +1 -1
  378. package/lib/packages/data/countdown/index2.js +1 -1
  379. package/lib/packages/data/countdown/index3.js +1 -1
  380. package/lib/packages/data/dashboard/index.js +1 -1
  381. package/lib/packages/data/dashboard/index2.js +1 -1
  382. package/lib/packages/data/dashboard/index3.js +1 -1
  383. package/lib/packages/data/display/index.js +1 -1
  384. package/lib/packages/data/display/index2.js +1 -1
  385. package/lib/packages/data/display/index3.js +1 -1
  386. package/lib/packages/data/icons/index.js +1 -1
  387. package/lib/packages/data/icons/index2.js +1 -1
  388. package/lib/packages/data/icons/index3.js +1 -1
  389. package/lib/packages/data/imgText/index.js +1 -1
  390. package/lib/packages/data/imgText/index2.js +1 -1
  391. package/lib/packages/data/imgText/index3.js +1 -1
  392. package/lib/packages/data/list/index.js +1 -1
  393. package/lib/packages/data/list/index2.js +6 -1
  394. package/lib/packages/data/list/index3.js +8 -5
  395. package/lib/packages/data/notice/index.js +1 -1
  396. package/lib/packages/data/notice/index2.js +1 -1
  397. package/lib/packages/data/notice/index3.js +1 -1
  398. package/lib/packages/data/operaText/index.js +1 -1
  399. package/lib/packages/data/operaText/index2.js +1 -1
  400. package/lib/packages/data/operaText/index3.js +1 -1
  401. package/lib/packages/data/panel/index.js +1 -1
  402. package/lib/packages/data/panel/index2.js +1 -1
  403. package/lib/packages/data/panel/index3.js +1 -1
  404. package/lib/packages/data/pay/index.js +1 -1
  405. package/lib/packages/data/pay/index2.js +1 -1
  406. package/lib/packages/data/pay/index3.js +1 -1
  407. package/lib/packages/data/price/index.js +1 -1
  408. package/lib/packages/data/price/index2.js +1 -1
  409. package/lib/packages/data/price/index3.js +1 -1
  410. package/lib/packages/data/product/index.js +1 -1
  411. package/lib/packages/data/product/index2.js +1 -1
  412. package/lib/packages/data/product/index3.js +1 -1
  413. package/lib/packages/data/profile/index.js +1 -1
  414. package/lib/packages/data/profile/index2.js +1 -1
  415. package/lib/packages/data/profile/index3.js +1 -1
  416. package/lib/packages/data/progress/index.js +1 -1
  417. package/lib/packages/data/progress/index2.js +1 -1
  418. package/lib/packages/data/progress/index3.js +1 -1
  419. package/lib/packages/data/rank/index.js +1 -1
  420. package/lib/packages/data/rank/index2.js +1 -1
  421. package/lib/packages/data/rank/index3.js +1 -1
  422. package/lib/packages/data/rotate/index.js +1 -1
  423. package/lib/packages/data/rotate/index2.js +1 -1
  424. package/lib/packages/data/rotate/index3.js +1 -1
  425. package/lib/packages/data/statistic/index.js +1 -1
  426. package/lib/packages/data/statistic/index2.js +15 -1
  427. package/lib/packages/data/statistic/index3.js +8 -5
  428. package/lib/packages/data/tabs/index.js +1 -1
  429. package/lib/packages/data/tabs/index2.js +1 -1
  430. package/lib/packages/data/tabs/index3.js +1 -1
  431. package/lib/packages/data/task/index.js +1 -1
  432. package/lib/packages/data/task/index2.js +1 -1
  433. package/lib/packages/data/task/index3.js +1 -1
  434. package/lib/packages/data/weather/index.js +1 -1
  435. package/lib/packages/data/weather/index2.js +6 -1
  436. package/lib/packages/data/weather/index3.js +6 -5
  437. package/lib/packages/element-plus/array/index.js +1 -1
  438. package/lib/packages/element-plus/array/index2.js +1 -1
  439. package/lib/packages/element-plus/array/index3.js +1 -1
  440. package/lib/packages/element-plus/article/index.js +1 -1
  441. package/lib/packages/element-plus/article/index2.js +185 -20
  442. package/lib/packages/element-plus/article/index3.js +97 -35
  443. package/lib/packages/element-plus/captcha/index.js +12 -0
  444. package/lib/packages/element-plus/captcha/index2.js +917 -0
  445. package/lib/packages/element-plus/captcha/index3.js +521 -0
  446. package/lib/packages/element-plus/cascader/index.js +1 -1
  447. package/lib/packages/element-plus/cascader/index2.js +1 -1
  448. package/lib/packages/element-plus/cascader/index3.js +1 -1
  449. package/lib/packages/element-plus/chat/index.js +1 -1
  450. package/lib/packages/element-plus/chat/index2.js +249 -203
  451. package/lib/packages/element-plus/chat/index3.js +339 -263
  452. package/lib/packages/element-plus/checkbox/index.js +1 -1
  453. package/lib/packages/element-plus/checkbox/index2.js +1 -1
  454. package/lib/packages/element-plus/checkbox/index3.js +1 -1
  455. package/lib/packages/element-plus/comment/index.js +1 -1
  456. package/lib/packages/element-plus/comment/index2.js +105 -32
  457. package/lib/packages/element-plus/comment/index3.js +60 -21
  458. package/lib/packages/element-plus/count-up/index.js +1 -1
  459. package/lib/packages/element-plus/count-up/index2.js +1 -1
  460. package/lib/packages/element-plus/count-up/index3.js +1 -1
  461. package/lib/packages/element-plus/crud/column/column-default.js +1 -1
  462. package/lib/packages/element-plus/crud/column/column-default2.js +1 -1
  463. package/lib/packages/element-plus/crud/column/column-default3.js +1 -1
  464. package/lib/packages/element-plus/crud/column/column-dynamic.js +1 -1
  465. package/lib/packages/element-plus/crud/column/column-dynamic2.js +1 -1
  466. package/lib/packages/element-plus/crud/column/column-dynamic3.js +1 -1
  467. package/lib/packages/element-plus/crud/column/column-menu.js +1 -1
  468. package/lib/packages/element-plus/crud/column/column-menu2.js +1 -1
  469. package/lib/packages/element-plus/crud/column/column-menu3.js +1 -1
  470. package/lib/packages/element-plus/crud/column/column-slot.js +1 -1
  471. package/lib/packages/element-plus/crud/column/column-slot2.js +4 -4
  472. package/lib/packages/element-plus/crud/column/column-slot3.js +1 -1
  473. package/lib/packages/element-plus/crud/column/column.js +1 -1
  474. package/lib/packages/element-plus/crud/column/column2.js +1 -1
  475. package/lib/packages/element-plus/crud/column/column3.js +1 -1
  476. package/lib/packages/element-plus/crud/column/menu.js +1 -1
  477. package/lib/packages/element-plus/crud/column/menu2.js +1 -1
  478. package/lib/packages/element-plus/crud/column/menu3.js +1 -1
  479. package/lib/packages/element-plus/crud/config.js +1 -1
  480. package/lib/packages/element-plus/crud/dialog/dialog-column.js +1 -1
  481. package/lib/packages/element-plus/crud/dialog/dialog-column2.js +118 -40
  482. package/lib/packages/element-plus/crud/dialog/dialog-column3.js +153 -71
  483. package/lib/packages/element-plus/crud/dialog/dialog-excel.js +1 -1
  484. package/lib/packages/element-plus/crud/dialog/dialog-excel2.js +2 -2
  485. package/lib/packages/element-plus/crud/dialog/dialog-excel3.js +1 -1
  486. package/lib/packages/element-plus/crud/dialog/dialog-filter.js +1 -1
  487. package/lib/packages/element-plus/crud/dialog/dialog-filter2.js +1 -1
  488. package/lib/packages/element-plus/crud/dialog/dialog-filter3.js +1 -1
  489. package/lib/packages/element-plus/crud/dialog/dialog-form.js +1 -1
  490. package/lib/packages/element-plus/crud/dialog/dialog-form2.js +1 -1
  491. package/lib/packages/element-plus/crud/dialog/dialog-form3.js +1 -1
  492. package/lib/packages/element-plus/crud/grid/index.js +1 -1
  493. package/lib/packages/element-plus/crud/grid/index2.js +1 -1
  494. package/lib/packages/element-plus/crud/grid/index3.js +1 -1
  495. package/lib/packages/element-plus/crud/grid/item.js +1 -1
  496. package/lib/packages/element-plus/crud/grid/item2.js +1 -1
  497. package/lib/packages/element-plus/crud/grid/item3.js +1 -1
  498. package/lib/packages/element-plus/crud/index.js +1 -1
  499. package/lib/packages/element-plus/crud/index2.js +6 -3
  500. package/lib/packages/element-plus/crud/index3.js +51 -20
  501. package/lib/packages/element-plus/crud/menu/header-menu.js +1 -1
  502. package/lib/packages/element-plus/crud/menu/header-menu2.js +14 -2
  503. package/lib/packages/element-plus/crud/menu/header-menu3.js +122 -62
  504. package/lib/packages/element-plus/crud/menu/header-search.js +1 -1
  505. package/lib/packages/element-plus/crud/menu/header-search2.js +2 -1
  506. package/lib/packages/element-plus/crud/menu/header-search3.js +1 -1
  507. package/lib/packages/element-plus/crud/menu/table-page.js +1 -1
  508. package/lib/packages/element-plus/crud/menu/table-page2.js +1 -1
  509. package/lib/packages/element-plus/crud/menu/table-page3.js +1 -1
  510. package/lib/packages/element-plus/date/index.js +1 -1
  511. package/lib/packages/element-plus/date/index2.js +1 -1
  512. package/lib/packages/element-plus/date/index3.js +1 -1
  513. package/lib/packages/element-plus/draggable/index.js +1 -1
  514. package/lib/packages/element-plus/draggable/index2.js +342 -294
  515. package/lib/packages/element-plus/draggable/index3.js +36 -38
  516. package/lib/packages/element-plus/dynamic/index.js +1 -1
  517. package/lib/packages/element-plus/dynamic/index2.js +1 -1
  518. package/lib/packages/element-plus/dynamic/index3.js +1 -1
  519. package/lib/packages/element-plus/file-manager/index.js +12 -0
  520. package/lib/packages/element-plus/file-manager/index2.js +578 -0
  521. package/lib/packages/element-plus/file-manager/index3.js +816 -0
  522. package/lib/packages/element-plus/filter-builder/index.js +12 -0
  523. package/lib/packages/element-plus/filter-builder/index2.js +212 -0
  524. package/lib/packages/element-plus/filter-builder/index3.js +292 -0
  525. package/lib/packages/element-plus/flow/index.js +1 -1
  526. package/lib/packages/element-plus/flow/index2.js +274 -232
  527. package/lib/packages/element-plus/flow/index3.js +29 -18
  528. package/lib/packages/element-plus/flow/node.js +1 -1
  529. package/lib/packages/element-plus/flow/node2.js +23 -37
  530. package/lib/packages/element-plus/flow/node3.js +19 -16
  531. package/lib/packages/element-plus/form/config.js +1 -1
  532. package/lib/packages/element-plus/form/index.js +1 -1
  533. package/lib/packages/element-plus/form/index2.js +9 -6
  534. package/lib/packages/element-plus/form/index3.js +20 -7
  535. package/lib/packages/element-plus/form/menu.js +1 -1
  536. package/lib/packages/element-plus/form/menu2.js +1 -1
  537. package/lib/packages/element-plus/form/menu3.js +1 -1
  538. package/lib/packages/element-plus/group/index.js +1 -1
  539. package/lib/packages/element-plus/group/index2.js +6 -1
  540. package/lib/packages/element-plus/group/index3.js +7 -4
  541. package/lib/packages/element-plus/{card → iframe}/index.js +4 -4
  542. package/lib/packages/element-plus/iframe/index2.js +194 -0
  543. package/lib/packages/element-plus/iframe/index3.js +66 -0
  544. package/lib/packages/element-plus/input/index.js +1 -1
  545. package/lib/packages/element-plus/input/index2.js +1 -1
  546. package/lib/packages/element-plus/input/index3.js +1 -1
  547. package/lib/packages/element-plus/input-color/index.js +1 -1
  548. package/lib/packages/element-plus/input-color/index2.js +1 -1
  549. package/lib/packages/element-plus/input-color/index3.js +1 -1
  550. package/lib/packages/element-plus/input-cron/index.js +1 -1
  551. package/lib/packages/element-plus/input-cron/index2.js +7 -2
  552. package/lib/packages/element-plus/input-cron/index3.js +8 -4
  553. package/lib/packages/element-plus/input-icon/index.js +1 -1
  554. package/lib/packages/element-plus/input-icon/index2.js +1 -1
  555. package/lib/packages/element-plus/input-icon/index3.js +1 -1
  556. package/lib/packages/element-plus/input-map/index.js +1 -1
  557. package/lib/packages/element-plus/input-map/index2.js +1 -1
  558. package/lib/packages/element-plus/input-map/index3.js +1 -1
  559. package/lib/packages/element-plus/input-number/index.js +1 -1
  560. package/lib/packages/element-plus/input-number/index2.js +1 -1
  561. package/lib/packages/element-plus/input-number/index3.js +1 -1
  562. package/lib/packages/element-plus/input-otp/index.js +12 -0
  563. package/lib/packages/element-plus/input-otp/index2.js +71 -0
  564. package/lib/packages/element-plus/input-otp/index3.js +43 -0
  565. package/lib/packages/element-plus/input-table/index.js +1 -1
  566. package/lib/packages/element-plus/input-table/index2.js +1 -1
  567. package/lib/packages/element-plus/input-table/index3.js +1 -1
  568. package/lib/packages/element-plus/input-tag/index.js +1 -1
  569. package/lib/packages/element-plus/input-tag/index2.js +1 -1
  570. package/lib/packages/element-plus/input-tag/index3.js +1 -1
  571. package/lib/packages/element-plus/input-tree/index.js +1 -1
  572. package/lib/packages/element-plus/input-tree/index2.js +1 -1
  573. package/lib/packages/element-plus/input-tree/index3.js +1 -1
  574. package/lib/packages/element-plus/license/index.js +1 -1
  575. package/lib/packages/element-plus/license/index2.js +216 -106
  576. package/lib/packages/element-plus/license/index3.js +44 -9
  577. package/lib/packages/element-plus/login/index.js +1 -1
  578. package/lib/packages/element-plus/login/index2.js +76 -50
  579. package/lib/packages/element-plus/login/index3.js +56 -45
  580. package/lib/packages/element-plus/mention/index.js +1 -1
  581. package/lib/packages/element-plus/mention/index2.js +32 -8
  582. package/lib/packages/element-plus/mention/index3.js +1 -1
  583. package/lib/packages/element-plus/{verify → qrcode}/index.js +4 -4
  584. package/lib/packages/element-plus/qrcode/index2.js +278 -0
  585. package/lib/packages/element-plus/qrcode/index3.js +59 -0
  586. package/lib/packages/element-plus/radio/index.js +1 -1
  587. package/lib/packages/element-plus/radio/index2.js +1 -1
  588. package/lib/packages/element-plus/radio/index3.js +1 -1
  589. package/lib/packages/element-plus/rate/index.js +1 -1
  590. package/lib/packages/element-plus/rate/index2.js +1 -1
  591. package/lib/packages/element-plus/rate/index3.js +1 -1
  592. package/lib/packages/element-plus/search/index.js +1 -1
  593. package/lib/packages/element-plus/search/index2.js +1 -1
  594. package/lib/packages/element-plus/search/index3.js +1 -1
  595. package/lib/packages/element-plus/select/index.js +1 -1
  596. package/lib/packages/element-plus/select/index2.js +31 -6
  597. package/lib/packages/element-plus/select/index3.js +1 -1
  598. package/lib/packages/element-plus/sign/index.js +1 -1
  599. package/lib/packages/element-plus/sign/index2.js +266 -183
  600. package/lib/packages/element-plus/sign/index3.js +70 -10
  601. package/lib/packages/element-plus/slider/index.js +1 -1
  602. package/lib/packages/element-plus/slider/index2.js +1 -1
  603. package/lib/packages/element-plus/slider/index3.js +1 -1
  604. package/lib/packages/element-plus/switch/index.js +1 -1
  605. package/lib/packages/element-plus/switch/index2.js +1 -1
  606. package/lib/packages/element-plus/switch/index3.js +1 -1
  607. package/lib/packages/element-plus/tabs/index.js +1 -1
  608. package/lib/packages/element-plus/tabs/index2.js +6 -1
  609. package/lib/packages/element-plus/tabs/index3.js +22 -7
  610. package/lib/packages/element-plus/text-ellipsis/index.js +1 -1
  611. package/lib/packages/element-plus/text-ellipsis/index2.js +1 -1
  612. package/lib/packages/element-plus/text-ellipsis/index3.js +1 -1
  613. package/lib/packages/element-plus/time/index.js +1 -1
  614. package/lib/packages/element-plus/time/index2.js +1 -1
  615. package/lib/packages/element-plus/time/index3.js +1 -1
  616. package/lib/packages/element-plus/title/index.js +1 -1
  617. package/lib/packages/element-plus/title/index2.js +1 -1
  618. package/lib/packages/element-plus/title/index3.js +1 -1
  619. package/lib/packages/element-plus/tree/index.js +1 -1
  620. package/lib/packages/element-plus/tree/index2.js +1 -1
  621. package/lib/packages/element-plus/tree/index3.js +1 -1
  622. package/lib/packages/element-plus/upload/index.js +1 -1
  623. package/lib/packages/element-plus/upload/index2.js +1 -1
  624. package/lib/packages/element-plus/upload/index3.js +1 -1
  625. package/lib/packages/element-plus/video/index.js +1 -1
  626. package/lib/packages/element-plus/video/index2.js +183 -32
  627. package/lib/packages/element-plus/video/index3.js +64 -28
  628. package/lib/src/core/column-state.js +1 -1
  629. package/lib/src/core/create.js +1 -1
  630. package/lib/src/core/dataformat.js +1 -1
  631. package/lib/src/core/detail.js +1 -1
  632. package/lib/src/core/dic.js +108 -136
  633. package/lib/src/core/locale.js +1 -1
  634. package/lib/src/core/option.js +3 -1
  635. package/lib/src/core/packages.js +4 -4
  636. package/lib/src/core/slot.js +1 -1
  637. package/lib/src/global/variable.js +2 -2
  638. package/lib/src/icon.js +1 -1
  639. package/lib/src/index.js +77 -65
  640. package/lib/src/locale/index.js +1 -1
  641. package/lib/src/locale/lang/en.js +12 -2
  642. package/lib/src/locale/lang/zh-cn.js +12 -2
  643. package/lib/src/locale/lang/zh.js +12 -2
  644. package/lib/src/plugin/ali/index.js +1 -1
  645. package/lib/src/plugin/clipboard/index.js +42 -57
  646. package/lib/src/plugin/export/_blob.js +1 -1
  647. package/lib/src/plugin/export/_export2Excel.js +1 -1
  648. package/lib/src/plugin/export/index.js +122 -67
  649. package/lib/src/plugin/logs/index.js +1 -1
  650. package/lib/src/plugin/print/index.js +205 -128
  651. package/lib/src/plugin/qiniu/index.js +1 -1
  652. package/lib/src/plugin/screenshot/index.js +26 -4
  653. package/lib/src/plugin/video/index.js +117 -28
  654. package/lib/src/plugin/watermark/index.js +58 -102
  655. package/lib/src/plugin/watermark/watermark.js +123 -80
  656. package/lib/src/ui/data/index.js +1 -1
  657. package/lib/src/ui/element-plus/index.js +112 -96
  658. package/lib/src/ui/index.js +1 -1
  659. package/lib/src/utils/bem.js +1 -1
  660. package/lib/src/utils/mock.js +1 -1
  661. package/lib/src/utils/print.js +218 -0
  662. package/lib/src/utils/util.js +1 -1
  663. package/lib/src/utils/validate.js +1 -1
  664. package/lib/src/version.js +2 -2
  665. package/package.json +4 -2
  666. package/types/index.d.ts +74 -19
  667. package/es/packages/element-plus/card/index2.mjs +0 -65
  668. package/es/packages/element-plus/card/index3.mjs +0 -94
  669. package/es/packages/element-plus/verify/index2.mjs +0 -52
  670. package/es/packages/element-plus/verify/index3.mjs +0 -18
  671. package/lib/packages/element-plus/card/index2.js +0 -69
  672. package/lib/packages/element-plus/card/index3.js +0 -96
  673. package/lib/packages/element-plus/verify/index2.js +0 -56
  674. package/lib/packages/element-plus/verify/index3.js +0 -20
@@ -0,0 +1,2240 @@
1
+ /*! Avue.js v3.9.4 | (c) 2017-2026 Smallwei | Released under the MIT License. */
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ //---------------------------------------------------------------------
7
+ //
8
+ // QR Code Generator for JavaScript
9
+ //
10
+ // Copyright (c) 2009 Kazuhiko Arase
11
+ //
12
+ // URL: http://www.d-project.com/
13
+ //
14
+ // Licensed under the MIT license:
15
+ // http://www.opensource.org/licenses/mit-license.php
16
+ //
17
+ // The word 'QR Code' is registered trademark of
18
+ // DENSO WAVE INCORPORATED
19
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
20
+ //
21
+ //---------------------------------------------------------------------
22
+
23
+ //---------------------------------------------------------------------
24
+ // qrcode
25
+ //---------------------------------------------------------------------
26
+
27
+ /**
28
+ * qrcode
29
+ * @param typeNumber 1 to 40
30
+ * @param errorCorrectionLevel 'L','M','Q','H'
31
+ */
32
+ const qrcode = function(typeNumber, errorCorrectionLevel) {
33
+
34
+ const PAD0 = 0xEC;
35
+ const PAD1 = 0x11;
36
+
37
+ let _typeNumber = typeNumber;
38
+ const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
39
+ let _modules = null;
40
+ let _moduleCount = 0;
41
+ let _dataCache = null;
42
+ const _dataList = [];
43
+
44
+ const _this = {};
45
+
46
+ const makeImpl = function(test, maskPattern) {
47
+
48
+ _moduleCount = _typeNumber * 4 + 17;
49
+ _modules = function(moduleCount) {
50
+ const modules = new Array(moduleCount);
51
+ for (let row = 0; row < moduleCount; row += 1) {
52
+ modules[row] = new Array(moduleCount);
53
+ for (let col = 0; col < moduleCount; col += 1) {
54
+ modules[row][col] = null;
55
+ }
56
+ }
57
+ return modules;
58
+ }(_moduleCount);
59
+
60
+ setupPositionProbePattern(0, 0);
61
+ setupPositionProbePattern(_moduleCount - 7, 0);
62
+ setupPositionProbePattern(0, _moduleCount - 7);
63
+ setupPositionAdjustPattern();
64
+ setupTimingPattern();
65
+ setupTypeInfo(test, maskPattern);
66
+
67
+ if (_typeNumber >= 7) {
68
+ setupTypeNumber(test);
69
+ }
70
+
71
+ if (_dataCache == null) {
72
+ _dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
73
+ }
74
+
75
+ mapData(_dataCache, maskPattern);
76
+ };
77
+
78
+ const setupPositionProbePattern = function(row, col) {
79
+
80
+ for (let r = -1; r <= 7; r += 1) {
81
+
82
+ if (row + r <= -1 || _moduleCount <= row + r) continue;
83
+
84
+ for (let c = -1; c <= 7; c += 1) {
85
+
86
+ if (col + c <= -1 || _moduleCount <= col + c) continue;
87
+
88
+ if ( (0 <= r && r <= 6 && (c == 0 || c == 6) )
89
+ || (0 <= c && c <= 6 && (r == 0 || r == 6) )
90
+ || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
91
+ _modules[row + r][col + c] = true;
92
+ } else {
93
+ _modules[row + r][col + c] = false;
94
+ }
95
+ }
96
+ }
97
+ };
98
+
99
+ const getBestMaskPattern = function() {
100
+
101
+ let minLostPoint = 0;
102
+ let pattern = 0;
103
+
104
+ for (let i = 0; i < 8; i += 1) {
105
+
106
+ makeImpl(true, i);
107
+
108
+ const lostPoint = QRUtil.getLostPoint(_this);
109
+
110
+ if (i == 0 || minLostPoint > lostPoint) {
111
+ minLostPoint = lostPoint;
112
+ pattern = i;
113
+ }
114
+ }
115
+
116
+ return pattern;
117
+ };
118
+
119
+ const setupTimingPattern = function() {
120
+
121
+ for (let r = 8; r < _moduleCount - 8; r += 1) {
122
+ if (_modules[r][6] != null) {
123
+ continue;
124
+ }
125
+ _modules[r][6] = (r % 2 == 0);
126
+ }
127
+
128
+ for (let c = 8; c < _moduleCount - 8; c += 1) {
129
+ if (_modules[6][c] != null) {
130
+ continue;
131
+ }
132
+ _modules[6][c] = (c % 2 == 0);
133
+ }
134
+ };
135
+
136
+ const setupPositionAdjustPattern = function() {
137
+
138
+ const pos = QRUtil.getPatternPosition(_typeNumber);
139
+
140
+ for (let i = 0; i < pos.length; i += 1) {
141
+
142
+ for (let j = 0; j < pos.length; j += 1) {
143
+
144
+ const row = pos[i];
145
+ const col = pos[j];
146
+
147
+ if (_modules[row][col] != null) {
148
+ continue;
149
+ }
150
+
151
+ for (let r = -2; r <= 2; r += 1) {
152
+
153
+ for (let c = -2; c <= 2; c += 1) {
154
+
155
+ if (r == -2 || r == 2 || c == -2 || c == 2
156
+ || (r == 0 && c == 0) ) {
157
+ _modules[row + r][col + c] = true;
158
+ } else {
159
+ _modules[row + r][col + c] = false;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ };
166
+
167
+ const setupTypeNumber = function(test) {
168
+
169
+ const bits = QRUtil.getBCHTypeNumber(_typeNumber);
170
+
171
+ for (let i = 0; i < 18; i += 1) {
172
+ const mod = (!test && ( (bits >> i) & 1) == 1);
173
+ _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
174
+ }
175
+
176
+ for (let i = 0; i < 18; i += 1) {
177
+ const mod = (!test && ( (bits >> i) & 1) == 1);
178
+ _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
179
+ }
180
+ };
181
+
182
+ const setupTypeInfo = function(test, maskPattern) {
183
+
184
+ const data = (_errorCorrectionLevel << 3) | maskPattern;
185
+ const bits = QRUtil.getBCHTypeInfo(data);
186
+
187
+ // vertical
188
+ for (let i = 0; i < 15; i += 1) {
189
+
190
+ const mod = (!test && ( (bits >> i) & 1) == 1);
191
+
192
+ if (i < 6) {
193
+ _modules[i][8] = mod;
194
+ } else if (i < 8) {
195
+ _modules[i + 1][8] = mod;
196
+ } else {
197
+ _modules[_moduleCount - 15 + i][8] = mod;
198
+ }
199
+ }
200
+
201
+ // horizontal
202
+ for (let i = 0; i < 15; i += 1) {
203
+
204
+ const mod = (!test && ( (bits >> i) & 1) == 1);
205
+
206
+ if (i < 8) {
207
+ _modules[8][_moduleCount - i - 1] = mod;
208
+ } else if (i < 9) {
209
+ _modules[8][15 - i - 1 + 1] = mod;
210
+ } else {
211
+ _modules[8][15 - i - 1] = mod;
212
+ }
213
+ }
214
+
215
+ // fixed module
216
+ _modules[_moduleCount - 8][8] = (!test);
217
+ };
218
+
219
+ const mapData = function(data, maskPattern) {
220
+
221
+ let inc = -1;
222
+ let row = _moduleCount - 1;
223
+ let bitIndex = 7;
224
+ let byteIndex = 0;
225
+ const maskFunc = QRUtil.getMaskFunction(maskPattern);
226
+
227
+ for (let col = _moduleCount - 1; col > 0; col -= 2) {
228
+
229
+ if (col == 6) col -= 1;
230
+
231
+ while (true) {
232
+
233
+ for (let c = 0; c < 2; c += 1) {
234
+
235
+ if (_modules[row][col - c] == null) {
236
+
237
+ let dark = false;
238
+
239
+ if (byteIndex < data.length) {
240
+ dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
241
+ }
242
+
243
+ const mask = maskFunc(row, col - c);
244
+
245
+ if (mask) {
246
+ dark = !dark;
247
+ }
248
+
249
+ _modules[row][col - c] = dark;
250
+ bitIndex -= 1;
251
+
252
+ if (bitIndex == -1) {
253
+ byteIndex += 1;
254
+ bitIndex = 7;
255
+ }
256
+ }
257
+ }
258
+
259
+ row += inc;
260
+
261
+ if (row < 0 || _moduleCount <= row) {
262
+ row -= inc;
263
+ inc = -inc;
264
+ break;
265
+ }
266
+ }
267
+ }
268
+ };
269
+
270
+ const createBytes = function(buffer, rsBlocks) {
271
+
272
+ let offset = 0;
273
+
274
+ let maxDcCount = 0;
275
+ let maxEcCount = 0;
276
+
277
+ const dcdata = new Array(rsBlocks.length);
278
+ const ecdata = new Array(rsBlocks.length);
279
+
280
+ for (let r = 0; r < rsBlocks.length; r += 1) {
281
+
282
+ const dcCount = rsBlocks[r].dataCount;
283
+ const ecCount = rsBlocks[r].totalCount - dcCount;
284
+
285
+ maxDcCount = Math.max(maxDcCount, dcCount);
286
+ maxEcCount = Math.max(maxEcCount, ecCount);
287
+
288
+ dcdata[r] = new Array(dcCount);
289
+
290
+ for (let i = 0; i < dcdata[r].length; i += 1) {
291
+ dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
292
+ }
293
+ offset += dcCount;
294
+
295
+ const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
296
+ const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
297
+
298
+ const modPoly = rawPoly.mod(rsPoly);
299
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
300
+ for (let i = 0; i < ecdata[r].length; i += 1) {
301
+ const modIndex = i + modPoly.getLength() - ecdata[r].length;
302
+ ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;
303
+ }
304
+ }
305
+
306
+ let totalCodeCount = 0;
307
+ for (let i = 0; i < rsBlocks.length; i += 1) {
308
+ totalCodeCount += rsBlocks[i].totalCount;
309
+ }
310
+
311
+ const data = new Array(totalCodeCount);
312
+ let index = 0;
313
+
314
+ for (let i = 0; i < maxDcCount; i += 1) {
315
+ for (let r = 0; r < rsBlocks.length; r += 1) {
316
+ if (i < dcdata[r].length) {
317
+ data[index] = dcdata[r][i];
318
+ index += 1;
319
+ }
320
+ }
321
+ }
322
+
323
+ for (let i = 0; i < maxEcCount; i += 1) {
324
+ for (let r = 0; r < rsBlocks.length; r += 1) {
325
+ if (i < ecdata[r].length) {
326
+ data[index] = ecdata[r][i];
327
+ index += 1;
328
+ }
329
+ }
330
+ }
331
+
332
+ return data;
333
+ };
334
+
335
+ const createData = function(typeNumber, errorCorrectionLevel, dataList) {
336
+
337
+ const rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectionLevel);
338
+
339
+ const buffer = qrBitBuffer();
340
+
341
+ for (let i = 0; i < dataList.length; i += 1) {
342
+ const data = dataList[i];
343
+ buffer.put(data.getMode(), 4);
344
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
345
+ data.write(buffer);
346
+ }
347
+
348
+ // calc num max data.
349
+ let totalDataCount = 0;
350
+ for (let i = 0; i < rsBlocks.length; i += 1) {
351
+ totalDataCount += rsBlocks[i].dataCount;
352
+ }
353
+
354
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
355
+ throw 'code length overflow. ('
356
+ + buffer.getLengthInBits()
357
+ + '>'
358
+ + totalDataCount * 8
359
+ + ')';
360
+ }
361
+
362
+ // end code
363
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
364
+ buffer.put(0, 4);
365
+ }
366
+
367
+ // padding
368
+ while (buffer.getLengthInBits() % 8 != 0) {
369
+ buffer.putBit(false);
370
+ }
371
+
372
+ // padding
373
+ while (true) {
374
+
375
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
376
+ break;
377
+ }
378
+ buffer.put(PAD0, 8);
379
+
380
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
381
+ break;
382
+ }
383
+ buffer.put(PAD1, 8);
384
+ }
385
+
386
+ return createBytes(buffer, rsBlocks);
387
+ };
388
+
389
+ _this.addData = function(data, mode) {
390
+
391
+ mode = mode || 'Byte';
392
+
393
+ let newData = null;
394
+
395
+ switch(mode) {
396
+ case 'Numeric' :
397
+ newData = qrNumber(data);
398
+ break;
399
+ case 'Alphanumeric' :
400
+ newData = qrAlphaNum(data);
401
+ break;
402
+ case 'Byte' :
403
+ newData = qr8BitByte(data);
404
+ break;
405
+ case 'Kanji' :
406
+ newData = qrKanji(data);
407
+ break;
408
+ default :
409
+ throw 'mode:' + mode;
410
+ }
411
+
412
+ _dataList.push(newData);
413
+ _dataCache = null;
414
+ };
415
+
416
+ _this.isDark = function(row, col) {
417
+ if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
418
+ throw row + ',' + col;
419
+ }
420
+ return _modules[row][col];
421
+ };
422
+
423
+ _this.getModuleCount = function() {
424
+ return _moduleCount;
425
+ };
426
+
427
+ _this.make = function() {
428
+ if (_typeNumber < 1) {
429
+ let typeNumber = 1;
430
+
431
+ for (; typeNumber < 40; typeNumber++) {
432
+ const rsBlocks = QRRSBlock.getRSBlocks(typeNumber, _errorCorrectionLevel);
433
+ const buffer = qrBitBuffer();
434
+
435
+ for (let i = 0; i < _dataList.length; i++) {
436
+ const data = _dataList[i];
437
+ buffer.put(data.getMode(), 4);
438
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
439
+ data.write(buffer);
440
+ }
441
+
442
+ let totalDataCount = 0;
443
+ for (let i = 0; i < rsBlocks.length; i++) {
444
+ totalDataCount += rsBlocks[i].dataCount;
445
+ }
446
+
447
+ if (buffer.getLengthInBits() <= totalDataCount * 8) {
448
+ break;
449
+ }
450
+ }
451
+
452
+ _typeNumber = typeNumber;
453
+ }
454
+
455
+ makeImpl(false, getBestMaskPattern() );
456
+ };
457
+
458
+ _this.createTableTag = function(cellSize, margin) {
459
+
460
+ cellSize = cellSize || 2;
461
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
462
+
463
+ let qrHtml = '';
464
+
465
+ qrHtml += '<table style="';
466
+ qrHtml += ' border-width: 0px; border-style: none;';
467
+ qrHtml += ' border-collapse: collapse;';
468
+ qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
469
+ qrHtml += '">';
470
+ qrHtml += '<tbody>';
471
+
472
+ for (let r = 0; r < _this.getModuleCount(); r += 1) {
473
+
474
+ qrHtml += '<tr>';
475
+
476
+ for (let c = 0; c < _this.getModuleCount(); c += 1) {
477
+ qrHtml += '<td style="';
478
+ qrHtml += ' border-width: 0px; border-style: none;';
479
+ qrHtml += ' border-collapse: collapse;';
480
+ qrHtml += ' padding: 0px; margin: 0px;';
481
+ qrHtml += ' width: ' + cellSize + 'px;';
482
+ qrHtml += ' height: ' + cellSize + 'px;';
483
+ qrHtml += ' background-color: ';
484
+ qrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';
485
+ qrHtml += ';';
486
+ qrHtml += '"/>';
487
+ }
488
+
489
+ qrHtml += '</tr>';
490
+ }
491
+
492
+ qrHtml += '</tbody>';
493
+ qrHtml += '</table>';
494
+
495
+ return qrHtml;
496
+ };
497
+
498
+ _this.createSvgTag = function(cellSize, margin, alt, title) {
499
+
500
+ let opts = {};
501
+ if (typeof arguments[0] == 'object') {
502
+ // Called by options.
503
+ opts = arguments[0];
504
+ // overwrite cellSize and margin.
505
+ cellSize = opts.cellSize;
506
+ margin = opts.margin;
507
+ alt = opts.alt;
508
+ title = opts.title;
509
+ }
510
+
511
+ cellSize = cellSize || 2;
512
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
513
+
514
+ // Compose alt property surrogate
515
+ alt = (typeof alt === 'string') ? {text: alt} : alt || {};
516
+ alt.text = alt.text || null;
517
+ alt.id = (alt.text) ? alt.id || 'qrcode-description' : null;
518
+
519
+ // Compose title property surrogate
520
+ title = (typeof title === 'string') ? {text: title} : title || {};
521
+ title.text = title.text || null;
522
+ title.id = (title.text) ? title.id || 'qrcode-title' : null;
523
+
524
+ const size = _this.getModuleCount() * cellSize + margin * 2;
525
+ let c, mc, r, mr, qrSvg='', rect;
526
+
527
+ rect = 'l' + cellSize + ',0 0,' + cellSize +
528
+ ' -' + cellSize + ',0 0,-' + cellSize + 'z ';
529
+
530
+ qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
531
+ qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : '';
532
+ qrSvg += ' viewBox="0 0 ' + size + ' ' + size + '" ';
533
+ qrSvg += ' preserveAspectRatio="xMinYMin meet"';
534
+ qrSvg += (title.text || alt.text) ? ' role="img" aria-labelledby="' +
535
+ escapeXml([title.id, alt.id].join(' ').trim() ) + '"' : '';
536
+ qrSvg += '>';
537
+ qrSvg += (title.text) ? '<title id="' + escapeXml(title.id) + '">' +
538
+ escapeXml(title.text) + '</title>' : '';
539
+ qrSvg += (alt.text) ? '<description id="' + escapeXml(alt.id) + '">' +
540
+ escapeXml(alt.text) + '</description>' : '';
541
+ qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
542
+ qrSvg += '<path d="';
543
+
544
+ for (r = 0; r < _this.getModuleCount(); r += 1) {
545
+ mr = r * cellSize + margin;
546
+ for (c = 0; c < _this.getModuleCount(); c += 1) {
547
+ if (_this.isDark(r, c) ) {
548
+ mc = c*cellSize+margin;
549
+ qrSvg += 'M' + mc + ',' + mr + rect;
550
+ }
551
+ }
552
+ }
553
+
554
+ qrSvg += '" stroke="transparent" fill="black"/>';
555
+ qrSvg += '</svg>';
556
+
557
+ return qrSvg;
558
+ };
559
+
560
+ _this.createDataURL = function(cellSize, margin) {
561
+
562
+ cellSize = cellSize || 2;
563
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
564
+
565
+ const size = _this.getModuleCount() * cellSize + margin * 2;
566
+ const min = margin;
567
+ const max = size - margin;
568
+
569
+ return createDataURL(size, size, function(x, y) {
570
+ if (min <= x && x < max && min <= y && y < max) {
571
+ const c = Math.floor( (x - min) / cellSize);
572
+ const r = Math.floor( (y - min) / cellSize);
573
+ return _this.isDark(r, c)? 0 : 1;
574
+ } else {
575
+ return 1;
576
+ }
577
+ } );
578
+ };
579
+
580
+ _this.createImgTag = function(cellSize, margin, alt) {
581
+
582
+ cellSize = cellSize || 2;
583
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
584
+
585
+ const size = _this.getModuleCount() * cellSize + margin * 2;
586
+
587
+ let img = '';
588
+ img += '<img';
589
+ img += '\u0020src="';
590
+ img += _this.createDataURL(cellSize, margin);
591
+ img += '"';
592
+ img += '\u0020width="';
593
+ img += size;
594
+ img += '"';
595
+ img += '\u0020height="';
596
+ img += size;
597
+ img += '"';
598
+ if (alt) {
599
+ img += '\u0020alt="';
600
+ img += escapeXml(alt);
601
+ img += '"';
602
+ }
603
+ img += '/>';
604
+
605
+ return img;
606
+ };
607
+
608
+ const escapeXml = function(s) {
609
+ let escaped = '';
610
+ for (let i = 0; i < s.length; i += 1) {
611
+ const c = s.charAt(i);
612
+ switch(c) {
613
+ case '<': escaped += '&lt;'; break;
614
+ case '>': escaped += '&gt;'; break;
615
+ case '&': escaped += '&amp;'; break;
616
+ case '"': escaped += '&quot;'; break;
617
+ default : escaped += c; break;
618
+ }
619
+ }
620
+ return escaped;
621
+ };
622
+
623
+ const _createHalfASCII = function(margin) {
624
+ const cellSize = 1;
625
+ margin = (typeof margin == 'undefined')? cellSize * 2 : margin;
626
+
627
+ const size = _this.getModuleCount() * cellSize + margin * 2;
628
+ const min = margin;
629
+ const max = size - margin;
630
+
631
+ let y, x, r1, r2, p;
632
+
633
+ const blocks = {
634
+ '██': '█',
635
+ '█ ': '▀',
636
+ ' █': '▄',
637
+ ' ': ' '
638
+ };
639
+
640
+ const blocksLastLineNoMargin = {
641
+ '██': '▀',
642
+ '█ ': '▀',
643
+ ' █': ' ',
644
+ ' ': ' '
645
+ };
646
+
647
+ let ascii = '';
648
+ for (y = 0; y < size; y += 2) {
649
+ r1 = Math.floor((y - min) / cellSize);
650
+ r2 = Math.floor((y + 1 - min) / cellSize);
651
+ for (x = 0; x < size; x += 1) {
652
+ p = '█';
653
+
654
+ if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
655
+ p = ' ';
656
+ }
657
+
658
+ if (min <= x && x < max && min <= y+1 && y+1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
659
+ p += ' ';
660
+ }
661
+ else {
662
+ p += '█';
663
+ }
664
+
665
+ // Output 2 characters per pixel, to create full square. 1 character per pixels gives only half width of square.
666
+ ascii += (margin < 1 && y+1 >= max) ? blocksLastLineNoMargin[p] : blocks[p];
667
+ }
668
+
669
+ ascii += '\n';
670
+ }
671
+
672
+ if (size % 2 && margin > 0) {
673
+ return ascii.substring(0, ascii.length - size - 1) + Array(size+1).join('▀');
674
+ }
675
+
676
+ return ascii.substring(0, ascii.length-1);
677
+ };
678
+
679
+ _this.createASCII = function(cellSize, margin) {
680
+ cellSize = cellSize || 1;
681
+
682
+ if (cellSize < 2) {
683
+ return _createHalfASCII(margin);
684
+ }
685
+
686
+ cellSize -= 1;
687
+ margin = (typeof margin == 'undefined')? cellSize * 2 : margin;
688
+
689
+ const size = _this.getModuleCount() * cellSize + margin * 2;
690
+ const min = margin;
691
+ const max = size - margin;
692
+
693
+ let y, x, r, p;
694
+
695
+ const white = Array(cellSize+1).join('██');
696
+ const black = Array(cellSize+1).join(' ');
697
+
698
+ let ascii = '';
699
+ let line = '';
700
+ for (y = 0; y < size; y += 1) {
701
+ r = Math.floor( (y - min) / cellSize);
702
+ line = '';
703
+ for (x = 0; x < size; x += 1) {
704
+ p = 1;
705
+
706
+ if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
707
+ p = 0;
708
+ }
709
+
710
+ // Output 2 characters per pixel, to create full square. 1 character per pixels gives only half width of square.
711
+ line += p ? white : black;
712
+ }
713
+
714
+ for (r = 0; r < cellSize; r += 1) {
715
+ ascii += line + '\n';
716
+ }
717
+ }
718
+
719
+ return ascii.substring(0, ascii.length-1);
720
+ };
721
+
722
+ _this.renderTo2dContext = function(context, cellSize) {
723
+ cellSize = cellSize || 2;
724
+ const length = _this.getModuleCount();
725
+ for (let row = 0; row < length; row++) {
726
+ for (let col = 0; col < length; col++) {
727
+ context.fillStyle = _this.isDark(row, col) ? 'black' : 'white';
728
+ context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
729
+ }
730
+ }
731
+ };
732
+
733
+ return _this;
734
+ };
735
+
736
+ //---------------------------------------------------------------------
737
+ // qrcode.stringToBytes
738
+ //---------------------------------------------------------------------
739
+
740
+ qrcode.stringToBytes = function(s) {
741
+ const bytes = [];
742
+ for (let i = 0; i < s.length; i += 1) {
743
+ const c = s.charCodeAt(i);
744
+ bytes.push(c & 0xff);
745
+ }
746
+ return bytes;
747
+ };
748
+
749
+ //---------------------------------------------------------------------
750
+ // qrcode.createStringToBytes
751
+ //---------------------------------------------------------------------
752
+
753
+ /**
754
+ * @param unicodeData base64 string of byte array.
755
+ * [16bit Unicode],[16bit Bytes], ...
756
+ * @param numChars
757
+ */
758
+ qrcode.createStringToBytes = function(unicodeData, numChars) {
759
+
760
+ // create conversion map.
761
+
762
+ const unicodeMap = function() {
763
+
764
+ const bin = base64DecodeInputStream(unicodeData);
765
+ const read = function() {
766
+ const b = bin.read();
767
+ if (b == -1) throw 'eof';
768
+ return b;
769
+ };
770
+
771
+ let count = 0;
772
+ const unicodeMap = {};
773
+ while (true) {
774
+ const b0 = bin.read();
775
+ if (b0 == -1) break;
776
+ const b1 = read();
777
+ const b2 = read();
778
+ const b3 = read();
779
+ const k = String.fromCharCode( (b0 << 8) | b1);
780
+ const v = (b2 << 8) | b3;
781
+ unicodeMap[k] = v;
782
+ count += 1;
783
+ }
784
+ if (count != numChars) {
785
+ throw count + ' != ' + numChars;
786
+ }
787
+
788
+ return unicodeMap;
789
+ }();
790
+
791
+ const unknownChar = '?'.charCodeAt(0);
792
+
793
+ return function(s) {
794
+ const bytes = [];
795
+ for (let i = 0; i < s.length; i += 1) {
796
+ const c = s.charCodeAt(i);
797
+ if (c < 128) {
798
+ bytes.push(c);
799
+ } else {
800
+ const b = unicodeMap[s.charAt(i)];
801
+ if (typeof b == 'number') {
802
+ if ( (b & 0xff) == b) {
803
+ // 1byte
804
+ bytes.push(b);
805
+ } else {
806
+ // 2bytes
807
+ bytes.push(b >>> 8);
808
+ bytes.push(b & 0xff);
809
+ }
810
+ } else {
811
+ bytes.push(unknownChar);
812
+ }
813
+ }
814
+ }
815
+ return bytes;
816
+ };
817
+ };
818
+
819
+ //---------------------------------------------------------------------
820
+ // QRMode
821
+ //---------------------------------------------------------------------
822
+
823
+ const QRMode = {
824
+ MODE_NUMBER : 1 << 0,
825
+ MODE_ALPHA_NUM : 1 << 1,
826
+ MODE_8BIT_BYTE : 1 << 2,
827
+ MODE_KANJI : 1 << 3
828
+ };
829
+
830
+ //---------------------------------------------------------------------
831
+ // QRErrorCorrectionLevel
832
+ //---------------------------------------------------------------------
833
+
834
+ const QRErrorCorrectionLevel = {
835
+ L : 1,
836
+ M : 0,
837
+ Q : 3,
838
+ H : 2
839
+ };
840
+
841
+ //---------------------------------------------------------------------
842
+ // QRMaskPattern
843
+ //---------------------------------------------------------------------
844
+
845
+ const QRMaskPattern = {
846
+ PATTERN000 : 0,
847
+ PATTERN001 : 1,
848
+ PATTERN010 : 2,
849
+ PATTERN011 : 3,
850
+ PATTERN100 : 4,
851
+ PATTERN101 : 5,
852
+ PATTERN110 : 6,
853
+ PATTERN111 : 7
854
+ };
855
+
856
+ //---------------------------------------------------------------------
857
+ // QRUtil
858
+ //---------------------------------------------------------------------
859
+
860
+ const QRUtil = function() {
861
+
862
+ const PATTERN_POSITION_TABLE = [
863
+ [],
864
+ [6, 18],
865
+ [6, 22],
866
+ [6, 26],
867
+ [6, 30],
868
+ [6, 34],
869
+ [6, 22, 38],
870
+ [6, 24, 42],
871
+ [6, 26, 46],
872
+ [6, 28, 50],
873
+ [6, 30, 54],
874
+ [6, 32, 58],
875
+ [6, 34, 62],
876
+ [6, 26, 46, 66],
877
+ [6, 26, 48, 70],
878
+ [6, 26, 50, 74],
879
+ [6, 30, 54, 78],
880
+ [6, 30, 56, 82],
881
+ [6, 30, 58, 86],
882
+ [6, 34, 62, 90],
883
+ [6, 28, 50, 72, 94],
884
+ [6, 26, 50, 74, 98],
885
+ [6, 30, 54, 78, 102],
886
+ [6, 28, 54, 80, 106],
887
+ [6, 32, 58, 84, 110],
888
+ [6, 30, 58, 86, 114],
889
+ [6, 34, 62, 90, 118],
890
+ [6, 26, 50, 74, 98, 122],
891
+ [6, 30, 54, 78, 102, 126],
892
+ [6, 26, 52, 78, 104, 130],
893
+ [6, 30, 56, 82, 108, 134],
894
+ [6, 34, 60, 86, 112, 138],
895
+ [6, 30, 58, 86, 114, 142],
896
+ [6, 34, 62, 90, 118, 146],
897
+ [6, 30, 54, 78, 102, 126, 150],
898
+ [6, 24, 50, 76, 102, 128, 154],
899
+ [6, 28, 54, 80, 106, 132, 158],
900
+ [6, 32, 58, 84, 110, 136, 162],
901
+ [6, 26, 54, 82, 110, 138, 166],
902
+ [6, 30, 58, 86, 114, 142, 170]
903
+ ];
904
+ const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
905
+ const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
906
+ const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
907
+
908
+ const _this = {};
909
+
910
+ const getBCHDigit = function(data) {
911
+ let digit = 0;
912
+ while (data != 0) {
913
+ digit += 1;
914
+ data >>>= 1;
915
+ }
916
+ return digit;
917
+ };
918
+
919
+ _this.getBCHTypeInfo = function(data) {
920
+ let d = data << 10;
921
+ while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
922
+ d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );
923
+ }
924
+ return ( (data << 10) | d) ^ G15_MASK;
925
+ };
926
+
927
+ _this.getBCHTypeNumber = function(data) {
928
+ let d = data << 12;
929
+ while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
930
+ d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );
931
+ }
932
+ return (data << 12) | d;
933
+ };
934
+
935
+ _this.getPatternPosition = function(typeNumber) {
936
+ return PATTERN_POSITION_TABLE[typeNumber - 1];
937
+ };
938
+
939
+ _this.getMaskFunction = function(maskPattern) {
940
+
941
+ switch (maskPattern) {
942
+
943
+ case QRMaskPattern.PATTERN000 :
944
+ return function(i, j) { return (i + j) % 2 == 0; };
945
+ case QRMaskPattern.PATTERN001 :
946
+ return function(i, j) { return i % 2 == 0; };
947
+ case QRMaskPattern.PATTERN010 :
948
+ return function(i, j) { return j % 3 == 0; };
949
+ case QRMaskPattern.PATTERN011 :
950
+ return function(i, j) { return (i + j) % 3 == 0; };
951
+ case QRMaskPattern.PATTERN100 :
952
+ return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };
953
+ case QRMaskPattern.PATTERN101 :
954
+ return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };
955
+ case QRMaskPattern.PATTERN110 :
956
+ return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };
957
+ case QRMaskPattern.PATTERN111 :
958
+ return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };
959
+
960
+ default :
961
+ throw 'bad maskPattern:' + maskPattern;
962
+ }
963
+ };
964
+
965
+ _this.getErrorCorrectPolynomial = function(errorCorrectLength) {
966
+ let a = qrPolynomial([1], 0);
967
+ for (let i = 0; i < errorCorrectLength; i += 1) {
968
+ a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );
969
+ }
970
+ return a;
971
+ };
972
+
973
+ _this.getLengthInBits = function(mode, type) {
974
+
975
+ if (1 <= type && type < 10) {
976
+
977
+ // 1 - 9
978
+
979
+ switch(mode) {
980
+ case QRMode.MODE_NUMBER : return 10;
981
+ case QRMode.MODE_ALPHA_NUM : return 9;
982
+ case QRMode.MODE_8BIT_BYTE : return 8;
983
+ case QRMode.MODE_KANJI : return 8;
984
+ default :
985
+ throw 'mode:' + mode;
986
+ }
987
+
988
+ } else if (type < 27) {
989
+
990
+ // 10 - 26
991
+
992
+ switch(mode) {
993
+ case QRMode.MODE_NUMBER : return 12;
994
+ case QRMode.MODE_ALPHA_NUM : return 11;
995
+ case QRMode.MODE_8BIT_BYTE : return 16;
996
+ case QRMode.MODE_KANJI : return 10;
997
+ default :
998
+ throw 'mode:' + mode;
999
+ }
1000
+
1001
+ } else if (type < 41) {
1002
+
1003
+ // 27 - 40
1004
+
1005
+ switch(mode) {
1006
+ case QRMode.MODE_NUMBER : return 14;
1007
+ case QRMode.MODE_ALPHA_NUM : return 13;
1008
+ case QRMode.MODE_8BIT_BYTE : return 16;
1009
+ case QRMode.MODE_KANJI : return 12;
1010
+ default :
1011
+ throw 'mode:' + mode;
1012
+ }
1013
+
1014
+ } else {
1015
+ throw 'type:' + type;
1016
+ }
1017
+ };
1018
+
1019
+ _this.getLostPoint = function(qrcode) {
1020
+
1021
+ const moduleCount = qrcode.getModuleCount();
1022
+
1023
+ let lostPoint = 0;
1024
+
1025
+ // LEVEL1
1026
+
1027
+ for (let row = 0; row < moduleCount; row += 1) {
1028
+ for (let col = 0; col < moduleCount; col += 1) {
1029
+
1030
+ let sameCount = 0;
1031
+ const dark = qrcode.isDark(row, col);
1032
+
1033
+ for (let r = -1; r <= 1; r += 1) {
1034
+
1035
+ if (row + r < 0 || moduleCount <= row + r) {
1036
+ continue;
1037
+ }
1038
+
1039
+ for (let c = -1; c <= 1; c += 1) {
1040
+
1041
+ if (col + c < 0 || moduleCount <= col + c) {
1042
+ continue;
1043
+ }
1044
+
1045
+ if (r == 0 && c == 0) {
1046
+ continue;
1047
+ }
1048
+
1049
+ if (dark == qrcode.isDark(row + r, col + c) ) {
1050
+ sameCount += 1;
1051
+ }
1052
+ }
1053
+ }
1054
+
1055
+ if (sameCount > 5) {
1056
+ lostPoint += (3 + sameCount - 5);
1057
+ }
1058
+ }
1059
+ }
1060
+ // LEVEL2
1061
+
1062
+ for (let row = 0; row < moduleCount - 1; row += 1) {
1063
+ for (let col = 0; col < moduleCount - 1; col += 1) {
1064
+ let count = 0;
1065
+ if (qrcode.isDark(row, col) ) count += 1;
1066
+ if (qrcode.isDark(row + 1, col) ) count += 1;
1067
+ if (qrcode.isDark(row, col + 1) ) count += 1;
1068
+ if (qrcode.isDark(row + 1, col + 1) ) count += 1;
1069
+ if (count == 0 || count == 4) {
1070
+ lostPoint += 3;
1071
+ }
1072
+ }
1073
+ }
1074
+
1075
+ // LEVEL3
1076
+
1077
+ for (let row = 0; row < moduleCount; row += 1) {
1078
+ for (let col = 0; col < moduleCount - 6; col += 1) {
1079
+ if (qrcode.isDark(row, col)
1080
+ && !qrcode.isDark(row, col + 1)
1081
+ && qrcode.isDark(row, col + 2)
1082
+ && qrcode.isDark(row, col + 3)
1083
+ && qrcode.isDark(row, col + 4)
1084
+ && !qrcode.isDark(row, col + 5)
1085
+ && qrcode.isDark(row, col + 6) ) {
1086
+ lostPoint += 40;
1087
+ }
1088
+ }
1089
+ }
1090
+
1091
+ for (let col = 0; col < moduleCount; col += 1) {
1092
+ for (let row = 0; row < moduleCount - 6; row += 1) {
1093
+ if (qrcode.isDark(row, col)
1094
+ && !qrcode.isDark(row + 1, col)
1095
+ && qrcode.isDark(row + 2, col)
1096
+ && qrcode.isDark(row + 3, col)
1097
+ && qrcode.isDark(row + 4, col)
1098
+ && !qrcode.isDark(row + 5, col)
1099
+ && qrcode.isDark(row + 6, col) ) {
1100
+ lostPoint += 40;
1101
+ }
1102
+ }
1103
+ }
1104
+
1105
+ // LEVEL4
1106
+
1107
+ let darkCount = 0;
1108
+
1109
+ for (let col = 0; col < moduleCount; col += 1) {
1110
+ for (let row = 0; row < moduleCount; row += 1) {
1111
+ if (qrcode.isDark(row, col) ) {
1112
+ darkCount += 1;
1113
+ }
1114
+ }
1115
+ }
1116
+
1117
+ const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
1118
+ lostPoint += ratio * 10;
1119
+
1120
+ return lostPoint;
1121
+ };
1122
+
1123
+ return _this;
1124
+ }();
1125
+
1126
+ //---------------------------------------------------------------------
1127
+ // QRMath
1128
+ //---------------------------------------------------------------------
1129
+
1130
+ const QRMath = function() {
1131
+
1132
+ const EXP_TABLE = new Array(256);
1133
+ const LOG_TABLE = new Array(256);
1134
+
1135
+ // initialize tables
1136
+ for (let i = 0; i < 8; i += 1) {
1137
+ EXP_TABLE[i] = 1 << i;
1138
+ }
1139
+ for (let i = 8; i < 256; i += 1) {
1140
+ EXP_TABLE[i] = EXP_TABLE[i - 4]
1141
+ ^ EXP_TABLE[i - 5]
1142
+ ^ EXP_TABLE[i - 6]
1143
+ ^ EXP_TABLE[i - 8];
1144
+ }
1145
+ for (let i = 0; i < 255; i += 1) {
1146
+ LOG_TABLE[EXP_TABLE[i] ] = i;
1147
+ }
1148
+
1149
+ const _this = {};
1150
+
1151
+ _this.glog = function(n) {
1152
+
1153
+ if (n < 1) {
1154
+ throw 'glog(' + n + ')';
1155
+ }
1156
+
1157
+ return LOG_TABLE[n];
1158
+ };
1159
+
1160
+ _this.gexp = function(n) {
1161
+
1162
+ while (n < 0) {
1163
+ n += 255;
1164
+ }
1165
+
1166
+ while (n >= 256) {
1167
+ n -= 255;
1168
+ }
1169
+
1170
+ return EXP_TABLE[n];
1171
+ };
1172
+
1173
+ return _this;
1174
+ }();
1175
+
1176
+ //---------------------------------------------------------------------
1177
+ // qrPolynomial
1178
+ //---------------------------------------------------------------------
1179
+
1180
+ const qrPolynomial = function(num, shift) {
1181
+
1182
+ if (typeof num.length == 'undefined') {
1183
+ throw num.length + '/' + shift;
1184
+ }
1185
+
1186
+ const _num = function() {
1187
+ let offset = 0;
1188
+ while (offset < num.length && num[offset] == 0) {
1189
+ offset += 1;
1190
+ }
1191
+ const _num = new Array(num.length - offset + shift);
1192
+ for (let i = 0; i < num.length - offset; i += 1) {
1193
+ _num[i] = num[i + offset];
1194
+ }
1195
+ return _num;
1196
+ }();
1197
+
1198
+ const _this = {};
1199
+
1200
+ _this.getAt = function(index) {
1201
+ return _num[index];
1202
+ };
1203
+
1204
+ _this.getLength = function() {
1205
+ return _num.length;
1206
+ };
1207
+
1208
+ _this.multiply = function(e) {
1209
+
1210
+ const num = new Array(_this.getLength() + e.getLength() - 1);
1211
+
1212
+ for (let i = 0; i < _this.getLength(); i += 1) {
1213
+ for (let j = 0; j < e.getLength(); j += 1) {
1214
+ num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );
1215
+ }
1216
+ }
1217
+
1218
+ return qrPolynomial(num, 0);
1219
+ };
1220
+
1221
+ _this.mod = function(e) {
1222
+
1223
+ if (_this.getLength() - e.getLength() < 0) {
1224
+ return _this;
1225
+ }
1226
+
1227
+ const ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );
1228
+
1229
+ const num = new Array(_this.getLength() );
1230
+ for (let i = 0; i < _this.getLength(); i += 1) {
1231
+ num[i] = _this.getAt(i);
1232
+ }
1233
+
1234
+ for (let i = 0; i < e.getLength(); i += 1) {
1235
+ num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);
1236
+ }
1237
+
1238
+ // recursive call
1239
+ return qrPolynomial(num, 0).mod(e);
1240
+ };
1241
+
1242
+ return _this;
1243
+ };
1244
+
1245
+ //---------------------------------------------------------------------
1246
+ // QRRSBlock
1247
+ //---------------------------------------------------------------------
1248
+
1249
+ const QRRSBlock = function() {
1250
+
1251
+ const RS_BLOCK_TABLE = [
1252
+
1253
+ // L
1254
+ // M
1255
+ // Q
1256
+ // H
1257
+
1258
+ // 1
1259
+ [1, 26, 19],
1260
+ [1, 26, 16],
1261
+ [1, 26, 13],
1262
+ [1, 26, 9],
1263
+
1264
+ // 2
1265
+ [1, 44, 34],
1266
+ [1, 44, 28],
1267
+ [1, 44, 22],
1268
+ [1, 44, 16],
1269
+
1270
+ // 3
1271
+ [1, 70, 55],
1272
+ [1, 70, 44],
1273
+ [2, 35, 17],
1274
+ [2, 35, 13],
1275
+
1276
+ // 4
1277
+ [1, 100, 80],
1278
+ [2, 50, 32],
1279
+ [2, 50, 24],
1280
+ [4, 25, 9],
1281
+
1282
+ // 5
1283
+ [1, 134, 108],
1284
+ [2, 67, 43],
1285
+ [2, 33, 15, 2, 34, 16],
1286
+ [2, 33, 11, 2, 34, 12],
1287
+
1288
+ // 6
1289
+ [2, 86, 68],
1290
+ [4, 43, 27],
1291
+ [4, 43, 19],
1292
+ [4, 43, 15],
1293
+
1294
+ // 7
1295
+ [2, 98, 78],
1296
+ [4, 49, 31],
1297
+ [2, 32, 14, 4, 33, 15],
1298
+ [4, 39, 13, 1, 40, 14],
1299
+
1300
+ // 8
1301
+ [2, 121, 97],
1302
+ [2, 60, 38, 2, 61, 39],
1303
+ [4, 40, 18, 2, 41, 19],
1304
+ [4, 40, 14, 2, 41, 15],
1305
+
1306
+ // 9
1307
+ [2, 146, 116],
1308
+ [3, 58, 36, 2, 59, 37],
1309
+ [4, 36, 16, 4, 37, 17],
1310
+ [4, 36, 12, 4, 37, 13],
1311
+
1312
+ // 10
1313
+ [2, 86, 68, 2, 87, 69],
1314
+ [4, 69, 43, 1, 70, 44],
1315
+ [6, 43, 19, 2, 44, 20],
1316
+ [6, 43, 15, 2, 44, 16],
1317
+
1318
+ // 11
1319
+ [4, 101, 81],
1320
+ [1, 80, 50, 4, 81, 51],
1321
+ [4, 50, 22, 4, 51, 23],
1322
+ [3, 36, 12, 8, 37, 13],
1323
+
1324
+ // 12
1325
+ [2, 116, 92, 2, 117, 93],
1326
+ [6, 58, 36, 2, 59, 37],
1327
+ [4, 46, 20, 6, 47, 21],
1328
+ [7, 42, 14, 4, 43, 15],
1329
+
1330
+ // 13
1331
+ [4, 133, 107],
1332
+ [8, 59, 37, 1, 60, 38],
1333
+ [8, 44, 20, 4, 45, 21],
1334
+ [12, 33, 11, 4, 34, 12],
1335
+
1336
+ // 14
1337
+ [3, 145, 115, 1, 146, 116],
1338
+ [4, 64, 40, 5, 65, 41],
1339
+ [11, 36, 16, 5, 37, 17],
1340
+ [11, 36, 12, 5, 37, 13],
1341
+
1342
+ // 15
1343
+ [5, 109, 87, 1, 110, 88],
1344
+ [5, 65, 41, 5, 66, 42],
1345
+ [5, 54, 24, 7, 55, 25],
1346
+ [11, 36, 12, 7, 37, 13],
1347
+
1348
+ // 16
1349
+ [5, 122, 98, 1, 123, 99],
1350
+ [7, 73, 45, 3, 74, 46],
1351
+ [15, 43, 19, 2, 44, 20],
1352
+ [3, 45, 15, 13, 46, 16],
1353
+
1354
+ // 17
1355
+ [1, 135, 107, 5, 136, 108],
1356
+ [10, 74, 46, 1, 75, 47],
1357
+ [1, 50, 22, 15, 51, 23],
1358
+ [2, 42, 14, 17, 43, 15],
1359
+
1360
+ // 18
1361
+ [5, 150, 120, 1, 151, 121],
1362
+ [9, 69, 43, 4, 70, 44],
1363
+ [17, 50, 22, 1, 51, 23],
1364
+ [2, 42, 14, 19, 43, 15],
1365
+
1366
+ // 19
1367
+ [3, 141, 113, 4, 142, 114],
1368
+ [3, 70, 44, 11, 71, 45],
1369
+ [17, 47, 21, 4, 48, 22],
1370
+ [9, 39, 13, 16, 40, 14],
1371
+
1372
+ // 20
1373
+ [3, 135, 107, 5, 136, 108],
1374
+ [3, 67, 41, 13, 68, 42],
1375
+ [15, 54, 24, 5, 55, 25],
1376
+ [15, 43, 15, 10, 44, 16],
1377
+
1378
+ // 21
1379
+ [4, 144, 116, 4, 145, 117],
1380
+ [17, 68, 42],
1381
+ [17, 50, 22, 6, 51, 23],
1382
+ [19, 46, 16, 6, 47, 17],
1383
+
1384
+ // 22
1385
+ [2, 139, 111, 7, 140, 112],
1386
+ [17, 74, 46],
1387
+ [7, 54, 24, 16, 55, 25],
1388
+ [34, 37, 13],
1389
+
1390
+ // 23
1391
+ [4, 151, 121, 5, 152, 122],
1392
+ [4, 75, 47, 14, 76, 48],
1393
+ [11, 54, 24, 14, 55, 25],
1394
+ [16, 45, 15, 14, 46, 16],
1395
+
1396
+ // 24
1397
+ [6, 147, 117, 4, 148, 118],
1398
+ [6, 73, 45, 14, 74, 46],
1399
+ [11, 54, 24, 16, 55, 25],
1400
+ [30, 46, 16, 2, 47, 17],
1401
+
1402
+ // 25
1403
+ [8, 132, 106, 4, 133, 107],
1404
+ [8, 75, 47, 13, 76, 48],
1405
+ [7, 54, 24, 22, 55, 25],
1406
+ [22, 45, 15, 13, 46, 16],
1407
+
1408
+ // 26
1409
+ [10, 142, 114, 2, 143, 115],
1410
+ [19, 74, 46, 4, 75, 47],
1411
+ [28, 50, 22, 6, 51, 23],
1412
+ [33, 46, 16, 4, 47, 17],
1413
+
1414
+ // 27
1415
+ [8, 152, 122, 4, 153, 123],
1416
+ [22, 73, 45, 3, 74, 46],
1417
+ [8, 53, 23, 26, 54, 24],
1418
+ [12, 45, 15, 28, 46, 16],
1419
+
1420
+ // 28
1421
+ [3, 147, 117, 10, 148, 118],
1422
+ [3, 73, 45, 23, 74, 46],
1423
+ [4, 54, 24, 31, 55, 25],
1424
+ [11, 45, 15, 31, 46, 16],
1425
+
1426
+ // 29
1427
+ [7, 146, 116, 7, 147, 117],
1428
+ [21, 73, 45, 7, 74, 46],
1429
+ [1, 53, 23, 37, 54, 24],
1430
+ [19, 45, 15, 26, 46, 16],
1431
+
1432
+ // 30
1433
+ [5, 145, 115, 10, 146, 116],
1434
+ [19, 75, 47, 10, 76, 48],
1435
+ [15, 54, 24, 25, 55, 25],
1436
+ [23, 45, 15, 25, 46, 16],
1437
+
1438
+ // 31
1439
+ [13, 145, 115, 3, 146, 116],
1440
+ [2, 74, 46, 29, 75, 47],
1441
+ [42, 54, 24, 1, 55, 25],
1442
+ [23, 45, 15, 28, 46, 16],
1443
+
1444
+ // 32
1445
+ [17, 145, 115],
1446
+ [10, 74, 46, 23, 75, 47],
1447
+ [10, 54, 24, 35, 55, 25],
1448
+ [19, 45, 15, 35, 46, 16],
1449
+
1450
+ // 33
1451
+ [17, 145, 115, 1, 146, 116],
1452
+ [14, 74, 46, 21, 75, 47],
1453
+ [29, 54, 24, 19, 55, 25],
1454
+ [11, 45, 15, 46, 46, 16],
1455
+
1456
+ // 34
1457
+ [13, 145, 115, 6, 146, 116],
1458
+ [14, 74, 46, 23, 75, 47],
1459
+ [44, 54, 24, 7, 55, 25],
1460
+ [59, 46, 16, 1, 47, 17],
1461
+
1462
+ // 35
1463
+ [12, 151, 121, 7, 152, 122],
1464
+ [12, 75, 47, 26, 76, 48],
1465
+ [39, 54, 24, 14, 55, 25],
1466
+ [22, 45, 15, 41, 46, 16],
1467
+
1468
+ // 36
1469
+ [6, 151, 121, 14, 152, 122],
1470
+ [6, 75, 47, 34, 76, 48],
1471
+ [46, 54, 24, 10, 55, 25],
1472
+ [2, 45, 15, 64, 46, 16],
1473
+
1474
+ // 37
1475
+ [17, 152, 122, 4, 153, 123],
1476
+ [29, 74, 46, 14, 75, 47],
1477
+ [49, 54, 24, 10, 55, 25],
1478
+ [24, 45, 15, 46, 46, 16],
1479
+
1480
+ // 38
1481
+ [4, 152, 122, 18, 153, 123],
1482
+ [13, 74, 46, 32, 75, 47],
1483
+ [48, 54, 24, 14, 55, 25],
1484
+ [42, 45, 15, 32, 46, 16],
1485
+
1486
+ // 39
1487
+ [20, 147, 117, 4, 148, 118],
1488
+ [40, 75, 47, 7, 76, 48],
1489
+ [43, 54, 24, 22, 55, 25],
1490
+ [10, 45, 15, 67, 46, 16],
1491
+
1492
+ // 40
1493
+ [19, 148, 118, 6, 149, 119],
1494
+ [18, 75, 47, 31, 76, 48],
1495
+ [34, 54, 24, 34, 55, 25],
1496
+ [20, 45, 15, 61, 46, 16]
1497
+ ];
1498
+
1499
+ const qrRSBlock = function(totalCount, dataCount) {
1500
+ const _this = {};
1501
+ _this.totalCount = totalCount;
1502
+ _this.dataCount = dataCount;
1503
+ return _this;
1504
+ };
1505
+
1506
+ const _this = {};
1507
+
1508
+ const getRsBlockTable = function(typeNumber, errorCorrectionLevel) {
1509
+
1510
+ switch(errorCorrectionLevel) {
1511
+ case QRErrorCorrectionLevel.L :
1512
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
1513
+ case QRErrorCorrectionLevel.M :
1514
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
1515
+ case QRErrorCorrectionLevel.Q :
1516
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
1517
+ case QRErrorCorrectionLevel.H :
1518
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
1519
+ default :
1520
+ return undefined;
1521
+ }
1522
+ };
1523
+
1524
+ _this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
1525
+
1526
+ const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
1527
+
1528
+ if (typeof rsBlock == 'undefined') {
1529
+ throw 'bad rs block @ typeNumber:' + typeNumber +
1530
+ '/errorCorrectionLevel:' + errorCorrectionLevel;
1531
+ }
1532
+
1533
+ const length = rsBlock.length / 3;
1534
+
1535
+ const list = [];
1536
+
1537
+ for (let i = 0; i < length; i += 1) {
1538
+
1539
+ const count = rsBlock[i * 3 + 0];
1540
+ const totalCount = rsBlock[i * 3 + 1];
1541
+ const dataCount = rsBlock[i * 3 + 2];
1542
+
1543
+ for (let j = 0; j < count; j += 1) {
1544
+ list.push(qrRSBlock(totalCount, dataCount) );
1545
+ }
1546
+ }
1547
+
1548
+ return list;
1549
+ };
1550
+
1551
+ return _this;
1552
+ }();
1553
+
1554
+ //---------------------------------------------------------------------
1555
+ // qrBitBuffer
1556
+ //---------------------------------------------------------------------
1557
+
1558
+ const qrBitBuffer = function() {
1559
+
1560
+ const _buffer = [];
1561
+ let _length = 0;
1562
+
1563
+ const _this = {};
1564
+
1565
+ _this.getBuffer = function() {
1566
+ return _buffer;
1567
+ };
1568
+
1569
+ _this.getAt = function(index) {
1570
+ const bufIndex = Math.floor(index / 8);
1571
+ return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
1572
+ };
1573
+
1574
+ _this.put = function(num, length) {
1575
+ for (let i = 0; i < length; i += 1) {
1576
+ _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
1577
+ }
1578
+ };
1579
+
1580
+ _this.getLengthInBits = function() {
1581
+ return _length;
1582
+ };
1583
+
1584
+ _this.putBit = function(bit) {
1585
+
1586
+ const bufIndex = Math.floor(_length / 8);
1587
+ if (_buffer.length <= bufIndex) {
1588
+ _buffer.push(0);
1589
+ }
1590
+
1591
+ if (bit) {
1592
+ _buffer[bufIndex] |= (0x80 >>> (_length % 8) );
1593
+ }
1594
+
1595
+ _length += 1;
1596
+ };
1597
+
1598
+ return _this;
1599
+ };
1600
+
1601
+ //---------------------------------------------------------------------
1602
+ // qrNumber
1603
+ //---------------------------------------------------------------------
1604
+
1605
+ const qrNumber = function(data) {
1606
+
1607
+ const _mode = QRMode.MODE_NUMBER;
1608
+ const _data = data;
1609
+
1610
+ const _this = {};
1611
+
1612
+ _this.getMode = function() {
1613
+ return _mode;
1614
+ };
1615
+
1616
+ _this.getLength = function(buffer) {
1617
+ return _data.length;
1618
+ };
1619
+
1620
+ _this.write = function(buffer) {
1621
+
1622
+ const data = _data;
1623
+
1624
+ let i = 0;
1625
+
1626
+ while (i + 2 < data.length) {
1627
+ buffer.put(strToNum(data.substring(i, i + 3) ), 10);
1628
+ i += 3;
1629
+ }
1630
+
1631
+ if (i < data.length) {
1632
+ if (data.length - i == 1) {
1633
+ buffer.put(strToNum(data.substring(i, i + 1) ), 4);
1634
+ } else if (data.length - i == 2) {
1635
+ buffer.put(strToNum(data.substring(i, i + 2) ), 7);
1636
+ }
1637
+ }
1638
+ };
1639
+
1640
+ const strToNum = function(s) {
1641
+ let num = 0;
1642
+ for (let i = 0; i < s.length; i += 1) {
1643
+ num = num * 10 + chatToNum(s.charAt(i) );
1644
+ }
1645
+ return num;
1646
+ };
1647
+
1648
+ const chatToNum = function(c) {
1649
+ if ('0' <= c && c <= '9') {
1650
+ return c.charCodeAt(0) - '0'.charCodeAt(0);
1651
+ }
1652
+ throw 'illegal char :' + c;
1653
+ };
1654
+
1655
+ return _this;
1656
+ };
1657
+
1658
+ //---------------------------------------------------------------------
1659
+ // qrAlphaNum
1660
+ //---------------------------------------------------------------------
1661
+
1662
+ const qrAlphaNum = function(data) {
1663
+
1664
+ const _mode = QRMode.MODE_ALPHA_NUM;
1665
+ const _data = data;
1666
+
1667
+ const _this = {};
1668
+
1669
+ _this.getMode = function() {
1670
+ return _mode;
1671
+ };
1672
+
1673
+ _this.getLength = function(buffer) {
1674
+ return _data.length;
1675
+ };
1676
+
1677
+ _this.write = function(buffer) {
1678
+
1679
+ const s = _data;
1680
+
1681
+ let i = 0;
1682
+
1683
+ while (i + 1 < s.length) {
1684
+ buffer.put(
1685
+ getCode(s.charAt(i) ) * 45 +
1686
+ getCode(s.charAt(i + 1) ), 11);
1687
+ i += 2;
1688
+ }
1689
+
1690
+ if (i < s.length) {
1691
+ buffer.put(getCode(s.charAt(i) ), 6);
1692
+ }
1693
+ };
1694
+
1695
+ const getCode = function(c) {
1696
+
1697
+ if ('0' <= c && c <= '9') {
1698
+ return c.charCodeAt(0) - '0'.charCodeAt(0);
1699
+ } else if ('A' <= c && c <= 'Z') {
1700
+ return c.charCodeAt(0) - 'A'.charCodeAt(0) + 10;
1701
+ } else {
1702
+ switch (c) {
1703
+ case '\u0020' : return 36;
1704
+ case '$' : return 37;
1705
+ case '%' : return 38;
1706
+ case '*' : return 39;
1707
+ case '+' : return 40;
1708
+ case '-' : return 41;
1709
+ case '.' : return 42;
1710
+ case '/' : return 43;
1711
+ case ':' : return 44;
1712
+ default :
1713
+ throw 'illegal char :' + c;
1714
+ }
1715
+ }
1716
+ };
1717
+
1718
+ return _this;
1719
+ };
1720
+
1721
+ //---------------------------------------------------------------------
1722
+ // qr8BitByte
1723
+ //---------------------------------------------------------------------
1724
+
1725
+ const qr8BitByte = function(data) {
1726
+
1727
+ const _mode = QRMode.MODE_8BIT_BYTE;
1728
+ const _bytes = qrcode.stringToBytes(data);
1729
+
1730
+ const _this = {};
1731
+
1732
+ _this.getMode = function() {
1733
+ return _mode;
1734
+ };
1735
+
1736
+ _this.getLength = function(buffer) {
1737
+ return _bytes.length;
1738
+ };
1739
+
1740
+ _this.write = function(buffer) {
1741
+ for (let i = 0; i < _bytes.length; i += 1) {
1742
+ buffer.put(_bytes[i], 8);
1743
+ }
1744
+ };
1745
+
1746
+ return _this;
1747
+ };
1748
+
1749
+ //---------------------------------------------------------------------
1750
+ // qrKanji
1751
+ //---------------------------------------------------------------------
1752
+
1753
+ const qrKanji = function(data) {
1754
+
1755
+ const _mode = QRMode.MODE_KANJI;
1756
+
1757
+ const stringToBytes = qrcode.stringToBytes;
1758
+ !function(c, code) {
1759
+ // self test for sjis support.
1760
+ const test = stringToBytes(c);
1761
+ if (test.length != 2 || ( (test[0] << 8) | test[1]) != code) {
1762
+ throw 'sjis not supported.';
1763
+ }
1764
+ }('\u53cb', 0x9746);
1765
+
1766
+ const _bytes = stringToBytes(data);
1767
+
1768
+ const _this = {};
1769
+
1770
+ _this.getMode = function() {
1771
+ return _mode;
1772
+ };
1773
+
1774
+ _this.getLength = function(buffer) {
1775
+ return ~~(_bytes.length / 2);
1776
+ };
1777
+
1778
+ _this.write = function(buffer) {
1779
+
1780
+ const data = _bytes;
1781
+
1782
+ let i = 0;
1783
+
1784
+ while (i + 1 < data.length) {
1785
+
1786
+ let c = ( (0xff & data[i]) << 8) | (0xff & data[i + 1]);
1787
+
1788
+ if (0x8140 <= c && c <= 0x9FFC) {
1789
+ c -= 0x8140;
1790
+ } else if (0xE040 <= c && c <= 0xEBBF) {
1791
+ c -= 0xC140;
1792
+ } else {
1793
+ throw 'illegal char at ' + (i + 1) + '/' + c;
1794
+ }
1795
+
1796
+ c = ( (c >>> 8) & 0xff) * 0xC0 + (c & 0xff);
1797
+
1798
+ buffer.put(c, 13);
1799
+
1800
+ i += 2;
1801
+ }
1802
+
1803
+ if (i < data.length) {
1804
+ throw 'illegal char at ' + (i + 1);
1805
+ }
1806
+ };
1807
+
1808
+ return _this;
1809
+ };
1810
+
1811
+ //=====================================================================
1812
+ // GIF Support etc.
1813
+ //
1814
+
1815
+ //---------------------------------------------------------------------
1816
+ // byteArrayOutputStream
1817
+ //---------------------------------------------------------------------
1818
+
1819
+ const byteArrayOutputStream = function() {
1820
+
1821
+ const _bytes = [];
1822
+
1823
+ const _this = {};
1824
+
1825
+ _this.writeByte = function(b) {
1826
+ _bytes.push(b & 0xff);
1827
+ };
1828
+
1829
+ _this.writeShort = function(i) {
1830
+ _this.writeByte(i);
1831
+ _this.writeByte(i >>> 8);
1832
+ };
1833
+
1834
+ _this.writeBytes = function(b, off, len) {
1835
+ off = off || 0;
1836
+ len = len || b.length;
1837
+ for (let i = 0; i < len; i += 1) {
1838
+ _this.writeByte(b[i + off]);
1839
+ }
1840
+ };
1841
+
1842
+ _this.writeString = function(s) {
1843
+ for (let i = 0; i < s.length; i += 1) {
1844
+ _this.writeByte(s.charCodeAt(i) );
1845
+ }
1846
+ };
1847
+
1848
+ _this.toByteArray = function() {
1849
+ return _bytes;
1850
+ };
1851
+
1852
+ _this.toString = function() {
1853
+ let s = '';
1854
+ s += '[';
1855
+ for (let i = 0; i < _bytes.length; i += 1) {
1856
+ if (i > 0) {
1857
+ s += ',';
1858
+ }
1859
+ s += _bytes[i];
1860
+ }
1861
+ s += ']';
1862
+ return s;
1863
+ };
1864
+
1865
+ return _this;
1866
+ };
1867
+
1868
+ //---------------------------------------------------------------------
1869
+ // base64EncodeOutputStream
1870
+ //---------------------------------------------------------------------
1871
+
1872
+ const base64EncodeOutputStream = function() {
1873
+
1874
+ let _buffer = 0;
1875
+ let _buflen = 0;
1876
+ let _length = 0;
1877
+ let _base64 = '';
1878
+
1879
+ const _this = {};
1880
+
1881
+ const writeEncoded = function(b) {
1882
+ _base64 += String.fromCharCode(encode(b & 0x3f) );
1883
+ };
1884
+
1885
+ const encode = function(n) {
1886
+ if (n < 0) {
1887
+ throw 'n:' + n;
1888
+ } else if (n < 26) {
1889
+ return 0x41 + n;
1890
+ } else if (n < 52) {
1891
+ return 0x61 + (n - 26);
1892
+ } else if (n < 62) {
1893
+ return 0x30 + (n - 52);
1894
+ } else if (n == 62) {
1895
+ return 0x2b;
1896
+ } else if (n == 63) {
1897
+ return 0x2f;
1898
+ } else {
1899
+ throw 'n:' + n;
1900
+ }
1901
+ };
1902
+
1903
+ _this.writeByte = function(n) {
1904
+
1905
+ _buffer = (_buffer << 8) | (n & 0xff);
1906
+ _buflen += 8;
1907
+ _length += 1;
1908
+
1909
+ while (_buflen >= 6) {
1910
+ writeEncoded(_buffer >>> (_buflen - 6) );
1911
+ _buflen -= 6;
1912
+ }
1913
+ };
1914
+
1915
+ _this.flush = function() {
1916
+
1917
+ if (_buflen > 0) {
1918
+ writeEncoded(_buffer << (6 - _buflen) );
1919
+ _buffer = 0;
1920
+ _buflen = 0;
1921
+ }
1922
+
1923
+ if (_length % 3 != 0) {
1924
+ // padding
1925
+ const padlen = 3 - _length % 3;
1926
+ for (let i = 0; i < padlen; i += 1) {
1927
+ _base64 += '=';
1928
+ }
1929
+ }
1930
+ };
1931
+
1932
+ _this.toString = function() {
1933
+ return _base64;
1934
+ };
1935
+
1936
+ return _this;
1937
+ };
1938
+
1939
+ //---------------------------------------------------------------------
1940
+ // base64DecodeInputStream
1941
+ //---------------------------------------------------------------------
1942
+
1943
+ const base64DecodeInputStream = function(str) {
1944
+
1945
+ const _str = str;
1946
+ let _pos = 0;
1947
+ let _buffer = 0;
1948
+ let _buflen = 0;
1949
+
1950
+ const _this = {};
1951
+
1952
+ _this.read = function() {
1953
+
1954
+ while (_buflen < 8) {
1955
+
1956
+ if (_pos >= _str.length) {
1957
+ if (_buflen == 0) {
1958
+ return -1;
1959
+ }
1960
+ throw 'unexpected end of file./' + _buflen;
1961
+ }
1962
+
1963
+ const c = _str.charAt(_pos);
1964
+ _pos += 1;
1965
+
1966
+ if (c == '=') {
1967
+ _buflen = 0;
1968
+ return -1;
1969
+ } else if (c.match(/^\s$/) ) {
1970
+ // ignore if whitespace.
1971
+ continue;
1972
+ }
1973
+
1974
+ _buffer = (_buffer << 6) | decode(c.charCodeAt(0) );
1975
+ _buflen += 6;
1976
+ }
1977
+
1978
+ const n = (_buffer >>> (_buflen - 8) ) & 0xff;
1979
+ _buflen -= 8;
1980
+ return n;
1981
+ };
1982
+
1983
+ const decode = function(c) {
1984
+ if (0x41 <= c && c <= 0x5a) {
1985
+ return c - 0x41;
1986
+ } else if (0x61 <= c && c <= 0x7a) {
1987
+ return c - 0x61 + 26;
1988
+ } else if (0x30 <= c && c <= 0x39) {
1989
+ return c - 0x30 + 52;
1990
+ } else if (c == 0x2b) {
1991
+ return 62;
1992
+ } else if (c == 0x2f) {
1993
+ return 63;
1994
+ } else {
1995
+ throw 'c:' + c;
1996
+ }
1997
+ };
1998
+
1999
+ return _this;
2000
+ };
2001
+
2002
+ //---------------------------------------------------------------------
2003
+ // gifImage (B/W)
2004
+ //---------------------------------------------------------------------
2005
+
2006
+ const gifImage = function(width, height) {
2007
+
2008
+ const _width = width;
2009
+ const _height = height;
2010
+ const _data = new Array(width * height);
2011
+
2012
+ const _this = {};
2013
+
2014
+ _this.setPixel = function(x, y, pixel) {
2015
+ _data[y * _width + x] = pixel;
2016
+ };
2017
+
2018
+ _this.write = function(out) {
2019
+
2020
+ //---------------------------------
2021
+ // GIF Signature
2022
+
2023
+ out.writeString('GIF87a');
2024
+
2025
+ //---------------------------------
2026
+ // Screen Descriptor
2027
+
2028
+ out.writeShort(_width);
2029
+ out.writeShort(_height);
2030
+
2031
+ out.writeByte(0x80); // 2bit
2032
+ out.writeByte(0);
2033
+ out.writeByte(0);
2034
+
2035
+ //---------------------------------
2036
+ // Global Color Map
2037
+
2038
+ // black
2039
+ out.writeByte(0x00);
2040
+ out.writeByte(0x00);
2041
+ out.writeByte(0x00);
2042
+
2043
+ // white
2044
+ out.writeByte(0xff);
2045
+ out.writeByte(0xff);
2046
+ out.writeByte(0xff);
2047
+
2048
+ //---------------------------------
2049
+ // Image Descriptor
2050
+
2051
+ out.writeString(',');
2052
+ out.writeShort(0);
2053
+ out.writeShort(0);
2054
+ out.writeShort(_width);
2055
+ out.writeShort(_height);
2056
+ out.writeByte(0);
2057
+
2058
+ //---------------------------------
2059
+ // Local Color Map
2060
+
2061
+ //---------------------------------
2062
+ // Raster Data
2063
+
2064
+ const lzwMinCodeSize = 2;
2065
+ const raster = getLZWRaster(lzwMinCodeSize);
2066
+
2067
+ out.writeByte(lzwMinCodeSize);
2068
+
2069
+ let offset = 0;
2070
+
2071
+ while (raster.length - offset > 255) {
2072
+ out.writeByte(255);
2073
+ out.writeBytes(raster, offset, 255);
2074
+ offset += 255;
2075
+ }
2076
+
2077
+ out.writeByte(raster.length - offset);
2078
+ out.writeBytes(raster, offset, raster.length - offset);
2079
+ out.writeByte(0x00);
2080
+
2081
+ //---------------------------------
2082
+ // GIF Terminator
2083
+ out.writeString(';');
2084
+ };
2085
+
2086
+ const bitOutputStream = function(out) {
2087
+
2088
+ const _out = out;
2089
+ let _bitLength = 0;
2090
+ let _bitBuffer = 0;
2091
+
2092
+ const _this = {};
2093
+
2094
+ _this.write = function(data, length) {
2095
+
2096
+ if ( (data >>> length) != 0) {
2097
+ throw 'length over';
2098
+ }
2099
+
2100
+ while (_bitLength + length >= 8) {
2101
+ _out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) );
2102
+ length -= (8 - _bitLength);
2103
+ data >>>= (8 - _bitLength);
2104
+ _bitBuffer = 0;
2105
+ _bitLength = 0;
2106
+ }
2107
+
2108
+ _bitBuffer = (data << _bitLength) | _bitBuffer;
2109
+ _bitLength = _bitLength + length;
2110
+ };
2111
+
2112
+ _this.flush = function() {
2113
+ if (_bitLength > 0) {
2114
+ _out.writeByte(_bitBuffer);
2115
+ }
2116
+ };
2117
+
2118
+ return _this;
2119
+ };
2120
+
2121
+ const getLZWRaster = function(lzwMinCodeSize) {
2122
+
2123
+ const clearCode = 1 << lzwMinCodeSize;
2124
+ const endCode = (1 << lzwMinCodeSize) + 1;
2125
+ let bitLength = lzwMinCodeSize + 1;
2126
+
2127
+ // Setup LZWTable
2128
+ const table = lzwTable();
2129
+
2130
+ for (let i = 0; i < clearCode; i += 1) {
2131
+ table.add(String.fromCharCode(i) );
2132
+ }
2133
+ table.add(String.fromCharCode(clearCode) );
2134
+ table.add(String.fromCharCode(endCode) );
2135
+
2136
+ const byteOut = byteArrayOutputStream();
2137
+ const bitOut = bitOutputStream(byteOut);
2138
+
2139
+ // clear code
2140
+ bitOut.write(clearCode, bitLength);
2141
+
2142
+ let dataIndex = 0;
2143
+
2144
+ let s = String.fromCharCode(_data[dataIndex]);
2145
+ dataIndex += 1;
2146
+
2147
+ while (dataIndex < _data.length) {
2148
+
2149
+ const c = String.fromCharCode(_data[dataIndex]);
2150
+ dataIndex += 1;
2151
+
2152
+ if (table.contains(s + c) ) {
2153
+
2154
+ s = s + c;
2155
+
2156
+ } else {
2157
+
2158
+ bitOut.write(table.indexOf(s), bitLength);
2159
+
2160
+ if (table.size() < 0xfff) {
2161
+
2162
+ if (table.size() == (1 << bitLength) ) {
2163
+ bitLength += 1;
2164
+ }
2165
+
2166
+ table.add(s + c);
2167
+ }
2168
+
2169
+ s = c;
2170
+ }
2171
+ }
2172
+
2173
+ bitOut.write(table.indexOf(s), bitLength);
2174
+
2175
+ // end code
2176
+ bitOut.write(endCode, bitLength);
2177
+
2178
+ bitOut.flush();
2179
+
2180
+ return byteOut.toByteArray();
2181
+ };
2182
+
2183
+ const lzwTable = function() {
2184
+
2185
+ const _map = {};
2186
+ let _size = 0;
2187
+
2188
+ const _this = {};
2189
+
2190
+ _this.add = function(key) {
2191
+ if (_this.contains(key) ) {
2192
+ throw 'dup key:' + key;
2193
+ }
2194
+ _map[key] = _size;
2195
+ _size += 1;
2196
+ };
2197
+
2198
+ _this.size = function() {
2199
+ return _size;
2200
+ };
2201
+
2202
+ _this.indexOf = function(key) {
2203
+ return _map[key];
2204
+ };
2205
+
2206
+ _this.contains = function(key) {
2207
+ return typeof _map[key] != 'undefined';
2208
+ };
2209
+
2210
+ return _this;
2211
+ };
2212
+
2213
+ return _this;
2214
+ };
2215
+
2216
+ const createDataURL = function(width, height, getPixel) {
2217
+ const gif = gifImage(width, height);
2218
+ for (let y = 0; y < height; y += 1) {
2219
+ for (let x = 0; x < width; x += 1) {
2220
+ gif.setPixel(x, y, getPixel(x, y) );
2221
+ }
2222
+ }
2223
+
2224
+ const b = byteArrayOutputStream();
2225
+ gif.write(b);
2226
+
2227
+ const base64 = base64EncodeOutputStream();
2228
+ const bytes = b.toByteArray();
2229
+ for (let i = 0; i < bytes.length; i += 1) {
2230
+ base64.writeByte(bytes[i]);
2231
+ }
2232
+ base64.flush();
2233
+
2234
+ return 'data:image/gif;base64,' + base64;
2235
+ };
2236
+
2237
+ qrcode.stringToBytes;
2238
+
2239
+ exports.default = qrcode;
2240
+ exports.qrcode = qrcode;