@nocobase/plugin-block-workbench 1.3.54 → 1.3.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,4 +33,4 @@
33
33
  `),e.append(`>>
34
34
  `),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<Zt.NUM_MASK_PATTERNS}}Zt.NUM_MASK_PATTERNS=8;class Ie extends A{}Ie.kind="WriterException";class j{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){j.clearMatrix(i),j.embedBasicPatterns(n,i),j.embedTypeInfo(t,r,i),j.maybeEmbedVersionInfo(n,i),j.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){j.embedPositionDetectionPatternsAndSeparators(t),j.embedDarkDotAtLeftBottomCorner(t),j.maybeEmbedPositionAdjustmentPatterns(e,t),j.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new le;j.makeTypeInfoBits(e,t,r);for(let i=0,s=r.getSize();i<s;++i){const o=r.get(r.getSize()-1-i),a=j.TYPE_INFO_COORDINATES[i],l=a[0],c=a[1];if(n.setBoolean(l,c,o),i<8){const f=n.getWidth()-i-1,g=8;n.setBoolean(f,g,o)}else{const g=n.getHeight()-7+(i-8);n.setBoolean(8,g,o)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new le;j.makeVersionInfoBits(e,n);let r=6*3-1;for(let i=0;i<6;++i)for(let s=0;s<3;++s){const o=n.get(r);r--,t.setBoolean(i,t.getHeight()-11+s,o),t.setBoolean(t.getHeight()-11+s,i,o)}}static embedDataBits(e,t,n){let r=0,i=-1,s=n.getWidth()-1,o=n.getHeight()-1;for(;s>0;){for(s===6&&(s-=1);o>=0&&o<n.getHeight();){for(let a=0;a<2;++a){const l=s-a;if(!j.isEmpty(n.get(l,o)))continue;let c;r<e.getSize()?(c=e.get(r),++r):c=!1,t!==255&&Pe.getDataMaskBit(t,l,o)&&(c=!c),n.setBoolean(l,o,c)}o+=i}i=-i,o+=i,s-=2}if(r!==e.getSize())throw new Ie("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-Z.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new O("0 polynomial");const n=j.findMSBSet(t);for(e<<=n-1;j.findMSBSet(e)>=n;)e^=t<<j.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!Zt.isValidMaskPattern(t))throw new Ie("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const i=j.calculateBCHCode(r,j.TYPE_INFO_POLY);n.appendBits(i,10);const s=new le;if(s.appendBits(j.TYPE_INFO_MASK_PATTERN,15),n.xor(s),n.getSize()!==15)throw new Ie("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=j.calculateBCHCode(e.getVersionNumber(),j.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new Ie("should not happen but we got: "+t.getSize())}static isEmpty(e){return e===255}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;j.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),j.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new Ie;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!j.isEmpty(n.get(e+r,t)))throw new Ie;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!j.isEmpty(n.get(e,t+r)))throw new Ie;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const i=j.POSITION_ADJUSTMENT_PATTERN[r];for(let s=0;s<5;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const i=j.POSITION_DETECTION_PATTERN[r];for(let s=0;s<7;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPatternsAndSeparators(e){const t=j.POSITION_DETECTION_PATTERN[0].length;j.embedPositionDetectionPattern(0,0,e),j.embedPositionDetectionPattern(e.getWidth()-t,0,e),j.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;j.embedHorizontalSeparationPattern(0,n-1,e),j.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),j.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;j.embedVerticalSeparationPattern(r,0,e),j.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),j.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=j.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let i=0,s=r.length;i!==s;i++){const o=r[i];if(o>=0)for(let a=0;a!==s;a++){const l=r[a];l>=0&&j.isEmpty(t.get(l,o))&&j.embedPositionAdjustmentPattern(l-2,o-2,t)}}}}j.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])]),j.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])]),j.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])]),j.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])]),j.VERSION_INFO_POLY=7973,j.TYPE_INFO_POLY=1335,j.TYPE_INFO_MASK_PATTERN=21522;class gs{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class _e{constructor(){}static calculateMaskPenalty(e){return Pe.applyMaskPenaltyRule1(e)+Pe.applyMaskPenaltyRule2(e)+Pe.applyMaskPenaltyRule3(e)+Pe.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=_e.DEFAULT_BYTE_MODE_ENCODING;const i=n!==null&&n.get(Ve.CHARACTER_SET)!==void 0;i&&(r=n.get(Ve.CHARACTER_SET).toString());const s=this.chooseMode(e,r),o=new le;if(s===Y.BYTE&&(i||_e.DEFAULT_BYTE_MODE_ENCODING!==r)){const F=k.getCharacterSetECIByName(r);F!==void 0&&this.appendECI(F,o)}this.appendModeInfo(s,o);const a=new le;this.appendBytes(e,s,a,r);let l;if(n!==null&&n.get(Ve.QR_VERSION)!==void 0){const F=Number.parseInt(n.get(Ve.QR_VERSION).toString(),10);l=z.getVersionForNumber(F);const P=this.calculateBitsNeeded(s,o,a,l);if(!this.willFit(P,l,t))throw new Ie("Data too big for requested version")}else l=this.recommendVersion(t,s,o,a);const c=new le;c.appendBitArray(o);const f=s===Y.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(f,l,s,c),c.appendBitArray(a);const g=l.getECBlocksForLevel(t),E=l.getTotalCodewords()-g.getTotalECCodewords();this.terminateBits(E,c);const I=this.interleaveWithECBytes(c,l.getTotalCodewords(),E,g.getNumBlocks()),b=new Zt;b.setECLevel(t),b.setMode(s),b.setVersion(l);const y=l.getDimensionForVersion(),_=new Gn(y,y),L=this.chooseMaskPattern(I,t,l,_);return b.setMaskPattern(L),j.buildMatrix(I,t,l,L,_),b.setMatrix(_),b}static recommendVersion(e,t,n,r){const i=this.calculateBitsNeeded(t,n,r,z.getVersionForNumber(1)),s=this.chooseVersion(i,e),o=this.calculateBitsNeeded(t,n,r,s);return this.chooseVersion(o,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<_e.ALPHANUMERIC_TABLE.length?_e.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(k.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Y.KANJI;let n=!1,r=!1;for(let i=0,s=e.length;i<s;++i){const o=e.charAt(i);if(_e.isDigit(o))n=!0;else if(this.getAlphanumericCode(o.charCodeAt(0))!==-1)r=!0;else return Y.BYTE}return r?Y.ALPHANUMERIC:n?Y.NUMERIC:Y.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=st.encode(e,k.SJIS)}catch(r){return!1}const n=t.length;if(n%2!==0)return!1;for(let r=0;r<n;r+=2){const i=t[r]&255;if((i<129||i>159)&&(i<224||i>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,s=-1;for(let o=0;o<Zt.NUM_MASK_PATTERNS;o++){j.buildMatrix(e,t,n,o,r);let a=this.calculateMaskPenalty(r);a<i&&(i=a,s=o)}return s}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=z.getVersionForNumber(n);if(_e.willFit(e,r,t))return r}throw new Ie("Data too big")}static willFit(e,t,n){const r=t.getTotalCodewords(),s=t.getECBlocksForLevel(n).getTotalECCodewords(),o=r-s,a=(e+7)/8;return o>=a}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new Ie("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let s=0;s<4&&t.getSize()<n;++s)t.appendBit(!1);const r=t.getSize()&7;if(r>0)for(let s=r;s<8;s++)t.appendBit(!1);const i=e-t.getSizeInBytes();for(let s=0;s<i;++s)t.appendBits(s&1?17:236,8);if(t.getSize()!==n)throw new Ie("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,i,s){if(r>=n)throw new Ie("Block ID too large");const o=e%n,a=n-o,l=Math.floor(e/n),c=l+1,f=Math.floor(t/n),g=f+1,E=l-f,I=c-g;if(E!==I)throw new Ie("EC bytes mismatch");if(n!==a+o)throw new Ie("RS blocks mismatch");if(e!==(f+E)*a+(g+I)*o)throw new Ie("Total bytes mismatch");r<a?(i[0]=f,s[0]=E):(i[0]=g,s[0]=I)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new Ie("Number of bits and data bytes does not match");let i=0,s=0,o=0;const a=new Array;for(let c=0;c<r;++c){const f=new Int32Array(1),g=new Int32Array(1);_e.getNumDataBytesAndNumECBytesForBlockID(t,n,r,c,f,g);const E=f[0],I=new Uint8Array(E);e.toBytes(8*i,I,0,E);const b=_e.generateECBytes(I,g[0]);a.push(new gs(I,b)),s=Math.max(s,E),o=Math.max(o,b.length),i+=f[0]}if(n!==i)throw new Ie("Data bytes does not match offset");const l=new le;for(let c=0;c<s;++c)for(const f of a){const g=f.getDataBytes();c<g.length&&l.appendBits(g[c],8)}for(let c=0;c<o;++c)for(const f of a){const g=f.getErrorCorrectionBytes();c<g.length&&l.appendBits(g[c],8)}if(t!==l.getSizeInBytes())throw new Ie("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let s=0;s<n;s++)r[s]=e[s]&255;new fr(fe.QR_CODE_FIELD_256).encode(r,t);const i=new Uint8Array(t);for(let s=0;s<t;s++)i[s]=r[n+s];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const i=n.getCharacterCountBits(t);if(e>=1<<i)throw new Ie(e+" is bigger than "+((1<<i)-1));r.appendBits(e,i)}static appendBytes(e,t,n,r){switch(t){case Y.NUMERIC:_e.appendNumericBytes(e,n);break;case Y.ALPHANUMERIC:_e.appendAlphanumericBytes(e,n);break;case Y.BYTE:_e.append8BitBytes(e,n,r);break;case Y.KANJI:_e.appendKanjiBytes(e,n);break;default:throw new Ie("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=_e.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=_e.getDigit(e.charAt(r));if(r+2<n){const s=_e.getDigit(e.charAt(r+1)),o=_e.getDigit(e.charAt(r+2));t.appendBits(i*100+s*10+o,10),r+=3}else if(r+1<n){const s=_e.getDigit(e.charAt(r+1));t.appendBits(i*10+s,7),r+=2}else t.appendBits(i,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=_e.getAlphanumericCode(e.charCodeAt(r));if(i===-1)throw new Ie;if(r+1<n){const s=_e.getAlphanumericCode(e.charCodeAt(r+1));if(s===-1)throw new Ie;t.appendBits(i*45+s,11),r+=2}else t.appendBits(i,6),r++}}static append8BitBytes(e,t,n){let r;try{r=st.encode(e,n)}catch(i){throw new Ie(i)}for(let i=0,s=r.length;i!==s;i++){const o=r[i];t.appendBits(o,8)}}static appendKanjiBytes(e,t){let n;try{n=st.encode(e,k.SJIS)}catch(i){throw new Ie(i)}const r=n.length;for(let i=0;i<r;i+=2){const s=n[i]&255,o=n[i+1]&255,a=s<<8&4294967295|o;let l=-1;if(a>=33088&&a<=40956?l=a-33088:a>=57408&&a<=60351&&(l=a-49472),l===-1)throw new Ie("Invalid byte sequence");const c=(l>>8)*192+(l&255);t.appendBits(c,13)}}static appendECI(e,t){t.appendBits(Y.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}_e.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]),_e.DEFAULT_BYTE_MODE_ENCODING=k.UTF8.getName();class Kt{write(e,t,n,r=null){if(e.length===0)throw new O("Found empty contents");if(t<0||n<0)throw new O("Requested dimensions are too small: "+t+"x"+n);let i=Se.L,s=Kt.QUIET_ZONE_SIZE;r!==null&&(r.get(Ve.ERROR_CORRECTION)!==void 0&&(i=Se.fromString(r.get(Ve.ERROR_CORRECTION).toString())),r.get(Ve.MARGIN)!==void 0&&(s=Number.parseInt(r.get(Ve.MARGIN).toString(),10)));const o=_e.encode(e,i,r);return this.renderResult(o,t,n,s)}writeToDom(e,t,n,r,i=null){typeof e=="string"&&(e=document.querySelector(e));const s=this.write(t,n,r,i);e&&e.appendChild(s)}renderResult(e,t,n,r){const i=e.getMatrix();if(i===null)throw new It;const s=i.getWidth(),o=i.getHeight(),a=s+r*2,l=o+r*2,c=Math.max(t,a),f=Math.max(n,l),g=Math.min(Math.floor(c/a),Math.floor(f/l)),E=Math.floor((c-s*g)/2),I=Math.floor((f-o*g)/2),b=this.createSVGElement(c,f);for(let y=0,_=I;y<o;y++,_+=g)for(let L=0,F=E;L<s;L++,F+=g)if(i.get(L,y)===1){const P=this.createSvgRectElement(F,_,g,g);b.appendChild(P)}return b}createSVGElement(e,t){const n=document.createElementNS(Kt.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const i=document.createElementNS(Kt.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",n.toString()),i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"fill","#000000"),i}}Kt.QUIET_ZONE_SIZE=4,Kt.SVG_NS="http://www.w3.org/2000/svg";class an{encode(e,t,n,r,i){if(e.length===0)throw new O("Found empty contents");if(t!==K.QR_CODE)throw new O("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new O(`Requested dimensions are too small: ${n}x${r}`);let s=Se.L,o=an.QUIET_ZONE_SIZE;i!==null&&(i.get(Ve.ERROR_CORRECTION)!==void 0&&(s=Se.fromString(i.get(Ve.ERROR_CORRECTION).toString())),i.get(Ve.MARGIN)!==void 0&&(o=Number.parseInt(i.get(Ve.MARGIN).toString(),10)));const a=_e.encode(e,s,i);return an.renderResult(a,n,r,o)}static renderResult(e,t,n,r){const i=e.getMatrix();if(i===null)throw new It;const s=i.getWidth(),o=i.getHeight(),a=s+r*2,l=o+r*2,c=Math.max(t,a),f=Math.max(n,l),g=Math.min(Math.floor(c/a),Math.floor(f/l)),E=Math.floor((c-s*g)/2),I=Math.floor((f-o*g)/2),b=new We(c,f);for(let y=0,_=I;y<o;y++,_+=g)for(let L=0,F=E;L<s;L++,F+=g)i.get(L,y)===1&&b.setRegion(F,_,g,g);return b}}an.QUIET_ZONE_SIZE=4;class ws{encode(e,t,n,r,i){let s;switch(t){case K.QR_CODE:s=new an;break;default:throw new O("No encoder available for format "+t)}return s.encode(e,t,n,r,i)}}class Tt extends xn{constructor(e,t,n,r,i,s,o,a){if(super(s,o),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=i,r+s>t||i+o>n)throw new O("Crop rectangle does not fit within image data.");a&&this.reverseHorizontal(s,o)}getRow(e,t){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return ee.arraycopy(this.yuvData,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return ee.arraycopy(this.yuvData,i,r,0,n),r;for(let s=0;s<t;s++){const o=s*e;ee.arraycopy(this.yuvData,i,r,o,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Tt(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/Tt.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Tt.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let i=this.top*this.dataWidth+this.left;for(let s=0;s<t;s++){const o=s*e;for(let a=0;a<e;a++){const l=r[i+a*Tt.THUMBNAIL_SCALE_FACTOR]&255;n[o+a]=4278190080|l*65793}i+=this.dataWidth*Tt.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Tt.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Tt.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,i=this.top*this.dataWidth+this.left;r<t;r++,i+=this.dataWidth){const s=i+e/2;for(let o=i,a=i+e-1;o<s;o++,a--){const l=n[o];n[o]=n[a],n[a]=l}}}invert(){return new Bt(this)}}Tt.THUMBNAIL_SCALE_FACTOR=2;class dr extends xn{constructor(e,t,n,r,i,s,o){if(super(t,n),this.dataWidth=r,this.dataHeight=i,this.left=s,this.top=o,e.BYTES_PER_ELEMENT===4){const a=t*n,l=new Uint8ClampedArray(a);for(let c=0;c<a;c++){const f=e[c],g=f>>16&255,E=f>>7&510,I=f&255;l[c]=(g+E+I)/4&255}this.luminances=l}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),i===void 0&&(this.dataHeight=n),s===void 0&&(this.left=0),o===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new O("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return ee.arraycopy(this.luminances,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return ee.arraycopy(this.luminances,i,r,0,n),r;for(let s=0;s<t;s++){const o=s*e;ee.arraycopy(this.luminances,i,r,o,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new dr(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new Bt(this)}}class $r extends k{static forName(e){return this.getCharacterSetECIByName(e)}}class xr{}xr.ISO_8859_1=k.ISO8859_1;class ei{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class ti{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class As{constructor(e){this.previous=e}getPrevious(){return this.previous}}class ln extends As{constructor(e,t,n){super(e),this.value=t,this.bitCount=n}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new ln(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new ln(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+Z.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class gr extends ln{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(n===0||n===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new gr(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Cs(u,e,t){return new gr(u,e,t)}function Sn(u,e,t){return new ln(u,e,t)}const Es=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Gt=0,Wn=1,Ct=2,ni=3,Nt=4,ms=new ln(null,0,0),wr=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function ps(u){for(let e of u)Ae.fill(e,-1);return u[Gt][Nt]=0,u[Wn][Nt]=0,u[Wn][Gt]=28,u[ni][Nt]=0,u[Ct][Nt]=0,u[Ct][Gt]=15,u}const ri=ps(Ae.createInt32Array(6,6));class _t{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let s=wr[this.mode][e];r=Sn(r,s&65535,s>>16),n+=s>>16}let i=e===Ct?4:5;return r=Sn(r,t,i),new _t(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===Ct?4:5;return n=Sn(n,ri[this.mode][e],r),n=Sn(n,t,5),new _t(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Nt||this.mode===Ct){let o=wr[n][Gt];t=Sn(t,o&65535,o>>16),r+=o>>16,n=Gt}let i=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new _t(t,n,this.binaryShiftByteCount+1,r+i);return s.binaryShiftByteCount===2078&&(s=s.endBinaryShift(e+1)),s}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=Cs(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new _t(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(wr[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=_t.calculateBinaryShiftCost(e)-_t.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;r!==null;r=r.getPrevious())t.unshift(r);let n=new le;for(const r of t)r.appendTo(n,e);return n}toString(){return J.format("%s bits=%d bytes=%d",Es[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}_t.INITIAL_STATE=new _t(ms,Gt,0,0);function Is(u){const e=J.getCharCode(" "),t=J.getCharCode("."),n=J.getCharCode(",");u[Gt][e]=1;const r=J.getCharCode("Z"),i=J.getCharCode("A");for(let g=i;g<=r;g++)u[Gt][g]=g-i+2;u[Wn][e]=1;const s=J.getCharCode("z"),o=J.getCharCode("a");for(let g=o;g<=s;g++)u[Wn][g]=g-o+2;u[Ct][e]=1;const a=J.getCharCode("9"),l=J.getCharCode("0");for(let g=l;g<=a;g++)u[Ct][g]=g-l+2;u[Ct][n]=12,u[Ct][t]=13;const c=["\0"," ","","","","","","","\x07","\b"," ",`
