From 556c887b5873be89a26bc3fe45ef239c6e320d29 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Fri, 22 Apr 2022 13:34:46 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E4=BA=BA=E6=95=B8=E8=AE=8A=E5=8C=96?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{index.26e8f481.js => index.acdfd36c.js} | 2 +- dist/index.html | 4 ++-- index.html | 2 +- src/components/QRCode.vue | 20 +++++++++++++++---- 4 files changed, 20 insertions(+), 8 deletions(-) rename dist/assets/{index.26e8f481.js => index.acdfd36c.js} (99%) diff --git a/dist/assets/index.26e8f481.js b/dist/assets/index.acdfd36c.js similarity index 99% rename from dist/assets/index.26e8f481.js rename to dist/assets/index.acdfd36c.js index a15ba08..eae93dc 100644 --- a/dist/assets/index.26e8f481.js +++ b/dist/assets/index.acdfd36c.js @@ -75,4 +75,4 @@ var k3=Object.defineProperty,x3=Object.defineProperties;var M3=Object.getOwnProp `),r.append(`>> `),r.toString()}setMode(r){this.mode=r}setECLevel(r){this.ecLevel=r}setVersion(r){this.version=r}setMaskPattern(r){this.maskPattern=r}setMatrix(r){this.matrix=r}static isValidMaskPattern(r){return r>=0&&r0;){for(g===6&&(g-=1);b>=0&&b=u;)r^=a<=0)for(let C=0;C!==g;C++){const A=d[C];A>=0&&Lt.isEmpty(a.get(A,b))&&Lt.embedPositionAdjustmentPattern(A-2,b-2,a)}}}}Lt.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Lt.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Lt.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Lt.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Lt.VERSION_INFO_POLY=7973,Lt.TYPE_INFO_POLY=1335,Lt.TYPE_INFO_MASK_PATTERN=21522;class b3{constructor(r,a){this.dataBytes=r,this.errorCorrectionBytes=a}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Nn{constructor(){}static calculateMaskPenalty(r){return Ln.applyMaskPenaltyRule1(r)+Ln.applyMaskPenaltyRule2(r)+Ln.applyMaskPenaltyRule3(r)+Ln.applyMaskPenaltyRule4(r)}static encode(r,a,u=null){let d=Nn.DEFAULT_BYTE_MODE_ENCODING;const h=u!==null&&u.get(jn.CHARACTER_SET)!==void 0;h&&(d=u.get(jn.CHARACTER_SET).toString());const g=this.chooseMode(r,d),b=new N;if(g===Rt.BYTE&&(h||Nn.DEFAULT_BYTE_MODE_ENCODING!==d)){const ht=B.getCharacterSetECIByName(d);ht!==void 0&&this.appendECI(ht,b)}this.appendModeInfo(g,b);const C=new N;this.appendBytes(r,g,C,d);let A;if(u!==null&&u.get(jn.QR_VERSION)!==void 0){const ht=Number.parseInt(u.get(jn.QR_VERSION).toString(),10);A=xt.getVersionForNumber(ht);const lt=this.calculateBitsNeeded(g,b,C,A);if(!this.willFit(lt,A,a))throw new vn("Data too big for requested version")}else A=this.recommendVersion(a,g,b,C);const L=new N;L.appendBitArray(b);const U=g===Rt.BYTE?C.getSizeInBytes():r.length;this.appendLengthInfo(U,A,g,L),L.appendBitArray(C);const Z=A.getECBlocksForLevel(a),se=A.getTotalCodewords()-Z.getTotalECCodewords();this.terminateBits(se,L);const ye=this.interleaveWithECBytes(L,A.getTotalCodewords(),se,Z.getNumBlocks()),Ce=new si;Ce.setECLevel(a),Ce.setMode(g),Ce.setVersion(A);const Oe=A.getDimensionForVersion(),Ke=new Vu(Oe,Oe),ft=this.chooseMaskPattern(ye,a,A,Ke);return Ce.setMaskPattern(ft),Lt.buildMatrix(ye,a,A,ft,Ke),Ce.setMatrix(Ke),Ce}static recommendVersion(r,a,u,d){const h=this.calculateBitsNeeded(a,u,d,xt.getVersionForNumber(1)),g=this.chooseVersion(h,r),b=this.calculateBitsNeeded(a,u,d,g);return this.chooseVersion(b,r)}static calculateBitsNeeded(r,a,u,d){return a.getSize()+r.getCharacterCountBits(d)+u.getSize()}static getAlphanumericCode(r){return r159)&&(h<224||h>235))return!1}return!0}static chooseMaskPattern(r,a,u,d){let h=Number.MAX_SAFE_INTEGER,g=-1;for(let b=0;b=C}static terminateBits(r,a){const u=r*8;if(a.getSize()>u)throw new vn("data bits cannot fit in the QR Code"+a.getSize()+" > "+u);for(let g=0;g<4&&a.getSize()0)for(let g=d;g<8;g++)a.appendBit(!1);const h=r-a.getSizeInBytes();for(let g=0;g=u)throw new vn("Block ID too large");const b=r%u,C=u-b,A=Math.floor(r/u),L=A+1,U=Math.floor(a/u),Z=U+1,se=A-U,ye=L-Z;if(se!==ye)throw new vn("EC bytes mismatch");if(u!==C+b)throw new vn("RS blocks mismatch");if(r!==(U+se)*C+(Z+ye)*b)throw new vn("Total bytes mismatch");d=1<=0&&a<=9}static appendNumericBytes(r,a){const u=r.length;let d=0;for(;d=33088&&C<=40956?A=C-33088:C>=57408&&C<=60351&&(A=C-49472),A===-1)throw new vn("Invalid byte sequence");const L=(A>>8)*192+(A&255);a.appendBits(L,13)}}static appendECI(r,a){a.appendBits(Rt.ECI.getBits(),4),a.appendBits(r.getValue(),8)}}Nn.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Nn.DEFAULT_BYTE_MODE_ENCODING=B.UTF8.getName();class ii{write(r,a,u,d=null){if(r.length===0)throw new m("Found empty contents");if(a<0||u<0)throw new m("Requested dimensions are too small: "+a+"x"+u);let h=Cn.L,g=ii.QUIET_ZONE_SIZE;d!==null&&(d.get(jn.ERROR_CORRECTION)!==void 0&&(h=Cn.fromString(d.get(jn.ERROR_CORRECTION).toString())),d.get(jn.MARGIN)!==void 0&&(g=Number.parseInt(d.get(jn.MARGIN).toString(),10)));const b=Nn.encode(r,h,d);return this.renderResult(b,a,u,g)}writeToDom(r,a,u,d,h=null){typeof r=="string"&&(r=document.querySelector(r));const g=this.write(a,u,d,h);r&&r.appendChild(g)}renderResult(r,a,u,d){const h=r.getMatrix();if(h===null)throw new de;const g=h.getWidth(),b=h.getHeight(),C=g+d*2,A=b+d*2,L=Math.max(a,C),U=Math.max(u,A),Z=Math.min(Math.floor(L/C),Math.floor(U/A)),se=Math.floor((L-g*Z)/2),ye=Math.floor((U-b*Z)/2),Ce=this.createSVGElement(L,U);for(let Oe=0,Ke=ye;Oea||h+b>u)throw new m("Crop rectangle does not fit within image data.");C&&this.reverseHorizontal(g,b)}getRow(r,a){if(r<0||r>=this.getHeight())throw new m("Requested row is outside the image: "+r);const u=this.getWidth();(a==null||a.length>16&255,se=U>>7&510,ye=U&255;A[L]=(Z+se+ye)/4&255}this.luminances=A}else this.luminances=r;if(d===void 0&&(this.dataWidth=a),h===void 0&&(this.dataHeight=u),g===void 0&&(this.left=0),b===void 0&&(this.top=0),this.left+a>this.dataWidth||this.top+u>this.dataHeight)throw new m("Crop rectangle does not fit within image data.")}getRow(r,a){if(r<0||r>=this.getHeight())throw new m("Requested row is outside the image: "+r);const u=this.getWidth();(a==null||a.length"}}class bf extends aa{constructor(r,a,u){super(r,0,0),this.binaryShiftStart=a,this.binaryShiftByteCount=u}appendTo(r,a){for(let u=0;u62?r.appendBits(this.binaryShiftByteCount-31,16):u===0?r.appendBits(Math.min(this.binaryShiftByteCount,31),5):r.appendBits(this.binaryShiftByteCount-31,5)),r.appendBits(a[this.binaryShiftStart+u],8)}addBinaryShift(r,a){return new bf(this,r,a)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function E3(H,r,a){return new bf(H,r,a)}function ml(H,r,a){return new aa(H,r,a)}const S3=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],ks=0,Hu=1,or=2,T1=3,zr=4,A3=new aa(null,0,0),wf=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,(10<<16)+(29<<5)+30]),Int32Array.from([(9<<16)+(30<<4)+14,0,(5<<16)+30,(5<<16)+29,(10<<16)+(29<<5)+30]),Int32Array.from([(4<<16)+14,(9<<16)+(14<<5)+28,0,(9<<16)+(14<<5)+29,(14<<16)+(14<<10)+(29<<5)+30]),Int32Array.from([(5<<16)+29,(5<<16)+28,(10<<16)+(29<<5)+30,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,(10<<16)+(31<<5)+28,(10<<16)+(31<<5)+30,(10<<16)+(31<<5)+29,0])];function T3(H){for(let r of H)T.fill(r,-1);return H[ks][zr]=0,H[Hu][zr]=0,H[Hu][ks]=28,H[T1][zr]=0,H[or][zr]=0,H[or][ks]=15,H}const I1=T3(T.createInt32Array(6,6));class Ur{constructor(r,a,u,d){this.token=r,this.mode=a,this.binaryShiftByteCount=u,this.bitCount=d}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(r,a){let u=this.bitCount,d=this.token;if(r!==this.mode){let g=wf[this.mode][r];d=ml(d,g&65535,g>>16),u+=g>>16}let h=r===or?4:5;return d=ml(d,a,h),new Ur(d,r,0,u+h)}shiftAndAppend(r,a){let u=this.token,d=this.mode===or?4:5;return u=ml(u,I1[this.mode][r],d),u=ml(u,a,5),new Ur(u,this.mode,0,this.bitCount+d+5)}addBinaryShiftChar(r){let a=this.token,u=this.mode,d=this.bitCount;if(this.mode===zr||this.mode===or){let b=wf[u][ks];a=ml(a,b&65535,b>>16),d+=b>>16,u=ks}let h=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,g=new Ur(a,u,this.binaryShiftByteCount+1,d+h);return g.binaryShiftByteCount===2047+31&&(g=g.endBinaryShift(r+1)),g}endBinaryShift(r){if(this.binaryShiftByteCount===0)return this;let a=this.token;return a=E3(a,r-this.binaryShiftByteCount,this.binaryShiftByteCount),new Ur(a,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(r){let a=this.bitCount+(wf[this.mode][r.mode]>>16);return this.binaryShiftByteCountr.binaryShiftByteCount&&r.binaryShiftByteCount>0&&(a+=10),a<=r.bitCount}toBitArray(r){let a=[];for(let d=this.endBinaryShift(r.length).token;d!==null;d=d.getPrevious())a.unshift(d);let u=new N;for(const d of a)d.appendTo(u,r);return u}toString(){return K.format("%s bits=%d bytes=%d",S3[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(r){return r.binaryShiftByteCount>62?21:r.binaryShiftByteCount>31?20:r.binaryShiftByteCount>0?10:0}}Ur.INITIAL_STATE=new Ur(A3,ks,0,0);function I3(H){const r=K.getCharCode(" "),a=K.getCharCode("."),u=K.getCharCode(",");H[ks][r]=1;const d=K.getCharCode("Z"),h=K.getCharCode("A");for(let Z=h;Z<=d;Z++)H[ks][Z]=Z-h+2;H[Hu][r]=1;const g=K.getCharCode("z"),b=K.getCharCode("a");for(let Z=b;Z<=g;Z++)H[Hu][Z]=Z-b+2;H[or][r]=1;const C=K.getCharCode("9"),A=K.getCharCode("0");for(let Z=A;Z<=C;Z++)H[or][Z]=Z-A+2;H[or][u]=12,H[or][a]=13;const L=["\0"," ","","","","","","","\x07","\b"," ",` `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~","\x7F"];for(let Z=0;Z","?","[","]","{","}"];for(let Z=0;Z0&&(H[zr][K.getCharCode(U[Z])]=Z);return H}const Cf=I3(T.createInt32Array(5,256));class vl{constructor(r){this.text=r}encode(){const r=K.getCharCode(" "),a=K.getCharCode(` -`);let u=A1.singletonList(Ur.INITIAL_STATE);for(let h=0;h0?(u=vl.updateStateListForPair(u,h,g),h++):u=this.updateStateListForChar(u,h)}return A1.min(u,(h,g)=>h.getBitCount()-g.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,a){const u=[];for(let d of r)this.updateStateForChar(d,a,u);return vl.simplifyStates(u)}updateStateForChar(r,a,u){let d=this.text[a]&255,h=Cf[r.getMode()][d]>0,g=null;for(let b=0;b<=zr;b++){let C=Cf[b][d];if(C>0){if(g==null&&(g=r.endBinaryShift(a)),!h||b===r.getMode()||b===or){const A=g.latchAndAppend(b,C);u.push(A)}if(!h&&I1[r.getMode()][b]>=0){const A=g.shiftAndAppend(b,C);u.push(A)}}}if(r.getBinaryShiftByteCount()>0||Cf[r.getMode()][d]===0){let b=r.addBinaryShiftChar(a);u.push(b)}}static updateStateListForPair(r,a,u){const d=[];for(let h of r)this.updateStateForPair(h,a,u,d);return this.simplifyStates(d)}static updateStateForPair(r,a,u,d){let h=r.endBinaryShift(a);if(d.push(h.latchAndAppend(zr,u)),r.getMode()!==zr&&d.push(h.shiftAndAppend(zr,u)),u===3||u===4){let g=h.latchAndAppend(or,16-u).latchAndAppend(or,1);d.push(g)}if(r.getBinaryShiftByteCount()>0){let g=r.addBinaryShiftChar(a).addBinaryShiftChar(a+1);d.push(g)}}static simplifyStates(r){let a=[];for(const u of r){let d=!0;for(const h of a){if(h.isBetterThanOrEqualTo(u)){d=!1;break}u.isBetterThanOrEqualTo(h)&&(a=a.filter(g=>g!==h))}d&&a.push(u)}return a}}class dn{constructor(){}static encodeBytes(r){return dn.encode(r,dn.DEFAULT_EC_PERCENT,dn.DEFAULT_AZTEC_LAYERS)}static encode(r,a,u){let d=new vl(r).encode(),h=_.truncDivision(d.getSize()*a,100)+11,g=d.getSize()+h,b,C,A,L,U;if(u!==dn.DEFAULT_AZTEC_LAYERS){if(b=u<0,C=Math.abs(u),C>(b?dn.MAX_NB_BITS_COMPACT:dn.MAX_NB_BITS))throw new m(K.format("Illegal value %s for layers",u));A=dn.totalBitsInLayer(C,b),L=dn.WORD_SIZE[C];let lt=A-A%L;if(U=dn.stuffBits(d,L),U.getSize()+h>lt)throw new m("Data to large for user specified layer");if(b&&U.getSize()>L*64)throw new m("Data to large for user specified layer")}else{L=0,U=null;for(let lt=0;;lt++){if(lt>dn.MAX_NB_BITS)throw new m("Data too large for an Aztec code");if(b=lt<=3,C=b?lt+1:lt,A=dn.totalBitsInLayer(C,b),g>A)continue;(U==null||L!==dn.WORD_SIZE[C])&&(L=dn.WORD_SIZE[C],U=dn.stuffBits(d,L));let rn=A-A%L;if(!(b&&U.getSize()>L*64)&&U.getSize()+h<=rn)break}}let Z=dn.generateCheckWords(U,A,L),se=U.getSize()/L,ye=dn.generateModeMessage(b,C,se),Ce=(b?11:14)+C*4,Oe=new Int32Array(Ce),Ke;if(b){Ke=Ce;for(let lt=0;lt=d||r.get(g+C))&&(b|=1<0&&i[i.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]o&&(o=c,n=l)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],o=0,s=t;o=c&&l()})})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(o){return o.decodedText})},e.prototype.scanFileV2=function(t,n){var o=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Aa(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(s,i){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var l=new Image;l.onload=function(){var c=l.width,f=l.height,p=document.getElementById(o.elementId),m=p.clientWidth?p.clientWidth:sr.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:f,sr.FILE_SCAN_MIN_HEIGHT),v=o.computeCanvasDrawConfig(c,f,m,y);if(n){var w=o.createCanvasElement(m,y,"qr-canvas-visible");w.style.display="inline-block",p.appendChild(w);var E=w.getContext("2d");if(!E)throw"Unable to get 2d context from canvas";E.canvas.width=m,E.canvas.height=y,E.drawImage(l,0,0,c,f,v.x,v.y,v.width,v.height)}var I=o.createCanvasElement(v.width,v.height);p.appendChild(I);var S=I.getContext("2d");if(!S)throw"Unable to get 2d context from canvas";S.canvas.width=v.width,S.canvas.height=v.height,S.drawImage(l,0,0,c,f,0,0,v.width,v.height);try{o.qrcode.decodeAsync(I).then(function(T){s(Oy.createFromQrcodeResult(T))}).catch(i)}catch(T){i("QR code parse error, error = "+T)}},l.onerror=i,l.onabort=i,l.onstalled=i,l.onsuspend=i,l.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;if(MediaStreamTrack&&t.getSources)return e.getCamerasFromMediaStreamTrack();var n=function(){if(location.protocol==="https:")return!0;var s=location.host.split(":")[0];return s==="127.0.0.1"||s==="localhost"},o=Nl.unableToQuerySupportedDevices();return n()||(o=Nl.insecureContextCameraQueryError()),Promise.reject(o)},e.prototype.getRunningTrackCapabilities=function(){if(this.localMediaStream==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";var t=this.localMediaStream.getVideoTracks()[0];return t.getCapabilities()},e.prototype.applyVideoConstraints=function(t){var n=this;if(t){if(!ZS.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";if(this.localMediaStream===null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";return new Promise(function(o,s){if("aspectRatio"in t){s("Chaning 'aspectRatio' in run-time is not yet supported.");return}var i=n.localMediaStream.getVideoTracks()[0];i.applyConstraints(t).then(function(l){o(l)}).catch(function(l){s(l)})})},e.getCamerasFromMediaDevices=function(){return new Promise(function(t,n){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(function(o){var s=function(i){for(var l=i.getVideoTracks(),c=0,f=l;ct&&(s.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),p=t),p};c(l.width),c(l.height),l.width=f(l.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(t,n)}catch(s){throw new Error("qrbox config was passed as a function but it failed with unknown error"+s)}return o},e.prototype.setupUi=function(t,n,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,o);var s=Aa(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(s);var i=this.toQrdimensions(t,n,s);i.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var l=o.isShadedBoxEnabled()&&i.height<=n,c={x:0,y:0,width:t,height:n},f=l?this.getShadedRegionBounds(t,n,i):c,p=this.createCanvasElement(f.width,f.height),m=p.getContext("2d");m.canvas.width=f.width,m.canvas.height=f.height,this.element.append(p),l&&this.possiblyInsertShadingElement(this.element,t,n,i),this.createScannerPausedUiElement(this.element),this.qrRegion=f,this.context=m,this.canvasElement=p},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText="Scanner paused",n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="yellow",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(s){return t(s.text,Oy.createFromQrcodeResult(s)),o.possiblyUpdateShaders(!0),!0}).catch(function(s){o.possiblyUpdateShaders(!1);var i=Nl.codeParseError(s);return n(i,XS.createFrom(i)),!1})},e.prototype.foreverScan=function(t,n,o){var s=this;if(!!this.shouldScan&&!!this.localMediaStream){var i=this.videoElement,l=i.videoWidth/i.clientWidth,c=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var f=this.qrRegion.width*l,p=this.qrRegion.height*c,m=this.qrRegion.x*l,y=this.qrRegion.y*c;this.context.drawImage(i,m,y,f,p,0,0,this.qrRegion.width,this.qrRegion.height);var v=function(){s.foreverScanTimeout=setTimeout(function(){s.foreverScan(t,n,o)},s.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(w){!w&&t.disableFlip!==!0?(s.context.translate(s.context.canvas.width,0),s.context.scale(-1,1),s.scanContext(n,o).finally(function(){v()})):v()}).catch(function(w){s.logger.logError("Error happend while scanning context",w),v()})}},e.prototype.onMediaStreamReceived=function(t,n,o,s,i,l){var c=this,f=this;return new Promise(function(p,m){var y=function(){var E=c.createVideoElement(s);f.element.append(E),E.onabort=m,E.onerror=m;var I=function(){var S=E.clientWidth,T=E.clientHeight;f.setupUi(S,T,n),f.foreverScan(n,i,l),E.removeEventListener("playing",I),p(null)};E.addEventListener("playing",I),E.srcObject=t,E.play(),f.videoElement=E};if(f.localMediaStream=t,o||!n.aspectRatio)y();else{var v={aspectRatio:n.aspectRatio},w=t.getVideoTracks()[0];w.applyConstraints(v).then(function(E){return y()}).catch(function(E){f.logger.logErrors(["[Html5Qrcode] Constriants could not be satisfied, ignoring constraints",E]),y()})}})},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",o="deviceId",s={user:!0,environment:!0},i="exact",l=function(E){if(E in s)return!0;throw"config has invalid 'facingMode' value = "+("'"+E+"'")},c=Object.keys(t);if(c.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+(" if passed as an object, found "+c.length+" keys");var f=Object.keys(t)[0];if(f!==n&&f!==o)throw"Only '"+n+"' and '"+o+"' are supported for 'cameraIdOrConfig'";if(f===n){var p=t.facingMode;if(typeof p=="string"){if(l(p))return{facingMode:p}}else if(typeof p=="object")if(i in p){if(l(p[""+i]))return{facingMode:{exact:p[""+i]}}}else throw"'facingMode' should be string or object with"+(" "+i+" as key.");else{var m=typeof p;throw"Invalid type of 'facingMode' = "+m}}else{var y=t.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(i in y)return{deviceId:{exact:y[""+i]}};throw"'deviceId' should be string or object with"+(" "+i+" as key.")}else{var v=typeof y;throw"Invalid type of 'deviceId' = "+v}}}var w=typeof t;throw"Invalid type of 'cameraIdOrConfig' = "+w},e.prototype.computeCanvasDrawConfig=function(t,n,o,s){if(t<=o&&n<=s){var i=(o-t)/2,l=(s-n)/2;return{x:i,y:l,width:t,height:n}}else{var c=t,f=n;return t>o&&(n=o/t*n,t=o),n>s&&(t=s/n*t,n=s),this.logger.log("Image downsampled from "+(c+"X"+f)+(" to "+t+"X"+n+".")),this.computeCanvasDrawConfig(t,n,o,s)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width=t+"px",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?sr.BORDER_SHADER_MATCH_COLOR:sr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,o){var s=t,i=n,l=document.createElement("canvas");return l.style.width=s+"px",l.style.height=i+"px",l.style.display="none",l.id=Aa(o)?"qr-canvas":o,l},e.prototype.getShadedRegionBounds=function(t,n,o){if(o.width>t||o.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-o.width)/2,y:(n-o.height)/2,width:o.width,height:o.height}},e.prototype.possiblyInsertShadingElement=function(t,n,o,s){if(!(n-s.width<1||o-s.height<1)){var i=document.createElement("div");i.style.position="absolute";var l=(n-s.width)/2,c=(o-s.height)/2;if(i.style.borderLeft=l+"px solid #0000007a",i.style.borderRight=l+"px solid #0000007a",i.style.borderTop=c+"px solid #0000007a",i.style.borderBottom=c+"px solid #0000007a",i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id=""+sr.SHADED_REGION_ELEMENT_ID,n-s.width<11||o-s.height<11)this.hasBorderShaders=!1;else{var f=5,p=40;this.insertShaderBorders(i,p,f,-f,0,!0),this.insertShaderBorders(i,p,f,-f,0,!1),this.insertShaderBorders(i,p,f,s.height+f,0,!0),this.insertShaderBorders(i,p,f,s.height+f,0,!1),this.insertShaderBorders(i,f,p+f,-f,-f,!0),this.insertShaderBorders(i,f,p+f,s.height+f-p,-f,!0),this.insertShaderBorders(i,f,p+f,-f,-f,!1),this.insertShaderBorders(i,f,p+f,s.height+f-p,-f,!1),this.hasBorderShaders=!0}t.append(i)}},e.prototype.insertShaderBorders=function(t,n,o,s,i,l){var c=document.createElement("div");c.style.position="absolute",c.style.backgroundColor=sr.BORDER_SHADER_DEFAULT_COLOR,c.style.width=n+"px",c.style.height=o+"px",c.style.top=s+"px",l?c.style.left=i+"px":c.style.right=i+"px",this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(c),t.appendChild(c)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),f1="data:image/svg+xml;base64,",fne=f1+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyL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N4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",Py=function(){function e(){}return e.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},e}(),gne=function(){function e(){this.data=Py.createDefault();var t=localStorage.getItem(e.LOCAL_STORAGE_KEY);t?this.data=JSON.parse(t):this.reset()}return e.prototype.hasCameraPermissions=function(){return this.data.hasPermission},e.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},e.prototype.setHasPermission=function(t){this.data.hasPermission=t,this.flush()},e.prototype.setLastUsedCameraId=function(t){this.data.lastUsedCameraId=t,this.flush()},e.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},e.prototype.reset=function(){this.data=Py.createDefault(),this.flush()},e.prototype.flush=function(){localStorage.setItem(e.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},e.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",e}(),mne=function(){function e(){this.infoDiv=document.createElement("div")}return e.prototype.renderInto=function(t){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid silver",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(248 248 248)",this.infoDiv.innerText=Dy.builtUsing();var n=document.createElement("a");n.innerText="html5-qrcode",n.href="https://github.com/mebjas/html5-qrcode",n.target="new",this.infoDiv.appendChild(n);var o=document.createElement("br"),s=document.createElement("br");this.infoDiv.appendChild(o),this.infoDiv.appendChild(s);var i=document.createElement("a");i.innerText=Dy.reportIssues(),i.href="https://github.com/mebjas/html5-qrcode/issues",i.target="new",this.infoDiv.appendChild(i),t.appendChild(this.infoDiv)},e.prototype.show=function(){this.infoDiv.style.display="block"},e.prototype.hide=function(){this.infoDiv.style.display="none"},e}(),vne=function(){function e(t,n){this.isShowingInfoIcon=!0,this.onTapIn=t,this.onTapOut=n,this.infoIcon=document.createElement("img")}return e.prototype.renderInto=function(t){var n=this;this.infoIcon.alt="Info icon",this.infoIcon.src=Ly,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(o){return n.onHoverIn()},this.infoIcon.onmouseout=function(o){return n.onHoverOut()},this.infoIcon.onclick=function(o){return n.onClick()},t.appendChild(this.infoIcon)},e.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},e.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},e.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=pne,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=Ly,this.infoIcon.style.opacity="0.6")},e}(),yne=function(){function e(){var t=this;this.infoDiv=new mne,this.infoIcon=new vne(function(){t.infoDiv.show()},function(){t.infoDiv.hide()})}return e.prototype.renderInto=function(t){this.infoDiv.renderInto(t),this.infoIcon.renderInto(t)},e}(),By=function(){function e(){}return e.hasCameraPermissions=function(){return new Promise(function(t,n){navigator.mediaDevices.enumerateDevices().then(function(o){o.forEach(function(s){s.kind==="videoinput"&&s.label&&t(!0)}),t(!1)})})},e}(),rs=function(){function e(t){this.supportedScanTypes=this.validateAndReturnScanTypes(t)}return e.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},e.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},e.prototype.isCameraScanRequired=function(){for(var t=0,n=this.supportedScanTypes;tn)throw"Max "+n+" values expected for supportedScanTypes";for(var o=0,s=t;o0?(t.removeChild(n),s.renderCameraSelection(l)):(s.setHeaderMessage(Ar.noCameraFound(),ir.STATUS_WARNING),i())}).catch(function(l){s.persistedDataManager.setHasPermission(!1),o?o.disabled=!1:i(),s.setHeaderMessage(l,ir.STATUS_WARNING)})},e.prototype.createPermissionButton=function(t,n){var o=this,s=document.createElement("button");s.id=this.getCameraPermissionButtonId(),s.innerText=Ar.cameraPermissionTitle(),s.addEventListener("click",function(){s.disabled=!0,o.createCameraListUi(t,n,s)}),n.appendChild(s)},e.prototype.createPermissionsUi=function(t,n){var o=this;if(rs.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){By.hasCameraPermissions().then(function(s){s?o.createCameraListUi(t,n):(o.persistedDataManager.setHasPermission(!1),o.createPermissionButton(t,n))}).catch(function(s){o.persistedDataManager.setHasPermission(!1),o.createPermissionButton(t,n)});return}this.createPermissionButton(t,n)},e.prototype.createSectionControlPanel=function(){var t=document.getElementById(this.getDashboardSectionId()),n=document.createElement("div");t.appendChild(n);var o=document.createElement("div");o.id=this.getDashboardSectionCameraScanRegionId(),o.style.display=rs.isCameraScanType(this.currentScanType)?"block":"none",n.appendChild(o);var s=document.createElement("div");s.style.textAlign="center",o.appendChild(s),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(o,s),this.renderFileScanUi(n)},e.prototype.renderFileScanUi=function(t){var n=this,o=document.createElement("div");o.id=this.getDashboardSectionFileScanRegionId(),o.style.textAlign="center",o.style.display=rs.isCameraScanType(this.currentScanType)?"none":"block",t.appendChild(o);var s=document.createElement("input");s.id=this.getFileScanInputId(),s.accept="image/*",s.type="file",s.style.width="200px",s.disabled=rs.isCameraScanType(this.currentScanType);var i=document.createElement("span");i.innerText=" Select Image",o.appendChild(s),o.appendChild(i),s.addEventListener("change",function(l){if(!n.html5Qrcode)throw"html5Qrcode not defined";if(!(l==null||l.target==null)&&!!rs.isFileScanType(n.currentScanType)&&l.target.files.length!==0){var c=l.target.files[0];n.html5Qrcode.scanFileV2(c,!0).then(function(f){n.resetHeaderMessage(),n.qrCodeSuccessCallback(f.decodedText,f)}).catch(function(f){n.setHeaderMessage(f,ir.STATUS_WARNING),n.qrCodeErrorCallback(f,XS.createFrom(f))})}})},e.prototype.renderCameraSelection=function(t){var n=this,o=this,s=document.getElementById(this.getDashboardSectionCameraScanRegionId());s.style.textAlign="center";var i=document.createElement("span");i.style.marginRight="10px";var l=t.length,c=document.createElement("select");if(l===1)c.style.display="none";else{var f=Ar.selectCamera();i.innerText=f+" ("+t.length+") "}c.id=this.getCameraSelectionId();for(var p=[],m=0,y=t;m",n.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(o){n.innerHTML="
",n.appendChild(t.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=fne},e.prototype.insertFileScanImageToScanRegion=function(){var t=this,n=document.getElementById(this.getScanRegionId());if(this.fileScanImage){n.innerHTML="
",n.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(o){n.innerHTML="
",n.appendChild(t.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=hne},e.prototype.clearScanRegion=function(){var t=document.getElementById(this.getScanRegionId());t.innerHTML=""},e.prototype.getDashboardSectionId=function(){return this.elementId+"__dashboard_section"},e.prototype.getDashboardSectionCameraScanRegionId=function(){return this.elementId+"__dashboard_section_csr"},e.prototype.getDashboardSectionFileScanRegionId=function(){return this.elementId+"__dashboard_section_fsr"},e.prototype.getDashboardSectionSwapLinkId=function(){return this.elementId+"__dashboard_section_swaplink"},e.prototype.getScanRegionId=function(){return this.elementId+"__scan_region"},e.prototype.getDashboardId=function(){return this.elementId+"__dashboard"},e.prototype.getFileScanInputId=function(){return this.elementId+"__filescan_input"},e.prototype.getStatusSpanId=function(){return this.elementId+"__status_span"},e.prototype.getHeaderMessageContainerId=function(){return this.elementId+"__header_message"},e.prototype.getCameraSelectionId=function(){return this.elementId+"__camera_selection"},e.prototype.getCameraPermissionButtonId=function(){return this.elementId+"__camera_permission_button"},e.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},e.prototype.getFileScanRegion=function(){return document.getElementById(this.getDashboardSectionFileScanRegionId())},e.prototype.getFileScanInput=function(){return document.getElementById(this.getFileScanInputId())},e.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},e.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},e}();const Ene={id:"qr-code-full-region"},Sne=ve({props:{qrbox:null,fps:null},emits:["decodedCode"],setup(e,{emit:t}){const n=e;var o={fps:n.fps?n.fps:10};let s="";n.qrbox&&(o.qrbox=n.qrbox);let i=null;function l(p,m){s!==p&&(s=p,t("decodedCode",p,m))}function c(p,m){}async function f(){await dt(),i=new Cne("qr-code-full-region",o,void 0),i.render(l,c)}return f(),(p,m)=>(M(),W("div",Ene))}}),Ane=Ht(" \u4EBA\u6578\uFF1A "),Tne={id:"section",class:"section",style:{width:"70%",margin:"auto"}},Ine=Ht("\u6309\u6211\u50B3\u9001\u7C21\u8A0A "),_ne=ve({setup(e){let t=F(""),n=F(1),o=F("");var s=navigator.userAgent,i=s.indexOf("Android")>-1||s.indexOf("Adr")>-1,l=!!s.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);const c=function(y,v){y.includes("1922:")?f(y):t.value=`\u5167\u5BB9:${y}`};function f(y){let w=y.split("1922:")[1];t.value=`\u5167\u5BB9:${w}`,o.value=w;let E=document.getElementById("Btn_Open");E.style.display="inline",p()}function p(){let y="";n.value>1&&(y=`+${n.value-1}`),i?window.open(`sms:1922?&body=${o.value}${y}`,"_self"):l?window.open(`sms:1922&body=${o.value}${y}`,"_self"):alert(`sms:1922&body=${o.value}${y}`)}async function m(){await dt();let y=document.getElementById("Btn_Open");if(y.style.display="none",!i&&!l){let v=document.getElementById("section");v.style.width="500px"}}return m(),(y,v)=>{const w=Ae("el-input-number"),E=Ae("el-button");return M(),W(at,null,[Q("div",null,[Ane,le(w,{modelValue:k(n),"onUpdate:modelValue":v[0]||(v[0]=I=>wn(n)?n.value=I:n=I),min:1,size:"large"},null,8,["modelValue"])]),Q("div",Tne,[le(Sne,{qrbox:200,fps:10,onDecodedCode:c})]),Q("div",null,Pe(k(t)),1),le(E,{id:"Btn_Open",type:"success",onClick:v[1]||(v[1]=()=>{p()}),size:"large",round:""},{default:ae(()=>[Ine]),_:1})],64)}}}),Nne=ve({setup(e){return(t,n)=>(M(),me(_ne))}});X2(Nne).use(Zte,{locale:Qte}).mount("#app")});export default kne(); +`);let u=A1.singletonList(Ur.INITIAL_STATE);for(let h=0;h0?(u=vl.updateStateListForPair(u,h,g),h++):u=this.updateStateListForChar(u,h)}return A1.min(u,(h,g)=>h.getBitCount()-g.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,a){const u=[];for(let d of r)this.updateStateForChar(d,a,u);return vl.simplifyStates(u)}updateStateForChar(r,a,u){let d=this.text[a]&255,h=Cf[r.getMode()][d]>0,g=null;for(let b=0;b<=zr;b++){let C=Cf[b][d];if(C>0){if(g==null&&(g=r.endBinaryShift(a)),!h||b===r.getMode()||b===or){const A=g.latchAndAppend(b,C);u.push(A)}if(!h&&I1[r.getMode()][b]>=0){const A=g.shiftAndAppend(b,C);u.push(A)}}}if(r.getBinaryShiftByteCount()>0||Cf[r.getMode()][d]===0){let b=r.addBinaryShiftChar(a);u.push(b)}}static updateStateListForPair(r,a,u){const d=[];for(let h of r)this.updateStateForPair(h,a,u,d);return this.simplifyStates(d)}static updateStateForPair(r,a,u,d){let h=r.endBinaryShift(a);if(d.push(h.latchAndAppend(zr,u)),r.getMode()!==zr&&d.push(h.shiftAndAppend(zr,u)),u===3||u===4){let g=h.latchAndAppend(or,16-u).latchAndAppend(or,1);d.push(g)}if(r.getBinaryShiftByteCount()>0){let g=r.addBinaryShiftChar(a).addBinaryShiftChar(a+1);d.push(g)}}static simplifyStates(r){let a=[];for(const u of r){let d=!0;for(const h of a){if(h.isBetterThanOrEqualTo(u)){d=!1;break}u.isBetterThanOrEqualTo(h)&&(a=a.filter(g=>g!==h))}d&&a.push(u)}return a}}class dn{constructor(){}static encodeBytes(r){return dn.encode(r,dn.DEFAULT_EC_PERCENT,dn.DEFAULT_AZTEC_LAYERS)}static encode(r,a,u){let d=new vl(r).encode(),h=_.truncDivision(d.getSize()*a,100)+11,g=d.getSize()+h,b,C,A,L,U;if(u!==dn.DEFAULT_AZTEC_LAYERS){if(b=u<0,C=Math.abs(u),C>(b?dn.MAX_NB_BITS_COMPACT:dn.MAX_NB_BITS))throw new m(K.format("Illegal value %s for layers",u));A=dn.totalBitsInLayer(C,b),L=dn.WORD_SIZE[C];let lt=A-A%L;if(U=dn.stuffBits(d,L),U.getSize()+h>lt)throw new m("Data to large for user specified layer");if(b&&U.getSize()>L*64)throw new m("Data to large for user specified layer")}else{L=0,U=null;for(let lt=0;;lt++){if(lt>dn.MAX_NB_BITS)throw new m("Data too large for an Aztec code");if(b=lt<=3,C=b?lt+1:lt,A=dn.totalBitsInLayer(C,b),g>A)continue;(U==null||L!==dn.WORD_SIZE[C])&&(L=dn.WORD_SIZE[C],U=dn.stuffBits(d,L));let rn=A-A%L;if(!(b&&U.getSize()>L*64)&&U.getSize()+h<=rn)break}}let Z=dn.generateCheckWords(U,A,L),se=U.getSize()/L,ye=dn.generateModeMessage(b,C,se),Ce=(b?11:14)+C*4,Oe=new Int32Array(Ce),Ke;if(b){Ke=Ce;for(let lt=0;lt=d||r.get(g+C))&&(b|=1<0&&i[i.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]o&&(o=c,n=l)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],o=0,s=t;o=c&&l()})})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(o){return o.decodedText})},e.prototype.scanFileV2=function(t,n){var o=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Aa(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(s,i){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var l=new Image;l.onload=function(){var c=l.width,f=l.height,p=document.getElementById(o.elementId),m=p.clientWidth?p.clientWidth:sr.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:f,sr.FILE_SCAN_MIN_HEIGHT),v=o.computeCanvasDrawConfig(c,f,m,y);if(n){var w=o.createCanvasElement(m,y,"qr-canvas-visible");w.style.display="inline-block",p.appendChild(w);var E=w.getContext("2d");if(!E)throw"Unable to get 2d context from canvas";E.canvas.width=m,E.canvas.height=y,E.drawImage(l,0,0,c,f,v.x,v.y,v.width,v.height)}var I=o.createCanvasElement(v.width,v.height);p.appendChild(I);var S=I.getContext("2d");if(!S)throw"Unable to get 2d context from canvas";S.canvas.width=v.width,S.canvas.height=v.height,S.drawImage(l,0,0,c,f,0,0,v.width,v.height);try{o.qrcode.decodeAsync(I).then(function(T){s(Oy.createFromQrcodeResult(T))}).catch(i)}catch(T){i("QR code parse error, error = "+T)}},l.onerror=i,l.onabort=i,l.onstalled=i,l.onsuspend=i,l.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;if(MediaStreamTrack&&t.getSources)return e.getCamerasFromMediaStreamTrack();var n=function(){if(location.protocol==="https:")return!0;var s=location.host.split(":")[0];return s==="127.0.0.1"||s==="localhost"},o=Nl.unableToQuerySupportedDevices();return n()||(o=Nl.insecureContextCameraQueryError()),Promise.reject(o)},e.prototype.getRunningTrackCapabilities=function(){if(this.localMediaStream==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";var t=this.localMediaStream.getVideoTracks()[0];return t.getCapabilities()},e.prototype.applyVideoConstraints=function(t){var n=this;if(t){if(!ZS.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";if(this.localMediaStream===null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";return new Promise(function(o,s){if("aspectRatio"in t){s("Chaning 'aspectRatio' in run-time is not yet supported.");return}var i=n.localMediaStream.getVideoTracks()[0];i.applyConstraints(t).then(function(l){o(l)}).catch(function(l){s(l)})})},e.getCamerasFromMediaDevices=function(){return new Promise(function(t,n){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(function(o){var s=function(i){for(var l=i.getVideoTracks(),c=0,f=l;ct&&(s.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),p=t),p};c(l.width),c(l.height),l.width=f(l.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(t,n)}catch(s){throw new Error("qrbox config was passed as a function but it failed with unknown error"+s)}return o},e.prototype.setupUi=function(t,n,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,o);var s=Aa(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(s);var i=this.toQrdimensions(t,n,s);i.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var l=o.isShadedBoxEnabled()&&i.height<=n,c={x:0,y:0,width:t,height:n},f=l?this.getShadedRegionBounds(t,n,i):c,p=this.createCanvasElement(f.width,f.height),m=p.getContext("2d");m.canvas.width=f.width,m.canvas.height=f.height,this.element.append(p),l&&this.possiblyInsertShadingElement(this.element,t,n,i),this.createScannerPausedUiElement(this.element),this.qrRegion=f,this.context=m,this.canvasElement=p},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText="Scanner paused",n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="yellow",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(s){return t(s.text,Oy.createFromQrcodeResult(s)),o.possiblyUpdateShaders(!0),!0}).catch(function(s){o.possiblyUpdateShaders(!1);var i=Nl.codeParseError(s);return n(i,XS.createFrom(i)),!1})},e.prototype.foreverScan=function(t,n,o){var s=this;if(!!this.shouldScan&&!!this.localMediaStream){var i=this.videoElement,l=i.videoWidth/i.clientWidth,c=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var f=this.qrRegion.width*l,p=this.qrRegion.height*c,m=this.qrRegion.x*l,y=this.qrRegion.y*c;this.context.drawImage(i,m,y,f,p,0,0,this.qrRegion.width,this.qrRegion.height);var v=function(){s.foreverScanTimeout=setTimeout(function(){s.foreverScan(t,n,o)},s.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(w){!w&&t.disableFlip!==!0?(s.context.translate(s.context.canvas.width,0),s.context.scale(-1,1),s.scanContext(n,o).finally(function(){v()})):v()}).catch(function(w){s.logger.logError("Error happend while scanning context",w),v()})}},e.prototype.onMediaStreamReceived=function(t,n,o,s,i,l){var c=this,f=this;return new Promise(function(p,m){var y=function(){var E=c.createVideoElement(s);f.element.append(E),E.onabort=m,E.onerror=m;var I=function(){var S=E.clientWidth,T=E.clientHeight;f.setupUi(S,T,n),f.foreverScan(n,i,l),E.removeEventListener("playing",I),p(null)};E.addEventListener("playing",I),E.srcObject=t,E.play(),f.videoElement=E};if(f.localMediaStream=t,o||!n.aspectRatio)y();else{var v={aspectRatio:n.aspectRatio},w=t.getVideoTracks()[0];w.applyConstraints(v).then(function(E){return y()}).catch(function(E){f.logger.logErrors(["[Html5Qrcode] Constriants could not be satisfied, ignoring constraints",E]),y()})}})},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",o="deviceId",s={user:!0,environment:!0},i="exact",l=function(E){if(E in s)return!0;throw"config has invalid 'facingMode' value = "+("'"+E+"'")},c=Object.keys(t);if(c.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+(" if passed as an object, found "+c.length+" keys");var f=Object.keys(t)[0];if(f!==n&&f!==o)throw"Only '"+n+"' and '"+o+"' are supported for 'cameraIdOrConfig'";if(f===n){var p=t.facingMode;if(typeof p=="string"){if(l(p))return{facingMode:p}}else if(typeof p=="object")if(i in p){if(l(p[""+i]))return{facingMode:{exact:p[""+i]}}}else throw"'facingMode' should be string or object with"+(" "+i+" as key.");else{var m=typeof p;throw"Invalid type of 'facingMode' = "+m}}else{var y=t.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(i in y)return{deviceId:{exact:y[""+i]}};throw"'deviceId' should be string or object with"+(" "+i+" as key.")}else{var v=typeof y;throw"Invalid type of 'deviceId' = "+v}}}var w=typeof t;throw"Invalid type of 'cameraIdOrConfig' = "+w},e.prototype.computeCanvasDrawConfig=function(t,n,o,s){if(t<=o&&n<=s){var i=(o-t)/2,l=(s-n)/2;return{x:i,y:l,width:t,height:n}}else{var c=t,f=n;return t>o&&(n=o/t*n,t=o),n>s&&(t=s/n*t,n=s),this.logger.log("Image downsampled from "+(c+"X"+f)+(" to "+t+"X"+n+".")),this.computeCanvasDrawConfig(t,n,o,s)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width=t+"px",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?sr.BORDER_SHADER_MATCH_COLOR:sr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,o){var s=t,i=n,l=document.createElement("canvas");return l.style.width=s+"px",l.style.height=i+"px",l.style.display="none",l.id=Aa(o)?"qr-canvas":o,l},e.prototype.getShadedRegionBounds=function(t,n,o){if(o.width>t||o.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-o.width)/2,y:(n-o.height)/2,width:o.width,height:o.height}},e.prototype.possiblyInsertShadingElement=function(t,n,o,s){if(!(n-s.width<1||o-s.height<1)){var i=document.createElement("div");i.style.position="absolute";var l=(n-s.width)/2,c=(o-s.height)/2;if(i.style.borderLeft=l+"px solid #0000007a",i.style.borderRight=l+"px solid #0000007a",i.style.borderTop=c+"px solid #0000007a",i.style.borderBottom=c+"px solid #0000007a",i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id=""+sr.SHADED_REGION_ELEMENT_ID,n-s.width<11||o-s.height<11)this.hasBorderShaders=!1;else{var f=5,p=40;this.insertShaderBorders(i,p,f,-f,0,!0),this.insertShaderBorders(i,p,f,-f,0,!1),this.insertShaderBorders(i,p,f,s.height+f,0,!0),this.insertShaderBorders(i,p,f,s.height+f,0,!1),this.insertShaderBorders(i,f,p+f,-f,-f,!0),this.insertShaderBorders(i,f,p+f,s.height+f-p,-f,!0),this.insertShaderBorders(i,f,p+f,-f,-f,!1),this.insertShaderBorders(i,f,p+f,s.height+f-p,-f,!1),this.hasBorderShaders=!0}t.append(i)}},e.prototype.insertShaderBorders=function(t,n,o,s,i,l){var c=document.createElement("div");c.style.position="absolute",c.style.backgroundColor=sr.BORDER_SHADER_DEFAULT_COLOR,c.style.width=n+"px",c.style.height=o+"px",c.style.top=s+"px",l?c.style.left=i+"px":c.style.right=i+"px",this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(c),t.appendChild(c)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),f1="data:image/svg+xml;base64,",fne=f1+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYT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1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",Py=function(){function e(){}return e.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},e}(),gne=function(){function e(){this.data=Py.createDefault();var t=localStorage.getItem(e.LOCAL_STORAGE_KEY);t?this.data=JSON.parse(t):this.reset()}return e.prototype.hasCameraPermissions=function(){return this.data.hasPermission},e.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},e.prototype.setHasPermission=function(t){this.data.hasPermission=t,this.flush()},e.prototype.setLastUsedCameraId=function(t){this.data.lastUsedCameraId=t,this.flush()},e.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},e.prototype.reset=function(){this.data=Py.createDefault(),this.flush()},e.prototype.flush=function(){localStorage.setItem(e.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},e.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",e}(),mne=function(){function e(){this.infoDiv=document.createElement("div")}return e.prototype.renderInto=function(t){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid silver",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(248 248 248)",this.infoDiv.innerText=Dy.builtUsing();var n=document.createElement("a");n.innerText="html5-qrcode",n.href="https://github.com/mebjas/html5-qrcode",n.target="new",this.infoDiv.appendChild(n);var o=document.createElement("br"),s=document.createElement("br");this.infoDiv.appendChild(o),this.infoDiv.appendChild(s);var i=document.createElement("a");i.innerText=Dy.reportIssues(),i.href="https://github.com/mebjas/html5-qrcode/issues",i.target="new",this.infoDiv.appendChild(i),t.appendChild(this.infoDiv)},e.prototype.show=function(){this.infoDiv.style.display="block"},e.prototype.hide=function(){this.infoDiv.style.display="none"},e}(),vne=function(){function e(t,n){this.isShowingInfoIcon=!0,this.onTapIn=t,this.onTapOut=n,this.infoIcon=document.createElement("img")}return e.prototype.renderInto=function(t){var n=this;this.infoIcon.alt="Info icon",this.infoIcon.src=Ly,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(o){return n.onHoverIn()},this.infoIcon.onmouseout=function(o){return n.onHoverOut()},this.infoIcon.onclick=function(o){return n.onClick()},t.appendChild(this.infoIcon)},e.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},e.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},e.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=pne,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=Ly,this.infoIcon.style.opacity="0.6")},e}(),yne=function(){function e(){var t=this;this.infoDiv=new mne,this.infoIcon=new vne(function(){t.infoDiv.show()},function(){t.infoDiv.hide()})}return e.prototype.renderInto=function(t){this.infoDiv.renderInto(t),this.infoIcon.renderInto(t)},e}(),By=function(){function e(){}return e.hasCameraPermissions=function(){return new Promise(function(t,n){navigator.mediaDevices.enumerateDevices().then(function(o){o.forEach(function(s){s.kind==="videoinput"&&s.label&&t(!0)}),t(!1)})})},e}(),rs=function(){function e(t){this.supportedScanTypes=this.validateAndReturnScanTypes(t)}return e.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},e.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},e.prototype.isCameraScanRequired=function(){for(var t=0,n=this.supportedScanTypes;tn)throw"Max "+n+" values expected for supportedScanTypes";for(var o=0,s=t;o0?(t.removeChild(n),s.renderCameraSelection(l)):(s.setHeaderMessage(Ar.noCameraFound(),ir.STATUS_WARNING),i())}).catch(function(l){s.persistedDataManager.setHasPermission(!1),o?o.disabled=!1:i(),s.setHeaderMessage(l,ir.STATUS_WARNING)})},e.prototype.createPermissionButton=function(t,n){var o=this,s=document.createElement("button");s.id=this.getCameraPermissionButtonId(),s.innerText=Ar.cameraPermissionTitle(),s.addEventListener("click",function(){s.disabled=!0,o.createCameraListUi(t,n,s)}),n.appendChild(s)},e.prototype.createPermissionsUi=function(t,n){var o=this;if(rs.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){By.hasCameraPermissions().then(function(s){s?o.createCameraListUi(t,n):(o.persistedDataManager.setHasPermission(!1),o.createPermissionButton(t,n))}).catch(function(s){o.persistedDataManager.setHasPermission(!1),o.createPermissionButton(t,n)});return}this.createPermissionButton(t,n)},e.prototype.createSectionControlPanel=function(){var t=document.getElementById(this.getDashboardSectionId()),n=document.createElement("div");t.appendChild(n);var o=document.createElement("div");o.id=this.getDashboardSectionCameraScanRegionId(),o.style.display=rs.isCameraScanType(this.currentScanType)?"block":"none",n.appendChild(o);var s=document.createElement("div");s.style.textAlign="center",o.appendChild(s),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(o,s),this.renderFileScanUi(n)},e.prototype.renderFileScanUi=function(t){var n=this,o=document.createElement("div");o.id=this.getDashboardSectionFileScanRegionId(),o.style.textAlign="center",o.style.display=rs.isCameraScanType(this.currentScanType)?"none":"block",t.appendChild(o);var s=document.createElement("input");s.id=this.getFileScanInputId(),s.accept="image/*",s.type="file",s.style.width="200px",s.disabled=rs.isCameraScanType(this.currentScanType);var i=document.createElement("span");i.innerText=" Select Image",o.appendChild(s),o.appendChild(i),s.addEventListener("change",function(l){if(!n.html5Qrcode)throw"html5Qrcode not defined";if(!(l==null||l.target==null)&&!!rs.isFileScanType(n.currentScanType)&&l.target.files.length!==0){var c=l.target.files[0];n.html5Qrcode.scanFileV2(c,!0).then(function(f){n.resetHeaderMessage(),n.qrCodeSuccessCallback(f.decodedText,f)}).catch(function(f){n.setHeaderMessage(f,ir.STATUS_WARNING),n.qrCodeErrorCallback(f,XS.createFrom(f))})}})},e.prototype.renderCameraSelection=function(t){var n=this,o=this,s=document.getElementById(this.getDashboardSectionCameraScanRegionId());s.style.textAlign="center";var i=document.createElement("span");i.style.marginRight="10px";var l=t.length,c=document.createElement("select");if(l===1)c.style.display="none";else{var f=Ar.selectCamera();i.innerText=f+" ("+t.length+") "}c.id=this.getCameraSelectionId();for(var p=[],m=0,y=t;m",n.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(o){n.innerHTML="
",n.appendChild(t.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=fne},e.prototype.insertFileScanImageToScanRegion=function(){var t=this,n=document.getElementById(this.getScanRegionId());if(this.fileScanImage){n.innerHTML="
",n.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(o){n.innerHTML="
",n.appendChild(t.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=hne},e.prototype.clearScanRegion=function(){var t=document.getElementById(this.getScanRegionId());t.innerHTML=""},e.prototype.getDashboardSectionId=function(){return this.elementId+"__dashboard_section"},e.prototype.getDashboardSectionCameraScanRegionId=function(){return this.elementId+"__dashboard_section_csr"},e.prototype.getDashboardSectionFileScanRegionId=function(){return this.elementId+"__dashboard_section_fsr"},e.prototype.getDashboardSectionSwapLinkId=function(){return this.elementId+"__dashboard_section_swaplink"},e.prototype.getScanRegionId=function(){return this.elementId+"__scan_region"},e.prototype.getDashboardId=function(){return this.elementId+"__dashboard"},e.prototype.getFileScanInputId=function(){return this.elementId+"__filescan_input"},e.prototype.getStatusSpanId=function(){return this.elementId+"__status_span"},e.prototype.getHeaderMessageContainerId=function(){return this.elementId+"__header_message"},e.prototype.getCameraSelectionId=function(){return this.elementId+"__camera_selection"},e.prototype.getCameraPermissionButtonId=function(){return this.elementId+"__camera_permission_button"},e.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},e.prototype.getFileScanRegion=function(){return document.getElementById(this.getDashboardSectionFileScanRegionId())},e.prototype.getFileScanInput=function(){return document.getElementById(this.getFileScanInputId())},e.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},e.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},e}();const Ene={id:"qr-code-full-region"},Sne=ve({props:{qrbox:null,fps:null},emits:["decodedCode"],setup(e,{emit:t}){const n=e;var o={fps:n.fps?n.fps:10};let s="";n.qrbox&&(o.qrbox=n.qrbox);let i=null;function l(p,m){s!==p&&(s=p,t("decodedCode",p,m))}function c(p,m){}async function f(){await dt(),i=new Cne("qr-code-full-region",o,void 0),i.render(l,c)}return f(),(p,m)=>(M(),W("div",Ene))}}),Ane=Ht(" \u4EBA\u6578\uFF1A "),Tne={id:"section",class:"section",style:{width:"70%",margin:"auto"}},Ine=Ht("\u6309\u6211\u50B3\u9001\u7C21\u8A0A "),_ne=ve({setup(e){let t=F("\u5167\u5BB9:"),n=F(1),o=F("");var s=navigator.userAgent,i=s.indexOf("Android")>-1||s.indexOf("Adr")>-1,l=!!s.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);function c(v,w){v.includes("1922:")?p(v):t.value=`\u5167\u5BB9:${v}`}function f(v){let w="";n.value>1&&(w=`+${n.value-1}`),t.value=`\u5167\u5BB9:${o.value}${w}`}function p(v){let w="";n.value>1&&(w=`+${n.value-1}`);let I=v.split("1922:")[1];o.value=I,t.value=`\u5167\u5BB9:${o.value}${w}`;let S=document.getElementById("Btn_Open");S.style.display="inline",m()}function m(){let v="";n.value>1&&(v=`+${n.value-1}`),i?window.open(`sms:1922?&body=${o.value}${v}`,"_self"):l?window.open(`sms:1922&body=${o.value}${v}`,"_self"):alert(`sms:1922&body=${o.value}${v}`)}async function y(){await dt();let v=document.getElementById("Btn_Open");if(v.style.display="none",!i&&!l){let w=document.getElementById("section");w.style.width="500px"}}return y(),(v,w)=>{const E=Ae("el-input-number"),I=Ae("el-button");return M(),W(at,null,[Q("div",null,[Ane,le(E,{modelValue:k(n),"onUpdate:modelValue":w[0]||(w[0]=S=>wn(n)?n.value=S:n=S),min:1,size:"large",onChange:f},null,8,["modelValue"])]),Q("div",Tne,[le(Sne,{qrbox:200,fps:10,onDecodedCode:c})]),Q("div",null,Pe(k(t)),1),le(I,{id:"Btn_Open",type:"success",onClick:w[1]||(w[1]=()=>{m()}),size:"large",round:""},{default:ae(()=>[Ine]),_:1})],64)}}}),Nne=ve({setup(e){return(t,n)=>(M(),me(_ne))}});X2(Nne).use(Zte,{locale:Qte}).mount("#app")});export default kne(); diff --git a/dist/index.html b/dist/index.html index e63c1a5..8beb4d9 100644 --- a/dist/index.html +++ b/dist/index.html @@ -6,8 +6,8 @@ - HTML5 QR Code with Vue js - + 建喵防疫實聯制 + diff --git a/index.html b/index.html index 852ec15..4278888 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ - HTML5 QR Code with Vue js + 建喵防疫實聯制 diff --git a/src/components/QRCode.vue b/src/components/QRCode.vue index 7f96128..a735f86 100644 --- a/src/components/QRCode.vue +++ b/src/components/QRCode.vue @@ -4,7 +4,7 @@ import QRCodeScanner from './QRCodeScanner.vue'; // defineProps<{ msg: string }>() -let result = ref(''); +let result = ref('內容:'); let count = ref(1); let smscontent = ref(''); @@ -12,7 +12,7 @@ var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 -const decodedCode = function (decodedText: string, decodedResult: any) { +function decodedCode(decodedText: string, decodedResult: any) { // console.log(`Scan result ${decodedText}`, decodedResult); if (decodedText.includes('1922:')) { smsto1922(decodedText); @@ -21,11 +21,23 @@ const decodedCode = function (decodedText: string, decodedResult: any) { } } +function changecount(value: number) { + let addcount = ""; + if (count.value > 1) { + addcount = `+${count.value - 1}`; + } + result.value = `內容:${smscontent.value}${addcount}`; +} + function smsto1922(decodedText: string) { + let addcount = ""; + if (count.value > 1) { + addcount = `+${count.value - 1}`; + } let contents = decodedText.split('1922:'); let sms = contents[1]; - result.value = `內容:${sms}`; smscontent.value = sms; + result.value = `內容:${smscontent.value}${addcount}`; let Btn_Open = document.getElementById("Btn_Open")!; Btn_Open.style.display = "inline"; OnclickOpen(); @@ -63,7 +75,7 @@ onLoad();