@smallwei/avue 3.9.2 → 3.9.3

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