Skip to content
使用html标签展示二维码的方式

工具地址:https://passer-by.com/widget-qrcode/

示例Html代码

html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="https://passer-by.com/widget-qrcode/dist/widget-qrcode.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <widget-qrcode value="二维码内容"></widget-qrcode>
</body>
</html>

避免js丢失,贴一份js源代码

js
/*!
 * widget-qrcode v1.0.4
 * qrcode component
 * https://passer-by.com/widget-qrcode/
 *
 * Copyright (c) 2024-present, HaoLe Zheng
 *
 * Released under the MIT License
 * https://github.com/mumuy/widget-qrcode
 *
 * Created on: 2026-01-13
 */
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function t(t,r){if(t){if("string"==typeof t)return e(t,r);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,r):void 0}}function r(r){return function(t){if(Array.isArray(t))return e(t)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||t(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function n(e){var t=function(e,t){if("object"!==o(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===o(t)?t:String(t)}function a(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function l(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function g(e,t,r){return g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&i(n,r.prototype),n},g.apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return g(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)},s(e)}var f={L:1,M:0,Q:3,H:2},c=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],h=1,d=2,v=4,m=8;function b(e){this.mode=v,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var o=[],n=this.data.charCodeAt(t);n>65536?(o[0]=240|(1835008&n)>>>18,o[1]=128|(258048&n)>>>12,o[2]=128|(4032&n)>>>6,o[3]=128|63&n):n>2048?(o[0]=224|(61440&n)>>>12,o[1]=128|(4032&n)>>>6,o[2]=128|63&n):n>128?(o[0]=192|(1984&n)>>>6,o[1]=128|63&n):o[0]=n,this.parsedData.push(o)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function y(){this.buffer=[],this.length=0}b.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}},y.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};for(var P={glog:function(e){if(e<1)throw new Error("glog("+e+")");return P.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return P.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},I=0;I<8;I++)P.EXP_TABLE[I]=1<<I;for(var p=8;p<256;p++)P.EXP_TABLE[p]=P.EXP_TABLE[p-4]^P.EXP_TABLE[p-5]^P.EXP_TABLE[p-6]^P.EXP_TABLE[p-8];for(var k=0;k<255;k++)P.LOG_TABLE[P.EXP_TABLE[k]]=k;function w(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&0==e[r];)r++;this.num=new Array(e.length-r+t);for(var o=0;o<e.length-r;o++)this.num[o]=e[o+r]}function C(e,t){this.totalCount=e,this.dataCount=t}w.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<e.getLength();o++)t[r+o]^=P.gexp(P.glog(this.get(r))+P.glog(e.get(o)));return new w(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=P.glog(this.get(0))-P.glog(e.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(var n=0;n<e.getLength();n++)r[n]^=P.gexp(P.glog(e.get(n))+t);return new w(r,0).mod(e)}},C.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],C.getRSBlocks=function(e,t){var r=C.getRsBlockTable(e,t);if(null==r)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var o=r.length/3,n=[],a=0;a<o;a++)for(var i=r[3*a+0],l=r[3*a+1],u=r[3*a+2],g=0;g<i;g++)n.push(new C(l,u));return n},C.getRsBlockTable=function(e,t){switch(t){case f.L:return C.RS_BLOCK_TABLE[4*(e-1)+0];case f.M:return C.RS_BLOCK_TABLE[4*(e-1)+1];case f.Q:return C.RS_BLOCK_TABLE[4*(e-1)+2];case f.H:return C.RS_BLOCK_TABLE[4*(e-1)+3];default:return}};var T=0,S=1,R=2,M=3,A=4,B=5,L=6,D=7,V={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;V.getBCHDigit(t)-V.getBCHDigit(V.G15)>=0;)t^=V.G15<<V.getBCHDigit(t)-V.getBCHDigit(V.G15);return(e<<10|t)^V.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;V.getBCHDigit(t)-V.getBCHDigit(V.G18)>=0;)t^=V.G18<<V.getBCHDigit(t)-V.getBCHDigit(V.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return V.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case T:return(t+r)%2==0;case S:return t%2==0;case R:return r%3==0;case M:return(t+r)%3==0;case A:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case B:return t*r%2+t*r%3==0;case L:return(t*r%2+t*r%3)%2==0;case D:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new w([1],0),r=0;r<e;r++)t=t.multiply(new w([1,P.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case h:return 10;case d:return 9;case v:case m:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case h:return 12;case d:return 11;case v:return 16;case m:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case h:return 14;case d:return 13;case v:return 16;case m:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,o=0;o<t;o++)for(var n=0;n<t;n++){for(var a=0,i=e.isDark(o,n),l=-1;l<=1;l++)if(!(o+l<0||t<=o+l))for(var u=-1;u<=1;u++)n+u<0||t<=n+u||0==l&&0==u||i==e.isDark(o+l,n+u)&&a++;a>5&&(r+=3+a-5)}for(var g=0;g<t-1;g++)for(var s=0;s<t-1;s++){var f=0;e.isDark(g,s)&&f++,e.isDark(g+1,s)&&f++,e.isDark(g,s+1)&&f++,e.isDark(g+1,s+1)&&f++,0!=f&&4!=f||(r+=3)}for(var c=0;c<t;c++)for(var h=0;h<t-6;h++)e.isDark(c,h)&&!e.isDark(c,h+1)&&e.isDark(c,h+2)&&e.isDark(c,h+3)&&e.isDark(c,h+4)&&!e.isDark(c,h+5)&&e.isDark(c,h+6)&&(r+=40);for(var d=0;d<t;d++)for(var v=0;v<t-6;v++)e.isDark(v,d)&&!e.isDark(v+1,d)&&e.isDark(v+2,d)&&e.isDark(v+3,d)&&e.isDark(v+4,d)&&!e.isDark(v+5,d)&&e.isDark(v+6,d)&&(r+=40);for(var m=0,b=0;b<t;b++)for(var y=0;y<t;y++)e.isDark(y,b)&&m++;return r+=10*(Math.abs(100*m/t/t-50)/5)}};function x(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function E(e,t){for(var r=1,o=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=0,a=c.length;n<=a;n++){var i=0;switch(t){case f.L:i=c[n][0];break;case f.M:i=c[n][1];break;case f.Q:i=c[n][2];break;case f.H:i=c[n][3]}if(o<=i)break;r++}if(r>c.length)throw new Error("Too long data");return r}function O(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a,i,l=[],u=!0,g=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==t);u=!0);}catch(e){g=!0,n=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(g)throw n}}return l}}(e,r)||t(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}x.prototype={addData:function(e){var t=new b(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=x.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(this.modules[e+r][t+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=V.getLostPoint(this);(0==r||e>o)&&(e=o,t=r)}return t},createMovieClip:function(e,t,r){var o=e.createEmptyMovieClip(t,r);this.make();for(var n=0;n<this.modules.length;n++)for(var a=1*n,i=0;i<this.modules[n].length;i++){var l=1*i;this.modules[n][i]&&(o.beginFill(0,100),o.moveTo(l,a),o.lineTo(l+1,a),o.lineTo(l+1,a+1),o.lineTo(l,a+1),o.endFill())}return o},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=V.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var o=e[t],n=e[r];if(null==this.modules[o][n])for(var a=-2;a<=2;a++)for(var i=-2;i<=2;i++)this.modules[o+a][n+i]=-2==a||2==a||-2==i||2==i||0==a&&0==i}},setupTypeNumber:function(e){for(var t=V.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var o=!e&&1==(t>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(var n=0;n<18;n++){var a=!e&&1==(t>>n&1);this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=a}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,o=V.getBCHTypeInfo(r),n=0;n<15;n++){var a=!e&&1==(o>>n&1);n<6?this.modules[n][8]=a:n<8?this.modules[n+1][8]=a:this.modules[this.moduleCount-15+n][8]=a}for(var i=0;i<15;i++){var l=!e&&1==(o>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=l:i<9?this.modules[8][15-i-1+1]=l:this.modules[8][15-i-1]=l}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,o=this.moduleCount-1,n=7,a=0,i=this.moduleCount-1;i>0;i-=2)for(6==i&&i--;;){for(var l=0;l<2;l++)if(null==this.modules[o][i-l]){var u=!1;a<e.length&&(u=1==(e[a]>>>n&1)),V.getMask(t,o,i-l)&&(u=!u),this.modules[o][i-l]=u,-1==--n&&(a++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},x.PAD0=236,x.PAD1=17,x.createData=function(e,t,r){for(var o=C.getRSBlocks(e,t),n=new y,a=0;a<r.length;a++){var i=r[a];n.put(i.mode,4),n.put(i.getLength(),V.getLengthInBits(i.mode,e)),i.write(n)}for(var l=0,u=0;u<o.length;u++)l+=o[u].dataCount;if(n.getLengthInBits()>8*l)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*l+")");for(n.getLengthInBits()+4<=8*l&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*l||(n.put(x.PAD0,8),n.getLengthInBits()>=8*l));)n.put(x.PAD1,8);return x.createBytes(n,o)},x.createBytes=function(e,t){for(var r=0,o=0,n=0,a=new Array(t.length),i=new Array(t.length),l=0;l<t.length;l++){var u=t[l].dataCount,g=t[l].totalCount-u;o=Math.max(o,u),n=Math.max(n,g),a[l]=new Array(u);for(var s=0;s<a[l].length;s++)a[l][s]=255&e.buffer[s+r];r+=u;var f=V.getErrorCorrectPolynomial(g),c=new w(a[l],f.getLength()-1).mod(f);i[l]=new Array(f.getLength()-1);for(var h=0;h<i[l].length;h++){var d=h+c.getLength()-i[l].length;i[l][h]=d>=0?c.get(d):0}}for(var v=0,m=0;m<t.length;m++)v+=t[m].totalCount;for(var b=new Array(v),y=0,P=0;P<o;P++)for(var I=0;I<t.length;I++)P<a[I].length&&(b[y++]=a[I][P]);for(var p=0;p<n;p++)for(var k=0;k<t.length;k++)p<i[k].length&&(b[y++]=i[k][p]);return b};var _={};function j(e,t,r){return{imageReady:function(e){var t={},r=Object.entries(e).map((function(e){return new Promise((function(r){var o=O(e,2),n=o[0],a=o[1];if(_[a]&&_[a].width)t[n]=_[a],r();else{var i=new Image;i.src=a,i.onload=function(){t[n]=i,_[a]=i,r()},i.onerror=function(){t[n]="",r()}}}))}));return r.length?Promise.all(r).then((function(){return t})):Promise.resolve({})},getValue:function(e,r){var o;return null==t||null===(o=t[e])||void 0===o?void 0:o[r]},isPositionPoint:function(e,r){if(!t)return!1;var o=t.length,n=0;return e>=2&&e<5&&r>=2&&r<5?n=1:e<7&&r<7?n=2:e>=o-5&&e<o-2&&r>=2&r<5?n=1:e>=o-7&&e<o&&r>=0&r<7?n=2:e>=2&&e<5&&r>=o-5&r<o-2?n=1:e>=0&&e<7&&r>=o-7&r<o&&(n=2),n},getRangeTrue:function(e,r,o,n){var a=!0;if(t){t.length;for(var i=e;i<e+o;i++)for(var l=r;l<r+n;l++)1!=this.getValue(i,l)&&(a=!1);return a}return!1},getRangeFalse:function(e,r,o,n){var a=!0;if(t){t.length;for(var i=e;i<e+o;i++)for(var l=r;l<r+n;l++)this.getValue(i,l)&&(a=!1);return a}return!1},setRangeDisabled:function(e,r,o,n){if(!t)return!1;for(var a=t.length,i=e;i<e+o;i++)for(var l=r;l<r+n;l++)i<0||l<0||i>=a||l>=a||(t[i][l]=2)},getImageBrush:function(t){var r;if(t.width>e.canvas.width||t.height>e.canvas.height){var o=document.createElement("canvas"),n=o.getContext("2d");t.width>e.canvas.width&&t.height>e.canvas.height?t.width/t.height<e.canvas.width/e.canvas.height?(o.width=e.canvas.width,o.height=t.height/t.width*e.canvas.width):(o.width=t.width/t.height*e.canvas.height,o.height=e.canvas.height):t.width>e.canvas.width?(o.width=e.canvas.width,o.height=t.height/t.width*e.canvas.width):(o.width=t.width/t.height*e.canvas.height,o.height=e.canvas.height),n.drawImage(t,0,0,o.width,o.height),r=e.createPattern(o,"repeat")}else r=e.createPattern(t,"repeat");return r},drawRightAngle:function(t,r,o,n){var a,i;switch(o){case 0:a=t*n,i=r*n,e.lineTo(a,i);break;case 1:a=t*n+n,i=r*n,e.lineTo(a,i);break;case 2:a=t*n+n,i=r*n+n,e.lineTo(a,i);break;case 3:a=t*n,i=r*n+n,e.lineTo(a,i)}},drawRoundBrick:function(t,r,o,n){var a,i,l=n/2;switch(o){case 0:a=t*n+l,i=r*n+l,e.arc(a,i,l,Math.PI,1.5*Math.PI,!1);break;case 1:a=t*n+n-l,i=r*n+l,e.arc(a,i,l,1.5*Math.PI,2*Math.PI,!1);break;case 2:a=t*n+n-l,i=r*n+n-l,e.arc(a,i,l,0,Math.PI/2,!1);break;case 3:a=t*n+l,i=r*n+n-l,e.arc(a,i,l,Math.PI/2,Math.PI,!1)}},fillRound:function(t,r,o,n){var a,i,l=n/2;switch(e.beginPath(),o){case 0:a=t*n+l,i=r*n+l,e.arc(a,i,l,Math.PI,1.5*Math.PI,!1),a=t*n,i=r*n;break;case 1:a=t*n+n-l,i=r*n+l,e.arc(a,i,l,1.5*Math.PI,2*Math.PI,!1),a=t*n+n,i=r*n;break;case 2:a=t*n+n-l,i=r*n+n-l,e.arc(a,i,l,0,Math.PI/2,!1),a=t*n+n,i=r*n+n;break;case 3:a=t*n+l,i=r*n+n-l,e.arc(a,i,l,Math.PI/2,Math.PI,!1),a=t*n,i=r*n+n}e.lineTo(a,i),e.closePath(),e.fill(),e.stroke()},setText:function(){if(r.text){var t=Math.ceil(e.canvas.height/12.5),o=Math.ceil(e.canvas.height/50);e.textAlign="center",e.textBaseline="middle",e.font="bold ".concat(t,"px 微软雅黑"),e.lineWidth=o,e.strokeStyle=r.textStroke||"#ffffff",e.strokeText(r.text,e.canvas.width/2,e.canvas.height/2),e.fillStyle=r.textColor||"#000000",e.fillText(r.text,e.canvas.width/2,e.canvas.height/2)}},setLogo:function(t){var r=Math.ceil(e.canvas.width/4),o=(e.canvas.width-r)/2,n=(e.canvas.height-r)/2;e.drawImage(t,o,n,r,r)}}}var H={default:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];if(!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage)),g.length>1){var f=e.createLinearGradient(0,0,e.canvas.width,e.canvas.height),c=g.length-1;g.forEach((function(e,t){f.addColorStop(t/c,e)})),s=f}var h=r.innerColor||s,d=r.outerColor||s,v=n;!r.backgroundColor&&t.backgroundImage&&(v=e.drawImage(t.backgroundImage,0,0,e.canvas.width,e.canvas.height)),e.save(),e.fillStyle=v,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l);for(var m=0;m<o;m++)for(var b=0;b<o;b++)u.getValue(m,b)&&(1==u.isPositionPoint(m,b)?e.fillStyle=h:2==u.isPositionPoint(m,b)?e.fillStyle=d:e.fillStyle=s,e.fillRect(Math.ceil(m*a)-.5,Math.ceil(b*a)-.5,Math.ceil(a)+1,Math.ceil(a)+1));e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},water:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];if(!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage)),g.length>1){var f=e.createLinearGradient(0,0,e.canvas.width,e.canvas.height),c=g.length-1;g.forEach((function(e,t){f.addColorStop(t/c,e)})),s=f}var h=r.innerColor||s,d=r.outerColor||s,v=n;!r.backgroundColor&&t.backgroundImage&&(v=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=v,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l);for(var m=0;m<o;m++)for(var b=0;b<o;b++)if(1==u.isPositionPoint(m,b)?(e.fillStyle=h,e.strokeStyle=h):2==u.isPositionPoint(m,b)?(e.fillStyle=d,e.strokeStyle=d):(e.fillStyle=s,e.strokeStyle=s),u.getValue(m,b)){var y=m*a,P=b*a+a/2;e.beginPath(),e.moveTo(y,P),u.getValue(m-1,b)||u.getValue(m,b-1)||u.getValue(m-1,b-1)?u.drawRightAngle(m,b,0,a):u.drawRoundBrick(m,b,0,a),u.getValue(m,b-1)||u.getValue(m+1,b)||u.getValue(m+1,b-1)?u.drawRightAngle(m,b,1,a):u.drawRoundBrick(m,b,1,a),u.getValue(m,b+1)||u.getValue(m+1,b)||u.getValue(m+1,b+1)?u.drawRightAngle(m,b,2,a):u.drawRoundBrick(m,b,2,a),u.getValue(m,b+1)||u.getValue(m-1,b)||u.getValue(m-1,b+1)?u.drawRightAngle(m,b,3,a):u.drawRoundBrick(m,b,3,a),e.closePath(),e.fill(),e.stroke()}else u.isPositionPoint(m,b,o)||(u.getValue(m,b-1)&&u.getValue(m-1,b)&&u.fillRound(m,b,0,a),u.getValue(m,b+1)&&u.getValue(m-1,b)&&u.fillRound(m,b,3,a),u.getValue(m,b+1)&&u.getValue(m+1,b)&&u.fillRound(m,b,2,a),u.getValue(m,b-1)&&u.getValue(m+1,b)&&u.fillRound(m,b,1,a));e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},star:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage));var f=r.innerColor||(null==g?void 0:g[1])||s;r.outerColor;var c=n;!r.backgroundColor&&t.backgroundImage&&(c=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=c,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l);for(var h=function(t,r,o){var n=.6*o,a=.55*o;e.beginPath();for(var i=0;i<5;i++)e.lineTo(t+Math.cos((18+72*i)/180*Math.PI)*n+a,r-Math.sin((18+72*i)/180*Math.PI)*n+a),e.lineTo(t+.4*Math.cos((54+72*i)/180*Math.PI)*n+a,r-.4*Math.sin((54+72*i)/180*Math.PI)*n+a);e.closePath(),e.fill()},d=0;d<o;d++)for(var v=0;v<o;v++)if(1==u.getValue(d,v)){if(1==u.isPositionPoint(d,v))e.fillStyle=f;else if(2==u.isPositionPoint(d,v)){var m=g[(d+v)%g.length],b=r.outerColor||m;e.fillStyle=b}else{var y=g[(d+v)%g.length];!r.foregroundColor&&t.foregroundImage&&(y=s),e.fillStyle=y}u.getRangeTrue(d,v,3,3)?(h(d*a-.55*a,v*a-.45*a,3.8*a),u.setRangeDisabled(d,v,3,3)):u.getRangeTrue(d,v,2,2)?(h(d*a-.15*a,v*a-.12*a,2*a),u.setRangeDisabled(d,v,2,2)):h(d*a,v*a,a)}e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},rect:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage));var f=r.innerColor||(null==g?void 0:g[1])||s,c=r.outerColor||s,h=n;!r.backgroundColor&&t.backgroundImage&&(h=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=h,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l);for(var d=0;d<o;d++)for(var v=0;v<o;v++)if(1==u.getValue(d,v)){if(1==u.isPositionPoint(d,v))e.fillStyle=f;else if(2==u.isPositionPoint(d,v))e.fillStyle=c;else{var m=g[(d+v)%g.length];!r.foregroundColor&&t.foregroundImage&&(m=s),e.fillStyle=m}u.isPositionPoint(d,v)?(e.fillRect(d*a,v*a,7*a,7*a),e.fillStyle=h,e.fillRect(d*a+a,v*a+a,5*a,5*a),e.fillStyle=f,e.beginPath(),e.moveTo((d+3.5)*a,(v+1)*a),e.lineTo((d+6)*a,(v+3.5)*a),e.lineTo((d+3.5)*a,(v+6)*a),e.lineTo((d+1)*a,(v+3.5)*a),e.closePath(),e.fill(),u.setRangeDisabled(d,v,7,7)):u.getRangeTrue(d,v,1,1)&&u.getRangeTrue(d-1,v+1,3,1)&&u.getRangeTrue(d,v+2,1,1)?(e.beginPath(),e.moveTo((d+.5)*a,v*a),e.lineTo((d+2)*a,(v+1.5)*a),e.lineTo((d+.5)*a,(v+3)*a),e.lineTo((d-1)*a,(v+1.5)*a),e.closePath(),e.fill(),u.setRangeDisabled(d,v,1,1),u.setRangeDisabled(d-1,v+1,3,1),u.setRangeDisabled(d,v+2,1,1)):u.getRangeTrue(d,v,3,2)?(e.fillRect(d*a,v*a,3*a,2*a),u.setRangeDisabled(d,v,3,2)):u.getRangeTrue(d,v,2,3)?(e.fillRect(d*a,v*a,2*a,3*a),u.setRangeDisabled(d,v,2,3)):u.getRangeTrue(d,v,2,2)&&(e.fillRect(d*a,v*a,2*a,2*a),u.setRangeDisabled(d,v,2,2))}for(var b=0;b<o;b++)for(var y=0;y<o;y++)if(1==u.getValue(b,y)){if(1==u.isPositionPoint(b,y))e.fillStyle=f;else if(2==u.isPositionPoint(b,y))e.fillStyle=c;else{var P=g[(b+y)%g.length];!r.foregroundColor&&t.foregroundImage&&(P=s),e.fillStyle=P}2!=u.getValue(b-1,y)&&2!=u.getValue(b,y-1)&&2!=u.getValue(b+1,y)&&2!=u.getValue(b,y+1)?(b+y)%2?(e.beginPath(),e.moveTo((b+.5)*a,y*a),e.lineTo((b+1)*a,(y+.5)*a),e.lineTo((b+.5)*a,(y+1)*a),e.lineTo(b*a,(y+.5)*a),e.closePath(),e.fill()):(e.fillRect(b*a,y*a,a,a),u.setRangeDisabled(b,y,1,1)):(e.beginPath(),e.moveTo((b+.5)*a,y*a),e.lineTo((b+1)*a,(y+.5)*a),e.lineTo((b+.5)*a,(y+1)*a),e.lineTo(b*a,(y+.5)*a),e.closePath(),e.fill())}e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},diamond:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];if(!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage)),g.length>1){var f=e.createLinearGradient(0,0,e.canvas.width,e.canvas.height),c=g.length-1;g.forEach((function(e,t){f.addColorStop(t/c,e)})),s=f}var h=r.innerColor||s,d=r.outerColor||s,v=n;!r.backgroundColor&&t.backgroundImage&&(v=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=v,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i+a/2,l+a/2);for(var m=0;m<o;m++)for(var b=0;b<o;b++)1==u.isPositionPoint(m,b)?(e.fillStyle=h,e.strokeStyle=h):2==u.isPositionPoint(m,b)?(e.fillStyle=d,e.strokeStyle=d):(e.fillStyle=s,e.strokeStyle=s),u.getValue(m,b)?(e.beginPath(),e.moveTo(m*a-.5*a,b*a),(u.getValue(m-1,b)||u.getValue(m,b-1))&&e.lineTo(m*a-.5*a,b*a-.5*a),e.lineTo(m*a,b*a-.5*a),(u.getValue(m+1,b)||u.getValue(m,b-1))&&e.lineTo(m*a+.5*a,b*a-.5*a),e.lineTo(m*a+.5*a,b*a),(u.getValue(m+1,b)||u.getValue(m,b+1))&&e.lineTo(m*a+.5*a,b*a+.5*a),e.lineTo(m*a,b*a+.5*a),(u.getValue(m-1,b)||u.getValue(m,b+1))&&e.lineTo(m*a-.5*a,b*a+.5*a),e.closePath(),e.fill(),e.stroke()):(u.getValue(m-1,b)&&u.getValue(m,b-1)&&u.getValue(m-1,b-1)&&(e.beginPath(),e.moveTo(m*a-.5*a,b*a-.5*a),e.lineTo(m*a-.5*a,b*a),e.lineTo(m*a,b*a-.5*a),e.closePath(),e.fill(),e.stroke()),u.getValue(m+1,b)&&u.getValue(m,b-1)&&u.getValue(m+1,b-1)&&(e.beginPath(),e.moveTo(m*a+.5*a,b*a-.5*a),e.lineTo(m*a+.5*a,b*a),e.lineTo(m*a,b*a-.5*a),e.closePath(),e.fill(),e.stroke()),u.getValue(m-1,b)&&u.getValue(m,b+1)&&u.getValue(m-1,b+1)&&(e.beginPath(),e.moveTo(m*a-.5*a,b*a+.5*a),e.lineTo(m*a-.5*a,b*a),e.lineTo(m*a,b*a+.5*a),e.closePath(),e.fill(),e.stroke()),u.getValue(m+1,b)&&u.getValue(m,b+1)&&u.getValue(m+1,b+1)&&(e.beginPath(),e.moveTo(m*a+.5*a,b*a+.5*a),e.lineTo(m*a+.5*a,b*a),e.lineTo(m*a,b*a+.5*a),e.closePath(),e.fill(),e.stroke()));e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},hexagon:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage));var f=r.innerColor||(null==g?void 0:g[1])||s,c=r.outerColor||s,h=n;!r.backgroundColor&&t.backgroundImage&&(h=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=h,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i+a/2,l+a/2);for(var d=1.5,v=0;v<o;v++)for(var m=0;m<o;m++)if(1==u.getValue(v,m)){if(1==u.isPositionPoint(v,m))e.fillStyle=f,e.strokeStyle=f;else if(2==u.isPositionPoint(v,m))e.fillStyle=c,e.strokeStyle=c;else{var b=g[(v+m)%g.length];!r.foregroundColor&&t.foregroundImage&&(b=s),e.fillStyle=b,e.strokeStyle=b}u.isPositionPoint(v,m)?(e.beginPath(),e.moveTo(v*a-.5*a,m*a+1*a),e.lineTo(v*a+3*a,m*a-.5*a),e.lineTo(v*a+6.5*a,m*a+1*a),e.lineTo(v*a+6.5*a,m*a+5*a),e.lineTo(v*a+3*a,m*a+6.5*a),e.lineTo(v*a-.5*a,m*a+5*a),e.closePath(),e.fill(),e.stroke(),e.fillStyle=h,e.strokeStyle=h,e.beginPath(),e.moveTo(v*a+.5*a,m*a+1.5*a+1/14*a),e.lineTo(v*a+3*a,m*a+.5*a),e.lineTo(v*a+5.5*a,m*a+1.5*a+1/14*a),e.lineTo(v*a+5.5*a,m*a+4.5*a-1/14*a),e.lineTo(v*a+3*a,m*a+5.5*a),e.lineTo(v*a+.5*a,m*a+4.5*a-1/14*a),e.closePath(),e.fill(),e.stroke(),e.fillStyle=f,e.strokeStyle=f,e.beginPath(),e.moveTo(v*a+1.5*a,m*a+2.5*a-5/14*a),e.lineTo(v*a+3*a,m*a+1.5*a),e.lineTo(v*a+4.5*a,m*a+2.5*a-5/14*a),e.lineTo(v*a+4.5*a,m*a+3.5*a+5/14*a),e.lineTo(v*a+3*a,m*a+4.5*a),e.lineTo(v*a+1.5*a,m*a+3.5*a+5/14*a),e.closePath(),e.fill(),e.stroke(),u.setRangeDisabled(v,m,7,7),e.fillRect(v*a-.25*a,m*a-.25*a,.5*a,.5*a),e.fillRect(v*a+5.75*a,m*a-.25*a,.5*a,.5*a),e.fillRect(v*a-.25*a,m*a+5.75*a,.5*a,.5*a),e.fillRect(v*a+5.75*a,m*a+5.75*a,.5*a,.5*a)):(e.beginPath(),v%2?(e.moveTo(v*a-a/d,m*a-.25*a),e.lineTo(v*a-a/d/2,m*a-.75*a),e.lineTo(v*a+a/d/2,m*a-.75*a),e.lineTo(v*a+a/d,m*a-.25*a),e.lineTo(v*a+a/d/2,m*a+.25*a),e.lineTo(v*a-a/d/2,m*a+.25*a)):(e.moveTo(v*a-a/d,m*a+.25*a),e.lineTo(v*a-a/d/2,m*a-.25*a),e.lineTo(v*a+a/d/2,m*a-.25*a),e.lineTo(v*a+a/d,m*a+.25*a),e.lineTo(v*a+a/d/2,m*a+.75*a),e.lineTo(v*a-a/d/2,m*a+.75*a)),e.closePath(),e.fill(),e.stroke())}e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},bar:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage));var f=r.innerColor||(null==g?void 0:g[1])||s,c=r.outerColor||s,h=n;!r.backgroundColor&&t.backgroundImage&&(h=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=h,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i+.5*a,l+.5*a);for(var d=function(n){for(var i=function(o){if(1==u.getValue(n,o)){if(1==u.isPositionPoint(n,o))e.fillStyle=f;else if(2==u.isPositionPoint(n,o))e.fillStyle=c;else{var i=g[(n+o)%g.length];!r.foregroundColor&&t.foregroundImage&&(i=s),e.fillStyle=i}u.isPositionPoint(n,o)?(e.beginPath(),e.arc((n+3)*a,(o+3)*a,3.5*a,0,2*Math.PI),e.closePath(),e.fill(),e.fillStyle=h,e.beginPath(),e.arc((n+3)*a,(o+3)*a,2.5*a,0,2*Math.PI),e.closePath(),e.fill(),e.fillStyle=f,e.beginPath(),e.arc((n+3)*a,(o+3)*a,1.5*a,0,2*Math.PI),e.closePath(),e.fill(),u.setRangeDisabled(n,o,7,7)):[[4,4],[4,3],[4,3],[4,1],[3,4],[3,3],[3,2],[3,1],[2,4],[2,3],[2,2],[2,1],[1,4],[1,3],[1,2],[1,1]].forEach((function(t){u.getRangeTrue(n,o,t[0],t[1])&&function(t,r,o,n){e.beginPath(),e.arc(t*a,r*a,.4*a,1*Math.PI,1.5*Math.PI),e.arc((t+o-1)*a,r*a,.4*a,1.5*Math.PI,0*Math.PI),e.arc((t+o-1)*a,(r+n-1)*a,.4*a,0*Math.PI,.5*Math.PI),e.arc(t*a,(r+n-1)*a,.4*a,.5*Math.PI,1*Math.PI),e.closePath(),e.fill(),u.setRangeDisabled(t,r,o,n)}(n,o,t[0],t[1])}))}},l=0;l<o;l++)i(l)},v=0;v<o;v++)d(v);e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},heart:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage));var f=r.innerColor||(null==g?void 0:g[1])||s,c=r.outerColor||s,h=n;!r.backgroundColor&&t.backgroundImage&&(h=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=h,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore();for(var d=a,v=0;v<o;v++)for(var m=0;m<o;m++)if(1==u.getValue(v,m)){if(e.save(),1==u.isPositionPoint(v,m))e.fillStyle=f;else if(2==u.isPositionPoint(v,m))e.fillStyle=c;else{var b=g[(v+m)%g.length];!r.foregroundColor&&t.foregroundImage&&(b=s),e.fillStyle=b}u.getRangeTrue(v,m,3,3)?(d=.92*a,e.translate(i+(v+1.45)*a,l+(m+.95)*a),e.beginPath(),e.arc(-d,0,d,Math.PI,0,!1),e.arc(d,0,d,Math.PI,0,!1),e.bezierCurveTo(1.9*d,1.2*d,.6*d,1.6*d,0,3*d),e.bezierCurveTo(-.6*d,1.6*d,-1.9*d,1.2*d,-2*d,0),e.closePath(),e.fill(),u.setRangeDisabled(v,m,3,3)):u.getRangeTrue(v,m,2,2)?(d=.5*a,e.translate(i+(v+1)*a,l+(m+.9)*a),e.beginPath(),e.arc(-d,0,d,Math.PI,0,!1),e.arc(d,0,d,Math.PI,0,!1),e.bezierCurveTo(1.9*d,1.2*d,.6*d,1.6*d,0,3*d),e.bezierCurveTo(-.6*d,1.6*d,-1.9*d,1.2*d,-2*d,0),e.closePath(),e.fill(),u.setRangeDisabled(v,m,2,2)):(d=.25*a,e.translate(i+(v+.5)*a,l+(m+.5)*a),e.beginPath(),e.arc(-d,0,d,Math.PI,0,!1),e.arc(d,0,d,Math.PI,0,!1),e.bezierCurveTo(1.9*d,1.2*d,.6*d,1.6*d,0,3*d),e.bezierCurveTo(-.6*d,1.6*d,-1.9*d,1.2*d,-2*d,0),e.closePath(),e.fill()),e.restore()}e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},glitter:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=(r.foregroundColor||"#000000").split(","),s=g[0];!r.foregroundColor&&t.foregroundImage&&(s=u.getImageBrush(t.foregroundImage));var f=r.innerColor||(null==g?void 0:g[1])||s,c=r.outerColor||s,h=n;!r.backgroundColor&&t.backgroundImage&&(h=u.getImageBrush(t.backgroundImage)),e.save(),e.fillStyle=h,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l),e.fillStyle=g[0];for(var d=0;d<o;d++)for(var v=0;v<o;v++){if(1==u.isPositionPoint(d,v))e.fillStyle=f;else if(2==u.isPositionPoint(d,v))e.fillStyle=c;else{var m=g[(d+v)%g.length];!r.foregroundColor&&t.foregroundImage&&(m=s),e.fillStyle=m}1==u.getValue(d,v)&&(u.isPositionPoint(d,v)?(e.beginPath(),e.arc((d+3.5)*a,(v+3.5)*a,3.75*a,0,2*Math.PI),e.closePath(),e.fill(),e.fillStyle=h,e.beginPath(),e.arc((d+3.5)*a,(v+3.5)*a,2.8*a,0,2*Math.PI),e.closePath(),e.fill(),e.fillStyle=f,e.beginPath(),e.arc((d+1)*a,(v+1)*a,2.5*a,0,.5*Math.PI),e.arc((d+6)*a,(v+1)*a,2.5*a,.5*Math.PI,Math.PI),e.arc((d+6)*a,(v+5)*a+a,2.5*a,Math.PI,1.5*Math.PI),e.arc((d+1)*a,(v+5)*a+a,2.5*a,1.5*Math.PI,2*Math.PI),e.closePath(),e.fill(),u.setRangeDisabled(d,v,7,7)):(d+v)%2?(e.beginPath(),e.arc(d*a,v*a,.5*a,0,.5*Math.PI),e.arc(d*a+a,v*a,.5*a,.5*Math.PI,Math.PI),e.arc(d*a+a,v*a+a,.5*a,Math.PI,1.5*Math.PI),e.arc(d*a,v*a+a,.5*a,1.5*Math.PI,2*Math.PI),e.closePath(),e.fill()):(e.beginPath(),e.arc((d+.5)*a,(v+.5)*a,.5*a,0,2*Math.PI),e.closePath(),e.fill()))}e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},fusion:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(t){var n=r.backgroundColor||"#ffffff",g=r.foregroundColor||"#000000",s=g.split(","),f=s[0],c=r.innerColor||s[0],h=r.outerColor||s[0];t.backgroundImage&&(f=g=s[0].replace(/#([0-9a-fA-F]{6}).*/,"#$188"),n=n.replace(/#([0-9a-fA-F]{6}).*/,"#$188"),c=c.replace(/#([0-9a-fA-F]{6}).*/,"#$188"),h=h.replace(/#([0-9a-fA-F]{6}).*/,"#$188"));var d=c||f,v=h||f;if(!r.foregroundColor&&t.foregroundImage&&(f=u.getImageBrush(t.foregroundImage)),s.length>1){var m=e.createLinearGradient(0,0,e.canvas.width,e.canvas.height),b=s.length-1;s.forEach((function(e,t){m.addColorStop(t/b,e)})),f=m}var y=t.backgroundImage?u.getImageBrush(t.backgroundImage):n;e.save(),e.fillStyle=y,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l);for(var P=0;P<o;P++)for(var I=0;I<o;I++)if(u.isPositionPoint(P,I))1==u.getValue(P,I)&&(e.fillStyle=v,e.fillRect(P*a,I*a,7*a,7*a),e.fillStyle=y,e.fillRect((P+1)*a,(I+1)*a,5*a,5*a),e.fillStyle=n,e.fillRect((P+1)*a,(I+1)*a,5*a,5*a),e.fillStyle=y,e.fillRect((P+2)*a,(I+2)*a,3*a,3*a),e.fillStyle=d,e.fillRect((P+2)*a,(I+2)*a,3*a,3*a),u.setRangeDisabled(P,I,7,7));else{var p=1==u.getValue(P,I)?f:n;e.fillStyle=p,e.beginPath(),e.arc(P*a,I*a,.5*a,0,.5*Math.PI),e.arc(P*a+a,I*a,.5*a,.5*Math.PI,Math.PI),e.arc(P*a+a,I*a+a,.5*a,Math.PI,1.5*Math.PI),e.arc(P*a,I*a+a,.5*a,1.5*Math.PI,2*Math.PI),e.closePath(),e.fill()}e.restore(),e.save(),u.setText(),t.logo&&u.setLogo(t.logo),e.restore()}))},stroke:function(e,t,r){var o=t.length,n=.05*e.canvas.width,a=(e.canvas.width-2*n)/o,i=n,l=n,u=j(e,t,r),g={};r.foregroundImage&&(g.foregroundImage=r.foregroundImage),r.backgroundImage&&(g.backgroundImage=r.backgroundImage),r.logo&&(g.logo=r.logo),u.imageReady(g).then((function(n){var g=r.backgroundColor||"#ffffff",s=(r.foregroundColor||"#000000").split(","),f=s[0];!r.foregroundColor&&n.foregroundImage&&(f=u.getImageBrush(n.foregroundImage));var c=r.innerColor||f,h=r.outerColor||(null==s?void 0:s[1])||f,d=g;!r.backgroundColor&&n.backgroundImage&&(d=u.getImageBrush(n.backgroundImage)),e.save(),e.fillStyle=d,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore(),e.save(),e.translate(i,l),e.fillStyle=s[0];for(var v=0;v<o;v++)for(var m=0;m<o;m++)if(1==u.getValue(v,m))if(!((v+m)%2)||u.getValue(v-1,m)||u.getValue(v+1,m)||u.getValue(v,m-1)||u.getValue(v,m+1)){for(var b=9;b;b--)for(var y=9;y;y--)if(u.getRangeTrue(v,m,b,y)){e.fillRect((v+.05)*a,(m+.05)*a,(b-.1)*a,(y-.1)*a);break}}else e.beginPath(),e.arc((v+.5)*a,(m+.5)*a,.25*a,0,2*Math.PI),e.closePath(),e.fill();var P=JSON.parse(JSON.stringify(t)),I=function t(r,o){if(u.getValue(r,o)&&1==P[r][o]){if(!((r+o)%2)||u.getValue(r-1,o)||u.getValue(r+1,o)||u.getValue(r,o-1)||u.getValue(r,o+1)){for(var n=9;n;n--)for(var i=9;i;i--)if(u.getRangeTrue(r,o,n,i)){e.fillRect((r+.15)*a,(o+.15)*a,(n-.3)*a,(i-.3)*a);break}}else;P[r][o]=2,t(r-1,o),t(r+1,o),t(r,o-1),t(r,o+1)}};e.lineWidth=1;for(var p=0;p<o;p++)for(var k=0;k<o;k++)if(1==u.getValue(p,k)){if(1==u.isPositionPoint(p,k))e.fillStyle=c;else if(2==u.isPositionPoint(p,k))e.fillStyle=h;else{var w=s[1+p*k%(s.length-1)];!r.foregroundColor&&n.foregroundImage&&(w=f),e.fillStyle=w}I(p,k)}e.restore(),e.save(),u.setText(),n.logo&&u.setLogo(n.logo),e.restore()}))}};const N=new CSSStyleSheet;function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=u(e);if(t){var n=u(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return l(this,r)}}N.replaceSync(':host {\n    display: inline-block;\n    vertical-align: middle;\n    container-type: inline-size;\n    font-family: Arial,Helvetica,"Microsoft Yahei";\n    font-size: 14px;\n    aspect-ratio: 1;\n}\n\n.mod-qrcode{\n    position: relative;\n    width: 100%;\n    height: 100%;\n}\n.mod-qrcode canvas{\n    width: 100%;\n    height: 100%;\n    background: #ffffff;\n    vertical-align: middle;\n}\n');var z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(u,e);var t,o,n,l=G(u);function u(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(e=l.call(this)).attachShadow({mode:"open"}),e}return t=u,o=[{key:"value",get:function(){return this.getAttribute("value")||"https://passer-by.com/"},set:function(e){return this.setAttribute("value",e)}},{key:"template",get:function(){return this.getAttribute("template")||"default"},set:function(e){return this.setAttribute("template",e)}},{key:"level",get:function(){return this.getAttribute("level")||"H"},set:function(e){return this.setAttribute("level",e)}},{key:"width",get:function(){return+this.getAttribute("width")||0},set:function(e){return this.setAttribute("width",e)}},{key:"height",get:function(){return+this.getAttribute("height")||0},set:function(e){return this.setAttribute("height",e)}},{key:"logo",get:function(){return this.getAttribute("logo")||""},set:function(e){return this.setAttribute("logo",e)}},{key:"text",get:function(){return this.getAttribute("text")||""},set:function(e){return this.setAttribute("text",e)}},{key:"textColor",get:function(){return this.getAttribute("text-color")||""},set:function(e){return this.setAttribute("text-color",e)}},{key:"textStroke",get:function(){return this.getAttribute("text-stroke")||""},set:function(e){return this.setAttribute("text-stroke",e)}},{key:"foregroundImage",get:function(){return this.getAttribute("foreground-image")||""},set:function(e){return this.setAttribute("foreground-image",e)}},{key:"backgroundImage",get:function(){return this.getAttribute("background-image")||""},set:function(e){return this.setAttribute("background-image",e)}},{key:"foregroundColor",get:function(){return this.getAttribute("foreground-color")||""},set:function(e){return this.setAttribute("foreground-color",e)}},{key:"backgroundColor",get:function(){return this.getAttribute("background-color")||""},set:function(e){return this.setAttribute("background-color",e)}},{key:"innerColor",get:function(){return this.getAttribute("inner-color")||""},set:function(e){return this.setAttribute("inner-color",e)}},{key:"outerColor",get:function(){return this.getAttribute("outer-color")||""},set:function(e){return this.setAttribute("outer-color",e)}},{key:"attributeChangedCallback",value:function(e,t,r){t!=r&&this.context&&this.drawQRCode()}},{key:"connectedCallback",value:function(){var e=this,t=new CSSStyleSheet;if(t.insertRule("\n            :host{\n                --width: attr(width px);\n                --height: attr(height px);\n                width: var(--width, 300px);\n                height: var(--height, 300px); \n            }\n        "),e.shadowRoot.adoptedStyleSheets)e.shadowRoot.adoptedStyleSheets=[t,N];else{var o=document.createElement("style");o.rel="stylesheet",o.textContent=[t.cssRules].concat(r(N.cssRules)).map((function(e){return e.cssText})).join(""),e.shadowRoot.appendChild(o)}e.render(),e.drawQRCode(),e.addEventListener("resize",(function(){e.resize()}),!1),navigator.userAgent.includes("Edg/")&&document.addEventListener("visibilitychange",(function(){e.drawQRCode()}))}},{key:"render",value:function(e){var t=this;t.shadowRoot.innerHTML='<div class="mod-qrcode">\n            <canvas></canvas>\n        </div>',t.$module=t.shadowRoot.querySelector(".mod-qrcode"),t.$canvas=t.$module.querySelector("canvas"),t.context=t.$canvas.getContext("2d"),t.resize(),"undefined"!=typeof ResizeObserver&&new ResizeObserver((function(){t.resize()})).observe(t)}},{key:"resize",value:function(){var e=this,t=window.getComputedStyle(e);if(t.width&&t.height){var r=Math.max(parseInt(t.width),parseInt(t.height));e.$canvas.width=2*r,e.$canvas.height=2*r,e.drawQRCode()}}},{key:"drawQRCode",value:function(){var e=this,t=e.logo?"H":e.level,r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://passer-by.com/",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"H",r=new x(E(e,f[t]),f[t]);return r.addData(e),r.make(),r.modules}(e.value,t);e.context.clearRect(0,0,e.$canvas.width,e.$canvas.height),(H[e.template]||H.default)(e.context,r,{foregroundImage:e.foregroundImage,backgroundImage:e.backgroundImage,foregroundColor:e.foregroundColor,backgroundColor:e.backgroundColor,innerColor:e.innerColor,outerColor:e.outerColor,logo:e.logo,text:e.text,textColor:e.textColor,textStroke:e.textStroke})}}],n=[{key:"observedAttributes",get:function(){return["value","template","level","width","height","logo","text","text-color","text-stroke","foreground-image","background-image","foreground-color","background-color","inner-color","outer-color"]}}],o&&a(t.prototype,o),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),u}(s(HTMLElement));customElements.get("widget-qrcode")||customElements.define("widget-qrcode",z)}));