35
35
  `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let g=0;g<c.length;g++)u[ni][J.getCharCode(c[g])]=g;const f=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let g=0;g<f.length;g++)J.getCharCode(f[g])>0&&(u[Nt][J.getCharCode(f[g])]=g);return u}const Ar=Is(Ae.createInt32Array(5,256));class Tn{constructor(e){this.text=e}encode(){const e=J.getCharCode(" "),t=J.getCharCode(`
36
- `);let n=ti.singletonList(_t.INITIAL_STATE);for(let i=0;i<this.text.length;i++){let s,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case J.getCharCode("\r"):s=o===t?2:0;break;case J.getCharCode("."):s=o===e?3:0;break;case J.getCharCode(","):s=o===e?4:0;break;case J.getCharCode(":"):s=o===e?5:0;break;default:s=0}s>0?(n=Tn.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}return ti.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Tn.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,i=Ar[e.getMode()][r]>0,s=null;for(let o=0;o<=Nt;o++){let a=Ar[o][r];if(a>0){if(s==null&&(s=e.endBinaryShift(t)),!i||o===e.getMode()||o===Ct){const l=s.latchAndAppend(o,a);n.push(l)}if(!i&&ri[e.getMode()][o]>=0){const l=s.shiftAndAppend(o,a);n.push(l)}}}if(e.getBinaryShiftByteCount()>0||Ar[e.getMode()][r]===0){let o=e.addBinaryShiftChar(t);n.push(o)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(Nt,n)),e.getMode()!==Nt&&r.push(i.shiftAndAppend(Nt,n)),n===3||n===4){let s=i.latchAndAppend(Ct,16-n).latchAndAppend(Ct,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class ue{constructor(){}static encodeBytes(e){return ue.encode(e,ue.DEFAULT_EC_PERCENT,ue.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Tn(e).encode(),i=Z.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,o,a,l,c,f;if(n!==ue.DEFAULT_AZTEC_LAYERS){if(o=n<0,a=Math.abs(n),a>(o?ue.MAX_NB_BITS_COMPACT:ue.MAX_NB_BITS))throw new O(J.format("Illegal value %s for layers",n));l=ue.totalBitsInLayer(a,o),c=ue.WORD_SIZE[a];let P=l-l%c;if(f=ue.stuffBits(r,c),f.getSize()+i>P)throw new O("Data to large for user specified layer");if(o&&f.getSize()>c*64)throw new O("Data to large for user specified layer")}else{c=0,f=null;for(let P=0;;P++){if(P>ue.MAX_NB_BITS)throw new O("Data too large for an Aztec code");if(o=P<=3,a=o?P+1:P,l=ue.totalBitsInLayer(a,o),s>l)continue;(f==null||c!==ue.WORD_SIZE[a])&&(c=ue.WORD_SIZE[a],f=ue.stuffBits(r,c));let ae=l-l%c;if(!(o&&f.getSize()>c*64)&&f.getSize()+i<=ae)break}}let g=ue.generateCheckWords(f,l,c),E=f.getSize()/c,I=ue.generateModeMessage(o,a,E),b=(o?11:14)+a*4,y=new Int32Array(b),_;if(o){_=b;for(let P=0;P<y.length;P++)y[P]=P}else{_=b+1+2*Z.truncDivision(Z.truncDivision(b,2)-1,15);let P=Z.truncDivision(b,2),ae=Z.truncDivision(_,2);for(let te=0;te<P;te++){let ht=te+Z.truncDivision(te,15);y[P-te-1]=ae-ht-1,y[P+te]=ae+ht+1}}let L=new We(_);for(let P=0,ae=0;P<a;P++){let te=(a-P)*4+(o?9:12);for(let ht=0;ht<te;ht++){let pt=ht*2;for(let ut=0;ut<2;ut++)g.get(ae+pt+ut)&&L.set(y[P*2+ut],y[P*2+ht]),g.get(ae+te*2+pt+ut)&&L.set(y[P*2+ht],y[b-1-P*2-ut]),g.get(ae+te*4+pt+ut)&&L.set(y[b-1-P*2-ut],y[b-1-P*2-ht]),g.get(ae+te*6+pt+ut)&&L.set(y[b-1-P*2-ht],y[P*2+ut])}ae+=te*8}if(ue.drawModeMessage(L,o,_,I),o)ue.drawBullsEye(L,Z.truncDivision(_,2),5);else{ue.drawBullsEye(L,Z.truncDivision(_,2),7);for(let P=0,ae=0;P<Z.truncDivision(b,2)-1;P+=15,ae+=16)for(let te=Z.truncDivision(_,2)&1;te<_;te+=2)L.set(Z.truncDivision(_,2)-ae,te),L.set(Z.truncDivision(_,2)+ae,te),L.set(te,Z.truncDivision(_,2)-ae),L.set(te,Z.truncDivision(_,2)+ae)}let F=new ei;return F.setCompact(o),F.setSize(_),F.setLayers(a),F.setCodeWords(E),F.setMatrix(L),F}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let i=t-r;i<=t+r;i++)e.set(i,t-r),e.set(i,t+r),e.set(t-r,i),e.set(t+r,i);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let r=new le;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=ue.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=ue.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=Z.truncDivision(n,2);if(t)for(let s=0;s<7;s++){let o=i-3+s;r.get(s)&&e.set(o,i-5),r.get(s+7)&&e.set(i+5,o),r.get(20-s)&&e.set(o,i+5),r.get(27-s)&&e.set(i-5,o)}else for(let s=0;s<10;s++){let o=i-5+s+Z.truncDivision(s,5);r.get(s)&&e.set(o,i-7),r.get(s+10)&&e.set(i+7,o),r.get(29-s)&&e.set(o,i+7),r.get(39-s)&&e.set(i-7,o)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new fr(ue.getGF(n)),s=Z.truncDivision(t,n),o=ue.bitsToWords(e,n,s);i.encode(o,s-r);let a=t%n,l=new le;l.appendBits(0,a);for(const c of Array.from(o))l.appendBits(c,n);return l}static bitsToWords(e,t,n){let r=new Int32Array(n),i,s;for(i=0,s=e.getSize()/t;i<s;i++){let o=0;for(let a=0;a<t;a++)o|=e.get(i*t+a)?1<<t-a-1:0;r[i]=o}return r}static getGF(e){switch(e){case 4:return fe.AZTEC_PARAM;case 6:return fe.AZTEC_DATA_6;case 8:return fe.AZTEC_DATA_8;case 10:return fe.AZTEC_DATA_10;case 12:return fe.AZTEC_DATA_12;default:throw new O("Unsupported word size "+e)}}static stuffBits(e,t){let n=new le,r=e.getSize(),i=(1<<t)-2;for(let s=0;s<r;s+=t){let o=0;for(let a=0;a<t;a++)(s+a>=r||e.get(s+a))&&(o|=1<<t-1-a);(o&i)===i?(n.appendBits(o&i,t),s--):o&i?n.appendBits(o,t):(n.appendBits(o|1,t),s--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ue.DEFAULT_EC_PERCENT=33,ue.DEFAULT_AZTEC_LAYERS=0,ue.MAX_NB_BITS=32,ue.MAX_NB_BITS_COMPACT=4,ue.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Hn{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let s=xr.ISO_8859_1,o=ue.DEFAULT_EC_PERCENT,a=ue.DEFAULT_AZTEC_LAYERS;return i!=null&&(i.has(Ve.CHARACTER_SET)&&(s=$r.forName(i.get(Ve.CHARACTER_SET).toString())),i.has(Ve.ERROR_CORRECTION)&&(o=Z.parseInt(i.get(Ve.ERROR_CORRECTION).toString())),i.has(Ve.AZTEC_LAYERS)&&(a=Z.parseInt(i.get(Ve.AZTEC_LAYERS).toString()))),Hn.encodeLayers(e,t,n,r,s,o,a)}static encodeLayers(e,t,n,r,i,s,o){if(t!==K.AZTEC)throw new O("Can only encode AZTEC, but got "+t);let a=ue.encode(J.getBytes(e,i),s,o);return Hn.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new It;let i=r.getWidth(),s=r.getHeight(),o=Math.max(t,i),a=Math.max(n,s),l=Math.min(o/i,a/s),c=(o-i*l)/2,f=(a-s*l)/2,g=new We(o,a);for(let E=0,I=f;E<s;E++,I+=l)for(let b=0,y=c;b<i;b++,y+=l)r.get(b,E)&&g.setRegion(y,I,l,l);return g}}h.AbstractExpandedDecoder=nr,h.ArgumentException=R,h.ArithmeticException=Dn,h.AztecCode=ei,h.AztecCodeReader=vn,h.AztecCodeWriter=Hn,h.AztecDecoder=ye,h.AztecDetector=Vr,h.AztecDetectorResult=kr,h.AztecEncoder=ue,h.AztecHighLevelEncoder=Tn,h.AztecPoint=nt,h.BarcodeFormat=K,h.Binarizer=Ne,h.BinaryBitmap=ie,h.BitArray=le,h.BitMatrix=We,h.BitSource=or,h.BrowserAztecCodeReader=Ki,h.BrowserBarcodeReader=$i,h.BrowserCodeReader=Wt,h.BrowserDatamatrixCodeReader=ts,h.BrowserMultiFormatReader=fs,h.BrowserPDF417Reader=ds,h.BrowserQRCodeReader=xs,h.BrowserQRCodeSvgWriter=Kt,h.CharacterSetECI=k,h.ChecksumException=$,h.Code128Reader=V,h.Code39Reader=ke,h.DataMatrixDecodedBitStreamParser=Ft,h.DataMatrixReader=kt,h.DecodeHintType=Ce,h.DecoderResult=gn,h.DefaultGridSampler=Ur,h.DetectorResult=Bn,h.EAN13Reader=Ht,h.EncodeHintType=Ve,h.Exception=A,h.FormatException=U,h.GenericGF=fe,h.GenericGFPoly=ot,h.GlobalHistogramBinarizer=He,h.GridSampler=Jn,h.GridSamplerInstance=Pt,h.HTMLCanvasElementLuminanceSource=vt,h.HybridBinarizer=ne,h.ITFReader=pe,h.IllegalArgumentException=O,h.IllegalStateException=It,h.InvertedLuminanceSource=Bt,h.LuminanceSource=xn,h.MathUtils=he,h.MultiFormatOneDReader=sn,h.MultiFormatReader=Jr,h.MultiFormatWriter=ws,h.NotFoundException=D,h.OneDReader=Fe,h.PDF417DecodedBitStreamParser=N,h.PDF417DecoderErrorCorrection=Yr,h.PDF417Reader=je,h.PDF417ResultMetadata=Kr,h.PerspectiveTransform=Et,h.PlanarYUVLuminanceSource=Tt,h.QRCodeByteMatrix=Gn,h.QRCodeDataMask=wt,h.QRCodeDecodedBitStreamParser=Me,h.QRCodeDecoderErrorCorrectionLevel=Se,h.QRCodeDecoderFormatInformation=Je,h.QRCodeEncoder=_e,h.QRCodeEncoderQRCode=Zt,h.QRCodeMaskUtil=Pe,h.QRCodeMatrixUtil=j,h.QRCodeMode=Y,h.QRCodeReader=Ut,h.QRCodeVersion=z,h.QRCodeWriter=an,h.RGBLuminanceSource=dr,h.RSS14Reader=ve,h.RSSExpandedReader=v,h.ReaderException=Vn,h.ReedSolomonDecoder=An,h.ReedSolomonEncoder=fr,h.ReedSolomonException=en,h.Result=tt,h.ResultMetadataType=Xe,h.ResultPoint=X,h.StringUtils=J,h.UnsupportedOperationException=$t,h.VideoInputDevice=Fr,h.WhiteRectangleDetector=Rt,h.WriterException=Ie,h.ZXingArrays=Ae,h.ZXingCharset=$r,h.ZXingInteger=Z,h.ZXingStandardCharsets=xr,h.ZXingStringBuilder=Ee,h.ZXingStringEncoding=st,h.ZXingSystem=ee,h.createAbstractExpandedDecoder=Xr,Object.defineProperty(h,"__esModule",{value:!0})})})(Kn,Kn.exports);var Te=Kn.exports;const Ii=li({__proto__:null,default:pi(Te)},[Te]);var Tr=function(){function w(x,h,m){if(this.formatMap=new Map([[G.QR_CODE,Te.BarcodeFormat.QR_CODE],[G.AZTEC,Te.BarcodeFormat.AZTEC],[G.CODABAR,Te.BarcodeFormat.CODABAR],[G.CODE_39,Te.BarcodeFormat.CODE_39],[G.CODE_93,Te.BarcodeFormat.CODE_93],[G.CODE_128,Te.BarcodeFormat.CODE_128],[G.DATA_MATRIX,Te.BarcodeFormat.DATA_MATRIX],[G.MAXICODE,Te.BarcodeFormat.MAXICODE],[G.ITF,Te.BarcodeFormat.ITF],[G.EAN_13,Te.BarcodeFormat.EAN_13],[G.EAN_8,Te.BarcodeFormat.EAN_8],[G.PDF_417,Te.BarcodeFormat.PDF_417],[G.RSS_14,Te.BarcodeFormat.RSS_14],[G.RSS_EXPANDED,Te.BarcodeFormat.RSS_EXPANDED],[G.UPC_A,Te.BarcodeFormat.UPC_A],[G.UPC_E,Te.BarcodeFormat.UPC_E],[G.UPC_EAN_EXTENSION,Te.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Ii)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=h,this.logger=m;var p=this.createZXingFormats(x),d=new Map;d.set(Te.DecodeHintType.POSSIBLE_FORMATS,p),d.set(Te.DecodeHintType.TRY_HARDER,!1),this.hints=d}return w.prototype.decodeAsync=function(x){var h=this;return new Promise(function(m,p){try{m(h.decode(x))}catch(d){p(d)}})},w.prototype.decode=function(x){var h=new Te.MultiFormatReader(this.verbose,this.hints),m=new Te.HTMLCanvasElementLuminanceSource(x),p=new Te.BinaryBitmap(new Te.HybridBinarizer(m)),d=h.decode(p);return{text:d.text,format:br.create(this.toHtml5QrcodeSupportedFormats(d.format)),debugData:this.createDebugData()}},w.prototype.createReverseFormatMap=function(){var x=new Map;return this.formatMap.forEach(function(h,m,p){x.set(h,m)}),x},w.prototype.toHtml5QrcodeSupportedFormats=function(x){if(!this.reverseFormatMap.has(x))throw"reverseFormatMap doesn't have ".concat(x);return this.reverseFormatMap.get(x)},w.prototype.createZXingFormats=function(x){for(var h=[],m=0,p=x;m<p.length;m++){var d=p[m];this.formatMap.has(d)?h.push(this.formatMap.get(d)):this.logger.logError("".concat(d," is not supported by")+"ZXingHtml5QrcodeShim")}return h},w.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},w}(),bi=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},yi=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Nr=function(){function w(x,h,m){if(this.formatMap=new Map([[G.QR_CODE,"qr_code"],[G.AZTEC,"aztec"],[G.CODABAR,"codabar"],[G.CODE_39,"code_39"],[G.CODE_93,"code_93"],[G.CODE_128,"code_128"],[G.DATA_MATRIX,"data_matrix"],[G.ITF,"itf"],[G.EAN_13,"ean_13"],[G.EAN_8,"ean_8"],[G.PDF_417,"pdf417"],[G.UPC_A,"upc_a"],[G.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!w.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=h,this.logger=m;var p=this.createBarcodeDetectorFormats(x);if(this.detector=new BarcodeDetector(p),!this.detector)throw"BarcodeDetector detector not supported"}return w.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var x=new BarcodeDetector({formats:["qr_code"]});return typeof x!="undefined"},w.prototype.decodeAsync=function(x){return bi(this,void 0,void 0,function(){var h,m;return yi(this,function(p){switch(p.label){case 0:return[4,this.detector.detect(x)];case 1:if(h=p.sent(),!h||h.length===0)throw"No barcode or QR code detected.";return m=this.selectLargestBarcode(h),[2,{text:m.rawValue,format:br.create(this.toHtml5QrcodeSupportedFormats(m.format)),debugData:this.createDebugData()}]}})})},w.prototype.selectLargestBarcode=function(x){for(var h=null,m=0,p=0,d=x;p<d.length;p++){var S=d[p],B=S.boundingBox.width*S.boundingBox.height;B>m&&(m=B,h=S)}if(!h)throw"No largest barcode found";return h},w.prototype.createBarcodeDetectorFormats=function(x){for(var h=[],m=0,p=x;m<p.length;m++){var d=p[m];this.formatMap.has(d)?h.push(this.formatMap.get(d)):this.logger.warn("".concat(d," is not supported by")+"BarcodeDetectorDelegate")}return{formats:h}},w.prototype.toHtml5QrcodeSupportedFormats=function(x){if(!this.reverseFormatMap.has(x))throw"reverseFormatMap doesn't have ".concat(x);return this.reverseFormatMap.get(x)},w.prototype.createReverseFormatMap=function(){var x=new Map;return this.formatMap.forEach(function(h,m,p){x.set(h,m)}),x},w.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},w}(),_r=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},Or=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Si=function(){function w(x,h,m,p){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=m,h&&Nr.isSupported()?(this.primaryDecoder=new Nr(x,m,p),this.secondaryDecoder=new Tr(x,m,p)):this.primaryDecoder=new Tr(x,m,p)}return w.prototype.decodeAsync=function(x){return _r(this,void 0,void 0,function(){var h;return Or(this,function(m){switch(m.label){case 0:h=performance.now(),m.label=1;case 1:return m.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(x)];case 2:return[2,m.sent()];case 3:return this.possiblyLogPerformance(h),[7];case 4:return[2]}})})},w.prototype.decodeRobustlyAsync=function(x){return _r(this,void 0,void 0,function(){var h,m;return Or(this,function(p){switch(p.label){case 0:h=performance.now(),p.label=1;case 1:return p.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(x)];case 2:return[2,p.sent()];case 3:if(m=p.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(x)];throw m;case 4:return this.possiblyLogPerformance(h),[7];case 5:return[2]}})})},w.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},w.prototype.possiblyLogPerformance=function(x){if(this.verbose){var h=performance.now()-x;this.executionResults.push(h),this.executions++,this.possiblyFlushPerformanceReport()}},w.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var x=0,h=0,m=this.executionResults;h<m.length;h++){var p=m[h];x+=p}var d=x/this.executionResults.length;console.log("".concat(d," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},w}(),jn=function(){var w=function(x,h){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(m[d]=p[d])},w(x,h)};return function(x,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");w(x,h);function m(){this.constructor=x}x.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}}(),On=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},Rn=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Rr=function(){function w(x,h){this.name=x,this.track=h}return w.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},w.prototype.apply=function(x){var h={};h[this.name]=x;var m={advanced:[h]};return this.track.applyConstraints(m)},w.prototype.value=function(){var x=this.track.getSettings();if(this.name in x){var h=x[this.name];return h}return null},w}(),Ti=function(w){jn(x,w);function x(h,m){return w.call(this,h,m)||this}return x.prototype.min=function(){return this.getCapabilities().min},x.prototype.max=function(){return this.getCapabilities().max},x.prototype.step=function(){return this.getCapabilities().step},x.prototype.apply=function(h){var m={};m[this.name]=h;var p={advanced:[m]};return this.track.applyConstraints(p)},x.prototype.getCapabilities=function(){this.failIfNotSupported();var h=this.track.getCapabilities(),m=h[this.name];return{min:m.min,max:m.max,step:m.step}},x.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},x}(Rr),Ni=function(w){jn(x,w);function x(h){return w.call(this,"zoom",h)||this}return x}(Ti),_i=function(w){jn(x,w);function x(h){return w.call(this,"torch",h)||this}return x}(Rr),Oi=function(){function w(x){this.track=x}return w.prototype.zoomFeature=function(){return new Ni(this.track)},w.prototype.torchFeature=function(){return new _i(this.track)},w}(),Ri=function(){function w(x,h,m){this.isClosed=!1,this.parentElement=x,this.mediaStream=h,this.callbacks=m,this.surface=this.createVideoElement(this.parentElement.clientWidth),x.append(this.surface)}return w.prototype.createVideoElement=function(x){var h=document.createElement("video");return h.style.width="".concat(x,"px"),h.style.display="block",h.muted=!0,h.setAttribute("muted","true"),h.playsInline=!0,h},w.prototype.setupSurface=function(){var x=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var h=function(){var m=x.surface.clientWidth,p=x.surface.clientHeight;x.callbacks.onRenderSurfaceReady(m,p),x.surface.removeEventListener("playing",h)};this.surface.addEventListener("playing",h),this.surface.srcObject=this.mediaStream,this.surface.play()},w.create=function(x,h,m,p){return On(this,void 0,void 0,function(){var d,S;return Rn(this,function(B){switch(B.label){case 0:return d=new w(x,h,p),m.aspectRatio?(S={aspectRatio:m.aspectRatio},[4,d.getFirstTrackOrFail().applyConstraints(S)]):[3,2];case 1:B.sent(),B.label=2;case 2:return d.setupSurface(),[2,d]}})})},w.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},w.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},w.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},w.prototype.resume=function(x){this.failIfClosed();var h=this,m=function(){setTimeout(x,200),h.surface.removeEventListener("playing",m)};this.surface.addEventListener("playing",m),this.surface.play()},w.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},w.prototype.getSurface=function(){return this.failIfClosed(),this.surface},w.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},w.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},w.prototype.applyVideoConstraints=function(x){return On(this,void 0,void 0,function(){return Rn(this,function(h){if("aspectRatio"in x)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(x)]})})},w.prototype.close=function(){if(this.isClosed)return Promise.resolve();var x=this;return new Promise(function(h,m){var p=x.mediaStream.getVideoTracks(),d=p.length,S=0;x.mediaStream.getVideoTracks().forEach(function(B){x.mediaStream.removeTrack(B),B.stop(),++S,S>=d&&(x.isClosed=!0,x.parentElement.removeChild(x.surface),h())})})},w.prototype.getCapabilities=function(){return new Oi(this.getFirstTrackOrFail())},w}(),Di=function(){function w(x){this.mediaStream=x}return w.prototype.render=function(x,h,m){return On(this,void 0,void 0,function(){return Rn(this,function(p){return[2,Ri.create(x,this.mediaStream,h,m)]})})},w.create=function(x){return On(this,void 0,void 0,function(){var h,m;return Rn(this,function(p){switch(p.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return h={audio:!1,video:x},[4,navigator.mediaDevices.getUserMedia(h)];case 1:return m=p.sent(),[2,new w(m)]}})})},w}(),Dr=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},Mr=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Mi=function(){function w(){}return w.failIfNotSupported=function(){return Dr(this,void 0,void 0,function(){return Mr(this,function(x){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new w]})})},w.prototype.create=function(x){return Dr(this,void 0,void 0,function(){return Mr(this,function(h){return[2,Di.create(x)]})})},w}(),Bi=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},vi=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Pi=function(){function w(){}return w.retrieve=function(){if(navigator.mediaDevices)return w.getCamerasFromMediaDevices();var x=MediaStreamTrack;return MediaStreamTrack&&x.getSources?w.getCamerasFromMediaStreamTrack():w.rejectWithError()},w.rejectWithError=function(){var x=Qt.unableToQuerySupportedDevices();return w.isHttpsOrLocalhost()||(x=Qt.insecureContextCameraQueryError()),Promise.reject(x)},w.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var x=location.host.split(":")[0];return x==="127.0.0.1"||x==="localhost"},w.getCamerasFromMediaDevices=function(){return Bi(this,void 0,void 0,function(){var x,h,m,p,d,S,B;return vi(this,function(M){switch(M.label){case 0:return x=function(A){for(var R=A.getVideoTracks(),O=0,ie=R;O<ie.length;O++){var $=ie[O];$.enabled=!1,$.stop(),A.removeTrack($)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return h=M.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(m=M.sent(),p=[],d=0,S=m;d<S.length;d++)B=S[d],B.kind==="videoinput"&&p.push({id:B.deviceId,label:B.label});return x(h),[2,p]}})})},w.getCamerasFromMediaStreamTrack=function(){return new Promise(function(x,h){var m=function(d){for(var S=[],B=0,M=d;B<M.length;B++){var A=M[B];A.kind==="video"&&S.push({id:A.id,label:A.label})}x(S)},p=MediaStreamTrack;p.getSources(m)})},w}(),Oe;(function(w){w[w.UNKNOWN=0]="UNKNOWN",w[w.NOT_STARTED=1]="NOT_STARTED",w[w.SCANNING=2]="SCANNING",w[w.PAUSED=3]="PAUSED"})(Oe||(Oe={}));var Li=function(){function w(){this.state=Oe.NOT_STARTED,this.onGoingTransactionNewState=Oe.UNKNOWN}return w.prototype.directTransition=function(x){this.failIfTransitionOngoing(),this.validateTransition(x),this.state=x},w.prototype.startTransition=function(x){return this.failIfTransitionOngoing(),this.validateTransition(x),this.onGoingTransactionNewState=x,this},w.prototype.execute=function(){if(this.onGoingTransactionNewState===Oe.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var x=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Oe.UNKNOWN,this.directTransition(x)},w.prototype.cancel=function(){if(this.onGoingTransactionNewState===Oe.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Oe.UNKNOWN},w.prototype.getState=function(){return this.state},w.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Oe.UNKNOWN)throw"Cannot transition to a new state, already under transition"},w.prototype.validateTransition=function(x){switch(this.state){case Oe.UNKNOWN:throw"Transition from unknown is not allowed";case Oe.NOT_STARTED:this.failIfNewStateIs(x,[Oe.PAUSED]);break;case Oe.SCANNING:break;case Oe.PAUSED:break}},w.prototype.failIfNewStateIs=function(x,h){for(var m=0,p=h;m<p.length;m++){var d=p[m];if(x===d)throw"Cannot transition from ".concat(this.state," to ").concat(x)}},w}(),Fi=function(){function w(x){this.stateManager=x}return w.prototype.startTransition=function(x){return this.stateManager.startTransition(x)},w.prototype.directTransition=function(x){this.stateManager.directTransition(x)},w.prototype.getState=function(){return this.stateManager.getState()},w.prototype.canScanFile=function(){return this.stateManager.getState()===Oe.NOT_STARTED},w.prototype.isScanning=function(){return this.stateManager.getState()!==Oe.NOT_STARTED},w.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Oe.SCANNING},w.prototype.isPaused=function(){return this.stateManager.getState()===Oe.PAUSED},w}(),ki=function(){function w(){}return w.create=function(){return new Fi(new Li)},w}(),Ui=function(){var w=function(x,h){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(m[d]=p[d])},w(x,h)};return function(x,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");w(x,h);function m(){this.constructor=x}x.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}}(),ft=function(w){Ui(x,w);function x(){return w!==null&&w.apply(this,arguments)||this}return x.DEFAULT_WIDTH=300,x.DEFAULT_WIDTH_OFFSET=2,x.FILE_SCAN_MIN_HEIGHT=300,x.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,x.MIN_QR_BOX_SIZE=50,x.SHADED_LEFT=1,x.SHADED_RIGHT=2,x.SHADED_TOP=3,x.SHADED_BOTTOM=4,x.SHADED_REGION_ELEMENT_ID="qr-shaded-region",x.VERBOSE=!1,x.BORDER_SHADER_DEFAULT_COLOR="#ffffff",x.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",x}(Ci),Vi=function(){function w(x,h){this.logger=h,this.fps=ft.SCAN_DEFAULT_FPS,x?(x.fps&&(this.fps=x.fps),this.disableFlip=x.disableFlip===!0,this.qrbox=x.qrbox,this.aspectRatio=x.aspectRatio,this.videoConstraints=x.videoConstraints):this.disableFlip=ft.DEFAULT_DISABLE_FLIP}return w.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Sr.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},w.prototype.isShadedBoxEnabled=function(){return!Ot(this.qrbox)},w.create=function(x,h){return new w(x,h)},w}(),Br=function(){function w(x,h){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(x))throw"HTML Element with id=".concat(x," not found");this.elementId=x,this.verbose=!1;var m;typeof h=="boolean"?this.verbose=h===!0:h&&(m=h,this.verbose=m.verbose===!0,m.experimentalFeatures),this.logger=new mi(this.verbose),this.qrcode=new Si(this.getSupportedFormats(h),this.getUseBarCodeDetectorIfSupported(m),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=ki.create()}return w.prototype.start=function(x,h,m,p){var d=this;if(!x)throw"cameraIdOrConfig is required";if(!m||typeof m!="function")throw"qrCodeSuccessCallback is required and should be a function.";var S;p?S=p:S=this.verbose?this.logger.log:function(){};var B=Vi.create(h,this.logger);this.clearElement();var M=!1;B.videoConstraints&&(B.isMediaStreamConstraintsValid()?M=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var A=M,R=document.getElementById(this.elementId);R.clientWidth?R.clientWidth:ft.DEFAULT_WIDTH,R.style.position="relative",this.shouldScan=!0,this.element=R;var O=this,ie=this.stateManagerProxy.startTransition(Oe.SCANNING);return new Promise(function($,Ne){var ee=A?B.videoConstraints:O.createVideoConstraints(x);if(!ee){ie.cancel(),Ne("videoConstraints should be defined");return}var $e={};(!A||B.aspectRatio)&&($e.aspectRatio=B.aspectRatio);var xt={onRenderSurfaceReady:function(Ae,Z){O.setupUi(Ae,Z,B),O.isScanning=!0,O.foreverScan(B,m,S)}};Mi.failIfNotSupported().then(function(Ae){Ae.create(ee).then(function(Z){return Z.render(d.element,$e,xt).then(function(le){O.renderedCamera=le,ie.execute(),$(null)}).catch(function(le){ie.cancel(),Ne(le)})}).catch(function(Z){ie.cancel(),Ne(Qt.errorGettingUserMedia(Z))})}).catch(function(Ae){ie.cancel(),Ne(Qt.cameraStreamingNotSupported())})})},w.prototype.pause=function(x){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Oe.PAUSED),this.showPausedState(),(Ot(x)||x!==!0)&&(x=!1),x&&this.renderedCamera&&this.renderedCamera.pause()},w.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var x=this,h=function(){x.stateManagerProxy.directTransition(Oe.SCANNING),x.hidePausedState()};if(!this.renderedCamera.isPaused()){h();return}this.renderedCamera.resume(function(){h()})},w.prototype.getState=function(){return this.stateManagerProxy.getState()},w.prototype.stop=function(){var x=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var h=this.stateManagerProxy.startTransition(Oe.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var m=function(){if(x.element){var d=document.getElementById(ft.SHADED_REGION_ELEMENT_ID);d&&x.element.removeChild(d)}},p=this;return this.renderedCamera.close().then(function(){return p.renderedCamera=null,p.element&&(p.element.removeChild(p.canvasElement),p.canvasElement=null),m(),p.qrRegion&&(p.qrRegion=null),p.context&&(p.context=null),h.execute(),p.hidePausedState(),p.isScanning=!1,Promise.resolve()})},w.prototype.scanFile=function(x,h){return this.scanFileV2(x,h).then(function(m){return m.decodedText})},w.prototype.scanFileV2=function(x,h){var m=this;if(!x||!(x instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Ot(h)&&(h=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(p,d){m.possiblyCloseLastScanImageFile(),m.clearElement(),m.lastScanImageFile=URL.createObjectURL(x);var S=new Image;S.onload=function(){var B=S.width,M=S.height,A=document.getElementById(m.elementId),R=A.clientWidth?A.clientWidth:ft.DEFAULT_WIDTH,O=Math.max(A.clientHeight?A.clientHeight:M,ft.FILE_SCAN_MIN_HEIGHT),ie=m.computeCanvasDrawConfig(B,M,R,O);if(h){var $=m.createCanvasElement(R,O,"qr-canvas-visible");$.style.display="inline-block",A.appendChild($);var Ne=$.getContext("2d");if(!Ne)throw"Unable to get 2d context from canvas";Ne.canvas.width=R,Ne.canvas.height=O,Ne.drawImage(S,0,0,B,M,ie.x,ie.y,ie.width,ie.height)}var ee=ft.FILE_SCAN_HIDDEN_CANVAS_PADDING,$e=Math.max(S.width,ie.width),xt=Math.max(S.height,ie.height),Ae=$e+2*ee,Z=xt+2*ee,le=m.createCanvasElement(Ae,Z);A.appendChild(le);var Mt=le.getContext("2d");if(!Mt)throw"Unable to get 2d context from canvas";Mt.canvas.width=Ae,Mt.canvas.height=Z,Mt.drawImage(S,0,0,B,M,ee,ee,$e,xt);try{m.qrcode.decodeRobustlyAsync(le).then(function(Ce){p(yr.createFromQrcodeResult(Ce))}).catch(d)}catch(Ce){d("QR code parse error, error = ".concat(Ce))}},S.onerror=d,S.onabort=d,S.onstalled=d,S.onsuspend=d,S.src=URL.createObjectURL(x)})},w.prototype.clear=function(){this.clearElement()},w.getCameras=function(){return Pi.retrieve()},w.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},w.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},w.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},w.prototype.applyVideoConstraints=function(x){if(x){if(!Sr.isMediaStreamConstraintsValid(x,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(x)},w.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},w.prototype.getSupportedFormats=function(x){var h=[G.QR_CODE,G.AZTEC,G.CODABAR,G.CODE_39,G.CODE_93,G.CODE_128,G.DATA_MATRIX,G.MAXICODE,G.ITF,G.EAN_13,G.EAN_8,G.PDF_417,G.RSS_14,G.RSS_EXPANDED,G.UPC_A,G.UPC_E,G.UPC_EAN_EXTENSION];if(!x||typeof x=="boolean"||!x.formatsToSupport)return h;if(!Array.isArray(x.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(x.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var m=[],p=0,d=x.formatsToSupport;p<d.length;p++){var S=d[p];Ai(S)?m.push(S):this.logger.warn("Invalid format: ".concat(S," passed in config, ignoring."))}if(m.length===0)throw"None of formatsToSupport match supported values.";return m},w.prototype.getUseBarCodeDetectorIfSupported=function(x){if(Ot(x))return!0;if(!Ot(x.useBarCodeDetectorIfSupported))return x.useBarCodeDetectorIfSupported!==!1;if(Ot(x.experimentalFeatures))return!0;var h=x.experimentalFeatures;return Ot(h.useBarCodeDetectorIfSupported)?!0:h.useBarCodeDetectorIfSupported!==!1},w.prototype.validateQrboxSize=function(x,h,m){var p=this,d=m.qrbox;this.validateQrboxConfig(d);var S=this.toQrdimensions(x,h,d),B=function(A){if(A<ft.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(ft.MIN_QR_BOX_SIZE,"px.")},M=function(A){return A>x&&(p.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."),A=x),A};B(S.width),B(S.height),S.width=M(S.width)},w.prototype.validateQrboxConfig=function(x){if(typeof x!="number"&&typeof x!="function"&&(x.width===void 0||x.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},w.prototype.toQrdimensions=function(x,h,m){if(typeof m=="number")return{width:m,height:m};if(typeof m=="function")try{return m(x,h)}catch(p){throw new Error("qrbox config was passed as a function but it failed with unknown error"+p)}return m},w.prototype.setupUi=function(x,h,m){m.isShadedBoxEnabled()&&this.validateQrboxSize(x,h,m);var p=Ot(m.qrbox)?{width:x,height:h}:m.qrbox;this.validateQrboxConfig(p);var d=this.toQrdimensions(x,h,p);d.height>h&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var S=m.isShadedBoxEnabled()&&d.height<=h,B={x:0,y:0,width:x,height:h},M=S?this.getShadedRegionBounds(x,h,d):B,A=this.createCanvasElement(M.width,M.height),R={willReadFrequently:!0},O=A.getContext("2d",R);O.canvas.width=M.width,O.canvas.height=M.height,this.element.append(A),S&&this.possiblyInsertShadingElement(this.element,x,h,d),this.createScannerPausedUiElement(this.element),this.qrRegion=M,this.context=O,this.canvasElement=A},w.prototype.createScannerPausedUiElement=function(x){var h=document.createElement("div");h.innerText=Qt.scannerPaused(),h.style.display="none",h.style.position="absolute",h.style.top="0px",h.style.zIndex="1",h.style.background="rgba(9, 9, 9, 0.46)",h.style.color="#FFECEC",h.style.textAlign="center",h.style.width="100%",x.appendChild(h),this.scannerPausedUiElement=h},w.prototype.scanContext=function(x,h){var m=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(p){return x(p.text,yr.createFromQrcodeResult(p)),m.possiblyUpdateShaders(!0),!0}).catch(function(p){m.possiblyUpdateShaders(!1);var d=Qt.codeParseError(p);return h(d,Ei.createFrom(d)),!1})},w.prototype.foreverScan=function(x,h,m){var p=this;if(this.shouldScan&&this.renderedCamera){var d=this.renderedCamera.getSurface(),S=d.videoWidth/d.clientWidth,B=d.videoHeight/d.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var M=this.qrRegion.width*S,A=this.qrRegion.height*B,R=this.qrRegion.x*S,O=this.qrRegion.y*B;this.context.drawImage(d,R,O,M,A,0,0,this.qrRegion.width,this.qrRegion.height);var ie=function(){p.foreverScanTimeout=setTimeout(function(){p.foreverScan(x,h,m)},p.getTimeoutFps(x.fps))};this.scanContext(h,m).then(function($){!$&&x.disableFlip!==!0?(p.context.translate(p.context.canvas.width,0),p.context.scale(-1,1),p.scanContext(h,m).finally(function(){ie()})):ie()}).catch(function($){p.logger.logError("Error happend while scanning context",$),ie()})}},w.prototype.createVideoConstraints=function(x){if(typeof x=="string")return{deviceId:{exact:x}};if(typeof x=="object"){var h="facingMode",m="deviceId",p={user:!0,environment:!0},d="exact",S=function(Ne){if(Ne in p)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(Ne,"'")},B=Object.keys(x);if(B.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(B.length," keys");var M=Object.keys(x)[0];if(M!==h&&M!==m)throw"Only '".concat(h,"' and '").concat(m,"' ")+" are supported for 'cameraIdOrConfig'";if(M===h){var A=x.facingMode;if(typeof A=="string"){if(S(A))return{facingMode:A}}else if(typeof A=="object")if(d in A){if(S(A["".concat(d)]))return{facingMode:{exact:A["".concat(d)]}}}else throw"'facingMode' should be string or object with"+" ".concat(d," as key.");else{var R=typeof A;throw"Invalid type of 'facingMode' = ".concat(R)}}else{var O=x.deviceId;if(typeof O=="string")return{deviceId:O};if(typeof O=="object"){if(d in O)return{deviceId:{exact:O["".concat(d)]}};throw"'deviceId' should be string or object with"+" ".concat(d," as key.")}else{var ie=typeof O;throw"Invalid type of 'deviceId' = ".concat(ie)}}}var $=typeof x;throw"Invalid type of 'cameraIdOrConfig' = ".concat($)},w.prototype.computeCanvasDrawConfig=function(x,h,m,p){if(x<=m&&h<=p){var d=(m-x)/2,S=(p-h)/2;return{x:d,y:S,width:x,height:h}}else{var B=x,M=h;return x>m&&(h=m/x*h,x=m),h>p&&(x=p/h*x,h=p),this.logger.log("Image downsampled from "+"".concat(B,"X").concat(M)+" to ".concat(x,"X").concat(h,".")),this.computeCanvasDrawConfig(x,h,m,p)}},w.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var x=document.getElementById(this.elementId);x&&(x.innerHTML="")},w.prototype.possiblyUpdateShaders=function(x){this.qrMatch!==x&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(h){h.style.backgroundColor=x?ft.BORDER_SHADER_MATCH_COLOR:ft.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=x)},w.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},w.prototype.createCanvasElement=function(x,h,m){var p=x,d=h,S=document.createElement("canvas");return S.style.width="".concat(p,"px"),S.style.height="".concat(d,"px"),S.style.display="none",S.id=Ot(m)?"qr-canvas":m,S},w.prototype.getShadedRegionBounds=function(x,h,m){if(m.width>x||m.height>h)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(x-m.width)/2,y:(h-m.height)/2,width:m.width,height:m.height}},w.prototype.possiblyInsertShadingElement=function(x,h,m,p){if(!(h-p.width<1||m-p.height<1)){var d=document.createElement("div");d.style.position="absolute";var S=(h-p.width)/2,B=(m-p.height)/2;if(d.style.borderLeft="".concat(S,"px solid rgba(0, 0, 0, 0.48)"),d.style.borderRight="".concat(S,"px solid rgba(0, 0, 0, 0.48)"),d.style.borderTop="".concat(B,"px solid rgba(0, 0, 0, 0.48)"),d.style.borderBottom="".concat(B,"px solid rgba(0, 0, 0, 0.48)"),d.style.boxSizing="border-box",d.style.top="0px",d.style.bottom="0px",d.style.left="0px",d.style.right="0px",d.id="".concat(ft.SHADED_REGION_ELEMENT_ID),h-p.width<11||m-p.height<11)this.hasBorderShaders=!1;else{var M=5,A=40;this.insertShaderBorders(d,A,M,-M,null,0,!0),this.insertShaderBorders(d,A,M,-M,null,0,!1),this.insertShaderBorders(d,A,M,null,-M,0,!0),this.insertShaderBorders(d,A,M,null,-M,0,!1),this.insertShaderBorders(d,M,A+M,-M,null,-M,!0),this.insertShaderBorders(d,M,A+M,null,-M,-M,!0),this.insertShaderBorders(d,M,A+M,-M,null,-M,!1),this.insertShaderBorders(d,M,A+M,null,-M,-M,!1),this.hasBorderShaders=!0}x.append(d)}},w.prototype.insertShaderBorders=function(x,h,m,p,d,S,B){var M=document.createElement("div");M.style.position="absolute",M.style.backgroundColor=ft.BORDER_SHADER_DEFAULT_COLOR,M.style.width="".concat(h,"px"),M.style.height="".concat(m,"px"),p!==null&&(M.style.top="".concat(p,"px")),d!==null&&(M.style.bottom="".concat(d,"px")),B?M.style.left="".concat(S,"px"):M.style.right="".concat(S,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(M),x.appendChild(M)},w.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},w.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},w.prototype.getTimeoutFps=function(x){return 1e3/x},w}(),vr;(function(w){w[w.STATUS_DEFAULT=0]="STATUS_DEFAULT",w[w.STATUS_SUCCESS=1]="STATUS_SUCCESS",w[w.STATUS_WARNING=2]="STATUS_WARNING",w[w.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(vr||(vr={}));function Gi({style:w={}}){const x={position:"absolute",backgroundColor:"rgb(255, 255, 255)"};return H.jsxs("div",{id:"qr-scan-box",style:it({boxSizing:"border-box",inset:"0px"},w),children:[H.jsx("div",{style:it({width:"40px",height:"5px",top:"-5px",left:"0px"},x)}),H.jsx("div",{style:it({width:"40px",height:"5px",top:"-5px",right:"0px"},x)}),H.jsx("div",{style:it({width:"40px",height:"5px",bottom:"-5px",left:"0px"},x)}),H.jsx("div",{style:it({width:"40px",height:"5px",bottom:"-5px",right:"0px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",top:"-5px",left:"-5px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",bottom:"-5px",left:"-5px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",top:"-5px",right:"-5px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",bottom:"-5px",right:"-5px"},x)})]})}function Wi({onScannerSizeChanged:w,elementId:x}){const[h,m]=De.useState(),p=ai.useNavigate(),{t:d}=Dt.useTranslation("block-workbench"),S=De.useMemo(()=>{const R=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),O=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);return{width:R,height:O}},[]),B=De.useCallback(R=>jt(this,null,function*(){return R.start({facingMode:"environment"},{fps:10,qrbox(O,ie){return w({width:O,height:ie}),{width:S.width,height:S.height}}},O=>{p(O)},void 0)}),[p,w,S]),M=De.useCallback(R=>jt(this,null,function*(){const O=R.getState();if([Oe.SCANNING,Oe.PAUSED].includes(O))return R.stop()}),[]),A=De.useCallback(R=>jt(this,null,function*(){yield M(h);try{const{decodedText:O}=yield h.scanFileV2(R,!1);p(O)}catch(O){alert(d("QR code recognition failed, please scan again")),B(h)}}),[h,M,B,d,p]);return De.useEffect(()=>{const R=new Br(x);return m(R),B(R),()=>{M(R)}},[x,B,M]),{startScanCamera:B,startScanFile:A}}const Pr="qrcode",Hi=w=>{const x=De.useRef(),h=De.useRef(),{t:m}=Dt.useTranslation("block-workbench"),[p,d]=De.useState({width:0,height:0}),S=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),B=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),{startScanFile:M}=Wi({onScannerSizeChanged:d,elementId:Pr}),A=()=>{const Ne=Math.floor(Math.min(S,B)*.6);return{left:`${(S-Ne)/2}px`,top:`${(B-Ne)/2}px`,position:"fixed",width:`${Ne}px`,height:`${Ne}px`}},R=()=>{h.current&&h.current.click()},O=Ne=>{const ee=Ne.target.files;if(ee.length>0){const $e=ee[0];$e.size<1e6?M($e):alert(m("The image size is too large. Please compress it to below 1MB before uploading"))}};De.useEffect(()=>(document.documentElement.style.overscrollBehavior="none",()=>{document.documentElement.style.overscrollBehavior="default"}),[]),De.useEffect(()=>{const{width:Ne,height:ee}=p,$e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),xt=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);if(Ne>0&&ee>0&&ee<xt){const Ae=xt/ee,Z=Math.floor(Ae*Ne),le=document.getElementsByTagName("video")[0];le.style.height=`${xt}px`,le.style.width=`${Z}px`,x.current.style.left=`${($e-Z)/2}px`,x.current.style.position="absolute"}},[p]);const ie=()=>H.jsx("div",{style:{position:"absolute",bottom:"20px",left:"20px",padding:"10px 60px"},children:H.jsxs("div",{style:{color:"white",width:"40px",display:"flex",flexDirection:"column",alignItems:"center"},children:[H.jsx(qt.FileImageOutlined,{style:$,onClick:R}),m("Album"),H.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:O,style:{visibility:"hidden"}})]})}),$={zIndex:"1003",fontSize:"1.8em",fontWeight:"bold"};return H.jsxs(H.Fragment,{children:[H.jsx("div",{ref:x,id:Pr,style:{position:"absolute"}}),H.jsx(Gi,{style:it({},A())}),H.jsx(ie,{})]})},Xi=w=>{const{visible:x,setVisible:h}=q.useActionContext(),[m,p]=De.useState(!1),{t:d}=Dt.useTranslation("block-workbench");De.useEffect(()=>{x&&!m&&jt(this,null,function*(){try{(yield Br.getCameras()).length===0?alert(d("No camera device detected")):p(!0)}catch(R){const O={NotFoundError:d("No camera device detected"),NotAllowedError:d("You have not granted permission to use the camera")};console.log(R);const ie=O[R.name];alert(ie!=null?ie:R),p(!1),h(!1)}})},[x,m,h,d]);const S={position:"fixed",width:"100%",height:"100%",background:"black",zIndex:"1001",top:0,left:0,overflow:"hidden"},B={position:"absolute",top:"22px",left:"20px",zIndex:"1003",color:"white",fontSize:"1.8em",fontWeight:"bold"},M={position:"absolute",color:"white",fontSize:"1.5em",left:0,right:0,top:"20px",zIndex:"1002",marginLeft:"auto",marginRight:"auto",textAlign:"center"};return x&&m?H.jsxs("div",{style:S,children:[H.jsx(Hi,{}),H.jsx(qt.LeftOutlined,{style:B,onClick:()=>h(!1)}),H.jsx("div",{style:M,children:d("Scan QR code")})]}):null},zi={type:"void","x-decorator":"CardItem","x-settings":"blockSettings:workbench","x-schema-toolbar":"BlockSchemaToolbar","x-component":"WorkbenchBlock",properties:{actions:{"x-component":"WorkbenchBlock.ActionBar","x-initializer":"workbench:configureActions"}}},Jt={type:"item",name:"workbenchBlock",icon:"FileImageOutlined",useComponentProps(){const{t:w}=Dt.useTranslation("@nocobase/plugin-block-workbench"),{insert:x}=q.useSchemaInitializer();return{title:w("Workbench"),onClick:()=>{x(zi)}}}},Yi=new q.SchemaSettings({name:"blockSettings:workbench",items:[{type:"remove",name:"remove"}]}),Zi=new q.SchemaInitializer({name:"workbench:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:xi}]});class Lr extends q.Plugin{load(){return jt(this,null,function*(){this.app.addComponents({WorkbenchBlock:Er,QRCodeScanner:Xi}),this.app.schemaSettingsManager.add(Yi),this.app.schemaInitializerManager.add(Zi),this.app.schemaInitializerManager.addItem("page:addBlock",`otherBlocks.${Jt.name}`,Jt),this.app.schemaInitializerManager.addItem("mobilePage:addBlock",`otherBlocks.${Jt.name}`,Jt),this.app.schemaInitializerManager.addItem("mobile:addBlock",`otherBlocks.${Jt.name}`,Jt),this.app.schemaSettingsManager.add(di),this.app.schemaSettingsManager.add(gi),this.app.schemaInitializerManager.addItem("workbench:configureActions","qrcode",{Component:wi})})}}oe.PluginBlockWorkbenchClient=Lr,oe.default=Lr,Object.defineProperties(oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
36
+ `);let n=ti.singletonList(_t.INITIAL_STATE);for(let i=0;i<this.text.length;i++){let s,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case J.getCharCode("\r"):s=o===t?2:0;break;case J.getCharCode("."):s=o===e?3:0;break;case J.getCharCode(","):s=o===e?4:0;break;case J.getCharCode(":"):s=o===e?5:0;break;default:s=0}s>0?(n=Tn.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}return ti.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Tn.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,i=Ar[e.getMode()][r]>0,s=null;for(let o=0;o<=Nt;o++){let a=Ar[o][r];if(a>0){if(s==null&&(s=e.endBinaryShift(t)),!i||o===e.getMode()||o===Ct){const l=s.latchAndAppend(o,a);n.push(l)}if(!i&&ri[e.getMode()][o]>=0){const l=s.shiftAndAppend(o,a);n.push(l)}}}if(e.getBinaryShiftByteCount()>0||Ar[e.getMode()][r]===0){let o=e.addBinaryShiftChar(t);n.push(o)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(Nt,n)),e.getMode()!==Nt&&r.push(i.shiftAndAppend(Nt,n)),n===3||n===4){let s=i.latchAndAppend(Ct,16-n).latchAndAppend(Ct,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class ue{constructor(){}static encodeBytes(e){return ue.encode(e,ue.DEFAULT_EC_PERCENT,ue.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Tn(e).encode(),i=Z.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,o,a,l,c,f;if(n!==ue.DEFAULT_AZTEC_LAYERS){if(o=n<0,a=Math.abs(n),a>(o?ue.MAX_NB_BITS_COMPACT:ue.MAX_NB_BITS))throw new O(J.format("Illegal value %s for layers",n));l=ue.totalBitsInLayer(a,o),c=ue.WORD_SIZE[a];let P=l-l%c;if(f=ue.stuffBits(r,c),f.getSize()+i>P)throw new O("Data to large for user specified layer");if(o&&f.getSize()>c*64)throw new O("Data to large for user specified layer")}else{c=0,f=null;for(let P=0;;P++){if(P>ue.MAX_NB_BITS)throw new O("Data too large for an Aztec code");if(o=P<=3,a=o?P+1:P,l=ue.totalBitsInLayer(a,o),s>l)continue;(f==null||c!==ue.WORD_SIZE[a])&&(c=ue.WORD_SIZE[a],f=ue.stuffBits(r,c));let ae=l-l%c;if(!(o&&f.getSize()>c*64)&&f.getSize()+i<=ae)break}}let g=ue.generateCheckWords(f,l,c),E=f.getSize()/c,I=ue.generateModeMessage(o,a,E),b=(o?11:14)+a*4,y=new Int32Array(b),_;if(o){_=b;for(let P=0;P<y.length;P++)y[P]=P}else{_=b+1+2*Z.truncDivision(Z.truncDivision(b,2)-1,15);let P=Z.truncDivision(b,2),ae=Z.truncDivision(_,2);for(let te=0;te<P;te++){let ht=te+Z.truncDivision(te,15);y[P-te-1]=ae-ht-1,y[P+te]=ae+ht+1}}let L=new We(_);for(let P=0,ae=0;P<a;P++){let te=(a-P)*4+(o?9:12);for(let ht=0;ht<te;ht++){let pt=ht*2;for(let ut=0;ut<2;ut++)g.get(ae+pt+ut)&&L.set(y[P*2+ut],y[P*2+ht]),g.get(ae+te*2+pt+ut)&&L.set(y[P*2+ht],y[b-1-P*2-ut]),g.get(ae+te*4+pt+ut)&&L.set(y[b-1-P*2-ut],y[b-1-P*2-ht]),g.get(ae+te*6+pt+ut)&&L.set(y[b-1-P*2-ht],y[P*2+ut])}ae+=te*8}if(ue.drawModeMessage(L,o,_,I),o)ue.drawBullsEye(L,Z.truncDivision(_,2),5);else{ue.drawBullsEye(L,Z.truncDivision(_,2),7);for(let P=0,ae=0;P<Z.truncDivision(b,2)-1;P+=15,ae+=16)for(let te=Z.truncDivision(_,2)&1;te<_;te+=2)L.set(Z.truncDivision(_,2)-ae,te),L.set(Z.truncDivision(_,2)+ae,te),L.set(te,Z.truncDivision(_,2)-ae),L.set(te,Z.truncDivision(_,2)+ae)}let F=new ei;return F.setCompact(o),F.setSize(_),F.setLayers(a),F.setCodeWords(E),F.setMatrix(L),F}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let i=t-r;i<=t+r;i++)e.set(i,t-r),e.set(i,t+r),e.set(t-r,i),e.set(t+r,i);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let r=new le;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=ue.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=ue.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=Z.truncDivision(n,2);if(t)for(let s=0;s<7;s++){let o=i-3+s;r.get(s)&&e.set(o,i-5),r.get(s+7)&&e.set(i+5,o),r.get(20-s)&&e.set(o,i+5),r.get(27-s)&&e.set(i-5,o)}else for(let s=0;s<10;s++){let o=i-5+s+Z.truncDivision(s,5);r.get(s)&&e.set(o,i-7),r.get(s+10)&&e.set(i+7,o),r.get(29-s)&&e.set(o,i+7),r.get(39-s)&&e.set(i-7,o)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new fr(ue.getGF(n)),s=Z.truncDivision(t,n),o=ue.bitsToWords(e,n,s);i.encode(o,s-r);let a=t%n,l=new le;l.appendBits(0,a);for(const c of Array.from(o))l.appendBits(c,n);return l}static bitsToWords(e,t,n){let r=new Int32Array(n),i,s;for(i=0,s=e.getSize()/t;i<s;i++){let o=0;for(let a=0;a<t;a++)o|=e.get(i*t+a)?1<<t-a-1:0;r[i]=o}return r}static getGF(e){switch(e){case 4:return fe.AZTEC_PARAM;case 6:return fe.AZTEC_DATA_6;case 8:return fe.AZTEC_DATA_8;case 10:return fe.AZTEC_DATA_10;case 12:return fe.AZTEC_DATA_12;default:throw new O("Unsupported word size "+e)}}static stuffBits(e,t){let n=new le,r=e.getSize(),i=(1<<t)-2;for(let s=0;s<r;s+=t){let o=0;for(let a=0;a<t;a++)(s+a>=r||e.get(s+a))&&(o|=1<<t-1-a);(o&i)===i?(n.appendBits(o&i,t),s--):o&i?n.appendBits(o,t):(n.appendBits(o|1,t),s--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ue.DEFAULT_EC_PERCENT=33,ue.DEFAULT_AZTEC_LAYERS=0,ue.MAX_NB_BITS=32,ue.MAX_NB_BITS_COMPACT=4,ue.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Hn{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let s=xr.ISO_8859_1,o=ue.DEFAULT_EC_PERCENT,a=ue.DEFAULT_AZTEC_LAYERS;return i!=null&&(i.has(Ve.CHARACTER_SET)&&(s=$r.forName(i.get(Ve.CHARACTER_SET).toString())),i.has(Ve.ERROR_CORRECTION)&&(o=Z.parseInt(i.get(Ve.ERROR_CORRECTION).toString())),i.has(Ve.AZTEC_LAYERS)&&(a=Z.parseInt(i.get(Ve.AZTEC_LAYERS).toString()))),Hn.encodeLayers(e,t,n,r,s,o,a)}static encodeLayers(e,t,n,r,i,s,o){if(t!==K.AZTEC)throw new O("Can only encode AZTEC, but got "+t);let a=ue.encode(J.getBytes(e,i),s,o);return Hn.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new It;let i=r.getWidth(),s=r.getHeight(),o=Math.max(t,i),a=Math.max(n,s),l=Math.min(o/i,a/s),c=(o-i*l)/2,f=(a-s*l)/2,g=new We(o,a);for(let E=0,I=f;E<s;E++,I+=l)for(let b=0,y=c;b<i;b++,y+=l)r.get(b,E)&&g.setRegion(y,I,l,l);return g}}h.AbstractExpandedDecoder=nr,h.ArgumentException=R,h.ArithmeticException=Dn,h.AztecCode=ei,h.AztecCodeReader=vn,h.AztecCodeWriter=Hn,h.AztecDecoder=ye,h.AztecDetector=Vr,h.AztecDetectorResult=kr,h.AztecEncoder=ue,h.AztecHighLevelEncoder=Tn,h.AztecPoint=nt,h.BarcodeFormat=K,h.Binarizer=Ne,h.BinaryBitmap=ie,h.BitArray=le,h.BitMatrix=We,h.BitSource=or,h.BrowserAztecCodeReader=Ki,h.BrowserBarcodeReader=$i,h.BrowserCodeReader=Wt,h.BrowserDatamatrixCodeReader=ts,h.BrowserMultiFormatReader=fs,h.BrowserPDF417Reader=ds,h.BrowserQRCodeReader=xs,h.BrowserQRCodeSvgWriter=Kt,h.CharacterSetECI=k,h.ChecksumException=$,h.Code128Reader=V,h.Code39Reader=ke,h.DataMatrixDecodedBitStreamParser=Ft,h.DataMatrixReader=kt,h.DecodeHintType=Ce,h.DecoderResult=gn,h.DefaultGridSampler=Ur,h.DetectorResult=Bn,h.EAN13Reader=Ht,h.EncodeHintType=Ve,h.Exception=A,h.FormatException=U,h.GenericGF=fe,h.GenericGFPoly=ot,h.GlobalHistogramBinarizer=He,h.GridSampler=Jn,h.GridSamplerInstance=Pt,h.HTMLCanvasElementLuminanceSource=vt,h.HybridBinarizer=ne,h.ITFReader=pe,h.IllegalArgumentException=O,h.IllegalStateException=It,h.InvertedLuminanceSource=Bt,h.LuminanceSource=xn,h.MathUtils=he,h.MultiFormatOneDReader=sn,h.MultiFormatReader=Jr,h.MultiFormatWriter=ws,h.NotFoundException=D,h.OneDReader=Fe,h.PDF417DecodedBitStreamParser=N,h.PDF417DecoderErrorCorrection=Yr,h.PDF417Reader=je,h.PDF417ResultMetadata=Kr,h.PerspectiveTransform=Et,h.PlanarYUVLuminanceSource=Tt,h.QRCodeByteMatrix=Gn,h.QRCodeDataMask=wt,h.QRCodeDecodedBitStreamParser=Me,h.QRCodeDecoderErrorCorrectionLevel=Se,h.QRCodeDecoderFormatInformation=Je,h.QRCodeEncoder=_e,h.QRCodeEncoderQRCode=Zt,h.QRCodeMaskUtil=Pe,h.QRCodeMatrixUtil=j,h.QRCodeMode=Y,h.QRCodeReader=Ut,h.QRCodeVersion=z,h.QRCodeWriter=an,h.RGBLuminanceSource=dr,h.RSS14Reader=ve,h.RSSExpandedReader=v,h.ReaderException=Vn,h.ReedSolomonDecoder=An,h.ReedSolomonEncoder=fr,h.ReedSolomonException=en,h.Result=tt,h.ResultMetadataType=Xe,h.ResultPoint=X,h.StringUtils=J,h.UnsupportedOperationException=$t,h.VideoInputDevice=Fr,h.WhiteRectangleDetector=Rt,h.WriterException=Ie,h.ZXingArrays=Ae,h.ZXingCharset=$r,h.ZXingInteger=Z,h.ZXingStandardCharsets=xr,h.ZXingStringBuilder=Ee,h.ZXingStringEncoding=st,h.ZXingSystem=ee,h.createAbstractExpandedDecoder=Xr,Object.defineProperty(h,"__esModule",{value:!0})})})(Kn,Kn.exports);var Te=Kn.exports;const Ii=li({__proto__:null,default:pi(Te)},[Te]);var Tr=function(){function w(x,h,m){if(this.formatMap=new Map([[G.QR_CODE,Te.BarcodeFormat.QR_CODE],[G.AZTEC,Te.BarcodeFormat.AZTEC],[G.CODABAR,Te.BarcodeFormat.CODABAR],[G.CODE_39,Te.BarcodeFormat.CODE_39],[G.CODE_93,Te.BarcodeFormat.CODE_93],[G.CODE_128,Te.BarcodeFormat.CODE_128],[G.DATA_MATRIX,Te.BarcodeFormat.DATA_MATRIX],[G.MAXICODE,Te.BarcodeFormat.MAXICODE],[G.ITF,Te.BarcodeFormat.ITF],[G.EAN_13,Te.BarcodeFormat.EAN_13],[G.EAN_8,Te.BarcodeFormat.EAN_8],[G.PDF_417,Te.BarcodeFormat.PDF_417],[G.RSS_14,Te.BarcodeFormat.RSS_14],[G.RSS_EXPANDED,Te.BarcodeFormat.RSS_EXPANDED],[G.UPC_A,Te.BarcodeFormat.UPC_A],[G.UPC_E,Te.BarcodeFormat.UPC_E],[G.UPC_EAN_EXTENSION,Te.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Ii)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=h,this.logger=m;var p=this.createZXingFormats(x),d=new Map;d.set(Te.DecodeHintType.POSSIBLE_FORMATS,p),d.set(Te.DecodeHintType.TRY_HARDER,!1),this.hints=d}return w.prototype.decodeAsync=function(x){var h=this;return new Promise(function(m,p){try{m(h.decode(x))}catch(d){p(d)}})},w.prototype.decode=function(x){var h=new Te.MultiFormatReader(this.verbose,this.hints),m=new Te.HTMLCanvasElementLuminanceSource(x),p=new Te.BinaryBitmap(new Te.HybridBinarizer(m)),d=h.decode(p);return{text:d.text,format:br.create(this.toHtml5QrcodeSupportedFormats(d.format)),debugData:this.createDebugData()}},w.prototype.createReverseFormatMap=function(){var x=new Map;return this.formatMap.forEach(function(h,m,p){x.set(h,m)}),x},w.prototype.toHtml5QrcodeSupportedFormats=function(x){if(!this.reverseFormatMap.has(x))throw"reverseFormatMap doesn't have ".concat(x);return this.reverseFormatMap.get(x)},w.prototype.createZXingFormats=function(x){for(var h=[],m=0,p=x;m<p.length;m++){var d=p[m];this.formatMap.has(d)?h.push(this.formatMap.get(d)):this.logger.logError("".concat(d," is not supported by")+"ZXingHtml5QrcodeShim")}return h},w.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},w}(),bi=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},yi=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Nr=function(){function w(x,h,m){if(this.formatMap=new Map([[G.QR_CODE,"qr_code"],[G.AZTEC,"aztec"],[G.CODABAR,"codabar"],[G.CODE_39,"code_39"],[G.CODE_93,"code_93"],[G.CODE_128,"code_128"],[G.DATA_MATRIX,"data_matrix"],[G.ITF,"itf"],[G.EAN_13,"ean_13"],[G.EAN_8,"ean_8"],[G.PDF_417,"pdf417"],[G.UPC_A,"upc_a"],[G.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!w.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=h,this.logger=m;var p=this.createBarcodeDetectorFormats(x);if(this.detector=new BarcodeDetector(p),!this.detector)throw"BarcodeDetector detector not supported"}return w.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var x=new BarcodeDetector({formats:["qr_code"]});return typeof x!="undefined"},w.prototype.decodeAsync=function(x){return bi(this,void 0,void 0,function(){var h,m;return yi(this,function(p){switch(p.label){case 0:return[4,this.detector.detect(x)];case 1:if(h=p.sent(),!h||h.length===0)throw"No barcode or QR code detected.";return m=this.selectLargestBarcode(h),[2,{text:m.rawValue,format:br.create(this.toHtml5QrcodeSupportedFormats(m.format)),debugData:this.createDebugData()}]}})})},w.prototype.selectLargestBarcode=function(x){for(var h=null,m=0,p=0,d=x;p<d.length;p++){var S=d[p],B=S.boundingBox.width*S.boundingBox.height;B>m&&(m=B,h=S)}if(!h)throw"No largest barcode found";return h},w.prototype.createBarcodeDetectorFormats=function(x){for(var h=[],m=0,p=x;m<p.length;m++){var d=p[m];this.formatMap.has(d)?h.push(this.formatMap.get(d)):this.logger.warn("".concat(d," is not supported by")+"BarcodeDetectorDelegate")}return{formats:h}},w.prototype.toHtml5QrcodeSupportedFormats=function(x){if(!this.reverseFormatMap.has(x))throw"reverseFormatMap doesn't have ".concat(x);return this.reverseFormatMap.get(x)},w.prototype.createReverseFormatMap=function(){var x=new Map;return this.formatMap.forEach(function(h,m,p){x.set(h,m)}),x},w.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},w}(),_r=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},Or=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Si=function(){function w(x,h,m,p){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=m,h&&Nr.isSupported()?(this.primaryDecoder=new Nr(x,m,p),this.secondaryDecoder=new Tr(x,m,p)):this.primaryDecoder=new Tr(x,m,p)}return w.prototype.decodeAsync=function(x){return _r(this,void 0,void 0,function(){var h;return Or(this,function(m){switch(m.label){case 0:h=performance.now(),m.label=1;case 1:return m.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(x)];case 2:return[2,m.sent()];case 3:return this.possiblyLogPerformance(h),[7];case 4:return[2]}})})},w.prototype.decodeRobustlyAsync=function(x){return _r(this,void 0,void 0,function(){var h,m;return Or(this,function(p){switch(p.label){case 0:h=performance.now(),p.label=1;case 1:return p.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(x)];case 2:return[2,p.sent()];case 3:if(m=p.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(x)];throw m;case 4:return this.possiblyLogPerformance(h),[7];case 5:return[2]}})})},w.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},w.prototype.possiblyLogPerformance=function(x){if(this.verbose){var h=performance.now()-x;this.executionResults.push(h),this.executions++,this.possiblyFlushPerformanceReport()}},w.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var x=0,h=0,m=this.executionResults;h<m.length;h++){var p=m[h];x+=p}var d=x/this.executionResults.length;console.log("".concat(d," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},w}(),jn=function(){var w=function(x,h){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(m[d]=p[d])},w(x,h)};return function(x,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");w(x,h);function m(){this.constructor=x}x.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}}(),On=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},Rn=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Rr=function(){function w(x,h){this.name=x,this.track=h}return w.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},w.prototype.apply=function(x){var h={};h[this.name]=x;var m={advanced:[h]};return this.track.applyConstraints(m)},w.prototype.value=function(){var x=this.track.getSettings();if(this.name in x){var h=x[this.name];return h}return null},w}(),Ti=function(w){jn(x,w);function x(h,m){return w.call(this,h,m)||this}return x.prototype.min=function(){return this.getCapabilities().min},x.prototype.max=function(){return this.getCapabilities().max},x.prototype.step=function(){return this.getCapabilities().step},x.prototype.apply=function(h){var m={};m[this.name]=h;var p={advanced:[m]};return this.track.applyConstraints(p)},x.prototype.getCapabilities=function(){this.failIfNotSupported();var h=this.track.getCapabilities(),m=h[this.name];return{min:m.min,max:m.max,step:m.step}},x.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},x}(Rr),Ni=function(w){jn(x,w);function x(h){return w.call(this,"zoom",h)||this}return x}(Ti),_i=function(w){jn(x,w);function x(h){return w.call(this,"torch",h)||this}return x}(Rr),Oi=function(){function w(x){this.track=x}return w.prototype.zoomFeature=function(){return new Ni(this.track)},w.prototype.torchFeature=function(){return new _i(this.track)},w}(),Ri=function(){function w(x,h,m){this.isClosed=!1,this.parentElement=x,this.mediaStream=h,this.callbacks=m,this.surface=this.createVideoElement(this.parentElement.clientWidth),x.append(this.surface)}return w.prototype.createVideoElement=function(x){var h=document.createElement("video");return h.style.width="".concat(x,"px"),h.style.display="block",h.muted=!0,h.setAttribute("muted","true"),h.playsInline=!0,h},w.prototype.setupSurface=function(){var x=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var h=function(){var m=x.surface.clientWidth,p=x.surface.clientHeight;x.callbacks.onRenderSurfaceReady(m,p),x.surface.removeEventListener("playing",h)};this.surface.addEventListener("playing",h),this.surface.srcObject=this.mediaStream,this.surface.play()},w.create=function(x,h,m,p){return On(this,void 0,void 0,function(){var d,S;return Rn(this,function(B){switch(B.label){case 0:return d=new w(x,h,p),m.aspectRatio?(S={aspectRatio:m.aspectRatio},[4,d.getFirstTrackOrFail().applyConstraints(S)]):[3,2];case 1:B.sent(),B.label=2;case 2:return d.setupSurface(),[2,d]}})})},w.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},w.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},w.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},w.prototype.resume=function(x){this.failIfClosed();var h=this,m=function(){setTimeout(x,200),h.surface.removeEventListener("playing",m)};this.surface.addEventListener("playing",m),this.surface.play()},w.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},w.prototype.getSurface=function(){return this.failIfClosed(),this.surface},w.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},w.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},w.prototype.applyVideoConstraints=function(x){return On(this,void 0,void 0,function(){return Rn(this,function(h){if("aspectRatio"in x)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(x)]})})},w.prototype.close=function(){if(this.isClosed)return Promise.resolve();var x=this;return new Promise(function(h,m){var p=x.mediaStream.getVideoTracks(),d=p.length,S=0;x.mediaStream.getVideoTracks().forEach(function(B){x.mediaStream.removeTrack(B),B.stop(),++S,S>=d&&(x.isClosed=!0,x.parentElement.removeChild(x.surface),h())})})},w.prototype.getCapabilities=function(){return new Oi(this.getFirstTrackOrFail())},w}(),Di=function(){function w(x){this.mediaStream=x}return w.prototype.render=function(x,h,m){return On(this,void 0,void 0,function(){return Rn(this,function(p){return[2,Ri.create(x,this.mediaStream,h,m)]})})},w.create=function(x){return On(this,void 0,void 0,function(){var h,m;return Rn(this,function(p){switch(p.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return h={audio:!1,video:x},[4,navigator.mediaDevices.getUserMedia(h)];case 1:return m=p.sent(),[2,new w(m)]}})})},w}(),Dr=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},Mr=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Mi=function(){function w(){}return w.failIfNotSupported=function(){return Dr(this,void 0,void 0,function(){return Mr(this,function(x){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new w]})})},w.prototype.create=function(x){return Dr(this,void 0,void 0,function(){return Mr(this,function(h){return[2,Di.create(x)]})})},w}(),Bi=function(w,x,h,m){function p(d){return d instanceof h?d:new h(function(S){S(d)})}return new(h||(h=Promise))(function(d,S){function B(R){try{A(m.next(R))}catch(O){S(O)}}function M(R){try{A(m.throw(R))}catch(O){S(O)}}function A(R){R.done?d(R.value):p(R.value).then(B,M)}A((m=m.apply(w,x||[])).next())})},vi=function(w,x){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},m,p,d,S;return S={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function B(A){return function(R){return M([A,R])}}function M(A){if(m)throw new TypeError("Generator is already executing.");for(;S&&(S=0,A[0]&&(h=0)),h;)try{if(m=1,p&&(d=A[0]&2?p.return:A[0]?p.throw||((d=p.return)&&d.call(p),0):p.next)&&!(d=d.call(p,A[1])).done)return d;switch(p=0,d&&(A=[A[0]&2,d.value]),A[0]){case 0:case 1:d=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,p=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(A[0]===6||A[0]===2)){h=0;continue}if(A[0]===3&&(!d||A[1]>d[0]&&A[1]<d[3])){h.label=A[1];break}if(A[0]===6&&h.label<d[1]){h.label=d[1],d=A;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(A);break}d[2]&&h.ops.pop(),h.trys.pop();continue}A=x.call(w,h)}catch(R){A=[6,R],p=0}finally{m=d=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},Pi=function(){function w(){}return w.retrieve=function(){if(navigator.mediaDevices)return w.getCamerasFromMediaDevices();var x=MediaStreamTrack;return MediaStreamTrack&&x.getSources?w.getCamerasFromMediaStreamTrack():w.rejectWithError()},w.rejectWithError=function(){var x=Qt.unableToQuerySupportedDevices();return w.isHttpsOrLocalhost()||(x=Qt.insecureContextCameraQueryError()),Promise.reject(x)},w.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var x=location.host.split(":")[0];return x==="127.0.0.1"||x==="localhost"},w.getCamerasFromMediaDevices=function(){return Bi(this,void 0,void 0,function(){var x,h,m,p,d,S,B;return vi(this,function(M){switch(M.label){case 0:return x=function(A){for(var R=A.getVideoTracks(),O=0,ie=R;O<ie.length;O++){var $=ie[O];$.enabled=!1,$.stop(),A.removeTrack($)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return h=M.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(m=M.sent(),p=[],d=0,S=m;d<S.length;d++)B=S[d],B.kind==="videoinput"&&p.push({id:B.deviceId,label:B.label});return x(h),[2,p]}})})},w.getCamerasFromMediaStreamTrack=function(){return new Promise(function(x,h){var m=function(d){for(var S=[],B=0,M=d;B<M.length;B++){var A=M[B];A.kind==="video"&&S.push({id:A.id,label:A.label})}x(S)},p=MediaStreamTrack;p.getSources(m)})},w}(),Oe;(function(w){w[w.UNKNOWN=0]="UNKNOWN",w[w.NOT_STARTED=1]="NOT_STARTED",w[w.SCANNING=2]="SCANNING",w[w.PAUSED=3]="PAUSED"})(Oe||(Oe={}));var Li=function(){function w(){this.state=Oe.NOT_STARTED,this.onGoingTransactionNewState=Oe.UNKNOWN}return w.prototype.directTransition=function(x){this.failIfTransitionOngoing(),this.validateTransition(x),this.state=x},w.prototype.startTransition=function(x){return this.failIfTransitionOngoing(),this.validateTransition(x),this.onGoingTransactionNewState=x,this},w.prototype.execute=function(){if(this.onGoingTransactionNewState===Oe.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var x=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Oe.UNKNOWN,this.directTransition(x)},w.prototype.cancel=function(){if(this.onGoingTransactionNewState===Oe.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Oe.UNKNOWN},w.prototype.getState=function(){return this.state},w.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Oe.UNKNOWN)throw"Cannot transition to a new state, already under transition"},w.prototype.validateTransition=function(x){switch(this.state){case Oe.UNKNOWN:throw"Transition from unknown is not allowed";case Oe.NOT_STARTED:this.failIfNewStateIs(x,[Oe.PAUSED]);break;case Oe.SCANNING:break;case Oe.PAUSED:break}},w.prototype.failIfNewStateIs=function(x,h){for(var m=0,p=h;m<p.length;m++){var d=p[m];if(x===d)throw"Cannot transition from ".concat(this.state," to ").concat(x)}},w}(),Fi=function(){function w(x){this.stateManager=x}return w.prototype.startTransition=function(x){return this.stateManager.startTransition(x)},w.prototype.directTransition=function(x){this.stateManager.directTransition(x)},w.prototype.getState=function(){return this.stateManager.getState()},w.prototype.canScanFile=function(){return this.stateManager.getState()===Oe.NOT_STARTED},w.prototype.isScanning=function(){return this.stateManager.getState()!==Oe.NOT_STARTED},w.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Oe.SCANNING},w.prototype.isPaused=function(){return this.stateManager.getState()===Oe.PAUSED},w}(),ki=function(){function w(){}return w.create=function(){return new Fi(new Li)},w}(),Ui=function(){var w=function(x,h){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(m[d]=p[d])},w(x,h)};return function(x,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");w(x,h);function m(){this.constructor=x}x.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}}(),ft=function(w){Ui(x,w);function x(){return w!==null&&w.apply(this,arguments)||this}return x.DEFAULT_WIDTH=300,x.DEFAULT_WIDTH_OFFSET=2,x.FILE_SCAN_MIN_HEIGHT=300,x.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,x.MIN_QR_BOX_SIZE=50,x.SHADED_LEFT=1,x.SHADED_RIGHT=2,x.SHADED_TOP=3,x.SHADED_BOTTOM=4,x.SHADED_REGION_ELEMENT_ID="qr-shaded-region",x.VERBOSE=!1,x.BORDER_SHADER_DEFAULT_COLOR="#ffffff",x.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",x}(Ci),Vi=function(){function w(x,h){this.logger=h,this.fps=ft.SCAN_DEFAULT_FPS,x?(x.fps&&(this.fps=x.fps),this.disableFlip=x.disableFlip===!0,this.qrbox=x.qrbox,this.aspectRatio=x.aspectRatio,this.videoConstraints=x.videoConstraints):this.disableFlip=ft.DEFAULT_DISABLE_FLIP}return w.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Sr.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},w.prototype.isShadedBoxEnabled=function(){return!Ot(this.qrbox)},w.create=function(x,h){return new w(x,h)},w}(),Br=function(){function w(x,h){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(x))throw"HTML Element with id=".concat(x," not found");this.elementId=x,this.verbose=!1;var m;typeof h=="boolean"?this.verbose=h===!0:h&&(m=h,this.verbose=m.verbose===!0,m.experimentalFeatures),this.logger=new mi(this.verbose),this.qrcode=new Si(this.getSupportedFormats(h),this.getUseBarCodeDetectorIfSupported(m),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=ki.create()}return w.prototype.start=function(x,h,m,p){var d=this;if(!x)throw"cameraIdOrConfig is required";if(!m||typeof m!="function")throw"qrCodeSuccessCallback is required and should be a function.";var S;p?S=p:S=this.verbose?this.logger.log:function(){};var B=Vi.create(h,this.logger);this.clearElement();var M=!1;B.videoConstraints&&(B.isMediaStreamConstraintsValid()?M=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var A=M,R=document.getElementById(this.elementId);R.clientWidth?R.clientWidth:ft.DEFAULT_WIDTH,R.style.position="relative",this.shouldScan=!0,this.element=R;var O=this,ie=this.stateManagerProxy.startTransition(Oe.SCANNING);return new Promise(function($,Ne){var ee=A?B.videoConstraints:O.createVideoConstraints(x);if(!ee){ie.cancel(),Ne("videoConstraints should be defined");return}var $e={};(!A||B.aspectRatio)&&($e.aspectRatio=B.aspectRatio);var xt={onRenderSurfaceReady:function(Ae,Z){O.setupUi(Ae,Z,B),O.isScanning=!0,O.foreverScan(B,m,S)}};Mi.failIfNotSupported().then(function(Ae){Ae.create(ee).then(function(Z){return Z.render(d.element,$e,xt).then(function(le){O.renderedCamera=le,ie.execute(),$(null)}).catch(function(le){ie.cancel(),Ne(le)})}).catch(function(Z){ie.cancel(),Ne(Qt.errorGettingUserMedia(Z))})}).catch(function(Ae){ie.cancel(),Ne(Qt.cameraStreamingNotSupported())})})},w.prototype.pause=function(x){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Oe.PAUSED),this.showPausedState(),(Ot(x)||x!==!0)&&(x=!1),x&&this.renderedCamera&&this.renderedCamera.pause()},w.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var x=this,h=function(){x.stateManagerProxy.directTransition(Oe.SCANNING),x.hidePausedState()};if(!this.renderedCamera.isPaused()){h();return}this.renderedCamera.resume(function(){h()})},w.prototype.getState=function(){return this.stateManagerProxy.getState()},w.prototype.stop=function(){var x=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var h=this.stateManagerProxy.startTransition(Oe.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var m=function(){if(x.element){var d=document.getElementById(ft.SHADED_REGION_ELEMENT_ID);d&&x.element.removeChild(d)}},p=this;return this.renderedCamera.close().then(function(){return p.renderedCamera=null,p.element&&(p.element.removeChild(p.canvasElement),p.canvasElement=null),m(),p.qrRegion&&(p.qrRegion=null),p.context&&(p.context=null),h.execute(),p.hidePausedState(),p.isScanning=!1,Promise.resolve()})},w.prototype.scanFile=function(x,h){return this.scanFileV2(x,h).then(function(m){return m.decodedText})},w.prototype.scanFileV2=function(x,h){var m=this;if(!x||!(x instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Ot(h)&&(h=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(p,d){m.possiblyCloseLastScanImageFile(),m.clearElement(),m.lastScanImageFile=URL.createObjectURL(x);var S=new Image;S.onload=function(){var B=S.width,M=S.height,A=document.getElementById(m.elementId),R=A.clientWidth?A.clientWidth:ft.DEFAULT_WIDTH,O=Math.max(A.clientHeight?A.clientHeight:M,ft.FILE_SCAN_MIN_HEIGHT),ie=m.computeCanvasDrawConfig(B,M,R,O);if(h){var $=m.createCanvasElement(R,O,"qr-canvas-visible");$.style.display="inline-block",A.appendChild($);var Ne=$.getContext("2d");if(!Ne)throw"Unable to get 2d context from canvas";Ne.canvas.width=R,Ne.canvas.height=O,Ne.drawImage(S,0,0,B,M,ie.x,ie.y,ie.width,ie.height)}var ee=ft.FILE_SCAN_HIDDEN_CANVAS_PADDING,$e=Math.max(S.width,ie.width),xt=Math.max(S.height,ie.height),Ae=$e+2*ee,Z=xt+2*ee,le=m.createCanvasElement(Ae,Z);A.appendChild(le);var Mt=le.getContext("2d");if(!Mt)throw"Unable to get 2d context from canvas";Mt.canvas.width=Ae,Mt.canvas.height=Z,Mt.drawImage(S,0,0,B,M,ee,ee,$e,xt);try{m.qrcode.decodeRobustlyAsync(le).then(function(Ce){p(yr.createFromQrcodeResult(Ce))}).catch(d)}catch(Ce){d("QR code parse error, error = ".concat(Ce))}},S.onerror=d,S.onabort=d,S.onstalled=d,S.onsuspend=d,S.src=URL.createObjectURL(x)})},w.prototype.clear=function(){this.clearElement()},w.getCameras=function(){return Pi.retrieve()},w.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},w.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},w.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},w.prototype.applyVideoConstraints=function(x){if(x){if(!Sr.isMediaStreamConstraintsValid(x,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(x)},w.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},w.prototype.getSupportedFormats=function(x){var h=[G.QR_CODE,G.AZTEC,G.CODABAR,G.CODE_39,G.CODE_93,G.CODE_128,G.DATA_MATRIX,G.MAXICODE,G.ITF,G.EAN_13,G.EAN_8,G.PDF_417,G.RSS_14,G.RSS_EXPANDED,G.UPC_A,G.UPC_E,G.UPC_EAN_EXTENSION];if(!x||typeof x=="boolean"||!x.formatsToSupport)return h;if(!Array.isArray(x.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(x.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var m=[],p=0,d=x.formatsToSupport;p<d.length;p++){var S=d[p];Ai(S)?m.push(S):this.logger.warn("Invalid format: ".concat(S," passed in config, ignoring."))}if(m.length===0)throw"None of formatsToSupport match supported values.";return m},w.prototype.getUseBarCodeDetectorIfSupported=function(x){if(Ot(x))return!0;if(!Ot(x.useBarCodeDetectorIfSupported))return x.useBarCodeDetectorIfSupported!==!1;if(Ot(x.experimentalFeatures))return!0;var h=x.experimentalFeatures;return Ot(h.useBarCodeDetectorIfSupported)?!0:h.useBarCodeDetectorIfSupported!==!1},w.prototype.validateQrboxSize=function(x,h,m){var p=this,d=m.qrbox;this.validateQrboxConfig(d);var S=this.toQrdimensions(x,h,d),B=function(A){if(A<ft.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(ft.MIN_QR_BOX_SIZE,"px.")},M=function(A){return A>x&&(p.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."),A=x),A};B(S.width),B(S.height),S.width=M(S.width)},w.prototype.validateQrboxConfig=function(x){if(typeof x!="number"&&typeof x!="function"&&(x.width===void 0||x.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},w.prototype.toQrdimensions=function(x,h,m){if(typeof m=="number")return{width:m,height:m};if(typeof m=="function")try{return m(x,h)}catch(p){throw new Error("qrbox config was passed as a function but it failed with unknown error"+p)}return m},w.prototype.setupUi=function(x,h,m){m.isShadedBoxEnabled()&&this.validateQrboxSize(x,h,m);var p=Ot(m.qrbox)?{width:x,height:h}:m.qrbox;this.validateQrboxConfig(p);var d=this.toQrdimensions(x,h,p);d.height>h&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var S=m.isShadedBoxEnabled()&&d.height<=h,B={x:0,y:0,width:x,height:h},M=S?this.getShadedRegionBounds(x,h,d):B,A=this.createCanvasElement(M.width,M.height),R={willReadFrequently:!0},O=A.getContext("2d",R);O.canvas.width=M.width,O.canvas.height=M.height,this.element.append(A),S&&this.possiblyInsertShadingElement(this.element,x,h,d),this.createScannerPausedUiElement(this.element),this.qrRegion=M,this.context=O,this.canvasElement=A},w.prototype.createScannerPausedUiElement=function(x){var h=document.createElement("div");h.innerText=Qt.scannerPaused(),h.style.display="none",h.style.position="absolute",h.style.top="0px",h.style.zIndex="1",h.style.background="rgba(9, 9, 9, 0.46)",h.style.color="#FFECEC",h.style.textAlign="center",h.style.width="100%",x.appendChild(h),this.scannerPausedUiElement=h},w.prototype.scanContext=function(x,h){var m=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(p){return x(p.text,yr.createFromQrcodeResult(p)),m.possiblyUpdateShaders(!0),!0}).catch(function(p){m.possiblyUpdateShaders(!1);var d=Qt.codeParseError(p);return h(d,Ei.createFrom(d)),!1})},w.prototype.foreverScan=function(x,h,m){var p=this;if(this.shouldScan&&this.renderedCamera){var d=this.renderedCamera.getSurface(),S=d.videoWidth/d.clientWidth,B=d.videoHeight/d.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var M=this.qrRegion.width*S,A=this.qrRegion.height*B,R=this.qrRegion.x*S,O=this.qrRegion.y*B;this.context.drawImage(d,R,O,M,A,0,0,this.qrRegion.width,this.qrRegion.height);var ie=function(){p.foreverScanTimeout=setTimeout(function(){p.foreverScan(x,h,m)},p.getTimeoutFps(x.fps))};this.scanContext(h,m).then(function($){!$&&x.disableFlip!==!0?(p.context.translate(p.context.canvas.width,0),p.context.scale(-1,1),p.scanContext(h,m).finally(function(){ie()})):ie()}).catch(function($){p.logger.logError("Error happend while scanning context",$),ie()})}},w.prototype.createVideoConstraints=function(x){if(typeof x=="string")return{deviceId:{exact:x}};if(typeof x=="object"){var h="facingMode",m="deviceId",p={user:!0,environment:!0},d="exact",S=function(Ne){if(Ne in p)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(Ne,"'")},B=Object.keys(x);if(B.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(B.length," keys");var M=Object.keys(x)[0];if(M!==h&&M!==m)throw"Only '".concat(h,"' and '").concat(m,"' ")+" are supported for 'cameraIdOrConfig'";if(M===h){var A=x.facingMode;if(typeof A=="string"){if(S(A))return{facingMode:A}}else if(typeof A=="object")if(d in A){if(S(A["".concat(d)]))return{facingMode:{exact:A["".concat(d)]}}}else throw"'facingMode' should be string or object with"+" ".concat(d," as key.");else{var R=typeof A;throw"Invalid type of 'facingMode' = ".concat(R)}}else{var O=x.deviceId;if(typeof O=="string")return{deviceId:O};if(typeof O=="object"){if(d in O)return{deviceId:{exact:O["".concat(d)]}};throw"'deviceId' should be string or object with"+" ".concat(d," as key.")}else{var ie=typeof O;throw"Invalid type of 'deviceId' = ".concat(ie)}}}var $=typeof x;throw"Invalid type of 'cameraIdOrConfig' = ".concat($)},w.prototype.computeCanvasDrawConfig=function(x,h,m,p){if(x<=m&&h<=p){var d=(m-x)/2,S=(p-h)/2;return{x:d,y:S,width:x,height:h}}else{var B=x,M=h;return x>m&&(h=m/x*h,x=m),h>p&&(x=p/h*x,h=p),this.logger.log("Image downsampled from "+"".concat(B,"X").concat(M)+" to ".concat(x,"X").concat(h,".")),this.computeCanvasDrawConfig(x,h,m,p)}},w.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var x=document.getElementById(this.elementId);x&&(x.innerHTML="")},w.prototype.possiblyUpdateShaders=function(x){this.qrMatch!==x&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(h){h.style.backgroundColor=x?ft.BORDER_SHADER_MATCH_COLOR:ft.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=x)},w.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},w.prototype.createCanvasElement=function(x,h,m){var p=x,d=h,S=document.createElement("canvas");return S.style.width="".concat(p,"px"),S.style.height="".concat(d,"px"),S.style.display="none",S.id=Ot(m)?"qr-canvas":m,S},w.prototype.getShadedRegionBounds=function(x,h,m){if(m.width>x||m.height>h)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(x-m.width)/2,y:(h-m.height)/2,width:m.width,height:m.height}},w.prototype.possiblyInsertShadingElement=function(x,h,m,p){if(!(h-p.width<1||m-p.height<1)){var d=document.createElement("div");d.style.position="absolute";var S=(h-p.width)/2,B=(m-p.height)/2;if(d.style.borderLeft="".concat(S,"px solid rgba(0, 0, 0, 0.48)"),d.style.borderRight="".concat(S,"px solid rgba(0, 0, 0, 0.48)"),d.style.borderTop="".concat(B,"px solid rgba(0, 0, 0, 0.48)"),d.style.borderBottom="".concat(B,"px solid rgba(0, 0, 0, 0.48)"),d.style.boxSizing="border-box",d.style.top="0px",d.style.bottom="0px",d.style.left="0px",d.style.right="0px",d.id="".concat(ft.SHADED_REGION_ELEMENT_ID),h-p.width<11||m-p.height<11)this.hasBorderShaders=!1;else{var M=5,A=40;this.insertShaderBorders(d,A,M,-M,null,0,!0),this.insertShaderBorders(d,A,M,-M,null,0,!1),this.insertShaderBorders(d,A,M,null,-M,0,!0),this.insertShaderBorders(d,A,M,null,-M,0,!1),this.insertShaderBorders(d,M,A+M,-M,null,-M,!0),this.insertShaderBorders(d,M,A+M,null,-M,-M,!0),this.insertShaderBorders(d,M,A+M,-M,null,-M,!1),this.insertShaderBorders(d,M,A+M,null,-M,-M,!1),this.hasBorderShaders=!0}x.append(d)}},w.prototype.insertShaderBorders=function(x,h,m,p,d,S,B){var M=document.createElement("div");M.style.position="absolute",M.style.backgroundColor=ft.BORDER_SHADER_DEFAULT_COLOR,M.style.width="".concat(h,"px"),M.style.height="".concat(m,"px"),p!==null&&(M.style.top="".concat(p,"px")),d!==null&&(M.style.bottom="".concat(d,"px")),B?M.style.left="".concat(S,"px"):M.style.right="".concat(S,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(M),x.appendChild(M)},w.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},w.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},w.prototype.getTimeoutFps=function(x){return 1e3/x},w}(),vr;(function(w){w[w.STATUS_DEFAULT=0]="STATUS_DEFAULT",w[w.STATUS_SUCCESS=1]="STATUS_SUCCESS",w[w.STATUS_WARNING=2]="STATUS_WARNING",w[w.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(vr||(vr={}));function Gi({style:w={}}){const x={position:"absolute",backgroundColor:"rgb(255, 255, 255)"};return H.jsxs("div",{id:"qr-scan-box",style:it({boxSizing:"border-box",inset:"0px"},w),children:[H.jsx("div",{style:it({width:"40px",height:"5px",top:"-5px",left:"0px"},x)}),H.jsx("div",{style:it({width:"40px",height:"5px",top:"-5px",right:"0px"},x)}),H.jsx("div",{style:it({width:"40px",height:"5px",bottom:"-5px",left:"0px"},x)}),H.jsx("div",{style:it({width:"40px",height:"5px",bottom:"-5px",right:"0px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",top:"-5px",left:"-5px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",bottom:"-5px",left:"-5px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",top:"-5px",right:"-5px"},x)}),H.jsx("div",{style:it({width:"5px",height:"45px",bottom:"-5px",right:"-5px"},x)})]})}function Wi({onScannerSizeChanged:w,elementId:x}){const[h,m]=De.useState(),p=ai.useNavigate(),{t:d}=Dt.useTranslation("block-workbench"),S=De.useMemo(()=>{const R=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),O=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);return{width:R,height:O}},[]),B=De.useCallback(R=>jt(this,null,function*(){return R.start({facingMode:"environment"},{fps:10,qrbox(O,ie){return w({width:O,height:ie}),{width:S.width,height:S.height}}},O=>{p(O)},void 0)}),[p,w,S]),M=De.useCallback(R=>jt(this,null,function*(){const O=R.getState();if([Oe.SCANNING,Oe.PAUSED].includes(O))return R.stop()}),[]),A=De.useCallback(R=>jt(this,null,function*(){yield M(h);try{const{decodedText:O}=yield h.scanFileV2(R,!1);p(O)}catch(O){alert(d("QR code recognition failed, please scan again")),B(h)}}),[h,M,B,d,p]);return De.useEffect(()=>{const R=new Br(x);return m(R),B(R),()=>{M(R)}},[x,B,M]),{startScanCamera:B,startScanFile:A}}const Pr="qrcode",Hi=w=>{const x=De.useRef(),h=De.useRef(),{t:m}=Dt.useTranslation("block-workbench"),[p,d]=De.useState({width:0,height:0}),S=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),B=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),{startScanFile:M}=Wi({onScannerSizeChanged:d,elementId:Pr}),A=()=>{const Ne=Math.floor(Math.min(S,B)*.6);return{left:`${(S-Ne)/2}px`,top:`${(B-Ne)/2}px`,position:"fixed",width:`${Ne}px`,height:`${Ne}px`}},R=()=>{h.current&&h.current.click()},O=Ne=>{const ee=Ne.target.files;if(ee.length>0){const $e=ee[0];$e.size<1e6?M($e):alert(m("The image size is too large. Please compress it to below 1MB before uploading"))}};De.useEffect(()=>(document.documentElement.style.overscrollBehavior="none",()=>{document.documentElement.style.overscrollBehavior="default"}),[]),De.useEffect(()=>{const{width:Ne,height:ee}=p,$e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),xt=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);if(Ne>0&&ee>0&&ee<xt){const Ae=xt/ee,Z=Math.floor(Ae*Ne),le=document.getElementsByTagName("video")[0];le.style.height=`${xt}px`,le.style.width=`${Z}px`,x.current.style.left=`${($e-Z)/2}px`,x.current.style.position="absolute"}},[p]);const ie=()=>H.jsx("div",{style:{position:"absolute",bottom:"20px",left:"20px",padding:"10px 60px"},children:H.jsxs("div",{style:{color:"white",width:"40px",display:"flex",flexDirection:"column",alignItems:"center"},children:[H.jsx(qt.FileImageOutlined,{style:$,onClick:R}),m("Album"),H.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:O,style:{visibility:"hidden"}})]})}),$={zIndex:"1003",fontSize:"1.8em",fontWeight:"bold"};return H.jsxs(H.Fragment,{children:[H.jsx("div",{ref:x,id:Pr,style:{position:"absolute"}}),H.jsx(Gi,{style:it({},A())}),H.jsx(ie,{})]})},Xi=w=>{const{visible:x,setVisible:h}=q.useActionContext(),[m,p]=De.useState(!1),{t:d}=Dt.useTranslation("block-workbench");De.useEffect(()=>{x&&!m&&jt(this,null,function*(){try{(yield Br.getCameras()).length===0?alert(d("No camera device detected")):p(!0)}catch(R){const O={NotFoundError:d("No camera device detected"),NotAllowedError:d("You have not granted permission to use the camera")};console.log(R);const ie=O[R.name];alert(ie!=null?ie:R),p(!1),h(!1)}})},[x,m,h,d]);const S={position:"fixed",width:"100%",height:"100%",background:"black",zIndex:"1001",top:0,left:0,overflow:"hidden"},B={position:"absolute",top:"22px",left:"20px",zIndex:"1003",color:"white",fontSize:"1.8em",fontWeight:"bold"},M={position:"absolute",color:"white",fontSize:"1.5em",left:0,right:0,top:"20px",zIndex:"1002",marginLeft:"auto",marginRight:"auto",textAlign:"center"};return x&&m?H.jsxs("div",{style:S,children:[H.jsx(Hi,{}),H.jsx(qt.LeftOutlined,{style:B,onClick:()=>h(!1)}),H.jsx("div",{style:M,children:d("Scan QR code")})]}):null},zi={type:"void","x-decorator":"CardItem","x-settings":"blockSettings:workbench","x-schema-toolbar":"BlockSchemaToolbar","x-component":"WorkbenchBlock",properties:{actions:{"x-component":"WorkbenchBlock.ActionBar","x-initializer":"workbench:configureActions"}}},Jt={type:"item",name:"workbenchBlock",icon:"AppstoreAddOutlined",useComponentProps(){const{t:w}=Dt.useTranslation("@nocobase/plugin-block-workbench"),{insert:x}=q.useSchemaInitializer();return{title:w("Workbench"),onClick:()=>{x(zi)}}}},Yi=new q.SchemaSettings({name:"blockSettings:workbench",items:[{type:"remove",name:"remove"}]}),Zi=new q.SchemaInitializer({name:"workbench:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:xi}]});class Lr extends q.Plugin{load(){return jt(this,null,function*(){this.app.addComponents({WorkbenchBlock:Er,QRCodeScanner:Xi}),this.app.schemaSettingsManager.add(Yi),this.app.schemaInitializerManager.add(Zi),this.app.schemaInitializerManager.addItem("page:addBlock",`otherBlocks.${Jt.name}`,Jt),this.app.schemaInitializerManager.addItem("mobilePage:addBlock",`otherBlocks.${Jt.name}`,Jt),this.app.schemaInitializerManager.addItem("mobile:addBlock",`otherBlocks.${Jt.name}`,Jt),this.app.schemaSettingsManager.add(di),this.app.schemaSettingsManager.add(gi),this.app.schemaInitializerManager.addItem("workbench:configureActions","qrcode",{Component:wi})})}}oe.PluginBlockWorkbenchClient=Lr,oe.default=Lr,Object.defineProperties(oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -9,13 +9,13 @@
9
9
 
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.0",
12
- "@nocobase/client": "1.3.54",
13
- "@nocobase/utils": "1.3.54",
12
+ "@nocobase/client": "1.3.55",
13
+ "@nocobase/utils": "1.3.55",
14
14
  "react": "18.2.0",
15
15
  "antd": "5.12.8",
16
16
  "antd-style": "3.7.1",
17
17
  "react-i18next": "11.18.6",
18
- "@nocobase/server": "1.3.54",
18
+ "@nocobase/server": "1.3.55",
19
19
  "@ant-design/icons": "5.3.7",
20
20
  "react-router-dom": "6.21.0"
21
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-block-workbench",
3
- "version": "1.3.54",
3
+ "version": "1.3.55",
4
4
  "displayName": "Block: Workbench",
5
5
  "displayName.zh-CN": "区块:工作台",
6
6
  "description": "Add buttons for actions, links, etc. in the workbench block to quickly initiate actions and jump pages.",
@@ -20,5 +20,5 @@
20
20
  "keywords": [
21
21
  "Blocks"
22
22
  ],
23
- "gitHead": "33b487952c467cbce819533b056de538728c3226"
23
+ "gitHead": "29126bb873bd07a9f40a7f2fee5ca1c396f09794"
24
24
  }