4 lines
312 KiB
JavaScript
4 lines
312 KiB
JavaScript
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ZXing={})}(this,function(t){"use strict";var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};var r,n=function(t){function r(e){var r,n,i,s=this.constructor,o=t.call(this,e)||this;return Object.defineProperty(o,"name",{value:s.name,enumerable:!1}),r=o,n=s.prototype,(i=Object.setPrototypeOf)?i(r,n):r.__proto__=n,function(t,e){void 0===e&&(e=t.constructor);var r=Error.captureStackTrace;r&&r(t,e)}(o),o}return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}(r,t),r}(Error);class i extends n{constructor(t){super(t),this.message=t}getKind(){return this.constructor.kind}}i.kind="Exception";class s extends i{}s.kind="ArgumentException";class o extends i{}o.kind="IllegalArgumentException";class a{constructor(t){if(this.binarizer=t,null===t)throw new o("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(t,e){return this.binarizer.getBlackRow(t,e)}getBlackMatrix(){return null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(t,e,r,n){const i=this.binarizer.getLuminanceSource().crop(t,e,r,n);return new a(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const t=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new a(this.binarizer.createBinarizer(t))}rotateCounterClockwise45(){const t=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new a(this.binarizer.createBinarizer(t))}toString(){try{return this.getBlackMatrix().toString()}catch(t){return""}}}class l extends i{static getChecksumInstance(){return new l}}l.kind="ChecksumException";class h{constructor(t){this.source=t}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class c{static arraycopy(t,e,r,n,i){for(;i--;)r[n++]=t[e++]}static currentTimeMillis(){return Date.now()}}class u extends i{}u.kind="IndexOutOfBoundsException";class d extends u{constructor(t,e){super(e),this.index=t,this.message=e}}d.kind="ArrayIndexOutOfBoundsException";class g{static fill(t,e){for(let r=0,n=t.length;r<n;r++)t[r]=e}static fillWithin(t,e,r,n){g.rangeCheck(t.length,e,r);for(let i=e;i<r;i++)t[i]=n}static rangeCheck(t,e,r){if(e>r)throw new o("fromIndex("+e+") > toIndex("+r+")");if(e<0)throw new d(e);if(r>t)throw new d(r)}static asList(...t){return t}static create(t,e,r){return Array.from({length:t}).map(t=>Array.from({length:e}).fill(r))}static createInt32Array(t,e,r){return Array.from({length:t}).map(t=>Int32Array.from({length:e}).fill(r))}static equals(t,e){if(!t)return!1;if(!e)return!1;if(!t.length)return!1;if(!e.length)return!1;if(t.length!==e.length)return!1;for(let r=0,n=t.length;r<n;r++)if(t[r]!==e[r])return!1;return!0}static hashCode(t){if(null===t)return 0;let e=1;for(const r of t)e=31*e+r;return e}static fillUint8Array(t,e){for(let r=0;r!==t.length;r++)t[r]=e}static copyOf(t,e){return t.slice(0,e)}static copyOfUint8Array(t,e){if(t.length<=e){const r=new Uint8Array(e);return r.set(t),r}return t.slice(0,e)}static copyOfRange(t,e,r){const n=r-e,i=new Int32Array(n);return c.arraycopy(t,e,i,0,n),i}static binarySearch(t,e,r){void 0===r&&(r=g.numberComparator);let n=0,i=t.length-1;for(;n<=i;){const s=i+n>>1,o=r(e,t[s]);if(o>0)n=s+1;else{if(!(o<0))return s;i=s-1}}return-n-1}static numberComparator(t,e){return t-e}}class f{static numberOfTrailingZeros(t){let e;if(0===t)return 32;let r=31;return 0!==(e=t<<16)&&(r-=16,t=e),0!==(e=t<<8)&&(r-=8,t=e),0!==(e=t<<4)&&(r-=4,t=e),0!==(e=t<<2)&&(r-=2,t=e),r-(t<<1>>>31)}static numberOfLeadin
|
||
|
|
||
|
/** Html5QrcodeScanner **/
|
||
|
"use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var Html5QrcodeScanner=function(){function a(b,c,d){if(_classCallCheck(this,a),this.elementId=b,this.config=c,this.verbose=!0===d,!document.getElementById(b))throw"HTML Element with id=".concat(b," not found");this.currentScanType=a.SCAN_TYPE_CAMERA,this.sectionSwapAllowed=!0,this.section=void 0,this.html5Qrcode=void 0,this.qrCodeSuccessCallback=void 0,this.qrCodeErrorCallback=void 0}return _createClass(a,[{key:"render",value:function(b,c){var d=this;this.lastMatchFound=void 0,this.qrCodeSuccessCallback=function(c){if(d.__setStatus("MATCH",a.STATUS_SUCCESS),b)b(c);else{if(d.lastMatchFound==c)return;d.lastMatchFound=c,d.__setHeaderMessage("Last Match: ".concat(c),a.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(a){d.__setStatus("Scanning"),c&&c(a)};var e=document.getElementById(this.elementId);e.innerHTML="",this.__createBasicLayout(e),this.html5Qrcode=new Html5Qrcode(this.__getScanRegionId(),this.verbose)}},{key:"clear",value:function(){var a=this,b=this,c=function(){var b=document.getElementById(a.elementId);b&&(b.innerHTML="",a.__resetBasicLayout(b))};if(this.html5Qrcode)return new Promise(function(a,d){b.html5Qrcode._isScanning&&b.html5Qrcode.stop().then(function(){b.html5Qrcode.clear(),c(),a()})["catch"](function(a){b.verbose&&console.error("Unable to stop qrcode scanner",a),d(a)})})}},{key:"__createBasicLayout",value:function(a){a.style.position="relative",a.style.padding="0px",a.style.border="1px solid silver",this.__createHeader(a);var b=document.createElement("div"),c=this.__getScanRegionId();b.id=c,b.style.width="100%",b.style.minHeight="100px",b.style.textAlign="center",a.appendChild(b),this.__insertCameraScanImageToScanRegion();var d=document.createElement("div"),e=this.__getDashboardId();d.id=e,d.style.width="100%",a.appendChild(d),this.__setupInitialDashboard(d)}},{key:"__resetBasicLayout",value:function(a){a.style.border="none"}},{key:"__setupInitialDashboard",value:function(a){this.__createSection(a),this.__createSectionControlPanel(),this.__createSectionSwap()}},{key:"__createHeader",value:function(a){var b=document.createElement("div");b.style.textAlign="left",b.style.margin="0px",b.style.padding="5px",b.style.fontSize="20px",b.style.borderBottom="1px solid rgba(192, 192, 192, 0.18)",a.appendChild(b);var c=document.createElement("span"),d=document.createElement("a");d.innerHTML="Code Scanner",d.href="https://github.com/mebjas/html5-qrcode",c.appendChild(d),b.appendChild(c);var e=document.createElement("span");e.id=this.__getStatusSpanId(),e.style.float="right",e.style.padding="5px 7px",e.style.fontSize="14px",e.style.background="#dedede6b",e.style.border="1px solid #00000000",e.style.color="rgb(17, 17, 17)",b.appendChild(e),this.__setStatus("IDLE");var f=document.createElement("div");f.id=this.__getHeaderMessageContainerId(),f.style.display="none",f.style.fontSize="14px",f.style.padding="2px 10px",f.style.marginTop="4px",f.style.borderTop="1px solid #f6f6f6",b.appendChild(f)}},{key:"__createSection",value:function(a){var b=document.createElement("div");b.id=this.__getDashboardSectionId(),b.style.width="100%",b.style.padding="10px",b.style.textAlign="left",a.appendChild(b)}},{key:"__createSectionControlPanel",value:function(){var b=this,c=document.getElementById(this.__getDashboardSectionId()),d=document.createElement("div");c.appendChild(d);var e=document.createElement("div");e.id=this.__getDashboardSectionCameraScanRegionId(),e.style.display=this.currentScanType==a.SCAN_TYPE_CAMERA?"block":"none",d.appendChild(e);var f=document.createElement("div");f.style.textAlign="center"
|