From 4cdbca900723af19961f218f2ecae89a1ed859b2 Mon Sep 17 00:00:00 2001 From: nuintun Date: Thu, 29 Feb 2024 10:59:17 +0800 Subject: [PATCH] feat: Update examples --- packages/examples/static/index.html | 2 +- .../static/public/js/7305743b7b3bab2d.js | 201 ++++++++++++++++++ ...4e9504632b8c322.js => 9b795fc345d6ec85.js} | 2 +- .../static/public/js/fe7d95d8b937dcd6.js | 201 ------------------ 4 files changed, 203 insertions(+), 203 deletions(-) create mode 100644 packages/examples/static/public/js/7305743b7b3bab2d.js rename packages/examples/static/public/js/{f4e9504632b8c322.js => 9b795fc345d6ec85.js} (98%) delete mode 100644 packages/examples/static/public/js/fe7d95d8b937dcd6.js diff --git a/packages/examples/static/index.html b/packages/examples/static/index.html index 326f6fd5..f8a51f25 100644 --- a/packages/examples/static/index.html +++ b/packages/examples/static/index.html @@ -1 +1 @@ -二维码
\ No newline at end of file +二维码
\ No newline at end of file diff --git a/packages/examples/static/public/js/7305743b7b3bab2d.js b/packages/examples/static/public/js/7305743b7b3bab2d.js new file mode 100644 index 00000000..4ec2dd9c --- /dev/null +++ b/packages/examples/static/public/js/7305743b7b3bab2d.js @@ -0,0 +1,201 @@ +!function(){"use strict";/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let e=new Map;class t{#e;#t;static TERMINATOR=new t([0,0,0],0);static NUMERIC=new t([10,12,14],1);static ALPHANUMERIC=new t([9,11,13],2);static STRUCTURED_APPEND=new t([0,0,0],3);static BYTE=new t([8,16,16],4);static ECI=new t([0,0,0],7);static KANJI=new t([8,10,12],8);static FNC1_FIRST_POSITION=new t([0,0,0],5);static FNC1_SECOND_POSITION=new t([0,0,0],9);static HANZI=new t([8,10,12],13);constructor(t,n){this.#e=n,this.#t=new Int32Array(t),e.set(n,this)}get bits(){return this.#e}getCharacterCountBits(e){let t,{version:n}=e;return t=n<=9?0:n<=26?1:2,this.#t[t]}}function n(e){return 32-Math.clz32(e)}function r(e,t){let r=n(t);for(e<<=r-1;n(e)>=r;)e^=t<32*t.length){let n=w(Math.ceil(e/.75));n.set(t),this.#e=n}this.#n=e}get length(){return this.#n}get byteLength(){return Math.ceil(this.#n/8)}set(e){this.#e[0|e/32]|=1<<(31&e)}get(e){return this.#e[0|e/32]>>>(31&e)&1}xor(e){let t=this.#e,n=e.#e,r=Math.min(this.#n,e.#n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:1,n=this.#n;if(e instanceof i){t=e.#n,this.#r(n+t);for(let r=0;r=0;r--)e>>>r&1&&this.set(n),n++}}toUint8Array(e,t,n,r){for(let w=0;w + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let s=new Map;class o{#w;#i;static CP437=new o("cp437",0,2);static ISO_8859_1=new o("iso-8859-1",1,3);static ISO_8859_2=new o("iso-8859-2",4);static ISO_8859_3=new o("iso-8859-3",5);static ISO_8859_4=new o("iso-8859-4",6);static ISO_8859_5=new o("iso-8859-5",7);static ISO_8859_6=new o("iso-8859-6",8);static ISO_8859_7=new o("iso-8859-7",9);static ISO_8859_8=new o("iso-8859-8",10);static ISO_8859_9=new o("iso-8859-9",11);static ISO_8859_10=new o("iso-8859-10",12);static ISO_8859_11=new o("iso-8859-11",13);static ISO_8859_13=new o("iso-8859-13",15);static ISO_8859_14=new o("iso-8859-14",16);static ISO_8859_15=new o("iso-8859-15",17);static ISO_8859_16=new o("iso-8859-16",18);static SJIS=new o("sjis",20);static CP1250=new o("cp1250",21);static CP1251=new o("cp1251",22);static CP1252=new o("cp1252",23);static CP1256=new o("cp1256",24);static UTF_16BE=new o("utf-16be",25);static UTF_8=new o("utf-8",26);static ASCII=new o("ascii",27,170);static BIG5=new o("big5",28);static GB18030=new o("gb18030",29);static EUC_KR=new o("euc-kr",30);constructor(e,...t){for(let n of(this.#w=e,this.#i=t,t))s.set(n,this)}get label(){return this.#w}get values(){return this.#i}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */function l(e){if(!e)throw Error("segment content should be at least 1 character")}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */function a(e,t){let n=[];for(let r of e){let e=r.charCodeAt(0);n.push(e>t?63:e)}return new Uint8Array(n)}function c(e,t){switch(t){case o.ASCII:return a(e,127);case o.ISO_8859_1:return a(e,255);case o.UTF_8:return new TextEncoder().encode(e);default:throw Error("built-in encode only support ascii, utf-8 and iso-8859-1 charset")}}let h="0123456789",u=`${h}ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;function f(e){let t=0,n=new Map;for(let r of e)n.set(r,t++);return n}function g(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r>8,255&n),i.push(n);let{length:l}=i,a=o.decode(new Uint8Array(w));for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:256,w=n.length-1,i=[];for(let s=e;s + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let p=f(h);function b(e){let t=p.get(e);if(null!=t)return t;throw Error(`illegal numeric character: ${e}`)}class y{#s;constructor(e){l(e),this.#s=e}get mode(){return t.NUMERIC}get content(){return this.#s}encode(){let e=new i,t=this.#s,{length:n}=t;for(let r=0;r + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let I=f(u);function m(e){let t=I.get(e);if(null!=t)return t;throw Error(`illegal alphanumeric character: ${e}`)}class C{#s;constructor(e){l(e),this.#s=e}get mode(){return t.ALPHANUMERIC}get content(){return this.#s}encode(){let e=new i,t=this.#s,{length:n}=t;for(let r=0;r + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let A=g("gb2312",[41377,41470],[41649,41698],[41701,41710],[41713,41724],[41889,41982],[42145,42227],[42401,42486],[42657,42680],[42689,42712],[42913,42945],[42961,42993],[43169,43194],[43205,43241],[43428,43503],...d(45217,55038,[0,93]),[55201,55289],...d(55457,63486,[0,93]));class _{#s;constructor(e){l(e),this.#s=e}get mode(){return t.HANZI}get content(){return this.#s}encode(){let e=new i;for(let t of this.#s){let n=function(e){let t=A.get(e);return null!=t?t:NaN}(t);if(n>=41377&&n<=43774)n-=41377;else if(n>=45217&&n<=64254)n-=42657;else throw Error(`illegal hanzi character: ${t}`);n=(n>>8)*96+(255&n),e.append(n,13)}return e}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let E=g("shift-jis",[33088,33150],[33152,33196],[33208,33215],[33224,33230],[33242,33256],[33264,33271],[33276,33276],[33359,33368],[33376,33401],[33409,33434],[33439,33521],[33600,33662],[33664,33686],[33695,33718],[33727,33750],[33856,33888],[33904,33918],[33920,33937],[33951,33982],[34975,35068],...d(35136,38908,[0,62,64,188]),[38976,39026],[39071,39164],...d(39232,40956,[0,62,64,188]),...d(57408,59900,[0,62,64,188]),[59968,60030],[60032,60068]);class B{#s;constructor(e){l(e),this.#s=e}get mode(){return t.KANJI}get content(){return this.#s}encode(){let e=new i;for(let t of this.#s){let n=function(e){let t=E.get(e);return null!=t?t:NaN}(t);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`illegal kanji character: ${t}`);n=(n>>8)*192+(255&n),e.append(n,13)}return e}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class S{#s;#o;constructor(e,t=o.ISO_8859_1){l(e),function(e){if(!(e instanceof o))throw Error("illegal charset")}(t),this.#s=e,this.#o=t}get mode(){return t.BYTE}get content(){return this.#s}get charset(){return this.#o}encode(e){let t=new i;for(let n of e(this.#s,this.#o))t.append(n,8);return t}}function v(e,t,n){return 1===e.get(t,n)}function T(e,t){let n=0,{size:r}=e;for(let w=0;w=5&&(n+=3+(s-5)),i=r,s=1)}s>=5&&(n+=3+(s-5))}return n}function M(e,t,n,r,w){if(n<0||r>e.size)return!1;for(let i=n;i + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class O{#l;#a;constructor(e){this.#l=e,this.#a=new Int8Array(e*e)}get size(){return this.#l}set(e,t,n){this.#a[t*this.#l+e]=n}get(e,t){return this.#a[t*this.#l+e]}clear(e){this.#a.fill(e)}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class k{#c;#h;constructor(e,t){this.#c=e,this.#h=t}get count(){return this.#c}get numDataCodewords(){return this.#h}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class N{#u;#f;#g;#d;#p;constructor(e,...t){let n=0,r=0;for(let{count:e,numDataCodewords:w}of t)n+=e,r+=w*e;let w=e*n;this.#u=t,this.#g=w,this.#d=r,this.#p=e,this.#f=r+w}get ecBlocks(){return this.#u}get numTotalCodewords(){return this.#f}get numTotalECCodewords(){return this.#g}get numTotalDataCodewords(){return this.#d}get numECCodewordsPerBlock(){return this.#p}}class D{#l;#b;#u;#y;constructor(e,t,...n){this.#b=e,this.#u=n,this.#l=17+4*e,this.#y=t}get size(){return this.#l}get version(){return this.#b}get alignmentPatterns(){return this.#y}getECBlocks(e){let{level:t}=e;return this.#u[t]}}let x=[new D(1,[],new N(7,new k(1,19)),new N(10,new k(1,16)),new N(13,new k(1,13)),new N(17,new k(1,9))),new D(2,[6,18],new N(10,new k(1,34)),new N(16,new k(1,28)),new N(22,new k(1,22)),new N(28,new k(1,16))),new D(3,[6,22],new N(15,new k(1,55)),new N(26,new k(1,44)),new N(18,new k(2,17)),new N(22,new k(2,13))),new D(4,[6,26],new N(20,new k(1,80)),new N(18,new k(2,32)),new N(26,new k(2,24)),new N(16,new k(4,9))),new D(5,[6,30],new N(26,new k(1,108)),new N(24,new k(2,43)),new N(18,new k(2,15),new k(2,16)),new N(22,new k(2,11),new k(2,12))),new D(6,[6,34],new N(18,new k(2,68)),new N(16,new k(4,27)),new N(24,new k(4,19)),new N(28,new k(4,15))),new D(7,[6,22,38],new N(20,new k(2,78)),new N(18,new k(4,31)),new N(18,new k(2,14),new k(4,15)),new N(26,new k(4,13),new k(1,14))),new D(8,[6,24,42],new N(24,new k(2,97)),new N(22,new k(2,38),new k(2,39)),new N(22,new k(4,18),new k(2,19)),new N(26,new k(4,14),new k(2,15))),new D(9,[6,26,46],new N(30,new k(2,116)),new N(22,new k(3,36),new k(2,37)),new N(20,new k(4,16),new k(4,17)),new N(24,new k(4,12),new k(4,13))),new D(10,[6,28,50],new N(18,new k(2,68),new k(2,69)),new N(26,new k(4,43),new k(1,44)),new N(24,new k(6,19),new k(2,20)),new N(28,new k(6,15),new k(2,16))),new D(11,[6,30,54],new N(20,new k(4,81)),new N(30,new k(1,50),new k(4,51)),new N(28,new k(4,22),new k(4,23)),new N(24,new k(3,12),new k(8,13))),new D(12,[6,32,58],new N(24,new k(2,92),new k(2,93)),new N(22,new k(6,36),new k(2,37)),new N(26,new k(4,20),new k(6,21)),new N(28,new k(7,14),new k(4,15))),new D(13,[6,34,62],new N(26,new k(4,107)),new N(22,new k(8,37),new k(1,38)),new N(24,new k(8,20),new k(4,21)),new N(22,new k(12,11),new k(4,12))),new D(14,[6,26,46,66],new N(30,new k(3,115),new k(1,116)),new N(24,new k(4,40),new k(5,41)),new N(20,new k(11,16),new k(5,17)),new N(24,new k(11,12),new k(5,13))),new D(15,[6,26,48,70],new N(22,new k(5,87),new k(1,88)),new N(24,new k(5,41),new k(5,42)),new N(30,new k(5,24),new k(7,25)),new N(24,new k(11,12),new k(7,13))),new D(16,[6,26,50,74],new N(24,new k(5,98),new k(1,99)),new N(28,new k(7,45),new k(3,46)),new N(24,new k(15,19),new k(2,20)),new N(30,new k(3,15),new k(13,16))),new D(17,[6,30,54,78],new N(28,new k(1,107),new k(5,108)),new N(28,new k(10,46),new k(1,47)),new N(28,new k(1,22),new k(15,23)),new N(28,new k(2,14),new k(17,15))),new D(18,[6,30,56,82],new N(30,new k(5,120),new k(1,121)),new N(26,new k(9,43),new k(4,44)),new N(28,new k(17,22),new k(1,23)),new N(28,new k(2,14),new k(19,15))),new D(19,[6,30,58,86],new N(28,new k(3,113),new k(4,114)),new N(26,new k(3,44),new k(11,45)),new N(26,new k(17,21),new k(4,22)),new N(26,new k(9,13),new k(16,14))),new D(20,[6,34,62,90],new N(28,new k(3,107),new k(5,108)),new N(26,new k(3,41),new k(13,42)),new N(30,new k(15,24),new k(5,25)),new N(28,new k(15,15),new k(10,16))),new D(21,[6,28,50,72,94],new N(28,new k(4,116),new k(4,117)),new N(26,new k(17,42)),new N(28,new k(17,22),new k(6,23)),new N(30,new k(19,16),new k(6,17))),new D(22,[6,26,50,74,98],new N(28,new k(2,111),new k(7,112)),new N(28,new k(17,46)),new N(30,new k(7,24),new k(16,25)),new N(24,new k(34,13))),new D(23,[6,30,54,78,102],new N(30,new k(4,121),new k(5,122)),new N(28,new k(4,47),new k(14,48)),new N(30,new k(11,24),new k(14,25)),new N(30,new k(16,15),new k(14,16))),new D(24,[6,28,54,80,106],new N(30,new k(6,117),new k(4,118)),new N(28,new k(6,45),new k(14,46)),new N(30,new k(11,24),new k(16,25)),new N(30,new k(30,16),new k(2,17))),new D(25,[6,32,58,84,110],new N(26,new k(8,106),new k(4,107)),new N(28,new k(8,47),new k(13,48)),new N(30,new k(7,24),new k(22,25)),new N(30,new k(22,15),new k(13,16))),new D(26,[6,30,58,86,114],new N(28,new k(10,114),new k(2,115)),new N(28,new k(19,46),new k(4,47)),new N(28,new k(28,22),new k(6,23)),new N(30,new k(33,16),new k(4,17))),new D(27,[6,34,62,90,118],new N(30,new k(8,122),new k(4,123)),new N(28,new k(22,45),new k(3,46)),new N(30,new k(8,23),new k(26,24)),new N(30,new k(12,15),new k(28,16))),new D(28,[6,26,50,74,98,122],new N(30,new k(3,117),new k(10,118)),new N(28,new k(3,45),new k(23,46)),new N(30,new k(4,24),new k(31,25)),new N(30,new k(11,15),new k(31,16))),new D(29,[6,30,54,78,102,126],new N(30,new k(7,116),new k(7,117)),new N(28,new k(21,45),new k(7,46)),new N(30,new k(1,23),new k(37,24)),new N(30,new k(19,15),new k(26,16))),new D(30,[6,26,52,78,104,130],new N(30,new k(5,115),new k(10,116)),new N(28,new k(19,47),new k(10,48)),new N(30,new k(15,24),new k(25,25)),new N(30,new k(23,15),new k(25,16))),new D(31,[6,30,56,82,108,134],new N(30,new k(13,115),new k(3,116)),new N(28,new k(2,46),new k(29,47)),new N(30,new k(42,24),new k(1,25)),new N(30,new k(23,15),new k(28,16))),new D(32,[6,34,60,86,112,138],new N(30,new k(17,115)),new N(28,new k(10,46),new k(23,47)),new N(30,new k(10,24),new k(35,25)),new N(30,new k(19,15),new k(35,16))),new D(33,[6,30,58,86,114,142],new N(30,new k(17,115),new k(1,116)),new N(28,new k(14,46),new k(21,47)),new N(30,new k(29,24),new k(19,25)),new N(30,new k(11,15),new k(46,16))),new D(34,[6,34,62,90,118,146],new N(30,new k(13,115),new k(6,116)),new N(28,new k(14,46),new k(23,47)),new N(30,new k(44,24),new k(7,25)),new N(30,new k(59,16),new k(1,17))),new D(35,[6,30,54,78,102,126,150],new N(30,new k(12,121),new k(7,122)),new N(28,new k(12,47),new k(26,48)),new N(30,new k(39,24),new k(14,25)),new N(30,new k(22,15),new k(41,16))),new D(36,[6,24,50,76,102,128,154],new N(30,new k(6,121),new k(14,122)),new N(28,new k(6,47),new k(34,48)),new N(30,new k(46,24),new k(10,25)),new N(30,new k(2,15),new k(64,16))),new D(37,[6,28,54,80,106,132,158],new N(30,new k(17,122),new k(4,123)),new N(28,new k(29,46),new k(14,47)),new N(30,new k(49,24),new k(10,25)),new N(30,new k(24,15),new k(46,16))),new D(38,[6,32,58,84,110,136,162],new N(30,new k(4,122),new k(18,123)),new N(28,new k(13,46),new k(32,47)),new N(30,new k(48,24),new k(14,25)),new N(30,new k(42,15),new k(32,16))),new D(39,[6,26,54,82,110,138,166],new N(30,new k(20,117),new k(4,118)),new N(28,new k(40,47),new k(7,48)),new N(30,new k(43,24),new k(22,25)),new N(30,new k(10,15),new k(67,16))),new D(40,[6,30,58,86,114,142,170],new N(30,new k(19,118),new k(6,119)),new N(28,new k(18,47),new k(31,48)),new N(30,new k(34,24),new k(34,25)),new N(30,new k(20,15),new k(61,16)))],P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,1,1,1,0,1],[1,0,1,1,1,0,1],[1,0,1,1,1,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],U=[[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]],R=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function L(e,t,n){return -1===e.get(t,n)}function $(e,t,n){for(let r=0;r<7;r++){let w=P[r];for(let i=0;i<7;i++)e.set(t+i,n+r,w[i])}}function Z(e,t,n){for(let r=0;r<8;r++)e.set(t+r,n,0)}function F(e,t,n){for(let r=0;r<7;r++)e.set(t,n+r,0)}function H(e,t,n,w){let s=new O(t.size);return s.clear(-1),!function(e){let{size:t}=e;$(e,0,0),$(e,t-7,0),$(e,0,t-7),Z(e,0,7),Z(e,t-8,7),Z(e,0,t-8),F(e,7,0),F(e,t-7-1,0),F(e,7,t-7)}(s),function(e,t){let{version:n}=t;if(n>=2){let{alignmentPatterns:t}=x[n-1],{length:r}=t;for(let n=0;n=7){let t=new i;!function(e,t){e.append(t,6);let n=r(t,7973);e.append(n,12)}(t,n);let w=17,{size:s}=e;for(let n=0;n<6;n++)for(let r=0;r<3;r++){let i=t.get(w--);e.set(n,s-11+r,i),e.set(s-11+r,n,i)}}}(s,t),function(e,t,n){let r=0,{size:w}=e,{length:i}=t;for(let s=w-1;s>=1;s-=2){6===s&&(s=5);for(let o=0;o + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class G{#I;#m;constructor(e,t){this.#I=t,this.#m=e}get ecCodewords(){return this.#I}get dataCodewords(){return this.#m}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class K{#C;#A;constructor(e,t){let{length:n}=t;if(n<=0)throw Error("polynomial coefficients cannot empty");if(this.#C=e,n>1&&0===t[0]){let e=1;for(;e=e.getDegree()&&!r.isZero();){let w=r.getDegree(),s=w-e.getDegree(),o=t.multiply(r.getCoefficient(w),i),l=e.multiplyByMonomial(s,o),a=t.buildPolynomial(s,o);n=n.addOrSubtract(a),r=r.addOrSubtract(l)}return[n,r]}}let j=new /** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class{#l;#_;#E;#B;#S;#v;constructor(e,t,n){let r=1,w=new Int32Array(t);for(let n=0;n=t&&(r^=e,r&=t-1);let i=new Int32Array(t);for(let e=0,n=t-1;e + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */function(e,t,n){let{length:r}=t;if(n>=r){let{generator:w}=e,i=t[r-1];for(let s=r;s<=n;s++){let n=new Int32Array([1,e.exp(s-1+w)]),r=i.multiply(new K(e,n));t.push(r),i=r}}return t[n]}(this.#C,this.#T,t);r.set(e.subarray(0,n));let[,i]=new K(this.#C,r).multiplyByMonomial(t,1).divide(w),{coefficients:s}=i,o=n+(t-s.length);e.fill(0,n,o),e.set(s,o)}}function Q(e){return e.mode===t.BYTE}function Y(e,t){e.append(t.bits,4)}function q(e,t,n){return t.getECBlocks(n).numTotalDataCodewords>=Math.ceil(e/8)}function V(e,t){for(let n of x)if(q(e,n,t))return n;throw Error("data too big for all versions")}function W(e,t){let n=0;for(let{mode:r,head:w,data:i}of e)n+=w.length+r.getCharacterCountBits(t)+i.length;return n}class X{#M;#z;#e;#O;#l;#k;#N;constructor(e){let t=1<4095)return!1;this.#N.set(e<<8|t,n++);let r=this.#e,w=this.#l;return n>w&&(w=1<<++r),this.#e=r,this.#l=w,this.#k=n,!0}get(e,t){return this.#N.get(e<<8|t)}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class ee{#e=0;#D;#x=0;#a=[];constructor(e){this.#D=e}write(e){let t=this.#e,n=this.#x|e<=8;)r.push(255&n),n>>=8,t-=8;this.#e=t,this.#x=n}pipe(e){let t=this.#a;this.#e>0&&t.push(this.#x),e.writeByte(this.#D.depth);let{length:n}=t;for(let r=0;r=255?(e.writeByte(255),e.writeBytes(t,r,255),r+=255):(e.writeByte(w),e.writeBytes(t,r,w),r=n)}e.writeByte(0)}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class et{#a=[];get bytes(){return this.#a}writeByte(e){this.#a.push(255&e)}writeInt16(e){this.#a.push(255&e,e>>8&255)}writeBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=this.#a;for(let w=0;w + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let{fromCharCode:en}=String;function er(e){if((e&=63)>=0){if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(62===e)return 43;else if(63===e)return 47}throw Error(`illegal char: ${en(e)}`)}class ew{#e=0;#x=0;#n=0;#P=new et;get bytes(){return this.#P.bytes}write(e){let t=this.#e+8,n=this.#P,r=this.#x<<8|255&e;for(;t>=6;)n.writeByte(er(r>>>t-6)),t-=6;this.#n++,this.#e=t,this.#x=r}close(){let e=this.#e,t=this.#P;e>0&&(t.writeByte(er(this.#x<<6-e)),this.#e=0,this.#x=0);let n=this.#n;if(n%3!=0){let e=3-n%3;for(let n=0;n + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class ei{#U;#R;#L;#$;#Z=[];constructor(e,t,{foreground:n=[0,0,0],background:r=[255,255,255]}={}){this.#U=e,this.#R=t,this.#L=n,this.#$=r}#F(){let e=this.#U,t=this.#R,n=new et,r=this.#$,w=this.#L;return n.writeBytes([71,73,70,56,57,97]),n.writeInt16(e),n.writeInt16(t),n.writeBytes([128,0,0]),n.writeBytes([r[0],r[1],r[2]]),n.writeBytes([w[0],w[1],w[2]]),n.writeByte(44),n.writeInt16(0),n.writeInt16(0),n.writeInt16(e),n.writeInt16(t),n.writeByte(0),!/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */function(e,t,n){let r=new X(2),w=new ee(r);if(w.write(r.bof),e.length>0){let t=e[0],{length:n}=e;for(let i=1;i + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class es{#H;#G;#b;#K;constructor(e,t,n,r){this.#H=r,this.#G=n,this.#K=e,this.#b=t}get size(){return this.#K.size}get mask(){return this.#H}get level(){return this.#G.name}get version(){return this.#b.version}get(e,t){let{size:n}=this.#K;if(e<0||t<0||e>=n||t>=n)throw Error(`illegal coordinate: [${e}, ${t}]`);return this.#K.get(e,t)}toDataURL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2,{margin:t=4*e,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Math.max(1,e>>0),t=Math.max(0,t>>0);let r=this.#K,w=e*r.size+2*t,i=new ei(w,w,n),s=w-t;for(let n=0;n=t&&o=t&&n + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */let eo=new Map;class el{#j;#e;#G;static L=new el("L",0,1);static M=new el("M",1,0);static Q=new el("Q",2,3);static H=new el("H",3,2);constructor(e,t,n){this.#e=n,this.#j=e,this.#G=t,eo.set(n,this)}get bits(){return this.#e}get name(){return this.#j}get level(){return this.#G}}/** + * @module QRCode + * @package @nuintun/qrcode + * @license MIT + * @version 4.0.0 + * @author nuintun + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */class ea{#J;#G;#F;#b;constructor({hints:e={},level:t="L",version:n="Auto",encode:r=c}={}){!function(e){let{fnc1:t}=e;if(null!=t){let[e]=t;if("GS1"!==e&&"AIM"!==e)throw Error("illegal fn1 hint");if("AIM"===e){let[,e]=t;if(e<0||e>255||!Number.isInteger(e))throw Error("illegal fn1 application indicator")}}}(e),function(e){if(0>["L","M","Q","H"].indexOf(e))throw Error("illegal error correction level")}(t),function(e){if("Auto"!==e&&(e<1||e>40||!Number.isInteger(e)))throw Error("illegal version")}(n),this.#J=e,this.#F=r,this.#b=n,this.#G=el[t]}encode(){let e;for(var n=arguments.length,r=Array(n),w=0;w0)for(let t=r;t<8;t++)e.append(0);let w=t-e.byteLength;for(let t=0;t + * @description A pure JavaScript QRCode encode and decode library. + * @see https://github.com/nuintun/qrcode#readme + */function(e,t){let n=e.length,r=new Int32Array(n+t);return r.set(e),new J().encode(r,t),new Uint8Array(r.subarray(n))}(t,r);l.push(new G(t,n)),o+=i,w=Math.max(w,n.length),s=Math.max(s,i)}let a=new i;for(let e=0;e>16&255,t>>8&255,255&t]}self.addEventListener("message",e=>{let{data:t}=e,{level:n,version:r}=t,w=new ea({level:n,version:r,hints:function(e){let{fnc1:t,aimIndicator:n}=e;switch(t){case"GS1":return{fnc1:["GS1"]};case"AIM":return{fnc1:["AIM",+n]}}}(t)});try{let e=w.encode(function(e){let{mode:t,content:n,charset:r}=e;switch(t){case"Auto":if(/^\d+$/.test(n))return new y(n);if(/^[0-9A-Z$%*+-./: ]+$/.test(n))return new C(n);let w=new _(n);try{return w.encode(),w}catch{}let i=new B(n);try{return i.encode(),i}catch{}return new S(n,o[r]);case"Hanzi":return new _(n);case"Kanji":return new B(n);case"Numeric":return new y(n);case"Alphanumeric":return new C(n);default:return new S(n,o[r])}}(t)),{moduleSize:n,quietZone:r,background:i,foreground:s}=t,l={type:"ok",payload:e.toDataURL(n,{margin:r,background:ec(i),foreground:ec(s)})};self.postMessage(l)}catch(t){let e={type:"error",message:t.message};self.postMessage(e)}})}(); \ No newline at end of file diff --git a/packages/examples/static/public/js/f4e9504632b8c322.js b/packages/examples/static/public/js/9b795fc345d6ec85.js similarity index 98% rename from packages/examples/static/public/js/f4e9504632b8c322.js rename to packages/examples/static/public/js/9b795fc345d6ec85.js index 3fb70316..0b3da963 100644 --- a/packages/examples/static/public/js/f4e9504632b8c322.js +++ b/packages/examples/static/public/js/9b795fc345d6ec85.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,u,i,f={},c={};function a(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return f[e](n,n.exports,a),n.exports}a.m=f,e=[],a.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(a.O).every(function(e){return a.O[e](n[c])})?n.splice(c--,1):(f=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(a.O).every(function(e){return a.O[e](n[c])})?n.splice(c--,1):(f=!1,o - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let e=new Map;class t{#e;#t;static TERMINATOR=new t([0,0,0],0);static NUMERIC=new t([10,12,14],1);static ALPHANUMERIC=new t([9,11,13],2);static STRUCTURED_APPEND=new t([0,0,0],3);static BYTE=new t([8,16,16],4);static ECI=new t([0,0,0],7);static KANJI=new t([8,10,12],8);static FNC1_FIRST_POSITION=new t([0,0,0],5);static FNC1_SECOND_POSITION=new t([0,0,0],9);static HANZI=new t([8,10,12],13);constructor(t,n){this.#e=n,this.#t=new Int32Array(t),e.set(n,this)}get bits(){return this.#e}getCharacterCountBits(e){let t,{version:n}=e;return t=n<=9?0:n<=26?1:2,this.#t[t]}}function n(e){return 32-Math.clz32(e)}function r(e,t){let r=n(t);for(e<<=r-1;n(e)>=r;)e^=t<32*t.length){let n=w(Math.ceil(e/.75));n.set(t),this.#e=n}this.#n=e}get length(){return this.#n}get byteLength(){return Math.ceil(this.#n/8)}set(e){this.#e[0|e/32]|=1<<(31&e)}get(e){return this.#e[0|e/32]>>>(31&e)&1}xor(e){let t=this.#e,n=e.#e,r=Math.min(this.#n,e.#n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:1,n=this.#n;if(e instanceof i){t=e.#n,this.#r(n+t);for(let r=0;r=0;r--)e>>>r&1&&this.set(n),n++}}toUint8Array(e,t,n,r){for(let w=0;w - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let s=new Map;class o{#w;#i;static CP437=new o("cp437",0,2);static ISO_8859_1=new o("iso-8859-1",1,3);static ISO_8859_2=new o("iso-8859-2",4);static ISO_8859_3=new o("iso-8859-3",5);static ISO_8859_4=new o("iso-8859-4",6);static ISO_8859_5=new o("iso-8859-5",7);static ISO_8859_6=new o("iso-8859-6",8);static ISO_8859_7=new o("iso-8859-7",9);static ISO_8859_8=new o("iso-8859-8",10);static ISO_8859_9=new o("iso-8859-9",11);static ISO_8859_10=new o("iso-8859-10",12);static ISO_8859_11=new o("iso-8859-11",13);static ISO_8859_13=new o("iso-8859-13",15);static ISO_8859_14=new o("iso-8859-14",16);static ISO_8859_15=new o("iso-8859-15",17);static ISO_8859_16=new o("iso-8859-16",18);static SJIS=new o("sjis",20);static CP1250=new o("cp1250",21);static CP1251=new o("cp1251",22);static CP1252=new o("cp1252",23);static CP1256=new o("cp1256",24);static UTF_16BE=new o("utf-16be",25);static UTF_8=new o("utf-8",26);static ASCII=new o("ascii",27,170);static BIG5=new o("big5",28);static GB18030=new o("gb18030",29);static EUC_KR=new o("euc-kr",30);constructor(e,...t){for(let n of(this.#w=e,this.#i=t,t))s.set(n,this)}get label(){return this.#w}get values(){return this.#i}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */function l(e){if(!e)throw Error("segment content should be at least 1 character")}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */function a(e,t){let n=[];for(let r of e){let e=r.charCodeAt(0);n.push(e>t?63:e)}return new Uint8Array(n)}function c(e,t){switch(t){case o.ASCII:return a(e,127);case o.ISO_8859_1:return a(e,255);case o.UTF_8:return new TextEncoder().encode(e);default:throw Error("built-in encode only support ascii, utf-8 and iso-8859-1 charset")}}let h="0123456789",u=`${h}ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;function f(e){let t=0,n=new Map;for(let r of e)n.set(r,t++);return n}function g(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r>8,255&n),i.push(n);let{length:l}=i,a=o.decode(new Uint8Array(w));for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:256,w=n.length-1,i=[];for(let s=e;s - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let p=f(h);function b(e){let t=p.get(e);if(null!=t)return t;throw Error(`illegal numeric character: ${e}`)}class y{#s;constructor(e){l(e),this.#s=e}get mode(){return t.NUMERIC}get content(){return this.#s}encode(){let e=new i,t=this.#s,{length:n}=t;for(let r=0;r - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let I=f(u);function m(e){let t=I.get(e);if(null!=t)return t;throw Error(`illegal alphanumeric character: ${e}`)}class C{#s;constructor(e){l(e),this.#s=e}get mode(){return t.ALPHANUMERIC}get content(){return this.#s}encode(){let e=new i,t=this.#s,{length:n}=t;for(let r=0;r - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let A=g("gb2312",[41377,41470],[41649,41698],[41701,41710],[41713,41724],[41889,41982],[42145,42227],[42401,42486],[42657,42680],[42689,42712],[42913,42945],[42961,42993],[43169,43194],[43205,43241],[43428,43503],...d(45217,55038,[0,93]),[55201,55289],...d(55457,63486,[0,93]));class _{#s;constructor(e){l(e),this.#s=e}get mode(){return t.HANZI}get content(){return this.#s}encode(){let e=new i;for(let t of this.#s){let n=function(e){let t=A.get(e);return null!=t?t:NaN}(t);if(n>=41377&&n<=43774)n-=41377;else if(n>=45217&&n<=64254)n-=42657;else throw Error(`illegal hanzi character: ${t}`);n=(n>>8)*96+(255&n),e.append(n,13)}return e}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let E=g("shift-jis",[33088,33150],[33152,33196],[33208,33215],[33224,33230],[33242,33256],[33264,33271],[33276,33276],[33359,33368],[33376,33401],[33409,33434],[33439,33521],[33600,33662],[33664,33686],[33695,33718],[33727,33750],[33856,33888],[33904,33918],[33920,33937],[33951,33982],[34975,35068],...d(35136,38908,[0,62,64,188]),[38976,39026],[39071,39164],...d(39232,40956,[0,62,64,188]),...d(57408,59900,[0,62,64,188]),[59968,60030],[60032,60068]);class B{#s;constructor(e){l(e),this.#s=e}get mode(){return t.KANJI}get content(){return this.#s}encode(){let e=new i;for(let t of this.#s){let n=function(e){let t=E.get(e);return null!=t?t:NaN}(t);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`illegal kanji character: ${t}`);n=(n>>8)*192+(255&n),e.append(n,13)}return e}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class S{#s;#o;constructor(e,t=o.ISO_8859_1){l(e),function(e){if(!(e instanceof o))throw Error("illegal charset")}(t),this.#s=e,this.#o=t}get mode(){return t.BYTE}get content(){return this.#s}get charset(){return this.#o}encode(e){let t=new i;for(let n of e(this.#s,this.#o))t.append(n,8);return t}}function v(e,t,n){return 1===e.get(t,n)}function T(e,t){let n=0,{size:r}=e;for(let w=0;w=5&&(n+=3+(s-5)),i=r,s=1)}s>=5&&(n+=3+(s-5))}return n}function M(e,t,n,r,w){if(n<0||r>e.size)return!1;for(let i=n;i - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class z{#l;#a;constructor(e,t){this.#l=e,this.#a=t}get count(){return this.#l}get numDataCodewords(){return this.#a}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class O{#c;#h;#u;#f;#g;constructor(e,...t){let n=0,r=0;for(let{count:e,numDataCodewords:w}of t)n+=e,r+=w*e;let w=e*n;this.#c=t,this.#u=w,this.#f=r,this.#g=e,this.#h=r+w}get ecBlocks(){return this.#c}get numTotalCodewords(){return this.#h}get numTotalECCodewords(){return this.#u}get numTotalDataCodewords(){return this.#f}get numECCodewordsPerBlock(){return this.#g}}class k{#d;#p;#c;#b;constructor(e,t,...n){this.#p=e,this.#c=n,this.#d=17+4*e,this.#b=t}get size(){return this.#d}get version(){return this.#p}get alignmentPatterns(){return this.#b}getECBlocks(e){let{level:t}=e;return this.#c[t]}}let N=[new k(1,[],new O(7,new z(1,19)),new O(10,new z(1,16)),new O(13,new z(1,13)),new O(17,new z(1,9))),new k(2,[6,18],new O(10,new z(1,34)),new O(16,new z(1,28)),new O(22,new z(1,22)),new O(28,new z(1,16))),new k(3,[6,22],new O(15,new z(1,55)),new O(26,new z(1,44)),new O(18,new z(2,17)),new O(22,new z(2,13))),new k(4,[6,26],new O(20,new z(1,80)),new O(18,new z(2,32)),new O(26,new z(2,24)),new O(16,new z(4,9))),new k(5,[6,30],new O(26,new z(1,108)),new O(24,new z(2,43)),new O(18,new z(2,15),new z(2,16)),new O(22,new z(2,11),new z(2,12))),new k(6,[6,34],new O(18,new z(2,68)),new O(16,new z(4,27)),new O(24,new z(4,19)),new O(28,new z(4,15))),new k(7,[6,22,38],new O(20,new z(2,78)),new O(18,new z(4,31)),new O(18,new z(2,14),new z(4,15)),new O(26,new z(4,13),new z(1,14))),new k(8,[6,24,42],new O(24,new z(2,97)),new O(22,new z(2,38),new z(2,39)),new O(22,new z(4,18),new z(2,19)),new O(26,new z(4,14),new z(2,15))),new k(9,[6,26,46],new O(30,new z(2,116)),new O(22,new z(3,36),new z(2,37)),new O(20,new z(4,16),new z(4,17)),new O(24,new z(4,12),new z(4,13))),new k(10,[6,28,50],new O(18,new z(2,68),new z(2,69)),new O(26,new z(4,43),new z(1,44)),new O(24,new z(6,19),new z(2,20)),new O(28,new z(6,15),new z(2,16))),new k(11,[6,30,54],new O(20,new z(4,81)),new O(30,new z(1,50),new z(4,51)),new O(28,new z(4,22),new z(4,23)),new O(24,new z(3,12),new z(8,13))),new k(12,[6,32,58],new O(24,new z(2,92),new z(2,93)),new O(22,new z(6,36),new z(2,37)),new O(26,new z(4,20),new z(6,21)),new O(28,new z(7,14),new z(4,15))),new k(13,[6,34,62],new O(26,new z(4,107)),new O(22,new z(8,37),new z(1,38)),new O(24,new z(8,20),new z(4,21)),new O(22,new z(12,11),new z(4,12))),new k(14,[6,26,46,66],new O(30,new z(3,115),new z(1,116)),new O(24,new z(4,40),new z(5,41)),new O(20,new z(11,16),new z(5,17)),new O(24,new z(11,12),new z(5,13))),new k(15,[6,26,48,70],new O(22,new z(5,87),new z(1,88)),new O(24,new z(5,41),new z(5,42)),new O(30,new z(5,24),new z(7,25)),new O(24,new z(11,12),new z(7,13))),new k(16,[6,26,50,74],new O(24,new z(5,98),new z(1,99)),new O(28,new z(7,45),new z(3,46)),new O(24,new z(15,19),new z(2,20)),new O(30,new z(3,15),new z(13,16))),new k(17,[6,30,54,78],new O(28,new z(1,107),new z(5,108)),new O(28,new z(10,46),new z(1,47)),new O(28,new z(1,22),new z(15,23)),new O(28,new z(2,14),new z(17,15))),new k(18,[6,30,56,82],new O(30,new z(5,120),new z(1,121)),new O(26,new z(9,43),new z(4,44)),new O(28,new z(17,22),new z(1,23)),new O(28,new z(2,14),new z(19,15))),new k(19,[6,30,58,86],new O(28,new z(3,113),new z(4,114)),new O(26,new z(3,44),new z(11,45)),new O(26,new z(17,21),new z(4,22)),new O(26,new z(9,13),new z(16,14))),new k(20,[6,34,62,90],new O(28,new z(3,107),new z(5,108)),new O(26,new z(3,41),new z(13,42)),new O(30,new z(15,24),new z(5,25)),new O(28,new z(15,15),new z(10,16))),new k(21,[6,28,50,72,94],new O(28,new z(4,116),new z(4,117)),new O(26,new z(17,42)),new O(28,new z(17,22),new z(6,23)),new O(30,new z(19,16),new z(6,17))),new k(22,[6,26,50,74,98],new O(28,new z(2,111),new z(7,112)),new O(28,new z(17,46)),new O(30,new z(7,24),new z(16,25)),new O(24,new z(34,13))),new k(23,[6,30,54,78,102],new O(30,new z(4,121),new z(5,122)),new O(28,new z(4,47),new z(14,48)),new O(30,new z(11,24),new z(14,25)),new O(30,new z(16,15),new z(14,16))),new k(24,[6,28,54,80,106],new O(30,new z(6,117),new z(4,118)),new O(28,new z(6,45),new z(14,46)),new O(30,new z(11,24),new z(16,25)),new O(30,new z(30,16),new z(2,17))),new k(25,[6,32,58,84,110],new O(26,new z(8,106),new z(4,107)),new O(28,new z(8,47),new z(13,48)),new O(30,new z(7,24),new z(22,25)),new O(30,new z(22,15),new z(13,16))),new k(26,[6,30,58,86,114],new O(28,new z(10,114),new z(2,115)),new O(28,new z(19,46),new z(4,47)),new O(28,new z(28,22),new z(6,23)),new O(30,new z(33,16),new z(4,17))),new k(27,[6,34,62,90,118],new O(30,new z(8,122),new z(4,123)),new O(28,new z(22,45),new z(3,46)),new O(30,new z(8,23),new z(26,24)),new O(30,new z(12,15),new z(28,16))),new k(28,[6,26,50,74,98,122],new O(30,new z(3,117),new z(10,118)),new O(28,new z(3,45),new z(23,46)),new O(30,new z(4,24),new z(31,25)),new O(30,new z(11,15),new z(31,16))),new k(29,[6,30,54,78,102,126],new O(30,new z(7,116),new z(7,117)),new O(28,new z(21,45),new z(7,46)),new O(30,new z(1,23),new z(37,24)),new O(30,new z(19,15),new z(26,16))),new k(30,[6,26,52,78,104,130],new O(30,new z(5,115),new z(10,116)),new O(28,new z(19,47),new z(10,48)),new O(30,new z(15,24),new z(25,25)),new O(30,new z(23,15),new z(25,16))),new k(31,[6,30,56,82,108,134],new O(30,new z(13,115),new z(3,116)),new O(28,new z(2,46),new z(29,47)),new O(30,new z(42,24),new z(1,25)),new O(30,new z(23,15),new z(28,16))),new k(32,[6,34,60,86,112,138],new O(30,new z(17,115)),new O(28,new z(10,46),new z(23,47)),new O(30,new z(10,24),new z(35,25)),new O(30,new z(19,15),new z(35,16))),new k(33,[6,30,58,86,114,142],new O(30,new z(17,115),new z(1,116)),new O(28,new z(14,46),new z(21,47)),new O(30,new z(29,24),new z(19,25)),new O(30,new z(11,15),new z(46,16))),new k(34,[6,34,62,90,118,146],new O(30,new z(13,115),new z(6,116)),new O(28,new z(14,46),new z(23,47)),new O(30,new z(44,24),new z(7,25)),new O(30,new z(59,16),new z(1,17))),new k(35,[6,30,54,78,102,126,150],new O(30,new z(12,121),new z(7,122)),new O(28,new z(12,47),new z(26,48)),new O(30,new z(39,24),new z(14,25)),new O(30,new z(22,15),new z(41,16))),new k(36,[6,24,50,76,102,128,154],new O(30,new z(6,121),new z(14,122)),new O(28,new z(6,47),new z(34,48)),new O(30,new z(46,24),new z(10,25)),new O(30,new z(2,15),new z(64,16))),new k(37,[6,28,54,80,106,132,158],new O(30,new z(17,122),new z(4,123)),new O(28,new z(29,46),new z(14,47)),new O(30,new z(49,24),new z(10,25)),new O(30,new z(24,15),new z(46,16))),new k(38,[6,32,58,84,110,136,162],new O(30,new z(4,122),new z(18,123)),new O(28,new z(13,46),new z(32,47)),new O(30,new z(48,24),new z(14,25)),new O(30,new z(42,15),new z(32,16))),new k(39,[6,26,54,82,110,138,166],new O(30,new z(20,117),new z(4,118)),new O(28,new z(40,47),new z(7,48)),new O(30,new z(43,24),new z(22,25)),new O(30,new z(10,15),new z(67,16))),new k(40,[6,30,58,86,114,142,170],new O(30,new z(19,118),new z(6,119)),new O(28,new z(18,47),new z(31,48)),new O(30,new z(34,24),new z(34,25)),new O(30,new z(20,15),new z(61,16)))],D=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,1,1,1,0,1],[1,0,1,1,1,0,1],[1,0,1,1,1,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],x=[[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]],P=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function U(e,t,n){return -1===e.get(t,n)}function L(e,t,n){for(let r=0;r<7;r++){let w=D[r];for(let i=0;i<7;i++)e.set(t+i,n+r,w[i])}}function R(e,t,n){for(let r=0;r<8;r++)e.set(t+r,n,0)}function $(e,t,n){for(let r=0;r<7;r++)e.set(t,n+r,0)}function Z(e,t,n,w,s){e.clear(-1),function(e){let{size:t}=e;L(e,0,0),L(e,t-7,0),L(e,0,t-7),R(e,0,7),R(e,t-8,7),R(e,0,t-8),$(e,7,0),$(e,t-7-1,0),$(e,7,t-7)}(e),function(e,t){let{version:n}=t;if(n>=2){let{alignmentPatterns:t}=N[n-1],{length:r}=t;for(let n=0;n=7){let t=new i;!function(e,t){e.append(t,6);let n=r(t,7973);e.append(n,12)}(t,n);let w=17,{size:s}=e;for(let n=0;n<6;n++)for(let r=0;r<3;r++){let i=t.get(w--);e.set(n,s-11+r,i),e.set(s-11+r,n,i)}}}(e,n),function(e,t,n){let r=0,{size:w}=e,{length:i}=t;for(let s=w-1;s>=1;s-=2){6===s&&(s=5);for(let o=0;o - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class F{#y;#I;constructor(e,t){this.#y=t,this.#I=e}get ecCodewords(){return this.#y}get dataCodewords(){return this.#I}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class H{#m;#C;constructor(e,t){let{length:n}=t;if(n<=0)throw Error("polynomial coefficients cannot empty");if(this.#m=e,n>1&&0===t[0]){let e=1;for(;e=e.getDegree()&&!r.isZero();){let w=r.getDegree(),s=w-e.getDegree(),o=t.multiply(r.getCoefficient(w),i),l=e.multiplyByMonomial(s,o),a=t.buildPolynomial(s,o);n=n.addOrSubtract(a),r=r.addOrSubtract(l)}return[n,r]}}let G=new /** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class{#d;#A;#_;#E;#B;#S;constructor(e,t,n){let r=1,w=new Int32Array(t);for(let n=0;n=t&&(r^=e,r&=t-1);let i=new Int32Array(t);for(let e=0,n=t-1;e - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */function(e,t,n){let{length:r}=t;if(n>=r){let{generator:w}=e,i=t[r-1];for(let s=r;s<=n;s++){let n=new Int32Array([1,e.exp(s-1+w)]),r=i.multiply(new H(e,n));t.push(r),i=r}}return t[n]}(this.#m,this.#v,t);r.set(e.subarray(0,n));let[,i]=new H(this.#m,r).multiplyByMonomial(t,1).divide(w),{coefficients:s}=i,o=n+(t-s.length);e.fill(0,n,o),e.set(s,o)}}function j(e){return e.mode===t.BYTE}function J(e,t){e.append(t.bits,4)}function Q(e,t,n){return t.getECBlocks(n).numTotalDataCodewords>=Math.ceil(e/8)}function Y(e,t){for(let n of N)if(Q(e,n,t))return n;throw Error("data too big for all versions")}function V(e,t){let n=0;for(let{mode:r,head:w,data:i}of e)n+=w.length+r.getCharacterCountBits(t)+i.length;return n}class X{#T;#M;#e;#z;#d;#O;#k;constructor(e){let t=1<4095)return!1;this.#k.set(e<<8|t,n++);let r=this.#e,w=this.#d;return n>w&&(w=1<<++r),this.#e=r,this.#d=w,this.#O=n,!0}get(e,t){return this.#k.get(e<<8|t)}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class q{#e=0;#N;#D=0;#x=[];constructor(e){this.#N=e}write(e){let t=this.#e,n=this.#D|e<=8;)r.push(255&n),n>>=8,t-=8;this.#e=t,this.#D=n}pipe(e){let t=this.#x;this.#e>0&&t.push(this.#D),e.writeByte(this.#N.depth);let{length:n}=t;for(let r=0;r=255?(e.writeByte(255),e.writeBytes(t,r,255),r+=255):(e.writeByte(w),e.writeBytes(t,r,w),r=n)}e.writeByte(0)}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class W{#x=[];get bytes(){return this.#x}writeByte(e){this.#x.push(255&e)}writeInt16(e){this.#x.push(255&e,e>>8&255)}writeBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=this.#x;for(let w=0;w - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let{fromCharCode:ee}=String;function et(e){if((e&=63)>=0){if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(62===e)return 43;else if(63===e)return 47}throw Error(`illegal char: ${ee(e)}`)}class en{#e=0;#D=0;#n=0;#P=new W;get bytes(){return this.#P.bytes}write(e){let t=this.#e+8,n=this.#P,r=this.#D<<8|255&e;for(;t>=6;)n.writeByte(et(r>>>t-6)),t-=6;this.#n++,this.#e=t,this.#D=r}close(){let e=this.#e,t=this.#P;e>0&&(t.writeByte(et(this.#D<<6-e)),this.#e=0,this.#D=0);let n=this.#n;if(n%3!=0){let e=3-n%3;for(let n=0;n - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class er{#U;#L;#R;#$;#Z=[];constructor(e,t,{foreground:n=[0,0,0],background:r=[255,255,255]}={}){this.#U=e,this.#L=t,this.#R=n,this.#$=r}#F(){let e=this.#U,t=this.#L,n=new W,r=this.#$,w=this.#R;return n.writeBytes([71,73,70,56,57,97]),n.writeInt16(e),n.writeInt16(t),n.writeBytes([128,0,0]),n.writeBytes([r[0],r[1],r[2]]),n.writeBytes([w[0],w[1],w[2]]),n.writeByte(44),n.writeInt16(0),n.writeInt16(0),n.writeInt16(e),n.writeInt16(t),n.writeByte(0),!/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */function(e,t,n){let r=new X(2),w=new q(r);if(w.write(r.bof),e.length>0){let t=e[0],{length:n}=e;for(let i=1;i - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class ew{#H;#G;#p;#K;constructor(e,t,n,r){this.#H=r,this.#G=n,this.#K=e,this.#p=t}get size(){return this.#K.size}get mask(){return this.#H}get level(){return this.#G.name}get version(){return this.#p.version}get(e,t){let{size:n}=this.#K;if(e<0||t<0||e>=n||t>=n)throw Error(`illegal coordinate: [${e}, ${t}]`);return this.#K.get(e,t)}toDataURL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2,{margin:t=4*e,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Math.max(1,e>>0),t=Math.max(0,t>>0);let r=this.#K,w=e*r.size+2*t,i=new er(w,w,n),s=w-t;for(let n=0;n=t&&o=t&&n - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */let ei=new Map;class es{#j;#e;#G;static L=new es("L",0,1);static M=new es("M",1,0);static Q=new es("Q",2,3);static H=new es("H",3,2);constructor(e,t,n){this.#e=n,this.#j=e,this.#G=t,ei.set(n,this)}get bits(){return this.#e}get name(){return this.#j}get level(){return this.#G}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class eo{#d;#x;constructor(e){this.#d=e,this.#x=new Int8Array(e*e)}get size(){return this.#d}set(e,t,n){this.#x[t*this.#d+e]=n}get(e,t){return this.#x[t*this.#d+e]}clear(e){this.#x.fill(e)}}/** - * @module QRCode - * @package @nuintun/qrcode - * @license MIT - * @version 4.0.0 - * @author nuintun - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */class el{#J;#G;#F;#p;constructor({hints:e={},level:t="L",version:n="Auto",encode:r=c}={}){!function(e){let{fnc1:t}=e;if(null!=t){let[e]=t;if("GS1"!==e&&"AIM"!==e)throw Error("illegal fn1 hint");if("AIM"===e){let[,e]=t;if(e<0||e>255||!Number.isInteger(e))throw Error("illegal fn1 application indicator")}}}(e),function(e){if(0>["L","M","Q","H"].indexOf(e))throw Error("illegal error correction level")}(t),function(e){if("Auto"!==e&&(e<1||e>40||!Number.isInteger(e)))throw Error("illegal version")}(n),this.#J=e,this.#F=r,this.#p=n,this.#G=es[t]}encode(){let e;for(var n=arguments.length,r=Array(n),w=0;w0)for(let t=r;t<8;t++)e.append(0);let w=t-e.byteLength;for(let t=0;t - * @description A pure JavaScript QRCode encode and decode library. - * @see https://github.com/nuintun/qrcode#readme - */function(e,t){let n=e.length,r=new Int32Array(n+t);return r.set(e),new K().encode(r,t),new Uint8Array(r.subarray(n))}(t,r);l.push(new F(t,n)),o+=i,w=Math.max(w,n.length),s=Math.max(s,i)}let a=new i;for(let e=0;e>16&255,t>>8&255,255&t]}self.addEventListener("message",e=>{let{data:t}=e,{level:n,version:r}=t,w=new el({level:n,version:r,hints:function(e){let{fnc1:t,aimIndicator:n}=e;switch(t){case"GS1":return{fnc1:["GS1"]};case"AIM":return{fnc1:["AIM",+n]}}}(t)});try{let e=w.encode(function(e){let{mode:t,content:n,charset:r}=e;switch(t){case"Auto":if(/^\d+$/.test(n))return new y(n);if(/^[0-9A-Z$%*+-./: ]+$/.test(n))return new C(n);let w=new _(n);try{return w.encode(),w}catch{}let i=new B(n);try{return i.encode(),i}catch{}return new S(n,o[r]);case"Hanzi":return new _(n);case"Kanji":return new B(n);case"Numeric":return new y(n);case"Alphanumeric":return new C(n);default:return new S(n,o[r])}}(t)),{moduleSize:n,quietZone:r,background:i,foreground:s}=t,l={type:"ok",payload:e.toDataURL(n,{margin:r,background:ea(i),foreground:ea(s)})};self.postMessage(l)}catch(t){let e={type:"error",message:t.message};self.postMessage(e)}})}(); \ No newline at end of file