study_xxqg/docs/qrcode.js

1 line
16 KiB
JavaScript
Raw Normal View History

2022-03-24 10:22:29 +00:00
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.jrQrcode=e():t.jrQrcode=e()}(this,function(){return function(t){function e(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";t.exports=r(3)},function(t,e){"use strict";!function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),r=1;r<arguments.length;r++){var o=arguments[r];if(void 0!==o&&null!==o){o=Object(o);for(var n=Object.keys(Object(o)),i=0,a=n.length;i<a;i++){var s=n[i],u=Object.getOwnPropertyDescriptor(o,s);void 0!==u&&u.enumerable&&(e[s]=o[s])}}}return e}})}()},function(t,e){"use strict";t.exports=function(){var t={};return t.utf16to8=function(t){var e,r,o,n;for(e="",o=t.length,r=0;r<o;r++)n=t.charCodeAt(r),n>=1&&n<=127?e+=t.charAt(r):n>2047?(e+=String.fromCharCode(224|n>>12&15),e+=String.fromCharCode(128|n>>6&63),e+=String.fromCharCode(128|n>>0&63)):(e+=String.fromCharCode(192|n>>6&31),e+=String.fromCharCode(128|n>>0&63));return e},t.utf8to16=function(t){var e,r,o,n,i,a;for(e="",o=t.length,r=0;r<o;)switch(n=t.charCodeAt(r++),n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=t.charAt(r-1);break;case 12:case 13:i=t.charCodeAt(r++),e+=String.fromCharCode((31&n)<<6|63&i);break;case 14:i=t.charCodeAt(r++),a=t.charCodeAt(r++),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|(63&a)<<0)}return e},t}()},function(t,e,r){"use strict";r(1),r(4);var o=r(2),n=function(){function t(t){var e=new QRCode(t.typeNumber,t.correctLevel);e.addData(t.text),e.make();var r=document.createElement("canvas");r.width=t.width,r.height=t.height;var o=r.getContext("2d"),n=(t.width-2*t.padding)/e.getModuleCount(),i=(t.height-2*t.padding)/e.getModuleCount();if(t.reverse){var a="rgba(0, 0, 0, 0)";o.fillStyle=a,t.foreground=a}else o.fillStyle=t.background;o.fillRect(0,0,r.width,r.height);for(var s=0;s<e.getModuleCount();s++)for(var u=0;u<e.getModuleCount();u++){o.fillStyle=e.isDark(s,u)?t.foreground:t.background;var h=Math.ceil((u+1)*n)-Math.floor(u*n),f=Math.ceil((s+1)*n)-Math.floor(s*n);o.fillRect(Math.round(u*n)+t.padding,Math.round(s*i)+t.padding,h,f)}return r}var e={};return e.getQrBase64=function(e,r){"string"!=typeof e&&(e=""),"string"==typeof r?r={text:r}:"object"!=typeof r&&(r={}),r=Object.assign({padding:10,width:256,height:256,typeNumber:-1,correctLevel:QRErrorCorrectLevel.H,reverse:!1,background:"#ffffff",foreground:"#000000"},r);try{r.text=o.utf16to8(e)}catch(t){r.text=""+t}var n=t(r);return n.toDataURL()},e.QRErrorCorrectLevel=QRErrorCorrectLevel,e}();!window.jrQrcode&&(window.jrQrcode=n),t.exports=n},function(t,e){function r(t){this.mode=s.MODE_8BIT_BYTE,this.data=t}function o(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array}function n(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}function i(t,e){this.totalCount=t,this.dataCount=e}function a(){this.buffer=new Array,this.length=0}r.prototype={getLength:function(t){return this.data.length},write:function(t){for(var e=0;e<this.data.length;e++)t.put(this.data.charCodeAt(e),8)}},o.prototype={addData:function(t){var e=new r(t);this.dataList.push(e),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var t=1;for(t=1;t<40;t++){for(var e=i.getRSBlocks(t,this.errorCorrectLevel),r=new a,o=0,n=0;n<e.length;n++)o+=e[n].dataCount;for(var n=0;n<this.dataList.length;n++){var s=this.dataList[n];r.put(s.mode,4),r.put