mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
9 lines
28 KiB
JavaScript
9 lines
28 KiB
JavaScript
var de=Object.defineProperty;var It=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable;var Pt=(r,o,i)=>o in r?de(r,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[o]=i,Mt=(r,o)=>{for(var i in o||(o={}))ge.call(o,i)&&Pt(r,i,o[i]);if(It)for(var i of It(o))he.call(o,i)&&Pt(r,i,o[i]);return r};var tt=(r,o,i)=>new Promise((n,t)=>{var e=u=>{try{a(i.next(u))}catch(c){t(c)}},s=u=>{try{a(i.throw(u))}catch(c){t(c)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(e,s);a((i=i.apply(r,o)).next())});import{p as W}from"./propTypes-B9jTUFW5.js";import{S as me,d as we,a as Nt,p as vt,n as Ce,f as U,z as ye,A as Ee,u as V,h as Be,F as pe,x as Re,ag as Ae,ax as Lt,V as Te}from"./index-DI6gHrBb.js";import{R as be}from"./refresh-right-rMUb0Mev.js";var j={},et,Dt;function Se(){return Dt||(Dt=1,et=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),et}var nt={},_={},qt;function H(){if(qt)return _;qt=1;let r;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return _.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},_.getSymbolTotalCodewords=function(n){return o[n]},_.getBCHDigit=function(i){let n=0;for(;i!==0;)n++,i>>>=1;return n},_.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');r=n},_.isKanjiModeEnabled=function(){return typeof r!="undefined"},_.toSJIS=function(n){return r(n)},_}var rt={},Ut;function Tt(){return Ut||(Ut=1,function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function o(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+i)}}r.isValid=function(n){return n&&typeof n.bit!="undefined"&&n.bit>=0&&n.bit<4},r.from=function(n,t){if(r.isValid(n))return n;try{return o(n)}catch(e){return t}}}(rt)),rt}var ot,_t;function Ie(){if(_t)return ot;_t=1;function r(){this.buffer=[],this.length=0}return r.prototype={get:function(o){const i=Math.floor(o/8);return(this.buffer[i]>>>7-o%8&1)===1},put:function(o,i){for(let n=0;n<i;n++)this.putBit((o>>>i-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),o&&(this.buffer[i]|=128>>>this.length%8),this.length++}},ot=r,ot}var it,kt;function Pe(){if(kt)return it;kt=1;function r(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}return r.prototype.set=function(o,i,n,t){const e=o*this.size+i;this.data[e]=n,t&&(this.reservedBit[e]=!0)},r.prototype.get=function(o,i){return this.data[o*this.size+i]},r.prototype.xor=function(o,i,n){this.data[o*this.size+i]^=n},r.prototype.isReserved=function(o,i){return this.reservedBit[o*this.size+i]},it=r,it}var st={},Ft;function Me(){return Ft||(Ft=1,function(r){const o=H().getSymbolSize;r.getRowColCoords=function(n){if(n===1)return[];const t=Math.floor(n/7)+2,e=o(n),s=e===145?26:Math.ceil((e-13)/(2*t-2))*2,a=[e-7];for(let u=1;u<t-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},r.getPositions=function(n){const t=[],e=r.getRowColCoords(n),s=e.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||t.push([e[a],e[u]]);return t}}(st)),st}var ut={},zt;function Ne(){if(zt)return ut;zt=1;const r=H().getSymbolSize,o=7;return ut.getPositions=function(n){const t=r(n);return[[0,0],[t-o,0],[0,t-o]]},ut}var at={},Vt;function ve(){return Vt||(Vt=1,function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const o={N1:3,N2:3,N3:40,N4:10};r.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){const e=t.size;let s=0,a=0,u=0,c=null,m=null;for(let S=0;S<e;S++){a=u=0,c=m=null;for(let E=0;E<e;E++){let g=t.get(S,E);g===c?a++:(a>=5&&(s+=o.N1+(a-5)),c=g,a=1),g=t.get(E,S),g===m?u++:(u>=5&&(s+=o.N1+(u-5)),m=g,u=1)}a>=5&&(s+=o.N1+(a-5)),u>=5&&(s+=o.N1+(u-5))}return s},r.getPenaltyN2=function(t){const e=t.size;let s=0;for(let a=0;a<e-1;a++)for(let u=0;u<e-1;u++){const c=t.get(a,u)+t.get(a,u+1)+t.get(a+1,u)+t.get(a+1,u+1);(c===4||c===0)&&s++}return s*o.N2},r.getPenaltyN3=function(t){const e=t.size;let s=0,a=0,u=0;for(let c=0;c<e;c++){a=u=0;for(let m=0;m<e;m++)a=a<<1&2047|t.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|t.get(m,c),m>=10&&(u===1488||u===93)&&s++}return s*o.N3},r.getPenaltyN4=function(t){let e=0;const s=t.data.length;for(let u=0;u<s;u++)e+=t.data[u];return Math.abs(Math.ceil(e*100/s/5)-10)*o.N4};function i(n,t,e){switch(n){case r.Patterns.PATTERN000:return(t+e)%2===0;case r.Patterns.PATTERN001:return t%2===0;case r.Patterns.PATTERN010:return e%3===0;case r.Patterns.PATTERN011:return(t+e)%3===0;case r.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2===0;case r.Patterns.PATTERN101:return t*e%2+t*e%3===0;case r.Patterns.PATTERN110:return(t*e%2+t*e%3)%2===0;case r.Patterns.PATTERN111:return(t*e%3+(t+e)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}r.applyMask=function(t,e){const s=e.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)e.isReserved(u,a)||e.xor(u,a,i(t,u,a))},r.getBestMask=function(t,e){const s=Object.keys(r.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){e(c),r.applyMask(c,t);const m=r.getPenaltyN1(t)+r.getPenaltyN2(t)+r.getPenaltyN3(t)+r.getPenaltyN4(t);r.applyMask(c,t),m<u&&(u=m,a=c)}return a}}(at)),at}var $={},Ht;function ue(){if(Ht)return $;Ht=1;const r=Tt(),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return $.getBlocksCount=function(t,e){switch(e){case r.L:return o[(t-1)*4+0];case r.M:return o[(t-1)*4+1];case r.Q:return o[(t-1)*4+2];case r.H:return o[(t-1)*4+3];default:return}},$.getTotalCodewordsCount=function(t,e){switch(e){case r.L:return i[(t-1)*4+0];case r.M:return i[(t-1)*4+1];case r.Q:return i[(t-1)*4+2];case r.H:return i[(t-1)*4+3];default:return}},$}var ct={},Y={},Kt;function Le(){if(Kt)return Y;Kt=1;const r=new Uint8Array(512),o=new Uint8Array(256);return function(){let n=1;for(let t=0;t<255;t++)r[t]=n,o[n]=t,n<<=1,n&256&&(n^=285);for(let t=255;t<512;t++)r[t]=r[t-255]}(),Y.log=function(n){if(n<1)throw new Error("log("+n+")");return o[n]},Y.exp=function(n){return r[n]},Y.mul=function(n,t){return n===0||t===0?0:r[o[n]+o[t]]},Y}var Ot;function De(){return Ot||(Ot=1,function(r){const o=Le();r.mul=function(n,t){const e=new Uint8Array(n.length+t.length-1);for(let s=0;s<n.length;s++)for(let a=0;a<t.length;a++)e[s+a]^=o.mul(n[s],t[a]);return e},r.mod=function(n,t){let e=new Uint8Array(n);for(;e.length-t.length>=0;){const s=e[0];for(let u=0;u<t.length;u++)e[u]^=o.mul(t[u],s);let a=0;for(;a<e.length&&e[a]===0;)a++;e=e.slice(a)}return e},r.generateECPolynomial=function(n){let t=new Uint8Array([1]);for(let e=0;e<n;e++)t=r.mul(t,new Uint8Array([1,o.exp(e)]));return t}}(ct)),ct}var lt,Jt;function qe(){if(Jt)return lt;Jt=1;const r=De();function o(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return o.prototype.initialize=function(n){this.degree=n,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(n.length+this.degree);t.set(n);const e=r.mod(t,this.genPoly),s=this.degree-e.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(e,s),a}return e},lt=o,lt}var ft={},dt={},gt={},jt;function ae(){return jt||(jt=1,gt.isValid=function(o){return!isNaN(o)&&o>=1&&o<=40}),gt}var L={},Yt;function ce(){if(Yt)return L;Yt=1;const r="[0-9]+",o="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
|
|
]))+`;L.KANJI=new RegExp(i,"g"),L.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),L.BYTE=new RegExp(n,"g"),L.NUMERIC=new RegExp(r,"g"),L.ALPHANUMERIC=new RegExp(o,"g");const t=new RegExp("^"+i+"$"),e=new RegExp("^"+r+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return L.testKanji=function(u){return t.test(u)},L.testNumeric=function(u){return e.test(u)},L.testAlphanumeric=function(u){return s.test(u)},L}var Qt;function K(){return Qt||(Qt=1,function(r){const o=ae(),i=ce();r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(e,s){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!o.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?e.ccBits[0]:s<27?e.ccBits[1]:e.ccBits[2]},r.getBestModeForData=function(e){return i.testNumeric(e)?r.NUMERIC:i.testAlphanumeric(e)?r.ALPHANUMERIC:i.testKanji(e)?r.KANJI:r.BYTE},r.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},r.isValid=function(e){return e&&e.bit&&e.ccBits};function n(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+t)}}r.from=function(e,s){if(r.isValid(e))return e;try{return n(e)}catch(a){return s}}}(dt)),dt}var Gt;function Ue(){return Gt||(Gt=1,function(r){const o=H(),i=ue(),n=Tt(),t=K(),e=ae(),s=7973,a=o.getBCHDigit(s);function u(E,g,P){for(let f=1;f<=40;f++)if(g<=r.getCapacity(f,P,E))return f}function c(E,g){return t.getCharCountIndicator(E,g)+4}function m(E,g){let P=0;return E.forEach(function(f){const M=c(f.mode,g);P+=M+f.getBitsLength()}),P}function S(E,g){for(let P=1;P<=40;P++)if(m(E,P)<=r.getCapacity(P,g,t.MIXED))return P}r.from=function(g,P){return e.isValid(g)?parseInt(g,10):P},r.getCapacity=function(g,P,f){if(!e.isValid(g))throw new Error("Invalid QR Code version");typeof f=="undefined"&&(f=t.BYTE);const M=o.getSymbolTotalCodewords(g),h=i.getTotalCodewordsCount(g,P),b=(M-h)*8;if(f===t.MIXED)return b;const R=b-c(f,g);switch(f){case t.NUMERIC:return Math.floor(R/10*3);case t.ALPHANUMERIC:return Math.floor(R/11*2);case t.KANJI:return Math.floor(R/13);case t.BYTE:default:return Math.floor(R/8)}},r.getBestVersionForData=function(g,P){let f;const M=n.from(P,n.M);if(Array.isArray(g)){if(g.length>1)return S(g,M);if(g.length===0)return 1;f=g[0]}else f=g;return u(f.mode,f.getLength(),M)},r.getEncodedBits=function(g){if(!e.isValid(g)||g<7)throw new Error("Invalid QR Code version");let P=g<<12;for(;o.getBCHDigit(P)-a>=0;)P^=s<<o.getBCHDigit(P)-a;return g<<12|P}}(ft)),ft}var ht={},Wt;function _e(){if(Wt)return ht;Wt=1;const r=H(),o=1335,i=21522,n=r.getBCHDigit(o);return ht.getEncodedBits=function(e,s){const a=e.bit<<3|s;let u=a<<10;for(;r.getBCHDigit(u)-n>=0;)u^=o<<r.getBCHDigit(u)-n;return(a<<10|u)^i},ht}var mt={},wt,$t;function ke(){if($t)return wt;$t=1;const r=K();function o(i){this.mode=r.NUMERIC,this.data=i.toString()}return o.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(n){let t,e,s;for(t=0;t+3<=this.data.length;t+=3)e=this.data.substr(t,3),s=parseInt(e,10),n.put(s,10);const a=this.data.length-t;a>0&&(e=this.data.substr(t),s=parseInt(e,10),n.put(s,a*3+1))},wt=o,wt}var Ct,Xt;function Fe(){if(Xt)return Ct;Xt=1;const r=K(),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(n){this.mode=r.ALPHANUMERIC,this.data=n}return i.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let s=o.indexOf(this.data[e])*45;s+=o.indexOf(this.data[e+1]),t.put(s,11)}this.data.length%2&&t.put(o.indexOf(this.data[e]),6)},Ct=i,Ct}var yt,Zt;function ze(){if(Zt)return yt;Zt=1;const r=K();function o(i){this.mode=r.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return o.getBitsLength=function(n){return n*8},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(i){for(let n=0,t=this.data.length;n<t;n++)i.put(this.data[n],8)},yt=o,yt}var Et,xt;function Ve(){if(xt)return Et;xt=1;const r=K(),o=H();function i(n){this.mode=r.KANJI,this.data=n}return i.getBitsLength=function(t){return t*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(n){let t;for(t=0;t<this.data.length;t++){let e=o.toSJIS(this.data[t]);if(e>=33088&&e<=40956)e-=33088;else if(e>=57408&&e<=60351)e-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
Make sure your charset is UTF-8`);e=(e>>>8&255)*192+(e&255),n.put(e,13)}},Et=i,Et}var Bt={exports:{}},te;function He(){return te||(te=1,function(r){var o={single_source_shortest_paths:function(i,n,t){var e={},s={};s[n]=0;var a=o.PriorityQueue.make();a.push(n,0);for(var u,c,m,S,E,g,P,f,M;!a.empty();){u=a.pop(),c=u.value,S=u.cost,E=i[c]||{};for(m in E)E.hasOwnProperty(m)&&(g=E[m],P=S+g,f=s[m],M=typeof s[m]=="undefined",(M||f>P)&&(s[m]=P,a.push(m,P),e[m]=c))}if(typeof t!="undefined"&&typeof s[t]=="undefined"){var h=["Could not find a path from ",n," to ",t,"."].join("");throw new Error(h)}return e},extract_shortest_path_from_predecessor_list:function(i,n){for(var t=[],e=n;e;)t.push(e),i[e],e=i[e];return t.reverse(),t},find_path:function(i,n,t){var e=o.single_source_shortest_paths(i,n,t);return o.extract_shortest_path_from_predecessor_list(e,t)},PriorityQueue:{make:function(i){var n=o.PriorityQueue,t={},e;i=i||{};for(e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t.queue=[],t.sorter=i.sorter||n.default_sorter,t},default_sorter:function(i,n){return i.cost-n.cost},push:function(i,n){var t={value:i,cost:n};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=o}(Bt)),Bt.exports}var ee;function Ke(){return ee||(ee=1,function(r){const o=K(),i=ke(),n=Fe(),t=ze(),e=Ve(),s=ce(),a=H(),u=He();function c(h){return unescape(encodeURIComponent(h)).length}function m(h,b,R){const C=[];let N;for(;(N=h.exec(R))!==null;)C.push({data:N[0],index:N.index,mode:b,length:N[0].length});return C}function S(h){const b=m(s.NUMERIC,o.NUMERIC,h),R=m(s.ALPHANUMERIC,o.ALPHANUMERIC,h);let C,N;return a.isKanjiModeEnabled()?(C=m(s.BYTE,o.BYTE,h),N=m(s.KANJI,o.KANJI,h)):(C=m(s.BYTE_KANJI,o.BYTE,h),N=[]),b.concat(R,C,N).sort(function(p,A){return p.index-A.index}).map(function(p){return{data:p.data,mode:p.mode,length:p.length}})}function E(h,b){switch(b){case o.NUMERIC:return i.getBitsLength(h);case o.ALPHANUMERIC:return n.getBitsLength(h);case o.KANJI:return e.getBitsLength(h);case o.BYTE:return t.getBitsLength(h)}}function g(h){return h.reduce(function(b,R){const C=b.length-1>=0?b[b.length-1]:null;return C&&C.mode===R.mode?(b[b.length-1].data+=R.data,b):(b.push(R),b)},[])}function P(h){const b=[];for(let R=0;R<h.length;R++){const C=h[R];switch(C.mode){case o.NUMERIC:b.push([C,{data:C.data,mode:o.ALPHANUMERIC,length:C.length},{data:C.data,mode:o.BYTE,length:C.length}]);break;case o.ALPHANUMERIC:b.push([C,{data:C.data,mode:o.BYTE,length:C.length}]);break;case o.KANJI:b.push([C,{data:C.data,mode:o.BYTE,length:c(C.data)}]);break;case o.BYTE:b.push([{data:C.data,mode:o.BYTE,length:c(C.data)}])}}return b}function f(h,b){const R={},C={start:{}};let N=["start"];for(let w=0;w<h.length;w++){const p=h[w],A=[];for(let l=0;l<p.length;l++){const y=p[l],B=""+w+l;A.push(B),R[B]={node:y,lastCount:0},C[B]={};for(let T=0;T<N.length;T++){const d=N[T];R[d]&&R[d].node.mode===y.mode?(C[d][B]=E(R[d].lastCount+y.length,y.mode)-E(R[d].lastCount,y.mode),R[d].lastCount+=y.length):(R[d]&&(R[d].lastCount=y.length),C[d][B]=E(y.length,y.mode)+4+o.getCharCountIndicator(y.mode,b))}}N=A}for(let w=0;w<N.length;w++)C[N[w]].end=0;return{map:C,table:R}}function M(h,b){let R;const C=o.getBestModeForData(h);if(R=o.from(b,C),R!==o.BYTE&&R.bit<C.bit)throw new Error('"'+h+'" cannot be encoded with mode '+o.toString(R)+`.
|
|
Suggested mode is: `+o.toString(C));switch(R===o.KANJI&&!a.isKanjiModeEnabled()&&(R=o.BYTE),R){case o.NUMERIC:return new i(h);case o.ALPHANUMERIC:return new n(h);case o.KANJI:return new e(h);case o.BYTE:return new t(h)}}r.fromArray=function(b){return b.reduce(function(R,C){return typeof C=="string"?R.push(M(C,null)):C.data&&R.push(M(C.data,C.mode)),R},[])},r.fromString=function(b,R){const C=S(b,a.isKanjiModeEnabled()),N=P(C),w=f(N,R),p=u.find_path(w.map,"start","end"),A=[];for(let l=1;l<p.length-1;l++)A.push(w.table[p[l]].node);return r.fromArray(g(A))},r.rawSplit=function(b){return r.fromArray(S(b,a.isKanjiModeEnabled()))}}(mt)),mt}var ne;function Oe(){if(ne)return nt;ne=1;const r=H(),o=Tt(),i=Ie(),n=Pe(),t=Me(),e=Ne(),s=ve(),a=ue(),u=qe(),c=Ue(),m=_e(),S=K(),E=Ke();function g(w,p){const A=w.size,l=e.getPositions(p);for(let y=0;y<l.length;y++){const B=l[y][0],T=l[y][1];for(let d=-1;d<=7;d++)if(!(B+d<=-1||A<=B+d))for(let I=-1;I<=7;I++)T+I<=-1||A<=T+I||(d>=0&&d<=6&&(I===0||I===6)||I>=0&&I<=6&&(d===0||d===6)||d>=2&&d<=4&&I>=2&&I<=4?w.set(B+d,T+I,!0,!0):w.set(B+d,T+I,!1,!0))}}function P(w){const p=w.size;for(let A=8;A<p-8;A++){const l=A%2===0;w.set(A,6,l,!0),w.set(6,A,l,!0)}}function f(w,p){const A=t.getPositions(p);for(let l=0;l<A.length;l++){const y=A[l][0],B=A[l][1];for(let T=-2;T<=2;T++)for(let d=-2;d<=2;d++)T===-2||T===2||d===-2||d===2||T===0&&d===0?w.set(y+T,B+d,!0,!0):w.set(y+T,B+d,!1,!0)}}function M(w,p){const A=w.size,l=c.getEncodedBits(p);let y,B,T;for(let d=0;d<18;d++)y=Math.floor(d/3),B=d%3+A-8-3,T=(l>>d&1)===1,w.set(y,B,T,!0),w.set(B,y,T,!0)}function h(w,p,A){const l=w.size,y=m.getEncodedBits(p,A);let B,T;for(B=0;B<15;B++)T=(y>>B&1)===1,B<6?w.set(B,8,T,!0):B<8?w.set(B+1,8,T,!0):w.set(l-15+B,8,T,!0),B<8?w.set(8,l-B-1,T,!0):B<9?w.set(8,15-B-1+1,T,!0):w.set(8,15-B-1,T,!0);w.set(l-8,8,1,!0)}function b(w,p){const A=w.size;let l=-1,y=A-1,B=7,T=0;for(let d=A-1;d>0;d-=2)for(d===6&&d--;;){for(let I=0;I<2;I++)if(!w.isReserved(y,d-I)){let v=!1;T<p.length&&(v=(p[T]>>>B&1)===1),w.set(y,d-I,v),B--,B===-1&&(T++,B=7)}if(y+=l,y<0||A<=y){y-=l,l=-l;break}}}function R(w,p,A){const l=new i;A.forEach(function(I){l.put(I.mode.bit,4),l.put(I.getLength(),S.getCharCountIndicator(I.mode,w)),I.write(l)});const y=r.getSymbolTotalCodewords(w),B=a.getTotalCodewordsCount(w,p),T=(y-B)*8;for(l.getLengthInBits()+4<=T&&l.put(0,4);l.getLengthInBits()%8!==0;)l.putBit(0);const d=(T-l.getLengthInBits())/8;for(let I=0;I<d;I++)l.put(I%2?17:236,8);return C(l,w,p)}function C(w,p,A){const l=r.getSymbolTotalCodewords(p),y=a.getTotalCodewordsCount(p,A),B=l-y,T=a.getBlocksCount(p,A),d=l%T,I=T-d,v=Math.floor(l/T),k=Math.floor(B/T),F=k+1,z=v-k,Q=new u(z);let O=0;const G=new Array(T),bt=new Array(T);let X=0;const fe=new Uint8Array(w.buffer);for(let J=0;J<T;J++){const x=J<I?k:F;G[J]=fe.slice(O,O+x),bt[J]=Q.encode(G[J]),O+=x,X=Math.max(X,x)}const Z=new Uint8Array(l);let St=0,D,q;for(D=0;D<X;D++)for(q=0;q<T;q++)D<G[q].length&&(Z[St++]=G[q][D]);for(D=0;D<z;D++)for(q=0;q<T;q++)Z[St++]=bt[q][D];return Z}function N(w,p,A,l){let y;if(Array.isArray(w))y=E.fromArray(w);else if(typeof w=="string"){let v=p;if(!v){const k=E.rawSplit(w);v=c.getBestVersionForData(k,A)}y=E.fromString(w,v||40)}else throw new Error("Invalid data");const B=c.getBestVersionForData(y,A);if(!B)throw new Error("The amount of data is too big to be stored in a QR Code");if(!p)p=B;else if(p<B)throw new Error(`
|
|
The chosen QR Code version cannot contain this amount of data.
|
|
Minimum version required to store current data is: `+B+`.
|
|
`);const T=R(p,A,y),d=r.getSymbolSize(p),I=new n(d);return g(I,p),P(I),f(I,p),h(I,A,0),p>=7&&M(I,p),b(I,T),isNaN(l)&&(l=s.getBestMask(I,h.bind(null,I,A))),s.applyMask(l,I),h(I,A,l),{modules:I,version:p,errorCorrectionLevel:A,maskPattern:l,segments:y}}return nt.create=function(p,A){if(typeof p=="undefined"||p==="")throw new Error("No input text");let l=o.M,y,B;return typeof A!="undefined"&&(l=o.from(A.errorCorrectionLevel,o.M),y=c.from(A.version),B=s.from(A.maskPattern),A.toSJISFunc&&r.setToSJISFunction(A.toSJISFunc)),N(p,y,l,B)},nt}var pt={},Rt={},re;function le(){return re||(re=1,function(r){function o(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let n=i.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+i);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(e){return[e,e]}))),n.length===6&&n.push("F","F");const t=parseInt(n.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+n.slice(0,6).join("")}}r.getOptions=function(n){n||(n={}),n.color||(n.color={});const t=typeof n.margin=="undefined"||n.margin===null||n.margin<0?4:n.margin,e=n.width&&n.width>=21?n.width:void 0,s=n.scale||4;return{width:e,scale:e?4:s,margin:t,color:{dark:o(n.color.dark||"#000000ff"),light:o(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},r.getScale=function(n,t){return t.width&&t.width>=n+t.margin*2?t.width/(n+t.margin*2):t.scale},r.getImageWidth=function(n,t){const e=r.getScale(n,t);return Math.floor((n+t.margin*2)*e)},r.qrToImageData=function(n,t,e){const s=t.modules.size,a=t.modules.data,u=r.getScale(s,e),c=Math.floor((s+e.margin*2)*u),m=e.margin*u,S=[e.color.light,e.color.dark];for(let E=0;E<c;E++)for(let g=0;g<c;g++){let P=(E*c+g)*4,f=e.color.light;if(E>=m&&g>=m&&E<c-m&&g<c-m){const M=Math.floor((E-m)/u),h=Math.floor((g-m)/u);f=S[a[M*s+h]?1:0]}n[P++]=f.r,n[P++]=f.g,n[P++]=f.b,n[P]=f.a}}}(Rt)),Rt}var oe;function Je(){return oe||(oe=1,function(r){const o=le();function i(t,e,s){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=s,e.width=s,e.style.height=s+"px",e.style.width=s+"px"}function n(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}r.render=function(e,s,a){let u=a,c=s;typeof u=="undefined"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(c=n()),u=o.getOptions(u);const m=o.getImageWidth(e.modules.size,u),S=c.getContext("2d"),E=S.createImageData(m,m);return o.qrToImageData(E.data,e,u),i(S,c,m),S.putImageData(E,0,0),c},r.renderToDataURL=function(e,s,a){let u=a;typeof u=="undefined"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const c=r.render(e,s,u),m=u.type||"image/png",S=u.rendererOpts||{};return c.toDataURL(m,S.quality)}}(pt)),pt}var At={},ie;function je(){if(ie)return At;ie=1;const r=le();function o(t,e){const s=t.a/255,a=e+'="'+t.hex+'"';return s<1?a+" "+e+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function i(t,e,s){let a=t+e;return typeof s!="undefined"&&(a+=" "+s),a}function n(t,e,s){let a="",u=0,c=!1,m=0;for(let S=0;S<t.length;S++){const E=Math.floor(S%e),g=Math.floor(S/e);!E&&!c&&(c=!0),t[S]?(m++,S>0&&E>0&&t[S-1]||(a+=c?i("M",E+s,.5+g+s):i("m",u,0),u=0,c=!1),E+1<e&&t[S+1]||(a+=i("h",m),m=0)):u++}return a}return At.render=function(e,s,a){const u=r.getOptions(s),c=e.modules.size,m=e.modules.data,S=c+u.margin*2,E=u.color.light.a?"<path "+o(u.color.light,"fill")+' d="M0 0h'+S+"v"+S+'H0z"/>':"",g="<path "+o(u.color.dark,"stroke")+' d="'+n(m,c,u.margin)+'"/>',P='viewBox="0 0 '+S+" "+S+'"',M='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+P+' shape-rendering="crispEdges">'+E+g+`</svg>
|
|
`;return typeof a=="function"&&a(null,M),M},At}var se;function Ye(){if(se)return j;se=1;const r=Se(),o=Oe(),i=Je(),n=je();function t(e,s,a,u,c){const m=[].slice.call(arguments,1),S=m.length,E=typeof m[S-1]=="function";if(!E&&!r())throw new Error("Callback required as last argument");if(E){if(S<2)throw new Error("Too few arguments provided");S===2?(c=a,a=s,s=u=void 0):S===3&&(s.getContext&&typeof c=="undefined"?(c=u,u=void 0):(c=u,u=a,a=s,s=void 0))}else{if(S<1)throw new Error("Too few arguments provided");return S===1?(a=s,s=u=void 0):S===2&&!s.getContext&&(u=a,a=s,s=void 0),new Promise(function(g,P){try{const f=o.create(a,u);g(e(f,s,u))}catch(f){P(f)}})}try{const g=o.create(a,u);c(null,e(g,s,u))}catch(g){c(g)}}return j.create=o.create,j.toCanvas=t.bind(null,i.render),j.toDataURL=t.bind(null,i.renderToDataURL),j.toString=t.bind(null,function(e,s,a){return n.render(e,a)}),j}var Qe=Ye();const Ge=me(Qe),We={tag:W.string.validate(r=>["canvas","img"].includes(r)).def("canvas"),text:{type:[String,Array],default:null},options:{type:Object,default:()=>({})},width:W.number.def(200),logo:{type:[String,Object],default:()=>""},disabled:W.bool.def(!1),disabledText:W.string.def("")},$e=we({name:"ReQrcode",props:We,emits:["done","click","disabled-click"],setup(r,{emit:o}){const{toCanvas:i,toDataURL:n}=Ge,t=Nt(!0),e=Nt(null),s=vt(()=>String(r.text)),a=vt(()=>({width:r.width+"px",height:r.width+"px"})),u=()=>tt(this,null,function*(){yield Re();const f=Ae(r.options||{});if(r.tag==="canvas"){f.errorCorrectionLevel=f.errorCorrectionLevel||S(V(s));const M=yield m(V(s),f);f.scale=r.width===0?void 0:r.width/M*4;const h=yield i(V(e),V(s),f);if(r.logo){const b=yield c(h);o("done",b),t.value=!1}else o("done",h.toDataURL()),t.value=!1}else{const M=yield n(s.value,Mt({errorCorrectionLevel:"H",width:r.width},f));V(e).src=M,o("done",M),t.value=!1}});Ce(()=>s.value,f=>{f&&u()},{deep:!0,immediate:!0});const c=f=>{const M=f.width,h=Object.assign({logoSize:.15,bgColor:"#ffffff",borderSize:.05,crossOrigin:"anonymous",borderRadius:8,logoRadius:0},Lt(r.logo)?{}:r.logo),{logoSize:b=.15,bgColor:R="#ffffff",borderSize:C=.05,crossOrigin:N="anonymous",borderRadius:w=8,logoRadius:p=0}=h,A=Lt(r.logo)?r.logo:r.logo.src,l=M*b,y=M*(1-b)/2,B=M*(b+C),T=M*(1-b-C)/2,d=f.getContext("2d");if(!d)return;E(d)(T,T,B,B,w),d.fillStyle=R,d.fill();const I=new Image;(N||p)&&I.setAttribute("crossOrigin",N),I.src=A;const v=F=>{d.drawImage(F,y,y,l,l)},k=F=>{const z=document.createElement("canvas");z.width=y+l,z.height=y+l;const Q=z.getContext("2d");if(!Q||!d||(Q.drawImage(F,y,y,l,l),E(d)(y,y,l,l,p),!d))return;const O=d.createPattern(z,"no-repeat");O&&(d.fillStyle=O,d.fill())};return new Promise(F=>{I.onload=()=>{p?k(I):v(I),F(f.toDataURL())}})},m=(f,M)=>tt(this,null,function*(){const h=document.createElement("canvas");return yield i(h,f,M),h.width}),S=f=>f.length>36?"M":f.length>16?"Q":"H",E=f=>(M,h,b,R,C)=>{const N=Math.min(b,R);return C>N/2&&(C=N/2),f.beginPath(),f.moveTo(M+C,h),f.arcTo(M+b,h,M+b,h+R,C),f.arcTo(M+b,h+R,M,h+R,C),f.arcTo(M,h+R,M,h,C),f.arcTo(M,h,M+b,h,C),f.closePath(),f},g=()=>{o("click")},P=()=>{o("disabled-click")};return()=>U(pe,null,[ye(U("div",{class:"qrcode relative inline-block",style:V(a)},[r.tag==="canvas"?U("canvas",{ref:e,onClick:g},null):U("img",{ref:e,onClick:g},null),r.disabled&&U("div",{class:"qrcode--disabled absolute top-0 left-0 flex w-full h-full items-center justify-center",onClick:P},[U("div",{class:"absolute top-[50%] left-[50%] font-bold"},[U(Be("iconify-icon-offline"),{class:"cursor-pointer",icon:be,width:"30",color:"var(--el-color-primary)"},null),U("div",null,[r.disabledText])])])]),[[Ee("loading"),V(t)]])])}}),en=Te($e);export{en as R};
|