// @Tue 10/20/2026 151840
/*
* @name: dwt all-in-one package
* @version: 19.5
* @components:
*   + Dynamsoft Dynamic Web TWAIN version: 19.5
*   + Dynamsoft Barcode Reader Addon for DWT version 19.5 (DBR version 9.6.40)
*   + Dynamsoft PDF Rasterizer Addon for DWT version: 19.5
*   + Dynamsoft OCR Basic Addon for DWT version: 19.5
*   + Dynamsoft OCR Pro Addon for DWT version: 19.5
*   + Dynamsoft OCR Kit Addon for DWT version: 19.5
*   + Dynamsoft Webcam Addon for DWT version: 19.5
*   + Dynamsoft File Uploader version: 19.5
*/


/*! 20261015100910 - 20260922110806
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 19.5
*/
var _gThis=(function(){if(typeof globalThis!=='undefined')return globalThis;if(typeof self!=='undefined')return self;if(typeof window!=='undefined')return window;if(typeof global!=='undefined')return global;return {}})(),Dynamsoft=_gThis.Dynamsoft||{};
(function(b){if(!b.DWT){b.DWT={}}if(!b.DWT.LTS){b.DWT.LTS={}}if(!b.Lib){b.Lib={}}if(!b.Lib.UI){b.Lib.UI={}}if(!b.Lib.html5){b.Lib.html5={}}_gThis.Dynamsoft=b})(Dynamsoft);
(function(e){if(!e.WeakSet){e.WeakSet=b;var c=Date.now()%1E9;function b(a){this.name="__st"+(1E9*Math.random()>>>0)+(c++ +"__");a&&a.forEach&&a.forEach(this.add,this)}var z=b.prototype;z.add=function(a){var d=this.name;a[d]||Object.defineProperty(a,d,{value:!0,writable:!0});return this};z["delete"]=function(a){if(!a[this.name])return!1;a[this.name]=void 0;return!0};z.has=function(a){return!!a[this.name]};}
if(!e.WeakMap){var r=Object.prototype.hasOwnProperty;var n=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch(e){}}();var i=function(e,t,r){if(n){Object.defineProperty(e,t,{configurable:true,writable:true,value:r})}else{e[t]=r}};e.WeakMap=function(){function WeakMap(){if(this===void 0){throw new TypeError("Constructor WeakMap requires 'new'")}i(this,"_id",genId("_WeakMap"));if(arguments.length>0){throw new TypeError("WeakMap iterable is not supported")}}i(WeakMap.prototype,"delete",function(e){checkInstance(this,"delete");if(!isObject(e)){return false}var t=e[this._id];if(t&&t[0]===e){delete e[this._id];return true}return false});i(WeakMap.prototype,"get",function(e){checkInstance(this,"get");if(!isObject(e)){return void 0}var t=e[this._id];if(t&&t[0]===e){return t[1]}return void 0});i(WeakMap.prototype,"has",function(e){checkInstance(this,"has");if(!isObject(e)){return false}var t=e[this._id];if(t&&t[0]===e){return true}return false});i(WeakMap.prototype,"set",function(e,t){checkInstance(this,"set");if(!isObject(e)){throw new TypeError("Invalid value used as weak map key")}var r=e[this._id];if(r&&r[0]===e){r[1]=t;return this}i(e,this._id,[e,t]);return this});function checkInstance(e,t){if(!isObject(e)||!r.call(e,"_id")){throw new TypeError(t+" method called on incompatible receiver "+typeof e)}}function genId(e){return e+"_"+rand()+"."+rand()}function rand(){return Math.random().toString().substring(2)}i(WeakMap,"_polyfill",true);return WeakMap}();function isObject(e){return Object(e)===e}}})(_gThis);

if(!Dynamsoft.Lib.jsinited){Dynamsoft.Lib.jsinited=1;
if(window) { window['SparkMD5']=(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a+=(b&c|~b&d)+k[0]-680876936|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[1]-389564586|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[2]+606105819|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[3]-1044525330|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[4]-176418897|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[5]+1200080426|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[6]-1473231341|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[7]-45705983|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[8]+1770035416|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[9]-1958414417|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[10]-42063|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[11]-1990404162|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[12]+1804603682|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[13]-40341101|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[14]-1502002290|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[15]+1236535329|0;b=(b<<22|b>>>10)+c|0;a+=(b&d|c&~d)+k[1]-165796510|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[6]-1069501632|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[11]+643717713|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[0]-373897302|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[5]-701558691|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[10]+38016083|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[15]-660478335|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[4]-405537848|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[9]+568446438|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[14]-1019803690|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[3]-187363961|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[8]+1163531501|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[13]-1444681467|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[2]-51403784|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[7]+1735328473|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[12]-1926607734|0;b=(b<<20|b>>>12)+c|0;a+=(b^c^d)+k[5]-378558|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[8]-2022574463|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[11]+1839030562|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[14]-35309556|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[1]-1530992060|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[4]+1272893353|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[7]-155497632|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[10]-1094730640|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[13]+681279174|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[0]-358537222|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[3]-722521979|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[6]+76029189|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[9]-640364487|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[12]-421815835|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[15]+530742520|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[2]-995338651|0;b=(b<<23|b>>>9)+c|0;a+=(c^(b|~d))+k[0]-198630844|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[7]+1126891415|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[14]-1416354905|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[5]-57434055|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[12]+1700485571|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[3]-1894986606|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[10]-1051523|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[1]-2054922799|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[8]+1873313359|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[15]-30611744|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[6]-1560198380|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[13]+1309151649|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[4]-145523070|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[11]-1120210379|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[2]+718787259|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[9]-343485551|0;b=(b<<21|b>>>11)+c|0;x[0]=a+x[0]|0;x[1]=b+x[1]|0;x[2]=c+x[2]|0;x[3]=d+x[3]|0}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64<n?a.subarray(i-64):new Uint8Array(0);length=a.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i<x.length;i+=1){x[i]=rhex(x[i])}return x.join("")}if(hex(md51("hello"))!=="5d41402abc4b2a76b9719d911017c592"){add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i<length;i+=1){arr[i]=str.charCodeAt(i)}return returnUInt8Array?arr:buff}function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}function hexToBinaryString(hex){var bytes=[],length=hex.length,x;for(x=0;x<length-1;x+=2){bytes.push(parseInt(hex.substr(x,2),16))}return String.fromCharCode.apply(String,bytes)}function SparkMD5(){this.reset()}SparkMD5.prototype.append=function(str){this.appendBinary(toUtf8(str));return this};SparkMD5.prototype.appendBinary=function(contents){this._buff+=contents;this._length+=contents.length;var length=this._buff.length,i;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk(this._buff.substring(i-64,i)))}this._buff=this._buff.substring(i-64);return this};SparkMD5.prototype.end=function(raw){var buff=this._buff,length=buff.length,i,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64<length?new Uint8Array(buff.buffer.slice(i-64)):new Uint8Array(0);return this};SparkMD5.ArrayBuffer.prototype.end=function(raw){var buff=this._buff,length=buff.length,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i,ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5})(); }

if(window && !window['Promise']){
/* @preserve
 * The MIT License (MIT)
 * 
 * Copyright (c) 2013-2018 Petka Antonov
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 */
/**
 * bluebird build version 3.7.2
 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
*/
!function(t){if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,n){"use strict";e.exports=function(t){function e(t){var e=new n(t),r=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),r}var n=t._SomePromiseArray;t.any=function(t){return e(t)},t.prototype.any=function(){return e(this)}}},{}],2:[function(t,e,n){"use strict";function r(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new f(16),this._normalQueue=new f(16),this._haveDrainedQueues=!1;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=p}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function o(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function s(t){this._normalQueue._pushOne(t),this._queueTick()}function a(t){for(;t.length()>0;)c(t)}function c(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),r=t.shift();e.call(n,r)}}var u;try{throw new Error}catch(l){u=l}var p=t("./schedule"),f=t("./queue");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n    See http://goo.gl/MqrFmX\n")}},r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=s,r.prototype._drainQueues=function(){a(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,a(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=u},{"./queue":26,"./schedule":29}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var u=n(o),l=new t(e);l._propagateFrom(this,1);var p=this._target();if(l._setBoundTo(u),u instanceof t){var f={promiseRejectionQueued:!1,promise:l,target:p,bindingPromise:u};p._then(e,s,void 0,l,f),u._then(a,c,void 0,l,f),l._setOnCancel(u)}else l._resolveCallback(p);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=s(t).call(this._boundValue());r===a&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,a){return function(c){var u=a._boundValue();t:for(var l=0;l<t.length;++l){var p=t[l];if(p===Error||null!=p&&p.prototype instanceof Error){if(c instanceof p)return o(n).call(u,c)}else if("function"==typeof p){var f=o(p).call(u,c);if(f===s)return f;if(f)return o(n).call(u,c)}else if(r.isObject(c)){for(var h=i(p),_=0;_<h.length;++_){var d=h[_];if(p[d]!=c[d])continue t}return o(n).call(u,c)}}return e}}var r=t("./util"),i=t("./es5").keys,o=r.tryCatch,s=r.errorObj;return n}},{"./es5":13,"./util":36}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return i?new e:void 0}function r(){var t=o.length-1;return t>=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,e){return{promise:e}}function s(){return!1}function a(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+B.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function c(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?B.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function u(){return this._onCancelField}function l(t){this._onCancelField=t}function p(){this._cancellationParent=void 0,this._onCancelField=void 0}function f(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function _(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function d(){this._trace=new V(this._peekContext())}function v(t,e){if(q(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=F(t);B.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),B.notEnumerableProp(t,"__stackCleaned__",!0)}}}function y(){this._trace=void 0}function g(t,e,n,r,i){if(void 0===t&&null!==e&&Z){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=k(a),u=c.length-1;u>=0;--u){var l=c[u];if(!Q.test(l)){var p=l.match(G);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var f=c[0],u=0;u<a.length;++u)if(a[u]===f){u>0&&(s="\n"+a[u-1]);break}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(h,!0,e)}}function m(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),b(n)}function b(t,n,r){if(lt.warnings){var i,o=new U(t);if(n)r._attachExtraTrace(o);else if(lt.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=F(o);o.stack=s.message+"\n"+s.stack.join("\n")}ot("warning",o)||x(o,"",!0)}}function w(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function C(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function j(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],s=-1,a=r.length-1;a>=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function k(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i="    (No stack trace)"===r||z.test(r),o=i&&at(r);i&&!o&&(W&&" "!==r.charAt(0)&&(r="    "+r),e.push(r))}return e}function E(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if("    (No stack trace)"===r||z.test(r))break}return n>0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function F(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?E(t):["    (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:k(e)}}function x(t,e,n){if("undefined"!=typeof console){var r;if(B.isObject(t)){var i=t.stack;r=e+X(i,t)}else r=e+String(t);"function"==typeof I?I(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function T(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){N.throwLater(o)}"unhandledRejection"===t?ot(t,n,r)||i||x(n,"Unhandled rejection "):ot(t,r)}function P(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():B.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+R(e)+">, no stack trace)"}function R(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function S(){return"function"==typeof ut}function O(t){var e=t.match(ct);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function A(t,e){if(S()){for(var n,r,i=(t.stack||"").split("\n"),o=(e.stack||"").split("\n"),s=-1,a=-1,c=0;c<i.length;++c){var u=O(i[c]);if(u){n=u.fileName,s=u.line;break}}for(var c=0;c<o.length;++c){var u=O(o[c]);if(u){r=u.fileName,a=u.line;break}}0>s||0>a||!n||!r||n!==r||s>=a||(at=function(t){if($.test(t))return!0;var e=O(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function V(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);ut(this,V),e>32&&this.uncycle()}var H,D,I,L,N=e._async,U=t("./errors").Warning,B=t("./util"),M=t("./es5"),q=B.canAttachTrace,$=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,Q=/\((?:timers\.js):\d+:\d+\)/,G=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,z=null,X=null,W=!1,K=!(0==B.env("BLUEBIRD_DEBUG")||!B.env("BLUEBIRD_DEBUG")&&"development"!==B.env("NODE_ENV")),J=!(0==B.env("BLUEBIRD_WARNINGS")||!K&&!B.env("BLUEBIRD_WARNINGS")),Y=!(0==B.env("BLUEBIRD_LONG_STACK_TRACES")||!K&&!B.env("BLUEBIRD_LONG_STACK_TRACES")),Z=0!=B.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(J||!!B.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){function t(){for(var t=0;t<r.length;++t)r[t]._notifyUnhandledRejection();n()}function n(){r.length=0}var r=[];L=function(e){r.push(e),setTimeout(t,1)},M.defineProperty(e,"_unhandledRejectionCheck",{value:t}),M.defineProperty(e,"_unhandledRejectionClear",{value:n})}(),e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),L(this))},e.prototype._notifyUnhandledRejectionIsHandled=function(){T("rejectionHandled",H,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),T("unhandledRejection",D,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return b(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var n=e._getContext();D=B.contextBind(n,t)},e.onUnhandledRejectionHandled=function(t){var n=e._getContext();H=B.contextBind(n,t)};var tt=function(){};e.longStackTraces=function(){if(N.haveItemsQueued()&&!lt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/MqrFmX\n");if(!lt.longStackTraces&&S()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace,i=e.prototype._dereferenceTrace;lt.longStackTraces=!0,tt=function(){if(N.haveItemsQueued()&&!lt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,e.prototype._dereferenceTrace=i,n.deactivateLongStackTraces(),lt.longStackTraces=!1},e.prototype._captureStackTrace=d,e.prototype._attachExtraTrace=v,e.prototype._dereferenceTrace=y,n.activateLongStackTraces()}},e.hasLongStackTraces=function(){return lt.longStackTraces&&S()};var et={unhandledrejection:{before:function(){var t=B.global.onunhandledrejection;return B.global.onunhandledrejection=null,t},after:function(t){B.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=B.global.onrejectionhandled;return B.global.onrejectionhandled=null,t},after:function(t){B.global.onrejectionhandled=t}}},nt=function(){var t=function(t,e){if(!t)return!B.global.dispatchEvent(e);var n;try{return n=t.before(),!B.global.dispatchEvent(e)}finally{t.after(n)}};try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r={detail:n,cancelable:!0},i=new CustomEvent(e,r);return M.defineProperty(i,"promise",{value:n.promise}),M.defineProperty(i,"reason",{value:n.reason}),t(et[e],i)}}if("function"==typeof Event){var e=new Event("CustomEvent");return B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=new Event(e,{cancelable:!0});return r.detail=n,M.defineProperty(r,"promise",{value:n.promise}),M.defineProperty(r,"reason",{value:n.reason}),t(et[e],r)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,!1,!0,n),t(et[e],r)}}catch(n){}return function(){return!1}}(),rt=function(){return B.isNode?function(){return process.emit.apply(process,arguments)}:B.global?function(t){var e="on"+t.toLowerCase(),n=B.global[e];return n?(n.apply(B.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),it={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:o},ot=function(t){var e=!1;try{e=rt.apply(null,arguments)}catch(n){N.throwLater(n),e=!0}var r=!1;try{r=nt(t,it[t].apply(null,arguments))}catch(n){N.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&tt()),"warnings"in t){var n=t.warnings;lt.warnings=!!n,Z=lt.warnings,B.isObject(n)&&"wForgottenReturn"in n&&(Z=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!lt.cancellation){if(N.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=p,e.prototype._propagateFrom=f,e.prototype._onCancel=u,e.prototype._setOnCancel=l,e.prototype._attachCancellationCallback=c,e.prototype._execute=a,st=f,lt.cancellation=!0}if("monitoring"in t&&(t.monitoring&&!lt.monitoring?(lt.monitoring=!0,e.prototype._fireEvent=ot):!t.monitoring&&lt.monitoring&&(lt.monitoring=!1,e.prototype._fireEvent=s)),"asyncHooks"in t&&B.nodeSupportsAsyncResource){var o=lt.asyncHooks,h=!!t.asyncHooks;o!==h&&(lt.asyncHooks=h,h?r():i())}return e},e.prototype._fireEvent=s,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._dereferenceTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var st=h,at=function(){return!1},ct=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;B.inherits(V,Error),n.CapturedTrace=V,V.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var u=c._length+1,l=r-2;l>=0;--l)e[l]._length=u,u++;return}}}},V.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=F(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(k(i.stack.split("\n"))),i=i._parent;j(r),C(r),B.notEnumerableProp(t,"stack",w(n,r)),B.notEnumerableProp(t,"__stackCleaned__",!0)}};var ut=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():P(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,z=t,X=e;var n=Error.captureStackTrace;return at=function(t){return $.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return z=/@/,X=e,W=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(X=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?P(e):e.toString()},null):(z=t,X=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(I=function(t){console.warn(t)},B.isNode&&process.stderr.isTTY?I=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:B.isNode||"string"!=typeof(new Error).stack||(I=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var lt={warnings:J,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return Y&&e.longStackTraces(),{asyncHooks:function(){return lt.asyncHooks},longStackTraces:function(){return lt.longStackTraces},warnings:function(){return lt.warnings},cancellation:function(){return lt.cancellation},monitoring:function(){return lt.monitoring},propagateFromFunction:function(){return st},boundValueFunction:function(){return _},checkForgottenReturns:g,setBounds:A,warn:b,deprecated:m,CapturedTrace:V,fireDomEvent:nt,fireGlobalEvent:rt}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return l(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,u=t("./util"),l=u.inherits,p=u.notEnumerableProp,f=r("Warning","warning"),h=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g<y.length;++g)"function"==typeof Array.prototype[y[g]]&&(d.prototype[y[g]]=Array.prototype[y[g]]);a.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var m=0;d.prototype.toString=function(){var t=Array(4*m+1).join(" "),e="\n"+t+"AggregateError of:\n";m++,t=Array(4*m+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];r=i.join("\n"),e+=r+"\n"}return m--,e},l(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:h,TimeoutError:_,OperationalError:i,RejectionError:i,AggregateError:d}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:o,RangeError:s,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:f}},{"./es5":13,"./util":36}],13:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,s={}.constructor.prototype,a=function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},c=function(t,e){return{value:t[e]}},u=function(t,e,n){return t[e]=n.value,t},l=function(t){return t},p=function(t){try{return Object(t).constructor.prototype}catch(e){return s}},f=function(t){try{return"[object Array]"===o.call(t)}catch(e){return!1}};e.exports={isArray:f,keys:a,names:a,defineProperty:u,getDescriptor:c,freeze:l,getPrototypeOf:p,isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.map;t.prototype.filter=function(t,r){return n(this,t,r,e)},t.filter=function(t,r,i){return n(t,r,i,e)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function o(t){this.finallyHandler=t}function s(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return u.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(f.e=t,f)}function u(t){var i=this.promise,u=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?u.call(i._boundValue()):u.call(i._boundValue(),t);if(l===r)return l;if(void 0!==l){i._setReturnedNonUndefined();var h=n(l,i);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),f.e=_,f}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),f.e=t,f):(s(this),t)}var l=t("./util"),p=e.CancellationError,f=l.errorObj,h=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,u,u)},e.prototype.tap=function(t){return this._passThrough(t,1,u)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,u);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!l.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+l.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(h(i,a,this),1,void 0,u)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o<n.length;++o){r._pushContext();var s=h(n[o])(t);if(r._popContext(),s===f){r._pushContext();var a=e.reject(f.e);return r._popContext(),a}var c=i(s,r);if(c instanceof e)return c}return null}function c(t,n,i,o){if(s.cancellation()){var a=new e(r),c=this._finallyPromise=new e(r);this._promise=a.lastly(function(){return c}),a._captureStackTrace(),a._setOnCancel(this)}else{var u=this._promise=new e(r);u._captureStackTrace()}this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(_):_,this._yieldedPromise=null,this._cancellationPhase=!1}var u=t("./errors"),l=u.TypeError,p=t("./util"),f=p.errorObj,h=p.tryCatch,_=[];p.inherits(c,o),c.prototype._isResolved=function(){return null===this._promise},c.prototype._cleanup=function(){this._promise=this._generator=null,s.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},c.prototype._promiseCancelled=function(){if(!this._isResolved()){var t,n="undefined"!=typeof this._generator["return"];if(n)this._promise._pushContext(),t=h(this._generator["return"]).call(this._generator,void 0),this._promise._popContext();else{var r=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),t=h(this._generator["throw"]).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(t)}},c.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=h(this._generator["throw"]).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},c.prototype.promise=function(){return this._promise},c.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},c.prototype._continue=function(t){var n=this._promise;if(t===f)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(t.e,!1);var r=t.value;if(t.done===!0)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(r);
var o=i(r,this._promise);if(!(o instanceof e)&&(o=a(o,this._yieldHandlers,this._promise),null===o))return void this._promiseRejected(new l("A value %s was yielded that could not be treated as a promise\n\n    See http://goo.gl/MqrFmX\n\n".replace("%s",String(r))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));o=o._target();var s=o._bitField;0===(50397184&s)?(this._yieldedPromise=o,o._proxy(this,null)):0!==(33554432&s)?e._async.invoke(this._promiseFulfilled,this,o._value()):0!==(16777216&s)?e._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled()},e.coroutine=function(t,e){if("function"!=typeof t)throw new l("generatorFunction must be a function\n\n    See http://goo.gl/MqrFmX\n");var n=Object(e).yieldHandler,r=c,i=(new Error).stack;return function(){var e=t.apply(this,arguments),o=new r(void 0,void 0,n,i),s=o.promise();return o._generator=e,o._promiseFulfilled(void 0),s}},e.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new l("expecting a function but got "+p.classString(t));_.push(t)},e.spawn=function(t){if(s.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof t)return n("generatorFunction must be a function\n\n    See http://goo.gl/MqrFmX\n");var r=new c(t,this),i=r.promise();return r._run(e.spawn),i}}},{"./errors":12,"./util":36}],17:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util");s.canEvaluate,s.tryCatch,s.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t),this._promise._captureStackTrace();var s=e._getContext();if(this._callback=u.contextBind(s,n),this._preservedValues=i===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0),u.isArray(t))for(var a=0;a<t.length;++a){var c=t[a];c instanceof e&&c.suppressUnhandledRejections()}}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var u=t("./util"),l=u.tryCatch,p=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var u=this._promise,f=this._callback,h=u._boundValue();u._pushContext();var _=l(f).call(h,t,n,o),d=u._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",u),_===p)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var g=++this._totalResolved;return g>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight<e;){if(this._isResolved())return;var r=t.pop();this._promiseFulfilled(n[r],r)}},a.prototype._filter=function(t,e){for(var n=e.length,r=new Array(n),i=0,o=0;n>o;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],l=arguments[2];c=s.isArray(u)?a(t).apply(l,u):a(t).call(l,u)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&l.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new u(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=l.keys(t),i=0;i<n.length;++i){var o=n[i];p.test(o)||(e[o]=t[o])}return e}return s.markAsOriginatingFromRejection(t),t}function o(t,e){return function(n,r){if(null!==t){if(n){var o=i(a(n));t._attachExtraTrace(o),t._reject(o)}else if(e){var s=[].slice.call(arguments,1);t._fulfill(s)}else t._fulfill(r);t=null}}}var s=t("./util"),a=s.maybeWrapAsError,c=t("./errors"),u=c.OperationalError,l=t("./es5"),p=/^(?:name|message|stack|cause)$/;e.exports=o},{"./errors":12,"./es5":13,"./util":36}],21:[function(t,e,n){"use strict";e.exports=function(e){function n(t,e){var n=this;if(!o.isArray(t))return r.call(n,t,e);var i=a(e).apply(n._boundValue(),[null].concat(t));i===c&&s.throwLater(i.e)}function r(t,e){var n=this,r=n._boundValue(),i=void 0===t?a(e).call(r,null):a(e).call(r,null,t);i===c&&s.throwLater(i.e)}function i(t,e){var n=this;if(!t){var r=new Error(t+"");r.cause=t,t=r}var i=a(e).call(n._boundValue(),t);i===c&&s.throwLater(i.e)}var o=t("./util"),s=e._async,a=o.tryCatch,c=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=r;void 0!==e&&Object(e).spread&&(o=n),this._then(o,i,void 0,this,t)}return this}}},{"./util":36}],22:[function(t,e,n){"use strict";e.exports=function(){function n(){}function r(t,e){if(null==t||(t.constructor!==i&&"undefined"!=typeof Promise&&t.constructor!==Promise))throw new E("the promise constructor cannot be invoked directly\n\n    See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new E("expecting a function but got "+f.classString(e))}function i(t){t!==x&&r(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(t){this.promise._resolveCallback(t)}function s(t){this.promise._rejectCallback(t,!1)}function a(t){var e=new i(x);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var c=function(){return new E("circular promise resolution chain\n\n    See http://goo.gl/MqrFmX\n")},u=function(){return new i.PromiseInspection(this._target())},l=function(t){return i.reject(new E(t))},p={},f=t("./util");f.setReflectHandler(u);var h=function(){var t=process.domain;return void 0===t?null:t},_=function(){return null},d=function(){return{domain:h(),async:null}},v=f.isNode&&f.nodeSupportsAsyncResource?t("async_hooks").AsyncResource:null,y=function(){return{domain:h(),async:new v("Bluebird::Promise")}},g=f.isNode?d:_;f.notEnumerableProp(i,"_getContext",g);var m=function(){g=y,f.notEnumerableProp(i,"_getContext",y)},b=function(){g=d,f.notEnumerableProp(i,"_getContext",d)},w=t("./es5"),C=t("./async"),j=new C;w.defineProperty(i,"_async",{value:j});var k=t("./errors"),E=i.TypeError=k.TypeError;i.RangeError=k.RangeError;var F=i.CancellationError=k.CancellationError;i.TimeoutError=k.TimeoutError,i.OperationalError=k.OperationalError,i.RejectionError=k.OperationalError,i.AggregateError=k.AggregateError;var x=function(){},T={},P={},R=t("./thenables")(i,x),S=t("./promise_array")(i,x,R,l,n),O=t("./context")(i),A=O.create,V=t("./debuggability")(i,O,m,b),H=(V.CapturedTrace,t("./finally")(i,R,P)),D=t("./catch_filter")(P),I=t("./nodeback"),L=f.errorObj,N=f.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype["catch"]=function(t){var e=arguments.length;if(e>1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return l("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}if(r.length=i,t=arguments[n],"function"!=typeof t)throw new E("The last argument to .catch() must be a function, got "+f.toString(t));return this.then(void 0,D(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(V.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?l("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,T,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new S(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(x);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=N(t)(I(e,n));return r===L&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new S(t).promise()},i.cast=function(t){var e=R(t);return e instanceof i||(e=new i(x),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(x);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new E("expecting a function but got "+f.classString(t));return j.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(x),c=this._target(),u=c._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():c===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var l=g();if(0!==(50397184&u)){var p,h,_=c._settlePromiseCtx;0!==(33554432&u)?(h=c._rejectionHandler0,p=t):0!==(16777216&u)?(h=c._fulfillmentHandler0,p=e,c._unsetRejectionIsUnhandled()):(_=c._settlePromiseLateCancellationObserver,h=new F("late cancellation observer"),c._attachExtraTrace(h),p=e),j.invoke(_,c,{handler:f.contextBind(l,p),promise:a,receiver:r,value:h})}else c._addCallbacks(t,e,a,r,l);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){if(!j.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},i.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&(536870912|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===p?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=p),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=p),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=f.contextBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=f.contextBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=f.contextBind(i,t)),"function"==typeof e&&(this[s+1]=f.contextBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=R(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(c());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(n)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var u=new F("late cancellation observer");r._attachExtraTrace(u),this._reject(u)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&V.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==x){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===T?n&&"number"==typeof n.length?o=N(t).apply(this._boundValue(),n):(o=L,o.e=new E("cannot .spread() a non-array: "+f.classString(n))):o=N(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===P?r._reject(n):o===L?r._rejectCallback(o.e,!1):(V.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof H&&r.isFinallyHandler()?(r.cancelPromise=t,N(e).call(r,o)===L&&t._reject(L.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof S?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():j.settlePromises(this),this._dereferenceTrace())}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?j.fatalError(t,f.isNode):void((65535&e)>0?j.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&w.defineProperty(i.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),i.defer=i.pending=function(){V.deprecated("Promise.defer","new Promise");var t=new i(x);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",c),t("./method")(i,x,R,l,V),t("./bind")(i,x,R,V),t("./cancel")(i,S,l,V),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,S,R,x,j),i.Promise=i,i.version="3.7.2",t("./call_get.js")(i),t("./generators.js")(i,l,x,R,n,V),t("./map.js")(i,S,l,R,x,V),t("./nodeify.js")(i),t("./promisify.js")(i,x),t("./props.js")(i,S,R,l),t("./race.js")(i,x,R,l),t("./reduce.js")(i,S,l,R,x,V),t("./settle.js")(i,S,V),t("./some.js")(i,S,l),t("./timers.js")(i,x,V),t("./using.js")(i,l,R,A,x,V),t("./any.js")(i),t("./each.js")(i,x),t("./filter.js")(i,x),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(x)),V.setBounds(C.firstLineError,f.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,async_hooks:void 0}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&(r._propagateFrom(t,3),t.suppressUnhandledRejections()),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function u(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(u,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var l=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(l,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(t){return t},a}},{"./util":36}],24:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){return!C.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,n){var r=h.getDataPropertyOrDefault(t,e+n,b);return r?i(r):!1}function s(t,e,n){for(var r=0;r<t.length;r+=2){var i=t[r];if(n.test(i))for(var o=i.replace(n,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new g("Cannot promisify an API that has normal methods with '%s'-suffix\n\n    See http://goo.gl/MqrFmX\n".replace("%s",e))}}function a(t,e,n,r){for(var a=h.inheritedDataKeys(t),c=[],u=0;u<a.length;++u){var l=a[u],p=t[l],f=r===j?!0:j(l,p,t);"function"!=typeof p||i(p)||o(t,l,e)||!r(l,p,t,f)||c.push(l,p)}return s(c,e,n),c}function c(t,r,i,o,s,a){function c(){var i=r;r===f&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof l&&this!==u?this[l]:t,c=_(o,a);try{s.apply(i,d(arguments,c))}catch(p){o._rejectCallback(v(p),!0,!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var u=function(){return this}(),l=t;return"string"==typeof l&&(t=o),h.notEnumerableProp(c,"__isPromisified__",!0),c}function u(t,e,n,r,i){for(var o=new RegExp(k(e)+"$"),s=a(t,e,o,n),c=0,u=s.length;u>c;c+=2){var l=s[c],p=s[c+1],_=l+e;if(r===E)t[_]=E(l,f,l,p,e,i);else{var d=r(p,function(){return E(l,f,l,p,e,i)});h.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return h.toFastProperties(t),t}function l(t,e,n){return E(t,e,void 0,t,null,n)}var p,f={},h=t("./util"),_=t("./nodeback"),d=h.withAppended,v=h.maybeWrapAsError,y=h.canEvaluate,g=t("./errors").TypeError,m="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return h.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},k=function(t){return t.replace(new Regexp("([$])","g"),"\\$")},E=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new g("expecting a function but got "+h.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?f:e.context,o=!!e.multiArgs,s=l(t,n,o);return h.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new g("the target of promisifyAll must be an object or a function\n\n    See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=m);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=E),!h.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n    See http://goo.gl/MqrFmX\n");for(var s=h.inheritedDataKeys(t),a=0;a<s.length;++a){var c=t[s[a]];"constructor"!==s[a]&&h.isClass(c)&&(u(c.prototype,r,i,o,n),u(c,r,i,o,n))}return u(t,r,i,o,n)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t){var e,n=!1;if(void 0!==a&&t instanceof a)e=p(t),n=!0;else{var r=l.keys(t),i=r.length;e=new Array(2*i);for(var o=0;i>o;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return u(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n    See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),u=c.isObject,l=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),f=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=f(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity<t},i.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var n=this._front+e&this._capacity-1;this[n]=t,this._length=e+1},i.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},i.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(t=s.asArray(t),null===t)return i("expecting an array or an iterable object but got "+s.classString(t));var u=new e(n);void 0!==o&&u._propagateFrom(o,3);for(var l=u._fulfill,p=u._reject,f=0,h=t.length;h>f;++f){var _=t[f];(void 0!==_||f in t)&&e.cast(_)._then(l,p,void 0,u,null)}return u}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=e._getContext();this._fn=f.contextBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function u(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function l(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=h(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var f=t("./util"),h=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n;for(var o=r;i>o;++o){var s=t[o];s instanceof e&&s.suppressUnhandledRejections()}if(!n.isRejected())for(;i>r;++r){var a={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(l,void 0,void 0,a,void 0),0===(127&r)&&n._setNoAsyncGuarantee()}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return u(this,t,e,null)},e.reduce=function(t,e,n,r){return u(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n    See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){
var u=s.resolve();r=function(t){u.then(t)}}else r="undefined"!=typeof MutationObserver&&("undefined"==typeof window||!window.navigator||!window.navigator.standalone&&!window.cordova)&&"classList"in document.documentElement?function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}():"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o;e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.allSettled=function(t){return new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n    See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,u=s.isArray,l={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=u(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e<this._values.length;++e)this._values[e]!==l&&t.push(this._values[e]);return t.length>0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n    See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n    See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(l(t)){if(t instanceof e)return t;var i=o(t);if(i===u){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return u.e=e,u}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),l=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,f=c.tryCatch(r).call(t,o,s);return p=!1,a&&f===u&&(a._rejectCallback(f.e,!0,!0),a=null),l}var c=t("./util"),u=c.errorObj,l=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var u=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(u,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return l(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function u(t,n){function i(){if(s>=u)return l._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,u=t.length,l=new e(o);return i(),l}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function f(t){return l.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function h(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,g=_.tryCatch,m={};l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():m},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==m?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,l),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},h.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new h(t),p=0;t>p;++p){var d=o[p];if(l.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var m=r(d);m instanceof e&&(d=m._then(f,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p<b.length;++p)b[p]=e.resolve(c[p]).reflect();var w=e.all(b).then(function(t){for(var e=0;e<t.length;++e){var n=t[e];if(n.isRejected())return y.e=n.error(),y;if(!n.isFulfilled())return void w.cancel();t[e]=n.value()}C._pushContext(),i=g(i);var r=a?i.apply(void 0,t):i(t),o=C._popContext();return s.checkForgottenReturns(r,o,"Promise.using",C),r}),C=w.lastly(function(){var t=new e.PromiseInspection(w);return u(c,t)});return c.promise=C,C._setOnCancel(c),C},e.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(131072&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function u(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function l(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function f(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function h(t){function e(){}function n(){return typeof r.foo}e.prototype=t;var r=new e;return n(),n(),t}function _(t){return V.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{l(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{F.defineProperty(e,o,F.getDescriptor(t,o))}catch(s){}}}function j(t){return N?process.env[t]:void 0}function k(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"===w(t))return Promise}catch(e){}}function E(t,e){if(null===t||"function"!=typeof e||e===U)return e;null!==t.domain&&(e=t.domain.bind(e));var n=t.async;if(null!==n){var r=e;e=function(){var t=new Array(2).concat([].slice.call(arguments));return t[0]=r,t[1]=this,n.runInAsyncScope.apply(n,t)}}return e}var F=t("./es5"),x="undefined"==typeof navigator,T={e:{}},P,R="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,S=function(t,e){function n(){this.constructor=t,this.constructor$=e;for(var n in e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},O=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(F.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(s){return r}for(var a=0;a<o.length;++a){var c=o[a];if(!i[c]){i[c]=!0;var u=Object.getOwnPropertyDescriptor(t,c);null!=u&&null==u.get&&null==u.set&&r.push(c)}}t=F.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var s=0;s<t.length;++s)if(r.call(t[s],o))continue t;i.push(o)}return i}}(),A=/this\s*\.\s*\S+\s*=/,V=/^[a-z$_][a-z$_0-9]*$/i,H=function(){return"stack"in new Error?function(t){return b(t)?t:new Error(v(t))}:function(t){if(b(t))return t;try{throw new Error(v(t))}catch(e){return e}}}(),D=function(t){return F.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var I="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n};D=function(t){return F.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?I(t):null}}var L="undefined"!=typeof process&&"[object process]"===w(process).toLowerCase(),N="undefined"!=typeof process&&"undefined"!=typeof process.env,U,B={setReflectHandler:function(t){U=t},isClass:f,isIdentifier:_,inheritedDataKeys:O,getDataPropertyOrDefault:u,thrower:p,isArray:F.isArray,asArray:D,notEnumerableProp:l,isPrimitive:o,isObject:s,isError:y,canEvaluate:x,errorObj:T,tryCatch:i,inherits:S,withAppended:c,maybeWrapAsError:a,toFastProperties:h,filledRange:d,toString:v,canAttachTrace:b,ensureErrorObject:H,originatesFromRejection:m,markAsOriginatingFromRejection:g,classString:w,copyDescriptors:C,isNode:L,hasEnvVariables:N,env:j,global:R,getNativePromise:k,contextBind:E};B.isRecentNode=B.isNode&&function(){var t;return process.versions&&process.versions.node?t=process.versions.node.split(".").map(Number):process.version&&(t=process.version.split(".").map(Number)),0===t[0]&&t[1]>10||t[0]>0}(),B.nodeSupportsAsyncResource=B.isNode&&function(){var e=!1;try{var n=t("async_hooks").AsyncResource;e="function"==typeof n.prototype.runInAsyncScope}catch(r){e=!1}return e}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(M){B.lastLineError=M}e.exports=B},{"./es5":13,async_hooks:void 0}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
}
!function(){"use strict";function e(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=o(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==t["return"]||t["return"]()}finally{if(u)throw a}}}}function r(e){if(null!=e){var r=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],t=0;if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}}throw new TypeError(C(e)+" is not iterable")}function t(e,r,t,i){var o=n(c(1&i?e.prototype:e),r,t);return 2&i&&"function"==typeof o?function(e){return o.apply(t,e)}:o}function n(){return n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,r,t){var n=function(e,r){for(;!{}.hasOwnProperty.call(e,r)&&null!==(e=c(e)););return e}(e,r);if(n){var i=Object.getOwnPropertyDescriptor(n,r);return i.get?i.get.call(arguments.length<3?e:t):i.value}},n.apply(null,arguments)}function i(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(s.push(n.value),s.length!==r);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=t["return"]&&(a=t["return"](),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,r)||o(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,r){if(e){if("string"==typeof e)return a(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function s(e,r,t){return r=c(r),function(e,r){if(r&&("object"==C(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(r,t||[],c(e).constructor):r.apply(e,t))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function l(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&f(e,r)}function f(e,r){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},f(e,r)}function d(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(t,n,i,o){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return h(c,"_invoke",function(t,n,i){var o,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(r,t){return o=r,s=0,u=e,d.n=t,a}};function h(t,n){for(s=t,u=n,r=0;!f&&c&&!i&&r<l.length;r++){var i,o=l[r],h=d.p,g=o[2];t>3?(i=g===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=t<2&&h<o[1])?(s=0,d.v=n,d.n=o[1]):h<g&&(i=t<3||o[0]>n||n>g)&&(o[4]=t,o[5]=n,d.n=g,s=0))}if(i||t>1)return a;throw f=!0,n}return function(i,l,g){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,g),s=l,u=g;(r=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(i="next"),r=o[i]){if(!(r=r.call(o,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,s<2&&(s=0)}else 1===s&&(r=o["return"])&&r.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((r=(f=d.n<0)?u:t.call(n,d))!==a)break}catch(r){o=e,s=1,u=r}finally{c=1}}return{value:r,done:f}}}(t,i,o),!0),c}var a={};function s(){}function u(){}function c(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(h(r={},n,function(){return this}),r),f=c.prototype=s.prototype=Object.create(l);function g(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,h(f,"constructor",c),h(c,"constructor",u),u.displayName="GeneratorFunction",h(c,i,"GeneratorFunction"),h(f),h(f,i,"Generator"),h(f,n,function(){return this}),h(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:o,m:g}})()}function h(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}h=function(e,r,t,n){function o(r,t){h(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))},h(e,r,t,n)}function g(e,r){(function(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,r),r.add(e)}function v(e,r,t){if("function"==typeof e?e===r:e.has(r))return arguments.length<3?r:t;throw new TypeError("Private element is not present on this object")}function m(e,r,t,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,i)}function p(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){m(o,n,i,a,s,"next",e)}function s(e){m(o,n,i,a,s,"throw",e)}a(void 0)})}}function _(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function y(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function S(e,r,t){return r&&y(e.prototype,r),t&&y(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function I(e,r,t){return(r=b(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function b(e){var r=function(e,r){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==C(r)?r:r+""}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}var T;function w(e){var r=e?new Date(e):new Date,t="yyyy-MM-dd HH:mm:ss.SSSZ",n={"M+":r.getUTCMonth()+1,"d+":r.getUTCDate(),"H+":r.getUTCHours(),"h+":r.getUTCHours()%12||12,"m+":r.getUTCMinutes(),"s+":r.getUTCSeconds(),"q+":Math.floor((r.getUTCMonth()+3)/3),"S+":r.getUTCMilliseconds()};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(r.getUTCFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?String(n[i]):("000"+n[i]).substr(("000"+n[i]).length-RegExp.$1.length)));return t}T="object"===("undefined"==typeof window?"undefined":C(window))?window:{};var A=undefined;function E(e){return e===A}function k(e){return e!==A}function P(e){return null===e}var F={"[object Function]":"function","[object AsyncFunction]":"function","[object String]":"string","[object Object]":"object","[object Boolean]":"boolean","[object Number]":"number","[object Array]":"array"};function D(e){return P(e)||E(e)?String(e):F[{}.toString.call(e)]||"object"}function x(e){return"function"===D(e)}function O(e){return"string"===D(e)}function N(e){return"object"===D(e)}function R(e){return"boolean"===D(e)}function W(e){return"number"===D(e)}function M(e){return Array.isArray?Array.isArray(e):"array"===D(e)}function L(e){if(null==e)return[];if(M(e))return e;var r=C(e.length),t=C(e);if("number"!==r||e.alert||"string"===t||"function"===t&&(!("item"in e)||"number"!==r))return[e];for(var n=[],i=0,o=e.length;i<o;i++)n[i]=e[i];return n}var B,U,V={debug:!1,bShowConsoleError:!1};function j(){return B}function H(e){B=e}function G(){if(V.debug&&U&&x(U.log)){for(var e=w((new Date).getTime()),r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var i=L(t);U.log("[".concat(e,"] ").concat(i))}}function z(){if((V.debug||V.bShowConsoleError)&&U&&x(U.error)){for(var e=w((new Date).getTime()),r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var i=L(t);U.error("[".concat(e,"] ").concat(i))}}function K(){if(V.debug&&U&&x(U.warn)){for(var e=w((new Date).getTime()),r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var i=L(t);U.warn("[".concat(e,"] ").concat(i))}}function J(){if(V.debug&&U&&x(U.info)){for(var e=w((new Date).getTime()),r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var i=L(t);U.info("[".concat(e,"] ").concat(i))}}T&&k(T.console)&&(!(U=T.console)||x(U.log)&&x(U.error)||(U=!1),B={log:G,error:z,info:J,warn:K,debug:function(){if(V.debug&&U&&x(U.debug)){for(var e=w((new Date).getTime()),r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var i=L(t);U.debug("[".concat(e,"] ").concat(i))}},trace:function(){if(V.debug&&U&&x(U.trace)){for(var e=w((new Date).getTime()),r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var i=L(t);U.trace("[".concat(e,"] ").concat(i))}}});var Q={queue:[],doNextStarted:!1,timer:null,pushToDo:function(e,r,t){Q.queue.push({obj:e,method:r,args:t})},doNext:function(){if(Q.doNextStarted)if(0!==Q.queue.length){var e=Q.queue[0],r=e.obj,t=e.method,n=e.args;if(Q.queue.splice(0,1),r&&"string"==typeof t&&x(r[t])){var i=!1;if(n&&n.length>2){var o=n[n.length-2],a=n[n.length-1];x(o)&&x(a)&&(n[n.length-2]=function(){try{o.apply(r,arguments)}catch(hH){}Q.timer=setTimeout(Q.doNext,0)},n[n.length-1]=function(){try{a.apply(r,arguments)}catch(hH){}Q.timer=setTimeout(Q.doNext,0)},i=!0)}try{r[t].apply(r,n)}catch(hH){}i||(Q.timer=setTimeout(Q.doNext,0))}else if(null===r&&x(t)){try{t.apply(null,n)}catch(hH){}Q.timer=setTimeout(Q.doNext,0)}else G("not invoke a function: "+t),Q.timer=setTimeout(Q.doNext,0)}else Q.stop();else Q.stop()},start:function(){Q.doNextStarted||(Q.doNextStarted=!0,Q.timer=setTimeout(Q.doNext,0))},stop:function(){null!==Q.timer&&clearTimeout(Q.timer),Q.timer=null,Q.doNextStarted=!1,Q.queue=[]}};function q(e){return Math.random().toString(16).substring(2,2+e)}function Y(e){var r=[q(8),"-",q(4),"-",q(4),"-",q(4),"-",q(8)];return e&&r.unshift(e),r.join("")}var X=function(){return S(function e(){_(this,e),I(this,"handlers",void 0),this.handlers={}},[{key:"fire",value:function(e,r){var t=this.handlers[e.toLowerCase()];if(t){for(var n=0,i=0;n<t.length;n++){var o=t[n];try{o.handler.apply(o.context,[r]),i++}catch(hH){G(hH)}}return i}return 0}},{key:"emit",value:function(e){return this.fire(e)}},{key:"on",value:function(e,r,t){var n,i=Y(),o=e.toLowerCase();return this.handlers[o]=null!==(n=this.handlers[o])&&void 0!==n?n:[],this.handlers[o].push({id:i,handler:r,context:t}),i}},{key:"off",value:function(e,r){var t,n=e.toLowerCase(),i=this.handlers[n];if(i)if(r){for(t=i.length-1;t>=0;t--)if(i[t].id==r){i.splice(t,1);break}}else i.splice(0),delete this.handlers[n]}},{key:"clear",value:function(){this.handlers={}}}])}(),Z="";var $,ee=navigator,re=!0,te="";if("userAgentData"in ee){var ne=ee.userAgentData,ie=[];ne.platform&&""!=ne.platform&&("brands"in ne&&Array.isArray(ne.brands)&&ne.brands.length>0?ie=ne.brands:"uaList"in ne&&Array.isArray(ne.uaList)&&ne.uaList.length>0&&(ie=ne.uaList),ie.length>0&&(re=!1,te=ne.platform.toLowerCase(),$=function(e,r,t){var n,i,o,a,s,u,c,l,f,d=!1,h=!1,g=!1,v=e.mobile,m=!1,p=Z,_=navigator.maxTouchPoints||0;for(i=r.length,n=0;n<i;n++){var y=r[n].brand.toLowerCase();if(y.indexOf("chrome")>=0){g=!0,p=r[n].version;break}if(y.indexOf("edge")>=0){d=!0,p=r[n].version;break}if(y.indexOf("opera")>=0){h=!0,p=r[n].version;break}if(y.indexOf("chromium")>=0){g=!0,p=r[n].version;break}}return g||d||h||(g=!0,p="100"),o=/windows/g.test(t),a=/mac/g.test(t),s=/linux/g.test(t),u=/android/g.test(t),c=/harmony/g.test(t),l=/(chromeos|chrome\sos)/g.test(t),f=/iphone/g.test(t),o||u||s||f||(m=/macintel/g.test(t)&&_>1),(u||c||f||m)&&(v=!0),{bUseUserAgent:!1,bWin:o,bMac:a,bLinux:s,bAndroid:u,bHarmonyOS:c,bChromeOS:l,bIE:!1,bEdge:d,bUC:!1,bPlaybook:!1,bBlackBerry:!1,bHuaWeiBrowser:!1,bOpera:h,bFirefox:!1,bChrome:g,bJSDom:!1,biPhone:f,biPad:m,bPad:u&&!e.mobile,bSafari:!1,bMobile:v,strBrowserVersion:p,bHTML5Edition:!0,IEVersion:0,IEMode:0}}(ne,ie,te)))}re&&($=function(e,r){var t,n=e.toLowerCase(),i=r.toLowerCase(),o=/harmonyos/g.test(n);"linux"==i&&n.indexOf("windows nt")>=0&&(i="harmonyos",o=!0);var a=!o&&/cros/.test(n),s=!o&&/android/g.test(n)||/android/g.test(i),u=/iphone/g.test(n)||/iphone/g.test(i),c=/macintosh/.test(n),l=navigator.maxTouchPoints||0,f=/ipad/g.test(n)||(c||"macintel"==i)&&l>1,d=/ucweb|ucbrowser/g.test(n),h=!d&&/nexus/g.test(n)&&/version\/[\d.]+.*safari\//g.test(n),g=/playbook/g.test(n),v=/hp-tablet/g.test(n),m=/blackberry|bb10/g.test(n),p=/symbian/g.test(n),_=/windows phone/g.test(n),y=/mobile/g.test(n),S=/arm64|aarch64/g.test(n),I=/mips64/g.test(n),b=/huaweibrowser/g.test(n),C=/jsdom/g.test(n),w=g||f||v,A=!w&&!a&&(u||h||m||p||_||s||o||y),E=!A&&!w&&!a,k=E&&/win32|win64|windows/.test(i),P=k&&/win64|x64/.test(n),F=E&&/mac68k|macppc|macintosh|macintel/.test(n),D=E&&/linux/.test(i),x="win64"==i||/wow64|x86_64|win64|x64/.test(n)||S||I,O=/wow64/g.test(n),N=!1,R=/opera|opr/g.test(n),W=/360se/g.test(n),M=/maxthon/g.test(n),L=/tencenttraveler|qqbrowser/g.test(n),B=/the world/g.test(n),U=/metasr/g.test(n),V=/avant/g.test(n),j=/firefox|fxios/g.test(n),H=/gecko/g.test(n),G=!(j||b)&&/edge\/|edga\/|edgios\/|edg\//g.test(n),z=!(m||g||d||R||G||b||C)&&/chrome|crios/g.test(n),K=!1,J=Z,Q=0,q=0,Y=Z;if(k&&!G&&!j&&!z){var X=n.indexOf("msie "),$=n.indexOf("trident"),ee=n.indexOf("rv:");K=-1!=X||-1!=$||-1!=ee}if(!(F||u||f||k||m||g||h)||d||R||G||K||j||(t=n.match(/version\/([\d.]+).*safari\//))&&(m||g||h||(N=!0,z=!1),Y=t[1]),G){var re=n.indexOf("edge/");re>-1?re+=5:(re=n.indexOf("edg/"))>-1?re+=4:(re=n.indexOf("edga/"))>-1?re+=5:(re=n.indexOf("edgios/"))>-1&&(re+=7),re>-1&&(t=(Y=n.slice(re)).indexOf(" "))>-1&&(Y=Y.slice(0,t))}else if(j)if((t=n.indexOf("firefox/"))>-1){var te=(t=n.slice(t+8)).indexOf(" ");te>-1&&(t=t.slice(0,te)),Y=t,(te=t.indexOf("."))>-1&&(t=Y.slice(0,te))}else(u||f)&&(t=n.indexOf("fxios/"))>-1&&(Y=t=(t=n.slice(t+6)).slice(0,t.indexOf(" ")));else if(K){var ne=n.indexOf("msie "),ie=n.indexOf("trident"),oe=n.indexOf("rv:");-1!=ne?J=t=(t=n.slice(ne+5)).slice(0,t.indexOf(";")):-1!=oe?J=t=(t=(t=n.slice(oe+3)).slice(0,t.indexOf(";"))).slice(0,t.indexOf(")")):-1!=ie&&(J=t=(t=n.slice(ie+7)).slice(0,t.indexOf(";"))),Y=t}else if(N)(t=Y.indexOf("."))>-1&&(t=Y.slice(0,t));else if(d)(t=n.indexOf("ucweb"))>-1?Y=n.slice(t+5):(t=n.indexOf("ucbrowser/"))>-1&&(t=(Y=n.slice(t+10)).indexOf(" "))>-1&&(Y=Y.slice(0,t));else if(R)(t=n.indexOf("version/"))>-1?Y=n.slice(t+8):(t=n.indexOf("opr/"))>-1&&(Y=n.slice(t+4));else if(p)(t=n.indexOf("browserng/"))>-1&&(Y=n.slice(t+10));else if(_)(t=n.indexOf("iemobile/"))>-1&&(Y=n.slice(t+9));else if(z){var ae=n.indexOf("chrome/");ae>-1?(t=(Y=n.slice(ae+7)).indexOf(" "))>-1&&(Y=Y.slice(0,t)):(ae=n.indexOf("crios/"))>-1&&(t=(Y=n.slice(ae+6)).indexOf(" "))>-1&&(Y=Y.slice(0,t)),(t=Y.indexOf("."))>-1&&(t=Y.slice(0,t))}else if(b){var se=n.indexOf("huaweibrowser");se>-1&&(t=(Y=n.slice(se+14)).indexOf(" "))>-1&&(Y=Y.slice(0,t))}else if(C){var ue=n.indexOf("jsdom");ue>-1&&(t=(Y=n.slice(ue+6)).indexOf(" "))>-1&&(Y=Y.slice(0,t))}if(G||K){var ce=window.document;ce&&ce.documentMode?Q=ce.documentMode:(Q=5,ce.compatMode&&"CSS1Compat"==ce.compatMode&&(Q=7)),K&&(q=parseInt(Y))}(F||D)&&(x=!0,F&&(t=n.match(/mac os x (\d+)(_|\.)(\d+)/))&&t.length>3&&(10==parseInt(t[1])&&parseInt(t[3])<14||parseInt(t[1])<10)&&(x=!1)),k||F||D||S||I||(A=!0);var le=!0;if(K)if(""===J||parseInt(J)>=10){var fe=T.Dynamsoft;fe&&fe.DWT&&fe.DWT.IfUseActiveXForIE10Plus&&(le=!1)}else le=!1;return{bUseUserAgent:!0,bWin:k,bMac:F,bLinux:D,bMobile:A,bPad:w,bChromeOS:a,bHarmonyOS:o,bArm64:S,bMips64:I,bEmbed:S||I,bAndroid:s,biPhone:u,biPad:f,bWin64:P,bWOW64:O,bOSx64:x,bIE:K,bEdge:G,bChrome:z,bFirefox:j,bSafari:N,bOpera:R,bNexus:h,bUC:d,b360SE:W,bMaxthon:M,bTencentTraveler:L,bTheWorld:B,bMetaSr:U,bAvant:V,bHuaWeiBrowser:b,bJSDom:C,bGecko:H,bHTML5Edition:le,strBrowserVersion:Y,IEVersion:q,IEMode:Q}}(ee.userAgent.toLowerCase(),ee.platform.toLowerCase()));if($){var oe,ae=null===(oe=document)||void 0===oe||null===(oe=oe.location)||void 0===oe?void 0:oe.protocol;ae||(ae="https:"),$.protocol=ae,$.bSSL="https:"===ae,$.bFileSystem="https:"!==ae&&"http:"!==ae}var se=$;function ue(e){return se.bGecko&&"mousewheel"===e?"DOMMouseScroll":e}function ce(e,r,t){var n=ue(r);e&&e.addEventListener(n,t,!1)}function le(e,r,t){var n=ue(r);e&&e.removeEventListener(n,t||null,!1)}function fe(e){var r=e||T.event;r&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),r.returnValue=!1,r.cancelBubble=!0)}function de(e,r){var t=T.document.createEvent("HTMLEvents");t.initEvent(e,!0,!0),r.dispatchEvent&&r.dispatchEvent(t)}var he,ge,ve,me,pe=T.document,_e=[],ye=_e.push,Se=_e.slice,Ie=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,be=function(){ge()};function Ce(e,r,t,n){var i,o,a,s=r&&r.ownerDocument,u=r?r.nodeType:9;if(t=t||[],"string"!=typeof e||!e||1!==u&&9!==u&&11!==u)return t;if(!n&&((r?r.ownerDocument||r:pe)!==ve&&ge(r),r=r||ve,11!==u&&(a=Ie.exec(e))))if(i=a[1]){if(9===u){if(!(o=r.getElementById(i)))return t;if(o.id===i)return t.push(o),t}else if(s&&(o=s.getElementById(i))&&me(r,o)&&o.id===i)return t.push(o),t}else{if(a[2])return ye.apply(t,r.getElementsByTagName(e)),t;if((i=a[3])&&r.getElementsByClassName)return ye.apply(t,r.getElementsByClassName(i)),t}return t}ye.apply(Se.call(pe.childNodes),pe.childNodes),ge=Ce.setDocument=function(e){var r,t=e?e.ownerDocument||e:pe;return t!==ve&&9===t.nodeType&&t.documentElement?(pe!==(ve=t)&&(r=ve.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",be,!1):r.attachEvent&&r.attachEvent("onunload",be)),me=function(e,r){if(r)for(;r=r.parentNode;)if(r===e)return!0;return!1},ve):ve},Ce.contains=function(e,r){return(e.ownerDocument||e)!==ve&&ge(e),me(e,r)},Ce.error=function(e){throw new Error("Syntax error: "+e)},he=Ce.getText=function(e){var r,t="",n=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)t+=he(e)}else if(3===i||4===i)return e.nodeValue}else for(;r=e[n++];)t+=he(r);return t},ge();var Te={encodeChars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeChars:[-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1]},we={UTF16ToUTF8:function(e){for(var r,t,n=[],i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o);if(a>0&&a<=127)n.push(e.charAt(o));else if(a>=128&&a<=2047)r=192|a>>6&31,t=128|63&a,n.push(String.fromCharCode(r),String.fromCharCode(t));else if(a>=2048&&a<=65535){r=224|a>>12&15,t=128|a>>6&63;var s=128|63&a;n.push(String.fromCharCode(r),String.fromCharCode(t),String.fromCharCode(s))}}return n.join("")},UTF8ToUTF16:function(e){var r,t,n,i,o=[],a=e.length;for(r=0;r<a;r++)(t=e.charCodeAt(r))>>7&255?6==(t>>5&255)?(i=(31&t)<<6|63&(n=e.charCodeAt(++r)),o.push(String.fromCharCode(i))):14==(t>>4&255)&&(i=(255&(t<<4|(n=e.charCodeAt(++r))>>2&15))<<8|((3&n)<<6|63&e.charCodeAt(++r)),o.push(String.fromCharCode(i))):o.push(e.charAt(r));return o.join("")},encode:function(e){for(var r,t,n,i=this.UTF16ToUTF8(e),o=[],a=0,s=i.length;a<s;){if(r=255&i.charCodeAt(a++),a==s){o.push(Te.encodeChars.charAt(r>>2)),o.push(Te.encodeChars.charAt((3&r)<<4)),o.push("==");break}if(t=i.charCodeAt(a++),a==s){o.push(Te.encodeChars.charAt(r>>2)),o.push(Te.encodeChars.charAt((3&r)<<4|(240&t)>>4)),o.push(Te.encodeChars.charAt((15&t)<<2)),o.push("=");break}n=i.charCodeAt(a++),o.push(Te.encodeChars.charAt(r>>2)),o.push(Te.encodeChars.charAt((3&r)<<4|(240&t)>>4)),o.push(Te.encodeChars.charAt((15&t)<<2|(192&n)>>6)),o.push(Te.encodeChars.charAt(63&n))}return o.join("")},encodeArray:function(e){if(window.ArrayBuffer&&window.Uint8Array&&e instanceof window.ArrayBuffer){var r=new window.Uint8Array(e);return this.encodeArray(r)}for(var t,n,i,o=[],a=0,s=e.length;a<s;){if(t=255&e[a++],a==s){o.push(Te.encodeChars.charAt(t>>2)),o.push(Te.encodeChars.charAt((3&t)<<4)),o.push("==");break}if(n=255&e[a++],a==s){o.push(Te.encodeChars.charAt(t>>2)),o.push(Te.encodeChars.charAt((3&t)<<4|(240&n)>>4)),o.push(Te.encodeChars.charAt((15&n)<<2)),o.push("=");break}i=255&e[a++],o.push(Te.encodeChars.charAt(t>>2)),o.push(Te.encodeChars.charAt((3&t)<<4|(240&n)>>4)),o.push(Te.encodeChars.charAt((15&n)<<2|(192&i)>>6)),o.push(Te.encodeChars.charAt(63&i))}return o.join("")},decode:function(e,r){for(var t,n,i,o,a=this,s=[],u=0,c=e.length;u<c;){do{t=Te.decodeChars[255&e.charCodeAt(u++)]}while(u<c&&-1==t);if(-1==t)break;do{n=Te.decodeChars[255&e.charCodeAt(u++)]}while(u<c&&-1==n);if(-1==n)break;r?s.push(t<<2|(48&n)>>4):s.push(String.fromCharCode(t<<2|(48&n)>>4));do{if(61==(i=255&e.charCodeAt(u++)))return r?s:a.UTF8ToUTF16(s.join(""));i=Te.decodeChars[i]}while(u<c&&-1==i);if(-1==i)break;r?s.push((15&n)<<4|(60&i)>>2):s.push(String.fromCharCode((15&n)<<4|(60&i)>>2));do{if(61==(o=255&e.charCodeAt(u++)))return r?s:a.UTF8ToUTF16(s.join(""));o=Te.decodeChars[o]}while(u<c&&-1==o);if(-1==o)break;r?s.push((3&i)<<6|o):s.push(String.fromCharCode((3&i)<<6|o))}return r?s:a.UTF8ToUTF16(s.join(""))}},Ae={fromUTF16:function(e){for(var r,t=[],n=0,i=e.length;n<i;)(r=e.charCodeAt(n))>=1&&r<=127?t.push(e.charAt(n)):r>2047?(t.push(String.fromCharCode(224|r>>12&15)),t.push(String.fromCharCode(128|r>>6&63)),t.push(String.fromCharCode(128|63&r))):(t.push(String.fromCharCode(192|r>>6&31)),t.push(String.fromCharCode(128|63&r))),n++;return t.join("")},toUTF16:function(e){for(var r,t,n,i=[],o=0,a=e.length;o<a;)switch((r=e.charCodeAt(o++))>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:i.push(e.charAt(o-1));break;case 12:case 13:t=e.charCodeAt(o++),i.push(String.fromCharCode((31&r)<<6|63&t));break;case 14:t=e.charCodeAt(o++),n=e.charCodeAt(o++),i.push(String.fromCharCode((15&r)<<12|(63&t)<<6|63&n))}return i.join("")}},Ee="undefined"!=typeof self?self:global,ke=Ee.btoa?function(e){return Ee.btoa(e)}:function(e){for(var r,t=String(e),n=0,i=0,o=Te.encodeChars,a="";t.charAt(0|i)||(o="=",i%1);a+=o.charAt(63&n>>8-i%1*8)){if((r=t.charCodeAt(i+=3/4))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|r}return a},Pe=Ee.atob?function(e){return Ee.atob(e)}:function(e){var r=String(e).replace(/[=]+$/,"");if(r.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,n=0,i=0,o=0,a="";t=r.charAt(o++);~t&&(i=n%4?64*i+t:t,n++%4)?a+=String.fromCharCode(255&i>>(-2*n&6)):0)t=Te.encodeChars.indexOf(t);return a};function Fe(e){if(null===e||"object"!==C(e))return e;if(e instanceof Date){var r=new Date;return r.setTime(e.getTime()),r}if(Array.isArray(e)){for(var t=[],n=e.length,i=0;i<n;i++)t[i]=Fe(e[i]);return t}if(e instanceof Object){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(o[a]=Fe(e[a]));return o}return e}var De=Date.now||function(){return+new Date},xe=function(){return""+De()};function Oe(){for(var e,r=De()%1e4,t=[],n=0;n<5;n++)e=Math.floor(10*Math.random()),0!=n||0!=e?t.push(e):n=-1;return r<10?t.push("000"):r<100?t.push("00"):r<1e3&&t.push("0"),t.push(r),t.join("")}function Ne(e){return"__proto__"===e||"prototype"===e||"constructor"===e}function Re(e,r){for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(Ne(t))continue;e[t]=r[t]}return e}function We(e,r){for(var t in r)!Object.prototype.hasOwnProperty.call(r,t)||Ne(t)||E(r[t])||Object.prototype.hasOwnProperty.call(e,t)&&!E(e[t])||(e[t]=r[t]);return e}var Me=!1;"wakeLock"in navigator&&(Me=!0);var Le=null;function Be(){return(Be=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.wakeLock.request("screen");case 1:Le=e.v,e.n=3;break;case 2:e.p=2,e.v,Le=null;case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function Ue(){Me&&(null==Le?function(){Be.apply(this,arguments)}():Le.release().then(function(){Le=null}))}function Ve(){return Le}var je=Array.prototype;function He(e,r,t){return je.filter.call(e,r,t)}function Ge(e,r){return je.indexOf.call(r,e)}function ze(e){var r,t,n=[],i=e.length;for(r=0;r<i;r++){for(t=r+1;t<i;t++)e[r]===e[t]&&(t=++r);n.push(e[r])}return n}var Ke=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/;function Je(e,r){var t,n=[];for(t=0;t<e.length;t++){var i=e[t];i&&"."!==i&&(".."===i?n.length&&".."!==n[n.length-1]?n.pop():r&&n.push(".."):n.push(i))}return n}function Qe(e){var r="/"===e.charAt(0),t="/"===e.slice(-1);return(e=Je(He(e.split("/"),function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e}var qe=function(){return S(function e(){_(this,e)},[{key:"resolve",value:function(){var e,r,t="",n=arguments,i=!1;for(e=n.length-1;e>=0&&!i;e--)O(r=n[e])&&r&&(t=r+"/"+t,i="/"===r.charAt(0));return(i?"/":"")+Je(He(t.split("/"),function(e){return!!e}),!i).join("/")||"."}},{key:"join",value:function(){return Qe(He(L(arguments),function(e){return e&&O(e)}).join("/"))}},{key:"relative",value:function(e,r){e=Qe(e),r=Qe(r);var t,n,i=He(e.split("/"),function(e){return!!e}),o=[],a=He(r.split("/"),function(e){return!!e}),s=Math.min(i.length,a.length);for(t=0;t<s&&i[t]===a[t];t++);for(n=t;t<i.length;)o.push(".."),t++;return(o=o.concat(a.slice(n))).join("/")}},{key:"basename",value:function(e,r){var t;return t=(e.match(Ke)||[])[3]||"",r&&t&&t.slice(-1*r.length)===r&&(t=t.slice(0,-1*r.length)),t}},{key:"dirname",value:function(e){var r=e.match(Ke)||[],t=r[1]||"",n=r[2]||"";return t||n?(n&&(n=n.substring(0,n.length-1)),t+n):"."}},{key:"extname",value:function(e){return(e.match(Ke)||[])[4]||""}}])}(),Ye=!1,Xe=!0;function Ze(e,r,t){if(!e)return e;var n=t||null,i=e.length;if(E(i)||x(e))for(var o=Object.keys(e),a=0;a<o.length;a++){var s=o[a];if(r.call(n,e[s],s,e)===Ye)break}else for(var u=e,c=0;c<i&&r.call(n,u[c],c,e)!==Ye;c++);return e}var $e=Object.prototype.hasOwnProperty;function er(e){if(!e||"object"!==D(e)||e.nodeType||e.window==e)return Ye;var r,t;try{if((t=e.constructor)&&!$e.call(e,"constructor")&&!$e.call(t.prototype,"isPrototypeOf"))return Ye}catch(hH){return Ye}for(r in e);return E(r)||$e.call(e,r)}var rr="object"===("undefined"==typeof HTMLElement?"undefined":C(HTMLElement));function tr(e){return rr?e instanceof HTMLElement:e&&"object"===C(e)&&(1===e.nodeType||9===e.nodeType)&&"string"==typeof e.nodeName}function nr(e){var r=e;if(tr(e))for(;!r&&r!=document.body;)r=r.parentNode;else r=0;return!!r}function ir(e,r){return 0===e.lastIndexOf(r,0)}function or(e,r){var t=e.length-r.length;return t>=0&&e.indexOf(r,t)===t}function ar(e){return null==e?Z:String.prototype.trim.call(e)}function sr(e){if(e&&"object"===C(e))for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&!E(e[r]))return!1;return!0}function ur(e){return O(e)?e.replace(/[^\x20-\x7E]/g,""):e}function cr(e,r,t){return e.replace(new RegExp(r,"gi"),t)}function lr(e){return e.charAt(0).toUpperCase()+e.substring(1)}String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,Z)});var fr,dr="none",hr={getOffset:function(e,r,t){e=e||T.event;for(var n,i,o=t||e.target,a=0,s=0,u=0,c=0,l=!1,f=T.document;o&&!isNaN(o.offsetLeft)&&!isNaN(o.offsetTop);){var d,h;if(i=o.scrollLeft,n=o.scrollTop,"BODY"===o.tagName)if(l)i=0,n=0;else i|=null===(d=f.documentElement)||void 0===d?void 0:d.scrollLeft,n|=null===(h=f.documentElement)||void 0===h?void 0:h.scrollTop;else"fixed"===o.style.position&&(l=!0);a+=o.offsetLeft-i,s+=o.offsetTop-n,o=o.offsetParent}return r&&(u=r.Left,c=r.Top),{x:a=e.clientX-a-u,y:s=e.clientY-s-c}},getElDimensions:function(e,r){var t,n;return e?(t=e.style.display,e.style.display="",n=r?{offsetTop:e.offsetTop,offsetLeft:e.offsetLeft,offsetWidth:e.offsetWidth,offsetHeight:e.offsetHeight}:{clientTop:e.clientTop,clientLeft:e.clientLeft,clientWidth:e.clientWidth?e.clientWidth:parseInt(e.style.width)?parseInt(e.style.width):0,clientHeight:e.clientHeight?e.clientHeight:parseInt(e.style.height)?parseInt(e.style.height):0},e.style.display=t,n):{offsetTop:0,offsetLeft:0,offsetWidth:0,offsetHeight:0}}};function gr(e){return document.getElementById(e)}function vr(e){var r=O(e)?gr(e):e;r&&(r.length>0&&(r=r[0]),r.style.display=dr)}function mr(e){var r=O(e)?gr(e):e;r&&(r.length>0&&(r=r[0]),r.style.display=Z)}function pr(e){var r=O(e)?gr(e):e;r&&(r.length>0&&(r=r[0]),r.style.display===dr?r.style.display=Z:r.style.display=dr)}function _r(e){if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}function yr(e){return encodeURIComponent(String(e))}function Sr(e){return decodeURIComponent(e.replace(/\+/g," "))}if(window.trustedTypes){try{fr=window.trustedTypes.createPolicy("d-create-script",{createScriptURL:function(e){return e}})}catch(lK){}}function Ir(e){return fr?fr.createScriptURL(e):e}var br=document,Cr=br&&br.documentElement,Tr=br.getElementsByTagName("head")[0]||Cr,wr=br.createElement("script").readyState?function(e,r){var t=e.onreadystatechange;e.onreadystatechange=function(){var n=e.readyState;if("loaded"===n||"complete"===n){e.onreadystatechange=null,t&&t();r.call(this,{type:"load",path:[e]})}else"loading"===n||r.call(this,{type:"error",path:[e]})}}:function(e,r){e.addEventListener("load",r,!1),e.addEventListener("error",r,!1)};function Ar(e,r,t){return Er(e,r,!1,t)}function Er(e,r,t,n){var i=n||function(){};if(x(n)||(i=function(){}),O(e)&&e!==Z){var o=br.createElement("script"),a=["",e].join(Z);return o.src=Ir(a),r&&(o.async=!0),o.charset="utf-8",wr(o,i),t?Tr.appendChild(o):Tr.insertBefore(o,Tr.firstChild),o}i()}function kr(e,r,t){return Pr(e,r,!1,t)}function Pr(e,r,t,n){var i=n||function(){};if(x(n)||(i=function(){}),se.bJSDom)i("ok");else if(M(e)){var o=e.length,a=function(e){e&&"object"===C(e)&&"load"===e.type?o--:(e&&"object"===C(e)&&"error"===e.type&&z(["Failed to load resource: ",e.target.src,"."].join("")),i()),o<=0&&i("ok")};o<=0?i("ok"):Ze(e,function(e){Er(e,r||!1,t,a)})}else i()}function Fr(e,r){return Dr(e,!1,r)}function Dr(e,r,t){var n=t||!1;if(x(t)||(n=!1),O(e)&&e!==Z){if(!se.bJSDom){var i=br.createElement("link");return i.href=Ir(e),i.rel="stylesheet",i.async=!0,n&&wr(i,n),r?Tr.appendChild(i):Tr.insertBefore(i,Tr.firstChild),i}n&&n()}else n&&n()}function xr(e,r){return Or(e,!1,r)}function Or(e,r,t){if(se.bJSDom)t&&t("ok");else if(M(e)){var n=e.length,i=function(e){e&&"object"===C(e)&&"load"===e.type&&n--,e&&"object"===C(e)&&"load"!==e.type&&("error"===e.type&&z(["Failed to load resource: ",e.target.href,"."].join("")),t&&t()),n<=0&&t&&t("ok")};Ze(e,function(e){Dr(e,r,i)})}else t&&t()}function Nr(e){var r,t;if(!se.bJSDom){var n=document;if(n&&O(t=e.body)&&t!=Z){(r=n.createElement("script")).charset="utf-8",se.bIE?r.text=t:r.appendChild(n.createTextNode(t)),e.language?r.language=e.language:r.language="javascript",e.type?r.type=e.type:r.type="text/javascript";var i=n&&n.documentElement,o=n.getElementsByTagName("head")[0]||i;o.insertBefore(r,o.firstChild)}}}function Rr(e){Nr({body:e})}function Wr(e){Nr({body:e,language:"vbscript",type:"text/vbscript"})}function Mr(e){return null!=e&&e==e.window}function Lr(){this.keys=[],this.data={},this.set=function(e,r){null==this.data[e]&&-1==this.keys.indexOf(e)&&this.keys.push(e),this.data[e]=r},this.get=function(e){return this.data[e]}}function Br(e){return Math.random().toString(16).substring(2,2+e)}function Ur(e){var r=[Br(8),"-",Br(4),"-",Br(4),"-",Br(4),"-",Br(8)];return e&&r.unshift(e),r.join("")}var Vr=function(){return S(function e(){_(this,e),I(this,"nil",undefined),I(this,"bNode",!1),I(this,"noop",function(){}),I(this,"mix",Re),I(this,"mixOwnProperties",We),I(this,"clone",Fe),I(this,"keys",Object.keys),I(this,"now",xe),I(this,"getFormatedNow",w),I(this,"getRandom",Oe),I(this,"guid",Y),I(this,"get",gr),I(this,"show",mr),I(this,"hide",vr),I(this,"toggle",pr),I(this,"empty",_r),I(this,"uid",Ur),I(this,"stringify",T.JSON.stringify),I(this,"parse",T.JSON.parse),I(this,"isDef",k),I(this,"isUndef",E),I(this,"isUndefined",E),I(this,"isNull",P),I(this,"isNaN",isNaN),I(this,"isFunction",x),I(this,"isString",O),I(this,"isObject",N),I(this,"isBoolean",R),I(this,"isNumber",W),I(this,"isArray",M),I(this,"type",D),I(this,"isPlainObject",er),I(this,"isDOM",tr),I(this,"isDOMInBody",nr),I(this,"each",Ze),I(this,"getLogger",j),I(this,"setLogger",H),I(this,"log",G),I(this,"error",z),I(this,"warn",K),I(this,"info",J),I(this,"filter",He),I(this,"indexOf",Ge),I(this,"uniq",ze),I(this,"startsWith",ir),I(this,"endsWith",or),I(this,"replaceAll",cr),I(this,"upperCaseFirst",lr),I(this,"removeNonPrintableChar",ur),I(this,"trim",ar),I(this,"makeArray",L),I(this,"isEmptyObject",sr),I(this,"Map",Lr),I(this,"Path",new qe),I(this,"DOM",hr),I(this,"isWindow",Mr),I(this,"customEvent",new X),I(this,"addEventListener",ce),I(this,"removeEventListener",le),I(this,"stopPropagation",fe),I(this,"fireEvent",de),I(this,"base64",we),I(this,"utf8",Ae),I(this,"btoa",ke),I(this,"atob",Pe),I(this,"asyncQueue",Q),I(this,"sizzle",Ce),I(this,"toggleWakeLock",Ue),I(this,"getWakeLock",Ve),I(this,"urlEncode",yr),I(this,"urlDecode",Sr),I(this,"scriptOnload",wr),I(this,"addAllCss",Or),I(this,"getAllCss",xr),I(this,"addCss",Dr),I(this,"getCss",Fr),I(this,"addScripts",Pr),I(this,"getScripts",kr),I(this,"addScript",Er),I(this,"getScript",Ar),I(this,"addJS",Rr),I(this,"addVBS",Wr)},[{key:"debug",get:function(){return V.debug},set:function(e){V.debug=e}},{key:"bShowConsoleError",get:function(){return V.debug},set:function(e){V.bShowConsoleError=e}}])}(),jr=new Vr,Hr=function(e){return e.Cancel=0,e.Exit=1,e.SaveAndExit=2,e}({}),Gr=function(e){return e.enumFitWindow=0,e.enumFitWindowHeight=1,e.enumFitWindowWidth=2,e}({}),zr=function(e){return e.IM_NEARESTNEIGHBOUR=1,e.IM_BILINEAR=2,e.IM_BICUBIC=3,e.IM_BESTQUALITY=5,e}({}),Kr=function(e){return e.English=0,e.French=1,e.Arabic=2,e.Spanish=3,e.Portuguese=4,e.German=5,e.Italian=6,e.Russian=7,e.Chinese=8,e}({}),Jr=function(e){return e.Default=0,e.Hand=1,e.Crosshair=2,e.Zoom=3,e.NWResize=4,e.EResize=5,e.NResize=6,e.Resize=7,e.Move=8,e}({}),Qr=function(e){return e.Single=0,e.Multiple=1,e}({}),qr=function(e){return e.TwainService=1,e}({}),Yr=function(e){return e.SW_ACTIVE=0,e.SW_MAX=1,e.SW_MIN=2,e.SW_CLOSE=3,e.SW_IFLIVE=4,e}({}),Xr=function(e){return e.TWUN_INCHES=0,e.TWUN_CENTIMETERS=1,e.TWUN_PICAS=2,e.TWUN_POINTS=3,e.TWUN_TWIPS=4,e.TWUN_PIXELS=5,e.TWUN_MILLIMETERS=6,e}({}),Zr=function(e){return e.enumUnknown=-1,e.enumChrome=1,e.enumFirefox=2,e.enumEdge=3,e.enumSafari=4,e.enumIE=5,e.enumOpera=6,e.enumHuaWeiBrowser=7,e}({}),$r=function(e){return e.DoNotCheck=0,e.Check127=1,e.CheckLocalDynamsoftCert=2,e}({}),et=function(e){return e.Info=1,e.Error=2,e.NotInstalledError=3,e}({}),rt=function(e){return e.enumUnknown=-1,e.enumWindow=0,e.enumMac=1,e.enumLinux=2,e.enumEmbed=3,e.enumChromeOS=4,e.enumHarmonyOS=5,e.enumAndroid=6,e.enumiOS=7,e}({}),tt=function(e){return e.Init=0,e.Connected=1,e.CheckingManagerVer=15,e.CheckingServiceVer=16,e.NotInstalled=17,e.NotReady=18,e.CheckedService=5,e.VerifyingZip=6,e.VerifiedZip=7,e.UpdatingService=8,e.UpdateSucceed=9,e.UpdateFailed=10,e.UpdateSkipped=11,e}({}),nt=function(e){return e.LicenseNotIncludePDFRForLoad=-1119,e.LicenseInvalid=-2325,e.LicenseExpired=-2326,e.LicenseNoChrome=-2327,e.LicenseNoFirefox=-2328,e.LicenseNoIE=-2329,e.LicenseNoEdge=-2330,e.LicenseNoSafari=-2392,e.LicenseNotIncludeWebcam=-2338,e.LicenseNotIncludePDFR=-2339,e.LicenseNotIncludeOCR_OCRKIT=-2340,e.LicenseNotIncludeOCRPro=-2341,e.LicenseBadDomain=-2342,e.LicenseBrowserNotMatched=-2343,e.LicenseNotIncludeWindows=-2344,e.LicenseNotIncludeMacOS=-2345,e.LicenseNotIncludeLinux=-2346,e.LicenseNotIncludeWasm=-2369,e.LicenseIsFuture=-2396,e.LicenseTrialFullMixed=-2426,e.LicenseVersionNotCurrent=-2539,e.LicenseNotIncludeEmbed=-2542,e.LicenseParseFailed=-2546,e.LicenseExpiredForDLS=-2808,e.LicenseNoCoreForDLS=-2809,e.LicenseNoCore=-2810,e}({}),it=function(e){return e.SourceHasNothingToCapture=-1029,e.UserCancelled=-1032,e.CORSErrorFromService=-2137,e.TokenAccessDenied=-2136,e.TokenServiceLock=-2138,e.TokenExpired=-2139,e.TokenInvalid=-2140,e.TokenMissing=-2142,e.CommonError=-2201,e.ModuleNotExists=-2371,e.MustUpgrade=-2207,e.RemoteDynamsoftServiceStopped=-2613,e.ServiceNotInstalled=-2800,e.ResponseDataTypeError=-2801,e.HTSTError=-2817,e.SSLCertExpired=-2818,e.SSLCertInvalid=-2819,e.CORSError=-2820,e.DWTPortNotReady=-2821,e.HTTPRedirected=-2823,e.BboError=-2827,e.HTTPServerError=-2842,e.ChromeLNADenied=-2909,e}({}),ot=function(e){return e.UserCanceled=-2615,e.HTTPError=-2816,e.HTTPRedirected=-2823,e}({}),at=function(e){return e["default"]=0,e.standard=1,e.supported=2,e}({}),st=function(e){return e.URL=0,e.Blob=1,e.Base64=2,e}({}),ut=function(e){return e.IT_BMP=0,e.IT_JPG=1,e.IT_TIF=2,e.IT_PNG=3,e.IT_PDF=4,e.IT_ALL=5,e.IT_MULTIPAGE_PDF=7,e.IT_MULTIPAGE_TIF=8,e.IT_J2K=14,e}({}),ct=function(e){return e.PDF_AUTO=0,e.PDF_FAX3=1,e.PDF_FAX4=2,e.PDF_LZW=3,e.PDF_RLE=4,e.PDF_JPEG=5,e.PDF_JP2000=6,e.PDF_JBIG2=7,e}({}),lt=function(e){return e.TWPT_BW=0,e.TWPT_GRAY=1,e.TWPT_RGB=2,e.TWPT_PALLETE=3,e.TWPT_CMY=4,e.TWPT_CMYK=5,e.TWPT_YUV=6,e.TWPT_YUVK=7,e.TWPT_CIEXYZ=8,e.TWPT_LAB=9,e.TWPT_SRGB=10,e.TWPT_SCRGB=11,e.TWPT_INFRARED=16,e}({}),ft=function(e){return e.TIFF_AUTO=0,e.TIFF_NONE=1,e.TIFF_RLE=2,e.TIFF_FAX3=3,e.TIFF_T4=3,e.TIFF_FAX4=4,e.TIFF_T6=4,e.TIFF_LZW=5,e.TIFF_JPEG=7,e.TIFF_PACKBITS=32773,e}({}),dt=function(e){return e.RGBA=15,e.Auto=16,e}({}),ht=function(e){return e.normal=0,e.balance=1,e}({}),gt=function(e){return e.Page_Default=0,e.Page_Custom=1,e.Page_A4=2,e.Page_A4_Reverse=3,e.Page_A3=4,e.Page_A3_Reverse=5,e.Page_Letter=6,e.Page_Letter_Reverse=7,e.Page_Legal=8,e.Page_Legal_Reverse=9,e}({}),vt=function(e){return e.Text=0,e.Blob=1,e.ArrayBuffer=2,e.XML=3,e.JSON=4,e.UserDefined=5,e}({}),mt=function(e){return e.Binary=0,e.Base64=1,e}({}),pt=function(e){return e.Init=-1,e.OK=0,e.Failed=1,e.Cancelled=2,e}({}),_t=function(e){return e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3,e}({}),yt=function(e){return e.CAP_NONE=0,e.CAP_XFERCOUNT=1,e.ICAP_COMPRESSION=256,e.ICAP_PIXELTYPE=257,e.ICAP_UNITS=258,e.ICAP_XFERMECH=259,e.CAP_AUTHOR=4096,e.CAP_CAPTION=4097,e.CAP_FEEDERENABLED=4098,e.CAP_FEEDERLOADED=4099,e.CAP_TIMEDATE=4100,e.CAP_SUPPORTEDCAPS=4101,e.CAP_EXTENDEDCAPS=4102,e.CAP_AUTOFEED=4103,e.CAP_CLEARPAGE=4104,e.CAP_FEEDPAGE=4105,e.CAP_REWINDPAGE=4106,e.CAP_INDICATORS=4107,e.CAP_SUPPORTEDCAPSEXT=4108,e.CAP_PAPERDETECTABLE=4109,e.CAP_UICONTROLLABLE=4110,e.CAP_DEVICEONLINE=4111,e.CAP_AUTOSCAN=4112,e.CAP_THUMBNAILSENABLED=4113,e.CAP_DUPLEX=4114,e.CAP_DUPLEXENABLED=4115,e.CAP_ENABLEDSUIONLY=4116,e.CAP_CUSTOMDSDATA=4117,e.CAP_ENDORSER=4118,e.CAP_JOBCONTROL=4119,e.CAP_ALARMS=4120,e.CAP_ALARMVOLUME=4121,e.CAP_AUTOMATICCAPTURE=4122,e.CAP_TIMEBEFOREFIRSTCAPTURE=4123,e.CAP_TIMEBETWEENCAPTURES=4124,e.CAP_CLEARBUFFERS=4125,e.CAP_MAXBATCHBUFFERS=4126,e.CAP_DEVICETIMEDATE=4127,e.CAP_POWERSUPPLY=4128,e.CAP_CAMERAPREVIEWUI=4129,e.CAP_DEVICEEVENT=4130,e.CAP_SERIALNUMBER=4132,e.CAP_PRINTER=4134,e.CAP_PRINTERENABLED=4135,e.CAP_PRINTERINDEX=4136,e.CAP_PRINTERMODE=4137,e.CAP_PRINTERSTRING=4138,e.CAP_PRINTERSUFFIX=4139,e.CAP_LANGUAGE=4140,e.CAP_FEEDERALIGNMENT=4141,e.CAP_FEEDERORDER=4142,e.CAP_REACQUIREALLOWED=4144,e.CAP_BATTERYMINUTES=4146,e.CAP_BATTERYPERCENTAGE=4147,e.CAP_CAMERASIDE=4148,e.CAP_SEGMENTED=4149,e.CAP_CAMERAENABLED=4150,e.CAP_CAMERAORDER=4151,e.CAP_MICRENABLED=4152,e.CAP_FEEDERPREP=4153,e.CAP_FEEDERPOCKET=4154,e.CAP_AUTOMATICSENSEMEDIUM=4155,e.CAP_CUSTOMINTERFACEGUID=4156,e.ICAP_AUTOBRIGHT=4352,e.ICAP_BRIGHTNESS=4353,e.ICAP_CONTRAST=4355,e.ICAP_CUSTHALFTONE=4356,e.ICAP_EXPOSURETIME=4357,e.ICAP_FILTER=4358,e.ICAP_FLASHUSED=4359,e.ICAP_GAMMA=4360,e.ICAP_HALFTONES=4361,e.ICAP_HIGHLIGHT=4362,e.ICAP_IMAGEFILEFORMAT=4364,e.ICAP_LAMPSTATE=4365,e.ICAP_LIGHTSOURCE=4366,e.ICAP_ORIENTATION=4368,e.ICAP_PHYSICALWIDTH=4369,e.ICAP_PHYSICALHEIGHT=4370,e.ICAP_SHADOW=4371,e.ICAP_FRAMES=4372,e.ICAP_XNATIVERESOLUTION=4374,e.ICAP_YNATIVERESOLUTION=4375,e.ICAP_XRESOLUTION=4376,e.ICAP_YRESOLUTION=4377,e.ICAP_MAXFRAMES=4378,e.ICAP_TILES=4379,e.ICAP_BITORDER=4380,e.ICAP_CCITTKFACTOR=4381,e.ICAP_LIGHTPATH=4382,e.ICAP_PIXELFLAVOR=4383,e.ICAP_PLANARCHUNKY=4384,e.ICAP_ROTATION=4385,e.ICAP_SUPPORTEDSIZES=4386,e.ICAP_THRESHOLD=4387,e.ICAP_XSCALING=4388,e.ICAP_YSCALING=4389,e.ICAP_BITORDERCODES=4390,e.ICAP_PIXELFLAVORCODES=4391,e.ICAP_JPEGPIXELTYPE=4392,e.ICAP_TIMEFILL=4394,e.ICAP_BITDEPTH=4395,e.ICAP_BITDEPTHREDUCTION=4396,e.ICAP_UNDEFINEDIMAGESIZE=4397,e.ICAP_EXTIMAGEINFO=4399,e.ICAP_MINIMUMHEIGHT=4400,e.ICAP_MINIMUMWIDTH=4401,e.ICAP_AUTODISCARDBLANKPAGES=4404,e.ICAP_FLIPROTATION=4406,e.ICAP_BARCODEDETECTIONENABLED=4407,e.ICAP_SUPPORTEDBARCODETYPES=4408,e.ICAP_BARCODEMAXSEARCHPRIORITIES=4409,e.ICAP_BARCODESEARCHPRIORITIES=4410,e.ICAP_BARCODESEARCHMODE=4411,e.ICAP_BARCODEMAXRETRIES=4412,e.ICAP_BARCODETIMEOUT=4413,e.ICAP_ZOOMFACTOR=4414,e.ICAP_PATCHCODEDETECTIONENABLED=4415,e.ICAP_SUPPORTEDPATCHCODETYPES=4416,e.ICAP_PATCHCODEMAXSEARCHPRIORITIES=4417,e.ICAP_PATCHCODESEARCHPRIORITIES=4418,e.ICAP_PATCHCODESEARCHMODE=4419,e.ICAP_PATCHCODEMAXRETRIES=4420,e.ICAP_PATCHCODETIMEOUT=4421,e.ICAP_FLASHUSED2=4422,e.ICAP_IMAGEFILTER=4423,e.ICAP_NOISEFILTER=4424,e.ICAP_OVERSCAN=4425,e.ICAP_AUTOMATICBORDERDETECTION=4432,e.ICAP_AUTOMATICDESKEW=4433,e.ICAP_AUTOMATICROTATE=4434,e.ICAP_JPEGQUALITY=4435,e.ICAP_FEEDERTYPE=4436,e.ICAP_ICCPROFILE=4437,e.ICAP_AUTOSIZE=4438,e.ICAP_AUTOMATICCROPUSESFRAME=4439,e.ICAP_AUTOMATICLENGTHDETECTION=4440,e.ICAP_AUTOMATICCOLORENABLED=4441,e.ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE=4442,e.ICAP_COLORMANAGEMENTENABLED=4443,e.ICAP_IMAGEMERGE=4444,e.ICAP_IMAGEMERGEHEIGHTTHRESHOLD=4445,e.ICAP_SUPPORTEDEXTIMAGEINFO=4446,e}({}),St=function(e){return e.Other=0,e.HTTPUpload=1,e.HTTPDownload=2,e.FTPUpload=3,e.FTPDownload=4,e.Scan=5,e.LoadImage=6,e.ConvertToBlob=7,e.HTTPPut=8,e}({}),It=function(e){return e.TWLG_DAN=0,e.TWLG_DUT=1,e.TWLG_ENG=2,e.TWLG_FCF=3,e.TWLG_FIN=4,e.TWLG_FRN=5,e.TWLG_GER=6,e.TWLG_ICE=7,e.TWLG_ITN=8,e.TWLG_NOR=9,e.TWLG_POR=10,e.TWLG_SPA=11,e.TWLG_SWE=12,e.TWLG_USA=13,e.TWLG_USERLOCALE=-1,e.TWLG_AFRIKAANS=14,e.TWLG_ALBANIA=15,e.TWLG_ARABIC=16,e.TWLG_ARABIC_ALGERIA=17,e.TWLG_ARABIC_BAHRAIN=18,e.TWLG_ARABIC_EGYPT=19,e.TWLG_ARABIC_IRAQ=20,e.TWLG_ARABIC_JORDAN=21,e.TWLG_ARABIC_KUWAIT=22,e.TWLG_ARABIC_LEBANON=23,e.TWLG_ARABIC_LIBYA=24,e.TWLG_ARABIC_MOROCCO=25,e.TWLG_ARABIC_OMAN=26,e.TWLG_ARABIC_QATAR=27,e.TWLG_ARABIC_SAUDIARABIA=28,e.TWLG_ARABIC_SYRIA=29,e.TWLG_ARABIC_TUNISIA=30,e.TWLG_ARABIC_UAE=31,e.TWLG_ARABIC_YEMEN=32,e.TWLG_BASQUE=33,e.TWLG_BYELORUSSIAN=34,e.TWLG_BULGARIAN=35,e.TWLG_CATALAN=36,e.TWLG_CHINESE=37,e.TWLG_CHINESE_HONGKONG=38,e.TWLG_CHINESE_PRC=39,e.TWLG_CHINESE_SINGAPORE=40,e.TWLG_CHINESE_SIMPLIFIED=41,e.TWLG_CHINESE_TAIWAN=42,e.TWLG_CHINESE_TRADITIONAL=43,e.TWLG_CROATIA=44,e.TWLG_CZECH=45,e.TWLG_DANISH=0,e.TWLG_DUTCH=1,e.TWLG_DUTCH_BELGIAN=46,e.TWLG_ENGLISH=2,e.TWLG_ENGLISH_AUSTRALIAN=47,e.TWLG_ENGLISH_CANADIAN=48,e.TWLG_ENGLISH_IRELAND=49,e.TWLG_ENGLISH_NEWZEALAND=50,e.TWLG_ENGLISH_SOUTHAFRICA=51,e.TWLG_ENGLISH_UK=52,e.TWLG_ENGLISH_USA=13,e.TWLG_ESTONIAN=53,e.TWLG_FAEROESE=54,e.TWLG_FARSI=55,e.TWLG_FINNISH=4,e.TWLG_FRENCH=5,e.TWLG_FRENCH_BELGIAN=56,e.TWLG_FRENCH_CANADIAN=3,e.TWLG_FRENCH_LUXEMBOURG=57,e.TWLG_FRENCH_SWISS=58,e.TWLG_GERMAN=6,e.TWLG_GERMAN_AUSTRIAN=59,e.TWLG_GERMAN_LUXEMBOURG=60,e.TWLG_GERMAN_LIECHTENSTEIN=61,e.TWLG_GERMAN_SWISS=62,e.TWLG_GREEK=63,e.TWLG_HEBREW=64,e.TWLG_HUNGARIAN=65,e.TWLG_ICELANDIC=7,e.TWLG_INDONESIAN=66,e.TWLG_ITALIAN=8,e.TWLG_ITALIAN_SWISS=67,e.TWLG_JAPANESE=68,e.TWLG_KOREAN=69,e.TWLG_KOREAN_JOHAB=70,e.TWLG_LATVIAN=71,e.TWLG_LITHUANIAN=72,e.TWLG_NORWEGIAN=9,e.TWLG_NORWEGIAN_BOKMAL=73,e.TWLG_NORWEGIAN_NYNORSK=74,e.TWLG_POLISH=75,e.TWLG_PORTUGUESE=10,e.TWLG_PORTUGUESE_BRAZIL=76,e.TWLG_ROMANIAN=77,e.TWLG_RUSSIAN=78,e.TWLG_SERBIAN_LATIN=79,e.TWLG_SLOVAK=80,e.TWLG_SLOVENIAN=81,e.TWLG_SPANISH=11,e.TWLG_SPANISH_MEXICAN=82,e.TWLG_SPANISH_MODERN=83,e.TWLG_SWEDISH=12,e.TWLG_THAI=84,e.TWLG_TURKISH=85,e.TWLG_UKRANIAN=86,e.TWLG_ASSAMESE=87,e.TWLG_BENGALI=88,e.TWLG_BIHARI=89,e.TWLG_BODO=90,e.TWLG_DOGRI=91,e.TWLG_GUJARATI=92,e.TWLG_HARYANVI=93,e.TWLG_HINDI=94,e.TWLG_KANNADA=95,e.TWLG_KASHMIRI=96,e.TWLG_MALAYALAM=97,e.TWLG_MARATHI=98,e.TWLG_MARWARI=99,e.TWLG_MEGHALAYAN=100,e.TWLG_MIZO=101,e.TWLG_NAGA=102,e.TWLG_ORISSI=103,e.TWLG_PUNJABI=104,e.TWLG_PUSHTU=105,e.TWLG_SERBIAN_CYRILLIC=106,e.TWLG_SIKKIMI=107,e.TWLG_SWEDISH_FINLAND=108,e.TWLG_TAMIL=109,e.TWLG_TELUGU=110,e.TWLG_TRIPURI=111,e.TWLG_URDU=112,e.TWLG_VIETNAMESE=113,e}({}),bt=function(e){return e.TWSS_NONE=0,e.TWSS_A4LETTER=1,e.TWSS_B5LETTER=2,e.TWSS_USLETTER=3,e.TWSS_USLEGAL=4,e.TWSS_A5=5,e.TWSS_B4=6,e.TWSS_B6=7,e.TWSS_USLEDGER=9,e.TWSS_USEXECUTIVE=10,e.TWSS_A3=11,e.TWSS_B3=12,e.TWSS_A6=13,e.TWSS_C4=14,e.TWSS_C5=15,e.TWSS_C6=16,e.TWSS_4A0=17,e.TWSS_2A0=18,e.TWSS_A0=19,e.TWSS_A1=20,e.TWSS_A2=21,e.TWSS_A4=1,e.TWSS_A7=22,e.TWSS_A8=23,e.TWSS_A9=24,e.TWSS_A10=25,e.TWSS_ISOB0=26,e.TWSS_ISOB1=27,e.TWSS_ISOB2=28,e.TWSS_ISOB3=12,e.TWSS_ISOB4=6,e.TWSS_ISOB5=29,e.TWSS_ISOB6=7,e.TWSS_ISOB7=30,e.TWSS_ISOB8=31,e.TWSS_ISOB9=32,e.TWSS_ISOB10=33,e.TWSS_JISB0=34,e.TWSS_JISB1=35,e.TWSS_JISB2=36,e.TWSS_JISB3=37,e.TWSS_JISB4=38,e.TWSS_JISB5=2,e.TWSS_JISB6=39,e.TWSS_JISB7=40,e.TWSS_JISB8=41,e.TWSS_JISB9=42,e.TWSS_JISB10=43,e.TWSS_C0=44,e.TWSS_C1=45,e.TWSS_C2=46,e.TWSS_C3=47,e.TWSS_C7=48,e.TWSS_C8=49,e.TWSS_C9=50,e.TWSS_C10=51,e.TWSS_USSTATEMENT=52,e.TWSS_BUSINESSCARD=53,e.TWSS_MAXSIZE=54,e}({}),Ct=function(e){return e.TWON_NONE=0,e.TWON_ARRAY=3,e.TWON_ENUMERATION=4,e.TWON_ONEVALUE=5,e.TWON_RANGE=6,e}({}),Tt=function(e){return e.TWTY_INT8=0,e.TWTY_INT16=1,e.TWTY_INT32=2,e.TWTY_UINT8=3,e.TWTY_UINT16=4,e.TWTY_int=5,e.TWTY_BOOL=6,e.TWTY_FIX32=7,e.TWTY_FRAME=8,e.TWTY_STR32=9,e.TWTY_STR64=10,e.TWTY_STR128=11,e.TWTY_STR255=12,e}({}),wt=function(e){return e.TWFA_NONE=0,e.TWFA_LEFT=1,e.TWFA_CENTER=2,e.TWFA_RIGHT=3,e}({}),At=function(e){return e.TWFO_FIRSTPAGEFIRST=0,e.TWFO_LASTPAGEFIRST=1,e}({}),Et=function(e){return e.TWPR_IMPRINTERTOPBEFORE=0,e.TWPR_IMPRINTERTOPAFTER=1,e.TWPR_IMPRINTERBOTTOMBEFORE=2,e.TWPR_IMPRINTERBOTTOMAFTER=3,e.TWPR_ENDORSERTOPBEFORE=4,e.TWPR_ENDORSERTOPAFTER=5,e.TWPR_ENDORSERBOTTOMBEFORE=6,e.TWPR_ENDORSERBOTTOMAFTER=7,e}({}),kt=function(e){return e.TWPM_SINGLESTRING=0,e.TWPM_MULTISTRING=1,e.TWPM_COMPOUNDSTRING=2,e}({}),Pt=function(e){return e.TWBR_THRESHOLD=0,e.TWBR_HALFTONE=1,e.TWBR_CUSTHALFTONE=2,e.TWBR_DIFFUSION=3,e}({}),Ft=function(e){return e.TWBO_LSBFIRST=0,e.TWBO_MSBFIRST=1,e}({}),Dt=function(e){return e.TWFT_RED=0,e.TWFT_GREEN=1,e.TWFT_BLUE=2,e.TWFT_NONE=3,e.TWFT_WHITE=4,e.TWFT_CYAN=5,e.TWFT_MAGENTA=6,e.TWFT_YELLOW=7,e.TWFT_BLACK=8,e}({}),xt=function(e){return e.TWFL_NONE=0,e.TWFL_OFF=1,e.TWFL_ON=2,e.TWFL_AUTO=3,e.TWFL_REDEYE=4,e}({}),Ot=function(e){return e.TWFR_BOOK=0,e.TWFR_FANFOLD=1,e}({}),Nt=function(e){return e.TWIF_NONE=0,e.TWIF_AUTO=1,e.TWIF_LOWPASS=2,e.TWIF_BANDPASS=3,e.TWIF_HIGHPASS=4,e.TWIF_TEXT=3,e.TWIF_FINELINE=4,e}({}),Rt=function(e){return e.TWLP_REFLECTIVE=0,e.TWLP_TRANSMISSIVE=1,e}({}),Wt=function(e){return e.TWLS_RED=0,e.TWLS_GREEN=1,e.TWLS_BLUE=2,e.TWLS_NONE=3,e.TWLS_WHITE=4,e.TWLS_UV=5,e.TWLS_IR=6,e}({}),Mt=function(e){return e.TWNF_NONE=0,e.TWNF_AUTO=1,e.TWNF_LONEPIXEL=2,e.TWNF_MAJORITYRULE=3,e}({}),Lt=function(e){return e.TWOR_ROT0=0,e.TWOR_ROT90=1,e.TWOR_ROT180=2,e.TWOR_ROT270=3,e.TWOR_PORTRAIT=0,e.TWOR_LANDSCAPE=3,e.TWOR_AUTO=4,e.TWOR_AUTOTEXT=5,e.TWOR_AUTOPICTURE=6,e}({}),Bt=function(e){return e.TWOV_NONE=0,e.TWOV_AUTO=1,e.TWOV_TOPBOTTOM=2,e.TWOV_LEFTRIGHT=3,e.TWOV_ALL=4,e}({}),Ut=function(e){return e.TWPF_CHOCOLATE=0,e.TWPF_VANILLA=1,e}({}),Vt=function(e){return e.TWPC_CHUNKY=0,e.TWPC_PLANAR=1,e}({}),jt=function(e){return e.TWBP_DISABLE=-2,e.TWBP_AUTO=-1,e}({}),Ht=function(e){return e.CM_RENDERALL=1,e.CM_IMAGEONLY=2,e.CM_AUTO=3,e.CM_RENDERALLWITHANNOTATION=4,e}({}),Gt=function(e){return e.TWAINSCANNER=16,e.WIASCANNER=32,e.TWAINX64SCANNER=64,e.ICASCANNER=128,e.SANESCANNER=256,e.ESCLSCANNER=512,e.WIFIDIRECTSCANNER=1024,e.WIATWAINSCANNER=2048,e}({}),zt=Gt.TWAINSCANNER|Gt.WIASCANNER|Gt.TWAINX64SCANNER|Gt.ICASCANNER|Gt.SANESCANNER|Gt.ESCLSCANNER|Gt.WIFIDIRECTSCANNER|Gt.WIATWAINSCANNER,Kt=Gt.TWAINSCANNER|Gt.WIASCANNER|Gt.TWAINX64SCANNER|Gt.ICASCANNER|Gt.SANESCANNER,Jt=Gt.TWAINSCANNER|Gt.WIATWAINSCANNER|Gt.TWAINX64SCANNER|Gt.ICASCANNER|Gt.SANESCANNER;Gt.TWAINSCANNER,Gt.WIASCANNER,Gt.WIATWAINSCANNER;var Qt=Gt.ESCLSCANNER|Gt.WIFIDIRECTSCANNER,qt=Gt.TWAINSCANNER|Gt.WIATWAINSCANNER,Yt=function(e){return e.ST_UNKNOWN=0,e.ST_TWAIN_DIRECT=1,e.ST_DYNAMSOFT_SERVICE=2,e.ST_ESCL=3,e.ST_WIFI_DIRECT=4,e}({}),Xt=function(e){return e.TWAIN=0,e.ICA=3,e.SANE=3,e.TWAIN_AND_ICA=4,e.TWAIN_AND_TWAIN64=4,e.TWAIN64=5,e}({}),Zt=function(e){return e.enumBCAppend=1,e.enumBCInsert=2,e.enumBCRemove=3,e.enumBCEdit=4,e.enumBCIndexChange=5,e.enumBCUpdate=6,e}({}),$t=function(e){return e.SMF_NAME=1,e.SMF_TWAINVERSION=2,e.SMF_TWAINPROTOCOL=4,e.SMF_ICAUUID=8,e.SMF_ICAMODULEVERSION=16,e.SMF_ICALOCATIONTYPE=32,e}({}),en=function(e){return e.TWBS_NONE=0,e.TWBS_SINGLEFLAT=1,e.TWBS_SINGLE3D=2,e}({}),rn=function(e){return e.TWQC_GET=1,e.TWQC_SET=2,e.TWQC_GETDEFAULT=4,e.TWQC_GETCURRENT=8,e.TWQC_RESET=16,e}({}),tn=function(e){return e.TWSX_NATIVE=0,e.TWSX_FILE=1,e.TWSX_MEMORY=2,e}({}),nn=function(e){return e.TWFF_TIFF=0,e.TWFF_PICT=1,e.TWFF_BMP=2,e.TWFF_XBM=3,e.TWFF_JFIF=4,e.TWFF_FPX=5,e.TWFF_TIFFMULTI=6,e.TWFF_PNG=7,e.TWFF_SPIFF=8,e.TWFF_EXIF=9,e.TWFF_PDF=10,e.TWFF_JP2=11,e.TWFF_JPN=12,e.TWFF_JPX=13,e.TWFF_DEJAVU=14,e.TWFF_PDFA=15,e.TWFF_PDFA2=16,e}({}),on=function(e){return e.TWDX_NONE=0,e.TWDX_1PASSDUPLEX=1,e.TWDX_2PASSDUPLEX=2,e}({}),an=function(e){return e.TWMD_MICR=0,e.TWMD_RAW=1,e.TWMD_INVALID=2,e}({}),sn=function(e){return e.TWDSS_CLOSED=0,e.TWDSS_OPENED=1,e.TWDSS_ENABLED=2,e.TWDSS_ACQUIRING=3,e}({}),un=function(e){return e.TWCP_NONE=0,e.TWCP_PACKBITS=1,e.TWCP_GROUP31D=2,e.TWCP_GROUP31DEOL=3,e.TWCP_GROUP32D=4,e.TWCP_GROUP4=5,e.TWCP_JPEG=6,e.TWCP_LZW=7,e.TWCP_JBIG=8,e.TWCP_PNG=9,e.TWCP_RLE4=10,e.TWCP_RLE8=11,e.TWCP_BITFIELDS=12,e.TWCP_ZIP=13,e.TWCP_JPEG2000=14,e}({});function cn(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function ln(e,r,t){if("function"==typeof e?e===r:e.has(r))return arguments.length<3?r:t;throw new TypeError("Private element is not present on this object")}function fn(e,r,t,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,i)}function dn(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){fn(o,n,i,a,s,"next",e)}function s(e){fn(o,n,i,a,s,"throw",e)}a(void 0)})}}function hn(e,r,t){return r=Sn(r),function(e,r){if(r&&("object"==C(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,bn()?Reflect.construct(r,t||[],Sn(e).constructor):r.apply(e,t))}function gn(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function vn(e,r){(function(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,r),r.add(e)}function mn(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,En(n.key),n)}}function pn(e,r,t){return r&&mn(e.prototype,r),t&&mn(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _n(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return cn(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?cn(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==t["return"]||t["return"]()}finally{if(s)throw o}}}}function yn(e,r,t){return(r=En(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Sn(e){return Sn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Sn(e)}function In(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&An(e,r)}function bn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(bn=function(){return!!e})()}function Cn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function Tn(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(t,n,i,o){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return wn(c,"_invoke",function(t,n,i){var o,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(r,t){return o=r,s=0,u=e,d.n=t,a}};function h(t,n){for(s=t,u=n,r=0;!f&&c&&!i&&r<l.length;r++){var i,o=l[r],h=d.p,g=o[2];t>3?(i=g===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=t<2&&h<o[1])?(s=0,d.v=n,d.n=o[1]):h<g&&(i=t<3||o[0]>n||n>g)&&(o[4]=t,o[5]=n,d.n=g,s=0))}if(i||t>1)return a;throw f=!0,n}return function(i,l,g){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,g),s=l,u=g;(r=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(i="next"),r=o[i]){if(!(r=r.call(o,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,s<2&&(s=0)}else 1===s&&(r=o["return"])&&r.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((r=(f=d.n<0)?u:t.call(n,d))!==a)break}catch(r){o=e,s=1,u=r}finally{c=1}}return{value:r,done:f}}}(t,i,o),!0),c}var a={};function s(){}function u(){}function c(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(wn(r={},n,function(){return this}),r),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,wn(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,wn(f,"constructor",c),wn(c,"constructor",u),u.displayName="GeneratorFunction",wn(c,i,"GeneratorFunction"),wn(f),wn(f,i,"Generator"),wn(f,n,function(){return this}),wn(f,"toString",function(){return"[object Generator]"}),(Tn=function(){return{w:o,m:d}})()}function wn(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}wn=function(e,r,t,n){function o(r,t){wn(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))},wn(e,r,t,n)}function An(e,r){return An=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},An(e,r)}function En(e){var r=function(e,r){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==C(r)?r:r+""}function kn(e){return kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kn(e)}var Pn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Fn=!!("object"===("undefined"==typeof global?"undefined":kn(global))&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement),Dn=Pn.Dynamsoft;Dn||(Dn={},Pn.Dynamsoft=Dn),Dn.navInfoSync=se,Dn.DWT||(Dn.DWT={});var xn=Dn.DWT;xn.LTS||(xn.LTS={}),Dn.Lib||(Dn.Lib={});var On=Dn.Lib,Nn=20260121;(On.__ver||0)<Nn&&(jr.mix(On,jr),On.__ver=Nn),On.UI||(On.UI={}),On.html5||(On.html5={}),On.detect||(On.detect={}),On.Connect||(On.Connect={});var Rn=function(){if("undefined"!=typeof window){if(window.__zone_symbol__Promise&&jr.isFunction(window.__zone_symbol__Promise))return window.__zone_symbol__Promise;if(window.Promise)return window.Promise}if("undefined"!=typeof self&&self.Promise)return self.Promise;jr.error("Not support Promise.")}(),Wn=function(e){return e.LEFT=0,e.MIDDLE=1,e.RIGHT=2,e}({}),Mn=function(){return pn(function e(){gn(this,e)},null,[{key:"getWheelDelta",value:function(e){var r=e||window.event;if(!r)return 0;var t,n=r.wheelDelta,i=r.detail;if(n!==undefined)t=n/120;else{if(i===undefined)return 0;t=-(i%3==0?i/3:i)}return t}},{key:"detectButton",value:function(e){var r=e||window.event;return r?null==r.which?r.button<2?Wn.LEFT:4===r.button?Wn.MIDDLE:Wn.RIGHT:r.which<2?Wn.LEFT:2===r.which?Wn.MIDDLE:Wn.RIGHT:Wn.LEFT}}])}();yn(Mn,"Events",{registedClass:[],registedObjs:[]});var Ln=Mn.Events,Bn=Mn.getWheelDelta.bind(Mn),Un=Mn.detectButton.bind(Mn),Vn=function(){return pn(function e(){gn(this,e)},null,[{key:"switchEvent",value:function(e){var r=e||window.event;return r?(null==r.which?r.which=r.button<2?1:4===r.button?2:3:r.which=r.which<2?1:2===r.which?2:3,r):undefined}}])}(),jn=Vn.switchEvent.bind(Vn),Hn=function(){return pn(function e(){gn(this,e)},null,[{key:"currentStyle",value:function(e,r){return e?e.currentStyle?e.currentStyle[r]:window.getComputedStyle&&(null===(t=document.defaultView)||void 0===t||null===(t=t.getComputedStyle(e,null))||void 0===t?void 0:t[r])||"":"";var t}}])}(),Gn=Hn.currentStyle.bind(Hn),zn="data:image/gif;base64,R0lGODlhZABkAKUAAPyOFPzKjPyuVPzmxPy+dPyeNPzarPz27PzSnPy2ZPymRPzGhPyWJPzu3PzixPzOnPyyZPzChPyiRPzevPz+/PzWrPy6dPyqVPzOlPyyXPzq1PzCfPyiPPzetPz69PzWpPy6bPyqTPyaLPySHPzKlPyuXPzmzPy+fPyePPzatPz29PzSpPy2bPymTPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCQAxACwAAAAAZABkAAAG/sCYcEgsGo/IpHLJbDqf0Kh0Sq1ar9hslXI4aEwHFUVLLicpjUBrBACMFKTG2Ewne1Khtl4fSnnqgFYUFSJ7hgAiFXOBjE8mDIeHIyaNlUweGZGRGX+WnkYTL5qHIhOfp0MubKN7Iy6oUhQwDSYmDTBPHiyshyydsEwUJgslCiIFCgkPcpcJvIYJv8BJBy4okW8r0kceIM97LIvTRw0Cq5ojBNtGqt9uC08qGisnBA9g4loHAt8jESpKJhT6VqqJMALn3AiYsE7QAneIFCVRkelbiYZFKDhooanAinxWHFyDKABXEhMJ0VFiAkMBqwITQE6hEAGinhRKBg3UlEim/pENzwQcyAKDn00AJ3wKucMxUogKGIsc2DlqhIMsGjgcBRBC6dI0Cla9IaHBKxEHKTWRyGKCqjsUZpeqOFArTFwiK9JGIsDW7TcOd7FU0HuIL5asWwVELfPo2wOiELYuCHzFQ4FnIzRkoYCBsCYGVz3lZZVuMRQNLiGyGOrpQORRClZuHv2tgAPKWNBA0KvgdhkPJzzrYfDBNB0uKwowYDCCQYETMHA78RDB7x6P42J4MFFhhQPWgA4YKJGWAQgHxrObkdXhhAAOHDK4wKd+GgUKHu5Lr8+/v///AAYo4IAEAgODBhNoYFKBdVCgAQkKMDdCcwq40EB6DDoBAwbW/rUhwgMLZlhFA7vxMkICmolIxQEhCLeHUCpK4YEzNvkiIhomOGACDKYNdhQDFWR4wAMCiMKAAA+AZ8QBFR2VgZIBwsACJHswwEKIRAi0FSKmDEjBLtiEYwQFJGzZBgb7eWICabIN4QEBZiKFISxAsRLBkmBumQCU/pXASwZL0rjlagMaNQqgRbwZpzoDnsDLnRmVaSYJaVoygGeTHKHlVgV5mWcvMjG5JQR8/icllcOBgCURKaDqDgM4MXgAAgJAciQCpbopqDs2ZugBDDnaYhwMF7jYxggwxihFAxm4OAIEKSq77AMdIoJBA9JW4UEDLkQ4IYUWzpmtEgcmuOq4/uimq+66/qHhwAQfVDABGOxGodECFyjnBgMoZBAAM/UuAcMJl6HDAQniZiuMVt9AAHDAQ1AwAcPuCIAtxENo0JRNECTs664QjUApxg7EycHFp/x64XpNbjVCAJVS4cAGJQhggR9kaFCtRecCsqmHk2mxgqtbFdAmIw5Y94EWNcUJAKyWeFDnISF4fIQFTrcRZCUw+BmJCNFagXXWWzdSFE9HUzG1mQwYYIkKYx+iQK5RPGAsKyKEVkkK1r2SRdJOh4ByIx48ZEgJdEfhwcYuJ/UJBSu0UIAIEriQuBQVxFnAALBsR68ZBzBuEwExC0hBBzt31LMRKqRAAAEpAESgYgfU2sSB3kscsOueBXqQnDshxOTECocsXeDpokeCImWv7QFBhlxUEIIIEx7LgAgQoBeF13sgeqMJD7gAAgEurPAwFHYb8hjGT4iqB6nsPyELkSWAWHr8+Oev//789+8/u0EAACH5BAkJADEALAAAAABkAGQAAAb+wJhwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+0uPY1JJ+XQeLxob2OhYAAAjNaika5fKYPL6M0HjC4DFHaDUSYofYgAKCaEjUweAomJAmeOlkYOe5J9Iw6Xn0MEm4kEoJ8UCqOICoKmUB4aJiYNrU4UHKp9HLWuSwcBAhwoBQolFZVMFC25fC28vUceFQWSIyEOz0gWzG8W0EoeLm6jIilNmdyeUBQNsg3IXhXjqhyMX5G5lK8uF8IKJ3S8HKDGjQU8JA5wjeKgzkmDEprejECBrYsLbm/KJXOgJ9Gfik5g4EtUwJ4WSBjfLDiIpEGENm8YKIgQ0NaKiKRYVtGgEGP+Ahi2NExIkWKChmy+QKgKUROLA4IYBTQddCCEqpJbBhxKKQCoowMXVC3aokFCSgAsDljycELVhalWUKZ0gTQNBQPzEI2IUJdKBZxiB3xSsQHwm65dPFhlNmKDzkEwXIjowwAC3CxPmbXwCspDCgICLrBYoRYNhRRQPba4bImChwMHPPTVYoLFZEQcInD+tjbFAgglSrAgYeIxb0KvYcA4MPu48+fQo0ufTr269evYs1t3DaOBdxiytXOB8VnBixEiJJwwsFt8lQEl8vJhUEKweyoUKvTcxMFA8/tG5HdbLiJU8B+AQzSwXy4csDYdBTBoAMOBF521gHYutcBBCBv+OCgEDANiVEB70lHgQAs4tRBIEvKcBUcF1x1QgiQllHbEAi6+EcF16HjUkBHb5OiNdRiMgkESSgl5HQmjkJAEji7uxaNhfvxYRItnMQCjdQeM1IcANhoBoosjXodHKn2oOBuUKV2YXQMnhCBBCAAxoWBKDYoHoYQHCshNgQciKER+CybCgYGCRuFAfJLQZ2WiIVVAgAQijPCCBARUQCKktnjQ3XfhcSrqqKSWauqpqBbhqSwTppqMCScoUIAIBRTQAgm0uGqEBw5AQCUcAAWaKAUPpLaJAiClSsEKL2AkwaOknmZsLkyl2oCXGFkgrHb5/aoKAx7aQcG2T3gwY47+ALgAigoYXCBHuFIc4G0urDThGmyhTqHCYm+gYJ8WDqD7RgHhHjABBhFYAEIEGEwQ5hMBJFICuUoYIDAAIpi06wolTFtACSsYF80yej1sRQUXZ3wEOyHIhwgDTAXqAZqImFzFBBcTvOsEhW6CwgSBioIbxUnAcLEEB5loFp7JKqHBVhkhelLP3IAgJrbcXGDzEb3uEUIKIktBAQnzbjLCv0NEIPCOnXqQ7xYN0JwSBM+Mia4Im4JCrMtXPfpA2aOM8IBzB5wAeEYrPENBAhcDkADRaHhAAN+IFBCymCQLvNlzKjygwK8jCJACUnderAC8l7CDweecQKBpXWU1zoFdBiWCYUIFKZgQ22xxN346qR6EdbEAKpQqtMCllDrB4dVMYCoF/LoYAuTVpUD5t+acKnmOJ4QtKAwgMD8CC3mPWvj180WwdakeIICi2S0g4P2o7KwgAE6hr5ArKEEAACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPyeNPzarPy+dPz27PzSnPymRPy2ZPzGhPyWJPzu3PzixPzOnPyiRPzevPzChPz+/PzWrPyqVPy6dPzOlPyyXPzq1PyiPPzetPzCfPz69PzWpPyqTPy6bPyaLPySHPzKlPyuXPzmzPyePPzatPy+fPz29PzSpPymTPy2bPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweAydRCyVjyUyIbujkwYGQK9jGu23Xtkg1f8AJA17hEYdLSKAdSItHYWPMA0Jin8Jg5CEA4mUdCIlmIQRnH8OoGUvJSUHeVAlm5yepkwTLyMaIrgMCQWrT5KjAJaySh0OK5QiGBmsS4evgCIBjsNHZhrAApdNfZyCVRPTYS/HwAAszEq0JM8iguhNcQYrGiwO71oj5XQMEWURIAIqrLk36wSDPyIWhNsy4Zo+ACgIisngEGG/Lg0OPqxwoFCAZ3a8OAA5StieDhY4aViYxdXDYNreTDDACQJLLC806hPQkdD+A5IAQHiZ8OGhCAkSxZFDmOELBaCAQjR91KCCRhEJ2Hw5oKAcI1AHEKBA8QAPmAkZKowSAaInqAlJtcRhobNOiBYvqOkxY0FAghUCUMTUK/NAhgYp4hJezLix48eQI0ueTLmy5cuYM397kaFEhheKNS+Z4ICDAA0mNAjgYE/0lA4oQigSEQLFTdd8BJTLhrvJCxZQF7HI2zvJBA/B/zBQEVov3OYHILwM5jZyBw8QQkDwcLuIg+l0SklOseBVwhRL8oEfMdmB7D8ELiahCd6A5AkXKD1IigI8APuRTfCAfkkF4B97kkXwnl3yIfEdeOJFdoAE5klQ3REHTPJSAhf+PnZddtt1R8QEKtQ1ynLNUQNOir8lB4AIwxW3RAO6YTOYjEd0YMCCf9QmIo5EFCOBABBoAIEAEjjwI5BF0JJKCaAxKeWUVFZp5ZVYPgHOCy8kluURL5yAAgYkCICBAWWN8VwHHcAFSgoPJGDiiyZIEGUXHTSgAgYmMMCABiBEcKceHZSgITAhULBkFAdcIN1sHyi61wmP6sPAA4s68ducPbaQ4hUlVPRQCB58ikQHfujDSKZXZOgfAARESEUHC0yXqKlwGPgqABiwikQJJoAnAHFgvFCpf7HMKgGyJ4hBAacvcVBFA0X5ZwGuTsy0ax0QYAtDCTy+tBIYB8yxLaz+Nzox0qsMZFqMCi20oIKSS7yg1rkhfDLFusj+SIstDOCSiwYjDFoEjecCkC8VA7jwKgESdUCBqIpowB2GqW4bQrrbHDqdAgR18AC0yu1nSErnjjvFASC8ylw1Jb7kQqlGjOAiMBhYcUK45ZjUpAPBTmdCa0RkQMC5DUrRQcsvMXDBPSnQVx9L2u66gq9INHAsMCx0KEQGPOvjwo0NhF0OAxR4S4ShXmFArBEIbIuAESTejBAKXk/RAAhhi0CABOglwcK2LOT4gNmzWZA3FSkUYEECIYjAQAgfJLlkta9WcKoKR59t4Rd5luCAAyWYxcRS/q1g3AAKBFfBCVi7kbFpfyQ0U0ILkIcQAgH0OODlYhxsK20THXAGZeyhbJt0cS9Q/JAGb8sooN2LmCzlC+a+pED0QJaw9SgQTEVlHB8kJ8IKplv5ggS3zKaBnV/CUOgICiRAAAEJKDBCCcj3NsEBDThMA3qBiSAAACH5BAkJAC8ALAAAAABkAGQAhfyOFPzKjPyuVPzmxPyeNPy+dPzarPz27PzSnPymRPy2ZPzGhPyWJPzu3PzOnPyiRPzChPzixPz+/PzWrPyqVPy6dPzOlPyyXPzq1PyiPPzCfPzevPz69PzWpPyqTPy6bPyaLPySHPzKlPyuXPzmzPyePPy+fPzatPz29PzSpPymTPy2bPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+wJdwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweEwum4sS1yYg2rgk53gzIgDYQ5SIfI9sJOyAAAkNfIVCEgWBgSZwhnsNKoqAKoSOchh/koIYlnKQmoKVnU4SHByNUoghmoyjTRwRDiwBKSSoUA0PkoOuTC4VBKsAIRkWKFN0gHh6vUouI5ohEAepaiIBbreppdpeHB+gww7dcQ0LCSUFtmERBOEAKtSFB3WADwNgEg7vw5yFKZJWkMPCYQE/ABsMXZAEYuAVDiwOJiwETlEJh1YkpBAGKoSoPScktfpCIsM7AfL4cFgRiMLHLhJEMAAFYgNGMhIiFKgwISX+GBQaOAICkYJDszIHHCQQFmLEBqNHy0g4QGJDhAYHbkbdyrWr169gw4odS7as2bNow3BwgcEF1LRVOJwoQCHBgwQUCpx4C7fJ1BPBopXoqRWuBAwrhEZbgaEw1QEkfH5t4EFxRw8v0TQokAGE5wcFGhR2hKLeQUAjJA9BkcKdJAIpVPfiUMAyvxAF+AopaPvOAt29NoA4zXDiEAkTZr5r0WF0HBQmeh80wZfyacxRG5gkLimDKAknpAcKccK5mQjcoxmXYJD4AvNlEKTXlGLISu4rgFuKOF9RAPsVnfaBfo6I0J8iLBwHAXcQEGgIQAcCUt8h4Z1GHnxkoBfhMMz+CGHdQS5lt92B3hGBXAv8MIchGSgkEqEJkvEWTgi/cSXcgQQYRwRrrikC2zFc0dZfCBUQKMFmnXmWQWgrxnEABfN5IFsRLpAQAQkujPXhQSF44E9fSByW2G2MNSmWBChMUIJtIQyWFZhOyEVXAhngpZeDcCpxAFsuTJnnn4AGKuigUJRyAgsfrLDABG+MUYoLDTTgliMSkGCCcoooEAGQXhyQQgEjJKDCBRA8pVIKI2oCwjQwRTACpoAQ8EFmY3AgAoq3KYBnFBykMFw4GXSIkwOwvhMCdVqcUKwmJdBKUgnpMdAcFgek+s6AZHBgQn8jZHmFBdzVRMYBy3Kp4xT+B0TCHbJiTPCimS+Q0ONp3Y6x4IEe7LrEjdzxIkaA82WgrxIn/Eqcv0uU0kAEKaRw1SlMsHRgCQMn0U56FHjrzAkCCBWCACf4KcS2+FaMhAuZEFeByC808EG5ADAwqxIQ9odtFYhwx0AKGLmggnjwaGxEAxFOAG/LBvOTmp6m8YNSmAvNl8CXVlgANAAgCGuErVffIcJA/BIXgggmKwGdeAwggNGW1zl7NncXCH3FASIkrUwGey1RIXfkJeGCAl2X2EUDJqhQAggElOCBBXIfAVF/LDhIG8x2MHCBs1hMNcAGG5DA6RLf9FekEr2+KkkICYjQeCcoSJzeCiynsYFdBgJkUIIABUzQQNlnCDkfu0yUYoopR4uhT3/jDBqB3fxkTegBUROnAMtwXXxajoQe4sDVISSf/QsQUR5z5N/bd4IKyzKgQt7lE+GpAnXhpUBs7YcJKQYH8F6/IUEAACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPyeNPzarPz27Py2ZPymRPzSnPzGhPyWJPzu3PzixPzOnPyyZPzChPyiRPzevPz+/Py6dPyqVPzOlPyyXPzq1PzCfPyiPPzetPz69Py6bPyqTPzWrPyaLPySHPzKlPyuXPzmzPy+fPyePPzatPz29Py2bPymTPzSpPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweEwum5EUynkd7Uwuo0mHTVemTCEAIGRK1f9FFyJ6eiIjUhQdBygBJgQLIA0daoBPFAWEhCeUTm4qDJmFJCAHnJVKBy6hAAwHTwcLeauEDCoNp0yXq5tOLxWDs6EfGbhLI8CFh00HHsHBw6bFRAd4enyuuQHOzirYXB0ZICgN0VEHb3FzTS+y26sMIOVWvgUMLgUt8lBpUC3uzgLUZWmAKRQGb2QObPjn7FaWDghmGdLnxUE7hqFYaMlwMROJF2ZAgMK4SoMWFKpmJSBW5gEykoRUaOEwctVKMw9qwtTjQQv+wWAQEIoRuTPTAi0UTMxiwIJilxIdYYLY0gGCThcBnHbp8KGoHgYgtxx4IGBDAggG6LDwCkCFQKQvSmQoRUdh0RATtErbR5SkiAhv92LpkBOjiApCBWMZqzPY4bCKvxk4sS1EgMSRs1AYKyCECwagQyRoQS6zGAoZULB4AKKEH9OwY8ueTbu27duyOzRAYQJDAgwmxgXGHYVCgxYFQ+ErTbz4BAHuBOS1xM82BQ7JtxWYroTCCwcXTDxw8EJvsRIpGYYo0X0CBmQMMHCH3YHETgzDh6DITqgAB9koNPYPAyggwY4zIUAWGUReITAcBRq4o4F5dWQggVc3FXHACu7+rIBZMRNEpd4ERmSw0DYbsBSZAenB5EJaRZjozgkqKhagVwzAOE0C7iTwIS4heoWXERC6YwKFdGTAY1EZFnFgMAnSB0GD+cGw3ywFFBjbjTDBkwQF7tUU33ymHWAfTCRUKYR3DoygwQjkIVlJCQIiyF4TaciJC5j8BbOdnriBacFLoYhgAZnN4dnAAn0CsBygicKgGwe9/RbcC2pGqummnHbq6aeghlpcnqJa8p0CLWjwwASSkKFbBhmUd8oLCghA6AYBZAApniAgkIAEG6ygwp11NGCVYxY4sOuXDRBA6B6XLUtFA0tWxoG0RVDgQLWzfLTGC2f+E4JDWbxgwT/+BGBrSWEYEZApFC7944IDZrwAHUknDPBQo7OooG4TEzzrTj5YZCCwSgqCQcEDRXnwmhUoHLzKBsSGQUEERXl7RcQYUYyInEllnPAUJUgcSgLkMnFACRMowAIHJfxIBAUjFNXNYiLOAsG7QnTggAonIHOCB3IwEfBOC/DcRAUMiaAREx2MwO8JF7wrI0khaInFT9Hp1UEEJgMAWHcthJ3JzkiBwK8eTSrBsTsi/KdEBueO+A0HXa0iggoD6HVA3v98IDOYOWcyURfe4SHC4gwUwAJdTIDQ4jYvLsFnZSMoTYXPE0xQApJFkjSh5RlU0GcIGCibWQcqwORWEz4HUAFdBhioAMnDkaUQEUkOWpLCCy8coDkgFDBNUgX/mnaMYQGUOgRUGK3n/JqtM+TB8IkesDYhG4wsKpjc2oSo8xSUAMGzIkBQAvabJsIB0CGEcIIKciTf3AHeT69/qUEAACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPzarPyeNPz27PzSnPy2ZPymRPzGhPyWJPzu3PzixPzOnPyyZPzChPzevPyiRPz+/PzWrPy6dPzOlPyyXPzq1PzCfPzetPyiPPz69PzWpPy6bPyqTPyaLPySHPzKlPyuXPzmzPy+fPzatPyePPz29PzSpPy2bPymTPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj0gk5dDYPBaRx6ZxoCSv2Kx2yx2mThYDYExGfU6prnrN5r5WIbKcHFq92vg8m1ICzf9kLCVWeoWGRnwTgIsACoOHkIYHAoyMAgeRmXgPlZUPmqBdL3GdiyF3oalXDyKliyKfqrJFFBiujBiEs7MvLLeLLKhYFMS6u2olHL+AHCVXFC8lJw8PFQ4NxsdZJSjLfyjOSC8qGKRjDCAB2Npayd5zzUgZAgyvCifZ7EYvCu9yCsKGUHAgphODB/n0CbTlbwyEbIluicCnEAmnhrCMHFjR6haLBqAodMjQoEPCfea8nTIiod4vEQE6ZDrQwqUBFSeLXPSWkVb+gncfI1Fo0fGcBC0HSLy7ZKSDi3cMHERK4VIOiZwCSyj6pcBBvgYNcUIqwQxkFj5+SolwlJCsvxFY1WRgFhDLm5R/6tQl4vbdhbhdOhSUswIwkQMbLCiDZ+EEpiQvGlYwvIWCh6IAGJjtsiSDhCcLpGSogkXwuxBShUrAwGHChwwKKUR4h2HvoRePKw7AaxBhxVkdZv8SYPu3phckMDMyANv4rgYClP/hcNT5sQYmeJ9b8cj6sQ4lIgwGECKBBNLe2RE7kCHDC5Pp48ufT7++/fv48+vfn17kAfj8aQKNBAGY8IEJI2zwAmUBnlWBAE/J4QIJHsjUYB4paFDVHwz+RJDbhWq88FMpdmxxgAMbOFCcfR0Q5YoILViYBAUFgGBACAYIQNF+DWhnymZHdPBAhGQcJCN+wv2iwRUlaBdCOPh10M0yKBxZRAuMtKBfBj4yEkJzRyi1CAn6ObChK1ElwRAgGJR5ZilpIoHlIlrmx6VKYBrRJCBP6ielN1UmISSRY7jwgJX2aeDNks8UIMCNKAhQAIPO9fhLCEBC5oAEKjbYonSAwIgoiFgckACocohQIqlqZPhmkRp8yCoXFKgA4RwuCCDWrHu8sMEIBByY4IK86uEfgMUmq+yyzDbr7LPQRqveqNIicYAEF0SgwQgnZFotER2sFkJRISiAQBr+qXQQzQMqjEZpJiks8CoAqq6jyQEBTDnGPejq08ECpdR2nAWAMDCCrLtsMO8cdULy6SIM7HjMAWt2shIkBFWiAMKqnNDlHw0XQsEIpUA5y8ioAvLQIR0QUEoF2gS3DAj96tEBwZ2oELOiv4DAMRsdBFBKaruMvMxVkLRUiQErItGBA9kucIEE1B5RwcJ/RBDJARBUMkLVR5RQTkciGICByVc00M+LaBfSQFpziGBB00V04IGPIagA9hCsuFKYJhlAkJIBC9BNBAUeLy2xoCuUokCeW//6gQUPOLB33WtrfDkMDVT8R1fvqtFBCshyccItJ2gBTQvjxv1a6No07ndgFw2MgAEIIJCwQHf3UZB5JwqEnsLP9VGwWCkcwH4hJa6Q+S0Mc5YSsrQZpEyGCJBHS8EHpVigPIgvQICqCBAY3mwDFrzJgAXZP39ABQmQUkcFxH/r3wH4l/78/vz3T0QQACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPzarPyeNPz27PzSnPy2ZPymRPzGhPyWJPzu3PzixPzOnPyyZPzChPzevPz+/PzWrPy6dPyqVPzOlPyyXPzq1PzCfPzetPyiPPz69PzWpPy6bPyqTPyaLPySHPzKlPyuXPzmzPy+fPzatPyePPz29PzSpPy2bPymTPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp9QZad08lBOpUN0y+1CDyoMx8UQhVAYldbLbnMnDpAIQK/TRSDJxM3vIzsUDHaDdQwUHX6JfRMUIYSPACEUe4qVXSUKkJAKJZaeUB0EmpoEiJ+nShkuo5AMGahsGRQBEREXFGtLCKyaKrBREx0nJCFlcyIMKCslpkgQvJAQv09wAnOaIgQNlEYc0I8c003CBt8CA9xEjt+DBuMlFA8PHg4pihMn5ewsr0Yo7IPCKZlQYgUHYwwMWDiRjg0cfQBZ5BqCAaAdDEoORBD0SESCbW5SWLBYR0NDFSTp+EJyQBQrCw3cFEhJx0AnIhk4AnSFZML+iGusEjR7I4AmABER0nWoQJKAvSMlvEETcYJNiXU0BcTEKfUbpz8RAIKYGEWFzpQoBhRhhJWVpIZDGoAAaMCBlwVAUzLYYATQ2VaHkmRoy4vBSi4mjN6hcGSCBBZ57YhgoUdJicisRIzwklixiAJJwGBAYcwFBxJqmJT4m3lzlwCYAbqQsOQAFQoeTgx4yiQDRGiGvARSzOGmpRdF2RX30uA3SQxkE/mMDWnFUGAJjIp4ADdRAxbfGKhl44A6Lw5bP00owPpR0jYdVqTc3l1Rhwft62SLzqVBcnYirFBfJcIoEBsHI/DWBhzgfSMCBun9MkEDD5BgAAMJWRBBCQP+vpFBJrwECJI4QkzwQgYllJDBiJUcsAAK1DHAgQodkojKBBksIMAYyITAQQIPsGjjkEO8UIIEJ5wgQQkKEunkk1BGKeWUVFZp5ZVYZvlGCjVq6UcHDrTwAQQftODAdV76QRAGIQBlBgYcpplIBwWYZwiacr5xAmGEhFBAlyUaKWSe30HDQoQ9NbAChgysMKiWEwTAzgg1vlDRRS/kCcMBXZ3X5FoqRCYCjXm+YB4hImSaRAedDWICnleWYJFxR4TySCl5ZmBRPz2ZNYhhgEZpKoCqJvECCYOQUGyaKYAIjQL8EWFiBYxW8EKwUU7QwqSATujAtZrG1SArh4brxXr+fA7iJ6zmjjMcYOy228SabZkBQZzytpFCmBWQ2YIEn+br0AHxCmzwwQgnrPDCDDfs8MMQRywxlPhoAAEGBKQ28R8SyCGZASoU7EYHDaQI7pMdqJDuURFEy0cDC4DAAQcCjCDyJxKsTAcDNltygMf6vUrkBHOxYgCifMTXEaVDnnBqHRFUchUkAiw7jQlP06FAJe8SshyJE1xaGLZO+PqITTaGHR7ZTTiwMghIw8IUNAIlcsB/kkVwsyIUZA0AAZasRgjcRB7gXEd2VUKQAMUwEEICLg/UwAgGiqDACI8qEeooIgjtyb5WMPOGA+PWwYID2HawESQiQBC3lRkUTQhgP1+MwGfnr1fJ6iieO0FyBCxgyIEJZ+b6jyYo8LoxDOVxnvjyzPPy/PKCa8IArRsjN0rV0AtxX34McNe9EAd8gJkIH0QesbYw3oFCC2wzjOMDC0TwQAbxj6///vz3v38QACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPyeNPzarPz27Py2ZPymRPzSpPzGhPyWJPzu3PzixPzOnPyyZPzChPyiRPzevPz+/Py6dPyqVPzOlPyyXPzq1PzCfPyiPPzetPz69Py6bPyqTPzWpPyaLPySHPzKlPyuXPzmzPy+fPyePPzatPz29Py2bPymTPzGjPyWLPzy5PzWrP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp/QqHRKrUI7pcmk1LF6v9ZOxlNgmBmFSqYLbruRjQgDQK/TGZrGe/92YeyAdCIkLnyGYRWBigAVbIePThQXc4uADBcUkJpLDR+Vih96m6NGKJSfdgwopFMUHQcZEw4NBx2ZSx0LqIoLjqxMFA0KAiKpHigut0gHCLuBCAe/TR0vFsWKDBgOSgckzoAk0dJKFAstuxsoykXM33bQTi4vASwKa3wdLNe7IS/rQx0iuKvTawmFEipEFFMoIsEEX14ogDjnbkMJJKYGqsKloMAiBgsKgWmwYiAdBP+EdBoYasmLEJ9EsIDY6sE+dyIyHKEw4ub+JwYjUhJx4REVgwlfOpQ0SccEkg4evnmgSYSCiW8JhEI54NPdCqowXJDoameQyCQulu4ScdFKCaZ1Cpw10kDDKUsmRClxUHTtAy8c4NIpoDOJGBVlzhTwUEJrkZfuFniZIBgA4SYHsmwR5wQFTGcyvWSofGKuoRInvolQ4OXAXZaO2xzwBFovlQ7N4F4YZdOZii8UXrx2xsD2oxS0PxVo60UsUw2x3zhIXamFArBRKPAdKMA4JAoZMAwHcOIF9ikGPu/6wJxVBwUWToQIUWCFBtNggm/YJaDxOCEHDIACCrNEV8VBHpAFQAgRePcfKeAtsMIJBRRwwgcKNGDgg5r+UOBCA7RsyOGIJJZoIoQUiHjiHh5OcMECESwwwgTJrDiKCyYkEMI+IoSQgAn42ejGARf0pUiPF3AmZBsuRAVaBUEuOcUBEJgEj5RhaKBgJSJocJ6JWJiwwgYrmOAAWMGpN1AL/mB5kDeAiNBfSgf8IRgGStpYwn6LWGTEBFuuhdSSDViASndFEFAZHQQsmU+gAIiwwDrUVbYBoQk4s4JtkK6lIikTUGTUNkMsWkeeJaLgziqlmgoAqiSq+g2rQnSKighfjuPAeIGEQKoQfJJGqFqfJGBbIos2KuSjt7KwDqCViTCokA0IcKhxdVaGJ5YDBBvIBgMYkSZc/Xz6y0H+xMQ55xEB2VpWBLmS2IEDJnywwQdmntfOQCrAimUUDSQImgcO/ivFASMYGUiPI/hr8BQuaLBCCKcwEEKZDj9MhYccPMDCAiw8gIy5GkORIsklp6zyyiy37PLLMMcs88wcvvKhC7bQLAV4ERQVQgUToCyFGA3E26EDxNIRggJCR4KCAAVsgEFhHGaQHCAFcPAIBQrcxADV43SgwScCRPlFCgoDgIDRfBxQqSIhTLvHW98WvEkDkL5wCGWBXPZfA7uwZohrgQjA9h4uqBkIA1obUk6cckvTAbKLtHTIASxQUgDTHFIwgeJ1iBDUdwfIckDTQlBwwOkbd7S4CaifW0JlACp4EIB/Oz/9GQMfjJ7yC2+XV4ULE7wAAgpFq7wdICG0pzMuuT1z+MwNZKqIsc83kYEEi0gAdvbLXG2HBRmDL4Q+C7NgPhPOAVL2+kwEzEAxDBAMfzxamH3//vz37///AFxREAAAO2l6MlNnMjJPaEJTY1lvVkpORFI0dmF6ek1tK1ZrditmL1VXWmxseUxSc0NPYk4vVU5kVVRWeThHRmlpUWNqNWQ=",Kn={loaderBarClassName:"ds-dwt-loaderBar",loaderBarBackgroundColor:"",loaderBarSource:se.bIE?zn:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHdpZHRoPSIxMDBweCIgaGVpZ2h0PSIxMDBweCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjE2IiBmaWxsPSIjZmU4ZTE0Ii8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iMTQuMzQ0IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSg0NSA2NCA2NCkiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjY0IiByPSIxMi41MzEiIGZpbGw9IiNmZThlMTQiIHRyYW5zZm9ybT0icm90YXRlKDkwIDY0IDY0KSIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjEwLjc1IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzUgNjQgNjQpIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iMTAuMDYzIiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgxODAgNjQgNjQpIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iOC4wNjMiIGZpbGw9IiNmZThlMTQiIHRyYW5zZm9ybT0icm90YXRlKDIyNSA2NCA2NCkiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjY0IiByPSI2LjQzOCIgZmlsbD0iI2ZlOGUxNCIgdHJhbnNmb3JtPSJyb3RhdGUoMjcwIDY0IDY0KSIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjUuMzc1IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgzMTUgNjQgNjQpIi8+PGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHZhbHVlcz0iNDUgNjQgNjQ7OTAgNjQgNjQ7MTM1IDY0IDY0OzE4MCA2NCA2NDsyMjUgNjQgNjQ7MjcwIDY0IDY0OzMxNSA2NCA2NDswIDY0IDY0IiBjYWxjTW9kZT0iZGlzY3JldGUiIGR1cj0iNzIwbXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIj48L2FuaW1hdGVUcmFuc2Zvcm0+PC9nPjwvc3ZnPg==",loaderBarSourceIE:zn,loaderBarWidth:0,loaderBarHeight:0,errorMessages:{limitReachedForZoomIn:"Error: You have reached the limit for zooming in",limitReachedForZoomOut:"Error: You have reached the limit for zooming out",insufficientParas:"Error: Not enough parameters.",invalidAngle:"Error: The angle you entered is invalid.",invalidIndex:"Error: The index you entered is invalid.",invalidHeightOrWidth:"Error: The height or width you entered is invalid.",imageNotChanged:"Error: You have not changed the current image."},generalMessages:{checkingDWTVersion:"Checking WebTwain version ...",updatingDService:"Dynamic Web TWAIN Service is updating ...",downloadingDWTModule:"Downloading the Dynamic Web TWAIN module.",refreshNeeded:"Please REFRESH your browser.",downloadNeeded:"Please download and install the Dynamic Web TWAIN.",DWTmoduleLoaded:"The Dynamic Web TWAIN module is loaded."},customProgressText:{upload:"Uploading...",download:"Downloading...",load:"Loading...",decode:"Processing...",decodeTIFF:"Processing tiff...",decodePDF:"Processing pdf...",encode:"Processing...",encodeTIFF:"Processing tiff...",encodePDF:"Processing pdf...",transfer:"Transferring...",canvasLoading:"Loading ..."},buttons:{titles:{previous:"Previous Image",next:"Next Image",print:"Print Image",scan:"Acquire new Image(s)",load:"Load local Image(s)",rotateleft:"Rotate Left",rotate:"Rotate",rotateright:"Rotate Right",deskew:"Deskew",crop:"Crop Selected Area",cut:"Cut Selected Area",changeimagesize:"Change Image Size",flip:"Flip Image",mirror:"Mirror Image",zoomin:"Zoom In",originalsize:"Show Original Size",zoomout:"Zoom Out",stretch:"Stretch Mode",fit:"Fit Window",fitw:"Fit Horizontally",fith:"Fit Vertically",hand:"Hand Mode",rectselect:"Select Mode",zoom:"Click to Zoom In",restore:"Restore Original Image",save:"Save Changes",close:"Close the Editor",removeall:"Remove All Images",removeselected:"Remove All Selected Images"},bShowAllButtons:!0,visibility:{scan:!0,load:!0,print:!0,removeall:!0,removeselected:!0,rotateleft:!0,rotate:!0,rotateright:!0,deskew:!0,crop:!0,cut:!0,changeimagesize:!0,flip:!0,mirror:!0,zoomin:!0,originalsize:!0,zoomout:!0,stretch:!0,fit:!0,fitw:!0,fith:!0,hand:!0,rectselect:!0,zoom:!0,restore:!0,save:!0,close:!0}},dialogText:{dlgRotateAnyAngle:["Angle :","Interpolation:","Keep size","  OK  ","Cancel"],dlgChangeImageSize:["New Height :","New Width :","Interpolation:","  OK  ","Cancel"],saveChangedImage:["You have changed the image, do you want to keep the change(s)?","  Yes  ","  No  "],selectSource:["Select Source:","Select","Cancel","There is no source available!"]}},Jn=undefined,Qn="ds-dwt-loaderBar";function qn(e){var r,t="230px",n="240px",i="px",o=document.createElement("div");o.className=Qn,o.style.margin="0 auto",e&&(e.unix&&"rem"===(i=e.unix)&&(t="14.375rem",n="15rem"),e.background&&(o.style.background=e.background),e.width&&(t=e.width,o.style.maxWidth=t),e.height&&(n=e.height,o.style.maxHeight=n,o.style.lineHeight=n),e.imageSource&&(r=e.imageSource));var a=document.createElement("img");if(o.appendChild(a),a.style.userSelect="none",a.style.maxWidth=t,a.style.maxHeight=n,a.style.verticalAlign="middle",a.src=r,a.draggable=!1,"px"===i){var s=parseInt(t)/2;jr.isNumber(s)&&s>0&&(a.style.width=s+"px");var u=parseInt(n)/2;jr.isNumber(u)&&u>0&&(a.style.height=u+"px")}else a.style.width=t,a.style.height=n;return o}var Yn,Xn=window,Zn=document,$n=5e5;function ei(e,r){for(var t=0;t<e.length;++t)if(e[t]==r)return!0;return!1}function ri(e){var r;return Xn.getComputedStyle?r=Xn.getComputedStyle(e):e.currentStyle&&(r=e.currentStyle),(!r||"absolute"==r.position)&&(!("auto"!=e.style.top&&""!=e.style.top||"auto"!=e.style.bottom&&""!=e.style.bottom)&&!function(e){for(var r=0;r<Zn.styleSheets.length;++r){var t=Zn.styleSheets[r],n=void 0,i=void 0,o=void 0,a=void 0;try{n=t.cssRules,i=Zn.querySelectorAll}catch(hH){}if(n&&i)for(var s=0;s<n.length;++s){o=n[s],a=!1;try{a=i(o.selectorText)}catch(hH){}if(a&&ei(a,e)){var u=o.style.getPropertyValue("top"),c=o.style.getPropertyValue("bottom");if(u&&"auto"!=u||c&&"auto"!=c)return!0}}}return!1}(e))}function ti(e){var r=Zn.createEvent("MouseEvents");return null==r||r.initMouseEvent(e.type,e.bubbles,e.cancelable,Xn,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),r}function ni(e){var r;null===(r=Zn.body)||void 0===r||r.dispatchEvent(ti(e))}function ii(e,r){if(Yn){var t=Yn.style;t.backgroundColor=["rgba(",r,",",r,",",r,",",e,")"].join(""),t.filter=["alpha(opacity=",100*e,")"].join(""),t.opacity=t.MozOpacity=e}}function oi(e,r){Yn===Jn?function(e,r){if(Yn=Zn.createElement("div")){var t=Yn.style;if(t.position="fixed",t.display="block",t.left=t.top=t.margin=t.padding=0,ii(e,r),t.zIndex=$n,t.width=t.height="100%",se.bIE&&se.IEVersion<10){var n=Zn.createElement("iframe");n.style.background="none",n.style.margin="0px auto",n.style.border="0",n.style.width="100%",n.style.height="100%",n.style.position="relative",n.style.zIndex="9999",n.src="javascript:''",Yn.appendChild(n)}Zn.createEvent&&jr.addEventListener(Yn,"click",ni)}}(e,r):ii(e,r),Zn.body&&!Zn.body.contains(Yn)&&Zn.body.appendChild(Yn)}var ai,si,ui={pendingDialogStack:[],pendingDialogTopmostStack:[],opacity:.1,grayHex:128,_updateStacking:function(e){var r,t;0!=(r=this.pendingDialogStack).length?(1!=e&&oi(ui.opacity,ui.grayHex),t=$n,jr.each(r,function(e){t++,e._dlgInfo.mask&&(e._dlgInfo.mask.style.zIndex=t++),e.style.zIndex=t})):Yn!==Jn&&(jr.removeEventListener(Yn,"click",ni),Zn&&Zn.body&&Zn.body.removeChild(Yn),Yn=Jn)},pushDialog:function(e,r){var t,n,i=this;if(e.getBoundingClientRect(),(n=e.bTopmost?i.pendingDialogTopmostStack:i.pendingDialogStack).length>=1e3)jr.error("Too many modal dialogs.");else{if((t=Zn.createElement("div")).style.zIndex="10000",t.className="dynamsoft-backdrop",1==r?(t.style.left=0,t.style.top=0,t.style.position="absolute"):(t.style.left=0,t.style.top=0,t.style.width="100%",t.style.height="100%",t.style.position="fixed"),Zn.createEvent&&jr.addEventListener(t,"click",function(r){if(e.dispatchEvent){var t=ti(r);e.dispatchEvent(t)}}),e.parentNode.insertBefore(t,e.nextSibling),e._dlgInfo.mask=t,e.bTopmost){var o=501e3;e._dlgInfo.mask&&(e._dlgInfo.mask.style.zIndex=o),e.style.zIndex=501001}n.push(e),i._updateStacking(r)}},removeDialog:function(e){var r,t,n,i=this;n=e.bTopmost?i.pendingDialogTopmostStack:i.pendingDialogStack,-1!=(r=jr.isArray(n)?jr.indexOf(e,n):-1)&&(n.splice(r,1),(t=e._dlgInfo.mask).parentNode&&t.parentNode.removeChild(t),e._dlgInfo.mask=null,i._updateStacking(!1))}};function ci(e,r){var t,n,i,o,a,s,u=this,c=!0,l=1==r?"absolute":"fixed",f="50%",d="50%",h="",g="",v=null;if(u._dlgInfo&&u._dlgInfo.styleConfig){var m=u._dlgInfo.styleConfig;jr.isString(m.position)&&(l=m.position,c=!1),(jr.isString(m.left)||jr.isNumber(m.left))&&(d=m.left,c=!1),(jr.isString(m.top)||jr.isNumber(m.top))&&(f=m.top,c=!1),(jr.isString(m.width)||jr.isNumber(m.width))&&(h=m.width,c=!1),(jr.isString(m.height)||jr.isNumber(m.height))&&(g=m.height,c=!1),jr.isString(m.transform)&&(v=m.transform,c=!1)}u.opened?jr.error("showDialog called on open dialog."):(u.opened=!0,u.removeAttribute("closed"),u.setAttribute("opened","true"),c?t=se.bIE&&"fixed"==l?{display:"block",position:"fixed",top:"35%",margin:"0 auto",left:0,right:0}:{display:"block",position:l,left:"50%",top:"50%",transform:"translate(-50%,-50%)"}:(t={display:"block",position:l,left:d,top:f,width:h,height:g},v&&(t.transform=v)),"DIALOG"==u.tagName?(se.bIE?t.margin="0 auto":t.margin="0",t.broderRadius="6px",t.boxShadow="2px 2px 0 0 rgba(0,0,0,.05)",t.webkitBoxSizing="border-box",t.boxSizing="border-box"):(t.border="0",se.bIE?t.margin="0 auto":t.margin="0",t.webkitBoxSizing="border-box",t.boxSizing="border-box"),jr.mix(u.style,t),ri(u)&&(n=u,s=((null===(i=Zn.body)||void 0===i?void 0:i.scrollTop)||(null===(o=Zn.documentElement)||void 0===o?void 0:o.scrollTop)||0)+((Xn.innerHeight?Xn.innerHeight:null===(a=Zn.documentElement)||void 0===a?void 0:a.clientHeight)-n.offsetHeight)/2,n.style.top=s+"px",n._dlgInfo.isTopOverridden=!0),e&&(u._dlgInfo.modal=!0,ui.pushDialog(u,r)))}function li(e){var r=this;return r.opened||jr.error("closeDialog called on closed dialog."),r.opened=!1,r.removeAttribute("opened"),r.setAttribute("closed","closed"),r.style.display="none",void 0!==e&&(r.returnValue=e),r._dlgInfo.isTopOverridden&&(r.style.top="auto"),r._dlgInfo.modal&&ui.removeDialog(r),r.returnValue}function fi(e){jr.isNumber(e.opacity)?ui.opacity=e.opacity:ui.opacity=.1,jr.isNumber(e.grayHex)?ui.grayHex=e.grayHex:ui.grayHex=128}function di(e){var r,t,n,i;if(!si.dlgMask){var o,a,s,u,c=!1;if(e){if(u={},(jr.isString(e.top)||jr.isNumber(e.top))&&(u.top=e.top),(jr.isString(e.left)||jr.isNumber(e.left))&&(u.left=e.left),jr.isString(e.position)&&(u.position=e.position),e.confined)document.getElementsByClassName("dwt-viewer-imageEditor-fullScreen")[0]||(c=e.confined);(jr.isString(e.width)||jr.isNumber(e.width))&&(r=e.width),(jr.isString(e.height)||jr.isNumber(e.height))&&(t=e.height),jr.isString(e.background)&&(n=e.background),jr.isString(e.imageSource)&&(i=e.imageSource),fi(e),c&&e.wrapperEl&&(a=e.wrapperEl,jr.isString(a)&&(a=Zn.getElementById(a)))}if(i||(se.bIE&&jr.isString(On.loaderBarSourceIE)&&""!=On.loaderBarSourceIE&&(i=On.loaderBarSourceIE),!i&&jr.isString(On.loaderBarSource)&&""!=On.loaderBarSource&&(i=On.loaderBarSource),i||(i=Kn.loaderBarSource)),a&&(s=a.getBoundingClientRect(),a.style.position="relative"),o=Zn.createElement("div")){var l;if(o.className="dynamsoft-dialog-wrap",o.appendChild(qn({width:r,height:t,background:n,imageSource:i})),a)a.appendChild(o),o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.transform="translate(-50%, -50%)";else null===(l=Zn.body)||void 0===l||l.appendChild(o);c&&s&&(window.onresize?si.preOnresize=window.onresize:si.preOnresize=!1,window.onscroll?si.preOnscroll=window.onscroll:si.preOnscroll=!1),si.dlgMask=o,ai.setup(o,c),u&&(o._dlgInfo.styleConfig=u),a&&(o._dlgInfo.wrapperEl=a),o.showModal()}}}function hi(){var e=si.dlgMask;if(e){var r;if(e.close(),e._dlgInfo&&e._dlgInfo.wrapperEl)e._dlgInfo.wrapperEl.removeChild(e),e._dlgInfo.wrapperEl=null;else null===(r=Zn.body)||void 0===r||r.removeChild(e);si.dlgMask=!1}si.preOnresize?window.onresize=si.preOnresize:window.onresize=null,si.preOnresize=!1,si.preOnscroll?window.onscroll=si.preOnscroll:window.onscroll=null,si.preOnscroll=!1}ai={setup:function(e,r){e.show=ci.bind(e,!1,r),e.showModal=ci.bind(e,!0,r),e.close=li.bind(e),e._dlgInfo={}}},si={dlgMask:!1,preOnresize:!1,preOnscroll:!1};var gi=pn(function fK(e){gn(this,fK),this.tagName=e,this.attr={},this.childNodes=[]}),vi=pn(function dK(e){gn(this,dK),this.value=e||""}),mi=new WeakSet,pi=function(){return pn(function e(){gn(this,e),vn(this,mi),this.stack=[],this.stacks=[]},[{key:"getStacks",value:function(){return this.stacks}},{key:"receiveInput",value:function(e){var r=this.stack;if("startTag"===e.type)r.push(new gi(e.value));else if("attr"===e.type){var t,n,i=e.value,o=i.indexOf("=");o>-1?(t=i.substring(0,o),n='"'===i.charAt(o+1)||"'"===i.charAt(o+1)?i.substring(o+2,i.length-1):i.substring(o+1),r[r.length-1].attr[t]=n):"readonly"!==i&&"disabled"!==i&&"checked"!==i||(r[r.length-1].attr[i]=i)}else if("text"===e.type){var a=e.value;a=(a=(a=a.replace(/\n/g," ")).replace(/\t/g," ")).replace(/\s+/g," ");var s=new vi(a);r.length?r[r.length-1].childNodes.push(s):this.stacks.push(s)}else if("endTag"===e.type){var u=r.pop();r.length?r[r.length-1].childNodes.push(u):this.stacks.push(u)}}},{key:"getOutPutHtml",value:function(){var e,r=document.createDocumentFragment(),t=this.stacks;for(e=0;e<t.length;e++){var n=t[e],i=ln(mi,this,Ii).call(this,n);i&&r.appendChild(i)}return r}}])}();function _i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()})}function yi(e){var r={};if(!e)return r;var t,n=e.split(";");for(t=0;t<n.length;t++){var i=n[t].split(":");if(2===i.length){var o=i[0].trim(),a=i[1].trim();""!==a&&(r[o=ln(mi,this,_i).call(this,o)]=a)}}return r}function Si(e,r){var t=ln(mi,this,yi).call(this,r);for(var n in t)e.style[n]=t[n]}function Ii(e){if(e instanceof gi){var r=document.createElement(e.tagName);for(var t in e.attr)""!==t&&""!==e.attr[t]&&("style"===t?ln(mi,this,Si).call(this,r,e.attr[t]):r.setAttribute(t,e.attr[t]));if(e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];r.appendChild(ln(mi,this,Ii).call(this,i))}return r}if(e instanceof vi)return document.createTextNode(e.value)}var bi=function(e){return e.None=0,e.AttrKey=1,e.AttrKeyQuoteStart=2,e.AttrKeyQuoteEnd=3,e.AttrValueQuoteStart=4,e.AttrSpace=5,e.AttrSplite=6,e}(bi||{}),Ci=pn(function hK(e,r){gn(this,hK),this.allChars=e,this.curIndex=0,this.state=r,this.attrStatus=bi.None,this.attrQuoteChar=""}),Ti=new WeakSet,wi=function(){return pn(function e(r,t){gn(this,e),vn(this,Ti),this.token=[],this.tokens=[],this.attrStatus=bi.None,this.thisStartTagName=null,jr.isString(r)?this.htmlString=r:r&&(this.htmlString=r.toString()),this.tokenHandler=t},[{key:"start",value:function(e){var r=e.allChars[e.curIndex];return"<"===r?(this.token.push(r),e.state=this.tagState,e):this.textState(e)}},{key:"textState",value:function(e){var r=e.allChars[e.curIndex];return"<"===r?(ln(Ti,this,Ai).call(this,"text",this.token.join("")),this.token=[],this.start(e)):(this.token.push(r),e.state=this.textState,e)}},{key:"tagState",value:function(e){var r=e.allChars[e.curIndex];return this.token.push(r),"/"===r?(e.state=this.endTagState,e):(e.state=this.startTagState,e)}},{key:"startTagState",value:function(e){var r=e.curIndex,t=e.allChars,n=t[r];if(n.match(/[a-zA-Z]/))return this.token.push(n),e.state=this.startTagState,e;if(" "===n){if(this.thisStartTagName=this.token.join("").substring(1),ln(Ti,this,Ai).call(this,"startTag",this.thisStartTagName.toLowerCase()),this.token=[],r<t.length-2){var i=t[r+1],o=t[r+2];if("/"===i&&">"===o)return ln(Ti,this,Ai).call(this,"endTag",this.thisStartTagName),this.token=[],e.state=this.start,e.curIndex+=2,e}return e.attrQuoteChar="",e.attrStatus=bi.None,e.state=this.attrState,e}return">"===n?(this.thisStartTagName=this.token.join("").substring(1),ln(Ti,this,Ai).call(this,"startTag",this.thisStartTagName.toLowerCase()),this.token=[],e.state=this.start,ln(Ti,this,Ei).call(this)&&e.curIndex++,e):void 0}},{key:"attrState",value:function(e){var r=e.curIndex,t=e.allChars,n=t[r],i=!1,o=!1;if(e.attrStatus==bi.AttrSplite?n.match(/[0-9|^<&;#]/)&&(i=!0):e.attrStatus!=bi.AttrKey&&e.attrStatus!=bi.AttrKeyQuoteStart||(n.match(/[0-9]/)||"."===n||"-"===n)&&(o=!0),n.match(/[:|a-z|A-Z|_]/)||i||o){if(e.attrStatus==bi.None||e.attrStatus==bi.AttrKey||e.attrStatus==bi.AttrKeyQuoteStart)return this.token.push(n),e.state=this.attrState,e.attrStatus==bi.None&&(e.attrStatus=bi.AttrKey),e;if(e.attrStatus==bi.AttrSpace){var a=this.token.join("");return"readonly"!==a&&"disabled"!==a&&"checked"!==a||ln(Ti,this,Ai).call(this,"attr",a),this.token=[n],e.state=this.attrState,e.attrStatus=bi.AttrKey,e}var s;if(e.attrStatus==bi.AttrSplite)for(s=r;s<t.length;s++)if(this.token.push(t[s]),s+1<t.length){var u=t[s+1],c=!1,l=!1;if(" "===u||">"===u)c=!0;else if("/"===u){if(s+2<t.length)">"===t[s+2]&&(c=!0,l=!0)}if(c)return e.curIndex=s,e.attrStatus=bi.None,e.attrQuoteChar="",ln(Ti,this,Ai).call(this,"attr",this.token.join("")),this.token=[],e.state=this.attrState,">"===u&&ln(Ti,this,Ei).call(this)&&(this.token=[],e.curIndex++,e.state=this.start),l&&(ln(Ti,this,Ai).call(this,"endTag",this.thisStartTagName),this.token=[],e.curIndex+=2,e.state=this.start),e}}if("="===n&&(e.attrStatus==bi.AttrKey||e.attrStatus==bi.AttrKeyQuoteEnd||e.attrStatus==bi.AttrSpace))return this.token.push(n),e.state=this.attrState,e.attrStatus=bi.AttrSplite,e;if(n.match(/['"]/)){if(e.attrStatus==bi.AttrValueQuoteStart||e.attrStatus==bi.AttrKeyQuoteStart){if(n===e.attrQuoteChar)return e.attrStatus==bi.AttrValueQuoteStart?(this.token.push(n),ln(Ti,this,Ai).call(this,"attr",this.token.join("")),this.token=[],e.attrStatus=bi.None):e.attrStatus=bi.AttrKeyQuoteEnd,e.attrQuoteChar="",e.state=this.attrState,e;this.token.push(n)}else e.attrStatus==bi.None?e.attrStatus=bi.AttrKeyQuoteStart:e.attrStatus==bi.AttrSplite&&(e.attrStatus=bi.AttrValueQuoteStart,this.token.push(n)),e.attrQuoteChar=n;return e.state=this.attrState,e}if(e.attrStatus==bi.AttrValueQuoteStart){if(this.token.push(n),"\\"===n&&r<t.length-1){var f=t[r+1];this.token.push(f),e.curIndex++}return e.state=this.attrState,e}if(" "===n){if(e.attrStatus==bi.AttrKey||e.attrStatus==bi.AttrKeyQuoteEnd)return e.attrStatus=bi.AttrSpace,e.state=this.attrState,e;if(e.attrStatus==bi.None||e.attrStatus==bi.AttrSplite||e.attrStatus==bi.AttrSpace)return e.state=this.attrState,e}if("/"===n){if(r<t.length-1)if(">"===t[r+1])return ln(Ti,this,Ai).call(this,"attr",this.token.join("")),ln(Ti,this,Ai).call(this,"endTag",this.thisStartTagName),this.token=[],e.state=this.start,e.curIndex++,e;return this.token.push(n),e.state=this.attrState,e}return">"===n?(ln(Ti,this,Ai).call(this,"attr",this.token.join("")),this.token=[],ln(Ti,this,Ei).call(this),e.state=this.start,e):(e.state=this.attrState,e)}},{key:"endTagState",value:function(e){var r=e.allChars[e.curIndex];if(r.match(/[a-zA-Z]/))return this.token.push(r.toLowerCase()),e.state=this.endTagState,e;if(">"===r){var t=this.token.join("").toLowerCase();return t=t.replace("</",""),ln(Ti,this,Ai).call(this,"endTag",t),this.token=[],e.state=this.start,e}}},{key:"doParse",value:function(){if(this.htmlString){var e=this.htmlString.split(""),r=new Ci(e,this.start);do{r.state.bind(this)(r),r.curIndex++}while(r.curIndex<e.length)}}},{key:"getTokens",value:function(){return this.tokens}}])}();function Ai(e,r){var t={type:e,value:r};"attr"==e&&""===r||(this.tokens.push(t),this.tokenHandler&&this.tokenHandler(t))}function Ei(){if(this.thisStartTagName){if("img"==this.thisStartTagName)return ln(Ti,this,Ai).call(this,"endTag","img"),!0;if("input"==this.thisStartTagName)return ln(Ti,this,Ai).call(this,"endTag","input"),!0}return!1}var ki=function(){return pn(function e(){gn(this,e)},null,[{key:"moveChildren",value:function(e,r){for(;e.firstChild;)e.removeChild(e.firstChild);for(;r.firstChild;){var t=r.firstChild;r.removeChild(t),e.appendChild(t)}}},{key:"setHtml",value:function(e,r){if(document.body)if(se.bIE)e.innerHTML=r;else{var t=new pi;new wi(r,t.receiveInput.bind(t)).doParse();var n=t.getOutPutHtml();n.children.length>0&&this.moveChildren(e,n)}}}])}(),Pi=ki.setHtml.bind(ki),Fi=function(){return pn(function e(r){var t;gn(this,e);var n=r.createElement("div"),i=r.createElement("div");if(i.style){this.div=i,this.container=n,this.docElem=r.documentElement,i.textContent=" ";var o=document.createElement("link");i.appendChild(o);var a=document.createElement("table");i.appendChild(a);var s=document.createElement("a");s.href="/a",i.appendChild(s);var u=document.createElement("input");u.type="checkbox",i.appendChild(u),this.leadingWhitespace=3===(null===(t=i.firstChild)||void 0===t?void 0:t.nodeType),this.tbody=!i.getElementsByTagName("tbody").length,this.htmlSerialize=!!i.getElementsByTagName("link").length,i.style.cssText="float:left;opacity:.5",this.opacity="0.5"===i.style.opacity,this.cssFloat=!!i.style.cssFloat,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",this.clearCloneStyle="content-box"===i.style.backgroundClip;var c=document.createElement("div");for(c.style.cssText="border:0;width:60px;height:0;top:0;left:-11111px;padding:0;margin-top:1px;position:absolute";i.firstChild;)i.removeChild(i.firstChild);c.appendChild(i),this.boxSizing=""===i.style.boxSizing||""===i.style.mozBoxSizing||""===i.style.webkitBoxSizing}},[{key:"reliableHiddenOffsets",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.reliableHiddenOffsetsVal}},{key:"boxSizingReliable",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.boxSizingReliableVal}},{key:"pixelBoxStyles",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.pixelBoxStylesVal}},{key:"pixelMarginRight",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.pixelMarginRightVal}},{key:"pixelPosition",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.pixelPositionVal}},{key:"reliableMarginRight",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.reliableMarginRightVal}},{key:"reliableMarginLeft",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.reliableMarginLeftVal}},{key:"roundPixelMeasures",value:function(e){return Math.round(parseFloat(e.toString()))}},{key:"computeStyleTests",value:function(){var e,r,t=this.div;if(this.docElem&&this.container&&this.docElem.appendChild(this.container),t&&(t.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;overflow:scroll;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:60%",this.pixelPositionVal=this.boxSizingReliableVal=this.reliableMarginLeftVal=this.pixelBoxStylesVal=!1,this.pixelMarginRightVal=this.reliableMarginRightVal=!0,window.getComputedStyle&&(r=window.getComputedStyle(t),this.pixelPositionVal="1%"!==(r||{}).top,this.reliableMarginLeftVal="2px"===(r||{}).marginLeft,this.boxSizingReliableVal="4px"===(r||{width:"4px"}).width,t.style.marginRight="50%",this.pixelMarginRightVal="4px"===(r||{marginRight:"4px"}).marginRight,(e=t.appendChild(document.createElement("div"))).style.cssText=t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",e.style.marginRight=e.style.width="0",t.style.width="1px",this.reliableMarginRightVal=!parseFloat((window.getComputedStyle(e)||{}).marginRight),t.style.right="60%",this.pixelBoxStylesVal=36===this.roundPixelMeasures(r.right||"0"),e&&t.removeChild(e))),t&&(t.style.display="none",this.reliableHiddenOffsetsVal=0===t.getClientRects().length,this.reliableHiddenOffsetsVal)){t.style.display="";var n=document.createElement("table"),i=document.createElement("tr"),o=document.createElement("td");i.appendChild(o);var a=document.createElement("td");a.textContent="t",i.appendChild(a),n.appendChild(i),t.appendChild(i),t.childNodes[0].style.borderCollapse="separate";var s=t.getElementsByTagName("td");s[0].style.cssText="margin:0;border:0;padding:0;display:none",this.reliableHiddenOffsetsVal=0===s[0].offsetHeight,this.reliableHiddenOffsetsVal&&(s[0].style.display="",s[1].style.display="none",this.reliableHiddenOffsetsVal=0===s[0].offsetHeight)}this.docElem&&this.container&&this.docElem.removeChild(this.container)}},{key:"createHTMLDocument",get:function(){if(document.implementation){var e=document.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}return!1}}])}(),Di=new Fi(document),xi=Di.docElem;jr.sizzle;var Oi,Ni,Ri=/^(top|right|bottom|left)$/,Wi=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Mi=new RegExp("^("+Wi+")(?!px)[a-z%]+$","i"),Li=new RegExp("^("+Wi+")(.*)$","i");window.getComputedStyle?Oi=function(e){var r,t;return(t=(r=jr.isFunction(e.getEL)?e.getEL():e).ownerDocument.defaultView)&&t.opener||(t=window),t.getComputedStyle(r)}:xi&&xi.currentStyle&&(Oi=function(e){return e.currentStyle});var Bi=/^--/,Ui="[\\x20\\t\\r\\n\\f]",Vi=new RegExp("^"+Ui+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Ui+"+$","g"),ji=["Top","Right","Bottom","Left"],Hi=new RegExp(ji.join("|"),"i");window.getComputedStyle?Ni=function(e,r,t){var n,i,o,a,s=Bi.test(r),u=e.style;return(t=t||Oi(e))&&(a=t.getPropertyValue(r)||t[r],s&&a&&(a=a.replace(Vi,"$1")||undefined),""!==a||function(e){return oo.contains(e.ownerDocument,e)}(e)||(a=fo(e,r)),!Di.pixelBoxStyles()&&Mi.test(a)&&Hi.test(r)&&(n=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=t.width,u.width=n,u.minWidth=i,u.maxWidth=o)),a===undefined?a:a+""}:xi&&xi.currentStyle&&(Ni=function(e,r,t){var n,i,o,a,s=e.style;return null==(a=(t=t||Oi(e))?t[r]:undefined)&&s&&s[r]&&(a=s[r]),Mi.test(a)&&!Ri.test(r)&&(n=s.left,(o=(i=e.runtimeStyle)&&i.left)&&(i.left=e.currentStyle.left),s.left="fontSize"===r?"1em":a,a=s.pixelLeft+"px",s.left=n,o&&(i.left=o)),a===undefined?a:a+""||"auto"});var Gi,zi=/<([\w:-]+)/,Ki=/<|&#?\w+;/,Ji=/^-ms-/,Qi=/-([\da-z])/gi,qi=/^(none|table(?!-c[ea]).+)/,Yi=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Xi={position:"absolute",visibility:"hidden",display:"block"},Zi={letterSpacing:"0",fontWeight:"400"},$i={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:Di.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},eo=document.createElement("div");Gi=eo.style,Di.cssFloat=!!eo.style.cssFloat;var ro=function(e,r){return r.toUpperCase()},to=["Webkit","Moz","ms"],no={};function io(e){var r=oo.cssProps[e]||no[e];return r||(e in Gi?e:no[e]=function(e){if(e in Gi)return e;var r=e.charAt(0).toUpperCase()+e.slice(1),t=to.length;for(;t--;)if((e=to[t]+r)in Gi)return e}(e)||e)}var oo={cssHooks:{},contains:function(e,r){var t=r&&r.parentNode;return e===t||!(!t||1!==t.nodeType||!(e.contains?e.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t)))},merge:function(e,r){for(var t=+r.length,n=0,i=e.length;n<t;)e[i++]=r[n++];if(t!=t)for(;r[n]!==undefined;)e[i++]=r[n++];return e.length=i,e},camelCase:function(e){return e.replace(Ji,"ms-").replace(Qi,ro)},cssProps:{},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0}},ao=["flo","at"].join("");oo.cssProps[ao]=Di.cssFloat?"cssFloat":"styleFloat";function so(e,r,t,n,i){for(var o=t===(n?"border":"content")?4:"width"===r?1:0,a=0;o<4;o+=2)"margin"===t&&(a+=ho(e,t+ji[o],!0,i)),n?("content"===t&&(a-=ho(e,"padding"+ji[o],!0,i)),"margin"!==t&&(a-=ho(e,"border"+ji[o]+"Width",!0,i))):(a+=ho(e,"padding"+ji[o],!0,i),"padding"!==t&&(a+=ho(e,"border"+ji[o]+"Width",!0,i)));return a}function uo(e,r,t){var n=!0,i="width"===r?e.offsetWidth:e.offsetHeight,o=Oi(e),a=Di.boxSizing&&"border-box"===ho(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Ni(e,r,o))<0||null==i)&&(i=e.style[r]),"string"==typeof i&&Mi.test(i))return i;n=a&&(Di.boxSizingReliable()||i===e.style[r]),i="string"==typeof i?parseFloat(i)||0:i}return i+so(e,r,t||(a?"border":"content"),n,o)}function co(e){return new RegExp("^(?:([+-])=|)("+Wi+")([a-z%]*)$","i").exec(e)}function lo(e,r,t,n){var i,o=1,a=20,s=n?function(){return n.cur()}:function(){return ho(e,r,"")},u=s(),c=t&&t[3]||(oo.cssNumber[r]?"":"px"),l=(oo.cssNumber[r]||"px"!==c&&+u)&&co(ho(e,r));if(l&&l[3]!==c){c=c||l[3],t=t||[],l=+u||1;do{fo(e,r,(l/=o=o||".5")+c)}while(o!==(o=s()/u)&&1!==o&&--a)}return t&&(l=+l||+u||0,i=t[1]?l+(t[1]+1)*t[2]:+t[2],n&&(n.unit=c,n.start=l,n.end=i)),i}function fo(e,r,t,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=oo.camelCase(r),u=Bi.test(r),c=e.style;if(u||(r=io(s)),a=oo.cssHooks[r]||oo.cssHooks[s],t===undefined)return a&&"get"in a&&(i=a.get(e,!1,n))!==undefined?i:c[r];"string"===(o=kn(t))&&(i=co(t))&&i[1]&&(t=lo(e,r,i),o="number"),null!=t&&t==t&&("number"!==o||u||(t+=i&&i[3]||(oo.cssNumber[s]?"":"px")),Di.clearCloneStyle||""!==t||0!==r.indexOf("background")||(c[r]="inherit"),a&&"set"in a&&(t=a.set(e,t,n))===undefined||(u?c.setProperty(r,t):c[r]=t))}}function ho(e,r,t,n){var i,o,a,s=oo.camelCase(r);return Bi.test(r)||(r=io(s)),(a=oo.cssHooks[r]||oo.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,t)),i===undefined&&(i=Ni(e,r,n)),"normal"===i&&r in Zi&&(i=Zi[r]),""===t||t?(o=parseFloat(i),!0===t||isFinite(o)?o||0:i):i}function go(e,r){if(!e||"string"!=typeof e)return[];if("boolean"==typeof r&&(r=!1),!r)if(Di.createHTMLDocument){var t=(r=document.implementation.createHTMLDocument("")).createElement("base");t.href=document.location.href,r.head.appendChild(t)}else r=document;var n=Yi.exec(e);return n?[r.createElement(n[1])]:(n=function(e,r){for(var t,n,i,o,a,s=r.createDocumentFragment(),u=[],c=0,l=e.length;c<l;c++)if((t=e[c])||0===t)if("object"===jr.type(t))oo.merge(u,t.nodeType?[t]:t);else if(Ki.test(t)){for(n=n||s.appendChild(r.createElement("div")),i=(zi.exec(t)||["",""])[1].toLowerCase(),Pi(n,(o=$i[i]||$i._default)[1]+t+o[2]),a=o[0];a--;)n=n.lastChild;oo.merge(u,n.childNodes),(n=s.firstChild).textContent=""}else u.push(r.createTextNode(t));for(s.textContent="",c=0;t=u[c++];)s.appendChild(t);return n=null,s}([e],r),oo.merge([],n.childNodes))}jr.each(["height","width"],function(e,r){oo.cssHooks[e]={get:function(r,t,n){if(t)return qi.test(ho(r,"display"))&&0===r.offsetWidth?function(e,r,t,n){var i,o={};return jr.each(r,function(t,n){o[n]=e.style[n],e.style[n]=r[n]}),i=t.apply(e,n||[]),jr.each(r,function(r,t){e.style[t]=o[t]}),i}(r,Xi,function(){return uo(r,e,n)}):uo(r,e,n)},set:function(r,t,n){var i=n&&Oi(r);return function(e,r,t){var n=Li.exec(r);return n?Math.max(0,parseInt(n[1])-(t||0))+(n[2]||"px"):r}(0,t,n?so(r,e,n,Di.boxSizing&&"border-box"===ho(r,"boxSizing",!1,i),i):0)}}});var vo,mo=Array.prototype.slice,po=" ",_o=se.bIE&&se.IEMode<10,yo=/[\n\t\r\.]/g,So=function(){function e(r,t,n){gn(this,e),yn(this,"isNodeList",!0),yn(this,"length",0),r&&!jr.isString(r)&&(jr.isArray(r)||r.isNodeList?Array.prototype.push.apply(this,jr.makeArray(r)):(this[0]=r,this.length=1))}return pn(e,[{key:"item",value:function(r){return jr.isNumber(r)?r>=this.length||r<0?null:new e(this[r]):new e(r)}},{key:"slice",value:function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return new e(mo.apply(this,t))}},{key:"getDOMNodes",value:function(){return mo.call(this)}},{key:"each",value:function(r,t){var n=this;return jr.each(n,function(i,o){var a=new e(i);return r.call(t||a,a,o,n)}),n}},{key:"getEL",value:function(){return this.length>0?this[0]:null}},{key:"all",value:function(r){return this.length>0?To(r,this):new e}},{key:"one",value:function(e){var r=this.all(e);return r.length?r.slice(0,1):r}},{key:"attr",value:function(e,r){var t=this.getEL();if(t){if(jr.isUndefined(r)){if("readonly"===e)return t.readOnly?"readonly":"";if("style"!==e&&_o)return t[e];var n=t.attributes[e];return n?n.value:undefined}"class"===e?t.className=r:t[e]=r}}},{key:"addClass",value:function(e){var r=this.getEL();r&&function(e,r){var t,n,i,o,a=e.className,s=r.length;if(a){for(t=bo(a),n=a,i=0;i<s;i++)o=Co(r[i]),t.indexOf(po+o+po)<0&&(n+=po+o);n=jr.trim(n)}else n=r.join(" ");e.className=n}(r,e.split(po))}},{key:"removeClass",value:function(e){var r=this.getEL();r&&function(e,r){var t,n,i,o=e.className,a=r.length;if(o&&a){for(t=bo(o),n=0;n<a;n++)for(i=po+Co(r[n])+po;t.indexOf(i)>=0;)t=t.replace(i,po);e.className=jr.trim(t)}}(r,e.split(po))}},{key:"hasClass",value:function(e){var r=this.getEL();return!!r&&function(e,r){var t,n,i,o=e.className,a=r.length;if(o&&a){for(t=bo(o),n=0;n<a;n++)if(i=po+Co(r[n])+po,t.indexOf(i)<0)return!1;return!0}return!1}(r,e.split(po))}},{key:"parent",value:function(){var r=this.getEL(),t=r?r.parentNode:null;return new e(t)}},{key:"remove",value:function(){var e=this.getEL();e&&e.parentNode&&e.parentNode.removeChild(e)}},{key:"offset",value:function(){var e=this.getEL();return jr.DOM.getElDimensions(e,!0)}},{key:"before",value:function(e){var r=this.getEL();if(r){var t=[e];Io(e)&&(t=go(e)),jr.each(t,function(e){r.insertBefore(e,r.childNodes[0])})}}},{key:"append",value:function(e){var r=this.getEL();if(r){var t=[e];Io(e)&&(t=go(e)),jr.each(t,function(e){r.appendChild(e)})}}},{key:"html",value:function(e){var r=this.getEL();if(r){if(jr.isUndefined(e))return function(e){var r=e.innerHTML;if(!document.all)return r;var t=/(\s+\w+)\s*=\s*([^<>"\s]+)(?=[^<>]*\/>)/gi,n=/"'([^'"]*)'"/gi;return(r=r.replace(t,'$1="$2"').replace(n,'"$1"')).replace(/<(\/?)(\w+)([^>]*)>/g,function(e,r,t,n){return r?"</"+t.toLowerCase()+">":("<"+t.toLowerCase()+n+">").replace(/=(("[^"]*?")|('[^']*?')|([\w\-\.]+))([\s>])/g,function(e,r,t,n,i,o,a,s){return i?'="'+i+'"'+o:e})}).replace(/<\/?([^>]+)>/g,function(e){return e})}(r);for(;r.firstChild;)r.removeChild(r.firstChild);jr.each(go(e),function(e){r.appendChild(e)})}}},{key:"style",value:function(e,r){var t=this.getEL();if(t)return fo(t,e,r)}},{key:"css",value:function(e){jr.each(this,function(r){jr.each(e,function(e,t){fo(r,t,e)})})}},{key:"show",value:function(){jr.each(this,function(e){e.style.display=""})}},{key:"hide",value:function(){jr.each(this,function(e){e.style.display="none"})}}])}();function Io(e){return jr.isString(e)&&(e=jr.trim(e))&&e.length>=3&&jr.startsWith(e,"<")&&jr.endsWith(e,">")}function bo(e){return(po+e+po).replace(yo,po)}function Co(e){return e.replace(yo," ")}function To(e,r){var t=r;return t&&(t instanceof HTMLElement||Ao(t)&&(t=t.getEL())),jr.isString(e)?(Io(e)&&jr.error("Err 4002."),new So(jr.sizzle(e,t))):e&&e.isNodeList?e:new So(e)}function wo(e,r){var t=To(e,r);return t.length?t.slice(0,1):t}function Ao(e){return e instanceof So}var Eo=function(){return pn(function e(){gn(this,e)},null,[{key:"getEscapeReg",value:function(){return this.escapeReg}},{key:"getUnEscapeReg",value:function(){if(this.unEscapeReg)return this.unEscapeReg;var e=Object.keys(this.HTML_ENTITIES).join("|")+"|&#(\\d{1,5});";return this.unEscapeReg=new RegExp(e,"g"),this.unEscapeReg}},{key:"fromUnicode",value:function(e){var r=this;return e.replace(/\\u([a-f\d]{4})/gi,function(e,t){return String.fromCharCode(parseInt(t,r.HEX_BASE))})}},{key:"escapeHtml",value:function(e){var r=this;return String(e).replace(this.getEscapeReg(),function(e){return r.REVERSE_ENTITIES[e]})}},{key:"escapeRegExp",value:function(e){return e.replace(this.ESCAPE_REG_EXP,"\\$&")}},{key:"unEscapeHtml",value:function(e){var r=this;return e.replace(this.getUnEscapeReg(),function(e,t){return r.HTML_ENTITIES[e]||String.fromCharCode(parseInt(t,10))})}}])}();vo=Eo,yn(Eo,"HEX_BASE",16),yn(Eo,"ESCAPE_REG_EXP",/[\-#$\^*()+\[\]{}|\\,.?\s]/g),yn(Eo,"HTML_ENTITIES",{"&amp;":"&","&gt;":">","&lt;":"<","&nbsp;":" ","&#x60;":"`","&#x2F;":"/","&quot;":'"',"&#x27;":"'"}),yn(Eo,"REVERSE_ENTITIES",{}),yn(Eo,"escapeReg",/[&>< `\/"']/g),yn(Eo,"unEscapeReg",null),jr.each(vo.HTML_ENTITIES,function(e,r){vo.REVERSE_ENTITIES[e]=r});var ko,Po=Eo.fromUnicode.bind(Eo),Fo=Eo.escapeHtml.bind(Eo),Do=Eo.escapeRegExp.bind(Eo),xo=Eo.unEscapeHtml.bind(Eo),Oo=function(){return pn(function e(){gn(this,e)},null,[{key:"isValidParamValue",value:function(e){var r=kn(e);return null==e||"object"!==r&&"function"!==r}},{key:"param",value:function(e,r,t,n){var i=this,o=r||this.SEP,a=t||this.EQ,s=null==n||n,u=[];return jr.each(e,function(e,r){var t=jr.urlEncode(r);i.isValidParamValue(e)?(u.push(t),jr.isDef(e)&&u.push(a,jr.urlEncode(String(e))),u.push(o)):jr.isArray(e)&&e.length&&jr.each(e,function(e){i.isValidParamValue(e)&&(u.push(t,s?jr.urlEncode("[]"):Z),jr.isDef(e)&&u.push(a,jr.urlEncode(String(e))),u.push(o))})}),u.pop(),u.join(Z)}},{key:"unparam",value:function(e,r,t){if(!jr.isString(e)||!(e=jr.trim(e)))return{};var n,i=r||this.SEP,o=t||this.EQ,a={},s=jr.urlDecode,u=_n(e.split(i));try{for(u.s();!(n=u.n()).done;){var c=n.value,l=c.indexOf(o),f=void 0,d=void 0;if(-1===l)f=s(c),d=null;else{f=s(c.substring(0,l)),d=c.substring(l+1);try{d=s(d)}catch(hH){jr.error("decodeURIComponent error : "+d),jr.error(hH)}jr.endsWith(f,"[]")&&(f=f.substring(0,f.length-2))}f in a?jr.isArray(a[f])?a[f].push(d):a[f]=[a[f],d]:a[f]=d}}catch(h){u.e(h)}finally{u.f()}return a}}])}();ko=Oo,yn(Oo,"SEP","&"),yn(Oo,"EQ","="),yn(Oo,"HTML_ENTITIES",{"&amp;":"&","&gt;":">","&lt;":"<","&#x60;":"`","&#x2F;":"/","&quot;":'"',"&#x27;":"'"}),yn(Oo,"REVERSE_ENTITIES",{}),jr.each(ko.HTML_ENTITIES,function(e,r){ko.REVERSE_ENTITIES[e]=r});var No=function(){return pn(function e(){gn(this,e)},null,[{key:"headersContainsJson",value:function(e){var r=e.toLowerCase();return r.indexOf("text/json")>=0||r.indexOf("application/json")>=0}},{key:"contentTypeIsJson",value:function(e){var r=e.toLowerCase();return"text/json"===r||"application/json"===r}}])}(),Ro=No.headersContainsJson.bind(No),Wo=No.contentTypeIsJson.bind(No),Mo=function(e){return e.OK=0,e.Custom=-1,e.NETWORK_BASE=-4200,e.WS_DISCONN=-4201,e.COMMON_BASE=-5e3,e.JSON_REQUIRED=-5001,e.OBJECT_DISPOSED=-5002,e.INVALID_TASK=-5003,e.OBJECT_DISPOSING=-5004,e}({}),Lo=function(e){return e.WS_DISCONN="The Web Socket connection failed.",e.JSON_REQUIRED="The input is not a JSON object or JSON styled string.",e.OBJECT_DISPOSED="The object has been disposed.",e.INVALID_TASK="The task is invalid.",e.OBJECT_DISPOSING="The object need to be disposed.",e}({}),Bo=function(){return pn(function e(){gn(this,e)},null,[{key:"message",value:function(e){var r;return null!==(r=this._errorMessage[e])&&void 0!==r?r:"Unknown error."}},{key:"init",value:function(){this._errorMessage[Mo.OK]="Successful.",this._errorMessage[Mo.WS_DISCONN]=Lo.WS_DISCONN,this._errorMessage[Mo.JSON_REQUIRED]=Lo.JSON_REQUIRED,this._errorMessage[Mo.OBJECT_DISPOSED]=Lo.OBJECT_DISPOSED,this._errorMessage[Mo.INVALID_TASK]=Lo.INVALID_TASK,this._errorMessage[Mo.OBJECT_DISPOSING]=Lo.OBJECT_DISPOSING}}])}();yn(Bo,"_errorMessage",Object.create(null)),Bo.init();var Uo=function(){return pn(function e(r,t){gn(this,e),yn(this,"name","DSError"),this.message=null!=t?t:"string"==typeof r?r:Bo.message(null!=r?r:Mo.OK),this._code="string"==typeof r?Mo.Custom:null!=r?r:Mo.OK},[{key:"code",get:function(){return this._code}}])}(),Vo=function(e){return e.GET_TASKID=0,e.GET_EVENT_TASKID=1,e.ONMESSAGE_PROCESS_DATA=2,e.ONMESSAGE_GET_TASKID=3,e.ONMESSAGE_GET_EVENT_TASKID=4,e.HANDLE_RAW_MESSAGE=5,e.HANDLE_PROCESSED_MESSAGE=6,e}({}),jo=function(){return pn(function t(e){gn(this,t),yn(this,"_disposed",!1),this._serverInfo=e,this._ref=1},[{key:"serverInfo",get:function(){return this._serverInfo}},{key:"disposed",get:function(){return this._disposed}},{key:"dispose",value:(r=dn(Tn().m(function n(){return Tn().w(function(e){for(;;)switch(e.n){case 0:if(this._ref--,!(this._ref>0)){e.n=1;break}return e.a(2,!1);case 1:return this._disposed=!0,e.n=2,this._terminate();case 2:return e.a(2,!0)}},n,this)})),function(){return r.apply(this,arguments)})},{key:"_terminate",value:(e=dn(Tn().m(function i(){return Tn().w(function(e){for(;;)if(0===e.n)return e.a(2)},i)})),function(){return e.apply(this,arguments)})},{key:"addRef",value:function(){this._ref++}}]);var e,r}(),Ho=function(){return pn(function e(){gn(this,e)},null,[{key:"setErr",value:function(e,r,t){e._errorCode=r,e._errorString=t}},{key:"ERR_HTTPError",value:function(e,r,t){this.setErr(e,ot.HTTPError,["HTTP process error: ",t," (",r,")."].join(""))}},{key:"ERR_UserCanceled",value:function(e){this.setErr(e,ot.UserCanceled,"User cancelled the operation.")}},{key:"ERR_HTTPRedirected",value:function(){return{code:ot.HTTPRedirected,message:"The http url redirected."}}}])}();Ho.setErr.bind(Ho);var Go=Ho.ERR_HTTPError.bind(Ho),zo=Ho.ERR_UserCanceled.bind(Ho),Ko=Ho.ERR_HTTPRedirected.bind(Ho),Jo=/[#\/\?@]/g,Qo=/[#\?]/g,qo={scheme:1,userInfo:2,hostname:3,port:4,path:5},Yo=new RegExp("^(?:([\\w\\d+.-]+):)?(?://(?:([^/?#@]*)@)?([\\w\\d\\-\\u0100-\\uffff.+%]*|\\[[^\\]]+\\])(?::([0-9]+))?)?(.+)?$");function Xo(e,r){return jr.isString(e)&&jr.isString(r)?e.toLowerCase()===r.toLowerCase():e===r}function Zo(e,r){return encodeURI(e).replace(r,function(e){return"%"+function(e){return 1===e.length?"0"+e:e}(e.charCodeAt(0).toString(16))})}var $o,ea,ra=function(){function e(r){if(gn(this,e),yn(this,"scheme",""),yn(this,"userInfo",""),yn(this,"hostname",""),yn(this,"port",""),yn(this,"path",""),r instanceof e)return jr.clone(r);e.getComponents(r,this)}return pn(e,[{key:"clone",value:function(){var r=new e,t=this;return jr.each(qo,function(e,n){r[n]=t[n]}),r}},{key:"getScheme",value:function(){return this.scheme}},{key:"setScheme",value:function(e){return this.scheme=e,this}},{key:"getHostname",value:function(){return this.hostname}},{key:"setHostname",value:function(e){return this.hostname=e,this}},{key:"setUserInfo",value:function(e){return this.userInfo=e,this}},{key:"getUserInfo",value:function(){return this.userInfo}},{key:"setPort",value:function(e){return this.port=e,this}},{key:"getPort",value:function(){return this.port}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"getPath",value:function(){return this.path}},{key:"isSameOriginAs",value:function(e){var r=this;return Xo(r.hostname,e.hostname)&&Xo(r.scheme,e.scheme)&&Xo(r.port,e.port)}},{key:"toString",value:function(e){var r,t,n,i,o,a=[],s=this;return(r=s.scheme)&&(a.push(Zo(r,Jo)),a.push(":")),(t=s.hostname)&&(a.push("//"),(o=s.userInfo)&&(a.push(Zo(o,Jo)),a.push("@")),a.push(encodeURIComponent(t)),(i=s.port)&&(a.push(":"),a.push(i))),(n=s.path)&&(t&&!jr.startsWith(n,"/")&&(n="/"+n),a.push(Zo(n,Qo))),a.join("")}}],[{key:"getComponents",value:function(e,r){var t=(e=e||Z).match(Yo)||[],n=r||{};return jr.each(qo,function(e,r){n[r]=t[e]}),n}}])}(),ta=undefined,na=jr.each,ia=jr.error,oa=jr.isFunction,aa=jr.isString,sa=se.bIE&&se.IEVersion<=9,ua=new ra(location.href),ca=!(ua&&/^(?:about|app|app\-storage|.+\-extension|file|widget)$/.test(ua.getScheme())||!window.XMLHttpRequest)&&"withCredentials"in(new XMLHttpRequest||{}),la=/^(?:GET|HEAD)$/,fa=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,da={xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},ha=ta,ga=function(){function e(){gn(this,e),yn(this,"url",!1),yn(this,"onSuccess",!1),yn(this,"onError",!1),yn(this,"onComplete",!1),yn(this,"method","GET"),yn(this,"async",!0),yn(this,"xhrFields",!1),yn(this,"mimeType",!1),yn(this,"username",!1),yn(this,"password",!1),yn(this,"data",!1),yn(this,"dataType","text"),yn(this,"headers",!1),yn(this,"contentType","application/x-www-form-urlencoded; charset=UTF-8"),yn(this,"beforeSend",!1),yn(this,"afterSend",!1),yn(this,"timeout",0),yn(this,"cache",!0),yn(this,"crossDomain",!1),yn(this,"retry",0)}return pn(e,[{key:"setRequestHeader",value:function(e,r){this.headers[e]=r}},{key:"getAllResponseHeaders",value:function(){return 2===this.state&&this.responseHeadersString||""}},{key:"getNativeXhr",value:function(){return this.nativeXhr}},{key:"getResponseHeader",value:function(e){var r,t;if(e=e.toLowerCase(),2===this.state){if(!(t=this.responseHeaders))for(t=this.responseHeaders={};r=fa.exec(this.responseHeadersString||"");)t[r[1].toLowerCase()]=r[2];r=t[e]}return r===undefined?"":r}},{key:"overrideMimeType",value:function(e){return this.state||(this.mimeType=e),this}},{key:"abort",value:function(e){return this.state=3,this.status=0,this.statusText=null!=e?e:"abort",this.nativeXhr.abort(),this._callback(),this}},{key:"_ioReady",value:function(e,r){var t=!1,n=this;if(2!==this.state&&3!==this.state){1===this.state&&(this.state=2),this.readyState=4,this.onreadystatechange&&this.onreadystatechange(),e>=200&&e<300||304===e?304===e?(r="not modified",t=!0):(r="success",t=!0):e<0&&(e=0);try{e>=200&&this.handleResponseData()}catch(hH){ia(hH,"error"),r=hH.message||"parser error"}return(e<200||!t)&&this.retry>0?(this.retry=this.retry-1,void setTimeout(function(){n.sendInternal()},200)):(this.status=e,this.statusText=r,this._callback(t),t)}}},{key:"_callback",value:function(e){var r=this,t=this.timeoutTimer;t&&(clearTimeout(t),this.timeoutTimer=0),na([e?this.onSuccess:this.onError,this.onComplete],function(e){oa(e)&&e.apply(r.context,[r.responseData,r.statusText,r])}),this.responseData=null}},{key:"handleResponseData",value:function(){var e,r=this.dataType,t=this.nativeXhr;if("blob"===r||"arraybuffer"===r)if(sa){var n,i,o;if("responseBody"in t)n=t.responseBody,i=window.dsVbsBinGetLength(n),e=new window.VBArray(window.dsVbsBinGetBytes(n,0,i)).toArray();else for(e=[],i=(n=t.responseText).length,o=0;o<i;++o)e.push(255&n.charCodeAt(o));n=null}else e=window.Blob?t.response:"responseBody"in t?t.responseBody:t.responseText;else if("json"==r)e=t.responseType&&"json"==t.responseType.toLowerCase()?t.response:t.responseText?jr.parse(t.responseText):jr.parse(t.response);else if("user-defined"===r)e=t.response!==undefined?t.response:t.responseText;else{var a;this.responseText=e=null!==(a=t.responseText)&&void 0!==a?a:"";try{var s=t.responseXML;s&&s.documentElement&&(this.responseXML=s)}catch(hH){}}this.responseData=e}},{key:"sendInternal",value:function(e){var r,t,n,i,o,a,s,u,c,l,f,d=this;if(t=(r=this._setup(e)).method,aa(t)&&(t=t.toUpperCase()),o=r.contentType,n=r.url,i=r.dataType,u=r.mimeType,aa(n)&&(this.nativeXhr=a=new XMLHttpRequest,a)){try{if(this.state=1,r.username?a.open(t,n,r.async,r.username,r.password):a.open(t,n,r.async),(r.async||se.bIE)&&i&&"user-defined"!=i&&"responseType"in a)try{a.responseType=i}catch(hH){}}catch(h){return void(this.state<2?(ia(h,"error"),this._ioReady(-1,"open error: "+(jr.isNumber(h.number)?"("+h.number+")":"")+(h.message||""))):ia(h))}"withCredentials"in(s=r.xhrFields||{})&&(ca||delete s.withCredentials),na(s,function(e,r){try{a[r]=e}catch(hH){ia(hH)}}),u&&a.overrideMimeType&&a.overrideMimeType(u),!1===(c=r.headers||{})["X-Requested-With"]&&delete c["X-Requested-With"],"setRequestHeader"in a&&(o&&a.setRequestHeader("Content-Type",r.contentType),a.setRequestHeader("Accept",i&&da[i]?da[i]+("*"===i?"":", */*; q=0.01"):da["*"]),na(c,function(e,r){a.setRequestHeader(r,e)})),"GET"!=t||r.cache||(a.setRequestHeader("If-Modified-Since","0"),a.setRequestHeader("Cache-Control","no-cache")),f=(l=!la.test(r.method))&&r.data||null,l&&sa&&(f=r.data),r.async&&r.timeout>0&&(r.timeout<300&&(r.timeout=300),this.timeoutTimer=setTimeout(function(){d.abort("timeout")},r.timeout));try{if(this.state=1,oa(this.beforeSend))if(!1===this.beforeSend(a,d))return void this.abort("cancel");a.send(f),f=null,r.data=null,oa(this.afterSend)&&this.afterSend(d)}catch(hH){this.state<2?(ia(hH,"error"),this._ioReady(-1,"send error: "+(hH.message||""))):ia(hH)}if(!r.async||4===a.readyState)return d._xhrCallback();a.onreadystatechange=function(){d._xhrCallback()}}}},{key:"_xhrCallback",value:function(e,r){var t,n=this.nativeXhr;try{if(4===n.readyState||r)if(n.onreadystatechange=ha,r)4!==n.readyState&&n.abort();else{this.responseHeadersString=n.getAllResponseHeaders();var i,o=n.status;try{i=n.statusText}catch(hH){ia("xhr statusText error: "),ia(hH),i=""}t=this._ioReady(o,i)}}catch(hH){ia(hH,"error"),n.onreadystatechange=ha,r||this._ioReady(-1,hH.message||"process error")}return t}},{key:"_setup",value:function(r){var t,n,i,o,a;if(r){for(n in this.context=r.context,delete r.context,r instanceof e&&(r=r.config),this.config=r,o=r.url,jr.startsWith(o,"//")&&(r.url=o="http:"+o),(jr.startsWith(o,"http://")||jr.startsWith(o,"https://"))&&(a=new ra(o)),t=r.dataType?r.dataType.toLowerCase():"text",r.dataType=t,r.method?r.method=r.method.toUpperCase():r.method="GET",a&&!("crossDomain"in r)&&(r.crossDomain=!a.isSameOriginAs(ua)),i=r.headers)ma(i[n])&&delete i[n];jr.mix(this,r)}return this.state=1,this}},{key:"dispose",value:function(){this.responseHeaders=null,this.responseHeadersString=null,this.responseData=null,this.responseText=null,this.responseXML=null,this.context=null,this.config=null,this.onSuccess=null,this.onError=null,this.onComplete=null,this.xhrFields=null,this.data=null,this.headers=null,this.beforeSend=null,this.afterSend=null}}])}();function va(e){if(!e||!aa(e.url))throw jr.log("the url is error."),new Error("Invalid URL provided");var r=new ga;return e.async=!!e.async,e.async?(r.sendInternal(e),r):r.sendInternal(e)}function ma(e){return e===ta}var pa,_a=undefined,ya=se.bIE&&se.IEVersion<=9;null!==($o=self)&&void 0!==$o&&$o.fetch?pa=self.fetch:null!==(ea=window)&&void 0!==ea&&ea.fetch&&(pa=window.fetch);var Sa=0;function Ia(e,r){var t=!1,n=r;return function(i,o){var a=!1,s="text",u=!1,c=undefined,l=null,f=o?function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Cn(Object(t),!0).forEach(function(r){yn(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cn(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({},o):{};if(f&&(f.dataType&&(s=f.dataType),f.fetchRaw&&(u=!0),f.timeout)){var d=f.timeout;d<300&&(d=300);var h=new AbortController;f.signal,f.signal=h.signal;var g=setTimeout(function(){a||t||h.abort()},d);c=function(){return clearTimeout(g)}}t=!1;var v=pa(i,f).then(function(i){if(i.ok){var o;if(a=!0,!e)return i;if(e.__clickCancel)return e.__clickCancel=!1,e.__cancelBeforObjectCreated=!1,t=!0,i;e.IfShowCancelDialogWhenImageTransfer?(Ta(!0),l=e.on("cancel",function(){t=!0})):Ta(!1);var s=i.headers.get("Content-Length"),u=s?parseInt(s,10):null,c=0;e._onPercent&&n===r&&e._onPercent({loaded:c,total:u});var f=null==i||null===(o=i.body)||void 0===o?void 0:o.getReader();if(!f)return new Response(null,{headers:i.headers});var d=new ReadableStream({start:function(i){var o=function(){return f?f.read().then(function(a){if(a.done||t)return t?f.cancel():l&&(e.off("cancel",l),l=null),i.close(),Promise.resolve();var s=a.value;if(!s)return i.close(),Promise.resolve();c+=s.length,e._onPercent&&n===r&&e._onPercent({loaded:c,total:u});try{return i.enqueue(s),o()}catch(d){return jr.error(d),i.close(),l&&(e.off("cancel",l),l=null),Promise.resolve()}})["catch"](function(r){jr.error("Stream read error:",r),i.error(r),l&&(e.off("cancel",l),l=null)}):(i.close(),Promise.resolve())};f?setTimeout(function(){o()},0):i.close()}}),h=i.headers.get("Content-Type");return h&&""!==h||(h="application/octet-stream"),new Response(d,{headers:{"Content-Type":h}})}if("opaqueredirect"===i.type)throw Ko();var g={};throw Go(g,i.status,i.statusText),{code:g._errorCode,message:g._errorString,httpCode:i.status}})["catch"](function(r){throw void 0!==c&&c(),l&&e&&"function"==typeof e.off&&(e.off("cancel",l),l=null),r});return u?v:(v="blob"===s?v.then(function(e){var r=e.headers.get("content-type");return Wo(r)?e.json():se.bLinux?e.arrayBuffer().then(function(e){return new Blob([e],{type:r})}):e.blob()}):"json"===s?v.then(function(e){return e.json()}):"arraybuffer"===s?v.then(function(e){return Wo(e.headers.get("content-type"))?e.json():e.arrayBuffer()}):v.then(function(e){return e.text()})).then(function(e){if(t){var r={};throw zo(r),{code:r._errorCode,message:r._errorString}}return e})["finally"](function(){void 0!==c&&c(),l&&e&&"function"==typeof e.off&&(e.off("cancel",l),l=null)})}}function ba(e,r){return pa?Ia(e,r):function(e,r){return Sa=r,ya&&jr.addVBS(["Function dsVbsBinGetAt(strBinary,iOffset)\r\n"," dsVbsBinGetAt=AscB(MidB(strBinary,iOffset+1,1))\r\n","End Function\r\n","Function dsVbsBinGetBytes(strBinary,iOffset,iLength)\r\n"," Dim aBytes()\r\n"," ReDim aBytes(iLength-1)\r\n"," For i=0 To iLength-1\r\n","  aBytes(i)=dsVbsBinGetAt(strBinary,iOffset+i)\r\n"," Next\r\n"," dsVbsBinGetBytes=aBytes\r\n","End Function\r\n","Function dsVbsBinGetLength(strBinary)\r\n"," dsVbsBinGetLength=LenB(strBinary)\r\n","End Function"].join("")),function(t,n){return new Rn(function(i,o){var a={url:t,async:!0,onSuccess:function(e,r,t){var n=!1;if(t&&t.responseHeadersString){var o=t.responseHeadersString;Ro(o)&&(jr.isArray(e)||e instanceof ArrayBuffer)&&(n=!0)}if(n){var a=e;e instanceof ArrayBuffer&&(a=new Uint8Array(e));for(var s=[],u=0;u<a.length;u+=1e4){var c=Math.min(u+1e4,a.length),l=a.subarray?a.subarray(u,c):Array.prototype.slice.call(a,u,c);s.push(String.fromCharCode.apply(null,l))}i(s.join(""))}else i(e)},onError:function(e,r,t){var n={};Go(n,null==t?void 0:t.status,r),o({code:n._errorCode,message:n._errorString,httpCode:null==t?void 0:t.status})},dataType:"text",method:_a,data:_a,headers:_a,contentType:_a,mimeType:_a};n&&(n.method&&(a.method=n.method),n.body&&(a.data=n.body),n.headers&&(a.headers||(a.headers={}),jr.each(n.headers,function(e,r){a.headers[r]=e})),n.dataType&&(a.dataType=n.dataType),n.contentType&&(a.contentType=n.contentType),jr.isNumber(n.timeout)&&n.timeout>0&&(a.timeout=n.timeout)),"blob"===a.dataType&&ya&&(a.mimeType="text/plain; charset=x-user-defined"),e&&(e._onPercent&&(a.beforeSend=function(t,n,i){t&&t.upload&&t.upload.addEventListener("progress",function(t){e._onPercent&&Sa===r&&e._onPercent(t)},!1)}),Ta(!!e.IfShowCancelDialogWhenImageTransfer));var s=va(a);if(e&&e.IfShowCancelDialogWhenImageTransfer){var u=e.on("cancel",function(){s&&"function"==typeof s.abort&&s.abort()});s.onreadystatechange=function(){4===s.readyState&&u&&e.off&&e.off("cancel",u)}}})}}(e,r)}var Ca=ba(null,0);function Ta(e){var r=jr.sizzle(".dynamsoft-btnCancel");if(r.length>0){var t=r[0];t.style.display=e?"":"none"}}var wa=jr.getLogger();function Aa(e){return e instanceof Uo||e&&e.code&&e.message?e:new Uo((null==e?void 0:e.message)||"Unknown error")}var Ea=new WeakSet,ka=function(e){function r(){var e;gn(this,r);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return vn(e=hn(this,r,[].concat(n)),Ea),e}return In(r,e),pn(r,[{key:"send",value:(t=dn(Tn().m(function n(e,r,t){return Tn().w(function(e){for(;;)switch(e.n){case 0:wa.error("HTTP Client send not supported");case 1:return e.a(2)}},n)})),function(e,r,n){return t.apply(this,arguments)})},{key:"requestSync",value:function(e,r,t){return undefined}},{key:"request",value:function(e,r,t,n){return ln(Ea,this,Fa).call(this,e,r,t,undefined,undefined,n)}},{key:"testConnection",value:function(e,r,t,n){return ln(Ea,this,Fa).call(this,undefined,undefined,e,r,t,n)}}]);var t}(jo);function Pa(e){var r=this.serverInfo,t=r.ssl?"https://":"http://",n="".concat(t).concat(r.server);if(r.port&&(n+=":".concat(r.port)),e){var i=jr.startsWith(e,"/"),o=jr.endsWith(n,"/");n+=i||o?e:"/"+e,jr.endsWith(n,"/")&&(n=n.slice(0,-1))}return n}function Fa(e,r,t,n,i,o){return Da.apply(this,arguments)}function Da(){return Da=dn(Tn().m(function e(r,t,n,i,o,a){var s,u;return Tn().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,s=null!=n?n:{},r&&(s.body=r),s.method||(s.method="POST"),a&&(s.timeout=a),u=ln(Ea,this,Pa).call(this,t),wa.debug("HTTP URL: "+u),e.n=1,Ca(u,s);case 1:return e.a(2,e.v);case 2:throw e.p=2,Aa(e.v);case 3:return e.a(2)}},e,this,[[0,2]])})),Da.apply(this,arguments)}var xa,Oa=function(){return pn(function e(){gn(this,e)},null,[{key:"toJson",value:function(e){try{if("object"===kn(e))return e;var r="string"!=typeof e?jr.stringify(e):e;return jr.parse(r)}catch(t){throw t instanceof Uo?t:new Uo(Mo.JSON_REQUIRED)}}}])}(),Na=jr.getLogger();function Ra(e){return e instanceof Uo||e&&e.code&&e.message?e:new Uo((null==e?void 0:e.message)||"Unknown error")}function Wa(e){return"__proto__"===e||"prototype"===e||"constructor"===e}var Ma=new WeakSet,La=function(e){function r(e){var t;return gn(this,r),vn(t=hn(this,r,[e]),Ma),yn(t,"_defaultRetries",1),yn(t,"_ws",null),yn(t,"_events",Object.create(null)),yn(t,"_lic_callback",null),yn(t,"_blob_callbacks",[]),yn(t,"_bHeartBeatStarted",!1),yn(t,"_heartBeatTicks",3e4),t._ws=null,t.bUseParentWS=!1,t._tasks=Object.create(null),t._timedout=!1,t.bReady=!1,t._blob_callbacks=[],t._processing_blob=!1,t}return In(r,e),pn(r,[{key:"ws",get:function(){return this._ws}},{key:"requestSync",value:function(e,r,t){return Na.error("WebSocket Client requestSync not supported"),undefined}},{key:"send",value:(i=dn(Tn().m(function o(e,r,t){var n,i,a,s,u;return Tn().w(function(o){for(;;)switch(o.p=o.n){case 0:if(n=t.client,o.p=1,(i=t.taskId)!==undefined){o.n=3;break}return o.n=2,r(e,Vo.GET_TASKID,n._requestTaskId,t);case 2:i=o.v;case 3:if(a=n._tasks[i]){o.n=4;break}throw Na.error("invalid task id: "+i),new Uo(Mo.INVALID_TASK);case 4:return o.n=5,ln(Ma,n,qa).call(n,!1);case 5:return o.n=6,ln(Ma,n,Xa).call(n,e,r,t,a);case 6:Na.debug("begin to send data "+i),n.disposed||n._ws.send(e),e=null,Na.debug("end to send data "+i),o.n=8;break;case 7:o.p=7,u=o.v,Na.debug("failed to send data."),Na.error(u),delete n._tasks[i],null===(s=a)||void 0===s||null===(s=s.resolver)||void 0===s||s.reject(u.message);case 8:return o.a(2)}},o,null,[[1,7]])})),function(e,r,t){return i.apply(this,arguments)})},{key:"request",value:function(e,r,t,n){var i=this._defaultRetries,o=null!=r?r:ln(Ma,this,Ja),a=null!=t?t:{client:this,userData:this};return ln(Ma,this,$a).call(this,e,o,a,i,!1,undefined,n)}},{key:"connected",get:function(){var e;return(null===(e=this._ws)||void 0===e?void 0:e.readyState)==WebSocket.OPEN}},{key:"testConnection",value:function(e,r,t,n){return ln(Ma,this,qa).call(this,!0,null!=r?r:0,t,n)}},{key:"_terminate",value:(n=dn(Tn().m(function a(){var e,r,t;return Tn().w(function(n){for(;;)switch(n.n){case 0:for(r in Na.debug("terminate WSClient"),this.fireEvent("disposed"),e=!1,this._tasks)(t=this._tasks[r])!==undefined&&!t.timedout&&t.resolver&&(e=!0);if(this._lic_callback=null,this._blob_callbacks=[],this._processing_blob=!1,this._ws&&(this._ws.onopen=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.onclose=null,this._ws.close()),this._ws=null,this._tasks=Object.create(null),!e){n.n=1;break}throw new Uo(Mo.OBJECT_DISPOSING);case 1:return n.a(2)}},a,this)})),function(){return n.apply(this,arguments)})},{key:"setRetry",value:function(e){this._defaultRetries=null!=e?e:1}},{key:"addEvent",value:function(e,r,t){if(jr.isString(e)&&!Wa(e)){var n=this._events[e];n||(this._events[e]=Object.create(null),n=this._events[e]),jr.isString(r)&&!Wa(r)&&jr.isFunction(t)&&(n[r]=t)}}},{key:"removeEvent",value:function(e,r){if(jr.isString(e)&&!Wa(e)){var t=this._events[e];t&&jr.isString(r)&&!Wa(r)&&delete t[r]}}},{key:"clearEvent",value:function(e){jr.isString(e)&&!Wa(e)&&this._events[e]&&(this._events[e]=Object.create(null))}},{key:"fireEvent",value:function(e){if(jr.isString(e)&&!Wa(e)){var r,t=this._events[e];if(t){var n=Object.keys(t);for(r=0;r<n.length;r++)jr.isFunction(t[n[r]])&&t[n[r]]()}}}},{key:"getRequestTaskId",value:function(){return this._requestTaskId?this._requestTaskId:0}}],[{key:"_waitForPreBlob",value:(t=dn(Tn().m(function s(e){return Tn().w(function(t){for(;;)switch(t.n){case 0:if(!e._processing_blob){t.n=1;break}return setTimeout(function(){r._waitForPreBlob(e)},500),t.a(2);case 1:r._preBlobResolv&&r._preBlobResolv();case 2:return t.a(2)}},s)})),function(e){return t.apply(this,arguments)})}]);var t,n,i}(jo);function Ba(e){var r="";return r=e.ssl?"wss://":"ws://",r+=e.server,e.port&&(r+=":",r+=e.port),r}function Ua(e,r,t,n){var i=this;return new Rn(function(o,a){try{var s,u,c=a,l=o;if(n&&(u=setTimeout(function(){var e=new Uo("createWebSocket timed out.");Na.debug(e.message),c&&(c(e),c=null,l=null),u&&clearTimeout(u),s&&s.close()},n)),e.bUseParentWS){var f=window,d=parent,h=f.WebSocket;try{for(;f!=d&&d&&d.WebSocket;)h=d.WebSocket,f=d.window,d=d.parent}catch(g){h=window.WebSocket}s=t?new h(r,t):new h(r)}else s=t?new WebSocket(r,t):new WebSocket(r);s.onopen=function(){u&&clearTimeout(u),e._ws=s,l&&(l(s),c=null,l=null)},s.onerror=function(r){s.close(),e.bReady=!1,u&&clearTimeout(u),i.fireEvent("error"),c&&(c(new Uo("websocket error")),c=null,l=null)},s.onmessage=function(r){ln(Ma,e,za).call(e,e,r.data)},s.onclose=function(r){e.bReady=!1,u&&clearTimeout(u),i.fireEvent("close"),c&&(r&&1006==r.code?c(new Uo("websocket error")):c(r),c=null,l=null)}}catch(v){throw Ra(v)}})}function Va(e){return ja.apply(this,arguments)}function ja(){return(ja=dn(Tn().m(function e(r){var t,n=this;return Tn().w(function(e){for(;;)switch(e.n){case 0:if(!this._processing_blob){e.n=2;break}return e.n=1,new Rn(function(e){xa._preBlobResolv=e,xa._waitForPreBlob(n)});case 1:xa._preBlobResolv=null;case 2:if(this._processing_blob=!0,!(t=this._blob_callbacks.shift())){e.n=3;break}return e.n=3,t(r);case 3:this._processing_blob=!1;case 4:return e.a(2)}},e,this)}))).apply(this,arguments)}function Ha(e){return Ga.apply(this,arguments)}function Ga(){return Ga=dn(Tn().m(function e(r){var t,n,i,o,a,s,u,c,l;return Tn().w(function(e){for(;;)switch(e.n){case 0:if(!(this.bReady&&jr.isString(r)&&(r.indexOf("Function not found")>0||r.indexOf("Version not found")>0))){e.n=1;break}return e.a(2);case 1:if(this._cbToGetTaskId){e.n=2;break}return e.a(2);case 2:return n={client:this,userData:undefined},e.n=3,this._cbToGetTaskId(r,Vo.ONMESSAGE_PROCESS_DATA,this._requestTaskId,n);case 3:return i=e.v,e.n=4,this._cbToGetTaskId(i,Vo.ONMESSAGE_GET_TASKID,this._requestTaskId,n);case 4:if(o=e.v,a=!1,o){e.n=7;break}if(!i.Detail||!i.Domain){e.n=5;break}return this._lic_callback&&this._lic_callback(i),e.a(2);case 5:return e.n=6,this._cbToGetTaskId(i,Vo.ONMESSAGE_GET_EVENT_TASKID,this._requestTaskId,n);case 6:(o=e.v)&&(a=!0);case 7:if(s=this._tasks[o]){e.n=10;break}if(!a){e.n=8;break}s={},e.n=9;break;case 8:return""!==o&&Na.log("invalid task id: "+o),e.a(2);case 9:e.n=11;break;case 10:if(!s.timedout){e.n=11;break}return e.a(2);case 11:return u=null!==(t=s.cb)&&void 0!==t?t:this._cbToGetTaskId,e.n=12,u({rawData:r,jsonData:i},Vo.HANDLE_RAW_MESSAGE,this._requestTaskId,s.ctx);case 12:if((c=e.v)!==undefined){e.n=14;break}return e.n=13,u(i,Vo.HANDLE_PROCESSED_MESSAGE,this._requestTaskId,s.ctx);case 13:c=e.v;case 14:return c&&!a&&(s.tmid&&clearTimeout(s.tmid),delete this._tasks[o],null===(l=s.resolver)||void 0===l||l.resolve(c)),e.a(2,o)}},e,this)})),Ga.apply(this,arguments)}function za(e,r){return Ka.apply(this,arguments)}function Ka(){return(Ka=dn(Tn().m(function e(r,t){var n,i,o,a;return Tn().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=r,e.p=1,"object"!==kn(t)){e.n=3;break}if(!(n._blob_callbacks.length>0)){e.n=3;break}return e.n=2,ln(Ma,n,Va).call(n,t);case 2:return e.a(2);case 3:return e.n=4,ln(Ma,n,Ha).call(n,t);case 4:i=e.v,e.n=6;break;case 5:e.p=5,a=e.v,Na.debug("failed to handle message."),a instanceof Error?Na.error(a):Na.error(jr.stringify(a)),i&&n._tasks[i]&&(delete n._tasks[i],null===(o=n._tasks[i])||void 0===o||null===(o=o.resolver)||void 0===o||o.reject(a.message));case 6:return e.a(2)}},e,null,[[1,5]])}))).apply(this,arguments)}function Ja(e,r,t){return Qa.apply(this,arguments)}function Qa(){return(Qa=dn(Tn().m(function e(r,t,n){var i,o,a;return Tn().w(function(e){for(;;)switch(e.n){case 0:a=t,e.n=a===Vo.GET_TASKID?1:a===Vo.HANDLE_RAW_MESSAGE?2:3;break;case 1:return(o=Oa.toJson(r)).cmdId=null!==(i=o.cmdId)&&void 0!==i?i:jr.uid(),e.a(2,o.cmdId);case 2:return e.a(2,r);case 3:return e.a(2,undefined);case 4:return e.a(2)}},e)}))).apply(this,arguments)}function qa(e,r,t,n){return Ya.apply(this,arguments)}function Ya(){return Ya=dn(Tn().m(function e(r,t,n,i){var o,a;return Tn().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this.connected&&!this.disposed){e.n=1;break}return e.a(2);case 1:if(!(o=this)._connectPromise){e.n=3;break}return e.n=2,o._connectPromise;case 2:case 8:return e.a(2);case 3:return t=null!=t?t:this._defaultRetries,n=null!=n?n:100,a=ln(Ma,o,Ba).call(o,o.serverInfo),Na.debug("WebSocket URL: "+a+", try to create websocket "+t+"/"+n),o._connectPromise=new Rn(function(e,r){var s=function(n){ln(Ma,o,Ua).call(o,o,a,o.serverInfo.protocol,i).then(function(r){e(r)})["catch"](function(e){Na.debug("create websocket failed: "+e.message),n<t?u(n):r(e)})};function u(e,r,t){setTimeout(function(){s(++e)},n)}s(0)}),e.p=4,e.n=5,o._connectPromise;case 5:e.n=7;break;case 6:throw e.p=6,e.v;case 7:return e.p=7,o._connectPromise=null,e.f(7)}},e,this,[[4,6,7,8]])})),Ya.apply(this,arguments)}function Xa(e,r,t,n){return Za.apply(this,arguments)}function Za(){return(Za=dn(Tn().m(function e(r,t,n,i){var o,a,s,u;return Tn().w(function(e){for(;;)switch(e.n){case 0:if(o=this,a=n.eventTaskId,s=n.lastEventTaskId,a!==undefined){e.n=2;break}return e.n=1,t(r,Vo.GET_EVENT_TASKID,o._requestTaskId,n);case 1:a=e.v;case 2:a&&(o._tasks[a]?n&&n.userData&&n.userData.command&&((u=o._tasks[a]).ctx=n,s&&((u=o._tasks[s]).ctx=n)):(u={id:i.id,resolver:null,ctx:n,timedout:!1},o._tasks[a]=u,s&&(o._tasks[s]=u)));case 3:return e.a(2)}},e,this)}))).apply(this,arguments)}function $a(e,r,t,n,i,o,a){return es.apply(this,arguments)}function es(){return es=dn(Tn().m(function e(r,t,n,i,o,a,s){var u,c,l,f,d;return Tn().w(function(e){for(;;)switch(e.p=e.n){case 0:return u=this,e.p=1,n.client=u,e.n=2,ln(Ma,u,qa).call(u,o,i,a,s);case 2:if("0"!=(c=n.taskId)){e.n=3;break}return u.disposed||u._ws.send(r),r=null,e.a(2);case 3:if(c!==undefined){e.n=5;break}return e.n=4,t(r,Vo.GET_TASKID,null,n);case 4:c=e.v;case 5:return c===undefined&&Na.debug("websocket send: task id is invalid."),(l={}).promise=new Rn(function(e,r){l.resolve=e,l.reject=r}),f={id:c,resolver:l,ctx:n,timedout:!1,cb:t},u._tasks[c]=f,u._requestTaskId=c,e.n=6,ln(Ma,u,Xa).call(u,r,t,n,f);case 6:return u._cbToGetTaskId=t,s&&(f.tmid=setTimeout(function(){Na.debug("ws request time out."),f.timedout=!0,u._timedout=!0,f.resolver.reject("request timed out.")},s)),u.disposed||u._ws.send(r),Na.debug("end to send task "+c),r=null,e.a(2,l.promise);case 7:throw e.p=7,d=e.v,c&&delete u._tasks[c],Ra(d);case 8:return e.p=8,r=null,e.f(8);case 9:return e.a(2)}},e,this,[[1,7,8,9]])})),es.apply(this,arguments)}xa=La;var rs,ts=function(){return pn(function e(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"",t=arguments.length>1?arguments[1]:undefined,n=arguments.length>2&&arguments[2]!==undefined&&arguments[2],i=arguments.length>3&&arguments[3]!==undefined&&arguments[3],o=arguments.length>4?arguments[4]:undefined;gn(this,e),this.server=r,this.port=t,this.ssl=n,this.useWS=i,this.protocol=o},[{key:"equals",value:function(e){return this.port===e.port&&this.protocol===e.protocol&&this.server===e.server&&this.ssl===e.ssl&&this.useWS===e.useWS}},{key:"toString",value:function(){var e=this.ssl?"https":"http",r=this.port?":".concat(this.port):"";return"".concat(e,"://").concat(this.server).concat(r)}}])}();function ns(e,r){return e instanceof ts?e.equals(r):e.port===r.port&&e.protocol===r.protocol&&e.server===r.server&&e.ssl===r.ssl&&e.useWS===r.useWS}var is=new WeakSet,os=function(){function e(){gn(this,e),vn(this,is),yn(this,"_maxWebSocketCon",10),yn(this,"_wsClients",[])}return pn(e,[{key:"removeTerminatedWSClient",value:function(){this._wsClients=this._wsClients.filter(function(e){return!e.disposed})}},{key:"getClient",value:function(e,r){return e.useWS?ln(is,this,ss).call(this,e,r):new ka(e)}},{key:"getClientInPool",value:function(e){return e.useWS?ln(is,this,as).call(this,e):null}},{key:"closeClient",value:(t=dn(Tn().m(function n(e){var r;return Tn().w(function(t){for(;;)switch(t.n){case 0:return r=this._wsClients.filter(function(r){return ns(r.serverInfo,e)&&!r.disposed}),t.n=1,Promise.all(r.map(function(e){return e.dispose()}));case 1:this.removeTerminatedWSClient();case 2:return t.a(2)}},n,this)})),function(e){return t.apply(this,arguments)})},{key:"terminate",value:(r=dn(Tn().m(function i(){var e;return Tn().w(function(r){for(;;)switch(r.n){case 0:return e=this._wsClients.slice(),this._wsClients=[],r.n=1,Promise.all(e.map(function(){var e=dn(Tn().m(function r(e){return Tn().w(function(r){for(;;)switch(r.p=r.n){case 0:return r.p=0,r.n=1,e.dispose();case 1:r.n=3;break;case 2:r.p=2,r.v;case 3:return r.a(2)}},r,null,[[0,2]])}));return function(r){return e.apply(this,arguments)}}()));case 1:return r.a(2)}},i,this)})),function(){return r.apply(this,arguments)})}],[{key:"Instance",get:function(){return this._gClientPool||(this._gClientPool=new e),this._gClientPool}}]);var r,t}();function as(e){this.removeTerminatedWSClient();var r,t=_n(this._wsClients);try{for(t.s();!(r=t.n()).done;){var n=r.value;if(ns(n.serverInfo,e)&&!n.disposed)return n.addRef(),n}}catch(i){t.e(i)}finally{t.f()}return null}function ss(e,r){var t=null;return r||(t=ln(is,this,as).call(this,e)),t||(this._wsClients.length<this._maxWebSocketCon?((t=new La(e)).addEvent("disposed","1",function(){rs.Instance.removeTerminatedWSClient()}),this._wsClients.push(t),t):null)}rs=os,yn(os,"_gClientPool",null);var us=function(){return pn(function e(){gn(this,e)},null,[{key:"runWithCatch",value:function(e,r,t,n,i){try{e(r,t,n,i)}catch(o){}r=t=n=i=null}},{key:"runErrWithCatch",value:function(e,r,t){try{e(r._errorCode,r._getErrorString(),t)}catch(n){}r=t=null}},{key:"runErrWithCatch4",value:function(e,r,t,n,i,o){try{e(r._errorCode,r._getErrorString(),t,n,i,o)}catch(a){}r=t=n=i=o=null}}])}(),cs=jr.mix({},Kn);function ls(){var e;cs=jr.mix({},Kn);var r=null!==(e=xn.CustomizableDisplayInfo)&&void 0!==e?e:null;r&&(r.errorMessages&&jr.mix(cs.errorMessages,r.errorMessages),r.generalMessages&&jr.mix(cs.generalMessages,r.generalMessages),r.customProgressText&&jr.mix(cs.customProgressText,r.customProgressText),r.buttons&&(r.buttons.titles&&jr.mix(cs.buttons.titles,r.buttons.titles),undefined!==r.buttons.bShowAllButtons&&(cs.buttons.bShowAllButtons=r.buttons.bShowAllButtons),r.buttons.visibility&&jr.mix(cs.buttons.visibility,r.buttons.visibility)),r.dialogText&&jr.mix(cs.dialogText,r.dialogText)),fs()}function fs(){var e,r=null!==(e=xn.CustomizableDisplayInfo)&&void 0!==e?e:null;r&&(jr.isString(r.loaderBarSource)&&""!=r.loaderBarSource?On.loaderBarSource=r.loaderBarSource:se.bIE?(On.loaderBarSource=Kn.loaderBarSourceIE,On.loaderBarSourceIE=Kn.loaderBarSourceIE):On.loaderBarSource=Kn.loaderBarSource,jr.isString(r.loaderBarClassName)&&""!=r.loaderBarClassName?On.loaderBarClassName=r.loaderBarClassName:On.loaderBarClassName=Kn.loaderBarClassName,jr.isString(r.loaderBarBackgroundColor)?On.loaderBarBackgroundColor=r.loaderBarBackgroundColor:On.loaderBarBackgroundColor=Kn.loaderBarBackgroundColor,r.loaderBarWidth?On.loaderBarWidth=r.loaderBarWidth:On.loaderBarWidth=Kn.loaderBarWidth,r.loaderBarHeight?On.loaderBarHeight=r.loaderBarHeight:On.loaderBarHeight=Kn.loaderBarHeight)}function ds(){return cs}var hs=function(){function e(){gn(this,e)}return pn(e,null,[{key:"padHex",value:function(e){return 1===e.length?"0".concat(e):e}},{key:"parseRgbComponents",value:function(e){for(var r="",t=0;t<this.RGB_COMPONENTS;++t){var n=Number(e[t]).toString(this.HEX_BASE);r+=this.padHex(n)}if(e.length===this.RGBA_COMPONENTS){var i=Math.round(Number(e[3])*this.ALPHA_MAX).toString(this.HEX_BASE);r+=this.padHex(i)}else r+="ff";return r}},{key:"parseHex6",value:function(e){return e.replace(/#/,"")+"ff"}},{key:"parseHex3",value:function(e){for(var r="",t=1;t<=this.RGB_COMPONENTS;++t)r+=e[t]+e[t];return r+="ff"}},{key:"colorStrToInt",value:function(e){var r;if(/^(rgb|RGB)/.test(e)){var t=e.replace(/[^\d,.]/g,"").split(",");r=this.parseRgbComponents(t)}else if("transparent"===e)r="00000000";else if(/^#[0-9a-fA-F]{6}$/.test(e))r=this.parseHex6(e);else{if(!/^#[0-9a-fA-F]{3}$/.test(e))return-1;r=this.parseHex3(e)}return parseInt(r,this.HEX_BASE)}},{key:"IntToColorStr",value:function(e){if(e>this.COLOR_MAX||e<this.COLOR_MIN)return"";if(se.bHTML5Edition){var r=Math.floor(e/16777216),t=Math.floor(e/65536)%256,n=Math.floor(e/256)%256,i=e%256/this.ALPHA_MAX;return"rgba(".concat(r,",").concat(t,",").concat(n,",").concat(i,")")}if(e%256==0)return"transparent";var o=Math.floor(e/256).toString(this.HEX_BASE).padStart(6,"0");return"#".concat(o)}},{key:"getHex",value:function(e){var r=Number(e).toString(16).toUpperCase();return 1==r.length&&(r=["0",r].join("")),r}},{key:"getColor",value:function(r){var t,n,i;return i=r>>16,n=(65280&r)>>8,t=255&r,["#",e.getHex(i),e.getHex(n),e.getHex(t)].join("")}},{key:"RGB2BGR",value:function(e){return(255&e)<<16|65280&e|e>>16}},{key:"BGR2RGB",value:function(r){return e.RGB2BGR(r)}}])}();yn(hs,"HEX_BASE",16),yn(hs,"ALPHA_MAX",255),yn(hs,"COLOR_MAX",4294967295),yn(hs,"COLOR_MIN",0),yn(hs,"RGB_COMPONENTS",3),yn(hs,"RGBA_COMPONENTS",4);var gs="application/pdf",vs="image/jpeg",ms="image/png",ps="image/tiff",_s="image/bmp",ys="image/jp2";function Ss(e){var r=-1;if(jr.isString(e)){var t=e.toLowerCase();t==gs?r=ut.IT_PDF:t==ms?r=ut.IT_PNG:t==vs||"image/jpg"==t?r=ut.IT_JPG:t==_s?r=ut.IT_BMP:t==ps||"image/tif"==t?r=ut.IT_TIF:t==ys&&(r=ut.IT_J2K)}return r}function Is(e){var r="application/octet-stream";switch(e){case ut.IT_BMP:r=_s;break;case ut.IT_JPG:r=vs;break;case ut.IT_TIF:r=ps;break;case ut.IT_PNG:r=ms;break;case ut.IT_PDF:r=gs;break;case ut.IT_J2K:r=ys}return r}function bs(e){if(e===undefined)return-1;if(e.length<4)return-1;var r=e.lastIndexOf(".");if(-1===r)return-1;var t=e.slice(r).toLowerCase();return".bmp"===t||".dib"===t?ut.IT_BMP:".jpg"===t||".jpe"===t||".jpeg"===t||".jfif"===t?ut.IT_JPG:".tif"===t||".tiff"===t?ut.IT_TIF:".png"===t?ut.IT_PNG:".pdf"===t?ut.IT_PDF:".jp2"===t||".j2k"===t||".j2c"===t?ut.IT_J2K:-1}var Cs=new(pn(function gK(){gn(this,gK),yn(this,"version",20260116),yn(this,"Events",Ln),yn(this,"EnumMouseButton",Wn),yn(this,"detectButton",Un),yn(this,"getWheelDelta",Bn),yn(this,"fromUnicode",Po),yn(this,"escapeHtml",Fo),yn(this,"escapeRegExp",Do),yn(this,"unEscapeHtml",xo),yn(this,"param",Oo.param.bind(Oo)),yn(this,"unparam",Oo.unparam.bind(Oo)),yn(this,"currentStyle",Gn),yn(this,"parseHTML",go),yn(this,"setHtml",Pi),yn(this,"css",ho),yn(this,"style",fo),yn(this,"support",Di),yn(this,"all",To),yn(this,"one",wo),yn(this,"isNodeList",Ao),yn(this,"Promise",Rn),yn(this,"loaderBarClassName",Qn),yn(this,"loaderBarSource",Kn.loaderBarSource),yn(this,"createShowMaskContent",qn),yn(this,"switchEvent",jn),yn(this,"setBackOpacity",fi),yn(this,"showMask",di),yn(this,"hideMask",hi),yn(this,"dialog",ai),yn(this,"mask",si),yn(this,"contentTypeIsJson",Wo),yn(this,"headersContainsJson",Ro)}));function Ts(e,r,t,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,i)}function ws(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){Ts(o,n,i,a,s,"next",e)}function s(e){Ts(o,n,i,a,s,"throw",e)}a(void 0)})}}function As(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Es(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xs(n.key),n)}}function ks(e,r,t){return r&&Es(e.prototype,r),t&&Es(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ps(e,r,t){return(r=xs(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Fs(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(t,n,i,o){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return Ds(c,"_invoke",function(t,n,i){var o,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(r,t){return o=r,s=0,u=e,d.n=t,a}};function h(t,n){for(s=t,u=n,r=0;!f&&c&&!i&&r<l.length;r++){var i,o=l[r],h=d.p,g=o[2];t>3?(i=g===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=t<2&&h<o[1])?(s=0,d.v=n,d.n=o[1]):h<g&&(i=t<3||o[0]>n||n>g)&&(o[4]=t,o[5]=n,d.n=g,s=0))}if(i||t>1)return a;throw f=!0,n}return function(i,l,g){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,g),s=l,u=g;(r=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(i="next"),r=o[i]){if(!(r=r.call(o,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,s<2&&(s=0)}else 1===s&&(r=o["return"])&&r.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((r=(f=d.n<0)?u:t.call(n,d))!==a)break}catch(r){o=e,s=1,u=r}finally{c=1}}return{value:r,done:f}}}(t,i,o),!0),c}var a={};function s(){}function u(){}function c(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(Ds(r={},n,function(){return this}),r),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ds(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Ds(f,"constructor",c),Ds(c,"constructor",u),u.displayName="GeneratorFunction",Ds(c,i,"GeneratorFunction"),Ds(f),Ds(f,i,"Generator"),Ds(f,n,function(){return this}),Ds(f,"toString",function(){return"[object Generator]"}),(Fs=function(){return{w:o,m:d}})()}function Ds(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Ds=function(e,r,t,n){function o(r,t){Ds(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))},Ds(e,r,t,n)}function xs(e){var r=function(e,r){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==C(r)?r:r+""}function Os(e){return Os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Os(e)}var Ns="19",Rs=3e3,Ws=1e3,Ms=1e3,Ls=600,Bs="dwtc_",Us="dwt_",Vs="127.0.0.1";se.bAndroid&&se.bSSL&&(Vs="local.dynamsoft.com");var js={localIP:Vs,wsProtocol:"dwt_command",bIgnoreHttpsMixedContent:!1,bDWTChecked:!1,bEnhancedMode:!1,bPortsChecking:!1,bCSSLoaded:!1,bPortChanged:!1,fireOnBeforeCheckEvent:!0,objEnhancedPorts:{},HttpConnectTimeout:se.bSSL?Rs:Ws,WebSocketConnectTimeout:se.bSSL?Ms:Ls,getDWTHost:function(){var e=xn.Host;return jr.isString(e)&&""!==e||(xn.Host=e=Vs),e},getDWTPort:function(e){return e?xn.SSLPort:xn.Port},getDWTPrefix:function(){return!0===xn.CustomMode?Bs:Us},getVersionStrForCheck:function(){return"".concat(Ns).concat("000000")},setMajorVersion:function(e){Ns=e},getMajorVersion:function(){return Ns}};function Hs(){return js.HttpConnectTimeout}function Gs(){return js.WebSocketConnectTimeout}function zs(e){return"localhost"===e||"127.0.0.1"===e}function Ks(e){return(js.bIgnoreHttpsMixedContent||!(zs(e)&&se.bSSL&&xn.EnableLocalNetworkMixedContent))&&!!se.bSSL}function Js(){return Ks(xn.Host)}var Qs="Version not found",qs="Function not found",Ys=Ps(Ps(Ps(Ps(Ps(Ps(Ps({},Vo.GET_TASKID,function(e,r){return null==r?void 0:r.taskId}),Vo.ONMESSAGE_PROCESS_DATA,function(e){return jr.parse(e)}),Vo.ONMESSAGE_GET_TASKID,function(e,r){return null!=e&&e.cmdId?e.cmdId:null!=r&&r.client?r.client.getRequestTaskId():undefined}),Vo.HANDLE_RAW_MESSAGE,function(e,r){var t=e.rawData;e.jsonData;var n=null==r?void 0:r.userData;return n?(t.indexOf(Qs)>=0||t.indexOf(qs)>=0?jr.isFunction(n.fFun)&&n.fFun():jr.isFunction(n.sFun)&&n.sFun(t),t):undefined}),Vo.GET_EVENT_TASKID,function(){return undefined}),Vo.ONMESSAGE_GET_EVENT_TASKID,function(){return undefined}),Vo.HANDLE_PROCESSED_MESSAGE,function(){return undefined});function Xs(e,r,t,n){return Zs.apply(this,arguments)}function Zs(){return Zs=ws(Fs().m(function e(r,t,n,i){var o;return Fs().w(function(e){for(;;)if(0===e.n)return o=Ys[t],e.a(2,o?o(r,i):undefined)},e)})),Zs.apply(this,arguments)}var $s=function(){function e(){As(this,e)}return ks(e,null,[{key:"createServerInfo",value:function(e,r,t,n,i){var o=e||js.getDWTHost();return new ts(o,r,t,n,i)}},{key:"getHttpClient",value:function(r,t,n){var i=n?"https":"http",o=e.createServerInfo(r,t,n,!1,i);return os.Instance.getClient(o)}},{key:"getWsClient",value:function(r,t,n,i){var o=e.createServerInfo(r,t,n,!0,js.wsProtocol);return os.Instance.getClient(o,i)}},{key:"getWsClientInPool",value:function(r,t,n,i){var o=e.createServerInfo(r,t,n,!0,js.wsProtocol);return os.Instance.getClientInPool(o)}},{key:"closeWsClient",value:function(r,t,n){var i=e.createServerInfo(r,t,n,!0,js.wsProtocol);os.Instance.closeClient(i)}}])}(),eu="local-network-access",ru=127,tu={first:169,second:254},nu={first:172,secondMin:16,secondMax:31},iu={first:192,second:168},ou=/^(([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])$/;function au(){return!(!se.bChrome&&!se.bEdge)&&parseInt(se.strBrowserVersion,10)>=145}function su(){return uu.apply(this,arguments)}function uu(){return(uu=ws(Fs().m(function e(){var r;return Fs().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(se.bFirefox||se.bSafari||se.bIE)){e.n=1;break}e.n=11;break;case 1:if(null===(r=navigator.permissions)||void 0===r||!r.query){e.n=11;break}if(!au()){e.n=8;break}return e.p=2,e.n=3,navigator.permissions.query({name:"loopback-network"});case 3:return e.a(2,e.v);case 4:return e.p=4,e.v,e.p=5,e.n=6,navigator.permissions.query({name:eu});case 6:return e.a(2,e.v);case 7:e.p=7,e.v,e.n=11;break;case 8:return e.p=8,e.n=9,navigator.permissions.query({name:eu});case 9:return e.a(2,e.v);case 10:e.p=10,e.v;case 11:return e.a(2,{state:"other"})}},e,null,[[8,10],[5,7],[2,4]])}))).apply(this,arguments)}function cu(){return!!se.bFirefox}function lu(e){if(!jr.isString(e))return!1;if(zs(e))return!0;if(!ou.test(e))return!1;var r=e.split(".");if(4!==r.length)return!1;var t=parseInt(r[0],10),n=parseInt(r[1],10);return t===ru||(t===tu.first&&n===tu.second||(t===nu.first&&n>=nu.secondMin&&n<=nu.secondMax||t===iu.first&&n===iu.second))}function fu(){var e=location.hostname;return"localhost"!=e&&"127.0.0.1"!=e&&(!lu(e)&&!se.bFileSystem)}function du(){var e=location.hostname;return"localhost"!=e&&"127.0.0.1"!=e&&(!(!se.bChrome&&!se.bEdge)&&parseInt(se.strBrowserVersion,10)>=94&&!lu(e)&&!se.bSSL&&!se.bFileSystem)}var hu=du,gu="ws://",vu="wss://",mu="http://",pu="https://";function _u(e,r,t){if(jr.isString(e)&&(e.indexOf("Function not found")>=0||e.indexOf("Version not found")>=0))null==r||r(e);else{var n=e.data;if("object"!==Os(n)){var i=n.replace(/\0/g,"");try{null==r||r(i)}catch(o){jr.log(n),null==t||t()}}else null==t||t()}}function yu(e,r){e&&e.readyState!==_t.CLOSING&&e.readyState!==_t.CLOSED?e.readyState===_t.CONNECTING?(e.onerror=function(r){r&&jr.log("websocket error: "+r),e._reject&&(e._reject(r),e._reject=undefined),e.close()},e.onclose=function(r){e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null,e._reject=undefined},e.onopen=function(){e.readyState===_t.OPEN?(e.onopen=null,e.send(r)):e.readyState===_t.CONNECTING&&(e.onopen?setTimeout(e.onopen,100):e._reject&&(e._reject(),e._reject=undefined))}):e.readyState===_t.OPEN&&(e.onopen=null,e.send(r)):null!=e&&e._reject&&(e._reject({closed:!0}),e._reject=undefined)}function Su(e,r,t,n){var i,o=n;if(!o){var a=jr.startsWith(e,vu)||jr.startsWith(e,gu),s=jr.startsWith(e,pu)||jr.startsWith(e,mu);xn.ConnectWithSocket&&!a?o=t?vu:gu:xn.ConnectWithSocket||s||(o=t?pu:mu)}return r?(jr.endsWith(e,"/")&&(e=e.substring(0,e.length-1)),i=":".concat(r,"/")):i=jr.endsWith(e,"/")?"":"/","".concat(o).concat(e).concat(i)}function Iu(e,r){return new Cs.Promise(function(t,n){!function(e,r,t){e.onmessage=function(n){_u(n,function(t){r(t),e.close()},function(r){t(r),e.close()})},e._reject=t}(e,t,n),yu(e,r)})}var bu=function(){function e(){As(this,e)}return ks(e,null,[{key:"postStringDataByWS",value:function(e,r){return arguments.length>2&&arguments[2]!==undefined&&arguments[2]?function(e,r){return new Cs.Promise(function(t,n){e.onmessage=function(e){_u(e,function(e){t(e)},function(e){n(e)})},e._reject=n,yu(e,r)})}(e,r):Iu(e,r)}},{key:"postStringDataByWSUrl",value:function(r,t){var n=Iu(e.newWebsocket(r,!1),t);return se.bEdge&&(n=n["catch"](function(){return Iu(e.newWebsocket(r,!0),t)})),n}},{key:"newWebsocket",value:function(e,r){var t=js.wsProtocol,n=window.MozWebSocket;if(void 0!==n)return t?new n(e,t):new n(e);var i=window.WebSocket;if(r){var o=window,a=parent;try{for(;o!==a&&a.WebSocket;)i=a.WebSocket,o=a.window,a=a.parent}catch(s){i=window.WebSocket}}return t?new i(e,t):new i(e)}},{key:"getWsUrl",value:function(e,r,t){var n=t!==undefined?t:Ks(e);return Su(e,r,n,n?vu:gu)}},{key:"getModuleUrl",value:function(e){var r=arguments.length>1&&arguments[1]!==undefined&&arguments[1],t=js.getDWTHost(),n=r?!!se.bSSL:Ks(t),i=Su(t,js.getDWTPort(n),n);return e?i+e:i}},{key:"getModuleUrlForRemoteScan",value:function(r){return e.getModuleUrl(r,!0)}}])}();var Cu="Initializing the service...",Tu="Checking the service enhanced module...",wu="Getting the WebTwain port...",Au="Checking the WebTwain module...",Eu="Checking the WebTwain version...",ku="Check the WebTwain version successfully.",Pu="The WebTwain version not compatible.",Fu="Getting Machine ID.";function Du(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function xu(e,r,t,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,i)}function Ou(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){xu(o,n,i,a,s,"next",e)}function s(e){xu(o,n,i,a,s,"throw",e)}a(void 0)})}}function Nu(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Ru(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Vu(n.key),n)}}function Wu(e,r,t){return r&&Ru(e.prototype,r),t&&Ru(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mu(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=ju(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==t["return"]||t["return"]()}finally{if(s)throw o}}}}function Lu(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(t,n,i,o){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return Bu(c,"_invoke",function(t,n,i){var o,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(r,t){return o=r,s=0,u=e,d.n=t,a}};function h(t,n){for(s=t,u=n,r=0;!f&&c&&!i&&r<l.length;r++){var i,o=l[r],h=d.p,g=o[2];t>3?(i=g===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=t<2&&h<o[1])?(s=0,d.v=n,d.n=o[1]):h<g&&(i=t<3||o[0]>n||n>g)&&(o[4]=t,o[5]=n,d.n=g,s=0))}if(i||t>1)return a;throw f=!0,n}return function(i,l,g){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,g),s=l,u=g;(r=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(i="next"),r=o[i]){if(!(r=r.call(o,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,s<2&&(s=0)}else 1===s&&(r=o["return"])&&r.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((r=(f=d.n<0)?u:t.call(n,d))!==a)break}catch(r){o=e,s=1,u=r}finally{c=1}}return{value:r,done:f}}}(t,i,o),!0),c}var a={};function s(){}function u(){}function c(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(Bu(r={},n,function(){return this}),r),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Bu(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Bu(f,"constructor",c),Bu(c,"constructor",u),u.displayName="GeneratorFunction",Bu(c,i,"GeneratorFunction"),Bu(f),Bu(f,i,"Generator"),Bu(f,n,function(){return this}),Bu(f,"toString",function(){return"[object Generator]"}),(Lu=function(){return{w:o,m:d}})()}function Bu(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Bu=function(e,r,t,n){function o(r,t){Bu(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))},Bu(e,r,t,n)}function Uu(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(s.push(n.value),s.length!==r);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=t["return"]&&(a=t["return"](),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,r)||ju(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vu(e){var r=function(e,r){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==C(r)?r:r+""}function ju(e,r){if(e){if("string"==typeof e)return Du(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Du(e,r):void 0}}var Hu=se.bMobile,Gu={bMobile:Hu=!(se.bWin||se.bMac||se.bLinux||se.bChromeOS)||(Hu||se.bAndroid||se.bPad||se.biPhone||se.biPad)},zu=se.bHTML5Edition,Ku=0,Ju=!1;se.bIE&&(""===(Ku=se.IEVersion)||Ku>=10?xn.IfUseActiveXForIE10Plus?(zu=!1,Ju=!0,se.bHTML5Edition=zu):zu=!0:(zu=!1,Ku>=9&&(Ju=!0))),Ju||zu||(zu=!0);var Qu={getServerVersionForCompareCompitable:function(){return""},getServerVersionInfo:function(e){return""},getJSVersion:function(){return""},getManagerVer:function(){return""},getDdmModuleNameVerPath:function(){return""},getDdm_ManagerVer:function(){return""}};function qu(e){var r=Yu(),t=e;return t||(t=se.bWin?".msi":se.bMac?".pkg":Dn.navInfo.bArm64?"-arm64.deb":Dn.navInfo.bMips64?"-mips64el.deb":Dn.navInfo.bAndroid?".apk":se.bLinux||se.bChromeOS||se.bHarmonyOS?".deb":".msi"),[r,"DynamicWebTWAINServiceSetup",t].join("")}function Yu(){var e,r,t=Zu.refServiceInstallerLocation||null,n=function(){"/"!=t[t.length-1]&&(t+="/")};if(t)n();else{var i;if(null!==(i=window)&&void 0!==i&&null!==(i=i.Dynamsoft)&&void 0!==i&&null!==(i=i.Core)&&void 0!==i&&null!==(i=i.CoreModule)&&void 0!==i&&null!==(i=i.engineResourcePaths)&&void 0!==i&&i.dwt&&(e=window.Dynamsoft.Core.CoreModule.engineResourcePaths.dwt,window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory&&(r=window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory)),e&&(jr.isString(e)||jr.isString(e.serviceInstallerLocation)&&(t=e.serviceInstallerLocation),jr.isString(t)))if(jr.startsWith(t,"https://")||jr.startsWith(t,"http://"));else if(r&&jr.isString(r)&&r.length>0){var o="";"/"==r.charAt(r.length-1)||(o="/"),t=[r,o,t].join("")}if(jr.isString(t)&&t.length>0)n();else{var a=Xu();if(jr.isString(a)&&a.length>0){var s="";"/"==a.charAt(a.length-1)||(s="/"),t=[a,s,"dist"].join("")}else t="Resources/dist"}Zu.refServiceInstallerLocation=t,n()}return t}function Xu(){var e=Zu.refResourcesPath||null;if(!e){var r,t,n;if(null!==(r=window)&&void 0!==r&&null!==(r=r.Dynamsoft)&&void 0!==r&&null!==(r=r.Core)&&void 0!==r&&null!==(r=r.CoreModule)&&void 0!==r&&null!==(r=r.engineResourcePaths)&&void 0!==r&&r.dwt&&(t=window.Dynamsoft.Core.CoreModule.engineResourcePaths.dwt,window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory&&(n=window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory)),t&&(jr.isString(t)?e=t:jr.isString(t.resourcesPath)&&(e=t.resourcesPath),jr.isString(e)))if(jr.startsWith(e,"https://")||jr.startsWith(e,"http://"));else if(n&&jr.isString(n)&&n.length>0){var i="";"/"==n.charAt(n.length-1)||(i="/"),e=[n,i,e].join("")}if(!jr.isString(e)){var o=function(){try{throw new Error}catch(hH){var e=(hH.stack||hH.sourceURL||"").match(/(?:http|https|file):\/\/[^\s]+\.js/);if(e&&e.length>=1)return e[0]}return""}()||"Resources/";e=o.substring(0,o.lastIndexOf("/"))}if(!se.bFileSystem){void 0!==e&&""!=e&&null!=e||(e=location.pathname||""),e.length>0&&"/"==e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),Zu.refResourcesPath=e}}if("/"===e){var a=window.location.protocol,s=window.location.host;return"".concat(a,"//").concat(s)}return e}On.versionFunctionSlots=Qu;var Zu={name:"Dynamic Web TWAIN",_iImageCaptureDriverType:3,_iBrokerProcessType:1,getChromeEditionPath:qu,getPKGPath:function(){return Yu()+"DynamicWebTWAINMacEdition.pkg"},getMSIPath:function(){return Yu()+"DynamicWebTWAINPlugIn.msi"},getActiveXCABx86Path:function(){return Yu()+"DynamicWebTWAIN.cab"},getActiveXCABx64Path:function(){return Yu()+"DynamicWebTWAINx64.cab"},getDWTPrefix:js.getDWTPrefix,getServerVersionInfo:function(){return Qu.getServerVersionInfo()},onlineResources:"https://demo.dynamsoft.com/DWT/Resources/",strMIMEType:"Application/DynamicWebTwain-Plugin",strFullClassID:"E7DA7F8D-27AB-4EE9-8FC0-3FEC9ECFE758",scripts:{},dwtConfigLoaded:!1,dwtConfigLoading:!1,loadResourcePath:!1,loadingResourcePath:!1,handshakeCode:undefined,organizationID:undefined,licenseServer:undefined,sessionPassword:"",bPublicLTS:!0,refProductKey:undefined,ltsDebug:!1,bDWTLoading:!1,bDWTUnloading:!1,bAndroidConnected:!1,unloadQueue:[],appendBrowserLicenseWhenServiceMode:function(){return Promise.resolve(!0)},bDCPChecked:!1,bUseDynamsoftLicenseManager:!1,bChromeEdition:zu,bHTML5Edition:zu,bActiveXEdition:Ju,updateServiceVersion:function(e){var r=js.getMajorVersion();if(jr.isString(e)&&e.length>0){var t=jr.replaceAll(e," ","").split(",");if(t.length>=1)if(t[0]==r){var n=t.join(",");xn.ServerVersionInfo=n,xn.ServerLinuxVersionInfo=n,xn.ServerMacVersionInfo=n}}},tokenFlag:"0",versionInfoVer:1,addTokenToHttpHeaders:function(e){e&&xn.Token&&e.append("Authorization","Bearer "+xn.Token)}},$u={SSLPort:18626,Port:18625,oldDWASMVerStr:"dwasm_13000404",oldDWASMVer:[13,0,0,"0404"],detect:{dcpStatus:tt.Init,ddmPort:0,dwtPort:0,dwtSSLPort:0,bConnected:!1,connectedResult:"",MaxManagerModuleConnectCount:1,EnumDCP_DetectStatus:tt},strSID:"",b64bit:!0,_getStatusString:function(e,r){var t,n,i="";return e==tt.Init?"Getting manager version":e==tt.Connected?(r&&(i=r),"Getting manager version succeeded and the version is "+i):e==tt.NotReady?"The Dynamic Web TWAIN Service is not ready, please try again later.":e==tt.CheckingManagerVer?"Getting manager version":e==tt.CheckingServiceVer?"Getting service version":e==tt.NotInstalled?"Dynamic Web TWAIN Service Not Installed":e==tt.UpdateSkipped?"Update skipped":e==tt.CheckedService?(r&&(i=r),"Getting service version succeeded and the version is "+i):e==tt.VerifyingZip?"Verifying the update package":e==tt.VerifiedZip?"Update package verified":e==tt.UpdatingService?"Updating the service":e==tt.UpdateSucceed?"Update succeeded":e==tt.UpdateFailed?(n=".",r&&r.length>0?("."==r.slice(r.length-1)&&(n=""),t=" with the error: "+r):t="","The update failed"+t+n):""},_sendStatusEvent:function(e,r){var t=!!e;jr.isFunction(window.OnGetServiceUpdateStatus)&&window.OnGetServiceUpdateStatus(t,$u.detect.dcpStatus,$u._getStatusString($u.detect.dcpStatus,r))}};function ec(e){var r=e.split(",").map(function(e){return jr.trim(e)});return 4==r.length?{major:parseInt(r[0])||0,minor:parseInt(r[1])||0,patch:parseInt(r[2])||0,build:r[3]}:{major:0,minor:0,patch:0,build:"0000"}}function rc(e,r){var t=ec(e),n=ec(r);return t.major===n.major&&(t.minor>n.minor||!(t.minor<n.minor)&&(t.patch>n.patch||!(t.patch<n.patch)&&(t.build!==undefined&&n.build!==undefined&&t.build>=n.build)))}function tc(e,r){var t=ec(e),n=ec(r);return t.major===n.major}var nc={isSupportLS:function(){var e=!1;if(se.bEdge&&se.bFileSystem);else try{e=!!window.localStorage}catch(hH){}return e},item:function(e,r,t){var n=null;return this.isSupportLS()?(r?(localStorage.setItem(e,r),n=r):n=localStorage.getItem(e),null===n?t:n):t},removeItem:function(e){return!!this.isSupportLS()&&(localStorage.removeItem(e),!0)}};function ic(){if((se.bChrome||se.bEdge)&&parseInt(se.strBrowserVersion)>=142)return!0;return!1}function oc(e){if(undefined===e)return!0;var r;if(e)for(r=0;r<xn.LocalHosts.length;r++)if(e===xn.LocalHosts[r])return!0;return!1}function ac(e,r){jr.isString(r)&&""!=r&&!zs(r)&&xn.EnableLocalNetworkMixedContent&&(xn.HostIsLoopback&&xn.HostIsLoopback(r)?e.targetAddressSpace="loopback":xn.HostIsPrivate&&xn.HostIsPrivate(r)&&(e.targetAddressSpace="local"))}function sc(e){jr.log(e)}function uc(e){return{code:e._errorCode,message:e._errorString}}function cc(e){var r=Date.parse(e+"T00:00:00");return""!==e&&!isNaN(r)&&(!!xn.CheckCertExpired&&(new Date).getTime()>=r-864e5*xn.CertificateConfig.UpdateDaysBeforeExpired)}xn.HostIsLoopback=xn.HostIsLoopback||function(e){return!se.bSafari&&"local.dynamsoft.com"==e},xn.HostIsPrivate=xn.HostIsPrivate||function(e){return se.bSafari||lu(e),!1};var lc="Please make sure the Dynamic Web TWAIN Service has been installed.";function fc(e,r,t){e._errorCode=r,e._errorString=t}function dc(){return{code:it.ServiceNotInstalled,message:lc}}function hc(e){fc(e,it.ResponseDataTypeError,"Invalid response data was returned from the Dynamic Web TWAIN Service.")}function gc(e,r){fc(e,-2811,r)}function vc(){return{code:it.HTSTError,message:"The Connection from the insecure (HTTP) web page failed for HTST."}}function mc(){return{code:it.CORSError,message:'The Connection from the insecure (HTTP) web page to the local "Dynamic Web TWAIN Service" failed!'}}function pc(){return{code:it.DWTPortNotReady,message:"The Dynamic Web TWAIN Service is not ready, please try again later."}}function _c(){return{code:it.BboError,message:"Failed to get Machine ID."}}function yc(e,r,t,n){var i="",o=Qu.getJSVersion(),a="";r?(a=jr.replaceAll(r," ",""),a="version "+jr.replaceAll(a,",",".")):a="old version",o=jr.replaceAll(o,",","."),t&&(i=" It might be a custom version."),fc(e,it.MustUpgrade,"The installed Dynamic Web TWAIN Service (".concat(a,") is incompatible with the JavaScript version ").concat(o," used on this website.").concat(i))}function Sc(e){fc(e,-2909,"Access to the local scanning service is blocked.")}function Ic(e){fc(e,-2911,"Please grant access to the local scanning service.")}function bc(e){return e===it.MustUpgrade}var Cc="Version not found",Tc=!1,wc=function(){function e(){Nu(this,e)}return Wu(e,null,[{key:"_saveLS",value:function(e,r,t){oc(e)&&(nc.item("DWT_port",r),nc.item("DWT_ssl",t?"true":"false"))}},{key:"sendVersionRequestByWebSocket",value:(c=Ou(Lu().m(function l(e,r,t,n,i,o,a){var s,u,c,f,d,h;return Lu().w(function(l){for(;;)switch(l.p=l.n){case 0:if(s=Xs,u={client:null,userData:{cmdId:n,cmd:null,sFun:null,fFun:null,rawData:!0},taskId:n},!(c=$s.getWsClientInPool(e,r,t))){l.n=1;break}if(!(f=c._versionInfoRet)){l.n=1;break}return l.a(2,f);case 1:return(d=$s.getWsClient(e,r,t)).setRetry(0),l.p=2,l.n=3,d.request(i,s,u,o);case 3:return l.a(2,l.v);case 4:if(l.p=4,h=l.v,a&&jr.isObject(a)&&(a.timedout=d._timedout),!d){l.n=5;break}return l.n=5,d.dispose();case 5:throw h;case 6:return l.a(2)}},l,null,[[2,4]])})),function(e,r,t,n,i,o,a){return c.apply(this,arguments)})},{key:"sendVersionRequestByHttp",value:(u=Ou(Lu().m(function f(e,r,t,n,i,o){var a,s,u,c;return Lu().w(function(l){for(;;)switch(l.n){case 0:return a="fa/VersionInfo?v=1&ts="+jr.now(),s=$s.getHttpClient(e,r,t),ac(u={},js.getDWTHost()),o&&(u.redirect="manual"),xn.Token&&((c=new Headers).append("Authorization","Bearer "+xn.Token),u.headers=c),l.n=1,s.request(n,a,u,i);case 1:return l.a(2,l.v)}},f)})),function(e,r,t,n,i,o){return u.apply(this,arguments)})},{key:"sendVersionRequest",value:(s=Ou(Lu().m(function d(e,r,t,n,i,o,a,s){var u,c,l;return Lu().w(function(f){for(;;)switch(f.p=f.n){case 0:if(!a){f.n=7;break}u={},c=2;case 1:if(!(c>0)){f.n=6;break}return f.p=2,f.n=3,this.sendVersionRequestByWebSocket(e,r,t,n,i,o,u);case 3:return f.a(2,f.v);case 4:if(f.p=4,l=f.v,!u.timedout){f.n=5;break}if(!(--c>0)){f.n=5;break}return f.a(3,1);case 5:throw l;case 6:f.n=9;break;case 7:return f.n=8,this.sendVersionRequestByHttp(e,r,t,i,o,s);case 8:return f.a(2,f.v);case 9:return f.a(2)}},d,this,[[2,4]])})),function(e,r,t,n,i,o,a,u){return s.apply(this,arguments)})},{key:"processVersionResponse",value:(a=Ou(Lu().m(function h(e,r,t,n,i,o,a,s,u){var c;return Lu().w(function(l){for(;;)switch(l.n){case 0:if(!(c=this.parseResponse(e)).exception){l.n=1;break}this.handleExceptionResponse(c,a),l.n=6;break;case 1:if(!c.result){l.n=3;break}return l.n=2,this.handleResultResponse(c.result,r,t,n,i,o,a);case 2:return l.a(2,l.v);case 3:if(!c.ports){l.n=5;break}return l.n=4,this.handlePortsResponse(c.ports,r,n,s,u);case 4:return l.a(2,l.v);case 5:this.throwBadResponseError(a);case 6:return l.a(2)}},h,this)})),function(e,r,t,n,i,o,s,u,c){return a.apply(this,arguments)})},{key:"parseResponse",value:function(e){return e?jr.parse(e):null}},{key:"handleExceptionResponse",value:function(e,r){var t,n={};"exception"in(t=e)&&"description"in t&&0!==t.exception&&""!==t.description?(n._errorCode=e.exception,n._errorString=e.description,n._errorCause=function(e){return e&&"cause"in e&&e.cause||null}(e)):n._errorCode=it.CommonError,this.throwError(n,r)}},{key:"getMaxVersion",value:function(e){if(e&&e.length>0){for(var r=e[0],t=1;t<e.length;t++)parseFloat(e[t])>parseFloat(r)&&(r=e[t]);return r}return""}},{key:"handleSimpleCheckVersionInfoResult",value:function(e){jr.isArray(e)&&0!==e.length||this.throwBadResponseError(!1);var r=Uu(e,7);r[0];var t=r[1],n=void 0===t?"":t;r[2],r[3],r[4],r[5];var i=r[6],o=void 0===i?null:i;if(o&&jr.isObject(o)&&"code"in o&&"message"in o&&0!=o.code)throw{code:o.code,message:o.message,isServerError:!0};if(""===n);else if(n===Cc){var a={};yc(a,"",!1),this.throwError(a,!1)}else{var s={};gc(s,n),this.throwError(s,!1)}}},{key:"handleResultResponse",value:(o=Ou(Lu().m(function g(r,t,n,i,o,a,s){var u,c,l,f,d,h,v,m,p,_,y,S,I,b,C,T,w,A,E,k;return Lu().w(function(g){for(;;)switch(g.p=g.n){case 0:if(jr.isArray(r)&&0!==r.length||this.throwBadResponseError(s),u=Uu(r,7),c=u[0],l=u[1],f=void 0===l?"":l,d=u[2],h=void 0===d?0:d,v=u[3],m=void 0===v?"":v,p=u[4],_=void 0===p?"":p,y=u[5],S=void 0===y?"0":y,I=u[6],!(b=void 0===I?null:I)||!jr.isObject(b)){g.n=1;break}if(!("code"in b)||!("message"in b)){g.n=1;break}if(0==b.code){g.n=1;break}throw{code:b.code,message:b.message,isServerError:!0};case 1:if(""!==f){g.n=3;break}return g.n=2,this.processSuccessfulVersion(c,h,m,_,S,t,n,i,o,a,s);case 2:return g.a(2,g.v);case 3:if(f!==Cc){g.n=8;break}return C={},T="",w=!1,g.p=4,g.n=5,e.fetchAllDWTVersions(t,n,i);case 5:A=g.v,T=e.getMaxVersion(A),E=Qu.getJSVersion(),E=jr.replaceAll(E,",","."),T=jr.replaceAll(T," ",""),T=jr.replaceAll(T,",","."),w=E==T,g.n=7;break;case 6:g.p=6,g.v;case 7:yc(C,T,w),this.throwError(C,s),g.n=9;break;case 8:gc(k={},f),this.throwError(k,s);case 9:return g.a(2)}},g,this,[[4,6]])})),function(e,r,t,n,i,a,s){return o.apply(this,arguments)})},{key:"fetchAllDWTVersions",value:(i=Ou(Lu().m(function v(e,r,t){var n,i,o;return Lu().w(function(a){for(;;)switch(a.n){case 0:return i=(new Date).getTime(),a.n=1,fetch("".concat(t?"https":"http","://").concat(e,":").concat(r,"/api/server/version?t=").concat(i),{method:"GET"});case 1:return a.n=2,a.v.json();case 2:return o=a.v,a.a(2,(null==o||null===(n=o.moduleVersions)||void 0===n?void 0:n.core)||[])}},v)})),function(e,r,t){return i.apply(this,arguments)})},{key:"processSuccessfulVersion",value:(n=Ou(Lu().m(function m(e,r,t,n,i,o,a,s,u,c,l){var f,d,h,g;return Lu().w(function(v){for(;;)switch(v.n){case 0:if(this.showVersionInfo(e,l),this.handlePlatformInfo(r,o),this.handleMachineID(t,o),f=this.handleSSLCertInfo(n),this.checkCertValidity(n,c),Zu.tokenFlag=i,!jr.isString(e)||""===e){v.n=3;break}if(sc(Eu),Zu.updateServiceVersion(e),!u&&!rc(e,Qu.getServerVersionForCompareCompitable())){v.n=1;break}return v.a(2,{host:o,port:a,bSSL:s,version:e,certExpiredDate:f,tokenFlag:i});case 1:sc(Pu),d={},h=ec(e),g=ec(Qu.getServerVersionForCompareCompitable()),h.major,g.major,yc(d,e),this.throwError(d,l);case 2:v.n=4;break;case 3:this.throwBadResponseError(l);case 4:return v.a(2)}},m,this)})),function(e,r,t,i,o,a,s,u,c,l,f){return n.apply(this,arguments)})},{key:"showVersionInfo",value:function(e,r){var t="The WebTwain version is: "+e;r&&xn.OnWebTwainInitMessage&&xn.OnWebTwainInitMessage(t,et.Info)}},{key:"handlePlatformInfo",value:function(e,r){"32"===e&&oc(r)&&($u.b64bit=!1)}},{key:"handleMachineID",value:function(e,r){oc(r)&&xn.li&&xn.lgdt&&(!xn.li({instanceMode:xn.lgdt()},"")&&""!==e&&xn.lsmid&&xn.lsmid2b&&(xn.lsmid(e,""),xn.lsmid2b(e)))}},{key:"handleSSLCertInfo",value:function(e){if(!jr.isFunction(xn.OnSSLCertInfo)&&!jr.isFunction(Dn.OnSSLCertInfo))return null;var r=null;if(""!==e){var t=Date.parse(e+"T00:00:00");isNaN(t)||(r=new Date(t))}return Tc||(jr.isFunction(xn.OnSSLCertInfo)?xn.OnSSLCertInfo(r):jr.isFunction(Dn.OnSSLCertInfo)&&Dn.OnSSLCertInfo(r),Tc=!0),r}},{key:"checkCertValidity",value:function(e,r){if(r){if(""===e)throw{code:it.SSLCertInvalid,message:"The Dynamic Web TWAIN Service SSL certificate is invalid."};if(cc(e))throw{code:it.SSLCertExpired,message:"The Dynamic Web TWAIN Service SSL certificate has expired."}}}},{key:"handlePortsResponse",value:(t=Ou(Lu().m(function p(e,r,t,n,i){var o,a,s,u,c;return Lu().w(function(l){for(;;)switch(l.n){case 0:if(o=e.filter(function(e){return jr.isArray(e)&&3===e.length&&e[0]}),1!==o.length){l.n=1;break}return(a=Uu(o[0],3))[0],s=a[1],u=a[2],l.a(2,{bPortsChanged:!0,port:s,sslPort:u});case 1:if(!(o.length>1)){l.n=3;break}return l.n=2,this.tryMultiplePorts(o,r,t,n,i);case 2:return l.a(2,l.v);case 3:c=dc(),this.throwStandardError(c,i.bShowInitMessage);case 4:return l.a(2)}},p,this)})),function(e,r,n,i,o){return t.apply(this,arguments)})},{key:"tryMultiplePorts",value:(r=Ou(Lu().m(function _(e,r,t,n,i){var o,a,s,u,c,l,f,d,h,g;return Lu().w(function(v){for(;;)switch(v.p=v.n){case 0:i.bShowInitMessage=!1,i.bConnectWithSocket=!0,o=Mu(e),v.p=1,o.s();case 2:if((a=o.n()).done){v.n=8;break}return s=a.value,(u=Uu(s,3))[0],c=u[1],l=u[2],f=t?l:c,v.p=3,v.n=4,Ac(r,f,t,n,i);case 4:return v.a(2,{bPortsChanged:!0,port:c,sslPort:l});case 5:if(v.p=5,!(h=v.v).isServerError){v.n=6;break}throw delete h.isServerError,h;case 6:if(!bc(h.code)){v.n=7;break}throw h;case 7:v.n=2;break;case 8:v.n=10;break;case 9:v.p=9,g=v.v,o.e(g);case 10:return v.p=10,o.f(),v.f(10);case 11:d=dc(),this.throwStandardError(d,i.bShowInitMessage);case 12:return v.a(2)}},_,this,[[3,5],[1,9,10,11]])})),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"throwBadResponseError",value:function(e){var r={};hc(r),this.throwError(r,e)}},{key:"throwError",value:function(e,r){throw r&&xn.OnWebTwainInitMessage&&xn.OnWebTwainInitMessage(e._errorString,et.Error),{code:e._errorCode,message:e._errorString}}},{key:"throwStandardError",value:function(e,r){throw r&&xn.OnWebTwainInitMessage&&xn.OnWebTwainInitMessage(e.message,et.Error),e}},{key:"handleConnectionErrorThenThrow",value:function(e,r,t,n){if(r&&(e&&e.code)===it.HTTPRedirected)throw vc();var i=dc();throw n&&(jr.isString(e)?i.message=i.message+" Details: "+e:e&&e.message&&(i.message=i.message+" Details: "+e.message)),t&&xn.OnWebTwainInitMessage&&xn.OnWebTwainInitMessage(i.message,et.Error),i}}]);var r,t,n,i,o,a,s,u,c}();function Ac(e,r,t,n,i){return Ec.apply(this,arguments)}function Ec(){return(Ec=Ou(Lu().m(function e(r,t,n,i,o){var a,s,u,c,l,f,d,h,g,v,m,p,_,y,S,I;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return u=(s=o||{}).bRemoteServer||!1,c=null!==(a=s.bConnectWithSocket)&&void 0!==a?a:xn.ConnectWithSocket,l=s.bCheckCert||!1,f=!1!==s.bShowInitMessage,d=s.strPostVersion||"",kc(f),h=jr.now(),g=Pc(h,d),v=!c&&!se.bSSL,e.p=1,e.n=2,wc.sendVersionRequest(r,t,n,h,g,i,c,v);case 2:m=e.v,e.n=4;break;case 3:e.p=3,S=e.v,jr.log(["check DWT Version failed",jr.stringify(S)]),wc.handleConnectionErrorThenThrow(S,v,f,false);case 4:return e.p=4,e.n=5,wc.processVersionResponse(m,r,t,n,u,l,f,i,s);case 5:return p=e.v,c&&(_=$s.getWsClientInPool(r,t,n))&&(_._versionInfoRet=m),e.a(2,p);case 6:throw e.p=6,I=e.v,(y=$s.getWsClientInPool(r,t,n))&&(y._versionInfoRet=null),I;case 7:return e.a(2)}},e,null,[[4,6],[1,3]])}))).apply(this,arguments)}function kc(e){if(e&&xn.OnWebTwainInitMessage){var r=ds();xn.OnWebTwainInitMessage(r.generalMessages.checkingDWTVersion,et.Info)}}function Pc(e,r){var t={id:e,cmdId:e,method:"VersionInfo",version:r||"".concat(js.getDWTPrefix()).concat(js.getVersionStrForCheck()),tags:[Zu.versionInfoVer,Qu.getJSVersion()]};return xn.Token&&t.tags.push(xn.Token),jr.stringify(t)}function Fc(e,r,t,n){var i=jr.now(),o=i,a={id:i,cmdId:i,method:"VersionInfo",version:[js.getDWTPrefix(),js.getVersionStrForCheck()].join(""),tags:[Zu.versionInfoVer,Qu.getJSVersion()]};xn.Token&&a.tags.push(xn.Token);var s,u=Xs,c={cmdId:o,cmd:null,fFun:t,rawData:!0},l=Gs();s={client:e,userData:c,taskId:i},e.setRetry(0),e.request(jr.stringify(a),u,s,l).then(function(e){var n=e;if(jr.isString(e))try{n=jr.parse(e)}catch(i){}else jr.isObject(e)&&(n=e);if(n&&"result"in n){try{wc.handleSimpleCheckVersionInfoResult(n.result)}catch(o){return"isServerError"in o&&delete o.isServerError,void(jr.isFunction(t)&&t(o))}return jr.isFunction(r)&&r(n),n}jr.isFunction(t)&&t()},function(){jr.isFunction(n)&&n(),e.dispose()})}var Dc=function(){return Wu(function e(r){Nu(this,e),this.isLoadingFn=r,this.resolveCallbacks=[],this.isFirstWait=!0},[{key:"checkLoadingLoop",value:function(){var e=this;this.isLoadingFn()?setTimeout(function(){e.checkLoadingLoop()},100):(jr.each(this.resolveCallbacks,function(e){e(!0)}),this.resolveCallbacks=[])}},{key:"asyncWaitingJSLoaded",value:function(){var e=this;return new Cs.Promise(function(r){e.isLoadingFn()?(e.resolveCallbacks.push(r),e.isFirstWait&&(e.isFirstWait=!1,setTimeout(function(){e.checkLoadingLoop()},100))):r(!0)})}}])}(),xc={name:"Dynamic Web TWAIN",bFullEdition:!1,bHTML5Edition:zu,bActiveXEdition:Ju,versionInfoFromServer:"",hostForCheckCert:js.localIP,RemoteReconnectMaxTimes:200,RemoteReconnectTimeSpan:5e3,LocalReconnectMaxTimes:60,LocaleReconnectTimeSpan:3e3,getDSPath:function(e){return qu(e)},getLinuxHTML5DebPath:function(){return qu(".deb")},getLinuxHTML5RpmPath:function(){return qu(".rpm")},getEnumPlatform:function(){return se.bAndroid?rt.enumAndroid:se.bMac?rt.enumMac:se.bChromeOS?rt.enumChromeOS:se.bHarmonyOS?rt.enumHarmonyOS:Dn.navInfo.bEmbed?rt.enumEmbed:se.bLinux?rt.enumLinux:se.biPhone||se.biPad?rt.enumiOS:rt.enumWindow},getEnumBrowser:function(){return se.bEdge?Zr.enumEdge:se.bChrome?Zr.enumChrome:se.bFirefox?Zr.enumFirefox:se.bIE?Zr.enumIE:se.bSafari?Zr.enumSafari:se.bHuaWeiBrowser?Zr.enumHuaWeiBrowser:se.bOpera?Zr.enumOpera:Zr.enumUnknown}};function Oc(e,r,t){if(e){var n=null!=r?r:270,i=null!=t?t:350;n<=0&&(n=270),i<=0&&(i=350),Cs.one(e).before(On.install._strNonInstallDIV);var o=jr.get(On.install._divDWTNonInstallContainerID);o&&(o.style.width=n,o.style.height=i),jr.show(On.install._divDWTNonInstallContainerID)}}function Nc(e){var r=xc.getDSPath(),t=Js();if(""!=On.install._divDWTemessageContainer&&jr.hide(On.install._divDWTemessageContainer),se.bMac)e?jr.isFunction(Dn.OnWebTwainNeedUpgradeCallback)&&Dn.OnWebTwainNeedUpgradeCallback(xc.name,{"default":r},xc.bHTML5Edition,rt.enumMac,se.bIE,se.bSafari,t,se.IEVersion):jr.isFunction(Dn.OnWebTwainNotFoundOnMacCallback)&&Dn.OnWebTwainNotFoundOnMacCallback(xc.name,r,xc.bHTML5Edition,se.bIE,se.bSafari,t,se.IEVersion);else if(se.bLinux||Dn.navInfo.bEmbed||se.bChromeOS||Gu.bMobile){var n,i,o=xc.getEnumPlatform();if(Dn.navInfo.bEmbed||se.bAndroid||se.bChromeOS||se.bHarmonyOS?n=r:(n=xc.getLinuxHTML5DebPath(),i=xc.getLinuxHTML5RpmPath()),e){if(se.bAndroid)jr.isFunction(Dn.OnWebTwainNeedUpgradeOnAndroidCallback)&&Dn.OnWebTwainNeedUpgradeOnAndroidCallback(xc.name,r,t);else if(jr.isFunction(Dn.OnWebTwainNeedUpgradeCallback)){var a={"default":n};se.bLinux&&(a.deb=n,a.rpm=i),Dn.OnWebTwainNeedUpgradeCallback(xc.name,a,xc.bHTML5Edition,o,se.bIE,se.bSafari,t,se.IEVersion)}}else se.bAndroid?jr.isFunction(Dn.OnWebTwainNotFoundOnAndroidCallback)&&Dn.OnWebTwainNotFoundOnAndroidCallback(xc.name,r,t,!1):!xc.bFullEdition&&Gu.bMobile?jr.isFunction(Dn.OnMobileNotSupportCallback)&&Dn.OnMobileNotSupportCallback():jr.isFunction(Dn.OnWebTwainNotFoundOnLinuxCallback)&&Dn.OnWebTwainNotFoundOnLinuxCallback(xc.name,n,i,xc.bHTML5Edition,se.bIE,se.bSafari,t,se.IEVersion,o)}else if(se.bChrome||se.bSafari||se.bFirefox||se.bOpera||0==xn.IfUseActiveXForIE10Plus||!xn.ActiveXInstallWithCAB&&se.bIE)if(e){if(jr.isFunction(Dn.OnWebTwainNeedUpgradeCallback)){var s={"default":r};Dn.OnWebTwainNeedUpgradeCallback(xc.name,s,xc.bHTML5Edition,rt.enumWindow,se.bIE,se.bSafari,t,se.IEVersion)}}else jr.isFunction(Dn.OnWebTwainNotFoundOnWindowsCallback)&&Dn.OnWebTwainNotFoundOnWindowsCallback(xc.name,r,xc.bHTML5Edition,se.bIE,se.bSafari,t,se.IEVersion)}function Rc(e){if(!jr.isString(e)||0===e.length)return!1;var r=e.charAt(0);if("f"===r||"t"===r)return!0;if(jr.startsWith(e,"DLS"))return!1;if(jr.startsWith(e,"DLC"))return!1;if(jr.isNumber(e))return!1;var t=parseInt(e)+"-";return!jr.startsWith(e,t)}function Wc(e){return!(!jr.isString(e)||0===e.length)&&jr.startsWith(e,"DLC")}function Mc(){return Zu.bUseDynamsoftLicenseManager?jr.isString(Zu.refProductKey)&&(jr.startsWith(Zu.refProductKey,"DLS2")||""===Zu.refProductKey):jr.isString(Zu.handshakeCode)||jr.isString(Zu.organizationID)||Zu.bPublicLTS||jr.isString(xn.ProductKey)&&jr.startsWith(xn.ProductKey,"DLS2")}function Lc(e,r){var t=Js();On.detect.urls.splice(0),On.detect.urls.push({port:t?r:e,ssl:t}),On.detect.ports=[{port:t?r:e,ssl:t}],On.detect.cUrlIndex=0,$u.detect.dwtPort=e,$u.detect.dwtSSLPort=r,xn.Port=e,xn.SSLPort=r}function Bc(e,r,t){return Uc.apply(this,arguments)}function Uc(){return(Uc=Ou(Lu().m(function e(r,t,n){var i,o,a,s,u,c,l,f;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!Zu.bDCPChecked){e.n=1;break}return e.a(2,{port:xn.Port,sslPort:xn.SSLPort});case 1:return sc(Cu),o=Ks(r),a=o?$u.SSLPort:$u.Port,s=$s.getHttpClient(r,a,o),e.p=2,e.n=3,zc(s);case 3:i=e.v,e.n=7;break;case 4:if(e.p=4,f=e.v,jr.log(f),!f){e.n=6;break}if(u=f.code,!jr.isNumber(u)){e.n=6;break}if(u!=it.ResponseDataTypeError&&u!=it.HTSTError&&u!=it.CORSError&&u!=it.CORSErrorFromService&&u!=it.SSLCertExpired&&u!=it.SSLCertInvalid&&u!=it.TokenInvalid&&u!=it.TokenMissing&&u!=it.TokenExpired&&u!=it.TokenServiceLock){e.n=5;break}throw f;case 5:if(!bc(u)){e.n=6;break}throw f;case 6:throw pc();case 7:if(!js.bEnhancedMode){e.n=11;break}if(sc(Tu),c=On.install._dlgInstall,l=500,c||(l=0),c&&"true"==c.getAttribute("opened")||(l=0),!(i.port<=0||i.sslPort<=0)){e.n=10;break}if(!(l>0)){e.n=8;break}return e.n=8,new Cs.Promise(function(e,r){setTimeout(function(){e(!0)},l)});case 8:return sc(wu),e.n=9,Vc(s);case 9:i=e.v;case 10:e.n=12;break;case 11:i={port:t,sslPort:n};case 12:return Zu.bDCPChecked=!0,e.a(2,i)}},e,null,[[2,4]])}))).apply(this,arguments)}function Vc(e){return jc.apply(this,arguments)}function jc(){return(jc=Ou(Lu().m(function e(r){var t,n,i,o;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:n=5,i=1500,o={port:0,sslPort:0},t=0;case 1:if(!(t<n)){e.n=8;break}return t>2&&(i=3e3),sc(wu),e.p=2,e.n=3,Hc(r);case 3:o=e.v,e.n=5;break;case 4:e.p=4,e.v;case 5:if(!(jr.isNumber(o.port)&&o.port>0&&jr.isNumber(o.sslPort)&&o.sslPort>0)){e.n=6;break}return Lc(o.port,o.sslPort),e.a(2,o);case 6:return e.n=7,new Cs.Promise(function(e,r){setTimeout(function(){e(!0)},i)});case 7:t++,e.n=1;break;case 8:throw On.detect.dcpStatus=tt.NotReady,pc();case 9:return e.a(2)}},e,null,[[2,4]])}))).apply(this,arguments)}function Hc(e){return Gc.apply(this,arguments)}function Gc(){return Gc=Ou(Lu().m(function e(r){var t,n,i,o,a,s,u,c,l,f;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=Zu.refProductKey,i={id:jr.guid(),method:"GetPorts",version:"dwasm2_"+Qu.getManagerVer(),parameter:[$u.strSID]},Rc(t)&&(i.productKey=t),o={method:"POST"},xn.Token&&((a=new Headers).append("Authorization","Bearer "+xn.Token),o.headers=a),s="/dcp/dwasm2_"+js.getVersionStrForCheck()+"/GetPorts",e.n=1,r.request(jr.stringify(i),s,o);case 1:if(u=e.v,!jr.isString(u)){e.n=5;break}if(e.p=2,(c=jr.parse(u))&&"result"in c&&(n=c.result),!(jr.isArray(n)&&n.length>1&&n[1])){e.n=3;break}if(!(l=n[1]).dwt){e.n=3;break}return e.a(2,{port:l.dwt.port,sslPort:l.dwt.sslPort});case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:throw hc(f={}),uc(f);case 6:return e.a(2)}},e,null,[[2,4]])})),Gc.apply(this,arguments)}function zc(e){return Kc.apply(this,arguments)}function Kc(){return(Kc=Ou(Lu().m(function e(r){var t,n;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return $u.detect.bConnected=!1,e.p=1,e.n=2,Jc(r);case 2:return qc(e.v),$u.detect.bConnected=!0,e.a(2,{port:$u.detect.dwtPort,sslPort:$u.detect.dwtSSLPort});case 3:if(e.p=3,!(n=e.v)){e.n=5;break}if(t=n.code,!jr.isNumber(t)){e.n=5;break}if(t!=it.ResponseDataTypeError&&t!=it.HTSTError&&t!=it.CORSError&&t!=it.CORSErrorFromService&&t!=it.SSLCertExpired&&t!=it.SSLCertInvalid&&t!=it.TokenInvalid&&t!=it.TokenMissing&&t!=it.TokenExpired&&t!=it.TokenServiceLock){e.n=4;break}throw n;case 4:if(!bc(t)){e.n=5;break}throw n;case 5:throw $u.detect.dcpStatus=tt.NotInstalled,$u._sendStatusEvent(),dc();case 6:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function Jc(e){return Qc.apply(this,arguments)}function Qc(){return Qc=Ou(Lu().m(function e(r){var t,n,i,o,a,s,u,c,l,f,d,h;return Lu().w(function(e){for(;;)switch(e.n){case 0:return t=Zu.refProductKey,i={id:jr.guid(),method:"VersionInfo",version:"dwasm2_"+js.getVersionStrForCheck(),parameter:[]},Rc(t)&&(i.productKey=t),o={method:"POST"},xn.Token&&((a=new Headers).append("Authorization","Bearer "+xn.Token),o.headers=a,i.parameter.push(xn.Token)),s="/dcp/dwasm2_"+js.getVersionStrForCheck()+"/VersionInfo",e.n=1,r.request(jr.stringify(i),s,o);case 1:if(u=e.v,!jr.isString(u)){e.n=3;break}try{c=jr.parse(u)}catch(g){}if(!c){e.n=3;break}if(!("description"in c)||!("exception"in c)){e.n=2;break}throw{code:c.exception,message:c.description};case 2:"result"in c&&(n=c.result);case 3:if(l={},!(jr.isArray(n)&&n.length>0&&n[0])){e.n=6;break}if(f=n[0],!jr.isString(f)||""==f){e.n=6;break}if(Zu.updateServiceVersion(f),!tc(f,Qu.getServerVersionForCompareCompitable())){e.n=4;break}return $u.detect.dcpStatus=tt.UpdateSkipped,$u._sendStatusEvent(),e.a(2,n);case 4:throw d=ec(f),h=ec(Qu.getServerVersionForCompareCompitable()),d.major,h.major,yc(l,f),sc(Pu),uc(l);case 5:e.n=6;break;case 6:throw hc(l),uc(l);case 7:return e.a(2)}},e)})),Qc.apply(this,arguments)}function qc(e){var r="",t=!1,n=!1,i={};if(e.length>4&&(r=jr.isString(e[2])?e[2]:"",t=jr.isString(e[3])&&"true"===e[3],n=jr.isString(e[4])&&"64"===e[4]),e.length>5&&(i=e[5]),$u.detect.connectedResult=e,$u.strSID=r,$u.b64bit=n,js.objEnhancedPorts=i,js.bEnhancedMode=t,t&&i){if(i.dcp){var o=i.dcp;$u.SSLPort=o.sslPort,$u.Port=o.port}if(i.ddm){var a=i.ddm;if(a){var s=Js();$u.detect.ddmPort=s?a.sslPort:a.port}else $u.detect.ddmPort=0}if(xn.Port=0,xn.SSLPort=0,i.dwt){var u=i.dwt;u&&u.port>0&&u.sslPort>0&&Lc(u.port,u.sslPort)}}}function Yc(e){jr.isFunction(xn.OnWebTwainError)?xn.OnWebTwainError(e):jr.isFunction(window.Dynamsoft_OnError)&&window.Dynamsoft_OnError(e)}function Xc(e,r,t){var n,i,o="/";return jr.startsWith(e,"https://")?n=!0:jr.startsWith(e,"http://")?n=!1:e=(n=Ks(e))?"https://"+e:"http://"+e,i=n?$u.SSLPort+"/":$u.Port+"/",jr.endsWith(e,"/")&&(o=""),r?[e,o,"ddm/",i,t].join(""):[e,o,t].join("")}function Zc(e,r){return $c.apply(this,arguments)}function $c(){return($c=Ou(Lu().m(function e(r,t){var n,i,o;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(Mc()){e.n=1;break}return e.a(2);case 1:if(e.p=1,!xn.li||!xn.lgdt){e.n=6;break}if(xn.li({instanceMode:xn.lgdt()},"")){e.n=6;break}return t&&sc(Fu),e.p=2,e.n=3,tl();case 3:return n=e.v,e.n=4,el(n);case 4:e.n=6;break;case 5:e.p=5,i=e.v,jr.log(i);case 6:e.n=8;break;case 7:e.p=7,o=e.v,jr.log(o);case 8:return e.a(2)}},e,null,[[2,5],[1,7]])}))).apply(this,arguments)}function el(e){return rl.apply(this,arguments)}function rl(){return(rl=Ou(Lu().m(function e(r){var t;return Lu().w(function(e){for(;;)switch(e.n){case 0:if(!r){e.n=2;break}if(!(jr.isArray(r.result)&&r.result.length>3)){e.n=1;break}t=r.result[3],e.n=2;break;case 1:if(!r.description){e.n=2;break}return e.a(2,{code:r.exception,message:r.description});case 2:return jr.isString(t)&&""!=t&&(xn.lsmid(t,""),xn.lsmid2b(t)),e.a(2,{code:0,message:""})}},e)}))).apply(this,arguments)}function tl(e){return nl.apply(this,arguments)}function nl(){return(nl=Ou(Lu().m(function e(r){var t,n,i,o,a,s;return Lu().w(function(e){for(;;)if(0===e.n)return t=Hs(),n=[Qu.getDdmModuleNameVerPath(),"/VersionInfo?","ts=",jr.now()].join(""),i=['{"id":"',jr.guid(),'","method":"VersionInfo"}'].join(""),o=il(r),a={dataType:"json"},xn.Token&&((s=new Headers).append("Authorization","Bearer "+xn.Token),a.headers=s),ac(a,js.getDWTHost()),e.a(2,o.request(i,n,a,t))},e)}))).apply(this,arguments)}function il(e,r){var t;if(jr.isString(e)){var n=new ts;if(r)t=!1;else t=Ks(new ra(e).hostname);return jr.startsWith(e,"https://")?n.server=e.substring(8):jr.startsWith(e,"http://")?n.server=e.substring(7):n.server=e,n.ssl=t,os.Instance.getClient(n)}r?t=!1:t=Ks(new ra(e).hostname);return $s.getHttpClient(null,t?$u.SSLPort:$u.Port,t)}var ol=null,al=null,sl=!1,ul={onCheckDWT:null};function cl(e){return ll.apply(this,arguments)}function ll(){return(ll=Ou(Lu().m(function e(r){var t,n,i,o,a,s,u;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=cu()&&Dn.DWT.EnableFirefoxLNAPermission,e.n=1,su();case 1:if(!(n=e.v)){e.n=7;break}if("denied"!=(i=n.state)&&"prompt"!=i&&!t){e.n=6;break}if(e.p=2,!ul.onCheckDWT){e.n=3;break}return e.n=3,ul.onCheckDWT(r);case 3:sl&&xn.CloseDialog(),ul.onCheckDWT=null,ol(),e.n=5;break;case 4:e.p=4,u=e.v,((o=u.code)==it.HTSTError||o==it.SSLCertExpired||o==it.SSLCertInvalid||bc(o)||o==it.CORSErrorFromService||o==it.TokenInvalid||o==it.TokenMissing||o==it.TokenExpired||o==it.TokenServiceLock)&&al(u),a={},s=!1,t?(s=!0,Ic(a)):"denied"==i?Sc(a):(s=!0,Ic(a)),Dn.OnBrowserLNADenied&&(Dn.OnBrowserLNADenied(a._errorString,!1,s),sl=!0),Dn.DWT.OnWebTwainInitMessage&&Dn.DWT.OnWebTwainInitMessage(a._errorString,et.Error),setTimeout(function(){cl(r)},2e3);case 5:e.n=7;break;case 6:sl&&xn.CloseDialog(),ul.onCheckDWT=null,ol();case 7:return e.a(2)}},e,null,[[2,4]])}))).apply(this,arguments)}function fl(e){return ol=null,al=null,e&&jr.isFunction(e.onCheckDWT)&&(ul.onCheckDWT=e.onCheckDWT),new On.Promise(function(r,t){ol=r,al=t,cl(e)})}function dl(e,r,t,n,i,o){var a=0,s=e,u=r,c=t,l=i,f=o;if(jr.isFunction(s)&&jr.isFunction(u))for(l=s,f=u,s=js.getDWTHost(),a=0;a<On.detect.ports.length;a++)if(c&&On.detect.ports[a].ssl||!c&&!On.detect.ports[a].ssl){u=On.detect.ports[a].port;break}s||(s=js.getDWTHost()),Ac(s,u,c,Hs(),n).then(function(e){if("bPortsChanged"in e){jr.isFunction(f)&&f({code:-1,message:"Ports changed unexpectedly"})}else{var r=e,t=r.host,n=r.port,i=r.version;jr.isFunction(l)&&l(t,n,i)}},function(e){jr.isFunction(f)&&f(e)})}function hl(e,r,t,n){return gl.apply(this,arguments)}function gl(){return(gl=Ou(Lu().m(function e(r,t,n,i){return Lu().w(function(e){for(;;)switch(e.n){case 0:throw vl(r,i),oc(t.host)?Nc(!1):jr.isFunction(Dn.OnRemoteWebTwainNotFoundCallback)&&Dn.OnRemoteWebTwainNotFoundCallback(xc.name,t.host,n,i,Gu.bMobile),r;case 1:return e.a(2)}},e)}))).apply(this,arguments)}function vl(e,r){var t=e.code;if(t==it.CORSErrorFromService||t==it.SSLCertExpired||t==it.SSLCertInvalid||t==it.TokenInvalid||t==it.TokenMissing||t==it.TokenExpired||t==it.TokenServiceLock)throw e;if(bc(t))throw Nc(!0),e;if(r&&xn.EnableLocalNetworkMixedContent)throw e}function ml(e,r,t,n){return pl.apply(this,arguments)}function pl(){return(pl=Ou(Lu().m(function e(r,t,n,i){return Lu().w(function(e){for(;;)switch(e.n){case 0:return On.detect.dcpStatus=tt.Connected,wc._saveLS(r.host,t.port,t.bSSL),e.n=1,Zc(!1,!0);case 1:if(!Mc()||!oc(n)){e.n=2;break}if(!xn.li||!xn.lgdt){e.n=2;break}if(xn.li({instanceMode:xn.lgdt()},"")){e.n=2;break}throw _c();case 2:return e.a(2)}},e)}))).apply(this,arguments)}function _l(e){return yl.apply(this,arguments)}function yl(){return(yl=Ou(Lu().m(function e(r){var t,n;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,r();case 1:case 4:t=e.v,e.n=6;break;case 2:if(e.p=2,!bc((n=e.v).code)){e.n=3;break}throw n;case 3:if(!se.bSSL||!xn.EnableLocalNetworkMixedContent){e.n=5;break}return xn.EnableLocalNetworkMixedContent=!1,e.n=4,r();case 5:throw n;case 6:return e.a(2,t)}},e,null,[[0,2]])}))).apply(this,arguments)}function Sl(e){return!(xn.EnableLocalNetworkMixedContent&&se.bSSL||js.bPortChanged)&&!(!js.bDWTChecked||!e.bFromLoadInit)}function Il(e){return bl.apply(this,arguments)}function bl(){return(bl=Ou(Lu().m(function e(r){var t,n,i,o,a,s,u,c,l;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,_l(Ou(Lu().m(function f(){var e;return Lu().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,kl(r,!0);case 1:return Ll(e=t.v,r),t.a(2,e)}},f)})));case 1:t=e.v,e.n=6;break;case 2:if(e.p=2,!(c=e.v).isServerError){e.n=3;break}throw delete c.isServerError,c;case 3:if(!bc(c.code)){e.n=4;break}throw Nc(!0),c;case 4:return e.n=5,_l(Ou(Lu().m(function d(){var e;return Lu().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,xl(r);case 1:return Ll(e=t.v,r),t.a(2,e)}},d)})));case 5:t=e.v;case 6:if(e.p=6,n=!1,!se.bFirefox){e.n=7;break}xn.EnableFirefoxLNAPermission&&(n=!0),e.n=9;break;case 7:if(!se.bChrome&&!se.bEdge){e.n=9;break}return e.n=8,su();case 8:(i=e.v)&&("denied"==i.state?(Sc(o={}),Dn.OnBrowserLNADenied&&Dn.OnBrowserLNADenied(o._errorString,!1,!1),n=!0):"prompt"==i.state&&ic()&&fu()&&(Ic(a={}),Dn.OnBrowserLNADenied&&Dn.OnBrowserLNADenied(a._errorString,!1,!0),n=!0)),e.n=9;break;case 9:if(!n){e.n=11;break}return e.n=10,fl(r);case 10:Dn.DWT.CloseDialog();case 11:if(se.bSSL||!du()||Dn.DWT.ConnectWithSocket){e.n=13;break}return e.n=12,_l(Ou(Lu().m(function h(){var e;return Lu().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Nl(r);case 1:return Ll(e=t.v,r),t.a(2,e)}},h)})));case 12:t=e.v;case 13:e.n=22;break;case 14:if(e.p=14,l=e.v,(s=l.code)!=it.HTSTError&&s!=it.SSLCertExpired&&s!=it.SSLCertInvalid&&!bc(s)&&s!=it.CORSErrorFromService&&s!=it.TokenInvalid&&s!=it.TokenMissing&&s!=it.TokenExpired&&s!=it.TokenServiceLock){e.n=15;break}throw l;case 15:if(u={},!fu()){e.n=19;break}if(!se.bFirefox){e.n=16;break}Ic(u),e.n=18;break;case 16:if(!ic()){e.n=17;break}Ic(u),e.n=18;break;case 17:throw l;case 18:e.n=20;break;case 19:throw l;case 20:return Dn.OnBrowserLNADenied&&Dn.OnBrowserLNADenied(u._errorString,!1,!0),e.n=21,fl(r);case 21:Dn.DWT.CloseDialog();case 22:return e.a(2,t)}},e,null,[[6,14],[0,2]])}))).apply(this,arguments)}var Cl,Tl=!1,wl=new Dc(function(){return Tl});function Al(e){return El.apply(this,arguments)}function El(){return El=Ou(Lu().m(function e(r){var t,n,i,o;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!Sl(r)){e.n=1;break}return e.a(2);case 1:if(Tl){e.n=2;break}Tl=!0,e.n=4;break;case 2:return e.n=3,wl.asyncWaitingJSLoaded();case 3:return e.a(2,e.v);case 4:return t=r.host,n=xn.EnableLocalNetworkMixedContent,e.p=5,r.onCheckDWT=function(){var e=Ou(Lu().m(function r(e){var t;return Lu().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,kl(e,!1,!1);case 1:(t=r.v)&&t.port&&(e.Port=t.port);case 2:return r.a(2)}},r)}));return function(r){return e.apply(this,arguments)}}(),e.n=6,Il(r);case 6:return i=e.v,e.n=7,ml(r,i,t,n);case 7:e.n=9;break;case 8:throw e.p=8,o=e.v,Tl=!1,o;case 9:js.bDWTChecked=!0,Tl=!1;case 10:return e.a(2)}},e,null,[[5,8]])})),El.apply(this,arguments)}function kl(e,r,t){return Pl.apply(this,arguments)}function Pl(){return(Pl=Ou(Lu().m(function e(r,t,n){var i,o,a,s,u,c,l,f,d,h;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:return sc(Au),i=r.host,o=r.port,a=r.sslPort,s=Ks(i),(u=s?a:o)||jr.each(On.detect.ports,function(e){s?e.ssl&&(u=e.port):e.ssl||(u=e.port)}),l=!0,!0!==n&&(l=!1),e.p=1,e.n=2,Ac(i,u,s,t?Gs():Hs(),{bConnectWithSocket:t,bShowInitMessage:l});case 2:if(!(c=e.v).bPortsChanged){e.n=4;break}return f=c.port,d=c.sslPort,u=s?d:f,r.port=f,r.sslPort=d,e.n=3,Ac(i,u,s,t?Gs():Hs(),{bConnectWithSocket:t,bShowInitMessage:l});case 3:(c=e.v).bPortsChanged=!0;case 4:e.n=6;break;case 5:throw e.p=5,h=e.v,On.detect.dcpStatus=tt.NotInstalled,h;case 6:return sc(ku),!xc.versionInfoFromServer&&oc(c.host)&&(xc.versionInfoFromServer=c.version),e.a(2,c)}},e,null,[[1,5]])}))).apply(this,arguments)}function Fl(e,r,t,n,i,o){dl(e,r,t,{bRemoteServer:!0,bConnectWithSocket:n},i,o)}function Dl(e,r,t,n,i){if(jr.isString(e)&&jr.isString(r))dl(e,r,t,null,n,i);else{var o=e,a=r,s=xn.Host,u=Ks(s);dl(s,u?xn.SSLPort:xn.Port,u,null,o,a)}}function xl(e){return Ol.apply(this,arguments)}function Ol(){return(Ol=Ou(Lu().m(function e(r){var t,n,i,o,a,s,u,c;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=r.port,n=r.sslPort,i=Js(),o=i?n:t,!i||se.bSafari||se.bMobile||se.bAndroid){e.n=12;break}if(e.p=1,!xn.ConnectWithSocket&&1==xn.IfCheckCORS){e.n=2;break}throw dc();case 2:return e.n=3,Wl(r,!1);case 3:e.n=11;break;case 4:if(e.p=4,vl(e.v,!0),e.p=5,1==xn.IfCheckCert){e.n=6;break}throw dc();case 6:return e.n=7,Ac(js.localIP,t,!1,Gs(),{bConnectWithSocket:!0,bCheckCert:!0});case 7:if(!("bPortsChanged"in(a=e.v))){e.n=9;break}return t=(s=a).port,n=s.sslPort,o=i?n:t,e.n=8,Ac(js.localIP,o,!1,Gs(),{bConnectWithSocket:!0,bCheckCert:!0});case 8:a=e.v;case 9:e.n=11;break;case 10:return e.p=10,u=e.v,e.n=11,hl(u,r,o,!1);case 11:e.n=16;break;case 12:if(e.p=12,!xn.ConnectWithSocket&&0!=xn.IfCheckCORS){e.n=13;break}throw dc();case 13:return e.n=14,Wl(r,!1);case 14:e.n=16;break;case 15:return e.p=15,c=e.v,e.n=16,hl(c,r,o,i);case 16:throw pc();case 17:return e.a(2)}},e,null,[[12,15],[5,10],[1,4]])}))).apply(this,arguments)}function Nl(e){return Rl.apply(this,arguments)}function Rl(){return(Rl=Ou(Lu().m(function e(r){return Lu().w(function(e){for(;;)if(0===e.n)return e.a(2,Wl(r,!0))},e)}))).apply(this,arguments)}function Wl(e,r){return Ml.apply(this,arguments)}function Ml(){return(Ml=Ou(Lu().m(function e(r,t){var n,i,o,a;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,xn.ConnectWithSocket){e.n=2;break}return e.n=1,kl(r,!1);case 1:n=e.v;case 2:e.n=4;break;case 3:throw e.p=3,a=e.v,i=a,(o=a.code)==it.ResponseDataTypeError||o==it.HTSTError||o==it.CORSError||o==it.SSLCertExpired||o==it.SSLCertInvalid||o==it.TokenInvalid||o==it.TokenMissing||o==it.TokenExpired||o==it.TokenServiceLock||bc(o)||(o==it.CORSErrorFromService?jr.isFunction(Dn.OnCorsConfigError)&&Dn.OnCorsConfigError(a.message):oc(r.host)&&t&&du()&&(i=mc(),o=i.code)),o==it.CORSError&&jr.isFunction(Dn.OnHTTPCorsError)&&Dn.OnHTTPCorsError(i.message),i;case 4:return e.a(2,n)}},e,null,[[0,3]])}))).apply(this,arguments)}function Ll(e,r){e&&e.bPortsChanged&&($u.Port=r.port,$u.SSLPort=r.sslPort,xn.Port=r.port,xn.SSLPort=r.sslPort,js.bPortChanged=!0)}function Bl(e){return Ul.apply(this,arguments)}function Ul(){return(Ul=Ou(Lu().m(function e(r){var t,n,i,o,a,s,u,c;return Lu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,!js.fireOnBeforeCheckEvent||!On.Connect.OnBeforeCheck){e.n=2;break}return e.n=1,On.Connect.OnBeforeCheck();case 1:js.fireOnBeforeCheckEvent=!1;case 2:e.n=4;break;case 3:e.p=3,Yc(e.v);case 4:t=3,(i=r||{}).host||(i.host=js.getDWTHost()),i.port||(i.port=xn.Port),i.sslPort||(i.sslPort=xn.SSLPort),n=0;case 5:if(!(n<t)){e.n=12;break}return e.p=6,e.n=7,Al(i);case 7:return e.a(3,12);case 8:if(e.p=8,c=e.v,!(n<t-1&&c.code==it.DWTPortNotReady)){e.n=10;break}return e.n=9,new Cs.Promise(function(e,r){setTimeout(function(){e(!0)},300)});case 9:return e.a(3,11);case 10:throw c;case 11:n++,e.n=5;break;case 12:if(!xn.IfCheckDCP){e.n=19;break}return o=Js(),a=o?i.sslPort:i.port,e.n=13,Bc(i.host,i.port,i.sslPort);case 13:if(!(s=e.v)){e.n=14;break}i.port=s.port,i.sslPort=s.sslPort,a=o?i.sslPort:i.port,e.n=15;break;case 14:throw hc(u={}),uc(u);case 15:if(!js.bEnhancedMode){e.n=19;break}return e.p=16,o=Ks(i.host),e.n=17,$s.closeWsClient(i.host,a,o);case 17:e.n=19;break;case 18:e.p=18,e.v;case 19:if(js.bDWTChecked)try{jr.isFunction(On.Connect.OnConnectReady)&&On.Connect.OnConnectReady()}catch(l){Yc(l)}case 20:return e.a(2)}},e,null,[[16,18],[6,8],[0,3]])}))).apply(this,arguments)}function Vl(){var e=On.Promise;if(Cl)return e.resolve(Cl);var r,t,n=navigator;if(n&&"userAgentData"in n){var i=navigator.userAgentData;if(i.platform&&""!=i.platform){var o=[];if("brands"in i&&jr.isArray(i.brands)&&i.brands.length>0?o=i.brands:"uaList"in i&&jr.isArray(i.uaList)&&i.uaList.length>0&&(o=i.uaList),o.length>0)return(t=function(e){var r=se,t=e.architecture.toLowerCase(),n="64"==e.bitness,i=t.indexOf("arm")>-1,o=t.indexOf("mips")>-1;return{bUseUserAgent:!1,bWin:r.bWin,bMac:r.bMac,bLinux:r.bLinux,bAndroid:r.bAndroid,bMobile:r.bMobile,bPad:r.bPad,bChromeOS:r.bChromeOS,bHarmonyOS:r.bHarmonyOS,bArm64:i,bMips64:o,bEmbed:i||o,bOSx64:n,bIE:!1,bEdge:r.bEdge,bChrome:r.bChrome,bFirefox:r.bFirefox,bSafari:r.bSafari,bOpera:r.bOpera,bGecko:!0,bHuaWeiBrowser:!1,bHTML5Edition:!0,strBrowserVersion:r.strBrowserVersion,IEMode:0}},r?On.Promise.resolve(function(){return t(r)}):navigator.userAgentData.getHighEntropyValues(["platform","platformVersion","architecture","bitness"]).then(t)).then(function(e){return Cl=e,e})}}return Cl=se,e.resolve(Cl)}function jl(e,r){On.detect.bMaskShow=!0,xn.ScanDirectly||jr.isFunction(xn.OnWebTwainPreExecute)&&xn.OnWebTwainPreExecute(e,r)}function Hl(){On.detect.bMaskShow=!1,xn.ScanDirectly||jr.isFunction(xn.OnWebTwainPostExecute)&&xn.OnWebTwainPostExecute()}var Gl=0;function zl(e,r,t){if(jr.log("showMask:"+e+"--"+Gl),0===Gl)if(r){jl(r,t||{});var n=On.mask.dlgMask;if(n){n.style.zIndex="10000";var i=jr.sizzle(".dynamsoft-backdrop",n.parentNode);i&&i.length>0&&(i[0].style.zIndex="10000")}}else jl(null,t||{});Gl++}function Kl(e){jr.log("hideMask:"+e+"--"+Gl),Gl>1?Gl--:Gl<=1&&(Hl(),Gl=0)}var Jl=function(){return Wu(function r(){Nu(this,r)},null,[{key:"CheckWebTwainBySocket",value:function(e,r,t,n,i,o){var a=$s.getWsClient(e,r,t);return Fc(a,n,i,o),a}},{key:"Init",value:(e=Ou(Lu().m(function t(){var e;return Lu().w(function(r){for(;;)switch(r.p=r.n){case 0:if(!js.bPortsChecking){r.n=1;break}return r.a(2);case 1:if(js.bPortsChecking=!0,Ql(),r.p=2,Dn.navInfo){r.n=4;break}return r.n=3,Vl();case 3:Dn.navInfo=r.v;case 4:return r.p=4,r.n=5,Yl();case 5:r.n=7;break;case 6:r.p=6,Yc(r.v);case 7:try{On.closeProgress()}catch(lK){}try{xn.CloseDialog()}catch(t){Yc(t)}if(e={host:js.getDWTHost(),port:xn.Port,sslPort:xn.SSLPort},!xn.AutoCheckConnection){r.n=8;break}return r.n=8,Bl(e);case 8:return r.p=8,js.bPortsChecking=!1,ql(),r.f(8);case 9:return r.a(2)}},t,null,[[4,6],[2,,8,9]])})),function(){return e.apply(this,arguments)})}]);var e}();function Ql(){zl("openLoadingMsg")}function ql(){Kl("closeLoadingMsg:")}function Yl(){return Xl.apply(this,arguments)}function Xl(){return Xl=Ou(Lu().m(function e(){var r,t,n,i;return Lu().w(function(e){for(;;)switch(e.n){case 0:if(!js.bCSSLoaded){e.n=1;break}return e.a(2);case 1:if(!On.detect.cssLoaded){e.n=2;break}return js.bCSSLoaded=!0,e.a(2);case 2:return r=Xu(),t="",n="",jr.isString(r)&&r.length>0&&("/"==r.charAt(r.length-1)||(n="/")),!se.bFileSystem&&xn.IfResourcesAddTimestamp&&(t=On.timestamp),i=[[r,n,"src/dynamsoft.webtwain.css",t].join("")],js.bCSSLoaded=!0,e.n=3,new Cs.Promise(function(e,r){if(se.bSafari){var t=!1;if(jr.addAllCss(i,!1,function(e){e||(t=!0)}),t)r({code:-2804,message:"Loading the WebTwain css files failed."});else e(!0)}else jr.addAllCss(i,!1,function(t){t?e(!0):r({code:-2804,message:"Loading the WebTwain css files failed."})})});case 3:return e.a(2)}},e)})),Xl.apply(this,arguments)}var Zl=function(){function e(){Nu(this,e)}return Wu(e,[{key:"closeDialog",value:function(){var e=this,r=On.install._dlgInstall;if(r){var t=jr.sizzle(".dynamsoft-dialog-close");jr.each(t,function(r){jr.removeEventListener(r,"click",e.closeDialog.bind(e))}),"true"===r.getAttribute("opened")&&r.close(),document.body.removeChild(r),On.install._dlgInstall=!1}}},{key:"showDialog",value:function(e,r,t,n,i){if(!1!==t){var o,a={width:e,height:r,position:"absolute"};n?(o='<div class="dynamsoft-dwt-dialog-body">'.concat(t,"</div>"),a.closeButton=!1):o='<div class="ds-dwt-ui-showdlg"><div class="dynamsoft-dwt-dialog-body">\n <div class="dynamsoft-dwt-dlg-header">'.concat(i?"":'<div class="dynamsoft-dialog-close"></div>',"</div>\n ").concat(t,"\n</div></div>"),i&&(a.closeButton=!1),this.showMessage(o,a)}}},{key:"showMessage",value:function(e,r){var t,n,i=this,o=On.install,a="ds-dwt-ui-dlg",s="ds-dwt-ui-dlg-wrap",u=screen.width,c=!0,l=null==r?void 0:r.width,f=(null==r?void 0:r.height)||"100%",d=(null==r?void 0:r.seconds)||0,h=!1!==(null==r?void 0:r.closeButton),g=null==r?void 0:r.bAutoClose,v=!0,m=(null==r?void 0:r.headerStyle)||0,p=(null==r?void 0:r.position)||"fixed",_=(null==r?void 0:r.caption)||"Error",y=xc.bActiveXEdition,S=1===(null==r?void 0:r.backgroundStyle),I=null==r?void 0:r.onClose;if(!1===(null==r?void 0:r.bReadyClosed)&&(c=!1),l?!se.bMobile&&l>u-10&&(l=u-10):l=u>600?600:u-10,1===m?e='<div class="dynamsoft-dialog"><div class="dynamsoft-dwt-dialog-body">\n <div class="dynamsoft-dwt-dlg-header">'.concat(h?'<div class="dynamsoft-dialog-close"></div>':"","</div>\n ").concat(e,"\n</div></div>"):2===m&&(e='<div class="dynamsoft-dialog">\n <div class="dynamsoft-dwt-ltsdlg-header"><span style="color:#FFF;line-height:35px;margin-left:15px">'.concat(_,"</span>").concat(h?'<div class="dynamsoft-dialog-close"></div>':"",'</div>\n <div class="dynamsoft-dwt-ltsdlg-body" style="padding:25px 40px 20px 40px;">').concat(e,"</div>\n</div>")),0===jr.sizzle("."+a).length){var b=document.createElement("div"),C=document.createElement("div"),T=document.createElement("div");if(b.className=a,C.className=s,C.style.margin="auto",C.style.zIndex="9999",C.style.position="relative",C.style.border="0",g&&((t=document.createElement("div")).className="dynamsoft-dialog-close",C.insertBefore(t,C.firstElementChild),(n=document.createElement("div")).className="dynamsoft-dialog-closeTimer",n.style.width="100%",n.style.height="2px",n.style.marginTop="-2px",n.style.backgroundColor="#fe8e14",C.insertBefore(n,C.firstElementChild)),C.appendChild(T),this.setElementInnerHTML(T,e),b.appendChild(C),document.body.appendChild(b),I){var w=Cs.one(".dynamsoft-dialog-close",b);if(w){var A=w[0];A.onClose=function(){jr.removeEventListener(A,"click",A.onClose),A.onClose=null,I()},jr.addEventListener(A,"click",A.onClose)}}if(S?Cs.setBackOpacity({opacity:.4,grayHex:0}):Cs.setBackOpacity({}),b.bTopmost=!0,o._dlgInstall=b,Cs.dialog.setup(o._dlgInstall,!1),se.bIE){var E=document.createElement("iframe");E.frameborder="0",E.marginheight="0",E.marginwidth="0",E.style.border="0",E.style.backgroundColor="transparent",E.style.position="absolute",E.style.left="0",E.style.top="0",E.style.width="100%",E.style.height=document.body.clientHeight+"px",E.style.margin="0 auto",E.style.zIndex="10000",E.src=["javas","cript:",'""'].join("");var k=Cs.one(".dynamsoft-backdrop");if(k&&k.length>0){for(var P=k[0];P.firstChild;)P.removeChild(P.firstChild);P.style.zIndex="10000",P.appendChild(E)}}}else v=!1;var F=Cs.one("."+s);if(F&&F.getEL()&&(F[0].style.width=l+"px",jr.isNumber(f)&&f>0?F[0].style.height=f+"px":F[0].style.height="100%",v||jr.each(F[0].childNodes,function(r){return"DIV"===r.tagName&&"dynamsoft-dialog-close"!==r.className&&"dynamsoft-dialog-closeTimer"!==r.className?(i.setElementInnerHTML(r,e),!1):undefined})),y){var D=Cs.one(".dynamsoft-dialog");D&&D.getEL()&&(D.getEL().style.border="1px solid #999")}if("true"===o._dlgInstall.getAttribute("opened")&&o._dlgInstall.close(),o._dlgInstall.showModal({position:p}),o._dlgInstall.bReadyClosed=c,S&&Cs.setBackOpacity({}),h){var x=jr.sizzle(".dynamsoft-dialog-close");jr.each(x,function(e){jr.addEventListener(e,"click",i.closeDialog.bind(i))}),x.length>0&&g&&d>0&&setTimeout(function(){return i.updateCloseTimer()},100)}}},{key:"updateCloseTimer",value:function(){var e=this,r=On.install._dlgInstall;if(r){var t=jr.sizzle(".dynamsoft-dialog-closeTimer",r);if(t.length>0){var n=t[0],i=parseInt(n.style.width);(i-=1)<=0?this.closeDialog():(n.style.width=i+"%",setTimeout(function(){return e.updateCloseTimer()},100))}}}},{key:"setElementInnerHTML",value:function(e,r){document.body&&Cs.setHtml(e,r)}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}])}();xn.OnWebTwainPreExecute||(xn.OnWebTwainPreExecute=function(e,r){var t,n,i,o=xn.IfConfineMaskWithinTheViewer;if(o&&(e&&(n=e._containerElement),n||xn.Containers&&xn.Containers.length>0&&xn.Containers[0].ContainerId&&(n=jr.get(xn.Containers[0].ContainerId)),n))for(t=n.getBoundingClientRect(),i=0;i<n.children.length;i++){var a=n.children[i];if(a&&"dvs-root dvs-web-viewer"===a.className){for(a=a.firstElementChild;a;){if(jr.isFunction(a.getBoundingClientRect)){t=a.getBoundingClientRect();break}a=a.nextSibling}n=a;break}}(n===document.body||t===undefined||xn.Containers&&xn.Containers.length>1||xn.Containers&&1===xn.Containers.length&&(0===t.width||0===t.height))&&(o=!1,n=null);var s=null!=r?r:{};o&&(s={confined:o,wrapperEl:n}),Cs.showMask(s)}),xn.OnWebTwainPostExecute||(xn.OnWebTwainPostExecute=function(){Cs.hideMask()});window.DCP_DWT_OnClickCloseInstall=function(e,r){r||Zl.getInstance().closeDialog();var t=jr.get(On.install._divDWTNonInstallContainerID);if(t&&t.parentNode&&t.parentNode.removeChild(t),e&&jr.isDOM(e)&&jr.show(e),e&&jr.isString(e))jr.show(e);else{var n=xn.WebTwainIdMap;if(n){var i,o,a=Object.keys(n);for(i=0;i<a.length;i++)n[o=a[i]]._containerElement&&jr.show(n[o]._containerElement)}}""!==On.install._divDWTemessageContainer&&jr.show(On.install._divDWTemessageContainer)};var $l=Zl.getInstance();xn.CloseDialog=$l.closeDialog.bind($l),xn.ShowDialog=$l.showDialog.bind($l),xn.ShowMessage=$l.showMessage.bind($l);var ef=$l.updateCloseTimer.bind($l),rf=$l.setElementInnerHTML,tf=0,nf=[],of=!(!document||!document.addEventListener),af="DOMContentLoaded",sf="readystatechange",uf="load",cf="complete",lf=of?function(e,r,t){e.addEventListener(r,t,!1)}:function(e,r,t){e.attachEvent("on"+r,t)},ff=of?function(e,r,t){e.removeEventListener(r,t,!1)}:function(e,r,t){e.detachEvent("on"+r,t)};function df(){tf||(tf=1,Vl().then(function(){document&&ff(window,uf,df),function(){for(var e=function(){try{nf[r]()}catch(hH){jr.log(hH,"error"),setTimeout(function(){throw hH},0)}},r=0;r<nf.length;r++)e()}()}))}function hf(e){if(tf)try{e()}catch(hH){jr.log(hH,"error"),setTimeout(function(){throw hH},0)}else nf.push(e);return this}var gf=function(){var e=null;if(document.currentScript)e=document.currentScript;else{var r=document.getElementsByTagName("script");e=r[r.length-1]}var t=e.getAttribute("src");if(t){var n=t;return n.indexOf("?")>-1&&(n=n.substring(0,n.indexOf("?"))),n.lastIndexOf("/")>-1&&(n=n.substring(0,n.lastIndexOf("/"))),n}return""}();function vf(e){var r,t=null===(r=window)||void 0===r?void 0:r.console;if(t&&jr.isFunction(t.error)){if(jr.isString(e)||e instanceof Error);else if(jr.isObject(e))return void t.error(jr.stringify(e));t.error(e)}}var mf={URL:"",UpdateDaysBeforeExpired:30};function pf(){if(xn.CertificateConfig){var e=xn.CertificateConfig;jr.isString(e.URL)||(e.URL=mf.URL),(!jr.isNumber(e.UpdateDaysBeforeExpired)||e.UpdateDaysBeforeExpired<=0)&&(e.UpdateDaysBeforeExpired=mf.UpdateDaysBeforeExpired)}else xn.CertificateConfig=mf}function _f(e,r,t,n){n&&n._bRemoteMode&&!n._bNotShowMessage?jr.isFunction(Dn.OnRemoteWebTwainNotFoundCallback)&&Dn.OnRemoteWebTwainNotFoundCallback(Zu.name,n._serverInfo.server,n._serverInfo.port,n._serverInfo.ssl,Gu.bMobile):(Oc(e,r,t),Nc(!1))}function yf(e,r,t){return r=Tf(r),function(e,r){if(r&&("object"==C(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,wf()?Reflect.construct(r,t||[],Tf(e).constructor):r.apply(e,t))}function Sf(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function If(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ef(n.key),n)}}function bf(e,r,t){return r&&If(e.prototype,r),t&&If(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cf(e,r,t){return(r=Ef(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Tf(e){return Tf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Tf(e)}function wf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(wf=function(){return!!e})()}function Af(e,r){return Af=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Af(e,r)}function Ef(e){var r=function(e,r){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==C(r)?r:r+""}xn.RegisterEvent=function(e,r){if(jr.isUndefined(e))throw{code:-2314,message:"The parameter cannot be empty."};if(!jr.isString(e)||jr.isString(e)&&0==e.trim().length||jr.isUndefined(r)||!jr.isFunction(r))throw{code:-2416,message:"Invalid parameter."};return jr.isFunction(r)&&(xn[e]=r),!0},jr.mix(On,Cs),Dn.MSG||(Dn.MSG={Loading:"Processing...",LoadingTiff:"Processing tiff...",LoadingPdf:"Processing pdf...",Encoding:"Processing...",ConvertingToBlob:"Converting to blob...",ConvertingToBase64:"Converting to base64...",SavingPdf:"Saving pdf...",SavingTiff:"Saving tiff...",Downloading:"Downloading...",Uploading:"Uploading...",Transfer:"Transferring...",CanvasLoading:"Loading ..."}),On.fetch||(On.fetch=Ca),On.Promise||(On.Promise=Cs.Promise),On.bNode=Fn,On._defaultAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",On._defaultPlatform="Win64",On.ajax=va,On.product=Zu,On.scannerInfo=xc,On.domReady=hf,On.env=Gu,jr.mix(On,hs),On.Connect||(On.Connect={}),On.Connect.Check=Jl,On.Connect.ClientPool=os,On.Connect.AutoRedirectPorts=Bl,On.Connect.CheckConnectToTheService=Dl,On.Connect.RegisterEvent=function(e,r){if(jr.isUndefined(e))throw{code:-2314,message:"The parameter cannot be empty."};if(!jr.isString(e)||jr.isString(e)&&0==e.trim().length||jr.isUndefined(r)||!jr.isFunction(r))throw{code:-2416,message:"Invalid parameter."};return jr.isFunction(r)&&(On.Connect[e]=r),!0},On.Connect.ConnectUtils=js,On.Connect.NetManager=bu,On.Connect.NeedCheckWebTwainBySocket=hu,xn.ConnectUtils=js,xn.NetManager=bu,xn.NeedCheckWebTwainBySocket=hu,xn.NetManager.getDDMUrl=Xc,xn.NetManager.checkModuleManager=function(e,r){var t=js.getDWTHost(),n=Ks(t),i=n?$u.SSLPort:$u.Port;zc($s.getHttpClient(t,i,n)).then(e,r)},xn.CheckWebTwainBySocket=function(e,r,t){var n,i,o,a=On.detect.urls;if(a&&a.length>0){var s=a[0];n=s.host||js.getDWTHost(),i=s.port,o=s.ssl}else i=(o=Ks(n=js.getDWTHost()))?xn.SSLPort:xn.Port;var u=$s.getWsClient(n,i,o);return Fc(u,e,r,t),u},Dn.dcp=$u,function vK(){if(!window||document&&document.body){var e=document;if(e.readyState!==cf)if(lf(window,uf,df),of){var r=function(){ff(e,af,r),df()};lf(e,af,r)}else{var t,n,i,o=function(){e.readyState===cf&&(ff(e,sf,o),df())};lf(e,sf,o),n=e&&e.documentElement,i=n&&n.doScroll;try{t=null===window.frameElement}catch(hH){t=!1}if(i&&t){var a=function(){try{i("left"),setTimeout(df,30)}catch(e){setTimeout(a,40)}};a()}}else df()}else setTimeout(vK,100)}(),Dn.Ready=function(e){if(!Dn.navInfo)return Vl().then(function(r){Dn.navInfo=r;try{e()}catch(hH){throw jr.log(hH.stack||hH,"error"),hH}});try{e()}catch(hH){throw jr.log(hH.stack||hH,"error"),hH}},hf(function(){if(ls(),se.bIE){xn.CustomizableDisplayInfo&&!xn.CustomizableDisplayInfo.loaderBarSourceIE&&(xn.CustomizableDisplayInfo.loaderBarSourceIE=Kn.loaderBarSourceIE);try{document.execCommand("BackgroundImageCache",!1,!0)}catch(hH){}}});var kf=function(e){function r(){var e;return Sf(this,r),(e=yf(this,r)).IfShowProgressBar=!0,e.IfShowCancelDialogWhenImageTransfer=!0,e.__cancelBeforObjectCreated=!1,e.__clickCancel=!1,e._onPercent=null,e.progressContainer=null,e}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&Af(e,r)}(r,e),bf(r)}(X);function Pf(e){e.style.border="1px solid #A0A0A0",e.style.cssFloat="left",e.style.display="inline-block",e.style.position="relative"}var Ff=function(){function e(r,t){Sf(this,e);var n,i=0;(n=jr.isString(r)?document.getElementById(r):r).style.backgroundColor="transparent",this.isLoaded=!1,this.displayType=0,this.progress=0,this.progressPosition=0,this.borderWidth={left:0,right:0,top:0,bottom:0},this.orientation=t.orientation||e.Orientation.Horizontal,this.direction=t.direction||e.Direction.LeftToRight,this.creationType=t.creationType||e.CreationType.Replace,this.value=0,this.initialValue=t.value||0,this.minValue=t.minValue||0,this.maxValue=t.maxValue||100,this.showLabel="undefined"==typeof t.showLabel||t.showLabel,this.labelText=t.labelText||"",this.width=t.width||"100%",this.height=t.height||20,this.borderRadius=t.borderRadius||10,this.orientation==e.Orientation.Horizontal&&this.borderRadius>this.height/2&&(this.borderRadius=Math.round(this.height/2)),jr.isNumber(this.width)&&this.orientation==e.Orientation.Vertical&&this.borderRadius>this.width/2&&(this.borderRadius=Math.round(this.width/2)),this.backColor=t.backColor||"",this.color=t.color||"#50a8e1",this.animationStyle=0,this.animationInterval=t.animationInterval||100;var o=["parent","background","wrapper","left","middle","right","horizontalText","verticalText","marker"];for(this.extraClassName={},i=0;i<o.length;i++)t.extraClassName?"string"==typeof t.extraClassName?this.extraClassName[o[i]]=t.extraClassName:this.extraClassName[o[i]]=t.extraClassName[o[i]]||"":this.extraClassName[o[i]]="";this.onLoad=t.onLoad||null,this.onValueChanged=t.onValueChanged||null,this.onAnimate=t.onAnimate||null,this.creationType==e.CreationType.Replace?this.parentElement=n:(this.parentElement=document.createElement("DIV"),n.appendChild(this.parentElement)),this.finishLoading()}return bf(e,[{key:"finishLoading",value:function(){var r=this.parentElement,t=document.createElement("DIV"),n=document.createElement("DIV"),i=document.createElement("DIV"),o=document.createElement("DIV"),a=document.createElement("DIV");this.backgroundElement=t,this.valueElement=n,this.leftElement=i,this.middleElement=o,this.rightElement=a,this.backgroundElement.className="progressbar_background"+(this.extraClassName.background?" ":"")+this.extraClassName.background,this.backgroundElement.style.cssText=this.backgroundElement.style.cssText+e._createBorderRadiusCss(this.borderRadius),r.appendChild(t);var s=["border-radius","border-bottom-right-radius"],u=0,c="";for(u=0;u<s.length&&(!(c=e._elementCurrentStyle(t,s[u]))&&"string"!=typeof c);u++);if(""!=c&&e._parseInt(c)!=this.borderRadius&&(this.borderRadius=e._parseInt(c)),this.orientation==e.Orientation.Horizontal||this.orientation==e.Orientation.Vertical?this.displayType=0:this.displayType=1,r.className=(""!=r.className?" ":"")+"progressbar_parent dynamsoft-progressBar"+(this.extraClassName.parent?" ":"")+this.extraClassName.parent,0==this.displayType){var l=document.createElement("DIV");Pf(l),l.style.width=jr.isNumber(this.width)?this.width+"px":this.width,l.style.height=this.height+"px",l.style.left="0px",l.style.top=-this.height+"px",l.style.backgroundColor=this.backColor,l.style.backgroundRepeat="no-repeat",l.style.cssText=l.style.cssText+e._createBorderRadiusCss(this.borderRadius),r.appendChild(l),this.borderWidth={left:e._parseInt(e._elementCurrentStyle(l,"border-left-width")),right:e._parseInt(e._elementCurrentStyle(l,"border-right-width")),top:e._parseInt(e._elementCurrentStyle(l,"border-top-width")),bottom:e._parseInt(e._elementCurrentStyle(l,"border-bottom-width"))}}else 1==this.displayType&&(this.orientation==e.Orientation.Horizontal?jr.isNumber(this.width)&&this.borderRadius>this.width/2&&(this.borderRadius=this.width):this.orientation==e.Orientation.Vertical&&this.borderRadius>this.height/2&&(this.borderRadius=this.height),n.className="",Pf(n),i.style.backgroundColor=this.backColor,i.style.backgroundRepeat="no-repeat",Pf(a),a.style.backgroundColor=this.backColor,a.style.backgroundRepeat="no-repeat",Pf(o),o.style.overflow="hidden",n.style.backgroundColor=this.backColor,n.style.position="relative",this.orientation==e.Orientation.Horizontal?(i.style.width=this.borderRadius+"px",i.style.height=this.height+"px",i.style.top=-this.height+"px",i.style.left="0px",i.style.borderRight="none",i.style.cssText=i.style.cssText+e._createBorderRadiusCss(this.borderRadius,0,0,this.borderRadius),a.style.width=this.borderRadius+"px",a.style.height=this.height+"px",a.style.top=-this.height+"px",a.style.borderLeft="none",a.style.cssText=this.rightElement.style.cssText+e._createBorderRadiusCss(0,this.borderRadius,this.borderRadius,0),o.style.width=jr.isNumber(this.width)?this.width-2*this.borderRadius+"px":this.width,o.style.height=this.height+"px",o.style.top=-this.height+"px",o.style.borderLeft="none",o.style.borderRight="none",n.style.width="0px",n.style.height=this.height+"px"):this.orientation==e.Orientation.Vertical&&(i.style.width=jr.isNumber(this.width)?this.width+"px":this.width,i.style.height=this.borderRadius+"px",i.style.top=-this.height+"px",i.style.left="0px",i.style.borderBottom="none",i.style.cssText=i.style.cssText+e._createBorderRadiusCss(this.borderRadius,this.borderRadius,0,0),a.style.width=jr.isNumber(this.width)?this.width+"px":this.width,a.style.height=this.borderRadius+"px",a.style.top=-this.height+"px",a.style.left="0px",a.style.borderTop="none",a.style.cssText=a.style.cssText+e._createBorderRadiusCss(0,0,this.borderRadius,this.borderRadius),o.style.width=jr.isNumber(this.width)?this.width+"px":this.width,o.style.height=this.height-2*this.borderRadius+"px",o.style.top=-this.height+"px",o.style.left="0px",o.style.borderTop="none",o.style.borderBottom="none",n.style.width=jr.isNumber(this.width)?this.width+"px":this.width,n.style.height="0px"),o.appendChild(n),r.appendChild(i),r.appendChild(o),r.appendChild(a),this.orientation==e.Orientation.Horizontal?this.borderWidth={left:e._parseInt(e._elementCurrentStyle(i,"border-left-width")),right:e._parseInt(e._elementCurrentStyle(a,"border-right-width")),top:e._parseInt(e._elementCurrentStyle(o,"border-top-width")),bottom:e._parseInt(e._elementCurrentStyle(o,"border-bottom-width"))}:this.orientation==e.Orientation.Vertical&&(this.borderWidth={left:e._parseInt(e._elementCurrentStyle(o,"border-left-width")),right:e._parseInt(e._elementCurrentStyle(o,"border-right-width")),top:e._parseInt(e._elementCurrentStyle(i,"border-top-width")),bottom:e._parseInt(e._elementCurrentStyle(a,"border-bottom-width"))}));jr.isNumber(this.width)&&(r.style.width=this.width+this.borderWidth.left+this.borderWidth.right+"px"),r.style.height=this.height+this.borderWidth.top+this.borderWidth.bottom+"px",t.style.cssFloat="left",t.style.display="inline-block",jr.isNumber(this.width)&&(t.style.width=this.width+this.borderWidth.left+this.borderWidth.right+"px"),t.style.height=this.height+"px",t.style.backgroundColor="#FFFFFF",t.style.position="relative",0==this.displayType&&jr.isNumber(this.width)&&(t.style.width=this.width+this.borderWidth.left+this.borderWidth.right+"px"),t.style.top=this.borderWidth.top+"px";var f=document.createElement("DIV");this.markerElement=f,f.style.display="inline-block",f.style.zoom="1.0",f.style.width=jr.isNumber(this.width)?this.width+"px":this.width,f.style.height=this.height+"px",f.style.top=2*-this.height-this.borderWidth.top+"px",f.style.left=this.borderWidth.left+"px",f.style.backgroundColor=this.color,f.style.lineHeight=this.height+"px",f.style.position="relative",r.appendChild(f),this.isLoaded=!0,this.setValue(this.initialValue),null!=this.onLoad&&this.onLoad()}},{key:"setValue",value:function(r){if(null!==r&&r<this.minValue&&(r=this.minValue),null!==r&&r>this.maxValue&&(r=this.maxValue),null===r||(this.value=r),this.isLoaded){var t=this.width;if(jr.isString(t)){var n=Cs.one(".dynamsoft-progressBar");n&&n.getEL()&&(t=n.getEL().offsetWidth)}this.orientation==e.Orientation.Horizontal?this._setValueHorizontal(t):this.orientation==e.Orientation.Vertical&&this._setValueVertical(t),this.progress=this.value/this.maxValue}null!=this.onValueChanged&&this.onValueChanged()}},{key:"_setValueHorizontal",value:function(r){var t,n,i=this.markerElement,o=this.borderRadius,a=this.valueElement;t=this.value/this.maxValue*r,this.progressPosition=t,0==this.displayType||1==this.displayType&&(this.direction==e.Direction.LeftToRight?a.style.width=t<=o?"0px":t>=r-o?this.middleElement.style.width:t-o+"px":t<=o?a.style.width="0px":t>=r-o?(a.style.left="0px",a.style.width=this.middleElement.style.width):(a.style.left=r-t-o+"px",a.style.width=t-o+"px")),t>0?(this.animationStyle!=e.AnimationStyle.StaticFull&&this.animationStyle!=e.AnimationStyle.CustomFull?i.style.width=t+"px":i.style.width=r+"px",i.style.visibility="visible"):(i.style.width=r+"px",this.animationStyle!=e.AnimationStyle.StaticFull&&this.animationStyle!=e.AnimationStyle.CustomFull&&(i.style.visibility="hidden")),this.animationStyle!=e.AnimationStyle.StaticFull&&this.animationStyle!=e.AnimationStyle.CustomFull?this.direction==e.Direction.LeftToRight?i.style.left=this.borderWidth.left+"px":i.style.left=r-t+this.borderWidth.left+"px":i.style.left=this.borderWidth.left+"px";var s=2*-this.height-this.borderWidth.top;if(0==t||r==t)i.style.top=s+"px",i.style.height=this.height+"px",i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o);else if(t<o){var u=this.height-2.25*(o-Math.sqrt(Math.pow(o,2)-Math.pow(o-t,2))),c=s+this.height/2-u/2;i.style.top=c+"px",i.style.height=u+"px",this.direction==e.Direction.LeftToRight?i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o,0,0,o):i.style.cssText=i.style.cssText+e._createBorderRadiusCss(0,o,o,0)}else r-t<o?(n=(2*(o-(r-t))+(o-Math.sqrt(Math.pow(o,2)-Math.pow(o-(r-t),2))))/3,this.direction==e.Direction.LeftToRight?i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o,n,n,o):i.style.cssText=i.style.cssText+e._createBorderRadiusCss(n,o,o,n)):(i.style.top=s+"px",i.style.height=this.height+"px",this.direction==e.Direction.LeftToRight?i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o,0,0,o):i.style.cssText=i.style.cssText+e._createBorderRadiusCss(0,o,o,0))}},{key:"_setValueVertical",value:function(r){var t,n,i=this.markerElement,o=this.borderRadius,a=this.valueElement;t=this.value/this.maxValue*this.height,this.progressPosition=t,0==this.displayType||1==this.displayType&&(this.direction==e.Direction.TopToBottom?t<=o?a.style.height="0px":t>=this.height-o?a.style.height=this.middleElement.style.height:a.style.height=t-o+"px":t<=o?a.style.height="0px":t>=this.height-o?(a.style.top="0px",a.style.height=this.middleElement.style.height):(a.style.top=this.height-t-o+"px",a.style.height=t+2*o+"px")),t>0?(this.animationStyle!=e.AnimationStyle.StaticFull&&this.animationStyle!=e.AnimationStyle.CustomFull?i.style.height=t+"px":(i.style.height=this.height+"px",i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o)),i.style.visibility="visible"):(i.style.height="0px",this.animationStyle!=e.AnimationStyle.StaticFull&&this.animationStyle!=e.AnimationStyle.CustomFull&&(i.style.visibility="hidden"));var s=this.borderWidth.left;if(0==t||this.height==t)i.style.left=s+"px",i.style.width=r+"px",i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o);else if(t<o){var u=2.5*t;u>r&&(u=r);var c=s+r/2-u/2;i.style.left=c+"px",i.style.width=u+"px",this.direction==e.Direction.BottomToTop?i.style.cssText=i.style.cssText+e._createBorderRadiusCss(0,0,o,o):i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o,o,0,0)}else this.height-t<o?(n=(2*(o-(this.height-t))+(o-Math.sqrt(Math.pow(o,2)-Math.pow(o-(this.height-t),2))))/3,this.direction==e.Direction.BottomToTop?i.style.cssText=i.style.cssText+e._createBorderRadiusCss(n,n,o,o):i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o,o,n,n)):(i.style.left=s+"px",i.style.width=r+"px",this.direction==e.Direction.BottomToTop?i.style.cssText=i.style.cssText+e._createBorderRadiusCss(0,0,o,o):i.style.cssText=i.style.cssText+e._createBorderRadiusCss(o,o,0,0));this.animationStyle!=e.AnimationStyle.StaticFull&&this.animationStyle!=e.AnimationStyle.CustomFull?this.direction==e.Direction.TopToBottom?i.style.top=2*-this.height-this.borderWidth.top+"px":i.style.top=-this.height-t-this.borderWidth.top+"px":i.style.top=2*-this.height-this.borderWidth.top+"px"}}],[{key:"_elementCurrentStyle",value:function(e,r){if(e.currentStyle){var t=0,n="",i=!1;for(t=0;t<r.length;t++)"-"!=r[t].toString()?(n+=i?r[t].toString().toUpperCase():r[t].toString(),i=!1):i=!0;return r=n,e.currentStyle[r]}return getComputedStyle(e,null).getPropertyValue(r)}},{key:"_parseInt",value:function(e){var r=parseInt(e);return isNaN(r)&&(r=0),r}},{key:"_createBorderRadiusCss",value:function(e,r,t,n){return null!=e&&null==r&&null==t&&null==n?";-ms-border-radius: "+e+"px;border-radius:"+e+"px;":";-ms-border-radius:"+(e=e||0)+"px "+(r=r||0)+"px "+(t=t||0)+"px "+(n=n||0)+"px;border-radius:"+e+"px "+r+"px "+t+"px "+n+"px;"}}])}();Cf(Ff,"Orientation",{Horizontal:0,Vertical:1}),Cf(Ff,"Direction",{LeftToRight:0,RightToLeft:1,TopToBottom:0,BottomToTop:1}),Cf(Ff,"CreationType",{Replace:0,AppendChild:1}),Cf(Ff,"AnimationStyle",{None:0,Static:1,StaticFull:2,Custom:3,CustomFull:4,Flickering1:10,Flickering2:11,Flickering3:12,LeftToRight1:20,LeftToRight2:21,RightToLeft1:22,RightToLeft2:23,TwoWay:24});var Df=new kf;function xf(){var e,r;if(!On.dlgProgress){(r=[]).push('<dialog class="dynamsoft-dwt-dialogProgress" closed="closed" style="top:30%"><div class="ds-dwt-progressWrap">'),r.push('<h3 class="dynamsoft-finalMessage"> </h3>'),r.push('<p class="dynamsoft-desc"></p><p class="dynamsoft-status">0%</p>'),se.bIE?r.push('<div class="dynamsoft-progressBar" value="" max="100"></div>'):r.push('<progress class="dynamsoft-progressBar" value="" max="100"></progress>'),r.push('<div style="width:100%;text-align:center;margin:5px 0;"><button class="dynamsoft-btnCancel" value="cancel" autofcus>cancel</button></div>'),r.push("</div></dialog>"),(e=Cs.one(".dynamsoft-dwt-dialogProgress"))&&e.getEL()&&e.remove();var t=Cs.parseHTML(r.join(""));if(t&&t.length>0&&document.body.appendChild(t[0]),se.bIE){var n=Cs.one(".dynamsoft-progressBar"),i=n&&n.getEL();i&&(i.objProgressBar=new Ff(i,{height:20}));var o=Cs.one(".ds-dwt-progressWrap").getEL();o&&(o.style.boxSizing="content-box")}(e=Cs.one(".dynamsoft-dwt-dialogProgress"))&&e.getEL()&&(On.dlgProgress=e[0],Cs.dialog.setup(On.dlgProgress)),On.dlgRef=0,On.dialogShowStatus=!1,On.cancelFrom=St.Other}}function Of(){Mf(null,"");var e=Cs.one(".dynamsoft-dwt-dialogProgress");if(e&&e.getEL()){var r=e.getEL();r.show=null,r.showModal=null,r.close=null,r._dlgInfo={},r.parentNode.removeChild(r)}On.dlgProgress=null}var Nf=function(){if(Df){var e,r=Df.fire("cancel");if(r>=1)for(e=0;e<r;e++)Mf(null,"");else Df.__cancelBeforObjectCreated&&(Mf(null,""),Df.__clickCancel=!0)}};function Rf(){Df&&(Df.IfShowProgressBar=!1,Df.IfShowCancelDialogWhenImageTransfer=!1,Df.off("cancel"),Df._onPercent=null)}function Wf(e,r,t){var n,i=e;if(i.IfShowProgressBar)if(Df&&(Df.IfShowProgressBar=!0,Df.IfShowCancelDialogWhenImageTransfer=i.IfShowCancelDialogWhenImageTransfer),On.dlgRef>0)On.dlgRef++;else{var o;if((n=xn.IfConfineMaskWithinTheViewer)?i._isNoViewer&&i._isNoViewer()?o=document.body:i._containerElement?o=i._containerElement:xn.Containers&&xn.Containers.length>0&&xn.Containers[0].ContainerId&&(o=jr.get(xn.Containers[0].ContainerId))||(o=document.body):o=document.body,o&&o!==document.body){var a=!1,s=o.firstElementChild;if(s&&s!==On.dlgProgress&&"dvs-root dvs-web-viewer"==s.className&&(o=s,a=!0),0==a)for(var u=0;u<o.children.length;u++)if((s=o.children[u])&&s!==On.dlgProgress&&"dvs-root dvs-web-viewer"==s.className){o=s;break}var c=On.progressContext;""!==o.style.position&&"static"!==o.style.position||(o.style.position="relative",c.progressContainer={el:o})}jr.log("showProgress:"+r+",bCancel:"+t),On.dlgProgress&&o.appendChild(On.dlgProgress),Ta(t);var l=Cs.one(".dynamsoft-btnCancel");if(l&&l.getEL()&&(jr.removeEventListener(l[0],"click",Nf),jr.addEventListener(l[0],"click",Nf)),0==On.dialogShowStatus){On.dlgProgress&&(n&&o&&o!==document.body?Cs.dialog.setup(On.dlgProgress,!0):Cs.dialog.setup(On.dlgProgress),On.dlgProgress.showModal()),On.dialogShowStatus=!0;var f=Cs.one(".dynamsoft-finalMessage"),d=Cs.one(".dynamsoft-progressBar"),h=d&&d.getEL(),g=Cs.one(".dynamsoft-status");f&&f.getEL()&&f.html(""),g&&g.getEL()&&g.html("0%"),h&&(se.bIE&&h.objProgressBar?h.objProgressBar.setValue(0):h.value=0)}On.dlgRef++}else Rf()}function Mf(e,r){jr.log("closeProgress:"+r),Df.IfShowProgressBar?(On.dlgRef--,On.dlgRef<=0&&(On.dlgRef=0)):On.dlgRef=0,0==On.dlgRef&&(Df.off("cancel"),Df._onPercent=null,1==On.dialogShowStatus&&(On.dlgProgress&&(On.dlgProgress.close(),On.dlgProgress&&document.body.appendChild(On.dlgProgress),Df&&Df.progressContainer&&Df.progressContainer.el&&(Df.progressContainer.el.style.position="",Df.progressContainer=null)),On.dialogShowStatus=!1),On.cancelFrom=St.Other)}var Lf,Bf={upload:"Uploading...",download:"Downloading...",load:"Processing...",decode:"Processing...",decodeTIFF:"Processing tiff...",decodePDF:"Processing pdf...",encodeTIFF:"Processing tiff...",encodePDF:"Processing pdf...",encode:"Processing...",transfer:"Transferring..."};function Uf(e,r,t,n,i,o){var a,s=Cs.one(".dynamsoft-progressBar"),u=Cs.one(".dynamsoft-status"),c=Cs.one(".dynamsoft-finalMessage"),l=Cs.one(".dynamsoft-desc");if(xn.UseDefaultViewer&&xn.IfConfineMaskWithinTheViewer&&o&&(s=Cs.one(".dynamsoft-progressBar",o),u=Cs.one(".dynamsoft-status",o),c=Cs.one(".dynamsoft-finalMessage",o),l=Cs.one(".dynamsoft-desc",o)),On.cancelFrom==St.FTPUpload||On.cancelFrom==St.FTPDownload?On.setBtnCancelVisibleForProgress(!!t):On.cancelFrom==St.HTTPUpload||On.cancelFrom==St.LoadImage||On.cancelFrom==St.HTTPPut?"Processing..."==r&&On.setBtnCancelVisibleForProgress(!1):On.cancelFrom==St.ConvertToBlob&&(-1==e||On.setBtnCancelVisibleForProgress(!1),100==n&&(r="",On.progressMessage="Processing...")),e<0?(On.progressMessage=r,a=On.progressMessage):a=""!=r&&"1/1"!=r?On.progressMessage+"("+r+")":On.progressMessage,c&&c.getEL()){var f="",d="";a.indexOf(" ...")&&(a=a.replace(" ...","...")),-1!=a.indexOf("(")?(f=a.substr(0,a.indexOf("(")),d=a.substr(a.indexOf("("))):f=a,jr.each(Bf,function(e,r){if(-1!=e.indexOf(f)){var t=ds();a=t.customProgressText[r]+d}}),""==a&&(a="&nbsp;"),c.html(a)}if(i?""==i||jr.isUndefined(i)?(i="&nbsp;",l&&l.hide&&l.hide()):(jr.isString(i)&&i.length>30&&(i=i.substring(0,30)+"..."),l&&(l.show&&l.show(),l.html(i))):l&&l.hide&&l.hide(),(n||0===n)&&(u&&u.getEL()&&u.html(n+"%"),s&&s.getEL())){var h=n;h>=100&&(h=100),se.bIE?s[0].objProgressBar?s[0].objProgressBar.setValue(h):s[0].value=h:se.bEdge?(s[0].style.display="",s[0].value=h):s[0].value=h}On.dlgRef<=0&&setTimeout(function(){s&&s.getEL()&&(se.bIE?s[0].objProgressBar?s[0].objProgressBar.setValue(0):s[0].value=0:se.bEdge?(s[0].style.display="none",s[0].value=0):s[0].value=0)},1e3)}function Vf(e,r,t){if("function"==typeof e?e===r:e.has(r))return arguments.length<3?r:t;throw new TypeError("Private element is not present on this object")}function jf(e,r,t){return r=Qf(r),function(e,r){if(r&&("object"==C(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Yf()?Reflect.construct(r,t||[],Qf(e).constructor):r.apply(e,t))}function Hf(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Gf(e,r){(function(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,r),r.add(e)}function zf(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Zf(n.key),n)}}function Kf(e,r,t){return r&&zf(e.prototype,r),t&&zf(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jf(e,r,t){return(r=Zf(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Qf(e){return Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Qf(e)}function qf(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&Xf(e,r)}function Yf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Yf=function(){return!!e})()}function Xf(e,r){return Xf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Xf(e,r)}function Zf(e){var r=function(e,r){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==C(r)?r:r+""}function $f(e){return $f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$f(e)}var ed,rd="[bio]: ",td=window,nd=td&&td.FormData,id=new WeakSet,od=function(e){function r(e){var t;return Hf(this,r),Gf(t=jf(this,r),id),Jf(t,"_attrs",{}),jr.mix(t._attrs,{action:"",data:{},bChunkedSendData:!0,ajaxConfig:{value:{},type:"post",processData:!1,cache:!1,dataType:"text",async:!0,contentType:!1,retry:0,headers:{"X-Requested-With":!1}},ajax:"",formData:"",CORS:!1,bOnlyResponseEmptyIsOK:!0}),jr.mix(t._attrs,e),Vf(id,t,ad).call(t),t}return qf(r,e),Kf(r,[{key:"get",value:function(e){return e in this._attrs?this._attrs[e]:""}},{key:"set",value:function(e,r){e in this._attrs&&(this._attrs[e]=r)}},{key:"uploadFilesToServer",value:function(e){return Vf(id,this,sd).call(this,e)}},{key:"uploadToServer",value:function(e){var t=this,n=t.get("ajaxConfig");Vf(id,t,ud).call(t),e&&e.size>0&&(Vf(id,t,cd).call(t,e),jr.isString(e.name)&&""!=e.name?t.name=e.name:t.name=e.fileName,e=null),jr.mix(n,{data:t.get(r.PROP.formData),url:t.get(r.PROP.action),beforeSend:function(e,n,i){e.upload.addEventListener("progress",function(e){t.fire(r.event.PROGRESS,{loaded:e.loaded,total:e.total,name:t.name})},!1)}});var i=t.get("async");if(jr.mix(n,{method:"POST",async:i,onSuccess:function(e,n,i){dd(t.get(r.PROP.data)),dd(t.get(r.PROP.formData));var o=t.get(r.PROP.ajax);jr.isFunction(o.dispose)&&o.dispose(),t.set(r.PROP.data,null),t.set(r.PROP.formData,null),t.set(r.PROP.ajax,null);var a=Vf(id,t,fd).call(t,e,i);t.fire(r.event.SUCCESS,a)},onError:function(e,n,i){var o;dd(t.get(r.PROP.data)),dd(t.get(r.PROP.formData));var a,s,u=t.get(r.PROP.ajax);jr.isFunction(u.dispose)&&u.dispose(),t.set(r.PROP.data,null),t.set(r.PROP.formData,null),t.set(r.PROP.ajax,null),e&&jr.isArray(e)&&e.length>2?(o=e[0],a=e[1],s=e[2]):(o=e,a=n,s=i),Vf(id,t,ld).call(t,s,a,o)}}),i){var o=va(n);return t.set(r.PROP.ajax,o),!0}return va(n)}},{key:"abort",value:function(){var e=this.get(r.PROP.ajax);return jr.isObject(e)?(e&&jr.isFunction(e.abort)&&e.abort(),this.set("ajax",!1),this):(jr.log(rd+"abort(), the value of io invalid!"),this)}},{key:"setRequestHeader",value:function(e,r){var t=this.get("ajaxConfig");return t.headers[e]=r,this.set("ajaxConfig",t),t=null,r}}])}(X);function ad(){this.get("CORS");var e=this.get("ajaxConfig");return jr.mix(e,{xhrFields:{withCredentials:!1}}),e}function sd(e){var r=this,t=r.get(Lf.PROP.ajaxConfig),n=[];if(Vf(id,r,ud).call(r),jr.each(e,function(e){e&&e.size>0?(Vf(id,r,cd).call(r,e),jr.isString(e.name)&&""!=e.name?n.push(e.name):n.push(e.fileName)):n.push("")}),jr.mix(t,{data:r.get(Lf.PROP.formData),url:r.get(Lf.PROP.action),beforeSend:function(e,t,n){e.upload.addEventListener("progress",function(e){r.fire(Lf.event.PROGRESS,{loaded:e.loaded,total:e.total,name:""})},!1)}}),jr.mix(t,{method:"POST",async:r.get("async"),onSuccess:function(e,t,i){var o="";n=[],e&&(e&&jr.isArray(e)&&e.length>1?o=e[0]:jr.isString(e)&&(o=e)),o=Vf(id,r,fd).call(r,o,i),r.fire(Lf.event.SUCCESS,o)},onError:function(e,t,i){var o,a;n=[],e&&jr.isArray(e)&&e.length>2?(o=e[1],a=e[2]):(o=t,a=i),Vf(id,r,ld).call(r,a,o)}}),r.name="",r.get("async")){var i=va(t);return r.set(Lf.PROP.formData,null),r.set(Lf.PROP.ajax,i),!0}var o=va(t);return r.set(Lf.PROP.formData,null),o}function ud(){var e,r=this,t=r.get("data");if(nd)if(t instanceof nd)r.set(Lf.PROP.formData,t);else{e=new nd;try{jr.each(t,function(r,t){e.append(t,r)}),r.set(Lf.PROP.formData,e)}catch(hH){jr.log(rd+"something error when reset FormData.")}}else jr.log(rd+"the browser does not support ajax.")}function cd(e){if(!jr.isObject(e))return jr.log(rd+"_addFileData(), file parameter invalid!"),!1;var r=this.get(Lf.PROP.formData),t=e.name,n=e.remoteFilename;return n||(n="RemoteFile"),r.append(n,e,t),this.set(Lf.PROP.formData,r),e=null,r}function ld(e,r,t){var n=Lf.status.ERROR,i={status:n,msg:r,response:!1,name:this.name};e&&(i.httpStatus=e.status,i.response=t||e.responseText),this.fire(n,i)}function fd(e,r){var t,n,i,o=!1,a=this.name,s=Lf.status.SUCCESS,u=Lf.event.ERROR,c=r?r.status:0;if(jr.log("Response from server: "+e),!this.get("bOnlyResponseEmptyIsOK"))return{status:s,msg:!1,json:!1,response:e,name:a,httpStatus:c};if(jr.isUndefined(e)||""===e)t={status:s,msg:!1,json:!1,response:"",name:a,httpStatus:c};else if(jr.isString(e)){try{for(n=0;n<e.length&&!(n>10);n++){if("{"==(i=e[n])){o=!0;break}if(" "!=i&&"\r"!=i&&"\n"!=i&&"\t"!=i)break}if(o){var l=jr.parse(e);t=1==l.status?{status:s,msg:!1,json:l,response:e,name:a,httpStatus:c}:{status:u,msg:!1,json:l,response:e,name:a,httpStatus:c}}}catch(hH){o=!1,jr.log(hH)}if(!o){var f=String(e);t=""==(f=f.replace(/( |\t|\r|\n)/g,""))?{status:s,msg:!1,json:!1,response:e,name:a,httpStatus:c}:{status:u,msg:!1,json:!1,response:e,name:a,httpStatus:c}}}else t={status:s,msg:!1,json:!1,response:"",name:a,httpStatus:c};return t}function dd(e){e&&e instanceof nd&&e.forEach&&e.forEach(function(r,t){t&&e["delete"](t)})}Lf=od,Jf(od,"event",{SUCCESS:"success",ERROR:"error",PROGRESS:"progress"}),Jf(od,"status",{SUCCESS:"success",ERROR:"error"}),Jf(od,"PROP",{action:"action",data:"data",bChunkedSendData:"bChunkedSendData",ajaxConfig:"ajaxConfig",ajax:"ajax",formData:"formData",CORS:"CORS",bOnlyResponseEmptyIsOK:"bOnlyResponseEmptyIsOK"});var hd=new WeakSet,gd=function(e){function r(e){var t;return Hf(this,r),Gf(t=jf(this,r),hd),t._attrs={action:"",retry:0,timeout:0,CORS:Ye,async:Xe,dataType:"text",fileStatus:"",data:{},bOnlyResponseEmptyIsOK:Xe},jr.mix(t._attrs,e),Vf(hd,t,md).call(t),t}return qf(r,e),Kf(r,[{key:"get",value:function(e){return e in this._attrs?this._attrs[e]:""}},{key:"set",value:function(e,r){e in this._attrs&&(this._attrs[e]=r)}},{key:"upload",value:function(e){var r;if(e){if(jr.isArray(e))return r=this._uploadType.uploadFilesToServer(e),e=null,r;if(jr.isObject(e)){var t=e;return t.size?(t.id||(t.id=jr.guid("file-")),t.size&&(t.textSize=Vf(hd,this,vd).call(this,t.size))):t.size=0,r=this._uploadType.uploadToServer(t),t=null,e=null,r}}return r=this._uploadType.uploadToServer(e),e=null,r}},{key:"abort",value:function(e){return this._uploadType&&this._uploadType.abort(),!0}},{key:"setRequestHeader",value:function(e,r){this._uploadType.setRequestHeader(e,r)}}])}(X);function vd(e){var r=-1;do{e/=1024,r++}while(e>99&&r<4);return Math.max(e,.1).toFixed(1)+["KB","MB","GB","TB"][r]}function md(){var e=this,r={async:e.get(ed.PROP.async),action:e.get(ed.PROP.action),data:e.get(ed.PROP.data),CORS:e.get(ed.PROP.CORS),bOnlyResponseEmptyIsOK:e.get(ed.PROP.bOnlyResponseEmptyIsOK)};this._uploadType=new od(r);var t=this._uploadType.get(od.PROP.ajaxConfig);return t&&(t.dataType=e.get(ed.PROP.dataType),t.async=e.get(ed.PROP.async),t.retry=e.get(ed.PROP.retry)),this._uploadType.on(od.event.SUCCESS,Vf(hd,e,_d),e),this._uploadType.on(od.event.ERROR,Vf(hd,e,_d),e),this._uploadType.on(od.event.PROGRESS,Vf(hd,e,pd),e),this._uploadType}function pd(e){this.fire(ed.event.PROGRESS,e)}function _d(e){var r=this,t=(null==e?void 0:e.status)||"",n=(null==e?void 0:e.msg)||"",i=r.get("file");if(jr.mix(e,{file:i}),"success"===t)r.fire(ed.event.SUCCESS,e);else{if(!1===n||("abort"===n?jr.mix(e,{canceled:!0}):"timeout"===n&&jr.mix(e,{timeout:!0})),!n){var o=(null==e?void 0:e.httpStatus)||0;o&&o>=200&&o<300&&(200==o?n="OK":201==o?n="Created":202==o?n="Accepted":203==o?n="Non-Authoritative":204==o?n="No Content":205==o?n="Reset Content":206==o?n="Partial Content":207==o&&(n="Multi-Status"),e.msg=n)}r.fire(ed.event.ERROR,e)}}ed=gd,Jf(gd,"event",{SUCCESS:"success",ERROR:"error",PROGRESS:"progress"}),Jf(gd,"PROP",{action:"action",retry:"retry",timeout:"timeout",CORS:"CORS",async:"async",dataType:"dataType",fileStatus:"fileStatus",data:"data",bOnlyResponseEmptyIsOK:"bOnlyResponseEmptyIsOK"});var yd="Uploading...";function Sd(e,r,t){e._errorCode=r,e._errorString=t}function Id(e){Sd(e,-2306,"Upload Error: the upload file cannot be empty.")}function bd(e){Sd(e,-2313,"The size of the images you are about to upload has exceeded the limit.")}var Cd={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function Td(e,r){if(jr.isFunction("_".repeat))return e.repeat(r);for(var t=0,n=[];t<r;t++)n.push(e);return n.join("")}var wd=Object.create?Object.create(null):{};function Ad(e,r,t,n){return function(e,r){var t,n,i,o,a,s,u,c,l,f=1,d=e.length,h="";for(n=0;n<d;n++)if("string"==typeof e[n])h+=e[n];else if("object"===$f(e[n])){if((o=e[n]).keys)for(t=r[f],i=0;i<o.keys.length;i++){if(t==undefined)throw new Error(Ad('[sprintf] Cannot access property "%s" of undefined value "%s"',o.keys[i],o.keys[i-1]));t=t[o.keys[i]]}else t=o.param_no?r[o.param_no]:r[f++];if(Cd.not_type.test(o.type)&&Cd.not_primitive.test(o.type)&&t instanceof Function&&(t=t()),Cd.numeric_arg.test(o.type)&&"number"!=typeof t&&isNaN(t))throw new TypeError(Ad("[sprintf] expecting number but found %T",t));switch(Cd.number.test(o.type)&&(c=t>=0),o.type){case"b":t=parseInt(t,10).toString(2);break;case"c":t=String.fromCharCode(parseInt(t,10));break;case"d":case"i":t=parseInt(t,10);break;case"j":t=jr.stringify(t,null,o.width?parseInt(o.width):0);break;case"e":t=o.precision?parseFloat(t).toExponential(o.precision):parseFloat(t).toExponential();break;case"f":t=o.precision?parseFloat(t).toFixed(o.precision):parseFloat(t);break;case"g":t=o.precision?String(Number(t.toPrecision(o.precision))):parseFloat(t);break;case"o":t=(parseInt(t,10)>>>0).toString(8);break;case"s":t=String(t),t=o.precision?t.substring(0,o.precision):t;break;case"t":t=String(!!t),t=o.precision?t.substring(0,o.precision):t;break;case"T":t=Object.prototype.toString.call(t).slice(8,-1).toLowerCase(),t=o.precision?t.substring(0,o.precision):t;break;case"u":t=parseInt(t,10)>>>0;break;case"v":t=t.valueOf(),t=o.precision?t.substring(0,o.precision):t;break;case"x":t=(parseInt(t,10)>>>0).toString(16);break;case"X":t=(parseInt(t,10)>>>0).toString(16).toUpperCase()}Cd.json.test(o.type)?h+=t:(!Cd.number.test(o.type)||c&&!o.sign?l="":(l=c?"+":"-",t=t.toString().replace(Cd.sign,"")),s=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",u=o.width-(l+t).length,a=o.width&&u>0?Td(s,u):"",h+=o.align?l+t+a:"0"===s?l+a+t:a+l+t)}return h}(function(e){if(wd[e])return wd[e];for(var r,t=e,n=[],i=0;t;){if(null!==(r=Cd.text.exec(t)))n.push(r[0]);else if(null!==(r=Cd.modulo.exec(t)))n.push("%");else{if(null===(r=Cd.placeholder.exec(t)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],a=r[2],s=[];if(null===(s=Cd.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(s[1]);""!==(a=a.substring(s[0].length));)if(null!==(s=Cd.key_access.exec(a)))o.push(s[1]);else{if(null===(s=Cd.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(s[1])}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}t=t.substring(r[0].length)}return wd[e]=n,n}(e),arguments)}function Ed(e,r){if(jr.isString(e)){var t,n,i,o,a,s=e.indexOf("<%");if(-1==s)return e;if(n=e.substring(0,s),!(s+2<(t=e.indexOf(">",n))))return e;i=e.substring(s+1,t),o=e.substring(t+1);try{a=Ad(i,r)}catch(_H){a=""}return[n,a,o].join("")}return""}function kd(e,r,t,n){var i,o,a,s,u=r.url,c=r.headers,l=r.retry,f=r.httpFormData,d=r.bOnlyResponseEmptyIsOK,h=r.bAsync,g=(o=r.responseType)==vt.Text?"text":o==vt.JSON?"json":o==vt.Blob?"blob":o==vt.ArrayBuffer?"arraybuffer":o==vt.XML?"xml":5==o?"user-defined":"text",v=e.IfShowProgressBar,m=e.IfShowCancelDialogWhenImageTransfer,p=e.objUploadStatus;Fd(e.IfShowCancelDialogWhenImageTransfer),(i=r.content)&&(i.remoteFilename||(i.remoteFilename=r.remoteFilename),i.fileName||(i.fileName=r.fileName||i.name),i.name||(i.name=r.fileName||i.fileName));var _,y=new gd({action:u,data:f,async:h,retry:l,bOnlyResponseEmptyIsOK:d,dataType:g});if(m&&On.progressContext&&(_=On.progressContext.on("cancel",function(){y.abort(),y=null})),(a=y._uploadType)&&(s=a.get("ajaxConfig"),c&&s&&s.headers&&c&&jr.mix(s.headers,c),e.HTTPRequestswithCredentials&&jr.mix(s.xhrFields,{withCredentials:!0}),s=null),y.on(gd.event.SUCCESS,function(n){if(r.content=null,y=null,_&&On.progressContext.off("cancel",_),n?e.HTTPPostResponse=n.response:r.responseType==vt.ArrayBuffer?e.HTTPPostResponse=[]:r.responseType==vt.Blob?e.HTTPPostResponse=new Blob([]):r.responseType==vt.JSON?e.HTTPPostResponse={}:e.HTTPPostResponse="",jr.isFunction(e.onHttpUploadStatus)){var i;i={fileName:n.name,percentage:100,statusCode:200,responseString:e.HTTPPostResponse},e.onHttpUploadStatus(i)}jr.isFunction(t)&&t(e.HTTPPostResponse)}),y.on(gd.event.ERROR,function(t){r.content=null,y=null;var i=t&&t.canceled;t&&t.timeout;var o="",a=0;_&&On.progressContext.off("cancel",_),t&&jr.isString(t.response)?e.HTTPPostResponse=t.response:e.HTTPPostResponse="",i||(t&&t.msg&&(o=t.msg),t&&t.httpStatus&&(a=t.httpStatus));var s,u={};(function(e,r,t,n){if(r)zo(e);else if(e._errorCode=-2003,n&&n>0||t){var i;i=n&&n>=200&&n<300?["HTTP process: "]:["HTTP process error: "],t&&(t.indexOf("HTTP process error: ")>=0&&(i=[""]),i.push(t)),n&&n>0&&(i.push(" ("+n+")"),n>=300&&(e._errorCode=it.HTTPServerError));var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP process error."}(u,i,o,a),jr.isFunction(e.onHttpUploadStatus))&&(s={fileName:t.name,percentage:100,statusCode:a,responseString:e.HTTPPostResponse},e.onHttpUploadStatus(s));jr.isFunction(n)&&n(u._errorCode,u._errorString,e.HTTPPostResponse,a)}),(v||jr.isFunction(e.onHttpUploadStatus))&&(y.on(gd.event.PROGRESS,function(r){!se.bSafari&&r&&(delete r.totalSize,delete r.position);var t=0===r.total?100:Math.round(100*r.loaded/r.total);if([r.loaded," / ",r.total].join(""),jr.isFunction(e.onHttpUploadStatus)){var n;n={fileName:r.name,percentage:t,statusCode:0,responseString:""},e.onHttpUploadStatus(n)}e.onPercent([0,t,"","http",r.name])}),e.onPercent([0,-1,yd,"http"]),jr.isFunction(e.onHttpUploadStatus))){var S="";jr.isArray(i)&&i.length>0||(i&&i.name&&""!=i.name?S=i.name:i&&i.fileName&&(S=i.fileName)),!S&&r.fileName&&(S=r.fileName),e.onHttpUploadStatus({fileName:S,percentage:0,statusCode:0,responseString:""})}if(p&&p.bCancel){p.st=2;var I={};return zo(I),r.content=null,jr.isFunction(n)&&n(I._errorCode,I._errorString),!1}var b=y.upload(i);return i=null,b}function Pd(e,r,t,n){var i,o,a=e.MaxUploadImageSize,s=0,u=r.content;if(!u||!jr.isArray(u)||u.length<=0){r.content=null;var c={};return Id(c),jr.isFunction(n)&&n(c._errorCode,c._errorString),Ye}for(i=0;i<u.length;i++){var l=u[i];if(!l||l.size<=0){var f={};return Id(f),jr.isFunction(n)&&n(f._errorCode,f._errorString),Ye}var d=l.size,h=l.type;if(s+=d,""===h||h&&h!=r.contentType){var g=l.slice||l.webkitSlice||l.mozSlice,v=l.name,m=g.call(l,0,d,r.contentType);jr.isString(v)&&""!=v||(v=l.fileName),m.name=Ed(v,i+1),u[i]=m}u[i].remoteFilename=Ed(r.remoteFilename,i+1),l=null}if(s>a&&-1!=a){var p={};return bd(p),jr.isFunction(n)&&n(p._errorCode,p._errorString),Ye}for(On.cancelFrom=St.HTTPUpload,o=kd(e,r,t,n),r=null,i=0;i<u.length;i++)u[i]=null;return u=null,o}function Fd(e){On.dlgRef<=0||0==On.dialogShowStatus||Ta(e)}On.setBtnCancelVisibleForProgress=Ta;var Dd=function(){return Kf(function e(){Hf(this,e)},[{key:"_onProgress",value:function(e,r,t){var n=0===t.total?100:Math.round(100*t.loaded/t.total);[t.loaded," / ",t.total].join(""),e.onPercent([0,n,"","http",r])}},{key:"_uploadBlobFragment",value:function(e,r,t,n){var i=r.fileName,o=r.blockSize,a=0;r.method;var s,u,c,l=r.offset,f=this,d=function(e,t){r.content=null,jr.isFunction(n)&&n(e,t)};if((s=r.content).size<=0){var h={};return Id(h),d(h._errorCode,h._errorString),Ye}if(a=s.size,(u=a-l)>0){var g;if(u>=o&&o>0?(u-=o,c=o):(c=u,u=0),!(g=0==l&&c==a?s:s.slice(l,l+c))){var v={};Id(v),d(v._errorCode,v._errorString)}if(!e.IfShowProgressBar||e.IfShowProgressBar&&On.dlgRef>0){g.name=i,r.headers["Content-Range"]=["bytes ",l,"-",l+g.size-1,"/",a].join(""),f._onProgress(e,i,{total:a,loaded:l});var m=jr.clone(r);return m.httpFormData=function(e){if(!e)return e;var r=new FormData,t=e;if(jr.isFunction(t.forEach))return t.forEach(function(e,t){e instanceof File?r.append(t,e,e.name):"object"===$f(e)&&null!==e?r.append(t,JSON.stringify(e)):r.append(t,e)}),r;if(jr.isFunction(t.entries)){for(var n=t.entries(),i=n.next();!i.done;){var o=i.value,a=o[0],s=o[1];s instanceof File?r.append(a,s,s.name):"object"===$f(s)&&null!==s?r.append(a,JSON.stringify(s)):r.append(a,s),i=n.next()}return r}return e}(r.httpFormData),m.content=g,m.offset=0,f.httpPostUpload(e,m,function(n){0==u&&(On.needShowTwiceShowDialog=!1),f._onProgress(e,i,{total:a,loaded:l+c}),0==u?(r.content=null,jr.isFunction(t)&&us.runWithCatch(t,n)):(r.offset=r.offset+c,setTimeout(function(){f._uploadBlobFragment(e,r,t,d)},100))},d),!0}var p={};return zo(p),d(p._errorCode,p._errorString),!1}return On.needShowTwiceShowDialog=!1,r.content=null,jr.isFunction(t)&&t(""),!0}},{key:"httpPostUploadFragment",value:function(e,r,t,n){var i;if(!(i=r.content)){var o={};return Id(o),jr.isFunction(n)&&n(o._errorCode,o._errorString),Ye}if(jr.isString(i)){if(""==i){var a={};return Id(a),jr.isFunction(n)&&n(a._errorCode,a._errorString),Ye}var s=new Blob([i],{type:"text/plain"}),u=r.fileName;s.name=u,r.content=s,s=null}return On.cancelFrom=St.HTTPUpload,this._uploadBlobFragment(e,r,t,n)}},{key:"httpPostUpload",value:function(e,r,t,n){var i,o,a=r.bAsync,s=function(e,t,i,o){return r.content=null,r=null,jr.isFunction(n)&&n(e,t,i,o),!1};if(!(i=r.content)){var u={};return Id(u),s(u._errorCode,u._errorString),!!a&&void 0}if(jr.isString(i)){var c,l=r.fileName;if(""==i){var f={};return Id(f),s(f._errorCode,f._errorString),!!a&&void 0}if(c=e.MaxUploadImageSize,i.length>c&&-1!=c){var d={};return bd(d),s(d._errorCode,d._errorString),!!a&&void 0}(o=new Blob([i],{type:"text/plain"})).name=l,i=null}else if(i instanceof Blob&&(o=i,i=null,o.size<=0)){var h={};return Id(h),s(h._errorCode,h._errorString),!!a&&void 0}if(o){var g,v,m=e.MaxUploadImageSize,p=o.size,_=o.type;if(p>m&&-1!=m){var y={};return bd(y),s(y._errorCode,y._errorString),!!a&&void 0}if(""===_||_&&_!=r.contentType)(g=(o.slice||o.webkitSlice||o.mozSlice).call(o,0,p,r.contentType))instanceof File?(v=g.fileName,g.name=v):g.name=o.name||o.fileName;else g=o;o=null,g&&(r.content=g),g=null}On.cancelFrom=St.HTTPUpload;var S=kd(e,r,function(e){return r.content=null,r=null,jr.isFunction(t)&&t(e),e=null,!0},s);return a?void 0:!!S}}])}(),xd=Kf(function mK(){Hf(this,mK),this.method="",this.httpMethod="POST",this.contentType="application/octet-stream",this.remoteFilename="RemoteFile",this.blockSize=0,this.offset=0,this.retry=0,this.bOnlyResponseEmptyIsOK=!0,this.bAsync=!0,this.responseType=vt.Text}),Od=Kf(function pK(){Hf(this,pK),this.IfShowProgressBar=!1,this.IfShowCancelDialogWhenImageTransfer=!0}),Nd=["19","5","0","0922"],Rd=["19","5","0","0922"],Wd=[].concat(Nd),Md=Rd[0],Ld=Rd[1],Bd=Rd[2],Ud=Rd[3],Vd=Wd[0],jd=Wd[1],Hd=Wd[2],Gd=Wd[3],zd=Nd[0],Kd=Nd[1],Jd=Nd[2],Qd=Nd[3],qd=Ud,Yd=[parseInt(Md),parseInt(Ld),parseInt(Bd),Ud],Xd=[].concat(Yd),Zd=[].concat(Yd),$d=[1,9,2,qd],eh=[].concat($d),rh=[].concat($d);function th(){if(se.bWin);else{if(se.bMac)return Xd;if(se.bLinux)return Zd}return Yd}function nh(){if(se.bWin);else{if(se.bMac)return eh;if(se.bLinux)return rh}return $d}function ih(){return"dcp/dwasm2_"+oh()}function oh(){return th().join("")}var ah="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function sh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}var uh,ch={};function lh(){if(uh)return ch;uh=1,String.prototype.startsWith||(String.prototype.startsWith=function(e){return 0==this.indexOf(e)});return ch.preProcessLicense=function(e){var r,t=e,n=t._license||"",i=JSON.parse(JSON.stringify(t._licenseServer)),o=t._sessionPassword,a=0;if(n.startsWith("t")||n.startsWith("f"))a=0;else if(0===n.length||n.startsWith("P")||n.startsWith("L")||n.startsWith("Y")||n.startsWith("A"))a=1;else{a=2;var s=n.indexOf(":");if(-1!=s&&(n=n.substring(s+1)),n.startsWith("DLS2")){var u;try{var c=n.substring(4);c=Dynamsoft.Lib.atob(c),u=JSON.parse(c)}catch(f){throw new Error("Format Error: The license string you specified is invalid, please check to make sure it is correct.")}if("number"==typeof(n=u.handshakeCode?u.handshakeCode:u.organizationID?u.organizationID:"")&&(n=JSON.stringify(n)),0===i.length){var l=[];u.mainServerURL&&(l[0]=u.mainServerURL),u.standbyServerURL&&(l[1]=u.standbyServerURL),i=function(e){if(null==e)e=[];else{e instanceof Array||(e=[e]);for(var r=0;r<e.length;++r){if(document&&document.createElement){var t=document.createElement("a");t.href=e[r],e[r]=t.href}e[r].lastIndexOf("/")!=e[r].length-1&&(e[r]+="/")}}return e}(l)}!o&&u.sessionPassword&&(o=u.sessionPassword),r=u.remark}n&&"200001"!==n&&!n.startsWith("200001-")||(a=1)}return 1===a&&(n=""),{lt:a,l:n,ls:i,sp:o,rmk:r}},ch}var fh=lh();function dh(e){jr.log(e)}function hh(e,r,t){e._errorCode=r,e._errorString=t}function gh(e){var r=xn.licenseException;r.code=e._errorCode,r.message=e._errorString,r.fromLTS=!1}var vh="Processing...",mh="Processing...",ph="Converting to blob...",_h="Converting to base64...",yh="Downloading...",Sh="Uploading...",Ih="Loading the config script...",bh="Loading css...",Ch="Loading the viewer script...",Th="Unload...",wh="Checking Product Key format...",Ah="Parsing Product Key...",Eh="Creating WebTwain from Dynamsoft.DWT.Containers...",kh="Creating a WebTwain instance...",Ph="Changing Map...",Fh="Configuring the WebTwain instance...",Dh="Activating the WebTwain instance...",xh="Decoding the license...",Oh="Checking the license...",Nh="Error: This browser is currently not supported.",Rh="Error: Duplicate ContainerId detected while creating a Dynamic Web TWAIN object.",Wh="Error: Duplicate WebTwainId detected while creating a Dynamic Web TWAIN object.",Mh="Error: The ID of the target DIV for the new DWT object is invalid.";function Lh(){return xn.IfChromeExtension?"":"Please contact the site administrator."}function Bh(e){hh(e,-1033,"Invalid index.")}function Uh(e){hh(e,-1034,"Invalid value.")}function Vh(e){hh(e,-1035,"There is no image.")}function jh(e){hh(e,-1110,"Unrecognized file extension.")}function Hh(e){hh(e,-2007,"The system is busy, some operations are not completed. Please try later.")}function Gh(e){hh(e,-2209,"The HTML5 edition does not support this method or property.")}function zh(e){hh(e,-2300,"Http upload error: the HTTP Server name/ip cannot be empty.")}function Kh(e){hh(e,-2301,"Network error.")}function Jh(e){hh(e,-2302,"The result format is invalid.")}function Qh(e,r,t,n){if(r)zo(e);else if(e._errorCode=-2003,n&&n>0||t){var i;i=n&&n>=200&&n<300?["HTTP process: "]:["HTTP process error: "],t&&(t.indexOf("HTTP process error: ")>=0&&(i=[""]),i.push(t)),n&&n>0&&(i.push(" ("+n+")"),n>=300&&(e._errorCode=it.HTTPServerError));var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP process error."}function qh(e){hh(e,-2304,"Http download error: the url is invalid.")}function Yh(e,r,t,n){if(r)hh(e,-2305,"User cancelled the operation.");else if(e._errorCode=-2003,n&&n>0||t){var i=["HTTP put error: "];t&&(t.indexOf("HTTP put error: ")>=0&&(i=[""]),i.push(t)),n&&n>=300&&(e._errorCode=it.HTTPServerError);var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP put error."}function Xh(e,r,t,n){if(r)hh(e,-2305,"User cancelled the operation.");else if(e._errorCode=-2003,n&&n>0||t){var i=["HTTP process error: "];t&&(t.indexOf("HTTP process error: ")>=0&&(i=[""]),i.push(t));var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP process error."}function Zh(e){hh(e,-2306,"Upload Error: the upload file cannot be empty.")}function $h(e){hh(e,-2307,"The width or height you entered is invalid.")}function eg(e){hh(e,-2313,"The size of the images you are about to upload has exceeded the limit.")}function rg(e){hh(e,-2314,"The parameter cannot be empty.")}function tg(e){hh(e,-2320,"Invalid file.")}function ng(e){hh(e,nt.LicenseInvalid,Mc()?"The license is invalid.":"The current product key is empty or invalid."),gh(e)}var ig=["January","February","March","April","May","June","July","August","September","October","November","December"];function og(e){if(jr.isFunction(xn.GetFormatedDate))return xn.GetFormatedDate(e);var r,t,n=e;n=n.replace(/-/g,"/"),r=Date.parse(n),isNaN(r)&&(r=0);var i=(t=new Date(r)).getFullYear(),o=ig[t.getMonth()],a=t.getDate();return"".concat(o," ").concat(a,", ").concat(i)}function ag(e,r,t){e._errorCode=nt.LicenseExpired;var n="",i=t?"Dynamic Web TWAIN":"document scanning SDK";if(r&&""!=r&&(-1==r.indexOf("on")&&(n=" on "+og(r)),e.__licenseInfo&&(e.__licenseInfo.ExpireDate=r)),Mc()){var o,a,s,u;if(o=xn.lgdt(),e._bRemoteMode)a=null!==(s=null===(u=e._dmService)||void 0===u||null===(u=u.attrs)||void 0===u?void 0:u.UUID)&&void 0!==s?s:"";else a="";e._errorString="The "+i+" license expired"+n+". Please contact the website developer for further assistance.",xn.lcexp(o,a).then(function(){e._errorString=xn.licenseException.message})}else e._errorString="The "+i+" product key expired"+n+". Please contact the website developer for further assistance.",gh(e)}function sg(e,r){Mc()?111==r?(e._errorCode=nt.LicenseExpiredForDLS,e._errorString="The license for v"+Md+" Service Core Module has expired."):(e._errorCode=nt.LicenseNoCoreForDLS,e._errorString="The license for v"+Md+" Service Core Module is not found."):(e._errorCode=nt.LicenseNoCore,e._errorString="The product key for the current operating system is missing the Service Core license. "+Lh()),gh(e)}function ug(e){e._errorCode=-2339,Mc()?e._errorString="The license for the module pdf rasterizer is not found or has expired.":e._errorString="The current product key does not support pdf rasterizer. "+Lh(),gh(e)}function cg(e){hh(e,-2350,"The indices cannot be empty.")}function lg(e){hh(e,-2351,"You cannot upload more than one image when the format is BMP, JPG or PNG")}function fg(e){hh(e,-2352,"The indices are out of range.")}function dg(e){hh(e,-2353,"The header name being used is a protected keyword and is not allowed.")}function hg(e){hh(e,-2358,"The type of the parameter indices must be an Array.")}function gg(e){hh(e,-2359,"The index is out of range.")}function vg(e){hh(e,-2360,"The index is null or undefined.")}function mg(e){hh(e,-2362,"The image type is not supported.")}function pg(e){hh(e,-2363,"The data format is not supported.")}function _g(e){hh(e,-2365,"The url is invalid.")}function yg(e){hh(e,-2366,"Converting images to a base64 string failed.")}function Sg(e){hh(e,-2376,"The generate url failed.")}function Ig(e){hh(e,-2377,"Failed to set Image Capture Driver Type.")}function bg(e){hh(e,-2391,"Invalid event name.")}function Cg(e){hh(e,-2393,"Failed to convert the data to blob.")}function Tg(e){hh(e,-2399,"Invalid imageId.")}function wg(e,r){hh(e,-2401,"Failed to load image: "+function(e){return jr.isString(e)?e:("errorMessage"in e&&(r=e.errorMessage),"message"in e&&(r=e.message),jr.isString(r)||(r="message"in r?r.message:""),"errorCode"in e&&-1==r.indexOf("(")&&(r+="("+e.errorCode+")"),"code"in e&&-1==r.indexOf("(")&&(r+="("+e.code+")"),r);var r}(r))}function Ag(e){hh(e,-2416,"Invalid parameter.")}function Eg(e){hh(e,-2426,"You have used a full license with a trial license which is not permitted. Please check and update DWT.ProductKey.")}function kg(e){hh(e,-2510,"The callback is not a function.")}function Pg(e){hh(e,-2513,"The WebTwain instance has been destroyed and can not be used anymore.")}function Fg(e){hh(e,-2530,"Document name cannot be empty.")}function Dg(e){hh(e,-2531,"Document name is not a string.")}function xg(e){hh(e,-2548,"You cannot call this function when DWT.UseDefaultViewer is set to false.")}function Og(e){hh(e,-2549,"You cannot call this function when there is no ui binding.")}function Ng(e){hh(e,0,"")}function Rg(e){var r=e;return r||(r="[]"),{code:-2601,message:"Failed to connect to the Dynamic Web TWAIN Service on "+r+". Please make sure Dynamic Web TWAIN Service is running or the certificate is valid."}}function Wg(){return{code:-2602,message:'The parameter "SendTo" is invalid.'}}function Mg(){return{code:-2604,message:"Failed to connect to the Proxy Service. Please make sure the Proxy Service is configured successfully, Dynamic Web TWAIN Service is running, or the certificate is valid."}}function Lg(e){var r;return e._bRemoteMode?Rg(null===(r=e._dmService)||void 0===r||null===(r=r.attrs)||void 0===r?void 0:r.name).message:"The Dynamic Web TWAIN Service has been stopped."}function Bg(e){hh(e,-2607,"The device selected was not found under the current service object.")}function Ug(e){hh(e,-2608,"IfShowFileDialog cannot be set to true when Object is created by CreateRemoteScanObjectAsync.")}function Vg(){return{code:-2612,message:"The devices must be an Array."}}function jg(e,r){jr.isString(r)&&""!=r?hh(e,it.RemoteDynamsoftServiceStopped,"The Dynamic Web TWAIN Service on ["+r+"] has been stopped."):hh(e,-2308,"The Dynamic Web TWAIN Service has been stopped.")}function Hg(e){hh(e,-2614,"The Dynamic Web TWAIN Service has been restarted.")}function Gg(e){hh(e,-2616,"Invalid image format type.")}function zg(e){hh(e,-2617,"ShareImages is only supported on Android devices.")}function Kg(e){hh(e,-2618,"Only single index selection is allowed when enumImageType is set to BMP, JPG or PNG.")}function Jg(e){hh(e,-2619,"Only single index selection is allowed when enumImageFormatType is set to url.")}function Qg(e){hh(e,-2620,"The RemoteScan object has been disposed.")}function qg(e){hh(e,-2621,"DWT.Containers was not set.")}function Yg(e){hh(e,-2622,'Please do not set enumImageType to "IT_MULTIPAGE_PDF", "IT_MULTIPAGE_TIF" or "IT_ALL".')}function Xg(e){hh(e,-2623,"Saving multiple images is not allowable when the selected output format is BMP, JPG or PNG.")}function Zg(e){hh(e,-2624,"The element within DWT.Containers should be a valid object.")}function $g(e){hh(e,it.ResponseDataTypeError,"Invalid response data was returned from the Dynamic Web TWAIN Service.")}function ev(){return{code:-2806,message:'Error: The argument passed to the parameter "conatinerId" is not a string.'}}function rv(e){return{code:-2807,message:'Error: The element specified by the id "'+e+"\" doesn't exist."}}function tv(e){hh(e,-2812,Wh)}function nv(e){hh(e,-2815,Rh)}function iv(){return{code:-2825,message:"Failed to setup the Default Dynamic Web TWAIN Service."}}function ov(e){return{code:-2826,message:"Failed to connect the Dynamic Web TWAIN Service on ["+e+"]."}}function av(e){hh(e,-2828,"Invalid PDF Convert Mode Value.")}function sv(e){hh(e,-2844,"Only Blob of JPEG, PNG, BMP, TIFF and PDF image types can be saved.")}function uv(e){hh(e,-2848,"The capability value is out of range.")}function cv(e){hh(e,-2853,"The imageId cannot be empty.")}function lv(e){hh(e,-2854,"The imageId does not exist.")}function fv(e){hh(e,-2855,"The blob cannot be empty.")}function dv(e){hh(e,-2857,"Invalid blob value.")}function hv(e){hh(e,-2901,"Source document does not exist. Please check the document name or create the document before performing this operation.")}function gv(e){hh(e,-2902,"Target document does not exist. Please check the document name or create the document before performing this operation.")}function vv(e){hh(e,-2906,"After initialization, the product key cannot be changed.")}var mv=Md+".",pv=parseInt(Md),_v=0,yv=1,Sv=2,Iv=3,bv=4,Cv=7,Tv=8,wv=9,Av=10,Ev=50,kv=51,Pv=52;function Fv(e){return jr.isString(e)?jr.trim(e):e}var Dv=new WeakSet,xv=function(){return S(function r(){_(this,r),g(this,Dv),I(this,"isLTS",Mc)},[{key:"isLicenseMixed",value:function(e,r){return!1}},{key:"_isDLSLicenseParseError",value:function(e,r){var t,n=!1,i=e||xn.ProductKey;(xn.lclex(),r)&&((Fv(Dn.DWT.organizationID)||Fv(Dn.DWT.handshakeCode))&&i&&(n=!0,hh(t={},-2444,"A license can only be specified once and has already been set using the ProductKey API.")));if(!n&&jr.isString(i)&&(i=jr.trim(i),jr.startsWith(i,"DLS2")))try{v(Dv,this,Nv).call(this,i)}catch(a){n=!0,hh(t={},-2440,""),t._errorString=a.message}if(n&&t){gh(t);var o=xn.licenseException;jr.error(o.message)}return n}},{key:"getLicenseFromDynamsoftCore",value:function(){var e,r,t=null;null!==(e=window)&&void 0!==e&&null!==(e=e.Dynamsoft)&&void 0!==e&&null!==(e=e.Core)&&void 0!==e&&null!==(e=e.mapPackageRegister)&&void 0!==e&&e.license&&(t=null===(r=window.Dynamsoft.Core.mapPackageRegister.license.LicenseManager)||void 0===r?void 0:r.license);if(null!==t){if(""===t)return"";if(jr.isString(t))return t=jr.trim(t)}return null}},{key:"_initAR",value:function(e){var r,t;e&&(e.pk||(r=e.ar,t=e.u,r&&t&&(Zu.bUseDynamsoftLicenseManager=!0,xn.lsdt(xn.EnumInstance.dwt_browser),xn.lsmid(t,""),xn.lsar(r,""))))}},{key:"preParseProductKey",value:(e=p(d().m(function t(e){var r,n,i,o;return d().w(function(t){for(;;)switch(t.n){case 0:if(r=null,n=!1,r=this.getLicenseFromDynamsoftCore(),!jr.isString(r)){t.n=6;break}if(""===r||!Rc(r)&&!Wc(r)){t.n=1;break}return this._isDLSLicenseParseError(r)||(this._innerResetLicense(),Zu.bPublicLTS=!1,Zu.refProductKey=r),t.a(2);case 1:if(null===(i=window)||void 0===i||null===(i=i.Dynamsoft)||void 0===i||null===(i=i.Core)||void 0===i||null===(i=i.mapPackageRegister)||void 0===i||!i.license){t.n=3;break}return t.n=2,window.Dynamsoft.Core.mapPackageRegister.license.getAR();case 2:o=t.v;case 3:if(!o){t.n=6;break}if(this._initAR(o),""!==r){t.n=4;break}return this._innerResetLicense(),Zu.refProductKey="",Zu.bPublicLTS=!0,Zu.handshakeCode="200001",t.a(2);case 4:if(!o.pk){t.n=5;break}return this._isDLSLicenseParseError(o.pk,!1)||(this._innerResetLicense(),Zu.bPublicLTS=!1,Zu.refProductKey=o.pk),t.a(2);case 5:Zu.refProductKey!==r&&(n=!0);case 6:!n&&this._isDLSLicenseParseError(null,!0)||this.reparseProductKey(e);case 7:return t.a(2)}},t,this)})),function(r){return e.apply(this,arguments)})},{key:"reparseProductKey",value:function(e){e&&dh(Ah);var r=this.getLicenseFromDynamsoftCore(),t=!1;if(null===r||""===r){var n=Fv(xn.organizationID),i=Fv(xn.handshakeCode),o=n||i;if(r=jr.trim(xn.ProductKey),!o){var a=v(Dv,this,Ov).call(this,r);a.LTS&&(i=Fv(a.handshakeCode),o=(n=Fv(a.organizationID))||i)}if(o)return this._innerResetLicense(),jr.isNumber(r)&&(n=r),Zu.handshakeCode=i,Zu.organizationID=n,Zu.licenseServer=xn.licenseServer,Zu.sessionPassword=xn.sessionPassword,void(Zu.bPublicLTS=v(Dv,this,Rv).call(this,Zu.licenseServer,o))}if(Zu.refProductKey!==r&&(this._innerResetLicense(),jr.isString(r)&&r.length>0&&(Zu.refProductKey=r,t=!0)),t)if(Rc(Zu.refProductKey)||Wc(Zu.refProductKey))Zu.bPublicLTS=!1;else{var s,u={_pLoad:{isEmpty:!0},_license:Zu.refProductKey,_licenseServer:[]};try{s=fh.preProcessLicense(u)}catch(l){jr.error(l),s=!1}if(s&&jr.isString(s.l)){var c=jr.trim(s.l);""==c?(c="200001",Zu.organizationID=c,Zu.handshakeCode=c):(-1!=c.indexOf("-")||(Zu.organizationID=c),Zu.handshakeCode=c),jr.isArray(s.ls)&&s.ls.length>0&&(Zu.licenseServer=s.ls),Zu.bPublicLTS=v(Dv,this,Rv).call(this,Zu.licenseServer,c),Zu.sessionPassword=s.sp}else Zu.bPublicLTS=!1,s&&jr.isNumber(s.l)&&(Zu.handshakeCode=""+s.l)}}},{key:"_innerResetLicense",value:function(){Zu.refProductKey="",Zu.handshakeCode=undefined,Zu.organizationID=undefined,Zu.licenseServer=undefined,Zu.sessionPassword="",Zu.bPublicLTS=!0}},{key:"checkOSForAllowCore",value:function(e,r,t){if(xc.bHTML5Edition){if(e)return v(Dv,this,Vv).call(this,r);var n=t._bRemoteMode,i=t.__serverPlatform;return this.isOSOK(r,n,i)}return!0}},{key:"checkLocalPlatformForRemoteService",value:function(e){var r,t,n,i=e.__licenseInfo,o=xc.getEnumPlatform(),a=!1;for(r=0;r<i.Detail.length;r++)if(t=i.Detail[r],(n=v(Dv,this,Bv).call(this,t.EnumLicenseType,t.LicenseType)).Core&&jr.isString(t.Version)&&0==t.Version.indexOf(mv)){if(a=v(Dv,this,Vv).call(this,t.OS))break;if(a=this.isOSOK(t.OS,true,o))break;if(!e._blts&&e._bScanForProxyRemote&&n.RemoteScan)break}return a||(o==rt.enumWindow?function(e){hh(e,-2344,"The current product key does not support Windows OS. "+Lh()),gh(e)}(e):o==rt.enumLinux?function(e){hh(e,-2346,"The current product key does not support Linux OS. "+Lh()),gh(e)}(e):o==rt.enumMac?function(e){hh(e,-2345,"The current product key does not support MAC OS. "+Lh()),gh(e)}(e):function(e){hh(e,-2347,"The current product key does not support your OS. "+Lh()),gh(e)}(e)),a}},{key:"checkProductKey",value:function(e,r,t){return!r.Camera||this.checkCameraProductKey(e)}},{key:"checkCameraProductKey",value:function(e){var r,t=Dn.DWT.licenseException;return(r=v(Dv,this,Mv).call(this,e,e.__licenseInfo,!0,{Camera:!0},!0))||(t.code=e._errorCode,t.message=e._getErrorString(),t.fromLTS=!1),r}},{key:"isBindDomainOK",value:function(e){return!0}},{key:"isExpiredOrFuture",value:function(e,r){if(""==e)return!1;if(!r){var t=e.length;if(t>2&&"/"==e[t-2]&&"0"==e[t-1])return!1}var n=Hv(e),i=(new Date).getTime(),o=i+5184e6;return n.getTime()<i||!!(r&&n.getTime()>o)}},{key:"willTrialExpire",value:function(e){if(""==e)return!1;var r=Hv(e),t=(new Date).getTime();return r.getTime()<t+432e6&&r.getTime()>t}},{key:"isOSOK",value:function(e,r,t){var n=!1,i=!1,o=!1,a=!1,s=!1,u=!1,c=!1,l=!1;return""==e||"0"==e||(r?t==rt.enumWindow?o=!0:t==rt.enumLinux?i=!0:t==rt.enumMac?n=!0:t==rt.enumEmbed?s=!0:t==rt.enumChromeOS?u=!0:t==rt.enumAndroid?c=!0:t==rt.enumHarmonyOS?l=!0:t==rt.enumiOS&&(a=!0):(n=se.bMac,i=se.bLinux,o=se.bWin,a=se.biPhone||se.biPad,u=se.bChromeOS,s=Dn.navInfo.bEmbed,c=se.bAndroid,l=se.bHarmonyOS),!!((e=e.toLowerCase()).indexOf("windows")>-1&&o)||(!!(e.indexOf("mac")>-1&&n)||(!!(e.indexOf("linux")>-1&&(i||u||l))||(!!(e.indexOf("android")>-1&&c)||(!!(e.indexOf("ios")>-1&&a)||!!(e.indexOf("embed")>-1&&s))))))}},{key:"isBrowserOK",value:function(e){if(jr.isString(e)){if(""==e||"0"==e)return!0;var r=(e=e.toLowerCase()).split(";"),t=!1;return jr.each(r,function(e){("chrome"==jr.trim(e)&&(se.bChrome||se.bSafari||se.bOpera||se.bEdge)||"ie"==jr.trim(e)&&se.bIE||"firefox"==jr.trim(e)&&se.bFirefox)&&(t=!0)}),t}return!1}},{key:"isAllowLicenseType",value:function(e,r){return r.Core?e.Core:r.PDFRasterizer?e.PDFRasterizer:r.Webcam||r.Camera?e.Webcam:r.barcode1D?e.barcode1D:r.QR?e.QR:r.PDF417?e.PDF417:r.DataMatrix?e.DataMatrix:r.OCRKit?e.OCRKit:r.OCRPro?e.OCRPro:r.OCR?e.OCR:e.Core}},{key:"setNoAllowedLicenseTypeError",value:function(e,r,t){t.Core?sg(e):t.Webcam||t.Camera?r||t.Camera?function(e){e._errorCode=-2431,Mc()?e._errorString="The license for the Camera Addon is not found or has expired.":hh(e,-2431,"The current product key does not support Camera Addon. "+Lh()),gh(e)}(e):function(e){e._errorCode=-2338,Mc()?e._errorString="The license for the module direct show is not found or has expired.":e._errorString="The current product key does not support Webcam. "+Lh(),gh(e)}(e):t.PDFRasterizer?r?function(e){e._errorCode=-2370,Mc()?e._errorString="The license for the module pdf rasterizer is not found or has expired.":e._errorString="The current product key does not support Pdf Rasterizer Wasm. "+Lh(),gh(e)}(e):ug(e):t.OCRKit?function(e){e._errorCode=-2340,Mc()?e._errorString="The license for the module OCR Kit is not found or has expired.":e._errorString="The current product key does not support OCR Kit. "+Lh(),gh(e)}(e):t.OCRPro?function(e){e._errorCode=-2341,Mc()?e._errorString="The license for the module OCR pro is not found or has expired.":e._errorString="The current product key does not support OCR pro. "+Lh(),gh(e)}(e):t.OCR?function(e){e._errorCode=-2340,Mc()?e._errorString="The license for the module OCR is not found or has expired.":e._errorString="The current product key does not support OCR. "+Lh(),gh(e)}(e):ng(e)}},{key:"getLicenseDateString",value:function(e){var r,t=e.getFullYear();return[(r=e.getMonth()+1)>=10?""+r:"0"+r,"/",e.getDate()>=10?""+e.getDate():"0"+e.getDate(),"/",t].join("")}},{key:"hasPDFRProductKey",value:function(e){return!!this.checkProductKey(e,{PDFRasterizer:!0},!0)||(e._resetErr(),!1)}},{key:"checkPDFProductKeyWhenNeeds",value:function(e,r){return!0}},{key:"getPublicLicenseContent",value:function(e){var r=[],t=e;if(!jr.isString(t)){if(jr.isUndefined(t))return"";t=t instanceof Error||"message"in t?t.message:""+t}var n=t.indexOf("["),i=t.indexOf("]",n),o=t.indexOf("(",i),a=t.indexOf(")",o);if(-1==n||-1==i||-1==o||-1==a)return t;n>0&&r.push(t.substring(0,n));var s=t.substring(n+1,i),u=t.substring(o+1,a);return r.push(['<a href="',u,'" target="_blank" class="dynamsoft-major-color">',s,"</a>"].join("")),r.push(t.substring(a+1)),r.join("")}},{key:"getLTSLicense",value:function(){return Zu.bPublicLTS?"":Zu.handshakeCode||Zu.organizationID}}]);var e}();function Ov(e){var r,t,n=e,i=e.indexOf("-"),o=-1!=i;return t={},o&&(n=e.substring(0,i)),r=Number(n),isNaN(r)||String(Number(r))!==n||(o?t.handshakeCode=e:t.organizationID=e,t.LTS=!0),t}function Nv(e){var r={_pLoad:{isEmpty:!0},_license:e,_licenseServer:[]};fh.preProcessLicense(r)}function Rv(e,r){var t=!0;if(jr.isArray(e)&&e.length>0){var n=e[0];if(jr.isString(n)&&""!=n)"mlts.dynamsoft.com"!==new ra(n).getHostname()&&(t=!1)}return t&&(!r||"200001"===r||jr.startsWith(r,"200001-"))}function Wv(e,r,t){return this.checkOSForAllowCore(e,r,t)}function Mv(e,r,t,n,i){var o,a=!1;if(xc.bHTML5Edition&&jr.isFunction(e._needCheckProxyRemoteScanLicense)&&(a=e._needCheckProxyRemoteScanLicense()),r&&r.LTS){if(!r||!jr.isArray(r.Detail)||0==r.Detail.length)return this.isLTS()?sg(e):ng(e),!1}else if(!r||!jr.isArray(r.Detail)||0==r.Detail.length)return this.isLTS()?sg(e):ng(e),!1;var s,u,c,l,f=0,d=0,h=[],g=[],m=!1,p=!1,_=!1,y=!1,S=!1,I=!1,b=!1,C=!1;if(!this.isBindDomainOK(r.Domain))return function(e){hh(e,-2342,"The domain of your current site does not match the domain bound in the current product key. "+Lh()),gh(e)}(e),!1;for(r.Detail.length>0&&(o="FALSE"!=(c=r.Detail[0]).Trial),u=1;u<r.Detail.length;u++)if("FALSE"==(c=r.Detail[u]).Trial&&o||"TRUE"==c.Trial&&!o)return Eg(e),!1;if(r.bTrial=o,n.Core||n.Webcam){var T=[],w=!1;for(u=0;u<r.Detail.length;u++)if(c=r.Detail[u],l=v(Dv,this,Bv).call(this,c.EnumLicenseType,c.LicenseType),n.Core&&l.Core&&this.checkOSForAllowCore(t,c.OS,e)||n.Core&&l.Core&&xc.bActiveXEdition&&l.ActiveX||n.Webcam&&l.Webcam&&!t){if(r.LTS);else if(!jr.isString(c.Version)||0!=c.Version.indexOf(mv)){T.push(c);continue}if(xc.bHTML5Edition){if(l.ActiveX&&!l.Html5)continue;if(a&&!l.RemoteScan)continue;g.push(c)}else{if(!l.ActiveX&&l.Html5)continue;g.push(c)}w=!0}if(!w&&T.length>0)return T.splice(0),function(e,r){var t=Lh();hh(e,nt.LicenseVersionNotCurrent,"The current product key is not for version ".concat(r,". ").concat(t)),gh(e)}(e,"0"==Bd.toString()?[Md,Ld].join("."):[Md,Ld,Bd].join(".")),!1;T.splice(0)}else g=r.Detail;for(u=0;u<g.length;u++){var A=!0;if(c=g[u],l=v(Dv,this,Bv).call(this,c.EnumLicenseType,c.LicenseType),n.Core&&l.Core||this.isAllowLicenseType(l,n)){s=c.ExpireDate.replace(/-/g,"/");var E="FALSE"!=c.Trial;if(this.isExpiredOrFuture(s,E))h.push(s);else if(E&&l.Core&&this.willTrialExpire(s)&&(r.ExpireDate=s),r.LTS||l.Core&&xc.bHTML5Edition&&parseInt(c.Version)>=pv||l.Core&&xc.bActiveXEdition||!l.Core){var k=!1;if(l.Core)(this.checkOSForAllowCore(t,c.OS,e)||xc.bActiveXEdition&&l.ActiveX)&&(k=!0);else{var P=t;n.Camera&&(P=!0),v(Dv,this,Wv).call(this,P,c.OS,e)&&(k=!0)}k?this.isBrowserOK(c.Browser)||i?(f++,A=!1):p=!0:n.Core?m=!0:n.PDFRasterizer?y=!0:n.Webcam||n.Camera?S=!0:n.OCRKit?b=!0:n.OCRPro?C=!0:n.OCR&&(I=!0)}else _=!0;A&&d++}}if(f>0)return!0;if(0==d)return this.setNoAllowedLicenseTypeError(e,t,n),!1;if(h.length>0){var F,D=0,x=1e20,O="",N=(new Date).getTime();for(s="",u=0;u<h.length;u++)(F=Hv(h[u])).getTime()<N&&F.getTime()>D?(D=F.getTime(),s=h[u]):F.getTime()>N&&F.getTime()<x&&(x=F.getTime(),O=h[u]);return""!=s?(F=Hv(s),ag(e,s=this.getLicenseDateString(F),o)):""!=O?(F=Hv(O),O=this.getLicenseDateString(F),function(e){hh(e,nt.LicenseIsFuture,"The current product key is invalid. "+Lh()),gh(e)}(e)):ag(e,"",o),!1}return _?(function(e){hh(e,-2348,"The current product key is invalid because it's generated with the licenses of a different major version."),gh(e)}(e),!1):p?(se.bEdge?function(e){hh(e,-2330,"The current product key does not support Edge. "+Lh()),gh(e)}(e):se.bChrome?function(e){hh(e,-2327,"The current product key does not support Chrome. "+Lh()),gh(e)}(e):se.bFirefox?function(e){hh(e,-2328,"The current product key does not support Firefox. "+Lh()),gh(e)}(e):se.bIE?function(e){hh(e,-2329,"The current product key does not support IE. "+Lh()),gh(e)}(e):se.bSafari?function(e){hh(e,-2392,"The current product key does not support Safari. "+Lh()),gh(e)}(e):function(e){hh(e,-2343,"The current product key does not support your browser. "+Lh()),gh(e)}(e),!1):m?(this.setNoAllowedLicenseTypeError(e,t,{Core:!0}),!1):y?(this.setNoAllowedLicenseTypeError(e,t,{PDFRasterizer:!0}),!1):S?(this.setNoAllowedLicenseTypeError(e,t,{Webcam:!0}),!1):b?(this.setNoAllowedLicenseTypeError(e,t,{OCRKit:!0}),!1):C?(this.setNoAllowedLicenseTypeError(e,t,{OCRPro:!0}),!1):I?(this.setNoAllowedLicenseTypeError(e,t,{OCR:!0}),!1):(ng(e),!1)}function Lv(e){var r=!1,t=!1,n=!1,i=!1,o=!1,a=!1,s=!1,u=!1,c=!1;return jr.isString(e)&&""!=e&&jr.each(e.split(";"),function(e){var l=1*e;l==Sv||l==Iv||l==_v||l==yv?r=!0:l==bv?t=!0:l==Ev?n=!0:l==kv?i=!0:l==Pv?o=!0:l==Cv?a=!0:l==Tv?s=!0:l==wv?u=!0:l==Av&&(c=!0)}),{Core:r,PDFRasterizer:u,Webcam:s,barcode1D:t,QR:n,PDF417:i,DataMatrix:o,OCR:a,OCRPro:c,OCRKit:!1}}function Bv(e,r){var t=v(Dv,this,Lv).call(this,e),n=v(Dv,this,Uv).call(this,r);return jr.each(["Core","Html5","RemoteScan","LocalScan","ActiveX","PDFRasterizer","Webcam","barcode1D","QR","PDF417","DataMatrix","OCR","OCRPro","OCRKit"],function(e){t[e]=t[e]||n[e]}),t}function Uv(e){var r=!1,t=!1,n=!1,i=!1,o=!1,a=!1,s=!1,u=!1,c=!1,l=!1,f=!1,d=!1,h=!1,g=!1;return e&&""!=e&&((e=e.toLowerCase()).indexOf("html5")>-1||"win=(aph) or mac=(ph) or linux(h)"==e?(r=!0,e.indexOf("html5;activex;oldie")>-1?i=!0:e.indexOf("html5;activex")>-1?(t=!0,h=!0,i=!0):(t=!0,h=!0),e.indexOf(";remotescan")>-1&&(t=!0,d=!0,e.indexOf(";onlyremote")>-1&&(h=!1))):"1d barcode reader"==e?n=!0:"2d barcode reader(qrcode)"==e?o=!0:"2d barcode reader(pdf417)"==e?a=!0:"2d barcode reader(data matrix)"==e?s=!0:"webcam"==e?c=!0:"pdf rasterizer"==e?l=!0:"proocr"==e?f=!0:e.indexOf("ocr")>-1&&(e.indexOf("ocr kit")>-1&&(g=!0),u=!0)),{Core:r,Html5:t,RemoteScan:d,LocalScan:h,ActiveX:i,PDFRasterizer:l,Webcam:c,barcode1D:n,QR:o,PDF417:a,DataMatrix:s,OCR:u,OCRPro:f,OCRKit:g}}function Vv(e){var r=e.toLowerCase();return r.indexOf("wasm")>-1||r.indexOf("mobile")>-1}var jv=new xv;function Hv(e){var r,t=e;return t=t.replace(/-/g,"/"),r=Date.parse(t),isNaN(r)&&(r=0),(r=new Date(r)).setHours(23,59,59,999),r}function Gv(e){if(""==e)return 65536;var r=Hv(e),t=(new Date).getTime(),n=(r.getTime()-t)/864e5;return r.getTime()<t?0:Math.ceil(n)}xn.isPublicLicense=function(){return Zu.bPublicLTS};var zv=se.bWin,Kv=parseFloat(se.strBrowserVersion),Jv=location.hostname,Qv=location.pathname,qv=0;""===Jv?zv&&Qv.lastIndexOf("\\")>1?Qv=Qv.substring(1,Qv.lastIndexOf("\\")).replace(/%20/g," "):(qv=1,Qv=Qv.substring(1,Qv.lastIndexOf("/")).replace(/%20/g," ")):(qv=1,Qv=Qv.substring(0,Qv.lastIndexOf("/")));var Yv={bMobile:Gu.bMobile,bChrome:se.bChrome,bFirefox:se.bFirefox,bSafari:se.bSafari,bIE:se.bIE,bEdge:se.bEdge,bWin:zv,bMac:se.bMac,bLinux:se.bLinux,iPluginLength:0,bFileSystem:se.bFileSystem,strChromeVersion:se.bChrome?Kv:"",strFirefoxVersion:se.bFirefox?Kv:"",basePath:Qv,pathType:qv,isDesktopViewer:function(){return se.bWin||se.bLinux||se.bChromeOS||se.bMac},isPadViewer:function(){return se.bPad||se.biPad},isMobileViewer:function(){return se.bMobile||se.biPhone||se.bAndroid||se.bHarmonyOS},WSVersion:"18.5.0",WSSession:(new Date).getTime(),bDiscardBlankImage:!1};function Xv(e){var r=e||{};r.basePath&&(Yv.basePath=r.basePath),r.pathType&&(Yv.pathType=r.pathType),jr.isUndefined(r.bDiscardBlankImage)||(Yv.bDiscardBlankImage=r.bDiscardBlankImage),r.msgPrefix&&r.msgPrefix,r.msgSuffix&&r.msgSuffix,r.detectType&&(On.detect.detectType=r.detectType),r.tryTimes&&(On.detect.tryTimes=r.tryTimes);var t=xn.RemoteScanConfig;t||(t={sessionTimeout:300,keepAwake:!0},xn.RemoteScanConfig=t),t.keepAwake===undefined&&(t.keepAwake=!0)}function Zv(){return!!jr.getWakeLock()}function $v(e){return em.apply(this,arguments)}function em(){return(em=p(d().m(function e(r){var t;return d().w(function(e){for(;;)switch(e.n){case 0:if(t=jr.getWakeLock(),!r){e.n=2;break}if(null!=t){e.n=1;break}return e.n=1,jr.toggleWakeLock();case 1:e.n=3;break;case 2:if(!t){e.n=3;break}return e.n=3,jr.toggleWakeLock();case 3:return e.a(2)}},e)}))).apply(this,arguments)}function rm(e){return!(!e||jr.isString(e))}function tm(e){return nm.apply(this,arguments)}function nm(){return(nm=p(d().m(function e(r){var t,n,i;return d().w(function(e){for(;;)switch(e.n){case 0:r&&(t=document.createElement("style"),n=om(),i="",jr.isString(n)&&n.length>0&&("/"==n.charAt(n.length-1)||(i="/")),t.textContent=['@import url("',n,i,"src/dynamsoft.webtwain.viewer.css",On.timestamp,'")'].join(""),r.appendChild(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function im(e,r){var t;for(t=0;t<e.length;t++)if(e[t]==r)return!0;return!1}function om(){return Xu()}var am=function(){return S(function e(){_(this,e),this.queue=[],this.doNextStarted=!1,this.timer=null},[{key:"pause",value:function(){clearTimeout(this.timer),this.timer=null,this.doNextStarted=!1}},{key:"stop",value:function(){this.pause(),this.queue=[]}},{key:"start",value:function(){var e=this;this.doNextStarted||(this.doNextStarted=!0,this.timer=setTimeout(function(){e.doNext()},0))}},{key:"pushToDo",value:function(e,r,t){return this.queue.push({obj:e,method:r,args:t}),!0}},{key:"addHeadToDo",value:function(e,r,t){return this.queue.unshift({obj:e,method:r,args:t}),!0}},{key:"doNext",value:function(){var e=this;if(this.doNextStarted)if(0!=this.queue.length){var r=this.queue[0],t=r.obj,n=r.method,i=r.args;if(this.queue.splice(0,1),t&&jr.isFunction(t[n])){var o=!1;if(i.length>2){var a=i[i.length-2],s=i[i.length-1];jr.isFunction(a)&&jr.isFunction(s)&&(i[i.length-2]=function(){try{a.apply(t,arguments)}catch(hH){}e.timer=setTimeout(function(){e.doNext()},0)},i[i.length-1]=function(){try{s.apply(t,arguments)}catch(hH){}e.timer=setTimeout(function(){e.doNext()},0)},o=!0)}try{t[n].apply(t,i)}catch(u){}o||(e.timer=setTimeout(function(){e.doNext()},0))}else if(null===t&&jr.isFunction(n)){try{n.apply(null,i)}catch(c){}this.timer=setTimeout(function(){e.doNext()},0)}else this.timer=setTimeout(function(){e.doNext()},0)}else this.stop();else this.stop()}}])}(),sm=new am,um={getImageUrl:function(e,r,t,n,i){var o,a=[e];if(jr.isNumber(r)&&r<0)return"";if(r!==undefined&&null!==r&&(a.push("&index="),a.push(r)),a.push("&width="),a.push(t),a.push("&height="),a.push(n),Yv.bMobile&&a.push("&type=1&quality=85"),a.push("&ticks="),i?a.push(i):a.push(Date.now()),o=a.join(""),se.bFileSystem&&o.indexOf("dwt://")<0){var s=new Image;s.crossOrigin="anonymous",s.src=o,s=null}return o},getUrlByAct:function(e,r,t){var n=[e];return r!==undefined&&null!==r&&(n.push("&index="),n.push(r)),t&&(n.push("&act="),n.push(t)),n.push("&ticks="),n.push(Date.now()),n.join("")},output:function(e,r){jr.debug&&jr.log(r)},print:function(e){var r,t=0,n="";for(t=0;t<e.length;t++)n=n+'<div class="image-container"><img src="'+e[t].Url+'" /></div>';var i=om(),o="";jr.isString(i)&&i.length>0&&("/"==i.charAt(i.length-1)||(o="/"));var a,s,u,c=[i,o,"src/dynamsoft.webtwain.css"].join(""),l=["alwaysRaised=yes,z-look=yes,top=0,left=0,toolbar=no,menubar=no,location=no,status=no,width=",0,",height=",0].join(""),f=window.open("about:blank","_blank",l);(r=["<html>",'<head><link rel="stylesheet" type="text/css" href="',c,'"></head>','<body id="D_body">',n,"</body></html>"].join(""),f)&&((s=(u=f.document).write)&&s.call(u,r),u.close(),f.focus(),(a=u.body)?a.onload=function(){f&&f.print(),jr.log("print image...ok")}:jr.log("cannot find image"))}};On.html5.Funs2=um;var cm=jr.isString,lm=jr.isArray,fm=jr.each;function dm(e,r){if(cm(r))e.push('"'),e.push(r),e.push('"');else if(lm(r)){var t=!0;e.push("["),fm(r,function(r){t?t=!1:e.push(","),dm(e,r)}),e.push("]")}else r===undefined?e.push('""'):e.push(r)}function hm(){for(var e=[],r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];if(t.length>0)if(1===t.length){var i=t[0];e.push("["),dm(e,i),e.push("]")}else if(2===t.length){var o=t[0],a=t[1];e.push("["),dm(e,o),e.push(","),dm(e,a),e.push("]")}else dm(e,Array.prototype.slice.call(t));return e.join("")}function gm(e){return e instanceof ArrayBuffer||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||window.Uint8ClampedArray&&e instanceof window.Uint8ClampedArray||e instanceof Float32Array||e instanceof Float64Array}var vm=1;function mm(){return(++vm).toString()}function pm(){return["dwt_",jr.getRandom()].join("")}var _m={ActiveXVersion:"18,0,0,1025",ActiveXPdfVersion:"11.5.2.0312",PdfVersion:"11.5.2.0312",PdfLinuxVersion:"11.5.2.0312",PdfMacVersion:"11.5.2.0312"};function ym(){return js.getDWTHost()}function Sm(){var e=300,r=xn.RemoteScanConfig;return r&&jr.isNumber(r.sessionTimeout)&&r.sessionTimeout>0&&(e=r.sessionTimeout),e}var Im=!1;function bm(e){return{code:e._errorCode,message:e._errorString}}function Cm(e){return"exception"in e&&"description"in e&&0!=e.exception&&""!=e.description}function Tm(e){return e&&"cause"in e?e.cause:null}function wm(e){return-1416==e}var Am=function(){return S(function e(r,t){_(this,e),I(this,"m_server",""),I(this,"m_iUsingTime",0),I(this,"m_countMap",{}),I(this,"m_newConsum",!1),I(this,"m_mapSavedToDb",!1),this.clearData(),this.m_enumInstance=r,r==xn.EnumInstance.dwt_desktop?(this.m_deploymentType="desktop",this.m_server=t):r==xn.EnumInstance.dwt_browser?(this.m_deploymentType="browser",this.m_server=t):r==xn.EnumInstance.dbr&&(this.m_deploymentType="browser",this.m_server="")},[{key:"clearData",value:function(){this.m_iUsingTime=0,this.m_jvUsingTime=jr.nil,this.m_countMap={},this.m_newConsum=!1,this.m_mapSavedToDb=!1,this.m_minExpiredTime=jr.nil,this.m_maxExpiredTime=jr.nil,this.m_cu=jr.nil,this.m_ar=jr.nil,this.m_ltsInstance=jr.nil}},{key:"set_cu",value:function(e){this.m_cu=e}},{key:"get_cu",value:function(){return this.m_cu}},{key:"set_ar",value:function(e){this.m_ar=e}},{key:"get_ar",value:function(){return this.m_ar}},{key:"get_ltsInstance",value:function(e){return this.m_ltsInstance||(this.m_ltsInstance=e(this.m_enumInstance)),this.m_ltsInstance}},{key:"inited_ltsInstance",value:function(){return!!this.m_ltsInstance}},{key:"set_maxExpiredTime",value:function(e){this.m_maxExpiredTime=e}},{key:"get_maxExpiredTime",value:function(){return this.m_maxExpiredTime}},{key:"set_minExpiredTime",value:function(e){this.m_minExpiredTime=e}},{key:"get_minExpiredTime",value:function(){return this.m_minExpiredTime}},{key:"get_deploymentType",value:function(){return this.m_deploymentType}},{key:"get_enumDeploymentType",value:function(){return this.m_enumInstance}}])}();xn.LTS=xn.LTS||{},xn.licenseException={code:0,message:"",fromLTS:!1},xn.bLTSOnline=!0,xn.axInstance=undefined,xn.lOnUpdateDWObj=[],xn.EnumInstance={dwt_desktop:0,dwt_browser:1,dbr:2};var Em,km=0,Pm={},Fm=!1,Dm=!1,xm=!1,Om=!1,Nm=!1;function Rm(){var e=Zu.handshakeCode;return jr.isString(e)||(e=""),e}function Wm(){var e=Zu.organizationID;return jr.isNumber(e)?e=""+e:jr.isString(e)||(e=""),e}function Mm(){return jr.replaceAll(Qu.getJSVersion(),",",".")}function Lm(e,r){var t=e;return t===jr.nil&&(t=xn.lgdt()),t==xn.EnumInstance.dbr?(xn._dbrLicense||(xn._dbrLicense=new Am(t,"")),xn._dbrLicense):(xn._dwtDLicense||(xn._dwtDLicense=new Am(t,"")),xn._dwtDLicense)}xn.lupverfy=function(){Lm(xn.lgdt()).get_ltsInstance(Vm),Lm(xn.EnumInstance.dbr).get_ltsInstance(Vm)};var Bm=xn.EnumInstance.dwt_desktop;xn.lsdt=function(e,r){Bm=e},xn.lgdt=function(e){return Bm},xn.lsmid=function(e,r){Lm(xn.lgdt()).set_cu(e)},xn.lsar=function(e,r){Lm(xn.lgdt()).set_ar(e)},xn.lsmid2b=function(e){Lm(xn.lgdt("")).set_cu(e)},xn.lgar=function(e,r){return Lm(e).get_ar()},xn.laddDWTObj=function(e){var r=!1;jr.each(xn.lOnUpdateDWObj,function(t){if(t==e)return r=!0,!1}),r||xn.lOnUpdateDWObj.push(e)},xn.lremoveDWTObj=function(e){jr.each(xn.lOnUpdateDWObj,function(r,t){if(r==e)return xn.lOnUpdateDWObj.splice(t,1),!1})},xn.lsendUpdateEvt=function(e,r){var t=[];if(jr.each(xn.lOnUpdateDWObj,function(r){e==xn.EnumInstance.dwt_desktop&&t.push(r)}),0==t.length)return Promise.resolve();var n,i=t[0];return i._bAx?(jr.each(t,function(r){r.SetLTSInfo(Lm(e).get_ar(),Lm(e).get_cu())}),i.GetLicenseInfo().then(function(t){t&&jr.isArray(t.Detail)&&t.Detail.length>0&&xn.lsexp(e,t.Detail[0].ExpireDate,r)})):(n=i.SetLTSLicenseAsync(Lm(e).get_ar()).then(function(t){t&&jr.isArray(t.Detail)&&t.Detail.length>0&&xn.lsexp(e,t.Detail[0].ExpireDate,r)}),jr.each(t,function(r,t){0!=t&&r.SetLTSLicenseAsync(Lm(e).get_ar())}),n)},xn.lgcb=function(){var e=[];return se.bChrome?e.push("Chrome"):se.bFirefox?e.push("Firefox"):se.bEdge?e.push("Edge"):se.bIE?e.push("IE"):se.bSafari?e.push("Safari"):se.bOpera?e.push("Opera"):se.b360SE?e.push("360SE"):se.bTencentTraveler?e.push("TencentTraveler"):se.bMaxthon?e.push("Maxthon"):se.bMetaSr?e.push("MetaSr"):se.bTheWorld?e.push("TheWorld"):se.bUC?e.push("UC"):se.bHuaWeiBrowser&&e.push("HuaWeiBrowser"),e.push(se.strBrowserVersion),se.bWin?e.push("Windows"):se.bMac?e.push("Mac"):se.bLinux?e.push("Linux"):se.bAndroid?e.push("Android"):se.bChromeOS?e.push("ChromeOS"):se.bHarmonyOS?e.push("HarmonyOS"):Yv.bMobile?e.push("Mobile OS"):Dn.navInfo.bEmbed&&e.push("Embed OS"),e.join(" ")};var Um={NetworkError:-2440,Timedout:-2441,JsonError:-2442,CorsError:-2443,Expired:-2445,LtsJsLoadError:-2446,UUIDError:-2447};function Vm(e){var r,t,n=Zu.licenseServer;if(n&&n.length>0)for(r=0;r<n.length;r++)t=n[r],jr.endsWith(t,"/")||(n[r]=t+"/");var i=Lm(e),o={bd:On.ltsDebug,dm:location.origin?jr.startsWith(location.origin,"http")?location.origin:"https://localhost":jr.startsWith(location.href,"http")?location.href:"https://localhost",hs:On.product.handshakeCode||"",pd:xn.lgpd(e),vm:Md,dt:i.get_enumDeploymentType(),btoa:jr.btoa,atob:jr.atob,fol:xn.OnFirstOffline,sutlcb:function(){jr.isFunction(xn.lonsend)&&xn.lonsend()},lf:On.localforage,updl:function(r){i.set_ar(r.ar),i.get_cu()||i.set_cu(r.cu),xn.lsendUpdateEvt(e,"")},mnet:function(){return i.get_maxExpiredTime()},mxet:function(){return i.get_minExpiredTime()},dwt:!0};if(e==xn.EnumInstance.dwt_browser||e==xn.EnumInstance.dbr?o.feab=xn.lfeab_wasm:o.feab=xn.lfeab_ax,!se.bIE&&Zu.ltsDebug&&(o.log=console.log),Dn.LTS&&Dn.LTS._)return Dn.LTS._.createLtsInstance(o);var a={},s=function(){return Promise.reject({code:Um.LtsJsLoadError,message:"The dynamsoft.lts.js load failed."})};return a.i=s,a.s=s,a.u=s,a.caret=s,a}xn.lgpd=function(e){return e==xn.EnumInstance.dwt_desktop?"dwt|dbr|ddv":"dwt|ddv"};var jm=!1;function Hm(e,r){return Gm.apply(this,arguments)}function Gm(){return Gm=p(d().m(function e(r,t){var n,i,o,a,s,u,c,l,f,h,g;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=null!=t?t:"",o=Lm(r),a=o.get_enumDeploymentType(),xn.lclex(),!o.get_ar()||!o.get_cu()){e.n=3;break}if(jm){e.n=2;break}return i=o.get_ltsInstance(Vm),e.n=1,i.ih();case 1:jm=!0;case 2:return e.a(2,Promise.resolve({ar:o.get_ar(),cu:o.get_cu()}));case 3:if((s={pd:xn.lgpd(r),v:Mm(),os:xn.lgcb(),fn:xn.DeviceFriendlyName||"",ls:Zu.licenseServer,sp:Zu.sessionPassword,l:jv.getLTSLicense(),mnet:function(){return o.get_maxExpiredTime()},mxet:function(){return o.get_minExpiredTime()},fol:xn.OnFirstOffline}).dt=o.get_deploymentType(),a!=xn.EnumInstance.dwt_desktop){e.n=5;break}if(""!=o.get_cu()){e.n=4;break}return ng(u={}),e.a(2,Promise.reject({code:u._errorCode,message:u._errorString}));case 4:s.lsu=o.get_cu(),e.n=6;break;case 5:a==xn.EnumInstance.dbr||(s.dwt=!0,""!=o.get_cu()&&(s.lsu=o.get_cu()),s.updl=function(e){o.set_ar(e.ar),o.get_cu()||o.set_cu(e.cu),xn.lsendUpdateEvt(a,n)});case 6:return e.p=6,i=o.get_ltsInstance(Vm),e.n=7,i.i(s);case 7:return c=e.v,o.get_ar()||o.set_ar(c.ar),o.get_cu()||o.set_cu(c.cu),e.a(2,c);case 8:throw e.p=8,g=e.v,o.clearData(),jr.isString(g)?(f=Jm(g),xn.lsetException(f,g,!0),l=xn.licenseException):(Qm(h={},g),l={code:h._errorCode,message:h._errorString}),l;case 9:return e.a(2)}},e,null,[[6,8]])})),Gm.apply(this,arguments)}function zm(){return Date.now()}function Km(e){var r=e?new Date(e):new Date,t="yyyy-MM-ddTHH:mm:ss.SSSZ",n={"M+":r.getUTCMonth()+1,"d+":r.getUTCDate(),"H+":r.getUTCHours(),"h+":r.getUTCHours()%12||12,"m+":r.getUTCMinutes(),"s+":r.getUTCSeconds(),"q+":Math.floor((r.getUTCMonth()+3)/3),"S+":r.getUTCMilliseconds()};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(r.getUTCFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("000"+n[i]).substr(("000"+n[i]).length-RegExp.$1.length)));return t}function Jm(e){var r=Um.NetworkError;return e.indexOf("timed out")>-1||e.indexOf("timeout")>-1?r=Um.Timedout:(e.indexOf("access-control-allow-origin")>-1||e.indexOf("cors")>-1)&&(r=Um.CorsError),r}function Qm(e,r){if(r){var t=r.code||r.ltsErrorCode,n=r.message;111==t||106==t||108==t?(sg(e,t),e._errorString=n):(e._errorCode=t,e._errorString=n),xn.lsetException(e._errorCode,e._errorString,!0)}}function qm(e,r){e.__licenseInfo=r}function Ym(e){var r=xn.licenseException;r.code=e.code,r.message=e.message,e&&Yc(e)}function Xm(e){return e==it.TokenExpired||e==it.TokenInvalid||e==it.TokenMissing||e==it.TokenServiceLock}function Zm(e){return e==nt.LicenseExpired||e==nt.LicenseExpiredForDLS||e==nt.LicenseNoCore||e==nt.LicenseNoCoreForDLS||e==nt.LicenseInvalid||e==nt.LicenseParseFailed||e==nt.LicenseIsFuture||e==nt.LicenseVersionNotCurrent||e==nt.LicenseBadDomain||e==nt.LicenseTrialFullMixed||e==nt.LicenseNoChrome||e==nt.LicenseNoFirefox||e==nt.LicenseNoIE||e==nt.LicenseNoEdge||e==nt.LicenseNoSafari||e==nt.LicenseBrowserNotMatched||e==nt.LicenseNotIncludeWindows||e==nt.LicenseNotIncludeMacOS||e==nt.LicenseNotIncludeLinux||e==nt.LicenseNotIncludeEmbed}function $m(e){return e==nt.LicenseExpired}function ep(e){var r=0,t=e.message;jr.isNumber(e.code)?r=e.code:jr.isString(t)&&(r=-1),0!=r&&function(e,r){jr.isFunction(Dn.OnLicenseError)&&Dn.OnLicenseError(r,e)}(r,t)}function rp(e){ep(bm(e))}xn.lglic=Hm,xn.lshow=function(){return{t:Em,t2:km,m:jr.stringify(Pm)}},xn.lgct=function(e){switch(e){case 0:return"3011";case 1:return"3012";case 2:return"3014";case 3:return"3013";case 4:return"3015";case 14:return"3016";case 3001:return"3001";case 3002:return"3002";case 3003:return"3003";case 3004:return"3004";case 3005:return"3005";case 3006:return"3006";case 3007:return"3007";case 3008:return"3008";case 3009:return"3009";case 5001:return"5001";case 4001:return"4001";case 4002:return"4002";case 4003:return"4003"}return""},xn.lcvrf=function(e){e&&(e._canConsume&&!e._canConsume()||setTimeout(function(){xn.lcvrf_(e)},1))},xn.lcvrf_=function(e){var r;r=xn.lgdt();var t,n=xn.DeviceFriendlyName||"",i=xn.lgcb(),o=Lm(r),a={hs:Rm(),og:Wm(),cu:o.get_cu(),fn:n,cw:"",os:i,v:Mm(),dt:o.get_deploymentType(),ed:"js"},s=function(e,r){var t,n,i=0;if(jr.isString(e)&&""!=e&&"{}"!=e&&r&&jr.isArray(r)&&!(r.length<1)){if(n=Lm(r[0]),t=jr.parse(e),xn.lclex(),0==km){var o=zm(),a="";km=o,Em=Km(o),Pm={},i=0,jr.each(t,function(e,r){(r<i||0==i)&&(i=r,a=e)}),i>0&&n.get_ltsInstance(Vm).s(Zu.licenseServer,a,i,!0).then(function(){},function(e){})}jr.each(t,function(e,r){var t=!1,o=parseInt(r);o>0&&o!=i&&(o+18e4<zm()&&(t=!0),n.get_ltsInstance(Vm).s(Zu.licenseServer,e,r,t).then(function(){},function(e){}))})}};if(a.pd=xn.lgpd(r),t=jr.stringify(a),!e._bAx){var u="GetBuffer",c=hm(jr.replaceAll(t,'"','\\"')),l={cmd:u,cmdId:mm(),sFun:s,fFun:function(){},params:[r]};return e._innerSendByWS(u,c,l,null,!0)}s(e.GetBuffer(t),[r,""])},xn.lavrf=function(e,r,t,n){var i=1;if(""!=e){r>1&&(i=r);var o=zm();if(km>0&&km+18e4<o){Dm?(Pm={},xn.lavrf__unload()):xn.lavrf__(!0,t,n);var a=zm()+1;km=a,Em=Km(a),Pm={}}Fm=!0,Dm=!1,Pm[e]?Pm[e]+=i:Pm[e]=i,0==km&&xn.lavrf__(!0,t,n)}},xn.lavrf_=function(e,r,t){if(Fm){var n=1;e&&(n=e),setTimeout(function(){xn.lavrf__(!1,r,t)},n)}},xn.lavrf__=function(e,r,t){var n,i,o,a=zm(),s=!1,u=!!e,c=0,l=r;jr.isUndefined(l)&&(l=xn.lgdt()),o=Lm(l),Fm=!1,0==km&&(s=!0,km=a,Em=Km(a)),n=km,i=Em;var f={};f.ut=i;var d={};if(jr.each(Pm,function(e,r){d[r]=e,e>0&&c++}),f.cts=d,u||n+18e4<a){u=!0;var h=zm()+1;if(km=h,Em=Km(h),Pm={},Dm=!1,0==c)return}else{if(0==c)return;Dm=!0}f.dur=s?1:180;var g,v=xn.DeviceFriendlyName||"",m=xn.lgcb(),p={hs:Rm(),og:Wm(),cu:o.get_cu(),fn:v,cw:"",os:m,v:Mm(),dt:o.get_deploymentType(),ed:"js",rcs:[f]};p.product=xn.lgpd(r),g=jr.stringify(p),Zu.ltsDebug&&Km(),xn.lclex(),o.get_ltsInstance(Vm).s(Zu.licenseServer,g,""+n,u).then(function(){},function(e){})},xn.lavrf__unload=p(d().m(function _K(){var e,r,t,n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(e=zm(),r=!0,n=!1,i=Lm(xn.lgdt()),o=Lm(xn.EnumInstance.dbr),Fm=!1,0==km&&(km=e,Em=Km(e)),t=km,a=zm()+1,km=a,Em=Km(a),Pm={},Dm=!1,t+=1,xn.lclex(),!i.inited_ltsInstance()){s.n=4;break}return s.p=1,s.n=2,i.get_ltsInstance(Vm).s(Zu.licenseServer,n,""+t,r);case 2:s.n=4;break;case 3:s.p=3,s.v;case 4:if(!o.inited_ltsInstance()){s.n=8;break}return s.p=5,s.n=6,o.get_ltsInstance(Vm).s(Zu.licenseServer,n,""+t,r);case 6:s.n=8;break;case 7:s.p=7,s.v;case 8:return s.a(2)}},_K,null,[[5,7],[1,3]])})),xn.lclex=function(){var e=xn.licenseException;e.code=0,e.message="",e.httpResponse="",e.fromLTS=!1},xn.li=function(e,r){var t;if(e.axInstance&&(xn.axInstance=e.axInstance,xn.axInstance))return t=xn.axInstance.GetUUID(),Zu.ltsDebug&&jr.log("ActiveX cu: "+t),Lm(e.instanceMode).set_cu(t),t;return Lm(e.instanceMode).get_cu()},xn.lfeab_ax=function(e){return new Promise(function(r,t){var n="";if(xn.axInstance)try{n=xn.axInstance.Encrypt(e,0)}catch(_H){}r(n)})},xn.lfeab_wasm=function(e){return Promise.resolve("")},xn.lwsproc=function(e,r){"GetBuffer"==e.method?r.sFun&&e.result.length>0?r.sFun(e.result[0],r.params):r.sFun("",r.params):r.sFun&&r.sFun(e)},xn.lsexp=function(e,r,t){var n,i=r;if(3==(n=(i=jr.replaceAll(i,"/","-")).split("-")).length){var o=n[0],a=n[1],s=n[2];a.length<2&&(a=(a="00"+a).substr(a.length-2)),s.length<2&&(s=(s="00"+s).substr(s.length-2)),i=[o,a,s].join("-")}var u=[i,"T23:59:59.999Z"].join("");Lm(e).set_minExpiredTime(u),Lm(e).set_maxExpiredTime(u)},xn.lunload=p(d().m(function yK(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,xn.lavrf__unload();case 1:km=0,Em=jr.nil,Pm={},Dm=!1,Fm=!1,xm=!1,Om=!1,Nm=!1,xn.lclex(),xn.bLTSOnline=!0,xn.axInstance=jr.nil,xn.lOnUpdateDWObj=[];case 2:return e.a(2)}},yK)})),xn.lcexp=function(e,r){return Lm(e).get_ltsInstance(Vm).caret().then(function(){return!1},function(e){var r=xn.licenseException,t="";return e instanceof Error||"message"in e?t=e.message:jr.isString(e)&&(t=e),xn.lsetException(Um.Expired,t,!1),Om||(Om=!0,jr.error(t),Dn.OnLTSLicenseError&&Dn.OnLTSLicenseError(jv.getPublicLicenseContent(r.message),r.code)),!0})},xn.OnLicenseException=function(){var e=xn.licenseException,r=e.message;if(jr.isString(r)&&(r.indexOf("Error Code")>-1?r=jr.replaceAll(r,"Error Code","error code"):r.indexOf("Error code")>-1&&(r=jr.replaceAll(r,"Error code","error code"))),r.indexOf("(https://www.dynamsoft.com/purchase-center/)")>-1&&(r=r.replace("(https://www.dynamsoft.com/purchase-center/)","(https://www.dynamsoft.com/store/dynamic-web-twain/)"),e.message=r),r.indexOf("error code:")>-1){var t=r.substr(0,r.indexOf("message")),n=r.substr(r.indexOf("message"));t.indexOf("{")>-1&&(t=t.substr(t.indexOf("{")+1)),n.indexOf("}")>-1&&(n=n.substr(0,n.indexOf("}"))),t=jr.replaceAll(t,"error code:",""),n=jr.replaceAll(n,"message: ",""),xn.lsetException(parseInt(t),n,!0),jr.error(n),Dn.OnLTSLicenseError&&Dn.OnLTSLicenseError(jv.getPublicLicenseContent(r),e.code)}else{if(!e.code){var i=Jm(r);xn.lsetException(i,r,!0)}if(jr.error(e.message),e.code==Um.LtsJsLoadError)return;Dn.OnLTSLicenseError&&Dn.OnLTSLicenseError(jv.getPublicLicenseContent(e.message),e.code)}},xn.lol=function(){return xn.bLTSOnline},xn.OnFirstOffline=function(e){xn.bLTSOnline=!1},xn.lpubdlg=function(e,r){if(jr.isString(e)&&""!=e){if(e=jr.atob(e),console&&console.warn&&!xm&&Zu.bUseDynamsoftLicenseManager,1==r)return xm||Zu.bUseDynamsoftLicenseManager||(xm=!0,Dn.OnLTSPublicLicenseWarning&&Dn.OnLTSPublicLicenseWarning(jv.getPublicLicenseContent(e))),!0;2==r&&(xm||(xm=!0))}return!1},xn.lcheckLic=function(e,r,t){var n=!1;if(r){if(jr.isArray(r.Detail)&&r.Detail.length>0){var i=r.Detail[0].ExpireDate;return xn.lsexp(e,i,t),xn.lcexp(e,t).then(function(e){var t=!1;e?t=!0:1!=r.Trial&&2!=r.Trial||(t=xn.lpubdlg(r.Message,r.Trial)),t||xn.bLTSOnline||Nm||(Nm=!0,Dn.OnLTSConnectionWarning&&Dn.OnLTSConnectionWarning())})}1!=r.Trial&&2!=r.Trial||(n=xn.lpubdlg(r.Message,r.Trial))}return n||xn.bLTSOnline||Nm||(Nm=!0,Dn.OnLTSConnectionWarning&&Dn.OnLTSConnectionWarning()),Promise.resolve()},xn.lisValidID=function(e){if(jr.isString(e)&&""!=e)return!0;var r,t=xn.licenseException;return xn.lsetException(Um.UUIDError,"Failed to generate an ID for your device to license it: not enough permission.",!0),jr.error(t.message),r=t.message,Dn.OnLTSLicenseError&&Dn.OnLTSLicenseError(r,t.code),!1},xn.lsetException=function(e,r,t){var n=xn.licenseException;n.code=e,n.message=r,t?n.fromLTS=!0:t in n&&delete n.fromLTS},xn.lgcuid=function(e){var r=xn.li({instanceMode:e},"");return r?Promise.resolve(r):Lm(e).get_ltsInstance(Vm).u().then(function(e){return xn.lsmid(e,""),xn.lsmid2b(e),e})},xn.lts_unload=function(){xn._dbrLicense.clearData(),xn._dbrLicense=null,xn._dwtDLicense.clearData(),xn._dwtDLicense=null};var tp=S(function SK(){_(this,SK),this.server="",this.normal=!0});function np(e){var r=new tp;return r.server=e.server,r.normal=!0,e.attrs&&(r.attrs=jr.clone(e.attrs)),r}var ip=function(){return S(function t(e){if(_(this,t),this._id=e.id,this._clientId=jr.getRandom(),this._uuidForActiveUI=undefined,this._bReady=!1,this._destroy=!1,this._bMustUpgradeService=!1,this._wsClient=undefined,this._wsRetry=0,this._wsFailedTimes=0,this._bConnecting=!1,this._bNoMask=!1,this._bNotShowMessage=!1,this.__serverPlatform=rt.enumWindow,this.__productKey="",this.__licenseInfo=null,this._reconnectTimeSpan=xc.RemoteReconnectTimeSpan,this._reconnectShortSpan=300,this._reconnectShortSpanTimes=5,this._bIfShowProgressBar=!0,this.__IfShowCancelDialogWhenImageTransfer=!0,this._bLicenseErrorDispose=!0,this.__bServerOnPostLoadFired=!1,e.dmService){var r,n,i,o,a,s,u=np(e.dmService),c="/",l="";n=u.server;var f=new ra(e.dmService.server),d=f.scheme,h=f.hostname;d&&(d=d.toLowerCase()),"https"==d?(r=!0,i=n.substring(8)):"http"==d?(r=!1,i=n.substring(7)):"wss"==d?(r=!0,i=n,n=jr.replaceAll(n,"wss://","")):"ws"==d?(r=!1,i=n,n=jr.replaceAll(n,"ws://","")):(i=n,n=(r=Ks(h))?"https://"+n:"http://"+n),this._bSSL=r,oc(h||f.scheme)?this._bRemoteMode=!1:this._bRemoteMode=!0,jr.endsWith(n,"/")&&(c="");var g=u.attrs;if(g){var v,m;o=(null===(v=g)||void 0===v?void 0:v.UUID)||"";var p=(null===(m=g.modules)||void 0===m?void 0:m.length)||0;if(""!=o&&p>0){var y;if(r?p>1&&p>1+(y=g.modules[1])+2&&(a=g.modules[1+y+2]):p>2&&(a=g.modules[2]),jr.endsWith(a,"/")&&(c=""),l=[o,"/",a,"/"].join(""),p>=12)for(var S=js.getDWTPrefix()+Md,I=11;I<p;I++){var b=g.modules[I];if(jr.isString(b)&&0==b.indexOf(S)){this._dmServiceDWTVersion=b;break}}}}else g={UUID:"",service_type:Yt.ST_DYNAMSOFT_SERVICE};s=[n,c,l].join(""),g.url=s,this._serverInfo=new ts([i,c,l].join(""),undefined,r,!0,js.wsProtocol),this._httpUrl=s,this._dmService=u}else{var C,T,w=e.port,A=e.sslPort;T=Ks(C=e.host?e.host:ym()),this._bSSL=T,oc(C)?this._bRemoteMode=!1:this._bRemoteMode=!0,w||(w=xn.Port),A||(A=xn.SSLPort),this._serverInfo=new ts(C,T?A:w,T,!0,js.wsProtocol),this._httpUrl=function(e){var r=e.server||js.getDWTHost();if(jr.startsWith(r,vu)||jr.startsWith(r,gu))return r;var t=e.ssl?pu:mu;return"".concat(t).concat(r,":").concat(e.port,"/")}(this._serverInfo),this._dmService={server:this._httpUrl,attrs:{url:this._httpUrl,UUID:"",service_type:Yt.ST_DYNAMSOFT_SERVICE},normal:!0}}this._dmServiceDWTVersion||(this._dmServiceDWTVersion=[js.getDWTPrefix(),Qu.getServerVersionInfo()].join(""))},[{key:"_resetErr",value:function(){this._errorCode=0,this._errorString="",this._errorCause=null,this.__bServerOnPostLoadFired=!1;var e=xn.licenseException;e.code=0,e.message=""}},{key:"dispose",value:(r=p(d().m(function n(){return d().w(function(e){for(;;)switch(e.n){case 0:this.__unload();case 1:return e.a(2)}},n,this)})),function(){return r.apply(this,arguments)})},{key:"__unload",value:(e=p(d().m(function i(){return d().w(function(e){for(;;)switch(e.n){case 0:this._bReady=!1,this._destroy=!0;case 1:return e.a(2)}},i,this)})),function(){return e.apply(this,arguments)})},{key:"isDestroy",get:function(){return this._destroy}}]);var e,r}(),op=S(function IK(){_(this,IK),I(this,"name",""),I(this,"displayName",""),I(this,"deviceType",Kt)});function ap(e,r){var t,n=[],i=r;if(jr.isString(i)&&(i=jr.parse(i)),jr.isArray(i))for(t=0;t<i.length;t++){var o=lp(i[t]);n.push(o)}for(t=0;t<n.length;t++){var a=n[t],s=a.deviceType;a.name&&(a.name=jr.base64.decode(a.name)),s&zt&&a.deviceInfo&&cp(a.deviceInfo),a.serviceInfo=null==e?void 0:e._dmService,up(a,null==e?void 0:e._dmService),jr.isBoolean(a.isSystemDefaultPrinter)||(a.isSystemDefaultPrinter=!1)}return n}function sp(e,r){return function(e,r){var t=r.deviceType;r.name&&(r.name=jr.base64.decode(r.name));t&zt&&r.deviceInfo&&cp(r.deviceInfo);r.serviceInfo=null==e?void 0:e._dmService,up(r,null==e?void 0:e._dmService),jr.isBoolean(r.isSystemDefaultPrinter)||(r.isSystemDefaultPrinter=!1);return r}(e,jr.parse(r))}function up(e,r){var t,n=e.name,i="",o=e.deviceType;o==Gt.TWAINSCANNER?t="":o==Gt.TWAINX64SCANNER?t="Twain64-":o==Gt.WIASCANNER?t="WIA-":o==Gt.WIATWAINSCANNER?(n=jr.replaceAll(n,"WIA-",""),t="WIATWAIN-"):t=o==Gt.ICASCANNER?"ICA-":o==Gt.SANESCANNER?"Sane-":o==Gt.ESCLSCANNER?"eSCL-":(Gt.WIFIDIRECTSCANNER,""),r&&r.attrs&&r.attrs.ty&&(i=" on ["+r.attrs.ty+"]"),e.displayName=[t,n,i].join("")}function cp(e){if(e.ProductName){var r=e.ProductName;e.ProductName=jr.base64.decode(r)}if(e.ProductFamily){var t=e.ProductFamily;e.ProductFamily=jr.base64.decode(t)}if(e.Manufacturer){var n=e.Manufacturer;e.Manufacturer=jr.base64.decode(n)}if(e.Version&&e.Version.Info){var i=e.Version.Info;e.Version.Info=jr.base64.decode(i)}}function lp(e){var r=new op;return r.strDevice=jr.stringify(e),e.deviceInfo&&(r.deviceInfo=jr.clone(e.deviceInfo)),e.deviceType&&(r.deviceType=jr.clone(e.deviceType)),e.displayName&&(r.displayName=jr.clone(e.displayName)),e.name&&(r.name=jr.clone(e.name)),e.serviceInfo&&(r.serviceInfo=np(e.serviceInfo)),jr.isBoolean(e.isSystemDefaultPrinter)?r.isSystemDefaultPrinter=e.isSystemDefaultPrinter:r.isSystemDefaultPrinter=!1,r}On.removeNonPrintableChar;var fp=new WeakSet,dp=function(e){function r(e){var t;return _(this,r),g(t=s(this,r,[e]),fp),t._acquireDivEL=null,t.__serverId="",t.__bAcquireImageNow=!1,t._blts=Mc(),t._bltsCopyImage=!1,t._b64bit=$u.b64bit,t._logLevel=0,t._bServerAlwaysFocusOnPopupWindow=!0,t._bPageFocus=!0,t.__bOpenFileNow=!1,t._bScanForProxyRemote=!1,t._loadImageBytesFileCount=0,t._evt_ids=[],t.__bLoadingImage=!1,t}return l(r,e),S(r,[{key:"_isValid",value:function(){return!this._destroy||(Pg(this),!1)}},{key:"_connnect",value:(F=p(d().m(function D(){var e;return d().w(function(r){for(;;)if(0===r.n)return e=this,r.a(2,new Promise(function(r,t){Dl(e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,r,t)}))},D,this)})),function(){return F.apply(this,arguments)})},{key:"_waitForConnect",value:function(){var e=this;return e._wsRetry=0,e._bReady?Promise.resolve():new Promise(function(r,t){e._wsCheckResolve=r,e._wsCheckReject=t,_p(e)})}},{key:"_getWSCallback",value:function(){return yp}},{key:"_getWSContextData",value:function(){return{}}},{key:"_additionalWSCallback",value:function(e,r,t,n){"ConvertToBlob"==e&&r._blob_callbacks.push(function(e){return t(e,Vo.HANDLE_RAW_MESSAGE,"0",n)})}},{key:"_innerSendBlobByWS",value:function(e,r,t,n,i){var o={cmd:e,cmdId:mm(),sFun:function(e){jr.isFunction(n)&&n(e)},fFun:i,contextData:{document:t.currentFileName,tag:t.currentTagName,bNeedClearTag:t.bNeedClearCurrentTagName,index:t.index,bNeedRefresh:"UpdateImage"==e},rawData:!0};return this._innerSendByWS(e,r,o,t,!0)}},{key:"_innerSendByWS",value:function(e,r,t,n,i){var o,a,s,u,c=this,l=this._getWSCallback();t&&t.cmdId?(o=t.cmdId,s=pp(c._clientId,o),u=pp(c._clientId,""),this._evt_ids.push(s)):(o=0,s=0,u=0);var f=mp(c._clientId,e,r,o,c._bScanForProxyRemote?c._dmServiceDWTVersion:""),d=c._wsClient;a={client:d,userData:{stwain:c,command:t},taskId:o,eventTaskId:s,lastEventTaskId:u};var h,g,v,m,p,_,y,S,I=0;if(!i){var b;try{b=d.request(f,l,a)}catch(hH){jr.log(hH),b=Promise.reject(hH)}return b}if(v=new ArrayBuffer(12),n)if(n instanceof Blob)I=n.size;else if(n instanceof ArrayBuffer||n instanceof Uint8Array)I=n.byteLength;else if(n instanceof Array)I=n.length;else{var C=n;I=C.size||C.byteLength||C.length}for(g=(h=(y=new Blob([f])).size)+I,m=new DataView(v),_=0;_<8&&g;_++)m.setUint8(_,g%256),g=Math.floor(g/256);for(_=0;_<4&&h;_++)m.setUint8(8+_,h%256),h=Math.floor(h/256);return p=new Blob([v,y]),S=d.request(p,l,a),this._additionalWSCallback(e,d,l,a),I>0&&(S=d.request(n,l,a)),v=null,y=null,p=null,m=null,n=null,S}},{key:"_sendDataConnectWithSocket",value:function(e,r,t,n){var i=this;return new Promise(function(t,o){i._sendData(e,r,!0,function(e){var r=!1;try{r=jr.isString(e)?jr.parse(e):e}catch(hH){}if(i._resetErr(),r){if(r instanceof Blob||gm(r))return void t(r);Cm(r)&&(i._errorCode=r.exception,i._errorString=r.description,i._errorCause=Tm(r))}t(n?r:r.result)},function(e){o({code:i._errorCode,message:i._getErrorString()})})})}},{key:"_sendDataByHttpAsync",value:function(e,t,n,i,o){var a,s,u=this;if("SendEventToScannerUI"!=e&&u._resetErr(),!u._isValid())return Promise.reject({code:u._errorCode,message:u._getErrorString()});if(r.isServerInvalid(u))return o?Promise.reject({code:u._errorCode,message:u._getErrorString()}):u._waitForConnect().then(function(){return u._sendDataByHttpAsync(e,t,n)});if(xn.ConnectWithSocket)return u._sendDataConnectWithSocket(e,t,n,i);s={method:"post",async:!0,body:mp(u._clientId,e,t,0,u._bScanForProxyRemote?u._dmServiceDWTVersion:""),dataType:null!=n?n:"text"};var c=null!==(a=xn.Token)&&void 0!==a?a:"";c&&(s.headers={Authorization:"Bearer ".concat(c)});var l=null,f=jr.guid();return u._bIfShowProgressBar&&(l=On.progressContext),ba(l,f)([u._httpUrl,"fa/",e].join(""),s).then(function(r){var t=!1;try{t=jr.isString(r)?jr.parse(r):r}catch(hH){}if(t){if(t instanceof Blob||gm(t))return t;if(!Cm(t))return"SendEventToScannerUI"!=e&&u._resetErr(),i?t:t.result;u._errorCode=t.exception,u._errorString=t.description,u._errorCause=Tm(t)}else Jh(u),u._errorCause=null;throw{code:u._errorCode,message:u._getErrorString()}},function(e){if(u._errorCode=e.code,u._errorString=e.message,!On.page.bUnload)throw e})}},{key:"_sendData",value:function(e,t,n,i,o){var a,s=this,u=undefined,c=undefined,l=!1,f=!0;if(s._destroy)return Promise.resolve();if("ActiveUI"==e?f=!1:l=r.isServerInvalid(s),l)return s._waitForConnect().then(function(){s._sendData(e,t,n,i,o)})["catch"](function(e){jr.isFunction(o)&&o(e.code,e.message)});jr.isFunction(i)&&(c=i),jr.isFunction(o)&&(u=o),a="ConvertToBlob"==e||"Heartbeat"==e?0:mm();var d=this._getWSContextData(),h={cmd:e,cmdId:a,sFun:c,fFun:u,contextData:d,rawData:null!=n&&n};return s._innerSendByWS(e,t,h,undefined,f)}},{key:"_innerFunV2",value:(P=p(d().m(function x(e,r,t){var n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if(n=this,!(o=t)&&!jr.isUndefined(o)){a.n=2;break}return a.n=1,n._sendDataConnectWithSocket(e,r,"json",!0);case 1:i=a.v,a.n=4;break;case 2:return a.n=3,n._sendDataByHttpAsync(e,r,"json",!0);case 3:i=a.v;case 4:if(!(i&&jr.isArray(i)&&i.length>0)){a.n=5;break}return a.a(2,i[0]);case 5:if(!(i&&jr.isArray(i.result)&&i.result.length>0)){a.n=6;break}return a.a(2,i.result[0]);case 6:return a.a(2,i)}},x,this)})),function(e,r,t){return P.apply(this,arguments)})},{key:"_OnReady",value:(k=p(d().m(function O(){var e,r,t,n,i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:if((i=this)._wsRetry=0,i._wsFailedTimes=0,On.detect.starting=!1,i._bRemoteMode||(On.detect.bOK=!0),null!==i._wsClient){s.n=1;break}return s.a(2);case 1:if(null!==(o=null===(e=i._wsClient)||void 0===e?void 0:e.ws)&&o!==undefined){s.n=2;break}return s.a(2);case 2:i._bReady=!0,o.onopen=null,a=pp(i._clientId,""),this._evt_ids.push(a),null===(r=i._wsClient)||void 0===r||r.addEvent("close",i._clientId,function(e){e&&jr.log("websocket close: "+e),i.__bAcquireImageNow=!1,i._OnWSClose(e)}),null===(t=i._wsClient)||void 0===t||t.addEvent("error",i._clientId,function(e){e&&jr.log("websocket error: "+e),i.__bAcquireImageNow=!1,i._OnWSError(e)}),null===(n=i._wsClient)||void 0===n||n.addEvent("timeout",i._clientId,function(e){e&&jr.log("websocket timeout: "+e),i._OnWSTimeout(e)});case 3:return s.a(2)}},O,this)})),function(){return k.apply(this,arguments)})},{key:"getServiceInfo",value:function(){return this._dmService}},{key:"_OnWSClose",value:function(e){var t,n,i,o,a=this;(a._bReady=!1,a._wsRetry=0,a._bRemoteMode)&&(t=null!==(n=null===(i=a.getServiceInfo())||void 0===i||null===(i=i.attrs)||void 0===i?void 0:i.name)&&void 0!==n?n:"");jg(a,t),a.__closeRemoteScanUI(!0),a._heartBeatTimer&&(clearTimeout(a._heartBeatTimer),a._heartBeatTimer=null),a._bNoMask||(o="websocket close",jr.log("hideMask:"+o+"--"+Gl),Hl(),Gl=0),a.__OnWSClose&&a.__OnWSClose();var s=a._bRemoteMode?xc.RemoteReconnectMaxTimes:xc.LocalReconnectMaxTimes;if(a._wsFailedTimes<s){var u=a._reconnectTimeSpan;a._wsFailedTimes<a._reconnectShortSpanTimes&&(u=a._reconnectShortSpan),a._heartBeatTimer=setTimeout(function(){r.startDWTReconnect(a)},u)}}},{key:"_OnWSError",value:function(e){var r=this;r._bReady=!1,r.__OnWSError&&r.__OnWSError()}},{key:"_OnWSTimeout",value:function(e){var t,n,i,o=this;(o._bReady=!1,o._wsRetry=0,o._bRemoteMode)&&(t=null!==(n=null===(i=o.getServiceInfo())||void 0===i||null===(i=i.attrs)||void 0===i?void 0:i.name)&&void 0!==n?n:"");jg(o,t),o.__closeRemoteScanUI(!0),o._heartBeatTimer&&(clearTimeout(o._heartBeatTimer),o._heartBeatTimer=null);var a=o._bRemoteMode?xc.RemoteReconnectMaxTimes:xc.LocalReconnectMaxTimes;if(o._wsFailedTimes<a){var s=o._reconnectTimeSpan;o._wsFailedTimes<o._reconnectShortSpanTimes&&(s=o._reconnectShortSpan),o._heartBeatTimer=setTimeout(function(){r.startDWTReconnect(o)},s)}}},{key:"__OnRecieveMsg",value:function(e,r){if(e.event)return this._handleEvent(e,r.contextData);this.__OnRecieveMsg_Method(e,r)}},{key:"__OnRecieveMsg_Method",value:function(e,r){var t=this;if(Cm(e)?(t._errorCode=e.exception,t._errorString=e.description,t._errorCause=Tm(e)):(t._errorCode=0,t._errorString="",t._errorCause=null),xn.ConnectWithSocket){var n=e,i=null==r?void 0:r.cmd;return"ActiveUI"==i||"VersionInfo"==i||"ConvertToBase64"==i||"SaveSelectedImagesToBase64Binary"==i||"ConvertToBlob"==i?r.sFun&&jr.isArray(e.result)&&e.result.length>0?(r.sFun(e.result),!0):(r.fFun&&r.fFun(e.result),!1):(0!=t._errorCode&&r.fFun&&r.fFun(t._errorString),"BeginSaveMem"==i||"CreateLocalStorage"==i||"LocalStorageExist"==i||"SaveToLocalStorage"==i||"LoadFromLocalStorage"==i||"RemoveLocalStorage"==i?r.sFun&&jr.isArray(e.result)&&e.result.length>0?(r.sFun(e.result),!0):(r.fFun&&r.fFun(e.result),!1):(n=r.rawData?e:jr.isArray(e.result)&&e.result.length>0?e.result[0]:e.result,r.sFun?r.sFun(n):r.fFun&&r.fFun(n),e=null,!0))}if(0==t._errorCode)return r.sFun&&jr.isArray(e.result)&&e.result.length>0?(r.sFun(e.result),!0):(r.fFun&&r.fFun(e.result),!0);var o=!1;r.fFun&&(o=r.fFun(t._errorString)),!o&&e.exception&&e.exception<0&&-2115!=e.exception&&jr.isFunction(t.__OnPrintMsg)&&t.__OnPrintMsg(t._errorString)}},{key:"_handleOnBitmapChangedEvent",value:function(e,r){try{var t,n,i,o,a,s,u,c,l,f,d,h,g,v,m,p,_=e.result[0],y=e.result[1];if(jr.isString(y)){var S=JSON.parse(y);t=jr.isArray(S)?S:[S]}else jr.isArray(y)&&(t=y);if(jr.isArray(t))for(p=r||{},v=0;v<t.length;v++)if(m=t[v],jr.isArray(m.images))if(n=m.consumeType,i=m.curImageId,o=m.type,a=m.images.length,o!=Zt.enumBCAppend&&o!=Zt.enumBCInsert||(!p.document&&m.document&&(p.document=m.document),!p.tag&&m.tag&&(p.tag=m.tag)),o==Zt.enumBCRemove){var I=[];for(s=0;s<a;s++)I.push(m.images[s].id);var b=[_,I.join(","),o,i,a,null,null,null,null,null,null,c];this._OnBitmapChanged(b,e,p)}else for(s=0;s<a;s++){u=m.images[s].id,f=m.images[s].width,d=m.images[s].height,l=m.images[s].depth,h=m.images[s].xdpi,g=m.images[s].ydpi,c=m.images[s].uid;var C=[_,u.toString(),o,i,a,f,d,l,h,g,n,c];this._OnBitmapChanged(C,e,p)}}catch(T){jr.error(T)}return!0}},{key:"_handleEvent",value:function(e,r){var t=this,n=e.result[0],i=!1;return"OnBitmapChanged"==e.event?t._handleOnBitmapChangedEvent(e,r):(jr.each(Cp,function(r,n){if(e.event===r){var o=["_",r].join("");return i=!0,jr.isFunction(t[o])&&t[o](e.result,e),!1}}),i?(jr.log("handled event:"+e.event),jr.each(Tp,function(r,i){if(e.event===r)return jr.log("sendback event:"+e.event),t._innerSendByWS(e.event,hm(n),undefined,undefined,!0),!1})):(jr.each(On.Addon_Events,function(r,n){if(e.event===r){var o=["_",r].join("");return i=!0,jr.isFunction(t[o])&&t[o](e.result),!1}}),i&&(jr.log("handled addon event:"+e.event),jr.each(On.Addon_Sendback_Events,function(r,i){if(e.event===r)return jr.log("sendback addon event:"+e.event),t._innerSendByWS(e.event,hm(n),undefined,undefined,!0),!1}))),i)}},{key:"_setProductKeyAsync",value:function(e){var r=this,t=e;return r._resetErr(),r._isValid()?Zu.bUseDynamsoftLicenseManager||r._blts?(vv(r),Promise.reject({code:r._errorCode,message:r._getErrorString()})):jr.isString(t)&&(Rc(t)||Wc(t))?v(fp,r,hp).call(r,t).then(function(e){var t=e;if(!t||t.message)throw t&&t.code&&t.message?(r._errorCode=t.code,r._errorString=t.message):(ng(r),t&&t.message&&(r._errorString=t.message)),{code:r._errorCode,message:r._getErrorString()};return"ErrorCode"in t&&0!=t.ErrorCode&&(r._errorCode=t.ErrorCode,"ErrorString"in t&&(r._errorString=t.ErrorString)),qm(r,t),t}):(ng(r),Promise.reject({code:r._errorCode,message:r._getErrorString()})):Promise.reject({code:r._errorCode,message:r._getErrorString()})}},{key:"_setLTSLic",value:function(e){var r=this,t=e;return r._resetErr(),!!r._isValid()&&(jr.isString(t)?r._sendDataByHttpAsync("LTSLicense",hm(t),null,!0).then(function(e){if(e){if(Cm(e))throw r._errorCode=e.exception,r._errorString=e.description,r._errorCause=Tm(e),{code:r._errorCode,message:r._getErrorString(),ErrorCause:r._errorCause};return r._innerFunV2("GetLicenseInfo",hm(2))}throw ng(r),{code:r._errorCode,message:r._getErrorString()}}):(ng(r),Promise.reject({code:r._errorCode,message:r._getErrorString()})))}},{key:"_setLTSLicenseAsync",value:function(e){var r=this;return r._resetErr(),r._isValid()?jr.isString(e)?r._setLTSLic(e).then(function(e){var t=e;if(!t||t.message)throw t&&t.code&&t.message?(r._errorCode=t.code,r._errorString=t.message):(ng(r),t&&t.message&&(r._errorString=t.message)),{code:r._errorCode,message:r._getErrorString()};return qm(r,t),r.__licenseInfo&&(r.__licenseInfo.LTS=!0),t}):(ng(r),Promise.reject({code:r._errorCode,message:r._getErrorString()})):Promise.reject({code:r._errorCode,message:r._getErrorString()})}},{key:"_innerActiveUI",value:(E=p(d().m(function N(e){var r,t,n,i,o,a,s;return d().w(function(u){for(;;)switch(u.n){case 0:return t=this._bSSL,n=Sm(),this._bRemoteMode||(n=5),i="",this._blts&&(i=null!=e?e:""),o=this,a=null!==(r=xn.Token)&&void 0!==r?r:"",u.n=1,new Promise(function(e,r){o._sendData("ActiveUI",hm(Yv.WSVersion,Yv.WSSession,1,i,t,1,n,a),!1,e,r)});case 1:return s=u.v,u.a(2,s)}},N,this)})),function(e){return E.apply(this,arguments)})},{key:"_reconnected",value:(A=p(d().m(function R(e){var t,n,i,o,a,s,u,c;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return(t=this)._wsFailedTimes=0,e.n=1,t._innerActiveUI(t._uuidForActiveUI);case 1:if(n=e.v,i=!1,n&&jr.isArray(n)&&(n.length>12?(t.__serverId=n[1],t.__serviceMode=n[11],i=n[12]):n.length>8?(t.__serverId=n[1],i=n[8]):n.length>=2&&(t.__serverId=n[1])),t._bReady=!0,t._bRemoteMode||(On.detect.bOK=!0),On.detect.starting=!1,i){try{t._OnActiveUIClearBuffer()}catch(l){t._resetErr()}Hg(t)}if(e.p=2,!t._blts){e.n=5;break}return o=t._bRemoteMode&&null!==(a=null===(s=t._dmService)||void 0===s||null===(s=s.attrs)||void 0===s?void 0:s.UUID)&&void 0!==a?a:"",e.n=3,Hm(xn.lgdt(),o);case 3:return u=e.v,e.n=4,t._setLTSLicenseAsync(u.ar);case 4:e.n=6;break;case 5:return c=Zu.refProductKey,e.n=6,t._setProductKeyAsync(c);case 6:return e.n=7,t._OnReconnected();case 7:e.n=9;break;case 8:throw e.p=8,e.v,t._bRemoteMode&&sg(t),{code:t._errorCode,message:t._errorString};case 9:return e.p=9,r.startHeartBeat(t),e.f(9);case 10:return e.a(2)}},R,this,[[2,8,9,10]])})),function(e){return A.apply(this,arguments)})},{key:"_OnReconnected",value:(w=p(d().m(function W(){return d().w(function(e){for(;;)if(0===e.n)return e.a(2)},W)})),function(){return w.apply(this,arguments)})},{key:"_initRemoteDiv",value:function(){if(!this._acquireDivEL){var e=document.createElement("div");e.style.position="fixed",e.style.zIndex="510000",e.style.left="0",e.style.top="0";var r=document.createElement("img");r.className="ds-img-screen",e.appendChild(r),document.body.appendChild(e),this._acquireDivEL=e}}},{key:"getHeartBeatData",value:function(e){var r,t=this,n=mp(t._clientId,e.cmd,null,e.cmdId,t._bScanForProxyRemote?t._dmServiceDWTVersion:""),i=n.length,o=i,a=new ArrayBuffer(12+o),s=new DataView(a);for(r=0;r<8&&o;r++)s.setUint8(r,o%256),o=Math.floor(o/256);for(r=0;r<4&&i;r++)s.setUint8(8+r,i%256),i=Math.floor(i/256);for(r=0;r<n.length;r++)s.setUint8(12+r,n.charCodeAt(r));return a}},{key:"__closeRemoteScanUI",value:function(e){var r=this;if(r._acquireDivEL){var t=jr.sizzle(".ds-img-screen");r._acquireDivEL.evtFun?(t&&t.length>0&&jr.removeEventListener(t[0],"mouseup",r._acquireDivEL.evtFun),r._acquireDivEL.evtFun=null):t&&t.length>0&&jr.removeEventListener(t[0],"mouseup"),t&&t.length>0&&(t[0].src=""),e&&(document.body.removeChild(r._acquireDivEL),r._acquireDivEL=null)}}},{key:"_removeImageByIdAsync",value:(T=p(d().m(function M(e){var r;return d().w(function(t){for(;;)switch(t.n){case 0:if((r=this)._resetErr(),r._isValid()){t.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:return t.n=2,r._innerFunV2("RemoveAllImages",hm(e));case 2:return t.a(2,t.v)}},M,this)})),function(e){return T.apply(this,arguments)})},{key:"_removeAllImagesAsync",value:(C=p(d().m(function L(e,r){var t;return d().w(function(e){for(;;)switch(e.n){case 0:if((t=this)._resetErr(),t._isValid()){e.n=1;break}throw{code:t._errorCode,message:t._getErrorString()};case 1:return e.n=2,t._innerFunV2("RemoveAllImages");case 2:return e.a(2,e.v)}},L,this)})),function(e,r){return C.apply(this,arguments)})},{key:"_LicensePromptExpired",value:function(){}},{key:"_OnActiveUI",value:(b=p(d().m(function B(e){var t,n,i,o,a,s,u,c,l,f,h,g,v,m,p,_,y,S,I,b;return d().w(function(d){for(;;)switch(d.p=d.n){case 0:if(t=this,i=!1,e&&e.length>=6?(e[2],n=e[5],o=!1,a=!1,s=0,e.length>12?(e[6],t._b64bit="64"==e[7],e[8],o=e[9],a=e[10],s=e[11],e[12]):e.length>8&&(o=e[6],a=e[7],s=e[8]),o?a&&s&&(t._bRemoteMode=!0):t._bRemoteMode=!0,jr.isString(n)&&("win"==n?t.__serverPlatform=rt.enumWindow:"linux"==n?t.__serverPlatform=rt.enumLinux:"mac"==n?t.__serverPlatform=rt.enumMac:"embed"==n?t.__serverPlatform=rt.enumEmbed:"chromeos"==n&&(t.__serverPlatform=rt.enumChromeOS))):i=!0,t._bMustUpgradeService=i,i){d.n=22;break}if(dh(Dh),u=!1,!t._blts){d.n=15;break}return l=t._bRemoteMode&&null!==(f=null===(h=t._dmService)||void 0===h||null===(h=h.attrs)||void 0===h?void 0:h.UUID)&&void 0!==f?f:"",d.p=1,d.n=2,Hm(xn.lgdt(),l);case 2:c=d.v,d.n=5;break;case 3:if(d.p=3,S=d.v,Qm(t,S),g=$m(t._errorCode),!t._bLicenseErrorDispose){d.n=4;break}throw t._bRemoteMode||(g?this._LicensePromptExpired():rp(t)),{code:t._errorCode,message:t._errorString};case 4:g||jr.warn(t._errorString),c=null;case 5:if(dh(xh),!c){d.n=13;break}return d.p=6,d.n=7,t._setLTSLicenseAsync(c.ar);case 7:v=d.v,d.n=11;break;case 8:if(d.p=8,I=d.v,!t._bLicenseErrorDispose){d.n=9;break}throw t._bRemoteMode||Zm(I.code)&&ep(I),I;case 9:jr.warn(I.message);case 10:u=!1;case 11:return xn.laddDWTObj(t),l="",t._bRemoteMode&&(l=null!==(m=null===(p=t._dmService)||void 0===p||null===(p=p.attrs)||void 0===p?void 0:p.UUID)&&void 0!==m?m:""),dh(Oh),d.n=12,xn.lcheckLic(xn.lgdt(),v,l);case 12:u=0==xn.licenseException.code,d.n=14;break;case 13:u=!1;case 14:d.n=21;break;case 15:return dh(xh),_=Zu.refProductKey,d.p=16,d.n=17,t._setProductKeyAsync(_);case 17:d.v&&(u=!0),d.n=21;break;case 18:if(d.p=18,b=d.v,!t._bLicenseErrorDispose){d.n=19;break}throw t._bRemoteMode||Zm(b.code)&&ep(b),b;case 19:jr.warn(b.message);case 20:u=!1;case 21:if(u&&(dh(Oh),jv.checkProductKey(t,{Core:!0})||(y={code:t._errorCode,message:t._getErrorString()},t._resetErr(),xn.lclex(),se.bWin&&jv.checkProductKey(t,{Webcam:!0},!0)||(t._errorCode=y.code,t._errorString=y.message))),0==t._errorCode){d.n=22;break}if(t._bRemoteMode||($m(t._errorCode)?this._LicensePromptExpired():rp(t)),!t._bLicenseErrorDispose){d.n=22;break}throw{code:t._errorCode,message:t._getErrorString()};case 22:r.startHeartBeat(t);case 23:return d.a(2)}},B,this,[[16,18],[6,8],[1,3]])})),function(e){return b.apply(this,arguments)})},{key:"_innerConvertToArrayBufferAsync",value:(I=p(d().m(function U(e,r,t,n){var i,o,a,s,u;return d().w(function(c){for(;;)switch(c.n){case 0:return i=this,o=t,a=null!=n?n:"arraybuffer",s=",",jr.isString(o)&&""!=o||(o="",s=""),u=["[",e,',"',r.join(","),'"',s,o,"]"].join(""),c.n=1,i._sendDataByHttpAsync("ConvertToBlob",u,a,!0);case 1:return c.a(2,c.v)}},U,this)})),function(e,r,t,n){return I.apply(this,arguments)})},{key:"_getImageByServerId",value:(y=p(d().m(function V(e){var r,t,n;return d().w(function(i){for(;;)switch(i.n){case 0:return r=ut.IT_PNG,i.n=1,this._innerConvertToArrayBufferAsync(r,[e],void 0,void 0);case 1:return t=i.v,n=Is(r),i.a(2,new Blob([t],{type:n}))}},V,this)})),function(e){return y.apply(this,arguments)})},{key:"_getSourcesAsync",value:(m=p(d().m(function j(e,r,t,n){var i,o;return d().w(function(a){for(;;)switch(a.n){case 0:return i=this,a.n=1,i._innerFunV2("GetSources",hm(e,r||!1,t||!1,0,n||0));case 1:return o=a.v,a.a(2,ap(this,o))}},j,this)})),function(e,r,t,n){return m.apply(this,arguments)})},{key:"_getDevices",value:(h=p(d().m(function H(e,r,t,n){var i,o,a,s,u,c;return d().w(function(l){for(;;)switch(l.p=l.n){case 0:if(o=[],a="getDevices",s=(i=this)._bRemoteMode?Kt:se.bAndroid?Qt:Kt,u=null!=e?e:s,i._resetErr(),i._isValid()){l.n=1;break}return l.a(2,Promise.reject({code:i._errorCode,message:i._getErrorString()}));case 1:return i._bNoMask||zl(a,i),l.p=2,l.n=3,i._getSourcesAsync(u,r,t,n);case 3:c=l.v,jr.isArray(c)&&c.length>0&&(o=o.concat(c)),l.n=5;break;case 4:throw l.p=4,l.v;case 5:return l.p=5,i._bNoMask||Kl(a),l.f(5);case 6:return l.a(2,o)}},H,this,[[2,4,5,6]])})),function(e,r,t,n){return h.apply(this,arguments)})},{key:"_innerAcquireImageFromService",value:function(e,r,t){var n,i,o=this;if(i=jr.clone(e),!jv.checkProductKey(o,{Core:!0}))return jr.isFunction(t)&&t(o._errorCode,o._getErrorString()),!1;var a=!!o._bRemoteMode;i.RemoteScan=a?1:0,o._bRemoteMode&&(jr.isFunction(o.__OnRemoteScanStatusAsync)||(o.__OnRemoteScanStatusAsync=function(){}),jr.isFunction(o.__OnSourceUIClose)||(o.__OnSourceUIClose=function(){}));for(var s=0,u=0;u<bp.length;u++){var c=["__",bp[u]].join("");jr.isFunction(o[c])&&(s|=1<<u)}return i.EnableEvents=s,a&&o._isBindViewer()&&o._initRemoteDiv(),o._bRemoteMode||(o._bPageFocus&&xn.IfAlwaysFocusOnPopupWindow?o._bServerAlwaysFocusOnPopupWindow||o._OnPageFocus(!0):o._bServerAlwaysFocusOnPopupWindow&&o._OnPageBlur(!0)),n=["[",jr.stringify(i),"]"].join(""),o._sendData("AcquireImage",n,!0,function(e){r(e)},function(e){t(o._errorCode,o._getErrorString())}),!0}},{key:"_canConsume",value:function(){return this._blts&&!this._bltsCopyImage}},{key:"_acquireImageFromServiceAsync",value:function(e){var r=this;return new Promise(function(t,n){return r._innerAcquireImageFromService(e,function(){r._canConsume()&&xn.lcvrf(r),t()},function(e,t){r._canConsume()&&xn.lcvrf(r),n({code:e,message:t})})})}},{key:"_acquireImage",value:(f=p(d().m(function G(e,r){var t,n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(t=this,n=r?jr.clone(r):{},i="acuqireImage",t._resetErr(),t._isValid()){s.n=1;break}throw{code:t._errorCode,message:t._getErrorString()};case 1:if(jv.checkProductKey(t,{Core:!0})&&t._isValid()){s.n=2;break}throw{code:t._errorCode,message:t._getErrorString()};case 2:if(!t.__bAcquireImageNow){s.n=3;break}throw Hh(t),{code:t._errorCode,message:t._getErrorString()};case 3:return t.__bAcquireImageNow=!0,t._bNoMask||zl(i,t),o=xn.RemoteScanConfig,a=Zv(),s.p=4,Ip(n),o&&$v(o.keepAwake),null!=e&&(n.Device=e.strDevice,n.DeviceMatchField=$t.SMF_NAME),s.n=5,t._acquireImageFromServiceAsync(n);case 5:s.n=7;break;case 6:throw s.p=6,s.v;case 7:return s.p=7,t.__bAcquireImageNow=!1,t._bNoMask||Kl(i),$v(a),s.f(7);case 8:return s.a(2,!0)}},G,this,[[4,6,7,8]])})),function(e,r){return f.apply(this,arguments)})},{key:"_getCapabilities",value:(c=p(d().m(function z(e,r,t){var n,i,o,a,s,u;return d().w(function(r){for(;;)switch(r.p=r.n){case 0:return i=null,v(fp,n=this,gp).call(n,e),n._initRemoteDiv(),r.n=1,n._innerSelectDeviceAsync(e);case 1:return jr.isArray(t)&&(i=hm(t)),r.n=2,n._sendDataByHttpAsync("GetCapabilities",i);case 2:if(o=r.v,r.p=3,o.length>0&&(s=o[0]),!jr.isString(s)){r.n=5;break}if(s=On.removeNonPrintableChar(s),0!=(a=JSON.parse(s)).errorCode){r.n=4;break}return r.a(2,a.response);case 4:throw n._errorCode=a.errorCode,n._errorString=a.errorString,n._errorCause=Tm(a),{code:n._errorCode,message:n._getErrorString()};case 5:throw $g(n),{code:n._errorCode,message:n._getErrorString()};case 6:r.n=8;break;case 7:throw r.p=7,u=r.v,n._errorCode=-2302,n._errorString=u,{code:n._errorCode,message:n._getErrorString()};case 8:return r.a(2)}},z,this,[[3,7]])})),function(e,r,t){return c.apply(this,arguments)})},{key:"_setCapabilities",value:(u=p(d().m(function K(e,r,t){var n,i;return d().w(function(t){for(;;)switch(t.n){case 0:if(v(fp,n=this,gp).call(n,e),jr.isObject(r)&&!jr.isArray(r)){t.n=1;break}throw Ag(n),{code:n._errorCode,message:n._getErrorString()};case 1:return n._initRemoteDiv(),t.n=2,n._innerSelectDeviceAsync(e);case 2:return i=["[",jr.stringify(r),"]"].join(""),t.n=3,n._sendDataByHttpAsync("SetCapabilities",i);case 3:return t.a(2,t.v)}},K,this)})),function(e,r,t){return u.apply(this,arguments)})},{key:"_closeSource",value:(a=p(d().m(function J(){var e;return d().w(function(r){for(;;)switch(r.n){case 0:return e=this,r.n=1,e._innerFunV2("CloseSource");case 1:return r.a(2)}},J,this)})),function(){return a.apply(this,arguments)})},{key:"_innerSelectDeviceAsync",value:(o=p(d().m(function Q(e,r){var t,n,i,o,a,s,u,c,l;return d().w(function(f){for(;;)switch(f.n){case 0:if(n=this,e&&e instanceof op){f.n=1;break}throw Ag(n),{code:n._errorCode,message:n._errorString};case 1:if(!(i=null===(t=this._dmService.attrs)||void 0===t?void 0:t.UUID)){f.n=4;break}if((null===(o=e.serviceInfo)||void 0===o||null===(o=o.attrs)||void 0===o?void 0:o.UUID)!=i){f.n=2;break}f.n=4;break;case 2:if(!((u=(null===(a=e.serviceInfo)||void 0===a||null===(a=a.attrs)||void 0===a?void 0:a.url)||(null===(s=e.serviceInfo)||void 0===s?void 0:s.server))&&u.indexOf(i)>-1)){f.n=3;break}f.n=4;break;case 3:throw Bg(n),{code:n._errorCode,message:n._errorString};case 4:return c=null!=r?r:$t.SMF_NAME,l=["[",e.strDevice,",",c,"]"].join(""),f.n=5,n._innerFunV2("SelectSourceEx",l);case 5:return f.a(2,f.v)}},Q,this)})),function(e,r){return o.apply(this,arguments)})},{key:"registerEvent",value:function(e,r){return jr.isUndefined(e)?(rg(this),!1):!jr.isString(e)||jr.isString(e)&&0==e.trim().length||jr.isUndefined(r)||!jr.isFunction(r)?(Ag(this),!1):!!this._registerEvent(e,r)}},{key:"unregisterEvent",value:function(e,r){return this._unregisterEvent(e,r)}},{key:"_registerEvent",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(t[["__",e].join("")]=r,!0)}},{key:"_unregisterEvent",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(t[["__",e].join("")]=null,!0)}},{key:"_OnPageFocus",value:function(e){var r=this;if(r._bPageFocus=!0,r._bReady&&se.bWin&&xn.IfAlwaysFocusOnPopupWindow){var t=jr.stringify({sequence:0,wnds:0,wnd:"0",type:3,x:0,y:0});if(r.__bAcquireImageNow||e||r.__bOpenFileNow){r._bServerAlwaysFocusOnPopupWindow=!0;try{r._isValid()&&r._sendDataByHttpAsync("SendEventToScannerUI",["[",t,"]"].join(""))}catch(lK){}}}}},{key:"_OnPageBlur",value:function(e){var r=this;if(se.bWin&&r._bReady){var t=jr.stringify({sequence:0,wnds:0,wnd:"0",type:4,x:0,y:0});if((0!=r._bPageFocus||e)&&(r._bPageFocus=!1,r.__bAcquireImageNow||e||r.__bOpenFileNow)){r._bServerAlwaysFocusOnPopupWindow=!1;try{r._isValid()&&r._sendDataByHttpAsync("SendEventToScannerUI",["[",t,"]"].join(""))}catch(lK){}}}}},{key:"_OnRemoteScanStatusAsync",value:function(e){var r,t,n,i,o,a,s,u=this;if(e&&e.length>=2){try{var c=new String(e[1]);r=jr.parse(c)}catch(f){jr.error(f.message),jr.log("parse json failed: "+e[1])}r||(r={sequence:0,screen:[]})}if(r&&r.sequence)if(r.sequence>0&&r.screen&&r.screen.length>0){if(t=r.screen,i=r.sequence,a=r.wnds,s=(n=t[0]).img,jr.isString(s)&&""!=s&&(o=n.wnd),i&&o){var l=jr.sizzle(".ds-img-screen");l&&l.length>0&&u._acquireDivEL&&(u._acquireDivEL.evtFun&&(jr.removeEventListener(l[0],"mouseup",u._acquireDivEL.evtFun),u._acquireDivEL.evtFun=null),l[0].src=s,u._acquireDivEL.evtFun=function(e){a||(a="0");var r=jr.stringify({sequence:i,wnds:a,wnd:o+"",type:2,x:e.offsetX,y:e.offsetY});u._sendDataByHttpAsync("SendEventToScannerUI",["[",r,"]"].join(""))},jr.addEventListener(l[0],"mouseup",u._acquireDivEL.evtFun))}}else u.__closeRemoteScanUI(!1);return jr.isFunction(u.__OnRemoteScanStatusAsync)&&u.__OnRemoteScanStatusAsync(r),!0}},{key:"_OnBitmapChanged",value:function(e,r,t){var n=this,i="m1"==e[0],o="c1"==e[0],a="c2"==e[0],s=o||a||i,u=e[2],c=e[3],l=-1;if(!s){if(e.length>10&&(l=e[10]),l>-1&&n._canConsume()&&(u==Zt.enumBCAppend||u==Zt.enumBCInsert)){var f=xn.lgct(l);jr.isFunction(n.__OnLtsverify)&&n.__OnLtsverify(f,1)}if((u==Zt.enumBCAppend||u==Zt.enumBCInsert)&&jr.isFunction(n.__OnBufferChanged)){var d={action:"add",currentId:c,imageIds:[],selectedIds:[]};n.__OnBufferChanged(d)}}}},{key:"_OnPostTransferAsync",value:function(e,r,t){var n,i=this;if(e&&e.length>=2)try{var o=String(e[1]).replace(/\\/g,"\\\\");n=jr.parse(o)}catch(s){jr.error(s)}n||(n={imageId:""});var a=!1;if(jr.isFunction(i.__OnPostTransferAsync))try{a=i.__OnPostTransferAsync(n)}catch(u){jr.error(u)}if(jr.isFunction(i.__OnPostTransferAsync2))try{i.__OnPostTransferAsync2(n)}catch(u){jr.error(u)}return a}},{key:"_OnCurrentDeviceSelected",value:function(e,r){}},{key:"_getErrorCode",value:function(){return this._errorCode}},{key:"_getErrorString",value:function(){return 0!=this._errorCode?this._errorString:"Successful."}},{key:"_isBindViewer",value:function(){return!1}},{key:"_isNoViewer",value:function(){return!0}},{key:"_isMobileMode",value:function(){return!1}},{key:"_needCheckProxyRemoteScanLicense",value:function(){if(!this._blts&&this._bScanForProxyRemote){if(""==this._strRemoteServiceVer)return!0;if(e=this._strRemoteServiceVer,r=ec(e),t=18,n=3,r.major>t||r.major===t&&r.minor>=n)return!0}var e,r,t,n;return!1}},{key:"_OnActiveUIClearBuffer",value:function(){}}],[{key:"isServerInvalid",value:function(e){var r,t;if(r=!e._bReady||null===e._wsClient,t=e._bMustUpgradeService,r){var n,i,o;if(e._bRemoteMode)n=null!==(i=null===(o=e._dmService)||void 0===o||null===(o=o.attrs)||void 0===o?void 0:o.name)&&void 0!==i?i:"";jg(e,n)}else t?yc(e,xn.ServerVersionInfo):e.isDestroy&&Pg(e);return r||t||-2208==e._errorCode||e.isDestroy}},{key:"STwainConnectToServer",value:(i=p(d().m(function q(e){var r,t,n,i,o;return d().w(function(a){for(;;)switch(a.p=a.n){case 0:if(r=e._id,!xn.WebTwainIdMap[r]){a.n=2;break}return a.n=1,e._OnReady();case 1:case 14:return a.a(2);case 2:if(!e._bReady&&!e._destroy){a.n=3;break}return a.a(2);case 3:if(e._bConnecting=!0,n=os.Instance.getClientInPool(e._serverInfo),i=!1,n?t=n:(i=!0,t=os.Instance.getClient(e._serverInfo,i)),t){a.n=4;break}return a.a(2);case 4:return i&&t.setRetry(0),e._bNoMask||zl("",e),a.p=5,a.n=6,Zc(e._bRemoteMode);case 6:if(a.p=7,!i){a.n=8;break}return a.n=8,t.testConnection(void 0,0,void 0,1e4);case 8:a.n=10;break;case 9:throw a.p=9,a.v,o=dc(),e._errorCode=o.code,e._errorString=o.message,Oc(),Nc(!1),o;case 10:if(e._wsClient=t,e._wsClient.bReady=!0,On.detect.bFirst&&(On.detect.bFirst=!1),e._bReady){a.n=11;break}return e._bReady=!0,a.n=11,e._OnReady();case 11:a.n=13;break;case 12:throw a.p=12,a.v,e._bReady=!1,{code:e._errorCode,message:e._getErrorString()};case 13:return a.p=13,e._bConnecting=!1,e._bNoMask||Kl(""),a.f(13)}},q,null,[[7,9],[5,12,13,14]])})),function(e){return i.apply(this,arguments)})},{key:"_innerSendHeartBeat",value:(n=p(d().m(function Y(e,t){var n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(s.p=0,!e.__bAcquireImageNow){s.n=1;break}s.n=3;break;case 1:if(n={client:undefined,userData:null,taskId:"0",eventTaskId:"0",lastEventTaskId:"0"},i=mm(),o={cmd:"Heartbeat",cmdId:i,sFun:undefined,fFun:undefined,contextData:null,rawData:!0},a=e.getHeartBeatData(o),!e._wsClient){s.n=2;break}return e._wsClient.setRetry(0),s.n=2,e._wsClient.request(a,undefined,n);case 2:o=null,a=null;case 3:s.n=5;break;case 4:s.p=4,s.v;case 5:e._wsClient&&e._wsClient.connected&&t&&setTimeout(function(){r._innerSendHeartBeat(e,t)},e._wsClient._heartBeatTicks);case 6:return s.a(2)}},Y,null,[[0,4]])})),function(e,r){return n.apply(this,arguments)})},{key:"startDWTReconnect",value:(t=p(d().m(function X(e){var t,n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(s.p=0,!e._destroy){s.n=1;break}return s.a(2);case 1:if(t=e._serverInfo,!(js.bEnhancedMode&&t&&t.port)){s.n=7;break}return Zu.bDCPChecked=!1,s.p=2,s.n=3,Bc(t.server,xn.Port,xn.SSLPort);case 3:if(!(n=s.v)){s.n=4;break}e._serverInfo.port=t.ssl?n.sslPort:n.port,s.n=5;break;case 4:throw $g(e),bm(e);case 5:s.n=7;break;case 6:return s.p=6,s.v,e._wsFailedTimes++,i=e._bRemoteMode?xc.RemoteReconnectMaxTimes:xc.LocalReconnectMaxTimes,e._wsFailedTimes<i&&(o=e._reconnectTimeSpan,e._wsFailedTimes<e._reconnectShortSpanTimes&&(o=e._reconnectShortSpan),e._heartBeatTimer=setTimeout(function(){r.startDWTReconnect(e)},o)),s.a(2);case 7:return e._bConnecting=!0,(a=os.Instance.getClient(e._serverInfo)).setRetry(0),s.n=8,a.testConnection(void 0,0,void 0,3e4);case 8:return e._wsClient=a,e._wsClient.bReady=!0,e._wsRetry=0,s.n=9,e._reconnected(a);case 9:s.n=11;break;case 10:s.p=10,s.v,e._wsFailedTimes++;case 11:return s.p=11,e._bConnecting=!1,s.f(11);case 12:return s.a(2)}},X,null,[[2,6],[0,10,11,12]])})),function(e){return t.apply(this,arguments)})},{key:"startHeartBeat",value:function(e){var t=e._wsClient;t&&t.connected&&!t._bHeartBeatStarted&&(t._bHeartBeatStarted=!0,setTimeout(function(){r._innerSendHeartBeat(e,!0)},t._heartBeatTicks))}},{key:"getServerImageUrlPrefix",value:function(e){return[e._httpUrl,"dwt/",e._bScanForProxyRemote?e._dmServiceDWTVersion:[js.getDWTPrefix(),Qu.getServerVersionInfo()].join(""),"/img?id=",e._clientId].join("")}}]);var t,n,i,o,a,u,c,f,h,m,y,I,b,C,T,w,A,E,k,P,F}(ip);function hp(e){var r,t=this,n=e;return t._resetErr(),t._isValid()?Zu.bUseDynamsoftLicenseManager||t._blts?(vv(t),Promise.reject({code:t._errorCode,message:t._getErrorString()})):(n=jr.isString(n)?jr.trim(n):"",r=t._sendDataConnectWithSocket("ProductKey",hm(n),"json",!0),t.__productKey=n,r=r.then(function(e){if(jr.isArray(e)&&e.length>0){if(0!=t._errorCode)throw t.__productKey="",{code:t._errorCode,message:t._getErrorString()};xn.ProductKey=t.__productKey,jv.reparseProductKey();return t._innerFunV2("GetLicenseInfo",hm(2))}throw ng(t),r.context=null,{code:t._errorCode,message:t._getErrorString()}})):Promise.reject({code:t._errorCode,message:t._getErrorString()})}function gp(e){return vp.apply(this,arguments)}function vp(){return(vp=p(d().m(function e(r){var t;return d().w(function(e){for(;;)switch(e.n){case 0:if((t=this)._resetErr(),t._isValid()){e.n=1;break}return e.a(2,Promise.reject({code:t._errorCode,message:t._errorString}));case 1:if(r&&r instanceof op){e.n=2;break}throw Ag(t),{code:t._errorCode,message:t._errorString};case 2:return e.a(2)}},e,this)}))).apply(this,arguments)}function mp(e,r,t,n,i){var o,a=[];return a.push("{"),a.push('"id":"'),a.push(e),a.push('"'),n&&(a.push(',"cmdId":"'),a.push(n),a.push('"')),a.push(',"method":"'),a.push(r),a.push('"'),a.push(',"module":"dwt","version":"'),o=i||[js.getDWTPrefix(),Qu.getServerVersionInfo()].join(""),a.push(o),a.push('"'),t!==undefined&&null!==t&&(a.push(',"parameter":'),jr.isArray(t)?a.push(jr.stringify(t)):a.push(t)),a.push("}"),a.join("")}function pp(e,r){return["evt",e,r].join("_")}function _p(e){if(e._bReady)e._wsCheckresolve(!0);else{if(xn.bConnectCanceled)return jr.asyncQueue.stop(),sm.stop(),zo(e),void e._wsCheckReject({code:e._errorCode,message:e._getErrorString()});if(e._wsRetry>10)return Lg(e),void e._wsCheckReject({code:e._errorCode,message:e._getErrorString()});e._wsRetry++,setTimeout(function(){_p(e)},1100)}}function yp(e,r,t,n){return Sp.apply(this,arguments)}function Sp(){return(Sp=p(d().m(function e(r,t,n,i){var o,a,s,u,c,l,f,h;return d().w(function(e){for(;;)switch(e.n){case 0:if(t!=Vo.GET_TASKID){e.n=1;break}return e.a(2,null==i?void 0:i.taskId);case 1:if(t!=Vo.GET_EVENT_TASKID){e.n=2;break}return e.a(2,null==i?void 0:i.eventTaskId);case 2:if(t!=Vo.ONMESSAGE_PROCESS_DATA){e.n=5;break}if("object"!==C(r)){e.n=3;break}return e.a(2,r);case 3:if(!((u=r).indexOf("Version not found")>=0||u.indexOf("Function not found")>=0)){e.n=4;break}return e.a(2,{cmdId:null!=n?n:0});case 4:return e.a(2,jr.parse(r));case 5:if(t!=Vo.ONMESSAGE_GET_TASKID){e.n=8;break}if(!r){e.n=7;break}if(!r.event){e.n=6;break}return e.a(2,0);case 6:return e.a(2,r.cmdId);case 7:return e.a(2,r);case 8:if(t!=Vo.ONMESSAGE_GET_EVENT_TASKID){e.n=10;break}if(!r||!r.event){e.n=9;break}return e.a(2,pp(r.id,r.cmdId));case 9:return e.a(2,0);case 10:if(t!=Vo.HANDLE_RAW_MESSAGE){e.n=17;break}if(c=r.rawData,l=r.jsonData,o=null==i?void 0:i.userData){e.n=11;break}return e.a(2,!1);case 11:if(a=o.stwain,s=o.command){e.n=12;break}return e.a(2,!1);case 12:if(a&&jr.isFunction(a.__OnWSMessage)&&a.__OnWSMessage(r),"object"!==C(r)){e.n=13;break}if(!xn.ConnectWithSocket){e.n=13;break}return"ConvertToBlob"!=s.cmd&&"GetImageByIndex"!=s.cmd||s.sFun(r),e.a(2,!0);case 13:if("Heartbeat"!=l.method){e.n=14;break}return e.a(2,!0);case 14:if("EnableBuffer"!=l.method&&"GetBuffer"!=l.method){e.n=15;break}return xn.lwsproc(l,s),e.a(2,!0);case 15:if(jr.isString(c)&&(f=c.replace(/\0/g,"")),!(f&&f.indexOf("Exception:")>=0||0==f.indexOf("Error"))){e.n=16;break}return h=!1,jr.log(f+"@"+s.cmd),s.fFun&&(h=s.fFun(f)),!h&&a&&jr.isFunction(a.__OnPrintMsg)&&a.__OnPrintMsg(f),e.a(2,!0);case 16:e.n=21;break;case 17:if(t!=Vo.HANDLE_PROCESSED_MESSAGE){e.n=21;break}if(o=null==i?void 0:i.userData){e.n=18;break}return e.a(2,!1);case 18:if(a=o.stwain){e.n=19;break}return e.a(2,!1);case 19:if(s=o.command){e.n=20;break}return e.a(2,!1);case 20:return e.a(2,a.__OnRecieveMsg(r,s));case 21:return e.a(2)}},e)}))).apply(this,arguments)}function Ip(e){e.Resolution!==undefined&&(e.Resolution=parseInt(e.Resolution)),e.PixelType!==undefined&&(e.PixelType=parseInt(e.PixelType)),e.SelectSourceByIndex!==undefined&&(e.SelectSourceByIndex=parseInt(e.SelectSourceByIndex))}var bp=["OnPreAllTransfers","OnPreTransfer","OnPostTransfer","OnPostTransferAsync"],Cp=["OnPostAllTransfers","OnPostTransfer","OnPostLoad","OnPreTransfer","OnPreAllTransfers","OnResult","OnTransferCancelled","OnTransferError","OnSourceUIClose","OnGetFilePath","OnPercentDone","OnPostTransferAsync","OnPreAllTransfersAsync","OnRemoteScanStatusAsync","OnConsumed","OnDiskExceedLimit","OnCurrentDeviceSelected"],Tp=["OnPreAllTransfers","OnPreTransfer","OnPostTransfer","OnGetFilePath","OnPostLoad"];function wp(e){var r,t=null!==(r=xn.Token)&&void 0!==r?r:"";return t&&(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+t),va(e)}function Ap(e,r){return Ep.apply(this,arguments)}function Ep(){return Ep=p(d().m(function e(r,t){var n,i;return d().w(function(e){for(;;)if(0===e.n)return(i=null!==(n=xn.Token)&&void 0!==n?n:"")&&(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+i),e.a(2,Ca(r,t))},e)})),Ep.apply(this,arguments)}jr.each;var kp={notSupportProperty:function(e){},notSupportMethod:function(e){},refreshImageAfterInvokeFun:function(e,r,t){return 1==t},loadHttpBlob:function(e,r,t,n,i,o,a,s){var u,c,l=!1;if(c={method:r,dataType:"blob"},s&&(c.headers=s),""!=e.HTTPUserName&&(c.username=e.HTTPUserName,c.password=e.HTTPPassword),e.__HTTPPostResponseString="",n){if("get"==r){var f=jr.guid();return On.progressContext&&(On.progressContext._onPercent=a),void ba(On.progressContext,f)(t,c).then(function(r){var t=r.type;if("text/plain"==t||"text/html"==t||Wo(t)){var n=new FileReader;n.readAsText(r),n.onload=function(){e.__HTTPPostResponseString=n.result,i(r)},n.onerror=function(){i(r)}}else i(r)},function(r){r&&r.code?(e._errorCode=r.code,e._errorString=r.message):r&&r.httpCode?Xh(e,!1,r.message,r.httpCode):qh(e),jr.isFunction(o)&&o({code:e._errorCode,message:e._errorString})})}c.onSuccess=function(r,t,n){var o=n?n.getResponseHeader("content-type"):"";if(o.indexOf("text/")>=0||Wo(o)){var a=new FileReader;a.readAsText(r),a.onload=function(){e.__HTTPPostResponseString=a.result,i(r)},a.onerror=function(){i(r)}}else i(r)},jr.isFunction(a)&&(c.beforeSend=function(e){e.addEventListener("progress",function(e){!se.bSafari&&e&&(delete e.totalSize,delete e.position),a(e)},!1)})}else se.bIE?(c.dataType="arraybuffer",c.onSuccess=function(r,t,n){var o,a;(o=r||n.responseData)&&(a=new Uint8Array(o)),e.__HTTPPostResponseString=n.responseText,e._errorCode=0,e._errorString="",i(a),a=null,l=!0}):(c.dataType="text",c.contentType="text/plain; charset=x-user-defined",c.mimeType="text/plain; charset=x-user-defined",c.onSuccess=function(r,t,n){var o,a,s;o=n.responseText,e.__HTTPPostResponseString=o,a=o.length,s=new Uint8Array(a);for(var u=0;u<a;u++)s[u]=o.charCodeAt(u);e._errorCode=0,e._errorString="",i(s),s=null,l=!0}),c.headers?jr.mix(c.headers,{"X-Requested-With":!1}):c.headers={"X-Requested-With":!1};if("post"==r){var d,h=e.httpFormFields;if(h)try{d=new FormData,jr.each(h,function(e,r){if(e instanceof Blob){var t=e.name;d.append(r,e,t)}else d.append(r,e)}),jr.mix(c,{data:d,processData:!1,contentType:!1})}catch(hH){}}u=function(r,t,n){var i,a;if(r&&jr.isArray(r)&&r.length>2?(i=r[1],a=r[2]):(i=t,a=n),2!=a.state&&3!=a.state||0!=a.status)Xh(e,!1,i,a.status);else if("abort"===a.statusText){Xh(e,!0)}else qh(e);jr.isFunction(o)&&o()},c.url=t,c.async=n,c.onError=u,c.onComplete=function(){e._cancelableObj=null};var g=wp(c);if(!n)return l;On.progressContext&&(On.progressContext._onPercent=a,e.IfShowCancelDialogWhenImageTransfer&&On.progressContext.on("cancel",function(){g.abort()}))},combineUrl:function(e,r,t){var n=[],i=r;if(i===undefined||t===undefined)return undefined;if(jr.isString(i)||(i=String(r)),0==i.indexOf("http://")?(i=i.replace("http://",""),n.push("http://")):0==i.indexOf("https://")?(i=i.replace("https://",""),n.push("https://")):(0==i.indexOf("//")&&(i=i.replace("//","")),e.IfSSL?n.push("https://"):n.push("http://")),n.push(i),i.indexOf(":")<0){var o=Ks(i);e.HTTPPort||(e.HTTPPort=o?443:80),(!o&&80!=e.HTTPPort||o&&443!=e.HTTPPort)&&(n.push(":"),n.push(e.HTTPPort))}return 0!==t.indexOf("/")&&n.push("/"),n.push(t),n.join("")},httpPutImage:function(e,r,t,n,i,o,a){var s=!0,u={method:"PUT",url:r,hasContent:!0,processData:!1,async:n,data:t,onSuccess:i,onError:function(r,t,n){var i,a;if(s=!1,r&&jr.isArray(r)&&r.length>2?(i=r[1],a=r[2]):(i=t,a=n),2!=a.state&&3!=a.state||0!=a.status)Yh(e,!1,i,a.status);else if("abort"===a.statusText){Yh(e,!0)}else!function(e){hh(e,-2304,"Http put error: the url is invalid.")}(e);jr.isFunction(o)&&o()},onComplete:function(){e._cancelableObj=null},beforeSend:function(e){jr.isFunction(a)&&e.upload.addEventListener("progress",function(e){!se.bSafari&&e&&(delete e.totalSize,delete e.position),a(e)},!1)}};""!=e.HTTPUserName&&(u.username=e.HTTPUserName,u.password=e.HTTPPassword),n||jr.mix(u,{headers:{"X-Requested-With":!1}});var c=wp(u);return On.progressContext&&(On.progressContext._onPercent=a,On.progressContext._onCancel=function(){c.abort()}),s},GetImageInfo:function(e,r){var t=e._ImgManager.convertClientIndexToServerId(r);return-1==t?(gg(e),!1):e._innerFun("GetImageInfo",hm(t))},getBlobTypeByImageType:Is,callbacks:[],pushCallback:function(e,r,t){var n={method:e,callback:r,ticks:t};kp.callbacks.push(n)},refreshUIRef:0,isServerInvalid:function(e){dp.isServerInvalid(e)},replaceLocalFilename:function(e){var r;return e===undefined?"":(r=(e=String(e)).replace(/\\/g,"\\\\"),se.bFileSystem&&(r=decodeURI(r)),r)},getImageType:bs,makeParams:hm,showMask:zl,hideMask:Kl,getFileName:function(e){var r=e,t=r.lastIndexOf("/");return(t>-1||se.bWin&&(t=r.lastIndexOf("\\"))>-1)&&(r=r.substring(t+1)),r},getFilePath:function(e){var r=e,t=r.lastIndexOf("/");return(t>-1||se.bWin&&(t=r.lastIndexOf("\\"))>-1)&&(r=r.substring(0,t)),r}};function Pp(e,r,t,n,i){var o=0;return e==Xt.TWAIN&&(o=qt),e==Xt.TWAIN64?o=Gt.TWAINX64SCANNER:e==Xt.ICA?t?o=Gt.SANESCANNER:n?o=Gt.ICASCANNER:(r||i)&&(o=qt):e==Xt.TWAIN_AND_TWAIN64&&(t?o=qt|Gt.SANESCANNER:n?o=qt|Gt.ICASCANNER:r?o=qt|Gt.TWAINX64SCANNER:i&&(o=qt)),o}function Fp(e,r){for(var t=e.HowManyImagesInBuffer,n=0;n<t;n++)r.push(e._ImgManager.convertClientIndexToServerId(n))}function Dp(e,r){return 0!=e._ImgManager.count()||(Vh(e),jr.isFunction(r)&&r(e._errorCode,e._getErrorString()),!1)}function xp(e,r,t){return!!Dp(e,t)&&(!(isNaN(r)||!jr.isNumber(r)||r<0||r>=e._ImgManager.count())||(gg(e),jr.isFunction(t)&&t(e._errorCode,e._getErrorString()),!1))}function Op(e){var r,t,n,i=[];return e._ImgManager.count()<=0||((t=e._ImgManager.getCurrentImageIndex())>=0&&(r=e._ImgManager.convertClientIndexToServerId(t)),n=e._ImgManager.getSelectedClientIndexArray(),jr.isArray(n)&&jr.each(n,function(r){var t=e._ImgManager.convertClientIndexToServerId(r);-1!=t&&i.push(t)}),-1!=r&&0==i.length&&i.push(r)),i}function Np(e){var r,t=[];return e._ImgManager.count()<=0||(r=e._ImgManager.getCurrentImageIndex(),t=e._ImgManager.getSelectedClientIndexArray(),-1!=r&&0==t.length&&t.push(r)),t}function Rp(e,r,t){return e._resetErr(),!!e._isValid()&&(isNaN(r)?(Bh(e),jr.isFunction(t)&&t(e._errorCode,e.ErrorString),!1):!(r<0||r>=e._ImgManager.count())||(gg(e),jr.isFunction(t)&&t(e._errorCode,e.ErrorString),!1))}function Wp(e){return e==Gt.TWAINSCANNER||e==Gt.WIATWAINSCANNER||e==Gt.TWAINX64SCANNER}function Mp(e){var r,t=[],n=e.HowManyImagesInBuffer;for(r=0;r<n;r++)t.push(r);return e._imageBufferWrapper.convertIndicesToServerIds(t)}function Lp(e,r){return e._imageBufferWrapper.convertIndicesToServerIds(r)}On.html5.Funs=kp;var Bp,Up,Vp,jp,Hp,Gp,zp,Kp,Jp,Qp,qp,Yp,Xp,Zp,$p,e_,r_=function(){return S(function e(){_(this,e),I(this,"bIsDirty",!1),I(this,"imageWidth",0),I(this,"imageHeight",0),I(this,"iImageControlWidth",0),I(this,"iImageControlHeight",0),I(this,"imageUrl",""),I(this,"minImageUrl",""),I(this,"uuid",-1),I(this,"serverId",-1),I(this,"uidFromServer",""),I(this,"aryOverlayRectangleData",[]),I(this,"ticks",Date.now())},[{key:"Clear",value:function(){this.imageUrl="",this.minImageUrl="",this.serverId=-1,this.uuid=-1,this.uidFromServer="",this.aryOverlayRectangleData=[]}}])}(),t_={};function n_(){if(Up)return Bp;Up=1;var e=function(e){return e&&e.Math===Math&&e};return Bp=e("object"==("undefined"==typeof globalThis?"undefined":C(globalThis))&&globalThis)||e("object"==("undefined"==typeof window?"undefined":C(window))&&window)||e("object"==("undefined"==typeof self?"undefined":C(self))&&self)||e("object"==C(ah)&&ah)||e("object"==C(Bp)&&Bp)||function(){return this}()||Function("return this")()}function i_(){return jp?Vp:(jp=1,Vp=function(e){try{return!!e()}catch(ia){return!0}})}function o_(){return Gp?Hp:(Gp=1,Hp=!i_()(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))}function a_(){if(Kp)return zp;Kp=1;var e=o_(),r=Function.prototype,t=r.apply,n=r.call;return zp="object"==("undefined"==typeof Reflect?"undefined":C(Reflect))&&Reflect.apply||(e?n.bind(t):function(){return n.apply(t,arguments)}),zp}function s_(){if(Qp)return Jp;Qp=1;var e=o_(),r=Function.prototype,t=r.call,n=e&&r.bind.bind(t,t);return Jp=e?n:function(e){return function(){return t.apply(e,arguments)}},Jp}function u_(){if(Yp)return qp;Yp=1;var e=s_(),r=e({}.toString),t=e("".slice);return qp=function(e){return t(r(e),8,-1)},qp}function c_(){if(Zp)return Xp;Zp=1;var e=u_(),r=s_();return Xp=function(t){if("Function"===e(t))return r(t)}}function l_(){if(e_)return $p;e_=1;var e="object"==("undefined"==typeof document?"undefined":C(document))&&document.all;return $p=void 0===e&&e!==undefined?function(r){return"function"==typeof r||r===e}:function(e){return"function"==typeof e}}var f_,d_,h_,g_,v_={};function m_(){return d_?f_:(d_=1,f_=!i_()(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function p_(){if(g_)return h_;g_=1;var e=o_(),r=Function.prototype.call;return h_=e?r.bind(r):function(){return r.apply(r,arguments)},h_}var __,y_,S_,I_,b_,C_,T_,w_,A_,E_,k_,P_,F_,D_,x_,O_,N_,R_,W_,M_,L_,B_,U_,V_,j_,H_,G_,z_,K_,J_,Q_,q_,Y_,X_,Z_,$_,ey,ry={};function ty(){if(__)return ry;__=1;var e={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,t=r&&!e.call({1:2},1);return ry.f=t?function(e){var t=r(this,e);return!!t&&t.enumerable}:e,ry}function ny(){return S_?y_:(S_=1,y_=function(e,r){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:r}})}function iy(){if(b_)return I_;b_=1;var e=s_(),r=i_(),t=u_(),n=Object,i=e("".split);return I_=r(function(){return!n("z").propertyIsEnumerable(0)})?function(e){return"String"===t(e)?i(e,""):n(e)}:n,I_}function oy(){return T_||(T_=1,C_=function(e){return null===e||e===undefined}),C_}function ay(){if(A_)return w_;A_=1;var e=oy(),r=TypeError;return w_=function(t){if(e(t))throw new r("Can't call method on "+t);return t},w_}function sy(){if(k_)return E_;k_=1;var e=iy(),r=ay();return E_=function(t){return e(r(t))},E_}function uy(){if(F_)return P_;F_=1;var e=l_();return P_=function(r){return"object"==C(r)?null!==r:e(r)},P_}function cy(){return x_?D_:(x_=1,D_={})}function ly(){if(N_)return O_;N_=1;var e=cy(),r=n_(),t=l_(),n=function(e){return t(e)?e:undefined};return O_=function(t,i){return arguments.length<2?n(e[t])||n(r[t]):e[t]&&e[t][i]||r[t]&&r[t][i]},O_}function fy(){return W_?R_:(W_=1,R_=s_()({}.isPrototypeOf))}function dy(){if(L_)return M_;L_=1;var e=n_().navigator,r=e&&e.userAgent;return M_=r?String(r):""}function hy(){if(U_)return B_;U_=1;var e,r,t=n_(),n=dy(),i=t.process,o=t.Deno,a=i&&i.versions||o&&o.version,s=a&&a.v8;return s&&(r=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!r&&n&&(!(e=n.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=n.match(/Chrome\/(\d+)/))&&(r=+e[1]),B_=r}function gy(){if(j_)return V_;j_=1;var e=hy(),r=i_(),t=n_().String;return V_=!!Object.getOwnPropertySymbols&&!r(function(){var r=Symbol("symbol detection");return!t(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&e&&e<41}),V_}function vy(){return G_?H_:(G_=1,H_=gy()&&!Symbol.sham&&"symbol"==C(Symbol.iterator))}function my(){if(K_)return z_;K_=1;var e=ly(),r=l_(),t=fy(),n=Object;return z_=vy()?function(e){return"symbol"==C(e)}:function(i){var o=e("Symbol");return r(o)&&t(o.prototype,n(i))},z_}function py(){if(Q_)return J_;Q_=1;var e=String;return J_=function(r){try{return e(r)}catch(ia){return"Object"}}}function _y(){if(Y_)return q_;Y_=1;var e=l_(),r=py(),t=TypeError;return q_=function(n){if(e(n))return n;throw new t(r(n)+" is not a function")}}function yy(){if(Z_)return X_;Z_=1;var e=_y(),r=oy();return X_=function(t,n){var i=t[n];return r(i)?undefined:e(i)}}function Sy(){if(ey)return $_;ey=1;var e=p_(),r=l_(),t=uy(),n=TypeError;return $_=function(i,o){var a,s;if("string"===o&&r(a=i.toString)&&!t(s=e(a,i)))return s;if(r(a=i.valueOf)&&!t(s=e(a,i)))return s;if("string"!==o&&r(a=i.toString)&&!t(s=e(a,i)))return s;throw new n("Can't convert object to primitive value")}}var Iy,by,Cy,Ty,wy,Ay,Ey,ky,Py,Fy,Dy,xy,Oy,Ny,Ry,Wy,My,Ly,By,Uy,Vy,jy,Hy,Gy,zy,Ky,Jy,Qy,qy={exports:{}};function Yy(){return by?Iy:(by=1,Iy=!0)}function Xy(){if(Ty)return Cy;Ty=1;var e=n_(),r=Object.defineProperty;return Cy=function(t,n){try{r(e,t,{value:n,configurable:!0,writable:!0})}catch(ia){e[t]=n}return n}}function Zy(){if(wy)return qy.exports;wy=1;var e=Yy(),r=n_(),t=Xy(),n="__core-js_shared__",i=qy.exports=r[n]||t(n,{});return(i.versions||(i.versions=[])).push({version:"3.49.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"}),qy.exports}function $y(){if(Ey)return Ay;Ey=1;var e=Zy();return Ay=function(r,t){return e[r]||(e[r]=t||{})}}function eS(){if(Py)return ky;Py=1;var e=ay(),r=Object;return ky=function(t){return r(e(t))}}function rS(){if(Dy)return Fy;Dy=1;var e=s_(),r=eS(),t=e({}.hasOwnProperty);return Fy=Object.hasOwn||function(e,n){return t(r(e),n)},Fy}function tS(){if(Oy)return xy;Oy=1;var e=s_(),r=0,t=Math.random(),n=e(1.1.toString);return xy=function(e){return"Symbol("+(e===undefined?"":e)+")_"+n(++r+t,36)}}function nS(){if(Ry)return Ny;Ry=1;var e=n_(),r=$y(),t=rS(),n=tS(),i=gy(),o=vy(),a=e.Symbol,s=r("wks"),u=o?a["for"]||a:a&&a.withoutSetter||n;return Ny=function(e){return t(s,e)||(s[e]=i&&t(a,e)?a[e]:u("Symbol."+e)),s[e]}}function iS(){if(My)return Wy;My=1;var e=p_(),r=uy(),t=my(),n=yy(),i=Sy(),o=TypeError,a=nS()("toPrimitive");return Wy=function(s,u){if(!r(s)||t(s))return s;var c,l=n(s,a);if(l){if(u===undefined&&(u="default"),c=e(l,s,u),!r(c)||t(c))return c;throw new o("Can't convert object to primitive value")}return u===undefined&&(u="number"),i(s,u)}}function oS(){if(By)return Ly;By=1;var e=iS(),r=my();return Ly=function(t){var n=e(t,"string");return r(n)?n:n+""}}function aS(){if(Vy)return Uy;Vy=1;var e=n_(),r=uy(),t=e.document,n=r(t)&&r(t.createElement);return Uy=function(e){return n?t.createElement(e):{}},Uy}function sS(){if(Hy)return jy;Hy=1;var e=m_(),r=i_(),t=aS();return jy=!e&&!r(function(){return 7!==Object.defineProperty(t("div"),"a",{get:function(){return 7}}).a})}function uS(){if(Gy)return v_;Gy=1;var e=m_(),r=p_(),t=ty(),n=ny(),i=sy(),o=oS(),a=rS(),s=sS(),u=Object.getOwnPropertyDescriptor;return v_.f=e?u:function(e,c){if(e=i(e),c=o(c),s)try{return u(e,c)}catch(ia){}if(a(e,c))return n(!r(t.f,e,c),e[c])},v_}function cS(){if(Ky)return zy;Ky=1;var e=i_(),r=l_(),t=/#|\.prototype\./,n=function(t,n){var u=o[i(t)];return u===s||u!==a&&(r(n)?e(n):!!n)},i=n.normalize=function(e){return String(e).replace(t,".").toLowerCase()},o=n.data={},a=n.NATIVE="N",s=n.POLYFILL="P";return zy=n}function lS(){if(Qy)return Jy;Qy=1;var e=c_(),r=_y(),t=o_(),n=e(e.bind);return Jy=function(e,i){return r(e),i===undefined?e:t?n(e,i):function(){return e.apply(i,arguments)}},Jy}var fS,dS,hS,gS,vS,mS,pS,_S,yS,SS,IS,bS,CS,TS,wS,AS,ES,kS,PS,FS,DS,xS,OS,NS={};function RS(){return dS?fS:(dS=1,fS=m_()&&i_()(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}))}function WS(){if(gS)return hS;gS=1;var e=uy(),r=String,t=TypeError;return hS=function(n){if(e(n))return n;throw new t(r(n)+" is not an object")}}function MS(){if(vS)return NS;vS=1;var e=m_(),r=sS(),t=RS(),n=WS(),i=oS(),o=TypeError,a=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",c="configurable",l="writable";return NS.f=e?t?function(e,r,t){if(n(e),r=i(r),n(t),"function"==typeof e&&"prototype"===r&&"value"in t&&l in t&&!t[l]){var o=s(e,r);o&&o[l]&&(e[r]=t.value,t={configurable:c in t?t[c]:o[c],enumerable:u in t?t[u]:o[u],writable:!1})}return a(e,r,t)}:a:function(e,t,s){if(n(e),t=i(t),n(s),r)try{return a(e,t,s)}catch(ia){}if("get"in s||"set"in s)throw new o("Accessors not supported");return"value"in s&&"__proto__"!==t&&"prototype"!==t&&"constructor"!==t&&(e[t]=s.value),e},NS}function LS(){if(pS)return mS;pS=1;var e=m_(),r=MS(),t=ny();return mS=e?function(e,n,i){return r.f(e,n,t(1,i))}:function(e,r,t){return"__proto__"!==r&&"prototype"!==r&&"constructor"!==r&&(e[r]=t),e},mS}function BS(){if(yS)return _S;yS=1;var e=n_(),r=a_(),t=c_(),n=l_(),i=uS().f,o=cS(),a=cy(),s=lS(),u=LS(),c=rS(),l=function(e){var t=function(n,i,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,i)}return new e(n,i,o)}return r(e,this,arguments)};return t.prototype=e.prototype,t};return _S=function(r,f){var d,h,g,v,m,p,_,y,S,I=r.target,b=r.global,T=r.stat,w=r.proto,A=b?e:T?e[I]:e[I]&&e[I].prototype,E=b?a:a[I]||u(a,I,{})[I],k=E.prototype;for(v in f)h=!(d=o(b?v:I+(T?".":"#")+v,r.forced))&&A&&c(A,v),p=E[v],h&&(_=r.dontCallGetSet?(S=i(A,v))&&S.value:A[v]),m=h&&_?_:f[v],(d||w||C(p)!=C(m))&&(y=r.bind&&h?s(m,e):r.wrap&&h?l(m):w&&n(m)?t(m):m,(r.sham||m&&m.sham||p&&p.sham)&&u(y,"sham",!0),u(E,v,y),w&&(c(a,g=I+"Prototype")||u(a,g,{}),u(a[g],v,m),r.real&&k&&(d||!k[v])&&u(k,v,m)))}}function US(){return IS?SS:(IS=1,SS=s_()([].slice))}function VS(){if(CS)return bS;CS=1;var e=s_(),r=_y(),t=uy(),n=rS(),i=US(),o=o_(),a=Function,s=e([].concat),u=e([].join),c={};return bS=o?a.bind:function(e){var o=r(this),l=o.prototype,f=i(arguments,1),d=function(){var r=s(f,i(arguments));return this instanceof d?function(e,r,t){if(!n(c,r)){for(var i=[],o=0;o<r;o++)i[o]="a["+o+"]";c[r]=a("C,a","return new C("+u(i,",")+")")}return c[r](e,t)}(o,r.length,r):o.apply(e,r)};return t(l)&&(d.prototype=l),d},bS}function jS(){if(wS)return TS;wS=1;var e={};return e[nS()("toStringTag")]="z",TS="[object z]"===String(e)}function HS(){if(ES)return AS;ES=1;var e=jS(),r=l_(),t=u_(),n=nS()("toStringTag"),i=Object,o="Arguments"===t(function(){return arguments}());return AS=e?t:function(e){var a,s,u;return e===undefined?"Undefined":null===e?"Null":"string"==typeof(s=function(e,r){try{return e[r]}catch(ia){}}(a=i(e),n))?s:o?t(a):"Object"===(u=t(a))&&r(a.callee)?"Arguments":u},AS}function GS(){if(PS)return kS;PS=1;var e=s_(),r=l_(),t=Zy(),n=e(Function.toString);return r(t.inspectSource)||(t.inspectSource=function(e){return n(e)}),kS=t.inspectSource}function zS(){if(DS)return FS;DS=1;var e=s_(),r=i_(),t=l_(),n=HS(),i=ly(),o=GS(),a=function(){},s=i("Reflect","construct"),u=/^\s*(?:class|function)\b/,c=e(u.exec),l=!u.test(a),f=function(e){if(!t(e))return!1;try{return s(a,[],e),!0}catch(ia){return!1}},d=function(e){if(!t(e))return!1;switch(n(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return l||!!c(u,o(e))}catch(ia){return!0}};return d.sham=!0,FS=!s||r(function(){var e;return f(f.call)||!f(Object)||!f(function(){e=!0})||e})?d:f}function KS(){if(OS)return xS;OS=1;var e=zS(),r=py(),t=TypeError;return xS=function(n){if(e(n))return n;throw new t(r(n)+" is not a constructor")}}var JS,QS,qS,YS,XS,ZS,$S,eI,rI,tI,nI,iI,oI,aI,sI,uI,cI,lI,fI,dI,hI,gI,vI,mI,pI,_I,yI,SI,II,bI,CI,TI,wI,AI,EI={};function kI(){if(QS)return JS;QS=1;var e=Math.ceil,r=Math.floor;return JS=Math.trunc||function(t){var n=+t;return(n>0?r:e)(n)}}function PI(){if(YS)return qS;YS=1;var e=kI();return qS=function(r){var t=+r;return t!=t||0===t?0:e(t)}}function FI(){if(ZS)return XS;ZS=1;var e=PI(),r=Math.max,t=Math.min;return XS=function(n,i){var o=e(n);return o<0?r(o+i,0):t(o,i)}}function DI(){if(eI)return $S;eI=1;var e=PI(),r=Math.min;return $S=function(t){var n=e(t);return n>0?r(n,9007199254740991):0}}function xI(){if(tI)return rI;tI=1;var e=DI();return rI=function(r){return e(r.length)}}function OI(){if(iI)return nI;iI=1;var e=sy(),r=FI(),t=xI(),n=function(n){return function(i,o,a){var s=e(i),u=t(s);if(0===u)return!n&&-1;var c,l=r(a,u);if(n&&o!=o){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((n||l in s)&&s[l]===o)return n||l||0;return!n&&-1}};return nI={includes:n(!0),indexOf:n(!1)}}function NI(){return aI?oI:(aI=1,oI={})}function RI(){if(uI)return sI;uI=1;var e=s_(),r=rS(),t=sy(),n=OI().indexOf,i=NI(),o=e([].push);return sI=function(e,a){var s,u=t(e),c=0,l=[];for(s in u)!r(i,s)&&r(u,s)&&o(l,s);for(;a.length>c;)r(u,s=a[c++])&&(~n(l,s)||o(l,s));return l},sI}function WI(){return lI?cI:(lI=1,cI=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function MI(){if(dI)return fI;dI=1;var e=RI(),r=WI();return fI=Object.keys||function(t){return e(t,r)}}function LI(){if(hI)return EI;hI=1;var e=m_(),r=RS(),t=MS(),n=WS(),i=sy(),o=MI();return EI.f=e&&!r?Object.defineProperties:function(e,r){n(e);for(var a,s=i(r),u=o(r),c=u.length,l=0;c>l;)t.f(e,a=u[l++],s[a]);return e},EI}function BI(){return vI?gI:(vI=1,gI=ly()("document","documentElement"))}function UI(){if(pI)return mI;pI=1;var e=$y(),r=tS(),t=e("keys");return mI=function(e){return t[e]||(t[e]=r(e))}}function VI(){if(yI)return _I;yI=1;var e,r=WS(),t=LI(),n=WI(),i=NI(),o=BI(),a=aS(),s="prototype",u="script",c=UI()("IE_PROTO"),l=function(){},f=function(e){return"<"+u+">"+e+"</"+u+">"},d=function(e){e.write(f("")),e.close();var r=e.parentWindow.Object;return e=null,r},h=function(){try{e=new ActiveXObject("htmlfile")}catch(ia){}var r,t,i;h="undefined"!=typeof document?document.domain&&e?d(e):(t=a("iframe"),i="java"+u+":",t.style.display="none",o.appendChild(t),t.src=String(i),(r=t.contentWindow.document).open(),r.write(f("document.F=Object")),r.close(),r.F):d(e);for(var c=n.length;c--;)delete h[s][n[c]];return h()};return i[c]=!0,_I=Object.create||function(e,n){var i;return null!==e?(l[s]=r(e),i=new l,l[s]=null,i[c]=e):i=h(),n===undefined?i:t.f(i,n)}}function jI(){return bI?II:(bI=1,function(){if(SI)return t_;SI=1;var e=BS(),r=ly(),t=a_(),n=VS(),i=KS(),o=WS(),a=uy(),s=VI(),u=i_(),c=r("Reflect","construct"),l=Object.prototype,f=[].push,d=u(function(){function e(){}return!(c(function(){},[],e)instanceof e)}),h=!u(function(){c(function(){})}),g=d||h;e({target:"Reflect",stat:!0,forced:g,sham:g},{construct:function(e,r){i(e);var u=arguments.length<3?e:i(arguments[2]);if(o(r),h&&!d)return c(e,r,u);if(e===u){switch(r.length){case 0:return new e;case 1:return new e(r[0]);case 2:return new e(r[0],r[1]);case 3:return new e(r[0],r[1],r[2]);case 4:return new e(r[0],r[1],r[2],r[3])}var g=[null];return t(f,g,r),new(t(n,e,g))}var v=u.prototype,m=s(a(v)?v:l),p=t(e,m,r);return a(p)?p:m}})}(),II=cy().Reflect.construct)}function HI(){return TI?CI:(TI=1,CI=jI())}var GI,zI,KI=sh(AI?wI:(AI=1,wI=HI())),JI={},QI={};function qI(){if(zI)return GI;zI=1;var e=HS(),r=String;return GI=function(t){if("Symbol"===e(t))throw new TypeError("Cannot convert a Symbol value to a string");return r(t)}}var YI,XI={};function ZI(){if(YI)return XI;YI=1;var e=RI(),r=WI().concat("length","prototype");return XI.f=Object.getOwnPropertyNames||function(t){return e(t,r)},XI}var $I,eb={};function rb(){if($I)return eb;$I=1;var e=u_(),r=sy(),t=ZI().f,n=US(),i="object"==("undefined"==typeof window?"undefined":C(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return eb.f=function(o){return i&&"Window"===e(o)?function(e){try{return t(e)}catch(ia){return n(i)}}(o):t(r(o))},eb}var tb,nb,ib,ob,ab,sb={};function ub(){return tb||(tb=1,sb.f=Object.getOwnPropertySymbols),sb}function cb(){if(ib)return nb;ib=1;var e=LS();return nb=function(r,t,n,i){return i&&i.enumerable?r[t]=n:e(r,t,n),r}}function lb(){if(ab)return ob;ab=1;var e=MS();return ob=function(r,t,n){return e.f(r,t,n)}}var fb,db,hb,gb,vb,mb,pb,_b,yb,Sb,Ib,bb,Cb,Tb,wb,Ab,Eb,kb,Pb,Fb,Db,xb,Ob,Nb,Rb={};function Wb(){if(fb)return Rb;fb=1;var e=nS();return Rb.f=e,Rb}function Mb(){if(hb)return db;hb=1;var e=cy(),r=rS(),t=Wb(),n=MS().f;return db=function(i){var o=e.Symbol||(e.Symbol={});r(o,i)||n(o,i,{value:t.f(i)})}}function Lb(){if(vb)return gb;vb=1;var e=p_(),r=ly(),t=nS(),n=cb();return gb=function(){var i=r("Symbol"),o=i&&i.prototype,a=o&&o.valueOf,s=t("toPrimitive");o&&!o[s]&&n(o,s,function(r){return e(a,this)},{arity:1})}}function Bb(){if(pb)return mb;pb=1;var e=jS(),r=HS();return mb=e?{}.toString:function(){return"[object "+r(this)+"]"}}function Ub(){if(yb)return _b;yb=1;var e=jS(),r=MS().f,t=LS(),n=rS(),i=Bb(),o=nS()("toStringTag");return _b=function(a,s,u,c){var l=u?a:a&&a.prototype;l&&(n(l,o)||r(l,o,{configurable:!0,value:s}),c&&!e&&t(l,"toString",i))},_b}function Vb(){if(Ib)return Sb;Ib=1;var e=n_(),r=l_(),t=e.WeakMap;return Sb=r(t)&&/native code/.test(String(t))}function jb(){if(Cb)return bb;Cb=1;var e,r,t,n=Vb(),i=n_(),o=uy(),a=LS(),s=rS(),u=Zy(),c=UI(),l=NI(),f="Object already initialized",d=i.TypeError,h=i.WeakMap;if(n||u.state){var g=u.state||(u.state=new h);g.get=g.get,g.has=g.has,g.set=g.set,e=function(e,r){if(g.has(e))throw new d(f);return r.facade=e,g.set(e,r),r},r=function(e){return g.get(e)||{}},t=function(e){return g.has(e)}}else{var v=c("state");l[v]=!0,e=function(e,r){if(s(e,v))throw new d(f);return r.facade=e,a(e,v,r),r},r=function(e){return s(e,v)?e[v]:{}},t=function(e){return s(e,v)}}return bb={set:e,get:r,has:t,enforce:function(n){return t(n)?r(n):e(n,{})},getterFor:function(e){return function(t){var n;if(!o(t)||(n=r(t)).type!==e)throw new d("Incompatible receiver, "+e+" required");return n}}},bb}function Hb(){if(wb)return Tb;wb=1;var e=u_();return Tb=Array.isArray||function(r){return"Array"===e(r)}}function Gb(){if(Eb)return Ab;Eb=1;var e=Hb(),r=zS(),t=uy(),n=nS()("species"),i=Array;return Ab=function(o){var a;return e(o)&&(a=o.constructor,(r(a)&&(a===i||e(a.prototype))||t(a)&&null===(a=a[n]))&&(a=undefined)),a===undefined?i:a}}function zb(){if(Pb)return kb;Pb=1;var e=Gb();return kb=function(r,t){return new(e(r))(0===t?0:t)}}function Kb(){if(Db)return Fb;Db=1;var e=m_(),r=MS(),t=ny();return Fb=function(n,i,o){e?r.f(n,i,t(0,o)):n[i]=o},Fb}function Jb(){if(Ob)return xb;Ob=1;var e=lS(),r=iy(),t=eS(),n=xI(),i=zb(),o=Kb(),a=function(a){var s=1===a,u=2===a,c=3===a,l=4===a,f=6===a,d=7===a,h=5===a||f;return function(g,v,m){for(var p,_,y=t(g),S=r(y),I=n(S),b=e(v,m),C=0,T=0,w=s?i(g,I):u||d?i(g,0):undefined;I>C;C++)if((h||C in S)&&(_=b(p=S[C],C,y),a))if(s)o(w,C,_);else if(_)switch(a){case 3:return!0;case 5:return p;case 6:return C;case 2:o(w,T++,p)}else switch(a){case 4:return!1;case 7:o(w,T++,p)}return f?-1:c||l?l:w}};return xb={forEach:a(0),map:a(1),filter:a(2),some:a(3),every:a(4),find:a(5),findIndex:a(6),filterReject:a(7)}}var Qb,qb,Yb,Xb={};function Zb(){return qb?Qb:(qb=1,Qb=gy()&&!!Symbol["for"]&&!!Symbol.keyFor)}var $b,eC={};var rC,tC,nC,iC,oC,aC,sC,uC={};function cC(){if(tC)return rC;tC=1;var e=uy(),r=jb().get;return rC=function(t){if(!e(t))return!1;var n=r(t);return!!n&&"RawJSON"===n.type}}function lC(){if(iC)return nC;iC=1;var e=s_(),r=rS(),t=SyntaxError,n=parseInt,i=String.fromCharCode,o=e("".charAt),a=e("".slice),s=e(/./.exec),u={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},c=/^[\da-f]{4}$/i,l=/^[\u0000-\u001F]$/;return nC=function(e,f){for(var d=!0,h="";f<e.length;){var g=o(e,f);if("\\"===g){var v=a(e,f,f+2);if(r(u,v))h+=u[v],f+=2;else{if("\\u"!==v)throw new t('Unknown escape sequence: "'+v+'"');var m=a(e,f+=2,f+4);if(!s(c,m))throw new t("Bad Unicode escape at: "+f);h+=i(n(m,16)),f+=4}}else{if('"'===g){d=!1,f++;break}if(s(l,g))throw new t("Bad control character in string literal at: "+f);h+=g,f++}}if(d)throw new t("Unterminated string at: "+f);return{value:h,end:f}}}function fC(){return aC?oC:(aC=1,oC=!i_()(function(){var e="9007199254740993",r=JSON.rawJSON(e);return!JSON.isRawJSON(r)||JSON.stringify(r)!==e}))}var dC,hC,gC,vC,mC,pC,_C,yC,SC={};function IC(){return hC||(hC=1,function(){if(Nb)return QI;Nb=1;var e=BS(),r=n_(),t=p_(),n=s_(),i=Yy(),o=m_(),a=gy(),s=i_(),u=rS(),c=fy(),l=WS(),f=sy(),d=oS(),h=qI(),g=ny(),v=VI(),m=MI(),p=ZI(),_=rb(),y=ub(),S=uS(),I=MS(),b=LI(),C=ty(),T=cb(),w=lb(),A=$y(),E=UI(),k=NI(),P=tS(),F=nS(),D=Wb(),x=Mb(),O=Lb(),N=Ub(),R=jb(),W=Jb().forEach,M=E("hidden"),L="Symbol",B="prototype",U=R.set,V=R.getterFor(L),j=Object[B],H=r.Symbol,G=H&&H[B],z=r.RangeError,K=r.TypeError,J=r.QObject,Q=S.f,q=I.f,Y=_.f,X=C.f,Z=n([].push),$=A("symbols"),ee=A("op-symbols"),re=A("wks"),te=!J||!J[B]||!J[B].findChild,ne=function(e,r,t){var n=Q(j,r);return n&&delete j[r],q(e,r,t),n&&e!==j&&q(j,r,n),e},ie=o&&s(function(){return 7!==v(q({},"a",{get:function(){return q(this,"a",{value:7}).a}})).a})?ne:q,oe=function(e,r){var t=$[e]=v(G);return U(t,{type:L,tag:e,description:r}),o||(t.description=r),t},ae=function(e,r,t){e===j&&ae(ee,r,t),l(e);var n=d(r);return l(t),u($,n)?(("enumerable"in t?!t.enumerable:!u(e,n)||u(e,M)&&e[M][n])?(u(e,M)||q(e,M,g(1,v(null))),e[M][n]=!0):(u(e,M)&&e[M][n]&&(e[M][n]=!1),t=v(t,{enumerable:g(0,!1)})),ie(e,n,t)):q(e,n,t)},se=function(e,r){l(e);var n=f(r),i=m(n).concat(fe(n));return W(i,function(r){o&&!t(ue,n,r)||ae(e,r,n[r])}),e},ue=function(e){var r=d(e),n=t(X,this,r);return!(this===j&&u($,r)&&!u(ee,r))&&(!(n||!u(this,r)||!u($,r)||u(this,M)&&this[M][r])||n)},ce=function(e,r){var t=f(e),n=d(r);if(t!==j||!u($,n)||u(ee,n)){var i=Q(t,n);return!i||!u($,n)||u(t,M)&&t[M][n]||(i.enumerable=!0),i}},le=function(e){var r=Y(f(e)),t=[];return W(r,function(e){u($,e)||u(k,e)||Z(t,e)}),t},fe=function(e){var r=e===j,t=Y(r?ee:f(e)),n=[];return W(t,function(e){!u($,e)||r&&!u(j,e)||Z(n,$[e])}),n};a||(H=function(){if(c(G,this))throw new K("Symbol is not a constructor");var e=arguments.length&&arguments[0]!==undefined?h(arguments[0]):undefined,n=P(e),i=function(e){var o=this===undefined?r:this;o===j&&t(i,ee,e),u(o,M)&&u(o[M],n)&&(o[M][n]=!1);var a=g(1,e);try{ie(o,n,a)}catch(ia){if(!(ia instanceof z))throw ia;ne(o,n,a)}};return o&&te&&ie(j,n,{configurable:!0,set:i}),oe(n,e)},T(G=H[B],"toString",function(){return V(this).tag}),T(H,"withoutSetter",function(e){return oe(P(e),e)}),C.f=ue,I.f=ae,b.f=se,S.f=ce,p.f=_.f=le,y.f=fe,D.f=function(e){return oe(F(e),e)},o&&(w(G,"description",{configurable:!0,get:function(){return V(this).description}}),i||T(j,"propertyIsEnumerable",ue,{unsafe:!0}))),e({global:!0,constructor:!0,wrap:!0,forced:!a,sham:!a},{Symbol:H}),W(m(re),function(e){x(e)}),e({target:L,stat:!0,forced:!a},{useSetter:function(){te=!0},useSimple:function(){te=!1}}),e({target:"Object",stat:!0,forced:!a,sham:!o},{create:function(e,r){return r===undefined?v(e):se(v(e),r)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ce}),e({target:"Object",stat:!0,forced:!a},{getOwnPropertyNames:le}),O(),N(H,L),k[M]=!0}(),function(){if(Yb)return Xb;Yb=1;var e=BS(),r=ly(),t=rS(),n=qI(),i=$y(),o=Zb(),a=i("string-to-symbol-registry"),s=i("symbol-to-string-registry");e({target:"Symbol",stat:!0,forced:!o},{"for":function(e){var i=n(e);if(t(a,i))return a[i];var o=r("Symbol")(i);return a[i]=o,s[o]=i,o}})}(),function(){if($b)return eC;$b=1;var e=BS(),r=rS(),t=my(),n=py(),i=$y(),o=Zb(),a=i("symbol-to-string-registry");e({target:"Symbol",stat:!0,forced:!o},{keyFor:function(e){if(!t(e))throw new TypeError(n(e)+" is not a symbol");if(r(a,e))return a[e]}})}(),function(){if(sC)return uC;sC=1;var e=BS(),r=ly(),t=a_(),n=p_(),i=s_(),o=i_(),a=Hb(),s=l_(),u=cC(),c=my(),l=u_(),f=qI(),d=US(),h=lC(),g=tS(),v=gy(),m=fC(),p=String,_=r("JSON","stringify"),y=i(/./.exec),S=i("".charAt),I=i("".charCodeAt),b=i("".replace),C=i("".slice),T=i([].push),w=i(1.1.toString),A=/[\uD800-\uDFFF]/g,E=/^[\uD800-\uDBFF]$/,k=/^[\uDC00-\uDFFF]$/,P=g(),F=P.length,D=!v||o(function(){var e=r("Symbol")("stringify detection");return"[null]"!==_([e])||"{}"!==_({a:e})||"{}"!==_(Object(e))}),x=o(function(){return'"\\udf06\\ud834"'!==_("\udf06\ud834")||'"\\udead"'!==_("\udead")}),O=D?function(e,r){var i=d(arguments),o=R(r);if(s(o)||e!==undefined&&!c(e))return i[1]=function(e,r){if(s(o)&&(r=n(o,this,p(e),r)),!c(r))return r},t(_,null,i)}:_,N=function(e,r,t){var n=S(t,r-1),i=S(t,r+1);return y(E,e)&&!y(k,i)||y(k,e)&&!y(E,n)?"\\u"+w(I(e,0),16):e},R=function(e){if(s(e))return e;if(a(e)){for(var r=e.length,t=[],n=0;n<r;n++){var i=e[n];"string"==typeof i?T(t,i):"number"!=typeof i&&"Number"!==l(i)&&"String"!==l(i)||T(t,f(i))}var o=t.length,u=!0;return function(e,r){if(u)return u=!1,r;if(a(this))return r;for(var n=0;n<o;n++)if(t[n]===e)return r}}};_&&e({target:"JSON",stat:!0,arity:3,forced:D||x||!m},{stringify:function(e,r,t){var i=R(r),o=[],a=O(e,function(e,r){var t=s(i)?n(i,this,p(e),r):r;return!m&&u(t)?P+(T(o,t.rawJSON)-1):t},t);if("string"!=typeof a)return a;if(x&&(a=b(a,A,N)),m)return a;for(var c="",l=a.length,f=0;f<l;f++){var d=S(a,f);if('"'===d){var g=h(a,++f).end-1,v=C(a,f,g);c+=C(v,0,F)===P?o[C(v,F)]:'"'+v+'"',f=g}else c+=d}return c}})}(),function(){if(dC)return SC;dC=1;var e=BS(),r=gy(),t=i_(),n=ub(),i=eS();e({target:"Object",stat:!0,forced:!r||t(function(){n.f(1)})},{getOwnPropertySymbols:function(e){var r=n.f;return r?r(i(e)):[]}})}()),JI}function bC(){return vC?gC:(vC=1,IC(),gC=cy().Object.getOwnPropertySymbols)}function CC(){return pC?mC:(pC=1,mC=bC())}var TC,wC,AC,EC,kC,PC,FC=sh(yC?_C:(yC=1,_C=CC())),DC={exports:{}},xC={};function OC(){if(wC)return DC.exports;wC=1,function(){if(TC)return xC;TC=1;var e=BS(),r=i_(),t=sy(),n=uS().f,i=m_();e({target:"Object",stat:!0,forced:!i||r(function(){n(1)}),sham:!i},{getOwnPropertyDescriptor:function(e,r){return n(t(e),r)}})}();var e=cy().Object,r=DC.exports=function(r,t){return e.getOwnPropertyDescriptor(r,t)};return e.getOwnPropertyDescriptor.sham&&(r.sham=!0),DC.exports}function NC(){return EC?AC:(EC=1,AC=OC())}var RC,WC,MC,LC,BC,UC,VC,jC,HC,GC=sh(PC?kC:(PC=1,kC=NC())),zC={};function KC(){if(WC)return RC;WC=1;var e=ly(),r=s_(),t=ZI(),n=ub(),i=WS(),o=r([].concat);return RC=e("Reflect","ownKeys")||function(e){var r=t.f(i(e)),a=n.f;return a?o(r,a(e)):r},RC}function JC(){return BC?LC:(BC=1,function(){if(MC)return zC;MC=1;var e=BS(),r=m_(),t=KC(),n=sy(),i=uS(),o=Kb();e({target:"Object",stat:!0,sham:!r},{getOwnPropertyDescriptors:function(e){for(var r,a,s=n(e),u=i.f,c=t(s),l={},f=0;c.length>f;)(a=u(s,r=c[f++]))!==undefined&&o(l,r,a);return l}})}(),LC=cy().Object.getOwnPropertyDescriptors)}function QC(){return VC?UC:(VC=1,UC=JC())}var qC,YC,XC,ZC,$C,eT,rT=sh(HC?jC:(HC=1,jC=QC())),tT={exports:{}},nT={};function iT(){if(qC)return nT;qC=1;var e=BS(),r=m_(),t=LI().f;return e({target:"Object",stat:!0,forced:Object.defineProperties!==t,sham:!r},{defineProperties:t}),nT}function oT(){if(YC)return tT.exports;YC=1,iT();var e=cy().Object,r=tT.exports=function(r,t){return e.defineProperties(r,t)};return e.defineProperties.sham&&(r.sham=!0),tT.exports}function aT(){return ZC?XC:(ZC=1,XC=oT())}var sT,uT,cT,lT,fT,dT,hT,gT,vT,mT,pT,_T,yT,ST,IT,bT,CT,TT,wT,AT,ET,kT,PT,FT,DT,xT,OT,NT,RT,WT,MT,LT,BT,UT,VT,jT,HT,GT,zT,KT,JT,QT,qT,YT,XT,ZT,$T,ew,rw,tw,nw,iw,ow=sh(eT?$C:(eT=1,$C=aT())),aw={},sw={};function uw(){return uT?sT:(uT=1,sT=!i_()(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))}function cw(){if(lT)return cT;lT=1;var e=rS(),r=l_(),t=eS(),n=UI(),i=uw(),o=n("IE_PROTO"),a=Object,s=a.prototype;return cT=i?a.getPrototypeOf:function(n){var i=t(n);if(e(i,o))return i[o];var u=i.constructor;return r(u)&&i instanceof u?u.prototype:i instanceof a?s:null},cT}function lw(){if(dT)return fT;dT=1;var e=s_(),r=_y();return fT=function(t,n,i){try{return e(r(Object.getOwnPropertyDescriptor(t,n)[i]))}catch(ia){}},fT}function fw(){if(gT)return hT;gT=1;var e=uy();return hT=function(r){return e(r)||null===r}}function dw(){if(mT)return vT;mT=1;var e=fw(),r=String,t=TypeError;return vT=function(n){if(e(n))return n;throw new t("Can't set "+r(n)+" as a prototype")}}function hw(){if(_T)return pT;_T=1;var e=lw(),r=uy(),t=ay(),n=dw();return pT=Object.setPrototypeOf||("__proto__"in{}?function(){var i,o=!1,a={};try{(i=e(Object.prototype,"__proto__","set"))(a,[]),o=a instanceof Array}catch(ia){}return function(e,a){return t(e),n(a),r(e)?(o?i(e,a):e.__proto__=a,e):e}}():undefined)}function gw(){if(ST)return yT;ST=1;var e=rS(),r=KC(),t=uS(),n=MS();return yT=function(i,o,a){for(var s=r(o),u=n.f,c=t.f,l=0;l<s.length;l++){var f=s[l];e(i,f)||a&&e(a,f)||u(i,f,c(o,f))}},yT}function vw(){if(bT)return IT;bT=1;var e=uy(),r=LS();return IT=function(t,n){e(n)&&"cause"in n&&r(t,"cause",n.cause)}}function mw(){if(TT)return CT;TT=1;var e=Error,r=s_()("".replace),t=String(new e("zxcasd").stack),n=/\n\s*at [^:]*:[^\n]*/,i=n.test(t);return CT=function(t,o){if(i&&"string"==typeof t&&!e.prepareStackTrace)for(;o--;)t=r(t,n,"");return t}}function pw(){if(AT)return wT;AT=1;var e=i_(),r=ny();return wT=!e(function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",r(1,7)),7!==e.stack)}),wT}function _w(){if(kT)return ET;kT=1;var e=LS(),r=mw(),t=pw(),n=Error.captureStackTrace;return ET=function(i,o,a,s){t&&(n?n(i,o):e(i,"stack",r(a,s)))},ET}function yw(){return FT?PT:(FT=1,PT={})}function Sw(){if(xT)return DT;xT=1;var e=nS(),r=yw(),t=e("iterator"),n=Array.prototype;return DT=function(e){return e!==undefined&&(r.Array===e||n[t]===e)},DT}function Iw(){if(NT)return OT;NT=1;var e=HS(),r=yy(),t=oy(),n=yw(),i=nS()("iterator");return OT=function(o){if(!t(o))return r(o,i)||r(o,"@@iterator")||n[e(o)]},OT}function bw(){if(WT)return RT;WT=1;var e=p_(),r=_y(),t=WS(),n=py(),i=Iw(),o=TypeError;return RT=function(a,s){var u=arguments.length<2?i(a):s;if(r(u))return t(e(u,a));throw new o(n(a)+" is not iterable")},RT}function Cw(){if(LT)return MT;LT=1;var e=p_(),r=WS(),t=yy();return MT=function(n,i,o){var a,s;r(n);try{if(!(a=t(n,"return"))){if("throw"===i)throw o;return o}a=e(a,n)}catch(ia){s=!0,a=ia}if("throw"===i)throw o;if(s)throw a;return r(a),o},MT}function Tw(){if(UT)return BT;UT=1;var e=lS(),r=p_(),t=WS(),n=py(),i=Sw(),o=xI(),a=fy(),s=bw(),u=Iw(),c=Cw(),l=TypeError,f=function(e,r){this.stopped=e,this.result=r},d=f.prototype;return BT=function(h,g,v){var m,p,_,y,S,I,b,T=v&&v.that,w=!(!v||!v.AS_ENTRIES),A=!(!v||!v.IS_RECORD),E=!(!v||!v.IS_ITERATOR),k=!(!v||!v.INTERRUPTED),P=e(g,T),F=function(e){var r=m;return m=undefined,r&&c(r,"normal"),new f(!0,e)},D=function(e){return w?(t(e),k?P(e[0],e[1],F):P(e[0],e[1])):k?P(e,F):P(e)};if(A)m=h.iterator;else if(E)m=h;else{if(!(p=u(h)))throw new l(n(h)+" is not iterable");if(i(p)){for(_=0,y=o(h);y>_;_++)if((S=D(h[_]))&&a(d,S))return S;return new f(!1)}m=s(h,p)}for(I=A?h.next:m.next;!(b=r(I,m)).done;){var x=b.value;try{S=D(x)}catch(ia){if(!m)throw ia;c(m,"throw",ia)}if("object"==C(S)&&S&&a(d,S))return S}return new f(!1)},BT}function ww(){if(jT)return VT;jT=1;var e=qI();return VT=function(r,t){return r===undefined?arguments.length<2?"":t:e(r)},VT}function Aw(){return GT||(GT=1,function(){if(HT)return sw;HT=1;var e=BS(),r=fy(),t=cw(),n=hw(),i=gw(),o=VI(),a=LS(),s=ny(),u=vw(),c=_w(),l=Tw(),f=ww(),d=nS()("toStringTag"),h=Error,g=[].push,v=function(e,i){var s,p=r(m,this);n?s=n(new h,p?t(this):m):(s=p?this:o(m),a(s,d,"Error")),i!==undefined&&a(s,"message",f(i)),c(s,v,s.stack,1),arguments.length>2&&u(s,arguments[2]);var _=[];return l(e,g,{that:_}),a(s,"errors",_),s};n?n(v,h):i(v,h,{name:!0});var m=v.prototype=o(h.prototype,{constructor:s(1,v),message:s(1,""),name:s(1,"AggregateError")});e({global:!0,constructor:!0,arity:2},{AggregateError:v})}()),aw}function Ew(){return KT?zT:(KT=1,zT=function(){})}function kw(){if(QT)return JT;QT=1;var e=m_(),r=rS(),t=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,i=r(t,"name"),o=i&&"something"===function(){}.name,a=i&&(!e||e&&n(t,"name").configurable);return JT={EXISTS:i,PROPER:o,CONFIGURABLE:a}}function Pw(){if(YT)return qT;YT=1;var e,r,t,n=i_(),i=l_(),o=uy(),a=VI(),s=cw(),u=cb(),c=nS(),l=Yy(),f=c("iterator"),d=!1;return[].keys&&("next"in(t=[].keys())?(r=s(s(t)))!==Object.prototype&&(e=r):d=!0),!o(e)||n(function(){var r={};return e[f].call(r)!==r})?e={}:l&&(e=a(e)),i(e[f])||u(e,f,function(){return this}),qT={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:d}}function Fw(){if(ZT)return XT;ZT=1;var e=Pw().IteratorPrototype,r=VI(),t=ny(),n=Ub(),i=yw(),o=function(){return this};return XT=function(a,s,u,c){var l=s+" Iterator";return a.prototype=r(e,{next:t(+!c,u)}),n(a,l,!1,!0),i[l]=o,a}}function Dw(){if(ew)return $T;ew=1;var e=BS(),r=p_(),t=Yy(),n=kw(),i=l_(),o=Fw(),a=cw(),s=hw(),u=Ub(),c=LS(),l=cb(),f=nS(),d=yw(),h=Pw(),g=n.PROPER,v=n.CONFIGURABLE,m=h.IteratorPrototype,p=h.BUGGY_SAFARI_ITERATORS,_=f("iterator"),y="keys",S="values",I="entries",b=function(){return this};return $T=function(n,f,h,C,T,w,A){o(h,f,C);var E,k,P,F=function(e){if(e===T&&R)return R;if(!p&&e&&e in O)return O[e];switch(e){case y:case S:case I:return function(){return new h(this,e)}}return function(){return new h(this)}},D=f+" Iterator",x=!1,O=n.prototype,N=O[_]||O["@@iterator"]||T&&O[T],R=!p&&N||F(T),W="Array"===f&&O.entries||N;if(W&&(E=a(W.call(new n)))!==Object.prototype&&E.next&&(t||a(E)===m||(s?s(E,m):i(E[_])||l(E,_,b)),u(E,D,!0,!0),t&&(d[D]=b)),g&&T===S&&N&&N.name!==S&&(!t&&v?c(O,"name",S):(x=!0,R=function(){return r(N,this)})),T)if(k={values:F(S),keys:w?R:F(y),entries:F(I)},A)for(P in k)(p||x||!(P in O))&&l(O,P,k[P]);else e({target:f,proto:!0,forced:p||x},k);return t&&!A||O[_]===R||l(O,_,R,{name:T}),d[f]=R,k}}function xw(){return tw?rw:(tw=1,rw=function(e,r){return{value:e,done:r}})}function Ow(){if(iw)return nw;iw=1;var e=sy(),r=Ew(),t=yw(),n=jb(),i=MS().f,o=Dw(),a=xw(),s=Yy(),u=m_(),c="Array Iterator",l=n.set,f=n.getterFor(c);nw=o(Array,"Array",function(r,t){l(this,{type:c,target:e(r),index:0,kind:t})},function(){var e=f(this),r=e.target,t=e.index++;if(!r||t>=r.length)return e.target=null,a(undefined,!0);switch(e.kind){case"keys":return a(t,!1);case"values":return a(r[t],!1)}return a([t,r[t]],!1)},"values");var d=t.Arguments=t.Array;if(r("keys"),r("values"),r("entries"),!s&&u&&"values"!==d.name)try{i(d,"name",{value:"values"})}catch(ia){}return nw}var Nw,Rw,Ww,Mw,Lw,Bw,Uw,Vw,jw,Hw,Gw,zw,Kw,Jw,Qw,qw,Yw,Xw,Zw,$w,eA,rA,tA,nA,iA,oA,aA,sA,uA,cA,lA,fA,dA,hA,gA={},vA={};function mA(){if(Rw)return Nw;Rw=1;var e=n_(),r=dy(),t=u_(),n=function(e){return r.slice(0,e.length)===e};return Nw=n("Bun/")?"BUN":n("Cloudflare-Workers")?"CLOUDFLARE":n("Deno/")?"DENO":n("Node.js/")?"NODE":e.Bun&&"string"==typeof Bun.version?"BUN":e.Deno&&"object"==C(Deno.version)?"DENO":"process"===t(e.process)?"NODE":e.window&&e.document?"BROWSER":"REST"}function pA(){return Mw?Ww:(Mw=1,Ww="NODE"===mA())}function _A(){if(Bw)return Lw;Bw=1;var e=ly(),r=lb(),t=nS(),n=m_(),i=t("species");return Lw=function(t){var o=e(t);n&&o&&!o[i]&&r(o,i,{configurable:!0,get:function(){return this}})}}function yA(){if(Vw)return Uw;Vw=1;var e=fy(),r=TypeError;return Uw=function(t,n){if(e(n,t))return t;throw new r("Incorrect invocation")},Uw}function SA(){if(Hw)return jw;Hw=1;var e=WS(),r=KS(),t=oy(),n=nS()("species");return jw=function(i,o){var a,s=e(i).constructor;return s===undefined||t(a=e(s)[n])?o:r(a)}}function IA(){if(zw)return Gw;zw=1;var e=TypeError;return Gw=function(r,t){if(r<t)throw new e("Not enough arguments");return r}}function bA(){if(Jw)return Kw;Jw=1;var e=dy();return Kw=/ipad|iphone|ipod/i.test(e)&&/applewebkit/i.test(e)}function CA(){if(qw)return Qw;qw=1;var e,r,t,n,i=n_(),o=a_(),a=lS(),s=l_(),u=rS(),c=i_(),l=BI(),f=US(),d=aS(),h=IA(),g=bA(),v=pA(),m=i.setImmediate,p=i.clearImmediate,_=i.process,y=i.Dispatch,S=i.Function,I=i.MessageChannel,b=i.String,C=0,T={},w="onreadystatechange";c(function(){e=i.location});var A=function(e){if(u(T,e)){var r=T[e];delete T[e],r()}},E=function(e){return function(){A(e)}},k=function(e){A(e.data)},P=function(r){i.postMessage(b(r),e.protocol+"//"+e.host)};return m&&p||(m=function(e){h(arguments.length,1);var t=s(e)?e:S(e),n=f(arguments,1);return T[++C]=function(){o(t,undefined,n)},r(C),C},p=function(e){delete T[e]},v?r=function(e){_.nextTick(E(e))}:y&&y.now?r=function(e){y.now(E(e))}:I&&!g?(n=(t=new I).port2,t.port1.onmessage=k,r=a(n.postMessage,n)):i.addEventListener&&s(i.postMessage)&&!i.importScripts&&e&&"file:"!==e.protocol&&!c(P)?(r=P,i.addEventListener("message",k,!1)):r=w in d("script")?function(e){l.appendChild(d("script"))[w]=function(){l.removeChild(this),A(e)}}:function(e){setTimeout(E(e),0)}),Qw={set:m,clear:p}}function TA(){if(Xw)return Yw;Xw=1;var e=n_(),r=m_(),t=Object.getOwnPropertyDescriptor;return Yw=function(n){if(!r)return e[n];var i=t(e,n);return i&&i.value}}function wA(){if($w)return Zw;$w=1;var e=function(){this.head=null,this.tail=null};return e.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},Zw=e}function AA(){return rA?eA:(rA=1,eA=/ipad|iphone|ipod/i.test(dy())&&"undefined"!=typeof Pebble)}function EA(){return nA?tA:(nA=1,tA=/web0s(?!.*chrome)/i.test(dy()))}function kA(){if(oA)return iA;oA=1;var e,r,t,n,i,o=n_(),a=TA(),s=lS(),u=CA().set,c=wA(),l=bA(),f=AA(),d=EA(),h=pA(),g=o.MutationObserver||o.WebKitMutationObserver,v=o.document,m=o.process,p=o.Promise,_=a("queueMicrotask");if(!_){var y=new c,S=function(){var r,t;for(h&&(r=m.domain)&&r.exit();t=y.get();)try{t()}catch(ia){throw y.head&&e(),ia}r&&r.enter()};l||h||d||!g||!v?!f&&p&&p.resolve?((n=p.resolve(undefined)).constructor=p,i=s(n.then,n),e=function(){i(S)}):h?e=function(){m.nextTick(S)}:(u=s(u,o),e=function(){u(S)}):(r=!0,t=v.createTextNode(""),new g(S).observe(t,{characterData:!0}),e=function(){t.data=r=!r}),_=function(r){y.head||e(),y.add(r)}}return iA=_}function PA(){return sA?aA:(sA=1,aA=function(e,r){})}function FA(){return cA?uA:(cA=1,uA=function(e){try{return{error:!1,value:e()}}catch(ia){return{error:!0,value:ia}}})}function DA(){return fA?lA:(fA=1,lA=n_().Promise)}function xA(){if(hA)return dA;hA=1;var e=n_(),r=DA(),t=l_(),n=cS(),i=GS(),o=nS(),a=mA(),s=Yy(),u=hy(),c=r&&r.prototype,l=o("species"),f=!1,d=t(e.PromiseRejectionEvent),h=n("Promise",function(){var e=i(r),t=e!==String(r);if(!t&&66===u)return!0;if(s&&(!c["catch"]||!c["finally"]))return!0;if(!u||u<51||!/native code/.test(e)){var n=new r(function(e){e(1)}),o=function(e){e(function(){},function(){})};if((n.constructor={})[l]=o,!(f=n.then(function(){})instanceof o))return!0}return!(t||"BROWSER"!==a&&"DENO"!==a||d)});return dA={CONSTRUCTOR:h,REJECTION_EVENT:d,SUBCLASSING:f}}var OA,NA,RA={};function WA(){if(OA)return RA;OA=1;var e=_y(),r=TypeError,t=function(t){var n,i;this.promise=new t(function(e,t){if(n!==undefined||i!==undefined)throw new r("Bad Promise constructor");n=e,i=t}),this.resolve=e(n),this.reject=e(i)};return RA.f=function(e){return new t(e)},RA}var MA,LA,BA,UA,VA,jA={};function HA(){if(LA)return MA;LA=1;var e=nS()("iterator"),r=!1;try{var t=0,n={next:function(){return{done:!!t++}},"return":function(){r=!0}};n[e]=function(){return this},Array.from(n,function(){throw 2})}catch(ia){}return MA=function(t,n){try{if(!n&&!r)return!1}catch(ia){return!1}var i=!1;try{var o={};o[e]=function(){return{next:function(){return{done:i=!0}}}},t(o)}catch(ia){}return i},MA}function GA(){if(UA)return BA;UA=1;var e=DA(),r=HA(),t=xA().CONSTRUCTOR;return BA=t||!r(function(r){e.all(r).then(undefined,function(){})})}var zA,KA={};var JA,QA={};var qA,YA={};var XA,ZA,$A,eE,rE={};function tE(){if(ZA)return XA;ZA=1;var e=WS(),r=uy(),t=WA();return XA=function(n,i){if(e(n),r(i)&&i.constructor===n)return i;var o=t.f(n);return(0,o.resolve)(i),o.promise}}function nE(){return eE||(eE=1,function(){if(NA)return vA;NA=1;var e,r,t,n,i=BS(),o=Yy(),a=pA(),s=n_(),u=cy(),c=p_(),l=cb(),f=hw(),d=Ub(),h=_A(),g=_y(),v=l_(),m=uy(),p=yA(),_=SA(),y=CA().set,S=kA(),I=PA(),b=FA(),C=wA(),T=jb(),w=DA(),A=xA(),E=WA(),k="Promise",P=A.CONSTRUCTOR,F=A.REJECTION_EVENT,D=A.SUBCLASSING,x=T.getterFor(k),O=T.set,N=w&&w.prototype,R=w,W=N,M=s.TypeError,L=s.document,B=s.process,U=E.f,V=U,j=!!(L&&L.createEvent&&s.dispatchEvent),H="unhandledrejection",G=function(e){var r;return!(!m(e)||!v(r=e.then))&&r},z=function(e,r){var t,n,i,o=r.value,a=1===r.state,s=a?e.ok:e.fail,u=e.resolve,l=e.reject,f=e.domain;try{s?(a||(2===r.rejection&&Y(r),r.rejection=1),!0===s?t=o:(f&&f.enter(),t=s(o),f&&(f.exit(),i=!0)),t===e.promise?l(new M("Promise-chain cycle")):(n=G(t))?c(n,t,u,l):u(t)):l(o)}catch(ia){f&&!i&&f.exit(),l(ia)}},K=function(e,r){e.notified||(e.notified=!0,S(function(){for(var t,n=e.reactions;t=n.get();)z(t,e);e.notified=!1,r&&!e.rejection&&Q(e)}))},J=function(e,r,t){var n,i;j?((n=L.createEvent("Event")).promise=r,n.reason=t,n.initEvent(e,!1,!0),s.dispatchEvent(n)):n={promise:r,reason:t},!F&&(i=s["on"+e])?i(n):e===H&&I("Unhandled promise rejection",t)},Q=function(e){c(y,s,function(){var r,t=e.facade,n=e.value;if(q(e)&&(r=b(function(){a?B.emit("unhandledRejection",n,t):J(H,t,n)}),e.rejection=a||q(e)?2:1,r.error))throw r.value})},q=function(e){return 1!==e.rejection&&!e.parent},Y=function(e){c(y,s,function(){var r=e.facade;a?B.emit("rejectionHandled",r):J("rejectionhandled",r,e.value)})},X=function(e,r,t){return function(n){e(r,n,t)}},Z=function(e,r,t){e.done||(e.done=!0,t&&(e=t),e.value=r,e.state=2,K(e,!0))},$=function(e,r,t){if(!e.done){e.done=!0,t&&(e=t);try{if(e.facade===r)throw new M("Promise can't be resolved itself");var n=G(r);n?S(function(){var t={done:!1};try{c(n,r,X($,t,e),X(Z,t,e))}catch(ia){Z(t,ia,e)}}):(e.value=r,e.state=1,K(e,!1))}catch(ia){Z({done:!1},ia,e)}}};if(P&&(W=(R=function(r){p(this,W),g(r),c(e,this);var t=x(this);try{r(X($,t),X(Z,t))}catch(ia){Z(t,ia)}}).prototype,(e=function(e){O(this,{type:k,done:!1,notified:!1,parent:!1,reactions:new C,rejection:!1,state:0,value:null})}).prototype=l(W,"then",function(e,r){var t=x(this),n=U(_(this,R));return t.parent=!0,n.ok=!v(e)||e,n.fail=v(r)&&r,n.domain=a?B.domain:undefined,0===t.state?t.reactions.add(n):S(function(){z(n,t)}),n.promise}),r=function(){var r=new e,t=x(r);this.promise=r,this.resolve=X($,t),this.reject=X(Z,t)},E.f=U=function(e){return e===R||e===t?new r(e):V(e)},!o&&v(w)&&N!==Object.prototype)){n=N.then,D||l(N,"then",function(e,r){var t=this;return new R(function(e,r){c(n,t,e,r)}).then(e,r)},{unsafe:!0});try{delete N.constructor}catch(ia){}f&&f(N,W)}i({global:!0,constructor:!0,wrap:!0,forced:P},{Promise:R}),t=u.Promise,d(R,k,!1,!0),h(k)}(),function(){if(VA)return jA;VA=1;var e=BS(),r=p_(),t=_y(),n=WA(),i=FA(),o=Tw();e({target:"Promise",stat:!0,forced:GA()},{all:function(e){var a=this,s=n.f(a),u=s.resolve,c=s.reject,l=i(function(){var n=t(a.resolve),i=[],s=0,l=1;o(e,function(e){var t=s++,o=!1;l++,r(n,a,e).then(function(e){o||(o=!0,i[t]=e,--l||u(i))},c)}),--l||u(i)});return l.error&&c(l.value),s.promise}})}(),function(){if(zA)return KA;zA=1;var e=BS(),r=Yy(),t=xA().CONSTRUCTOR,n=DA(),i=ly(),o=l_(),a=cb(),s=n&&n.prototype;if(e({target:"Promise",proto:!0,forced:t,real:!0},{"catch":function(e){return this.then(undefined,e)}}),!r&&o(n)){var u=i("Promise").prototype["catch"];s["catch"]!==u&&a(s,"catch",u,{unsafe:!0})}}(),function(){if(JA)return QA;JA=1;var e=BS(),r=p_(),t=_y(),n=WA(),i=FA(),o=Tw();e({target:"Promise",stat:!0,forced:GA()},{race:function(e){var a=this,s=n.f(a),u=s.reject,c=i(function(){var n=t(a.resolve);o(e,function(e){r(n,a,e).then(s.resolve,u)})});return c.error&&u(c.value),s.promise}})}(),function(){if(qA)return YA;qA=1;var e=BS(),r=WA();e({target:"Promise",stat:!0,forced:xA().CONSTRUCTOR},{reject:function(e){var t=r.f(this);return(0,t.reject)(e),t.promise}})}(),function(){if($A)return rE;$A=1;var e=BS(),r=ly(),t=Yy(),n=DA(),i=xA().CONSTRUCTOR,o=tE(),a=r("Promise"),s=t&&!i;e({target:"Promise",stat:!0,forced:t||i},{resolve:function(e){return o(s&&this===a?n:this,e)}})}()),gA}var iE,oE={};function aE(){if(iE)return oE;iE=1;var e=BS(),r=p_(),t=_y(),n=WA(),i=FA(),o=Tw();return e({target:"Promise",stat:!0,forced:GA()},{allSettled:function(e){var a=this,s=n.f(a),u=s.resolve,c=s.reject,l=i(function(){var n=t(a.resolve),i=[],s=0,c=1;o(e,function(e){var t=s++,o=!1;c++,r(n,a,e).then(function(e){o||(o=!0,i[t]={status:"fulfilled",value:e},--c||u(i))},function(e){o||(o=!0,i[t]={status:"rejected",reason:e},--c||u(i))})}),--c||u(i)});return l.error&&c(l.value),s.promise}}),oE}var sE,uE={};function cE(){if(sE)return uE;sE=1;var e=BS(),r=p_(),t=_y(),n=ly(),i=WA(),o=FA(),a=Tw(),s="No one promise resolved";return e({target:"Promise",stat:!0,forced:GA()},{any:function(e){var u=this,c=n("AggregateError"),l=i.f(u),f=l.resolve,d=l.reject,h=o(function(){var n=t(u.resolve),i=[],o=0,l=1,h=!1;a(e,function(e){var t=o++,a=!1;l++,r(n,u,e).then(function(e){a||h||(h=!0,f(e))},function(e){a||h||(a=!0,i[t]=e,--l||d(new c(i,s)))})}),--l||d(new c(i,s))});return h.error&&d(h.value),l.promise}}),uE}var lE,fE={};function dE(){if(lE)return fE;lE=1;var e=BS(),r=n_(),t=a_(),n=US(),i=WA(),o=_y(),a=FA(),s=r.Promise,u=!1;return e({target:"Promise",stat:!0,forced:!s||!s["try"]||a(function(){s["try"](function(e){u=8===e},8)}).error||!u},{"try":function(e){var r=arguments.length>1?n(arguments,1):[],s=i.f(this),u=a(function(){return t(o(e),undefined,r)});return(u.error?s.reject:s.resolve)(u.value),s.promise}}),fE}var hE,gE={};function vE(){if(hE)return gE;hE=1;var e=BS(),r=WA();return e({target:"Promise",stat:!0},{withResolvers:function(){var e=r.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}}),gE}var mE,pE={};var _E,yE,SE,IE,bE,CE={};function TE(){if(yE)return _E;yE=1;var e=s_(),r=PI(),t=qI(),n=ay(),i=e("".charAt),o=e("".charCodeAt),a=e("".slice),s=function(e){return function(s,u){var c,l,f=t(n(s)),d=r(u),h=f.length;return d<0||d>=h?e?"":undefined:(c=o(f,d))<55296||c>56319||d+1===h||(l=o(f,d+1))<56320||l>57343?e?i(f,d):c:e?a(f,d,d+2):l-56320+(c-55296<<10)+65536}};return _E={codeAt:s(!1),charAt:s(!0)}}function wE(){if(SE)return CE;SE=1;var e=TE().charAt,r=qI(),t=jb(),n=Dw(),i=xw(),o="String Iterator",a=t.set,s=t.getterFor(o);return n(String,"String",function(e){a(this,{type:o,string:r(e),index:0})},function(){var r,t=s(this),n=t.string,o=t.index;return o>=n.length?i(undefined,!0):(r=e(n,o),t.index+=r.length,i(r,!1))}),CE}function AE(){return bE?IE:(bE=1,Aw(),Ow(),nE(),aE(),cE(),dE(),vE(),function(){if(mE)return pE;mE=1;var e=BS(),r=Yy(),t=DA(),n=i_(),i=ly(),o=l_(),a=SA(),s=tE(),u=cb(),c=t&&t.prototype;if(e({target:"Promise",proto:!0,real:!0,forced:!!t&&n(function(){c["finally"].call({then:function(){}},function(){})})},{"finally":function(e){var r=a(this,i("Promise")),t=o(e);return this.then(t?function(t){return s(r,e()).then(function(){return t})}:e,t?function(t){return s(r,e()).then(function(){throw t})}:e)}}),!r&&o(t)){var l=i("Promise").prototype["finally"];c["finally"]!==l&&u(c,"finally",l,{unsafe:!0})}}(),wE(),IE=cy().Promise)}var EE,kE,PE,FE,DE,xE={};function OE(){return kE?EE:(kE=1,EE={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function NE(){if(PE)return xE;PE=1,Ow();var e=OE(),r=n_(),t=Ub(),n=yw();for(var i in e)t(r[i],i),n[i]=n.Array;return xE}function RE(){if(DE)return FE;DE=1;var e=AE();return NE(),FE=e}var WE;var ME,LE,BE;function UE(){if(BE)return LE;BE=1;var e=RE();return WE||(WE=1,dE()),ME||(ME=1,vE()),LE=e}var VE;var jE;var HE,GE,zE,KE,JE;function QE(){if(zE)return GE;zE=1;var e=UE();return VE||(VE=1,Aw()),jE||(jE=1,aE()),HE||(HE=1,cE()),GE=e}function qE(){return JE?KE:(JE=1,KE=QE())}var YE=sh(qE());function XE(e,r,t,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void t(e)}s.done?r(u):YE.resolve(u).then(n,i)}function ZE(e){return function(){var r=this,t=arguments;return new YE(function(n,i){var o=e.apply(r,t);function a(e){XE(o,n,i,a,s,"next",e)}function s(e){XE(o,n,i,a,s,"throw",e)}a(void 0)})}}function $E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var ek,rk,tk,nk,ik,ok,ak,sk={};function uk(){if(rk)return ek;rk=1;var e=TypeError;return ek=function(r){if(r>9007199254740991)throw new e("Maximum allowed index exceeded");return r},ek}function ck(){if(nk)return tk;nk=1;var e=m_(),r=Hb(),t=TypeError,n=Object.getOwnPropertyDescriptor,i=e&&!function(){if(this!==undefined)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(ia){return ia instanceof TypeError}}();return tk=i?function(e,i){if(r(e)&&!n(e,"length").writable)throw new t("Cannot set read only .length");return e.length=i}:function(e,r){return e.length=r}}function lk(){if(ok)return ik;ok=1;var e=i_(),r=nS(),t=hy(),n=r("species");return ik=function(r){return t>=51||!e(function(){var e=[];return(e.constructor={})[n]=function(){return{foo:1}},1!==e[r](Boolean).foo})}}function fk(){if(ak)return sk;ak=1;var e=BS(),r=i_(),t=Hb(),n=uy(),i=eS(),o=xI(),a=uk(),s=Kb(),u=ck(),c=zb(),l=lk(),f=nS(),d=hy(),h=f("isConcatSpreadable"),g=d>=51||!r(function(){var e=[];return e[h]=!1,e.concat()[0]!==e}),v=function(e){if(!n(e))return!1;var r=e[h];return r!==undefined?!!r:t(e)};return e({target:"Array",proto:!0,arity:1,forced:!g||!l("concat")},{concat:function(e){var r,t,n,l,f,d=i(this),h=c(d,0),g=0;for(r=-1,n=arguments.length;r<n;r++)if(v(f=-1===r?d:arguments[r]))for(l=o(f),a(g+l),t=0;t<l;t++,g++)t in f&&s(h,g,f[t]);else a(g+1),s(h,g++,f);return u(h,g),h}}),sk}var dk,hk={};function gk(){return dk||(dk=1,Mb()("asyncDispose")),hk}var vk,mk={};function pk(){return vk||(vk=1,Mb()("asyncIterator")),mk}var _k,yk={};function Sk(){return _k||(_k=1,Mb()("dispose")),yk}var Ik;var bk;var Ck,Tk={};function wk(){return Ck||(Ck=1,Mb()("iterator")),Tk}var Ak;var Ek;var kk;var Pk;var Fk;var Dk;var xk,Ok={};function Nk(){if(xk)return Ok;xk=1;var e=Mb(),r=Lb();return e("toPrimitive"),r(),Ok}var Rk,Wk={};var Mk;var Lk,Bk,Uk,Vk,jk,Hk={};function Gk(){return Uk?Bk:(Uk=1,fk(),IC(),gk(),pk(),Sk(),Ik||(Ik=1,Mb()("hasInstance")),bk||(bk=1,Mb()("isConcatSpreadable")),wk(),Ak||(Ak=1,Mb()("match")),Ek||(Ek=1,Mb()("matchAll")),kk||(kk=1,Mb()("replace")),Pk||(Pk=1,Mb()("search")),Fk||(Fk=1,Mb()("species")),Dk||(Dk=1,Mb()("split")),Nk(),function(){if(Rk)return Wk;Rk=1;var e=ly(),r=Mb(),t=Ub();r("toStringTag"),t(e("Symbol"),"Symbol")}(),Mk||(Mk=1,Mb()("unscopables")),function(){if(Lk)return Hk;Lk=1;var e=n_();Ub()(e.JSON,"JSON",!0)}(),Bk=cy().Symbol)}function zk(){if(jk)return Vk;jk=1;var e=Gk();return NE(),Vk=e}var Kk,Jk={};var Qk;var qk;var Yk,Xk,Zk;function $k(){if(Zk)return Xk;Zk=1;var e=zk();return function(){if(Kk)return Jk;Kk=1;var e=nS(),r=MS().f,t=e("metadata"),n=Function.prototype;n[t]===undefined&&r(n,t,{value:null})}(),Qk||(Qk=1,gk()),qk||(qk=1,Sk()),Yk||(Yk=1,Mb()("metadata")),Xk=e}var eP,rP,tP;function nP(){if(rP)return eP;rP=1;var e=ly(),r=s_(),t=e("Symbol"),n=t.keyFor,i=r(t.prototype.valueOf);return eP=t.isRegisteredSymbol||function(e){try{return n(i(e))!==undefined}catch(ia){return!1}}}var iP,oP,aP;function sP(){if(oP)return iP;oP=1;for(var e=$y(),r=ly(),t=s_(),n=my(),i=nS(),o=r("Symbol"),a=o.isWellKnownSymbol,s=r("Object","getOwnPropertyNames"),u=t(o.prototype.valueOf),c=e("wks"),l=0,f=s(o),d=f.length;l<d;l++)try{var h=f[l];n(o[h])&&i(h)}catch(ia){}return iP=function(e){if(a&&a(e))return!0;try{for(var r=u(e),t=0,n=s(c),i=n.length;t<i;t++)if(c[n[t]]==r)return!0}catch(ia){}return!1},iP}var uP;var cP;var lP;var fP;var dP;var hP;var gP;var vP,mP,pP,_P,yP;function SP(){if(pP)return mP;pP=1;var e=$k();return tP||(tP=1,BS()({target:"Symbol",stat:!0},{isRegisteredSymbol:nP()})),aP||(aP=1,BS()({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:sP()})),uP||(uP=1,Mb()("customMatcher")),cP||(cP=1,Mb()("observable")),lP||(lP=1,BS()({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:nP()})),fP||(fP=1,BS()({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:sP()})),dP||(dP=1,Mb()("matcher")),hP||(hP=1,Mb()("metadataKey")),gP||(gP=1,Mb()("patternMatch")),vP||(vP=1,Mb()("replaceAll")),mP=e}function IP(){return yP?_P:(yP=1,_P=SP())}var bP,CP,TP,wP,AP,EP,kP,PP,FP,DP,xP=sh(IP());function OP(){return CP?bP:(CP=1,Ow(),wE(),wk(),bP=Wb().f("iterator"))}function NP(){if(wP)return TP;wP=1;var e=OP();return NE(),TP=e}function RP(){return EP?AP:(EP=1,AP=NP())}function WP(){return PP?kP:(PP=1,kP=RP())}function MP(){return DP?FP:(DP=1,FP=WP())}var LP=sh(MP());function BP(e){return BP="function"==typeof xP&&"symbol"==typeof LP?function(e){return typeof e}:function(e){return e&&"function"==typeof xP&&e.constructor===xP&&e!==xP.prototype?"symbol":typeof e},BP(e)}var UP,VP,jP,HP,GP,zP,KP,JP,QP,qP,YP;function XP(){return jP?VP:(jP=1,UP||(UP=1,BS()({target:"Object",stat:!0},{setPrototypeOf:hw()})),VP=cy().Object.setPrototypeOf)}function ZP(){return GP?HP:(GP=1,HP=XP())}function $P(){return KP?zP:(KP=1,zP=ZP())}function eF(){return QP?JP:(QP=1,JP=$P())}function rF(){return YP?qP:(YP=1,qP=eF())}var tF,nF,iF,oF,aF,sF,uF,cF,lF,fF,dF,hF,gF,vF,mF,pF=sh(rF()),_F={};function yF(){if(iF)return nF;iF=1;var e=n_(),r=cy();return nF=function(t,n){var i=r[t+"Prototype"],o=i&&i[n];if(o)return o;var a=e[t],s=a&&a.prototype;return s&&s[n]}}function SF(){return aF?oF:(aF=1,function(){if(tF)return _F;tF=1;var e=BS(),r=VS();e({target:"Function",proto:!0,forced:Function.bind!==r},{bind:r})}(),oF=yF()("Function","bind"))}function IF(){if(uF)return sF;uF=1;var e=fy(),r=SF(),t=Function.prototype;return sF=function(n){var i=n.bind;return n===t||e(t,n)&&i===t.bind?r:i},sF}function bF(){return lF?cF:(lF=1,cF=IF())}function CF(){return dF?fF:(dF=1,fF=bF())}function TF(){return gF?hF:(gF=1,hF=CF())}function wF(){return mF?vF:(mF=1,vF=TF())}var AF,EF,kF,PF,FF,DF,xF,OF,NF,RF,WF,MF=sh(wF()),LF={};function BF(){return kF?EF:(kF=1,function(){if(AF)return LF;AF=1;var e=BS(),r=i_(),t=eS(),n=cw(),i=uw();e({target:"Object",stat:!0,forced:r(function(){n(1)}),sham:!i},{getPrototypeOf:function(e){return n(t(e))}})}(),EF=cy().Object.getPrototypeOf)}function UF(){return FF?PF:(FF=1,PF=BF())}function VF(){return xF?DF:(xF=1,DF=UF())}function jF(){return NF?OF:(NF=1,OF=VF())}function HF(){return WF?RF:(WF=1,RF=jF())}var GF=sh(HF());function zF(e){var r;return zF=pF?MF(r=GF).call(r):function(e){return e.__proto__||GF(e)},zF(e)}var KF,JF,QF,qF,YF,XF,ZF,$F,eD,rD,tD,nD,iD,oD={};function aD(){if(JF)return KF;JF=1;var e=rS();return KF=function(r){return r!==undefined&&(e(r,"value")||e(r,"writable"))}}function sD(){return YF?qF:(YF=1,function(){if(QF)return oD;QF=1;var e=BS(),r=p_(),t=uy(),n=WS(),i=aD(),o=uS(),a=cw(),s=oS(),u=function(e,s,c){if(n(e)===c)return e[s];var l=o.f(e,s);if(l)return i(l)?l.value:l.get===undefined?undefined:r(l.get,c);var f=a(e);return t(f)?u(f,s,c):void 0};e({target:"Reflect",stat:!0},{get:function(e,r){return u(n(e),s(r),arguments.length<3?e:arguments[2])}})}(),qF=cy().Reflect.get)}function uD(){return ZF?XF:(ZF=1,XF=sD())}function cD(){return eD?$F:(eD=1,$F=uD())}function lD(){return tD?rD:(tD=1,rD=cD())}function fD(){return iD?nD:(iD=1,nD=lD())}var dD,hD,gD,vD,mD,pD,_D=sh(fD());function yD(){return hD?dD:(hD=1,dD=NC())}function SD(){return vD?gD:(vD=1,gD=yD())}function ID(){return pD?mD:(pD=1,mD=SD())}var bD=sh(ID());function CD(){var e;return CD="undefined"!=typeof Reflect&&_D?MF(e=_D).call(e):function(e,r,t){var n=function(e,r){for(;!{}.hasOwnProperty.call(e,r)&&null!==(e=zF(e)););return e}(e,r);if(n){var i=bD(n,r);return i.get?i.get.call(arguments.length<3?e:t):i.value}},CD.apply(null,arguments)}var TD,wD,AD,ED,kD,PD,FD,DD,xD,OD,ND;function RD(){if(AD)return wD;AD=1,TD||(TD=1,BS()({target:"Object",stat:!0,sham:!m_()},{create:VI()}));var e=cy().Object;return wD=function(r,t){return e.create(r,t)}}function WD(){return kD?ED:(kD=1,ED=RD())}function MD(){return FD?PD:(FD=1,PD=WD())}function LD(){return xD?DD:(xD=1,DD=MD())}function BD(){return ND?OD:(ND=1,OD=LD())}var UD,VD,jD,HD,GD,zD,KD,JD,QD,qD,YD=sh(BD()),XD={exports:{}},ZD={};function $D(){if(UD)return ZD;UD=1;var e=BS(),r=m_(),t=MS().f;return e({target:"Object",stat:!0,forced:Object.defineProperty!==t,sham:!r},{defineProperty:t}),ZD}function ex(){if(VD)return XD.exports;VD=1,$D();var e=cy().Object,r=XD.exports=function(r,t,n){return e.defineProperty(r,t,n)};return e.defineProperty.sham&&(r.sham=!0),XD.exports}function rx(){return HD?jD:(HD=1,jD=ex())}function tx(){return zD?GD:(zD=1,GD=rx())}function nx(){return JD?KD:(JD=1,KD=tx())}function ix(){return qD?QD:(qD=1,QD=nx())}var ox=sh(ix());function ax(e,r){var t;return ax=pF?MF(t=pF).call(t):function(e,r){return e.__proto__=r,e},ax(e,r)}function sx(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=YD(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),ox(e,"prototype",{writable:!1}),r&&ax(e,r)}var ux,cx,lx,fx,dx,hx,gx,vx,mx,px,_x;function yx(){return lx?cx:(lx=1,ux||(ux=1,BS()({target:"Array",stat:!0},{isArray:Hb()})),cx=cy().Array.isArray)}function Sx(){return dx?fx:(dx=1,fx=yx())}function Ix(){return gx?hx:(gx=1,hx=Sx())}function bx(){return mx?vx:(mx=1,vx=Ix())}function Cx(){return _x?px:(_x=1,px=bx())}var Tx,wx,Ax,Ex,kx,Px,Fx,Dx,xx,Ox,Nx=sh(Cx());function Rx(){return wx?Tx:(wx=1,Ow(),wE(),Tx=Iw())}function Wx(){if(Ex)return Ax;Ex=1;var e=Rx();return NE(),Ax=e}function Mx(){return Px?kx:(Px=1,kx=Wx())}function Lx(){return Dx?Fx:(Dx=1,Fx=Mx())}function Bx(){return Ox?xx:(Ox=1,xx=Lx())}var Ux,Vx,jx,Hx,Gx,zx,Kx,Jx,Qx,qx,Yx,Xx,Zx,$x=sh(Bx()),eO={};function rO(){return jx?Vx:(jx=1,function(){if(Ux)return eO;Ux=1;var e=BS(),r=eS(),t=xI(),n=ck(),i=uk();e({target:"Array",proto:!0,arity:1,forced:i_()(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(ia){return ia instanceof TypeError}}()},{push:function(e){var o=r(this),a=t(o),s=arguments.length;i(a+s);for(var u=0;u<s;u++)o[a]=arguments[u],a++;return n(o,a),a}})}(),Vx=yF()("Array","push"))}function tO(){if(Gx)return Hx;Gx=1;var e=fy(),r=rO(),t=Array.prototype;return Hx=function(n){var i=n.push;return n===t||e(t,n)&&i===t.push?r:i},Hx}function nO(){return Kx?zx:(Kx=1,zx=tO())}function iO(){return Qx?Jx:(Qx=1,Jx=nO())}function oO(){return Yx?qx:(Yx=1,qx=iO())}function aO(){return Zx?Xx:(Zx=1,Xx=oO())}var sO=sh(aO());var uO,cO,lO,fO,dO,hO,gO,vO,mO,pO,_O,yO,SO,IO={};function bO(){return lO?cO:(lO=1,function(){if(uO)return IO;uO=1;var e=BS(),r=Hb(),t=zS(),n=uy(),i=FI(),o=xI(),a=sy(),s=Kb(),u=ck(),c=nS(),l=lk(),f=US(),d=l("slice"),h=c("species"),g=Array,v=Math.max;e({target:"Array",proto:!0,forced:!d},{slice:function(e,c){var l,d,m,p=a(this),_=o(p),y=i(e,_),S=i(c===undefined?_:c,_);if(r(p)&&(l=p.constructor,(t(l)&&(l===g||r(l.prototype))||n(l)&&null===(l=l[h]))&&(l=undefined),l===g||l===undefined))return f(p,y,S);for(d=new(l===undefined?g:l)(v(S-y,0)),m=0;y<S;y++,m++)y in p&&s(d,m,p[y]);return u(d,m),d}})}(),cO=yF()("Array","slice"))}function CO(){if(dO)return fO;dO=1;var e=fy(),r=bO(),t=Array.prototype;return fO=function(n){var i=n.slice;return n===t||e(t,n)&&i===t.slice?r:i},fO}function TO(){return gO?hO:(gO=1,hO=CO())}function wO(){return mO?vO:(mO=1,vO=TO())}function AO(){return _O?pO:(_O=1,pO=wO())}function EO(){return SO?yO:(SO=1,yO=AO())}var kO,PO,FO,DO,xO,OO,NO,RO,WO,MO,LO,BO,UO,VO,jO,HO=sh(EO()),GO={};function zO(){if(PO)return kO;PO=1;var e=WS(),r=Cw();return kO=function(t,n,i,o){try{return o?n(e(i)[0],i[1]):n(i)}catch(ia){r(t,"throw",ia)}},kO}function KO(){if(DO)return FO;DO=1;var e=lS(),r=p_(),t=eS(),n=zO(),i=Sw(),o=zS(),a=xI(),s=Kb(),u=ck(),c=bw(),l=Iw(),f=Cw(),d=Array;return FO=function(h){var g=o(this),v=arguments.length,m=v>1?arguments[1]:undefined,p=m!==undefined;p&&(m=e(m,v>2?arguments[2]:undefined));var _,y,S,I,b,C,T=t(h),w=l(T),A=0;if(!w||this===d&&i(w))for(_=a(T),y=g?new this(_):d(_);_>A;A++)C=p?m(T[A],A):T[A],s(y,A,C);else for(y=g?new this:[],b=(I=c(T,w)).next;!(S=r(b,I)).done;A++){C=p?n(I,m,[S.value,A],!0):S.value;try{s(y,A,C)}catch(ia){f(I,"throw",ia)}}return u(y,A),y},FO}function JO(){return NO?OO:(NO=1,wE(),function(){if(xO)return GO;xO=1;var e=BS(),r=KO();e({target:"Array",stat:!0,forced:!HA()(function(e){Array.from(e)})},{from:r})}(),OO=cy().Array.from)}function QO(){return WO?RO:(WO=1,RO=JO())}function qO(){return LO?MO:(LO=1,MO=QO())}function YO(){return UO?BO:(UO=1,BO=qO())}function XO(){return jO?VO:(jO=1,VO=YO())}var ZO,$O,eN,rN,tN,nN,iN,oN,aN,sN,uN=sh(XO());function cN(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function lN(e,r){if(e){var t;if("string"==typeof e)return cN(e,r);var n=HO(t={}.toString.call(e)).call(t,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?uN(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cN(e,r):void 0}}function fN(e,r){return function(e){if(Nx(e))return e}(e)||function(e,r){var t=null==e?null:void 0!==xP&&$x(e)||e["@@iterator"];if(null!=t){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(sO(s).call(s,n.value),s.length!==r);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=t["return"]&&(a=t["return"](),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,r)||lN(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dN(e){return function(e){if(Nx(e))return cN(e)}(e)||function(e){if(void 0!==xP&&null!=$x(e)||null!=e["@@iterator"])return uN(e)}(e)||lN(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hN(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function gN(){return $O?ZO:($O=1,Nk(),ZO=Wb().f("toPrimitive"))}function vN(){return rN?eN:(rN=1,eN=gN())}function mN(){return nN?tN:(nN=1,tN=vN())}function pN(){return oN?iN:(oN=1,iN=mN())}function _N(){return sN?aN:(sN=1,aN=pN())}var yN=sh(_N());function SN(e){var r=function(e,r){if("object"!=BP(e)||!e)return e;var t=e[yN];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=BP(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==BP(r)?r:r+""}function IN(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),ox(e,SN(n.key),n)}}function bN(e,r,t){return r&&IN(e.prototype,r),t&&IN(e,t),ox(e,"prototype",{writable:!1}),e}function CN(e,r,t){return(r=SN(r))in e?ox(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):"__proto__"!==r&&"prototype"!==r&&"constructor"!==r&&(e[r]=t),e}var TN,wN,AN,EN,kN,PN,FN,DN,xN,ON,NN,RN,WN,MN={exports:{}},LN={};function BN(){return AN?wN:(AN=1,function(){if(TN)return LN;TN=1;var e=BS(),r=s_(),t=Hb(),n=r([].reverse),i=[1,2];e({target:"Array",proto:!0,forced:String(i)===String(i.reverse())},{reverse:function(){return t(this)&&(this.length=this.length),n(this)}})}(),wN=yF()("Array","reverse"))}function UN(){if(kN)return EN;kN=1;var e=fy(),r=BN(),t=Array.prototype;return EN=function(n){var i=n.reverse;return n===t||e(t,n)&&i===t.reverse?r:i},EN}function VN(){return FN?PN:(FN=1,PN=UN())}function jN(){return xN?DN:(xN=1,DN=VN())}function HN(){return NN?ON:(NN=1,ON=jN())}function GN(){return WN?RN:(WN=1,RN=HN())}var zN,KN={exports:{}};function JN(){return zN||(zN=1,(e=KN).exports=function(e,r){this.v=e,this.k=r},e.exports.__esModule=!0,e.exports["default"]=e.exports),KN.exports;var e}var QN,qN,YN={exports:{}},XN={exports:{}};function ZN(){return QN||(QN=1,function(e){var r=ix();function t(n,i,o,a){var s=r;try{s({},"",{})}catch(n){s=0}e.exports=t=function(e,r,n,i){function o(r,n){t(e,r,function(e){return this._invoke(r,n,e)})}r?s?s(e,r,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},e.exports.__esModule=!0,e.exports["default"]=e.exports,t(n,i,o,a)}e.exports=t,e.exports.__esModule=!0,e.exports["default"]=e.exports}(XN)),XN.exports}function $N(){return qN||(qN=1,function(e){var r=IP(),t=BD(),n=wF(),i=HF(),o=rF(),a=ZN();function s(){var u,c,l="function"==typeof r?r:{},f=l.iterator||"@@iterator",d=l.toStringTag||"@@toStringTag";function h(e,r,i,o){var s=r&&r.prototype instanceof v?r:v,l=t(s.prototype);return a(l,"_invoke",function(e,r,t){var i,o,a,s=0,l=t||[],f=!1,d={p:0,n:0,v:u,a:h,f:n(h).call(h,u,4),d:function(e,r){return i=e,o=0,a=u,d.n=r,g}};function h(e,r){for(o=e,a=r,c=0;!f&&s&&!t&&c<l.length;c++){var t,n=l[c],i=d.p,h=n[2];e>3?(t=h===r)&&(a=n[(o=n[4])?5:(o=3,3)],n[4]=n[5]=u):n[0]<=i&&((t=e<2&&i<n[1])?(o=0,d.v=r,d.n=n[1]):i<h&&(t=e<3||n[0]>r||r>h)&&(n[4]=e,n[5]=r,d.n=h,o=0))}if(t||e>1)return g;throw f=!0,r}return function(t,n,l){if(s>1)throw TypeError("Generator is already running");for(f&&1===n&&h(n,l),o=n,a=l;(c=o<2?u:a)||!f;){i||(o?o<3?(o>1&&(d.n=-1),h(o,a)):d.n=a:d.v=a);try{if(s=2,i){if(o||(t="next"),c=i[t]){if(!(c=c.call(i,a)))throw TypeError("iterator result is not an object");if(!c.done)return c;a=c.value,o<2&&(o=0)}else 1===o&&(c=i["return"])&&c.call(i),o<2&&(a=TypeError("The iterator does not provide a '"+t+"' method"),o=1);i=u}else if((c=(f=d.n<0)?a:e.call(r,d))!==g)break}catch(c){i=u,o=1,a=c}finally{s=1}}return{value:c,done:f}}}(e,i,o),!0),l}var g={};function v(){}function m(){}function p(){}c=i;var _=[][f]?c(c([][f]())):(a(c={},f,function(){return this}),c),y=p.prototype=v.prototype=t(_);function S(e){return o?o(e,p):(e.__proto__=p,a(e,d,"GeneratorFunction")),e.prototype=t(y),e}return m.prototype=p,a(y,"constructor",p),a(p,"constructor",m),m.displayName="GeneratorFunction",a(p,d,"GeneratorFunction"),a(y),a(y,d,"Generator"),a(y,f,function(){return this}),a(y,"toString",function(){return"[object Generator]"}),(e.exports=s=function(){return{w:h,m:S}},e.exports.__esModule=!0,e.exports["default"]=e.exports)()}e.exports=s,e.exports.__esModule=!0,e.exports["default"]=e.exports}(YN)),YN.exports}var eR,rR,tR,nR,iR,oR,aR,sR,uR,cR,lR,fR,dR,hR={exports:{}},gR={exports:{}},vR={exports:{}};function mR(){return rR?eR:(rR=1,pk(),eR=Wb().f("asyncIterator"))}function pR(){return nR?tR:(nR=1,tR=mR())}function _R(){return oR?iR:(oR=1,iR=pR())}function yR(){return sR?aR:(sR=1,aR=_R())}function SR(){return cR?uR:(cR=1,uR=yR())}function IR(){return lR||(lR=1,function(e){var r=IP(),t=SR(),n=JN(),i=ZN();e.exports=function o(e,a){function s(r,t,i,o){try{var u=e[r](t),c=u.value;return c instanceof n?a.resolve(c.v).then(function(e){s("next",e,i,o)},function(e){s("throw",e,i,o)}):a.resolve(c).then(function(e){u.value=e,i(u)},function(e){return s("throw",e,i,o)})}catch(e){o(e)}}var u;this.next||(i(o.prototype),i(o.prototype,"function"==typeof r&&t||"@asyncIterator",function(){return this})),i(this,"_invoke",function(e,r,t){function n(){return new a(function(r,n){s(e,t,r,n)})}return u=u?u.then(n,n):n()},!0)},e.exports.__esModule=!0,e.exports["default"]=e.exports}(vR)),vR.exports}function bR(){return fR||(fR=1,function(e){var r=qE(),t=$N(),n=IR();e.exports=function(e,i,o,a,s){return new n(t().w(e,i,o,a),s||r)},e.exports.__esModule=!0,e.exports["default"]=e.exports}(gR)),gR.exports}function CR(){return dR||(dR=1,function(e){var r=bR();e.exports=function(e,t,n,i,o){var a=r(e,t,n,i,o);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports["default"]=e.exports}(hR)),hR.exports}var TR,wR,AR,ER,kR,PR,FR,DR,xR,OR,NR,RR,WR,MR,LR,BR,UR={exports:{}},VR={};function jR(){if(wR)return TR;wR=1;var e=py(),r=TypeError;return TR=function(t,n){if(!delete t[n])throw new r("Cannot delete property "+e(n)+" of "+e(t))}}function HR(){return kR?ER:(kR=1,function(){if(AR)return VR;AR=1;var e=BS(),r=eS(),t=xI(),n=ck(),i=jR(),o=uk();e({target:"Array",proto:!0,arity:1,forced:1!==[].unshift(0)||!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(ia){return ia instanceof TypeError}}()},{unshift:function(e){var a=r(this),s=t(a),u=arguments.length;if(u){o(s+u);for(var c=s;c--;){var l=c+u;c in a?a[l]=a[c]:i(a,l)}for(var f=0;f<u;f++)a[f]=arguments[f]}return n(a,s+u)}})}(),ER=yF()("Array","unshift"))}function GR(){if(FR)return PR;FR=1;var e=fy(),r=HR(),t=Array.prototype;return PR=function(n){var i=n.unshift;return n===t||e(t,n)&&i===t.unshift?r:i},PR}function zR(){return xR?DR:(xR=1,DR=GR())}function KR(){return NR?OR:(NR=1,OR=zR())}function JR(){return WR?RR:(WR=1,RR=KR())}function QR(){return LR?MR:(LR=1,MR=JR())}function qR(){return BR||(BR=1,e=UR,r=QR(),e.exports=function(e){var t=Object(e),n=[];for(var i in t)r(n).call(n,i);return function o(){for(;n.length;)if((i=n.pop())in t)return o.value=i,o.done=!1,o;return o.done=!0,o}},e.exports.__esModule=!0,e.exports["default"]=e.exports),UR.exports;var e,r}var YR,XR,ZR,$R,eW,rW={exports:{}},tW={exports:{}};function nW(){return YR||(YR=1,function(e){var r=IP(),t=MP();function n(i){return e.exports=n="function"==typeof r&&"symbol"==typeof t?function(e){return typeof e}:function(e){return e&&"function"==typeof r&&e.constructor===r&&e!==r.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports["default"]=e.exports,n(i)}e.exports=n,e.exports.__esModule=!0,e.exports["default"]=e.exports}(tW)),tW.exports}function iW(){return XR||(XR=1,function(e){var r=nW()["default"],t=IP(),n=MP();e.exports=function(e){if(null!=e){var i=e["function"==typeof t&&n||"@@iterator"],o=0;if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports["default"]=e.exports}(rW)),rW.exports}var oW,aW,sW=function(){if(eW)return $R;eW=1;var e=(ZR||(ZR=1,function(e){var r=HF(),t=GN(),n=JN(),i=$N(),o=CR(),a=bR(),s=IR(),u=qR(),c=iW();function l(){var f=i(),d=f.m(l),h=(r?r(d):d.__proto__).constructor;function g(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))}var v={"throw":1,"return":2,"break":3,"continue":3};function m(e){var r,t;return function(n){r||(r={stop:function(){return t(n.a,2)},"catch":function(){return n.v},abrupt:function(e,r){return t(n.a,v[e],r)},delegateYield:function(e,i,o){return r.resultName=i,t(n.d,c(e),o)},finish:function(e){return t(n.f,e)}},t=function(e,t,i){n.p=r.prev,n.n=r.next;try{return e(t,i)}finally{r.next=n.n}}),r.resultName&&(r[r.resultName]=n.v,r.resultName=void 0),r.sent=n.v,r.next=n.n;try{return e.call(this,r)}finally{n.p=r.prev,n.n=r.next}}}return(e.exports=l=function(){return{wrap:function(e,r,n,i){return f.w(m(e),r,n,i&&t(i).call(i))},isGeneratorFunction:g,mark:f.m,awrap:function(e,r){return new n(e,r)},AsyncIterator:s,async:function(e,r,t,n,i){return(g(r)?a:o)(m(e),r,t,n,i)},keys:u,values:c}},e.exports.__esModule=!0,e.exports["default"]=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports["default"]=e.exports}(MN)),MN.exports)();$R=e;try{regeneratorRuntime=e}catch(r){"object"===("undefined"==typeof globalThis?"undefined":C(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return $R}(),uW=sh(sW);var cW,lW,fW,dW,hW,gW,vW,mW,pW,_W,yW,SW,IW,bW=sh(aW?oW:(aW=1,oW=Sx())),CW={};function TW(){if(lW)return cW;lW=1;var e=i_();return cW=function(r,t){var n=[][r];return!!n&&e(function(){n.call(null,t||function(){return 1},1)})}}function wW(){if(dW)return fW;dW=1;var e=Jb().forEach,r=TW()("forEach");return fW=r?[].forEach:function(r){return e(this,r,arguments.length>1?arguments[1]:undefined)},fW}function AW(){return vW?gW:(vW=1,function(){if(hW)return CW;hW=1;var e=BS(),r=wW();e({target:"Array",proto:!0,forced:[].forEach!==r},{forEach:r})}(),gW=yF()("Array","forEach"))}function EW(){return pW?mW:(pW=1,mW=AW())}function kW(){if(yW)return _W;yW=1;var e=HS(),r=rS(),t=fy(),n=EW(),i=Array.prototype,o={DOMTokenList:!0,NodeList:!0};return _W=function(a){var s=a.forEach;return a===i||t(i,a)&&s===i.forEach||r(o,e(a))?n:s},_W}var PW,FW,DW,xW,OW,NW,RW,WW=sh(IW?SW:(IW=1,SW=kW())),MW={};function LW(){return DW?FW:(DW=1,function(){if(PW)return MW;PW=1;var e=BS(),r=eS(),t=MI();e({target:"Object",stat:!0,forced:i_()(function(){t(1)})},{keys:function(e){return t(r(e))}})}(),FW=cy().Object.keys)}function BW(){return OW?xW:(OW=1,xW=LW())}var UW,VW,jW,HW,GW,zW,KW,JW=sh(RW?NW:(RW=1,NW=BW()));function QW(){return jW?VW:(jW=1,UW||(UW=1,BS()({target:"Number",stat:!0},{isNaN:function(e){return e!=e}})),VW=cy().Number.isNaN)}function qW(){return GW?HW:(GW=1,HW=QW())}var YW,XW,ZW,$W,eM,rM,tM,nM,iM=sh(KW?zW:(KW=1,zW=qW()));function oM(){return XW?YW:(XW=1,fk(),YW=yF()("Array","concat"))}function aM(){if($W)return ZW;$W=1;var e=fy(),r=oM(),t=Array.prototype;return ZW=function(n){var i=n.concat;return n===t||e(t,n)&&i===t.concat?r:i},ZW}function sM(){return rM?eM:(rM=1,eM=aM())}var uM,cM,lM,fM,dM,hM,gM,vM,mM,pM=sh(nM?tM:(nM=1,tM=sM())),_M={};function yM(){if(lM)return cM;lM=1;var e=i_(),r=nS(),t=m_(),n=Yy(),i=r("iterator");return cM=!e(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),r=e.searchParams,o=new URLSearchParams("a=1&a=2&b=3"),a="";return e.pathname="c%20d",r.forEach(function(e,t){r["delete"]("b"),a+=t+e}),o["delete"]("a",2),o["delete"]("b",undefined),n&&(!e.toJSON||!o.has("a",1)||o.has("a",2)||!o.has("a",undefined)||o.has("b"))||!r.size&&(n||!t)||!r.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==r.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!r[i]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==a||"x"!==new URL("https://x",undefined).host}),cM}function SM(){if(dM)return fM;dM=1;var e=cb();return fM=function(r,t,n){for(var i in t)n&&n.unsafe&&r[i]?r[i]=t[i]:e(r,i,t[i],n);return r}}function IM(){if(gM)return hM;gM=1;var e=US(),r=Math.floor,t=function(n,i){var o=n.length;if(o<8)for(var a,s,u=1;u<o;){for(s=u,a=n[u];s&&i(n[s-1],a)>0;)n[s]=n[--s];s!==u++&&(n[s]=a)}else for(var c=r(o/2),l=t(e(n,0,c),i),f=t(e(n,c),i),d=l.length,h=f.length,g=0,v=0;g<d||v<h;)n[g+v]=g<d&&v<h?i(l[g],f[v])<=0?l[g++]:f[v++]:g<d?l[g++]:f[v++];return n};return hM=t}function bM(){if(mM)return vM;mM=1,Ow(),function(){if(uM)return _M;uM=1;var e=BS(),r=s_(),t=FI(),n=RangeError,i=String.fromCharCode,o=String.fromCodePoint,a=r([].join);e({target:"String",stat:!0,arity:1,forced:!!o&&1!==o.length},{fromCodePoint:function(e){for(var r,o=[],s=arguments.length,u=0;s>u;){if(t(r=+arguments[u],1114111)!==r)throw new n(r+" is not a valid code point");o[u++]=r<65536?i(r):i(55296+((r-=65536)>>10),r%1024+56320)}return a(o,"")}})}();var e=BS(),r=n_(),t=TA(),n=ly(),i=p_(),o=s_(),a=m_(),s=yM(),u=cb(),c=lb(),l=SM(),f=Ub(),d=Fw(),h=jb(),g=yA(),v=l_(),m=rS(),p=lS(),_=HS(),y=WS(),S=uy(),I=qI(),b=VI(),C=ny(),T=bw(),w=Iw(),A=xw(),E=IA(),k=nS(),P=IM(),F=k("iterator"),D="URLSearchParams",x=D+"Iterator",O=h.set,N=h.getterFor(D),R=h.getterFor(x),W=t("fetch"),M=t("Request"),L=t("Headers"),B=M&&M.prototype,U=L&&L.prototype,V=r.TypeError,j=r.encodeURIComponent,H=String.fromCharCode,G=n("String","fromCodePoint"),z=parseInt,K=o("".charAt),J=o([].join),Q=o([].push),q=o("".replace),Y=o([].shift),X=o([].splice),Z=o("".split),$=o("".slice),ee=o(/./.exec),re=/\+/g,te=/^[0-9a-f]+$/i,ne=function(e,r){var t=$(e,r,r+2);return ee(te,t)?z(t,16):NaN},ie=function(e){for(var r=0,t=128;t>0&&0!==(e&t);t>>=1)r++;return r},oe=function(e){var r=null,t=e.length;switch(t){case 1:r=e[0];break;case 2:r=(31&e[0])<<6|63&e[1];break;case 3:r=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:r=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return null===r||r>1114111||r>=55296&&r<=57343||r<(t>3?65536:t>2?2048:t>1?128:0)?null:r},ae=function(e){for(var r=(e=q(e,re," ")).length,t="",n=0;n<r;){var i=K(e,n);if("%"===i){if("%"===K(e,n+1)||n+3>r){t+="%",n++;continue}var o=ne(e,n+1);if(o!=o){t+=i,n++;continue}n+=2;var a=ie(o);if(0===a)i=H(o);else{if(1===a||a>4){t+="�",n++;continue}for(var s=[o],u=1;u<a&&!(++n+3>r||"%"!==K(e,n));){var c=ne(e,n+1);if(c!=c||c>191||c<128)break;if(1===u){if(224===o&&c<160)break;if(237===o&&c>159)break;if(240===o&&c<144)break;if(244===o&&c>143)break}Q(s,c),n+=2,u++}if(s.length!==a){t+="�";continue}var l=oe(s);if(null===l){for(var f=0;f<a;f++)t+="�";n++;continue}i=G(l)}}t+=i,n++}return t},se=/[!'()~]|%20/g,ue={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ce=function(e){return ue[e]},le=function(e){return q(j(e),se,ce)},fe=d(function(e,r){O(this,{type:x,target:N(e).entries,index:0,kind:r})},D,function(){var e=R(this),r=e.target,t=e.index++;if(!r||t>=r.length)return e.target=null,A(undefined,!0);var n=r[t];switch(e.kind){case"keys":return A(n.key,!1);case"values":return A(n.value,!1)}return A([n.key,n.value],!1)},!0),de=function(e){this.entries=[],this.url=null,e!==undefined&&(S(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===K(e,0)?$(e,1):e:I(e)))};de.prototype={type:D,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var r,t,n,o,a,s,u,c=this.entries,l=w(e);if(l)for(t=(r=T(e,l)).next;!(n=i(t,r)).done;){if(a=(o=T(y(n.value))).next,(s=i(a,o)).done||(u=i(a,o)).done||!i(a,o).done)throw new V("Expected sequence with length 2");Q(c,{key:I(s.value),value:I(u.value)})}else for(var f in e)m(e,f)&&Q(c,{key:f,value:I(e[f])})},parseQuery:function(e){if(e)for(var r,t,n=this.entries,i=Z(e,"&"),o=0;o<i.length;)(r=i[o++]).length&&(t=Z(r,"="),Q(n,{key:ae(Y(t)),value:ae(J(t,"="))}))},serialize:function(){for(var e,r=this.entries,t=[],n=0;n<r.length;)e=r[n++],Q(t,le(e.key)+"="+le(e.value));return J(t,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var he=function(){g(this,ge);var e=arguments.length>0?arguments[0]:undefined,r=O(this,new de(e));a||(this.size=r.entries.length)},ge=he.prototype;if(l(ge,{append:function(e,r){var t=N(this);E(arguments.length,2),Q(t.entries,{key:I(e),value:I(r)}),a||this.size++,t.updateURL()},"delete":function(e){for(var r=N(this),t=E(arguments.length,1),n=r.entries,i=I(e),o=t<2?undefined:arguments[1],s=o===undefined?o:I(o),u=0;u<n.length;){var c=n[u];c.key!==i||s!==undefined&&c.value!==s?u++:X(n,u,1)}a||(this.size=n.length),r.updateURL()},get:function(e){var r=N(this).entries;E(arguments.length,1);for(var t=I(e),n=0;n<r.length;n++)if(r[n].key===t)return r[n].value;return null},getAll:function(e){var r=N(this).entries;E(arguments.length,1);for(var t=I(e),n=[],i=0;i<r.length;i++)r[i].key===t&&Q(n,r[i].value);return n},has:function(e){for(var r=N(this).entries,t=E(arguments.length,1),n=I(e),i=t<2?undefined:arguments[1],o=i===undefined?i:I(i),a=0;a<r.length;){var s=r[a++];if(s.key===n&&(o===undefined||s.value===o))return!0}return!1},set:function(e,r){var t=N(this);E(arguments.length,2);for(var n,i=t.entries,o=!1,s=I(e),u=I(r),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?X(i,c--,1):(o=!0,n.value=u));o||Q(i,{key:s,value:u}),a||(this.size=i.length),t.updateURL()},sort:function(){var e=N(this);P(e.entries,function(e,r){return e.key>r.key?1:-1}),e.updateURL()},forEach:function(e){for(var r,t=N(this).entries,n=p(e,arguments.length>1?arguments[1]:undefined),i=0;i<t.length;)n((r=t[i++]).value,r.key,this)},keys:function(){return new fe(this,"keys")},values:function(){return new fe(this,"values")},entries:function(){return new fe(this,"entries")}},{enumerable:!0}),u(ge,F,ge.entries,{name:"entries"}),u(ge,"toString",function(){return N(this).serialize()},{enumerable:!0}),a&&c(ge,"size",{get:function(){return N(this).entries.length},configurable:!0,enumerable:!0}),f(he,D),e({global:!0,constructor:!0,forced:!s},{URLSearchParams:he}),!s&&v(L)){var ve=o(U.has),me=o(U.set),pe=function(e){if(S(e)){var r,t=e.body;if(_(t)===D)return r=e.headers?new L(e.headers):new L,ve(r,"content-type")||me(r,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),b(e,{body:C(0,I(t)),headers:C(0,r)})}return e};if(v(W)&&e({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return W(e,arguments.length>1?pe(arguments[1]):{})}}),v(M)){var _e=function(e){return g(this,B),new M(e,arguments.length>1?pe(arguments[1]):{})};B.constructor=_e,_e.prototype=B,e({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:_e})}}return vM={URLSearchParams:he,getState:N}}var CM,TM,wM,AM,EM,kM,PM={};function FM(){if(TM)return CM;TM=1;var e=m_(),r=s_(),t=p_(),n=i_(),i=MI(),o=ub(),a=ty(),s=eS(),u=iy(),c=Object.assign,l=Object.defineProperty,f=r([].concat);return CM=!c||n(function(){if(e&&1!==c({b:1},c(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var r={},t={},n=Symbol("assign detection"),o="abcdefghijklmnopqrst";return r[n]=7,o.split("").forEach(function(e){t[e]=e}),7!==c({},r)[n]||i(c({},t)).join("")!==o})?function(r,n){for(var c=s(r),l=arguments.length,d=1,h=o.f,g=a.f;l>d;)for(var v,m=u(arguments[d++]),p=h?f(i(m),h(m)):i(m),_=p.length,y=0;_>y;)v=p[y++],e&&!t(g,m,v)||(c[v]=m[v]);return c}:c,CM}function DM(){if(AM)return wM;AM=1;var e=s_(),r=2147483647,t=/[^\0-\u007E]/,n=/[.\u3002\uFF0E\uFF61]/g,i="Overflow: input needs wider integers to process",o=RangeError,a=e(n.exec),s=Math.floor,u=String.fromCharCode,c=e("".charCodeAt),l=e([].join),f=e([].push),d=e("".replace),h=e("".split),g=e("".toLowerCase),v=function(e){return e+22+75*(e<26)},m=function(e,r,t){var n=0;for(e=t?s(e/700):e>>1,e+=s(e/r);e>455;)e=s(e/35),n+=36;return s(n+36*e/(e+38))},p=function(e){var t=[];e=function(e){for(var r=[],t=0,n=e.length;t<n;){var i=c(e,t++);if(i>=55296&&i<=56319&&t<n){var o=c(e,t++);56320==(64512&o)?f(r,((1023&i)<<10)+(1023&o)+65536):(f(r,i),t--)}else f(r,i)}return r}(e);var n,a,d=e.length,h=128,g=0,p=72;for(n=0;n<e.length;n++)(a=e[n])<128&&f(t,u(a));var _=t.length,y=_;for(_&&f(t,"-");y<d;){var S=r;for(n=0;n<e.length;n++)(a=e[n])>=h&&a<S&&(S=a);var I=y+1;if(S-h>s((r-g)/I))throw new o(i);for(g+=(S-h)*I,h=S,n=0;n<e.length;n++){if((a=e[n])<h&&++g>r)throw new o(i);if(a===h){for(var b=g,C=36;;){var T=C<=p?1:C>=p+26?26:C-p;if(b<T)break;var w=b-T,A=36-T;f(t,u(v(T+w%A))),b=s(w/A),C+=36}f(t,u(v(b))),p=m(g,I,y===_),g=0,y++}}g++,h++}return l(t,"")};return wM=function(e){var r,i,o=[],s=h(d(g(e),n,"."),".");for(r=0;r<s.length;r++)i=s[r],f(o,a(t,i)?"xn--"+p(i):i);return l(o,".")}}function xM(){if(EM)return PM;EM=1,wE();var e,r=BS(),t=m_(),n=yM(),i=n_(),o=lS(),a=s_(),s=cb(),u=lb(),c=yA(),l=rS(),f=FM(),d=KO(),h=US(),g=TE().codeAt,v=DM(),m=qI(),p=Ub(),_=IA(),y=bM(),S=jb(),I=S.set,b=S.getterFor("URL"),T=y.URLSearchParams,w=y.getState,A=i.URL,E=i.TypeError,k=i.encodeURIComponent,P=i.parseInt,F=Math.floor,D=Math.pow,x=a("".charAt),O=a(/./.exec),N=a([].join),R=a(1.1.toString),W=a([].pop),M=a([].push),L=a("".replace),B=a([].shift),U=a("".split),V=a("".slice),j=a("".toLowerCase),H=a([].unshift),G="Invalid scheme",z="Invalid host",K="Invalid port",J=/[a-z]/i,Q=/[\d+\-.a-z]/i,q=/\d/,Y=/^0x/i,X=/^[0-7]+$/,Z=/^\d+$/,$=/^[\da-f]+$/i,ee=/[\0\t\n\r #%/:<>?@[\\\]^|]/,re=/[\0\t\n\r #/:<>?@[\\\]^|]/,te=/^[\u0000-\u0020]+/,ne=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ie=/[\t\n\r]/g,oe=function(e){var r,t,n,i;if("number"==typeof e){for(r=[],t=0;t<4;t++)H(r,e%256),e=F(e/256);return N(r,".")}if("object"==C(e)){for(r="",n=function(e){for(var r=null,t=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>t&&(r=n,t=i),n=null,i=0):(null===n&&(n=o),++i);return i>t?n:r}(e),t=0;t<8;t++)i&&0===e[t]||(i&&(i=!1),n===t?(r+=t?":":"::",i=!0):(r+=R(e[t],16),t<7&&(r+=":")));return"["+r+"]"}return e},ae={},se=f({},ae,{" ":1,'"':1,"#":1,"<":1,">":1}),ue=f({},se,{"'":1}),ce=f({},ae,{" ":1,'"':1,"<":1,">":1,"`":1}),le=f({},ce,{"#":1,"?":1,"{":1,"}":1,"^":1}),fe=f({},le,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),de=function(e,r){var t=g(e,0);return t>=32&&t<127&&!l(r,e)?e:"'"===e&&l(r,e)?"%27":k(e)},he={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ge=function(e,r){var t;return 2===e.length&&O(J,x(e,0))&&(":"===(t=x(e,1))||!r&&"|"===t)},ve=function(e){var r;return e.length>1&&ge(V(e,0,2))&&(2===e.length||"/"===(r=x(e,2))||"\\"===r||"?"===r||"#"===r)},me=function(e){return"."===e||"%2e"===j(e)},pe=function(e){return".."===(e=j(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},_e={},ye={},Se={},Ie={},be={},Ce={},Te={},we={},Ae={},Ee={},ke={},Pe={},Fe={},De={},xe={},Oe={},Ne={},Re={},We={},Me={},Le={},Be=function(e,r,t){var n,i,o,a=m(e);if(r){if(i=this.parse(a))throw new E(i);this.searchParams=null}else{if(t!==undefined&&(n=new Be(t,!0)),i=this.parse(a,null,n))throw new E(i);(o=w(new T)).bindURL(this),this.searchParams=o}};Be.prototype={type:"URL",parse:function(r,t,n){var i,o,a,s,u=this,c=t||_e,f=0,g="",v=!1,p=!1,_=!1;for(r=m(r),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,r=L(r,te,""),r=L(r,ne,"$1")),r=L(r,ie,""),i=d(r);f<=i.length;){switch(o=i[f],c){case _e:if(!o||!O(J,o)){if(t)return G;c=Se;continue}g+=j(o),c=ye;break;case ye:if(o&&O(Q,o))g+=j(o);else{if(":"!==o){if(t)return G;g="",c=Se,f=0;continue}if(t&&(u.isSpecial()!==l(he,g)||"file"===g&&(u.includesCredentials()||null!==u.port)||"file"===u.scheme&&""===u.host))return;if(u.scheme=g,t)return void(u.isSpecial()&&he[u.scheme]===u.port&&(u.port=null));g="","file"===u.scheme?c=De:u.isSpecial()&&n&&n.scheme===u.scheme?c=Ie:u.isSpecial()?c=we:"/"===i[f+1]?(c=be,f++):(u.cannotBeABaseURL=!0,M(u.path,""),c=We)}break;case Se:if(!n||n.cannotBeABaseURL&&"#"!==o)return G;if(n.cannotBeABaseURL&&"#"===o){u.scheme=n.scheme,u.path=h(n.path),u.query=n.query,u.fragment="",u.cannotBeABaseURL=!0,c=Le;break}c="file"===n.scheme?De:Ce;continue;case Ie:if("/"!==o||"/"!==i[f+1]){c=Ce;continue}c=Ae,f++;break;case be:if("/"===o){c=Ee;break}c=Re;continue;case Ce:if(u.scheme=n.scheme,o===e)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=h(n.path),u.query=n.query;else if("/"===o||"\\"===o&&u.isSpecial())c=Te;else if("?"===o)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=h(n.path),u.query="",c=Me;else{if("#"!==o){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=h(n.path),u.path.length&&u.path.length--,c=Re;continue}u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=h(n.path),u.query=n.query,u.fragment="",c=Le}break;case Te:if(!u.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,c=Re;continue}c=Ee}else c=Ae;break;case we:if(c=Ae,"/"!==o||"/"!==i[f+1])continue;f++;break;case Ae:if("/"!==o&&"\\"!==o){c=Ee;continue}break;case Ee:if("@"===o){v&&(g="%40"+g),v=!0,a=d(g);for(var y=0;y<a.length;y++){var S=a[y];if(":"!==S||_){var I=de(S,fe);_?u.password+=I:u.username+=I}else _=!0}g=""}else if(o===e||"/"===o||"?"===o||"#"===o||"\\"===o&&u.isSpecial()){if(v&&""===g)return"Invalid authority";f-=d(g).length+1,g="",c=ke}else g+=o;break;case ke:case Pe:if(t&&"file"===u.scheme){c=Oe;continue}if(":"!==o||p){if(o===e||"/"===o||"?"===o||"#"===o||"\\"===o&&u.isSpecial()){if(u.isSpecial()&&""===g)return z;if(t&&""===g&&(u.includesCredentials()||null!==u.port))return;if(s=u.parseHost(g))return s;if(g="",c=Ne,t)return;continue}"["===o?p=!0:"]"===o&&(p=!1),g+=o}else{if(""===g)return z;if(t===Pe)return;if(s=u.parseHost(g))return s;g="",c=Fe}break;case Fe:if(!O(q,o)){if(o===e||"/"===o||"?"===o||"#"===o||"\\"===o&&u.isSpecial()||t){if(""!==g){var b=P(g,10);if(b>65535)return K;u.port=u.isSpecial()&&b===he[u.scheme]?null:b,g=""}if(t)return;c=Ne;continue}return K}g+=o;break;case De:if(u.scheme="file",u.host="","/"===o||"\\"===o)c=xe;else{if(!n||"file"!==n.scheme){c=Re;continue}switch(o){case e:u.host=n.host,u.path=h(n.path),u.query=n.query;break;case"?":u.host=n.host,u.path=h(n.path),u.query="",c=Me;break;case"#":u.host=n.host,u.path=h(n.path),u.query=n.query,u.fragment="",c=Le;break;default:u.host=n.host,ve(N(h(i,f),""))||(u.path=h(n.path),u.shortenPath()),c=Re;continue}}break;case xe:if("/"===o||"\\"===o){c=Oe;break}n&&"file"===n.scheme&&(u.host=n.host,!ve(N(h(i,f),""))&&ge(n.path[0],!0)&&M(u.path,n.path[0])),c=Re;continue;case Oe:if(o===e||"/"===o||"\\"===o||"?"===o||"#"===o){if(!t&&ge(g))c=Re;else if(""===g){if(u.host="",t)return;c=Ne}else{if(s=u.parseHost(g))return s;if("localhost"===u.host&&(u.host=""),t)return;g="",c=Ne}continue}g+=o;break;case Ne:if(u.isSpecial()){if(c=Re,"/"!==o&&"\\"!==o)continue}else if(t||"?"!==o)if(t||"#"!==o){if(o!==e&&(c=Re,"/"!==o))continue}else u.fragment="",c=Le;else u.query="",c=Me;break;case Re:if(o===e||"/"===o||"\\"===o&&u.isSpecial()||!t&&("?"===o||"#"===o)){if(pe(g)?(u.shortenPath(),"/"===o||"\\"===o&&u.isSpecial()||M(u.path,"")):me(g)?"/"===o||"\\"===o&&u.isSpecial()||M(u.path,""):("file"===u.scheme&&!u.path.length&&ge(g)&&(null!==u.host&&""!==u.host&&(u.host=""),g=x(g,0)+":"),M(u.path,g)),g="","file"===u.scheme&&(o===e||"?"===o||"#"===o))for(;u.path.length>1&&""===u.path[0];)B(u.path);"?"===o?(u.query="",c=Me):"#"===o&&(u.fragment="",c=Le)}else g+=de(o,le);break;case We:"?"===o?(u.query="",c=Me):"#"===o?(u.fragment="",c=Le):o!==e&&(u.path[0]+=de(o,ae));break;case Me:t||"#"!==o?o!==e&&(u.query+=de(o,u.isSpecial()?ue:se)):(u.fragment="",c=Le);break;case Le:o!==e&&(u.fragment+=de(o,ce))}f++}},parseHost:function(e){var r,t,n;if("["===x(e,0)){if("]"!==x(e,e.length-1))return z;if(r=function(e){var r,t,n,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,f=0,d=function(){return x(e,f)};if(":"===d()){if(":"!==x(e,1))return;f+=2,l=++c}for(;d();){if(8===c)return;if(":"!==d()){for(r=t=0;t<4&&O($,d());)r=16*r+P(d(),16),f++,t++;if("."===d()){if(0===t)return;if(f-=t,c>6)return;for(n=0;d();){if(i=null,n>0){if(!("."===d()&&n<4))return;f++}if(!O(q,d()))return;for(;O(q,d());){if(o=P(d(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;f++}u[c]=256*u[c]+i,2!==++n&&4!==n||c++}if(4!==n)return;break}if(":"===d()){if(f++,!d())return}else if(d())return;u[c++]=r}else{if(null!==l)return;f++,l=++c}}if(null!==l)for(a=c-l,c=7;0!==c&&a>0;)s=u[c],u[c--]=u[l+a-1],u[l+--a]=s;else if(8!==c)return;return u}(V(e,1,-1)),!r)return z;this.host=r}else if(this.isSpecial()){if(e=v(e),O(ee,e))return z;if(function(e){var r,t,n=U(e,".");if(""===n[n.length-1]){if(1===n.length)return!1;n.length--}return r=n[n.length-1],!!O(Z,r)||!!O(Y,r)&&(""===(t=V(r,2))||!!O($,t))}(e)){if(r=function(e){var r,t,n,i,o,a,s,u=U(e,".");if(u.length&&""===u[u.length-1]&&u.length--,(r=u.length)>4)return null;for(t=[],n=0;n<r;n++){if(""===(i=u[n]))return null;if(o=10,i.length>1&&"0"===x(i,0)&&(o=O(Y,i)?16:8,i=V(i,8===o?1:2)),""===i)a=0;else{if(!O(10===o?Z:8===o?X:$,i))return null;a=P(i,o)}M(t,a)}for(n=0;n<r;n++)if(a=t[n],n===r-1){if(a>=D(256,5-r))return null}else if(a>255)return null;for(s=W(t),n=0;n<t.length;n++)s+=t[n]*D(256,3-n);return s}(e),null===r)return z;this.host=r}else this.host=e}else{if(O(re,e))return z;for(r="",t=d(e),n=0;n<t.length;n++)r+=de(t[n],ae);this.host=r}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return l(he,this.scheme)},shortenPath:function(){var e=this.path,r=e.length;!r||"file"===this.scheme&&1===r&&ge(e[0],!0)||e.length--},serialize:function(){var e=this,r=e.scheme,t=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,u=e.fragment,c=r+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=t+(n?":"+n:"")+"@"),c+=oe(i),null!==o&&(c+=":"+o)):"file"===r&&(c+="//"),null===i&&!e.cannotBeABaseURL&&a.length>1&&""===a[0]&&(c+="/."),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+N(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var r=this.parse(e);if(r)throw new E(r);this.searchParams.update()},getOrigin:function(){var e=this.scheme,r=this.port;if("blob"===e)try{return new Ue(this.path[0]).origin}catch(ia){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+oe(this.host)+(null!==r?":"+r:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(m(e)+":",_e)},getUsername:function(){return this.username},setUsername:function(e){var r=d(m(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<r.length;t++)this.username+=de(r[t],fe)}},getPassword:function(){return this.password},setPassword:function(e){var r=d(m(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<r.length;t++)this.password+=de(r[t],fe)}},getHost:function(){var e=this.host,r=this.port;return null===e?"":null===r?oe(e):oe(e)+":"+r},setHost:function(e){this.cannotBeABaseURL||this.parse(e,ke)},getHostname:function(){var e=this.host;return null===e?"":oe(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Pe)},getPort:function(){var e=this.port;return null===e?"":m(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=m(e))?this.port=null:this.parse(e,Fe))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+N(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Ne))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=m(e))?this.query=null:("?"===x(e,0)&&(e=V(e,1)),this.query="",this.parse(e,Me)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=m(e))?("#"===x(e,0)&&(e=V(e,1)),this.fragment="",this.parse(e,Le)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Ue=function(e){var r=c(this,Ve),n=_(arguments.length,1)>1?arguments[1]:undefined,i=I(r,new Be(e,!1,n));t||(r.href=i.serialize(),r.origin=i.getOrigin(),r.protocol=i.getProtocol(),r.username=i.getUsername(),r.password=i.getPassword(),r.host=i.getHost(),r.hostname=i.getHostname(),r.port=i.getPort(),r.pathname=i.getPathname(),r.search=i.getSearch(),r.searchParams=i.getSearchParams(),r.hash=i.getHash())},Ve=Ue.prototype,je=function(e,r){return{get:function(){return b(this)[e]()},set:r&&function(e){return b(this)[r](e)},configurable:!0,enumerable:!0}};if(t&&(u(Ve,"href",je("serialize","setHref")),u(Ve,"origin",je("getOrigin")),u(Ve,"protocol",je("getProtocol","setProtocol")),u(Ve,"username",je("getUsername","setUsername")),u(Ve,"password",je("getPassword","setPassword")),u(Ve,"host",je("getHost","setHost")),u(Ve,"hostname",je("getHostname","setHostname")),u(Ve,"port",je("getPort","setPort")),u(Ve,"pathname",je("getPathname","setPathname")),u(Ve,"search",je("getSearch","setSearch")),u(Ve,"searchParams",je("getSearchParams")),u(Ve,"hash",je("getHash","setHash"))),s(Ve,"toJSON",function(){return b(this).serialize()},{enumerable:!0}),s(Ve,"toString",function(){return b(this).serialize()},{enumerable:!0}),A){var He=A.createObjectURL,Ge=A.revokeObjectURL;He&&s(Ue,"createObjectURL",o(He,A)),Ge&&s(Ue,"revokeObjectURL",o(Ge,A))}return p(Ue,"URL"),r({global:!0,constructor:!0,forced:!n,sham:!t},{URL:Ue}),PM}var OM,NM={};var RM,WM,MM,LM,BM,UM,VM,jM={};function HM(){return MM?WM:(MM=1,kM||(kM=1,xM()),function(){if(OM)return NM;OM=1;var e=BS(),r=ly(),t=i_(),n=IA(),i=qI(),o=yM(),a=r("URL"),s=o&&t(function(){a.canParse()}),u=t(function(){return 1!==a.canParse.length});e({target:"URL",stat:!0,forced:!s||u},{canParse:function(e){var r=n(arguments.length,1),t=i(e),o=r<2||arguments[1]===undefined?undefined:i(arguments[1]);try{return!!new a(t,o)}catch(ia){return!1}}})}(),function(){if(RM)return jM;RM=1;var e=BS(),r=ly(),t=IA(),n=qI(),i=yM(),o=r("URL");e({target:"URL",stat:!0,forced:!i},{parse:function(e){var r=t(arguments.length,1),i=n(e),a=r<2||arguments[1]===undefined?undefined:n(arguments[1]);try{return new o(i,a)}catch(ia){return null}}})}(),WM=cy().URL)}function GM(){return BM?LM:(BM=1,LM=HM())}var zM,KM,JM=sh(VM?UM:(VM=1,UM=GM()));var QM,qM,YM,XM,ZM,$M,eL,rL,tL,nL=sh(KM?zM:(KM=1,zM=TO())),iL={};function oL(){return YM?qM:(YM=1,function(){if(QM)return iL;QM=1;var e=BS(),r=c_(),t=OI().indexOf,n=TW(),i=r([].indexOf),o=!!i&&1/i([1],1,-0)<0;e({target:"Array",proto:!0,forced:o||!n("indexOf")},{indexOf:function(e){var r=arguments.length>1?arguments[1]:undefined;return o?i(this,e,r)||0:t(this,e,r)}})}(),qM=yF()("Array","indexOf"))}function aL(){if(ZM)return XM;ZM=1;var e=fy(),r=oL(),t=Array.prototype;return XM=function(n){var i=n.indexOf;return n===t||e(t,n)&&i===t.indexOf?r:i},XM}function sL(){return eL?$M:(eL=1,$M=aL())}var uL,cL,lL,fL,dL,hL,gL,vL,mL,pL=sh(tL?rL:(tL=1,rL=sL())),_L={};function yL(){return lL?cL:(lL=1,function(){if(uL)return _L;uL=1;var e=BS(),r=eS(),t=FI(),n=PI(),i=xI(),o=ck(),a=uk(),s=zb(),u=Kb(),c=jR(),l=lk()("splice"),f=Math.max,d=Math.min;e({target:"Array",proto:!0,forced:!l},{splice:function(e,l){var h,g,v,m,p,_,y=r(this),S=i(y),I=t(e,S),b=arguments.length;for(0===b?h=g=0:1===b?(h=0,g=S-I):(h=b-2,g=d(f(n(l),0),S-I)),a(S+h-g),v=s(y,g),m=0;m<g;m++)(p=I+m)in y&&u(v,m,y[p]);if(o(v,g),h<g){for(m=I;m<S-g;m++)_=m+h,(p=m+g)in y?y[_]=y[p]:c(y,_);for(m=S;m>S-g+h;m--)c(y,m-1)}else if(h>g)for(m=S-g;m>I;m--)_=m+h-1,(p=m+g-1)in y?y[_]=y[p]:c(y,_);for(m=0;m<h;m++)y[m+I]=arguments[m+2];return o(y,S-g+h),v}})}(),cL=yF()("Array","splice"))}function SL(){if(dL)return fL;dL=1;var e=fy(),r=yL(),t=Array.prototype;return fL=function(n){var i=n.splice;return n===t||e(t,n)&&i===t.splice?r:i},fL}function IL(){return gL?hL:(gL=1,hL=SL())}var bL,CL,TL,wL,AL,EL,kL,PL,FL,DL=sh(mL?vL:(mL=1,vL=IL())),xL={};function OL(){return TL?CL:(TL=1,function(){if(bL)return xL;bL=1;var e=BS(),r=Jb().findIndex,t=Ew(),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),e({target:"Array",proto:!0,forced:i},{findIndex:function(e){return r(this,e,arguments.length>1?arguments[1]:undefined)}}),t(n)}(),CL=yF()("Array","findIndex"))}function NL(){if(AL)return wL;AL=1;var e=fy(),r=OL(),t=Array.prototype;return wL=function(n){var i=n.findIndex;return n===t||e(t,n)&&i===t.findIndex?r:i},wL}function RL(){return kL?EL:(kL=1,EL=NL())}var WL,ML,LL,BL,UL,VL,jL,HL,GL,zL=sh(FL?PL:(FL=1,PL=RL())),KL={};function JL(){if(LL)return KL;LL=1;var e=BS(),r=function(){if(ML)return WL;ML=1;var e=m_(),r=i_(),t=s_(),n=cw(),i=MI(),o=sy(),a=t(ty().f),s=t([].push),u=e&&r(function(){var e=Object.create(null);return e[2]=2,!a(e,2)}),c=function(r){return function(t){for(var c,l=o(t),f=i(l),d=u&&null===n(l),h=f.length,g=0,v=[];h>g;)c=f[g++],e&&!(d?c in l:a(l,c))||s(v,r?[c,l[c]]:l[c]);return v}};return WL={entries:c(!0),values:c(!1)}}().entries;return e({target:"Object",stat:!0},{entries:function(e){return r(e)}}),KL}function QL(){return UL?BL:(UL=1,JL(),BL=cy().Object.entries)}function qL(){return jL?VL:(jL=1,VL=QL())}var YL,XL,ZL=sh(GL?HL:(GL=1,HL=qL()));var $L,eB,rB,tB,nB,iB,oB,aB,sB,uB=sh(XL?YL:(XL=1,YL=RE())),cB={};function lB(){return rB?eB:(rB=1,function(){if($L)return cB;$L=1;var e=BS(),r=Jb().find,t=Ew(),n="find",i=!0;n in[]&&Array(1)[n](function(){i=!1}),e({target:"Array",proto:!0,forced:i},{find:function(e){return r(this,e,arguments.length>1?arguments[1]:undefined)}}),t(n)}(),eB=yF()("Array","find"))}function fB(){if(nB)return tB;nB=1;var e=fy(),r=lB(),t=Array.prototype;return tB=function(n){var i=n.find;return n===t||e(t,n)&&i===t.find?r:i},tB}function dB(){return oB?iB:(oB=1,iB=fB())}var hB,gB,vB,mB,pB,_B,yB,SB,IB,bB=sh(sB?aB:(sB=1,aB=dB())),CB={};function TB(){return vB?gB:(vB=1,function(){if(hB)return CB;hB=1;var e=BS(),r=Jb().filter;e({target:"Array",proto:!0,forced:!lk()("filter")},{filter:function(e){return r(this,e,arguments.length>1?arguments[1]:undefined)}})}(),gB=yF()("Array","filter"))}function wB(){if(pB)return mB;pB=1;var e=fy(),r=TB(),t=Array.prototype;return mB=function(n){var i=n.filter;return n===t||e(t,n)&&i===t.filter?r:i},mB}function AB(){return yB?_B:(yB=1,_B=wB())}var EB,kB,PB,FB,DB,xB,OB,NB,RB,WB=sh(IB?SB:(IB=1,SB=AB())),MB={};function LB(){return PB?kB:(PB=1,function(){if(EB)return MB;EB=1;var e=BS(),r=Jb().map;e({target:"Array",proto:!0,forced:!lk()("map")},{map:function(e){return r(this,e,arguments.length>1?arguments[1]:undefined)}})}(),kB=yF()("Array","map"))}function BB(){if(DB)return FB;DB=1;var e=fy(),r=LB(),t=Array.prototype;return FB=function(n){var i=n.map;return n===t||e(t,n)&&i===t.map?r:i},FB}function UB(){return OB?xB:(OB=1,xB=BB())}var VB,jB,HB,GB=sh(RB?NB:(RB=1,NB=UB())),zB={};function KB(){return HB?jB:(HB=1,function(){if(VB)return zB;VB=1;var e=BS(),r=OI().includes,t=i_(),n=Ew(),i=t(function(){return!Array(1).includes()}),o=t(function(){return[,1].includes(undefined,1)});e({target:"Array",proto:!0,forced:i||o},{includes:function(e){return r(this,e,arguments.length>1?arguments[1]:undefined)}}),n("includes")}(),jB=yF()("Array","includes"))}var JB,QB,qB,YB,XB,ZB,$B,eU,rU,tU,nU,iU,oU,aU,sU,uU={};function cU(){if(QB)return JB;QB=1;var e=uy(),r=u_(),t=nS()("match");return JB=function(n){var i;return e(n)&&((i=n[t])!==undefined?!!i:"RegExp"===r(n))},JB}function lU(){if(YB)return qB;YB=1;var e=cU(),r=TypeError;return qB=function(t){if(e(t))throw new r("The method doesn't accept regular expressions");return t},qB}function fU(){if(ZB)return XB;ZB=1;var e=nS()("match");return XB=function(r){var t=/./;try{"/./"[r](t)}catch(n){try{return t[e]=!1,"/./"[r](t)}catch(i){}}return!1}}function dU(){return rU?eU:(rU=1,function(){if($B)return uU;$B=1;var e=BS(),r=s_(),t=lU(),n=ay(),i=qI(),o=fU(),a=r("".indexOf);e({target:"String",proto:!0,forced:!o("includes")},{includes:function(e){return!!~a(i(n(this)),i(t(e)),arguments.length>1?arguments[1]:undefined)}})}(),eU=yF()("String","includes"))}function hU(){if(nU)return tU;nU=1;var e=fy(),r=KB(),t=dU(),n=Array.prototype,i=String.prototype;return tU=function(o){var a=o.includes;return o===n||e(n,o)&&a===n.includes?r:"string"==typeof o||o===i||e(i,o)&&a===i.includes?t:a},tU}function gU(){return oU?iU:(oU=1,iU=hU())}var vU,mU,pU,_U,yU,SU,IU,bU,CU,TU,wU,AU,EU,kU=sh(sU?aU:(sU=1,aU=gU())),PU={};function FU(){return mU?vU:(mU=1,vU="\t\n\x0B\f\r                　\u2028\u2029\ufeff")}function DU(){if(SU)return yU;SU=1;var e=n_(),r=i_(),t=s_(),n=qI(),i=function(){if(_U)return pU;_U=1;var e=s_(),r=ay(),t=qI(),n=FU(),i=e("".replace),o=RegExp("^["+n+"]+"),a=RegExp("(^|[^"+n+"])["+n+"]+$"),s=function(e){return function(n){var s=t(r(n));return 1&e&&(s=i(s,o,"")),2&e&&(s=i(s,a,"$1")),s}};return pU={start:s(1),end:s(2),trim:s(3)}}().trim,o=FU(),a=e.parseInt,s=e.Symbol,u=s&&s.iterator,c=/^[+-]?0x/i,l=t(c.exec),f=8!==a(o+"08")||22!==a(o+"0x16")||u&&!r(function(){a(Object(u))});return yU=f?function(e,r){var t=i(n(e));return a(t,r>>>0||(l(c,t)?16:10))}:a}function xU(){return CU?bU:(CU=1,function(){if(IU)return PU;IU=1;var e=BS(),r=DU();e({global:!0,forced:parseInt!==r},{parseInt:r})}(),bU=cy().parseInt)}function OU(){return wU?TU:(wU=1,TU=xU())}var NU,RU,WU=sh(EU?AU:(EU=1,AU=OU()));var MU,LU,BU,UU,VU,jU,HU,GU,zU=sh(RU?NU:(RU=1,NU=QO()));function KU(){return LU?MU:(LU=1,Ow(),MU=yF()("Array","keys"))}function JU(){return UU?BU:(UU=1,BU=KU())}function QU(){if(jU)return VU;jU=1,NE();var e=HS(),r=rS(),t=fy(),n=JU(),i=Array.prototype,o={DOMTokenList:!0,NodeList:!0};return VU=function(a){var s=a.keys;return a===i||t(i,a)&&s===i.keys||r(o,e(a))?n:s},VU}var qU,YU,XU,ZU,$U,eV,rV,tV,nV,iV,oV,aV,sV,uV=sh(GU?HU:(GU=1,HU=QU())),cV={},lV={exports:{}};function fV(){return YU?qU:(YU=1,qU=i_()(function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))}function dV(){if(ZU)return XU;ZU=1;var e=i_(),r=uy(),t=u_(),n=fV(),i=Object.isExtensible,o=e(function(){});return XU=o||n?function(e){return!!r(e)&&((!n||"ArrayBuffer"!==t(e))&&(!i||i(e)))}:i,XU}function hV(){return eV?$U:(eV=1,$U=!i_()(function(){return Object.isExtensible(Object.preventExtensions({}))}))}function gV(){if(rV)return lV.exports;rV=1;var e=BS(),r=s_(),t=NI(),n=uy(),i=rS(),o=MS().f,a=ZI(),s=rb(),u=dV(),c=tS(),l=hV(),f=!1,d=c("meta"),h=0,g=function(e){o(e,d,{value:{objectID:"O"+h++,weakData:{}}})},v=lV.exports={enable:function(){v.enable=function(){},f=!0;var t=a.f,n=r([].splice),i={};i[d]=1,t(i).length&&(a.f=function(e){for(var r=t(e),i=0,o=r.length;i<o;i++)if(r[i]===d){n(r,i,1);break}return r},e({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:s.f}))},fastKey:function(e,r){if(!n(e))return"symbol"==C(e)?e:("string"==typeof e?"S":"P")+e;if(!i(e,d)){if(!u(e))return"F";if(!r)return"E";g(e)}return e[d].objectID},getWeakData:function(e,r){if(!i(e,d)){if(!u(e))return!0;if(!r)return!1;g(e)}return e[d].weakData},onFreeze:function(e){return l&&f&&u(e)&&!i(e,d)&&g(e),e}};return t[d]=!0,lV.exports}function vV(){if(nV)return tV;nV=1;var e=BS(),r=n_(),t=gV(),n=p_(),i=i_(),o=LS(),a=Tw(),s=yA(),u=l_(),c=uy(),l=oy(),f=Ub(),d=MS().f,h=Jb().forEach,g=m_(),v=jb(),m=v.set,p=v.getterFor;return tV=function(v,_,y){var S,I=-1!==v.indexOf("Map"),b=-1!==v.indexOf("Weak"),C=I?"set":"add",T=r[v],w=T&&T.prototype,A={};if(g&&u(T)&&(b||w.forEach&&!i(function(){(new T).entries().next()}))){var E=(S=_(function(e,r){m(s(e,E),{type:v,collection:new T}),l(r)||a(r,e[C],{that:e,AS_ENTRIES:I})})).prototype,k=p(v);h(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(e){var r="add"===e||"set"===e;!(e in w)||b&&"clear"===e||o(E,e,function(t,i){var o=this,a=k(o).collection;if(!r&&b&&!c(t))return"get"===e&&undefined;var s=a[e]("forEach"===e?function(e,r){n(t,i,e,r,o)}:0===t?0:t,i);return r?o:s})}),b||d(E,"size",{configurable:!0,get:function(){return k(this).collection.size}})}else S=y.getConstructor(_,v,I,C),t.enable();return f(S,v,!1,!0),A[v]=S,e({global:!0,forced:!0},A),b||y.setStrong(S,v,I),S},tV}function mV(){if(oV)return iV;oV=1;var e=VI(),r=lb(),t=SM(),n=lS(),i=yA(),o=oy(),a=Tw(),s=Dw(),u=xw(),c=_A(),l=m_(),f=gV().fastKey,d=jb(),h=d.set,g=d.getterFor;return iV={getConstructor:function(s,u,c,d){var v=s(function(r,t){i(r,m),h(r,{type:u,index:e(null),first:null,last:null,size:0}),l||(r.size=0),o(t)||a(t,r[d],{that:r,AS_ENTRIES:c})}),m=v.prototype,p=g(u),_=function(e,r,t){var n,i,o=p(e),a=y(e,r);return a?a.value=t:(o.last=a={index:i=f(r,!0),key:r,value:t,previous:n=o.last,next:null,removed:!1},o.first||(o.first=a),n&&(n.next=a),l?o.size++:e.size++,"F"!==i&&(o.index[i]=a)),e},y=function(e,r){var t,n=p(e),i=f(r);if("F"!==i)return n.index[i];for(t=n.first;t;t=t.next)if(t.key===r)return t};return t(m,{clear:function(){for(var r=p(this),t=r.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=null),t=t.next;r.first=r.last=null,r.index=e(null),l?r.size=0:this.size=0},"delete":function(e){var r=this,t=p(r),n=y(r,e);if(n){var i=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),t.first===n&&(t.first=i),t.last===n&&(t.last=o),l?t.size--:r.size--}return!!n},forEach:function(e){for(var r,t=p(this),i=n(e,arguments.length>1?arguments[1]:undefined);r=r?r.next:t.first;)for(i(r.value,r.key,this);r&&r.removed;)r=r.previous},has:function(e){return!!y(this,e)}}),t(m,c?{get:function(e){var r=y(this,e);return r&&r.value},set:function(e,r){return _(this,0===e?0:e,r)}}:{add:function(e){return _(this,e=0===e?0:e,e)}}),l&&r(m,"size",{configurable:!0,get:function(){return p(this).size}}),v},setStrong:function(e,r,t){var n=r+" Iterator",i=g(r),o=g(n);s(e,r,function(e,r){h(this,{type:n,target:e,state:i(e),kind:r,last:null})},function(){for(var e=o(this),r=e.kind,t=e.last;t&&t.removed;)t=t.previous;return e.target&&(e.last=t=t?t.next:e.state.first)?u("keys"===r?t.key:"values"===r?t.value:[t.key,t.value],!1):(e.target=null,u(undefined,!0))},t?"entries":"values",!t,!0),c(r)}},iV}function pV(){return sV||(sV=1,aV||(aV=1,vV()("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:undefined)}},mV()))),cV}var _V,yV,SV,IV,bV,CV,TV,wV,AV,EV,kV,PV,FV,DV,xV,OV,NV,RV,WV,MV,LV,BV,UV,VV={};function jV(){if(yV)return _V;yV=1;var e=py(),r=TypeError;return _V=function(t){if("object"==C(t)&&"size"in t&&"has"in t&&"add"in t&&"delete"in t&&"keys"in t)return t;throw new r(e(t)+" is not a set")},_V}function HV(){return IV||(IV=1,SV=function(e,r){return 1===r?function(r,t){return r[e](t)}:function(r,t,n){return r[e](t,n)}}),SV}function GV(){if(CV)return bV;CV=1;var e=ly(),r=HV(),t=e("Set"),n=t.prototype;return bV={Set:t,add:r("add",1),has:r("has",1),remove:r("delete",1),proto:n}}function zV(){if(wV)return TV;wV=1;var e=p_();return TV=function(r,t,n){for(var i,o,a=n?r:r.iterator,s=r.next;!(i=e(s,a)).done;)if((o=t(i.value))!==undefined)return o},TV}function KV(){if(EV)return AV;EV=1;var e=zV();return AV=function(r,t,n){return n?e(r.keys(),t,!0):r.forEach(t)},AV}function JV(){if(PV)return kV;PV=1;var e=GV(),r=KV(),t=e.Set,n=e.add;return kV=function(e){var i=new t;return r(e,function(e){n(i,e)}),i},kV}function QV(){return DV||(DV=1,FV=function(e){return e.size}),FV}function qV(){return OV?xV:(OV=1,xV=function(e){return{iterator:e,next:e.next,done:!1}})}function YV(){if(RV)return NV;RV=1;var e=_y(),r=WS(),t=p_(),n=PI(),i=qV(),o="Invalid size",a=RangeError,s=TypeError,u=Math.max,c=function(r,t){this.set=r,this.size=u(t,0),this.has=e(r.has),this.keys=e(r.keys)};return c.prototype={getIterator:function(){return i(r(t(this.keys,this.set)))},includes:function(e){return t(this.has,this.set,e)}},NV=function(e){r(e);var t=+e.size;if(t!=t)throw new s(o);var i=n(t);if(i<0)throw new a(o);return new c(e,i)}}function XV(){if(MV)return WV;MV=1;var e=jV(),r=GV(),t=JV(),n=QV(),i=YV(),o=KV(),a=zV(),s=r.has,u=r.remove;return WV=function(r){var c=e(this),l=i(r),f=t(c);return n(f)<=l.size?o(f,function(e){l.includes(e)&&u(f,e)}):a(l.getIterator(),function(e){s(f,e)&&u(f,e)}),f}}function ZV(){return BV?LV:(BV=1,LV=function(){return!1})}var $V,ej,rj,tj={};function nj(){if(ej)return $V;ej=1;var e=jV(),r=GV(),t=QV(),n=YV(),i=KV(),o=zV(),a=r.Set,s=r.add,u=r.has;return $V=function(r){var c=e(this),l=n(r),f=new a;return t(c)>l.size?o(l.getIterator(),function(e){u(c,e)&&s(f,e)}):i(c,function(e){l.includes(e)&&s(f,e)}),f}}var ij,oj,aj,sj={};function uj(){if(oj)return ij;oj=1;var e=jV(),r=GV().has,t=QV(),n=YV(),i=KV(),o=zV(),a=Cw();return ij=function(s){var u=e(this),c=n(s);if(t(u)<=c.size)return!1!==i(u,function(e){if(c.includes(e))return!1},!0);var l=c.getIterator();return!1!==o(l,function(e){if(r(u,e))return a(l.iterator,"normal",!1)})},ij}var cj,lj,fj,dj={};function hj(){if(lj)return cj;lj=1;var e=jV(),r=QV(),t=KV(),n=YV();return cj=function(i){var o=e(this),a=n(i);return!(r(o)>a.size)&&!1!==t(o,function(e){if(!a.includes(e))return!1},!0)}}var gj,vj,mj,pj={};function _j(){if(vj)return gj;vj=1;var e=jV(),r=GV().has,t=QV(),n=YV(),i=zV(),o=Cw();return gj=function(a){var s=e(this),u=n(a);if(t(s)<u.size)return!1;var c=u.getIterator();return!1!==i(c,function(e){if(!r(s,e))return o(c.iterator,"normal",!1)})},gj}var yj,Sj,Ij,bj,Cj,Tj={};function wj(){if(Sj)return yj;Sj=1;var e=jV(),r=GV(),t=JV(),n=YV(),i=zV(),o=r.add,a=r.has,s=r.remove;return yj=function(r){var u=e(this),c=n(r).getIterator(),l=t(u);return i(c,function(e){a(u,e)?s(l,e):o(l,e)}),l}}function Aj(){return bj?Ij:(bj=1,Ij=function(e){try{var r=new Set,t={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return r.clear(),r.add(4),function(){return{done:!0}}}})}},n=r[e](t);return 1===n.size&&4===n.values().next().value}catch(ia){return!1}})}var Ej,kj,Pj,Fj,Dj,xj,Oj,Nj,Rj,Wj={};function Mj(){if(kj)return Ej;kj=1;var e=jV(),r=GV().add,t=JV(),n=YV(),i=zV();return Ej=function(o){var a=e(this),s=n(o).getIterator(),u=t(a);return i(s,function(e){r(u,e)}),u},Ej}function Lj(){return Dj?Fj:(Dj=1,Ow(),pV(),function(){if(UV)return VV;UV=1;var e=BS(),r=XV(),t=i_();e({target:"Set",proto:!0,real:!0,forced:!ZV()("difference",function(e){return 0===e.size})||t(function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var t=e++>1;return r.has(1)&&r.clear(),{done:t,value:2}}}}},r=new Set([1,2,3,4]);return 3!==r.difference(e).size})},{difference:r})}(),function(){if(rj)return tj;rj=1;var e=BS(),r=i_(),t=nj();e({target:"Set",proto:!0,real:!0,forced:!ZV()("intersection",function(e){return 2===e.size&&e.has(1)&&e.has(2)})||r(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:t})}(),function(){if(aj)return sj;aj=1;var e=BS(),r=uj();e({target:"Set",proto:!0,real:!0,forced:!ZV()("isDisjointFrom",function(e){return!e})},{isDisjointFrom:r})}(),function(){if(fj)return dj;fj=1;var e=BS(),r=hj();e({target:"Set",proto:!0,real:!0,forced:!ZV()("isSubsetOf",function(e){return e})},{isSubsetOf:r})}(),function(){if(mj)return pj;mj=1;var e=BS(),r=_j();e({target:"Set",proto:!0,real:!0,forced:!ZV()("isSupersetOf",function(e){return!e})},{isSupersetOf:r})}(),function(){if(Cj)return Tj;Cj=1;var e=BS(),r=wj(),t=Aj();e({target:"Set",proto:!0,real:!0,forced:!ZV()("symmetricDifference")||!t("symmetricDifference")},{symmetricDifference:r})}(),function(){if(Pj)return Wj;Pj=1;var e=BS(),r=Mj(),t=Aj();e({target:"Set",proto:!0,real:!0,forced:!ZV()("union")||!t("union")},{union:r})}(),wE(),Fj=cy().Set)}function Bj(){if(Oj)return xj;Oj=1;var e=Lj();return NE(),xj=e}var Uj,Vj,jj=sh(Rj?Nj:(Rj=1,Nj=Bj()));var Hj=sh(Vj?Uj:(Vj=1,Uj=rx()));function Gj(e,r){var t=JW(e);if(FC){var n=FC(e);r&&(n=WB(n).call(n,function(r){return GC(e,r).enumerable})),t.push.apply(t,n)}return t}function zj(e){for(var r=1;r<arguments.length;r++){var t,n,i=null!=arguments[r]?arguments[r]:{};r%2?WW(t=Gj(Object(i),!0)).call(t,function(r){CN(e,r,i[r])}):rT?ow(e,rT(i)):WW(n=Gj(Object(i))).call(n,function(r){Hj(e,r,GC(i,r))})}return e}function Kj(e,r,t){return r=zF(r),function(e,r){if(r&&("object"==BP(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return $E(e)}(e,Jj()?KI(r,t||[],zF(e).constructor):r.apply(e,t))}function Jj(){try{var e=!Boolean.prototype.valueOf.call(KI(Boolean,[],function(){}))}catch(e){}return(Jj=function(){return!!e})()}var Qj=function(e){return bW?bW(e):"[object Array]"===function(e){return Object.prototype.toString.call(e)}(e)},qj=function(e){return void 0===e},Yj=function(e,r){var t;e=null!=e?e:"yyyy-MM-dd hh:mm:ss";var n=qj(r)?new Date:new Date(r),i={"M+":(n.getMonth()+1).toString(),"d+":n.getDate().toString(),"h+":n.getHours().toString(),"m+":n.getMinutes().toString(),"s+":n.getSeconds().toString(),"q+":Math.floor((n.getMonth()+3)/3).toString(),S:n.getMilliseconds().toString()};return/(y+)/.test(e)&&(e=e.replace(RegExp.$1,"".concat(n.getFullYear()).substring(4-RegExp.$1.length))),WW(t=JW(i)).call(t,function(r){new RegExp("(".concat(r,")")).test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?i[r]:"00".concat(i[r]).substring("".concat(i[r]).length)))}),e},Xj=function(e){return"string"==typeof e},Zj=function(e){return"number"==typeof e&&!iM(e)},$j=function(e){return"function"==typeof e},eH=0,rH=function(){var e;return eH+=1,pM(e="".concat((new Date).getTime().toString(36))).call(e,eH.toString(36))};!function(e,r){for(var t=JW(e),n=0;n<t.length;n++){var i=t[n];if(!1===r.call(null,e[i],i,e))break}}({"&amp;":"&","&gt;":">","&lt;":"<","&nbsp;":" ","&quot;":'"',"&#x27;":"'"},function(e,r){}),function(e,r){for(var t=JW(e),n=0;n<t.length;n++){var i=t[n];if(!1===r.call(null,e[i],i,e))break}}({"&amp;":"&","&gt;":">","&lt;":"<","&nbsp;":" ","&quot;":'"',"&#x27;":"'"},function(e,r){});var tH=function(e){var r=JM||window.webkitURL;/^blob:/.test(e)&&r.revokeObjectURL(e)},nH=function(){function e(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"",t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";hN(this,e),CN(this,"prefix",void 0),CN(this,"postfix",void 0),CN(this,"isDestroyed",!1),CN(this,"uid",rH()),CN(this,"cacheEvents",void 0),CN(this,"events",void 0),CN(this,"isCached",void 0),this.cacheEvents=[],this.events={},this.isCached=!1,this.prefix=r,this.postfix=t}return bN(e,[{key:"save",value:function(){this.isCached=!0}},{key:"restore",value:function(){var e,r=this;this.isCached=!1,WW(e=this.cacheEvents).call(e,function(e){var t,n=e.eventName,i=e.param;r.emit.apply(r,pM(t=[n]).call(t,dN(i)))}),this.cacheEvents.length=0}},{key:"destroy",value:function(){var e=this;if(!this.isDestroyed){for(var r in this.events)if(Object.prototype.hasOwnProperty.call(this.events,r)){var t,n=this.events[r];n&&WW(t=nL(n).call(n)).call(t,function(r){var t=r.name,n=r.fn,i=r.context,o=r.once;e.off(t,n,i,o)})}this.events={},this.isDestroyed=!0}}},{key:"on",value:function(e,r,t){var n,i=arguments.length>3&&arguments[3]!==undefined&&arguments[3],o=this.events,a={name:e=this.format(e),uid:rH(),context:t,once:i,fn:r};return o[e]||(o[e]=[]),pL(n=o[e]).call(n,a)<0&&o[e].push(a),a}},{key:"once",value:function(e,r,t){return this.on(e,r,t,!0)}},{key:"emit",value:function(e){for(var r,t,n=this,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(this.isCached)return this.cacheEvents.push({eventName:e,param:o}),!0;var s=this.events[e=this.format(e)];return!(!s||!s.length||(WW(r=nL(s).call(s)).call(r,function(e){var r,t=e.fn,n=e.context;t.call.apply(t,pM(r=[n||null]).call(r,o))}),WW(t=nL(s).call(s)).call(t,function(r){var t=r.fn,i=r.context,o=r.once;o&&n.off(e,t,i,o)}),0))}},{key:"off",value:function(e,r,t,n){var i=this.events[e=this.format(e)];if(!i)return!1;if(!arguments.length)return i.length=0,!0;for(var o=i.length-1;o>=0;o--){var a=i[o];r&&a.fn!==r||t&&a.context!==t||n&&a.once!==n||DL(i).call(i,o,1)}return!0}},{key:"removeAllEventListeners",value:function(e){if(e){var r,t;e=this.format(e);var n=zL(r=this.cacheEvents).call(r,function(r){return r.eventName===e});n>-1&&DL(t=this.cacheEvents).call(t,n,1),this.events[e]&&delete this.events[e]}else this.cacheEvents=[],this.events={}}},{key:"getAllEvents",value:function(){return this.events}},{key:"format",value:function(e){var r,t;return pM(r=pM(t="".concat(this.prefix||"")).call(t,e)).call(r,this.postfix||"")}}],[{key:"create",value:function(r,t){return new e(r,t)}}])}(),iH="default",oH=function(){function e(){hN(this,e),CN(this,"emitter",new nH)}return bN(e,[{key:"on",value:function(e){this.emitter.on(iH,e)}},{key:"emit",value:function(){for(var e,r,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=this.emitter).emit.apply(e,pM(r=[iH]).call(r,n))}},{key:"off",value:function(e){this.emitter.off(iH,e)}}],[{key:"create",value:function(){return new e}}])}(),aH=function(){return bN(function e(r){hN(this,e),CN(this,"uid",void 0),CN(this,"children",void 0),this.uid=r.uid,this.children=r.children||[]},[{key:"append",value:function(e){var r=this.children;return pL(r).call(r,e)<0&&(r.push(e),!0)}},{key:"insert",value:function(e,r){var t=this.children;return!(r<0||(r>t.length&&(r=t.length),DL(t).call(t,r,0,e),0))}},{key:"remove",value:function(e){var r=this.children,t=pL(r).call(r,e);return!(t<0||(DL(r).call(r,t,1),0))}},{key:"clear",value:function(){return this.children=[],!0}},{key:"move",value:function(e,r){if(e===r)return!0;var t=this.children,n=fN(DL(t).call(t,e,1),1)[0];return DL(t).call(t,r,0,n),!0}},{key:"switch",value:function(e,r){if(e===r)return!0;var t=this.children,n=t[e];return t[e]=t[r],t[r]=n,!0}},{key:"reorder",value:function(e){var r=this.children,t=e.length,n=[],i=0;if(r.length!==t||0===t)return!1;for(var o=0;o<t;o++)e[o]===o&&(i+=1);if(i===t)return!0;for(var a=0;a<t;a++)n[a]=r[e[a]];for(var s=0;s<t;s++)r[s]=n[s];return!0}}])}(),sH=function(){return bN(function e(r,t){hN(this,e),CN(this,"isDestroyed",!1),CN(this,"data",void 0),CN(this,"table",["database","table","item"]),CN(this,"dbName",void 0),CN(this,"tableName",void 0),this.data={},this.dbName=r,this.tableName=t,this.createDatabase(r,t)},[{key:"destroy",value:function(){if(!this.isDestroyed){for(var e=0,r=ZL(this.data);e<r.length;e++){var t=fN(r[e],2),n=t[0];t[1],this.data[n]=null}this.data=null,this.isDestroyed=!0}}},{key:"createDatabase",value:function(e,r){this.data[e]={},this.data[e][r]={}}},{key:"set",value:function(e,r){var t=this,n=this.dbName,i=this.tableName;return new uB(function(o,a){t.checkId(e)?a(new Error("The ".concat(e," already exists."))):(t.data[n][i][e]=r,o("Save ".concat(e," to database successful.")))})}},{key:"get",value:function(e){var r=this,t=this.dbName,n=this.tableName;return new uB(function(i,o){r.checkId(e)?i(r.data[t][n][e]):o(r.erMsg(2,e))})}},{key:"remove",value:function(e){var r=this,t=this.dbName,n=this.tableName;return new uB(function(i,o){delete r.data[t][n][e],i("Remove ".concat(e," successful."))})}},{key:"update",value:function(e,r){var t=this,n=this.dbName,i=this.tableName;return new uB(function(o,a){t.checkId(e)?(t.data[n][i][e]=r,o("Update ".concat(e," successful."))):a(t.erMsg(2,e))})}},{key:"checkId",value:function(e){var r=this.dbName,t=this.tableName;return void 0!==this.data[r][t][e]}},{key:"erMsg",value:function(e,r){var t;return pM(t="The ".concat(this.table[e]," ")).call(t,r," does not exist.")}}])}(),uH=function(){return bN(function e(){hN(this,e),CN(this,"isDestroyed",!1),CN(this,"data",void 0),this.data={}},[{key:"destroy",value:function(){if(!this.isDestroyed){for(var e=0,r=ZL(this.data);e<r.length;e++){var t,n=fN(r[e],2),i=n[0];n[1],null!==(t=this.data[i])&&void 0!==t&&t.destroy(),this.data[i]=null}this.data=null,this.isDestroyed=!0}}},{key:"set",value:function(e,r){return!this.check(e)&&(this.data[e]=r,!0)}},{key:"get",value:function(e){return this.data[e]}},{key:"remove",value:function(e){return!!this.check(e)&&(delete this.data[e],!0)}},{key:"update",value:function(e,r){return!!this.check(e)&&(this.data[e]=r,!0)}},{key:"check",value:function(e){return void 0!==this.data[e]}}])}(),cH=function(e){function r(e){var t;return hN(this,r),CN($E(t=Kj(this,r,[e])),"name",void 0),CN($E(t),"type",void 0),CN($E(t),"fileType",void 0),CN($E(t),"createdDate",void 0),CN($E(t),"modifiedDate",void 0),CN($E(t),"parent",void 0),CN($E(t),"isRoot",!1),t.name=e.name,t.type=e.type,t.fileType=e.fileType,t.parent=e.parent||null,t.isRoot=e.isRoot||!1,t.createdDate=Yj(),t.modifiedDate=t.createdDate,t}return sx(r,e),bN(r,[{key:"updateDate",value:function(){this.modifiedDate=Yj()}},{key:"setName",value:function(e){this.name=e}},{key:"reorder",value:function(e){var t=this.type;return("file"===t||"default"===t)&&function(e,r,t,n){var i=CD(zF(1&n?e.prototype:e),r,t);return 2&n&&"function"==typeof i?function(e){return i.apply(t,e)}:i}(r,"reorder",this,3)([e])}}])}(aH),lH=function(){return bN(function e(){hN(this,e),CN(this,"root",void 0),CN(this,"currentNode",void 0),CN(this,"selectedUid",void 0),CN(this,"defaultNode",void 0),CN(this,"hooks",{fileChanged:oH.create(),beforeRemoveFile:oH.create(),removeFile:oH.create(),afterRemoveFile:oH.create(),afterRenameFile:oH.create(),destroy:oH.create()}),this.root=new cH({uid:rH(),children:[],name:"root",type:"file",fileType:"folder",parent:void 0,isRoot:!0}),this.defaultNode=this.root,this.currentNode=this.root},[{key:"appendChildrenToFile",value:function(e,r,t){var n=t,i=fH(this.defaultNode,e);return i||(i=this.createFile(e),this.hooks.fileChanged.emit(this.defaultNode)),WW(r).call(r,function(e){qj(n)?i.append(e):(i.insert(e,n),n+=1)}),i}},{key:"removeChildFromFile",value:function(e,r){Xj(r)&&(r=[r]);var t=this.getFileByUid(e);t&&WW(r).call(r,function(e){t.remove(e)})}},{key:"findChild",value:function(e,r){var t;return bB(t=e.children).call(t,function(e){return e.name===r})}},{key:"createFile",value:function(e){var r=this.defaultNode;r||(r=this.root);var t=fH(r,e);return t&&"file"===t.type||(t=new cH({uid:rH(),children:[],name:e,type:"file",fileType:"file",parent:r,isRoot:!1}),this.currentNode.append(t),this.hooks.fileChanged.emit(this.currentNode.children)),t}},{key:"removeFile",value:function(e){for(var r=this.defaultNode.children,t=0;t<r.length;t++){var n=r[t];if(n.name===e)return this.hooks.beforeRemoveFile.emit(n),DL(r).call(r,t,1),this.hooks.afterRemoveFile.emit(n),this.hooks.fileChanged.emit(n),!0}return!1}},{key:"renameFile",value:function(e,r){var t=this.findChild(this.defaultNode,e),n=this.findChild(this.defaultNode,r);return!!t&&!n&&(t.name=r,this.hooks.afterRenameFile.emit(t),this.hooks.fileChanged.emit(this.currentNode.children),!0)}},{key:"getFile",value:function(e){return this.findChild(this.defaultNode,e)}},{key:"getFileByUid",value:function(e){return bB(this).call(this,e,this.root)}},{key:"getCurrentFileList",value:function(){return this.currentNode.children}},{key:"isFileExist",value:function(e){return!!this.findChild(this.defaultNode,e)}},{key:"createFolder",value:function(){}},{key:"find",value:function(e,r){for(var t=r.children,n=t.length,i=0;i<n;i++){if(t[i].uid===e)return t[i];if(t[i].children){var o=bB(this).call(this,e,t[i]);if(o)return o}}return null}}])}();function fH(e,r){var t,n=WB(t=e.children).call(t,function(e){return e.name===r});return 0===n.length?null:n[0]}var dH,hH,gH=function(e){function r(e){var t;return hN(this,r),CN($E(t=Kj(this,r,[e])),"name",void 0),CN($E(t),"type","tag"),t.name=e.name,t.uid=e.uid||rH(),t.type="tag",t}return sx(r,e),bN(r)}(aH),vH=function(){return bN(function e(){hN(this,e),CN(this,"tags",void 0),CN(this,"defaultName",void 0),CN(this,"defaultUid",void 0),CN(this,"selectedUid",void 0),CN(this,"emptyItem",void 0),CN(this,"hooks",{beforeRemoveTag:oH.create(),afterRenameTag:oH.create(),destroy:oH.create(),load:oH.create()}),this.tags=[],this.defaultName=null,this.defaultUid=null,this.selectedUid=null,this.emptyItem=new gH({name:"defaultTag",children:[]})},[{key:"appendChildToTag",value:function(e,r){var t=this.createTag(e);Xj(r)&&(r=[r]);var n=!1;return WW(r).call(r,function(e){t.append(e)&&(n=!0)}),n}},{key:"removeChildFromTag",value:function(e,r){var t=this.getTag(e);return!!t&&(Xj(r)&&(r=[r]),WW(r).call(r,function(e){t.remove(e)}),!0)}},{key:"createTag",value:function(e){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[],t=this.getTag(e);return t||(t=new gH({name:e,children:r}),this.tags.push(t)),t}},{key:"removeTag",value:function(e){var r,t,n=this.getTag(e);if(!n)return!1;this.hooks.beforeRemoveTag.emit(n);var i=zL(r=this.tags).call(r,function(r){return r.name===e});return e===this.defaultName&&(this.defaultName=null,this.selectedUid=null),DL(t=this.tags).call(t,i,1),!0}},{key:"renameTag",value:function(e,r){if(!Xj(e)||!Xj(r))return!1;var t=this.isTagExisted(r),n=this.getTag(e);return!(!n||t||(n.name=r,this.hooks.afterRenameTag.emit(n),0))}},{key:"getTag",value:function(e){var r;return bB(r=this.tags).call(r,function(r){return r.name===e})}},{key:"getTagByUid",value:function(e){var r;return bB(r=this.tags).call(r,function(r){return r.uid===e})}},{key:"getTagList",value:function(){var e;return nL(e=this.tags).call(e)}},{key:"setDefaultTag",value:function(e){if(!e)return this.defaultName=null,this.defaultUid=null,!0;var r=this.getTag(e);return!!r&&(this.defaultName=e,this.defaultUid=r.uid,!0)}},{key:"getDefaultTag",value:function(){return this.defaultName}},{key:"isTagExisted",value:function(e){return!!this.getTag(e)}}])}(),mH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){var r=e.hooks,t={beforeStatus:null,afterStatus:null,operation:null,docUid:null},n=function(e){t.beforeStatus={uids:e.uids,selectedUids:[],currentUid:"",modifiedUid:e.modifiedUid,removedUids:e.removedUids}},i=function(r){t.afterStatus={uids:r.uids,selectedUids:[],currentUid:"",modifiedUid:r.modifiedUid,removedUids:r.removedUids},t.docUid=r.docUid,t.operation=r.operation,t.docType=r.docType,t.docName=r.docName,e.emit("bufferChanged",zj({},t)),t={beforeStatus:null,afterStatus:null,operation:null,docUid:null}};r.beforeBufferChanged.on(n),r.afterBufferChanged.on(i),r.destroy.on(function(){r.beforeBufferChanged.off(n),r.afterBufferChanged.off(i)})}}])}(),pH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){var r=e.hooks;e.customStore=new uH;var t=function(r){var t=r.data;WW(t).call(t,function(r){var t=r.customData;t||(t={}),e.customStore.set(r.uid,t)})},n=function(r){var t=r.removedUids;WW(t).call(t,function(r){e.customStore.remove(r)})},i=function(r){var t=r.data.customData;t&&e.customStore.update(r.modifiedUid,t)};r.loadSource.on(t),r.removeSource.on(n),r.updateSource.on(i),r.destroy.on(function(){r.loadSource.off(t),r.removeSource.off(n),r.updateSource.off(i)})}}])}(),_H=function(e){function r(){var e;return hN(this,r),CN(e=Kj(this,r,[{uid:rH(),children:[]}]),"name","dvs-default"),CN(e,"isDestroyed",!1),CN(e,"type",void 0),e}return sx(r,e),bN(r,[{key:"destroy",value:function(){this.isDestroyed||(this.isDestroyed=!0)}}])}(aH),yH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){e.defaultFile=new _H;var r=e.hooks,t=function(r){var t,n,i,o=r.filename,a=r.index,s=r.data;if(qj(o)){var u=GB(s).call(s,function(e){return e.uid});void 0===a?(t=e.defaultFile.children).push.apply(t,dN(u)):DL(n=e.defaultFile.children).apply(n,pM(i=[a,0]).call(i,dN(u)));var c={docUid:e.defaultFile.uid,sourceUids:u,type:"default",index:a};e.hooks.loadToDoc.emit(c)}},n=function(r){var t=r.removedUids,n=[];WW(t).call(t,function(r){var t=e.statusStore.get(r);t&&t.ownerDefaultFile&&(e.defaultFile.remove(r),n.push(r))}),n.length&&e.hooks.removeFromDoc.emit({docUid:e.defaultFile.uid,sourceUids:t,type:"default"})};r.loadSource.on(t),r.removeSource.on(n),r.destroy.on(function(){r.loadSource.off(t),r.removeSource.off(n)})}}])}(),SH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){e.dir=new lH,this.listenDirectoryHooks(e),this.listenSpaceHooks(e)}},{key:"listenDirectoryHooks",value:function(e){var r=e.dir.hooks,t=function(r){var t;WW(t=r.children).call(t,function(t){var n=e.statusStore.get(t);n&&n.ownerFiles.remove(r.uid)}),e.hooks.removeDoc.emit(r)},n=function(r){e.hooks.renameDoc.emit(r)};r.beforeRemoveFile.on(t),r.afterRenameFile.on(n),r.destroy.on(function(){r.beforeRemoveFile.off(t),r.afterRenameFile.off(n)})}},{key:"listenSpaceHooks",value:function(e){var r=e.hooks,t=function(r){var t=r.data,n=r.filename,i=r.index;if(!qj(n)){var o=e.dir.getFile(n);e.hooks.beforeBufferChanged.emit({docType:"file",docUid:null==o?void 0:o.uid,uids:dN((null==o?void 0:o.children)||[]),operation:"add"});var a=GB(t).call(t,function(e){return e.uid}),s=e.dir.appendChildrenToFile(n,a,i),u={docUid:s.uid,sourceUids:a,type:"file",index:i};e.hooks.loadToDoc.emit(u),e.hooks.afterBufferChanged.emit({docType:"file",docName:n,docUid:null==s?void 0:s.uid,uids:dN((null==s?void 0:s.children)||[]),operation:"add"})}},n=function(r){var t=r.removedUids,n={};WW(t).call(t,function(r){var t,i,o=e.statusStore.get(r);o&&WW(t=nL(i=o.ownerFiles.children).call(i)).call(t,function(e){n[e]||(n[e]=[]),n[e].push(r)})});for(var i=0,o=ZL(n);i<o.length;i++){var a=fN(o[i],2),s=a[0],u=a[1],c=e.dir.getFileByUid(s);c&&(e.hooks.beforeBufferChanged.emit({docUid:s,uids:dN(c.children),removedUids:dN(u),operation:"remove"}),e.dir.removeChildFromFile(s,u),e.hooks.afterBufferChanged.emit({docType:"file",docName:c.name,docUid:s,uids:dN(c.children),removedUids:dN(u),operation:"remove"})),e.hooks.removeFromDoc.emit({docUid:s,sourceUids:u})}},i=function(r){var t,n,i=e.statusStore.get(r.modifiedUid);i&&WW(t=nL(n=i.ownerFiles.children).call(n)).call(t,function(t){var n=e.dir.getFileByUid(t);n&&(e.hooks.beforeBufferChanged.emit({uids:dN(n.children),modifiedUid:r.modifiedUid,operation:"modify"}),e.hooks.afterBufferChanged.emit({docType:"file",docName:n.name,docUid:t,uids:dN(n.children),modifiedUid:r.modifiedUid,operation:"modify"}))})};r.loadSource.on(t),r.removeSource.on(n),r.updateSource.on(i),r.destroy.on(function(){r.loadSource.off(t),r.removeSource.off(n),r.updateSource.off(i)})}}])}(),IH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){var r=e.hooks;e.metadataStore=new uH;var t=function(r){var t=r.data;WW(t).call(t,function(r){var t=r.metadata;t||(t={width:void 0,height:void 0}),e.metadataStore.set(r.uid,t)})},n=function(r){var t=r.removedUids;WW(t).call(t,function(r){e.metadataStore.remove(r)})},i=function(r){var t=r.data.metadata;t&&e.metadataStore.update(r.modifiedUid,t)};r.loadSource.on(t),r.removeSource.on(n),r.updateSource.on(i),r.destroy.on(function(){r.loadSource.off(t),r.removeSource.off(n),r.updateSource.off(i)})}}])}(),bH=function(){return bN(function e(r){hN(this,e),CN(this,"uid",null),CN(this,"minData",null),CN(this,"oriData",null),CN(this,"customData",{}),CN(this,"activeOri",!1),CN(this,"activeMin",!1),CN(this,"minTask",null),CN(this,"oriTask",null),CN(this,"load",!1),CN(this,"preload",[]),CN(this,"visible",[]),CN(this,"overlays",[]),CN(this,"img",null),CN(this,"minImg",null),CN(this,"imageScale",1),CN(this,"owners",[]),CN(this,"oriType",null),CN(this,"minType",null),CN(this,"metadata",null),CN(this,"realTimeWidth",0),CN(this,"realTimeHeight",0),CN(this,"isFromFile",!1),CN(this,"isCached",!1),CN(this,"isDestroyed",!1),CN(this,"isLoading",!1),CN(this,"isMinLoading",!1),CN(this,"isSaving",!1),CN(this,"annotations",void 0),CN(this,"ownerFiles",new aH({children:[]})),CN(this,"ownerTags",new aH({children:[]})),CN(this,"ownerDefaultFile",void 0),CN(this,"operations",[]),CN(this,"useFillColor",!1),this.uid=r.uid,this.metadata=zj({},r.metadata),this.setRealTimeSize(this.metadata.width,this.metadata.height)},[{key:"setRealTimeSize",value:function(e,r){this.realTimeWidth=e,this.realTimeHeight=r}},{key:"destroy",value:function(){this.isDestroyed||(this.customData=null,this.img=null,this.owners=null,this.metadata=null,this.isDestroyed=!0)}},{key:"addOwner",value:function(e){var r=this.owners;pL(r).call(r,e)<0&&r.push(e)}},{key:"removeOwner",value:function(e){var r=this.owners,t=pL(r).call(r,e);t>-1&&DL(r).call(r,t,1)}},{key:"removeViewer",value:function(e){var r=this.owners,t=pL(r).call(r,e);t>-1&&DL(r).call(r,t,1)}},{key:"setVisible",value:function(e){var r;pL(r=this.visible).call(r,e)<0&&this.visible.push(e)}},{key:"cancelVisible",value:function(e){var r,t,n=pL(r=this.visible).call(r,e);n>-1&&DL(t=this.visible).call(t,n,1)}},{key:"setPreload",value:function(e){var r;pL(r=this.preload).call(r,e)<0&&this.preload.push(e)}},{key:"cancelPreload",value:function(e){var r,t,n=pL(r=this.preload).call(r,e);n>-1&&DL(t=this.preload).call(t,n,1)}},{key:"reset",value:function(){this.minData=null,this.oriData=null,this.img=null,this.activeOri=!1,this.activeMin=!1,this.minTask=null,this.oriTask=null,this.operations=[]}}])}(),CH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){var r=e.hooks;e.statusStore=new uH;var t=function(r){var t=r.data;r.filename,r.index,WW(t).call(t,function(r){var t=new bH(r);e.statusStore.set(r.uid,t)})},n=function(r){var t=r.removedUids;WW(t).call(t,function(r){var t,n,i=e.statusStore.get(r);i&&(tH(i.minData),tH(i.oriData),i.ownerFiles.clear(),i.ownerTags.clear(),i.ownerDefaultFile=!1,null!==(t=i.img)&&void 0!==t&&t.src&&(i.img.src=""),null!==(n=i.minImg)&&void 0!==n&&n.src&&(i.minImg.src=""),i.img=null,i.minImg=null),e.statusStore.remove(r)})},i=function(r){var t=r.modifiedUid,n=r.data,i=r.revoke,o=e.statusStore.get(t);if(o){o.img=null,o.minImg=null;var a=n.metadata;a&&(o.metadata=zj({},a),o.setRealTimeSize(a.width,a.height)),i&&(tH(o.oriData),tH(o.minData)),o.reset(),e.statusStore.update(t,o)}},o=function(r){var t;WW(t=r.children).call(t,function(t){var n=e.statusStore.get(t);n&&("file"===r.type?n.ownerFiles.remove(r.uid):"tag"===r.type&&n.ownerTags.remove(r.uid))})},a=function(r){var t=r.docUid,n=r.sourceUids,i=r.type;WW(n).call(n,function(r){var n=e.statusStore.get(r);n&&("file"===i?n.ownerFiles.append(t):"tag"===i?n.ownerTags.append(t):"default"===i&&(n.ownerDefaultFile=!0))})},s=function(r){var t=r.docUid,n=r.sourceUids,i=r.type;WW(n).call(n,function(r){var n=e.statusStore.get(r);n&&("file"===i?n.ownerFiles.remove(t):"tag"===i?n.ownerTags.remove(t):"default"===i&&(n.ownerDefaultFile=!0))})};r.loadSource.on(t),r.afterRemoveSource.on(n),r.updateSource.on(i),r.removeDoc.on(o),r.loadToDoc.on(a),r.removeFromDoc.on(s),r.destroy.on(function(){r.loadSource.off(t),r.afterRemoveSource.off(n),r.updateSource.off(i),r.removeDoc.off(o),r.loadToDoc.off(a),r.removeFromDoc.off(s)})}}])}(),TH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){var r=e.hooks;e.store=new sH("space_db","space_doc");var t=function(r){var t=r.data;t&&WW(t).call(t,function(r){e.store.set(r.uid,r)})},n=function(r){var t;WW(t=r.removedUids).call(t,function(r){e.store.remove(r)})},i=function(r){e.store.update(r.modifiedUid,r.data)};r.loadSource.on(t),r.removeSource.on(n),r.updateSource.on(i),r.destroy.on(function(){r.loadSource.off(t),r.removeSource.off(n),r.updateSource.off(i)})}}])}(),wH=function(){return bN(function e(){hN(this,e)},[{key:"apply",value:function(e){e.tag=new vH,this.listenSpaceHooks(e),this.listenTagHooks(e)}},{key:"listenTagHooks",value:function(e){var r=e.tag.hooks,t=function(r){var t;WW(t=r.children).call(t,function(t){var n=e.statusStore.get(t);n&&n.ownerFiles.remove(r.uid)}),e.hooks.removeDoc.emit(r)},n=function(r){e.hooks.renameDoc.emit(r)};r.beforeRemoveTag.on(t),r.afterRenameTag.on(n),r.destroy.on(function(){r.beforeRemoveTag.off(t),r.afterRenameTag.off(n)})}},{key:"listenSpaceHooks",value:function(e){var r=e.hooks,t=function(r){var t=r.data,n=e.tag.defaultName;WW(t).call(t,function(e){var r;(e.tags||(e.tags=[]),n)&&(pL(r=e.tags).call(r,n)<0&&e.tags.push(n))})},n=function(r){var t=r.data;WW(t).call(t,function(r){var t;null!==(t=r.tags)&&void 0!==t&&WW(t).call(t,function(t){var n=e.tag.getTag(t);e.hooks.beforeBufferChanged.emit({uids:dN((null==n?void 0:n.children)||[]),operation:"add"}),e.tag.appendChildToTag(t,r.uid);var i=e.tag.getTag(t),o={docUid:i.uid,sourceUids:[r.uid],type:"tag"};e.hooks.loadToDoc.emit(o),e.hooks.afterBufferChanged.emit({docType:"tag",docName:t,docUid:null==i?void 0:i.uid,uids:dN((null==i?void 0:i.children)||[]),operation:"add"})}),r.tags.length=0})},i=function(r){var t=r.removedUids,n={};WW(t).call(t,function(r){var t,i,o=e.statusStore.get(r);o&&WW(t=nL(i=o.ownerTags.children).call(i)).call(t,function(e){n[e]||(n[e]=[]),n[e].push(r)})});for(var i=0,o=ZL(n);i<o.length;i++){var a=fN(o[i],2),s=a[0],u=a[1],c=e.tag.getTagByUid(s);c&&(e.hooks.beforeBufferChanged.emit({uids:dN(c.children),removedUids:dN(u),operation:"remove"}),e.tag.removeChildFromTag(c.name,u),e.hooks.afterBufferChanged.emit({docType:"tag",docName:c.name,docUid:s,uids:dN(c.children),removedUids:dN(u),operation:"remove"})),e.hooks.removeFromDoc.emit({docUid:s,sourceUids:u,type:"tag"})}},o=function(e){"tag"!==e.type&&i({removedUids:e.children})},a=function(r){var t=r.docUid,n=r.sourceUids;if("tag"===r.type){var i=e.tag.getTagByUid(t);i&&WW(n).call(n,function(){var r=ZE(uW.mark(function t(r){var n,o;return uW.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=1,e.store.get(r);case 1:if(o=t.sent,!(o&&pL(n=o.tags).call(n,i.name)<0)){t.next=2;break}return o.tags.push(i.name),t.next=2,e.store.update(r,o);case 2:t.next=4;break;case 3:t.prev=3,t["catch"](0);case 4:case"end":return t.stop()}},t,null,[[0,3]])}));return function(e){return r.apply(this,arguments)}}())}},s=function(r){var t=r.docUid,n=r.sourceUids;if("tag"===r.type){var i=e.tag.getTagByUid(t);i&&WW(n).call(n,function(){var r=ZE(uW.mark(function t(r){var n,o,a,s;return uW.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=1,e.store.get(r);case 1:if(!(n=t.sent)){t.next=2;break}return(s=pL(o=n.tags).call(o,i.name))>-1&&DL(a=n.tags).call(a,s,1),t.next=2,e.store.update(r,n);case 2:t.next=4;break;case 3:t.prev=3,t["catch"](0);case 4:case"end":return t.stop()}},t,null,[[0,3]])}));return function(e){return r.apply(this,arguments)}}())}},u=function(r){var t,n,i=e.statusStore.get(r.modifiedUid);i&&WW(t=nL(n=i.ownerTags.children).call(n)).call(t,function(t){var n=e.tag.getTagByUid(t);n&&(e.hooks.beforeBufferChanged.emit({uids:dN(n.children),modifiedUid:r.modifiedUid,operation:"modify"}),e.hooks.afterBufferChanged.emit({docType:"tag",docName:n.name,docUid:t,uids:dN(n.children),modifiedUid:r.modifiedUid,operation:"modify"}))})};r.beforeLoadSource.on(t),r.loadSource.on(n),r.removeSource.on(i),r.removeDoc.on(o),r.loadToDoc.on(a),r.removeFromDoc.on(s),r.updateSource.on(u),r.destroy.on(function(){r.beforeLoadSource.off(t),r.loadSource.off(n),r.removeSource.off(i),r.removeDoc.off(o),r.loadToDoc.off(a),r.removeFromDoc.off(s),r.updateSource.off(u)})}}])}(),AH=function(e){function r(){var e;return hN(this,r),CN($E(e=Kj(this,r)),"uid",rH()),CN($E(e),"hooks",{init:oH.create(),destroy:oH.create(),beforeLoadSource:oH.create(),loadSource:oH.create(),afterLoadSource:oH.create(),beforeRemoveSource:oH.create(),removeSource:oH.create(),afterRemoveSource:oH.create(),beforeUpdateSource:oH.create(),updateSource:oH.create(),afterUpdateSource:oH.create(),beforeBufferChanged:oH.create(),afterBufferChanged:oH.create(),directoryChanged:oH.create(),tagChanged:oH.create(),openDoc:oH.create(),loadToDoc:oH.create(),removeFromDoc:oH.create(),removeDoc:oH.create(),renameDoc:oH.create(),move:oH.create(),afterMove:oH.create(),"switch":oH.create(),afterSwitch:oH.create(),reorder:oH.create(),afterReorder:oH.create()}),CN($E(e),"dir",void 0),CN($E(e),"tag",void 0),CN($E(e),"store",void 0),CN($E(e),"customStore",void 0),CN($E(e),"metadataStore",void 0),CN($E(e),"statusStore",void 0),CN($E(e),"defaultFile",void 0),CN($E(e),"plugins",[]),CN($E(e),"imageLoader",void 0),e.initPlugins(),e.hooks.init.emit(),e}return sx(r,e),bN(r,[{key:"destroy",value:function(){this.hooks.destroy.emit()}},{key:"initPlugins",value:function(){(new TH).apply(this),(new CH).apply(this),(new pH).apply(this),(new IH).apply(this),(new mH).apply(this),(new yH).apply(this),(new SH).apply(this),(new wH).apply(this)}},{key:"setImageLoader",value:function(e){this.imageLoader=e}},{key:"getCustomData",value:function(e){return this.customStore.get(e)}},{key:"setCustomData",value:function(e,r){return this.customStore.set(e,r)}},{key:"getMetadata",value:function(e){return this.metadataStore.get(e)}},{key:"setMetadata",value:function(e,r){return this.metadataStore.set(e,r)}},{key:"createStore",value:function(e){var r=e.type,t=void 0===r?"sync":r,n=e.tableName,i=e.dbName;return"sync"===t?new uH:i&&n?new sH(i,n):null}},{key:"loadSource",value:function(e,r){if(qj(e))return[];var t=e.data;if(!Qj(t))return[];var n=[];return WW(t).call(t,function(e){e.uid=rH(),n.push(e.uid)}),$j(r)&&r(n),this.hooks.beforeLoadSource.emit(e),this.hooks.loadSource.emit(e),this.hooks.afterLoadSource.emit(e),n}},{key:"removeSource",value:function(e){var r=!(arguments.length>1&&arguments[1]!==undefined)||arguments[1];Xj(e)&&(e=[e]);var t={removedUids:e,docUid:"",trigger:this.uid,operation:"remove"};return this.hooks.beforeRemoveSource.emit(t),this.hooks.removeSource.emit(t),r&&this.hooks.afterRemoveSource.emit(t),!0}},{key:"updateSource",value:function(e,r){var t={modifiedUid:e,data:r,revoke:!(arguments.length>2&&arguments[2]!==undefined)||arguments[2],operation:"modify"};return this.hooks.beforeUpdateSource.emit(t),this.hooks.updateSource.emit(t),this.hooks.afterUpdateSource.emit(t),!0}},{key:"getSource",value:function(e){return this.store.get(e)}},{key:"openDefault",value:function(e){var r={node:this.defaultFile,type:"default",config:e};this.hooks.openDoc.emit(r)}},{key:"createFile",value:function(e){return this.dir.createFile(e)}},{key:"removeFile",value:function(e){return this.dir.removeFile(e)}},{key:"renameFile",value:function(e,r){return this.dir.renameFile(e,r)}},{key:"openFile",value:function(e,r){var t=this.getFile(e);if(!t)return!1;var n={node:t,type:"file",config:r};return this.hooks.openDoc.emit(n),!0}},{key:"movePagesToFile",value:function(e,r,t,n){var i=this,o=this.getFile(e),a=this.getFile(t);if(!o||!a)return!1;for(var s=0;s<r.length;s++)if(r[s]<0||r[s]>=o.children.length)return!1;if(n<0)return!1;var u=GB(r).call(r,function(e){return o.children[e]});WW(u).call(u,function(e){var r=i.statusStore.get(e);r&&r.ownerFiles.remove(o.uid)}),this.dir.removeChildFromFile(o.uid,u),this.hooks.removeFromDoc.emit({docUid:o.uid,sourceUids:u}),n>a.children.length&&(n=a.children.length);var c=this.dir.appendChildrenToFile(t,u,n),l={docUid:c.uid,sourceUids:u,type:"file",index:n,isSameDoc:e===t};return WW(u).call(u,function(e){var r=i.statusStore.get(e);r&&r.ownerFiles.append(c.uid)}),this.hooks.loadToDoc.emit(l),!0}},{key:"getFile",value:function(e){return this.dir.getFile(e)}},{key:"getFileList",value:function(){return this.dir.getCurrentFileList()}},{key:"isFileExisted",value:function(e){return this.dir.isFileExist(e)}},{key:"createTag",value:function(e){return this.tag.createTag(e)}},{key:"removeTag",value:function(e){for(var r=this.getTag(e).children||[],t=0;t<r.length;t++)this.store.get(r[t]).then(function(r){var t,n,i=pL(t=(null==r?void 0:r.tags)||[]).call(t,e);-1!==i&&DL(n=r.tags).call(n,i,1)});return this.tag.removeTag(e)}},{key:"renameTag",value:function(e,r){var t=this.getTag(e).children||[],n=this.tag.renameTag(e,r);if(n)for(var i=0;i<t.length;i++)this.store.get(t[i]).then(function(t){var n,i,o=pL(n=(null==t?void 0:t.tags)||[]).call(n,e);-1!==o&&DL(i=t.tags).call(i,o,1,r)});return n}},{key:"openTag",value:function(e,r){var t=this.getTag(e);if(!t)return!1;var n={node:t,type:"tag",config:r};return this.hooks.openDoc.emit(n),!0}},{key:"getTag",value:function(e){return this.tag.getTag(e)}},{key:"getTagList",value:function(){return this.tag.getTagList()}},{key:"setDefaultTag",value:function(e){return this.tag.setDefaultTag(e)}},{key:"getDefaultTag",value:function(){return this.tag.getDefaultTag()}},{key:"isTagExisted",value:function(e){return this.tag.isTagExisted(e)}},{key:"addTagToSource",value:function(e,r){if(this.statusStore.get(e)){Xj(r)&&(r=[r]);for(var t=0;t<r.length;t++)if(!this.addSourceToTag(r[t],e))return!1;return!0}return!1}},{key:"removeTagFromSource",value:function(e,r){if(this.statusStore.get(e)){var t;qj(r)?r=GB(t=this.tag.tags).call(t,function(e){return e.name}):Xj(r)&&(r=[r]);for(var n=0;n<r.length;n++)if(!this.removeSourceFromTag(r[n],e))return!1;return!0}return!1}},{key:"addSourceToTag",value:function(e,r){var t=this.tag.getTag(e);if(t&&this.tag.appendChildToTag(e,r)){Xj(r)&&(r=[r]);for(var n=0;n<r.length;n++)this.store.get(r[n]).then(function(r){var t;r&&(Qj(r.tags)||(r.tags=[]),kU(t=r.tags).call(t,e)||r.tags.push(e))});var i={sourceUids:r,docUid:t.uid,type:"tag"};return this.hooks.loadToDoc.emit(i),!0}return!1}},{key:"removeSourceFromTag",value:function(e,r){var t=this.tag.getTag(e);if(t){this.tag.removeChildFromTag(e,r),Xj(r)&&(r=[r]);for(var n=0;n<r.length;n++)this.store.get(r[n]).then(function(r){var t,n,i=pL(t=(null==r?void 0:r.tags)||[]).call(t,e);-1!==i&&DL(n=r.tags).call(n,i,1)});var i={docUid:t.uid,sourceUids:r,type:"tag"};return this.hooks.removeFromDoc.emit(i),!0}return!1}},{key:"getSourceTags",value:function(e){var r,t=this,n=this.statusStore.get(e);return n?GB(r=n.ownerTags.children).call(r,function(e){return t.tag.getTagByUid(e).name}):[]}},{key:"switch",value:function(e){var r=e.one,t=e.other,n=e.type,i=e.docUid,o=e.emit,a=this.getDocNode(i,n);if(a){if(a["switch"](r,t),o||qj(o)){var s={one:r,other:t,docUid:i,type:a.type,trigger:this.uid,operation:"shift"};this.hooks["switch"].emit(s)}return!0}return!1}},{key:"move",value:function(e){var r=e.from,t=e.to,n=e.type,i=e.docUid,o=e.emit,a=this.getDocNode(i,n);if(a){if(a.move(r,t),o||qj(o)){var s={from:r,to:t,docUid:i,type:a.type,trigger:this.uid,operation:"shift"};this.hooks.move.emit(s)}return!0}return!1}},{key:"reorder",value:function(e){var r=e.indexes,t=e.type,n=e.docUid,i=e.emit,o=this.getDocNode(n,t);if(o&&(o.reorder(r),i||qj(i))){var a={indexes:r,docUid:n,type:o.type,trigger:this.uid,operation:"shift"};this.hooks.move.emit(a)}}},{key:"getDocNode",value:function(e,r){switch(r){case"default":return this.defaultFile;case"file":return this.dir.getFileByUid(e);case"tag":return this.tag.getTagByUid(e);default:return e===this.defaultFile.uid?this.defaultFile:this.tag.getTagByUid(e)||(this.dir.getFileByUid(e)||null)}}}])}(nH),EH={Successful:{errorCode:0,errorString:"Successful."},InvalidIndex:{errorCode:-1033,errorString:"Invalid index."},InvalidValue:{errorCode:-1034,errorString:"Invalid value."},NoImage:{errorCode:-1035,errorString:"There is no image."},UnBindViewer:{errorCode:-2210,errorString:"You cannot call this method on this WebTwain instance because it does not use the default viewer."},AlReadyBindViewer:{errorCode:-2211,errorString:"The element is already bound to the viewer."},ParameterCannotEmpty:{errorCode:-2314,errorString:"The parameter cannot be empty."},IndicesNotArray:{errorCode:-2358,errorString:"The type of the parameter indices must be an Array."},IndexOutOfRange:{errorCode:-2359,errorString:"The index is out of range."},InvalidTagName:{errorCode:-2394,errorString:"Invalid tag name."},InvalidLeftOrTopOrRightOrBottom:{errorCode:-2417,errorString:"The left or top or right or bottom you entered is invalid."},InvalidWidth:{errorCode:-2418,errorString:"The width you entered is invalid."},InvalidHeight:{errorCode:-2419,errorString:"The height you entered is invalid."},WidthOrHeightOutOfImageSize:{errorCode:-2420,errorString:"The width or height is out of image size."},MobileServer_InvalidIndex:{errorCode:-2423,errorString:"The index is invalid."},ImageEditorExist:{errorCode:-2500,errorString:"An ImageEditor already exists."},ThumbnailViewerExist:{errorCode:-2501,errorString:"A ThumbnailViewer already exists."},CustomElementExist:{errorCode:-2502,errorString:"A CustomElement already exists."},ImageEditorDispose:{errorCode:-2504,errorString:"The ImageEditor object has been disposed."},ThumbnailViewerNotExist:{errorCode:-2505,errorString:"This ThumbnailViewer doesn't exist."},ThumbnailViewerDispose:{errorCode:-2506,errorString:"The ThumbnailViewer object has been disposed."},CallbackNotAFunction:{errorCode:-2510,errorString:"The callback is not a function."},ElementRequired:{errorCode:-2511,errorString:"Parameter 'element' is required."},ElementNotExist:{errorCode:-2512,errorString:"Parameter 'element' doesn't instanceof HTMLDivElement."},InvalidPropertyValue:{errorCode:-2514,errorString:"Invalid property value."},CursorInvalidMode:{errorCode:-2519,errorString:"The current mode does not support setting the cursor to zoom."},OldTagNameRequired:{errorCode:-2517,errorString:"Old tag name is required."},NewTagNameRequired:{errorCode:-2518,errorString:"New tag name is required."},FileNameCannotEmpty:{errorCode:-2530,errorString:"Document name cannot be empty."},FileNameNotString:{errorCode:-2531,errorString:"Document name is not a string."},FileNotExist:{errorCode:-2540,errorString:"The document does not exist."},FileExist:{errorCode:-2541,errorString:"The document already exists."},CustomElementDispose:{errorCode:-2508,errorString:"The CustomElement object has been disposed."},CustomElementNotExist:{errorCode:-2507,errorString:"This CustomElement doesn't exist."},ParameterOutRange:{errorCode:80002,errorString:"The parameter is out of range."},TagNotExist:{errorCode:80009,errorString:"Tag does not exist."},TagExist:{errorCode:80010,errorString:"The tag already exists."},OperationError:{errorCode:80022,errorString:"The operation mode is wrong."}};(hH=dH||(dH={}))[hH.Normal=0]="Normal",hH[hH.Balance=1]="Balance";var kH=function(){return bN(function e(r){var t=this;hN(this,e),CN(this,"space",void 0),CN(this,"webViewer",void 0),CN(this,"isActiveFile",!1),CN(this,"isActiveTag",!1),CN(this,"currentFileName",""),CN(this,"currentTagName",""),CN(this,"bufferConfig",null),CN(this,"currentSelected",[]),CN(this,"lastCurrentSelected",[]),this.space=new AH,r&&(this.bufferConfig=r),this.space.on("bufferChanged",function(e,r){var n;if(!t.webViewer&&$j(null===(n=t.bufferConfig)||void 0===n?void 0:n.bufferChanged)){var i,o,a,s,u,c,l,f=[],d=[],h=t.getCurrentDataSet().children;WW(i=t.currentSelected).call(i,function(e){h&&h[e]&&f.push(h[e])}),WW(o=t.lastCurrentSelected).call(o,function(e){h&&h[e]&&d.push(h[e])});var g={afterStatus:{uids:e.afterStatus.uids,selectedUids:f,modifiedUid:(null==e||null===(a=e.afterStatus)||void 0===a?void 0:a.modifiedUid)||"",removedUids:(null==e||null===(s=e.afterStatus)||void 0===s?void 0:s.removedUids)||[],currentUid:e.afterStatus.uids[e.afterStatus.uids.length-1]||""},beforeStatus:{uids:e.beforeStatus.uids,selectedUids:d,removedUids:(null==e||null===(u=e.beforeStatus)||void 0===u?void 0:u.removedUids)||[],modifiedUid:(null==e||null===(c=e.beforeStatus)||void 0===c?void 0:c.modifiedUid)||"",currentUid:e.beforeStatus.uids[e.beforeStatus.uids.length-1]||""},operation:e.operation,docUid:e.docUid,docName:(null===(l=t.space.dir.getFileByUid(e.docUid))||void 0===l?void 0:l.name)||"",total:e.afterStatus.uids.length,curIndex:e.afterStatus.uids.length-1};t.lastCurrentSelected=dN(t.currentSelected),t.bufferConfig.bufferChanged(g,r)}})},[{key:"e",value:function(){this.setError("Successful")}},{key:"IsFileNameExist",value:function(e){var r=this.space.getFileList();if("dynamsoft-default-document"===e)return!0;if(r)for(var t=0;t<r.length;t++)if(r[t].name===e)return!0;return!1}},{key:"getCurrentDataSet",value:function(){if(this.webViewer){var e=this.webViewer.myViewer.getCurrentTab();if(void 0===e)return!1;var r=e.type;this.isActiveFile="file"===r,this.isActiveTag="tag"===r}if(this.isActiveFile){var t=this.getCurrentFileName(),n=this.space.getFile(t);if(n)return n}if(this.isActiveTag){var i=this.space.getTag(this.currentTagName);if(i)return i}return!1}},{key:"setError",value:function(e){var r;if("Default"!==e){if(this.webViewer)this.webViewer.setError(e);else if(this.bufferConfig&&this.bufferConfig.viewerError){var t=EH[e],n=t.errorCode,i=t.errorString;this.bufferConfig.viewerError.setError(n,i)}}else null==this||null===(r=this.webViewer)||void 0===r||r.setDefaultError()}},{key:"emitViewerEvent",value:function(){var e;this.webViewer&&0===this.getHowManyImagesInBuffer()&&(null===(e=this.webViewer)||void 0===e||null===(e=e.myViewer)||void 0===e||e.emit("pageRendered",-1))}},{key:"bindViewer",value:function(e){this.webViewer=e}},{key:"getCurrentTag",value:function(){return this.currentTagName}},{key:"getCurrentDocument",value:function(){return this.currentFileName}},{key:"getCurrentFileName",value:function(){var e=this,r=this.space.getFileList(),t="";return r&&WW(r).call(r,function(r){r.name===e.currentFileName&&(t=e.currentFileName)}),t}},{key:"getCurrentIndex",value:function(){if(this.webViewer)return this.webViewer.getCurrentIndex();var e=this.getSelectedImagesIndices().length;if(e<=0){var r=this.getCurrentDataSet();return!!r&&r.children.length-1}return this.getSelectedImagesIndices()[e-1]}},{key:"getHowManyImagesInBuffer",value:function(){if(this.webViewer)return this.webViewer.getHowManyImagesInBuffer();var e=this.getCurrentDataSet();return e?e.children.length:0}},{key:"getSelectedImagesIndices",value:function(){return this.webViewer?this.webViewer.getSelectedImagesIndices():this.currentSelected}},{key:"getIndexByUid",value:function(e){if(!Xj(e)||!e)return this.setError("InvalidValue"),!1;if(this.webViewer)return this.webViewer.myViewer.getIndexByUid(e);var r=this.getCurrentDataSet(),t=r.children;return!!(r&&t&&Qj(t))&&pL(t).call(t,e)}},{key:"getUidByIndex",value:function(e){if(e<0||e>=this.getHowManyImagesInBuffer())return this.setError("IndexOutOfRange"),!1;if(this.webViewer)return this.webViewer.myViewer.getUidByIndex(e);var r=this.getCurrentDataSet().children;return!(r&&r.length<e)&&r[e]}},{key:"getDataByUid",value:function(e){return this.space.getSource(e)}},{key:"updateDataByUid",value:function(e,r){return this.space.store.set(e,r)}},{key:"setCustomDataByUid",value:function(e,r){return Xj(e)&&""!==e?this.space.setCustomData(e,r):(this.setError("InvalidValue"),!1)}},{key:"getCustomDataByUid",value:function(e){return this.space.getCustomData(e)}},{key:"setMetadataByUid",value:function(e,r){return Xj(e)&&""!==e?this.space.setMetadata(e,r):(this.setError("InvalidValue"),!1)}},{key:"getMetadataByUid",value:function(e){return this.space.getMetadata(e)}},{key:"addImage",value:function(e,r,t){var n,i,o={},a=this.currentFileName,s="";!qj(t)&&Xj(t)?(this.IsFileNameExist(t)||this.createDocument(t),s=t):qj(a)||""===a?(this.space.isFileExisted("dynamsoft-default-document")||this.createDocument("dynamsoft-default-document"),this.webViewer&&(this.webViewer.bEmitBufferChanged=!1),this.openDocument("dynamsoft-default-document"),this.webViewer&&(this.webViewer.bEmitBufferChanged=!0),s="dynamsoft-default-document"):s=a,r&&(delete(i=zj({},r)).oriBlobData,r.oriBlobData&&(n=r.oriBlobData));var u=e.imageUrl,c=e.minImageUrl,l=e.imageId,f=e.serverId,d=e.uidFromServer,h=e.index;n&&(o=zj({},n)),l&&(o.imageId=l),f&&(o.serverId=f),d&&(o.uidFromServer=d);var g=this.getDocumentContents(s).length;!qj(h)&&Zj(h)?h>=g&&(h=g):h=g,this.isActiveFile&&(this.currentSelected=[h]);var v=this.space.loadSource({data:[{oriData:u,minData:c,metadata:i,customData:o}],filename:s,index:h},function(r){var t=fN(r,1)[0];e.uuid=t}),m=this.getHowManyImagesInBuffer();return this.isActiveTag&&(this.currentSelected=m>0?[m-1]:[]),v}},{key:"addImages",value:function(e,r,t){if(!Qj(e)||0===e.length)return!1;var n,i,o=this.currentFileName,a="";!qj(t)&&Xj(t)?(this.IsFileNameExist(t)||this.createDocument(t),a=t):qj(o)||""===o?(this.space.isFileExisted("dynamsoft-default-document")||this.createDocument("dynamsoft-default-document"),this.webViewer&&(this.webViewer.bEmitBufferChanged=!1),this.openDocument("dynamsoft-default-document"),this.webViewer&&(this.webViewer.bEmitBufferChanged=!0),a="dynamsoft-default-document"):a=o,r&&(delete(i=zj({},r)).oriBlobData,r.oriBlobData&&(n=r.oriBlobData));var s,u=this.getDocumentContents(a).length,c=e[0].index;s=!qj(c)&&Zj(c)?c>=u?u:c:u;var l=GB(e).call(e,function(e){var r=e.imageUrl,t=e.minImageUrl,o=e.imageId,a=e.serverId,s=e.uidFromServer,u={};return n&&(u=zj({},n)),o&&(u.imageId=o),a&&(u.serverId=a),s&&(u.uidFromServer=s),{oriData:r,minData:t,metadata:i,customData:u}});this.isActiveFile&&(this.currentSelected=[s]);var f=this.space.loadSource({data:l,filename:a,index:s},function(r){WW(r).call(r,function(r,t){e[t].uuid=r})}),d=this.getHowManyImagesInBuffer();return this.isActiveTag&&(this.currentSelected=d>0?[d-1]:[]),f}},{key:"insertImage",value:function(e,r,t){var n;if(t&&t>=0)this.currentSelected=[t],n=this.space.loadSource({data:[e],filename:r,index:t});else{n=this.space.loadSource({data:[e],filename:r});var i=this.getHowManyImagesInBuffer();this.currentSelected=i>0?[i-1]:[]}return n[0]}},{key:"updateImage",value:function(e,r){var t=e.imageUrl,n=e.minImageUrl,i=e.imageId,o=e.serverId,a=e.uidFromServer,s=e.uuid,u=zj({},r);return s&&""!==s&&-1!==s?(this.space.updateSource(s,{oriData:t,minData:n,metadata:u,customData:{imageId:i,serverId:o,uidFromServer:a}}),s):(this.setError("IndexOutOfRange"),!1)}},{key:"removeImageByUid",value:function(e){if(this.e(),this.webViewer){var r=this.webViewer.removePageByUid(e);return this.webViewer.resized(),this.emitViewerEvent(),r}return this.space.removeSource(e)}},{key:"removeImageByIndex",value:function(e){if(this.e(),e<0||e>=this.getHowManyImagesInBuffer())return this.setError("IndexOutOfRange"),!1;var r=this.getCurrentIndex(),t=!1;if(this.currentSelected=e===r&&0===e?this.getHowManyImagesInBuffer()>0?[0]:[]:e<=r?[r-1]:[r],this.webViewer)t=this.webViewer.removePageByIndexes(e),this.webViewer.resized(),this.emitViewerEvent();else{var n=this.getCurrentDataSet();if(!n)return!1;t=this.space.removeSource(n.children[e])}return t||this.setError("Default"),t}},{key:"removeSelectedImages",value:function(e){this.e();var r=this.getSelectedImagesIndices();Qj(e)&&e.length>0&&(r=e);var t=!1;if(this.webViewer)t=this.webViewer.removePageByIndexes(r),this.webViewer.resized(),this.emitViewerEvent();else{var n=[],i=this.getCurrentDataSet();if(!i)return!1;WW(r).call(r,function(e){i.children[e]&&i.children[e]&&n.push(i.children[e])}),t=this.space.removeSource(n)}t||this.setError("Default");var o=this.getHowManyImagesInBuffer();return this.currentSelected=o>0?[o-1]:[],t}},{key:"removeImageByIndexArr",value:function(e){if(this.e(),!Qj(e))return!1;var r=this.getCurrentDataSet();if(!r)return!1;var t,n=[];WW(e).call(e,function(e){var t=r.children[e];t&&n.push(t)}),(t=this.space.removeSource(n))||this.setError("Default"),this.webViewer&&(this.webViewer.resized(),this.emitViewerEvent());var i=this.getHowManyImagesInBuffer();return this.currentSelected=i>0?[i-1]:[],t}},{key:"removeAllImages",value:function(){this.e();var e=!1;if(this.currentSelected=[],this.webViewer)e=this.webViewer.removeAllPages(),this.webViewer.resized(),this.emitViewerEvent();else{var r=this.getCurrentDataSet();r&&(e=this.space.removeSource(dN(r.children)))}return e||this.setError("Default"),e}},{key:"tagImages",value:function(e,r){this.e();var t=this.getHowManyImagesInBuffer();if(!Qj(e))return this.setError("IndicesNotArray"),!1;if(!Xj(r)||""===r)return this.setError("InvalidTagName"),!1;for(var n=0;n<t;n++){var i=e[n];if(iM(i)||i<0||i>=t)return this.setError("IndexOutOfRange"),!1}this.space.createTag(r);for(var o=0;o<e.length;o++){var a=e[o];if(a>=0){var s=this.getUidByIndex(a);s&&""!==s&&-1!==WU(s,10)&&this.space.addTagToSource(s,r)}}return!0}},{key:"removeImageTag",value:function(e,r){if(this.e(),!Zj(e))return this.setError("InvalidValue"),!1;if(e<0||e>this.getHowManyImagesInBuffer())return this.setError("IndexOutOfRange"),!1;var t=this.getUidByIndex(e),n=!1;return t&&""!==t&&-1!==t&&(n=this.space.removeTagFromSource(t,r)),n||this.setError("Default"),n}},{key:"getDefaultTag",value:function(){return this.space.getDefaultTag()}},{key:"setDefaultTag",value:function(e){if(this.e(),!Xj(e))return this.setError("InvalidValue"),!1;if(""===e)return this.space.setDefaultTag(null),!0;var r;return this.space.createTag(e),(r=this.space.setDefaultTag(e))||this.setError("Default"),r}},{key:"removeTag",value:function(e,r){var t=this;if(this.e(),!Xj(e))return this.setError("InvalidValue"),!1;if(!qj(r)&&!Qj(r))return this.setError("IndicesNotArray"),!1;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),!1;var n=this.currentTagName,i=!1,o=!1;if(n&&(i=n===e),qj(r))o=this.space.removeTag(e),i&&this.clearFilter();else{var a=[];WW(r).call(r,function(e){var r=t.getUidByIndex(e);-1!==r&&a.push(r)});for(var s=0;s<(null==a?void 0:a.length);s++)if(!(o=this.space.removeTagFromSource(a[s],e)))return!1}return o||this.webViewer.setDefaultError(),o}},{key:"renameTag",value:function(e,r){if(this.e(),qj(e)||""===e)return this.setError("OldTagNameRequired"),!1;if(qj(r)||""===r)return this.setError("NewTagNameRequired"),!1;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),!1;if(this.space.isTagExisted(r))return this.setError("TagExist"),!1;var t;return e===this.currentTagName&&(this.currentTagName=r),(t=this.space.renameTag(e,r))?this.space.setDefaultTag(r):this.setError("Default"),t}},{key:"getTagContents",value:function(e){return this.e(),e&&Xj(e)&&""!==e?this.space.getTag(e).children:[]}},{key:"getTagList",value:function(){var e=this;this.e();var r=this.space.getTagList(),t=[];return r?WW(r).call(r,function(r){var n,i=[];WW(n=r.children).call(n,function(r){var t=e.getCustomDataByUid(r);if(t){var n=t.uidFromServer;i.push(n)}}),t.push({name:r.name,imageIds:i})}):t=[],t}},{key:"getTagListByIndex",value:function(e){if(!Zj(e))return!1;var r=this.getUidByIndex(e);return this.space.getSourceTags(r)}},{key:"clearFilter",value:function(){this.e(),this.currentTagName="",this.space.setDefaultTag(null);var e,r=this.getCurrentFileName();return""===r&&(r="dynamsoft-default-document"),(e=this.openDocument(r))||this.setError("Default"),e}},{key:"filterImagesByTag",value:function(e,r,t){this.e();var n=!1;if(qj(e)||null===e||""===e){this.currentTagName="";var i=this.getCurrentFileName();""===i&&(i="dynamsoft-default-document"),(n=this.openDocument(i))?$j(r)&&r():(this.setError("Default"),$j(t)&&t())}else{var o;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),$j(t)&&t(),!1;if(this.isActiveTag=!0,this.isActiveFile=!1,this.currentTagName=e,this.setDefaultTag(e),n=this.space.openTag(e,null==this||null===(o=this.webViewer)||void 0===o||null===(o=o.myViewer)||void 0===o?void 0:o.uid)){var a=this.space.getTag(e);if(a){var s,u=(null==a||null===(s=a.children)||void 0===s?void 0:s.length)||0;this.currentSelected=u>0?[u-1]:[]}$j(r)&&r()}else this.setError("Default"),$j(t)&&t()}return this.webViewer&&this.webViewer.render(),n}},{key:"createDocument",value:function(e){if(this.e(),!e||""===e){var r=Zj(e)?"FileNameNotString":"FileNameCannotEmpty";return this.setError(r),!1}return Xj(e)?this.space.isFileExisted(e)?(this.setError("FileExist"),!1):!!this.space.createFile(e)||(this.setError("Default"),!1):(this.setError("FileNameNotString"),!1)}},{key:"openDocument",value:function(e,r){var t;if(this.e(),!e||""===e){var n=Zj(e)?"FileNameNotString":"FileNameCannotEmpty";return this.setError(n),!1}if(!Xj(e))return this.setError("FileNameNotString"),!1;if(!this.space.isFileExisted(e))return this.setError("FileNotExist"),!1;var i=r&&""!==r?r:null==this||null===(t=this.webViewer)||void 0===t||null===(t=t.myViewer)||void 0===t?void 0:t.uid,o=this.space.getFile(e);if(o){var a,s=null==o||null===(a=o.children)||void 0===a?void 0:a.length;this.currentSelected=s>0?[s-1]:[]}return this.space.openFile(e,{viewerUid:i})?(this.currentFileName=e,this.isActiveFile=!0,this.isActiveTag=!1,!0):(this.setError("Default"),!1)}},{key:"getDocumentContents",value:function(e){return this.e(),e&&Xj(e)&&""!==e?this.space.isFileExisted(e)?this.space.getFile(e).children:(this.setError("FileNotExist"),[]):[]}},{key:"renameDocument",value:function(e,r){return this.e(),Xj(e)&&Xj(r)?(e&&""!==e&&r&&""!==r||this.setError("FileNameCannotEmpty"),this.space.isFileExisted(e)?this.space.isFileExisted(r)?(this.setError("FileExist"),!1):this.space.renameFile(e,r)?(this.currentFileName===e&&(this.currentFileName=r),!0):(this.setError("Default"),!1):(this.setError("FileNotExist"),!1)):(this.setError("FileNameNotString"),!1)}},{key:"removeDocument",value:function(e){if(this.e(),!e||!Xj(e))return this.setError("FileNameNotString"),!1;if(!this.space.isFileExisted(e))return this.setError("FileNotExist"),!1;var r=this.space.removeFile(e);return r?(r&&this.webViewer&&this.webViewer.resized(),this.currentFileName===e&&(this.currentFileName=""),!0):(this.setError("Default"),!1)}},{key:"getDocumentInfoList",value:function(){var e=this;this.e();var r=this.space.getFileList(),t=[];return r?(WW(r).call(r,function(r){if(r.children){for(var n=[],i=0;i<r.children.length;i++){var o=r.children[i],a=e.getCustomDataByUid(o);if(a){var s=a.uidFromServer;n.push(s)}}t.push({imageIds:n,name:r.name})}}),t):[]}},{key:"getDocumentInfo",value:function(e){this.e();var r=this.space.getFile(e);if(!r)return this.setError("FileNotExist"),{imageIds:[],length:0};for(var t=[],n=0;n<r.children.length;n++){var i=r.children[n],o=this.getCustomDataByUid(i);if(o){var a=o.uidFromServer;t.push(a)}}return{imageIds:t,length:t.length}}},{key:"selectImages",value:function(e){this.e();var r=!0;if(!e||!Qj(e))return!1;if(this.webViewer){var t=this.webViewer.getIfAutoScroll();!1===t&&this.webViewer.setIfAutoScroll(!0),r=this.webViewer.selectPages(e),!1===t&&this.webViewer.setIfAutoScroll(!1)}else{for(var n=this.getHowManyImagesInBuffer(),i=0;i<e.length;i++)if(!Zj(e[i])||e[i]<0||e[i]>=n)return this.setError("ParameterOutRange"),!1;r=!0}return r?this.currentSelected=e:this.setError("Default"),r}},{key:"selectAllImages",value:function(){this.e();var e=!0;if(this.webViewer)e=this.webViewer.myViewer.selectAll(),this.currentSelected=this.webViewer.getSelectedImagesIndices();else{var r,t=this.getCurrentDataSet();this.currentSelected=zU(uV(r=new Array(t.children.length)).call(r))}return e||this.setError("Default"),e}},{key:"moveImage",value:function(e,r){this.e();var t=WU(e,10),n=WU(r,10);if(iM(e)||iM(r))return this.setError("InvalidIndex"),!1;var i=this.getHowManyImagesInBuffer();if(t<0||t>=i||n<0||n>i)return this.setError("IndexOutOfRange"),!1;var o=!1;if(this.webViewer)o=this.webViewer.myViewer.movePage(e,r);else{var a=this.getCurrentDataSet();if(!a)return!1;a.children.length>r&&(this.currentSelected=[r]),o=this.space.move({docUid:a.uid,type:a.type,from:e,to:r})}return o||this.setError("Default"),o}},{key:"switchImage",value:function(e,r){this.e();var t=WU(e,10),n=WU(r,10);if(iM(e)||iM(r))return this.setError("InvalidIndex"),!1;var i=this.getHowManyImagesInBuffer(),o=this.getCurrentIndex();if(t<0||t>=i||n<0||n>i)return this.setError("IndexOutOfRange"),!1;var a=!1;if(this.webViewer)a=this.webViewer.myViewer.switchPage(e,r);else{var s=this.getCurrentDataSet();if(!s)return!1;a=this.space["switch"]({docUid:s.uid,type:s.type,one:e,other:r})}a||this.setError("Default");var u=o;return t===o?u=n:n===o&&(u=t),this.currentSelected=[u],a}},{key:"moveImageToFile",value:function(e,r,t,n){if(!this.space.isFileExisted(e)||!this.space.isFileExisted(t))return this.setError("FileNotExist"),!1;r=dN(new jj(r));var i=this.getDocumentInfo(e).length;if(!Qj(r)||r.length>i)return this.setError("ParameterOutRange"),!1;var o=this.getDocumentInfo(t).length,a=this.space.movePagesToFile(e,r,t,n);if(!this.webViewer&&this.isActiveFile){var s=this.getHowManyImagesInBuffer();e===this.currentFileName&&(this.currentSelected=s>0?[s-1]:[]),t===this.currentFileName&&(Zj(n)&&n<o&&n>=0?this.currentSelected=[n+r.length-1]:this.currentSelected=s>0?[s-1]:[])}return a}}])}();HTMLCanvasElement.prototype.toBlob||Hj(HTMLCanvasElement.prototype,"toBlob",{value:function(e,r,t){for(var n=atob(this.toDataURL(r,t).split(",")[1]),i=n.length,o=new Uint8Array(i),a=0;a<i;a++)o[a]=n.charCodeAt(a);e(new Blob([o],{type:r||"image/png"}))}});var PH=function(e){function r(e){var t;if(_(this,r),t=s(this,r),e)t._baseUrl=e._baseUrl,t._buffer=e._buffer,t._serverIdMap=e._serverIdMap,t._uidMap=e._uidMap;else{var n=t,i={bufferChanged:function(e,r){n.fire("bufferChanged",[e,r])},viewerError:{setError:function(e,r){n._error={code:e,message:r},n.fire("error",n._error)}}};t._baseUrl="",t._buffer=new kH(i),t._serverIdMap={},t._uidMap={}}return t}return l(r,e),S(r,[{key:"getError",value:function(){return this._error}},{key:"BaseUrl",get:function(){return this._baseUrl}},{key:"getImageUrl",value:function(e){var r=this.convertClientIndexToServerId(e),t=Date.now();return um.getImageUrl(this._baseUrl,r,-1,-1,t)}},{key:"getMinImageUrl",value:function(e,r,t){var n=this.convertClientIndexToServerId(e),i=Date.now();return n&&r&&t?um.getImageUrl(this._baseUrl,n,parseInt(r),parseInt(t),i):""}},{key:"append",value:function(e,r,t,n,o){var a,s,u,c,l=Date.now(),f=r,d=t;if(a={imageId:f,serverId:r,uidFromServer:d,imageUrl:u=um.getImageUrl(this._baseUrl,f,-1,-1,l),minImageUrl:s=n&&n.controlWidth&&n.controlWidth>0&&n.controlHeight&&n.controlHeight>0?Dn.navInfoSync.bMobile?um.getImageUrl(this._baseUrl,f,Math.round(n.controlWidth*devicePixelRatio),Math.round(n.controlHeight*devicePixelRatio),l):um.getImageUrl(this._baseUrl,f,parseInt(n.controlWidth),parseInt(n.controlHeight),l):u},c=n.currentFileName.length>0?this._buffer.addImage(a,n,n.currentFileName):this._buffer.addImage(a,n)){var h=i(c,1)[0],g=this._buffer.getCustomDataByUid(h);return g.serverId=f,g.uidFromServer=d,this._innerInsertModel(f,d,h,u,s),h}return!1}},{key:"appendImages",value:function(e){for(var r,t,n=[],i=[],o=0;o<e.length;o++){var a,s,u=e[o],c=Date.now(),l=u.serverId,f=u.uidFromServer;r||(r=u.metaDataObj),a={imageId:l,serverId:l,uidFromServer:f,imageUrl:s=um.getImageUrl(this._baseUrl,l,-1,-1,c),minImageUrl:r&&r.controlWidth&&r.controlWidth>0&&r.controlHeight&&r.controlHeight>0?Dn.navInfoSync.bMobile?um.getImageUrl(this._baseUrl,l,Math.round(r.controlWidth*devicePixelRatio),Math.round(r.controlHeight*devicePixelRatio),c):um.getImageUrl(this._baseUrl,l,parseInt(r.controlWidth),parseInt(r.controlHeight),c):s},i.push(a)}if(t=r&&r.currentFileName&&r.currentFileName.length>0?this._buffer.addImages(i,r,r.currentFileName):this._buffer.addImages(i,r))for(var d=0;d<i.length;d++){var h=i[d],g=h.serverId,v=h.uidFromServer,m=h.minImageUrl,p=h.imageUrl,_=t[d],y=this._buffer.getCustomDataByUid(_);y.serverId=g,y.uidFromServer=v,this._innerInsertModel(g,v,_,p,m),n.push(_)}return n}},{key:"insertBefore",value:function(e,r,t,n,o){var a,s,u,c=Date.now(),l=t,f=n;a={index:e,imageId:l,serverId:l,uidFromServer:f,imageUrl:u=um.getImageUrl(this._baseUrl,l,-1,-1,c),minImageUrl:s=o&&o.controlWidth&&o.controlWidth>0&&o.controlHeight&&o.controlHeight>0?Dn.navInfoSync.bMobile?um.getImageUrl(this._baseUrl,l,Math.round(o.controlWidth*devicePixelRatio),Math.round(o.controlHeight*devicePixelRatio),c):um.getImageUrl(this._baseUrl,l,parseInt(o.controlWidth),parseInt(o.controlHeight),c):u};var d=this._buffer.addImage(a);if(d){var h=i(d,1)[0],g=this._buffer.getCustomDataByUid(h);return g.serverId=l,g.uidFromServer=f,this._innerInsertModel(l,f,h,u,s),this._buffer.openDocument(this.getCurrentFileName()),h}return!1}},{key:"_innerInsertModel",value:function(e,r,t,n,i){var o=new r_;o.serverId=e,o.uidFromServer=r,o.uuid=t,o.imageUrl=n,o.minImageUrl=i,this._serverIdMap[e]=o,this._uidMap[r]=o}},{key:"refresh",value:function(e,r,t,n){var i=1*e;if(t){var o=this.count();if(i<0||i>o)return!1;this._setDataImageControl(i,n)}return!0}},{key:"refreshByImageId",value:function(e,r,t){var n=e;return r&&this._setDataImageControl(n,t,!0),!0}},{key:"_setDataImageControl",value:function(e,r,t){var n,i,o,a,s,u,c=this,l=c._baseUrl;if(t)s=e;else if(s=(a=c.getCustomDataByIndex(e)).serverId,u=a.uidFromServer,s<=0)return!1;if((n=c.getImageIdMap(s))||((n=new r_).serverId=s,n.uidFromServer=u,c._serverIdMap[s]=n,c._uidMap[u]=n),l){null!=n&&(n.ticks=Date.now()),i=um.getImageUrl(l,s,-1,-1,n.ticks),o=r&&r.controlWidth&&r.controlWidth>0&&r.controlHeight&&r.controlHeight>0?Dn.navInfoSync.bMobile?um.getImageUrl(l,s,Math.round(r.controlWidth*devicePixelRatio),Math.round(r.controlHeight*devicePixelRatio),n.ticks):um.getImageUrl(l,s,parseInt(r.controlWidth),parseInt(r.controlHeight),n.ticks):i,n.imageUrl=i,n.minImageUrl=o,r&&(r.height&&(n.height=r.height),r.width&&(n.width=r.width));var f=jr.clone(n);f.imageId=s,c._buffer.updateImage(f,r)}return!0}},{key:"convertIndicesToServerIds",value:function(e){var r,t=e.length,n=[];for(r=0;r<t;r++){var i=this.convertClientIndexToServerId(e[r]);-1!=i&&n.push(i)}return n}},{key:"removeImagesByServerId",value:function(e,r){var t=this,n=null!=r?r:this._buffer.getCurrentDocument(),i=[];return jr.each(e,function(e,r){var o=parseInt(e);t._removeMapModelImageControlByServerId(o);var a=-1;return a=t._buffer.isActiveFile?t._convertServerIdToIndexInFile(n,o):t._convertServerIdToIndex(o),!isNaN(a)&&(!(a<0||a>=t.count())&&void i.push(a))}),i.length>0&&t._buffer.removeImageByIndexArr(i)}},{key:"removeByServerId",value:function(e,r,t){var n=this,i=null!=t?t:this._buffer.getCurrentDocument();n._removeMapModelImageControlByServerId(e);var o=-1;return o=this._buffer.isActiveFile?this._convertServerIdToIndexInFile(i,e):r,!isNaN(o)&&(!(o<0||o>=n.count())&&n._buffer.removeImageByIndex(o))}},{key:"exists",value:function(e){if(this._serverIdMap[e])return!0;var r=-1;if(this._buffer.isActiveFile){var t=this.getCurrentFileName();r=this._convertServerIdToIndexInFile(t,e)}else r=this._convertServerIdToIndex(e);return r>-1}},{key:"removeImages",value:function(e){var r,t,n;for(n=e.length,r=0;r<n;r++)t=this.convertClientIndexToServerId(e[r]),this._removeMapModelImageControlByServerId(t);return this._buffer.removeSelectedImages(e)}},{key:"clear",value:function(){var e,r,t,n=this;for(t=n.count(),e=0;e<t;e++)r=n.convertClientIndexToServerId(e),this._removeMapModelImageControlByServerId(r);return t==Object.keys(n._serverIdMap).length&&(n._serverIdMap={},n._uidMap={}),n._buffer.removeAllImages()}},{key:"_uidFromServer2index",value:function(e){var r,t,n,i=this;if((n=i._uidMap[e])&&(t=n.uuid),t&&-1!=t)r=i._buffer.getIndexByUid(t);else if(i._buffer.isActiveFile){var o=this.getCurrentFileName();r=this._convertUidFromServerToIndexInFile(o,e)}else r=this._convertUidFromServerToIndex(e);return jr.isNumber(r)||(r=-1),r}},{key:"_serverId2uidFromServer",value:function(e){if(e&&e>0){var r,t,n;if((n=this._serverIdMap[e])&&(t=n.uidFromServer))return t;if((r=this.convertServerIdToClientIndex(e))>=0)return this._index2uidFromServer(r)}return-1}},{key:"_uidFromServer2ServerId",value:function(e){if(e){var r,t,n;if((n=this._uidMap[e])&&(t=n.serverId))return t;if((r=this._uidFromServer2index(e))>=0)return this.convertClientIndexToServerId(r)}return-1}},{key:"_index2uidFromServer",value:function(e){var r=this.getCustomDataByIndex(e);return r?r.uidFromServer:-1}},{key:"convertServerIdToClientIndex",value:function(e){var r,t,n,i=this;if((n=i._serverIdMap[e])&&(t=n.uuid),t&&-1!=t)r=i._buffer.getIndexByUid(t);else if(i._buffer.isActiveFile){var o=this.getCurrentFileName();r=this._convertServerIdToIndexInFile(o,e)}else r=this._convertServerIdToIndex(e);return jr.isNumber(r)||(r=-1),r}},{key:"getIndexByUid",value:function(e){var r;return!1===(r=this._buffer.getIndexByUid(e))?-1:r}},{key:"getUidByIndex",value:function(e){return this._buffer.getUidByIndex(e)}},{key:"convertClientIndexToServerId",value:function(e){var r=this.getCustomDataByIndex(e);return r?r.serverId:-1}},{key:"getCurrentImageIndex",value:function(){var e=this._buffer.getCurrentIndex();return jr.isBoolean(e)?-1:e}},{key:"setCurrentImageIndex",value:function(e){return this._buffer.selectImages([e])}},{key:"getCurrentFileName",value:function(){return this._buffer.getCurrentFileName()}},{key:"setDefaultTag",value:function(e){return this._buffer.setDefaultTag(e)}},{key:"getDefaultTag",value:function(){return this._buffer.getDefaultTag()}},{key:"count",value:function(){return this._buffer.getHowManyImagesInBuffer()}},{key:"getCountByDocumentName",value:function(e){return this._buffer.getDocumentInfo(e).length}},{key:"dispose",value:function(){this.clear(),this._buffer=null,this._baseUrl="",this._serverIdMap=null,this._uidMap=null,this._error=null}},{key:"getImageData",value:function(e){var r=this._buffer.getUidByIndex(e);return r?this._buffer.getDataByUid(r):Promise.resolve(null)}},{key:"getCustomDataByIndex",value:function(e){return this._buffer.getCustomDataByUid(this._buffer.getUidByIndex(e))}},{key:"getMetadataByIndex",value:function(e){return this._buffer.getMetadataByUid(this._buffer.getUidByIndex(e))}},{key:"setCustomData",value:function(e,r){var t=this._buffer.getUidByIndex(e);return!(!t||!r)&&this._buffer.setCustomDataByUid(t,r)}},{key:"openDocument",value:function(e){return this._buffer.openDocument(e)}},{key:"createDocument",value:function(e){return this._buffer.createDocument(e)}},{key:"getImageIdMap",value:function(e){return this._serverIdMap[e]}},{key:"_removeMapModelImageControlByServerId",value:function(e){var r=this;if(e>0&&r._serverIdMap[e]){var t=r._serverIdMap[e],n=t.uidFromServer;t.Clear(),delete r._serverIdMap[e],delete r._uidMap[n]}}},{key:"_convertServerIdToIndexInFile",value:function(e,r){var t,n,i=-1;for(t=this._buffer.getDocumentContents(e),n=0;n<t.length;n++){var o=t[n];if(o){var a=this._buffer.getCustomDataByUid(o);if(a&&a.serverId==r){i=n;break}}}return i}},{key:"_convertServerIdToIndex",value:function(e){var r,t=-1;for(r=0;r<this.count();r++){var n=this._buffer.getUidByIndex(r);if(n){var i=this._buffer.getCustomDataByUid(n);if(i&&i.serverId==e){t=r;break}}}return t}},{key:"_convertUidFromServerToIndexInFile",value:function(e,r){var t,n,i=-1;for(t=this._buffer.getDocumentContents(e),n=0;n<t.length;n++){var o=t[n];if(o){var a=this._buffer.getCustomDataByUid(o);if(a&&a.uidFromServer==r){i=n;break}}}return i}},{key:"_convertUidFromServerToIndex",value:function(e){var r,t=-1;for(r=0;r<this.count();r++){var n=this._buffer.getUidByIndex(r);if(n){var i=this._buffer.getCustomDataByUid(n);if(i&&i.uidFromServer==e){t=r;break}}}return t}},{key:"convertUUIDToServerId",value:function(e){var r=this._buffer.getCustomDataByUid(e);return r&&-1!=r.serverId?r.serverId:-1}},{key:"UpdateImage",value:function(e,r){return this._buffer.updateImage(e,r),!0}}],[{key:"_setBaseUrl",value:function(e,r){e._baseUrl=r}},{key:"_getBuffer",value:function(e){return e._buffer}}])}(X),FH=function(e){function r(e){var t;_(this,r);var n=t=s(this,r,[e]);t.__IfAppendImage=!0,t.__maxImagesInBuffer=32767,t.__insertingIndex=-1,t._aryBitmapCache=[],t._imageBufferWrapper=new PH,t._imageBufferWrapper.on("bufferChanged",function(e){if(jr.isFunction(n.__OnBufferChanged)){var r,t,i,o=e[0],a=[],s=-1,u=[];for(o.operation&&(o.action=o.operation),t=0;t<n._imageBufferWrapper.count();t++)(r=n._imageBufferWrapper.getCustomDataByIndex(t))&&r.serverId&&a.push(n._imageBufferWrapper._serverId2uidFromServer(r.serverId));if(o.imageIds=a,o.curIndex>=0&&(r=n._imageBufferWrapper.getCustomDataByIndex(o.curIndex))&&r.serverId&&(s=n._imageBufferWrapper._serverId2uidFromServer(r.serverId)),o.currentId=s,"modify"==o.operation&&""!=o.afterStatus.modifiedUid){var c=n._imageBufferWrapper.getIndexByUid(o.afterStatus.modifiedUid);c>=0&&(r=n._imageBufferWrapper.getCustomDataByIndex(c))&&r.serverId&&(o.modifiedId=n._imageBufferWrapper._serverId2uidFromServer(r.serverId))}if(o.afterStatus.selectedUids)for(i=0;i<o.afterStatus.selectedUids.length;i++){var l=o.afterStatus.selectedUids[i];if(l&&-1!=l){var f=n._imageBufferWrapper.getIndexByUid(o.afterStatus.selectedUids[i]);f>=0&&(r=n._imageBufferWrapper.getCustomDataByIndex(f))&&r.serverId&&u.push(n._imageBufferWrapper._serverId2uidFromServer(r.serverId))}}o.selectedIds=u,jr.mix(o,{}),delete o.uids,delete o.currentUid,delete o.selectedUids,delete o.afterStatus,delete o.beforeStatus,delete o.operation,delete o.curIndex,delete o.docUid;try{return n.__OnBufferChanged(o)}catch(d){jr.error(d)}}}),t._imageBufferWrapper.on("error",function(e){n._errorCode=e.code,n._errorString=e.message});var i=dp.getServerImageUrlPrefix(t);return PH._setBaseUrl(t._imageBufferWrapper,i),t}return l(r,e),S(r,[{key:"_OnActiveUIClearBuffer",value:function(){var e=this.__OnBufferChanged;this.__OnBufferChanged=undefined,this._imageBufferWrapper.clear(),this.__OnBufferChanged=e}},{key:"_registerMultiEvent",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n=["_$",e].join("");t[n]||(t[n]={});var i=t[n],o=jr.guid();return i[o]=r,o}},{key:"_unregisterMultiEvent",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n=["_$",e].join(""),i=t[n];if(r){var o;if(jr.isString(r))return delete i[r],!0;if(jr.isFunction(r))for(o=0;o<i.length;o++)if(r==i[o])return i.splice(o,1),!0}return t[n]=null,!0}},{key:"_getMetadata",value:function(e){return this._imageBufferWrapper.getMetadataByIndex(e)}},{key:"_updateImage",value:function(e,r,t){var n,i,o,a,s=dt.Auto,u=this;return t&&(undefined!=t.width&&(o=parseInt(t.width)),undefined!=t.height&&(a=parseInt(t.height)),s=jr.isNumber(o)&&jr.isNumber(a)&&r.byteLength===o*a*4?dt.RGBA:dt.Auto),n={imageId:e,serverId:e,bufferLen:r.byteLength,imageType:s},t&&s==dt.RGBA&&(n.width=o,n.height=a,undefined!=t.bitDepth&&(n.bit=t.bitDepth),undefined!=t.resolutionX&&(n.xres=parseInt(t.resolutionX)),undefined!=t.resolutionY&&(n.yres=parseInt(t.resolutionY)),undefined!=t.uid&&(n.uidFromServer=t.uid)),i=jr.stringify([jr.stringify(n)]),new Promise(function(e,t){u._innerSendBlobByWS("UpdateImage",i,r,function(r){jr.log("UpdateImage success."),e(r)},function(e){jr.log("UpdateImage failed."),jr.error(e),t({code:u._errorCode,message:u._errorString})})})}},{key:"_removeImages",value:function(e){return this._imageBufferWrapper.removeImages(e)}},{key:"_getCurrentDocumentName",value:function(){var e="";return this._imageBufferWrapper&&(e=this._imageBufferWrapper.getCurrentFileName()),e}},{key:"_getCurrentDefaultTagName",value:function(){var e="";return this._imageBufferWrapper&&(e=this._imageBufferWrapper.getDefaultTag()||""),e}},{key:"_innerRefreshUI",value:function(e,r,t,n,i){var o=this;return t&&o._imageBufferWrapper.refresh(e,o._imageBufferWrapper.count(),!0,n),jr.isFunction(o.__OnRefreshUI)&&o.__OnRefreshUI(o._imageBufferWrapper.getCurrentImageIndex(),o._imageBufferWrapper.count()),!0}},{key:"_innerRefreshUIByImageId",value:function(e,r,t,n){var i=this;return r&&i._imageBufferWrapper.refreshByImageId(e,!0,t),jr.isFunction(i.__OnRefreshUI)&&i.__OnRefreshUI(i._imageBufferWrapper.getCurrentImageIndex(),i._imageBufferWrapper.count()),!0}},{key:"_getHowManyImagesInBuffer",value:function(){return this._isValid()?this._imageBufferWrapper.count():0}},{key:"_OnBitmapChanged",value:function(e,r,t){var n,i,o,a=this,s="m1"==e[0],u="c1"==e[0],c="c2"==e[0],l=u||c||s,f=e[1].split(","),d=e[2],h=e[3],g=a.__maxImagesInBuffer,v=-1,m=!1,p=[];if(t&&(n=t.document,i=t.tag,t.bNeedClearTag&&(o=t.bNeedClearTag)),jr.log("_OnBitmapChanged.currentFileName="+n+", tag="+i),n?n!=a._getCurrentDocumentName()&&(m=!0):n=a._getCurrentDocumentName(),a._imageBufferWrapper&&(i?(a._imageBufferWrapper.setDefaultTag(i),jr.log("metaDataObj.currentTag="+i)):o&&(a._imageBufferWrapper.setDefaultTag(""),jr.log("metaDataObj.currentTag=''"))),s);else if(c)e.length>5&&(p=e[5]),jr.isArray(p)||(p=[]);else{var _={};if(e.length>5&&(_.width=e[5]),e.length>6&&(_.height=e[6]),e.length>7&&(_.bitDepth=e[7]),e.length>8&&(_.resolutionX=e[8]),e.length>9&&(_.resolutionY=e[9]),e.length>10&&(v=e[10]),e.length>11&&jr.isString(e[11])&&(_.uidFromServer=e[11]),p.push(_),v>-1&&a._canConsume()&&(d==Zt.enumBCAppend||d==Zt.enumBCInsert)){var y=xn.lgct(v);jr.isFunction(a.__OnLtsverify)&&a.__OnLtsverify(y,1)}}if(jr.log("OnBitmapChanged:"+e),d==Zt.enumBCInsert||d==Zt.enumBCAppend&&!a.__IfAppendImage||t&&d==Zt.enumBCAppend&&t.index>=0)jr.each(f,function(e,r){var i,o=parseInt(e),s=a._imageBufferWrapper.getCurrentImageIndex(),u=undefined;if(r<p.length&&p[r]?(u=(i=p[r]).uidFromServer,delete i.uidFromServer):i={},i.currentFileName=n,isNaN(o)||o<0)return!0;if(l)a._aryBitmapCache.push(o);else for(var c=0;c<a._aryBitmapCache.length;c++)if(a._aryBitmapCache[c]==o)return a._aryBitmapCache.splice(c,1),!0;if(a._imageBufferWrapper.exists(o))return!0;a.__insertingIndex>-1&&(s=a.__insertingIndex),i.controlWidth=400,i.controlHeight=400,a._controlWidth&&a._controlWidth>400&&(i.controlWidth=a._controlWidth),a._controlHeight&&a._controlHeight>400&&(i.controlHeight=a._controlHeight),-1==s&&(s=0),t.index>=0&&(s=t.index),a._imageBufferWrapper.insertBefore(s,g,o,u,i),a.__insertingIndex>-1&&(a.__insertingIndex=a.__insertingIndex+1),t.index++}),jr.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count());else if(d==Zt.enumBCAppend&&a.__IfAppendImage)jr.each(f,function(e,r){var t,i=parseInt(e),o=undefined;if(isNaN(i)||i<0)return!0;if(r<p.length&&p[r]?(o=(t=p[r]).uidFromServer,delete t.uidFromServer):t={},t.currentFileName=n,jr.log("metaDataObj.currentFileName="+n),l)a._aryBitmapCache.push(i);else for(var s=0;s<a._aryBitmapCache.length;s++)if(a._aryBitmapCache[s]==i)return a._aryBitmapCache.splice(s,1),!0;if(a._imageBufferWrapper.exists(i))return!0;t.controlWidth=400,t.controlHeight=400,a._controlWidth&&a._controlWidth>400&&(t.controlWidth=a._controlWidth),a._controlHeight&&a._controlHeight>400&&(t.controlHeight=a._controlHeight),m?a._imageBufferWrapper.append(g,i,o,t,n):a._imageBufferWrapper.append(g,i,o,t)}),jr.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count());else if(d==Zt.enumBCRemove&&l){var S=!1;if(1==f.length&&-1==f[0]&&(S=!0),S)a._imageBufferWrapper.clear();else{var I=[];jr.each(f,function(e,r){var t=parseInt(e);if(isNaN(t)||t<0)return!0;I.push(t)}),a._imageBufferWrapper.removeImagesByServerId(I,n)}jr.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count())}else if(d==Zt.enumBCEdit||d==Zt.enumBCUpdate)jr.each(f,function(e,r){var i,o=parseInt(e);if(isNaN(o)||o<0)return!0;if(r<p.length&&p[r]?delete(i=p[r]).uidFromServer:i={},i.currentFileName=n,o>=0){var s=a._imageBufferWrapper.convertServerIdToClientIndex(o);s>-1?a._innerRefreshUI(s,a._imageBufferWrapper.count(),!0,i,d):t.bNeedRefresh&&a._innerRefreshUIByImageId(o,!0,i,d)}});else if(d==Zt.enumBCIndexChange){var b;if(h>=0)(b=0<p.length&&p[0]?p[0]:{}).currentFileName=n,0==a.__IfAppendImage&&a._innerRefreshUI(h,a._imageBufferWrapper.count(),!0,b,d),a._imageBufferWrapper.refresh(h,a._imageBufferWrapper.count(),!1,b)}if(jr.isFunction(a.__OnBitmapChanged)){if(!s)if(l){if(d!=Zt.enumBCRemove)return!0}else if(d==Zt.enumBCRemove)return!0;var C=[];jr.each(f,function(e){var r,t=parseInt(e);if(isNaN(t)||t<0)return!0;(r=a._imageBufferWrapper.convertServerIdToClientIndex(t))>-1&&C.push(r)});var T=a._imageBufferWrapper.getCurrentImageIndex(),w=d;d==Zt.enumBCAppend&&(w=a.__IfAppendImage?Zt.enumBCAppend:Zt.enumBCInsert),a.__OnBitmapChanged(C,w,T,a._imageBufferWrapper.count())}}},{key:"_removeImageAsync",value:(n=p(d().m(function i(e,r){var t,n,o;return d().w(function(e){for(;;)switch(e.n){case 0:if(t=this,n=parseInt(r),Rp(t,n)){e.n=1;break}return e.a(2,!1);case 1:return o=t._imageBufferWrapper.convertClientIndexToServerId(n),e.n=2,t._removeImageByIdAsync(o);case 2:return e.a(2,e.v)}},i,this)})),function(e,r){return n.apply(this,arguments)})},{key:"_removeImageByIdAsync",value:(t=p(d().m(function o(e){var r,t;return d().w(function(n){for(;;)switch(n.n){case 0:if(r=this,-1!=e){n.n=1;break}return gg(r),n.a(2,!1);case 1:return n.n=2,r._innerFunV2("RemoveImage",hm(e));case 2:return((t=n.v)||-1033==r._errorCode)&&r._OnBitmapChanged(["c1",""+e,3,r._imageBufferWrapper.getCurrentImageIndex(),r._imageBufferWrapper.count()]),n.a(2,t)}},o,this)})),function(e){return t.apply(this,arguments)})}]);var t,n}(dp);function DH(e,r){var t,n=e.substring(e.lastIndexOf(".")).toLowerCase();if(r==ut.IT_BMP){if(".bmp"==n||".dib"==n)return e;t=[e,".bmp"].join("")}else if(r==ut.IT_JPG){if(".jpg"==n||".jpe"==n||".jpeg"==n||".jfif"==n)return e;t=[e,".jpg"].join("")}else if(r==ut.IT_PNG){if(".png"==n)return e;t=[e,".png"].join("")}else if(r==ut.IT_TIF){if(".tif"==n||".tiff"==n)return e;t=[e,".tif"].join("")}else if(r==ut.IT_PDF){if(".pdf"==n)return e;t=[e,".pdf"].join("")}else if(r==ut.IT_J2K){if(".jp2"==n)return e;t=[e,".jp2"].join("")}return t}var xH=window.SparkMD5,OH=function(){return S(function e(r,t,n,i){_(this,e);var o=this;o._md5=n,o._length=t,o._content=i},[{key:"getLength",value:function(){return this._length}},{key:"getMD5",value:function(){return this._md5}},{key:"getData",value:function(e,r){var t=this,n=r;return jr.isNumber(e)&&jr.isNumber(r)?e<0||r<=0?"":0==e&&n==t._length?t._content:(e+n>t._length&&(n=t._length-e),t._content.substr(e,n)):""}}])}();On.html5.Base64Result=OH;var NH=function(e){function r(e){var t;return _(this,r),(t=s(this,r,[e])).__maxUploadImageSize=-1,t._strHttpContentTypeFieldValue="application/octet-stream",t}return l(r,e),S(r,[{key:"_saveBlob",value:(E=p(d().m(function k(e,r){var t,n;return d().w(function(i){for(;;)switch(i.n){case 0:if(t=this,!Dn.navInfo.bIE){i.n=2;break}return i.n=1,t._innerSaveLocal(e,r);case 1:i.n=4;break;case 2:return n=URL.createObjectURL(e),i.n=3,t._innerSaveLocal(n,r);case 3:URL.revokeObjectURL(n);case 4:e=null;case 5:return i.a(2)}},k,this)})),function(e,r){return E.apply(this,arguments)})},{key:"_saveImages",value:(A=p(d().m(function P(e,r,t,n){var i,o,a,s,u,c;return d().w(function(l){for(;;)switch(l.n){case 0:return i=this,o=DH(r,n),a=Lp(i,t),On.cancelFrom=St.Other,l.n=1,i._innerConvertToArrayBufferWithUIAsync(e,n,a);case 1:return s=l.v,u=Is(n),c=new Blob([s],{type:u}),l.n=2,i._saveBlob(c,o);case 2:c=null;case 3:return l.a(2)}},P,this)})),function(e,r,t,n){return A.apply(this,arguments)})},{key:"_innerSaveLocal",value:(w=p(d().m(function F(e,r){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,n){var i=window,o=Dn.navInfo,a=i.requestFileSystem||i.webkitRequestFileSystem||i.mozRequestFileSystem;if(!o.biPad&&!o.biPhone||a||!(se.bSafari&&parseFloat(se.strBrowserVersion)<13)&&se.bSafari){var s=document.createElementNS("http://www.w3.org/1999/xhtml","a");if(s.href=e,s.download=r,s.target="_blank",document.body.appendChild(s),o.bEdge)s.click(),e=null,s.href=null;else if(o.bIE){var u;(u=window.navigator)&&"msSaveOrOpenBlob"in u&&u.msSaveOrOpenBlob(e,r)}else{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!1),s.dispatchEvent(c)}setTimeout(function(){document.body.removeChild(s),s=null,t()},6e3)}else{var l=i.open(e,"","",!1);setTimeout(function(){l.document.title=r,t()},6e3)}}))},F)})),function(e,r){return w.apply(this,arguments)})},{key:"_OnPostTransferAsync",value:function(e,r,t){var n,i=this;if(e&&e.length>=2)try{var o=String(e[1]).replace(/\\/g,"\\\\");n=jr.parse(o),!t&&n.imageId&&(n.imageId=i._serverId2uidFromServer(n.imageId))}catch(s){jr.log(e)}n||(n={imageId:""});var a=!1;if(jr.isFunction(i.__OnPostTransferAsync))try{a=i.__OnPostTransferAsync(n)}catch(u){jr.error(u)}if(jr.isFunction(i.__OnPostTransferAsync2))try{i.__OnPostTransferAsync2(n)}catch(u){jr.error(u)}return a}},{key:"_checkIndices",value:function(e,r){return WH(e,!jr.isUndefined(r)&&r>=0?r:this._imageBufferWrapper.count(),this)}},{key:"_acquireImageForSendTo",value:(T=p(d().m(function D(e,r,t,n){var i,o,a,s,u,c,l,f;return d().w(function(h){for(;;)switch(h.p=h.n){case 0:if(i=this,o=t?jr.clone(t):{},s=a=n,i._resetErr(),i._isValid()){h.n=1;break}throw{code:i._errorCode,message:i._errorString};case 1:if(jr.isString(null==a?void 0:a._id)){h.n=2;break}throw Wg();case 2:if(!i.__bAcquireImageNow){h.n=3;break}throw Hh(i),{code:i._errorCode,message:i._getErrorString()};case 3:if(i.__bAcquireImageNow=!0,zl(e,s),u=Promise.resolve(),c=xn.RemoteScanConfig,l=Zv(),h.p=4,Ip(o),c&&$v(c.keepAwake),jv.checkProductKey(i,{Core:!0})&&i._isValid()){h.n=5;break}throw{code:i._errorCode,message:i._errorString};case 5:return dp._innerSendHeartBeat(a,!1),f=function(){var e=p(d().m(function r(e){return d().w(function(r){for(;;)switch(r.n){case 0:u=u.then(function(){return new Promise(function(r,t){var n=[i._uidFromServer2ServerId(e.imageId)],o=xn.EnumDWT_ImageType.IT_PNG;On.cancelFrom=St.Scan,i._innerConvertToArrayBufferAsync(o,n).then(function(n){a._bltsCopyImage=!0,a.__LoadImageFromBytesV2(n,o,"",!0,0,0,!1,0,function(){var t=p(d().m(function n(t,o){var s;return d().w(function(t){for(;;)switch(t.n){case 0:return s=i._uidFromServer2ServerId(e.imageId),o?(jr.log("LoadImageFromBinary success"),a._bltsCopyImage=!1,e.imageId=a._uidFromServer2ServerId(o.ids),jr.isFunction(a._OnPostTransferAsync)&&a._OnPostTransferAsync([!0,jr.stringify(e)],null,!0)):jr.log("LoadImageFromBinary return null."),r(),t.n=1,i._removeImageByIdAsync(s);case 1:return t.a(2)}},n)}));return function(e,r){return t.apply(this,arguments)}}(),function(e,r){jr.log(r),a._bltsCopyImage=!1,t({code:e,message:r})})},function(e){e&&e.message&&jr.log(e.message),t(e)})})});case 1:return r.a(2)}},r)}));return function(r){return e.apply(this,arguments)}}(),i._registerEvent("OnPostTransferAsync2",f),null!=r&&(o.Device=r.strDevice,o.DeviceMatchField=$t.SMF_NAME),h.n=6,i._acquireImageFromServiceAsync(o);case 6:h.n=8;break;case 7:throw h.p=7,h.v;case 8:return h.p=8,h.p=9,h.n=10,u;case 10:h.n=12;break;case 11:h.p=11,h.v;case 12:return i._unregisterEvent("OnPostTransferAsync2"),i.__bAcquireImageNow=!1,Kl(e),$v(l),h.f(8);case 13:return h.a(2)}},D,this,[[9,11],[4,7,8,13]])})),function(e,r,t,n){return T.apply(this,arguments)})},{key:"_uidFromServer2index",value:function(e){var r,t=this;return t._resetErr(),!!t._isValid()&&(jr.isString(e)?(-1==(r=t._imageBufferWrapper._uidFromServer2index(e))&&-2540!=t._errorCode&&lv(t),r):(Tg(t),-1))}},{key:"_index2uidFromServer",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=parseInt(e);return isNaN(t)?(Bh(r),""):t<0||t>=this._imageBufferWrapper.count()?(gg(r),""):r._imageBufferWrapper._index2uidFromServer(e)}},{key:"__LoadImageFromBytesV2",value:function(e,r,t,n,i,o,a,s,u,c){var l,f=this,d=r||3,h=0,g=e.name,v=!0,m=1;if(e)if(e instanceof Blob)h=e.size;else if(gm(e))h=e.byteLength;else if(e instanceof Array)h=e.length;else{var p=e;h=p.size||p.byteLength||p.length}!isNaN(i)&&i>=0&&!isNaN(o)&&o>0?m=0:(i=0,o=0),l=["[",h,",",0,",",d,',"',t,'",',i,",",o,",",s,",",m,",",a?"true":"false","]"].join("");var _=function(){if(f.__bLoadingImage=!1,v){var e=f._imageBufferWrapper.getCurrentImageIndex();e>=0&&f._innerRefreshUI(e)}return jr.isFunction(c)&&c(f._errorCode,f._getErrorString(),g),!1};return jv.checkProductKey(f,{Core:!0})||se.bWin&&jv.checkProductKey(f,{Webcam:!0},!0)?jv.checkPDFProductKeyWhenNeeds(f,r)?0===h?(hh(f,-2312,"The file length is empty."),v=!1,_()):(f.__bLoadingImage=!0,f.Viewer,this._innerSendBlob("LoadImageFromBytes",l,e,n,m,function(e){if(f.__bLoadingImage=!1,f._isBindViewer()){var r=f._imageBufferWrapper.getCurrentImageIndex();n&&r>=0&&f._innerRefreshUI(r)}if(jr.isFunction(u)){var t=e;if(jr.isArray(t)&&(t=t.length>0?t[0]:{}),n)setTimeout(function(){u(g,t)},30);else try{u(g,t)}catch(i){jr.error(i.message)}}return f._canConsume()&&xn.lcvrf(f),!0},_)):(v=!1,_()):(jv.checkProductKey(f,{Core:!0},!1),v=!1,_())}},{key:"_innerSendBlob",value:function(e,r,t,n,i,o,a){var s=this;if(dp.isServerInvalid(s))return s._waitForConnect().then(function(){s._innerSendBlob(e,r,t,n,i,o,a)});if(n)return s._innerSendBlobByWS(e,r,t,o,a),!0;var u,c,l,f;return s._resetErr(),!!s._isValid()&&(c=[s._httpUrl,"f/",e].join(""),l=mp(s._clientId,e,r,0,s._bScanForProxyRemote?s._dmServiceDWTVersion:""),l+="\r\n\r\n",f={method:"POST",url:c,processData:!1,data:l+=jr.base64.encodeArray(t),async:!1,onSuccess:function(e,r,n){var o=!1,a=!1;try{o=jr.isString(e)&&Wo(n.getResponseHeader("content-type"))?jr.parse(e):e}catch(hH){}if(o!==undefined&&null!==o&&(Cm(o)?(s._errorCode=o.exception,s._errorString=o.description,s._errorCause=Tm(o)):s._resetErr(),(u=o.result)&&jr.isArray(u)&&u.length>=1))if(i){var c,l=u[0];l&&jr.isObject(l)&&(c=l.imageInfos,0==s._errorCode&&jr.isString(c)&&s._handleOnBitmapChangedEvent({result:["c1",c]},{document:t.currentFileName,tag:t.currentTagName}),a=!0)}else{var f=u.join(",");0==s._errorCode&&f.length>0&&s._OnBitmapChanged(["c1",f,1,s._imageBufferWrapper.getCurrentImageIndex(),s._imageBufferWrapper.count()],null,{document:t.currentFileName,tag:t.currentTagName}),a=!0}a||(Jh(s),u="")},onError:function(){Kh(s),u=""}},jr.mix(f,{headers:{"X-Requested-With":!1}}),se.bFileSystem&&(f.crossDomain=!1),wp(f),0==s._errorCode?jr.isFunction(o)&&o():jr.isFunction(a)&&a(),u)}},{key:"_convertToBase64ByServerIdsWithUI",value:function(e,r,t,n,i,o,a){this._convertToBase64ByServerIdsWithUIAsync(e,t,r,n).then(function(e){jr.isFunction(o)&&us.runWithCatch(o,e)},function(){jr.isFunction(a)&&a()})}},{key:"_OnPercentDone",value:function(e){var r,t,n,i,o,a=this,s=!1,u=!1,c=0;jr.isArray(e)&&e.length>2&&(t=e[0],c=e[1],n=e[2],e.length>3&&(i=e[3]),e.length>4&&(o=e[4]),e.length>5&&e[5],r=c,c<0?r=0:c>100&&(r=100),r=Math.floor(r),On.cancelFrom!=St.HTTPUpload&&On.cancelFrom!=St.HTTPDownload&&On.cancelFrom!=St.Scan&&On.cancelFrom!=St.HTTPPut||(u=o)),(a._bServerPercentDone||0==t)&&((c>0||0==c)&&(On.cancelFrom!=St.HTTPUpload&&On.cancelFrom!=St.HTTPDownload&&On.cancelFrom!=St.FTPUpload&&On.cancelFrom!=St.FTPDownload&&On.cancelFrom!=St.HTTPPut||(s=!0)),a.IfShowProgressBar&&On.progressBarOnPercentDone(c,n,i,r,u,this._containerElement),1==s&&(jr.isFunction(a.__OnInternetTransferPercentage)&&a.__OnInternetTransferPercentage(r,!1),jr.isFunction(a.__OnInternetTransferPercentageEx)&&a.__OnInternetTransferPercentageEx(r,!1)),jr.isFunction(a.__OnPercentDone)&&a.__OnPercentDone())}},{key:"IfShowProgressBar",get:function(){return this._bIfShowProgressBar},set:function(e){this._resetErr(),jr.isBoolean(e)?this._bIfShowProgressBar=e:Uh(this)}},{key:"IfShowCancelDialogWhenImageTransfer",get:function(){return this.__IfShowCancelDialogWhenImageTransfer},set:function(e){jr.isBoolean(e)?this.__IfShowCancelDialogWhenImageTransfer=e:(this._resetErr(),Uh(this))}},{key:"_getLogLevel",value:function(){return this._logLevel}},{key:"_setLogLevel",value:(C=p(d().m(function x(e){return d().w(function(r){for(;;)switch(r.n){case 0:return this._logLevel=e,r.n=1,this._innerFunV2("LogLevel",hm(e));case 1:return r.a(2)}},x,this)})),function(e){return C.apply(this,arguments)})},{key:"MaxUploadImageSize",get:function(){return this.__maxUploadImageSize},set:function(e){var r=this;r._resetErr();var t=1*e;!jr.isNumber(t)||isNaN(t)?Uh(r):r.__maxUploadImageSize=t}},{key:"HTTPRequestswithCredentials",get:function(){var e;return this._resetErr(),null!==(e=this._bWithCredentials)&&void 0!==e&&e},set:function(e){this._resetErr(),jr.isBoolean(e)?this._bWithCredentials=e:Uh(this)}},{key:"cancelableObj",get:function(){return this._cancelableObj},set:function(e){this._cancelableObj=e}},{key:"_getProfile",value:(b=p(d().m(function O(e){var r,t;return d().w(function(n){for(;;)switch(n.n){case 0:if((r=this)._resetErr(),r._isValid()){n.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:return e&&(t=jr.stringify([e.strDevice])),n.a(2,r._innerFunV2("GetCustomDSDataEx",t))}},O,this)})),function(e){return b.apply(this,arguments)})},{key:"_setProfile",value:(I=p(d().m(function N(e,r){var t,n;return d().w(function(i){for(;;)switch(i.n){case 0:if((t=this)._resetErr(),t._isValid()){i.n=1;break}throw{code:t._errorCode,message:t._errorString};case 1:return n=e?jr.stringify([r,e.strDevice]):hm(r),i.a(2,this._innerFunV2("SetCustomDSDataEx",n))}},N,this)})),function(e,r){return I.apply(this,arguments)})},{key:"_removeAllImagesAsync",value:(y=p(d().m(function R(e,r){var t,n,i,o,a,s;return d().w(function(e){for(;;)switch(e.n){case 0:if((t=this)._resetErr(),t._isValid()){e.n=1;break}throw{code:t._errorCode,message:t._errorString};case 1:for(i=[],a=t._getHowManyImagesInBuffer(),o=a-1;o>=0;o--)(s=t._imageBufferWrapper.convertClientIndexToServerId(o))>-1&&i.push(s);if(0!=i.length){e.n=3;break}return e.n=2,t._innerFunV2("RemoveAllImages");case 2:n=e.v,e.n=8;break;case 3:if(!r){e.n=5;break}return e.n=4,t._innerFunV2("RemoveAllImages",hm(i.join(",")));case 4:n=e.v,e.n=7;break;case 5:return e.n=6,t._innerFunV2("RemoveAllImages");case 6:n=e.v;case 7:(n||-1033==t._errorCode)&&t._OnBitmapChanged(["c1",i.join(","),3,t._imageBufferWrapper.getCurrentImageIndex(),t._imageBufferWrapper.count()]);case 8:return e.a(2,n)}},R,this)})),function(e,r){return y.apply(this,arguments)})},{key:"__OnRecieveMsg",value:function(e,n){var i=this,o=null==n?void 0:n.cmd;if(e.event)return t(r,"__OnRecieveMsg",this,3)([e,n]);if(Cm(e)?(i._errorCode=e.exception,i._errorString=e.description,i._errorCause=Tm(e)):"StartScan"!=o&&"GetAddOnVersion"!=o&&(i._errorCode=0,i._errorString=""),"ReadBarcode"==o||"OCRRecognize"==o||e.request&&"OCRProRecognize"==e.request.method)return n.sFun?(n.sFun(e),!0):(n.fFun&&n.fFun(e),!0);if("SetCapabilities"==o||"GetSkewAngleFromBinary"==o||"UpdateImage"==o)return"exception"in e&&"0"!=e.exception?(e.result.errorCode&&e.result.errorString?(i._errorCode=e.result.errorCode,i._errorString=e.result.errorString):(i._errorCode=e.exception,i._errorString=e.description),n.fFun&&n.fFun(e.result),e=null,!0):(n.sFun&&n.sFun(e.result),e=null,!0);if(e.result&&e.result.length&&("1"==e.result[0]||1==e.result[0]||"ok"==e.result[0]))return(n.sFun||n.sFun)&&n.sFun(e.result),!0;if(!e.exception)return n.sFun&&n.sFun(e.result),e=null,!0;var a=!1;return n.fFun&&(a=n.fFun(i._errorString)),!a&&e.exception&&e.exception<0&&-2115!=e.exception&&jr.isFunction(i.__OnPrintMsg)&&i.__OnPrintMsg(i._errorString),!0}},{key:"_convertServerIdToGuid",value:function(e){return this._serverId2uidFromServer(e)}},{key:"_convertGuidToServerId",value:function(e){return this._uidFromServer2ServerId(e)}},{key:"_serverId2uidFromServer",value:function(e){return this._imageBufferWrapper._serverId2uidFromServer(e)}},{key:"_uidFromServer2ServerId",value:function(e){return this._imageBufferWrapper._uidFromServer2ServerId(e)}},{key:"_innerConvertToBlobWithUI",value:function(e,r,t,n,i,o){var a=this,s=arguments,u=function(e){if(On.needShowTwiceShowDialog=!1,jr.isFunction(o)){var r=[];jr.isArray(t)&&jr.each(t,function(e){var t=a._imageBufferWrapper.convertServerIdToClientIndex(e);t>-1&&r.push(t)}),e&&(a._errorCode=e.code,a._errorString=e.message,e.errorCause&&(a._errorCause=e.errorCause)),o(r)}return!1};a._innerConvertToArrayBufferWithUIAsync(e,r,t,n).then(function(e){if(!e||e.byteLength<=0)return Cg(a),u();var n=a.__maxUploadImageSize;if(e.byteLength>n&&-1!=n)return eg(a),u();if(On.needShowTwiceShowDialog=!1,jr.isFunction(i)){var o=[];jr.isArray(t)&&jr.each(t,function(e){var r=a._imageBufferWrapper.convertServerIdToClientIndex(e);r>-1&&o.push(r)});var c=Is(r),l=new Blob([e],{type:c});try{i(l,o,s)}catch(f){}l=null}return!0},u)}},{key:"convertToBlob",value:(m=p(d().m(function W(e,r,t){var n,i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:return i=Lp(n=this,r),On.cancelFrom=St.ConvertToBlob,s.n=1,n._innerConvertToArrayBufferWithUIAsync("convertToBlob",e,i,t);case 1:return o=s.v,a=Is(e),s.a(2,new Blob([o],{type:a}))}},W,this)})),function(e,r,t){return m.apply(this,arguments)})},{key:"_innerConvertToArrayBufferWithUIAsync",value:(v=p(d().m(function M(e,r,t,n,i){var o,a,s,u;return d().w(function(c){for(;;)switch(c.p=c.n){case 0:return a=this,u=null===(o=On.progressContext)||void 0===o?void 0:o.IfShowCancelDialogWhenImageTransfer,c.p=1,a.IfShowProgressBar?On.showProgress(a,e,!1):On.hideProgress(),a._OnPercentDone([0,-1,mh]),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1),c.n=2,this._innerConvertToArrayBufferAsync(r,t,n,i);case 2:s=c.v;case 3:return c.p=3,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=u),a.IfShowProgressBar&&On.closeProgress(null,e),c.f(3);case 4:return c.a(2,s)}},M,this,[[1,,3,4]])})),function(e,r,t,n,i){return v.apply(this,arguments)})},{key:"_innerConvertToBase64Async",value:(g=p(d().m(function L(e,r,t){var n,i,o,a,s,u,c,l,f;return d().w(function(d){for(;;)switch(d.n){case 0:return n=this,i=t,jr.isString(i)&&""!=i||(i="{}"),o=["[",e,',"',r.join(","),'",',i,",1]"].join(""),d.n=1,n._sendDataByHttpAsync("ConvertToBase64",o,"text",!0);case 1:if(a=d.v,s=0,u="",c="",l=a&&a.result,0==n._errorCode){d.n=2;break}throw{code:n._errorCode,message:n._getErrorString()};case 2:if(!l||!jr.isArray(l)||3!=l.length){d.n=3;break}return c=l[0],s=l[1],u=l[2],f=new OH(null,s,u,c),d.a(2,f);case 3:throw yg(n),{code:n._errorCode,message:n._errorString};case 4:return d.a(2)}},L,this)})),function(e,r,t){return g.apply(this,arguments)})},{key:"_convertToBase64ByServerIdsWithUIAsync",value:(h=p(d().m(function B(e,r,t,n){var i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:return o=this,a=null===(i=On.progressContext)||void 0===i?void 0:i.IfShowCancelDialogWhenImageTransfer,s.p=1,o.IfShowProgressBar?On.showProgress(o,e,!1):On.hideProgress(),o._OnPercentDone([0,-1,mh]),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=o.IfShowCancelDialogWhenImageTransfer),s.n=2,this._innerConvertToBase64Async(r,t,n);case 2:return s.a(2,s.v);case 3:return s.p=3,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=a),o.IfShowProgressBar&&On.closeProgress(null,e),s.f(3);case 4:return s.a(2)}},B,this,[[1,,3,4]])})),function(e,r,t,n){return h.apply(this,arguments)})},{key:"_convertToBlobForUpload",value:function(e,r,t,n,i,o,a){var s=this,u=arguments;if(xn.ConnectWithSocket){var c=t,l=",";jr.isString(c)&&""!=c||(c="",l="");var f=["[",e,',"',r.join(","),'"',l,c,"]"].join("");return On.cancelFrom=St.ConvertToBlob,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1),s._sendData("ConvertToBlob",f,!0,function(e){s._resetErr();var r=e;if(r){if(r instanceof Blob||gm(r))return void i(r,"",u);Cm(r)&&(s._errorCode=r.exception,s._errorString=r.description,s._errorCause=Tm(r))}},function(e){s._errorCode=e.code,s._errorString=e.message,o(e)}),!0}s._innerConvertToArrayBufferAsync(e,r,t,"arraybuffer").then(function(e){var r=s._strHttpContentTypeFieldValue,t=new Blob([e],{type:r});if(xn.IfAddMD5InUploadHeader){var n=new xH.ArrayBuffer;n.append(e),jr.isFunction(i)&&i(t,n.end(),u)}else jr.isFunction(i)&&i(t,"",u);t=null},function(e){o(e.code,e.message)})}},{key:"dispose",value:(f=p(d().m(function U(){return d().w(function(e){for(;;)if(0===e.n)return e.a(2,this.__unload())},U,this)})),function(){return f.apply(this,arguments)})},{key:"_innerDisposeWSClient",value:function(){return this._isValid()?this._sendData("dispose",null,!0,function(){},function(){}):Promise.reject()}},{key:"__unload",value:(c=p(d().m(function V(){var e,r,t,n,i,o;return d().w(function(a){for(;;)switch(a.p=a.n){case 0:if(!(e=this)._bReady||On.page.bUnload){a.n=4;break}if(!e._wsClient){a.n=4;break}return a.p=1,a.n=2,e._innerDisposeWSClient();case 2:a.n=4;break;case 3:a.p=3,a.v;case 4:if(!(t=e._wsClient)){a.n=9;break}t.removeEvent("close",e._clientId),t.removeEvent("error",e._clientId),t.removeEvent("timeout",e._clientId);try{for(;e._evt_ids.length>0;)(n=e._evt_ids.pop())in t._tasks&&(i=t._tasks[n])&&(i.resolver&&(i.resolver.promise=null,i.resolver.resolve=null,i.resolver.reject=null,delete i.resolver),i.ctx&&(i.ctx.client=undefined,i.ctx.userData&&(i.ctx.userData.stwain=null,i.ctx.userData.command=null,delete i.ctx.userData),i.ctx=undefined),delete t._tasks[n])}catch(s){}return a.p=5,a.n=6,t.dispose();case 6:a.n=8;break;case 7:a.p=7,o=a.v,r=o;case 8:delete this._wsClient,this._wsClient=null;case 9:if(this._imageBufferWrapper.dispose(),this._bReady=!1,this._destroy=!0,this._cancelableObj=undefined,this._containerElement=null,this.__OnInternetTransferPercentage=undefined,this.__OnInternetTransferPercentageEx=undefined,this.__OnPercentDone=undefined,this.__licenseInfo=null,this._wsCheckResolve=null,this._wsCheckReject=null,this._heartBeatTimer=null,this._serverInfo=undefined,this._dmService=undefined,this.__OnPostTransferAsync=null,this.__OnPostTransferAsync2=null,this.__OnBitmapChanged=undefined,this.__OnCurrentDeviceSelected=undefined,this.__OnPrintMsg=undefined,this.__OnWSReconnect=undefined,this.__OnWSClose=undefined,this.__OnWSMessage=undefined,this.__OnWSError=undefined,this._imageBufferWrapper=undefined,this._aryBitmapCache=undefined,this._acquireDivEL=null,this.__OnRefreshUI=undefined,this.__OnLtsverify=undefined,this.__OnRemoteScanStatusAsync=undefined,this.__OnBufferChanged=undefined,!r){a.n=10;break}throw r;case 10:return a.a(2)}},V,this,[[5,7],[1,3]])})),function(){return c.apply(this,arguments)})},{key:"_getImages",value:(u=p(d().m(function j(e,r,t,n){var i,o,a,s;return d().w(function(u){for(;;)switch(u.n){case 0:if((i=this)._checkIndices(r)){u.n=1;break}throw{code:this._errorCode,message:this._errorString};case 1:if(n!=st.URL){u.n=3;break}if(!(r.length>1)){u.n=2;break}throw Jg(this),{code:this._errorCode,message:this._errorString};case 2:u.n=4;break;case 3:if(t!=xn.EnumDWT_ImageType.IT_BMP&&t!=xn.EnumDWT_ImageType.IT_JPG&&t!=xn.EnumDWT_ImageType.IT_PNG){u.n=4;break}if(!(r.length>1)){u.n=4;break}throw Kg(this),{code:this._errorCode,message:this._errorString};case 4:if(n!=st.URL){u.n=5;break}return u.a(2,this._imageBufferWrapper.getImageUrl(r[0]));case 5:if(On.cancelFrom=St.Other,o=Lp(i,r),n!=st.Blob){u.n=7;break}return u.n=6,this._innerConvertToArrayBufferWithUIAsync(e,t,o);case 6:return a=u.v,s=Is(t),u.a(2,new Blob([a],{type:s}));case 7:if(n!=st.Base64){u.n=9;break}return u.n=8,this._convertToBase64ByServerIdsWithUIAsync(e,t,o);case 8:return u.a(2,u.v);case 9:throw Gg(this),{code:this._errorCode,message:this._errorString};case 10:return u.a(2)}},j,this)})),function(e,r,t,n){return u.apply(this,arguments)})},{key:"_LicensePromptExpired",value:function(){var e=this,r=e.__licenseInfo.bTrial,t="";e.__licenseInfo&&e.__licenseInfo.ExpireDate&&(t=e.__licenseInfo.ExpireDate);var n=Gv(t);n<=0&&(r||jr.error(e._getErrorString()),jr.isFunction(Dn.OnLicenseExpiredWarning)&&Dn.OnLicenseExpiredWarning(og(t),n,r))}},{key:"__saveToViewerAfterUpdate",value:function(e,r){var t=this,n=this._imageBufferWrapper.getIndexByUid(e),i=this._imageBufferWrapper.convertClientIndexToServerId(n),o=um.getUrlByAct(this._imageBufferWrapper.BaseUrl,i,2);return new Promise(function(e,a){wp({method:"GET",xhrFields:{withCredentials:!0},url:o,onSuccess:function(o){var a,s=t._imageBufferWrapper.getMetadataByIndex(n);s||(s={}),s.width=r.width,s.height=r.height,a=Dn.navInfoSync.bMobile?t._imageBufferWrapper.getMinImageUrl(n,Math.round(s.controlWidth*devicePixelRatio),Math.round(s.controlHeight*devicePixelRatio)):t._imageBufferWrapper.getMinImageUrl(n,s.controlWidth,s.controlHeight);var u=t._imageBufferWrapper.getImageIdMap(i);if(u){u.ticks=Date.now(),u.imageUrl=t._imageBufferWrapper.getImageUrl(n),u.minImageUrl=a,u.width=r.width,u.height=r.height;var c=jr.clone(u);c.imageId=i,t._imageBufferWrapper.UpdateImage(c,s)}e()},onError:function(){e(),Kl("save")}})})}},{key:"RunCommandAsync",value:(a=p(d().m(function H(e){var r,t,n,i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:if(r=this,e&&jr.isString(e.command)&&e.parameter){s.n=1;break}throw Ag(r),{code:r._errorCode,message:r._errorString};case 1:if("Invert"!=e.command){s.n=2;break}return s.a(2,r._invert(e.parameter.index));case 2:if(t=e.parameter.index,!jr.isNumber(t)){s.n=4;break}if(!(isNaN(t)||!jr.isNumber(t)||t<0||t>=r._imageBufferWrapper.count())){s.n=3;break}throw gg(r),{code:r._errorCode,message:r._errorString};case 3:n=r._imageBufferWrapper.convertClientIndexToServerId(t),e.parameter.index=n;case 4:return i=["[",jr.stringify(e),"]"].join(""),s.n=5,r._innerFunRawV3("runCommand",i);case 5:if(o=s.v,!se.bIE){s.n=7;break}if(!jr.isString(o)){s.n=6;break}return s.a(2,jr.parse(o));case 6:return s.a(2,o);case 7:if(a=o.headers.get("content-type"),!Wo(a)){s.n=9;break}return s.n=8,o.json();case 8:return s.a(2,s.v);case 9:if("text/plain"!=a&&"text/html"!=a){s.n=11;break}return s.n=10,o.text();case 10:return s.a(2,s.v);case 11:return s.n=12,o.blob();case 12:return s.a(2,s.v)}},H,this)})),function(e){return a.apply(this,arguments)})},{key:"_innerFunRawV3",value:(o=p(d().m(function G(e,r){var t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:if(i="fa/",(t=this)._resetErr(),t._isValid()){o.n=1;break}throw{code:t._errorCode,message:t._errorString};case 1:if(!dp.isServerInvalid(t)){o.n=2;break}return o.a(2,t._waitForConnect().then(function(){return t._innerFunRawV3(e,r)}));case 2:return n={method:"post",body:mp(t._clientId,e,r,0,t._bScanForProxyRemote?t._dmServiceDWTVersion:""),fetchRaw:!0},o.n=3,Ap([t._httpUrl,i,e].join(""),n);case 3:return o.a(2,o.v)}},G,this)})),function(e,r){return o.apply(this,arguments)})},{key:"_invert",value:(i=p(d().m(function z(e){var r,t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if(r=this,t=parseInt(e),r._resetErr(),r._isValid()){a.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:if(!isNaN(t)){a.n=2;break}throw Bh(r),{code:r._errorCode,message:r._errorString};case 2:if(!(t<0||t>=r._imageBufferWrapper.count())){a.n=3;break}throw gg(r),{code:r._errorCode,message:r._errorString};case 3:if(-1!=(n=r._imageBufferWrapper.convertClientIndexToServerId(t))){a.n=4;break}throw gg(r),{code:r._errorCode,message:r._errorString};case 4:return a.n=5,r._innerFunV2("Invert",hm(n),!0);case 5:if(i=a.v,!(o=1==i)){a.n=6;break}kp.refreshImageAfterInvokeFun(r,t),a.n=7;break;case 6:throw{code:r._errorCode,message:r._errorString};case 7:return a.a(2,o)}},z,this)})),function(e){return i.apply(this,arguments)})}],[{key:"create",value:(n=p(d().m(function K(e){var t;return d().w(function(n){for(;;)switch(n.n){case 0:return t=new r(e),n.n=1,dp.STwainConnectToServer(t);case 1:return n.a(2,t)}},K)})),function(e){return n.apply(this,arguments)})}]);var n,i,o,a,u,c,f,h,g,v,m,y,I,b,C,T,w,A,E}(FH);function RH(e){var r=e,t="",n=!1;if(r&&r.__licenseInfo&&(r.__licenseInfo.ExpireDate&&(t=r.__licenseInfo.ExpireDate),n=r.__licenseInfo.bTrial),n&&!xn.HideTrialMessage){var i=Gv(t);i<=5&&(jr.isFunction(Dn.OnLicenseExpiredWarning)&&Dn.OnLicenseExpiredWarning(og(t),i,!0),xn.HideTrialMessage=!0)}}function WH(e,r,t){var n;if(!jr.isArray(e))return hg(t),!1;if(0==e.length)return cg(t),!1;if(xn.ConnectWithSocket)return!0;for(n=0;n<e.length;n++){var i=e[n];if(jr.isUndefined(i)||null===i)return vg(t),!1;if(i=parseInt(i),isNaN(i))return Bh(t),!1;if(i<0||i>=r)return fg(t),!1}return!0}var MH=S(function bK(e,r,t,n){_(this,bK),this.stwain=e,this.bufferWrapper=r,this.serverId=t,this.metaDataObj=n}),LH=function(e){function r(e,t){var n;return _(this,r),(n=s(this,r,[t]))._stwain=e,n.bImageJustChangedInEditor=!1,n.bImageChangedInViewer=!1,n}return l(r,e),S(r,[{key:"getUidByIndex",value:function(e){return this._buffer.getUidByIndex(e)}},{key:"dispose",value:function(){return this._stwain=null,!0}},{key:"append",value:function(e,r,t,n,i){var o,a,s,u,c,l=this;(this._buffer.isActiveFile||!jr.isUndefined(i))&&n.currentFileName&&n.currentFileName.length>0?c=a=l.getCountByDocumentName(n.currentFileName):(a=l.count(),c=l.getCountByDocumentName(l.GetCurrentFileName())),s=l.getCurrentImageIndex();for(var f=a-1;f>=e;f--)u=l.convertClientIndexToServerId(f),l.removeByServerId(u,f);return a<e?(o=c,l._updateUIAfterAdd(o,r,t,n,!0)):(o=s>=a-1?0:s+1,u=l.convertClientIndexToServerId(o),l.removeByServerId(u,o),o==e-1?l._updateUIAfterAdd(o,r,t,n,!0):l._updateUIAfterAdd(o,r,t,n,!1))}},{key:"insertBefore",value:function(e,r,t,n,i){var o,a=1*e;return(a<0||a>r)&&(a=-1),a>=(o=this.count())&&(a=o),this._updateUIAfterAdd(a,t,n,i,!1)}},{key:"exists",value:function(e){return!jr.isUndefined(this.getImageIdMap(e))}},{key:"insert",value:function(e,r,t,n,i){var o,a=1*e;return(a<0||a>r)&&(a=-1),a>=(o=this.count())&&(a=o),this._updateUIAfterAdd(a,t,n,i,!1)}},{key:"moveImage",value:function(e,r,t){return this._buffer.moveImage(e,r)}},{key:"switchImage",value:function(e,r){return this._buffer.switchImage(e,r)}},{key:"setSelectedClientIndexArray",value:function(e){return this._buffer.selectImages(e)}},{key:"getSelectedClientIndexArray",value:function(e){return this._buffer.getSelectedImagesIndices()}},{key:"showImagesByFilter",value:function(e,r,t){return this._buffer.filterImagesByTag(e,r,t)}},{key:"clearFilter",value:function(){return this._buffer.clearFilter()}},{key:"removeImageTag",value:function(e){return this._buffer.removeImageTag(e)}},{key:"addImageTag",value:function(e,r){return this._buffer.tagImages(e,r)}},{key:"getCurrentTag",value:function(){var e;return 0==(e=this._buffer.getCurrentTag())?"":e}},{key:"renameTag",value:function(e,r){return this._buffer.renameTag(e,r)}},{key:"removeTag",value:function(e,r){return this._buffer.removeTag(e,r)}},{key:"getTagList",value:function(){return this._buffer.getTagList()}},{key:"getTagListByIndex",value:function(e){return this._buffer.getTagListByIndex(e)}},{key:"OpenFile",value:function(e){return this._buffer.openDocument(e)}},{key:"CreateFile",value:function(e){return this._buffer.createDocument(e)}},{key:"GetCurrentFileName",value:function(){return this._buffer.getCurrentFileName()}},{key:"RemoveFile",value:function(e){return this._buffer.removeDocument(e)}},{key:"RenameFile",value:function(e,r){return this._buffer.renameDocument(e,r)}},{key:"GetFileInfoList",value:function(){return this._buffer.getDocumentInfoList()}},{key:"MoveImageToFile",value:function(e,r,t,n){return this._buffer.moveImageToFile(e,r,t,n)}},{key:"GetServerIdsByFileName",value:function(e){var r,t=this,n=[];return(r=t.GetFileInfoList())?jr.each(r,function(r){if(e==r.name){if(r.imageIds)for(var i=0;i<r.imageIds.length;i++){var o=r.imageIds[i];if(o&&-1!=o){var a=t._stwain._uidFromServer2ServerId(o);a>0&&n.push(a)}}return!1}}):n=[],n}},{key:"insertImage",value:function(e,r,t){this._buffer.insertImage(r,e,t)}},{key:"GetMetaDataByIndex",value:function(e){return this._buffer.getMetadataByUid(this._buffer.getUidByIndex(e))}},{key:"RefreshAllImages",value:function(e,r){for(var t,n,i,o=this,a=0;a<o.count();a++){t=o.convertClientIndexToServerId(a);var s=o.getImageIdMap(t);if(s){i=o.GetMetaDataByIndex(a),n=Dn.navInfoSync.bMobile?um.getImageUrl(o._baseUrl,t,Math.round(e*devicePixelRatio),Math.round(r*devicePixelRatio),Date.now()):um.getImageUrl(o._baseUrl,t,e,r,Date.now());var u=jr.clone(s);u.imageId=t,u.minImageUrl=n,o._buffer.updateImage(u,i)}}}},{key:"UpdateData",value:function(e,r){var t=e,n=this.getImageIdMap(t);if(n){var i=jr.clone(n);i.imageId=e,this._buffer.updateImage(i,r)}return!0}},{key:"UpdateImage",value:function(e,r){return this._buffer.updateImage(e,r),!0}},{key:"_setDataImageControl",value:function(e,r,t){var n,i,o,a;if(t)o=e;else if(o=(i=this.getCustomDataByIndex(e)).serverId,a=i.uidFromServer,o<=0)return!1;return(n=this.getImageIdMap(o))||((n=new r_).serverId=o,n.uidFromServer=a,r&&(r.height&&(n.height=r.height),r.width&&(n.width=r.width)),this._serverIdMap[o]=n,this._uidMap[a]=n),r&&(r.height&&(n.height=r.height),r.width&&(n.width=r.width)),null!=n&&(n.bIsDirty=!0),this.__GetImageAndAttach(n,o,!0,!1,!1,e,r),!0}},{key:"__AttachImages",value:function(){var e,r,t;r=this.count();for(var n=0;n<r;n++)(e=this.convertClientIndexToServerId(n))>=0&&(t=this.getImageIdMap(e))&&this.__GetImageAndAttach(t,e,!0,!1,!1,0)}},{key:"AddImage",value:function(e,r,t,n,i){var o,a=1*e;return!(r<=0)&&((o=new r_).bIsDirty=!0,o.serverId=r,o.uidFromServer=t,this._serverIdMap[r]=o,this._uidMap[t]=o,r>=0&&this.__GetImageAndAttach(o,r,!1,!0,i,a,n),!0)}},{key:"OnGetImageByURL",value:function(e,r,t,n,i,o,a,s){return r.imageUrl&&""!=r.imageUrl?(r.iImageControlWidth=t,r.iImageControlHeight=n,r.bAddImage=i,r.bAppendImage=o,r.index=a,this._attachImagesForControl(r,s),!0):this.OnGetImageFromServer(e,r,t,n,i,o,a,s)}},{key:"OnGetImageFromServer",value:function(e,r,t,n,i,o,a,s){var u,c,l=this._baseUrl;if(l){if(e<=0)return!1;r.bIsDirty&&(r.ticks=Date.now()),jr.isUndefined(t)&&(t=-1),jr.isUndefined(n)&&(n=-1),r.iImageControlWidth=t,r.iImageControlHeight=n,r.bAddImage=i,r.bAppendImage=o,r.index=a,xn.ConnectWithSocket&&this._stwain._isBindViewer()?(this._attachImagesForControl(r,s),UH.push(new MH(this._stwain,this,e,s)),VH()):(u=um.getImageUrl(l,e,-1,-1,r.ticks),c=Dn.navInfoSync.bMobile?um.getImageUrl(l,e,Math.round(t*devicePixelRatio),Math.round(n*devicePixelRatio),r.ticks):um.getImageUrl(l,e,t,n,r.ticks),r.imageUrl=u,r.minImageUrl=c,this._attachImagesForControl(r,s))}return!0}},{key:"getBaseUrl",get:function(){return this._baseUrl}},{key:"_attachImagesForControl",value:function(e,r){var t,n;if((n=jr.clone(e)).imageId=n.serverId,n.bAddImage){if(t=r.currentFileName.length>0?this._buffer.addImage(n,r,r.currentFileName):this._buffer.addImage(n,r)){var o=i(t,1)[0],a=this.getImageIdMap(n.serverId);a&&(a.uuid=o);var s=this._buffer.getCustomDataByUid(o);s&&(s.serverId&&n&&n.serverId&&(s.serverId=n.serverId),s.uidFromServer&&(s.uidFromServer=n.uidFromServer))}}else this._buffer.updateImage(n,r);return!0}},{key:"_updateUIAfterAdd",value:function(e,r,t,n,i){return!(r<0)&&this.AddImage(e,r,t,n,i)}},{key:"__GetImageAndAttach",value:function(e,r,t,n,i,o,a){var s,u,c,l,f,d,h;this._stwain._isBindViewer()?(c=(null===(l=this._stwain.Viewer)||void 0===l?void 0:l.height)>=400?null===(f=this._stwain.Viewer)||void 0===f?void 0:f.height:400,u=(null===(d=this._stwain.Viewer)||void 0===d?void 0:d.width)>=400?null===(h=this._stwain.Viewer)||void 0===h?void 0:h.width:400):(u=-1,c=-1);var g=!1;g=!!t||1==e.bIsDirty;var v=null===(s=this.getImageIdMap(r))||void 0===s?void 0:s.uuid;v&&-1!=v&&e.iImageControlWidth==u&&e.iImageControlHeight==c&&0==e.bIsDirty||this.__SetArrayControlLoadImage(r,e,u,c,g,n,i,o,a)}},{key:"__SetArrayControlLoadImage",value:function(e,r,t,n,i,o,a,s,u){i?this.OnGetImageFromServer(e,r,t,n,o,a,s,u):this.OnGetImageByURL(e,r,t,n,o,a,s,u)}},{key:"GetServerIdList",value:function(){var e,r,t,n=[];if(e=this._buffer.getDocumentContents(this._buffer.getCurrentDocument()))for(var i=0;i<e.length;i++)(r=e[i])&&-1!=r&&(t=this._buffer.getCustomDataByUid(r))&&n.push(t.serverId);return n}}])}(PH),BH=!1,UH=[];function VH(){if(UH.length>0&&!BH){BH=!0;var e=UH.shift();if(e){var r=e.stwain,t=e.bufferWrapper,n=e.serverId,i=e.metaDataObj;r._convertToBlobForUpload(ut.IT_PNG,[n],!1,4,function(e,r,n){var o=n[1][0],a=t.getImageIdMap(o);if(a){var s={imageId:o,serverId:o,uidFromServer:a.uidFromServer,uuid:a.uuid,imageUrl:URL.createObjectURL(e),minImageUrl:URL.createObjectURL(e)};e=null,t.UpdateImage(s,i)}BH=!1,setTimeout(VH,0)},function(e){BH=!1,setTimeout(VH,0)})}}}var jH={changeImageUISize:function(e){if(!xn.UseDefaultViewer||!e._containerElement)return!0;var r,t,n,i,o=e._width,a=e._height,s=!1;if(r=Cs.one(e._containerElement),jr.isString(o)&&(o.indexOf("%")>0||o.indexOf("rem")>0))n=o,s=!0;else{var u=o;jr.isString(o)&&o.indexOf("px")>0&&(u=parseInt(o)),jr.isNumber(u)?n=[(u=parseInt(o))+2,"px"].join(""):jr.isString(u)&&(n=u)}if(jr.isString(a)&&(a.indexOf("%")>0||a.indexOf("rem")>0))i=a,s=!0;else{var c=a;jr.isString(a)&&a.indexOf("px")>0&&(c=parseInt(a)),jr.isNumber(c)?i=[(c=parseInt(a))+2,"px"].join(""):jr.isString(c)&&(i=c)}return r&&(t=Cs.one(".dynamsoft-dwt-container-box",r))&&t.getEL()&&(jr.isString(n)&&t.style("width",n),jr.isString(i)&&t.style("height",i)),s?(e.__funResize||(e.__funResize=function(){return!(e._ImgManager&&e._UIView&&e._containerElement)||e._UIView.ChangeSize(e._width,e._height)}),jr.removeEventListener(window,"resize",e.__funResize),jr.addEventListener(window,"resize",e.__funResize)):e.__funResize&&(jr.removeEventListener(window,"resize",e.__funResize),e.__funResize=!1),!(e._ImgManager&&e._UIView&&e._containerElement)||e._UIView.ChangeSize(n,i)},__innerGetUIViewRealSize:function(e,r,t){var n,i=-1,o=-1;return n=Cs.one(e),jr.isString(r)&&r.indexOf("%")>0&&(i=Cs.css(n,"width")*parseInt(r)/100),i<0&&r&&(i=parseInt(r)),jr.isString(t)&&t.indexOf("%")>0&&(o=Cs.css(n,"height")*parseInt(t)/100),o<0&&t&&(o=parseInt(t)),{width:i,height:o}},bindUIViewEvents:function(e,r){var t=e;r.onBufferChanged=function(e){if(jr.isFunction(t.__OnBufferChanged))try{t.__OnBufferChanged(e)}catch(r){jr.error(r)}},xn.UseDefaultViewer&&(r.onSelected=function(e){if(!t._isNoViewer()){var r,n=e.length;n>0&&(t._ImgManager.SetSelectedImageCount(n),r=e[n-1],jr.isFunction(t.__OnRefreshUI)&&t.__OnRefreshUI(r))}},r.onRefreshUI=function(e){t._isNoViewer()||jH.__innerRefreshFromUIView(t,e)},r.onResetCurrentIndex=function(e){if(!t._isNoViewer()){var r=t._ImgManager.getCurrentImageIndex();if(e>=0&&e<t._ImgManager.count()&&r!=e&&jr.isFunction(t.__OnIndexChangeDuringDragDrop))try{t.__OnIndexChangeDuringDragDrop(r,e)}catch(n){jr.error(n)}}},r.onMouseMove=function(e){if(!t._isNoViewer()){var r=e.index;if(e){var n=e.x,i=e.y;t.__MouseX=n,t.__MouseY=i}if(jr.isFunction(t.__OnMouseMove))try{t.__OnMouseMove(r)}catch(o){jr.error(o)}}},r.onMouseClick=function(e){if(!t._isNoViewer()){var r=e.index;if(e){var n=e.x,i=e.y;t.__MouseX=n,t.__MouseY=i}if(jr.isFunction(t.__OnMouseClick))try{t.__OnMouseClick(r)}catch(o){jr.error(o)}}},r.onMouseDoubleClick=function(e){if(!t._isNoViewer()){var r=e.index;if(jr.isFunction(t.__OnMouseDoubleClick))try{t.__OnMouseDoubleClick(r)}catch(n){jr.error(n)}}},r.onMouseRightClick=function(e){if(!t._isNoViewer()){var r=e.index;if(e){var n=e.x,i=e.y;t.__MouseX=n,t.__MouseY=i}if(jr.isFunction(t.__OnMouseRightClick))try{return t.__OnMouseRightClick(r)}catch(o){jr.error(o)}return!0}},r.onImageAreaSelected=function(e){if(!t._isNoViewer()&&jr.isFunction(t.__OnImageAreaSelected))try{t.__OnImageAreaSelected(e.index,e.left,e.top,e.right,e.bottom,e.areaIndex)}catch(r){jr.error(r)}},r.onImageAreaDeSelected=function(e){if(!t._isNoViewer()&&jr.isFunction(t.__OnImageAreaDeSelected))try{t.__OnImageAreaDeSelected(e)}catch(r){jr.error(r)}})},__innerRefreshFromUIView:function(e,r){var t=e;jr.isFunction(t.__OnRefreshUI)&&t.__OnRefreshUI(r)}};function HH(e,r,t){r in e||Object.defineProperty(e,r,t)}var GH=function(){return S(function e(r){_(this,e);var t=this;t._parent=r,HH(t,"width",{get:function(){return this._parent._width},set:function(e){this.SetSize(e,!1)}}),HH(t,"height",{get:function(){return this._parent._height},set:function(e){this.SetSize(!1,e)}})},[{key:"SetSize",value:function(e,r){var t,n=this._parent,i=!1,o=!1;return!!n._isBindViewer()&&(jr.isString(e)&&e.length>0&&"%"===e.charAt(e.length-1)&&(i=e),!i&&e&&(t=parseInt(e))&&(i=t+"px"),jr.isString(r)&&r.length>0&&"%"===r.charAt(r.length-1)&&(o=r),!o&&r&&(t=parseInt(r))&&(o=t+"px"),!1!==i&&(n._width=i),!1!==o&&(n._height=o),jH.changeImageUISize(n))}}])}();function zH(e){var r,t,n,i,o=e._config;On.dlgProgress||On.initProgress(),o.bNoViewer?e._containerElement=null:(o.container?e._containerElement=o.container:o.containerId&&(e._containerElement=jr.get(o.containerId)),e._width=o.width,e._height=o.height,r=Cs.one(e._containerElement)),function(e,r){var t={Stwain:e};if(r){var n=e._width,i=e._height;jr.isString(n)&&n.indexOf("px")>0&&(n=parseInt(n)),jr.isString(i)&&i.indexOf("px")>0&&(i=parseInt(i)),t={Stwain:e,Container:r,Width:n,Height:i}}jH.bindUIViewEvents(e,t),e._UIView?e._UIView._Init(t):e._UIView=new On.UI.ImageUIView(e,t),xn.UseDefaultViewer&&(jr.isNumber(e.Width)&&e.Width<=0&&(e.Width=270),jr.isNumber(e.Height)&&e.Height<=0&&(e.Height=350),e._containerElement&&jH.changeImageUISize(e))}(e,r),e._isBindViewer()&&(t=e,n=e._config,i=n||{},t.__OnImageAreaDeSelected=i.onImageAreaDeSelected||"",t.__OnImageAreaSelected=i.onImageAreaSelected||"",t.__OnMouseClick=i.onMouseClick||"",t.__OnMouseDoubleClick=i.onMouseDoubleClick||"",t.__OnMouseMove=i.onMouseMove||"",t.__OnMouseRightClick=i.onMouseRightClick||"",t.__OnTopImageInTheViewChanged=i.onTopImageInTheViewChanged||"",t.__OnBufferChanged=i.onBufferChanged||"",e.__OnMouseClick=o.onMouseClick||"",e.__OnThumbnailMouseClick="",e.__OnKeyDown=o.onKeyDown||"",e.__OnMouseWheel=o.onMouseWheel||"",e.__OnMouseDoubleClick=o.onMouseDoubleClick||"",e.__OnMouseRightClick=o.onMouseRightClick||"",e.__OnMouseMove=o.onMouseMove||"",e.__OnImageAreaSelected=o.onImageAreaSelected||"",e.__OnImageAreaDeSelected=o.onImageAreaDeSelected||"",e.__OnRefreshUI=o.onRefreshUI||"",e.__OnBufferChanged=o.onBufferChanged||"",e.__MouseX=0,e.__MouseY=0,e.__style=new GH(e),e.__fSelectionRectAspectRatio=0)}var KH=new WeakSet,JH=function(e){function r(e){var t;return _(this,r),g(t=s(this,r,[e]),KH),t._ImgManager=new LH(t,t._imageBufferWrapper),t._imageBufferWrapper=t._ImgManager,t._bSelectedSourceByServer=!1,t._bRegistedLoad=!1,t._bKeepAwake=!1,t._bAx=!1,t._cookie="",t._enableEvents=0,t._startScanFlag=!1,t._destroying=!1,t._iServiceType=0,t._moduleSize=0,t._segementUploadThreshold=0,t._driverType=0,t._aryTiffTag=[],t._tiffCompressionType=0,t._jpgQuality=80,t._pdfConvertMode=0,t._logLevel=0,t._scaleDownThreshold=0,t._pdfWriteSetting={},t.__HTTPPostResponseString="",t.__remoteFilename="",t.__devices=[],t.__defaultSourceName="",t.__sourceCount=0,t.__backgroundFillColor="",t.httpFormFields={},t}return l(r,e),S(r,[{key:"_getWSContextData",value:function(){return{document:this._getCurrentDocumentName(),tag:this._getCurrentDefaultTagName(),bNeedClearTag:!1}}},{key:"_getErrorString",value:function(){var e=this;return-2207==e._errorCode&&e._bMustUpgradeService&&yc(e,xn.ServerVersionInfo),0!=e._errorCode?e._errorString:"Successful."}},{key:"_getWebTwainId",value:function(){return this._id}},{key:"_isTwainServiceType",value:function(){return!0}},{key:"_isPC",value:function(){return se.bWin||se.bMac||se.bLinux}},{key:"_serviceSyncMethodNotSupport",value:function(e){var r=this;return hh(r,-2605,'The synchronized method "'+e+'" is not supported under the current settings.'),{code:r._errorCode,message:r._getErrorString()}}},{key:"_serviceAsyncMethodNotSupport",value:function(e){var r=this;return hh(r,-2606,'The asynchronized method "'+e+'" is not supported under the current settings.'),{code:r._errorCode,message:r._getErrorString()}}},{key:"_serviceNotSupportAsync",value:function(e){var r=this;return hh(r,-2397,e+" doesn't work under current settings."),Promise.reject({code:r._errorCode,message:r._getErrorString()})}},{key:"_nouiNotSupport",value:function(e,r){var t=this;return hh(t,-2210,"You cannot call this method on this WebTwain instance because it does not use the default viewer."),jr.isFunction(r)&&r(t._errorCode,t._getErrorString()),!1}},{key:"_innerFunRaw",value:function(e,r,t,n,i,o,a){var s,u,c,l,f=this,d="f/",h=t;if(h&&(d="fa/"),xn.ConnectWithSocket)this._sendData(e,r,!1,o,a);else{if(f._resetErr(),!f._isValid())return!!h&&void 0;var g=dp.isServerInvalid(f);if(h&&g)return f._waitForConnect().then(function(){return f._innerFunRaw(e,r,h,n,i,o,a)});if(!h&&g)return Lg(f),!1;if(c={method:"POST",url:s=[f._httpUrl,d,e].join(""),data:u=mp(f._clientId,e,r,0,f._bScanForProxyRemote?f._dmServiceDWTVersion:""),async:h,onSuccess:function(e,r,t){var n=!1;try{n=jr.isString(e)&&Wo(t.getResponseHeader("content-type"))?jr.parse(e):e}catch(hH){}n?(Cm(n)?(f._errorCode=n.exception,f._errorString=n.description,f._errorCause=Tm(n)):f._resetErr(),l=i?n:n.result):(Jh(f),l=""),jr.isFunction(o)&&o(l),h&&(l=null)},onError:function(){Kh(f),l="",!On.page.bUnload&&jr.isFunction(a)&&a()}},!h&&n)se.bIE?(c.dataType="arraybuffer",c.onSuccess=function(e,r,t){var n,i,a,s=!1;if(t.responseHeadersString){var u=t.responseHeadersString;Ro(u)&&(s=!0)}if(n=t.responseData,f._resetErr(),l=!1,n&&(i=new Uint8Array(n),s?n=String.fromCharCode.apply(null,i):(l=new Blob([i],{type:f._strHttpContentTypeFieldValue}),(a=new xH.ArrayBuffer).append(i),l.md5=a.end())),!n||s){var c,d=!1;if((c=s?n:t.responseText).length>0){if("{"==c.charAt(0))try{d=jr.parse(c),s=!0}catch(h){jr.log(c)}s?Cm(d)?(f._errorCode=d.exception,f._errorString=d.description,f._errorCause=Tm(d),l=!1):l=!0:(i=new Uint8Array(c),l=new Blob([i],{type:f._strHttpContentTypeFieldValue}),(a=new xH.ArrayBuffer).append(i),l.md5=a.end())}}jr.isFunction(o)&&o(l)}):(h||(c.dataType="text",c.contentType="text/plain; charset=x-user-defined",c.mimeType="text/plain; charset=x-user-defined"),c.onSuccess=function(e,r,t){var n,i,a;if(f._resetErr(),(i=(n=t.responseText).length)>0){var s,u=!1;if("{"==n.charAt(0))try{s=jr.parse(n),u=!0}catch(h){jr.log(n)}if(u)Cm(s)?(f._errorCode=s.exception,f._errorString=s.description,f._errorCause=Tm(s),l=!1):l=!0;else{a=new Uint8Array(i);for(var c=0;c<i;c++)a[c]=n.charCodeAt(c);l=new Blob([a],{type:f._strHttpContentTypeFieldValue});var d=new xH.ArrayBuffer;d.append(a),l.md5=d.end()}}else l="";jr.isFunction(o)&&o(l)});else if(h&&n){c={method:"POST",body:u},se.bIE?c.dataType="arraybuffer":c.fetchRaw=!0;var v=Ap(s,c);return se.bIE||(v=v.then(function(e){var r=e.headers.get("content-type");return r.indexOf("image/")>=0||r.indexOf("application/octet-stream")>=0?e.arrayBuffer():e.json()})),v=v.then(function(e){if(f._resetErr(),gm(e))return jr.isFunction(o)&&o(e),void(e=null);if(jr.isObject(e)){var r=e;if(Cm(r))f._errorCode=r.exception,f._errorString=r.description,f._errorCause=Tm(r),jr.isFunction(a)&&a();else{var t="";r.result&&(t=r.result),jr.isFunction(o)&&o(t)}}else Kh(f),!On.page.bUnload&&jr.isFunction(a)&&a()},function(e){Kh(f),!On.page.bUnload&&jr.isFunction(a)&&a()}),!0}if(h||jr.mix(c,{headers:{"X-Requested-With":!1}}),se.bFileSystem&&(c.crossDomain=!1),wp(c),!h)return l}}},{key:"_innerSendCmd",value:function(e,r){this._innerFunRaw(e,r,!0,!1,!0)}},{key:"_innerFun",value:function(e,r){var t;return t=this._innerFunRaw(e,r,!1,!1,!1),jr.isArray(t)?t[0]:t}},{key:"__OnRecieveMsg",value:function(e,n){var i=this,o=null==n?void 0:n.cmd;if(e.event)return t(r,"__OnRecieveMsg",this,3)([e,n]);if(xn.ConnectWithSocket)return t(r,"__OnRecieveMsg",this,3)([e,n]);if(Cm(e)?(i._errorCode=e.exception,i._errorString=e.description,i._errorCause=Tm(e)):"StartScan"!=o&&"GetAddOnVersion"!=o&&(i._errorCode=0,i._errorString=""),"ReadBarcode"==o||"OCRRecognize"==o||e.request&&"OCRProRecognize"==e.request.method)return n.sFun?n.sFun(e):n.fFun&&n.fFun(e),!0;if("ActiveUI"==o||"VersionInfo"==o||"ConvertToBase64"==o||"SaveSelectedImagesToBase64Binary"==o||"ConvertToBlob"==o||"BeginSaveMem"==o)return n.sFun&&jr.isArray(e.result)&&e.result.length>0?n.sFun(e.result):n.fFun&&n.fFun(e.result),!0;if("ShowFileDialog"==o||"SplitTiff"==o||"SplitPDF"==o||"EncodeAsBase64"==o||"ProductKey"==o||"GetSourceNames"==o||"GetSkewAngle"==o||"GetImageInfo"==o||"GetSkewAngleFromBinary"==o)return n.sFun?n.sFun(e.result):n.fFun&&n.fFun(e.result),!0;if("SetCapabilities"==o)return t(r,"__OnRecieveMsg",this,3)([e,n]);if(e.result&&e.result.length&&("1"==e.result[0]||1==e.result[0]||"ok"==e.result[0]))(n.sFun||n.sFun)&&n.sFun(n.rawData?e:e.result);else{if(!e.exception)return n.sFun&&n.sFun(e.result),e=null,!0;var a=!1;n.fFun&&(a=n.fFun(i._errorString)),!a&&e.exception&&e.exception<0&&-2115!=e.exception&&jr.isFunction(i.__OnPrintMsg)&&i.__OnPrintMsg(i._errorString)}return!0}},{key:"OnRefreshUI",value:function(e,r,t,n){return this._innerRefreshUI(e,r,t,n)}},{key:"GetCurrentDocumentName",value:function(){return this._resetErr(),!!this._isValid()&&this._getCurrentDocumentName()}},{key:"RegisterEvent",value:function(e,r){return!!this.registerEvent(e,r)}},{key:"UnregisterEvent",value:function(e,r){return this.unregisterEvent(e,r)}},{key:"onEvent",value:function(e,r){this.registerEvent(e,r)}},{key:"on",value:function(e,r){this.registerEvent(e,r)}},{key:"_OnConsumed",value:function(e){}},{key:"_OnPostLoad",value:function(e,r){var t,n,i,o,a,s,u=this;(r!==undefined&&r.exception!==undefined&&r.description!==undefined&&(u._errorCode=r.exception,u._errorString=r.description),jr.log("OnPostLoad Results:"),XH(u,"On PostLoad"),(n=null===(t=u._ImgManager)||void 0===t?void 0:t.getCurrentImageIndex())>=0&&u._innerRefreshUI(n),0==u._loadImageBytesFileCount&&jr.isFunction(u.__OnPostLoad))&&(e&&jr.isArray(e)&&e.length>1&&(i=e[1].split(","),o=jr.base64.decode(i[0]),a=jr.base64.decode(i[1]),s=i[2]?parseInt(i[2]):-1,jr.log([o,a,s]),(""!=o&&""!=a||u._flag_LoadImageFromBinary)&&(u.__bServerOnPostLoadFired=!0,setTimeout(function(){u.__OnPostLoad&&u.__OnPostLoad(o,a,s)},200))))}},{key:"_OnPostTransfer",value:function(e){var r=this;if(jr.log("On PostTransfer Results:"+e),XH(r,"On PostTransfer"),jr.isFunction(r.__OnPostTransfer))try{r.__OnPostTransfer()}catch(t){jr.error(t)}}},{key:"_OnPreAllTransfersAsync",value:function(e){var r=this;if(jr.isFunction(r.__OnPreAllTransfersAsync)){var t={event:"beforeAcquire",result:{}};try{jr.isArray(e)&&e.length>1&&(t=jr.parse(e[1]))}catch(_H){}setTimeout(function(){try{r.__OnPreAllTransfersAsync&&r.__OnPreAllTransfersAsync(t)}catch(e){jr.error(e)}},10)}}},{key:"_OnPostAllTransfers",value:function(e){var r=this;if(e.length>=2&&0==r._errorCode&&(r._errorCode=e[1],r._errorString=e[2]),jr.log("On PostAllTransfers Results:"+e),r.__bLoadingImage=!1,r.__bAcquireImageNow=!1,r.__closeRemoteScanUI(!0),jr.isFunction(r.__OnPostAllTransfers))try{r.__OnPostAllTransfers()}catch(t){jr.error(t)}}},{key:"_OnResult",value:function(e){var r=e[1];if(jr.isFunction(this.__OnResult))try{this.__OnResult(r)}catch(t){jr.error(t)}}},{key:"_OnTransferCancelled",value:function(e){var r=this;if(r.__bLoadingImage=!1,r.__bAcquireImageNow=!1,jr.isFunction(r.__OnTransferCancelled))try{r.__OnTransferCancelled()}catch(t){jr.error(t)}}},{key:"_OnTransferError",value:function(e){if(jr.isFunction(this.__OnTransferError))try{this.__OnTransferError()}catch(r){jr.error(r)}}},{key:"_OnSourceUIClose",value:function(e){var r=this;if(r.__closeRemoteScanUI(!0),jr.isFunction(r.__OnSourceUIClose))try{r.__OnSourceUIClose()}catch(t){jr.error(t)}}},{key:"_OnPreTransfer",value:function(e){if(jr.isFunction(this.__OnPreTransfer))try{this.__OnPreTransfer()}catch(r){jr.error(r)}}},{key:"_OnPreAllTransfers",value:function(e){if(jr.isFunction(this.__OnPreAllTransfers))try{this.__OnPreAllTransfers()}catch(r){jr.error(r)}}},{key:"_OnGetFilePath",value:function(e){var r,t,n,i=this;if(r=e[1].split(","),jr.log("On GetFilePath Results:"+e),t=jr.base64.decode(r[3]),n=jr.base64.decode(r[4]),"-1032"==r[2]&&(r[2]="-1",t=n=""),jr.isFunction(i.__OnGetFilePath))try{i.__OnGetFilePath(1*r[0]>0,1*r[1],1*r[2],t,n)}catch(o){jr.error(o)}i.__bOpenFileNow=!1}},{key:"_OnDiskExceedLimit",value:function(){jr.isFunction(this.__OnDiskExceedLimit)&&this.__OnDiskExceedLimit()}},{key:"__GetLoadEventsNum",value:function(){var e=0;return jr.isFunction(this.__OnPostLoad)&&(e|=1),jr.isFunction(this.__OnGetFilePath)&&(e|=2),e}},{key:"_innerSend",value:function(e,r,t,n,i){var o=this;if(xn.ConnectWithSocket||"SaveSelectedImagesToBytes"!=e&&"ConvertToBlob"!=e)return this._sendData(e,r,t,n,i);var a=mm(),s=mp(o._clientId,e,r,a,o._bScanForProxyRemote?o._dmServiceDWTVersion:"");return o._innerFunRaw(e,s,!0,!0,!0,n,i),Promise.resolve()}},{key:"_convertToBlobByIndices",value:function(e,r,t,n,i,o){var a=this,s=!1,u=function(e){jr.isFunction(o)&&us.runErrWithCatch4(o,a,e,r,n),e=null};if(jr.isFunction(i)&&(s=!0),a._resetErr(),!a._isValid())return u(e),!!s&&void 0;var c=parseInt(r);if(!jv.checkProductKey(a,{Core:!0}))return u(e),!!s&&void 0;if(!a._checkIndices(e))return u(e),!!s&&void 0;if(c==ut.IT_BMP||c==ut.IT_JPG||c==ut.IT_PNG||c==ut.IT_J2K){if(e.length>1)return hh(a,-2372,"You cannot convert more than one image to binary when the format is BMP, JPG or PNG."),u(e),!!s&&void 0}else if(c!=ut.IT_TIF&&c!=ut.IT_PDF)return mg(a),u(e),!!s&&void 0;var l=Lp(a,e);return 0==l.length?(Bh(a),u(e),!!s&&void 0):s?(On.cancelFrom=St.ConvertToBlob,void a._innerConvertToBlobWithUI("ConvertToBlob",c,l,t,function(e,t){jr.isFunction(i)&&us.runWithCatch(i,e,t,r,n),e=t=null},u)):v(KH,a,QH).call(a,l,c,t)}},{key:"_getDefaultDevice",value:function(){var e=this;if(e._resetErr(),!e._isValid())return null;var r="",t=Gt.TWAINSCANNER,n=e._innerFun("GetDefaultSourceName");if(n.length>0)try{var i=JSON.parse(n);t=i.type,r=jr.base64.decode(i.ProductName)}catch(a){r=""}var o=new op;return o.name=r,o.deviceType=t,o.isSystemDefaultPrinter=!1,up(o),o}},{key:"_OnCurrentDeviceSelected",value:function(e,r){var t,n,i=this;if(e&&e.length>=2)try{n=parseInt(e[0]);var o=String(e[1]);(t=sp(this,o)).strDevice=o,i._curDevice=t}catch(s){jr.error(s)}var a=!1;if(jr.isFunction(i.__OnCurrentDeviceSelected))try{a=i.__OnCurrentDeviceSelected(t,n)}catch(u){jr.error(u)}return a}},{key:"_getDefaultDeviceAsync",value:(m=p(d().m(function y(){var e,r,t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if((e=this)._resetErr(),e._isValid()){a.n=1;break}return a.a(2,null);case 1:return r="",t=Gt.TWAINSCANNER,a.n=2,e._sendDataByHttpAsync("GetDefaultSourceName");case 2:if((n=a.v).length>0)try{i=JSON.parse(n),t=i.type,r=jr.base64.decode(i.ProductName)}catch(s){r=""}return(o=new op).name=r,o.deviceType=t,o.isSystemDefaultPrinter=!1,t==Gt.TWAINX64SCANNER&&r.length>0?o.displayName="Twain64-"+r:t==Gt.ICASCANNER&&this.__serverPlatform==rt.enumMac&&r.length>0?o.displayName="ICA-"+r:o.displayName=r,a.a(2,o)}},y,this)})),function(){return m.apply(this,arguments)})},{key:"_getSources",value:function(e,r,t,n){return ap(this,this._innerFun("GetSources",hm(e,null!=r&&r,null!=t&&t,0,null!=n?n:0)))}},{key:"_getSourceCountAsync",value:(h=p(d().m(function I(e,r){var t,n,i,o,a,s,u;return d().w(function(c){for(;;)switch(c.p=c.n){case 0:if((t=this)._resetErr(),t._isValid()){c.n=1;break}return c.a(2,Promise.reject({code:t._errorCode,message:t._errorString}));case 1:return v(KH,t,qH).call(t),zl("GetSourceCountAsync",t),n=[],c.p=2,e&&(t._driverType=e),i=!1,o=!1,a=!1,s=!1,t._bRemoteMode?t.__serverPlatform==rt.enumWindow?a=!0:t.__serverPlatform==rt.enumLinux?o=!0:t.__serverPlatform==rt.enumMac?i=!0:t.__serverPlatform==rt.enumAndroid&&(s=!0):(i=se.bMac,o=se.bLinux,a=se.bWin,s=se.bAndroid),u=Pp(t._driverType,a,o,i,s),c.n=3,this._getDevices(u,!0,void 0,r);case 3:n=c.v,c.n=5;break;case 4:throw c.p=4,c.v;case 5:return c.p=5,Kl("GetSourceCountAsync"),c.f(5);case 6:return c.a(2,t._setDevices(n))}},I,this,[[2,4,5,6]])})),function(e,r){return h.apply(this,arguments)})},{key:"_setDevices",value:function(e){var r,t=this;return t.__devices=e,r=e.length,t.__sourceCount=r,r<=0?(t.__defaultSourceName="",t.__sourceCount=0,0):r}},{key:"_getSourceNameByIndex",value:function(e){var r=this.__devices.length;return e<0||e>=r?"":this.__devices[e].displayName}},{key:"_dwtConvertToBlobSync",value:function(e,r,t,n,i,o){var a=this,s=t,u=",";jr.isString(s)&&""!=s||(s="",u="");var c=["[",e,',"',r.join(","),'"',u,s,"]"].join(""),l=a._innerFunRaw("ConvertToBlob",c,!1,!0,!1),f="";if(0==a._errorCode){l&&"md5"in l&&(f=l.md5);var d=!0;return jr.isFunction(n)&&(d=n(l,f,o)),d}return jr.isFunction(i)&&us.runErrWithCatch(i,a),!1}},{key:"_getSourceCountSync",value:function(e){var r,t=this,n=!1,i=!1,o=!1,a=!1;if(t._bRemoteMode?t.__serverPlatform==rt.enumWindow?o=!0:t.__serverPlatform==rt.enumLinux?i=!0:t.__serverPlatform==rt.enumMac?n=!0:t.__serverPlatform==rt.enumAndroid&&(a=!0):(n=se.bMac,i=se.bLinux,o=se.bWin,a=se.bAndroid),r=Pp(this._driverType,o,i,n,a),t._resetErr(),!t._isValid())return 0;if(!jv.checkProductKey(t,{Core:!0}))return 0;v(KH,t,qH).call(t);var s=t._getSources(r,!0,void 0,e);return t._setDevices(s)}},{key:"_OnActiveUI",value:(f=p(d().m(function b(e){var n;return d().w(function(i){for(;;)switch(i.n){case 0:return n=this,i.n=1,t(r,"_OnActiveUI",this,3)([e]);case 1:return i.n=2,n._setConvertModeAsync(n._pdfConvertMode)["catch"](function(){});case 2:return i.a(2)}},b,this)})),function(e){return f.apply(this,arguments)})},{key:"_OnReady",value:(c=p(d().m(function C(){var e,n,i,o,a,s;return d().w(function(u){for(;;)switch(u.p=u.n){case 0:return oc((e=this)._serverInfo.server)&&(nc.item("DWT_port",e._serverInfo.port),nc.item("DWT_ssl",e._serverInfo.ssl?"true":"false")),e._bNoMask||zl("OnReady",e),u.p=1,u.n=2,t(r,"_OnReady",this,3)([]);case 2:if(!Mc()){u.n=4;break}if(e._uuidForActiveUI){u.n=4;break}return u.n=3,xn.lgcuid(xn.lgdt(),"");case 3:n=u.v,e._uuidForActiveUI=n;case 4:return u.n=5,e._innerActiveUI(e._uuidForActiveUI);case 5:return i=u.v,u.n=6,e._OnActiveUI(i);case 6:if(dh(Ph),(o=e._id)&&!xn.WebTwainIdMap[o]&&(xn.WebTwainIdMap[o]=e),zH(e),a=!1,e._bRemoteMode||(a=On.attachAddon(e)),xn.IfDisableDefaultSettings){u.n=8;break}return dh(Fh),u.n=7,ZH(e);case 7:u.n=9;break;case 8:if(!a){u.n=9;break}return u.n=9,new Promise(function(e){setTimeout(e,300)});case 9:u.n=11;break;case 10:throw u.p=10,(s=u.v)&&(e._errorCode=s.code,e._errorString=s.message),e.dispose(),s;case 11:return u.p=11,e._bNoMask||Kl("OnReady"),u.f(11);case 12:return u.a(2)}},C,this,[[1,10,11,12]])})),function(){return c.apply(this,arguments)})},{key:"_OnWSClose",value:function(e){t(r,"_OnWSClose",this,3)([e]),On.detect.bOK=!1;this.__bLoadingImage=!1,this.__bAcquireImageNow=!1}},{key:"_OnWSTimeout",value:function(e){t(r,"_OnWSTimeout",this,3)([e]),On.detect.bOK=!1}},{key:"_setConvertModeAsync",value:function(e){var r,t,n=this,i=1*e;return isNaN(i)?(av(n),Promise.reject({code:n._errorCode,message:n._errorString})):n._checkConvertModeInner(i)?(t=this._mixSavedPdfReaderOptions({convertMode:i,renderOptions:{renderAnnotations:!(null===(r=n._pdfOptions)||void 0===r||null===(r=r.renderOptions)||void 0===r||!r.renderAnnotations)}}),n._resetPdfOptionsWhenSetConvertMode(t),v(KH,n,YH).call(n,t,i)):Promise.reject({code:n._errorCode,message:n._errorString})}},{key:"_OnReconnected",value:(u=p(d().m(function T(){var e;return d().w(function(r){for(;;)switch(r.n){case 0:return e=this,r.n=1,v(KH,e,YH).call(e,e._pdfOptions);case 1:return r.a(2)}},T,this)})),function(){return u.apply(this,arguments)})},{key:"_getConvertMode",value:function(){return this._pdfConvertMode}},{key:"_setConvertMode",value:function(e){var r,t,n=this,i=1*e;if(isNaN(i))return av(n),!1;if(!n._checkConvertModeInner(i))return!1;t=this._mixSavedPdfReaderOptions({convertMode:i,renderOptions:{renderAnnotations:!(null===(r=n._pdfOptions)||void 0===r||null===(r=r.renderOptions)||void 0===r||!r.renderAnnotations)}}),n._resetPdfOptionsWhenSetConvertMode(t);var o=n._setReaderOptions(t,!1);return o&&(n._pdfConvertMode=i,n._pdfOptions&&(n._pdfOptions.convertMode=t.convertMode,n._pdfOptions.renderOptions&&(n._pdfOptions.renderOptions.renderAnnotations=t.renderOptions.renderAnnotations),n._pdfOptions.convertMode==Ht.CM_IMAGEONLY&&n._pdfConvertMode==Ht.CM_RENDERALL||n._pdfOptions.convertMode==Ht.CM_IMAGEONLY&&n._pdfConvertMode==Ht.CM_RENDERALLWITHANNOTATION))?(n._pdfConvertMode=Ht.CM_IMAGEONLY,ug(n),!1):o}},{key:"_checkConvertModeInner",value:function(e){var r=this;return!!jv.checkProductKey(r,{Core:!0})&&(r._resetErr(),!!r._isValid()&&(e==Ht.CM_RENDERALL||e==Ht.CM_IMAGEONLY||e==Ht.CM_AUTO||e==Ht.CM_RENDERALLWITHANNOTATION||(av(r),!1)))}},{key:"_resetPdfOptionsWhenSetConvertMode",value:function(e){var r=e.convertMode;r==Ht.CM_IMAGEONLY||jv.hasPDFRProductKey(this)?e.convertMode=r:e.convertMode=Ht.CM_IMAGEONLY,e.convertMode==Ht.CM_IMAGEONLY||e.convertMode==Ht.CM_RENDERALL?e.renderOptions.renderAnnotations=!1:e.convertMode==Ht.CM_RENDERALLWITHANNOTATION&&(e.renderOptions.renderAnnotations=!0)}},{key:"_checkPDFPasswordValue",value:function(e){if(!jr.isUndefined(e)){if(!jr.isString(e))return hh(this,-2852,"The password is not a string."),!1;if(e.length>32)return function(e){hh(e,-2851,"The password must not exceed 32 characters in length.")}(this),!1}return!0}},{key:"_mixSavedPdfReaderOptions",value:function(e){var r,t,n=this;return t=jr.clone(n._pdfOptions),e||(e={}),e.convertMode&&(t.convertMode=e.convertMode),jr.isString(e.password)?t.password=e.password:jr.isNumber(e.password)&&(t.password=""+e.password),jr.isBoolean(e.preserveUnmodifiedOnSave)&&(t.preserveUnmodifiedOnSave=e.preserveUnmodifiedOnSave),e.renderOptions&&null!==(r=n._pdfOptions)&&void 0!==r&&r.renderOptions&&(t.renderOptions=jr.mix(n._pdfOptions.renderOptions,e.renderOptions)),t}},{key:"_setReaderOptions",value:function(e,r){var t,n,i=this,o=-1;if(i._resetErr(),e&&e.renderOptions){var a=e.renderOptions.resolution,s=e.renderOptions.maxWidth,u=e.renderOptions.maxHeight,c=e.renderOptions.renderGrayscale;if(!jr.isUndefined(a)&&(!jr.isNumber(a)||a<=0))return hh(i,-2830,"The PDF resolution must be a positive number."),!1;if(!jr.isUndefined(s)&&(!jr.isNumber(s)||s<0))return function(e){hh(e,-2831,"The PDF max width must be a positive number.")}(i),!1;if(!jr.isUndefined(u)&&(!jr.isNumber(u)||u<0))return function(e){hh(e,-2832,"The PDF max height must be a positive number.")}(i),!1;if(!jr.isUndefined(c)&&!jr.isBoolean(c))return function(e){hh(e,-2833,"The PDF render grayscale must be a boolean.")}(i),!1}if(r){t={},e||(e={}),e.convertMode?t.convertMode=e.convertMode:t.convertMode=Ht.CM_AUTO,o=t.convertMode,jr.isString(e.password)?t.password=e.password:jr.isNumber(e.password)?t.password=""+e.password:t.password="",e.preserveUnmodifiedOnSave?t.preserveUnmodifiedOnSave=!0:t.preserveUnmodifiedOnSave=!1,t.renderOptions=jr.mix({renderAnnotations:!1,resolution:200,maxWidth:0,maxHeight:0,renderGrayscale:!1},e.renderOptions);var l=t.renderOptions.renderAnnotations;jr.isBoolean(l)||jr.isString(l)&&(t.renderOptions.renderAnnotations="true"==l.toLowerCase());var f=t.renderOptions.renderGrayscale;if(jr.isBoolean(f)||jr.isString(f)&&(t.renderOptions.renderGrayscale="true"==f.toLowerCase()),jr.isNumber(t.convertMode)){if(!i._checkConvertModeInner(t.convertMode))return!1;jv.hasPDFRProductKey(i)||(t.convertMode=Ht.CM_IMAGEONLY),t.convertMode==Ht.CM_IMAGEONLY?t.renderOptions.renderAnnotations=!1:t.convertMode==Ht.CM_RENDERALLWITHANNOTATION&&(t.renderOptions.renderAnnotations=!0)}}else{if(jr.isUndefined(e))return function(e){hh(e,-2834,"The PDF reader options is invalid.")}(i),!1;if(t=e,jr.isString(e.password)||jr.isUndefined(e.password));else{if(!jr.isNumber(e.password))return function(e){hh(e,-2829,"The type of the PDF password must be a string.")}(i),!1;e.password=""+e.password}}var d=i._getPdfDllname();n=["[",jr.stringify(t),',"',d,'"',"]"].join("");var h,g,v=i._innerFun("SetPDFReaderOptions",n);if(v&&(r&&(i._pdfOptions=jr.clone(t),jr.isNumber(t.convertMode)&&(t.convertMode==Ht.CM_RENDERALL&&t.renderOptions.renderAnnotations&&(t.convertMode=Ht.CM_RENDERALLWITHANNOTATION),i._pdfConvertMode=t.convertMode,(null===(h=i._pdfOptions)||void 0===h?void 0:h.convertMode)==Ht.CM_IMAGEONLY&&o==Ht.CM_RENDERALL||(null===(g=i._pdfOptions)||void 0===g?void 0:g.convertMode)==Ht.CM_IMAGEONLY&&o==Ht.CM_RENDERALLWITHANNOTATION))))return i._pdfConvertMode=Ht.CM_IMAGEONLY,ug(i),!1;return v}},{key:"_getPdfDllname",value:function(){var e=this,r=!1,t=!1;return e._bRemoteMode?e.__serverPlatform==rt.enumWindow||(e.__serverPlatform==rt.enumLinux?t=!0:e.__serverPlatform==rt.enumMac&&(r=!0)):(r=se.bMac,t=se.bLinux,se.bWin),r?e._b64bit?"libDMCodecx64.dylib":"libDMCodec.dylib":t?"libDMCodec.so":e._b64bit?"DMCodecx64.dll":"DMCodec.dll"}},{key:"_unload_viewer",value:function(){}},{key:"__innerDeleteInMap",value:function(){return this._id,delete xn.WebTwainIdMap[this._id],!0}},{key:"__unload",value:(a=p(d().m(function w(){var e,n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(e=this,n=jr.clone(xn.licenseException),e.__closeRemoteScanUI(!0),!e._destroy&&!e._destroying){s.n=1;break}return s.a(2);case 1:return e._destroying=!0,this.__innerDeleteInMap(),e.__addon&&e.__addon.Camera&&e.__addon.Camera._viewer&&(""!=e.__addon.Camera.getStatus()&&e.__addon.Camera.closeSource()["catch"](function(){}),e.__addon.Camera._viewer.dispose(),e.__addon.Camera._viewer=null),e._unload_viewer(),e._containerElement=null,e._ImgManager&&e._ImgManager.clear(),xn.lremoveDWTObj(e),s.p=2,s.n=3,t(r,"__unload",this,3)([]);case 3:s.n=5;break;case 4:s.p=4,a=s.v,i=a;case 5:if(e.__bLoadingImage=!1,e.__bAcquireImageNow=!1,e._destroying=!1,e._destroy=!0,(o=xn.licenseException).code=n.code,o.message=n.message,o.fromLTS=n.fromLTS,!i){s.n=6;break}throw i;case 6:return s.a(2)}},w,this,[[2,4]])})),function(){return a.apply(this,arguments)})},{key:"_setIfShowUI",value:function(e){this._resetErr(),this._isValid()&&(jr.isBoolean(e)?this._innerFun("IfShowUI",hm(e)):Uh(self))}},{key:"_setIfShowFileDialog",value:function(e){this._resetErr(),this._isValid()&&(jr.isBoolean(e)?this._innerFun("IfShowFileDialog",hm(e)):Uh(self))}},{key:"_getDevicesAsync",value:(o=p(d().m(function A(e,r,t,n,i){var o,a,s,u,c;return d().w(function(l){for(;;)switch(l.p=l.n){case 0:if(o=this,a=[],!r||jr.isNumber(r)){l.n=1;break}return Ag(o),l.a(2,Promise.reject({code:o._errorCode,message:o._errorString}));case 1:if(s=o._bRemoteMode?Kt:se.bAndroid?Qt:Kt,u=null!=r?r:s,o._resetErr(),o._isValid()){l.n=2;break}return l.a(2,Promise.reject({code:o._errorCode,message:o._errorString}));case 2:return zl(e,o),l.p=3,l.n=4,o._getDevices(u,t,n,i);case 4:c=l.v,jr.isArray(c)&&c.length>0&&(a=a.concat(c)),l.n=6;break;case 5:throw l.p=5,l.v;case 6:return l.p=6,Kl(e),l.f(6);case 7:return a.length>0&&this._setDevices(a),l.a(2,a)}},A,this,[[3,5,6,7]])})),function(e,r,t,n,i){return o.apply(this,arguments)})},{key:"_openSourceAsync",value:function(e){var r=this;return r._resetErr(),r._isValid()?(r._bRemoteMode&&r._initRemoteDiv(),r._innerFunV2("OpenSource").then(function(e){return r.__closeRemoteScanUI(!0),e},function(e){return r.__closeRemoteScanUI(!0),Promise.reject(e)})):Promise.reject({code:r._errorCode,message:r._errorString})}},{key:"_closeSourceAsync",value:function(e){var r=this;return r._resetErr(),r._isValid()?r._innerFunV2("CloseSource").then(function(){return r._curDevice=null,!0}):Promise.reject({code:r._errorCode,message:r._errorString})}},{key:"_selectSourceAsync",value:function(e,r,t){var n=this;return n._resetErr(),n._isValid()?n._getDevicesAsync(e,r).then(function(r){var i,o,a=document,s=r?r.length:0;Cs.dialog.selectsourcedlg&&(Cs.dialog.selectsourcedlg.close(),document.body.removeChild(Cs.dialog.selectsourcedlg),Cs.dialog.selectsourcedlg=!1);var u,c,l,f,d=-1;for((o=a.createElement("dialog")).className="dynamsoft-dialog-selectsource",se.bIE&&(o.style.width="300px"),o.setAttribute("closed","closed"),(u=[]).push('<ul id="dynamsoft-dialog-selectsource-sourcelist-ul">'),i=0;i<s;i++){var h="",g=n._getSourceNameByIndex(i);(""==n.__defaultSourceName&&0==i||n.__defaultSourceName==g)&&(h=" dynamsoft-dialog-selectsource-sourcelist-li-selected",d=i),u.push('<li class="dynamsoft-dialog-selectsource-item'+h+'" sourceindex="'+i+'">'+g+"</li>")}u.push("</ul>"),u=u.join(""),jr.isArray(t)&&t.length>=3?(c=t[0],l=t[1],f=t[2]):(c="Select Source:",l="Select",f="Cancel");var v=["<p>",c,"</p>",'<div id="dynamsoft-dialog-selectsource-sourcelist">',u,"</div>",'<div><button class="dynamsoft-dialog-selectsource-button-select" >',l,"</button>",'<button class="dynamsoft-dialog-selectsource-button-cancel" >',f,"</button></div>"].join("");rf(o,v),Cs.dialog.selectsourcedlg=o,a.body.appendChild(Cs.dialog.selectsourcedlg),jr.each(jr.sizzle(".dynamsoft-dialog-selectsource-item"),function(e,r){jr.addEventListener(e,"click",function(e){for(var r,t,n=e.target,i=n.getAttribute("sourceindex"),o=null!==(r=null===(t=n.parentElement)||void 0===t?void 0:t.children)&&void 0!==r?r:[],a=0;a<o.length;a++)o[a].className="dynamsoft-dialog-selectsource-item";n.className="dynamsoft-dialog-selectsource-item dynamsoft-dialog-selectsource-sourcelist-li-selected";var s=jr.get("dynamsoft-dialog-selectsource-sourcelist-ul");s&&s.setAttribute("selectedSourceIndex",i)})});var m=jr.get("dynamsoft-dialog-selectsource-sourcelist-ul");return m&&m.setAttribute("selectedSourceIndex",d.toString()),Cs.dialog.setup(Cs.dialog.selectsourcedlg),Cs.dialog.selectsourcedlg&&Cs.dialog.selectsourcedlg.showModal(),"CSS1Compat"==a.compatMode?a.documentElement.scrollTop:a.body.scrollTop,new Promise(function(r,t){jr.removeEventListener(Cs.one(".dynamsoft-dialog-selectsource-button-select")[0],"click"),jr.removeEventListener(Cs.one(".dynamsoft-dialog-selectsource-button-cancel")[0],"click"),s>0&&jr.addEventListener(Cs.one(".dynamsoft-dialog-selectsource-button-select")[0],"click",function(){var t=-1,i=jr.get("dynamsoft-dialog-selectsource-sourcelist-ul");i&&(t=parseInt(i.getAttribute("selectedSourceIndex"))),t<0||n._selectSourceByIndexAsync(e,t).then(function(){Cs.dialog.selectsourcedlg&&(Cs.dialog.selectsourcedlg.close(),document.body.removeChild(Cs.dialog.selectsourcedlg),Cs.dialog.selectsourcedlg=!1),r(t)})}),jr.addEventListener(Cs.one(".dynamsoft-dialog-selectsource-button-cancel")[0],"click",function(){Cs.dialog.selectsourcedlg&&(Cs.dialog.selectsourcedlg.close(),document.body.removeChild(Cs.dialog.selectsourcedlg),Cs.dialog.selectsourcedlg=!1);var e={};zo(e),t({code:e._errorCode,message:e._errorString})})})}):Promise.reject({code:n._errorCode,message:n._errorString})}},{key:"_dwtGetCapabilities",value:function(e,r,t){var n,i=this,o=function(){jr.isFunction(t)&&t(i._errorCode,i._errorString)};if(e){if(!jr.isArray(e))return Ag(i),void o();if(!1===function(e,r){var t,n,i,o;for(o=0;o<r.length;o++){if(t=r[o],n=!1,i=!1,jr.isString(t)){var a=t;t=parseInt(t),(jr.isNaN(t)||t!=a)&&(n=!0)}if(0==n&&jr.isNumber(t)?(t<1||t>65535)&&(i=!0):n=!0,n)return Ag(e),!1;if(i)return uv(e),!1}return!0}(i,e))return void o();n=hm(e)}i._sendDataByHttpAsync("GetCapabilities",n).then(function(e){try{var t,n;e.length>0&&(n=e[0]),jr.isString(n)?(n=On.removeNonPrintableChar(n),0==(t=JSON.parse(n)).errorCode?jr.isFunction(r)&&r(t.response):(i._errorCode=t.errorCode,i._errorString=t.errorString,o())):($g(i),o())}catch(a){i._errorCode=-2302,i._errorString=a,o()}},o)}},{key:"_dwtSetCapabilities",value:function(e,r,t){var n=this;if(!jr.isObject(e)||jr.isArray(e))return Ag(n),jr.isFunction(t)&&t(n._errorCode,n._getErrorString()),!1;var i=["[",jr.stringify(e),"]"].join("");return n._innerSend("SetCapabilities",i,0,function(e){jr.isFunction(r)&&r(e)},t),!0}},{key:"_selectDeviceAsync",value:(i=p(d().m(function E(e,n,i){var o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:return o=this,zl(e,this),s.p=1,s.n=2,t(r,"_innerSelectDeviceAsync",this,3)([n,i]);case 2:(a=s.v)&&(o._curDevice=n,o._bSelectedSourceByServer=!1),s.n=4;break;case 3:throw s.p=3,s.v;case 4:return s.p=4,Kl(e),s.f(4);case 5:return s.a(2,a)}},E,this,[[1,3,4,5]])})),function(e,r,t){return i.apply(this,arguments)})},{key:"_selectSourceByIndexAsync",value:(n=p(d().m(function k(e,r){var t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:if(n=1*r,(t=this)._resetErr(),t._isValid()){o.n=1;break}return o.a(2,Promise.reject({code:t._errorCode,message:t._errorString}));case 1:if(!jr.isNaN(n)){o.n=2;break}return Bh(t),o.a(2,Promise.reject({code:t._errorCode,message:t._errorString}));case 2:if(t.__devices){o.n=3;break}return o.n=3,t._getDevicesAsync(e,undefined);case 3:if(!(n<0||n>=t.__devices.length)){o.n=4;break}return gg(t),o.a(2,Promise.reject({code:t._errorCode,message:t._errorString}));case 4:return i=t.__devices[n],o.a(2,t._selectDeviceAsync(e,i))}},k,this)})),function(e,r){return n.apply(this,arguments)})},{key:"_removeAllImages",value:function(e){var r=this,t=!0;if(r._resetErr(),!r._isValid())return!1;var n,i,o,a=[];for(n=r._getHowManyImagesInBuffer()-1;n>=0;n--){var s=r._imageBufferWrapper.convertClientIndexToServerId(n);s>-1&&a.push(s)}if(a.length>0){if(r._OnBitmapChanged(["c1",a.join(","),3,null===(i=r._ImgManager)||void 0===i?void 0:i.getCurrentImageIndex(),null===(o=r._ImgManager)||void 0===o?void 0:o.count()]),t=r._innerFunRaw("RemoveAllImages",hm(a.join(",")),!1,!1,!1,function(){},function(){}),jr.isArray(t))return t[0]}else t=!0;return t}},{key:"_removeImage",value:function(e,r){var t,n,i=this,o=parseInt(r);if(!Rp(i,o))return!1;var a,s,u=null===(t=i._ImgManager)||void 0===t?void 0:t.convertClientIndexToServerId(o);if(-1==u)return gg(i),!1;((n=i._innerFun("RemoveImage",hm(u)))||-1033==i._errorCode)&&i._OnBitmapChanged(["c1",""+u,3,null===(a=i._ImgManager)||void 0===a?void 0:a.getCurrentImageIndex(),null===(s=i._ImgManager)||void 0===s?void 0:s.count()]);return n}},{key:"__innerAcquireOrLoadImageAsync",value:function(e,r,t,n){var i=this;return new Promise(function(t,n){var o="LoadImage"==e||"LoadImageEx"==e||"GenerateURLForUploadData"==e,a=o||"LoadDibFromClipboard"==e||"StartScan"==e;o?On.showProgress(i,e,!1):zl(e,i),i._innerSend(e,r,!0,function(r){if(i.__bLoadingImage=!1,i.__bAcquireImageNow=!1,i.__bOpenFileNow=!1,i.__closeRemoteScanUI(!0),o){if(On.closeProgress(null,e),i._isBindViewer()){var n,s=null===(n=i._ImgManager)||void 0===n?void 0:n.getCurrentImageIndex();s>=0&&i._innerRefreshUI(s)}}else Kl(e);a&&i._canConsume()&&xn.lcvrf(i),t(r)},function(r){o?On.closeProgress(null,""):Kl(e),i.__bLoadingImage=!1,i.__bAcquireImageNow=!1,i.__bOpenFileNow=!1,i.__closeRemoteScanUI(!0);var t=i._ImgManager.getCurrentImageIndex();t>=0&&i._innerRefreshUI(t),wm(i._errorCode)&&ug(i),o?On.closeProgress(null,e):Kl(e),a&&i._canConsume()&&xn.lcvrf(i),n({code:i._errorCode,message:i._getErrorString()}),r&&jr.error(r)})})}},{key:"_innerLoadImageFromBinary",value:function(e,r,t,n,i,o){var a,s,u=this,c=r;if(!jv.checkProductKey(u,{Core:!0}))return jr.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(!e||""==e)return rg(u),jr.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(jr.isString(e))return Ag(u),jr.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(e instanceof Blob)s=e.size;else if(gm(e))s=e.byteLength;else if(e instanceof Array)s=e.length;else{var l=e;s=l.size||l.byteLength||l.length}if(!s||""==s)return Ag(u),jr.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;var f=e.currentFileName;f||(f=u._getCurrentDocumentName());var d,h=e.currentTagName;if(h||!jr.isUndefined(e.bNeedClearCurrentTagName)&&e.bNeedClearCurrentTagName||(h=u._getCurrentDefaultTagName()),e instanceof FileList){if(1==e.length)return e[0].currentFileName=f,e[0].currentTagName=h,u._innerLoadImageFromBinary(e[0],c,t,i,o);if(e.length>1){var g;for(jr.asyncQueue.stop(),sm.stop(),g=0;g<e.length;g++)e[g].currentFileName=f,e[g].currentTagName=h,g==e.length-1?jr.asyncQueue.pushToDo(u,"_innerLoadImageFromBinary",[e[g],c,t,i,o]):jr.asyncQueue.pushToDo(u,"_innerLoadImageFromBinary",[e[g],c,t,null,o]);return jr.asyncQueue.start(),!0}return rg(u),jr.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1}if(window.ReadableStream&&e instanceof ReadableStream?a=new Response(e):window.Response&&e instanceof Response&&(a=e),a)a.arrayBuffer().then(function(r){var a;(a=new Blob([r])).currentFileName=e.currentFileName,a.currentTagName=e.currentTagName;var s=n,c=0;t&&(c=u.__GetLoadEventsNum()),u.__LoadImageFromBytesV1(a,-1,"",c,s,i,o)});else{var v,m,p=e;n&&gm(p)&&((p=new Blob([e])).currentFileName=e.currentFileName,p.currentTagName=e.currentTagName);var _=Ss(null!==(v=null===(m=p)||void 0===m?void 0:m.type)&&void 0!==v?v:""),y=n,S=0;t&&(S=u.__GetLoadEventsNum()),d=u.__LoadImageFromBytesV1(p,_,"",S,y,i,o)}return!!n||d}},{key:"__LoadImageFromBytes",value:function(e,r,t,n,i,o,a,s){var u=this.__LoadImageFromBytesV2(e,r,t,n,a,s,!1,0,i,o);return n?u:0==this._errorCode}},{key:"__LoadImageFromBytesV1",value:function(e,r,t,n,i,o,a){var s=this.__LoadImageFromBytesV2(e,r,t,i,0,0,!1,n,o,a);return i?s:0==this._errorCode}},{key:"_isMobileMode",value:function(){return!1}},{key:"ErrorCode",get:function(){return this._errorCode}},{key:"ErrorString",get:function(){return this._getErrorString()}},{key:"ErrorCause",get:function(){return this._errorCause}},{key:"HowManyImagesInBuffer",get:function(){return this._getHowManyImagesInBuffer()}},{key:"_OnActiveUIClearBuffer",value:function(){var e=this.__OnBufferChanged;this.__OnBufferChanged=null,this._ImgManager.clear(),this.__OnBufferChanged=e}}]);var n,i,o,a,u,c,f,h,m}(NH);function QH(e,r,t){var n=this;return n._dwtConvertToBlobSync(r,e,t,function(e){if(!e||e.size<=0)return Cg(n),!1;var r=n.__maxUploadImageSize;return e.size>r&&-1!=r?(eg(n),!1):e},function(e){return!1})}function qH(){this.__defaultSourceName="",this.__sourceCount=0}function YH(e,r){var t=this,n=t._getPdfDllname(),i=["[",jr.stringify(e),',"',n,'"',"]"].join("");return t._innerFunV2("SetPDFReaderOptions",i).then(function(){if(jr.isNumber(r)&&(t._pdfConvertMode=r),t._pdfOptions&&(t._pdfOptions.convertMode=e.convertMode,t._pdfOptions.renderOptions&&(t._pdfOptions.renderOptions.renderAnnotations=e.renderOptions.renderAnnotations),t._pdfOptions.preserveUnmodifiedOnSave=e.preserveUnmodifiedOnSave,t._pdfOptions.convertMode==Ht.CM_IMAGEONLY&&t._pdfConvertMode==Ht.CM_RENDERALL||t._pdfOptions.convertMode==Ht.CM_IMAGEONLY&&t._pdfConvertMode==Ht.CM_RENDERALLWITHANNOTATION))throw t._pdfConvertMode=Ht.CM_IMAGEONLY,ug(t),{code:t._errorCode,message:t._errorString};return!0})}var XH=function(e,r){if(Yv.bDiscardBlankImage){var t=e._ImgManager.getCurrentImageIndex();e.IsBlankImage(t)&&e.RemoveImage(t);var n=["Blank Discard (",r,"): ",e.ErrorString].join("");jr.isFunction(e.__OnPrintMsg)&&e.__OnPrintMsg(n)}};function ZH(e){return $H.apply(this,arguments)}function $H(){return($H=p(d().m(function e(r){var t,n,i,o;return d().w(function(e){for(;;)switch(e.n){case 0:if(t=r,!xn.ConnectWithSocket){e.n=2;break}return e.n=1,new Promise(function(e,r){t._sendData("IfDisableSourceAfterAcquire","[1]",!1,e,r)});case 1:e.n=3;break;case 2:return e.n=3,r._innerFunV2("IfDisableSourceAfterAcquire","[1]");case 3:n=Xt.TWAIN,i=!1,o=!1,t._bRemoteMode?t.__serverPlatform==rt.enumWindow||(t.__serverPlatform==rt.enumLinux?o=!0:t.__serverPlatform==rt.enumMac&&(i=!0)):(i=se.bMac,o=se.bLinux,se.bWin),i?n=Xt.TWAIN_AND_ICA:o&&(n=Xt.SANE),r._driverType=n,r._bRemoteMode&&(r._setIfShowUI(!1),r._setIfShowFileDialog(!1));case 4:return e.a(2)}},e)}))).apply(this,arguments)}var eG=new WeakSet,rG=function(e){function t(e){var r;return _(this,t),g(r=s(this,t,[e]),eG),r.HTTPPassword="",r.HTTPPort=80,r.HTTPUserName="",r}return l(t,e),S(t,[{key:"SaveAsGIF",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!(jv.checkProductKey(i,{Core:!0})||se.bWin&&jv.checkProductKey(i,{Webcam:!0},!0)))return jv.checkProductKey(i,{Core:!0},!1),jr.isFunction(n)&&n(i._errorCode,i._getErrorString()),!!o&&void 0;var a,s=kp.replaceLocalFilename(e);if(!xp(i,r,n))return!!o&&void 0;if(-1==(a=i._ImgManager.convertClientIndexToServerId(r)))return gg(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var u=i.__GetLoadEventsNum(),c=i.__innerSaveImage("SaveAsGIF",hm(s,a,u),t,n);return o?void 0:c}},{key:"SaveSelectedImagesToBase64Binary",value:function(e,r){var t=this,n=!1;if(jr.isFunction(e)&&(n=!0),t._resetErr(),!t._isValid())return jr.isFunction(r)&&us.runErrWithCatch(r,t),!!n&&void 0;if(!(jv.checkProductKey(t,{Core:!0})||se.bWin&&jv.checkProductKey(t,{Webcam:!0},!0)))return jv.checkProductKey(t,{Core:!0},!1),jr.isFunction(r)&&r(t._errorCode,t._getErrorString()),!!n&&void 0;var i=Op(t);return 0==i.length?(Vh(t),jr.isFunction(r)&&us.runErrWithCatch(r,t),!!n&&void 0):n?void t._innerSend("SaveSelectedImagesToBase64Binary",hm(i.join(",")),!0,e,r):t._innerFun("SaveSelectedImagesToBase64Binary",hm(i.join(",")))}},{key:"ShowFileDialog",value:function(e,r,t,n,i,o,a,s){var u=this;if(u._resetErr(),!u._isValid())return!1;var c,l=kp.replaceLocalFilename(i);return c=u.__GetLoadEventsNum(),u._innerSend("ShowFileDialog",hm(e,r,t,n,l,o,a,s,c),!0),!0}},{key:"FTPDownload",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!e)return Ag(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a=bs(r);return v(eG,i,aG).call(i,"FTPDownload",[e,r],a,t,n)}},{key:"FTPDownloadEx",value:function(e,r,t,n,i){var o=this,a=!1;return jr.isFunction(n)&&(a=!0),o._resetErr(),o._isValid()?e?v(eG,o,aG).call(o,"FTPDownloadEx",[e,r,t],t,n,i):(Ag(o),jr.isFunction(i)&&us.runErrWithCatch(i,o),!!a&&void 0):(jr.isFunction(i)&&us.runErrWithCatch(i,o),!!a&&void 0)}},{key:"FTPUpload",value:function(e,r,t,n,i){var o=this,a=!1;if(jr.isFunction(n)&&(a=!0),o._resetErr(),!o._isValid())return jr.isFunction(i)&&us.runErrWithCatch(i,o),!!a&&void 0;if(!xp(o,r,i))return!!a&&void 0;var s=o._ImgManager.convertClientIndexToServerId(r);if(-1==s)return gg(o),jr.isFunction(i)&&us.runErrWithCatch(i,o),!!a&&void 0;var u=o.__innerFTPUpload("FTPUpload",hm(e,s,t),n,i);return a?void 0:u}},{key:"FTPUploadEx",value:function(e,r,t,n,i,o){var a,s=this,u=!1;if(jr.isFunction(i)&&(u=!0),s._resetErr(),!s._isValid())return jr.isFunction(o)&&us.runErrWithCatch(o,s),!!u&&void 0;if(!xp(s,r,o))return!!u&&void 0;if(-1==(a=s._ImgManager.convertClientIndexToServerId(r)))return gg(s),jr.isFunction(o)&&us.runErrWithCatch(o,s),!!u&&void 0;var c=s.__innerFTPUpload("FTPUploadEx",hm(e,a,t,n),i,o);return u?void 0:c}},{key:"FTPUploadAllAsMultiPageTIFF",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a=[];Fp(i,a);var s=i.__innerFTPUpload("FTPUploadAsMultiPageTIFF",hm(e,r,a.join(",")),t,n);return o?void 0:s}},{key:"FTPUploadAllAsPDF",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a=[];Fp(i,a);var s=i.__innerFTPUpload("FTPUploadAsMultiPagePDF",hm(e,r,a.join(",")),t,n);return o?void 0:s}},{key:"FTPUploadAsMultiPagePDF",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a=Op(i),s=i.__innerFTPUpload("FTPUploadAsMultiPagePDF",hm(e,r,a.join(",")),t,n);return o?void 0:s}},{key:"FTPUploadAsMultiPageTIFF",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a=Op(i),s=i.__innerFTPUpload("FTPUploadAsMultiPageTIFF",hm(e,r,a.join(",")),t,n);return o?void 0:s}},{key:"HTTPDownloadDirectly",value:function(e,r,t,n,i){var o,a=this,s=!1;if(jr.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return jr.isFunction(i)&&us.runErrWithCatch(i,a),!!s&&void 0;if(!jv.checkProductKey(a,{Core:!0}))return jr.isFunction(i)&&us.runErrWithCatch(i,a),!!s&&void 0;var u,c,l=a._GetHttpHeadersAndClear(),f=kp.combineUrl(a,e,r);if(f===undefined)return rg(a),jr.isFunction(i)&&us.runErrWithCatch(i,a),!!s&&void 0;if(!t||""==t)return function(e,r){hh(e,-2309,"The LocalFile is empty in the name "+r+" Function.")}(a,"HTTPDownloadDirectly"),jr.isFunction(i)&&us.runErrWithCatch(i,a),!!s&&void 0;if(u=bs(t),!jv.checkPDFProductKeyWhenNeeds(a,u))return jr.isFunction(i)&&us.runErrWithCatch(i,a),!!s&&void 0;On.cancelFrom=St.HTTPDownload,c=kp.replaceLocalFilename(t),a.IfShowProgressBar?On.showProgress(a,"HTTPDownloadDirectly",!1):On.hideProgress();var d=null===(o=On.progressContext)||void 0===o?void 0:o.IfShowCancelDialogWhenImageTransfer,h=function(){return a.IfShowProgressBar&&On.closeProgress(null,"HTTPDownloadDirectly"),jr.isFunction(n)&&n(),!0},g=function(){return On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=d),a.IfShowProgressBar&&On.closeProgress(null,"HTTPDownloadDirectly"),jr.isFunction(i)&&us.runErrWithCatch(i,a),!1};a._OnPercentDone([0,-1,yh,"http"]),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!0);var v=kp.loadHttpBlob(a,"get",f,s,function(e){On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=d),a._OnPercentDone([0,-1,vh]);var r=a.__GetLoadEventsNum();return a.__LoadImageFromBytesV1(e,3,c,r,s,h,g)},g,function(e){var r=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),r>=100&&e.loaded<e.total&&(r=99),a._OnPercentDone([0,r,"","http"])},l);return s?void 0:!!v}},{key:"HTTPUploadThroughPostDirectly",value:function(e,r,t,n,i,o){var a=this,s=!1,u=function(){jr.isFunction(o)&&us.runErrWithCatch(o,a,a.__HTTPPostResponseString)};if(jr.isFunction(i)&&(s=!0),a._resetErr(),a.__HTTPPostResponseString="",!a._isValid())return u(),!!s&&void 0;var c=kp.combineUrl(a,e,t);if(!r)return tg(a),u(),!!s&&void 0;if(!e)return zh(a),u(),!!s&&void 0;var l=this.IfShowProgressBar;return a._innerUploadDirectly(c,r,n,l,!1,0,!0,!1,i,u)}},{key:"_innerUploadDirectly",value:function(e,r,t,n,i,o,a,s,u,c){var l,f,d=this,h=d._GetHttpHeadersAndClear(),g="HTTPUploadThroughPostDirectly",m=!1;if(jr.isFunction(u)&&(m=!0),e===undefined||!1===e||""===e)return rg(d),jr.isFunction(c)&&us.runErrWithCatch(c,d),!!m&&void 0;if(!jv.checkProductKey(d,{Core:!0}))return jr.isFunction(c)&&us.runErrWithCatch(c,d),!!m&&void 0;On.cancelFrom=St.HTTPUpload;var p=function(e,r,t){return 0!=e&&r&&(d._errorCode=e,d._errorString=r),t&&(d.__HTTPPostResponseString=t),On.needShowTwiceShowDialog=!1,n&&On.closeProgress(null,g),jr.isFunction(c)&&us.runErrWithCatch(c,d),!1};return On.needShowTwiceShowDialog=!0,n?On.showProgress(d,g,!1):On.hideProgress(),(l=kp.replaceLocalFilename(r))&&""!=l?s&&s.bCancel?(s.st=2,zo(d),p(d._errorCode,d._errorString),!!m&&void 0):(f=v(eG,d,nG).call(d,l,m,i,function(r){if(On.needShowTwiceShowDialog=!1,s&&s.bCancel)return s.st=2,zo(d),p(d._errorCode,d._errorString),!1;if(r&&(!n||n&&On.dlgRef>0||0==m)){r instanceof File?r.fileName=t:r.name=t;var i=new Dd,c=d._createHttpUploaderConfig(),l=new xd;return d.__remoteFilename&&""!=d.__remoteFilename&&(l.remoteFilename=d.__remoteFilename),c.objUploadStatus=s,c.IfShowCancelDialogWhenImageTransfer=n&&d.__IfShowCancelDialogWhenImageTransfer,l.url=e,l.method=g,l.content=r,r=null,l.contentType=d._strHttpContentTypeFieldValue,l.headers=h,l.bAsync=m,l.httpFormData=uG(d.httpFormFields),l.retry=o,l.bOnlyResponseEmptyIsOK=a,l.blockSize=d._moduleSize,i.httpPostUpload(c,l,function(e){return n&&On.closeProgress(null,g),jr.isFunction(u)&&us.runWithCatch(u,e),!0},p)}return tg(d),p(d._errorCode,d._errorString),!1},p),m?void 0:!!f):(tg(d),p(d._errorCode,d._errorString),!!m&&void 0)}},{key:"_innerUploadFilesDirectly",value:function(e,r,t,n,i,o,a,s,u){var c,l=this,f=l._GetHttpHeadersAndClear(),d="HTTPUploadThroughPostDirectly",h=!1,g=[];if(jr.isFunction(s)&&(h=!0),!1===e||""===e)return rg(l),jr.isFunction(u)&&u({code:l._errorCode,message:l._getErrorString(),files:r}),!1;if(!jv.checkProductKey(l,{Core:!0}))return jr.isFunction(u)&&u({code:l._errorCode,message:l._getErrorString(),files:r}),!1;On.cancelFrom=St.HTTPUpload;var m=function(e,t,i){return 0!=e&&t&&(l._errorCode=e,l._errorString=t),i&&(l.__HTTPPostResponseString=i),On.needShowTwiceShowDialog=!1,n&&On.closeProgress(null,d),jr.isFunction(u)&&u({code:l._errorCode,message:l._errorString,response:i,files:r}),!1};On.needShowTwiceShowDialog=!0,n?On.showProgress(l,d,!1):On.hideProgress(),jr.each(r,function(e){var r=kp.replaceLocalFilename(e);if(!r||""==r)return tg(l),m(l._errorCode,l._errorString),!1;g.push(r)});var p=[],_=g.length,y=0;return jr.each(g,function(r,u){c=v(eG,l,nG).call(l,r,h,i,function(r){if(On.needShowTwiceShowDialog=!1,!r||n&&!(n&&On.dlgRef>0)&&0!=h)return n&&On.closeProgress(null,d),Qh(l),jr.isFunction(m)&&m(l._errorCode,l._errorString),!1;var i=Ed(t,u+1);if(r instanceof File?r.fileName=i:r.name=i,p[u]=r,r=null,++y==_){var c=l._createHttpUploaderConfig(),g=new xd;c.IfShowCancelDialogWhenImageTransfer=n&&l.__IfShowCancelDialogWhenImageTransfer,l.__remoteFilename&&""!=l.__remoteFilename&&(g.remoteFilename=l.__remoteFilename),g.url=e,g.method=d,g.content=p,p=null,g.contentType=l._strHttpContentTypeFieldValue,g.headers=f,g.bAsync=h,g.httpFormData=uG(l.httpFormFields),g.retry=o,g.bOnlyResponseEmptyIsOK=a,g.blockSize=l._moduleSize;var v=Pd(c,g,function(e){return n&&On.closeProgress(null,d),jr.isFunction(s)&&us.runWithCatch(s,e),!0},function(e,r,t){return n&&On.closeProgress(null,d),jr.isFunction(m)&&m(e,r,t),!1});return h?void 0:v}},function(){return n&&On.closeProgress(null,d),jr.isFunction(m)&&m(),!1})}),h?void 0:!!c}},{key:"_createHttpUploaderConfig",value:function(){var e=this,r=new Od;return r.IfShowProgressBar=e.IfShowProgressBar,r.IfShowCancelDialogWhenImageTransfer=e.__IfShowCancelDialogWhenImageTransfer,r.MaxUploadImageSize=e.MaxUploadImageSize,r.HTTPRequestswithCredentials=e.HTTPRequestswithCredentials,r.onPercent=function(r){e._OnPercentDone(r)},r.onHttpUploadStatus=function(r){jr.isFunction(e.__OnHttpUploadStatus)&&e.__OnHttpUploadStatus(r)},r}},{key:"SetUploadSegment",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(!jr.isNumber(e)||e<0?(hh(t,-2367,"Invalid value for the parameter segmentUploadThreshold."),!1):!jr.isNumber(r)||r<=0?(function(e){hh(e,-2368,"Invalid value for the parameter moduleSize.")}(t),!1):(t._segementUploadThreshold=1024*e*1024,t._moduleSize=1024*r,!0))}},{key:"ConvertToBase64",value:function(e,r,t,n){var i,o=this,a=arguments,s=!1;if(jr.isFunction(t)&&(s=!0),o._resetErr(),!o._isValid())return jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a),!!s&&void 0;var u=parseInt(r);if(!jv.checkProductKey(o,{Core:!0}))return jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a),!!s&&void 0;if(!o._checkIndices(e))return jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a),!!s&&void 0;if(u==ut.IT_BMP||u==ut.IT_JPG||u==ut.IT_PNG){if(e.length>1)return hh(o,-2361,"You cannot convert more than one image to base64 string when the format is BMP, JPG or PNG."),jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a),!!s&&void 0}else if(u!=ut.IT_TIF&&u!=ut.IT_PDF)return mg(o),jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a),!!s&&void 0;if(0==(i=Lp(o,e)).length)return Bh(o),jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a),!!s&&void 0;On.cancelFrom=St.ConvertToBlob,o._convertToBase64ByServerIdsWithUI("ConvertToBase64",i,u,!1,3,function(e){var n=[];jr.isArray(i)&&jr.each(i,function(e){var r=o._ImgManager.convertServerIdToClientIndex(e);r>-1&&n.push(r)}),jr.isFunction(t)&&us.runWithCatch(t,e,n,r,a)},function(){var e=[];jr.isArray(i)&&jr.each(i,function(r){var t=o._ImgManager.convertServerIdToClientIndex(r);t>-1&&e.push(t)}),jr.isFunction(n)&&us.runErrWithCatch4(n,o,e,r,a)})}},{key:"ClearAllHTTPFormField",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e.httpFormFields={},!0)}},{key:"SetHTTPFormField",value:function(e,r,t){var n=this;if(n._resetErr(),!n._isValid())return!1;var i=e;return jr.isString(i)||(i=""+i),r instanceof Blob&&(r.name=t),n.httpFormFields[i]=r,!0}},{key:"HTTPDownloadThroughPost",value:function(e,r,t,n,i,o){var a,s,u=this,c=u._GetHttpHeadersAndClear(),l=kp.combineUrl(u,e,r),f=!1;if(jr.isFunction(n)&&(f=!0),l===undefined)return rg(u),jr.isFunction(i)&&us.runErrWithCatch(i,u,""),!!f&&void 0;if(!jv.checkProductKey(u,{Core:!0}))return jr.isFunction(i)&&us.runErrWithCatch(i,u,""),!!f&&void 0;if(!jv.checkPDFProductKeyWhenNeeds(u,t))return jr.isFunction(i)&&us.runErrWithCatch(i,u,""),!!f&&void 0;On.cancelFrom=St.HTTPDownload,u.IfShowProgressBar?On.showProgress(u,"HttpDownloadThroughPost",!1):On.hideProgress();u._OnPercentDone([0,-1,yh,"http"]);var d=null===(a=On.progressContext)||void 0===a?void 0:a.IfShowCancelDialogWhenImageTransfer,h=function(){return u.IfShowProgressBar&&On.closeProgress(null,"HttpDownloadThroughPost"),jr.isFunction(n)&&n(),!0},g=function(){return On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=d),u.IfShowProgressBar&&On.closeProgress(null,"HttpDownloadThroughPost"),jr.isFunction(i)&&us.runErrWithCatch(i,u,u.__HTTPPostResponseString),!1};return On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!0),s=kp.loadHttpBlob(u,"post",l,f,function(e){On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=d),u._OnPercentDone([0,-1,vh]);var r=t;r!=ut.IT_BMP&&r!=ut.IT_JPG&&r!=ut.IT_TIF&&r!=ut.IT_PNG&&r!=ut.IT_PDF&&r!=ut.IT_J2K&&(r=-1);var n=u.__GetLoadEventsNum();return u.__LoadImageFromBytesV1(e,r,"",n,f,h,g)},g,function(e){var r=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),r>=100&&e.loaded<e.total&&(r=99),u._OnPercentDone([0,r,"","http"])},c),f?void 0:!!s}},{key:"HTTPDownloadThroughGet",value:function(e,r,t,n,i){return this._innerHTTPDownloadThroughGet("HTTPDownload",e,r,t,n,i)}},{key:"HTTPUploadThroughPut",value:function(e,r,t,n,i){var o=bs(t);return this.HTTPUploadThroughPutEx(e,r,t,o,n,i)}},{key:"HTTPUploadThroughPutEx",value:function(e,r,t,n,i,o){var a=this,s=a._GetHttpHeadersAndClear(),u="HTTPUploadThroughPutEx",c=kp.combineUrl(a,e,t),l=!1,f=[],d=!1,h=this.IfShowProgressBar;if(jr.isFunction(i)&&(l=!0),c===undefined)return rg(a),jr.isFunction(o)&&us.runErrWithCatch4(o,a,"",[r],t,n),!!l&&void 0;On.cancelFrom=St.HTTPPut;var g,v=function(){On.needShowTwiceShowDialog=!1,h&&On.closeProgress(null,u),jr.isFunction(o)&&us.runErrWithCatch4(o,a,a.__HTTPPostResponseString,f,t,n)};switch(On.needShowTwiceShowDialog=!0,h?On.showProgress(a,u,!1):On.hideProgress(),r){case-1:for(var m=0;m<a._ImgManager.count();m++)f.push(m);break;case-2:f=a._ImgManager.getSelectedClientIndexArray();break;default:if(f.push(r),!(r>=0))return gg(a),v(),!!l&&void 0}if(""===e)return zh(a),v(),!!l&&void 0;var p=[];jr.isArray(f)&&jr.each(f,function(e){var r=a._ImgManager.convertClientIndexToServerId(e);-1!=r&&p.push(r)});var _=!1;a._OnPercentDone([0,-1,mh,"http"]);var y=function(e,r,o){if(xn.IfAddMD5InUploadHeader&&r&&""!=r&&(s["dwt-md5"]=r),On.needShowTwiceShowDialog=!1,e&&(!h||h&&On.dlgRef>0||0==l)){var f=a.__maxUploadImageSize;return e.size>f&&-1!=f?(eg(a),v(),!!l&&void 0):(g=function(e){var r=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),r>=100&&e.loaded<e.total&&(r=99),a._OnPercentDone([0,r,"","http"])},a._OnPercentDone([0,-1,Sh,"http"]),h&&Fd(a.__IfShowCancelDialogWhenImageTransfer),On.cancelFrom=St.HTTPPut,d=kp.httpPutImage(a,c,e,l,function(e){if(e&&(a.__HTTPPostResponseString=e),h&&On.closeProgress(null,u),jr.isFunction(i)){var r=[];jr.isArray(p)&&jr.each(p,function(e){var t=a._ImgManager.convertServerIdToClientIndex(e);t>-1&&r.push(t)}),us.runWithCatch(i,a.__HTTPPostResponseString,r,t,n)}return!0},v,g),e=null,l?void 0:!!d)}return e=null,h&&On.closeProgress(null,u),!!l&&void 0};if(!l)return a._dwtConvertToBlobSync(n,p,_,y,v);a._convertToBlobForUpload(n,p,_,4,y,v)}},{key:"HTTPUploadAllThroughPutAsMultiPageTIFF",value:function(e,r,t,n){return this.HTTPUploadThroughPutEx(e,-1,r,2,t,n)}},{key:"HTTPUploadThroughPutAsMultiPageTIFF",value:function(e,r,t,n){return this.HTTPUploadThroughPutEx(e,-2,r,2,t,n)}},{key:"HTTPUploadAllThroughPutAsPDF",value:function(e,r,t,n){return this.HTTPUploadThroughPutEx(e,-1,r,4,t,n)}},{key:"HTTPUploadThroughPutAsMultiPagePDF",value:function(e,r,t,n){return this.HTTPUploadThroughPutEx(e,-2,r,4,t,n)}},{key:"GetSelectedImagesSize",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=Op(r);return r._innerFun("GetSelectedImagesSize",hm(e,t.join(",")))}},{key:"SetHTTPHeader",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n,i,o=e;if(t.__httpHeaderMap||(t.__httpHeaderMap={}),!o||!jr.isString(o))return jr.isUndefined(o)?hh(t,-2356,"The header name cannot be undefined."):""===o?function(e){hh(e,-2354,"The header name cannot be empty.")}(t):null===o?function(e){hh(e,-2355,"The header name cannot be null.")}(t):function(e){hh(e,-2357,"The header name you entered is invalid.")}(t),!1;for(n=["if-none-match","if-range","range","accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"],o=o.toLowerCase(),i=0;i<n.length;i++)if(n[i]==o)return dg(t),!1;return jr.isUndefined(r)||null===r||""===r?(e in t.__httpHeaderMap&&delete t.__httpHeaderMap[e],!0):(jr.isNumber(r)&&(r=""+r),t.__httpHeaderMap[e]=r,!0)}},{key:"ConvertToBlob",value:function(e,r,t,n,i){var o=arguments;return this._convertToBlobByIndices(e,r,!1,o,t,n)}},{key:"_asyncUploadFilesCmd",value:function(e,r,t,n,i,o,a,s,u,c,l,f){var d=this,h=parseInt(i),g="HTTPUpload",v=e,m=[];d.__HTTPPostResponseString="",On.cancelFrom=St.HTTPUpload;var p=function(e,t,n){var i=[];if(jr.isArray(r)&&jr.each(r,function(e){var r=d._ImgManager.convertServerIdToClientIndex(e);r>-1&&i.push(r)}),0!=e&&t&&(d._errorCode=e,d._errorString=t),n&&(d.__HTTPPostResponseString=n),d._bServerPercentDone=!0,On.needShowTwiceShowDialog=!1,s&&On.closeProgress(null,g),m.slice(0),m=null,jr.isFunction(f))try{f({code:d._errorCode,message:d._errorString,response:n,indices:i})}catch(o){}};On.needShowTwiceShowDialog=!0,s?On.showProgress(d,g,!1):On.hideProgress();var _=r.length,y=0,S=0,I="";d._bServerPercentDone=!1,d._OnPercentDone([0,-1,mh,"http"]),jr.each(r,function(e,i){d._convertToBlobForUpload(h,[e],a,4,function(e,a,f){if(!e||e.size<=0)return Zh(d),p(d._errorCode,d._errorString);var h=d.__maxUploadImageSize;if(e.size>h&&-1!=h)return eg(d),p(d._errorCode,d._errorString);var b=Ed(o,i+1);if(S=(y+1)/_*100,I=[y+1,"/",_].join(""),d._OnPercentDone([0,S,I,"http",b]),e.name=b,m.push(e),++y>=_){xn.IfAddMD5InUploadHeader&&a&&""!=a&&(t["dwt-md5"]=a);var C=d._createHttpUploaderConfig(),T=new xd;d.__remoteFilename&&""!=d.__remoteFilename&&(T.remoteFilename=d.__remoteFilename),T.url=v,T.method=g,T.content=m,T.contentType=d._strHttpContentTypeFieldValue,T.headers=t,T.httpFormData=n,T.retry=u,T.bOnlyResponseEmptyIsOK=c,T.blockSize=d._moduleSize,Pd(C,T,function(e){d.__HTTPPostResponseString=C.HTTPPostResponse,function(e){if(d._bServerPercentDone=!0,On.needShowTwiceShowDialog=!1,s&&On.closeProgress(null,g),m.slice(0),m=null,jr.isFunction(l)){var t=[];jr.isArray(r)&&jr.each(r,function(e){var r=d._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)}),us.runWithCatch(l,e,t)}}(e)},p)}e=null},p,[e,i])})}},{key:"_getVersionInfoAsync",value:function(){return xc.versionInfoFromServer?Promise.resolve(xc.versionInfoFromServer):this._innerFunV2("VersionInfo")}},{key:"__innerLoadImage",value:function(e,r,t,n,i,o,a,s){var u,c=this,l=!1;if((jr.isFunction(a)||xn.ConnectWithSocket)&&(l=!0),!jv.checkProductKey(c,{Core:!0}))return jr.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}),l?void 0:(r=null,!1);if(!jv.checkPDFProductKeyWhenNeeds(c,n))return jr.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}),l?void 0:(r=null,!1);if(n==ut.IT_MULTIPAGE_PDF||n==ut.IT_MULTIPAGE_TIF)return mg(c),jr.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}),l?void 0:(r=null,!1);if(u=r,l){if(c._bRemoteMode&&c._getIfShowFileDialog())return u=null,r=null,Ug(c),void(jr.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}));var f=xn.IfConfineMaskWithinTheViewer,d=c.Viewer;d&&d.webViewer&&d.webViewer.imageEditor&&d.webViewer.imageEditor.inner&&1==d.webViewer.imageEditor.inner.bShowImageEditor&&d.webViewer.imageEditor.inner.bShowImageEditor&&(xn.IfConfineMaskWithinTheViewer=!1);var h=c.IfShowCancelDialogWhenImageTransfer;return c.IfShowCancelDialogWhenImageTransfer=!1,c.__bLoadingImage=!0,void c.__innerAcquireOrLoadImageAsync(e,t,i,!0).then(function(){c.IfShowCancelDialogWhenImageTransfer=h,xn.IfConfineMaskWithinTheViewer=f,u=null,r=null,jr.isFunction(a)&&a()},function(t){if(c.IfShowCancelDialogWhenImageTransfer=h,xn.IfConfineMaskWithinTheViewer=f,c._errorCode=t.code,c._errorString=t.message,("LoadImage"==e||"LoadImageEx"==e)&&c.__OnPostLoad&&!c.__bServerOnPostLoadFired){var i=kp.getFilePath(u),o=kp.getFileName(u);c.__OnPostLoad(i,o,n)}u=null,r=null,jr.isFunction(s)&&s(t)})}if(c._bRemoteMode&&c._getIfShowFileDialog())return u=null,r=null,Ug(c),!1;var g=c._getCurrentDocumentName(),v=c._getCurrentDefaultTagName(),m=c.__innerLoadImageFun(e,t,o,g,v);if(m&&jr.isString(u)&&""!=u&&c.__OnPostLoad&&!c.__bServerOnPostLoadFired){var p=kp.getFilePath(u),_=kp.getFileName(u);setTimeout(function(){c.__bServerOnPostLoadFired||c.__OnPostLoad&&c.__OnPostLoad(p,_,n)},10)}return u=null,r=null,m}},{key:"__innerLoadImageFun",value:function(e,r,t,n,i){var o,a=this,s=!0;if(o=a._innerFunRaw(e,r,!1,!1,!0),a.__bOpenFileNow=!1,0!=a._errorCode)return!1;if(o&&jr.isArray(o.result)&&o.result.length>0){if(t){var u;if("FTPDownload"==e||"FTPDownloadEx"==e)u=JSON.stringify(o.result);else{var c=o.result[0];jr.isObject(c)?u=c.imageInfos:-1!=c||"LoadImage"!=e&&"LoadImageEx"!=e&&"LoadImageFromBase64Binary"!=e&&"LoadDibFromClipboard"!=e||(s=!1)}jr.isString(u)&&a._handleOnBitmapChangedEvent({result:["c1",u]},{document:n,tag:i})}else{var l=o.result.join(",");a._OnBitmapChanged(["c1",l,1,a._ImgManager.getCurrentImageIndex(),a._ImgManager.count()],null,{document:n,tag:i})}if(s)return a._canConsume()&&xn.lcvrf(a),!0}return wm(a._errorCode)&&ug(a),!1}},{key:"__innerSaveImage",value:function(e,r,t,n){var i,o=this,a=!1;if(jr.isFunction(t)&&(a=!0),a&&o._OnPercentDone([0,-1,mh]),o._bRemoteMode||(xn.IfAlwaysFocusOnPopupWindow?o._OnPageFocus(!0):o._OnPageBlur(!0)),0==a)return o._bRemoteMode?o._serviceSyncMethodNotSupport(e):this._innerFun(e,r);if(o._bRemoteMode&&o._getIfShowFileDialog())return Ug(o),void(jr.isFunction(n)&&n(o._errorCode,o._getErrorString()));var s=null===(i=On.progressContext)||void 0===i?void 0:i.IfShowCancelDialogWhenImageTransfer;o.IfShowProgressBar?On.showProgress(o,e,!1):On.hideProgress(),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1),o._innerSend(e,r,!0,function(){a&&("SaveAsPNG"!=e&&"SaveAsJPEG"!=e&&"SaveAsBMP"!=e&&"SaveAsBMP"!=e||o._OnPercentDone([0,100,"","http"])),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=s),setTimeout(function(){On.closeProgress(null,e)},0),jr.isFunction(t)&&t()},function(r){return On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=s),jr.isFunction(n)&&n(o._errorCode,o._getErrorString()),On.closeProgress(null,e),r&&jr.error(r),!1})}},{key:"__captureImage",value:function(e,r,t,n){var i=this.__GetLoadEventsNum();return this.__LoadImageFromBytesV2(e,r,"",!0,0,0,!0,i,t,n)}},{key:"_getIfShowFileDialog",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("IfShowFileDialog")}},{key:"SaveAsBMP",value:function(e,r,t,n){var i=this,o=!1;if((jr.isFunction(t)||se.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!(jv.checkProductKey(i,{Core:!0})||se.bWin&&jv.checkProductKey(i,{Webcam:!0},!0)))return jv.checkProductKey(i,{Core:!0},!1),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a,s=kp.replaceLocalFilename(e);if(!xp(i,r,n))return!!o&&void 0;if(se.bAndroid){if(0==i._ImgManager.count())return Vh(i),void(jr.isFunction(n)&&us.runErrWithCatch(n,i));var u=[];return u.push(r),void i._saveImages("SaveAsBMP",s,u,ut.IT_BMP).then(function(){jr.isFunction(t)&&t()})["catch"](function(e){jr.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(r)))return gg(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsBMP",hm(s,a,c),t,n);return o?void 0:l}},{key:"SaveAsJPEG",value:function(e,r,t,n){var i=this,o=!1;if((jr.isFunction(t)||se.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!(jv.checkProductKey(i,{Core:!0})||se.bWin&&jv.checkProductKey(i,{Webcam:!0},!0)))return jv.checkProductKey(i,{Core:!0},!1),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!xp(i,r,n))return!!o&&void 0;var a,s=kp.replaceLocalFilename(e);if(se.bAndroid){if(0==i._ImgManager.count())return Vh(i),void(jr.isFunction(n)&&us.runErrWithCatch(n,i));var u=[];return u.push(r),void i._saveImages("SaveAsJPEG",s,u,ut.IT_JPG).then(function(){jr.isFunction(t)&&t()})["catch"](function(e){jr.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(r)))return gg(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsJPEG",hm(s,a,c),t,n);return o?void 0:l}},{key:"SaveAsPDF",value:function(e,r,t,n){var i=this,o=!1;if((jr.isFunction(t)||se.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!(jv.checkProductKey(i,{Core:!0})||se.bWin&&jv.checkProductKey(i,{Webcam:!0},!0)))return jv.checkProductKey(i,{Core:!0},!1),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!xp(i,r,n))return!!o&&void 0;var a,s=kp.replaceLocalFilename(e);if(se.bAndroid){if(0==i._ImgManager.count())return Vh(i),void(jr.isFunction(n)&&us.runErrWithCatch(n,i));var u=[];return u.push(r),void i._saveImages("SaveSelectedImagesAsMultiPagePDF",s,u,ut.IT_PDF).then(function(){jr.isFunction(t)&&t()})["catch"](function(e){jr.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(r)))return gg(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var c=[a],l=i.__GetLoadEventsNum(),f=i.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",hm(s,c.join(","),l),t,n);return o?void 0:f}},{key:"SaveAsPNG",value:function(e,r,t,n){var i=this,o=!1;if((jr.isFunction(t)||se.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!(jv.checkProductKey(i,{Core:!0})||se.bWin&&jv.checkProductKey(i,{Webcam:!0},!0)))return jv.checkProductKey(i,{Core:!0},!1),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!xp(i,r,n))return!!o&&void 0;var a,s=kp.replaceLocalFilename(e);if(se.bAndroid){if(0==i._ImgManager.count())return Vh(i),void(jr.isFunction(n)&&us.runErrWithCatch(n,i));var u=[];return u.push(r),void i._saveImages("SaveAsPNG",s,u,ut.IT_PNG).then(function(){jr.isFunction(t)&&t()})["catch"](function(e){jr.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(r)))return gg(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsPNG",hm(s,a,c),t,n);return o?void 0:l}},{key:"SaveAsTIFF",value:function(e,r,t,n){var i=this,o=!1;if((jr.isFunction(t)||se.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!(jv.checkProductKey(i,{Core:!0})||se.bWin&&jv.checkProductKey(i,{Webcam:!0},!0)))return jv.checkProductKey(i,{Core:!0},!1),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!xp(i,r,n))return!!o&&void 0;var a,s=kp.replaceLocalFilename(e);if(se.bAndroid){if(0==i._ImgManager.count())return Vh(i),void(jr.isFunction(n)&&us.runErrWithCatch(n,i));var u=[];return u.push(r),void i._saveImages("SaveAsTIFF",s,u,ut.IT_TIF).then(function(){jr.isFunction(t)&&t()})["catch"](function(e){jr.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(r)))return gg(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsTIFF",hm(s,a,c),t,n);return o?void 0:l}},{key:"SaveSelectedImagesAsMultiPagePDF",value:function(e,r,t){var n=this,i=!1;if((jr.isFunction(r)||se.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;if(!(jv.checkProductKey(n,{Core:!0})||se.bWin&&jv.checkProductKey(n,{Webcam:!0},!0)))return jv.checkProductKey(n,{Core:!0},!1),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var o=kp.replaceLocalFilename(e);if(!se.bAndroid){var a=Op(n);if(0==a.length)return Vh(n),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",hm(o,a.join(","),s),r,t);return i?void 0:u}if(0==n._ImgManager.count())return Vh(n),void(jr.isFunction(t)&&us.runErrWithCatch(t,n));var c=Np(n);n._saveImages("SaveSelectedImagesAsMultiPagePDF",o,c,ut.IT_PDF).then(function(){jr.isFunction(r)&&r()})["catch"](function(e){jr.isFunction(t)&&t(e.code,e.message)})}},{key:"SaveSelectedImagesAsMultiPageTIFF",value:function(e,r,t){var n=this,i=!1;if((jr.isFunction(r)||se.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;if(!(jv.checkProductKey(n,{Core:!0})||se.bWin&&jv.checkProductKey(n,{Webcam:!0},!0)))return jv.checkProductKey(n,{Core:!0},!1),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var o=kp.replaceLocalFilename(e);if(!se.bAndroid){var a=Op(n);if(0==a.length)return Vh(n),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPageTIFF",hm(o,a.join(","),s),r,t);return i?void 0:u}if(0==n._ImgManager.count())return Vh(n),void(jr.isFunction(t)&&us.runErrWithCatch(t,n));var c=Np(n);n._saveImages("SaveSelectedImagesAsMultiPageTIFF",o,c,ut.IT_TIF).then(function(){jr.isFunction(r)&&r()})["catch"](function(e){jr.isFunction(t)&&t(e.code,e.message)})}},{key:"SaveAllAsMultiPageTIFF",value:function(e,r,t){var n=this,i=!1;if((jr.isFunction(r)||se.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;if(!(jv.checkProductKey(n,{Core:!0})||se.bWin&&jv.checkProductKey(n,{Webcam:!0},!0)))return jv.checkProductKey(n,{Core:!0},!1),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;if(!Dp(n,t))return!!i&&void 0;var o=[],a=kp.replaceLocalFilename(e);if(!se.bAndroid){if(Fp(n,o),0==o.length)return Vh(n),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPageTIFF",hm(a,o.join(","),s),r,t);return i?void 0:u}if(0==n._ImgManager.count())return Vh(n),void(jr.isFunction(t)&&us.runErrWithCatch(t,n));for(var c=[],l=0;l<this._ImgManager.count();l++)c.push(l);n._saveImages("SaveAllAsMultiPageTIFF",a,c,ut.IT_TIF).then(function(){jr.isFunction(r)&&r()})["catch"](function(e){jr.isFunction(t)&&t(e.code,e.message)})}},{key:"SaveAllAsPDF",value:function(e,r,t){var n=this,i=!1;if((jr.isFunction(r)||se.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;if(!(jv.checkProductKey(n,{Core:!0})||se.bWin&&jv.checkProductKey(n,{Webcam:!0},!0)))return jv.checkProductKey(n,{Core:!0},!1),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;if(!Dp(n,t))return!!i&&void 0;var o=[],a=kp.replaceLocalFilename(e);if(!se.bAndroid){if(Fp(n,o),0==o.length)return Vh(n),jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",hm(a,o.join(","),s),r,t);return i?void 0:u}if(0==n._ImgManager.count())return Vh(n),void(jr.isFunction(t)&&us.runErrWithCatch(t,n));for(var c=[],l=0;l<this._ImgManager.count();l++)c.push(l);n._saveImages("SaveAllAsPDF",a,c,ut.IT_PDF).then(function(){jr.isFunction(r)&&r()})["catch"](function(e){jr.isFunction(t)&&t(e.code,e.message)})}},{key:"HTTPUpload",value:function(e,r,t,n,i,o,a){var s=this,u=null!=i?i:"RemoteFile",c=s._GetHttpHeadersAndClear(),l=o,f=a;if(s._resetErr(),arguments.length<=3)return l=r,f=t,void this._innerFormFieldHTTPUpload(e,c,l,f);if(jr.isFunction(arguments[4])&&jr.isFunction(arguments[5])&&(u="RemoteFile",l=arguments[4],arguments.length>5&&(f=arguments[5])),s._isValid()){var d,h=arguments,g=function(e){jr.isFunction(f)&&us.runErrWithCatch4(f,s,s.__HTTPPostResponseString,e,h)};if(jr.isUndefined(e)||""===e)return rg(s),void(g&&g(r));if(!jr.isString(e))return _g(s),void(g&&g(r));if(s._checkIndices(r)){var v=Lp(s,r);if(0==v.length)return Bh(s),void(g&&g(r));if(jr.isUndefined(t))return mg(s),void(g&&g(r));if(t==ut.IT_BMP||t==ut.IT_JPG||t==ut.IT_PNG){if(v.length>1)return lg(s),void g(r)}else if(t!=ut.IT_TIF&&t!=ut.IT_PDF)return mg(s),void g(r);if(jr.isUndefined(n)||n!=mt.Binary&&n!=mt.Base64)return pg(s),void g(r);d={method:"HTTPUpload",url:e,serverIds:v,headers:c,formData:uG(s.httpFormFields),enumImageType:t,saveSetup:!1,dataFormat:n,fileName:u,retry:0,bOnlyResponseEmptyIsOK:!0,objUploadFileStatus:undefined,asyncSuccessFunc:function(e,r){jr.isFunction(l)&&us.runWithCatch(l,s.__HTTPPostResponseString,r,h)},asyncFailureFunc:g},this._asyncUploadCmd(d)}else g&&g(r)}else jr.isFunction(f)&&us.runErrWithCatch(f,s,"")}},{key:"_innerFormFieldHTTPUpload",value:function(e,r,t,n){var i,o=this,a="HTTPUpload",s=e,u=o.IfShowProgressBar;if(o._isValid()){if(jr.isUndefined(s)||""===s)return rg(o),void(jr.isFunction(n)&&us.runErrWithCatch(n,o,""));if(!jr.isString(s))return _g(o),void(jr.isFunction(n)&&us.runErrWithCatch(n,o,""));0!=s.indexOf("http://")&&0!=s.indexOf("https://")&&(s=this._bSSL?"https://"+s:"http://"+s),o.__HTTPPostResponseString="",On.cancelFrom=St.HTTPUpload,i=function(e,r,t){0!=e&&r&&(o._errorCode=e,o._errorString=r),t&&(o.__HTTPPostResponseString=t),On.needShowTwiceShowDialog=!1,On.closeProgress(null,a),jr.isFunction(n)&&us.runErrWithCatch(n,o,o.__HTTPPostResponseString)},u?On.showProgress(o,a,!1):On.hideProgress(),On.needShowTwiceShowDialog=!0,o._OnPercentDone([0,-1,Sh,"http"]);var c=o._createHttpUploaderConfig(),l=new xd;o.__remoteFilename&&""!=o.__remoteFilename&&(l.remoteFilename=o.__remoteFilename),l.url=s,l.method=a,l.content=[],l.headers=r,l.httpFormData=uG(o.httpFormFields),l.blockSize=o._moduleSize,(new Dd).httpPostUpload(c,l,function(r){On.needShowTwiceShowDialog=!1,On.closeProgress(null,a),jr.isFunction(t)&&us.runWithCatch(t,r,e,[e,t,n])},i)}else jr.isFunction(n)&&us.runErrWithCatch(n,o,"")}},{key:"HTTPUploadThroughPost",value:function(e,r,t,n,i,o,a){var s=this,u=!1;if(jr.isFunction(i)&&(u=!0),s._resetErr(),!s._isValid())return!!u&&void 0;var c=bs(n),l=arguments,f=!1,d=function(e){return jr.isFunction(o)&&us.runErrWithCatch4(o,s,s.__HTTPPostResponseString,e,l),!1};return jr.isString(n)&&""!=n?(i&&jr.isFunction(i)&&(f=function(e,r){return us.runWithCatch(i,s.__HTTPPostResponseString,r,l),!0}),sG(s,r,c,d)?v(eG,s,tG).call(s,e,r,t,n,c,f,d,a):!!u&&void 0):(Zh(s),d(),!!u&&void 0)}},{key:"HTTPUploadThroughPostEx",value:function(e,r,t,n,i,o,a,s){var u=this,c=!1;if(jr.isFunction(o)&&(c=!0),u._resetErr(),!u._isValid())return jr.isFunction(a)&&us.runErrWithCatch4(a,u,""),!!c&&void 0;var l=arguments,f=!1,d=function(e){jr.isFunction(a)&&us.runErrWithCatch4(a,u,u.__HTTPPostResponseString,e,l)};return jr.isString(n)&&""!=n?(o&&jr.isFunction(o)&&(f=function(e,r){us.runWithCatch(o,u.__HTTPPostResponseString,r,l)}),sG(u,r,i,d)?v(eG,u,tG).call(u,e,r,t,n,i,f,d,s):!!c&&void 0):(Zh(u),d(),!!c&&void 0)}},{key:"HTTPUploadAllThroughPostAsMultiPageTIFF",value:function(e,r,t,n,i,o){var a=this,s=!1;if(jr.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return jr.isFunction(i)&&us.runErrWithCatch4(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){jr.isFunction(i)&&us.runErrWithCatch4(i,a,a.__HTTPPostResponseString,e,u)};return jr.isString(t)&&""!=t?(s&&(c=function(e,r){us.runWithCatch(n,a.__HTTPPostResponseString,r,u)}),v(eG,a,tG).call(a,e,-1,r,t,2,c,l,o)):(Zh(a),l(),!!s&&void 0)}},{key:"HTTPUploadAllThroughPostAsPDF",value:function(e,r,t,n,i,o){var a=this,s=!1;if(jr.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return jr.isFunction(i)&&us.runErrWithCatch(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){return jr.isFunction(i)&&us.runErrWithCatch4(i,a,a.__HTTPPostResponseString,e,u),!1};return jr.isString(t)&&""!=t?(s&&(c=function(e,r){us.runWithCatch(n,a.__HTTPPostResponseString,r,u)}),v(eG,a,tG).call(a,e,-1,r,t,4,c,l,o)):(Zh(a),l())}},{key:"HTTPUploadThroughPostAsMultiPagePDF",value:function(e,r,t,n,i,o){var a=this,s=!1;if(jr.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return jr.isFunction(i)&&us.runErrWithCatch(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){jr.isFunction(i)&&us.runErrWithCatch4(i,a,a.__HTTPPostResponseString,e,u)};return jr.isString(t)&&""!=t?(s&&(c=function(e,r){us.runWithCatch(n,a.__HTTPPostResponseString,r,u)}),v(eG,a,tG).call(a,e,-2,r,t,4,c,l,o)):(Zh(a),l(),!!s&&void 0)}},{key:"HTTPUploadThroughPostAsMultiPageTIFF",value:function(e,r,t,n,i,o){var a=this,s=!1;if(jr.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return jr.isFunction(i)&&us.runErrWithCatch(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){jr.isFunction(i)&&us.runErrWithCatch4(i,a,a.__HTTPPostResponseString,e,u)};return jr.isString(t)&&""!=t?(s&&(c=function(e,r){us.runWithCatch(n,a.__HTTPPostResponseString,r,u)}),v(eG,a,tG).call(a,e,-2,r,t,2,c,l,o)):(Zh(a),l(),!!s&&void 0)}},{key:"_innerHTTPDownloadThroughGet",value:function(e,r,t,n,i,o){var a,s,u=this,c=u._GetHttpHeadersAndClear(),l=u.IfShowProgressBar,f=kp.combineUrl(u,r,t),d=!1;if(jr.isFunction(i)&&(d=!0),f===undefined)return rg(u),jr.isFunction(o)&&us.runErrWithCatch(o,u),!!d&&void 0;if(!jv.checkProductKey(u,{Core:!0}))return jr.isFunction(o)&&us.runErrWithCatch(o,u),!!d&&void 0;if(!jv.checkPDFProductKeyWhenNeeds(u,n))return jr.isFunction(o)&&us.runErrWithCatch(o,u),!!d&&void 0;On.cancelFrom=St.HTTPDownload;var h=null===(a=On.progressContext)||void 0===a?void 0:a.IfShowCancelDialogWhenImageTransfer,g=u._getCurrentDocumentName(),v=u._getCurrentDefaultTagName();return jr.log("_innerHTTPDownloadThroughGet.currentFileName:"+g+", tag="+v),l&&d?(u.__IfShowCancelDialogWhenImageTransfer&&(On.progressContext.__cancelBeforObjectCreated=!0),On.showProgress(u,e,u.__IfShowCancelDialogWhenImageTransfer)):d&&On.hideProgress(),u._OnPercentDone([0,-1,yh,"http"]),s=kp.loadHttpBlob(u,"get",f,d,function(r){On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=h),l&&d&&Fd(!1),u._OnPercentDone([0,-1,vh]);var a=n;a!=ut.IT_BMP&&a!=ut.IT_JPG&&a!=ut.IT_TIF&&a!=ut.IT_PNG&&a!=ut.IT_PDF&&a!=ut.IT_J2K&&(a=-1);var s=u.__GetLoadEventsNum(),c=kp.getFileName(t);return r.currentFileName=g,r.currentTagName=v,r.name=c,u._loadImageBytesFileCount+=1,u.__LoadImageFromBytesV1(r,a,"",s,d,function(){if(l&&d&&On.closeProgress(null,e),u._loadImageBytesFileCount-=1,u.__OnPostLoad&&!u.__bServerOnPostLoadFired){var r=kp.getFilePath(f);u.__OnPostLoad(r,c,a)}return c=null,jr.isFunction(i)&&i(),!0},function(){if(l&&d&&On.closeProgress(null,e),u._loadImageBytesFileCount-=1,u.__OnPostLoad&&!u.__bServerOnPostLoadFired){var r=kp.getFilePath(f);u.__OnPostLoad(r,c,a)}return c=null,jr.isFunction(o)&&us.runErrWithCatch(o,u),!1})},function(){On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=h),l&&d&&On.closeProgress(null,e);var r=kp.getFileName(t);if(u.__OnPostLoad&&!u.__bServerOnPostLoadFired){var i=kp.getFilePath(f);u.__OnPostLoad(i,r,n)}return jr.isFunction(o)&&us.runErrWithCatch(o,u),!1},function(e){var r=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),r>=100&&e.loaded<e.total&&(r=99),u._OnPercentDone([0,r,"","http"])},c),d?void 0:!!s}},{key:"LoadImage",value:function(e,r,t){var n=this,i=!1,o=n.__bServerOnPostLoadFired;if(n._resetErr(),!jr.isFunction(r)||(i=!0,!o)){if(!n._isValid())return jr.isFunction(t)&&us.runErrWithCatch(t,n),!!i&&void 0;var a,s,u,c=kp.replaceLocalFilename(e),l=bs(c);r&&jr.isFunction(r)&&(s=function(e){r()}),t&&jr.isFunction(t)&&(u=function(e){t(e.code,e.message)}),a=n.__GetLoadEventsNum(),""==c&&(n.__bOpenFileNow=!0);var f=n._getCurrentDocumentName(),d=n._getCurrentDefaultTagName();return n.__innerLoadImage("LoadImage",e,hm(c,a,1,f,d),l,!0,1,s,u)}setTimeout(function(){n.LoadImage(e,r,t)},10)}},{key:"LoadImageEx",value:function(e,r,t,n){var i=this,o=!1,a=i.__bServerOnPostLoadFired;if(i._resetErr(),jr.isFunction(t)&&(o=!0,a))setTimeout(function(){i.LoadImageEx(e,r,t,n)},10);else{if(!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var s,u,c,l=kp.replaceLocalFilename(e),f=r;if(t&&jr.isFunction(t)&&(u=function(e){t()}),n&&jr.isFunction(n)&&(c=function(e){n(e.code,e.message)}),!se.bAndroid){f==ut.IT_ALL&&(f=-1),s=i.__GetLoadEventsNum(),""==l&&(i.__bOpenFileNow=!0);var d=i._getCurrentDocumentName(),h=i._getCurrentDefaultTagName();return i.__innerLoadImage("LoadImageEx",e,hm(l,f,s,1,d,h),f,!0,1,u,c)}var g=Cs.one(".d-loadImage");if(0==g.length){var v=document.createElement("input");v._stwain=i,v.setAttribute("type","file"),v.setAttribute("multiple","multiple"),v.style.position="absolute",v.style.top="-9999px",v.style.left="-9999px",v.style.width="1px",v.style.height="1px",v.className="d-loadImage",r==ut.IT_BMP?v.setAttribute("accept","image/bmp"):r==ut.IT_JPG?v.setAttribute("accept","image/jpeg"):r==ut.IT_TIF?v.setAttribute("accept","image/tiff"):r==ut.IT_PNG?v.setAttribute("accept","image/png"):r==ut.IT_PDF?v.setAttribute("accept",".pdf"):r==ut.IT_J2K?v.setAttribute("accept",".jp2,.j2k,.j2c"):Yv.bMobile?v.setAttribute("accept","image/jpeg,image/png,image/tiff,image/tif"):v.setAttribute("accept","image/*,.pdf,.jp2,.j2k,.j2c"),v.ondoubleclick=function(){this.files.length>0&&this._stwain._x1_LoadImageFromBinary(this.files,u,c),this.value="",this._stwain=null,v&&v.parentElement.removeChild(v)},v.onchange=function(){this.files.length>0&&this._stwain._x1_LoadImageFromBinary(this.files,u,c),this.value="",this._stwain=null,v&&v.parentElement.removeChild(v)},document.body.appendChild(v),v.click()}else r==ut.IT_BMP?g[0].setAttribute("accept","image/bmp"):r==ut.IT_JPG?g[0].setAttribute("accept","image/jpeg"):r==ut.IT_TIF?g[0].setAttribute("accept","image/tiff"):r==ut.IT_PNG?g[0].setAttribute("accept","image/png"):r==ut.IT_PDF?g[0].setAttribute("accept",".pdf"):r==ut.IT_J2K?g[0].setAttribute("accept",".jp2,.j2k,.j2c"):Yv.bMobile?g[0].setAttribute("accept","image/jpeg,image/png,image/tiff,image/tif"):g[0].setAttribute("accept","image/*,.pdf,.jp2,.j2k,.j2c"),g[0].value="",g[0]._stwain=i,g[0].click()}}},{key:"HTTPDownload",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a=bs(r);return i._innerHTTPDownloadThroughGet("HTTPDownload",e,r,a,t,n)}},{key:"HTTPDownloadEx",value:function(e,r,t,n,i){var o=this,a=!1;return jr.isFunction(n)&&(a=!0),o._resetErr(),o._isValid()?o._innerHTTPDownloadThroughGet("HTTPDownloadEx",e,r,t,n,i):(jr.isFunction(i)&&us.runErrWithCatch(i,o),!!a&&void 0)}},{key:"getFormateDate",value:function(){var e=new Date,r=e.getFullYear(),t=e.getMonth()+1,n=e.getDate(),i=e.getHours(),o=e.getMinutes(),a=e.getSeconds();return t<=9&&(t="0"+t),n<=9&&(n="0"+n),i<=9&&(i="0"+i),o<=9&&(o="0"+o),a<=9&&(a="0"+a),{currentTime_title:r+"-"+t+"-"+n+" "+i+":"+o+":"+a,currentTime_info:t+"/"+n+"/"+r+" "+i+":"+o+":"+a}}},{key:"__shareImagesInner",value:function(e,r,t,n){var i=navigator;i.canShare&&i.canShare({files:e})&&i.share({files:e,title:r,text:this.getFormateDate().currentTime_info}).then(function(){jr.isFunction(t)&&t()})["catch"](function(e){jr.isFunction(n)&&n(e)})}},{key:"ShareImages",value:(n=p(d().m(function i(e,t,n){var o,a,s,u,c,l,f,h,g,v;return d().w(function(i){for(;;)switch(i.n){case 0:if(o=this,!se.bAndroid){i.n=12;break}if(n!=ut.IT_ALL&&n!=ut.IT_MULTIPAGE_PDF&&n!=ut.IT_MULTIPAGE_TIF){i.n=1;break}throw Yg(o),{code:o._errorCode,message:o._errorString};case 1:if(a=t.sort(function(e,r){return e-r}),!(a.length>0)){i.n=11;break}if(s="IMAGE File",n==ut.IT_PDF&&(s="PDF File"),u=DH(e,n),jr.isUndefined(u)&&(u=e),n!=ut.IT_PDF&&n!=ut.IT_TIF){i.n=2;break}return i.a(2,new Promise(function(e,r){o.ConvertToBlob(a,n,function(t,n,i){var a=[new File([t],u,{type:t.type})];o.__shareImagesInner(a,s,function(){e()},function(e){r({code:0!=e.code?e.code:2201,message:e.message})})},function(){r({code:o._errorCode,message:o._errorString})})}));case 2:c=[],l=u,v=n,i.n=v===ut.IT_BMP?3:v===ut.IT_JPG?4:v===ut.IT_PNG?5:6;break;case 3:return f=".bmp",i.a(3,7);case 4:return f=".jpg",i.a(3,7);case 5:return f=".png",i.a(3,7);case 6:f=".jpg";case 7:u&&u.lastIndexOf(".")>0&&(l=u.substring(0,u.lastIndexOf(".")),f=u.substring(u.lastIndexOf("."),u.length)),h=d().m(function m(e){return d().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,new Promise(function(r,t){o.ConvertToBlob([a[e]],n,function(t,n,i){0==e?c.push(new File([t],l+f,{type:t.type})):c.push(new File([t],l+e+f,{type:t.type})),r()},function(){t({code:o._errorCode,message:o._errorString})})});case 1:return r.a(2)}},m)}),g=0;case 8:if(!(g<a.length)){i.n=10;break}return i.d(r(h(g)),9);case 9:g++,i.n=8;break;case 10:o.__shareImagesInner(c,s);case 11:i.n=13;break;case 12:throw zg(o),{code:o._errorCode,message:o._errorString};case 13:return i.a(2)}},i,this)})),function(e,r,t){return n.apply(this,arguments)})},{key:"Addon",get:function(){return this.__addon}},{key:"LoadDibFromClipboard",value:function(e,r){var t=this,n=!1,i=t.__bServerOnPostLoadFired;if(t._resetErr(),!jr.isFunction(e)||(n=!0,!i)){if(!t._isValid())return jr.isFunction(r)&&us.runErrWithCatch(r,t),!!n&&void 0;if(t._bRemoteMode)return hh(t,-2609,"LoadDibFromClipboard is not supported when Object is created by CreateRemoteScanObjectAsync."),jr.isFunction(r)&&us.runErrWithCatch(r,t),!!n&&void 0;var o,a;e&&jr.isFunction(e)&&(o=function(r){e()}),r&&jr.isFunction(r)&&(a=function(e){r(e.code,e.message)});var s;return s=t.__GetLoadEventsNum(),t.__innerLoadImage("LoadDibFromClipboard","",hm(s,1),-1,!0,1,o,a)}setTimeout(function(){t.LoadDibFromClipboard(e,r)},10)}},{key:"__innerGetBarcodeResultAsyncFunction",value:function(e){var r=On.NewBarcodeResult();return e&&(r._errorCode=e.exception,r._errorString=e.description,r._resultlist=e.result,r._Count=e.result.length),r}},{key:"__innerGetOCRResultAsyncFunction",value:function(e){var r=On.NewOCRResult(this);return e&&(r._errorCode=e.exception,r._errorString=e.description,r._resultlist=e.result),r}},{key:"__innerFTPUpload",value:function(e,r,t,n){return On.cancelFrom=St.FTPUpload,v(eG,this,oG).call(this,e,r,!0,t,n)}},{key:"_GetHttpHeadersAndClear",value:function(){var e=this.__httpHeaderMap;return this.__httpHeaderMap={},e||(e={}),e}},{key:"_asyncUploadCmd",value:function(e){var r,n=this,i=e.url,o=e.asyncSuccessFunc,a=e.asyncFailureFunc,s=n.IfShowCancelDialogWhenImageTransfer,u=null===(r=On.progressContext)||void 0===r?void 0:r.IfShowCancelDialogWhenImageTransfer,c=e.method,l=e.serverIds,f=e.headers,d=e.formData,h=e.enumImageType,g=e.dataFormat,v=e.fileName,m=e.saveSetup,p=e.retry,_=e.bOnlyResponseEmptyIsOK,y=e.objUploadFileStatus;return jr.isNumber(p)&&p>0||(p=0),n.__HTTPPostResponseString="",n.IfShowCancelDialogWhenImageTransfer=!0,On.progressContext.IfShowCancelDialogWhenImageTransfer=n.IfShowCancelDialogWhenImageTransfer,t._innerHTTPUpload(n,c,i,f,d,l,h,g,v,m,p,_,y,function(e){if(n.IfShowCancelDialogWhenImageTransfer=s,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=u),jr.isFunction(o)){var r=[];jr.isArray(l)&&jr.each(l,function(e){var t=n._ImgManager.convertServerIdToClientIndex(e);t>-1&&r.push(t)});try{us.runWithCatch(o,e,r)}catch(t){}e=null}return!0},function(e,r,t,i){n.IfShowCancelDialogWhenImageTransfer=s,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=u);var o=[];if(jr.isArray(l)&&jr.each(l,function(e){var r=n._ImgManager.convertServerIdToClientIndex(e);r>-1&&o.push(r)}),0!=e&&r&&(n._errorCode=e,n._errorString=r),t&&(n.__HTTPPostResponseString=t),jr.isFunction(a))try{a(o)}catch(c){}return!1})}}],[{key:"_innerHTTPUpload",value:function(e,r,t,n,i,o,a,s,u,c,l,f,d,h,g){var v=parseInt(a),m=parseInt(s),p=u,_=t,y=e._segementUploadThreshold;if(jr.isUndefined(a))return mg(e),jr.isFunction(g)&&g(e._errorCode,e._errorString,""),!1;e._resetErr(),On.cancelFrom=St.HTTPUpload;var S,I=function(t,n,i,o){return 0!=t&&n&&(e._errorCode=t,e._errorString=n),i&&(e.__HTTPPostResponseString=i),On.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&On.closeProgress(null,r),jr.isFunction(g)&&g(e._errorCode,e._errorString,e.__HTTPPostResponseString,o),!1},b=e._createHttpUploaderConfig();if(b.objUploadStatus=d,p=DH(p,v),On.needShowTwiceShowDialog=!0,e.IfShowProgressBar?(On.showProgress(e,r,!1),On.progressContext&&(On.progressContext._onPercent=function(e){var r=0;if(e){var t,n;t=e.loaded,n=e.total,(r=Math.floor(t/n*100))>100&&(r=100)}On.progressBarOnPercentDone(-1,"Transferring...","",r,"")})):On.hideProgress(),m==mt.Binary){if(d&&d.bCancel)return d.st=2,zo(e),I(e._errorCode,e._errorString);e._OnPercentDone([0,-1,mh,"http"]),e._convertToBlobForUpload(v,o,c,4,function(t,o,a){if(S=function(t){return On.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&On.closeProgress(null,r),jr.isFunction(h)&&us.runWithCatch(h,t),!0},d&&d.bCancel)return d.st=2,zo(e),I(e._errorCode,e._errorString);if(!t||t.size<=0)return Zh(e),I(e._errorCode,e._errorString);var s=e.__maxUploadImageSize;if(t.size>s&&-1!=s)return eg(e),I(e._errorCode,e._errorString);if(xn.IfAddMD5InUploadHeader&&o&&""!=o&&(n["dwt-md5"]=o),y>0&&t.size>y){e._OnPercentDone([0,-1,Sh,"http",p]);var u=new Dd,c=new xd;return e.__remoteFilename&&""!=e.__remoteFilename&&(c.remoteFilename=e.__remoteFilename),c.url=_,c.method=r,c.content=t,t=null,c.contentType=e._strHttpContentTypeFieldValue,c.headers=n,c.fileName=p,c.httpFormData=i,c.retry=l,c.bOnlyResponseEmptyIsOK=f,c.blockSize=e._moduleSize,u.httpPostUploadFragment(b,c,S,I)}var g=new Dd,v=new xd;e.__remoteFilename&&""!=e.__remoteFilename&&(v.remoteFilename=e.__remoteFilename),v.url=_,v.method=r,v.content=t,t=null,v.contentType=e._strHttpContentTypeFieldValue,v.headers=n,v.fileName=p,v.httpFormData=i,v.retry=l,v.bOnlyResponseEmptyIsOK=f,v.blockSize=e._moduleSize,b.objUploadStatus=d,g.httpPostUpload(b,v,S,I)},I)}else if(m==mt.Base64){e._convertToBase64ByServerIdsWithUI(r,o,v,c,4,function(t){var o;if(!t||t.getLength()<=0)return Zh(e),I(e._errorCode,e._errorString);if(S=function(){return On.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&On.closeProgress(null,r),jr.isFunction(h)&&us.runWithCatch(h,t),!0},y>0&&t.getLength()>y){o=t.getMD5(),xn.IfAddMD5InUploadHeader&&(n["dwt-md5"]=o),e._OnPercentDone([0,-1,Sh,"http"]);var a=new xd;e.__remoteFilename&&""!=e.__remoteFilename&&(a.remoteFilename=e.__remoteFilename),a.url=_,a.method=r,a.content=t.getData(0,t.getLength()),a.headers=n,a.fileName=p,a.httpFormData=i,a.retry=l,a.bOnlyResponseEmptyIsOK=f,a.blockSize=e._moduleSize,a.offset=0,(new Dd).httpPostUploadFragment(b,a,S,I)}else{var s;if(o=t.getMD5(),xn.IfAddMD5InUploadHeader&&(n["dwt-md5"]=o),!(s=t.getData(0,t.getLength()))||""==s)return Zh(e),I(e._errorCode,e._errorString);var u=new xd;e.__remoteFilename&&""!=e.__remoteFilename&&(u.remoteFilename=e.__remoteFilename),u.url=_,u.method=r,u.content=s,u.headers=n,u.fileName=p,u.httpFormData=i,u.retry=l,u.bOnlyResponseEmptyIsOK=f,u.blockSize=e._moduleSize,(new Dd).httpPostUpload(b,u,S,I)}},I)}}}]);var n}(JH);function tG(e,r,t,n,i,o,a,s){var u,c,l=this,f="HTTPUploadThroughPostEx",d=l._GetHttpHeadersAndClear(),h=kp.combineUrl(l,e,t),g=[],v=function(e){jr.isFunction(a)&&a(e)},m=!1,p=!1;if(jr.isFunction(o)&&(p=!0),l.__HTTPPostResponseString="",jr.isNumber(r)){if(r<-2)return gg(l),v(r),!!p&&void 0}else if(!jr.isArray(r))return gg(l),v(r),!!p&&void 0;if(!jr.isString(n)||""==n)return Zh(l),v(),!!p&&void 0;if(jr.isUndefined(i))return mg(l),v(r),!!p&&void 0;if(i==ut.IT_BMP||i==ut.IT_JPG||i==ut.IT_PNG||i==ut.IT_J2K){if(-1==r&&l._ImgManager.count()>1||jr.isArray(r)&&r.length>1)return lg(l),v(r),!!p&&void 0;jr.isArray(r)?g.push(r[0]):-1==r?g.push(0):g.push(r)}else{if(i!=ut.IT_TIF&&i!=ut.IT_PDF)return mg(l),v(r),!!p&&void 0;if(-1==r){if(0==l._ImgManager.count())return Vh(l),v(),!!p&&void 0;for(c=0;c<l._ImgManager.count();c++)g.push(c)}else if(-2==r)g=l._ImgManager.getSelectedClientIndexArray();else if(jr.isArray(r))for(c=0;c<r.length;c++)g.push(r[c]);else g.push(r)}if(""===e)return zh(l),v(g),!!p&&void 0;if(jr.isUndefined(h)||""===h)return rg(l),v(g),!!p&&void 0;if(!jr.isString(h))return _g(l),v(g),!!p&&void 0;if(0!=h.indexOf("http://")&&0!=h.indexOf("https://")&&(h=this._bSSL?"https://"+h:"http://"+h),!l._checkIndices(g)&&-1!=g)return v(g),!!p&&void 0;var _=[];if(jr.isArray(g)&&jr.each(g,function(e){var r=l._ImgManager.convertClientIndexToServerId(e);-1!=r&&_.push(r)}),l._resetErr(),!l._isValid())return v(g),!!p&&void 0;if(!p){On.cancelFrom=St.HTTPUpload;var y=this.IfShowProgressBar,S=function(e,r,t){return 0!=e&&r&&(l._errorCode=e,l._errorString=r),t&&(l.__HTTPPostResponseString=t),On.needShowTwiceShowDialog=!1,y&&On.closeProgress(null,f),v(g),!1};return On.needShowTwiceShowDialog=!0,y?On.showProgress(l,f,!1):On.hideProgress(),l._OnPercentDone([0,-1,mh,"http"]),l._dwtConvertToBlobSync(i,_,m,function(e,r){if(On.needShowTwiceShowDialog=!1,e){var t=l.__maxUploadImageSize;if(e.size>t&&-1!=t)return eg(l),S(l._errorCode,l._errorString),!1;xn.IfAddMD5InUploadHeader&&r&&""!=r&&(d["dwt-md5"]=r),e instanceof File?e.fileName=n:e.name=n;var i=l._createHttpUploaderConfig(),o=new xd;return i.IfShowCancelDialogWhenImageTransfer=y&&l.__IfShowCancelDialogWhenImageTransfer,l.__remoteFilename&&""!=l.__remoteFilename&&(o.remoteFilename=l.__remoteFilename),o.url=h,o.method=f,o.content=e,o.contentType=l._strHttpContentTypeFieldValue,o.headers=d,o.bAsync=!1,o.httpFormData=uG(l.httpFormFields),o.blockSize=l._moduleSize,(new Dd).httpPostUpload(i,o,function(e){return y&&On.closeProgress(null,f),e},S)}var a={};return Qh(a),S(a._errorCode,a._errorString),!1},S)}u={method:"HTTPUploadThroughPostEx",url:h,serverIds:_,headers:d,formData:uG(l.httpFormFields),enumImageType:i,saveSetup:m,fileName:n,retry:0,bOnlyResponseEmptyIsOK:!0,objUploadFileStatus:undefined,dataFormat:mt.Binary,asyncSuccessFunc:o,asyncFailureFunc:v},this._asyncUploadCmd(u)}function nG(e,r,t,n,i){var o=this,a=!0;if(r)return o._innerFunRaw("SaveSelectedImagesToBytes",hm(0,0,e,t),r,a,!0,function(e){if(jr.isFunction(n)){var r=new Blob([e],{type:o._strHttpContentTypeFieldValue});n(r),r=null}},i),!0;var s=o._innerFunRaw("SaveSelectedImagesToBytes",hm(0,0,e,t),r,a,!1);if(0==o._errorCode){var u=n(s);return s=null,u}return s=null,i(),!1}function iG(){return this._resetErr(),!!this._isValid()&&(this._innerSend("SetCancel",null,!0),!0)}function oG(e,r,t,n,i){var o=this;if(!jr.isFunction(n))return this._innerFun(e,r);o.IfShowProgressBar?(On.showProgress(o,e,t),t&&On.progressContext&&On.progressContext.on("cancel",function(){v(eG,o,iG).call(o)})):On.hideProgress(),this._innerSend(e,r,!0,function(){On.closeProgress(null,e),jr.isFunction(n)&&n()},function(r){jr.isFunction(i)&&i(o._errorCode,o._getErrorString()),On.closeProgress(null,e),r&&jr.error(r)})}function aG(e,r,t,n,i){var o,a,s=this,u=!1;if(jr.isFunction(n)&&(u=!0),!jv.checkProductKey(s,{Core:!0}))return jr.isFunction(i)&&us.runErrWithCatch(i,s),!!u&&void 0;if(!jv.checkPDFProductKeyWhenNeeds(s,t))return jr.isFunction(i)&&us.runErrWithCatch(i,s),!!u&&void 0;On.cancelFrom=St.FTPDownload;var c,l="";if(r&&r.length>=2){var f=r[0],d=r[1];0==f.toLowerCase().indexOf("ftp://")&&(f=f.substring(6,f.length)),f&&f.length>1&&"/"==f[f.length-1]&&(f=f.substring(0,f.length-1)),d&&d.length>0&&"/"!=d[0]&&(d="/"+d);var h=["ftp://",f,d].join("");c=kp.getFilePath(h),l=kp.getFileName(h),o=2==r.length?hm(f,d):hm(f,d,r[2])}if(!u){var g=s._getCurrentDocumentName(),m=s._getCurrentDefaultTagName();(a=s.__innerLoadImageFun(e,o,1,g,m))&&s.__OnPostLoad&&!s.__bServerOnPostLoadFired&&setTimeout(function(){s.__bServerOnPostLoadFired||s.__OnPostLoad&&s.__OnPostLoad(c,l,t)},10);var p=s._ImgManager.getCurrentImageIndex();return p>=0&&s._innerRefreshUI(p),a}v(eG,s,oG).call(s,e,o,!0,function(){var e=s._ImgManager.getCurrentImageIndex();e>=0&&s._innerRefreshUI(e),s._canConsume()&&xn.lcvrf(s),s.__OnPostLoad&&!s.__bServerOnPostLoadFired&&s.__OnPostLoad(c,l,t),jr.isFunction(n)&&n()},function(){s.__OnPostLoad&&!s.__bServerOnPostLoadFired&&s.__OnPostLoad(c,l,t),jr.isFunction(i)&&us.runErrWithCatch(i,s)})}function sG(e,r,t,n){if(0==e._ImgManager.count())return Vh(e),jr.isFunction(n)&&n(r),!1;if(jr.isNumber(r)){if(isNaN(r)||r<-2||r>=e._ImgManager.count())return gg(e),jr.isFunction(n)&&n(r),!1}else{if(!jr.isArray(r))return gg(e),jr.isFunction(n)&&n(r),!1;var i;for(i=0;i<r.length;i++){var o=r[i];if(isNaN(o)||!jr.isNumber(o)||o<0||o>=e._ImgManager.count())return fg(e),jr.isFunction(n)&&n(r),!1}}if(t==ut.IT_BMP||t==ut.IT_JPG||t==ut.IT_PNG||t==ut.IT_J2K)(-1==r&&e._ImgManager.count()>1||jr.isArray(r)&&r.length>1)&&(lg(e),jr.isFunction(n)&&n(r));else if(t!=ut.IT_TIF&&t!=ut.IT_PDF)return mg(e),jr.isFunction(n)&&n(r),!1;return!0}function uG(e){var r;return e&&(r=new FormData,jr.each(e,function(e,t){if(e instanceof Blob){var n=e.name;r.append(t,e,n)}else r.append(t,e)})),r}var cG=function(e){function r(){return _(this,r),s(this,r,arguments)}return l(r,e),S(r,[{key:"Viewer",get:function(){return this._viewer}},{key:"BindViewer",value:function(e){var r,t=this,n=e;return xn.UseDefaultViewer?(jr.isString(e)&&(n=jr.get(e),jr.show(n)),t._config.container!=n&&(t._config.container=n,zH(t)),null===(r=t._UIView)||void 0===r?void 0:r.BindView(e)):(hh(t,-2439,"You cannot call the method bindViewer() when DWT.UseDefaultViewer is set to false."),!1)}},{key:"UnbindViewer",value:function(){return this._innerUnbindViewer(!1)}},{key:"AddText",value:function(e,r,t,n,i,o,a,s){var u=this,c=parseInt(e);if(!Rp(u,c))return!1;var l=hs.RGB2BGR(i),f=hs.RGB2BGR(o),d=u._ImgManager.convertClientIndexToServerId(c);return-1==d?(gg(u),!1):u._innerFun("AddText",hm(d,r,t,n,l,f,a,s))}},{key:"CreateTextFont",value:function(e,r,t,n,i,o,a,s,u,c,l,f,d,h){return this._resetErr(),!!this._isValid()&&this._innerFun("CreateTextFont",hm(e,r,t,n,i,o,a,s,u,c,l,f,d,h))}},{key:"CopyToClipboard",value:function(e){var r=parseInt(e);return!!Rp(this,r)&&lG(this,"CopyToClipboard",r,null,null,!1,!1)}},{key:"CopyToClipboardAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);return isNaN(t)?(Bh(r),Promise.reject({code:r._errorCode,message:r._errorString})):t<0||t>=r._ImgManager.count()?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):function(e,r,t){var n=e._ImgManager.convertClientIndexToServerId(t);if(-1==n)return gg(e),Promise.reject({code:e._errorCode,message:e._errorString});return e._innerFunV2(r,hm(n))}(r,"CopyToClipboard",t)}},{key:"getView",value:function(){return this._UIView}},{key:"Erase",value:function(e,r,t,n,i,o,a){var s,u=this;if(!jr.isFunction(o)){var c,l=parseInt(e);if(!Rp(u,l,a))return!1;var f=u._ImgManager.convertClientIndexToServerId(l);return-1==f?(gg(u),jr.isFunction(a)&&a(u._errorCode,u._getErrorString()),!1):(null===(s=u.getView())||void 0===s||s.ClearSelectedAreas(),(c=1==u._innerFun("Erase",hm(f,r,t,n,i)))?jr.isFunction(o)&&o():jr.isFunction(a)&&a(u._errorCode,u._getErrorString()),c)}u.EraseAsync(e,r,t,n,i).then(o,function(e){u._wrappeAsyncFailed(u,e,a)})}},{key:"EraseAsync",value:function(e,r,t,n,i){var o,a=this;if(a._resetErr(),!a._isValid())return Promise.reject({code:a._errorCode,message:a._errorString});var s=parseInt(e);if(isNaN(s))return Bh(a),Promise.reject({code:a._errorCode,message:a._errorString});if(s<0||s>=a._ImgManager.count())return gg(a),Promise.reject({code:a._errorCode,message:a._errorString});var u=a._ImgManager.convertClientIndexToServerId(s);return-1==u?(gg(a),Promise.reject({code:a._errorCode,message:a._errorString})):(null===(o=a.getView())||void 0===o||o.ClearSelectedAreas(),a._innerFunV2("Erase",hm(u,r,t,n,i),!0).then(function(e){if(1!=e)throw{code:a._errorCode,message:a._errorString}}))}},{key:"GetImageBitDepth",value:function(e){var r=this,t=parseInt(e);if(!Rp(r,t))return!1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),!1):r._innerFun("GetImageBitDepth",hm(n))}},{key:"GetImageWidth",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=parseInt(e);if(isNaN(t))return Bh(r),-1;if(t<0||t>=r._ImgManager.count())return gg(r),-1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),-1):r._innerFun("GetImageWidth",hm(n))}},{key:"GetImageHeight",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=parseInt(e);if(isNaN(t))return Bh(r),-1;if(t<0||t>=r._ImgManager.count())return gg(r),-1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),-1):r._innerFun("GetImageHeight",hm(n))}},{key:"GetImageSize",value:function(e,r,t){var n=this;if(n._resetErr(),!n._isValid())return!1;var i=parseInt(e);if(isNaN(i))return Bh(n),-1;if(i<0||i>=n._ImgManager.count())return gg(n),-1;var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(gg(n),-1):n._innerFun("GetImageSize",hm(o,r,t))}},{key:"GetImageSizeWithSpecifiedType",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n=parseInt(e);if(isNaN(n))return Bh(t),-1;if(n<0||n>=t._ImgManager.count())return gg(t),-1;var i=t._ImgManager.convertClientIndexToServerId(n);return-1==i?(gg(t),-1):t._innerFun("GetImageSizeWithSpecifiedType",hm(i,r))}},{key:"GetImageXResolution",value:function(e){var r=this,t=parseInt(e);if(!Rp(r,t))return!1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),!1):r._innerFun("GetImageXResolution",hm(n))}},{key:"GetImageYResolution",value:function(e){var r=this,t=parseInt(e);if(!Rp(r,t))return!1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),!1):r._innerFun("GetImageYResolution",hm(n))}},{key:"SelectAllImages",value:function(){var e,r=this,t=r._getHowManyImagesInBuffer(),n=[];if(r._resetErr(),!r._isValid())return!1;for(e=0;e<t;e++)n.push(e);return r._ImgManager.setSelectedClientIndexArray(n),n}},{key:"SelectImages",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&r._ImgManager.setSelectedClientIndexArray(e)}},{key:"GetSkewAngle",value:function(e,r,t){var n,i=this;if(!jr.isFunction(r)){var o=parseInt(e);return!!Rp(i,o,t)&&(n=lG(i,"GetSkewAngle",o,r,t,!0,!1),0==i._errorCode?(kp.refreshImageAfterInvokeFun(i,o),n):0)}i.GetSkewAngleAsync(e).then(r,function(e){i._wrappeAsyncFailed(i,e,t)})}},{key:"GetSkewAngleAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetSkewAngle",hm(n),!0).then(function(e){var n=e;return jr.isArray(e)&&(n=e.length>0?e[0]:0),kp.refreshImageAfterInvokeFun(r,t),n})}},{key:"GetSkewAngleEx",value:function(e,r,t,n,i){var o=this,a=parseInt(e);if(!Rp(o,a))return!1;var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(gg(o),!1):o._innerFun("GetSkewAngleEx",hm(s,r,t,n,i))}},{key:"GetSkewAngleFromBinaryAsync",value:function(e,r,t,n){var i=this;if(i._resetErr(),!i._isValid())return Promise.reject({code:i._errorCode,message:i._errorString});var o=this._imageBufferWrapper.getCustomDataByIndex(e),a=this._imageBufferWrapper.getMetadataByIndex(e),s=this._ImgManager.convertClientIndexToServerId(e),u={imageId:s,serverId:s,bufferLen:r.size,imageType:ut.IT_BMP,width:a.width,height:a.height,bit:a.bitDepth,xres:a.resolutionX,yres:a.resolutionY,uidFromServer:o.uidFromServer},c=jr.stringify([jr.stringify(u)]);return this._innerSendBlob("GetSkewAngleFromBinary",c,r,!0,!0,t,n)}},{key:"IsBlankImageEx",value:function(e,r,t,n,i,o){var a,s=this;if(!Rp(s,a=parseInt(e)))return!1;var u=s._ImgManager.convertClientIndexToServerId(a);return-1==u?(gg(s),!1):s._innerFun("IsBlankImageEx",hm(u,r,t,n,i,o))}},{key:"MirrorAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("Mirror",hm(n),!0).then(function(e){if(1!=e)throw{code:r._errorCode,message:r._errorString};var n;kp.refreshImageAfterInvokeFun(r,t),null===(n=r.getView())||void 0===n||n.ClearSelectedAreas()})}},{key:"Mirror",value:function(e,r,t){var n=this;if(!jr.isFunction(r)){var i=parseInt(e);return!!Rp(n,i,t)&&lG(n,"Mirror",i,r,t,!1,!0)}n.MirrorAsync(e).then(r,function(e){n._wrappeAsyncFailed(n,e,t)})}},{key:"RemoveAllImages",value:function(){return this._removeAllImages("RemoveAllImages")}},{key:"RemoveAllImagesAsync",value:function(){return this._removeAllImagesAsync("RemoveAllImagesAsync",!0)}},{key:"RemoveImageAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("RemoveImage",hm(n),!0).then(function(e){return!(!e&&-1033!=r._errorCode)&&(r._OnBitmapChanged(["c1",""+n,3,r._ImgManager.getCurrentImageIndex(),r._ImgManager.count()]),!0)})}},{key:"Rotate",value:function(e,r,t,n,i){return this.RotateEx(e,r,t,-1,n,i)}},{key:"_wrappeAsyncFailed",value:function(e,r,t){r&&(e._errorCode=r.code,e._errorString=r.message),jr.isFunction(t)&&t(e._errorCode,e._getErrorString())}},{key:"RotateEx",value:function(e,r,t,n,i,o){var a=this;if(!jr.isFunction(i)){if(a._resetErr(),!a._isValid())return!1;var s,u=parseInt(e);if(isNaN(u))return Bh(a),jr.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;if(u<0||u>=a._ImgManager.count())return gg(a),jr.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;var c,l=a._ImgManager.convertClientIndexToServerId(u);if(-1==l)return gg(a),jr.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;if(s=1==a._innerFun("RotateEx",hm(l,r,t,n)))kp.refreshImageAfterInvokeFun(a,u),null===(c=a.getView())||void 0===c||c.ClearSelectedAreas(),jr.isFunction(i)&&i();else jr.isFunction(o)&&o(a._errorCode,a._getErrorString());return s}a.RotateExAsync(e,r,t,n).then(i,function(e){a._wrappeAsyncFailed(a,e,o)})}},{key:"RotateLeft",value:function(e,r,t){return this.RotateEx(e,-90,!0,-1,r,t)}},{key:"RotateRight",value:function(e,r,t){return this.RotateEx(e,90,!0,-1,r,t)}},{key:"RotateAsync",value:function(e,r,t){return this.RotateExAsync(e,r,t,-1)}},{key:"RotateExAsync",value:function(e,r,t,n){var i=this;if(i._resetErr(),!i._isValid())return Promise.reject({code:i._errorCode,message:i._errorString});var o=parseInt(e);if(isNaN(o))return Bh(i),Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i._ImgManager.count())return gg(i),Promise.reject({code:i._errorCode,message:i._errorString});var a=i._ImgManager.convertClientIndexToServerId(o);return-1==a?(gg(i),Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("RotateEx",hm(a,r,t,n),!0).then(function(e){if(1!=e&&1!=e)throw{code:i._errorCode,message:i._errorString};var r;kp.refreshImageAfterInvokeFun(i,o),null===(r=i.getView())||void 0===r||r.ClearSelectedAreas()})}},{key:"RotateLeftAsync",value:function(e){return this.RotateExAsync(e,-90,!0,-1)}},{key:"RotateRightAsync",value:function(e){return this.RotateExAsync(e,90,!0,-1)}},{key:"ChangeImageSize",value:function(e,r,t,n,i,o){var a=this;if(!jr.isFunction(i)){var s,u=parseInt(e),c=1*r,l=1*t;if(!Rp(a,u,o))return!1;if(c<=0||l<=0)return $h(a),jr.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;var f=a._ImgManager.convertClientIndexToServerId(u);return-1==f?(gg(a),jr.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1):((s=1==a._innerFun("ChangeImageSize",hm(f,c,l,n)))?(kp.refreshImageAfterInvokeFun(a,u),jr.isFunction(i)&&i()):jr.isFunction(o)&&o(a._errorCode,a._getErrorString()),s)}a.ChangeImageSizeAsync(e,r,t,n).then(i,function(e){a._wrappeAsyncFailed(a,e,o)})}},{key:"ChangeImageSizeAsync",value:function(e,r,t,n){var i=this,o=parseInt(e),a=1*r,s=1*t;if(i._resetErr(),!i._isValid())return Promise.reject({code:i._errorCode,message:i._errorString});if(isNaN(o))return Bh(i),Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i._ImgManager.count())return gg(i),Promise.reject({code:i._errorCode,message:i._errorString});if(a<=0||s<=0)return $h(i),Promise.reject({code:i._errorCode,message:i._errorString});var u=i._ImgManager.convertClientIndexToServerId(o);return-1==u?(gg(i),Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("ChangeImageSize",hm(u,a,s,n),!0).then(function(e){if(1!=e)throw{code:i._errorCode,message:i._errorString};kp.refreshImageAfterInvokeFun(i,o)})}},{key:"Flip",value:function(e,r,t){var n=this;if(!jr.isFunction(r)){var i=parseInt(e);return!!Rp(n,i,t)&&lG(n,"Flip",i,r,t,!1,!0)}n.FlipAsync(e).then(r,function(e){n._wrappeAsyncFailed(n,e,t)})}},{key:"FlipAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("Flip",hm(n),!0).then(function(e){if(1!=e)throw{code:r._errorCode,message:r._errorString};var n;kp.refreshImageAfterInvokeFun(r,t),null===(n=r.getView())||void 0===n||n.ClearSelectedAreas()})}},{key:"OutputSelectedAreaAsync",value:(o=p(d().m(function a(e,r,t,n){var i,o,s,u,c,l,f,h,g,v,m,p,_,y;return d().w(function(a){for(;;)switch(a.p=a.n){case 0:if(s="OutputSelectedArea",(o=this)._resetErr(),o._isValid()){a.n=1;break}throw{code:o._errorCode,message:o._errorString};case 1:if(u=0,c=0,l=0,f=0,!isNaN(e)){a.n=2;break}throw Bh(o),{code:o._errorCode,message:o._errorString};case 2:if(t==ut.IT_BMP||t==ut.IT_JPG||t==ut.IT_TIF||t==ut.IT_PNG||t==ut.IT_PDF){a.n=3;break}throw Ag(o),{code:o._errorCode,message:o._errorString};case 3:if(n==st.Blob||n==st.Base64){a.n=4;break}throw Ag(o),{code:o._errorCode,message:o._errorString};case 4:if(!(e<0||e>=o._ImgManager.count())){a.n=5;break}throw gg(o),{code:o._errorCode,message:o._errorString};case 5:if(-1!=(h=o._ImgManager.convertClientIndexToServerId(e))){a.n=6;break}throw gg(o),{code:o._errorCode,message:o._errorString};case 6:return g=n==st.Base64,v=g?"text":"arraybuffer",r&&(On.isNumber(r.x)&&(u=r.x),On.isNumber(r.y)&&(c=r.y),On.isNumber(r.width)&&(l=r.width),On.isNumber(r.height)&&(f=r.height)),p=jr.stringify([{index:h,left:u,top:c,width:l,height:f}]),_="["+p+","+t+","+n+"]",y=null===(i=On.progressContext)||void 0===i?void 0:i.IfShowCancelDialogWhenImageTransfer,a.p=7,o.IfShowProgressBar?On.showProgress(o,s,!1):On.hideProgress(),g?o._OnPercentDone([0,-1,_h]):o._OnPercentDone([0,-1,ph]),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1),a.n=8,o._sendDataByHttpAsync(s,_,v,!0);case 8:m=a.v;case 9:return a.p=9,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=y),o.IfShowProgressBar&&On.closeProgress(null,s),a.f(9);case 10:if(!g){a.n=15;break}if(!m){a.n=13;break}if(!Cm(m)){a.n=11;break}return o._errorCode=m.exception,o._errorString=m.description,o._errorCause=Tm(m),a.a(2,"");case 11:if(!(jr.isArray(m.result)&&m.result.length>0&&jr.isString(m.result[0]))){a.n=12;break}return a.a(2,m.result[0]);case 12:a.n=14;break;case 13:return a.a(2,"");case 14:a.n=16;break;case 15:return a.a(2,new Blob([m],{type:Is(t)}));case 16:return a.a(2)}},a,this,[[7,,9,10]])})),function(e,r,t,n){return o.apply(this,arguments)})},{key:"Crop",value:function(e,r,t,n,i,o,a){var s,u=this;if(!jr.isFunction(o)){var c,l=parseInt(e);if(!Rp(u,l,a))return!1;var f,d,h=u._ImgManager.convertClientIndexToServerId(l);return-1==h?(gg(u),jr.isFunction(a)&&a(u._errorCode,u._getErrorString()),!1):(c=1==u._innerFun("Crop",hm(h,r,t,n,i)),f=u._errorCode,d=u._getErrorString(),null===(s=u.getView())||void 0===s||s.ClearSelectedAreas(),u._errorCode=f,u._errorString=d,c?(kp.refreshImageAfterInvokeFun(u,l),jr.isFunction(o)&&o()):jr.isFunction(a)&&a(f,d),c)}u.CropAsync(e,r,t,n,i).then(o,function(e){u._wrappeAsyncFailed(u,e,a)})}},{key:"CropAsync",value:function(e,r,t,n,i){var o=this;if(o._resetErr(),!o._isValid())return Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return Bh(o),Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return gg(o),Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(gg(o),Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("Crop",hm(s,r,t,n,i),!0).then(function(e){var r,t,n;if(t=o._errorCode,n=o._getErrorString(),null===(r=o.getView())||void 0===r||r.ClearSelectedAreas(),o._errorCode=t,o._errorString=n,1!=e)throw{code:o._errorCode,message:o._errorString};return kp.refreshImageAfterInvokeFun(o,a),!0})}},{key:"CropToClipboard",value:function(e,r,t,n,i){var o,a,s=this,u=parseInt(e);if(!Rp(s,u))return!1;var c=s._ImgManager.convertClientIndexToServerId(u);return-1==c?(gg(s),!1):(null===(o=s.getView())||void 0===o||o.ClearSelectedAreas(),(a=1==s._innerFun("CropToClipboard",hm(c,r,t,n,i)))&&kp.refreshImageAfterInvokeFun(s,u),a)}},{key:"CutFrameToClipboard",value:function(e,r,t,n,i){var o,a,s=this,u=parseInt(e);if(!Rp(s,u))return!1;var c=s._ImgManager.convertClientIndexToServerId(u);return-1==c?(gg(s),!1):(null===(o=s.getView())||void 0===o||o.ClearSelectedAreas(),(a=1==s._innerFun("CutFrameToClipboard",hm(c,r,t,n,i)))&&kp.refreshImageAfterInvokeFun(s,u),a)}},{key:"CutToClipboard",value:function(e){var r,t=this,n=parseInt(e);if(!Rp(t,n))return!1;var i=t._ImgManager.convertClientIndexToServerId(n);return-1==i?(gg(t),!1):((r=1==t._innerFun("CutToClipboard",hm(i)))&&t._OnBitmapChanged(["c1",""+i,3,t._ImgManager.getCurrentImageIndex(),t._ImgManager.count()]),r)}},{key:"CutFrameToClipboardAsync",value:function(e,r,t,n,i){var o=this;if(o._resetErr(),!o._isValid())return Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return Bh(o),Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return gg(o),Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(gg(o),Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("CutFrameToClipboard",hm(s,r,t,n,i)).then(function(e){var r=1==e;if(!r)throw{code:o._errorCode,message:o._errorString};return kp.refreshImageAfterInvokeFun(o,a),r})}},{key:"CropToClipboardAsync",value:function(e,r,t,n,i){var o=this;if(o._resetErr(),!o._isValid())return Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return Bh(o),Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return gg(o),Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(gg(o),Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("CropToClipboard",hm(s,r,t,n,i)).then(function(e){var r=1==e;if(!r)throw{code:o._errorCode,message:o._errorString};return kp.refreshImageAfterInvokeFun(o,a),r})}},{key:"CutToClipboardAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("CutToClipboard",hm(n)).then(function(e){var t=1==e;if(!t)throw{code:r._errorCode,message:r._errorString};return r._OnBitmapChanged(["c1",""+n,3,r._ImgManager.getCurrentImageIndex(),r._ImgManager.count()]),t})}},{key:"SetDPI",value:function(e,r,t,n,i,o,a){var s,u=this,c=!1;jr.isFunction(o)&&(c=!0);var l=parseInt(e);if(!Rp(u,l,a))return!!c&&void 0;var f=u._ImgManager.convertClientIndexToServerId(l);return-1==f?(gg(u),jr.isFunction(a)&&a(u._errorCode,u._getErrorString()),!!c&&void 0):((s=1==u._innerFun("SetDPI",hm(f,r,t,n,i)))?jr.isFunction(o)&&o():jr.isFunction(a)&&a(u._errorCode,u._getErrorString()),c?void 0:s)}},{key:"MoveImage",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n=parseInt(e),i=parseInt(r);return isNaN(n)||isNaN(i)?(Bh(t),!1):n<0||n>=t._ImgManager.count()||i<0||i>=t._ImgManager.count()?(gg(t),!1):t._ImgManager.moveImage(n,i)}},{key:"SwitchImage",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n=parseInt(e),i=parseInt(r);return isNaN(n)||isNaN(i)?(Bh(t),!1):n<0||n>=t._ImgManager.count()||i<0||i>=t._ImgManager.count()?(gg(t),!1):t._ImgManager.switchImage(n,i)}},{key:"CloseWorkingProcess",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("CloseWorkerProcess")}},{key:"RemoveAllSelectedImages",value:function(){var e=this;if(e._resetErr(),!e._isValid())return!1;var r=!0,t=e._ImgManager.getCurrentImageIndex(),n=e._ImgManager.getSelectedClientIndexArray(),i=[];if(jr.isArray(n)&&jr.each(n,function(r){var t=e._ImgManager.convertClientIndexToServerId(r);-1!=t&&i.push(t)}),0==i.length&&t>=0){var o=e._ImgManager.convertClientIndexToServerId(t);i.push(o)}return i.length>0&&(r=e._innerFun("RemoveAllSelectedImages",hm(i.join(",")))),r&&e._OnBitmapChanged(["c1",i.join(","),3,e._ImgManager.getCurrentImageIndex(),e._ImgManager.count()]),r}},{key:"RemoveAllSelectedImagesAsync",value:function(){var e=this;if(e._resetErr(),!e._isValid())return Promise.reject({code:e._errorCode,message:e._errorString});var r=e._ImgManager.getCurrentImageIndex(),t=e._ImgManager.getSelectedClientIndexArray(),n=[];if(jr.isArray(t)&&jr.each(t,function(r){var t=e._ImgManager.convertClientIndexToServerId(r);-1!=t&&n.push(t)}),0==n.length&&r>=0){var i=e._ImgManager.convertClientIndexToServerId(r);n.push(i)}return n.length>0?e._innerFunV2("RemoveAllSelectedImages",hm(n.join(","),!0)).then(function(r){r&&e._OnBitmapChanged(["c1",n.join(","),3,e._ImgManager.getCurrentImageIndex(),e._ImgManager.count()])}):Promise.resolve()}},{key:"TagImages",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;var n=!0,i=t._ImgManager.count();return jr.isArray(e)?jr.isString(r)&&""!=r?(jr.each(e,function(e){if(isNaN(e)||e<0||e>=i)return gg(t),n=!1}),n?t._ImgManager.addImageTag(e,r):n):(hh(t,-2394,"Invalid tag name."),!1):(hg(t),!1)}},{key:"ClearImageTags",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&(-1==e||e>=r._getHowManyImagesInBuffer()?(gg(r),!1):r._ImgManager.removeImageTag(e))}},{key:"SetDefaultTag",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&r._ImgManager.setDefaultTag(e)}},{key:"FilterImagesByTag",value:function(e,r,t){var n,i=this,o=!1;if(jr.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return!!o&&void 0;jr.isFunction(t)&&(n=function(){t({code:i._errorCode,message:i._errorString})});var a=i._ImgManager.showImagesByFilter(e,r,n);return o?void 0:a}},{key:"ClearFilter",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._ImgManager.clearFilter()}},{key:"CreateDocument",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&(e&&""!=e?jr.isString(e)?r._ImgManager.CreateFile(e):(Dg(r),!1):(jr.isNumber(e)?Dg(r):Fg(r),!1))}},{key:"OpenDocument",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&(e&&""!=e?jr.isString(e)?r._ImgManager.OpenFile(e):(Dg(r),!1):(jr.isNumber(e)?Dg(r):Fg(r),!1))}},{key:"RemoveDocument",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=r._ImgManager.GetServerIdsByFileName(e);return t.length>0&&r._innerFun("RemoveAllSelectedImages",hm(t.join(","))),r._ImgManager.RemoveFile(e)}},{key:"RenameDocument",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(jr.isString(e)&&jr.isString(r)?e&&""!=e&&r&&""!=r?t._ImgManager.RenameFile(e,r):(Fg(t),!1):(Dg(t),!1))}},{key:"GetDocumentInfoList",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._ImgManager.GetFileInfoList()}},{key:"MoveToDocumentAsync",value:(i=p(d().m(function u(e,r,t,n){var i,o,a,s,c,l,f,h,g,v;return d().w(function(u){for(;;)switch(u.n){case 0:if((i=this)._resetErr(),i._isValid()){u.n=1;break}throw{code:i._errorCode,message:i._errorString};case 1:if(!jr.isUndefined(e)&&0!=e.length){u.n=2;break}throw hv(i),{code:i._errorCode,message:i._errorString};case 2:if(!jr.isUndefined(r)&&0!=r.length){u.n=3;break}throw gv(i),{code:i._errorCode,message:i._errorString};case 3:o=i._ImgManager.GetFileInfoList(),c=0;case 4:if(!(c<o.length)){u.n=6;break}if(o[c].name!=e){u.n=5;break}return a=o[c],u.a(3,6);case 5:c++,u.n=4;break;case 6:l=0;case 7:if(!(l<o.length)){u.n=9;break}if(o[l].name!=r){u.n=8;break}return s=o[l],u.a(3,9);case 8:l++,u.n=7;break;case 9:if(!jr.isUndefined(a)){u.n=10;break}throw hv(i),{code:i._errorCode,message:i._errorString};case 10:if(!jr.isUndefined(s)){u.n=11;break}throw gv(i),{code:i._errorCode,message:i._errorString};case 11:if(f=[],!jr.isUndefined(t)){u.n=12;break}if(a.imageIds.length>0)for(g=0;g<a.imageIds.length;g++)f.push(g);u.n=18;break;case 12:if(!jr.isArray(t)){u.n=16;break}if(i._checkIndices(t,a.imageIds.length)){u.n=13;break}throw{code:i._errorCode,message:i._errorString};case 13:if(f=t,jr.isUndefined(n)){u.n=15;break}if(!jr.isNumber(n)){u.n=14;break}n<0?h=0:s.imageIds.length>n&&(h=n),u.n=15;break;case 14:throw Ag(i),{code:i._errorCode,message:i._errorString};case 15:u.n=18;break;case 16:if(!jr.isNumber(t)){u.n=17;break}if(a.imageIds.length>0)for(v=0;v<a.imageIds.length;v++)f.push(v);t<0?h=0:s.imageIds.length>t&&(h=t),u.n=18;break;case 17:throw Ag(i),{code:i._errorCode,message:i._errorString};case 18:return u.a(2,new Promise(function(t,n){0==f.length||i._ImgManager.MoveImageToFile(e,f,r,h)?t():n({code:i._errorCode,message:i._errorString})}))}},u,this)})),function(e,r,t,n){return i.apply(this,arguments)})},{key:"CopyToDocumentAsync",value:(n=p(d().m(function c(e,r,t,n){var i,o,a,s,u,l,f,h;return d().w(function(c){for(;;)switch(c.n){case 0:if((i=this)._resetErr(),i._isValid()){c.n=1;break}throw{code:i._errorCode,message:i._errorString};case 1:if(!jr.isUndefined(e)&&0!=e.length){c.n=2;break}throw hv(i),{code:i._errorCode,message:i._errorString};case 2:if(!jr.isUndefined(r)&&0!=r.length){c.n=3;break}throw gv(i),{code:i._errorCode,message:i._errorString};case 3:o=i._ImgManager.GetFileInfoList(),u=0;case 4:if(!(u<o.length)){c.n=6;break}if(o[u].name!=e){c.n=5;break}return a=o[u],c.a(3,6);case 5:u++,c.n=4;break;case 6:l=0;case 7:if(!(l<o.length)){c.n=9;break}if(o[l].name!=r){c.n=8;break}return s=o[l],c.a(3,9);case 8:l++,c.n=7;break;case 9:if(!jr.isUndefined(a)){c.n=10;break}throw hv(i),{code:i._errorCode,message:i._errorString};case 10:if(!jr.isUndefined(s)){c.n=11;break}throw gv(i),{code:i._errorCode,message:i._errorString};case 11:if(f=[],!jr.isUndefined(t)){c.n=12;break}a.imageIds.length>0&&jr.isArray(a.imageIds)&&jr.each(a.imageIds,function(e){var r=i._uidFromServer2ServerId(e);-1!=r&&f.push(r)}),c.n=18;break;case 12:if(!jr.isArray(t)){c.n=16;break}if(i._checkIndices(t,a.imageIds.length)){c.n=13;break}throw{code:i._errorCode,message:i._errorString};case 13:if(jr.each(t,function(e){var r=i._uidFromServer2ServerId(a.imageIds[e]);-1!=r&&f.push(r)}),jr.isUndefined(n)){c.n=15;break}if(!jr.isNumber(n)){c.n=14;break}n<0?h=0:s.imageIds.length>n&&(h=n),c.n=15;break;case 14:throw Ag(i),{code:i._errorCode,message:i._errorString};case 15:c.n=18;break;case 16:if(!jr.isNumber(t)){c.n=17;break}a.imageIds.length>0&&jr.isArray(a.imageIds)&&jr.each(a.imageIds,function(e){var r=i._uidFromServer2ServerId(e);-1!=r&&f.push(r)}),t<0?h=0:s.imageIds.length>t&&(h=t),c.n=18;break;case 17:throw Ag(i),{code:i._errorCode,message:i._errorString};case 18:return c.a(2,new Promise(function(e,t){var n="copyToDocument";if(s.imageIds.length,0==f.length)e();else{i.IfShowProgressBar?Ta(!1):On.hideProgress();var o=i.IfShowCancelDialogWhenImageTransfer;On.cancelFrom=St.LoadImage,i.IfShowCancelDialogWhenImageTransfer=!1,On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1),On.cancelFrom=St.Other,i._innerConvertToBlobWithUI(n,ut.IT_PDF,f,!1,function(a,s){a.currentFileName=r,a.currentTagName="",a.bNeedClearCurrentTagName=!0,a.index=h,i.IfShowProgressBar?(Ta(!1),On.showProgress(i,n,!1),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1)):On.hideProgress(),On.cancelFrom=St.LoadImage,i._innerLoadImageFromBinary(a,0,!0,!0,function(){i.IfShowCancelDialogWhenImageTransfer=o,i.IfShowProgressBar&&On.closeProgress(null,n),e()},function(){i.IfShowCancelDialogWhenImageTransfer=o,i.IfShowProgressBar&&On.closeProgress(null,n),t({code:i._errorCode,message:i._errorString})})},function(){i.IfShowCancelDialogWhenImageTransfer=o,t({code:i._errorCode,message:i._errorString})})}}))}},c,this)})),function(e,r,t,i){return n.apply(this,arguments)})},{key:"Invert",value:function(e,r,t){var n=this,i=!1;if(jr.isFunction(r)&&(i=!0),!i){var o=parseInt(e);return!!Rp(n,o,t)&&lG(n,"Invert",o,r,t,!1,!0)}n.InvertAsync(e).then(r,function(e){n._wrappeAsyncFailed(n,e,t)})}},{key:"InvertAsync",value:function(e){return this._invert(e)}},{key:"RenameTag",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(jr.isUndefined(e)?(rg(t),!1):0==e.length?(hh(t,-2517,"Old tag name is required."),!1):jr.isUndefined(r)||0==r.length?(function(e){hh(e,-2518,"New tag name is required.")}(t),!1):t._ImgManager.renameTag(e,r))}},{key:"RemoveTag",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(jr.isUndefined(e)||0==e.length?(rg(t),!1):jr.isUndefined(r)||jr.isArray(r)?t._ImgManager.removeTag(e,r):(hg(t),!1))}},{key:"GetTagList",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._ImgManager.getTagList()}},{key:"GetTagListByIndex",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return[];var t=parseInt(e);return isNaN(t)?(Bh(r),[]):t<0||t>=r._ImgManager.count()||-1==r._ImgManager.convertClientIndexToServerId(t)?(gg(r),[]):r._ImgManager.getTagListByIndex(t)}},{key:"GetImageBitDepthAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageBitDepth",hm(n))}},{key:"GetImageWidthAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageWidth",hm(n))}},{key:"GetImageHeightAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageHeight",hm(n))}},{key:"GetImageSizeAsync",value:function(e,r,t){var n=this;if(n._resetErr(),!n._isValid())return Promise.reject({code:n._errorCode,message:n._errorString});var i=parseInt(e);if(isNaN(i))return Bh(n),Promise.reject({code:n._errorCode,message:n._errorString});if(i<0||i>=n._ImgManager.count())return gg(n),Promise.reject({code:n._errorCode,message:n._errorString});var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(gg(n),Promise.reject({code:n._errorCode,message:n._errorString})):n._innerFunV2("GetImageSize",hm(o,r,t))}},{key:"GetImageSizeWithSpecifiedTypeAsync",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return Promise.reject({code:t._errorCode,message:t._errorString});var n=parseInt(e);if(isNaN(n))return Bh(t),Promise.reject({code:t._errorCode,message:t._errorString});if(n<0||n>=t._ImgManager.count())return gg(t),Promise.reject({code:t._errorCode,message:t._errorString});var i=t._ImgManager.convertClientIndexToServerId(n);return-1==i?(gg(t),Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageSizeWithSpecifiedType",hm(i,r))}},{key:"GetImageXResolutionAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageXResolution",hm(n))}},{key:"GetImageYResolutionAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageYResolution",hm(n))}},{key:"ChangeBrightnessAsync",value:function(e,r){var t=this,n=parseInt(e);if(!t._isValid())return Promise.reject({code:t._errorCode,message:t._errorString});if(r<-1e3||r>1e3)return Uh(t),Promise.reject({code:t._errorCode,message:t._errorString});var i=t._ImgManager.convertClientIndexToServerId(n);return-1==i?(gg(t),Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("ChangeBrightness",hm(i,r))}},{key:"ChangeContrastAsync",value:function(e,r){var t=this,n=parseInt(e);if(!t._isValid())return Promise.reject({code:t._errorCode,message:t._errorString});if(r<-1e3||r>1e3)return Uh(t),Promise.reject({code:t._errorCode,message:t._errorString});var i=t._ImgManager.convertClientIndexToServerId(n);return-1==i?(gg(t),Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("ChangeContrast",hm(i,r))}},{key:"GetImageAsync",value:function(e,r,t,n,i){var o=this;if(o._resetErr(),!o._isValid())return Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return Bh(o),Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return gg(o),Promise.reject({code:o._errorCode,message:o._errorString});var s,u=o._ImgManager.convertClientIndexToServerId(a);return-1==u?(gg(o),Promise.reject({code:o._errorCode,message:o._errorString})):(jr.isNumber(r)?s=hm(u,r):jr.isNumber(t)&&jr.isNumber(n)?s=hm(u,t,n):jr.isNumber(i)&&(s=hm(u,-1,-1,i)),o._sendDataByHttpAsync("GetImageByIndex",s,"blob"))}},{key:"GetImageInfoAsync",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return Promise.reject({code:r._errorCode,message:r._errorString});var t=parseInt(e);if(isNaN(t))return Bh(r),Promise.reject({code:r._errorCode,message:r._errorString});if(t<0||t>=r._ImgManager.count())return gg(r),Promise.reject({code:r._errorCode,message:r._errorString});var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageInfo",hm(n)).then(function(e){var r=0,t=0,n=e;if(jr.isArray(e)&&1==e.length&&(n=e[0]),jr.isString(n)){var i=n.split(",");r=parseInt(i[0]),t=parseInt(i[1])}return{width:r,height:t}})}},{key:"IfShowUI",get:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("IfShowUI")},set:function(e){this._setIfShowUI(e)}},{key:"IfShowFileDialog",get:function(){return this._getIfShowFileDialog()},set:function(e){this._setIfShowFileDialog(e)}},{key:"checkErrorString",value:function(){var e=this._errorCode;if(-2115===e)return!0;if(-2003===e&&!xn.IfHttpPostErrorNoWindow){var r=window.open("","ErrorMessage","height=500,width=750,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no");null==r||r.document.writeln(this.__HTTPPostResponseString)}return 0===e}},{key:"OverlayRectangle",value:function(e,r,t,n,i,o,a){var s,u,c=this;return c._resetErr(),!!c._isValid()&&(c._isNoViewer()?c._nouiNotSupport("OverlayRectangle"):r>n||t>i||r==n&&t==i?(hh(c,-2375,"The left or top or right or bottom you entered is invalid."),!1):(u=jr.isNumber(o)?hs.getColor(o):o,null===(s=c._UIView)||void 0===s?void 0:s.OverlayRectangle(e,r,t,n,i,u,a)))}},{key:"SetViewMode",value:function(e,r){var t,n=this;if(n._resetErr(),!n._isValid())return!1;if(n._isNoViewer())return n._nouiNotSupport("SetViewMode");if(jr.isString(e)||jr.isString(r)||e<-1&&r<-1)return Uh(n),!1;var i=Math.floor(e),o=Math.floor(r);return null===(t=n._UIView)||void 0===t||t.SetViewMode(i,o),!0}},{key:"ShowImageEditor",value:function(e,r,t,n){var i,o=this;return o._resetErr(),!!o._isValid()&&(o._isNoViewer()?o._nouiNotSupport("ShowImageEditor"):!dp.isServerInvalid(o)&&(null!==(i=o._UIView)&&void 0!==i&&i.GetWebViewer().webViewer.imageEditor?o.ShowImageEditorEx(-1,-1,-1,-1,3):e&&r&&t?o.ShowImageEditorEx(-1,-1,r,t,0,!0,e,n):o.ShowImageEditorEx(-1,-1,-1,-1,0,!1)))}},{key:"ShowImageEditorEx",value:function(e,r,t,n,i,o,a,s){var u,c=this;return c._resetErr(),!!c._isValid()&&(c._isNoViewer()?c._nouiNotSupport("ShowImageEditorEx"):null===(u=c._UIView)||void 0===u?void 0:u.ShowImageEditorEx(e,r,t,n,i,o,a,s))}},{key:"SetSelectedImageArea",value:function(e,r,t,n,i){var o,a=this;if(a._resetErr(),!a._isValid())return!1;if(a._isNoViewer())return a._nouiNotSupport("SetSelectedImageArea");var s=parseInt(e);return isNaN(s)||s<0||s>=a._ImgManager.count()?(gg(a),!1):!dp.isServerInvalid(a)&&(null===(o=a._UIView)||void 0===o?void 0:o.SetSelectedImageArea(r,t,n,i))}},{key:"first",value:function(){var e,r=this,t=r._ImgManager.count();if(r._resetErr(),!r._isValid())return!1;if(r._isNoViewer())return r._nouiNotSupport("first");t>0&&(null===(e=r._UIView)||void 0===e||e.Go(0),jH.__innerRefreshFromUIView(r,r._ImgManager.getCurrentImageIndex()));return!0}},{key:"previous",value:function(){var e,r=this,t=r._ImgManager.count();if(r._resetErr(),!r._isValid())return!1;if(r._isNoViewer())return r._nouiNotSupport("previous");t>0&&(null===(e=r._UIView)||void 0===e||e.__Previous(),jH.__innerRefreshFromUIView(r,r._ImgManager.getCurrentImageIndex()));return!0}},{key:"next",value:function(){var e,r=this,t=r._ImgManager.count();if(r._resetErr(),!r._isValid())return!1;if(r._isNoViewer())return r._nouiNotSupport("next");t>0&&(null===(e=r._UIView)||void 0===e||e.__Next(),jH.__innerRefreshFromUIView(r,r._ImgManager.getCurrentImageIndex()));return!0}},{key:"last",value:function(){var e,r=this,t=r._ImgManager.count();if(r._resetErr(),!r._isValid())return!1;if(r._isNoViewer())return r._nouiNotSupport("last");t>0&&(null===(e=r._UIView)||void 0===e||e.Go(t-1),jH.__innerRefreshFromUIView(r,r._ImgManager.getCurrentImageIndex()));return!0}},{key:"_isBindViewer",value:function(){return!(!this._viewer||!this._viewer.webViewer)&&this._viewer.webViewer.bindViewUI}},{key:"_isNoViewer",value:function(){return!this._isBindViewer()}},{key:"_innerUnbindViewer",value:function(e){var r=this;r.__funResize&&(jr.removeEventListener(window,"resize",r.__funResize),r.__funResize=!1),r._viewer&&(e?r._viewer.webViewer.dispose():r._viewer.unbind()),r._config.container=null}},{key:"_unload_viewer",value:function(){var e=this;if(e._isBindViewer())e._innerUnbindViewer(!0);else{var r,t=null===(r=e._containerElement)||void 0===r?void 0:r.id;t&&delete xn.ContainerMap[t]}e._ImgManager&&(e._ImgManager.dispose(),e._ImgManager=undefined),e._UIView&&(e._UIView.dispose(),e._UIView=undefined),e._viewer=undefined}},{key:"_innerRefreshUI",value:function(e,r,t,n,i){var o=this;return 4==i&&o._isBindViewer()&&(0==o._ImgManager.bImageJustChangedInEditor?o._ImgManager.bImageChangedInViewer=!0:(o._ImgManager.bImageJustChangedInEditor=!1,o._ImgManager.bImageChangedInViewer=!1)),t&&o._ImgManager.refresh(e,o._ImgManager.count(),!0,n),jr.isFunction(o.__OnRefreshUI)&&o.__OnRefreshUI(o._ImgManager.getCurrentImageIndex(),o._ImgManager.count()),!0}},{key:"updateImage",value:(t=p(d().m(function f(e,r){var t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if(n=this,dt.Auto,!jr.isUndefined(e)&&0!=e.length){a.n=1;break}throw cv(n),{code:n._errorCode,message:n._errorString};case 1:if(jr.isString(e)){a.n=2;break}throw Tg(n),{code:n._errorCode,message:n._errorString};case 2:if(-1!=(i=n._uidFromServer2ServerId(e))){a.n=3;break}throw lv(n),{code:n._errorCode,message:n._errorString};case 3:if(!jr.isUndefined(r)){a.n=4;break}throw fv(n),{code:n._errorCode,message:n._errorString};case 4:if(r instanceof Blob){a.n=5;break}throw dv(n),{code:n._errorCode,message:n._errorString};case 5:return a.n=6,fG(r);case 6:return o=a.v,a.n=7,n._updateImage(i,o);case 7:null===(t=n._UIView)||void 0===t||null===(t=t.GetWebViewer())||void 0===t||null===(t=t.webViewer)||void 0===t||t.resetImageEditorButton();case 8:return a.a(2)}},f,this)})),function(e,r){return t.apply(this,arguments)})}],[{key:"_getContainer",value:function(e){return e._containerElement}},{key:"_setContainer",value:function(e,r){return e._containerElement=r}},{key:"_closeImageEditorUI",value:function(e){if(jr.isFunction(e.__CloseImageEditorUI))try{e.__CloseImageEditorUI()}catch(r){jr.error(r)}}}]);var t,n,i,o}(rG);function lG(e,r,t,n,i,o,a){var s,u=e._ImgManager.convertClientIndexToServerId(t);if(-1==u)return gg(e),jr.isFunction(i)&&i(e._errorCode,e._errorString),!1;if(s=e._innerFun(r,hm(u)),o)return s;var c=1==s;if(c){var l;if(a)kp.refreshImageAfterInvokeFun(e,t),null===(l=e.getView())||void 0===l||l.ClearSelectedAreas();jr.isFunction(n)&&n()}else jr.isFunction(i)&&i(e._errorCode,e._errorString);return c}function fG(e){return jr.isFunction(e.arrayBuffer)?e.arrayBuffer():new Promise(function(r,t){if(Dn.navInfoSync.bIE||Dn.navInfoSync.bSafari){var n=new FileReader;n.onload=function(){r(n.result)},n.onerror=function(e){t(e)},n.readAsArrayBuffer(e)}else{var i;hh(i={},-2856,"Cannot convert blob to array buffer."),t({code:i._errorCode,message:i._errorString})}})}function dG(e){var r=e,t=window;if(t.ShadowRoot)for(;r;){if(r instanceof t.ShadowRoot)return r;r=r.parentNode}return null}function hG(e){var r=window;return!!(r.ShadowRoot&&e instanceof r.ShadowRoot)}function gG(e){return Math.floor(e)}var vG,mG=um,pG=function(){return S(function t(e,r){_(this,t),this._stwain=e,this._ImgManager=e._ImgManager,this.zoomInStep=1.2,this.zoomOutStep=.8,this.MIN_ZOOM=.02,this.MAX_ZOOM=65,this.MAX_ROWS=128,this.MAX_COLUMNS=128,this.__MousewheelValue=0,this._Init(r)},[{key:"_Init",value:function(e){var r=this;if(r.borderWidth=jr.isUndefined(e.borderWidth)?1:e.borderWidth,e.BackgroundColor?r.BackgroundColorByDefault=e.BackgroundColor:r.BackgroundColorByDefault="#FFFFFF",e.BackgroundColor=r.BackgroundColorByDefault,r.BackgroundFillColor=r.BackgroundColorByDefault,e.onTopImageInTheViewChanged=function(e){jr.isFunction(r._stwain.__OnTopImageInTheViewChanged)&&r._stwain.__OnTopImageInTheViewChanged(e.index,e.bByScrollBar)},e.onGetImageInfo=function(e){return{width:r._stwain.GetImageWidth(e),height:-1}},!r._stwain._viewer&&xn.UseDefaultViewer){var t,n={viewerContainer:{},viewerEvents:{topPageChanged:function(e,t){r.__topPageChanged(e,t,r)},click:function(e){r.__click(e,r)},rightclick:function(e){r.__rightclick(e,r)},dblclick:function(e){r.__dblclick(e,r)},mousemove:function(e){r.__mousemove(e,r)},pageAreaSelected:function(e,t){r.__pageAreaSelected(e,t,r)},pageAreaUnselected:function(e){r.__pageAreaUnselected(e,r)},dragdone:function(e){r.__dragdone(e,r)},onDrop:function(e){r.__onDrop(e,r)},pageChange:function(e){r.__pageChange(e,r)},bufferChanged:function(e,t){r.__bufferChanged(r,e,t)},onBind:function(e){r.__onBindViewer(e)},onUnBind:function(e){r.__onUnBindViewer(e)},save:function(e,t,n,i){return r.__save(r,e,t,n,i)},removeBtnClick:function(e){r.__removePage(r,e)}},viewerError:{setError:function(e,t){r.__setError(e,t,r)}},imageEditorEvents:{acquire:function(e){r.__acquire(r,e)},loadImage:function(){r.__loadImage(r)},deskew:function(e,t){r.__deskew(r,e,t)},removeImage:function(){r.__remove(r)},removeAllImage:function(){r.__removeAll(r)},close:function(){r.__close(r)}},imageEditorServerCallback:{rotateRight:function(){r.__rotateRightForServer(r)},rotate:function(e,t,n){r.__rotateForServer(r,e,t,n)},rotateLeft:function(){r.__rotateLeftForServer(r)},deskew:function(e){r.__deskewForServer(r)},crop:function(e){r.__cropForServer(r,e)},erase:function(e){r.__eraseForServer(r,e)},changeImageSize:function(e,t,n){r.__changeImageSizeForServer(r,e,t,n)},flip:function(){r.__flipForServer(r)},mirror:function(){r.__mirrorForServer(r)},restore:function(e){r.__restoreForServer(r,e)},save:function(e){return r.__saveForServer(r,e)}},beforeImageEditorCreated:function(e){r.__beforeImageEditorCreated(e)}};if(e.Container&&(Cs.isNodeList(e.Container)||jr.isArray(e.Container)&&e.Container.length>0)&&(n.viewerContainer={container:e.Container[0],width:gG(e.Width),height:gG(e.Height)}),r._stwain._viewer=new Dn.DWTViewer(PH._getBuffer(r._ImgManager),n),null!==(t=xn.Token)&&void 0!==t?t:""){var i,o=null===(i=r._stwain._viewer)||void 0===i?void 0:i.webViewer;null==o||o.setImageLoadToken(xn.Token)}}else e.Container&&(Cs.isNodeList(e.Container)||jr.isArray(e.Container)&&e.Container.length>0)&&r.__onBindViewer(e.Container[0]);r.__InitEvents(e)}},{key:"dispose",value:function(){}},{key:"__InitEvents",value:function(e){var r=this;jr.isFunction(e.onTopImageInTheViewChanged)&&(r.onTopImageInTheViewChanged=e.onTopImageInTheViewChanged),jr.isFunction(e.onGetImageInfo)&&(r.onGetImageInfo=e.onGetImageInfo),jr.isFunction(e.onZoomChanged)&&(r.onZoomChanged=e.onZoomChanged),jr.isFunction(e.onMouseMove)&&(r.onMouseMove=e.onMouseMove),jr.isFunction(e.onMouseClick)&&(r.onMouseClick=e.onMouseClick),jr.isFunction(e.onMouseRightClick)&&(r.onMouseRightClick=e.onMouseRightClick),jr.isFunction(e.onMouseDoubleClick)&&(r.onMouseDoubleClick=e.onMouseDoubleClick),jr.isFunction(e.onImageAreaDeSelected)&&(r.onImageAreaDeSelected=e.onImageAreaDeSelected),jr.isFunction(e.onImageAreaSelected)&&(r.onImageAreaSelected=e.onImageAreaSelected),jr.isFunction(e.onBufferChanged)&&(r.onBufferChanged=e.onBufferChanged),jr.isFunction(e.onSelected)&&(r.onSelected=e.onSelected),jr.isFunction(e.onRefreshUI)&&(r.onRefreshUI=e.onRefreshUI),jr.isFunction(e.onResetCurrentIndex)&&(r.onResetCurrentIndex=e.onResetCurrentIndex)}},{key:"GetWebViewer",value:function(){return this._stwain._viewer}},{key:"SetSelectedImageArea",value:function(e,r,t,n){if(null!=this.GetWebViewer()){var i=[],o={};return o.left=e,o.top=r,o.right=t,o.bottom=n,i.push(o),this.GetWebViewer().setSelectedAreas(i)}return!1}},{key:"OverlayRectangle",value:function(e,r,t,n,i,o,a){var s=this;return!!s._stwain._isNoViewer()||null!=s.GetWebViewer()&&s.GetWebViewer().webViewer.overlayRectangle(e,r,t,n,i,o,a)}},{key:"ChangeImageViewSize",value:function(e,r){var t=this;return e>=0&&(t.GetWebViewer().width,t.GetWebViewer().width=e),r>=0&&(t.GetWebViewer().height,t.GetWebViewer().height=r),!0}},{key:"ChangeSize",value:function(e,r){var t=this,n=t.GetWebViewer();return t._stwain._isNoViewer()||!n||(t.GetWidth()!=e&&t.SetWidth(e),t.GetHeight()!=r&&t.SetHeight(r)),!0}},{key:"GetWidth",value:function(){var e=this.GetWebViewer();return e?e.width:0}},{key:"SetWidth",value:function(e){var r=this,t=r.GetWebViewer(),n=e;return!(r._stwain._isNoViewer()||!t)&&(!(!jr.isString(n)&&!jr.isNumber(n))&&(r.GetWebViewer().width=n,!0))}},{key:"GetHeight",value:function(){var e=this.GetWebViewer();return e?e.height:0}},{key:"SetHeight",value:function(e){var r=this,t=r.GetWebViewer(),n=e;return!(r._stwain._isNoViewer()||!t)&&(!(!jr.isString(n)&&!jr.isNumber(n))&&(r.GetWebViewer().height=n,!0))}},{key:"SetViewMode",value:function(e,r){var t=this;return t._stwain._isNoViewer()?t._stwain._nouiNotSupport("SetViewMode"):t.GetWebViewer().setViewMode(e,r)}},{key:"SetIfFitWindowAndType",value:function(e){var r;if(null!=this.GetWebViewer()){switch(e){case 1:r="height";break;case 2:r="width";break;default:r="window"}this.GetWebViewer().fitWindow(r)}return!0}},{key:"GetAllowMultiSelect",value:function(){return!this._stwain._isNoViewer()&&this.GetWebViewer().selectionMode}},{key:"SetAllowMultiSelect",value:function(e){var r=this;return r._stwain._isNoViewer()||(r.GetWebViewer().selectionMode=e?1:0),!0}},{key:"GetFitWindowType",value:function(){return this._stwain._isNoViewer(),0}},{key:"SetSelectionRectAspectRatio",value:function(e){return this.GetWebViewer().selectionRectAspectRatio=e,!0}},{key:"GetSelectionRectAspectRatio",value:function(){return this.GetWebViewer().selectionRectAspectRatio}},{key:"SetFitWindowType",value:function(e){return this._stwain._isNoViewer()||this.SetIfFitWindowAndType(e),!0}},{key:"GetIfFitWindow",value:function(){return this._stwain._isNoViewer(),!0}},{key:"SetIfFitWindow",value:function(e){var r=this;return r._stwain._isNoViewer()||(e?r.GetWebViewer().fitWindow("window"):r.GetWebViewer().zoom=1),!0}},{key:"GetImageMargin",value:function(){return this._stwain._isNoViewer()?0:this.GetWebViewer().pageMargin}},{key:"SetImageMargin",value:function(e){return this._stwain._isNoViewer()||(this.GetWebViewer().pageMargin=e),!0}},{key:"GetSelectionImageBorderColor",value:function(){return this.GetWebViewer().selectedPageBorder}},{key:"SetSelectionImageBorderColor",value:function(e){var r=e;return jr.isNumber(r)&&(r=hs.getColor(r)),-1==r.indexOf("1px solid")&&(r="1px solid "+r),this.GetWebViewer().selectedPageBorder=r,!0}},{key:"GetZoom",value:function(){return this.GetWebViewer().zoom}},{key:"SetZoom",value:function(e,r,t){var n=this;return e<n.MIN_ZOOM&&(e=n.MIN_ZOOM),e>n.MAX_ZOOM&&(e=n.MAX_ZOOM),null!=n.GetWebViewer()&&(n.GetWebViewer().zoom=e),!0}},{key:"ZoomIn",value:function(e,r){var t=this,n=t._ImgManager.getImageIdMap(t._ImgManager.convertClientIndexToServerId(t._ImgManager.getCurrentImageIndex()));if(!n)return!1;var i=t.GetWebViewer().zoom,o=ds(),a=Math.floor(100*i*t.zoomInStep)+1;return 1<a&&a<2501?gG(n.imageWidth*i)>15e3||gG(n.imageHeight*i)>15e3?(um.output(t,o.errorMessages.limitReachedForZoomIn),alert(o.errorMessages.limitReachedForZoomIn),!1):(t.SetZoom(a/100,e,r),!0):(um.output(t,o.errorMessages.limitReachedForZoomIn),alert(o.errorMessages.limitReachedForZoomIn),!1)}},{key:"ZoomOut",value:function(){var e=this,r=e.GetWebViewer().zoom,t=Math.floor(100*r*e.zoomOutStep)-1;if(!(1<t&&t<6501)){var n=ds();return um.output(e,n.errorMessages.limitReachedForZoomOut),alert(n.errorMessages.limitReachedForZoomOut),!1}return e.SetZoom(t/100),!0}},{key:"GetMouseShape",value:function(){return this._stwain._isNoViewer()?0:"crosshair"!=this.GetWebViewer().cursor}},{key:"SetMouseShape",value:function(e){var r=this;return r._stwain._isNoViewer()||(r.GetWebViewer().cursor=e?"pointer":"crosshair"),!0}},{key:"GetShowPageNumber",value:function(){return!this._stwain._isNoViewer()&&this.GetWebViewer().showPageNumber}},{key:"SetShowPageNumber",value:function(e){return this._stwain._isNoViewer()||(this.GetWebViewer().showPageNumber=e),!0}},{key:"SetBackgroundFillColor",value:function(e){var r=e;return this.BackgroundFillColor=r,!0}},{key:"GetBackgroundColor",value:function(){return this.GetWebViewer().background}},{key:"SetBackgroundColor",value:function(e){var r=e;return this._stwain._isNoViewer()||(this.GetWebViewer().background=r),!0}},{key:"Go",value:function(e){return this.GetWebViewer().gotoPage(e)}},{key:"__Previous",value:function(){return this.Go(this._ImgManager.getCurrentImageIndex()-1),!0}},{key:"__Next",value:function(){return this.Go(this._ImgManager.getCurrentImageIndex()+1),!0}},{key:"__fireEvent",value:function(e,r){if(jr.isFunction(this[e]))try{return this[e](r)}catch(t){jr.error(t)}return!0}},{key:"GetIfAutoScroll",value:function(){var e;return null===(e=this.GetWebViewer())||void 0===e?void 0:e.ifAutoScroll}},{key:"SetIfAutoScroll",value:function(e){return this.GetWebViewer().ifAutoScroll=e,!0}},{key:"BindView",value:function(e){var r,t,n=e;return jr.isString(e)?n=jr.get(e):jr.isDOM(n)&&(n.id&&""!=n.id||(n.id=["dwt_",jr.getRandom()].join(""))),(t=null===(r=this.GetWebViewer())||void 0===r?void 0:r.bind(n))&&this.GetWebViewer().show(),t}},{key:"GetIfShowVideoContainer",value:function(){var e=this,r=e.GetWebViewer();return jr.isUndefined(r)?(xn.UseDefaultViewer?Og(e._stwain):xg(e._stwain),!1):r.webViewer.getIfShowVideoContainer()}},{key:"ShowVideoContainer",value:function(e){var r=this,t=r.GetWebViewer();return jr.isUndefined(t)?(xn.UseDefaultViewer?Og(r._stwain):xg(r._stwain),!1):t.webViewer.showVideoContainer(e)}},{key:"UpdateVideoContainer",value:function(e){var r=this,t=r.GetWebViewer();return jr.isUndefined(t)?(xn.UseDefaultViewer?Og(r._stwain):xg(r._stwain),!1):t.webViewer.updateVideoImage(e)}},{key:"ClearSelectedAreas",value:function(){var e=this.GetWebViewer();if(e)return e.clearSelectedAreas()}},{key:"OnCloseImageEditor",value:function(){return!!this.GetWebViewer().webViewer.imageEditor&&(this.GetWebViewer().createImageEditor().dispose(),!0)}},{key:"ShowImageEditorEx",value:function(e,r,t,n,i,o,a,s){var u=this;if(this._stwain._isNoViewer())return u._stwain._nouiNotSupport("ShowImageEditorEx");switch(i){case 0:case 1:case 2:break;case 3:if(u.OnCloseImageEditor())return!0}var c,l=document;if(cG._getContainer(u._stwain)==a&&(o=!1),a){var f=xn.ContainerMap;if(f){var d,h=Object.keys(f);for(d=0;d<h.length;d++)if(h[d]==a.id){o=!1;break}}}if(o&&a&&(jr.isDOM(a)?c=a:hG(a)?(c=document.createElement("div"),a.appendChild(c)):(c=l.getElementById(a))&&"DIV"!=c.nodeName&&(o=!1)),o&&a&&jr.isDOM(a)){var g=dG(a);if(g){if(xn.IfLoadResources){var v="";!se.bFileSystem&&xn.IfResourcesAddTimestamp&&(v=On.timestamp);var m,p,_=om(),y="";jr.isString(_)&&_.length>0&&("/"==_.charAt(_.length-1)||(y="/")),(m=l.createElement("link")).href=[_,y,"src/dynamsoft.webtwain.viewer.css",v].join(""),m.rel="stylesheet",m.async=!0,(p=l.createElement("link")).href=[_,y,"src/dynamsoft.webtwain.css",v].join(""),p.rel="stylesheet",p.async=!0,jr.scriptOnload(m,function(){jr.scriptOnload(p,function(){return u.ShowImageEditor(c,o,t,n)}),g.appendChild(p)}),g.appendChild(m)}return!0}}return u.ShowImageEditor(c,o,t,n)}},{key:"ShowImageEditor",value:function(e,r,t,n){var i=ds(),o=this,a={background:"#434246",topMenuBorder:"",innerBorder:"",promptToSaveChange:!0,buttons:i.buttons,dialogText:i.dialogText};return e&&t&&n?(a.element=e,a.width=t,a.height=n):(a.element=undefined,a.width=undefined,a.height=undefined),a.border=o.GetWebViewer().border,a.selectionRectAspectRatio=o.GetWebViewer().selectionRectAspectRatio,a.workMode=ht.normal,o.GetWebViewer().createImageEditor(a),0!=o._stwain.ErrorCode&&(o.GetWebViewer().webViewer.imageEditor&&o.GetWebViewer().webViewer.imageEditor.dispose(),o.GetWebViewer().createImageEditor(a)),o.GetWebViewer().webViewer.imageEditor&&o.GetWebViewer().webViewer.imageEditor.show(),!0}},{key:"__beforeImageEditorCreated",value:function(e){var r=ds();if(!jr.isUndefined(r)){if(!jr.isUndefined(r.buttons)){var t=r.buttons.titles;jr.isUndefined(t)||(jr.isUndefined(t.previous)||(e.buttons.titles.previous=t.previous),jr.isUndefined(t.next)||(e.buttons.titles.next=t.next),jr.isUndefined(t.print)||(e.buttons.titles.print=t.print),jr.isUndefined(t.scan)||(e.buttons.titles.scan=t.scan),jr.isUndefined(t.load)||(e.buttons.titles.load=t.load),jr.isUndefined(t.rotateleft)||(e.buttons.titles.rotateleft=t.rotateleft),jr.isUndefined(t.rotate)||(e.buttons.titles.rotate=t.rotate),jr.isUndefined(t.rotateright)||(e.buttons.titles.rotateright=t.rotateright),jr.isUndefined(t.deskew)||(e.buttons.titles.deskew=t.deskew),jr.isUndefined(t.crop)||(e.buttons.titles.crop=t.crop),jr.isUndefined(t.cut)||(e.buttons.titles.cut=t.cut),jr.isUndefined(t.changeimagesize)||(e.buttons.titles.changeimagesize=t.changeimagesize),jr.isUndefined(t.flip)||(e.buttons.titles.flip=t.flip),jr.isUndefined(t.mirror)||(e.buttons.titles.mirror=t.mirror),jr.isUndefined(t.zoomin)||(e.buttons.titles.zoomin=t.zoomin),jr.isUndefined(t.originalsize)||(e.buttons.titles.originalsize=t.originalsize),jr.isUndefined(t.zoomout)||(e.buttons.titles.zoomout=t.zoomout),jr.isUndefined(t.stretch)||(e.buttons.titles.stretch=t.stretch),jr.isUndefined(t.fit)||(e.buttons.titles.fit=t.fit),jr.isUndefined(t.fitw)||(e.buttons.titles.fitw=t.fitw),jr.isUndefined(t.fith)||(e.buttons.titles.fith=t.fith),jr.isUndefined(t.hand)||(e.buttons.titles.hand=t.hand),jr.isUndefined(t.rectselect)||(e.buttons.titles.rectselect=t.rectselect),jr.isUndefined(t.zoom)||(e.buttons.titles.zoom=t.zoom),jr.isUndefined(t.restore)||(e.buttons.titles.restore=t.restore),jr.isUndefined(t.save)||(e.buttons.titles.save=t.save),jr.isUndefined(t.close)||(e.buttons.titles.close=t.close),jr.isUndefined(t.removeall)||(e.buttons.titles.removeall=t.removeall),jr.isUndefined(t.removeselected)||(e.buttons.titles.removeselected=t.removeselected));var n=r.buttons.bShowAllButtons;jr.isUndefined(n)||(e.buttons.bShowAllButtons=n);var i=r.buttons.visibility;jr.isUndefined(i)||(jr.isUndefined(i.scan)||(e.buttons.visibility.scan=i.scan),jr.isUndefined(i.load)||(e.buttons.visibility.load=i.load),jr.isUndefined(i.print)||(e.buttons.visibility.print=i.print),jr.isUndefined(i.removeall)||(e.buttons.visibility.removeall=i.removeall),jr.isUndefined(i.removeselected)||(e.buttons.visibility.removeselected=i.removeselected),jr.isUndefined(i.rotateleft)||(e.buttons.visibility.rotateleft=i.rotateleft),jr.isUndefined(i.rotate)||(e.buttons.visibility.rotate=i.rotate),jr.isUndefined(i.rotateright)||(e.buttons.visibility.rotateright=i.rotateright),jr.isUndefined(i.deskew)||(e.buttons.visibility.deskew=i.deskew),jr.isUndefined(i.crop)||(e.buttons.visibility.crop=i.crop),jr.isUndefined(i.cut)||(e.buttons.visibility.cut=i.cut),jr.isUndefined(i.changeimagesize)||(e.buttons.visibility.changeimagesize=i.changeimagesize),jr.isUndefined(i.flip)||(e.buttons.visibility.flip=i.flip),jr.isUndefined(i.mirror)||(e.buttons.visibility.mirror=i.mirror),jr.isUndefined(i.zoomin)||(e.buttons.visibility.zoomin=i.zoomin),jr.isUndefined(i.originalsize)||(e.buttons.visibility.originalsize=i.originalsize),jr.isUndefined(i.zoomout)||(e.buttons.visibility.zoomout=i.zoomout),jr.isUndefined(i.stretch)||(e.buttons.visibility.stretch=i.stretch),jr.isUndefined(i.fit)||(e.buttons.visibility.fit=i.fit),jr.isUndefined(i.fitw)||(e.buttons.visibility.fitw=i.fitw),jr.isUndefined(i.fith)||(e.buttons.visibility.fith=i.fith),jr.isUndefined(i.hand)||(e.buttons.visibility.hand=i.hand),jr.isUndefined(i.rectselect)||(e.buttons.visibility.rectselect=i.rectselect),jr.isUndefined(i.zoom)||(e.buttons.visibility.zoom=i.zoom))}var o=r.dialogText;jr.isUndefined(o)||(jr.isUndefined(o.dlgRotateAnyAngle)||(e.dialogText.dlgRotateAnyAngle=o.dlgRotateAnyAngle),jr.isUndefined(o.dlgChangeImageSize)||(e.dialogText.dlgChangeImageSize=o.dlgChangeImageSize),jr.isUndefined(o.saveChangedImage)||(e.dialogText.saveChangedImage=o.saveChangedImage),jr.isUndefined(o.selectSource)||(e.dialogText.selectSource=o.selectSource))}}},{key:"__topPageChanged",value:function(e,r,t){t.__fireEvent("onTopImageInTheViewChanged",{index:e,bByScrollBar:r})}},{key:"__click",value:function(e,r){var t=r;t.__fireEvent("onMouseClick",{e:e,x:e.imageX,y:e.imageY,index:t._ImgManager.getCurrentImageIndex()})}},{key:"__rightclick",value:function(e,r){var t=r;t.__fireEvent("onMouseRightClick",{e:e,x:e.imageX,y:e.imageY,index:t._ImgManager.getCurrentImageIndex()})}},{key:"__dblclick",value:function(e,r){var t=r;t.__fireEvent("onMouseDoubleClick",{e:e,x:e.imageX,y:e.imageY,index:t._ImgManager.getCurrentImageIndex()})}},{key:"__mousemove",value:function(e,r){var t=r;t.__fireEvent("onMouseMove",{e:e,x:e.imageX,y:e.imageY,index:t._ImgManager.getCurrentImageIndex()})}},{key:"__pageAreaSelected",value:function(e,r,t){var n=t,i=1;if(r&&r.length>0){var o=r[r.length-1];o.index&&(i=gG(o.index)+1),n.__fireEvent("onImageAreaSelected",{index:e,left:gG(o.x),top:gG(o.y),right:gG(o.x+o.width),bottom:gG(o.y+o.height),areaIndex:i})}}},{key:"__pageAreaUnselected",value:function(e,r){r.__fireEvent("onImageAreaDeSelected",e)}},{key:"__dragdone",value:function(e,r){var t=r;jr.isFunction(t._stwain.__OnIndexChangeDragDropDone)&&t._stwain.__OnIndexChangeDragDropDone(e)}},{key:"__onDrop",value:function(e,r){var t=r;t.GetWebViewer().webViewer.acceptDrop&&t.__dropEvent(e,t)}},{key:"__dropEvent",value:(r=p(d().m(function n(e,r){var t,i,o,a,s,u,c,l,f,h,g,v,m,p,_,y;return d().w(function(n){for(;;)switch(n.p=n.n){case 0:t=r,a=function(e){e&&um.output(null,e+" was loaded successfully!")},s=function(e,r,n){t._stwain._errorCode=e,t._stwain._errorString=r,n&&um.output(null,n+" failed to load. Error code: "+e+"Error String: "+r)},c=e.dataTransfer.files,t._stwain._loadImageBytesFileCount+=c.length,l=0;case 1:if(!(l<c.length)){n.n=19;break}if(0!=(i=c[l]).type.length){n.n=10;break}f=void 0,(h=i.name.indexOf("."))>0&&(f=i.name.substring(h+1)),_=f,n.n="bmp"===_?2:"jpg"===_||"jpeg"===_?3:"tif"===_||"tiff"===_?4:"png"===_?5:"pdf"===_?6:"jp2"===_||"j2k"===_||"j2c"===_?7:8;break;case 2:return o=ut.IT_BMP,n.a(3,9);case 3:return o=ut.IT_JPG,n.a(3,9);case 4:return o=ut.IT_TIF,n.a(3,9);case 5:return o=ut.IT_PNG,n.a(3,9);case 6:return o=ut.IT_PDF,n.a(3,9);case 7:return o=ut.IT_J2K,n.a(3,9);case 8:um.output(null,i.name+" failed to load because the file type is not supported!"),o=-1,jh(t._stwain);case 9:n.n=11;break;case 10:m=null!==(g=null===(v=i)||void 0===v?void 0:v.type)&&void 0!==g?g:"",-1==(o=Ss(m))&&(um.output(null,i.name+" failed to load because the file type is not supported!"),o=-1,jh(t._stwain));case 11:if(u=i.name,-1==o){n.n=16;break}return t._stwain._bIfShowProgressBar?(p=t._stwain.IfShowCancelDialogWhenImageTransfer,t._stwain.IfShowCancelDialogWhenImageTransfer=!1,On.showProgress(t._stwain,"DropLoading",t._stwain.IfShowCancelDialogWhenImageTransfer),t._stwain.IfShowCancelDialogWhenImageTransfer=p):On.hideProgress(),t._stwain._OnPercentDone([0,-1,vh]),t._stwain.Addon&&t._stwain.Addon.PDF&&jv.checkProductKey(t._stwain,{PDFRasterizer:!0},!0),n.p=12,n.n=13,new Promise(function(e,r){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){var n=t._stwain.__GetLoadEventsNum();On.cancelFrom=St.LoadImage,t._stwain.__LoadImageFromBytesV2(i,o,"",!0,0,i.size,!1,n,function(){t._stwain._loadImageBytesFileCount-=1,t._stwain.__OnPostLoad&&t._stwain.__OnPostLoad("",u||"",o),a(i.name),e()},function(n,a){-1119==n&&a.indexOf("correct password is not provided")>-1&&c.length>1?(s(n,a,i.name),t._stwain._loadImageBytesFileCount-=1,t._stwain.__OnPostLoad&&t._stwain.__OnPostLoad("",u||"",o),e()):r({code:n,message:a})})},n.onerror=function(e){tg(t._stwain),r({code:t._stwain._errorCode,message:e})}});case 13:n.n=15;break;case 14:n.p=14,y=n.v,t._stwain._bIfShowProgressBar&&On.closeProgress(null),y&&"code"in y&&"message"in y?s(y.code,y.message,u):wg(t._stwain,y),t._stwain._loadImageBytesFileCount-=1,t._stwain.__OnPostLoad&&t._stwain.__OnPostLoad("",u||"",o);case 15:t._stwain._bIfShowProgressBar&&On.closeProgress(null),n.n=17;break;case 16:Gg(t._stwain),t._stwain._loadImageBytesFileCount-=1,t._stwain.__OnPostLoad&&t._stwain.__OnPostLoad("",u||"",o);case 17:i=null;case 18:l++,n.n=1;break;case 19:return n.a(2)}},n,null,[[12,14]])})),function(e,t){return r.apply(this,arguments)})},{key:"__pageChange",value:function(e,r){var t,n=r,i=n._ImgManager.count();if(jr.log("OnPagination"),i<=0)Vh(n._stwain);else if(1!=i){if(!/^\d+$/.test(e)||e<=0){var o=ds();alert(o.errorMessages.invalidIndex)}else(t=gG(e)-1)<0?t=0:t>=i&&(t=i-1),t!=n._ImgManager.getCurrentImageIndex()&&n.GetWebViewer().gotoPage(t)}}},{key:"__bufferChanged",value:function(e,r,t){var n,i=e,o=[],a=-1,s=[];r.operation&&(r.action=r.operation);for(var u=0;u<i._ImgManager.count();u++)(n=i._ImgManager.getCustomDataByIndex(u))&&n.serverId&&o.push(this._ImgManager._serverId2uidFromServer(n.serverId));if(r.imageIds=o,r.curIndex>=0&&(n=i._ImgManager.getCustomDataByIndex(r.curIndex))&&n.serverId&&(a=this._ImgManager._serverId2uidFromServer(n.serverId)),r.currentId=a,"modify"==r.operation&&""!=r.afterStatus.modifiedUid){var c=i._ImgManager.getIndexByUid(r.afterStatus.modifiedUid);c>=0&&(n=i._ImgManager.getCustomDataByIndex(c))&&n.serverId&&(r.modifiedId=this._ImgManager._serverId2uidFromServer(n.serverId))}if(r.afterStatus.selectedUids)for(var l=0;l<r.afterStatus.selectedUids.length;l++){var f=r.afterStatus.selectedUids[l];if(f&&-1!=f){var d=i._ImgManager.getIndexByUid(r.afterStatus.selectedUids[l]);d>=0&&(n=i._ImgManager.getCustomDataByIndex(d))&&n.serverId&&s.push(this._ImgManager._serverId2uidFromServer(n.serverId))}}r.selectedIds=s,jr.mix(r,{}),delete r.uids,delete r.currentUid,delete r.selectedUids,delete r.afterStatus,delete r.beforeStatus,delete r.operation,delete r.curIndex,delete r.docUid,delete r.docName,i.__fireEvent("onBufferChanged",r)}},{key:"__setError",value:function(e,r,t){var n=t;n._stwain._errorCode=e,n._stwain._errorString=r}},{key:"__acquire",value:function(e,r){var t=e;try{var n=!1;1==xn.IfConfineMaskWithinTheViewer&&(xn.IfConfineMaskWithinTheViewer=!1,n=!0);var i;if(jr.isArray(r)&&r.length>=3)i=r;else i=ds().dialogText.selectSource;t._stwain._selectSourceAsync("SelectSourceAsync",null,i).then(function(){return t._stwain.AcquireImageAsync({IfShowUI:!0,IfCloseSourceAfterAcquire:!0})}).then(function(){n&&(xn.IfConfineMaskWithinTheViewer=!0)})["catch"](function(e){jr.log("User did not select a source"),n&&(xn.IfConfineMaskWithinTheViewer=!0)})}catch(o){}}},{key:"__loadImage",value:function(e){if(e){var r=e._stwain._containerElement;try{var t=e,n=null;xn.IfConfineMaskWithinTheViewer&&(n=!0,xn.IfConfineMaskWithinTheViewer=!1),t._stwain._containerElement=undefined;if(t._stwain.IfShowFileDialog=!0,t._stwain.Addon&&t._stwain.Addon.PDF){jv.checkProductKey(t._stwain,{PDFRasterizer:!0},!0)}t._stwain.LoadImageEx("",5,function(){r&&(t._stwain._containerElement=r),jr.log("Loaded an image successfully."),null!=n&&(xn.IfConfineMaskWithinTheViewer=n)},function(e,i){r&&(t._stwain._containerElement=r),jr.log("Loading failed with the error: "+i),null!=n&&(xn.IfConfineMaskWithinTheViewer=n)})}catch(i){r&&(e._stwain._containerElement=r)}}}},{key:"__print",value:function(e){var r=e;Ng(r._stwain),r._ImgManager.getCurrentImageIndex()<0||r._ImgManager.PrintCurrentImage()}},{key:"__save",value:(e=p(d().m(function i(e,r,t,n,o){var a,s,u,c,l,f;return d().w(function(i){for(;;)switch(i.p=i.n){case 0:if(a=e,s="save",e){i.n=1;break}return i.a(2);case 1:if(Ng(a._stwain),!(a._ImgManager.count()<=0||a._ImgManager.getCurrentImageIndex()<0)){i.n=2;break}return i.a(2);case 2:return u=e._stwain._containerElement,a._stwain._containerElement=undefined,c=a.__getViewerElement(a,o),zl(s,c),i.p=3,l=this._ImgManager.getIndexByUid(r),f=this._ImgManager.convertClientIndexToServerId(l),i.n=4,a._stwain._updateImage(f,t,n);case 4:i.v,i.n=6;break;case 5:i.p=5,i.v;case 6:return i.p=6,u&&(e._stwain._containerElement=u),t=null,Kl(s),i.f(6);case 7:return i.a(2,void 0)}},i,this,[[3,5,6,7]])})),function(r,t,n,i,o){return e.apply(this,arguments)})},{key:"__removePage",value:function(e,r){var t=e;e&&(t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0||t._stwain.RemoveImage(r))}},{key:"__getViewerElement",value:function(e,r){var t,n=e;if(r)if(n.GetWebViewer().webViewer.imageEditor){var i=n.GetWebViewer().createImageEditor();t="dwt-viewer-imageEditor-fullScreen"==i.inner.containerElement.className?{_containerElement:document.body}:{_containerElement:i.inner.containerElement}}else t=n._stwain;else t=n._stwain;return t}},{key:"__deskew",value:function(e,r,t){var n=this,i="deskew";Ng(n._stwain);var o=n._ImgManager.getCurrentImageIndex();if(n._ImgManager.count()<=0||o<0)mG.output(n,"No image in Buffer");else{var a=n.__getViewerElement(n,!0);zl(i,a);n._stwain.GetSkewAngleFromBinaryAsync(o,r,function(e){t(e[0]),Kl(i)},function(){Kl(i)})}}},{key:"__remove",value:function(e){var r=this;Ng(r._stwain),r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0?mG.output(r,"No image in Buffer"):r._stwain.RemoveAllSelectedImages()}},{key:"__removeAll",value:function(e){var r=this;Ng(r._stwain),r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0?mG.output(r,"No image in Buffer"):r._stwain.RemoveAllImages()}},{key:"__onBindViewer",value:function(e){e&&(cG._setContainer(this._stwain,e),e.id&&(xn.ContainerMap[e.id]=this._stwain))}},{key:"__onUnBindViewer",value:function(e){if(e){var r=cG._getContainer(this._stwain);if(r)for(;r.firstChild;)r.removeChild(r.firstChild);if(cG._setContainer(this._stwain,null),e.id){var t=xn.ContainerMap;e.id in t&&delete xn.ContainerMap[e.id]}}}},{key:"__close",value:function(e){Ng(this._stwain),cG._closeImageEditorUI(this._stwain)}},{key:"__rotateRightForServer",value:function(e){var r=this;Ng(r._stwain);var t=r._ImgManager.getCurrentImageIndex();r._ImgManager.count()<=0||t<0?mG.output(r,"No image in Buffer"):r._stwain.RotateRight(t)}},{key:"__rotateForServer",value:function(e,r,t,n){var i=this;Ng(i._stwain);var o=i._ImgManager.getCurrentImageIndex();i._ImgManager.count()<=0||o<0?mG.output(i,"No image in Buffer"):i._stwain.RotateEx(o,r,n,t)}},{key:"__rotateLeftForServer",value:function(e){var r=this;Ng(r._stwain);var t=r._ImgManager.getCurrentImageIndex();r._ImgManager.count()<=0||t<0?mG.output(r,"No image in Buffer"):r._stwain.RotateLeft(t)}},{key:"__deskewForServer",value:function(e){var r=this;Ng(r._stwain);var t=r._ImgManager.getCurrentImageIndex();r._ImgManager.count()<=0||t<0?mG.output(r,"No image in Buffer"):r._stwain.GetSkewAngleAsync(t).then(function(e){r._stwain.RotateEx(t,e,!0,5,function(){},function(){})})}},{key:"__cropForServer",value:function(e,r){var t=this;Ng(t._stwain);var n=t._ImgManager.getCurrentImageIndex();if(t._ImgManager.count()<=0||n<0)mG.output(t,"No image in Buffer");else{var i=r.left,o=r.top,a=i+r.width,s=o+r.height;t._stwain.Crop(n,gG(i),gG(o),gG(a),gG(s))}}},{key:"__eraseForServer",value:function(e,r){var t=this;Ng(t._stwain);var n=t._ImgManager.getCurrentImageIndex();if(t._ImgManager.count()<=0||n<0)mG.output(t,"No image in Buffer");else{var i=r.left,o=r.top,a=i+r.width,s=o+r.height;t._stwain.CutFrameToClipboard(n,gG(i),gG(o),gG(a),gG(s))}}},{key:"__changeImageSizeForServer",value:function(e,r,t,n){var i=this;Ng(i._stwain);var o=i._ImgManager.getCurrentImageIndex();i._ImgManager.count()<=0||o<0?mG.output(i,"No image in Buffer"):i._stwain.ChangeImageSize(o,r,t,n)}},{key:"__flipForServer",value:function(e){var r=this;Ng(r._stwain);var t=r._ImgManager.getCurrentImageIndex();r._ImgManager.count()<=0||t<0?mG.output(r,"No image in Buffer"):r._stwain.Flip(t)}},{key:"__mirrorForServer",value:function(e){var r=this;Ng(r._stwain);var t=r._ImgManager.getCurrentImageIndex();r._ImgManager.count()<=0||t<0?mG.output(r,"No image in Buffer"):r._stwain.Mirror(t)}},{key:"__restoreForServer",value:function(e,r){var t=e;if(Ng(t._stwain),t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0)mG.output(t,"No image in Buffer");else{var n=t._ImgManager.getIndexByUid(r);n>=0&&t.__RestoreImageInner(t,n)}}},{key:"__saveForServer",value:function(e,r){var t=e;return new Promise(function(e,n){Ng(t._stwain),(t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0)&&(mG.output(t,"No image in Buffer"),e());var i=t._ImgManager.getIndexByUid(r);i>=0?t.__SaveImageInner(t,i,!0,function(){e()}):e()})}},{key:"__RestoreImageInner",value:function(e,r,t){var n=e,i=n._ImgManager.getImageIdMap(n._ImgManager.convertClientIndexToServerId(r));i&&n.__OnGetImageFromServerForEdit(i,r,1,function(e,r,i){if(e){jr.log("__RestoreImageInner: "+[e.uuid].join(","));var o=jr.clone(e);o.imageId=e.serverId,n._ImgManager.UpdateImage(o,i)}if(-1==(e&&e.serverId))return t&&t(),!1;t&&t()})}},{key:"__SaveImageInner",value:function(e,r,t,n){var i=e,o=i._ImgManager.getImageIdMap(i._ImgManager.convertClientIndexToServerId(r));return o&&i.__OnGetImageFromServerForEdit(o,r,2,function(e,r,o){if(e){if(1==t&&(jr.log("__SaveImageInner: "+[e.uuid].join(",")),i._ImgManager.getCurrentImageIndex()==r)){var a=jr.clone(e);a.imageId=e.serverId,i._ImgManager.UpdateImage(a,o)}if(-1==e.serverId)return n&&n(),!1}return n&&n(),!0}),!0}},{key:"__OnGetImageFromServerForEdit",value:function(e,r,t,n){var i=this;if(n&&i._ImgManager.getBaseUrl){var o=i._ImgManager.convertClientIndexToServerId(r);if(-1==o)return!1;if(xn.ConnectWithSocket)n();else wp({method:"GET",xhrFields:{withCredentials:!0},url:um.getUrlByAct(i._ImgManager.getBaseUrl,o,t),onSuccess:function(t){var a;e.ticks=Date.now(),a=Dn.navInfoSync.bMobile?um.getImageUrl(i._ImgManager.getBaseUrl,o,Math.round(e.iImageControlWidth*devicePixelRatio),Math.round(e.iImageControlHeight*devicePixelRatio),e.ticks):um.getImageUrl(i._ImgManager.getBaseUrl,o,gG(e.iImageControlWidth),gG(e.iImageControlHeight),e.ticks),e.imageUrl=um.getImageUrl(i._ImgManager.getBaseUrl,o,-1,-1,e.ticks),e.minImageUrl=a;var s=i._ImgManager.GetMetaDataByIndex(r);if(s){var u=i._ImgManager.getImageIdMap(o);u&&u.width?s.width=u.width:s.width=i._stwain.GetImageWidth(r),u&&u.height?s.height=u.height:s.height=i._stwain.GetImageHeight(r)}n(e,r,s)},onError:function(){}})}return!0}}]);var e,r}(),_G=function(e){var r=e||window.event,t=!0;return jr.each(Cs.Events.registedObjs,function(e){jr.each(Cs.Events.registedClass,function(n){if(e instanceof n&&e.bFocus&&e.handlerKeyDown&&!(t=e.handlerKeyDown(r)))return!1})}),t};hf(function(){jr.addEventListener(document.documentElement,"keydown",_G)}),jr.mix(xn,{EnumDCP_DetectStatus:tt,EnumDWT_BorderStyle:en,EnumDWT_Browser:Zr,EnumDWT_CancelFrom:St,EnumDWT_Cap:yt,EnumDWT_CapAutoDiscardBlankPages:jt,EnumDWT_CapBitOrder:Ft,EnumDWT_CapBitdepthReduction:Pt,EnumDWT_CapFeederAlignment:wt,EnumDWT_CapFeederOrder:At,EnumDWT_CapFilterType:Dt,EnumDWT_CapFlash:xt,EnumDWT_CapFlipRotation:Ot,EnumDWT_CapImageFilter:Nt,EnumDWT_CapLanguage:It,EnumDWT_CapLightPath:Rt,EnumDWT_CapLightSource:Wt,EnumDWT_CapNoiseFilter:Mt,EnumDWT_CapORientation:Lt,EnumDWT_CapOverscan:Bt,EnumDWT_CapPixelFlavor:Ut,EnumDWT_CapPlanarChunky:Vt,EnumDWT_CapPrinter:Et,EnumDWT_CapPrinterMode:kt,EnumDWT_CapSupportedSizes:bt,EnumDWT_CapType:Ct,EnumDWT_CapValueType:Tt,EnumDWT_CheckCertMode:$r,EnumDWT_CompressionType:un,EnumDWT_ConfirmExitType:Hr,EnumDWT_Connect_Error:ot,EnumDWT_ConvertMode:Ht,EnumDWT_DNSServiceType:Yt,EnumDWT_DUPLEX:on,EnumDWT_DataSourceStatus:sn,EnumDWT_DeviceType:Gt,EnumDWT_Driver:Xt,EnumDWT_Error:it,EnumDWT_ExtImageInfo:at,EnumDWT_FileFormat:nn,EnumDWT_FitWindowType:Gr,EnumDWT_ImageFormatType:st,EnumDWT_ImageType:ut,EnumDWT_InitMsg:et,EnumDWT_InterpolationMethod:zr,EnumDWT_Language:Kr,EnumDWT_LicenseErrorCode:nt,EnumDWT_MagType:an,EnumDWT_MessageType:rn,EnumDWT_MouseShape:Jr,EnumDWT_OnBitmapOp:Zt,EnumDWT_PDFCompressionType:ct,EnumDWT_PixelType:lt,EnumDWT_PlatformType:rt,EnumDWT_ResponseType:vt,EnumDWT_SelectionMode:Qr,EnumDWT_ServiceType:qr,EnumDWT_ShowMode:Yr,EnumDWT_SourceMatchField:$t,EnumDWT_TIFFCompressionType:ft,EnumDWT_TransferMode:tn,EnumDWT_UnitType:Xr,EnumDWT_UpdateImageType:dt,EnumDWT_UploadDataFormat:mt,EnumDWT_UploadStatus:pt,EnumDWT_WebsocketReadyState:_t,EnumDWT_WorkMode:ht,EnumPDF_Page:gt,EsclAndWifiDeviceType:Qt,TwainAndWiaTwainDeviceType:qt});var yG=20230506,SG=function(){if(Dn.dcp){var e=Dn.dcp.dcpJSVer;if(jr.isNumber(e))return e>=yG}return!1};if(SG())SG=vG,yG=vG;else{var IG=$u.detect,bG={_checkService:function(e,r){IG.dcpStatus=IG.EnumDCP_DetectStatus.CheckingServiceVer,CG(null,"DSVersion").then(e,r)},_checkUpdateFile:function(e,r){CG(null,"CheckUpdateFile").then(e,r)},_updateService:function(e,r){CG(null,"UpdateService").then(e,r)},_getDSUpdateZipUrl:function(){var e,r,t="";e="Win",se.bMac?e="Mac":se.bLinux&&(e="Linux"),r=se.bFileSystem?"":"?t="+jr.now(),se.bWin&&$u.b64bit&&(t="_x64");var n=om(),i="";return jr.isString(n)&&n.length>0&&("/"==n.charAt(n.length-1)||(i="/")),[n,i,"dist/serviceupdate/",e,"DSUpdate_",th().join("."),t,".zip",r].join("")},getPorts:function(e,r){var t="GetPorts",n="dwasm2_"+oh();return TG(e,t,{id:jr.guid(),method:t,version:n,parameter:[r]},Hs())},_getErr:function(e){var r,t="";try{jr.isString(e)?(r=e.replace(/\0/g,""),r=jr.parse(r)):e&&(r=e),"description"in r&&(t=r.description)}catch(n){}return t},_funShowUpgradeDialogWhenUpdateFailed:function(e,r){return IG.bConnected=!0,IG.dcpStatus=IG.EnumDCP_DetectStatus.UpdateFailed,e&&e(),r&&r(),$u._sendStatusEvent(!0),!0},_funUpdateFailed:function(e,r,t,n){var i,o;return IG.bConnected=!0,IG.dcpStatus=IG.EnumDCP_DetectStatus.UpdateFailed,e&&e(),200==n?(i="The update failed.",o=$u._getStatusString(IG.dcpStatus,bG._getErr(t))):o=i="The update failed. The error code is "+n,r&&r(!0,i),$u._sendStatusEvent(!0,o),!0},getDSPath:function(e,r){return xc.getDSPath(r)},getLinuxHTML5DebPath:function(){return xc.getDSPath(".deb")},getLinuxHTML5RpmPath:function(){return xc.getDSPath(".rpm")},getBinaryFileInfo:function(e,r){var t="GetBinaryFileInfo",n={id:jr.guid(),method:t,version:"dwasm2_"+oh(),parameter:[]},i=jr.stringify(n),o=function(t,n,i){var o;t&&(o=jr.parse(t)),o?e(o):r(t,n,i)};if(xn.ConnectWithSocket&&xc.bHTML5Edition){var a=xn.Host,s=bu.getWsUrl(xn.Host,Ks(a)?$u.SSLPort:$u.Port);return bu.postStringDataByWSUrl(s,i).then(o,r),!0}var u,c,l=[ih(),"/",t,"?type=1&dsver=",nh().join(""),"&ts=",jr.now()].join(""),f=il();ac(c={},ym());var d=null!==(u=xn.Token)&&void 0!==u?u:"";d&&(c.headers||(c.headers={}),c.headers.Authorization="Bearer "+d),f.request(i,l,c,500).then(o,r)}};jr.mix($u,bG),Dn.dcp=$u,Dn.dcp.dcpJSVer=yG,SG=vG,yG=vG}function CG(e,r,t,n){var i;return i={id:jr.guid(),method:r,version:"dwasm2_"+oh(),parameter:[]},"VersionInfo"==r&&(i.version="dwasm2_"+js.getVersionStrForCheck()),(Rc(t)||Wc(t))&&(i.productKey=t),TG(e,r,i,Hs(),n)}function TG(e,r,t,n,i){return wG.apply(this,arguments)}function wG(){return(wG=p(d().m(function e(r,t,n,i,o){var a,s,u,c,l,f,h,g,v,m,p,_,y,S;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return s=jr.stringify(n),$u.detect.bConnected=!1,u=[ih(),"/",t,"?type=1&dsver=",nh().join(""),"&ts=",jr.now()].join(""),l=Ks(r),f=l?$u.SSLPort:$u.Port,c=$s.getHttpClient(r,f,l),ac(h={},ym()),o&&!l&&(h.redirect="manual"),(g=null!==(a=xn.Token)&&void 0!==a?a:"")&&(h.headers||(h.headers={}),h.headers.Authorization="Bearer "+g),e.p=1,e.n=2,c.request(s,u,h,i);case 2:v=e.v,e.n=5;break;case 3:if(e.p=3,S=e.v,!o||l){e.n=4;break}if((S&&S.code)!=it.HTTPRedirected){e.n=4;break}throw vc();case 4:throw S;case 5:if(v&&(m=jr.parse(v)),!(m&&"exception"in m&&"description"in m)){e.n=6;break}throw p={code:m.exception,message:m.description},(_=Tm(m))&&(p.errorCause=_),p;case 6:if(!m||!("result"in m)){e.n=8;break}if(!$u.detect.bConnected){e.n=7;break}return e.a(2,m.result);case 7:return $u.detect.bConnected=!0,$u.detect.dcpStatus=$u.detect.EnumDCP_DetectStatus.Connected,e.a(2,m.result);case 8:throw $g(y={}),bm(y);case 9:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function AG(){pf(),ls(),jr.isString(xn.ProductKey)&&(xn.ProductKey=jr.trim(xn.ProductKey)),Dn.navInfo&&(se.bMac||se.bWin)&&(Dn.navInfo.bEmbed=!1,Dn.navInfo.bArm64=!1,Dn.navInfo.bMips64=!1),xn.Debug&&(jr.debug=!0)}function EG(){return kG.apply(this,arguments)}function kG(){return kG=p(d().m(function e(){var r,t,n,i;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!On.detect.cssLoaded){e.n=1;break}return e.a(2);case 1:if(xn.IfLoadResources){e.n=2;break}return On.detect.cssLoaded=!0,e.a(2);case 2:return r=om(),t="",n="",jr.isString(r)&&r.length>0&&("/"==r.charAt(r.length-1)||(n="/")),!se.bFileSystem&&xn.IfResourcesAddTimestamp&&(t=On.timestamp),i=[[r,n,"src/dynamsoft.webtwain.css",t].join("")],xc.bHTML5Edition&&xn.UseDefaultViewer&&i.push([r,n,"src/dynamsoft.webtwain.viewer.css",t].join("")),On.detect.cssLoaded=!0,e.p=3,e.n=4,new Promise(function(e,r){if(se.bSafari){var t=!1;if(jr.addAllCss(i,!1,function(e){e||xn.IfCheckCssFiles&&(t=!0)}),t)r({code:-2804,message:"Loading the WebTwain css files failed."});else e()}else jr.addAllCss(i,!1,function(t){!t&&xn.IfCheckCssFiles?r({code:-2804,message:"Loading the WebTwain css files failed."}):e()})});case 4:xc.bHTML5Edition&&!se.bFileSystem&&xn.IfCheckCssFiles&&(se.bSafari?setTimeout(function(){try{PG(i)}catch(e){Yc(e)}},1e3):PG()),e.n=6;break;case 5:e.p=5,Yc(e.v);case 6:return e.a(2)}},e,null,[[3,5]])})),kG.apply(this,arguments)}function PG(e){var r=document.createElement("div"),t=!1;if(r.style.display="none",document.body.appendChild(r),r.className="dynamsoft-zmyljydys","rgb(254, 142, 20)"===getComputedStyle(r).backgroundColor&&(Dn.DWT.UseDefaultViewer?(r.className="dvs-imageEditor-mask",t="rgb(220, 226, 241)"===getComputedStyle(r).backgroundColor):t=!0),document.body.removeChild(r),0==t)throw{code:-2804,message:"Loading the WebTwain css files failed."}}var FG=new Dc(function(){return Zu.loadingResourcePath});function DG(){return xG.apply(this,arguments)}function xG(){return xG=p(d().m(function e(){var r,t,n,i,o,a,s;return d().w(function(e){for(;;)switch(e.n){case 0:if(dh(bh),AG(),!Zu.loadResourcePath){e.n=1;break}return e.a(2,Promise.resolve());case 1:if(!Zu.loadingResourcePath){e.n=2;break}return e.a(2,FG.asyncWaitingJSLoaded());case 2:if(Zu.loadingResourcePath=!0,(xn.Port>0||xn.SSLPort>0)&&(On.detect.ports=[{port:xn.Port,ssl:!1},{port:xn.SSLPort,ssl:!0}],nc.removeItem("DWT_port"),nc.removeItem("DWT_ssl")),jr.each(On._funsAfterConfigLoaded,function(e){try{jr.isFunction(e)&&e()}catch(r){}}),(r=jr.sizzle(".dynamsoft_waiting"))&&r.length>0&&(t=r[0]).parentNode&&t.parentNode.removeChild(t),n=om(),i="",o="",jr.isString(n)&&n.length>0&&("/"==n.charAt(n.length-1)||(o="/")),!se.bFileSystem&&xn.IfResourcesAddTimestamp&&(i=On.timestamp),a=!0,s=[],se.bSafari&&(a=!1),s.push([n,o,"dynamsoft.webtwain.install.js",i].join("")),xn.bNpm&&(s=[]),xc.bHTML5Edition&&xn.UseDefaultViewer&&(dh(Ch),s.push([n,o,"src/dynamsoft.webtwain.viewer.js",i].join(""))),xn.IfLoadResources||(s=[]),EG(),0!=s.length){e.n=3;break}return OG(),Zu.loadResourcePath=!0,Zu.loadingResourcePath=!1,e.a(2,Promise.resolve());case 3:return e.a(2,new Promise(function(e,r){jr.addScripts(s,a,!1,function(t){var n="ok"===t;if(n&&(xc.bHTML5Edition&&xn.UseDefaultViewer&&!jr.isFunction(Dn.DWTViewer)&&(n=!1),se.bIE&&xc.bActiveXEdition&&(jr.isFunction(xn._innerLoad)||(n=!1))),!n)return Zu.loadingResourcePath=!1,void r({code:-2803,message:"Loading the WebTwain JavaScript source files failed."});OG(),Zu.loadResourcePath=!0,Zu.loadingResourcePath=!1,xn.OnWebTwainWillInit&&xn.OnWebTwainWillInit(),e()})}))}},e)})),xG.apply(this,arguments)}function OG(){if(On.bNode||se.bJSDom);else if(jr.isArray(Dn.aryAddonReadyFun)){for(var e=0,r=function(){var r=Dn.aryAddonReadyFun[e];if(jr.isFunction(r))try{r(On)}catch(t){jr.log(t.stack||t,"error"),setTimeout(function(){throw t},0)}};e<Dn.aryAddonReadyFun.length;e++)r();Dn.aryAddonReadyFun=[]}}var NG=[],RG=[];function WG(){var e,r=NG.length;for(e=0;e<r;e++)NG[e]();NG.splice(0),RG.splice(0),BG=0}function MG(){if(BG>0&&(new Date).getTime()-BG>LG){var e,r={code:-2802,message:"The file dynamsoft.webtwain.config.js timed out while loading."},t=xn.Containers;t&&0!==t.length||(qg(e={}),r={code:e._errorCode,message:e._errorString}),function(e){var r,t=RG.length;for(r=0;r<t;r++)RG[r](e);NG.splice(0),RG.splice(0),BG=0}(r)}else if(xn.Containers||xn.ProductKey||xn.licenseServer||xn.organizationID||xn.handshakeCode||xn.bNpm||0==xn.AutoLoad){if(Zu.dwtConfigLoading)return void setTimeout(MG,100);if(Zu.dwtConfigLoaded)return void WG();Zu.dwtConfigLoading=!0;var n=om(),i="";if(jr.isString(n)&&n.length>0&&("/"==n.charAt(n.length-1)||(i="/")),jr.isArray(xn.Containers)||(xn.Containers=[]),se.bIE){var o=se.IEVersion;if((""===o||o>=10)&&xn.IfUseActiveXForIE10Plus){var a=!1;se.bHTML5Edition=a,Zu.bChromeEdition=a,xc.bHTML5Edition=a,xc.bActiveXEdition=!0}}if(xc.bActiveXEdition&&xn.IfLoadResources){var s="";!se.bFileSystem&&xn.IfResourcesAddTimestamp&&(s=On.timestamp),jr.addScript([n,i,"src/dynamsoft.webtwain.activex.js",s].join(""),!0,!1,function(){Zu.dwtConfigLoaded=!0,Zu.dwtConfigLoading=!1,WG()})}else Zu.dwtConfigLoaded=!0,Zu.dwtConfigLoading=!1,WG()}else setTimeout(MG,100)}var LG=3e3,BG=0;function UG(e){return dh(Ih),Zu.dwtConfigLoaded?Promise.resolve():(e&&(LG=1e3*parseInt(e))<1&&(LG=1),new Promise(function(e,r){NG.push(e),RG.push(r),hf(function(){BG=(new Date).getTime(),setTimeout(MG,100)})}))}function VG(){var e;(e=xn.WebTwainIdMap)&&jr.each(e,function(e,r){e&&e._OnPageBlur&&e._OnPageBlur()})}if(xc.bActiveXEdition){var jG=function(){var e,r,t,n,i;if(xn.lunload(),On.closeAll&&On.closeAll(),n=xn.ContainerMap)for(i=Object.keys(n),e=0;e<i.length;e++)(t=i[e])&&t in n&&(r=n[t])&&(r.__unload(),delete n[t]);if(n=xn.WebTwainIdMap)for(i=Object.keys(n),e=0;e<i.length;e++)(t=i[e])&&t in n&&(r=n[t])&&(r.__unload(),delete n[t]);for(e=0;e<On.product.unloadQueue.length;e++){var o=On.product.unloadQueue[e];On.isFunction(o)&&o()}return On.product.unloadQueue.splice(0),On.detect.arySTwains.splice(0),On.Promise.resolve(!0)};xn.Unload=function(){jG();try{xn.CloseDialog(),On._zdgb_xkz_dhk(),On.closeProgress(null,""),On.hideMask()}catch(lK){}},xn.Load=function(){if(!On.product.bDWTLoading)return On.product.bDWTLoading=!0,On.detect.axAutoLoadDone=!1,UG().then(DG).then(jG).then(function(){return xn._innerLoad()}).then(function(){On.product.bDWTLoading=!1,On.detect.axAutoLoadDone=!0},function(e){On.product.bDWTLoading=!1,On.detect.axAutoLoadDone=!1,Ym(e)})},xn.ConnectToTheService=xn.Load,xn.CheckConnectToTheService=function(e,r,t,n,i){xc.bActiveXEdition?On.isFunction(i)&&i():On.isFunction(n)&&n()},xn.CreateDWTObject=function(e,r,t,n,i,o){return On._safePromptCustomMsg(function(){o&&o(Nh)}),!1},xn.CreateDWTObjectEx=function(e,r,t){return On._safePromptCustomMsg(function(){t&&t(Nh)}),!1},xn.CreateRemoteScanObjectAsync=function(){var e={};return hh(e,-2433,"The ActiveX edition does not support this method or property."),On.Promise.reject({code:e._errorCode,message:e._errorString})},xn.DeleteDWTObject=function(e){return!1}}function HG(e){var r,t={},n=e.WebTwainId,i=e.Host,o=e.Port,a=e.SSLPort;return jr.isString(n)&&""!==n?t.id=n:t.id=n=pm(),jr.isDOM(e.Container)?(r=e.Container,jr.isString(r.id)&&""!==r.id||(r.id=["dwt_node_",jr.getRandom()].join("")),t.container=r,t.bNoViewer=!1):t.bNoViewer=!0,t.bNoViewer?(t.width=0,t.height=0):(jr.isUndefined(e.Width)?r.style.width?t.width=r.style.width:t.width=300:t.width=e.Width,jr.isUndefined(e.Height)?r.style.height?t.height=r.style.height:t.height=300:t.height=e.Height),t.dmService=e.dmService,jr.isString(i)&&""!=i||(i=ym()),t.host=i,o||(o=xn.Port),t.port=o,a||(a=xn.SSLPort),t.sslPort=a,t}function GG(e){if(jr.isUndefined(e))return{compatible:!1,isLatest:!1};var r,t,n=function(e){if(jr.isUndefined(e))return 0;var r=e.toLowerCase().replace(Zu.name.toLowerCase()+" ","");return(r=jr.replaceAll(r,"[.]",",")).split(",")}(e.toString().toLowerCase());r=xc.bActiveXEdition?_m.ActiveXVersion:Qu.getServerVersionForCompareCompitable(),t=(r=jr.replaceAll(String(r),"[.]",",")).split(",");for(var i=n.length>t.length?n.length:t.length,o=0;o<i;o++){if(null==n[o]&&(n[o]=0),null==t[o]&&(t[o]=0),parseInt(n[o])<parseInt(t[o]))return{compatible:!1,isLatest:!1};if(parseInt(n[o])>parseInt(t[o]))return 0==o?{compatible:!1,isLatest:!0}:{compatible:!0,isLatest:!0}}return{compatible:!0,isLatest:!0}}xn.GetWebTwain=xn.GetWebTwainEx=function(e){var r=e,t=xn.WebTwainIdMap;if(!r){var n=Object.keys(t);return n.length>0?t[r=n[0]]:void 0}if(r in t)return t[r];var i=xn.ContainerMap;return r in i?i[r]:void 0};var zG="ddm/",KG=new WeakSet,JG=function(){return S(function t(e,r,n,i){_(this,t),g(this,KG),this.serverUrl=e,this.bLocal=oc(e),this.clientId=null!=n?n:jr.guid(),this.bGlobal=r,this.serverName=i,this.bLicenseOK=!1,this.longKeyOrShortkey="",this.cu="",this._wsClient=undefined},[{key:"checkSource",value:function(e){if(!e)throw{code:-1003,message:"Source Manager unable to find the specified Source"}}},{key:"parseResultDefault",value:function(e){var r;if(jr.isObject(e)&&e.exception&&0!=e.exception)throw{code:e.exception,message:null!==(r=e.description)&&void 0!==r?r:"general error"};if(e&&jr.isArray(e.result)&&e.result.length>0){var t=e.result[e.result.length-1];try{return JSON.parse(t)}catch(hH){return t}}throw e}},{key:"_requestAsync",value:(r=p(d().m(function n(e,r,t){var i,o,a,s,u,c,l,f,h,g,m;return d().w(function(n){for(;;)switch(n.p=n.n){case 0:if(!xn.ConnectWithSocket){n.n=3;break}return n.n=1,v(KG,this,QG).call(this);case 1:return i=n.v,o=0,e&&(o=e.cmdId),a={client:i,userData:{command:e},taskId:o},s=ZG,n.n=2,i.request(jr.stringify(e),s,a);case 2:return u=n.v,jr.isString(u)&&(u=jr.parse(u)),n.a(2,u);case 3:return c=[Qu.getDdmModuleNameVerPath(),"/",e.method].join(""),r&&(f=r),h=(g=this).serverUrl?Xc(g.serverUrl,g.bGlobal,[zG,e.method].join("")):bu.getModuleUrlForRemoteScan(c),n.p=4,m={method:"post",dataType:"json",body:jr.stringify(e),fetchRaw:null!=t&&t,timeout:f},n.n=5,Ap(h,m);case 5:l=n.v,n.n=7;break;case 6:throw n.p=6,n.v;case 7:return n.a(2,l)}},n,this,[[4,6]])})),function(e,t,n){return r.apply(this,arguments)})},{key:"_resetLicense",value:(e=p(d().m(function i(e,r,t){return d().w(function(e){for(;;)if(0===e.n)return e.a(2)},i)})),function(r,t,n){return e.apply(this,arguments)})}]);var e,r}();function QG(){return qG.apply(this,arguments)}function qG(){return(qG=p(d().m(function e(){var r,t,n,i,o,a,s,u,c,l;return d().w(function(e){for(;;)switch(e.n){case 0:if(t=this,n=null!==(r=se.bSSL)&&void 0!==r&&r,t._wsClient){e.n=2;break}return i=new ts,(o=this.serverUrl)?(s="/",a=n?"ddm/"+Dn.dcp.SSLPort+"/":"ddm/"+Dn.dcp.Port+"/",jr.endsWith(o,"/")&&(s=""),jr.startsWith(o,"https://")||jr.startsWith(o,"wss://")?(i.ssl=!0,u=jr.startsWith(o,"https://")?jr.replaceAll(o,"https://",""):jr.replaceAll(o,"wss://",""),o=u+s+a):jr.startsWith(o,"http://")||jr.startsWith(o,"ws://")?(i.ssl=!1,c=jr.startsWith(o,"http://")?jr.replaceAll(o,"http://",""):jr.replaceAll(o,"ws://",""),o=c+s+a):(i.ssl=n,i.port=i.ssl?$u.SSLPort:$u.Port),i.server=o):(i.ssl=n,i.server=ym(),i.port=i.ssl?$u.SSLPort:$u.Port),i.useWS=!0,i.protocol=js.wsProtocol,l=os.Instance.getClient(i),e.n=1,l.testConnection();case 1:t._wsClient=l;case 2:return e.a(2,t._wsClient)}},e,this)}))).apply(this,arguments)}I(JG,"logLevel",-1);var YG=function(r){function t(){var e;_(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return I(e=s(this,t,[].concat(n)),"_bInited",!1),e}return l(t,r),S(t,[{key:"getServices",value:(n=p(d().m(function i(r,t,n,o){var a,s,u,c,l,f,h,g,v,m,p,_,y,S,I;return d().w(function(i){for(;;)switch(i.p=i.n){case 0:return n=null!=n&&n,o=null!=o?o:30,a={id:this.clientId,cmdId:jr.guid(),method:"SearchScanner",parameter:[1,"_privet._tcp.local.",!1,!0,n,o,r,t],version:Qu.getDdm_ManagerVer()},i.p=1,i.n=2,this._requestAsync(a,3e4,!1);case 2:s=i.v,this._bInited=!0,i.n=5;break;case 3:if(i.p=3,i.v,!this.bLocal){i.n=4;break}throw jg(u={}),{code:u._errorCode,message:u._errorString};case 4:throw Mg();case 5:c=[],l=this.parseResultDefault(s),f=e(l),i.p=6,f.s();case 7:if((h=f.n()).done){i.n=11;break}if(!((g=h.value).service_type&&g.service_type==Yt.ST_UNKNOWN||g.type&&"dynamsoft_private_cloud_scan"!=g.type&&"twaindirect"!=g.type)){i.n=8;break}return i.a(3,10);case 8:if(!g.service_type){i.n=10;break}S=g.service_type,i.n=S===Yt.ST_DYNAMSOFT_SERVICE?9:10;break;case 9:return(v=g.modules)&&jr.isArray(v)&&jr.isString(v[0])&&(m=v[0].split(","),jr.isArray(m)&&m.length>=3&&(m[0]>=1&&m[1]>=9||m[0]>=1&&m[1]>=8&&m[2]>0)&&(g.bGlobalFind=!0,p=XG(this.serverUrl,g),c.push(p))),g.bGlobalFind||(y=null!==(_=null==g?void 0:g.ty)&&void 0!==_?_:"",jr.warn(["The Dynamic Web TWAIN Service on [",y,"] is old version."].join(""))),i.a(3,10);case 10:i.n=7;break;case 11:i.n=13;break;case 12:i.p=12,I=i.v,f.e(I);case 13:return i.p=13,f.f(),i.f(13);case 14:return i.a(2,c)}},i,this,[[6,12,13,14],[1,3]])})),function(e,r,t,i){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e={id:this.clientId,cmdId:jr.guid(),method:"dispose",version:Qu.getDdm_ManagerVer()};this._requestAsync(e,500)}}]);var n}(JG);function XG(e,r){var t=new tp;return t.server=e,t.attrs=r,t}function ZG(e,r,t,n){return $G.apply(this,arguments)}function $G(){return($G=p(d().m(function e(r,t,n,i){var o,a;return d().w(function(e){for(;;)switch(e.n){case 0:if(t!=Vo.GET_TASKID){e.n=1;break}return e.a(2,null==i?void 0:i.taskId);case 1:if(t!=Vo.ONMESSAGE_PROCESS_DATA){e.n=2;break}return e.a(2,jr.parse(r));case 2:if(t!=Vo.ONMESSAGE_GET_TASKID){e.n=5;break}if(!r||!r.cmdId){e.n=3;break}return e.a(2,r.cmdId);case 3:if(!i||!i.client){e.n=4;break}return e.a(2,i.client.getRequestTaskId());case 4:e.n=7;break;case 5:if(t!=Vo.HANDLE_RAW_MESSAGE){e.n=7;break}if(a=r.rawData,r.jsonData,o=null==i?void 0:i.userData){e.n=6;break}return e.a(2,!1);case 6:return a.indexOf("Version not found")>=0||a.indexOf("Function not found")>=0?jr.isFunction(o.fFun)&&o.fFun():jr.isFunction(o.sFun)&&o.sFun(a),e.a(2,a);case 7:return e.a(2)}},e)}))).apply(this,arguments)}function ez(e){var r,t=Yt.ST_UNKNOWN;return e==Gt.ESCLSCANNER?t=Yt.ST_ESCL:e==Gt.WIFIDIRECTSCANNER?t=Yt.ST_WIFI_DIRECT:((r=e)==Gt.TWAINSCANNER||r==Gt.WIATWAINSCANNER||r==Gt.TWAINX64SCANNER||r==Gt.ICASCANNER||r==Gt.SANESCANNER)&&(t=Yt.ST_DYNAMSOFT_SERVICE),t}var rz=new WeakSet,tz=function(r){function t(){var e;_(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return g(e=s(this,t,[].concat(n)),rz),I(e,"_bInited",!1),I(e,"_currentDevice",undefined),e}return l(t,r),S(t,[{key:"getSources",value:(h=p(d().m(function m(r,t,n){var i,o,a,s,u,c,l,f,h,g,v,p,_,y;return d().w(function(d){for(;;)switch(d.p=d.n){case 0:if(i="",o=!1,a=[],s=!1,((u=null!=r?r:Qt)&Gt.ESCLSCANNER)==Gt.ESCLSCANNER&&(i="_uscan._tcp.local."),(u&Gt.WIFIDIRECTSCANNER)==Gt.WIFIDIRECTSCANNER&&(o=!0),0!=i.length||o){d.n=1;break}return d.a(2,[]);case 1:return t=null!=t&&t,n=null!=n?n:30,c={id:this.clientId,cmdId:jr.guid(),method:"SearchScanner",parameter:[1,i,o,s,t,n],version:Qu.getDdm_ManagerVer()},d.n=2,this._requestAsync(c,3e4,!1);case 2:if(l=d.v,this._bInited=!0,f=this.parseResultDefault(l),jr.isArray(f)){d.n=3;break}throw Vg();case 3:h=e(f),d.p=4,h.s();case 5:if((g=h.n()).done){d.n=10;break}if(!((v=g.value).service_type&&v.service_type==Yt.ST_UNKNOWN||v.type&&"dynamsoft_private_cloud_scan"!=v.type&&"twaindirect"!=v.type)){d.n=6;break}return d.a(3,9);case 6:if(!v.service_type){d.n=9;break}_=v.service_type,d.n=_===Yt.ST_DYNAMSOFT_SERVICE?7:_===Yt.ST_ESCL||_===Yt.ST_WIFI_DIRECT?8:9;break;case 7:return d.a(3,9);case 8:return(p=new op).name="",p.displayName="",p.deviceType=0,p.isSystemDefaultPrinter=!1,v.service_type==Yt.ST_ESCL?p.deviceType=Gt.ESCLSCANNER:v.service_type==Yt.ST_WIFI_DIRECT&&(p.deviceType=Gt.WIFIDIRECTSCANNER),p.name=v.ty,v.hostname&&v.hostname.length>v.ty.length&&(p.name=v.hostname),p.displayName=(v.service_type==Yt.ST_ESCL?"eSCL-":"")+p.name,this.bGlobal||(v.url=this.serverUrl,this.serverName&&(p.displayName=p.displayName+" on ["+this.serverName+"]")),p.serviceInfo=XG(this.serverUrl,v),a.push(p),d.a(3,9);case 9:d.n=5;break;case 10:d.n=12;break;case 11:d.p=11,y=d.v,h.e(y);case 12:return d.p=12,h.f(),d.f(12);case 13:return d.a(2,a)}},m,this,[[4,11,12,13]])})),function(e,r,t){return h.apply(this,arguments)})},{key:"getCapabilitiesAsync",value:(f=p(d().m(function y(e){var r,t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:return this.checkSource(e),(e.deviceType&Gt.ESCLSCANNER)!=Gt.ESCLSCANNER&&(e.deviceType&Gt.WIFIDIRECTSCANNER)!=Gt.WIFIDIRECTSCANNER||(this._currentDevice=e),t=ez(e.deviceType),n={id:this.clientId,cmdId:jr.guid(),method:"SendRequestToScanner",parameter:["getCapabilities",jr.stringify({UUID:null===(r=e.serviceInfo)||void 0===r?void 0:r.attrs.UUID,service_type:t,ty:e.name})],version:Qu.getDdm_ManagerVer()},o.n=1,this._requestAsync(n,0);case 1:return i=o.v,o.a(2,this.parseResultDefault(i))}},y,this)})),function(e){return f.apply(this,arguments)})},{key:"selectSourceAsync",value:(c=p(d().m(function b(e){var r;return d().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getCapabilitiesAsync(e);case 1:if(!(r=t.v)&&""!=r){t.n=2;break}return t.a(2,!0);case 2:return t.a(2)}},b,this)})),function(e){return c.apply(this,arguments)})},{key:"versionInfo",value:(u=p(d().m(function C(){var e,r;return d().w(function(t){for(;;)switch(t.n){case 0:return e={id:this.clientId,cmdId:jr.guid(),method:"VersionInfo",version:Qu.getDdm_ManagerVer()},xn.Token&&e.parameter.push(xn.Token),t.n=1,this._requestAsync(e,5e3);case 1:return r=t.v,this._bInited=!0,t.a(2,r)}},C,this)})),function(){return u.apply(this,arguments)})},{key:"getLicenseInfo",value:function(e,r,t){return this._resetLicense(e,r,t)}},{key:"getImageAsArrayBuffer",value:(a=p(d().m(function T(e,r){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,v(rz,this,nz).call(this,e,r))},T,this)})),function(e,r){return a.apply(this,arguments)})},{key:"getImageToDWT",value:(o=p(d().m(function w(e,r,t){return d().w(function(n){for(;;)if(0===n.n)return n.a(2,v(rz,this,nz).call(this,e,r,t))},w,this)})),function(e,r,t){return o.apply(this,arguments)})},{key:"acquireImage",value:(i=p(d().m(function A(e,r,t){var n,i,o,a,s,u,c,l,f;return d().w(function(t){for(;;)switch(t.p=t.n){case 0:e=null!=e?e:this._currentDevice,this.checkSource(e),this._currentDevice=e,i=ez(e.deviceType),o=["scan",jr.stringify({UUID:null===(n=e.serviceInfo)||void 0===n?void 0:n.attrs.UUID,service_type:i})],a=v(rz,this,oz).call(this,r),o[2]=jr.stringify(a),s={id:this.clientId,cmdId:jr.guid(),method:"SendRequestToScanner",parameter:o,version:Qu.getDdm_ManagerVer()},u=0;case 1:if(!(u<5)){t.n=9;break}return t.p=2,t.n=3,this._requestAsync(s,0);case 3:return l=t.v,c=this.parseResultDefault(l),jr.isObject(c)&&(c.device=e,c.scanOptions=a),t.a(3,9);case 4:if(t.p=4,-1004!=(f=t.v).code&&-1001!=f.code){t.n=7;break}if(!(u>=4)){t.n=5;break}throw f;case 5:return t.n=6,new Promise(function(e,r){setTimeout(e,2e3)});case 6:t.n=8;break;case 7:throw f;case 8:u++,t.n=1;break;case 9:return t.a(2,c)}},A,this,[[2,4]])})),function(e,r,t){return i.apply(this,arguments)})},{key:"_resetLicense",value:(n=p(d().m(function E(e,r,n){var i,o,a,s;return d().w(function(u){for(;;)switch(u.p=u.n){case 0:return this.longKeyOrShortkey=e,this.cu=r,az(),i=null!=r?r:"",o={id:this.clientId,cmdId:jr.guid(),method:"GetLicenseInfo",parameter:[e,t.logLevel,i,n],version:Qu.getDdm_ManagerVer()},u.p=1,u.n=2,this._requestAsync(o,1e4);case 2:return a=u.v,this._bInited=!0,u.a(2,this.parseResultDefault(a));case 3:if(u.p=3,u.v,!this.bLocal){u.n=4;break}throw jg(s={}),{code:s._errorCode,message:s._errorString};case 4:throw Mg();case 5:return u.a(2)}},E,this,[[1,3]])})),function(e,r,t){return n.apply(this,arguments)})}]);var n,i,o,a,u,c,f,h}(YG);function nz(e,r,t){return iz.apply(this,arguments)}function iz(){return(iz=p(d().m(function e(r,t,n){var i,o,a,s,u;return d().w(function(e){for(;;)switch(e.n){case 0:if(null!=r&&r.device){e.n=1;break}throw{code:-1011,message:"Operation out of expected sequence"};case 1:return n=null!=n?n:{ver:"",clientId:""},(i=["getImage",jr.stringify({UUID:r.device.serviceInfo.attrs.UUID,service_type:t})])[2]=jr.stringify(r.scanOptions),i[3]=r.scanJobs,i[4]=r.scanId,i[5]=n._clientId,i[6]=n._ver,o={id:this.clientId,cmdId:jr.guid(),method:"SendRequestToScanner",parameter:i,version:Qu.getDdm_ManagerVer()},e.n=2,this._requestAsync(o,0,!0);case 2:if(a=e.v,!(a.headers.get("content-type").indexOf("image/")>=0)){e.n=4;break}return e.n=3,a.arrayBuffer();case 3:return e.a(2,e.v);case 4:return e.n=5,a.json();case 5:if(s=e.v,"boolean"!=typeof(u=this.parseResultDefault(s))){e.n=6;break}return e.a(2,null);case 6:return e.a(2,u);case 7:return e.a(2)}},e,this)}))).apply(this,arguments)}function oz(e){var r=[];if(e){jr.isNumber(e.PixelType)&&(r.push({capability:yt.ICAP_PIXELTYPE,curValue:e.PixelType}),lt.TWPT_BW==e.PixelType&&(r.push({capability:32771,curValue:"application/octet-stream"}),r.push({capability:32772,curValue:"application/octet-stream"})));var t=e.Resolution;t||(t=300),r.push({capability:yt.ICAP_XRESOLUTION,curValue:t}),r.push({capability:yt.ICAP_YRESOLUTION,curValue:t}),e.Brightness!==undefined&&r.push({capability:yt.ICAP_BRIGHTNESS,curValue:e.Brightness}),e.XferCount!==undefined&&r.push({capability:yt.CAP_XFERCOUNT,curValue:e.XferCount}),e.Contrast!==undefined&&r.push({capability:yt.ICAP_CONTRAST,curValue:e.Contrast}),e.TransferMode!==undefined&&r.push({capability:yt.ICAP_XFERMECH,curValue:e.TransferMode}),e.IfFeederEnabled!==undefined&&r.push({capability:yt.CAP_FEEDERENABLED,curValue:e.IfFeederEnabled?1:0}),e.IfDuplexEnabled!==undefined&&r.push({capability:yt.CAP_DUPLEXENABLED,curValue:e.IfDuplexEnabled?1:0})}return r}function az(){var e=tz.logLevel;jr.isNumber(e)||(tz.logLevel=-1)}var sz=S(function CK(e,r,t){_(this,CK),this.Url=e,this.Width=r,this.Height=t}),uz=function(){return S(function r(e){_(this,r),this._stwain=e,this._ImgManager=e._ImgManager},[{key:"Print",value:function(){var e=this;if(e.count()<=0)return!1;var r,t=[];for(r=0;r<e.count();r++)t.push(r);return e.PrintEx(t)}},{key:"PrintCurrentImage",value:function(){var e,r,t,n=this;if(!((e=n._ImgManager.getCurrentImageIndex())<0))return-1==(t=n._ImgManager.convertClientIndexToServerId(e))?(gg(n),!1):(r=um.getImageUrl(n._ImgManager.getBaseUrl,t,-1,-1),n.__PrintInner(r,t,e))}},{key:"PrintEx",value:function(e){var r=this;if(!(r.count()<=0)){var t=[];return xn.ConnectWithSocket?r.__GetPrintUrlforSocket(e,t):r.__GetPrintUrlforHttp(e,t),!0}}},{key:"__PrintInner",value:function(e,r,t){var n=this,i=n._ImgManager.getImageIdMap(r),o=[];if(!i)return!1;var a=jr.clone(i),s=a.width;(jr.isUndefined(a.width)||a.width<=0)&&(a.width=n.getImageWidthFromServer(t));var u=a.height;(jr.isUndefined(a.height)||a.height<=0)&&(a.height=n.getImageHeightFromServer(t));var c=new sz(e,a.width,a.height);return o.push(c),a.width=s,a.height=u,um.print(o),!0}},{key:"__GetPrintUrl",value:function(e,r,t){var n,i,o=this,a=0,s=0;return(n=o._ImgManager.getImageIdMap(r))&&(!n.width||n.width<=0?n.width=o.getImageWidthFromServer(t):a=n.width,!n.height||n.height<=0?n.height=o.getImageHeightFromServer(t):s=n.height,i=new sz(e,n.width,n.height),n.width=a,n.height=s),i}},{key:"__GetPrintUrlforHttp",value:(e=p(d().m(function t(e,r){var n,i,o,a,s,u,c,l,f,h,g;return d().w(function(t){for(;;)switch(t.n){case 0:n=this,i=0;case 1:if(!(i<e.length)){t.n=5;break}if(o=e[i],-1==(a=n._ImgManager.convertClientIndexToServerId(o))){t.n=4;break}if(s=void 0,!(Dn.navInfoSync.bMac&&Dn.navInfoSync.bSafari||Dn.navInfoSync.bFirefox||Dn.navInfoSync.bChrome)){t.n=3;break}if(!(u=n._stwain._ImgManager.getImageIdMap(a))){t.n=3;break}if(!(c=u.uuid)||-1==c){t.n=3;break}return t.n=2,null===(l=n._stwain.Viewer)||void 0===l?void 0:l.webViewer.myDvs.getImageData(c,{type:"blob"});case 2:f=t.v,h=window.URL||window.webkitURL,s=h.createObjectURL(f);case 3:s||(s=um.getImageUrl(n._ImgManager.getBaseUrl,a,-1,-1)),g=n.__GetPrintUrl(s,a,o),r.push(g);case 4:i++,t.n=1;break;case 5:um.print(r);case 6:return t.a(2)}},t,this)})),function(r,t){return e.apply(this,arguments)})},{key:"__GetPrintUrlforSocket",value:function(e,r){var t,n=this,i=Promise.resolve(0),o=0;return jr.each(e,function(a){i=i.then(function(){var i=n._ImgManager.convertClientIndexToServerId(a);if(-1!=i)return n._ImgManager.getImageData(a).then(function(s){if(o++,!s){var u={};return Bh(u),jr.error(u._errorString),-1}t=gm(s.oriData)?URL.createObjectURL(new Blob([s.oriData])):s.oriData instanceof Blob?URL.createObjectURL(s.oriData):s.oriData;var c=n.__GetPrintUrl(t,i,a);r.push(c),e.length==o&&um.print(r)})})}),!0}},{key:"__GetPrintUrlforMobileEx",value:function(e,r){var t,n=this,i=Promise.resolve(0),o=0;return jr.each(e,function(a){i=i.then(function(){var i=n._ImgManager.convertClientIndexToServerId(a);if(-1!=i)return n._ImgManager.getImageData(a).then(function(s){if(o++,!s){var u={};return Bh(u),jr.error(u._errorString),-1}t=gm(s.oriData)?URL.createObjectURL(new Blob([s.oriData])):s.oriData instanceof Blob?URL.createObjectURL(s.oriData):s.oriData;var c=n.__GetPrintUrl(t,i,a);r.push(c),e.length==o&&um.print(r)})})}),!0}},{key:"count",value:function(){return this._ImgManager.count()}},{key:"getImageHeightFromServer",value:function(e){var r,t,n,i=this,o=1*e;return r=i.count(),o<0||o>r?0:(n=i._ImgManager.convertClientIndexToServerId(o),(t=i._ImgManager.getImageIdMap(n))&&t.imageHeight?t.imageHeight:i._stwain.GetImageHeight(o))}},{key:"getImageWidthFromServer",value:function(e){var r,t,n,i=this,o=1*e;return r=i.count(),o<0||o>r?0:(n=i._ImgManager.convertClientIndexToServerId(o),(t=i._ImgManager.getImageIdMap(n))&&t.imageWidth?t.imageWidth:i._stwain.GetImageWidth(o))}},{key:"dispose",value:function(){this._stwain=undefined,this._ImgManager=undefined}}]);var e}(),cz=new WeakSet,lz=function(e){function r(e){var t;return _(this,r),g(t=s(this,r,[e]),cz),t._ImagePrint=new uz(t),t._flag_LoadImageFromBinary=!1,t}return l(r,e),S(r,[{key:"SetCookie",value:function(e){return this._cookie=e,document.cookie=e,!0}},{key:"LoadImageFromBase64Binary",value:function(e,r,t,n){var i=this,o=!1;if(jr.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!e)return Ag(i),jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;var a,s,u,c,l=e,f="LoadImageFromBase64Binary",d=r,h=1;if(l instanceof OH&&jr.isFunction(l.getLength)&&jr.isFunction(l.getData)&&(l=l.getData(0,l.getLength())),jr.isString(l))if(-1!=l.indexOf("data:image/bmp"))d=0;else if(-1!=l.indexOf("data:image/jpeg"))d=1;else if(-1!=l.indexOf("data:image/tif"))d=2;else if(-1!=l.indexOf("data:image/png"))d=3;else if(-1!=l.indexOf("data:application/pdf"))d=4;else if(-1!=l.indexOf("data:image/jp2"))d=14;else{var g=l.substr(0,64),v=jr.base64.decode(g,!0);c=u=v,(u instanceof ArrayBuffer||u instanceof Array)&&(c=new Uint8Array(u.slice(0,12))),d=function(e){return 37==e[0]&&80==e[1]&&68==e[2]&&70==e[3]}(c)?ut.IT_PDF:function(e){return 73==e[0]&&73==e[1]&&42==e[2]&&0==e[3]||77==e[0]&&77==e[1]&&0==e[2]&&42==e[3]}(c)?ut.IT_TIF:function(e){return 137==e[0]&&80==e[1]&&78==e[2]&&71==e[3]}(c)?ut.IT_PNG:function(e){return 255==e[0]&&216==e[1]}(c)?ut.IT_JPG:function(e){return 66==e[0]&&77==e[1]}(c)?ut.IT_BMP:function(e){return 0==e[0]&&0==e[1]&&0==e[2]&&12==e[3]&&106==e[4]&&80==e[5]&&32==e[6]&&32==e[7]||255==e[0]&&79==e[1]&&255==e[2]&&81==e[3]}(c)?ut.IT_J2K:ut.IT_PNG}if(d!=ut.IT_BMP&&d!=ut.IT_JPG&&d!=ut.IT_TIF&&d!=ut.IT_PNG&&d!=ut.IT_PDF&&d!=ut.IT_J2K&&(d=-1),!jv.checkProductKey(i,{Core:!0}))return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(!jv.checkPDFProductKeyWhenNeeds(i,d))return jr.isFunction(n)&&us.runErrWithCatch(n,i),!!o&&void 0;if(jr.isString(l)&&-1!=l.indexOf("base64,")&&(l=l.substr(l.indexOf("base64,")+7)),s=i.__GetLoadEventsNum(),!o){var m=i._getCurrentDocumentName(),p=i._getCurrentDefaultTagName();return(a=i.__innerLoadImageFun(f,hm(l,d,s,h),h,m,p))&&i.__OnPostLoad&&!i.__bServerOnPostLoadFired&&setTimeout(function(){i.__bServerOnPostLoadFired||i.__OnPostLoad&&i.__OnPostLoad("","",d)},10),a}On.cancelFrom=St.LoadImage,i.IfShowProgressBar?On.showProgress(i,f,i.__IfShowCancelDialogWhenImageTransfer):On.hideProgress(),i.__bLoadingImage=!0,h=0,i._innerSend(f,hm(l,d,s,h),!0,function(){if(On.closeProgress(null,f),i.__bLoadingImage=!1,i._isBindViewer()){var e=i._ImgManager.getCurrentImageIndex();e>=0&&i._innerRefreshUI(e)}i._canConsume()&&xn.lcvrf(i),i.__OnPostLoad&&!i.__bServerOnPostLoadFired&&i.__OnPostLoad("","",d),t&&t(l,r)},function(){On.closeProgress(null,f),i.__bLoadingImage=!1,i.__OnPostLoad&&!i.__bServerOnPostLoadFired&&i.__OnPostLoad("","",d),jr.isFunction(n)&&n(i._errorCode,i._getErrorString(),l,r)})}},{key:"SaveSelectedImagesToBytes",value:function(e,r){return Gh(this),!1}},{key:"LoadImageFromBytes",value:function(e,r,t){return Gh(this),!1}},{key:"SetImageWidth",value:function(e,r,t,n){var i,o=this,a=!1;if(jr.isFunction(t)&&(a=!0),o._resetErr(),!o._isValid())return!!a&&void 0;var s=parseInt(e);if(isNaN(s))return Bh(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;if(s<0||s>=o._ImgManager.count())return gg(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;if(jr.isUndefined(r))return Ag(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;var u=o._ImgManager.convertClientIndexToServerId(s);return-1==u?(gg(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0):((i=1==o._innerFun("SetImageWidth",hm(u,r)))?jr.isFunction(t)&&t():jr.isFunction(n)&&n(o._errorCode,o._getErrorString()),a?void 0:i)}},{key:"HTTPDownloadStreamThroughPost",value:function(e,r){return Gh(this),!1}},{key:"HTTPUploadStreamThroughPost",value:function(e,r,t,n,i){return Gh(this),!1}},{key:"HTTPUploadThroughPutDirectly",value:function(e,r,t,n,i){return Gh(this),!1}},{key:"SetCustomDSDataEx",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCustomDSDataEx",hm(e))}},{key:"SetCustomDSData",value:function(e){if(this._resetErr(),!this._isValid())return!1;var r=kp.replaceLocalFilename(e);return this._innerFun("SetCustomDSData",hm(r))}},{key:"GetCustomDSDataEx",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("GetCustomDSDataEx")}},{key:"GetCustomDSData",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=kp.replaceLocalFilename(e);return r._innerFun("GetCustomDSData",hm(t))}},{key:"on",value:function(e,r){return this.registerEvent(e,r)}},{key:"off",value:function(e,r){return this.unregisterEvent(e,r)}},{key:"ConvertToBW",value:function(e,r,t){var n=this,i=!1;if(jr.isFunction(r)&&(i=!0),n._resetErr(),!n._isValid())return!!i&&void 0;if(!jv.checkProductKey(n,{Core:!0}))return jr.isFunction(t)&&t(n._errorCode,n._getErrorString()),!!i&&void 0;var o=parseInt(e);if(isNaN(o))return Bh(n),jr.isFunction(t)&&t(n._errorCode,n._getErrorString()),!!i&&void 0;if(o<0||o>=n._ImgManager.count())return gg(n),jr.isFunction(t)&&t(n._errorCode,n._getErrorString()),!!i&&void 0;var a=n._ImgManager.convertClientIndexToServerId(o);if(-1==a)return gg(n),!1;var s=n._innerFun("ConvertToBW",hm(a));return s?jr.isFunction(r)&&r():jr.isFunction(t)&&t(n._errorCode,n._getErrorString()),i?void 0:s}},{key:"LoadImageFromBinary",value:function(e,r,t){var n=this;return jr.isFunction(r)?(this._flag_LoadImageFromBinary=!0,this._x1_LoadImageFromBinary(e,function(){n._flag_LoadImageFromBinary=!1,r()},function(e,i){n._flag_LoadImageFromBinary=!1,jr.isFunction(r)&&t(e,i)})):(Ag(n),!1)}},{key:"_x1_LoadImageFromBinary",value:function(e,r,t){var n,i=this,o="LoadImageFromBinary";if(!jr.isFunction(r))return Ag(i),!1;var a=null===(n=On.progressContext)||void 0===n?void 0:n.IfShowCancelDialogWhenImageTransfer;i.IfShowProgressBar?(On.showProgress(i,o,!1),On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=!1)):On.hideProgress();i._innerLoadImageFromBinary(e,0,!0,!0,function(){On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=a),i.IfShowProgressBar&&On.closeProgress(null,o),r()},function(e,r){On.progressContext&&(On.progressContext.IfShowCancelDialogWhenImageTransfer=a),i.IfShowProgressBar&&On.closeProgress(null,o),jr.isFunction(t)&&t(e,r)})}},{key:"EnableSourceUI",value:function(e,r){var t=this;return t._resetErr(),!!t._isValid()&&(t._innerSend("EnableSourceUI",null,!0,e,r),!0)}},{key:"GetIfShowVideoContainer",value:function(){var e;return null===(e=this._UIView)||void 0===e?void 0:e.GetIfShowVideoContainer()}},{key:"ShowVideoContainer",value:function(e){var r;return null===(r=this._UIView)||void 0===r?void 0:r.ShowVideoContainer(e)}},{key:"UpdateVideoContainer",value:function(e){var r;return null===(r=this._UIView)||void 0===r?void 0:r.UpdateVideoContainer(e)}},{key:"ChangeBitDepth",value:function(e,r,t){var n,i=this;if(i._resetErr(),!i._isValid())return!1;if(n=parseInt(e),isNaN(n))return Bh(i),!1;if(n<0||n>=i._ImgManager.count())return gg(i),!1;var o=i._ImgManager.convertClientIndexToServerId(n);return-1==o?(gg(i),!1):i._innerFun("ChangeBitDepth",hm(o,r,t))}},{key:"ConvertToGrayScale",value:function(e,r,t){var n,i=this,o=!1;if(jr.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return!!o&&void 0;var a=parseInt(e);if(isNaN(a))return Bh(i),jr.isFunction(t)&&t(i._errorCode,i._getErrorString()),!!o&&void 0;if(a<0||a>=i._ImgManager.count())return gg(i),jr.isFunction(t)&&t(i._errorCode,i._getErrorString()),!!o&&void 0;var s=i._ImgManager.convertClientIndexToServerId(a);return-1==s?(gg(i),jr.isFunction(t)&&t(i._errorCode,i._getErrorString()),!!o&&void 0):((n=1==i._innerFun("ConvertToGrayScale",hm(s)))?(kp.refreshImageAfterInvokeFun(i,a),jr.isFunction(r)&&r()):jr.isFunction(t)&&t(i._errorCode,i._getErrorString()),o?void 0:n)}},{key:"ClearTiffCustomTag",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e._aryTiffTag.splice(0,e._aryTiffTag.length),e._innerFun("ClearTiffCustomTag"))}},{key:"SetTiffCustomTag",value:function(e,r,t){var n=this;if(n._resetErr(),!n._isValid())return!1;if(jr.isUndefined(e)||jr.isUndefined(r))return Ag(n),!1;var i,o=1*e;if(i=jr.isString(r)?jr.replaceAll(r,'"','\\"'):r,o<=0||o>2147483647)return hh(n,-2378,"Invalid value for the tiff tag code."),!1;var a,s=0,u=!1,c=n._aryTiffTag.length;for(s=0;s<c;s++)(a=n._aryTiffTag[s]).tag==o&&(a.Content=r,a.UseBase64Encoding=t,u=!0);return!u&&c>=32?(function(e){hh(e,-2428,"Tiff tag count has exceeded the limit.")}(n),!1):n._innerFun("SetTiffCustomTag",hm(o,i,t))}},{key:"IsBlankImage",value:function(e){var r,t=this;if(t._resetErr(),!t._isValid())return!1;if(r=parseInt(e),isNaN(r))return Bh(t),!1;if(r<0||r>=t._ImgManager.count())return gg(t),!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(gg(t),!1):t._innerFun("IsBlankImage",hm(n,!1))}},{key:"IsBlankImageExpress",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;var t=parseInt(e);if(isNaN(t))return Bh(r),!1;if(t<0||t>=r._ImgManager.count())return gg(r),!1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(gg(r),!1):r._innerFun("IsBlankImage",hm(n,!0))}},{key:"SetOpenSourceTimeout",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&r._innerFun("SetOpenSourceTimeout",hm(e))}},{key:"GetImageURL",value:function(e,r,t,n,i){var o=this;if(o._resetErr(),!o._isValid())return!1;var a,s,u,c=e,l=parseInt(r),f=parseInt(t);if(n?(a="",s="dwt://"):(a=o._httpUrl,s="dwt/"),u=[a,s,o._bScanForProxyRemote?o._dmServiceDWTVersion:[js.getDWTPrefix(),Qu.getServerVersionInfo()].join(""),"/img?id=",o._clientId],jr.isUndefined(c)||null===c)return vg(o),"";if(i)u.push("&index=-1&width=-1&height=-1&webcam="),u.push(i),se.bIE||u.push("&type=6000");else{if(c=parseInt(c),isNaN(c))return Bh(o),"";if(c<-1||c>=o._ImgManager.count())return gg(o),"";var d=o._ImgManager.convertClientIndexToServerId(c);if(-1==d)return"";u.push("&index="),u.push(d),l>0&&f>0?(u.push("&width="),u.push(l),u.push("&height="),u.push(f)):u.push("&width=-1&height=-1"),Yv.bMobile&&u.push("&type=1&quality=85")}if(u.push("&t="),u.push((new Date).getTime()),u=u.join(""),se.bFileSystem&&!i&&u.indexOf("dwt://")<0){var h=new Image;h.crossOrigin="anonymous",h.src=u}return u}},{key:"GetImagePartURL",value:function(e,r,t){var n=this;if(n._resetErr(),!n._isValid())return!1;var i=parseInt(e);return isNaN(i)?(Bh(n),""):i<0||i>=n._ImgManager.count()?(gg(n),""):this.GetImageURL(i,r,t,!0)}},{key:"SetLanguage",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&r._innerFun("SetLanguageForSecurity",hm(e))}},{key:"GetLicenseInfo",value:function(e,r){var t=this;if(t.__licenseInfo)jr.isFunction(e)&&e(t.__licenseInfo);else{t._innerFunRaw("GetLicenseInfo",hm(2),!0,!1,!0,function(n){n?n.exception?jr.isFunction(r)&&r(n.exception):(jr.isArray(n.result)&&n.result.length>0&&qm(t,n.result[0]),jr.isFunction(e)&&e(t.__licenseInfo)):jr.isFunction(r)&&r()},r)}}},{key:"SetProductKeyAsync",value:function(e){return this._setProductKeyAsync(e)}},{key:"GetVersionInfoAsync",value:function(){return Promise.resolve(xc.versionInfoFromServer)}},{key:"isUsingActiveX",value:function(){return!1}},{key:"SetLTSLicenseAsync",value:function(e){return this._setLTSLicenseAsync(e)}},{key:"Print",value:function(e){var r=this;if(r._resetErr(),!r._isValid())return!1;if(r._isNoViewer())return r._nouiNotSupport("Print");if(e){return r._innerSend("PrintEx",hm(!0),!0,function(){},function(){}),!0}return r._ImagePrint.Print(),!0}},{key:"PrintEx",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return!1;if(!t._checkIndices(e))return!1;if(t._isNoViewer())return t._nouiNotSupport("Print");if(r&&r.mode&&"os"==r.mode.toLowerCase()){if(se.bMac||se.bLinux)return hh(t,-2910,"The OS print functionality is not supported on the current operating system."),!1;var n=!0;jr.isUndefined(r.osPrintOptions)||jr.isUndefined(r.osPrintOptions.showPrintDialog)||(n=r.osPrintOptions.showPrintDialog);var i=[];return jr.each(e,function(e){var r=t._ImgManager.convertClientIndexToServerId(e);i.push(r)}),t._innerSend("PrintEx",hm(n,i.join(",")),!0,function(){},function(){}),!0}return t._ImagePrint.PrintEx(e),!0}},{key:"IsBlankImageAsync",value:(c=p(d().m(function f(e,r){var t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:return t=this,i={minBlockHeight:20,maxBlockHeight:30},r&&(jr.isNumber(r.minBlockHeight)&&r.minBlockHeight>=0&&(i.minBlockHeight=r.minBlockHeight),jr.isNumber(r.maxBlockHeight)&&r.maxBlockHeight>=0&&(i.maxBlockHeight=r.maxBlockHeight)),n={command:"isBlankImage",parameter:{index:e,minHeight:i.minBlockHeight,maxHeight:i.maxBlockHeight}},a.n=1,t.RunCommandAsync(n);case 1:if(!((o=a.v)&&On.isArray(o.result)&&o.result.length>0)){a.n=2;break}return a.a(2,o.result[0]);case 2:return a.a(2,!1)}},f,this)})),function(e,r){return c.apply(this,arguments)})},{key:"httpUploadBlob",value:function(e,r,t,n){var i,o=this,a="httpUploadBlob",s=r,u=t,c=null,l=null,f=vt.Text;if(o._resetErr(),!o._isValid())return Promise.reject({code:o._errorCode,message:o._errorString});if(jr.isUndefined(e)||""===e)return rg(o),Promise.reject({code:o._errorCode,message:o._errorString});if(!jr.isString(e))return _g(o),Promise.reject({code:o._errorCode,message:o._errorString});if(!(s instanceof Blob))return Ag(o),Promise.reject({code:o._errorCode,message:o._errorString});if(-1==Ss(null!==(i=s.type)&&void 0!==i?i:""))return hh(o,-2845,"Only Blob of JPEG, PNG, BMP, TIFF and PDF image types can be uploaded."),Promise.reject({code:o._errorCode,message:o._errorString});if(n){var d=new FormData;jr.each(n.formFields,function(e,r){var t=e.name,n=e.value;jr.isString(t)&&(n instanceof Blob?d.append(t,n,e.fileName):d.append(t,n))}),c=d,l={},jr.each(n.headers,function(e,r){jr.isString(e.name)&&(l[e.name]=e.value)}),n.responseType&&(f=n.responseType)}var h=o._createHttpUploaderConfig(),g=new Dd,v=new xd;return v.url=e,v.method=a,v.content=s,s=null,v.contentType=o._strHttpContentTypeFieldValue,v.headers=l,v.fileName=u,c&&(v.httpFormData=c),o.__remoteFilename&&""!=o.__remoteFilename&&(v.remoteFilename=o.__remoteFilename),v.retry=1,v.bOnlyResponseEmptyIsOK=!1,v.responseType=f,h.objUploadStatus=void 0,o.IfShowProgressBar&&On.showProgress(o,a,!1),new Promise(function(e,r){g.httpPostUpload(h,v,function(r){o.IfShowProgressBar&&On.closeProgress(o,a,!1),e(r)},function(e,t){o.IfShowProgressBar&&On.closeProgress(o,a,!1),r({code:e,message:t})})})}},{key:"saveBlob",value:(u=p(d().m(function h(e,r){var t,n,i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:if(i=e,(t=this)._resetErr(),t._isValid()){s.n=1;break}throw{code:t._errorCode,message:t._errorString};case 1:if(!jr.isString(e)&&null!==e&&e!==undefined){s.n=2;break}s.n=3;break;case 2:case 6:throw Ag(t),{code:t._errorCode,message:t._errorString};case 3:if(!(r instanceof Blob)){s.n=6;break}if(-1!=Ss(null!==(a=r.type)&&void 0!==a?a:"")){s.n=4;break}throw sv(t),{code:t._errorCode,message:t._errorString};case 4:return s.n=5,fG(r);case 5:o=s.v,s.n=7;break;case 7:return i||(i=""),i=kp.replaceLocalFilename(i),n=hm(i),s.n=8,new Promise(function(e,r){t._innerSendBlobByWS("SaveBlobToFile",n,o,function(r){e(r)},function(e){r({code:t._errorCode,message:t._errorString})})});case 8:return s.a(2)}},h,this)})),function(e,r){return u.apply(this,arguments)})},{key:"createLocalStorage",value:(a=p(d().m(function m(e){var r,t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if((r=this)._resetErr(),r._isValid()){a.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:if(n="CreateLocalStorage",!e){a.n=3;break}if(o=e.password,!1!==v(cz,this,fz).call(this,o)){a.n=2;break}throw{code:r._errorCode,message:r._errorString};case 2:i=JSON.stringify([JSON.stringify(e)]),a.n=4;break;case 3:i='["{}"]';case 4:return a.n=5,new Promise(function(e,t){r._innerSend(n,i,!1,function(n){if(jr.isArray(n)&&n.length>0){var i=n[0];i&&jr.isString(i.uid)&&e(i.uid)}else $g(r),t({code:r._errorCode,message:r._errorString})},function(){t({code:r._errorCode,message:r._errorString})})});case 5:return t=a.v,a.a(2,t)}},m,this)})),function(e){return a.apply(this,arguments)})},{key:"localStorageExist",value:(o=p(d().m(function y(e){var r,t,n;return d().w(function(i){for(;;)switch(i.n){case 0:if(t="LocalStorageExist",(r=this)._resetErr(),r._isValid()){i.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:if(0!=v(cz,r,dz).call(r,e)){i.n=2;break}throw{code:r._errorCode,message:r._errorString};case 2:return i.n=3,new Promise(function(n,i){r._innerSend(t,hm(e),!1,function(e){if(jr.isArray(e)&&e.length>0){var t=e[0];(jr.isBoolean(t)||jr.isNumber(t))&&n(!!t)}else $g(r),i({code:r._errorCode,message:r._errorString})},function(){i({code:r._errorCode,message:r._errorString})})});case 3:return n=i.v,i.a(2,n)}},y,this)})),function(e){return o.apply(this,arguments)})},{key:"saveToLocalStorage",value:(i=p(d().m(function I(e){var r,t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:if(t="SaveToLocalStorage",(r=this)._resetErr(),r._isValid()){o.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:if(jr.isObject(e)){o.n=2;break}throw Ag(r),{code:r._errorCode,message:r._errorString};case 2:if(!1!==v(cz,r,dz).call(r,e.uid)&&!1!==v(cz,this,fz).call(this,e.password)){o.n=3;break}throw{code:r._errorCode,message:r._errorString};case 3:if(!jr.isUndefined(e.indices)){o.n=4;break}e.indices=Mp(r),o.n=7;break;case 4:if(!jr.isArray(e.indices)||0!=e.indices.length){o.n=5;break}o.n=7;break;case 5:if(r._checkIndices(e.indices)){o.n=6;break}throw{code:r._errorCode,message:r._errorString};case 6:e.indices=Lp(r,e.indices);case 7:return n=JSON.stringify([JSON.stringify(e)]),o.n=8,new Promise(function(e,i){r._innerSend(t,n,!1,function(t){if(jr.isArray(t)&&t.length>0){var n=t[0];n&&n.imageIds&&e(n.imageIds)}else $g(r),i({code:r._errorCode,message:r._errorString})},function(){i({code:r._errorCode,message:r._errorString})})});case 8:return i=o.v,o.a(2,i)}},I,this)})),function(e){return i.apply(this,arguments)})},{key:"loadFromLocalStorage",value:(n=p(d().m(function b(e){var r,t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if(t="LoadFromLocalStorage",(r=this)._resetErr(),r._isValid()){a.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:if(jr.isObject(e)){a.n=2;break}throw Ag(r),{code:r._errorCode,message:r._errorString};case 2:if(!1!==v(cz,r,dz).call(r,e.uid)&&!1!==v(cz,this,fz).call(this,e.password)){a.n=3;break}throw{code:r._errorCode,message:r._errorString};case 3:return(o=jr.clone(e)).documentName=r._getCurrentDocumentName(),o.tagName=r._getCurrentDefaultTagName(),n=JSON.stringify([JSON.stringify(o)]),On.showProgress(r,t,!1),On.progressBarOnPercentDone(-1,"Processing...","",0,""),a.n=4,new Promise(function(e,i){r._innerSend(t,n,!1,function(n){var o;On.closeProgress(null,t),jr.isArray(n)&&n.length>0?(o=n[0])&&o.mapImageIds&&e(o.mapImageIds):(!1===o&&0!=r._errorCode||$g(r),i({code:r._errorCode,message:r._errorString}))},function(){On.closeProgress(null,t),i({code:r._errorCode,message:r._errorString})})});case 4:return i=a.v,a.a(2,i)}},b,this)})),function(e){return n.apply(this,arguments)})},{key:"removeLocalStorage",value:(t=p(d().m(function C(e){var r,t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:if(t="RemoveLocalStorage",(r=this)._resetErr(),r._isValid()){o.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:if(jr.isObject(e)){o.n=2;break}throw Ag(r),{code:r._errorCode,message:r._errorString};case 2:if(!1!==v(cz,r,dz).call(r,e.uid)&&!1!==v(cz,this,fz).call(this,e.password)){o.n=3;break}throw{code:r._errorCode,message:r._errorString};case 3:return e&&(n=JSON.stringify([JSON.stringify(e)])),o.n=4,new Promise(function(e,i){r._innerSend(t,n,!1,function(t){if(jr.isArray(t)&&t.length>0){var n=t[0];jr.isArray(n)?e(n):jr.isString(n)||jr.isNumber(n)?e([n.toString()]):e([])}$g(r),i({code:r._errorCode,message:r._errorString})},function(){i({code:r._errorCode,message:r._errorString})})});case 4:return i=o.v,o.a(2,i)}},C,this)})),function(e){return t.apply(this,arguments)})}]);var t,n,i,o,a,u,c}(cG);function fz(e){if(!jr.isUndefined(e)){if(!jr.isString(e))return hh(this,-2850,"The password is not a string."),!1;if(e.length>32)return function(e){hh(e,-2849,"The password must not exceed 32 characters in length.")}(this),!1}return!0}function dz(e){return jr.isUndefined(e)||""==e?(hh(this,-2846,"The uid cannot be empty."),!1):!!jr.isString(e)||(function(e){hh(e,-2847,"The uid is invalid.")}(this),!1)}function hz(e,r,t,n){var i;0!==t&&1!==t?i=t:(i={},t&&(i.set=1==n?function(t){var n=1*t;return!jr.isNumber(n)||isNaN(n)?(Uh(e),!1):(e._resetErr(),!!e._isValid()&&e._innerFun(r,hm(n)))}:2==n?function(t){return jr.isBoolean(t)?(e._resetErr(),!!e._isValid()&&e._innerFun(r,hm(t))):(Uh(e),!1)}:function(t){return jr.isString(t)?(e._resetErr(),!!e._isValid()&&e._innerFun(r,hm(t))):(Uh(e),!1)})),i.get||(i.get=function(){return e._resetErr(),!!e._isValid()&&e._innerFun(r)}),r in e||Object.defineProperty(e,r,i)}On.removeNonPrintableChar;var gz=function(e,r,t){2==t&&jr.each(r,function(r,t){HH(e,r,{get:function(){return e._resetErr(),!!e._isValid()},set:function(r){return e._resetErr(),!!e._isValid()}})})},vz=function(e,r){jr.each(r,function(r,t){hz(e,r,1,2)})},mz=function(e,r){jr.each(r,function(r,t){hz(e,r,1,1)})},pz=function(e,r){jr.each(r,function(r,t){hz(e,r,0)})},_z=function(e,r){jr.each(r,function(r,t){hz(e,r,1)})};function yz(e){var r=e;if(!r._bRemoteMode){HH(r,"ProductKey",{get:function(){return xn.ProductKey},set:function(e){return jr.isString(e)?(r._resetErr(),!!r._isValid()&&r._setProductKey(e,!1)):(Uh(r),!1)}}),HH(r,"ProductName",{get:function(){return xn.ProductName}}),HH(r,"VersionInfo",{get:function(){return Qu.getJSVersion()}}),HH(r,"DefaultSourceName",{get:function(){var e=r._getDefaultDevice();return e?e.displayName:""}}),HH(r,"ImageCaptureDriverType",{get:function(){return r._resetErr(),r._isValid()?r._driverType:0},set:function(e){var t=!1,n=!1,i=!1;if(r._bRemoteMode?r.__serverPlatform==rt.enumWindow?i=!0:r.__serverPlatform==rt.enumLinux?n=!0:r.__serverPlatform==rt.enumMac&&(t=!0):(t=se.bMac,n=se.bLinux,i=se.bWin),r._resetErr(),!r._isValid())return!1;if(""!==e){var o=1*e,a=!1;if(o<Xt.TWAIN||o>Xt.TWAIN64)return Ig(r),!1;if(i){if(o===Xt.TWAIN_AND_TWAIN64)r._b64bit&&(r._driverType=o);else if(o!=Xt.TWAIN&&o!=Xt.TWAIN64)return Ig(r),!1;r._b64bit||(o=Xt.TWAIN),r._driverType=o,a=!0}else if(n)o=Xt.SANE,r._driverType=o,a=!0;else if(t){if(o===Xt.TWAIN_AND_ICA);else if(o!=Xt.ICA&&o!=Xt.TWAIN&&o!=Xt.TWAIN64)return Ig(r),!1;r._driverType=o,a=!0}return a&&(r._curDevice=null,r.__devices=null),!0}return Ig(r),!1}}),HH(r,"HTTPPostResponseString",{get:function(){return r._resetErr(),r._isValid()&&r.__HTTPPostResponseString?r.__HTTPPostResponseString:""}}),HH(r,"IfAppendImage",{get:function(){return r._resetErr(),!!r._isValid()&&r.__IfAppendImage},set:function(e){return r._resetErr(),!!r._isValid()&&(jr.isBoolean(e)?r.__IfAppendImage=e:(Uh(r),!1))}}),HH(r,"FTPPort",{get:function(){return r._resetErr(),r._isValid()?r._innerFun("FTPPort"):0},set:function(e){if(r._resetErr(),!r._isValid())return!1;if(""!==e){var t=1*e;return r._innerFun("FTPPort",hm(t))}}}),HH(r,"JPEGQuality",{get:function(){return r._resetErr(),r._isValid()?r._innerFun("JPEGQuality"):0},set:function(e){var t=1*e;return t>=100?t=100:t<0&&(t=0),r._resetErr(),!!r._isValid()&&r._innerFun("JPEGQuality",hm(t))}}),hz(r,"TIFFCompressionType",1,1),hz(r,"BufferMemoryLimit",1,1),HH(r,"LogLevel",{get:function(){return r._resetErr(),r._isValid()?r._innerFun("LogLevel"):0},set:function(e){if(r._resetErr(),!r._isValid())return!1;var t=1*e;return r._logLevel=t,tz.logLevel=r._logLevel,r._innerFun("LogLevel",hm(t))}}),HH(r,"HttpContentTypeFieldValue",{get:function(){return r._resetErr(),r._isValid()?r._strHttpContentTypeFieldValue:""},set:function(e){return r._resetErr(),!!r._isValid()&&(r._strHttpContentTypeFieldValue=e,e)}}),HH(r,"BrokerProcessType",{get:function(){return r._resetErr(),r._isValid()?1:0},set:function(e){return r._resetErr(),!!r._isValid()}}),HH(r,"BorderStyle",{get:function(){return r._resetErr(),!!r._isValid()&&0},set:function(e){return r._resetErr(),r._isValid(),!1}}),HH(r,"HttpFieldNameOfUploadedImage",{get:function(){return r._resetErr(),r._isValid()?r.__remoteFilename:""},set:function(e){return r._resetErr(),r._isValid()?r.__remoteFilename=e:""}}),HH(r,"style",{get:function(){return r._isValid()?r.__style:""}}),HH(r,"ScaleDownThreshold",{get:function(){return r._resetErr(),r._isValid()?r._scaleDownThreshold:0},set:function(e){var t=1*e;return!jr.isNumber(t)||isNaN(t)?(Uh(self),!1):(r._resetErr(),!!r._isValid()&&(r._scaleDownThreshold=e))}}),HH(r,"CurrentImageIndexInBuffer",{get:function(){return r._isValid()&&r._ImgManager?r._ImgManager.getCurrentImageIndex():0},set:function(e){var t=1*e;return r._resetErr(),!!r._isValid()&&(t>=0&&t<r._ImgManager.count()&&(r._ImgManager.setSelectedClientIndexArray([t]),r._isBindViewer()&&jH.__innerRefreshFromUIView(r,r._ImgManager.getCurrentImageIndex())),!0)}}),HH(r,"SelectedImagesIndices",{get:function(){return r._resetErr(),r._isValid()?r._ImgManager.count()<=0?[]:r._ImgManager.getSelectedClientIndexArray():[]}}),HH(r,"MaxImagesInBuffer",{get:function(){return r._resetErr(),r._isValid()?r.__maxImagesInBuffer:0},set:function(e){var t=1*e;return r._resetErr(),!!r._isValid()&&(t>0&&t<32768?r.__maxImagesInBuffer=t:hh(r,-1010,"Data parameter out of supported range."),r.__maxImagesInBuffer)}}),HH(r,"IfSSL",{get:function(){return r._bSSL},set:function(e){return r._bSSL=e,r._innerFun("IfSSL",hm(e)),!0}}),hz(r,"IfAllowLocalCache",1,2),HH(r,"UseLocalService",{get:function(){return!0}}),HH(r,"PDFCompressionType",{get:function(){return r._resetErr(),!!r._isValid()&&r._innerFun("PDFCompressionType")},set:function(e){var t=1*e;return t==ct.PDF_FAX3&&(t=ct.PDF_FAX4),r._resetErr(),!!r._isValid()&&r._innerFun("PDFCompressionType",hm(t))}}),r._setProductKey=function(e,t,n,i){var o=!0,a=e,s=function(e){e||(r.__licenseInfo=undefined);var t=!0;return i||(t=jv.checkProductKey(r,{Core:!0})),jr.isFunction(n)&&n(),t};if(r._resetErr(),!r._isValid())return!1;if(Zu.bUseDynamsoftLicenseManager||r._blts)return vv(r),!1;if(a=jr.isString(a)?jr.trim(a):"",xn.ProductKey=a,""==a)o=!1,s();else{jv.reparseProductKey();var u=xn.licenseException;if(0!=u.code)return r.__licenseInfo=undefined,r._errorCode=u.code,r._errorString=u.message,jr.isFunction(n)&&n(),!1;r._innerFunRaw("ProductKey",hm(a),t,!1,!1,function(e){var n=!1;n=jr.isArray(e)?e[0]:e,jr.isArray(e)&&e.length>=3&&"1"===e[1]&&jr.isFunction(xn.ShowMessage)&&xn.ShowMessage(e[2],{width:510,height:272,headerStyle:1,seconds:10}),t||(o=n),r.__licenseInfo=undefined,r.GetLicenseInfo(function(){r._setConvertMode(r._pdfConvertMode),s(!0)},s)},function(){t||(o=!1),s()})}return o},_z(r,["ProxyServer"]);_z(r,["CapValueString","CapDescription","FTPPassword","FTPUserName","PDFAuthor","PDFCreationDate","PDFCreator","PDFKeywords","PDFModifiedDate","PDFProducer","PDFSubject","PDFTitle","PDFVersion"]),pz(r,["Manufacturer","ProductFamily","ImageBitsPerPixel","ImageLength","ImageWidth","ImageXResolution","ImageYResolution"]);pz(r,["BlankImageCurrentStdDev","CapDefaultIndex","CapDefaultValue","DataSourceStatus","Duplex","PendingXfers","ImageLayoutDocumentNumber","ImageLayoutFrameBottom","ImageLayoutFrameLeft","ImageLayoutFrameNumber","ImageLayoutFrameRight","ImageLayoutFrameTop","ImageLayoutPageNumber","ImagePixelType","MagData","MagType","IfFeederLoaded","IfPaperDetectable","IfUIControllable"]),vz(r,["AllowPluginAuthentication","IfModalUI","IfScanInNewThread","_AutoCropMethod","IfSortBySelectionOrder"]);vz(r,["IfDisableSourceAfterAcquire","IfDuplexEnabled","IfFeederEnabled","IfPASVMode","IfAutoBright","IfAutoDiscardBlankpages","IfAutoFeed","IfAutomaticBorderDetection","IfAutomaticDeskew","IfAutoScan","IfShowIndicator","IfUseTwainDSM","IfTiffMultiPage"]),mz(r,["MaxInternetTransferThreads"]);mz(r,["BlankImageMaxStdDev","BlankImageThreshold","BitDepth","Brightness","PageSize","PixelType","Resolution","Capability","CapCurrentIndex","CapCurrentValue","CapMaxValue","CapMinValue","CapNumItems","CapStepSize","CapType","CapValue","CapValueType","Contrast","PixelFlavor","TransferMode","Unit","XferCount"]),gz(r,["AsyncMode","EnableInteractiveZoom","IfThrowException","ImageEditorIfEnableEnumerator","ImageEditorIfReadonly","ImageEditorIfModal","ImageEditorWindowTitle","IfShowPrintUI","VScrollBar"],2);gz(r,["IfOpenImageWithGDIPlus"])}}On.DynamicLoadAddonFuns=[],On.attachAddon=function(e){var r=!1;return jr.each(On.DynamicLoadAddonFuns,function(t){jr.isFunction(t)&&(t(e),r=!0)}),!xc.bFullEdition&&e.__addon&&delete e.__addon.Camera,r};var Sz=new WeakSet,Iz=function(e){function r(e){var t,n,i;return _(this,r),g(t=s(this,r,[e]),Sz),n=e||{},t._config=n,t._destroying=!1,t._iServiceType=qr.TwainService,t.__addon={},t._bNoMask=!1,t._bNotShowMessage=!1,t._bSelectedSourceByServer=!1,t._bKeepAwake=!1,t._bAx=!1,n.container&&(t._containerElement=n.container),t.__IfShowCancelDialogWhenImageTransfer=!0,t._errorCode=0,t._errorString="",t.__bLoadingImage=!1,t.__bAcquireImageNow=!1,t.__bOpenFileNow=!1,t.__defaultSourceName="",t.__sourceCount=0,t._bConnecting=!1,t.__licenseInfo=undefined,t.__productKey="",t._moduleSize=1048576,t._driverType=Xt.TWAIN,t.__maxUploadImageSize=-1,t._bServerPercentDone=!0,t._bRegistedLoad=!1,t._logLevel=0,t._scaleDownThreshold=0,t._pdfWriteSetting={},t.__serverPlatform=rt.enumUnknown,t._reconnectTimeSpan=xc.LocaleReconnectTimeSpan,t._bRemoteMode||(t.httpFormFields={},t.HTTPPassword="",t.HTTPPort=t._bSSL?443:80,t.HTTPUserName="",t.__HTTPPostResponseString="",t.__remoteFilename="RemoteFile",t.__httpHeaderMap=!1,t._b64bit?t._segementUploadThreshold=4294967296:t._segementUploadThreshold=524288e3,t._aryTiffTag=[],t._tiffCompressionType=xn.EnumDWT_TIFFCompressionType.TIFF_AUTO,t._jpgQuality=80,t._pdfConvertMode=3,t._pdfOptions={convertMode:Ht.CM_AUTO,password:"",renderOptions:{renderAnnotations:!1,resolution:200,maxWidth:0,maxHeight:0,renderGrayscale:!1},preserveUnmodifiedOnSave:!1}),yz(t),HH(i=t,"Width",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("Width"),""):i._UIView.GetWidth():""},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("Width"):!!i._UIView.SetWidth(e)&&(i._width=e,!0))}}),HH(i,"Height",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("Height"),""):i._UIView.GetHeight():""},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("Height"):!!i._UIView.SetHeight(e)&&(i._height=e,!0))}}),HH(i,"AllowMultiSelect",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?i._nouiNotSupport("AllowMultiSelect"):i._UIView.GetAllowMultiSelect():""},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("AllowMultiSelect"):void i._UIView.SetAllowMultiSelect(e))}}),HH(i,"BackgroundColor",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("BackgroundColor"),""):i._UIView.GetBackgroundColor():""},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("BackgroundColor"):i._UIView.SetBackgroundColor(e))}}),HH(i,"BackgroundFillColor",{get:function(){if(i._resetErr(),!i._isValid())return"";if(i._isNoViewer())return i._nouiNotSupport("BackgroundFillColor"),"";var e=i._innerFun("BackgroundFillColor");return hs.BGR2RGB(e)},set:function(e){if(i._resetErr(),!i._isValid())return!1;if(i._isNoViewer())return i._nouiNotSupport("BackgroundFillColor");var r,t=1*e;return!jr.isNumber(t)||jr.isNaN(t)?(Uh(i),!1):(r=hs.RGB2BGR(t),i._innerFun("BackgroundFillColor",hm(r)))}}),HH(i,"FitWindowType",{get:function(){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?(i._nouiNotSupport("FitWindowType"),0):i._UIView.GetFitWindowType())},set:function(e){if(i._resetErr(),!i._isValid())return!1;if(i._isNoViewer())return i._nouiNotSupport("FitWindowType");var r=1*e;return i._UIView.SetFitWindowType(r)}}),HH(i,"IfFitWindow",{get:function(){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("IfFitWindow"):i._UIView.GetIfFitWindow())},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("IfFitWindow"):e?i._UIView.SetIfFitWindow(!0):i._UIView.SetIfFitWindow(!1))}}),HH(i,"ImageMargin",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("ImageMargin"),0):i._UIView.GetImageMargin():0},set:function(e){if(i._resetErr(),!i._isValid())return!1;if(i._isNoViewer())return i._nouiNotSupport("ImageMargin");var r=parseInt(e);return!isNaN(r)&&i._UIView.SetImageMargin(r)}}),HH(i,"MouseX",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("MouseX"),0):i.__MouseX:0}}),HH(i,"MouseY",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("MouseY"),0):i.__MouseY:0}}),HH(i,"SelectionImageBorderColor",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("SelectionImageBorderColor"),""):i._UIView.GetSelectionImageBorderColor():""},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("SelectionImageBorderColor"):i._UIView.SetSelectionImageBorderColor(e))}}),HH(i,"Zoom",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("Zoom"),0):i._UIView.GetZoom():0},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("Zoom"):i._UIView.SetZoom(e))}}),HH(i,"MouseShape",{get:function(){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("MouseShape"):i._UIView.GetMouseShape())},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("MouseShape"):i._UIView.SetMouseShape(e))}}),HH(i,"SelectionRectAspectRatio",{get:function(){return i._resetErr(),i._isValid()?i._isNoViewer()?(i._nouiNotSupport("SelectionRectAspectRatio"),0):i._UIView.GetSelectionRectAspectRatio():0},set:function(e){if(i._resetErr(),!i._isValid())return!1;if(i._isNoViewer())return i._nouiNotSupport("SelectionRectAspectRatio");var r=parseFloat(e);return r>=0&&(i._UIView.SetSelectionRectAspectRatio(r),!0)}}),HH(i,"ShowPageNumber",{get:function(){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("ShowPageNumber"):i._UIView.GetShowPageNumber())},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("ShowPageNumber"):i._UIView.SetShowPageNumber(e))}}),HH(i,"IfAutoScroll",{get:function(){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("IfAutoScroll"):i._UIView.GetIfAutoScroll())},set:function(e){return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("IfAutoScroll"):i._UIView.SetIfAutoScroll(e))}}),t._innerInitEvents(n),t}return l(r,e),S(r,[{key:"dispose",value:(a=p(d().m(function u(){return d().w(function(e){for(;;)if(0===e.n)return e.a(2,this.__unload())},u,this)})),function(){return a.apply(this,arguments)})},{key:"__unload",value:(o=p(d().m(function c(){return d().w(function(e){for(;;)switch(e.n){case 0:return this._ImagePrint&&this._ImagePrint.dispose(),e.n=1,t(r,"__unload",this,3)([]);case 1:this._ImagePrint=undefined,this.__OnTopImageInTheViewChanged=undefined,this.__CloseImageEditorUI=undefined,this._config=null;case 2:return e.a(2)}},c,this)})),function(){return o.apply(this,arguments)})},{key:"GetImageDataAsync",value:function(e){return this._ImgManager.getImageData(e)}},{key:"SetCustomDataAsync",value:function(e,r){return this._ImgManager.setCustomData(e,r)}},{key:"style",get:function(){return this.__style}},{key:"GetSourceNamesAsync",value:(i=p(d().m(function f(e){var r;return d().w(function(t){for(;;)switch(t.p=t.n){case 0:if((r=this)._resetErr(),r._isValid()){t.n=1;break}throw{code:r._errorCode,message:r._errorString};case 1:return zl("GetSourceNamesAsync",r),t.p=2,t.n=3,r._getSourceCountAsync(r._driverType);case 3:t.n=5;break;case 4:throw t.p=4,t.v;case 5:return t.p=5,Kl("GetSourceNamesAsync"),t.f(5);case 6:if(!e){t.n=7;break}return t.a(2,v(Sz,r,bz).call(r));case 7:return t.a(2,v(Sz,r,Cz).call(r));case 8:return t.a(2)}},f,this,[[2,4,5,6]])})),function(e){return i.apply(this,arguments)})},{key:"SelectSourceAsync",value:function(e){var r=ds().dialogText.selectSource;return this._selectSourceAsync("SelectSourceAsync",e,r)}},{key:"SelectSourceByIndexAsync",value:function(e){return this._selectSourceByIndexAsync("SelectSourceByIndex",e)}},{key:"OpenSourceAsync",value:function(){return this._openSourceAsync("OpenSourceAsync")}},{key:"CloseSourceAsync",value:function(){return this._closeSourceAsync("CloseSourceAsync")}},{key:"OpenSourceManagerAsync",value:function(){var e=this;return e._resetErr(),e._isValid()?e._innerFunV2("OpenSourceManager"):Promise.reject({code:e._errorCode,message:e._errorString})}},{key:"CloseSourceManagerAsync",value:function(){var e=this;return e._resetErr(),e._isValid()?e._innerFunV2("CloseSourceManager"):Promise.reject({code:e._errorCode,message:e._errorString})}},{key:"AcquireImage",value:function(e,r,t){var n,i=this,o=null,a=null;return i._resetErr(),!!i._isValid()&&(jr.isUndefined(t)&&(jr.isFunction(e)&&jr.isFunction(r)||jr.isFunction(e)&&jr.isUndefined(r)||jr.isFunction(e)&&null==r||null==e&&jr.isFunction(r))?(n={},jr.isFunction(e)&&(o=e),jr.isFunction(r)&&(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message),r(i._errorCode,i._errorString)})):(n=jr.isUndefined(e)||null==e?{}:jr.clone(e),jr.isFunction(r)&&(o=function(){r(n)}),jr.isFunction(t)&&(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message),t(n,i._errorCode,i._errorString)})),o||(o=function(){}),a||(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message)}),i.AcquireImageAsync(n).then(o,a),!dp.isServerInvalid(i))}},{key:"GetDevicesAsync",value:function(e,r,t,n){return this._getDevicesAsync("GetDevicesAsync",e,r,t,n)}},{key:"SelectDeviceAsync",value:function(e,r){var t=this;return t._resetErr(),t._isValid()?this._selectDeviceAsync("SelectDeviceAsync",e,r):Promise.reject({code:t._errorCode,message:t._errorString})}},{key:"AcquireImageAsync",value:function(e){return t(r,"_acquireImage",this,3)([this._curDevice,e])}},{key:"ImageIDToIndex",value:function(e){return this._uidFromServer2index(e)}},{key:"IndexToImageID",value:function(e){return this._index2uidFromServer(e)}},{key:"RemoveImage",value:function(e){return this._removeImage("RemoveImage",e)}},{key:"_innerGetSourceNamesSync",value:function(e){var r=this;return r._getSourceCountSync(),e?v(Sz,r,bz).call(r):v(Sz,r,Cz).call(r)}},{key:"getCapabilities",value:function(e,r,t){var n,i,o,a=this;if(On.isFunction(e)?(i=e,o=r):(n=e,i=r,o=t),!jr.isUndefined(n)){if(!jr.isArray(n))return Ag(a),void(jr.isFunction(o)&&o(a._errorCode,a._getErrorString()));if(jr.isArray(n)&&n.indexOf(null)>=0)return Ag(a),void(jr.isFunction(o)&&o(a._errorCode,a._getErrorString()));if(jr.isString(n)&&0==n.trim().length)return Ag(a),void(jr.isFunction(o)&&o(a._errorCode,a._getErrorString()))}return this._dwtGetCapabilities(n,i,o)}},{key:"setCapabilities",value:function(e,r,t){return this._dwtSetCapabilities(e,r,t)}},{key:"CancelAllPendingTransfers",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CancelAllPendingTransfers")}},{key:"CloseSource",value:function(){var e=this;if(e._resetErr(),!e._isValid())return!1;var r=e._innerFun("CloseSource");return r&&(e._curDevice=null),r}},{key:"CloseSourceManager",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("CloseSourceManager")}},{key:"SelectDevice",value:function(e,r){var t,n=this;if(e&&e.deviceType,n._resetErr(),xn.ConnectWithSocket)return hh(n,-2400,"SelectDevice"+" doesn't work under current settings."),!1;var i,o=null===(t=this._dmService.attrs)||void 0===t?void 0:t.UUID;if(o)if((null===(i=e.serviceInfo)||void 0===i||null===(i=i.attrs)||void 0===i?void 0:i.UUID)==o);else{var a,s,u=(null===(a=e.serviceInfo)||void 0===a||null===(a=a.attrs)||void 0===a?void 0:a.url)||(null===(s=e.serviceInfo)||void 0===s?void 0:s.server);if(!(u&&u.indexOf(o)>-1))return Bg(n),!1}var c=!1;try{(c=v(Sz,this,Tz).call(this,e.strDevice,r))&&(this._curDevice=e,this._bSelectedSourceByServer=!1)}catch(l){c=!1,this._errorCode=it.CommonError,l&&l.message&&(this._errorString=l.message)}return c}},{key:"DisableSource",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("DisableSource")}},{key:"FeedPage",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("FeedPage")}},{key:"GetDeviceType",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("GetDeviceType")}},{key:"GetSourceNameItems",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&(r.__sourceCount<0&&(r.__sourceCount=0),e<r.__sourceCount&&e>=0?r._getSourceNameByIndex(e):"")}},{key:"SourceNameItems",value:function(e){var r=this;return r._resetErr(),!!r._isValid()&&r.GetSourceNameItems(e)}},{key:"GetSourceNames",value:function(e){return this._innerGetSourceNamesSync(e)}},{key:"getSourceCount",value:function(e){return this._getSourceCountAsync(e)}},{key:"GetSourceCountAsync",value:function(e){return this._getSourceCountAsync(e)}},{key:"GetSourceType",value:function(e){var r=this,t=parseInt(e);if(r._resetErr(),isNaN(t))return Ag(r),!1;if(null==r.__devices&&r.GetSourceNames(!1),t>=r.__devices.length||t<0)return gg(r),!1;var n,i,o,a=r.__devices[t];return n=a.deviceType,i=Xt.TWAIN,(o=n&Jt)==Gt.TWAINSCANNER||o==Gt.WIATWAINSCANNER||(o==Gt.TWAINX64SCANNER?i=Xt.TWAIN64:o==Gt.ICASCANNER?i=Xt.ICA:o==Gt.SANESCANNER?i=Xt.SANE:(o&Gt.TWAINX64SCANNER)==Gt.TWAINX64SCANNER?(o&Gt.TWAINSCANNER)!=Gt.TWAINSCANNER&&(o&Gt.WIATWAINSCANNER)!=Gt.WIATWAINSCANNER||(i=Xt.TWAIN_AND_TWAIN64):(o&Gt.ICASCANNER)==Gt.ICASCANNER&&((o&Gt.TWAINSCANNER)!=Gt.TWAINSCANNER&&(o&Gt.WIATWAINSCANNER)!=Gt.WIATWAINSCANNER||(i=Xt.TWAIN_AND_ICA))),i}},{key:"OpenSource",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e._bRemoteMode?(hh(e,-2610,"OpenSource is not supported when Object is created by CreateRemoteScanObjectAsync. Please use OpenSourceAsync instead."),!1):e._innerFun("OpenSource"))}},{key:"OpenSourceManager",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("OpenSourceManager")}},{key:"ResetImageLayout",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("ResetImageLayout")}},{key:"RewindPage",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("RewindPage")}},{key:"SelectSource",value:function(e,r){var t=this,n=!1;if(jr.isFunction(e)&&(n=!0),t._resetErr(),!t._isValid())return!!n&&void 0;var i=Xt.TWAIN;if(!n){if(t._bRemoteMode)return hh(t,-2438,"SelectSource cannot be used synchronously when Object is created by CreateRemoteScanObjectAsync. Please use SelectSourceAsync instead."),!1;if(t._driverType==Xt.TWAIN_AND_TWAIN64)return function(e){hh(e,-2429,"The method SelectSource() must be invoked asynchronously (i.e. with callback functions) when ImageCaptureDriverType is set to TWAIN_AND_ICA or TWAIN_AND_TWAIN64.")}(t),!1;t._driverType!=Xt.ICA&&t._driverType!=Xt.SANE&&t._driverType!=Xt.TWAIN64||(i=t._driverType);var o=se.bMac,a=se.bLinux,s=Pp(i,se.bWin,a,o,se.bAndroid);return t._bSelectedSourceByServer=!0,t._curDevice=null,t._innerFun("SelectSource",hm(s))}t._driverType!=Xt.ICA&&t._driverType!=Xt.SANE&&t._driverType!=Xt.TWAIN64&&t._driverType!=Xt.TWAIN_AND_TWAIN64||(i=t._driverType);var u=se.bMac,c=se.bLinux,l=Pp(i,se.bWin,c,u,se.bAndroid);t.SelectSourceAsync(l).then(function(){jr.isFunction(e)&&e()},function(e){e&&e.code&&(t._errorCode=e.code,t._errorString=e.message),jr.isFunction(r)&&r(t._errorCode,t._getErrorString())})}},{key:"GetSourceTypeAsync",value:function(e){var r=this,t=1*e;return r._resetErr(),r._isValid()?Promise.resolve(r.GetSourceType(t)):Promise.reject({code:r._errorCode,message:r._errorString})}},{key:"SetFileXferInfo",value:function(e,r){var t,n,i=this;return i._resetErr(),!!i._isValid()&&(t=se.bFileSystem?e.replace(/<%/g,"<%25"):e,n=kp.replaceLocalFilename(t),i._innerFun("SetFileXferInfo",hm(n,r)))}},{key:"SetImageLayout",value:function(e,r,t,n){var i=this;return i._resetErr(),!!i._isValid()&&i._innerFun("SetImageLayout",hm(e,r,t,n))}},{key:"CapGet",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGet")}},{key:"CapGetCurrent",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetCurrent")}},{key:"CapGetDefault",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetDefault")}},{key:"CapGetFrameBottom",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameBottom",hm(e))}},{key:"CapGetFrameLeft",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameLeft",hm(e))}},{key:"CapGetFrameRight",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameRight",hm(e))}},{key:"CapGetFrameTop",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameTop",hm(e))}},{key:"CapGetHelp",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetHelp")}},{key:"CapGetLabel",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetLabel")}},{key:"CapGetLabels",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetLabels")}},{key:"CapIfSupported",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapIfSupported",hm(e))}},{key:"CapReset",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapReset")}},{key:"CapSet",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapSet")}},{key:"CapSetFrame",value:function(e,r,t,n,i){return this._resetErr(),!!this._isValid()&&this._innerFun("CapSetFrame",hm(e,r,t,n,i))}},{key:"GetCapItems",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("GetCapItems",hm(e))}},{key:"GetCapItemsString",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("GetCapItemsString",hm(e))}},{key:"SetCapItems",value:function(e,r){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCapItems",hm(e,r))}},{key:"SetCapItemsString",value:function(e,r){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCapItemsString",hm(e,r))}},{key:"GenerateURLForUploadData",value:function(e,r,t,n,i){var o=this,a=[];if(r==xn.EnumDWT_ImageType.IT_BMP||r==xn.EnumDWT_ImageType.IT_JPG||r==xn.EnumDWT_ImageType.IT_PNG){if(!jr.isArray(e))return hg(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString(),"",e,r),"";if(e.length>1)return lg(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString(),"",e,r),"";if(!o._checkIndices(e))return n(o._errorCode,o._getErrorString(),"",e,r),!1;var s=o._ImgManager.convertClientIndexToServerId(e[0]);-1!=s&&a.push(s)}else{if(r!=xn.EnumDWT_ImageType.IT_TIF&&r!=xn.EnumDWT_ImageType.IT_PDF)return jr.isArray(e)?mg(o):hg(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,r),"";var u,c;if(jr.isArray(e)){if(!o._checkIndices(e))return n(o._errorCode,o._getErrorString(),"",e,r),!1;u=e}else{if(-1!=e)return hg(o),jr.isFunction(n)&&n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,r),"";for(u=[],c=0;c<o._ImgManager.count();c++)u.push(c)}jr.each(u,function(e){var r=o._ImgManager.convertClientIndexToServerId(e);-1!=r&&a.push(r)})}if(jr.isFunction(t)&&jr.isFunction(n)){return o._asyncGenerateURLForUploadData(a,r,i,t,function(e){n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,r)}),!0}return this._syncGenerateURLForUploadData(a,r,i)}},{key:"_syncGenerateURLForUploadData",value:function(e,r,t){var n,i=this,o=!1,a=th().join(""),s=t,u=",";jr.isString(s)&&""!=s||(s="",u="");var c=["[",'"dcp","dwasm_'+a,'",',r,',"',e.join(","),'"',u,s,"]"].join("");if((n=this._innerFunRaw("GenerateURLForUploadData",c,!1,!1,!0))&&jr.isArray(n.result)&&n.result.length>1){var l=n.result[0],f=n.result[1];1==l&&(o=["dcp://dwasm_",a,"/file/",f].join(""))}return jr.isArray(e)&&jr.each(e,function(e){i._ImgManager.convertServerIdToClientIndex(e)}),0==o?(Sg(i),""):o}},{key:"_asyncGenerateURLForUploadData",value:function(e,r,t,n,i){var o=this,a=r,s="GenerateURLForUploadData",u=function(){if(On.closeProgress(null,s),jr.isFunction(i)){var r=[];jr.isArray(e)&&jr.each(e,function(e){var t=o._ImgManager.convertServerIdToClientIndex(e);t>-1&&r.push(t)}),i(r)}return""},c=",";if(a==xn.EnumDWT_ImageType.IT_BMP||a==xn.EnumDWT_ImageType.IT_JPG||a==xn.EnumDWT_ImageType.IT_PNG){if(e.length>1)return lg(o),u(),""}else if(a!=xn.EnumDWT_ImageType.IT_TIF&&a!=xn.EnumDWT_ImageType.IT_PDF)return mg(o),u(),"";var l=!1,f=th().join(""),d=t;jr.isString(d)&&""!=d||(d="",c="");var h=["[",'"dcp","dwasm_'+f,'",',a,',"',e.join(","),'"',c,d,"]"].join("");return On.showProgress(o,s,!1),this._innerFunRaw(s,h,!0,!1,!0,function(t){if(On.closeProgress(null,s),t&&jr.isArray(t.result)&&t.result.length>0)if(1==t.result[0]&&t.result.length>1){var i=t.result[1];l=["dcp://dwasm_",f,"/file/",i].join("")}else t.exception!==undefined&&t.description!==undefined?(o._errorCode=t.exception,o._errorString=t.description):Sg(o);else Sg(o);if(0==l)return u(),"";if(jr.isFunction(n)){var a=[];jr.isArray(e)&&jr.each(e,function(e){var r=o._ImgManager.convertServerIdToClientIndex(e);r>-1&&a.push(r)}),n(l,a,r)}return l},u)}},{key:"SelectSourceByIndex",value:function(e){var r=this,t=parseInt(e);if(r._resetErr(),isNaN(t))return Ag(r),!1;if(null==r.__devices&&r.GetSourceNames(!1),t>=r.__devices.length||t<0)return gg(r),!1;var n=r.__devices[t];return r.SelectDevice(n)}},{key:"EnableSource",value:function(e,r,t){var n=this;return n._resetErr(),!!n._isValid()&&n.AcquireImage(e,r,t)}},{key:"SourceCount",get:function(){return this._getSourceCountSync()}},{key:"CurrentSourceName",get:function(){return this._curDevice?this._curDevice.displayName:""}},{key:"checkStartScanParams",value:function(e,r){var t=this;if(!e)return hh(t,-2381,"scanSetup is invalid."),!1;if(!jr.isUndefined(r.transferMode)&&0!=e.transferMode&&1!=e.transferMode&&2!=e.transferMode)return function(e){hh(e,-2382,"Scanner setup error: Invalid Transfer Mode.")}(t),!1;if(e.transferMode==xn.EnumDWT_TransferMode.TWSX_FILE){if(!e.fileXfer)return function(e){hh(e,-2383,"Scanner setup error: fileXfer is invalid.")}(t),!1;if(!jr.isString(e.fileXfer.fileName)||""==e.fileXfer.fileName)return function(e){hh(e,-2384,"Scanner setup error: Invalid fileName in fileXfer.")}(t),!1;if(!jr.isNumber(e.fileXfer.fileFormat)||e.fileXfer.fileFormat<0||e.fileXfer.fileFormat>16)return function(e){hh(e,-2385,"Scanner setup error: Invalid fileFormat in fileXfer.")}(t),!1}if(r){if(!jr.isString(r.type)||""==r.type)return function(e){hh(e,-2387,"Output setup error: Invalid type in outputSetup.")}(t),!1;if(!r.httpParams)return function(e){hh(e,-2386,"Output setup error: Invalid httpParams in outputSetup.")}(t),!1;if(e.transferMode!=xn.EnumDWT_TransferMode.TWSX_FILE&&jr.isUndefined(r.format))return function(e){hh(e,-2390,"Output setup error: Invalid format in outputSetup.")}(t),!1;if(!jr.isString(r.httpParams.url)||""==r.httpParams.url)return function(e){hh(e,-2388,"Output setup error: Invalid url in outputSetup.httpParams.")}(t),!1;if(!jr.isString(r.httpParams.fileName)||""==r.httpParams.fileName)return function(e){hh(e,-2389,"Output setup error: Invalid fileName in outputSetup.httpParams.")}(t),!1}return!0}},{key:"startScan",value:function(e){var r,t=this,n=e;if(t._resetErr(),!t._isValid())return!1;if(1==t._startScanFlag)return hh(r={},-2432,"Operation in progress, please try again when the current operation has finished."),Promise.reject({code:r._errorCode,message:r._errorString});t._startScanFlag=!0,jr.isObject(n)||(n={});var i,o,a,s=!1,u=!1,c=!0,l=!0,f=!0,d=!1,h=n.onFinally,g=[],m=[],p=0,_=1,y=[],S={type:"http",format:xn.EnumDWT_ImageType.IT_PDF,reTries:3,useUploader:!1,singlePost:!0,showProgressBar:!0,removeAfterOutput:!0,httpParams:{url:"",headers:{},formFields:{},remoteName:"RemoteFile",fileName:""}},I=jr.clone(n),b=n;if(a=I.funcScanStatus,delete I.funcScanStatus,jr.isFunction(a)?I.bfuncScanStatus=!0:I.bfuncScanStatus=!1,I.outputSetup){var C={pdfSetup:{},tiffSetup:{}};Dz(I.outputSetup,S),o=I.outputSetup,delete I.outputSetup,o.pdfSetup&&(o.format!=xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF&&o.format!=xn.EnumDWT_ImageType.IT_PDF||jr.mix(C.pdfSetup,o.pdfSetup)),o.tiffSetup&&(o.format!=xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&o.format!=xn.EnumDWT_ImageType.IT_TIF||jr.mix(C.tiffSetup,o.tiffSetup)),o.format!=xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF&&o.format!=xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF||(o.singlePost=!0),o.httpParams&&jr.isNumber(o.httpParams.threads)&&(_=o.httpParams.threads),s=jr.stringify(C),u=t.checkStartScanParams(I,o)}else(o=S).type="",u=t.checkStartScanParams(I,!1);if(!u)return new Promise(function(e,r){if(c){var n={code:t._errorCode,message:t._getErrorString(),response:""};t._startScanFlag=!1,r(n),c=!1}});o.funcHttpUploadStatus&&(d=o.funcHttpUploadStatus);var T,w,A,E,k,P,F=t.__remoteFilename,D=t.MaxUploadImageSize,x=t.IfShowProgressBar,O=t.__OnPostTransferAsync,N=t.__OnPostAllTransfers,R=t.__OnHttpUploadStatus,W=t.__insertingIndex,M=t.__IfAppendImage,L=t.httpFormFields,B=t._tiffCompressionType,U=!1,V=o.showProgressBar;if((T=function(e){var r=!0;jr.each(y,function(e,t){-1==e.st&&(r=!1)}),r?w(e):setTimeout(function(){T(e)},200)},w=function(e){e.__OnPostTransferAsync=O,e.__OnPostAllTransfers=N,e.__OnHttpUploadStatus=R,e.__remoteFilename=F,e.__maxUploadImageSize=D,e.IfShowProgressBar=x,e.__insertingIndex=W,e.__IfAppendImage=M,e.httpFormFields=L,e._tiffCompressionType=B,Dn.FileUploader&&(Dn.FileUploader.nextLoopTime=600),e._startScanFlag=!1},A=function(e,r,t){l?(e._startScanFlag=!1,r(t),T(e)):setTimeout(function(){A(e,r,t)},200)},E=function(e,r){U=!0,t._startScanFlag=!1,c&&(c=!1,l||t._innerSendCmd("CancelAllPendingTransfers"),A(t,e,r))},k=function(e,r,t,n){if(jr.isFunction(d)){var i,o=r,a=0;jr.isNumber(n)&&n>0&&(a=n),i={fileName:o,percentage:t,statusCode:a,responseString:e.__HTTPPostResponseString},setTimeout(function(){d(i)},10)}},t.__HTTPPostResponseString="",t.IfShowProgressBar=V,jr.isNumber(I.insertingIndex)&&I.insertingIndex>-1&&(t.__insertingIndex=I.insertingIndex,t.__IfAppendImage=!1),jr.isFunction(d)?t.__OnHttpUploadStatus=d:t.__OnHttpUploadStatus=!1,o.useUploader)&&!Dn.FileUploader)return new Promise(function(e,r){hh(t,-2380,"Please make sure the Uploader Module has been installed.");var n={code:t._errorCode,message:t._getErrorString(),response:""};l=!0,E(r,n)});if(i=o.reTries,o.useUploader){if(o.httpParams&&(P=o.httpParams.url),!jr.startsWith(P,"http://")&&!jr.startsWith(P,"https://")){var j=window.location.href,H=j.lastIndexOf("/");j=j.substring(0,H+1),o.httpParams.url=j+P}}else o.httpParams&&(jr.each(o.httpParams.headers,function(e,r){t.SetHTTPHeader(r,e)}),jr.each(o.httpParams.formFields,function(e,r){t.SetHTTPFormField(r,e)}));return o.httpParams&&""!==o.httpParams.remoteName&&(t.__remoteFilename=o.httpParams.remoteName),new Promise(function(e,r){o.useUploader?Dn.FileUploader.Init(0,function(r){e({uploadManager:r})},function(e,n){t._errorCode=e,t._errorString=n;var i={code:e,message:n,response:t.__HTTPPostResponseString};l=!0,E(r,i)}):e({})}).then(function(e){return new Promise(function(r,u){var c=function(){(I.transferMode==xn.EnumDWT_TransferMode.TWSX_FILE?p==m.length:p==g.length)?(On.closeProgress(null,"Scan Upload"),U=!0,r(b),w(t)):setTimeout(c,100)};a&&jr.isFunction(a)&&(t.__OnPreAllTransfersAsync=function(e){a(e)}),t.registerEvent("OnPostAllTransfers",function(){}),t.registerEvent("OnPostTransferAsync",function(r){var n,c,h,S,b,C,T=o.httpParams&&o.httpParams.url,w=t._uidFromServer2ServerId(r.imageId),A=o.singlePost,P=I.transferMode==xn.EnumDWT_TransferMode.TWSX_FILE,F=o.removeAfterOutput,D=0;if(f&&(l=!1,f=!1),P?(D=m.length,m.push(r.path)):(D=g.length,g.push(w)),a&&jr.isFunction(a)){var x={event:"postTransfer",bScanCompleted:!1,result:{outputInfo:r,currentPageNum:D+1}};setTimeout(function(){a(x)},10)}if(U)return!1;if("http"==o.type)if(o.httpParams&&(c=Ed(o.httpParams.fileName,D+1),h=Ed(o.httpParams.remoteName,D+1)),A||"http"!=o.type)!A&&o.type;else if(o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(t.__maxUploadImageSize=o.httpParams.maxSizeLimit),o.useUploader){V?(Dn.FileUploader.nextLoopTime=300,On.showProgress(t,"Scan Upload",t.__IfShowCancelDialogWhenImageTransfer)):On.hideProgress(),S=function(e,r){return t.__HTTPPostResponseString=r,k(t,e._fileName,100,200),t._OnPercentDone([0,100,"","http",e._fileName]),V&&On.closeProgress(null,"Scan Upload"),!P&&o.removeAfterOutput?setTimeout(function(){t._ImgManager.convertServerIdToClientIndex(w)>-1?v(Sz,t,Az).call(t,w,function(){p++},function(){p++}):p++},100):p++,!0};var O,N=e.uploadManager;if(b=function(){if(V){var e,r=0;for(r=P?m.length:g.length,e=0;e<r;e++)On.closeProgress(null,"Scan Upload")}!P&&o.removeAfterOutput&&setTimeout(function(){t._ImgManager.convertServerIdToClientIndex(w)>-1&&v(Sz,t,Az).call(t,w)},100),N.CancelAllUpload();var n={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return E(u,n),!1},C=function(e,r,n,i){var o=303;r==Pz.TRANS_SERVICE_ERROR_404?o=404:r==Pz.TRANS_SERVICE_ERROR_500?o=500:r==Pz.TRANS_SERVICE_ERROR_503&&(o=503),t._errorCode=r,t._errorString=n,t.__HTTPPostResponseString=i,k(t,c,100,o),b()},O=function(){t.__HTTPPostResponseString="",k(t,c,100,303),b()},P){var R=N.CreateJob(),W=R.FormField;o.httpParams&&(jr.each(o.httpParams.headers,function(e,r){R.HttpHeader[r]=e}),jr.each(o.httpParams.formFields,function(e,r){W.Add(r,e)})),R.ServerUrl=T,R.bDeleteFile=F,R.reTries=i,o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(R.maxSizeLimit=o.httpParams.maxSizeLimit),R._fileName=c,R.SourceValue.Add(r.path,c,h),R.ImageType=I.fileXfer.fileFormat,R.ThreadNum=_,R.OnRunSuccess=S,R.OnRunFailure=C,(V||jr.isFunction(d))&&(R.OnUploadTransferPercentage=function(e,r){r>0&&r<=100&&(t._OnPercentDone([0,r,"","http",e._fileName]),jr.isFunction(d)&&k(t,e._fileName,r,0))},On.cancelFrom=St.Scan,V&&v(Sz,t,Ez).call(t,b),t._OnPercentDone([0,-1,Sh,"http",c]),k(t,c,0,0)),N.Run(R)}else(n=o.format)==xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF?n=xn.EnumDWT_ImageType.IT_PDF:n==xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(n=xn.EnumDWT_ImageType.IT_TIF),On.cancelFrom=St.Scan,V&&v(Sz,t,Ez).call(t,b),t._OnPercentDone([0,-1,mh,"http",c]),t._asyncGenerateURLForUploadData([w],n,s,function(e){var r=N.CreateJob(),a=r.FormField;o.httpParams&&(jr.each(o.httpParams.headers,function(e,t){r.HttpHeader[t]=e}),jr.each(o.httpParams.formFields,function(e,r){a.Add(r,e)})),r.ServerUrl=T,r.bDeleteFile=F,r.reTries=i,o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(r.maxSizeLimit=o.httpParams.maxSizeLimit),r._fileName=c,r.SourceValue.Add(e,c,h),r.ImageType=n,r.ThreadNum=_,r.OnRunSuccess=S,r.OnRunFailure=C,(V||jr.isFunction(d))&&(r.OnUploadTransferPercentage=function(e,r){r>0&&r<=100&&(t._OnPercentDone([0,r,"","http",e._fileName]),jr.isFunction(d)&&k(t,e._fileName,r,0))},t._OnPercentDone([0,-1,Sh,"http",c]),k(t,c,0,0)),N.Run(r)},O)}else{var M={id:w,st:-1,bCancel:!1};if(y.push(M),0==D&&(V?On.showProgress(t,"Scan Upload",t.__IfShowCancelDialogWhenImageTransfer):On.hideProgress()),P)S=function(e){return M.st=0,!P&&o.removeAfterOutput?setTimeout(function(){t._ImgManager.convertServerIdToClientIndex(w)>-1?v(Sz,t,Az).call(t,w,function(){p++},function(){p++}):p++},100):p++,!0},b=function(){!P&&o.removeAfterOutput&&setTimeout(function(){t._ImgManager.convertServerIdToClientIndex(w)>-1&&v(Sz,t,Az).call(t,w)},100);var e={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return On.closeProgress(null,"Scan Upload"),2==M.st||(M.st=1,jr.each(y,function(e,r){-1==e.st&&(e.bCancel=!0)}),E(u,e)),!1},t._innerUploadDirectly(T,r.path,c,V,F,i,!1,M,S,b);else{if(S=function(e,r){return M.st=0,!P&&o.removeAfterOutput?setTimeout(function(){t._ImgManager.convertServerIdToClientIndex(w)>-1?v(Sz,t,Az).call(t,w,function(){p++},function(){p++}):p++},100):p++,!0},b=function(e){!P&&o.removeAfterOutput&&setTimeout(function(){t._ImgManager.convertServerIdToClientIndex(w)>-1&&v(Sz,t,Az).call(t,w)},100);var r={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return On.closeProgress(null,"Scan Upload"),2==M.st||(M.st=1,jr.each(y,function(e,r){-1==e.st&&(e.bCancel=!0)}),E(u,r)),!1},n=o.format,jr.isUndefined(n)){var L=t._ImgManager.convertServerIdToClientIndex(w);return mg(t),b([L]),!1}n==xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF?n=xn.EnumDWT_ImageType.IT_PDF:n==xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(n=xn.EnumDWT_ImageType.IT_TIF);var B={method:"startScan",url:T,serverIds:[w],headers:t._GetHttpHeadersAndClear(),formData:uG(t.httpFormFields),enumImageType:n,saveSetup:s,fileName:c,dataFormat:mt.Binary,retry:i,bOnlyResponseEmptyIsOK:!1,objUploadFileStatus:M,asyncSuccessFunc:S,asyncFailureFunc:b};t._asyncUploadCmd(B)}}});var S=function(){var f,y,S=-1,C=mt.Binary,T=o.httpParams.url,A=o.singlePost,P=I.transferMode==xn.EnumDWT_TransferMode.TWSX_FILE,F=o.removeAfterOutput;a&&jr.isFunction(a)&&(S=P?m.length:g.length,y={event:"postTransfer",bScanCompleted:!0,result:{currentPageNum:S}},setTimeout(function(){a(y)},10));if(0==S)return function(e){hh(e,-1029,"Source has nothing to capture.")}(t),void setTimeout(function(){l=!0,h&&jr.isFunction(h)&&h();var e={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};E(u,e)},1e3);if(S>0&&(t._errorCode==it.SourceHasNothingToCapture||t._errorCode==it.UserCancelled))if(t._errorCode==it.SourceHasNothingToCapture)t._errorCode=0;else{var D=n.scanner;t._errorCode==it.UserCancelled&&D&&D._deviceType==Gt.WIATWAINSCANNER&&(t._errorCode=0)}else if(0!=t._errorCode){l=!0,h&&jr.isFunction(h)&&h();var x={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return void E(u,x)}if("http"==o.type){if(A&&"http"==o.type){var O,N,R,W=g;if(o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(t.__maxUploadImageSize=o.httpParams.maxSizeLimit),o.useUploader){var M,L=e.uploadManager,B=L.CreateJob(),j=B.FormField;if(V?(Dn.FileUploader.nextLoopTime=300,On.showProgress(t,"Scan Upload",t.__IfShowCancelDialogWhenImageTransfer)):On.hideProgress(),O=function(e,n){var i=e._fileName;return i||(i=""),t._bServerPercentDone=!0,t.__HTTPPostResponseString=n,k(t,i,100,200),t._OnPercentDone([0,100,"","http"]),V&&On.closeProgress(null,"Scan Upload"),!P&&o.removeAfterOutput?setTimeout(function(){p=0,jr.each(W,function(e){t._ImgManager.convertServerIdToClientIndex(e)>-1?v(Sz,t,Az).call(t,e,function(){p++},function(){p++}):p++}),setTimeout(c,100)},100):(U=!0,r(b),w(t)),!0},N=function(){V&&On.closeProgress(null,"Scan Upload"),L.CancelAllUpload(),t._bServerPercentDone=!0;var e={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return E(u,e),!P&&o.removeAfterOutput&&setTimeout(function(){jr.each(W,function(e){t._ImgManager.convertServerIdToClientIndex(e)>-1&&v(Sz,t,Az).call(t,e)})},100),!1},R=function(e,r,n,i){var o=303;r==Pz.TRANS_SERVICE_ERROR_404?o=404:r==Pz.TRANS_SERVICE_ERROR_500?o=500:r==Pz.TRANS_SERVICE_ERROR_503&&(o=503),t._errorCode=r,t._errorString=n,t.__HTTPPostResponseString=i,k(t,"",100,o),N()},M=function(){t.__HTTPPostResponseString="",k(t,"",100,303),N()},V&&(On.cancelFrom=St.Scan,v(Sz,t,Ez).call(t,N)),P)o.httpParams&&(jr.each(o.httpParams.headers,function(e,r){B.HttpHeader[r]=e}),jr.each(o.httpParams.formFields,function(e,r){j.Add(r,e)})),B.ServerUrl=T,B.bDeleteFile=F,B.reTries=i,o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(B.maxSizeLimit=o.httpParams.maxSizeLimit),jr.each(m,function(e,r){var t,n;o.httpParams&&(t=Ed(o.httpParams.fileName,r+1),n=Ed(o.httpParams.remoteName,r+1)),B.SourceValue.Add(e,t,n)}),B.ImageType=I.fileXfer.fileFormat,B.ThreadNum=_,B.OnRunSuccess=O,B.OnRunFailure=R,(V||jr.isFunction(d))&&(B.OnUploadTransferPercentage=function(e,r){r>0&&r<=100&&(t._OnPercentDone([0,r,"","http"]),jr.isFunction(d)&&k(t,"",r,0))},t._OnPercentDone([0,-1,Sh,"http"]),k(t,"",0,0)),L.Run(B);else if((f=o.format)==xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF||f==xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF)f==xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF?f=xn.EnumDWT_ImageType.IT_PDF:f==xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(f=xn.EnumDWT_ImageType.IT_TIF),t._OnPercentDone([0,-1,mh,"http"]),t._asyncGenerateURLForUploadData(W,f,s,function(e){var r,n;o.httpParams&&(jr.each(o.httpParams.headers,function(e,r){B.HttpHeader[r]=e}),jr.each(o.httpParams.formFields,function(e,r){j.Add(r,e)})),B.ServerUrl=T,B.bDeleteFile=F,B.reTries=i,o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(B.maxSizeLimit=o.httpParams.maxSizeLimit),o.httpParams&&(r=Ed(o.httpParams.fileName,1),n=Ed(o.httpParams.remoteName,1)),B._fileName=r,B.SourceValue.Add(e,r,n),B.ImageType=f,B.ThreadNum=_,B.OnRunSuccess=O,B.OnRunFailure=R,(V||jr.isFunction(d))&&(B.OnUploadTransferPercentage=function(e,n){n>0&&n<=100&&(t._OnPercentDone([0,n,"","http",r]),jr.isFunction(d)&&k(t,r,n,0))},t._OnPercentDone([0,-1,Sh,"http",r])),L.Run(B)},M);else{var H=W.length,G=0,z=0,K="";V&&(t._bServerPercentDone=!1),t._OnPercentDone([0,-1,mh,"http"]),jr.each(W,function(e,r){var n,a;o.httpParams&&(n=Ed(o.httpParams.fileName,r+1),a=Ed(o.httpParams.remoteName,r+1)),t._asyncGenerateURLForUploadData([e],f,s,function(e){z=(G+1)/H*100,K=[G+1,"/",H].join(""),t._OnPercentDone([0,z,K,"http"]),B.SourceValue.Add(e,n,a),++G>=H&&(V&&(t._bServerPercentDone=!0),o.httpParams&&(jr.each(o.httpParams.headers,function(e,r){B.HttpHeader[r]=e}),jr.each(o.httpParams.formFields,function(e,r){j.Add(r,e)})),B.ServerUrl=T,B.bDeleteFile=F,B.reTries=i,o.httpParams&&jr.isNumber(o.httpParams.maxSizeLimit)&&(B.maxSizeLimit=o.httpParams.maxSizeLimit),B.ImageType=f,B.ThreadNum=_,B.OnRunSuccess=O,B.OnRunFailure=R,(V||jr.isFunction(d))&&(B.OnUploadTransferPercentage=function(e,r){r>0&&r<=100&&(t._OnPercentDone([0,r,"","http"]),jr.isFunction(d)&&k(t,"",r,0))},t._OnPercentDone([0,-1,Sh,"http"])),L.Run(B))},M)})}}else if(P)O=function(e){return t._bServerPercentDone=!0,!P&&o.removeAfterOutput?setTimeout(function(){p=0,jr.each(W,function(e){t._ImgManager.convertServerIdToClientIndex(e)>-1?v(Sz,t,Az).call(t,e,function(){p++},function(){p++}):p++}),setTimeout(c,100)},100):(U=!0,r(b),w(t)),!0},N=function(e){t._bServerPercentDone=!0;var r={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return E(u,r),!P&&o.removeAfterOutput&&setTimeout(function(){jr.each(W,function(e){t._ImgManager.convertServerIdToClientIndex(e)>-1&&v(Sz,t,Az).call(t,e)})},100),!1},t._innerUploadFilesDirectly(T,m,o.httpParams&&o.httpParams.fileName,V,F,i,!1,O,N);else{O=function(e,n){return t._bServerPercentDone=!0,!P&&o.removeAfterOutput?setTimeout(function(){p=0,jr.each(W,function(e){t._ImgManager.convertServerIdToClientIndex(e)>-1?v(Sz,t,Az).call(t,e,function(){p++},function(){p++}):p++}),setTimeout(c,100)},100):(U=!0,r(b),w(t)),!0},N=function(e){t._bServerPercentDone=!0;var r={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};return E(u,r),!P&&o.removeAfterOutput&&setTimeout(function(){jr.each(W,function(e){t._ImgManager.convertServerIdToClientIndex(e)>-1&&v(Sz,t,Az).call(t,e)})},100),!1},f=o.format;var J=t._GetHttpHeadersAndClear(),Q=uG(t.httpFormFields);if(f==xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF||f==xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF){var q;f==xn.EnumDWT_ImageType.IT_MULTIPAGE_PDF?f=xn.EnumDWT_ImageType.IT_PDF:f==xn.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(f=xn.EnumDWT_ImageType.IT_TIF),o.httpParams&&(q=Ed(o.httpParams.fileName,1),Ed(o.httpParams.remoteName,1));var Y={method:"startScan",url:T,headers:J,formData:Q,serverIds:W,enumImageType:f,saveSetup:s,fileName:q,dataFormat:C,retry:i,bOnlyResponseEmptyIsOK:!1,objUploadFileStatus:undefined,asyncSuccessFunc:O,asyncFailureFunc:N};t._asyncUploadCmd(Y)}else W.length>0&&t._asyncUploadFilesCmd(T,W,J,Q,f,o.httpParams&&o.httpParams.fileName,s,V,i,!1,O,N)}}A&&o.type}l=!0,h&&jr.isFunction(h)&&h()},C=function(){if(t._startScanFlag=!1,S(),"http"!=o.type)return U=!0,r(b),void w(t);o.singlePost?setTimeout(function(){if(!l&&t._startScanFlag)return U=!0,r(b),void w(t)},300):setTimeout(c,100)};v(Sz,t,wz).call(t,I,C,function(e){if(t._errorCode==it.SourceHasNothingToCapture||t._errorCode==it.UserCancelled){if(I.transferMode==xn.EnumDWT_TransferMode.TWSX_FILE?m.length>0:g.length>0)return t._errorCode=0,C()}if(a&&jr.isFunction(a)){var r={event:"postTransfer",bScanCompleted:!0,result:{currentPageNum:I.transferMode==xn.EnumDWT_TransferMode.TWSX_FILE?m.length:g.length}};setTimeout(function(){a(r)},10)}var n={code:t._errorCode,message:t._getErrorString(),response:t.__HTTPPostResponseString};E(u,n)})})})}},{key:"_innerInitEvents",value:function(e){this.__OnWSReconnect=e.onWSReconnect||null,this.__OnWSClose=e.onWSClose||null,this.__OnWSMessage=e.onWSMessage||null,this.__OnWSError=e.onWSError||null,this.__OnPercentDone=e.onPercentDone||"",this.__OnPrintMsg=e.onPrintMsg||"",this.__OnResult=e.onResult||"",this.__OnAfterOperate=e.onAfterOperate||"",this.__OnBeforeOperate=e.onBeforeOperate||"",this.__OnOperateStatus=e.onOperateStatus||"",this.__OnBitmapChanged=e.onBitmapChanged||"",this.__OnGetFilePath=e.onGetFilePath||"",this.__OnPreAllTransfers=e.onPreAllTransfers||"",this.__OnPreTransfer=e.onPreTransfer||"",this.__OnPostLoad=e.onPostLoad||"",this.__OnPostTransfer=e.onPostTransfer||"",this.__OnPostAllTransfers=e.onPostAllTransfers||"",this.__OnSourceUIClose=e.onSourceUIClose||"",this.__OnTransferCancelled=e.onTransferCancelled||"",this.__OnTransferError=e.onTransferError||"",this.__OnInternetTransferPercentage=e.onInternetTransferPercentage||"",this.__OnInternetTransferPercentageEx=e.onInternetTransferPercentageEx||"",this.__OnRemoteScanStatusAsync=e.onRemoteScanStatusAsync||""}}],[{key:"create",value:(n=p(d().m(function h(e){var t;return d().w(function(n){for(;;)switch(n.n){case 0:return t=new r(e),n.n=1,dp.STwainConnectToServer(t);case 1:return n.a(2,t)}},h)})),function(e){return n.apply(this,arguments)})}]);var n,i,o,a}(lz);function bz(){var e,r=[],t=this.__devices.length;for(e=0;e<t;e++){var n=this.__devices[e],i=n.deviceType,o=kz(),a=void 0,s=jr.clone(n.deviceInfo);Wp(i)?(i==Gt.TWAINSCANNER?a="TWAIN":i==Gt.WIATWAINSCANNER?a="WIATWAIN":i==Gt.TWAINX64SCANNER&&(a="TWAIN64"),o.Manufacturer=s.Manufacturer,o.ProductFamily=s.ProductFamily,o.ProtocolMajor=s.ProtocolMajor,o.ProtocolMinor=s.ProtocolMinor,o.SupportedGroups=s.SupportedGroups,o.Version=s.Version):i==Gt.SANESCANNER?(a="SANE",o.DeviceInfo=s):i==Gt.ICASCANNER?(a="ICA",o.DeviceInfo=s):i==Gt.ESCLSCANNER?(a="eSCL",o.DeviceInfo=s):i==Gt.WIFIDIRECTSCANNER?(a="WiFiScanner",o.DeviceInfo=s):i==Gt.WIASCANNER&&(a="WIA",o.DeviceInfo=s),o.ProductName=n.displayName,o.DriverType=a,r.push(o)}return r}function Cz(){var e,r=this,t=[],n=0;for(r.__devices&&(n=r.__devices.length),e=0;e<n;e++){var i=r.__devices[e];t.push(i.displayName)}return t}function Tz(e,r){var t=["[",e,",",null!=r?r:$t.SMF_NAME,"]"].join("");return this._innerFun("SelectSourceEx",t)}function wz(e,r,t){var n,i,o=this,a=null,s=null;if(i=jr.isUndefined(e)||null==e?{}:e,o._resetErr(),!o._isValid())return!1;if(jr.isFunction(r)&&(a=function(){r(i)}),jr.isFunction(t)&&(s=function(e,r){t(e,r,i)}),!jv.checkProductKey(o,{Core:!0}))return jr.isFunction(s)&&s(o._errorCode,o._errorString),!1;for(var u=0,c=0;c<bp.length;c++){var l=["__",bp[c]].join("");jr.isFunction(o[l])&&(u|=1<<c)}if(i.EnableEvents=u,i.scanner){var f=i.scanner;jr.isString(f)||jr.isString(f.strDevice)&&(i.device=f.strDevice,delete i.scanner)}return n=["[",jr.stringify(i),"]"].join(""),o.__bAcquireImageNow=!0,o.__innerAcquireOrLoadImageAsync("StartScan",n,!1,!0).then(a,function(e){o._errorCode=e.code,o._errorString=e.message,jr.isFunction(s)&&s(e.code,e.message)}),!0}function Az(e,r,t){var n=this;return n._innerFunRaw("RemoveImage",hm(e),!0,!1,!0,function(){n._OnBitmapChanged(["c1",""+e,3,n._ImgManager.getCurrentImageIndex(),n._ImgManager.count()]),jr.isFunction(r)&&r()},t)}function Ez(e){var r=this;r.IfShowCancelDialogWhenImageTransfer?(On.progressContext&&On.progressContext.on("cancel",function(){zo(r),e()}),Fd(!0)):Fd(!1)}function kz(){return{ProductName:"",DeviceInfo:{},DriverType:"",IsCurrentSource:!1,IsDefaultSource:!1,Manufacturer:"",ProductFamily:"",ProtocolMajor:0,ProtocolMinor:0,SupportedGroups:0,Version:{Country:0,Info:"",Language:0,MajorNum:0,MinorNum:0}}}var Pz={TRANS_SERVICE_ERROR_404:12,TRANS_SERVICE_ERROR_500:13,TRANS_SERVICE_ERROR_503:14};function Fz(e){return"__proto__"===e||"prototype"===e||"constructor"===e}var Dz=function(e,r){if(!jr.isUndefined(e)&&!jr.isUndefined(r)&&null!=e&&null!=r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&!Fz(t)&&(Object.prototype.hasOwnProperty.call(e,t)?"object"===C(e[t])&&Dz(e[t],r[t]):e[t]=r[t]);return e}};function xz(e){return Oz.apply(this,arguments)}function Oz(){return Oz=p(d().m(function e(r){var t,n,i,o;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=window,xn.UseDefaultViewer||(r.container=null),rm(r.container)?r.bNoViewer=!1:r.bNoViewer=!0,e.p=1,e.n=2,Iz.create(r);case 2:n=e.v,e.n=4;break;case 3:throw e.p=3,o=e.v,(i=o&&o.code)==it.ResponseDataTypeError||i==it.HTSTError||i==it.CORSError||i==it.CORSErrorFromService||i==it.SSLCertExpired||i==it.SSLCertInvalid||(i==it.MustUpgrade?Nc(!0):i==it.ModuleNotExists&&Mz(n)),n&&n.dispose(),o;case 4:return e.p=4,t.DCP_DWT_OnClickCloseInstall&&t.DCP_DWT_OnClickCloseInstall(!1,!0),e.f(4);case 5:return Rz(n),e.a(2,n)}},e,null,[[1,3,4,5]])})),Oz.apply(this,arguments)}function Nz(e,r,t,n,i){if(jr.isFunction(Dn.OnWebTwainNeedUpgradeCallback)){var o,a,s={};if(a=xc.getDSPath(),se.bWin)o=rt.enumWindow;else if(Dn.navInfo.bEmbed||se.bAndroid||se.bChromeOS||se.bHarmonyOS||se.biPhone||se.biPad)se.bAndroid?o=rt.enumAndroid:(s.deb=a,o=se.biPhone||se.biPad?rt.enumiOS:se.bChromeOS?rt.enumChromeOS:se.bHarmonyOS?rt.enumHarmonyOS:rt.enumEmbed);else if(se.bLinux){var u=xc.getLinuxHTML5DebPath(),c=xc.getLinuxHTML5RpmPath();a=u,s.deb=u,s.rpm=c,o=rt.enumLinux}else o=rt.enumMac;s["default"]=a;var l=Cs.one(".dynamsoft-dialog-license");l&&l.getEL()&&(l.getEL().style.display="none"),On.detect.needUpgrade=!0,Dn.OnWebTwainNeedUpgradeCallback(On.product.name,s,xc.bHTML5Edition,o,se.bIE,se.bSafari,Js(),se.IEVersion,r,t)}}function Rz(e){return Wz.apply(this,arguments)}function Wz(){return(Wz=p(d().m(function e(r){var t,n,i,o,a;return d().w(function(e){for(;;)switch(e.n){case 0:if(r&&!r._blts){e.n=1;break}return e.a(2);case 1:if(-2207==r.ErrorCode&&(On.detect.bPromptJSOrServerOutdated=!0,jr.isFunction(xn.OnWebTwainNeedUpgradeWebJavascript)&&xn.OnWebTwainNeedUpgradeWebJavascript(r.ErrorString)),!xc.versionInfoFromServer){e.n=2;break}t=xc.versionInfoFromServer,e.n=4;break;case 2:return e.n=3,r._getVersionInfoAsync();case 3:t=e.v;case 4:if(n=GG(t),On.detect.bNeedUpgradeEvent||!1!==n.isLatest&&!1!==n.compatible){e.n=7;break}if(On.detect.bNeedUpgradeEvent=!0,i=[Vd,jd,Hd,Gd].join("."),!1===n.isLatest?"upgrade":"incompatible",!jr.isFunction(xn.OnWebTwainNeedUpgradeService)){e.n=5;break}if(!xn.OnWebTwainNeedUpgradeService(t,i)){e.n=5;break}return e.a(2);case 5:if(!r._bRemoteMode){e.n=6;break}return o=r._serverInfo.port,jr.isFunction(Dn.OnRemoteWebTwainNeedUpgradeCallback)&&Dn.OnRemoteWebTwainNeedUpgradeCallback(On.product.name,r._serverInfo.server,o,r._serverInfo.ssl),e.a(2);case 6:(xc.bHTML5Edition&&r._isBindViewer()||!xc.bHTML5Edition)&&((a=r._containerElement)&&(Cs.one(a).before(On.install._strNonInstallDIV),jr.show(On.install._divDWTNonInstallContainerID)),""!=On.install._divDWTemessageContainer&&jr.hide(On.install._divDWTemessageContainer),Nz(0,t,i));case 7:return e.a(2)}},e)}))).apply(this,arguments)}function Mz(e){if(!On.detect.bNoControlEvent){var r,t=0,n=0;e&&(t=e._width,n=e._height,r=e._containerElement),e&&e._bRemoteMode?e._bNotShowMessage||jr.isFunction(Dn.OnRemoteWebTwainNotFoundCallback)&&Dn.OnRemoteWebTwainNotFoundCallback(On.product.name,e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,Gu.bMobile):(Oc(r,t,n),Nc(!1)),On.detect.bNoControlEvent=!0}}new Dc(function(){return On.product.loadingResourcePath});var Lz=function(e){function r(e){var t;_(this,r),(t=s(this,r,[e]))._bServerPercentDone=!0,t._bScanForProxyRemote=!0,t._controlWidth=0,t._controlHeight=0;var n=dp.getServerImageUrlPrefix(t);return PH._setBaseUrl(t._imageBufferWrapper,n),t}return l(r,e),S(r,[{key:"getDevices",value:function(e,r,t,n){return this._getDevices(e,r,t,n)}},{key:"_connnect",value:(v=p(d().m(function m(){var e;return d().w(function(r){for(;;)if(0===r.n)return e=this,r.a(2,new Promise(function(r,t){Fl(e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,void 0,function(t,n,i){e._strRemoteServiceVer=i,r()},t)}))},m,this)})),function(){return v.apply(this,arguments)})},{key:"acquireImage",value:function(e,n){return t(r,"_acquireImage",this,3)([e,n])}},{key:"_acquireImageForSendTo",value:function(e,n,i,o){return t(r,"_acquireImageForSendTo",this,3)([e,n,i,o])}},{key:"getCapabilities",value:function(e,r,t){return this._getCapabilities(e,r,t)}},{key:"setCapabilities",value:function(e,r,t){return this._setCapabilities(e,r,t)}},{key:"closeSource",value:function(){return this._closeSource()}},{key:"setBufferMemoryLimit",value:(g=p(d().m(function y(e){var r,t;return d().w(function(n){for(;;)switch(n.n){case 0:if(r=this,jr.isNumber(e)&&!isNaN(e)){n.n=1;break}throw Uh(r),{code:r._errorCode,message:r._errorString};case 1:if(r._resetErr(),r._isValid()){n.n=2;break}throw{code:r._errorCode,message:r._errorString};case 2:return n.n=3,r._innerFunV2("BufferMemoryLimit",hm(e));case 3:return t=n.v,n.a(2,t)}},y,this)})),function(e){return g.apply(this,arguments)})},{key:"setIfAllowLocalCache",value:(h=p(d().m(function I(e){var r,t;return d().w(function(n){for(;;)switch(n.n){case 0:if(r=this,jr.isBoolean(e)){n.n=1;break}throw Uh(self),{code:r._errorCode,message:r._errorString};case 1:if(r._resetErr(),r._isValid()){n.n=2;break}throw{code:r._errorCode,message:r._errorString};case 2:return n.n=3,r._innerFunV2("IfAllowLocalCache",hm(e));case 3:return t=n.v,n.a(2,t)}},I,this)})),function(e){return h.apply(this,arguments)})},{key:"howManyImagesInBuffer",get:function(){return this._imageBufferWrapper.count()}},{key:"currentImageIndexInBuffer",get:function(){return this._imageBufferWrapper.getCurrentImageIndex()},set:function(e){this._imageBufferWrapper.setCurrentImageIndex(e)}},{key:"saveImages",value:(f=p(d().m(function b(e,r,t,n){var i;return d().w(function(o){for(;;)switch(o.n){case 0:if(i="saveImages",this._checkIndices(r)){o.n=1;break}throw{code:this._errorCode,message:this._getErrorString()};case 1:return this._containerElement=n,o.n=2,this._saveImages(i,e,r,t);case 2:return o.a(2)}},b,this)})),function(e,r,t,n){return f.apply(this,arguments)})},{key:"getImages",value:function(e,r,t,n){if(!this._checkIndices(e))throw{code:this._errorCode,message:this._getErrorString()};return this._containerElement=n,this._getImages("getImages",e,r,t)}},{key:"removeImages",value:(c=p(d().m(function C(e){var r,t,n,i,o;return d().w(function(a){for(;;)switch(a.n){case 0:if(this._checkIndices(e)){a.n=1;break}throw{code:this._errorCode,message:this._getErrorString()};case 1:for(r=e.sort(function(e,r){return r-e}),t=[],n=0;n<r.length;n++)i=r[n],(o=this._imageBufferWrapper.convertClientIndexToServerId(i))>0&&t.push(o);if(0!=t.length){a.n=2;break}return a.a(2);case 2:return a.n=3,this._innerFunV2("RemoveAllImages",hm(t.join(",")));case 3:if(!a.v&&-1033!=this._errorCode){a.n=5;break}if(this._imageBufferWrapper.removeImages(r)){a.n=4;break}throw this._imageBufferWrapper.getError();case 4:a.n=6;break;case 5:throw{code:this._errorCode,message:this._errorString};case 6:return a.a(2)}},C,this)})),function(e){return c.apply(this,arguments)})},{key:"updateImage",value:function(e,n,i){var o=this._imageBufferWrapper.getIndexByUid(e),a=this._imageBufferWrapper.convertClientIndexToServerId(o);return t(r,"_updateImage",this,3)([a,n,i])}},{key:"getSkewAngleFromBinaryAsync",value:function(e,r,t,n){var i=this;if(i._resetErr(),!i._isValid())return Promise.reject({code:i._errorCode,message:i._errorString});var o=this._imageBufferWrapper.getCustomDataByIndex(e),a=this._imageBufferWrapper.getMetadataByIndex(e),s=this._imageBufferWrapper.convertClientIndexToServerId(e),u={imageId:s,serverId:s,bufferLen:r.size,imageType:ut.IT_BMP,width:a.width,height:a.height,bit:a.bitDepth,xres:a.resolutionX,yres:a.resolutionY,uidFromServer:o.uidFromServer},c=jr.stringify([jr.stringify(u)]);return this._innerSendBlob("GetSkewAngleFromBinary",c,r,!0,!0,t,n)}},{key:"httpUpload",value:(u=p(d().m(function T(e,t,n,i,o,a,s){var u,c;return d().w(function(l){for(;;)switch(l.n){case 0:if((u=this)._resetErr(),u._isValid()){l.n=1;break}throw{code:u._errorCode,message:u._errorString};case 1:if(!jr.isUndefined(e)&&""!==e){l.n=2;break}throw rg(u),{code:u._errorCode,message:u._errorString};case 2:if(jr.isString(e)){l.n=3;break}throw _g(u),{code:u._errorCode,message:u._errorString};case 3:if(u._checkIndices(t)){l.n=4;break}throw{code:u._errorCode,message:u._errorString};case 4:if(0!=(c=Lp(u,t)).length){l.n=5;break}throw Bh(u),{code:u._errorCode,message:u._errorString};case 5:if(!jr.isUndefined(n)){l.n=6;break}throw mg(u),{code:u._errorCode,message:u._errorString};case 6:if(n!=ut.IT_BMP&&n!=ut.IT_JPG&&n!=ut.IT_PNG){l.n=8;break}if(!(c.length>1)){l.n=7;break}throw lg(u),{code:u._errorCode,message:u._errorString};case 7:l.n=10;break;case 8:if(n!=ut.IT_TIF&&n!=ut.IT_PDF){l.n=9;break}l.n=10;break;case 9:throw mg(u),{code:u._errorCode,message:u._errorString};case 10:if(!(jr.isUndefined(i)||i!=mt.Binary&&i!=mt.Base64)){l.n=11;break}throw pg(u),{code:u._errorCode,message:u._errorString};case 11:return l.n=12,new Promise(function(t,l){var f,d,h=parseInt(n),g=parseInt(i);null!=a&&a.formFields&&(f=new FormData,jr.each(null==a?void 0:a.formFields,function(e,r){var t=e.name,n=e.value;jr.isString(t)&&(n instanceof Blob?f.append(t,n,e.fileName):f.append(t,n))})),null!=a&&a.headers&&(d={},jr.each(null==a?void 0:a.headers,function(e,r){jr.isString(e.name)&&(d[e.name]=e.value)})),u._containerElement=s,r._innerHTTPUpload(u,"httpUpload",e,null==a?void 0:a.responseType,d,f,c,h,g,o,void 0,0,!1,void 0,function(e){if(jr.isFunction(t)){var r=[];jr.isArray(c)&&jr.each(c,function(e){var t=u._imageBufferWrapper.convertServerIdToClientIndex(e);t>-1&&r.push(t)});try{us.runWithCatch(t,e,r)}catch(n){}}return e=null,!0},function(e){if(jr.isFunction(l))try{l(e)}catch(r){}return!1})});case 12:return l.a(2,l.v)}},T,this)})),function(e,r,t,n,i,o,a){return u.apply(this,arguments)})},{key:"getCustomDataByIndex",value:function(e){return this._imageBufferWrapper.getCustomDataByIndex(e)}},{key:"getIndexByUid",value:function(e){return this._imageBufferWrapper.getIndexByUid(e)}},{key:"getProfile",value:function(e){return t(r,"_getProfile",this,3)([e])}},{key:"setProfile",value:function(e,n){return t(r,"_setProfile",this,3)([e,n])}},{key:"imageIDToIndex",value:function(e){return this._uidFromServer2index(e)}},{key:"indexToImageID",value:function(e){return this._index2uidFromServer(e)}},{key:"rotate",value:function(e,r,t,n){var i=this;if(i._resetErr(),!i._isValid())return Promise.reject({code:i._errorCode,message:i._errorString});var o=parseInt(e);if(isNaN(o))return Bh(i),Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i.howManyImagesInBuffer)return gg(i),Promise.reject({code:i._errorCode,message:i._errorString});var a=i._imageBufferWrapper.convertClientIndexToServerId(o);return-1==a?(gg(i),Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("RotateEx",hm(a,r,t,n),!0).then(function(e){})}},{key:"crop",value:function(e,r){var t=this;if(t._resetErr(),!t._isValid())return Promise.reject({code:t._errorCode,message:t._errorString});var n=parseInt(e);if(isNaN(n))return Bh(t),Promise.reject({code:t._errorCode,message:t._errorString});if(n<0||n>=t.howManyImagesInBuffer)return gg(t),Promise.reject({code:t._errorCode,message:t._errorString});var i=t._imageBufferWrapper.convertClientIndexToServerId(n);if(-1==i)return gg(t),Promise.reject({code:t._errorCode,message:t._errorString});var o=r.x,a=r.y,s=r.x+r.width,u=r.y+r.height;return t._innerFunV2("Crop",hm(i,o,a,s,u),!0).then(function(e){})}},{key:"_createHttpUploaderConfig",value:function(){var e=this,r=new Od;return r.IfShowProgressBar=e.IfShowProgressBar,r.IfShowCancelDialogWhenImageTransfer=e.IfShowCancelDialogWhenImageTransfer,r.MaxUploadImageSize=e.MaxUploadImageSize,r.HTTPRequestswithCredentials=e.HTTPRequestswithCredentials,r.onPercent=function(r){e._OnPercentDone(r)},r.onHttpUploadStatus=function(e){},r}},{key:"_OnReady",value:(a=p(d().m(function w(){var e,n,i,o;return d().w(function(a){for(;;)switch(a.p=a.n){case 0:return oc((e=this)._serverInfo.server)&&(nc.item("DWT_port",e._serverInfo.port),nc.item("DWT_ssl",e._serverInfo.ssl?"true":"false")),e._bNoMask||zl("OnReady",e),a.p=1,a.n=2,t(r,"_OnReady",this,3)([]);case 2:return a.n=3,e._innerActiveUI(e._uuidForActiveUI);case 3:return n=a.v,a.n=4,e._OnActiveUI(n);case 4:(i=e._id)&&!xn.WebTwainIdMap[i]&&(xn.WebTwainIdMap[i]=e),a.n=6;break;case 5:throw a.p=5,(o=a.v)&&(e._errorCode=o.code,e._errorString=o.message),e.dispose(),o;case 6:return a.p=6,e._bNoMask||Kl("OnReady"),a.f(6);case 7:return a.a(2)}},w,this,[[1,5,6,7]])})),function(){return a.apply(this,arguments)})},{key:"_isBindViewer",value:function(){return this._bBindViewer}},{key:"_isNoViewer",value:function(){return!this._isBindViewer()}},{key:"getServiceInfo",value:function(){return t(r,"getServiceInfo",this,3)([])}},{key:"setViewerInfo",value:function(e){this._bBindViewer=e}},{key:"setViewerControlInfo",value:function(e){this._controlWidth=e.width,this._controlHeight=e.height}},{key:"getViewerControlInfo",value:function(){return{width:this._controlWidth,height:this._controlHeight}}}],[{key:"create",value:(o=p(d().m(function A(e){var t;return d().w(function(n){for(;;)switch(n.n){case 0:return t=new r(e),n.n=1,dp.STwainConnectToServer(t);case 1:return n.a(2,t)}},A)})),function(e){return o.apply(this,arguments)})},{key:"_getBuffer",value:function(e){return PH._getBuffer(e._imageBufferWrapper)}},{key:"_setError",value:function(e,r,t){e._errorCode=r,e._errorString=t}},{key:"createByServiceInfo",value:(i=p(d().m(function E(e,t,n){var i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:return o={id:jr.guid(),dmService:t,bNoViewer:!0,bNoMask:null==t||null===(i=t.attrs)||void 0===i?void 0:i.bNoMask,bNotShowMessage:!0},(a=new r(o))._uuidForActiveUI=e,a._bLicenseErrorDispose=!1,n&&(a._containerElement=n),s.n=1,a._connnect();case 1:return s.n=2,dp.STwainConnectToServer(a);case 2:return s.a(2,a)}},E)})),function(e,r,t){return i.apply(this,arguments)})},{key:"checkOnlineByServiceInfo",value:(n=p(d().m(function k(e){var t,n,i;return d().w(function(o){for(;;)switch(o.p=o.n){case 0:return t={id:jr.guid(),dmService:e,bNoViewer:!0,bNoMask:!0,bNotShowMessage:!0},o.p=1,n=new r(t),o.n=2,n._connnect();case 2:return n._bReady=!0,n.dispose(),o.a(2,!0);case 3:return o.p=3,i=o.v,jr.warn(i),o.a(2,!1)}},k,null,[[1,3]])})),function(e){return n.apply(this,arguments)})},{key:"_isReady",value:function(e){return e._bReady}},{key:"_innerHTTPUpload",value:function(e,r,t,n,i,o,a,s,u,c,l,f,d,h,g,v){var m=c,p=t;if(jr.isUndefined(s))return mg(e),void(jr.isFunction(v)&&v({code:e._errorCode,message:e._errorString}));On.cancelFrom=St.HTTPUpload;var _,y=function(t,n,i,o){On.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&On.closeProgress(null,r),jr.isFunction(v)&&v({code:t,message:n,response:i,httpCode:o})},S=e._createHttpUploaderConfig();if(S.objUploadStatus=h,m=DH(m,s),On.needShowTwiceShowDialog=!0,e.IfShowProgressBar?(On.showProgress(e,r,!1),On.progressContext&&(On.progressContext._onPercent=function(e){var r=0;if(e){var t,n;t=e.loaded,n=e.total,(r=Math.floor(t/n*100))>100&&(r=100)}On.progressBarOnPercentDone(-1,"Transferring...","",r,"")})):On.hideProgress(),u==mt.Binary){if(h&&h.bCancel)return h.st=2,zo(e),void y(e._errorCode,e._errorString);S&&S.onPercent&&S.onPercent([0,-1,mh,"http"]),e._convertToBlobForUpload(s,a,l,4,function(t,a,s){if(_=function(t){return On.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&On.closeProgress(null,r),jr.isFunction(g)&&us.runWithCatch(g,t),t=null,!0},h&&h.bCancel)return h.st=2,zo(e),y(e._errorCode,e._errorString);if(!t||t.size<=0)return Zh(e),y(e._errorCode,e._errorString);var u=e.__maxUploadImageSize;if(t.size>u&&-1!=u)return eg(e),y(e._errorCode,e._errorString);xn.IfAddMD5InUploadHeader&&a&&""!=a&&(i["dwt-md5"]=a);var c=new Dd,l=new xd;l.url=p,l.method=r,l.content=t,t=null,l.contentType=e._strHttpContentTypeFieldValue,l.headers=i,l.fileName=m,l.httpFormData=o,l.retry=f,l.bOnlyResponseEmptyIsOK=d,l.responseType=n,S.objUploadStatus=h,c.httpPostUpload(S,l,_,y)},y)}else if(u==mt.Base64){e._convertToBase64ByServerIdsWithUI(r,a,s,l,4,function(t){var a,s;if(!t||t.getLength()<=0)return Zh(e),y(e._errorCode,e._errorString);if(_=function(t){return On.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&On.closeProgress(null,r),jr.isFunction(g)&&us.runWithCatch(g,t),!0},a=t.getMD5(),xn.IfAddMD5InUploadHeader&&(i["dwt-md5"]=a),!(s=t.getData(0,t.getLength()))||""==s)return Zh(e),y(e._errorCode,e._errorString);var u=new xd;u.url=p,u.method=r,u.content=s,s=null,u.headers=i,u.fileName=m,u.httpFormData=o,u.retry=f,u.bOnlyResponseEmptyIsOK=d,u.responseType=n,(new Dd).httpPostUpload(S,u,_,y)},y)}}}]);var n,i,o,a,u,c,f,h,g,v}(NH),Bz=um,Uz=function(){return S(function k(e){var r=this;if(_(this,k),this._serverUrl=e,this._defaultDSScanClient=undefined,this._dsScanClientsMap={},this._serviceInfos=null,this._id=jr.guid(),this.onBufferChanged=undefined,this.onPostTransferAsync=undefined,this._errorCode=0,this._errorString="",this._bDispose=!1,this._needSetLogLevel=!1,this._logLevel=-1,this._showProgressBar=!0,this._checkServerUrl(),this._id&&!xn.RemoteScanIdMap[this._id]&&(xn.RemoteScanIdMap[this._id]=this),this._uuidForRemoteScanObject="",On.dlgProgress||On.initProgress(),xn.UseDefaultViewer){var t,n={viewerEvents:{bufferChanged:function(e,t){r.__bufferChanged(r,e,t)},save:function(e,t,n,i){return r.__save(e,t,n,i)},rotate:function(e,t,n){return r.__rotate(e,t,n)},crop:function(e,t,n,i,o){return r.__crop(e,{x:t,y:n,width:i,height:o})}},viewerError:{setError:function(e,t){r._defaultDSScanClient?Lz._setError(r._defaultDSScanClient,e,t):0==e&&""==t||(r._errorCode=e,r._errorString=t)}},imageEditorEvents:{deskew:function(e,t){r.__deskew(r,e,t)},removeImage:function(){r.__remove(r)},removeAllImage:function(){r.__removeAll(r)},close:function(){r.__close(r)}},imageEditorUiConfig:{buttons:{visibility:{scan:!1,load:!1}}},beforeImageEditorCreated:function(e){r.__beforeImageEditorCreated(e)}};if(this._viewer=new Dn.DWTViewerEx(null,n),null!==(t=xn.Token)&&void 0!==t?t:""){var i,o=null===(i=this._viewer)||void 0===i?void 0:i.webViewer;null==o||o.setImageLoadToken(xn.Token)}}else this._viewer=undefined},[{key:"Viewer",get:function(){return this._viewer}},{key:"_disposeDSClientByKey",value:(E=p(d().m(function P(e){var r;return d().w(function(t){for(;;)switch(t.n){case 0:if(!(r=this._dsScanClientsMap[e])){t.n=4;break}if(r.isDestroy){t.n=3;break}if(!r.__unload){t.n=2;break}return t.n=1,r.__unload();case 1:t.n=3;break;case 2:r.dispose();case 3:delete this._dsScanClientsMap[e];case 4:return t.a(2)}},P,this)})),function(e){return E.apply(this,arguments)})},{key:"_checkServerUrl",value:function(){var e=this._serverUrl;if(e&&jr.isString(e)&&jr.startsWith(location.href,"https://")&&jr.startsWith(e,"http://")){var r={};throw function(e,r,t){hh(e,-2436,'Mixed Content: The page at "'+r+'" was loaded over HTTPS, but requested an insecure resource "'+t+'/ddm/18625/ddm/SearchScanner". This request has been blocked; the content must be served over HTTPS.')}(r,location.href,e),bm(r)}if(!jr.isString(e)||""==e){var t={};throw hh(t,-2545,"The  proxy server URL is invalid."),bm(t)}}},{key:"getServices",value:(A=p(d().m(function F(e){var r,t,n,i,o,a,s,u,c,l,f,h,g,v,m,p,_,y,S,I,b,C;return d().w(function(d){for(;;)switch(d.p=d.n){case 0:if(!this._bDispose){d.n=1;break}throw Qg(r={}),bm(r);case 1:if(t=this._serverUrl,this._checkServerUrl(),n=new tz(t,!0),zl("getServices",this.getViewerElement()),d.p=2,!e&&this._serviceInfos&&0!=this._serviceInfos.length){d.n=19;break}if(i=null,o=this._serviceInfos,a="",s="",!Mc()){d.n=7;break}return d.n=3,this._setRemoteUuid();case 3:return d.p=3,d.n=4,Hm(xn.lgdt(),"");case 4:(u=d.v)&&(a=u.ar,s=this._uuidForRemoteScanObject),d.n=6;break;case 5:throw d.p=5,b=d.v,Qm(c={},b),{code:c._errorCode,message:c._errorString};case 6:d.n=8;break;case 7:a=Zu.refProductKey;case 8:return d.n=9,n.getServices(a,s,e);case 9:if(!((i=d.v)&&i.length>0)){d.n=19;break}l=[],h=[],f=0;case 10:if(!(f<i.length)){d.n=18;break}return m=np(i[f]),p=null!==(g=null==m||null===(v=m.attrs)||void 0===v?void 0:v.ty)&&void 0!==g?g:"",d.n=11,Lz.checkOnlineByServiceInfo(m);case 11:if(!d.v){d.n=15;break}if(m.attrs=m.attrs||{},m.attrs.bNoMask=!0,m.attrs.bNotShowMessage=!0,!o){d.n=14;break}_=void 0,_=0;case 12:if(!(_<o.length)){d.n=14;break}if(!this.isSameService(m,o[_])){d.n=13;break}return o.splice(_,1),d.a(3,14);case 13:_++,d.n=12;break;case 14:l.push(m),d.n=16;break;case 15:p+="(x)";case 16:h.push(p);case 17:f++,d.n=10;break;case 18:if(l.length>0&&(this._serviceInfos=l),jr.log("Find Dynamic Web TWAIN Services:"),jr.log(h.join(", ")),o)for(y=0;y<o.length;y++)(I=null===(S=o[y])||void 0===S||null===(S=S.attrs)||void 0===S?void 0:S.UUID)&&this._disposeDSClientByKey(I);case 19:this._needSetLogLevel&&-1!=this._logLevel&&this.setLogLevel(this._logLevel),d.n=21;break;case 20:throw d.p=20,C=d.v,this._serviceInfos=null,C;case 21:d.p=21,Kl("getServices");try{n._bInited&&n.dispose()}catch(lK){}return d.f(21);case 22:return d.a(2,this._serviceInfos)}},F,this,[[3,5],[2,20,21,22]])})),function(e){return A.apply(this,arguments)})},{key:"getDefaultService",value:function(){if(this._bDispose){var e={};throw Qg(e),bm(e)}return this._defaultDSScanClient?this._defaultDSScanClient.getServiceInfo():null}},{key:"setDefaultService",value:(w=p(d().m(function D(e){var r,t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:if(!this._bDispose){o.n=1;break}throw Qg(r={}),bm(r);case 1:if(null!==e){o.n=2;break}return this._defaultDSScanClient=undefined,this._serviceInfos=null,o.a(2);case 2:if(e&&e instanceof tp){o.n=3;break}throw Ag(t={}),{code:t._errorCode,message:t._errorString};case 3:return n=this.getViewerElement(),o.n=4,this._createDSClientByServiceInfo(e,!0,n._containerElement);case 4:if(!(i=o.v)){o.n=5;break}return o.n=5,this._innerSetDefault(i);case 5:return o.a(2)}},D,this)})),function(e){return w.apply(this,arguments)})},{key:"_innerSetDefault",value:(T=p(d().m(function x(e){var r,t,n,i;return d().w(function(o){for(;;)switch(o.n){case 0:if(!e){o.n=2;break}if(Lz._isReady(e)){o.n=1;break}throw n=null!==(r=null===(t=e.getServiceInfo())||void 0===t||null===(t=t.attrs)||void 0===t?void 0:t.name)&&void 0!==r?r:"",jg(e,n),{code:e._getErrorCode(),message:e._getErrorString()};case 1:this._defaultDSScanClient=e,this._serviceInfos=null,this._defaultDSScanClient.IfShowProgressBar=this._showProgressBar,(i=this.Viewer)&&i.webViewer&&i.webViewer.bindViewUI&&this._defaultDSScanClient.setViewerInfo(i.webViewer.bindViewUI),this.__setViewerControlInfo(),this._registEventToDefaultDS(),this._viewer&&this._viewer.webViewer.setBufferService(Lz._getBuffer(this._defaultDSScanClient));case 2:return o.a(2)}},x,this)})),function(e){return T.apply(this,arguments)})},{key:"__setViewerControlInfo",value:function(){var e,r=this.Viewer;r&&r.webViewer.bindViewUI&&r.width&&r.width>0&&r.height&&r.height>0&&(null===(e=this._defaultDSScanClient)||void 0===e||e.setViewerControlInfo({width:r.width,height:r.height}))}},{key:"__beforeImageEditorCreated",value:function(e){var r=ds();if(!jr.isUndefined(r)){if(!jr.isUndefined(r.buttons)){var t=r.buttons.titles;jr.isUndefined(t)||(jr.isUndefined(t.previous)||(e.buttons.titles.previous=t.previous),jr.isUndefined(t.next)||(e.buttons.titles.next=t.next),jr.isUndefined(t.print)||(e.buttons.titles.print=t.print),jr.isUndefined(t.scan)||(e.buttons.titles.scan=t.scan),jr.isUndefined(t.load)||(e.buttons.titles.load=t.load),jr.isUndefined(t.rotateleft)||(e.buttons.titles.rotateleft=t.rotateleft),jr.isUndefined(t.rotate)||(e.buttons.titles.rotate=t.rotate),jr.isUndefined(t.rotateright)||(e.buttons.titles.rotateright=t.rotateright),jr.isUndefined(t.deskew)||(e.buttons.titles.deskew=t.deskew),jr.isUndefined(t.crop)||(e.buttons.titles.crop=t.crop),jr.isUndefined(t.cut)||(e.buttons.titles.cut=t.cut),jr.isUndefined(t.changeimagesize)||(e.buttons.titles.changeimagesize=t.changeimagesize),jr.isUndefined(t.flip)||(e.buttons.titles.flip=t.flip),jr.isUndefined(t.mirror)||(e.buttons.titles.mirror=t.mirror),jr.isUndefined(t.zoomin)||(e.buttons.titles.zoomin=t.zoomin),jr.isUndefined(t.originalsize)||(e.buttons.titles.originalsize=t.originalsize),jr.isUndefined(t.zoomout)||(e.buttons.titles.zoomout=t.zoomout),jr.isUndefined(t.stretch)||(e.buttons.titles.stretch=t.stretch),jr.isUndefined(t.fit)||(e.buttons.titles.fit=t.fit),jr.isUndefined(t.fitw)||(e.buttons.titles.fitw=t.fitw),jr.isUndefined(t.fith)||(e.buttons.titles.fith=t.fith),jr.isUndefined(t.hand)||(e.buttons.titles.hand=t.hand),jr.isUndefined(t.rectselect)||(e.buttons.titles.rectselect=t.rectselect),jr.isUndefined(t.zoom)||(e.buttons.titles.zoom=t.zoom),jr.isUndefined(t.restore)||(e.buttons.titles.restore=t.restore),jr.isUndefined(t.save)||(e.buttons.titles.save=t.save),jr.isUndefined(t.close)||(e.buttons.titles.close=t.close),jr.isUndefined(t.removeall)||(e.buttons.titles.removeall=t.removeall),jr.isUndefined(t.removeselected)||(e.buttons.titles.removeselected=t.removeselected));var n=r.buttons.bShowAllButtons;jr.isUndefined(n)||(e.buttons.bShowAllButtons=n);var i=r.buttons.visibility;jr.isUndefined(i)||(jr.isUndefined(i.scan)||(e.buttons.visibility.scan=i.scan),jr.isUndefined(i.load)||(e.buttons.visibility.load=i.load),jr.isUndefined(i.print)||(e.buttons.visibility.print=i.print),jr.isUndefined(i.removeall)||(e.buttons.visibility.removeall=i.removeall),jr.isUndefined(i.removeselected)||(e.buttons.visibility.removeselected=i.removeselected),jr.isUndefined(i.rotateleft)||(e.buttons.visibility.rotateleft=i.rotateleft),jr.isUndefined(i.rotate)||(e.buttons.visibility.rotate=i.rotate),jr.isUndefined(i.rotateright)||(e.buttons.visibility.rotateright=i.rotateright),jr.isUndefined(i.deskew)||(e.buttons.visibility.deskew=i.deskew),jr.isUndefined(i.crop)||(e.buttons.visibility.crop=i.crop),jr.isUndefined(i.cut)||(e.buttons.visibility.cut=i.cut),jr.isUndefined(i.changeimagesize)||(e.buttons.visibility.changeimagesize=i.changeimagesize),jr.isUndefined(i.flip)||(e.buttons.visibility.flip=i.flip),jr.isUndefined(i.mirror)||(e.buttons.visibility.mirror=i.mirror),jr.isUndefined(i.zoomin)||(e.buttons.visibility.zoomin=i.zoomin),jr.isUndefined(i.originalsize)||(e.buttons.visibility.originalsize=i.originalsize),jr.isUndefined(i.zoomout)||(e.buttons.visibility.zoomout=i.zoomout),jr.isUndefined(i.stretch)||(e.buttons.visibility.stretch=i.stretch),jr.isUndefined(i.fit)||(e.buttons.visibility.fit=i.fit),jr.isUndefined(i.fitw)||(e.buttons.visibility.fitw=i.fitw),jr.isUndefined(i.fith)||(e.buttons.visibility.fith=i.fith),jr.isUndefined(i.hand)||(e.buttons.visibility.hand=i.hand),jr.isUndefined(i.rectselect)||(e.buttons.visibility.rectselect=i.rectselect),jr.isUndefined(i.zoom)||(e.buttons.visibility.zoom=i.zoom))}var o=r.dialogText;jr.isUndefined(o)||(jr.isUndefined(o.dlgRotateAnyAngle)||(e.dialogText.dlgRotateAnyAngle=o.dlgRotateAnyAngle),jr.isUndefined(o.dlgChangeImageSize)||(e.dialogText.dlgChangeImageSize=o.dlgChangeImageSize),jr.isUndefined(o.saveChangedImage)||(e.dialogText.saveChangedImage=o.saveChangedImage),jr.isUndefined(o.selectSource)||(e.dialogText.selectSource=o.selectSource))}}},{key:"__bufferChanged",value:function(e,r,t){var n,i=e,o=[],a=-1,s=[];r.operation&&(r.action=r.operation);for(var u=0;u<i.howManyImagesInBuffer;u++)(n=i._defaultDSScanClient.getCustomDataByIndex(u))&&n.uidFromServer&&o.push(n.uidFromServer);if(r.imageIds=o,r.curIndex>=0&&(n=i._defaultDSScanClient.getCustomDataByIndex(r.curIndex))&&n.uidFromServer&&(a=n.uidFromServer),r.currentId=a,r.afterStatus.selectedUids)for(var c=0;c<r.afterStatus.selectedUids.length;c++){var l=r.afterStatus.selectedUids[c];if(l&&-1!=l){var f=i._defaultDSScanClient.getIndexByUid(r.afterStatus.selectedUids[c]);f>=0&&(n=i._defaultDSScanClient.getCustomDataByIndex(f))&&n.serverId&&s.push(n.uidFromServer)}}r.selectedIds=s,jr.mix(r,{}),delete r.uids,delete r.currentUid,delete r.selectedUids,delete r.afterStatus,delete r.beforeStatus,delete r.operation,delete r.curIndex,delete r.docUid,delete r.docName,i.__fireEvent("onBufferChanged",r)}},{key:"__acquire",value:function(e,r){var t=e;t._stwain.SelectSource(function(){t._stwain.CloseSource(),t._stwain.OpenSource(),t._stwain.IfShowUI=!0,1==xn.IfConfineMaskWithinTheViewer?(xn.IfConfineMaskWithinTheViewer=!1,t._stwain.AcquireImage({},function(){xn.IfConfineMaskWithinTheViewer=!0},function(){})):t._stwain.AcquireImage()},function(){jr.log("User did not select a source")})}},{key:"__remove",value:(C=p(d().m(function O(e){var r,t;return d().w(function(e){for(;;)switch(e.n){case 0:if(r=this,!this._defaultDSScanClient){e.n=3;break}if(Ng(this._defaultDSScanClient),!(r.howManyImagesInBuffer<=0||r.currentImageIndexInBuffer<0)){e.n=1;break}return Bz.output(r,"No image in Buffer"),e.a(2,!0);case 1:return t=Lz._getBuffer(this._defaultDSScanClient),e.n=2,this._defaultDSScanClient.removeImages(t.getSelectedImagesIndices());case 2:return e.a(2,e.v);case 3:return e.a(2,!1)}},O,this)})),function(e){return C.apply(this,arguments)})},{key:"__removeAll",value:(b=p(d().m(function N(e){return d().w(function(e){for(;;)switch(e.n){case 0:if(!this._defaultDSScanClient){e.n=1;break}return Ng(this._defaultDSScanClient),e.n=1,this._defaultDSScanClient._removeAllImagesAsync("removeAllImages",!0);case 1:return e.a(2,!1)}},N,this)})),function(e){return b.apply(this,arguments)})},{key:"__save",value:(I=p(d().m(function R(e,r,t,n){var i,o,a,s,u;return d().w(function(c){for(;;)switch(c.p=c.n){case 0:if(o="save",a=(i=this).__getViewerElementForViewer(i,n),zl(o,a),c.p=1,Ng(i._defaultDSScanClient),!(i.howManyImagesInBuffer<=0||i.currentImageIndexInBuffer<0)){c.n=2;break}return Bz.output(i,"No image in Buffer"),c.a(2);case 2:return c.n=3,null===(s=i._defaultDSScanClient)||void 0===s?void 0:s.updateImage(e,r,t);case 3:return c.v,c.n=4,null===(u=i._defaultDSScanClient)||void 0===u?void 0:u.__saveToViewerAfterUpdate(e,t);case 4:c.n=6;break;case 5:c.p=5,c.v;case 6:return c.p=6,Kl(o),c.f(6);case 7:return c.a(2)}},R,this,[[1,5,6,7]])})),function(e,r,t,n){return I.apply(this,arguments)})},{key:"__getViewerElementForViewer",value:function(e,r){var t,n=e;if(r)if(n._viewer.webViewer.imageEditor){var i=n._viewer.createImageEditor();t="dwt-viewer-imageEditor-fullScreen"==i.inner.containerElement.className?{_containerElement:document.body}:{_containerElement:i.inner.containerElement}}else t=n.getViewerElement();else t=n.getViewerElement();return t}},{key:"__close",value:function(e){var r=e;if(jr.isFunction(r.__CloseImageEditorUI))try{r.__CloseImageEditorUI()}catch(t){jr.error(t)}}},{key:"__deskew",value:function(e,r,t){var n,i=this,o="deskew";if(Ng(i._defaultDSScanClient),i.howManyImagesInBuffer<=0||i.currentImageIndexInBuffer<0)Bz.output(i,"No image in Buffer");else{var a=i.__getViewerElementForViewer(i,!0);zl(o,a);null===(n=i._defaultDSScanClient)||void 0===n||n.getSkewAngleFromBinaryAsync(i.currentImageIndexInBuffer,r,function(e){t(e[0]),Kl(o)},function(){Kl(o)})}}},{key:"__rotate",value:(y=p(d().m(function W(e,r,t){var n;return d().w(function(i){for(;;)switch(i.n){case 0:return Ng(this._defaultDSScanClient),i.n=1,this._makeSureDefaultServiceInfo();case 1:if(this._defaultDSScanClient){i.n=2;break}throw iv();case 2:return i.n=3,this._defaultDSScanClient.rotate(e,r,t,-1);case 3:return n=i.v,i.a(2,n)}},W,this)})),function(e,r,t){return y.apply(this,arguments)})},{key:"__crop",value:(m=p(d().m(function M(e,r){var t;return d().w(function(n){for(;;)switch(n.n){case 0:return Ng(this._defaultDSScanClient),n.n=1,this._makeSureDefaultServiceInfo();case 1:if(this._defaultDSScanClient){n.n=2;break}throw iv();case 2:return n.n=3,this._defaultDSScanClient.crop(e,r);case 3:return t=n.v,n.a(2,t)}},M,this)})),function(e,r){return m.apply(this,arguments)})},{key:"__fireEvent",value:function(e,r){return!jr.isFunction(this[e])||this[e](r)}},{key:"getDevices",value:(v=p(d().m(function L(e){var r,t,n,i,o,a,s,u,c,l,f,h,g,v,m,p,_,y,S,I,b,C,T,w,A,E,k;return d().w(function(d){for(;;)switch(d.p=d.n){case 0:if(!this._bDispose){d.n=1;break}throw Qg(i={}),bm(i);case 1:if(o=[],a="getDevices",s=this.getViewerElement(),u=null!==(r=null==e?void 0:e.errorExit)&&void 0!==r&&r,c=null!==(t=null==e?void 0:e.timeout)&&void 0!==t?t:0,f=null==e?void 0:e.serviceInfo,h=null!==(n=null==e?void 0:e.deviceType)&&void 0!==n?n:Kt,zl(a,s),d.p=2,v=!1,m=[],this._serviceInfos){d.n=3;break}return d.n=3,this.getServices();case 3:if(!f){d.n=7;break}return d.n=4,this._createDSClientByServiceInfo(f,!0);case 4:if(!(_=d.v)){d.n=5;break}m.push(_),v=!1,d.n=6;break;case 5:throw ov(null==f||null===(y=f.attrs)||void 0===y?void 0:y.ty);case 6:d.n=12;break;case 7:if(!this._serviceInfos){d.n=12;break}p=0;case 8:if(!(p<this._serviceInfos.length)){d.n=11;break}return S=this._serviceInfos[p],d.n=9,this._createDSClientByServiceInfo(S);case 9:(I=d.v)&&m.push(I);case 10:p++,d.n=8;break;case 11:v=!0;case 12:p=0;case 13:if(!(p<m.length)){d.n=20;break}return b=void 0,d.p=14,d.n=15,m[p].getDevices(h,null==e?void 0:e.refresh,u,c);case 15:if(b=d.v,jr.isArray(b)&&b.length>0)for(l=0;l<b.length;l++)o.push(b[l]);d.n=18;break;case 16:if(d.p=16,k=d.v,!u){d.n=17;break}throw k;case 17:g=k;case 18:return d.p=18,C=null,this._defaultDSScanClient&&(C=null===(T=this._defaultDSScanClient.getServiceInfo())||void 0===T||null===(T=T.attrs)||void 0===T?void 0:T.UUID,this._defaultDSScanClient.isDestroy&&(this._disposeDSClientByKey(C),this._defaultDSScanClient=undefined,this._serviceInfos=null,C=null)),v&&(A=m[p].getServiceInfo(),(E=null==A||null===(w=A.attrs)||void 0===w?void 0:w.UUID)&&E!=C&&this._disposeDSClientByKey(E)),d.f(18);case 19:p++,d.n=13;break;case 20:d.n=22;break;case 21:throw d.p=21,d.v;case 22:return d.p=22,Kl(a),g&&xn.lsetException(g.code,g.message),d.f(22);case 23:return d.a(2,o)}},L,this,[[14,16,18,19],[2,21,22,23]])})),function(e){return v.apply(this,arguments)})},{key:"acquireImage",value:(g=p(d().m(function B(e,r){var t,n,i,o,a,s,u,c,l,f,h,g,v,m;return d().w(function(d){for(;;)switch(d.p=d.n){case 0:if(!(t=this)._bDispose){d.n=1;break}throw Qg(n={}),bm(n);case 1:if(e&&e instanceof op){d.n=2;break}throw Ag(i={}),{code:i._errorCode,message:i._errorString};case 2:return o=null,a="acquireImage",s=t.getViewerElement(),u=[],zl(a,s),d.p=3,jr.isUndefined(r)?r={}:(jr.isUndefined(r.IfShowUI)&&(r.IfShowUI=!1),jr.isUndefined(r.IfCloseSourceAfterAcquire)&&(r.IfCloseSourceAfterAcquire=!0)),c=e.serviceInfo,d.n=4,this._createDSClientByServiceInfo(c,!0);case 4:if(!(o=d.v)){d.n=12;break}if(t._defaultDSScanClient){d.n=5;break}return d.n=5,t._innerSetDefault(o);case 5:u.push(o),t._defaultDSScanClient&&o!=t._defaultDSScanClient&&u.push(t._defaultDSScanClient),l=0;case 6:if(!(l<u.length)){d.n=8;break}if(f=u[l],Lz._isReady(f)){d.n=7;break}throw v=null!==(h=null===(g=f.getServiceInfo())||void 0===g||null===(g=g.attrs)||void 0===g?void 0:g.name)&&void 0!==h?h:"",jg(f,v),{code:f._getErrorCode(),message:f._getErrorString()};case 7:l++,d.n=6;break;case 8:if(t.onPostTransferAsync?o.registerEvent("OnPostTransferAsync",t.onPostTransferAsync):o.unregisterEvent("OnPostTransferAsync"),this.__setViewerControlInfo(),o!=t._defaultDSScanClient){d.n=10;break}return d.n=9,o.acquireImage(e,r);case 9:d.n=11;break;case 10:return d.n=11,o._acquireImageForSendTo(a,e,r,t._defaultDSScanClient);case 11:d.n=13;break;case 12:throw Rg(null==c||null===(m=c.attrs)||void 0===m?void 0:m.name);case 13:d.n=15;break;case 14:throw d.p=14,d.v;case 15:return d.p=15,o&&o.__closeRemoteScanUI(!0),Kl(a),d.f(15);case 16:return d.a(2)}},B,this,[[3,14,15,16]])})),function(e,r){return g.apply(this,arguments)})},{key:"_waitForDSValid",value:function(e,r){for(var t=0,n=e.length,i=this;t<n;t++)if(!Lz._isReady(e[t]))return void setTimeout(function(){i._waitForDSValid(e,r)},xc.RemoteReconnectTimeSpan);jr.isFunction(i[r.command])&&i[r.command].apply(i,r.parmas)}},{key:"getCapabilities",value:(h=p(d().m(function U(e){var r,t,n,i,o,a,s;return d().w(function(u){for(;;)switch(u.p=u.n){case 0:if(!this._bDispose){u.n=1;break}throw Qg(r={}),bm(r);case 1:if(e&&e instanceof op){u.n=2;break}throw Ag(t={}),bm(t);case 2:return i="getCapabilities",o=[],a=this.getViewerElement(),zl(i,a),u.p=3,s=e.serviceInfo,u.n=4,this._createDSClientByServiceInfo(s,!0);case 4:if(n=u.v,!(n=this._findDSClientByServiceInfo(s))){u.n=6;break}return u.n=5,n.getCapabilities(e);case 5:o=u.v;case 6:u.n=8;break;case 7:throw u.p=7,u.v;case 8:return u.p=8,n&&n.__closeRemoteScanUI(!0),Kl(i),u.f(8);case 9:return u.a(2,o)}},U,this,[[3,7,8,9]])})),function(e){return h.apply(this,arguments)})},{key:"setCapabilities",value:(f=p(d().m(function V(e,r){var t,n,i,o,a,s;return d().w(function(u){for(;;)switch(u.p=u.n){case 0:if(!this._bDispose){u.n=1;break}throw Qg(t={}),bm(t);case 1:if(e&&e instanceof op){u.n=2;break}throw Ag(n={}),bm(n);case 2:return o="setCapabilities",a=this.getViewerElement(),zl(o,a),u.p=3,s=e.serviceInfo,u.n=4,this._createDSClientByServiceInfo(s,!0);case 4:if(!(i=u.v)){u.n=5;break}return u.n=5,i.setCapabilities(e,r);case 5:u.n=7;break;case 6:throw u.p=6,u.v;case 7:return u.p=7,i&&i.__closeRemoteScanUI(!0),Kl(o),u.f(7);case 8:return u.a(2)}},V,this,[[3,6,7,8]])})),function(e,r){return f.apply(this,arguments)})},{key:"closeSource",value:(l=p(d().m(function j(e){var r,t,n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(!this._bDispose){s.n=1;break}throw Qg(r={}),bm(r);case 1:if(e&&e instanceof op){s.n=2;break}throw Ag(t={}),bm(t);case 2:return n="closeSource",i=this.getViewerElement(),zl(n,i),s.p=3,o=e.serviceInfo,a=this._findDSClientByServiceInfo(o),s.n=4,null==a?void 0:a.closeSource();case 4:s.n=6;break;case 5:throw s.p=5,s.v;case 6:return s.p=6,Kl(n),s.f(6);case 7:return s.a(2)}},j,this,[[3,5,6,7]])})),function(e){return l.apply(this,arguments)})},{key:"_putDSClientToMap",value:function(e,r){var t,n=null==e||null===(t=e.attrs)||void 0===t?void 0:t.UUID;n&&(this._dsScanClientsMap[n]=r)}},{key:"_getDSClientFromMap",value:function(e){var r,t=null==e||null===(r=e.attrs)||void 0===r?void 0:r.UUID;return t?this._dsScanClientsMap[t]:null}},{key:"_createDSClientByServiceInfo",value:(c=p(d().m(function H(e,r,t){var n,i,o,a;return d().w(function(s){for(;;)switch(s.p=s.n){case 0:if(this._serviceInfos){s.n=1;break}return s.n=1,this.getServices();case 1:if(n=this._findDSClientByServiceInfo(e)){s.n=6;break}return s.n=2,this._setRemoteUuid();case 2:return s.p=2,s.n=3,Lz.createByServiceInfo(this._uuidForRemoteScanObject,e,t);case 3:(n=s.v)&&this._putDSClientToMap(e,n),s.n=6;break;case 4:if(s.p=4,(a=s.v).code==it.MustUpgrade&&(null==e||null===(i=e.attrs)||void 0===i?void 0:i.ty)&&(yc(o={},xn.ServerVersionInfo,!1),a.message=o._errorString),!r){s.n=5;break}throw a;case 5:jr.warn(a);case 6:return s.a(2,n)}},H,this,[[2,4]])})),function(e,r,t){return c.apply(this,arguments)})},{key:"_makeSureDefaultServiceInfo",value:(u=p(d().m(function G(){var e;return d().w(function(r){for(;;)switch(r.n){case 0:if(this._serviceInfos){r.n=1;break}return r.n=1,this.getServices();case 1:if(!(this._serviceInfos&&this._serviceInfos.length>0)){r.n=3;break}return e=this._serviceInfos[0],r.n=2,this._createDSClientByServiceInfo(e);case 2:return r.a(2,r.v);case 3:return r.a(2,null)}},G,this)})),function(){return u.apply(this,arguments)})},{key:"httpUpload",value:(s=p(d().m(function z(e,r,t,n,i,o){var a,s,u,c;return d().w(function(l){for(;;)switch(l.n){case 0:if(!this._bDispose){l.n=1;break}return Qg(a={}),l.a(2,Promise.reject(bm(a)));case 1:return u=this.getViewerElement(),c=u._containerElement,l.n=2,this._makeSureDefaultServiceInfo();case 2:if(this._defaultDSScanClient){l.n=3;break}throw iv();case 3:return l.n=4,this._defaultDSScanClient.httpUpload(e,r,t,n,i,o,c);case 4:return s=l.v,l.a(2,s)}},z,this)})),function(e,r,t,n,i,o){return s.apply(this,arguments)})},{key:"runCommand",value:function(e){var r;return null===(r=this._defaultDSScanClient)||void 0===r?void 0:r.RunCommandAsync(e)}},{key:"removeImages",value:(a=p(d().m(function K(e){var r,t,n,i,o;return d().w(function(a){for(;;)switch(a.p=a.n){case 0:if(!this._bDispose){a.n=1;break}return Qg(r={}),a.a(2,Promise.reject(bm(r)));case 1:return t="removeImages",i=this.getViewerElement(),zl(t,i),a.p=2,a.n=3,this._makeSureDefaultServiceInfo();case 3:if(this._defaultDSScanClient){a.n=4;break}throw iv();case 4:if(!this._defaultDSScanClient){a.n=6;break}return a.n=5,this._defaultDSScanClient.removeImages(e);case 5:n=a.v,a.n=7;break;case 6:if(0!=this.howManyImagesInBuffer){a.n=7;break}if(o={},WH(e,this.howManyImagesInBuffer,o)){a.n=7;break}throw{code:o._errorCode,message:o._errorString};case 7:a.n=9;break;case 8:throw a.p=8,a.v;case 9:return a.p=9,Kl(t),a.f(9);case 10:return a.a(2,n)}},K,this,[[2,8,9,10]])})),function(e){return a.apply(this,arguments)})},{key:"saveImages",value:(o=p(d().m(function J(e,r,t){var n,i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:if(n={},!this._bDispose){s.n=1;break}return Qg(n),s.a(2,Promise.reject(bm(n)));case 1:if(0!=this.howManyImagesInBuffer){s.n=2;break}return Vh(n),s.a(2,Promise.reject(bm(n)));case 2:if(jr.isNumber(t)){s.n=3;break}return Ag(n),s.a(2,Promise.reject(bm(n)));case 3:if(t!=ut.IT_BMP&&t!=ut.IT_JPG&&t!=ut.IT_PNG){s.n=5;break}if(!(r.length>1)){s.n=4;break}return Xg(n),s.a(2,Promise.reject(bm(n)));case 4:s.n=8;break;case 5:if(t!=ut.IT_TIF&&t!=ut.IT_PDF){s.n=6;break}s.n=8;break;case 6:if(t!=ut.IT_ALL&&t!=ut.IT_MULTIPAGE_PDF&&t!=ut.IT_MULTIPAGE_TIF){s.n=7;break}return Yg(n),s.a(2,Promise.reject(bm(n)));case 7:return mg(n),s.a(2,Promise.reject(bm(n)));case 8:return o=this.getViewerElement(),a=o._containerElement,s.n=9,this._makeSureDefaultServiceInfo();case 9:if(this._defaultDSScanClient){s.n=10;break}throw iv();case 10:return s.n=11,this._defaultDSScanClient.saveImages(e,r,t,a);case 11:return i=s.v,s.a(2,i)}},J,this)})),function(e,r,t){return o.apply(this,arguments)})},{key:"getImages",value:(i=p(d().m(function Q(e,r,t){var n,i,o,a;return d().w(function(s){for(;;)switch(s.n){case 0:if(n={},!this._bDispose){s.n=1;break}return Qg(n),s.a(2,Promise.reject(bm(n)));case 1:if(0!=this.howManyImagesInBuffer){s.n=2;break}return Vh(n),s.a(2,Promise.reject(bm(n)));case 2:if(jr.isNumber(r)&&jr.isNumber(t)){s.n=3;break}return Ag(n),s.a(2,Promise.reject(bm(n)));case 3:return o=this.getViewerElement(),a=o._containerElement,s.n=4,this._makeSureDefaultServiceInfo();case 4:if(this._defaultDSScanClient){s.n=5;break}throw iv();case 5:return s.n=6,this._defaultDSScanClient.getImages(e,r,t,a);case 6:return i=s.v,s.a(2,i)}},Q,this)})),function(e,r,t){return i.apply(this,arguments)})},{key:"__unload",value:(n=p(d().m(function q(){var e,r,t,n;return d().w(function(i){for(;;)switch(i.n){case 0:if(this._viewer&&this._viewer.unbind(),!this._dsScanClientsMap){i.n=3;break}r=this._dsScanClientsMap,t=Object.keys(r),e=0;case 1:if(!(e<t.length)){i.n=3;break}return n=t[e],i.n=2,this._disposeDSClientByKey(n);case 2:e++,i.n=1;break;case 3:this._dsScanClientsMap={},this._bDispose=!0;case 4:return i.a(2)}},q,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){return this.__unload()}},{key:"setLogLevel",value:function(e){var r,t=this._dsScanClientsMap;if(t){var n=Object.keys(t);for(r=0;r<n.length;r++)t[n[r]]._setLogLevel(e);this._needSetLogLevel=!1,this._logLevel=-1}else this._needSetLogLevel=!0,this._logLevel=e;return!0}},{key:"getProfile",value:(t=p(d().m(function Y(e){var r,t,n,i;return d().w(function(o){for(;;)switch(o.p=o.n){case 0:if(r="",e&&e instanceof op){o.n=1;break}throw Ag(t={}),{code:t._errorCode,message:t._errorString};case 1:return o.p=1,n=e.serviceInfo,o.n=2,this._createDSClientByServiceInfo(n,!0);case 2:if(!(i=o.v)){o.n=4;break}return o.n=3,i.getProfile(e);case 3:r=o.v;case 4:o.n=6;break;case 5:throw o.p=5,o.v;case 6:return o.a(2,r)}},Y,this,[[1,5]])})),function(e){return t.apply(this,arguments)})},{key:"setProfile",value:(r=p(d().m(function X(e,r){var t,n,i,o;return d().w(function(a){for(;;)switch(a.p=a.n){case 0:if(t="",e&&e instanceof op){a.n=1;break}throw Ag(n={}),{code:n._errorCode,message:n._errorString};case 1:return a.p=1,i=e.serviceInfo,a.n=2,this._createDSClientByServiceInfo(i,!0);case 2:if(!(o=a.v)){a.n=4;break}return a.n=3,o.setProfile(e,r);case 3:t=a.v;case 4:a.n=6;break;case 5:throw a.p=5,a.v;case 6:return a.a(2,t)}},X,this,[[1,5]])})),function(e,t){return r.apply(this,arguments)})},{key:"imageIDToIndex",value:function(e){return this._defaultDSScanClient?this._defaultDSScanClient.imageIDToIndex(e):0}},{key:"indexToImageID",value:function(e){return this._defaultDSScanClient?this._defaultDSScanClient.indexToImageID(e):""}},{key:"howManyImagesInBuffer",get:function(){return this._defaultDSScanClient?this._defaultDSScanClient.howManyImagesInBuffer:0}},{key:"currentImageIndexInBuffer",get:function(){return this._defaultDSScanClient?this._defaultDSScanClient.currentImageIndexInBuffer:-1},set:function(e){this._defaultDSScanClient&&(this._defaultDSScanClient.currentImageIndexInBuffer=e)}},{key:"showProgressBar",get:function(){return this._defaultDSScanClient?this._defaultDSScanClient.IfShowProgressBar:this._showProgressBar},set:function(e){this._defaultDSScanClient?(this._showProgressBar=e,this._defaultDSScanClient.IfShowProgressBar=e):this._showProgressBar}},{key:"registerEvent",value:function(e,r){if(this._bDispose){var t={};return Qg(t),Promise.reject(bm(t))}if(!jr.isFunction(r)){var n={};return kg(n),Promise.reject(bm(n))}if("onBufferChanged"==e||"OnBufferChanged"==e)this.onBufferChanged=r;else{if("onPostTransferAsync"!=e&&"OnPostTransferAsync"!=e){var i={};return bg(i),Promise.reject(bm(i))}this.onPostTransferAsync=r}return this._registEventToDefaultDS(),!0}},{key:"unregisterEvent",value:function(e,r){if(this._bDispose){var t={};return Qg(t),Promise.reject(bm(t))}if("onBufferChanged"==e||"OnBufferChanged"==e){if(this.onBufferChanged=undefined,this._defaultDSScanClient)return this._defaultDSScanClient.unregisterEvent("OnBufferChanged",r)}else{if("onPostTransferAsync"!=e&&"OnPostTransferAsync"!=e){var n={};return bg(n),Promise.reject(bm(n))}if(this.onPostTransferAsync=undefined,this._defaultDSScanClient)return this._defaultDSScanClient.unregisterEvent("OnPostTransferAsync",r)}}},{key:"getViewerElement",value:function(){var e=this.Viewer;return e&&e.webViewer&&e.webViewer.containerElement?{_containerElement:e.webViewer.containerElement}:{_containerElement:document.body}}},{key:"isSameService",value:function(e,r){return!(!e||!r)&&(e.server==r.server&&e.attrs.UUID==r.attrs.UUID&&e.attrs.accessmode==r.attrs.accessmode&&e.attrs.name==r.attrs.name&&e.attrs.os==r.attrs.os&&e.attrs.service_type==r.attrs.service_type&&e.attrs.tags==r.attrs.tags&&e.attrs.ty==r.attrs.ty&&e.attrs.type==r.attrs.type&&e.attrs.txtvers==r.attrs.txtvers)}},{key:"_findDSClientByServiceInfo",value:function(e){var r,t=this._serviceInfos;if(t)for(r=0;r<t.length;r++){var n=t[r];if(this.isSameService(e,n)){var i=this._getDSClientFromMap(n);if(i){var o;if(Lz._isReady(i))return i;i.isDestroy||i.dispose();var a=null==n||null===(o=n.attrs)||void 0===o?void 0:o.UUID;a&&delete this._dsScanClientsMap[a]}break}}return null}},{key:"_setRemoteUuid",value:(e=p(d().m(function Z(){var e;return d().w(function(r){for(;;)switch(r.n){case 0:if(!Mc()){r.n=2;break}if(this._uuidForRemoteScanObject){r.n=2;break}return r.n=1,xn.lgcuid(xn.lgdt(),"");case 1:e=r.v,this._uuidForRemoteScanObject=e;case 2:return r.a(2)}},Z,this)})),function(){return e.apply(this,arguments)})},{key:"_registEventToDefaultDS",value:function(){this._defaultDSScanClient&&(this.onBufferChanged&&this._defaultDSScanClient.registerEvent("OnBufferChanged",this.onBufferChanged),this.onPostTransferAsync&&this._defaultDSScanClient.registerEvent("OnPostTransferAsync",this.onPostTransferAsync))}}]);var e,r,t,n,i,o,a,s,u,c,l,f,h,g,v,m,y,I,b,C,T,w,A,E}(),Vz=!1;function jz(e,r){return Hz.apply(this,arguments)}function Hz(){return Hz=p(d().m(function e(r,t){var n,i;return d().w(function(e){for(;;)switch(e.n){case 0:return t&&dh(wh),e.n=1,jv.preParseProductKey(t);case 1:if(0==(n=xn.licenseException).code){e.n=2;break}throw r&&ep(n),{code:n.code,message:n.message};case 2:if(Vz){e.n=4;break}if(i=!1,se.bIE&&(i=se.IEVersion<=7),i||!Mc()){e.n=4;break}if(xn.IfLoadResources){e.n=3;break}return Vz=!0,e.a(2);case 3:return e.a(2,new Promise(function(e,r){var t=om(),n="",i="";jr.isString(t)&&t.length>0&&("/"==t.charAt(t.length-1)||(i="/")),!se.bFileSystem&&xn.IfResourcesAddTimestamp&&(n=On.timestamp),jr.addScript([t,i,"src/dynamsoft.lts.js",n].join(""),!0,!1,function(t){if(Dn.LTS&&Dn.LTS._)return Vz=!0,void e();if(t){if(se.bIE)return void r({code:-2822,message:"The WebTwain JavaScript lts.js load failed."});if("error"==t.type)return void r({code:-2822,message:"The WebTwain JavaScript lts.js load failed."})}Vz=!0,e()})}));case 4:return e.a(2)}},e)})),Hz.apply(this,arguments)}function Gz(e,r,t){return zz.apply(this,arguments)}function zz(){return zz=p(d().m(function e(r,t,n){var i,o,a,s,u,c,l,f,h,g,v,m;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:i=xn.Containers,o=0;case 1:if(!(o<i.length)){e.n=14;break}if(!(a=jr.clone(i[o])).ContainerId){e.n=2;break}if(!xn.ContainerMap[a.ContainerId]){e.n=2;break}return e.a(3,13);case 2:if(!a.WebTwainId){e.n=3;break}if(!xn.WebTwainIdMap[a.WebTwainId]){e.n=3;break}return e.a(3,13);case 3:if(a.Host=r,a.SSLPort=n,a.Port=t,!jr.isDOM(a.Container)){e.n=4;break}e.n=6;break;case 4:if(!a.ContainerId){e.n=6;break}if(c=a.ContainerId,jr.isString(c)){e.n=5;break}throw ev();case 5:if(a.Container=jr.get(c),a.Container){e.n=6;break}throw rv(c);case 6:if(!hG(a.Container)){e.n=7;break}return l=document.createElement("div"),a.Container.appendChild(l),a.Container=l,f=dG(l),e.n=7,tm(f);case 7:return Xv(h=HG(a)),g=void 0,e.p=8,e.n=9,Iz.create(h);case 9:g=e.v,e.n=11;break;case 10:throw e.p=10,m=e.v,g&&g.dispose(),m;case 11:if(0===(u=xn.licenseException).code){e.n=12;break}throw{code:u.code,message:u.message};case 12:s=g;case 13:o++,e.n=1;break;case 14:v=window,s&&(v.DCP_DWT_OnClickCloseInstall&&v.DCP_DWT_OnClickCloseInstall(!1,!0),Rz(s),RH(s)),setTimeout(function(){try{var e=0,r=xn.ContainerMap;if(r&&(e=Object.keys(r).length),0==e&&(r=xn.WebTwainIdMap)&&(e=Object.keys(r).length),0==e)return;jr.isFunction(xn.OnWebTwainReady)?xn.OnWebTwainReady():jr.isFunction(v.Dynamsoft_OnReady)&&v.Dynamsoft_OnReady()}catch(t){jr.error(t)}},10);case 15:return e.a(2)}},e,null,[[8,10]])})),zz.apply(this,arguments)}function Kz(){return Jz.apply(this,arguments)}function Jz(){return Jz=p(d().m(function e(){var r,t,n,i,o,a,s,u,c;return d().w(function(e){for(;;)switch(e.n){case 0:if(On.page.bUnload=!1,xc.bHTML5Edition){e.n=1;break}return e.a(2,xn._innerLoad());case 1:return e.n=2,jz(!0,!0);case 2:if((r=xn.Containers)&&0!==r.length){e.n=3;break}throw qg(t={}),{code:t._errorCode,message:t._errorString};case 3:o=!1,a=[],s=[],n=0;case 4:if(!(n<r.length)){e.n=12;break}if(!r[n]){e.n=10;break}if(jr.isObject(r[n])){e.n=5;break}return o=!0,e.a(3,12);case 5:if(i=r[n],!jr.isString(i.WebTwainId)||""==i.WebTwainId){e.n=7;break}if(!im(a,i.WebTwainId)){e.n=6;break}throw tv(t={}),{code:t._errorCode,message:t._errorString};case 6:a.push(i.WebTwainId);case 7:if(!jr.isString(i.ContainerId)||""==i.ContainerId){e.n=9;break}if(!im(s,i.ContainerId)){e.n=8;break}throw nv(t={}),{code:t._errorCode,message:t._errorString};case 8:s.push(i.ContainerId);case 9:e.n=11;break;case 10:return o=!0,e.a(3,12);case 11:n++,e.n=4;break;case 12:if(!o){e.n=13;break}throw Zg(u={}),{code:u._errorCode,message:u._errorString};case 13:return c={host:ym(),port:xn.Port,sslPort:xn.SSLPort,bFromLoadInit:!0},e.n=14,Bl(c);case 14:return dh(Eh),e.n=15,Gz(c.host,c.port,c.sslPort);case 15:return e.a(2)}},e)})),Jz.apply(this,arguments)}var Qz=new(function(){return S(function e(){_(this,e)},[{key:"InvalidValue",value:function(e){Uh(e)}},{key:"ParameterCannotEmpty",value:function(e){rg(e)}},{key:"ParameterNotDWTObject",value:function(e){hh(e,-2908,"The parameter is not a Dynamic Web TWAIN object.")}},{key:"Webcam_InvalidIndex",value:function(e,r){hh(e,-2315,"The index is out of range.")}},{key:"Webcam_InvalidRemoteFilename",value:function(e){hh(e,-2316,"The RemoteFile field is empty in the Webcam Download Function.")}},{key:"InvalidDestination",value:function(e){hh(e,-2318,"Invalid destination file.")}},{key:"InvalidSourceFile",value:function(e){hh(e,-2319,"Invalid source file.")}},{key:"InvalidFile",value:function(e){tg(e)}},{key:"OCR_InvalidIndex",value:function(e,r){hh(e,-2321,"The index is out of range.")}},{key:"OCR_InvalidLeftOrTopOrRightOrBottom",value:function(e){hh(e,-2322,"The left or top or right or bottom you entered is invalid.")}},{key:"OCR_InvalidOutputFormat",value:function(e){hh(e,-2323,"The OCR output format is not supported.")}},{key:"OCR_InvalidPageSetMode",value:function(e){hh(e,-2324,"The OCR page set mode is not supported.")}},{key:"IndexOutOfRange",value:function(e){gg(e)}},{key:"IndicesNotArray",value:function(e){hg(e)}},{key:"InvalidParameter",value:function(e){Ag(e)}},{key:"IndicesCannotEmpty",value:function(e){cg(e)}},{key:"IndexNullOrUndefined",value:function(e){vg(e)}},{key:"InvalidIndex",value:function(e){Bh(e)}},{key:"IndicesOutOfRange",value:function(e){fg(e)}},{key:"OCR_InvalidRemoteFilename",value:function(e){hh(e,-2379,"The RemoteFile field is empty in the OCR Download Function.")}},{key:"ImageEditorOpenCannotPlayVideo",value:function(e){hh(e,-2437,"The video can not be played while the Image Editor is open.")}},{key:"EventNotExist",value:function(e){hh(e,-2509,"The specified event doesn't exist.")}},{key:"CallbackNotAFunction",value:function(e){kg(e)}},{key:"WasmNotLoaded",value:function(e){hh(e,-2537,"The wasm not loaded.")}},{key:"WasmNotLoaded_UseWasmFalse",value:function(e){hh(e,-2538,"The wasm not loaded when Dynamsoft.DWT.UseCameraAddonWasm is set to false.")}},{key:"CannotDoWhenNoViewerJS",value:function(e){xg(e)}},{key:"LicenseNoDbr",value:function(e){hh(e,-2611,"The license for the Barcode module is invalid."),gh(e)}}])}());if(xc.bHTML5Edition){var qz=function(){var e=p(d().m(function r(e){var t,n,i,o,a,s,u,c,l;return d().w(function(r){for(;;)switch(r.n){case 0:return AG(),r.n=1,jz(!0,!1);case 1:if(xn.UseDefaultViewer||(e.Container=null),!hG(e.Container)){r.n=2;break}return n=document.createElement("div"),e.Container.appendChild(n),e.Container=n,i=dG(n),r.n=2,tm(i);case 2:return(t=HG(e)).bFromLoadInit=!1,r.n=3,DG();case 3:if(o=xn.GetWebTwain(t.id),xn.UseDefaultViewer&&(u=null===(s=t.container)||void 0===s?void 0:s.id,!o&&u&&(a=xn.GetWebTwain(u))),!o&&!a){r.n=4;break}throw c={},o?tv(c):nv(c),{code:c._errorCode,message:c._errorString};case 4:return r.n=5,Bl(t);case 5:return dh(kh),r.n=6,xz(t);case 6:return l=r.v,r.a(2,l)}},r)}));return function(r){return e.apply(this,arguments)}}();xn.OnBeforeUnload=function(e){},window.addEventListener("beforeunload",function(e){if(On.isFunction(xn.OnBeforeUnload))return xn.OnBeforeUnload(e)}),xn.Unload=p(d().m(function e(){var r,t;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!Zu.bDWTLoading&&!Zu.bDWTUnloading){e.n=1;break}return e.a(2);case 1:return Zu.bDWTUnloading=!0,e.p=2,e.n=3,Yz(!1,!0);case 3:e.n=5;break;case 4:e.p=4,t=e.v,r=t;case 5:try{$z(),xn.CloseDialog(),On._zdgb_xkz_dhk(),On.unloadProgress(),On.hideMask(),xn.lts_unload()}catch(lK){}if(Zu.bDWTLoading=!1,Zu.bDWTUnloading=!1,Zu.loadingResourcePath=!1,!r){e.n=6;break}throw r;case 6:return e.a(2)}},e,null,[[2,4]])})),xn.Load=p(d().m(function r(){var e,t,n,i,o,a;return d().w(function(r){for(;;)switch(r.p=r.n){case 0:if(!Zu.bDWTLoading){r.n=1;break}return r.a(2);case 1:if(!Zu.bDWTUnloading){r.n=2;break}return setTimeout(xn.Load,500),r.a(2);case 2:return Zu.bDWTLoading=!0,Zz(),r.p=3,r.p=4,r.n=5,UG();case 5:return r.n=6,DG();case 6:r.n=8;break;case 7:throw r.p=7,Ym(i=r.v),i;case 8:return r.p=8,On.closeProgress(),r.n=9,Yz(!0,!0);case 9:r.n=11;break;case 10:return r.p=10,r.v,r.n=11,Yz();case 11:r.p=11,xn.CloseDialog(),js.bDWTChecked=!1,e=1,t=0;case 12:if(!(t<e)){r.n=19;break}return r.p=13,r.n=14,Kz();case 14:return r.a(3,19);case 15:if(r.p=15,o=r.v,!(t<e-1&&o.code==it.DWTPortNotReady)){r.n=17;break}return r.n=16,new Promise(function(e,r){setTimeout(function(){e()},300)});case 16:return r.a(3,18);case 17:throw o;case 18:t++,r.n=12;break;case 19:r.n=24;break;case 20:return r.p=20,a=r.v,Zm(n=a.code)||Xm(n)||On.detect.bOK||sm.pushToDo(null,xn.Load),Ym(a),r.p=21,r.n=22,Yz();case 22:r.n=24;break;case 23:r.p=23,r.v;case 24:return r.p=24,Zu.bDWTLoading=!1,$z(),r.f(24);case 25:return r.a(2)}},r,null,[[21,23],[13,15],[11,20],[8,10],[4,7],[3,,24,25]])})),xn.CheckConnectToTheService=Dl,Zu.loadqueue=sm,xn.ConnectToTheService=function(){sm.start()},xn.CreateDWTObject=function(e,r,t,n,i,o){var a,s=i,u=o;jr.isFunction(r)&&jr.isFunction(t)?(s=r,u=t,a={}):a={Host:r,Port:t,SSLPort:n};var c,l=e;if(jr.isString(l)&&!(l=jr.get(l)))return function(e){hh(e,-2813,Mh)}(c={}),u&&u({code:c._errorCode,message:c._errorString}),!1;if(jr.isDOM(l))a.Container=l;else{if(!jr.isString(e)){var f={code:-2806,message:'Error: The argument passed to the parameter "conatinerId" is not a string.'};return jr.isFunction(u)&&u(f),!1}if(!jr.get(e)){var d=rv(e);return jr.isFunction(u)&&u(d),!1}}return a.WebTwainId=pm(),xn.CreateDWTObjectEx(a,s,u)},xn.CreateDWTObjectEx=function(e,r,t){sm.addHeadToDo(Dn.DWT,"_QueuedCreateDWTObject",[e,r,t]),sm.start()},xn._QueuedCreateDWTObject=function(e,r,t){var n=arguments,i=!!e.bLoadingDialogOpened;return Zu.loadResourcePath?jr.isString(e.WebTwainId)?(i||Zz(),delete e.bLoadingDialogOpened,js.bDWTChecked=!1,qz(e).then(function(e){$z(),RH(e),jr.isFunction(r)&&r(e)},function(e){if($z(),!On.detect.bOK){var r=e&&e.code,i=xn.licenseException;!r||Xm(r)||Zm(r)&&0!=i.code||(sm.pause(),setTimeout(function(){sm.pushToDo(Dn.DWT,"_QueuedCreateDWTObject",n)},100))}jr.isFunction(t)&&t(e)}),!0):(i&&$z(),t&&t({code:-2805,message:'Error: The "WebTwainId" is not a string.'}),!1):(i||(Zz(),e.bLoadingDialogOpened=!0),void UG().then(DG).then(function(){setTimeout(function(){xn._QueuedCreateDWTObject(e,r,t)},100)},function(e){$z(),t(e)}))},xn.CreateRemoteScanObjectAsync=function(){var e=p(d().m(function r(e){var t,n;return d().w(function(r){for(;;)switch(r.p=r.n){case 0:if(t=null,e){r.n=1;break}throw Ag(n={}),{code:n._errorCode,message:n._errorString};case 1:return Zu.bDWTLoading=!0,Zz(),r.p=2,r.n=3,DG();case 3:return r.n=4,jz(!1,!1);case 4:t=new Uz(e),Object.preventExtensions(t);case 5:return r.p=5,Zu.bDWTLoading=!1,$z(),r.f(5);case 6:return r.a(2,t)}},r,null,[[2,,5,6]])}));return function(r){return e.apply(this,arguments)}}(),xn.DeleteDWTObject=function(e){var r,t=e;return!(!xc.bHTML5Edition||!t)&&(!!(r=jr.isString(t)?xn.GetWebTwain(t):t)&&(r.dispose(),!0))}}function Yz(e,r){return Xz.apply(this,arguments)}function Xz(){return Xz=p(d().m(function e(r,t){var n,i,o,a,s,u,c,l,f,h;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r&&dh(Th),!t){e.n=1;break}return e.n=1,xn.lunload();case 1:if(On.dlgProgress=!1,On.detect.bOK=!1,On.detect.bFirst=!0,!(a=xn.WebTwainIdMap)){e.n=9;break}s=Object.keys(a),n=0;case 2:if(!(n<s.length)){e.n=9;break}if(!(o=s[n])||!(o in a)){e.n=8;break}if(!(i=a[o])){e.n=8;break}if(e.p=3,!i.__unload){e.n=5;break}return e.n=4,i.__unload();case 4:e.n=6;break;case 5:return e.n=6,i.dispose();case 6:e.n=8;break;case 7:e.p=7,l=e.v,u=l;case 8:n++,e.n=2;break;case 9:if(!(a=xn.ContainerMap)){e.n=17;break}s=Object.keys(a),n=0;case 10:if(!(n<s.length)){e.n=17;break}if(!(o=s[n])||!(o in a)){e.n=16;break}if(!(i=a[o])){e.n=16;break}if(e.p=11,!i.__unload){e.n=13;break}return e.n=12,i.__unload();case 12:e.n=14;break;case 13:return e.n=14,i.dispose();case 14:e.n=16;break;case 15:e.p=15,f=e.v,u=f;case 16:n++,e.n=10;break;case 17:if(!(a=xn.RemoteScanIdMap)){e.n=25;break}s=Object.keys(a),n=0;case 18:if(!(n<s.length)){e.n=25;break}if(!(o=s[n])||!(o in a)){e.n=24;break}if(!(i=a[o])){e.n=24;break}if(e.p=19,!i.__unload){e.n=21;break}return e.n=20,i.__unload();case 20:e.n=22;break;case 21:return e.n=22,i.dispose();case 22:e.n=24;break;case 23:e.p=23,h=e.v,u=h;case 24:n++,e.n=18;break;case 25:for(n=0;n<Zu.unloadQueue.length;n++)c=Zu.unloadQueue[n],jr.isFunction(c)&&c();if(Zu.unloadQueue.splice(0),!u){e.n=26;break}throw u;case 26:return e.a(2)}},e,null,[[19,23],[11,15],[3,7]])})),Xz.apply(this,arguments)}function Zz(){var e;xc.bHTML5Edition&&(fs(),e={},On.loaderBarWidth>0&&(e.width=On.loaderBarWidth+"px"),zl("openLoadingMsg",null,e))}function $z(){xc.bHTML5Edition&&Kl("closeLoadingMsg:")}On.Errors=Qz,hf(p(d().m(function TK(){var e,r,t,n,i;return d().w(function(o){for(;;)switch(o.p=o.n){case 0:if((e=window)&&(jr.addEventListener(e,"focus",function(){var e;(e=xn.WebTwainIdMap)&&jr.each(e,function(e,r){e&&e._OnPageFocus&&e._OnPageFocus()})}),jr.addEventListener(e,"blur",function(){se.bWin&&VG()}),r=e.document,jr.addEventListener(r,"visibilitychange",function(){se.bWin&&"hidden"==r.visibilityState&&VG()})),Dn.navInfo){o.n=4;break}return o.p=1,o.n=2,Vl();case 2:Dn.navInfo=o.v,o.n=4;break;case 3:o.p=3,o.v;case 4:if(!1!==xn.AutoLoad&&!Zu.bDWTLoading){o.n=5;break}return o.a(2);case 5:return o.p=5,o.p=6,o.n=7,UG();case 7:o.n=9;break;case 8:throw o.p=8,Ym(n=o.v),n;case 9:if(!(xn.Containers&&xn.Containers.length>0&&xn.AutoLoad)){o.n=10;break}return o.n=10,xn.Load();case 10:o.n=15;break;case 11:return o.p=11,i=o.v,Zm(t=i.code)||Xm(t)||On.detect.bOK||sm.pushToDo(null,xn.Load),o.p=12,o.n=13,Yz();case 13:o.n=15;break;case 14:o.p=14,o.v;case 15:return o.a(2)}},TK,null,[[12,14],[6,8],[5,11],[1,3]])}))),xn.RemoveAllAuthorizations=function(){var e=nc.item("DWT_port"),r="http://";return"true"==nc.item("DWT_ssl")&&(r="https://"),wp({method:"GET",xhrFields:{withCredentials:!0},url:[r,ym(),":",e,"/dwt/",js.getDWTPrefix(),Qu.getServerVersionInfo(),"/RemoveAllAuthorizations?t=",jr.now()].join(""),async:!0}),!0};var eK,rK,tK,nK,iK,oK,aK,sK={Errors:{FilePathSyntaxIncorrect:function(e){e._errorCode=-3123,e._errorString="The filename, directory name, or volume label syntax is incorrect."}},checkFilePath:function(e,r){return jr.isString(r)&&0!=r.length?!(jr.startsWith(r,"http://")||jr.startsWith(r,"https://")||jr.startsWith(r,"ftp://"))||(On.File.Errors.FilePathSyntaxIncorrect(e),!1):(tg(e),!1)}};function uK(e,r,t,n){var i,o,a=[ih(),"/LoadZipFromBytes?type=",4,"&dsver=",nh().join(""),"&ts=",jr.now()].join(""),s=il(undefined,r);ac(o={},ym());var u=null!==(i=xn.Token)&&void 0!==i?i:"";u&&(o.headers||(o.headers={}),o.headers.Authorization="Bearer "+u),s.request(e,a,o,3e4).then(t,function(e){jr.isFunction(n)&&n(e)})}function cK(e,r,t){if(jr.isString(e)&&""!=e){Ap(e,{mode:"cors",dataType:"arraybuffer"}).then(function(e){uK(e,!1,function(e){var n;try{var i=On.parse(e);i.description&&(n={code:i.exception,message:i.description})}catch(a){var o;$g(o={}),o=bm(o)}n?On.isFunction(t)&&t(n):(xn.CheckCertExpired=!1,jr.isFunction(r)&&r())},function(n){Js()?uK(e,!0,r,t):jr.isFunction(t)&&t(n)})},t)}else jr.isFunction(t)&&t()}sK.checkFolder=sK.checkFilePath,On.File=sK,On.showProgress=function(){},On.closeProgress=function(){},xn.__innerCheckCertDate=function(e){cc(e)&&(jr.isFunction(Dn.OnCertExpired)&&Dn.OnCertExpired(e),setTimeout(function(){cK(xn.CertificateConfig.URL,Dn.OnUpdateCertSuccess,Dn.OnUpdateCertFailure)},5e3))},xn.__innerReboot=function(e,r){var t,n,i=[ih(),"/admin?ts=",jr.now()].join(""),o='{"id":"'+(new Date).getTime().toString()+'","method":"Reboot","parameter":[],"version":"dwasm2_'+oh()+'"}',a=il();ac(n={},ym());var s=null!==(t=xn.Token)&&void 0!==t?t:"";s&&(n.headers||(n.headers={}),n.headers.Authorization="Bearer "+s),a.request(o,i,n,3e4).then(e,r)},On.timestamp="?t=20261015100910",On.detect.showMask=jl,On.detect.hideMask=Hl,On.ClientPool=os,On.License=jv,On.BIO=gd,On.UI.ImageUIView=pG,On.UI.ImageManager=LH,On.domReady=hf,On.env=Yv,On.hostnameIsLNAPublic=fu,On.queryLNAPermission=su,jr.mix(On,Cs),jr.mix(xn,_m),xn.ServiceInstallerLocation&&(Im=!0,On.product.refServiceInstallerLocation=jr.trim(xn.ServiceInstallerLocation)),xn.ResourcesPath&&(On.product.refResourcesPath=jr.trim(xn.ResourcesPath)),Object.defineProperty(xn,"ServiceInstallerLocation",{get:function(){return On.product.refServiceInstallerLocation||Yu(),On.product.refServiceInstallerLocation},set:function(e){e=jr.trim(e),Im=!0,On.product.refServiceInstallerLocation=e},enumerable:!0,configurable:!1}),Object.defineProperty(xn,"ResourcesPath",{get:function(){return On.product.refResourcesPath?On.product.refResourcesPath:Xu()},set:function(e){e=jr.trim(e),On.product.refResourcesPath=e,Im||(On.product.refServiceInstallerLocation=undefined)},enumerable:!0,configurable:!1}),xn.UpdateCert=cK,eK=[zd,Kd,Jd,Qd],rK=[Md,Ld,Bd,Ud],tK=[Vd,jd,Hd,Gd],nK=document.location.protocol,iK=location.hostname,oK=Ks(iK),aK={detect:{ssl:oK,dcpStatus:0,dcpCallbackType:0,arySTwains:[],isFirst:!0,isOK:!1,hasDialog:!1,cssLoaded:!1,viewerScriptLoaded:!1,hasNoControlEvent:!1,needsUpgradeEvent:!1,shouldPromptJSOrServerOutdated:!1,detectType:oK?1:"http:"===nK||""===iK?0:-1,tryTimes:0,ports:[{port:xn.SSLPort,ssl:!0},{port:xn.Port,ssl:!1}],currentUrlIndex:0,urls:[],onNoControl:!1,needUpgrade:!1,OnDetectNext:!1,OnCreatWS:!1,isMaskShown:!1},page:{isUnload:!1}},jr.mix(On,aK),On.Addon_Events||(On.Addon_Events=[]),On.Addon_Sendback_Events||(On.Addon_Sendback_Events=[]),On.install={_divDWTNonInstallContainerID:"dwt-NonInstallContainerID",_divDWTemessageContainer:"",_dlgInstall:!1},On.install._strNonInstallDIV=['<div style="text-align:center;" id="',On.install._divDWTNonInstallContainerID,'"></div>'].join(""),On.updateCloseTimer=ef,On.ShowLicenseDialog=xn.ShowMessage,On.createLoadingBarContent=function(){},function(e,r,t){if(e&&jr.isArray(e)&&4===e.length&&r&&jr.isArray(r)&&4===r.length&&t&&jr.isArray(t)&&4===t.length){var n=e.join(","),i=r.join(""),o=t.join(",");!function(e,r,t){var n,i=e[0],o=e[1],a=e[2];js.setMajorVersion(i),n="0"==a.toLowerCase()?"Dynamic Web TWAIN "+[i,o].join("."):"Dynamic Web TWAIN "+[i,o,a].join(".");var s=e.join(","),u=r.join(",");t.join(",");var c={ProductName:n,Containers:undefined,ContainerMap:{},WebTwainIdMap:{},RemoteScanIdMap:{},Trial:!1,ResourcesPath:gf,ServiceInstallerLocation:undefined,Debug:!1,IfUpdateService:!1,AutoLoad:!0,ReConnectToService:!0,OnWebTwainReady:!1,OnWebTwainError:vf,OnWebTwainNotFound:!1,OnWebTwainOldPluginNotAllowed:!1,OnWebTwainNeedUpgrade:!1,OnWebTwainNeedUpgradeWebJavascript:!1,OnWebTwainInitMessage:!1,ViewerJSIntegerited:!0,ActiveXInstallWithCAB:!1,IfUseActiveXForIE10Plus:!1,IfUseEmbeddedDownloadNoticeForActiveX:!1,IfCheckDCP:!1,IfDisableDefaultSettings:!1,OnWebTwainWillInit:!1,IfAddMD5InUploadHeader:!1,IfAlwaysFocusOnPopupWindow:!0,IfConfineMaskWithinTheViewer:!1,fetchOptions:{mode:"cors",credentials:"same-origin"},HideTrialMessage:!1,CheckCertExpired:!0,ConnectWithSocket:!1,SSLPort:18623,Port:18622,showLoadingMsgDialog:!0,licenseServer:undefined,sessionPassword:undefined,organizationID:undefined,handshakeCode:undefined,UseDefaultViewer:!0,Host:js.localIP,DeviceFriendlyName:"",LocalHosts:["127.0.0.1","localhost","local.dynamsoft.com"],IfCheckCORS:!1,IfCheckCert:!0,IfChromeExtension:!1,IfLoadResources:!0,IfResourcesAddTimestamp:!0,IfCheckCssFiles:!0,AutoCheckConnection:!1,EnableLocalNetworkMixedContent:!1,EnableFirefoxLNAPermission:!0,CustomizableDisplayInfo:ds(),JSVersion:s,ServerVersionInfo:u,ServerLinuxVersionInfo:u,ServerMacVersionInfo:u};jr.mixOwnProperties(xn,c)}(e,r,t),pf(),Qu.getServerVersionInfo=function(){return i},Qu.getServerVersionForCompareCompitable=function(){return o},Qu.getJSVersion=function(){return n},Qu.getManagerVer=function(){return i},Qu.getDdmModuleNameVerPath=function(){return"ddm/ddm_".concat(i)},Qu.getDdm_ManagerVer=function(){return"ddm_".concat(i)}}On.detect.onNoControl=_f}(eK,rK,tK),On.ProgressBar=Ff,On.progressMessage="",On.dialogShowStatus=!1,On.needShowTwiceShowDialog=!1,On.dlgProgress=!1,On.cancelFrom=St.Other,On.dlgRef=0,On.initProgress=xf,On.unloadProgress=Of,On.hideProgress=Rf,On.showProgress=Wf,On.closeProgress=Mf,On.progressBarOnPercentDone=Uf,On.showProgressMsg=function(){},On.progressContext=Df}();

}

Dynamsoft.DWT.bNpm=true;Dynamsoft.DWT.dbrCanvasMaxWH=4096;
Dynamsoft.aryAddonReadyFun=[];Dynamsoft.AddonReady=function(fn){Dynamsoft.aryAddonReadyFun.push(fn);};
/*! 20261015101011
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*
* Module: BarcodeReader
* Version: 19.5
* 
*/
var Dynamsoft=self.Dynamsoft||{};Dynamsoft.DWT=Dynamsoft.DWT||{},Dynamsoft.DBR=Dynamsoft.DBR||{},Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[],Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(e){Dynamsoft.aryAddonReadyFun.push(e)},function(){Dynamsoft.BarcodeReaderAddon=Dynamsoft.BarcodeReaderAddon||{};var n=Dynamsoft.BarcodeReaderAddon;n.Version="9.6.3.0410",n._decoding=!1,n._decodeQueue=[],n._decodeNext=function(){var e,t;0==n._decodeQueue.length?n._decoding=!1:(e=(t=n._decodeQueue[0]).method,t=t.args,n._decodeQueue.splice(0,1),e.apply(null,t))},n._defaultRuntimeSettingsStr="",n._defaultTemplateStr="",n._activeXInstance=!1,n.BarcodeReaderException=function(){var e=arguments[0],t=Dynamsoft.DBR.EnumErrorCode.DBR_UNKNOWN,e="number"==typeof e?(t=e,new Error(arguments[1])):new Error(e);return e.code=t,e},n.RemoveNonPrintableChar=function(e){return Dynamsoft.Lib.isString(e)?e.replace(/[^\x20-\x7E]|(\\")/g,""):e},n.errors={webcamNotInstalled:"The Webcam add-on not installed.",nonServiceNotSupportWebcamDecode:"The BarcodeReader add-on does not support reading barcodes from video streams.",decodeResultEmpty:"decode result is empty.",ServiceEditionNotSupportDbr:"The BarcodeReader add-on does not support your Operating System.",ServiceEditionNotSupportWasmMode:"You cannot call this method on this WebTwain instance."},n._activeXMaxIEVersion=9,n.logLevel=3,Dynamsoft.DBR.EnumAccompanyingTextRecognitionMode={ATRM_GENERAL:1,ATRM_SKIP:0},Dynamsoft.DBR.EnumBarcodeColourMode={BICM_DARK_ON_LIGHT:1,BICM_LIGHT_ON_DARK:2,BICM_DARK_ON_DARK:4,BICM_LIGHT_ON_LIGHT:8,BICM_DARK_LIGHT_MIXED:16,BICM_DARK_ON_LIGHT_DARK_SURROUNDING:32,BICM_SKIP:0},Dynamsoft.DBR.EnumBarcodeComplementMode={BCM_AUTO:1,BCM_GENERAL:2,BCM_SKIP:0},Dynamsoft.DBR.EnumBarcodeFormat={BF_ALL:-32505857,BF_ONED:2047,BF_GS1_DATABAR:260096,BF_CODE_39:1,BF_CODE_128:2,BF_CODE_93:4,BF_CODABAR:8,BF_ITF:16,BF_EAN_13:32,BF_EAN_8:64,BF_UPC_A:128,BF_UPC_E:256,BF_INDUSTRIAL_25:512,BF_CODE_39_EXTENDED:1024,BF_GS1_DATABAR_OMNIDIRECTIONAL:2048,BF_GS1_DATABAR_TRUNCATED:4096,BF_GS1_DATABAR_STACKED:8192,BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:16384,BF_GS1_DATABAR_EXPANDED:32768,BF_GS1_DATABAR_EXPANDED_STACKED:65536,BF_GS1_DATABAR_LIMITED:131072,BF_PATCHCODE:262144,BF_PDF417:33554432,BF_QR_CODE:67108864,BF_DATAMATRIX:134217728,BF_AZTEC:268435456,BF_MAXICODE:536870912,BF_MICRO_QR:1073741824,BF_MICRO_PDF417:524288,BF_GS1_COMPOSITE:-2147483648,BF_NULL:0},Dynamsoft.DBR.EnumBarcodeFormat_2={BF2_NULL:0,BF2_POSTALCODE:32505856,BF2_NONSTANDARD_BARCODE:1,BF2_USPSINTELLIGENTMAIL:1048576,BF2_POSTNET:2097152,BF2_PLANET:4194304,BF2_AUSTRALIANPOST:8388608,BF2_RM4SCC:16777216,BF2_DOTCODE:2},Dynamsoft.DBR.EnumBinarizationMode={BM_AUTO:1,BM_LOCAL_BLOCK:2,BM_SKIP:0},Dynamsoft.DBR.EnumClarityCalculationMethod={ECCM_CONTRAST:1},Dynamsoft.DBR.EnumClarityFilterMode={CFM_GENERAL:1},Dynamsoft.DBR.EnumColourClusteringMode={CCM_AUTO:1,CCM_GENERAL_HSV:2,CCM_SKIP:0},Dynamsoft.DBR.EnumColourConversionMode={CICM_GENERAL:1,CICM_SKIP:0},Dynamsoft.DBR.EnumConflictMode={CM_IGNORE:1,CM_OVERWRITE:2},Dynamsoft.DBR.EnumDeformationResistingMode={DRM_AUTO:1,DRM_GENERAL:2,DRM_SKIP:0},Dynamsoft.DBR.EnumDPMCodeReadingMode={DPMCRM_AUTO:1,DPMCRM_GENERAL:2,DPMCRM_SKIP:0},Dynamsoft.DBR.EnumErrorCode={DBR_SYSTEM_EXCEPTION:1,DBR_SUCCESS:0,DBR_UNKNOWN:-1e4,DBR_NO_MEMORY:-10001,DBR_NULL_REFERENCE:-10002,DBR_LICENSE_INVALID:-10003,DBR_LICENSE_EXPIRED:-10004,DBR_FILE_NOT_FOUND:-10005,DBR_FILETYPE_NOT_SUPPORTED:-10006,DBR_BPP_NOT_SUPPORTED:-10007,DBR_INDEX_INVALID:-10008,DBR_BARCODE_FORMAT_INVALID:-10009,DBR_CUSTOM_REGION_INVALID:-10010,DBR_MAX_BARCODE_NUMBER_INVALID:-10011,DBR_IMAGE_READ_FAILED:-10012,DBR_TIFF_READ_FAILED:-10013,DBR_QR_LICENSE_INVALID:-10016,DBR_1D_LICENSE_INVALID:-10017,DBR_DIB_BUFFER_INVALID:-10018,DBR_PDF417_LICENSE_INVALID:-10019,DBR_DATAMATRIX_LICENSE_INVALID:-10020,DBR_PDF_READ_FAILED:-10021,DBR_PDF_DLL_MISSING:-10022,DBR_PAGE_NUMBER_INVALID:-10023,DBR_CUSTOM_SIZE_INVALID:-10024,DBR_CUSTOM_MODULESIZE_INVALID:-10025,DBR_RECOGNITION_TIMEOUT:-10026,DBR_JSON_PARSE_FAILED:-10030,DBR_JSON_TYPE_INVALID:-10031,DBR_JSON_KEY_INVALID:-10032,DBR_JSON_VALUE_INVALID:-10033,DBR_JSON_NAME_KEY_MISSING:-10034,DBR_JSON_NAME_VALUE_DUPLICATED:-10035,DBR_TEMPLATE_NAME_INVALID:-10036,DBR_JSON_NAME_REFERENCE_INVALID:-10037,DBR_PARAMETER_VALUE_INVALID:-10038,DBR_DOMAIN_NOT_MATCHED:-10039,DBR_RESERVEDINFO_NOT_MATCHED:-10040,DBR_AZTEC_LICENSE_INVALID:-10041,DBR_LICENSE_DLL_MISSING:-10042,DBR_LICENSEKEY_NOT_MATCHED:-10043,DBR_REQUESTED_FAILED:-10044,DBR_LICENSE_INIT_FAILED:-10045,DBR_PATCHCODE_LICENSE_INVALID:-10046,DBR_POSTALCODE_LICENSE_INVALID:-10047,DBR_DPM_LICENSE_INVALID:-10048,DBR_FRAME_DECODING_THREAD_EXISTS:-10049,DBR_STOP_DECODING_THREAD_FAILED:-10050,DBR_SET_MODE_ARGUMENT_ERROR:-10051,DBR_LICENSE_CONTENT_INVALID:-10052,DBR_LICENSE_KEY_INVALID:-10053,DBR_LICENSE_DEVICE_RUNS_OUT:-10054,DBR_GET_MODE_ARGUMENT_ERROR:-10055,DBR_IRT_LICENSE_INVALID:-10056,DBR_MAXICODE_LICENSE_INVALID:-10057,DBR_GS1_DATABAR_LICENSE_INVALID:-10058,DBR_GS1_COMPOSITE_LICENSE_INVALID:-10059,DBR_DOTCODE_LICENSE_INVALID:-10061,DMERR_FAILED_TO_REACH_LTS:-20200},Dynamsoft.DBR.EnumGrayscaleTransformationMode={GTM_INVERTED:1,GTM_ORIGINAL:2,GTM_SKIP:0},Dynamsoft.DBR.EnumImagePixelFormat={IPF_Binary:0,IPF_BinaryInverted:1,IPF_GrayScaled:2,IPF_NV21:3,IPF_RGB_565:4,IPF_RGB_555:5,IPF_RGB_888:6,IPF_ARGB_8888:7,IPF_RGB_161616:8,IPF_ARGB_16161616:9,IPF_ABGR_8888:10,IPF_ABGR_16161616:11,IPF_BGR_888:12},Dynamsoft.DBR.EnumImagePreprocessingMode={IPM_AUTO:1,IPM_GENERAL:2,IPM_GRAY_EQUALIZE:4,IPM_GRAY_SMOOTH:8,IPM_SHARPEN_SMOOTH:16,IPM_MORPHOLOGY:32,IPM_SKIP:0},Dynamsoft.DBR.EnumIMResultDataType={IMRDT_IMAGE:1,IMRDT_CONTOUR:2,IMRDT_LINESEGMENT:4,IMRDT_LOCALIZATIONRESULT:8,IMRDT_REGIONOFINTEREST:16,IMRDT_QUADRILATERAL:32},Dynamsoft.DBR.EnumIntermediateResultSavingMode={IRSM_MEMORY:1,IRSM_FILESYSTEM:2,IRSM_BOTH:4},Dynamsoft.DBR.EnumIntermediateResultType={IRT_NO_RESULT:0,IRT_ORIGINAL_IMAGE:1,IRT_COLOUR_CLUSTERED_IMAGE:2,IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE:4,IRT_TRANSFORMED_GRAYSCALE_IMAGE:8,IRT_PREDETECTED_REGION:16,IRT_PREPROCESSED_IMAGE:32,IRT_BINARIZED_IMAGE:64,IRT_TEXT_ZONE:128,IRT_CONTOUR:256,IRT_LINE_SEGMENT:512,IRT_FORM:1024,IRT_SEGMENTATION_BLOCK:2048,IRT_TYPED_BARCODE_ZONE:4096,IRT_PREDETECTED_QUADRILATERAL:8192},Dynamsoft.DBR.EnumLocalizationMode={LM_SKIP:0,LM_AUTO:1,LM_CONNECTED_BLOCKS:2,LM_LINES:8,LM_STATISTICS:4,LM_SCAN_DIRECTLY:16,LM_STATISTICS_MARKS:32,LM_STATISTICS_POSTAL_CODE:64},Dynamsoft.DBR.EnumPDFReadingMode={PDFRM_RASTER:1,PDFRM_AUTO:2,PDFRM_VECTOR:4},Dynamsoft.DBR.EnumQRCodeErrorCorrectionLevel={QRECL_ERROR_CORRECTION_H:0,QRECL_ERROR_CORRECTION_L:1,QRECL_ERROR_CORRECTION_M:2,QRECL_ERROR_CORRECTION_Q:3},Dynamsoft.DBR.EnumRegionPredetectionMode={RPM_AUTO:1,RPM_GENERAL:2,RPM_GENERAL_RGB_CONTRAST:4,RPM_GENERAL_GRAY_CONTRAST:8,RPM_GENERAL_HSV_CONTRAST:16,RPM_SKIP:0},Dynamsoft.DBR.EnumResultCoordinateType={RCT_PIXEL:1,RCT_PERCENTAGE:2},Dynamsoft.DBR.EnumResultType={RT_STANDARD_TEXT:0,RT_RAW_TEXT:1,RT_CANDIDATE_TEXT:2,RT_PARTIAL_TEXT:3},Dynamsoft.DBR.EnumScaleUpMode={SUM_AUTO:1,SUM_LINEAR_INTERPOLATION:2,SUM_NEAREST_NEIGHBOUR_INTERPOLATION:4,SUM_SKIP:0},Dynamsoft.DBR.EnumTerminatePhase={TP_REGION_PREDETECTED:1,TP_IMAGE_PREPROCESSED:2,TP_IMAGE_BINARIZED:4,TP_BARCODE_LOCALIZED:8,TP_BARCODE_TYPE_DETERMINED:16,TP_BARCODE_RECOGNIZED:32},Dynamsoft.DBR.EnumTextAssistedCorrectionMode={TACM_AUTO:1,TACM_VERIFYING:2,TACM_VERIFYING_PATCHING:4,TACM_SKIP:0},Dynamsoft.DBR.EnumTextFilterMode={TFM_AUTO:1,TFM_GENERAL_CONTOUR:2,TFM_SKIP:0},Dynamsoft.DBR.EnumTextResultOrderMode={TROM_CONFIDENCE:1,TROM_POSITION:2,TROM_FORMAT:4,TROM_SKIP:0},Dynamsoft.DBR.EnumTextureDetectionMode={TDM_AUTO:1,TDM_GENERAL_WIDTH_CONCENTRATION:2,TDM_SKIP:0}}(),Dynamsoft.AddonReady(function(u,e){var t,E=Dynamsoft.BarcodeReaderAddon;function D(e){return e&&e instanceof ArrayBuffer}E.Class=function(){function e(e){this._runtimeSettings=null,this._initSettingsContent=null,this._tplContentArr=[],this._stwain=e}var T;e.prototype._decodeBlob=function(t,e){var n=this;return new u.Promise(function(e){if(!(t instanceof Blob))throw TypeError("'_decodeBlob(blob, templateName)': Type of 'blob' should be 'Blob'.");e()}).then(function(){return n._innerDecode(0,t,e)})},e.prototype._decodeArrayBuffer=function(t,e){var n=this;return new u.Promise(function(e){if(!(t instanceof ArrayBuffer))throw TypeError("'_decodeBlob(arrayBuffer, templateName)': Type of 'arrayBuffer' should be 'ArrayBuffer'.");e()}).then(function(){return n._innerDecode(0,t,e)})},e.prototype._decodeUint8Array=function(t,e){var n=this;return new u.Promise(function(e){if(!(t instanceof Uint8Array||self.Uint8ClampedArray&&t instanceof Uint8ClampedArray))throw TypeError("'_decodeBlob(uint8Array, templateName)': Type of 'uint8Array' should be 'Uint8Array'.");e()}).then(function(){return n._innerDecode(0,t,e)})},e.prototype._decodeImage=function(t,n){var o=this;return new u.Promise(function(e){if(!(t instanceof HTMLImageElement))throw TypeError("'_decodeImage(image, templateName)': Type of 'image' should be 'HTMLImageElement'.");if(t.crossOrigin&&"anonymous"!=t.crossOrigin)throw"cors";n=n||"",e()}).then(function(){return"data:image/"==t.src.substring(0,11)?o._decodeBase64(t.src,n):o._decodeUrl(t.src,n).catch(function(e){return 3<=E.logLevel&&console&&console.warn&&(console.warn("'_decodeImage(image, templateName)': Image src not available. Use '_decodeCanvas' instead."),console.warn(e)),self.HTMLCanvasElement?((e=document.createElement("canvas")).width=t.naturalWidth,e.height=t.naturalHeight,e.getContext("2d").drawImage(t,0,0),o._decodeCanvas(e,n)):u.Promise.reject(Error("'_decodeImage(image, templateName)': Browser not support HTMLCanvasElement."))})})},e.prototype._decodeCanvas=function(n,o){var t=this;return new u.Promise(function(t){if(!(n instanceof HTMLCanvasElement))throw TypeError("'_decodeCanvas(canvas, templateName)': Type of 'canvas' should be 'HTMLCanvasElement'.");if(n.crossOrigin&&"anonymous"!=n.crossOrigin)throw"cors";o=o||"",n.toBlob?n.toBlob(function(e){t(e)}):n.msToBlob?n.msToBlob(function(e){t(e)}):t(n.toDataURL())}).then(function(e){return n.toBlob||n.msToBlob?t._decodeBlob(e,o):t._decodeBase64(e,o)})},e.prototype._decodeVideo=function(_){var s,t=this,c=arguments;return new u.Promise(function(e){if(!(_ instanceof HTMLVideoElement))throw TypeError("'_decodeVideo(video [ [, sx, sy, sWidth, sHeight], dWidth, dHeight] [, templateName] )': Type of 'video' should be 'HTMLVideoElement'.");if(_.crossOrigin&&"anonymous"!=_.crossOrigin)throw"cors";c.length<=2?(t=n=0,o=i=_.videoWidth,r=a=_.videoHeight):a=c.length<=4?(t=n=0,o=_.videoWidth,r=_.videoHeight,i=c[1],c[2]):(t=c[1],n=c[2],o=c[3],r=c[4],i=c[5],c[6]),s="string"==typeof c[c.length-1]?c[c.length-1]:"";var t,n,o,r,i,a,d=document.createElement("canvas");d.width=i,d.height=a,d.getContext("2d").drawImage(_,t,n,o,r,0,0,i,a),e(d)}).then(function(e){return t._decodeCanvas(e,s)})},e.prototype._decodeBase64=e.prototype.decodeBase64String=function(t,e){var n=this;return new u.Promise(function(e){if(!("string"==typeof t||"object"==typeof t&&t instanceof String))throw TypeError("'decodeBase64(base64Str, templateName)': Type of 'base64Str' should be 'String'.");"data:image/"==t.substring(0,11)&&(t=t.substring(t.indexOf(",")+1)),e()}).then(function(){return n._innerDecode(1,t,e)})},e.prototype._decodeUrl=function(o,r){var t=this;return o&&o.indexOf&&(0==o.indexOf("dwt://")||0==o.indexOf("dcs://"))?t._decodeDynamsoftServiceInnerUrl(o,r):new u.Promise(function(e,t){var n;if(!("string"==typeof o||"object"==typeof o&&o instanceof String))throw TypeError("'_decodeUrl(url, templateName)': Type of 'url' should be 'String'.");r=r||"",E._activeXInstance?((n=new ActiveXObject("MSXML2.XMLHTTP")).open("GET",o,!0),n.overrideMimeType?n.overrideMimeType("text/plain; charset=x-user-defined"):n.setRequestHeader("Accept-Charset","x-user-defined"),n.onreadystatechange=function(){4==n.readyState&&e(new VBArray(n.responseBody).toArray())},n.send("")):((n=new XMLHttpRequest).open("GET",o,!0),n.responseType="arraybuffer",n.send(),n.onloadend=function(){e(this.response)},n.onerror=function(){t(Error(n.error))})}).then(function(e){return E._activeXInstance?t._activeXDecodeArray(e,r):t._decodeArrayBuffer(e,r)})},e.prototype._decodeDynamsoftServiceInnerUrl=function(t,e){var n=this;return new u.Promise(function(e){if(!("string"==typeof t||"object"==typeof t&&t instanceof String))throw TypeError("'_decodeUrl(url, templateName)': Type of 'innerUrl' should be 'String'.");if(0!=t.indexOf("dwt://")&&0!=t.indexOf("dcs://"))throw TypeError("'_decodeDynamsoftServiceInnerUrl(innerUrl, templateName)': 'innerUrl' should start with 'dwt://' or 'dcs://'.");e()}).then(function(){return n._innerDecode(4e3,t,e)})},e.prototype._activeXDecodeArray=function(n,o){var t=this;return new u.Promise(function(e,t){if(!(n instanceof Array))throw TypeError("'_activeXDecodeArray(array, templateName)': Type of 'array' should be 'Array'.");o=o||"";try{e(Dynamsoft.Lib.btoa(String.fromCharCode.apply(String,n)))}catch(e){t(e)}}).then(function(e){return t._decodeBase64(e,o)})},e.prototype._activeXDecodeHandle=function(e,t){var n=this;return new u.Promise(function(e){t=t||"",e()}).then(function(){return n._innerDecode(4001,e,t)})},e.prototype._decode=e.prototype.decode=function(e,t){return E._activeXInstance?"string"==typeof e||e instanceof String?this._activeXDecodeHandle(e,t):u.Promise.reject(TypeError("'_decode(source, templateName)' in activeX: Type of 'source' should be 'String(partUrl)'.")):self.Blob&&e instanceof Blob?this._decodeBlob(e,t):self.ArrayBuffer&&e instanceof ArrayBuffer?this._decodeArrayBuffer(e,t):self.Uint8Array&&e instanceof Uint8Array||self.Uint8ClampedArray&&e instanceof Uint8ClampedArray?this._decodeUint8Array(e,t):e instanceof Array?this._activeXDecodeArray(e,t):self.HTMLImageElement&&e instanceof HTMLImageElement?this._decodeImage(e,t):self.HTMLCanvasElement&&e instanceof HTMLCanvasElement?this._decodeCanvas(e,t):self.HTMLVideoElement&&e instanceof HTMLVideoElement?this._decodeVideo(e,t):isNaN(e)?"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?this._decodeBase64(e,t):this._decodeUrl(e,t):u.Promise.reject(TypeError("'_decode(source, templateName)' in H5: Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'.")):this._activeXDecodeHandle(e,t)},e.prototype._innerServiceCmd=function(r,i){var a=this._stwain;return new u.Promise(function(t,n){var e,o={method:"ReadBarcode",parameter:[Dynamsoft.Lib.product.refProductKey,4002,"",""],updateSettings:r,initSettingsContent:i};E._activeXInstance?t(E._activeXInstance.Process(u.stringify(o),location.protocol+"//"+location.host)):(a._blts?(e="",a&&a._bRemoteMode&&a._dmService&&a._dmService.attrs&&a._dmService.attrs.UUID&&(e=a._dmService.attrs.UUID),Dynamsoft.DWT.lglic(Dynamsoft.DWT.EnumInstance.dwt_desktop,e).then(function(e){return o.parameter.push(e.ar),o.parameter.push(e.cu),o.parameter.push(0),o.parameter.push(""),u.stringify(o)})):u.Promise.resolve(u.stringify(o))).then(function(e){e={mode:"cors",method:"post",body:e,dataType:"arrayBuffer"};return Dynamsoft.DWT.Token&&(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+Dynamsoft.DWT.Token),u.fetch(a._dbrUrlRoot+"ReadBarcode",e)}).then(function(e){D(e)?t(String.fromCharCode.apply(null,new Uint8Array(e))):t(e)},function(e){var t="Init template & runtimeSettings failed.";e&&(t=[t," Http info: ",e.errorString," (",e.httpCode,")"].join("")),n(t)})})},e.prototype._innerDecode=function(i,a,d,_){var R=this;return R._runtimeSettings&&0==R._runtimeSettings.expectedBarcodesCount&&(R._runtimeSettings.expectedBarcodesCount=512),new u.Promise(function(s,c){function o(e,t,n){try{var o,r,i,a,d=T&&T(e);for(d&&d.textResults||c(new E.BarcodeReaderException(d.exception,d.description)),u.product.bHTML5Edition&&n&&n.config.data&&(o=u.parse(n.config.data),u.isArray(o.parameter))&&2<o.parameter.length&&4e3==o.parameter[1]&&(4<o.parameter.length&&o.parameter[4]?d.textResults.imageid=o.parameter[4]:0<=(a=(i=o.parameter[2]).indexOf("&index="))&&(d.textResults.imageid=i.substring(a+7,i.indexOf("&t=")))),r=0;r<d.textResults.length;r++){var _=d.textResults[r];_.BarcodeText=_.barcodeText,d.exception!=Dynamsoft.DBR.EnumErrorCode.DBR_SUCCESS&&(_.exception=d.exception)}d.exception!=Dynamsoft.DBR.EnumErrorCode.DBR_SUCCESS&&(d.textResults.exception=d.exception,d.textResults.description=d.description),E._activeXInstance&&d.records&&(Dynamsoft.Lib.each(d.records,function(e,t){Dynamsoft.DWT.lavrf(t,e,Dynamsoft.DWT.EnumInstance.dwt_desktop)}),Dynamsoft.DWT.lavrf_(1,Dynamsoft.DWT.EnumInstance.dwt_desktop)),s(d.textResults)}catch(e){c(e)}}var t,e,n={method:"ReadBarcode",parameter:[Dynamsoft.Lib.product.refProductKey,i,0!=i?a:null,d||""],updateSettings:R._runtimeSettings,conflictMode:1==R.conflictMode?"ignore":"overwrite",initSettingsContent:R._initSettingsContent,tplContent:function(){if(d)for(var e=0;e<R._tplContentArr.length;++e)if(d==R._tplContentArr[e].ImageParameter.Name)return u.stringify(R._tplContentArr[e]);return null}()},r=R._stwain;E._activeXInstance?r._blts?Dynamsoft.DWT.lglic(Dynamsoft.DWT.EnumInstance.dwt_desktop,"").then(function(e){n.parameter.push(e.ar),n.parameter.push(e.cu),n.parameter.push(0),n.parameter.push(""),o(E._activeXInstance.Process(u.stringify(n),location.protocol+"//"+location.host))}):o(E._activeXInstance.Process(u.stringify(n),location.protocol+"//"+location.host)):(t=r._dbrUrlRoot+"ReadBarcode",0==i&&(t+="/LoadZipFromBytes?cmd="+encodeURIComponent(u.stringify(n))),(0==i?u.Promise.resolve(a):r._blts?(e="",r&&r._bRemoteMode&&r._dmService&&r._dmService.attrs&&r._dmService.attrs.UUID&&(e=r._dmService.attrs.UUID),Dynamsoft.DWT.lglic(Dynamsoft.DWT.EnumInstance.dwt_desktop,e).then(function(e){return n.parameter.push(e.ar),n.parameter.push(e.cu),n.parameter.push(0),n.parameter.push([u.product.getDWTPrefix(),u.product.getServerVersionInfo(),"/verify?id=",_,"&t=",u.getRandom()].join("")),u.stringify(n)})):u.Promise.resolve(u.stringify(n))).then(function(e){e={mode:"cors",method:"post",body:e,dataType:"arrayBuffer"};return Dynamsoft.DWT.Token&&(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+Dynamsoft.DWT.Token),u.fetch(t,e)}).then(function(e,t,n){D(e)?o(String.fromCharCode.apply(null,new Uint8Array(e)),0,n):o(e,0,n)},function(e){var t="ReadBarcode request fail.";e&&(t=[t," Http info: ",e.errorString," (",e.httpCode,")"].join("")),c(Error(t))}))})},T=E._handleRetJsonString=function(t){var n;if("string"==typeof t||"object"==typeof t&&t instanceof String)try{n=u.parse(t)}catch(e){n=u.parse(E.RemoveNonPrintableChar(t))}else n=t;if(!n)throw E.BarcodeReaderException(Dynamsoft.DBR.EnumErrorCode.DBR_UNKNOWN,E.errors.decodeResultEmpty);if("textResults"in n&&u.isArray(n.textResults)||n.exception==Dynamsoft.DBR.EnumErrorCode.DBR_SUCCESS)return n;throw E.BarcodeReaderException(n.exception,n.description)},e.prototype.getAllParameterTemplateNames=function(){for(var e=[],t=0;t<this._tplContentArr.length;++t)e.push(this._tplContentArr[t].ImageParameter.Name);return e},e.prototype.getRuntimeSettings=function(){return this._runtimeSettings||(this._runtimeSettings=u.parse(E._defaultRuntimeSettingsStr)),u.Promise.resolve(this._runtimeSettings)};return e.prototype.updateRuntimeSettings=function(e){var t,n=this;if("string"==typeof e||"object"==typeof e&&e instanceof String){if("speed"==e||"balance"==e||"coverage"==e||"default"==e)return n.initRuntimeSettingsWithString("speed"==e?'{"ImageParameter":{"AccompanyingTextRecognitionModes":[{"Mode":"ATRM_SKIP"}],"BarcodeColourModes":[{"LightReflection":1,"Mode":"BICM_DARK_ON_LIGHT"}],"BarcodeComplementModes":[{"Mode":"BCM_SKIP"}],"BarcodeFormatIds":["BF_ALL"],"BarcodeFormatIds_2":["BF2_POSTALCODE","BF2_DOTCODE"],"BinarizationModes":[{"BlockSizeX":0,"BlockSizeY":0,"EnableFillBinaryVacancy":1,"ImagePreprocessingModesIndex":-1,"Mode":"BM_LOCAL_BLOCK","ThreshValueCoefficient":10}],"ColourClusteringModes":[{"Mode":"CCM_SKIP"}],"ColourConversionModes":[{"BlueChannelWeight":-1,"GreenChannelWeight":-1,"Mode":"CICM_GENERAL","RedChannelWeight":-1}],"DPMCodeReadingModes":[{"Mode":"DPMCRM_SKIP"}],"DeblurLevel":3,"DeformationResistingModes":[{"Mode":"DRM_SKIP"}],"Description":"","ExpectedBarcodesCount":512,"FormatSpecificationNameArray":null,"GrayscaleTransformationModes":[{"Mode":"GTM_ORIGINAL"}],"ImagePreprocessingModes":[{"Mode":"IPM_GENERAL"}],"IntermediateResultSavingMode":{"Mode":"IRSM_MEMORY"},"IntermediateResultTypes":["IRT_NO_RESULT"],"LocalizationModes":[{"Mode":"LM_CONNECTED_BLOCKS"},{"Mode":"LM_STATISTICS_MARKS"},{"Mode":"LM_STATISTICS_POSTAL_CODE"}],"MaxAlgorithmThreadCount":4,"Name":"bestSpeed","PDFRasterDPI":300,"PDFReadingMode":{"Mode":"PDFRM_AUTO"},"Pages":"","RegionDefinitionNameArray":null,"RegionPredetectionModes":[{"Mode":"RPM_GENERAL"}],"ResultCoordinateType":"RCT_PIXEL","ReturnBarcodeZoneClarity":0,"ScaleDownThreshold":2300,"ScaleUpModes":[{"Mode":"SUM_AUTO"}],"TerminatePhase":"TP_BARCODE_RECOGNIZED","TextAssistedCorrectionMode":{"BottomTextPercentageSize":0,"LeftTextPercentageSize":0,"Mode":"TACM_VERIFYING","RightTextPercentageSize":0,"TopTextPercentageSize":0},"TextFilterModes":[{"Mode":"TFM_SKIP"}],"TextResultOrderModes":[{"Mode":"TROM_CONFIDENCE"},{"Mode":"TROM_POSITION"},{"Mode":"TROM_FORMAT"}],"TextureDetectionModes":[{"Mode":"TDM_GENERAL_WIDTH_CONCENTRATION","Sensitivity":5}],"Timeout":10000},"Version":"3.0"}':"balance"==e?'{"ImageParameter":{"AccompanyingTextRecognitionModes":[{"Mode":"ATRM_SKIP"}],"BarcodeColourModes":[{"LightReflection":1,"Mode":"BICM_DARK_ON_LIGHT"}],"BarcodeComplementModes":[{"Mode":"BCM_SKIP"}],"BarcodeFormatIds":["BF_ALL"],"BarcodeFormatIds_2":["BF2_POSTALCODE","BF2_DOTCODE"],"BinarizationModes":[{"BlockSizeX":0,"BlockSizeY":0,"EnableFillBinaryVacancy":1,"ImagePreprocessingModesIndex":-1,"Mode":"BM_LOCAL_BLOCK","ThreshValueCoefficient":10}],"ColourClusteringModes":[{"Mode":"CCM_SKIP"}],"ColourConversionModes":[{"BlueChannelWeight":-1,"GreenChannelWeight":-1,"Mode":"CICM_GENERAL","RedChannelWeight":-1}],"DPMCodeReadingModes":[{"Mode":"DPMCRM_SKIP"}],"DeblurLevel":5,"DeformationResistingModes":[{"Mode":"DRM_SKIP"}],"Description":"","ExpectedBarcodesCount":512,"FormatSpecificationNameArray":null,"GrayscaleTransformationModes":[{"Mode":"GTM_ORIGINAL"}],"ImagePreprocessingModes":[{"Mode":"IPM_GENERAL"}],"IntermediateResultSavingMode":{"Mode":"IRSM_MEMORY"},"IntermediateResultTypes":["IRT_NO_RESULT"],"LocalizationModes":[{"Mode":"LM_CONNECTED_BLOCKS"},{"Mode":"LM_STATISTICS"},{"Mode":"LM_STATISTICS_MARKS"},{"Mode":"LM_STATISTICS_POSTAL_CODE"}],"MaxAlgorithmThreadCount":4,"Name":"balance","PDFRasterDPI":300,"PDFReadingMode":{"Mode":"PDFRM_AUTO"},"Pages":"","RegionDefinitionNameArray":null,"RegionPredetectionModes":[{"Mode":"RPM_GENERAL"}],"ResultCoordinateType":"RCT_PIXEL","ReturnBarcodeZoneClarity":0,"ScaleDownThreshold":2300,"ScaleUpModes":[{"Mode":"SUM_AUTO"}],"TerminatePhase":"TP_BARCODE_RECOGNIZED","TextAssistedCorrectionMode":{"BottomTextPercentageSize":0,"LeftTextPercentageSize":0,"Mode":"TACM_VERIFYING","RightTextPercentageSize":0,"TopTextPercentageSize":0},"TextFilterModes":[{"MinImageDimension":65536,"Mode":"TFM_GENERAL_CONTOUR","Sensitivity":0}],"TextResultOrderModes":[{"Mode":"TROM_CONFIDENCE"},{"Mode":"TROM_POSITION"},{"Mode":"TROM_FORMAT"}],"TextureDetectionModes":[{"Mode":"TDM_GENERAL_WIDTH_CONCENTRATION","Sensitivity":5}],"Timeout":10000},"Version":"3.0"}':"coverage"==e?'{"ImageParameter":{"AccompanyingTextRecognitionModes":[{"Mode":"ATRM_SKIP"}],"BarcodeColourModes":[{"LightReflection":1,"Mode":"BICM_DARK_ON_LIGHT"}],"BarcodeComplementModes":[{"Mode":"BCM_SKIP"}],"BarcodeFormatIds":["BF_ALL"],"BarcodeFormatIds_2":["BF2_POSTALCODE","BF2_DOTCODE"],"BinarizationModes":[{"BlockSizeX":0,"BlockSizeY":0,"EnableFillBinaryVacancy":1,"ImagePreprocessingModesIndex":-1,"Mode":"BM_LOCAL_BLOCK","ThreshValueCoefficient":10}],"ColourClusteringModes":[{"Mode":"CCM_SKIP"}],"ColourConversionModes":[{"BlueChannelWeight":-1,"GreenChannelWeight":-1,"Mode":"CICM_GENERAL","RedChannelWeight":-1}],"DPMCodeReadingModes":[{"Mode":"DPMCRM_SKIP"}],"DeblurLevel":9,"DeformationResistingModes":[{"Mode":"DRM_SKIP"}],"Description":"","ExpectedBarcodesCount":512,"FormatSpecificationNameArray":null,"GrayscaleTransformationModes":[{"Mode":"GTM_ORIGINAL"},{"Mode":"GTM_INVERTED"}],"ImagePreprocessingModes":[{"Mode":"IPM_GENERAL"}],"IntermediateResultSavingMode":{"Mode":"IRSM_MEMORY"},"IntermediateResultTypes":["IRT_NO_RESULT"],"LocalizationModes":[{"Mode":"LM_CONNECTED_BLOCKS"},{"Mode":"LM_SCAN_DIRECTLY","ScanDirection":0,"ScanStride":0},{"Mode":"LM_STATISTICS"},{"Mode":"LM_LINES"},{"Mode":"LM_STATISTICS_MARKS"},{"Mode":"LM_STATISTICS_POSTAL_CODE"}],"MaxAlgorithmThreadCount":4,"Name":"coverage","PDFRasterDPI":300,"PDFReadingMode":{"Mode":"PDFRM_AUTO"},"Pages":"","RegionDefinitionNameArray":null,"RegionPredetectionModes":[{"Mode":"RPM_GENERAL"}],"ResultCoordinateType":"RCT_PIXEL","ReturnBarcodeZoneClarity":0,"ScaleDownThreshold":214748347,"ScaleUpModes":[{"Mode":"SUM_AUTO"}],"TerminatePhase":"TP_BARCODE_RECOGNIZED","TextAssistedCorrectionMode":{"BottomTextPercentageSize":0,"LeftTextPercentageSize":0,"Mode":"TACM_VERIFYING","RightTextPercentageSize":0,"TopTextPercentageSize":0},"TextFilterModes":[{"MinImageDimension":65536,"Mode":"TFM_GENERAL_CONTOUR","Sensitivity":0}],"TextResultOrderModes":[{"Mode":"TROM_CONFIDENCE"},{"Mode":"TROM_POSITION"},{"Mode":"TROM_FORMAT"}],"TextureDetectionModes":[{"Mode":"TDM_GENERAL_WIDTH_CONCENTRATION","Sensitivity":5}],"Timeout":10000},"Version":"3.0"}':'{"ImageParameter":{"AccompanyingTextRecognitionModes":[{"Mode":"ATRM_SKIP"}],"BarcodeColourModes":[{"LightReflection":1,"Mode":"BICM_DARK_ON_LIGHT"}],"BarcodeComplementModes":[{"Mode":"BCM_SKIP"}],"BarcodeFormatIds":["BF_ALL"],"BarcodeFormatIds_2":null,"BinarizationModes":[{"BlockSizeX":0,"BlockSizeY":0,"EnableFillBinaryVacancy":1,"ImagePreprocessingModesIndex":-1,"Mode":"BM_LOCAL_BLOCK","ThreshValueCoefficient":10}],"ColourClusteringModes":[{"Mode":"CCM_SKIP"}],"ColourConversionModes":[{"BlueChannelWeight":-1,"GreenChannelWeight":-1,"Mode":"CICM_GENERAL","RedChannelWeight":-1}],"DPMCodeReadingModes":[{"Mode":"DPMCRM_SKIP"}],"DeblurLevel":9,"DeformationResistingModes":[{"Mode":"DRM_SKIP"}],"Description":"","ExpectedBarcodesCount":512,"FormatSpecificationNameArray":null,"GrayscaleTransformationModes":[{"Mode":"GTM_ORIGINAL"}],"ImagePreprocessingModes":[{"Mode":"IPM_GENERAL"}],"IntermediateResultSavingMode":{"Mode":"IRSM_MEMORY"},"IntermediateResultTypes":["IRT_NO_RESULT"],"LocalizationModes":[{"Mode":"LM_CONNECTED_BLOCKS"},{"Mode":"LM_SCAN_DIRECTLY","ScanDirection":0,"ScanStride":0},{"Mode":"LM_STATISTICS"},{"Mode":"LM_LINES"}],"MaxAlgorithmThreadCount":4,"Name":"default","PDFRasterDPI":300,"PDFReadingMode":{"Mode":"PDFRM_AUTO"},"Pages":"","RegionDefinitionNameArray":null,"RegionPredetectionModes":[{"Mode":"RPM_GENERAL"}],"ResultCoordinateType":"RCT_PIXEL","ReturnBarcodeZoneClarity":0,"ScaleDownThreshold":2300,"ScaleUpModes":[{"Mode":"SUM_AUTO"}],"TerminatePhase":"TP_BARCODE_RECOGNIZED","TextAssistedCorrectionMode":{"BottomTextPercentageSize":0,"LeftTextPercentageSize":0,"Mode":"TACM_VERIFYING","RightTextPercentageSize":0,"TopTextPercentageSize":0},"TextFilterModes":[{"MinImageDimension":65536,"Mode":"TFM_GENERAL_CONTOUR","Sensitivity":0}],"TextResultOrderModes":[{"Mode":"TROM_CONFIDENCE"},{"Mode":"TROM_POSITION"},{"Mode":"TROM_FORMAT"}],"TextureDetectionModes":[{"Mode":"TDM_GENERAL_WIDTH_CONCENTRATION","Sensitivity":5}],"Timeout":10000},"Version":"3.0"}');t=e}else{if("object"!=typeof e)throw TypeError("'setTemplateSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");t=u.stringify(e)}e=u.parse(t);return n._runtimeSettings=e,n._initSettingsContent=null,n._innerServiceCmd(n._runtimeSettings,null).then(function(e){e=E._handleRetJsonString(e);return n._runtimeSettings=e.settings,n._runtimeSettings||(n._runtimeSettings=u.parse(E._defaultRuntimeSettingsStr)),e.settings})},e.prototype.resetRuntimeSettings=function(){var t=this;return t._runtimeSettings=u.parse(E._defaultRuntimeSettingsStr),t._initSettingsContent=null,t._innerServiceCmd(t._runtimeSettings,null).then(function(e){e=E._handleRetJsonString(e);return t._runtimeSettings=e.settings,t._runtimeSettings||(t._runtimeSettings=u.parse(E._defaultRuntimeSettingsStr)),e.settings})},e.prototype.outputSettingsToString=function(e){if(!e)return E._defaultTemplateStr;for(var t=0;t<this._tplContentArr.length;++t)if(e==this._tplContentArr[t].ImageParameter.Name)return u.stringify(this._tplContentArr[t])},e.prototype.initRuntimeSettingsWithString=function(e){var t=this;if(u.isString(e))return t._runtimeSettings=null,t._initSettingsContent=u.parse(e),t._innerServiceCmd(null,t._initSettingsContent).then(function(e){e=E._handleRetJsonString(e);return t._runtimeSettings=e.settings,t._runtimeSettings||(t._runtimeSettings=u.parse(E._defaultRuntimeSettingsStr)),e.settings});throw TypeError("'initRuntimeSettingsWithString(settings)': Type of 'settings' should be 'String'.")},e}(),E._dbr_ax=!1,E._dbr=!1,E._initH5=function(r,n,o){return new u.Promise(function(e,t){r._bRemoteMode&&r._dmService&&r._dmService.attrs&&r._dmService.attrs.url&&(r._dbrUrlRoot=r._dmService.attrs.url+"dcp/dbr_"+E.Version.replace(/\./g,"")+"/"),r._dbrUrlRoot||(r._dbrUrlRoot=Dynamsoft.DWT.NetManager.getModuleUrl("dcp/dbr_"+E.Version.replace(/\./g,"")+"/"));var n=5,o={method:"POST",url:r._dbrUrlRoot+"VersionInfo?t="+u.getRandom(),data:'{"method":"VersionInfo"}',onSuccess:function(){e()},onError:function(){if(--n<=0)return t("Failed to connect to the Barcode Reader Add-on, the library may be missing in the Dynamic Web TWAIN Service directory.");setTimeout(function(){u.ajax(o)},300)},dataType:"json",async:!0,timeout:800};Dynamsoft.DWT.Token&&(o.headers||(o.headers={}),o.headers.Authorization="Bearer "+Dynamsoft.DWT.Token),u.ajax(o)}).then(function(){return E._dbr=new E.Class(r),E._dbr._innerServiceCmd(null,null)}).then(function(e){try{var t=E._handleRetJsonString(e);E._dbr._runtimeSettings=t.settings,E._defaultRuntimeSettingsStr=u.stringify(t.settings),E._defaultTemplateStr=u.stringify(t.outputSettings),n(E._dbr)}catch(e){o(Error("Init template & runtimeSettings failed: "+e.message)||e)}},function(e){o(e)})},E.dbrInitPromiseFun=function(n){return new u.Promise(function(e,t){E.innerDbrInit(n,e,t)})},E.innerDbrInit=function(e,t,n){var o=!1,r=!1,i=(u.product.bHTML5Edition?o=!0:r=!0,Dynamsoft.BarcodeReaderAddon);if(o){if(i._dbr)return void t(i._dbr)}else if(r&&i._dbr_ax)return void t(i._dbr_ax);if(o&&i._initH5(e,t,n),r){o=Dynamsoft.navInfoSync,r={method:"ReadBarcode",parameter:[Dynamsoft.Lib.product.refProductKey,4002,"",""]};if(!o.bIE)return n(Error("The DBR init error."));try{i._activeXInstance=new ActiveXObject("DBRModule.AtlDBR");var a,d=i._activeXInstance.Process(u.stringify(r),location.protocol+"//"+location.host),_=u.parse(d);return _?"settings"in _?(i._dbr_ax=new i.Class(e),i._dbr_ax._runtimeSettings=_.settings,i._defaultRuntimeSettingsStr=u.stringify(_.settings),"outputSettings"in _&&(i._defaultTemplateStr=u.stringify(_.outputSettings)),void t(i._dbr_ax)):(a=_.description||"The DBR init error.",n(Error(a))):n(Error("The DBR init error."))}catch(e){return n(Error("The DBR .dll is missing or not accessible: "+(e.message||e)))}}},u.DynamicLoadAddonFuns&&u.DynamicLoadAddonFuns.push(function(a){if(t=a._b64bit?"dbrx64_"+Dynamsoft.BarcodeReaderAddon.Version+".dll":"dbr_"+Dynamsoft.BarcodeReaderAddon.Version+".dll",u.product.bHTML5Edition)try{a._innerSend("GetAddOnVersion",u.html5.Funs.makeParams("barcodereader",t),!0,!1,!1).catch(function(){})}catch(e){}function n(e){return!u.License.checkProductKey(e,{Core:!0})||!!Dynamsoft.Lib.env.bMobile&&(e._errorCode=Dynamsoft.DBR.EnumErrorCode.DBR_UNKNOWN,e._errorString=E.errors.ServiceEditionNotSupportDbr,!0)}var e={BarcodeReader:{decode:function(t){return n(a)?u.Promise.reject(E.BarcodeReaderException(a._errorCode,a._errorString)):!u.isNumber(t)||t<0||t>=a.HowManyImagesInBuffer?(u.Errors.IndexOutOfRange(a),u.Promise.reject(E.BarcodeReaderException(a._errorCode,a._errorString))):new u.Promise(function(e){E._decoding?E._decodeQueue.push({method:e,args:[t]}):(E._decoding=!0,e(t))}).then(function(e){var i;if(u.product.bHTML5Edition){if(-1==(i=a._ImgManager.convertClientIndexToServerId(e)))throw u.Errors.IndexOutOfRange(a),setTimeout(E._decodeNext,0),E.BarcodeReaderException(a._errorCode,a._errorString)}else i=e;return new u.Promise(function(o,r){E.dbrInitPromiseFun(a).then(function(e){var t;if(!u.product.bHTML5Edition)return t=i,n=a.GetImagePartURL(t,-1,-1),e._innerDecode(4001,n,"").then(function(e){e.imageid=a.IndexToImageID(t),setTimeout(E._decodeNext,0),o(e)},function(e){setTimeout(E._decodeNext,0),r(e)});t=a._ImgManager.convertServerIdToClientIndex(i);var n=a.GetImagePartURL(t,-1,-1);return e._innerDecode(4e3,n,"",a._clientId).then(function(e){e.imageid=a.IndexToImageID(t),setTimeout(E._decodeNext,0),o(e),a._blts&&Dynamsoft.DWT.lcvrf(a)},function(e){setTimeout(E._decodeNext,0),r(e)})},function(e){setTimeout(E._decodeNext,0),r(e)})})})},resetRuntimeSettings:function(){return n(a)?u.Promise.reject(E.BarcodeReaderException(a._errorCode,a._errorString)):E.dbrInitPromiseFun(a).then(function(e){return e.resetRuntimeSettings()})},getRuntimeSettings:function(e){return n(a)?u.Promise.reject(E.BarcodeReaderException(a._errorCode,a._errorString)):!u.isString(e)||"speed"!=e&&"balance"!=e&&"coverage"!=e&&"default"!=e?E.dbrInitPromiseFun(a).then(function(e){return e.getRuntimeSettings()}):this.updateRuntimeSettings(e)},updateRuntimeSettings:function(t){return n(a)?u.Promise.reject(E.BarcodeReaderException(a._errorCode,a._errorString)):E.dbrInitPromiseFun(a).then(function(e){return e.updateRuntimeSettings(t)})},initRuntimeSettingsWithString:function(t){return n(a)?u.Promise.reject(E.BarcodeReaderException(a._errorCode,a._errorString)):E.dbrInitPromiseFun(a).then(function(e){return e.initRuntimeSettingsWithString(t)})}}};u.product.bHTML5Edition?(a.__addon=a.__addon||{},u.mix(a.__addon,e)):(a.Addon=a.Addon||{},u.mix(a.Addon,e))})});
/*! 20261015101011
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*
* Module: PDF
* Version: 19.5
* 
*/
var Dynamsoft=self.Dynamsoft||{};Dynamsoft.DWT=Dynamsoft.DWT||{},Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[],Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(e){Dynamsoft.aryAddonReadyFun.push(e)},function(){Dynamsoft.DWT.EnumDWT_ConvertMode={CM_RENDERALL:1,CM_IMAGEONLY:2,CM_AUTO:3,CM_RENDERALLWITHANNOTATION:4},Dynamsoft.DWT.EnumDWT_PDFCompressionType={PDF_AUTO:0,PDF_FAX3:1,PDF_FAX4:2,PDF_LZW:3,PDF_RLE:4,PDF_JPEG:5,PDF_JP2000:6,PDF_JBIG2:7}}(),Dynamsoft.AddonReady(function(o,e){var t,n;o.product.bHTML5Edition&&(t={code:-2830,message:"The PDF resolution must be a positive number."},o.DynamicLoadAddonFuns)&&o.DynamicLoadAddonFuns.push(function(a){var e,i=o.html5.Funs;n=a.__serverPlatform==Dynamsoft.DWT.EnumDWT_PlatformType.enumMac?a._b64bit?"libDMCodecx64.dylib":"libDMCodec.dylib":a.__serverPlatform==Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux||a.__serverPlatform==Dynamsoft.DWT.EnumDWT_PlatformType.enumEmbed||a.__serverPlatform==Dynamsoft.DWT.EnumDWT_PlatformType.enumChromeOS?"libDMCodec.so":a._b64bit?"DMCodecx64.dll":"DMCodec.dll";try{a._innerSend("GetAddOnVersion",i.makeParams("pdf",n),!0,!1,!1).catch(function(){})}catch(e){}e={PDF:{IsModuleInstalled:function(){var e=a;return e._resetErr(),""!=e._innerFun("GetAddOnVersion",i.makeParams("pdf",n))},IsModuleInstalledAsync:function(){var e=a;return e._resetErr(),e._innerFunV2("GetAddOnVersion",i.makeParams("pdf",n)).then(function(e){return""!=e})},ConvertToImage:function(e,n,r,t){var e=i.replaceLocalFilename(e),o="ConvertPDFToImage",s=a;return s._resetErr(),i.showMask(o),s._innerSend(o,i.makeParams(e,n),!0,function(e){return i.hideMask(o),r&&r(),!0},function(e){return i.hideMask(o),t&&t(),!1}),!0},SetPassword:function(e){var n=a,r=e||"";return n._resetErr(),!!n._checkPDFPasswordValue(r)&&(r=n._mixSavedPdfReaderOptions({password:r}),(r=n._setReaderOptions(r,!1))&&(n._pdfOptions.password=e),r)},SetConvertMode:function(e){return a._setConvertMode(e)},SetConvertModeAsync:function(e){return a._setConvertModeAsync(e)},GetConvertMode:function(){var e=a;return e._resetErr(),e._pdfConvertMode},SetResolution:function(e){var n=a,r=e;return n._resetErr(),r=n._mixSavedPdfReaderOptions({renderOptions:{resolution:r}}),(r=n._setReaderOptions(r,!1))&&(n._pdfOptions.renderOptions.resolution=e),r},SetResolutionAsync:function(n){var r=a;return r._resetErr(),!Dynamsoft.Lib.isNumber(n)||n<=0?Dynamsoft.Lib.Promise.reject(t):r._innerFunV2("SetPDFResolution",i.makeParams(n)).then(function(e){e&&(r._pdfOptions.renderOptions.resolution=n)})},SetReaderOptions:function(e){return a._setReaderOptions(e,!0)},GetReaderOptions:function(){var e,n=a;return n._resetErr(),e=a._innerFun("GetPDFReaderOptions"),e=Dynamsoft.Lib.parse(e),n._pdfOptions=n._mixSavedPdfReaderOptions(e),Dynamsoft.Lib.clone(n._pdfOptions)},IsTextBasedPDF:function(e,n,r){var t=a,e=(t._resetErr(),i.replaceLocalFilename(e)),e=a._innerFun("IsTextBasedPDF",i.makeParams(e));return 0==t.ErrorCode?o.isFunction(n)&&n(e):o.isFunction(r)&&r(t.ErrorCode,t.ErrorString),e},IsRasterizationRequired:function(e){a._resetErr();e=i.replaceLocalFilename(e);return a._innerFun("IsRasterizationRequired",i.makeParams(e))},Write:{Setup:function(e){o.isObject(e)?(n=Dynamsoft.Lib.clone(e),2<o.stringify(n).length&&(o.isNumber(n.version)?1<=n.version&&n.version<2&&(n.version=parseInt(10*n.version)):n.version=15)):n={version:15},o.isNumber(n.compression)&&n.compression==Dynamsoft.DWT.EnumDWT_PDFCompressionType.PDF_FAX3&&(n.compression=Dynamsoft.DWT.EnumDWT_PDFCompressionType.PDF_FAX4);var n,e=a;return e._resetErr(),!(n.password&&(o.isNumber(n.password)&&(n.password=n.password.toString()),!e._checkPDFPasswordValue(n.password)))&&(n=o.stringify(n),n=o.replaceAll(n,'"','\\"'),e._innerFun("SetPDFSettings",['["',n,'"]'].join("")))}}}},a.__addon=a.__addon||{},o.mix(a.__addon,e)})}),Dynamsoft.AddonReady(function(a,e){a.product.bActiveXEdition&&a.DynamicLoadAddonFuns&&a.DynamicLoadAddonFuns.push(function(o){var e,s,n;if(!o.getSWebTwain()||!o.getSWebTwain().Addon)return!1;Dynamsoft.navInfoSync.bWin&&(n=!Dynamsoft.navInfo.bOSx64||Dynamsoft.navInfo.bWOW64?"DMCodec.dll":"DMCodecx64.dll"),s=o.getSWebTwain(),e={PDF:{IsModuleInstalled:function(){var e=s.GetAddOnVersion("pdf",n);return a.setErrorString(o),""!=e},IsModuleInstalledAsync:function(){var e=s.GetAddOnVersion("pdf",n);return a.setErrorString(o),a.Promise.resolve(""!=e)},ConvertToImage:function(e,n,r,t){e=s.ConvertPDFToImage(e,n);return a.wrapperRet(o,e,r,t)},SetPassword:function(e){e=s.SetPDFPassword(e);return a.wrapperRet(o,e)},SetConvertMode:function(e){return o._setConvertMode(e)},SetConvertModeAsync:function(e){return Promise.resolve(o._setConvertMode(e))},GetConvertMode:function(){return o._resetErr(),o._pdfConvertMode},SetResolution:function(e){e=s.SetPDFResolution(e);return a.wrapperRet(o,e)},SetResolutionAsync:function(e){e=s.SetPDFResolution(e);return a.Promise.resolve(a.wrapperRet(o,e))},SetReaderOptions:function(){return!1},GetReaderOptions:function(){return{}},IsTextBasedPDF:function(e){e=s.IsTextBasedPDF(e);return a.wrapperRet(o,e)}}},o.Addon=o.Addon||{},a.mix(o.Addon,e)})});
/*! 20261015101011
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*
* Module: OCR
* Version: 19.5
* 
*/
var Dynamsoft=self.Dynamsoft||{};Dynamsoft.DWT=Dynamsoft.DWT||{},Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[],Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(t){Dynamsoft.aryAddonReadyFun.push(t)},Dynamsoft.DWT.OCRVerInName="10.0.0.0618",function(){for(var t=[Dynamsoft.DWT],e=0;e<1;e++){var n=t[e];n.EnumDWT_OCRLanguage={OCRL_ENG:"eng",OCRL_ARA:"ara",OCRL_CHI_SIM:"chi_sim",OCRL_CHI_TRA:"chi_tra",OCRL_HIN:"hin",OCRL_URD:"urd",OCRL_SPA:"spa",OCRL_FRA:"fra",OCRL_MSA:"msa",OCRL_IND:"ind",OCRL_RUS:"rus",OCRL_BEN:"ben",OCRL_POR:"por",OCRL_PAN:"pan",OCRL_DEU:"deu",OCRL_JPN:"jpn",OCRL_FAS:"fas",OCRL_SWA:"swa",OCRL_JAV:"jav",OCRL_TEL:"tel",OCRL_TUR:"tur",OCRL_KOR:"kor",OCRL_MAR:"mar",OCRL_TAM:"tam",OCRL_VIE:"vie",OCRL_ITA:"ita",OCRL_THA:"tha"},n.EnumDWT_OCRPageSetMode={OCRPSM_OSD_ONLY:0,PSM_AUTO_OSD:1,PSM_AUTO_ONLY:2,PSM_AUTO:3,PSM_SINGLE_COLUMN:4,PSM_SINGLE_BLOCK_VERT_TEXT:5,PSM_SINGLE_BLOCK:6,PSM_SINGLE_LINE:7,PSM_SINGLE_WORD:8,PSM_CIRCLE_WORD:9,PSM_SINGLE_CHAR:10},n.EnumDWT_OCROutputFormat={OCROF_TEXT:0,OCROF_PDFPLAINTEXT:1,OCROF_PDFIMAGEOVERTEXT:2,OCROF_PDFPLAINTEXT_PDFX:3,OCROF_PDFIMAGEOVERTEXT_PDFX:4},n.EnumDWT_OCRDownloadType={OCRDT_Dll:0,OCRDT_LANGUAGE:1}}}(),Dynamsoft.DWT.OCRLanguageData_eng="4113088",Dynamsoft.DWT.OCRLanguageData_ara="1432056",Dynamsoft.DWT.OCRLanguageData_chi_sim="2469156",Dynamsoft.DWT.OCRLanguageData_chi_tra="2366642",Dynamsoft.DWT.OCRLanguageData_hin="1122751",Dynamsoft.DWT.OCRLanguageData_urd="1398718",Dynamsoft.DWT.OCRLanguageData_spa="2294433",Dynamsoft.DWT.OCRLanguageData_fra="1130365",Dynamsoft.DWT.OCRLanguageData_msa="1747801",Dynamsoft.DWT.OCRLanguageData_ind="1122661",Dynamsoft.DWT.OCRLanguageData_rus="3861738",Dynamsoft.DWT.OCRLanguageData_ben="855841",Dynamsoft.DWT.OCRLanguageData_por="1982756",Dynamsoft.DWT.OCRLanguageData_pan="497721",Dynamsoft.DWT.OCRLanguageData_deu="1525436",Dynamsoft.DWT.OCRLanguageData_jpn="2471260",Dynamsoft.DWT.OCRLanguageData_fas="431500",Dynamsoft.DWT.OCRLanguageData_swa="2167651",Dynamsoft.DWT.OCRLanguageData_jav="2982741",Dynamsoft.DWT.OCRLanguageData_tel="2769654",Dynamsoft.DWT.OCRLanguageData_tur="4550554",Dynamsoft.DWT.OCRLanguageData_kor="1677415",Dynamsoft.DWT.OCRLanguageData_mar="2118233",Dynamsoft.DWT.OCRLanguageData_tam="3237963",Dynamsoft.DWT.OCRLanguageData_vie="531275",Dynamsoft.DWT.OCRLanguageData_ita="2701314",Dynamsoft.DWT.OCRLanguageData_tha="1072600",Dynamsoft.DWT.OCRLanguageData={},Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_ENG]=Dynamsoft.DWT.OCRLanguageData_eng,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_ARA]=Dynamsoft.DWT.OCRLanguageData_ara,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_CHI_TRA]=Dynamsoft.DWT.OCRLanguageData_chi_tra,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_CHI_SIM]=Dynamsoft.DWT.OCRLanguageData_chi_sim,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_HIN]=Dynamsoft.DWT.OCRLanguageData_hin,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_URD]=Dynamsoft.DWT.OCRLanguageData_urd,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_SPA]=Dynamsoft.DWT.OCRLanguageData_spa,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_FRA]=Dynamsoft.DWT.OCRLanguageData_fra,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_MSA]=Dynamsoft.DWT.OCRLanguageData_msa,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_IND]=Dynamsoft.DWT.OCRLanguageData_ind,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_RUS]=Dynamsoft.DWT.OCRLanguageData_rus,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_BEN]=Dynamsoft.DWT.OCRLanguageData_ben,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_POR]=Dynamsoft.DWT.OCRLanguageData_por,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_PAN]=Dynamsoft.DWT.OCRLanguageData_pan,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_DEU]=Dynamsoft.DWT.OCRLanguageData_deu,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_JPN]=Dynamsoft.DWT.OCRLanguageData_jpn,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_FAS]=Dynamsoft.DWT.OCRLanguageData_fas,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_SWA]=Dynamsoft.DWT.OCRLanguageData_swa,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_JAV]=Dynamsoft.DWT.OCRLanguageData_jav,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_TEL]=Dynamsoft.DWT.OCRLanguageData_tel,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_TUR]=Dynamsoft.DWT.OCRLanguageData_tur,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_KOR]=Dynamsoft.DWT.OCRLanguageData_kor,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_MAR]=Dynamsoft.DWT.OCRLanguageData_mar,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_TAM]=Dynamsoft.DWT.OCRLanguageData_tam,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_VIE]=Dynamsoft.DWT.OCRLanguageData_vie,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_ITA]=Dynamsoft.DWT.OCRLanguageData_ita,Dynamsoft.DWT.OCRLanguageData[Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_THA]=Dynamsoft.DWT.OCRLanguageData_tha,function(t){function e(){var t=this;t._text="",t._fontName="",t._fontSize="",t._left=0,t._top=0,t._right=0,t._bottom=0}e.prototype.GetText=function(){return this._text},e.prototype.GetFontName=function(){return this._fontName},e.prototype.GetFontSize=function(){return this._fontSize},e.prototype.GetWordRect=function(){var t=this;return t._left+","+t._top+","+t._right+","+t._bottom},t.NewWordBasicResult=function(){return new e}}(Dynamsoft.Lib),function(t){function e(){var t=this;t._count=0,t._left=0,t._top=0,t._right=0,t._bottom=0,t._wordlist=[]}e.prototype.GetWordCount=function(){return this._count},e.prototype.GetLineRect=function(){var t=this;return t._left+","+t._top+","+t._right+","+t._bottom},e.prototype.GetWordContent=function(t){var e=this,n=e._wordlist.length;return e._errorCode<0?"":null==t||n<=t||t<0?(Dynamsoft.Lib.Errors.OCR_InvalidIndex(e,"GetWordContent"),""):((n=Dynamsoft.Lib.NewWordBasicResult())._text=e._wordlist[t].text,n._fontName=e._wordlist[t].fontname,n._fontSize=e._wordlist[t].fontsize,n._left=e._wordlist[t].rect[0],n._top=e._wordlist[t].rect[1],n._right=e._wordlist[t].rect[2],n._bottom=e._wordlist[t].rect[3],n)},t.NewLineBasicResult=function(){return new e}}(Dynamsoft.Lib),function(t){function e(){this._count=0,this._linelist=[]}e.prototype.GetLineCount=function(){return this._count},e.prototype.GetLineContent=function(t){var e=this,n=e._linelist.length;return e._errorCode<0?"":null==t||n<=t||t<0?(Dynamsoft.Lib.Errors.OCR_InvalidIndex(e,"GetLineContent"),""):((n=Dynamsoft.Lib.NewLineBasicResult())._count=e._linelist[t].words.length,n._left=e._linelist[t].rect[0],n._top=e._linelist[t].rect[1],n._right=e._linelist[t].rect[2],n._bottom=e._linelist[t].rect[3],n._wordlist=e._linelist[t].words,n)},t.NewPageBasicResult=function(){return new e}}(Dynamsoft.Lib),function(t){function e(){this._count=0,this._pagelist=[]}e.prototype.GetPageCount=function(){return this._count},e.prototype.GetPageContent=function(t){var e=this,n=e._pagelist.length;return e._errorCode<0?"":null==t||n<=t||t<0?(Dynamsoft.Lib.Errors.OCR_InvalidIndex(e,"GetPageContent"),""):((n=Dynamsoft.Lib.NewPageBasicResult())._count=e._pagelist[t].lines.length,n._linelist=e._pagelist[t].lines,n)},t.NewPageSetBasicResult=function(){return new e}}(Dynamsoft.Lib),function(e){function n(t){var e=this;e._errorCode=0,e._errorString="",e._resultlist=[],e._stwain=t}n.prototype.GetErrorCode=function(){return this._errorCode},n.prototype.GetErrorString=function(){return this._errorString},n.prototype.GetFormat=function(){return this._resultlist[0].format},n.prototype.GetInput=function(){var t=this._resultlist[0].input;if(t){var e=Number(t);if(!isNaN(e))return this._stwain._ImgManager.convertServerIdToClientIndex(e)}return t},n.prototype.GetPageSetCount=function(){return this._resultlist[0].pagesets.length},n.prototype.GetPageSetContent=function(t){var e=this,n=e._resultlist[0].pagesets.length;return e._errorCode<0?"":null==t||n<=t||t<0?(Dynamsoft.Lib.Errors.OCR_InvalidIndex(e,"GetPageSetContent"),""):((n=Dynamsoft.Lib.NewPageSetBasicResult())._count=e._resultlist[0].pagesets[t].pages.length,n._pagelist=e._resultlist[0].pagesets[t].pages,n)},n.prototype.Get=function(){return this._stwain._innerFun("GetOCRRestult")},n.prototype.Save=function(t){t=e.html5.Funs.replaceLocalFilename(t);return this._stwain._innerFun("SaveOCRRestult",e.html5.Funs.makeParams(t))},e.NewOCRBasicResult=function(t){return new n(t)}}(Dynamsoft.Lib),function(e){function t(){var t=this;t.UnicodeFontName="",t.UseDetectedFont=!0,t.MinFontSizeforMoreAccurateResult=0,t.OCRLanguage=Dynamsoft.DWT.EnumDWT_OCRLanguage.OCRL_ENG,t.PageSetMode=Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_AUTO,t.OutputFormat=Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFIMAGEOVERTEXT}t.prototype.GetUnicodeFontName=function(){return this.UnicodeFontName},t.prototype.SetUnicodeFontName=function(t){return e.isString(t)||(t=""),this.UnicodeFontName=t,!0},t.prototype.GetUseDetectedFont=function(){return!!this.UseDetectedFont},t.prototype.SetUseDetectedFont=function(t){return this.UseDetectedFont=!!t,!0},t.prototype.GetMinFontSizeforMoreAccurateResult=function(){return this.MinFontSizeforMoreAccurateResult},t.prototype.SetMinFontSizeforMoreAccurateResult=function(t){t=+t;return this.MinFontSizeforMoreAccurateResult=t=t<0?0:t,!0},t.prototype.GetOCRLanguage=function(){return this.OCRLanguage},t.prototype.SetOCRLanguage=function(t){return e.isString(t)||(t=""),this.OCRLanguage=t,!0},t.prototype.GetPageSetMode=function(){return this.PageSetMode},t.prototype.SetPageSetMode=function(t){t=+t;return(t<0||t>Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_CHAR)&&(t=Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_AUTO),this.PageSetMode=t,!0},t.prototype.GetOutputFormat=function(){return this.OutputFormat},t.prototype.SetOutputFormat=function(t){t=+t;return(t<0||t>Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFIMAGEOVERTEXT_PDFX)&&(t=Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFIMAGEOVERTEXT),this.OutputFormat=t,!0},e.NewOptions=function(){return new t}}(Dynamsoft.Lib),Dynamsoft.AddonReady(function(C,t){var g;C.product.bHTML5Edition&&C.DynamicLoadAddonFuns&&C.DynamicLoadAddonFuns.push(function(i){var t,O,m,_=C.html5.Funs,R=C.NewOptions();O=i,m=C.html5.Funs,g=C.env.bMac?"DynamicOCR_"+Dynamsoft.DWT.OCRVerInName+".dylib":C.env.bLinux?"DynamicOCR_"+Dynamsoft.DWT.OCRVerInName+".so":Dynamsoft.dcp.b64bit?"DynamicOCRx64_"+Dynamsoft.DWT.OCRVerInName+".dll":"DynamicOCR_"+Dynamsoft.DWT.OCRVerInName+".dll",O._isMobileMode()||O._innerSend("GetAddOnVersion",m.makeParams("ocr",g),!0,!1,!1),O.__innerOCRBasicReadFunction=function(t,e,n,a,o,r,u,D,s,i,_){return C.isFunction(i)?this.__innerOCRBasicAsyncReadFunction(t,e,n,a,o,r,u,D,s,i,_):this.__innerOCRSyncReadFunction(t,s)},O.__innerGetOCRBasicResultAsyncFunction=function(t){var e=Dynamsoft.Lib.NewOCRBasicResult(this);return t&&(e._errorCode=t.exception,e._errorString=t.description,e._resultlist=t.result),e},O.__innerOCRBasicAsyncReadFunction=function(n,a,o,r,u,D,s,i,t,_,R){var g=this;return m.showMask(n),g._innerSend(n,t,!0,function(t){var e;0==t.exception?(C.isFunction(_)&&(-1!=a?(e=g._convertServerIdToGuid(a),1==r?_(e,u,D,s,i,g.__innerGetOCRBasicResultAsyncFunction(t)):_(e,g.__innerGetOCRBasicResultAsyncFunction(t))):""!=o?_(o,g.__innerGetOCRBasicResultAsyncFunction(t)):_(g.__innerGetOCRBasicResultAsyncFunction(t))),C.License.isLTS()&&Dynamsoft.DWT.lcvrf(O)):C.isFunction(R)&&R(t.exception,t.description),m.hideMask(n)},function(t){m.hideMask(n)}),!0},O.__innerOCRSyncReadFunction=function(t,e){t=this._innerFunRaw(t,e,!1,!1),e=C.NewOCRBasicResult();return e._errorCode=this._errorCode,e._errorString=this._errorString,t&&C.isArray(t)&&(e._resultlist=t,e._Count=t.length,C.License.isLTS())&&Dynamsoft.DWT.lcvrf(O),e},O.__IsOCRBasicModuleInstalled=function(){return""!=O._innerFun("GetAddOnVersion",m.makeParams("ocr",g)).split("|")[0]},O.__innerBasicDownload=function(t,n,e,a,o){function r(){return D.IfShowProgressBar&&C.closeProgress(null,"Download"),C.isFunction(a)&&a(),!0}function u(){return D.IfShowProgressBar&&C.closeProgress(null,"Download"),C.isFunction(o)&&o(D.ErrorCode,D.ErrorString),!1}var D=O;C.cancelFrome=2,t=t.toString();if(!C.License.checkProductKey(D,{Core:!0}))return u();if(!C.License.checkProductKey(D,{OCR:!0},!0))return u();n!=Dynamsoft.DWT.EnumDWT_OCRDownloadType.OCRDT_Dll&&D._innerFun("SetOCRLanguage",m.makeParams(e));var s=D._innerFun("GetAddOnVersion",m.makeParams("ocr",g)).split("|");if(n==Dynamsoft.DWT.EnumDWT_OCRDownloadType.OCRDT_Dll){if(""!=s[0])return r(),!0}else{e=Dynamsoft.DWT.OCRLanguageData[e];if(e&&s[1]==e)return r(),!0}if(!t||""==t)return C.Errors.OCR_InvalidRemoteFilename(D),u(),!1;if(m.isServerInvalid(D))return u(),!1;D.IfShowProgressBar&&C.showProgress(D,"Download",!0);var i=!0;n==Dynamsoft.DWT.EnumDWT_OCRDownloadType.OCRDT_Dll?D._OnPercentDone([0,-1,"Downloading OCR Module...","http"]):D._OnPercentDone([0,-1,"Downloading OCR Language Data...","http"]),C.isFunction(a)||(i=!1),m.loadHttpBlob(D,"get",t,i,function(t){D._OnPercentDone([0,-1,"Loading..."]);var e=100;n==Dynamsoft.DWT.EnumDWT_OCRDownloadType.OCRDT_LANGUAGE&&(e=101),D.__LoadImageFromBytes(t,e,"",i,r,u)},function(){D.IfShowProgressBar&&C.closeProgress(null,"Download"),u()},function(t){var e=0===t.total?100:Math.round(100*t.loaded/t.total);[t.loaded," / ",t.total].join("");D._OnPercentDone([0,e,"","http"])})},t={OCR:{SetUnicodeFontName:function(t){var e=i;return e._resetErr(),e._isMobileMode()?e._mobileNotSupport("Addon.OCR.SetUnicodeFontName"):R.SetUnicodeFontName(t)},GetUnicodeFontName:function(){var t=i;return t._resetErr(),t._isMobileMode()?t._mobileNotSupport("Addon.OCR.GetUnicodeFontName"):R.GetUnicodeFontName()},SetIfUseDetectedFont:function(t){var e=i;return e._resetErr(),e._isMobileMode()?e._mobileNotSupport("Addon.OCR.SetIfUseDetectedFont"):R.SetUseDetectedFont(t)},GetIfUseDetectedFont:function(){var t=i;return t._resetErr(),t._isMobileMode()?t._mobileNotSupport("Addon.OCR.GetIfUseDetectedFont"):R.GetUseDetectedFont()},SetMinFontSizeforMoreAccurateResult:function(t){var e=i;return e._resetErr(),e._isMobileMode()?e._mobileNotSupport("Addon.OCR.SetMinFontSizeforMoreAccurateResult"):R.SetMinFontSizeforMoreAccurateResult(t)},GetMinFontSizeforMoreAccurateResult:function(){var t=i;return t._resetErr(),t._isMobileMode()?t._mobileNotSupport("Addon.OCR.GetMinFontSizeforMoreAccurateResult"):R.GetMinFontSizeforMoreAccurateResult()},SetLanguage:function(t){var e=i;return e._resetErr(),e._isMobileMode()?e._mobileNotSupport("Addon.OCR.SetLanguage"):R.SetOCRLanguage(t)},IsModuleInstalled:function(){var t=i;return t._resetErr(),t._isMobileMode()?t._mobileNotSupport("Addon.OCR.IsModuleInstalled"):t.__IsOCRBasicModuleInstalled()},SetPageSetMode:function(t){var e=i;return e._resetErr(),e._isMobileMode()?e._mobileNotSupport("Addon.OCR.SetPageSetMode"):(t=+t)==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.OCRPSM_OSD_ONLY||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_AUTO_OSD||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_AUTO_ONLY||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_AUTO||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_COLUMN||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_BLOCK_VERT_TEXT||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_BLOCK||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_LINE||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_WORD||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_CIRCLE_WORD||t==Dynamsoft.DWT.EnumDWT_OCRPageSetMode.PSM_SINGLE_CHAR?R.SetPageSetMode(t):(Dynamsoft.Lib.Errors.OCR_InvalidPageSetMode(e),!1)},SetOutputFormat:function(t){var e=i;return e._resetErr(),e._isMobileMode()?e._mobileNotSupport("Addon.OCR.SetOutputFormat"):(t=+t)==Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_TEXT||t==Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFPLAINTEXT||t==Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFIMAGEOVERTEXT||t==Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFPLAINTEXT_PDFX||t==Dynamsoft.DWT.EnumDWT_OCROutputFormat.OCROF_PDFIMAGEOVERTEXT_PDFX?R.SetOutputFormat(t):(Dynamsoft.Lib.Errors.OCR_InvalidOutputFormat(e),!1)},Recognize:function(t,e,n){var a=i;return a._resetErr(),a._isMobileMode()?a._mobileNotSupport("Addon.OCR.Recognize"):C.License.checkProductKey(a,{OCR:!0},!0)?(t=a._ImgManager.convertClientIndexToServerId(t),a.__innerOCRBasicReadFunction("OCRRecognize",t,"",0,0,0,0,0,_.makeParams(0,t,"",0,0,0,0,R.GetUnicodeFontName(),R.GetUseDetectedFont(),R.GetMinFontSizeforMoreAccurateResult(),R.GetOCRLanguage(),R.GetPageSetMode(),R.GetOutputFormat(),""),e,n)):(C.isFunction(n)&&n(a._errorCode,a._errorString),!1)},RecognizeRect:function(t,e,n,a,o,r,u){var D,s=i;return s._resetErr(),s._isMobileMode()?s._mobileNotSupport("Addon.OCR.RecognizeRect"):!e&&0!=e||!n&&0!=n||!a&&0!=a||!o&&0!=o?(D=Dynamsoft.Lib.NewOCRBasicResult(s),Dynamsoft.Lib.Errors.OCR_InvalidLeftOrTopOrRightOrBottom(D,"RecognizeRect"),void u(D.GetErrorCode(),D.GetErrorString())):C.License.checkProductKey(s,{OCR:!0},!0)?(D=s._ImgManager.convertClientIndexToServerId(t),s.__innerOCRBasicReadFunction("OCRRecognize",D,"",1,e,n,a,o,_.makeParams(0,D,"",e,n,a,o,R.GetUnicodeFontName(),R.GetUseDetectedFont(),R.GetMinFontSizeforMoreAccurateResult(),R.GetOCRLanguage(),R.GetPageSetMode(),R.GetOutputFormat(),""),r,u)):(C.isFunction(u)&&u(s._errorCode,s._errorString),!1)},RecognizeFile:function(t,e,n){var a=i;return a._resetErr(),a._isMobileMode()?a._mobileNotSupport("Addon.OCR.RecognizeFile"):(t=_.replaceLocalFilename(t),C.License.checkProductKey(a,{OCR:!0},!0)?a.__innerOCRBasicReadFunction("OCRRecognize",-1,t,0,0,0,0,0,_.makeParams(1,-1,t,0,0,0,0,R.GetUnicodeFontName(),R.GetUseDetectedFont(),R.GetMinFontSizeforMoreAccurateResult(),R.GetOCRLanguage(),R.GetPageSetMode(),R.GetOutputFormat(),""),e,n):(C.isFunction(n)&&n(a._errorCode,a._errorString),!1))},RecognizeSelectedImages:function(t,e){var n,a,o,r=i;return r._resetErr(),r._isMobileMode()?r._mobileNotSupport("Addon.OCR.RecognizeSelectedImages"):C.License.checkProductKey(r,{OCR:!0},!0)?(o=[],(n=r)._ImgManager.count()<=0||(a=n._ImgManager.getCurrentImageIndex(),n._ImgManager.convertClientIndexToServerId(a),a=n._ImgManager.getSelectedClientIndexArray(),C.isArray(a)&&C.each(a,function(t){t=n._ImgManager.convertClientIndexToServerId(t);o.push(t)})),a=o,r.__innerOCRBasicReadFunction("OCRRecognize",-1,"",0,0,0,0,0,_.makeParams(2,-1,"",0,0,0,0,R.GetUnicodeFontName(),R.GetUseDetectedFont(),R.GetMinFontSizeforMoreAccurateResult(),R.GetOCRLanguage(),R.GetPageSetMode(),R.GetOutputFormat(),a.join(",")),t,e)):(C.isFunction(e)&&e(r._errorCode,r._errorString),!1)}}},i.__addon=i.__addon||{},C.mix(i.__addon,t)})});
/*! 20260922110806 - 202512081100
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation 
* Author: Dynamsoft Support Team
*
* Module: OCR Pro
* Version: 19.5
* 
*
*/
;var Dynamsoft=self.Dynamsoft||{};Dynamsoft.DWT=Dynamsoft.DWT||{};Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[];Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(a){Dynamsoft.aryAddonReadyFun.push(a)};Dynamsoft.ProOCRVerInName="1.2.0.0806";(function(b){function a(){var c=this;c._text="";c._left=0;c._top=0;c._right=0;c._bottom=0}a.prototype.GetText=function(){var c=this;return c._text};a.prototype.GetLetterRect=function(){var c=this;return c._left+","+c._top+","+c._right+","+c._bottom};b.NewLetterResult=function(){return new a()}})(Dynamsoft.Lib);(function(b){function a(){var c=this;c._count=0;c._letterlist=[];c._zoneCount=0;c._zoneWords=[]}a.prototype.GetLettersCount=function(){var c=this;return c._count};a.prototype.GetZoneCount=function(){var c=this;return c._zoneCount};a.prototype.GetLetterContent=function(d){var f=this,c=f._count;if(f._errorCode<0){return""}if(d==null||d>=c||d<0){Dynamsoft.Lib.Errors.OCR_InvalidIndex(f,"GetLetterContent");return""}var e=Dynamsoft.Lib.NewLetterResult();e._text=f._letterlist[d].letter;e._left=f._letterlist[d].boundary[0];e._top=f._letterlist[d].boundary[1];e._right=f._letterlist[d].boundary[2];e._bottom=f._letterlist[d].boundary[3];return e};a.prototype.GetZoneContent=function(d){var e=this,c=e._zoneCount;if(e._errorCode<0){return""}if(d==null||d>=c||d<0){Dynamsoft.Lib.Errors.OCR_InvalidIndex(e,"GetZoneContent");return""}return e._zoneWords[d]};b.NewPageResult=function(){return new a()}})(Dynamsoft.Lib);(function(a){function b(){var c=this;c._input=0;c._message="";c._page=-1}b.prototype.GetInput=function(){var c=this;return c._input};b.prototype.GetMessage=function(){var c=this;return c._message};b.prototype.GetPage=function(){var c=this;return c._page};a.NewErrorInfo=function(){return new b()}})(Dynamsoft.Lib);(function(a){function b(c){var d=this;d._errorCode=0;d._errorString="";d._errorlist=[];d._request="";d._ocrTotalCount=0;d._alreadyOCRCount=0;d._resultlist=[];d._resultZoneDetail=[];d._stwain=c}b.prototype.GetErrorCode=function(){var c=this;return c._errorCode};b.prototype.GetErrorString=function(){var c=this;return c._errorString};b.prototype.GetInput=function(){var e=this;if(e._request&&e._request.input){var d=e._request.input;if(d){var c=Number(d);if(!isNaN(c)){return e._stwain._ImgManager.convertServerIdToClientIndex(c)}}return d}else{return""}};b.prototype.GetErrorDetailList=function(){var g=this,c=0;if(g._errorlist){c=g._errorlist.length}var e=[];for(var d=0;d<c;d++){var f=Dynamsoft.Lib.NewErrorInfo();f._input=g._errorlist[d].input;f._message=g._errorlist[d].message;f._page=g._errorlist[d].page;e.push(f)}return e};b.prototype.GetOCRTotalCount=function(){var c=this;if(c._ocrTotalCount){return c._ocrTotalCount}else{return 0}};b.prototype.GetAlreadyOCRCount=function(){var c=this;if(c._alreadyOCRCount){return c._alreadyOCRCount}else{return 0}};b.prototype.GetPageCount=function(){var c=this;if(c._resultlist&&c._resultlist.length){return c._resultlist.length}else{return 0}};b.prototype.GetPageContent=function(d){var f=this,c=0;if(f._resultlist){c=f._resultlist.length}if(d==null||d>=c||d<0){Dynamsoft.Lib.Errors.OCR_InvalidIndex(f,"GetPageContent");return""}var e=Dynamsoft.Lib.NewPageResult();if(f._resultlist){e._count=f._resultlist[d].length;e._letterlist=f._resultlist[d]}else{e._count=0}if(f._resultZoneDetail){e._zoneCount=f._resultZoneDetail[d].length;e._zoneWords=f._resultZoneDetail[d]}else{e._zoneCount=0}return e};b.prototype.Get=function(){var c=this;return c._stwain._innerFun("GetOCRRestult")};b.prototype.Save=function(c){var e=this,d=a.html5.Funs.replaceLocalFilename(c);return e._stwain._innerFun("SaveOCRRestult",a.html5.Funs.makeParams(d))};a.NewOCRProResult=function(c){return new b(c)}})(Dynamsoft.Lib);(function(c){var d=[Dynamsoft.DWT],b=0;for(;b<1;b++){var a=d[b];a.EnumDWT_OCRProRecognitionModule={OCRPM_AUTO:"AUTO",OCRPM_MOSTACCURATE:"MOSTACCURATE",OCRPM_BALANCED:"BALANCED",OCRPM_FASTEST:"FASTEST"};a.EnumDWT_OCRProOutputFormat={OCRPFT_TXTS:"TXTS",OCRPFT_TXTCSV:"TXTCSV",OCRPFT_TXTF:"TXTF",OCRPFT_XML:"XML",OCRPFT_IOTPDF:"IOTPDF",OCRPFT_IOTPDF_MRC:"IOTPDF_MRC"};a.EnumDWT_OCRProPDFVersion={OCRPPDFV_0:"1.0",OCRPPDFV_1:"1.1",OCRPPDFV_2:"1.2",OCRPPDFV_3:"1.3",OCRPPDFV_4:"1.4",OCRPPDFV_5:"1.5",OCRPPDFV_6:"1.6",OCRPPDFV_7:"1.7"};a.EnumDWT_OCRProPDFAVersion={OCRPPDFAV_1A:"pdf/a-1a",OCRPPDFAV_1B:"pdf/a-1b",OCRPPDFAV_2A:"pdf/a-2a",OCRPPDFAV_2B:"pdf/a-2b",OCRPPDFAV_2U:"pdf/a-2u",OCRPPDFAV_3A:"pdf/a-3a",OCRPPDFAV_3B:"pdf/a-3b",OCRPPDFAV_3U:"pdf/a-3u"};a.EnumDWT_OCRProType={OCRDT_File:0,OCRDT_Index:1};a.EnumDWT_OCRFindTextFlags={OCRFT_WHOLEWORD:1,OCRFT_MATCHCASE:2,OCRFT_FUZZYMATCH:4};a.EnumDWT_OCRFindTextAction={OCRFT_HIGHLIGHT:0,OCRFT_STRIKEOUT:1,OCRFT_MARKFORREDACT:2}}})(typeof window!=="undefined"?window:this);(function(a){function b(){var c=this;c.FindText="";c.FindTextFlags=Dynamsoft.DWT.EnumDWT_OCRFindTextFlags.OCRFT_WHOLEWORD;c.FindTextAction=Dynamsoft.DWT.EnumDWT_OCRFindTextAction.OCRFT_MARKFORREDACT}a.NewRedaction=function(){return new b()}})(Dynamsoft.Lib);Dynamsoft.WebTwain={Addon:{OCRPro:{}}};(function(a){function b(){var c=this;c.RecognitionModule="";c.Languages="eng";c.OutputFormat="";c.PDFVersion="";c.PDFAVersion="";c.LicenseChecker="";c.Redaction=Dynamsoft.Lib.NewRedaction()}a.NewSettings=function(){return new b()}})(Dynamsoft.WebTwain.Addon.OCRPro);(function(){function a(f,e,c,b){var d=this;d.left=f;d.top=e;d.right=c;d.bottom=b}Dynamsoft.WebTwain.Addon.OCRPro.NewOCRZone=function(e,d,c,b){return new a(e,d,c,b)}})();Dynamsoft.AddonReady(function(m,h){if(!m.product.bHTML5Edition){return}var n=1000,q=function(){return n++};function o(y){var z=m.html5.Funs;y.__innerGetOCRProResultAsyncFunction=function(B){var A=Dynamsoft.Lib.NewOCRProResult(this);if(B){A._errorCode=B.code;A._errorString=B.message;A._request=B.request;A._errorlist=B.errorList;A._ocrTotalCount=B.ocrTotalCount;A._alreadyOCRCount=B.alreadyOCRCount;A._resultlist=B.resultDetail;A._resultZoneDetail=B.resultZoneDetail}return A};y.__innerIsOCRTrial=function(A,B){var D=this,C=function(){var F=false;if(D.__licenseInfo.Detail){for(var E=0;E<D.__licenseInfo.Detail.length;E++){if(D.__licenseInfo.Detail[E].EnumLicenseType=="10"){if(D.__licenseInfo.Detail[E].Trial=="TRUE"){F=true}}}}return A(F)};if(D.__licenseInfo&&D.__licenseInfo.Detail){return C()}else{return D.GetLicenseInfo(C,B)}};y.__innerOCRReadFunction=function(D,I,E,H,A,B,G,C){var F=this;return F.__innerOCRAsyncReadFunction(D,I,E,H,A,B,G,C)};y.__innerOCRAsyncReadFunction=function(D,K,E,I,A,B,H,C){var G=this;var F=function(L){if(L.code==0){if(m.isFunction(H)){if(K!=-1){if(I==1){H(K,A,G.__innerGetOCRProResultAsyncFunction(L))}else{H(K,G.__innerGetOCRProResultAsyncFunction(L))}}else{if(E!=""){H(E,G.__innerGetOCRProResultAsyncFunction(L))}else{H(G.__innerGetOCRProResultAsyncFunction(L))}}}if(m.License.isLTS()){Dynamsoft.DWT.lcvrf(y)}}else{if(m.isFunction(C)){C(L.code,L.message,G.__innerGetOCRProResultAsyncFunction(L))}}z.hideMask(D)},J=function(L){z.hideMask(D)};z.showMask(D);G._innerSend(D,B,true,F,J);return true};y.__innerGetRequestJson=function(G,I,A,K,B){var F=y,C;var E="[{";E+='"id":"'+y.clientId+'",';E+='"method":"OCRProRecognize",';E+='"dllName":"'+B+'",';E+='"productkey":"'+Dynamsoft.DWT.ProductKey+'",';if(G==Dynamsoft.DWT.EnumDWT_OCRProType.OCRDT_File){E+='"inputType":"file",'}else{E+='"inputType":"index",'}E+='"input":[';for(C=0;C<I.length;C++){if(G==Dynamsoft.DWT.EnumDWT_OCRProType.OCRDT_File){E+='"'+I[C]+'"'}else{E+=I[C]}if(C+1<I.length){E+="|"}}E+="],";E+='"settings":{';E+='"recognitionMethod": "Page"';if(A){if(A.RecognitionModule&&A.RecognitionModule.length>0){E+=',"recognitionModule":"'+A.RecognitionModule+'"'}if(A.Languages&&A.Languages.length>0){E+=',"languages":"'+A.Languages+'"'}if(A.OutputFormat&&A.OutputFormat.length>0){E+=',"outputFormat":"'+A.OutputFormat+'"'}if(A.PDFVersion&&A.PDFVersion.length>0){E+=',"pdfVersion":"'+A.PDFVersion+'"'}if(A.PDFAVersion&&A.PDFAVersion.length>0){E+=',"pdfAVersion":"'+A.PDFAVersion+'"'}if(A.Redaction&&A.Redaction.FindText&&A.Redaction.FindText.length>0){var J=parseInt(A.Redaction.FindTextFlags),H=parseInt(A.Redaction.FindTextAction);if(!isNaN(J)&&!isNaN(H)){E+=',"redaction":{';var D=A.Redaction.FindText;D=D.replace(/"/g,['\\','"'].join(''));E+='"findText":"'+D+'"';E+=',"findTextFlags":'+J;E+=',"findTextAction":'+H;E+="}"}}}E+="},";E+='"zones":[';for(C=0;C<K.length;C++){E+="["+K[C].left+","+K[C].top+","+K[C].right+","+K[C].bottom+"]";if(C+1<K.length){E+=","}}E+="],";E+='"outputFile":""';E+="}]";return E};y.__LoadImageFromBytesForDownloadInner=function(E,K,O,J,L,B,H,M,D){var I=y;var A,C,G;if(E>=J){A=B*J;G=K.slice(A,L)}else{A=E*B;C=(E+1)*B;G=K.slice(A,C)}var N=function(){if(Dynamsoft.Lib.isFunction(D)){D()}};var F=function(){if(E>=J){if(Dynamsoft.Lib.isFunction(M)){M()}return}E=E+1;I.__LoadImageFromBytesForDownloadInner(E,K,O,J,L,B,H,M,D)};I.__LoadImageFromBytes(G,O,"",H,F,N,A,L)};y.__LoadImageFromBytesForDownload=function(H,B,G,D,C,J){var F=y;var A=2*1000*1000;var I=H.size||H.length;var E=parseInt(I/A);var K=I%A;if(K==0){E=E-1}F.__LoadImageFromBytesForDownloadInner(0,H,B,E,I,A,D,C,J)}}var e=function(B){var C=[],z,y,A;if(B._ImgManager.count()<=0){return C}y=B._ImgManager.getCurrentImageIndex();z=B._ImgManager.convertClientIndexToServerId(y);A=B._ImgManager.getSelectedClientIndexArray();if(m.isArray(A)){m.each(A,function(D){var E=B._ImgManager.convertClientIndexToServerId(D);C.push(E)})}return C},v=function(C,A,z,B){var y=m.NewOCRProResult(C);y._errorCode=A;y._errorString=z;var D=m.NewErrorInfo();D.input=B;D.message=y._errorString;D.page=0;y._errorlist=[D];return y},g=function(A){var B=m.html5.Funs,z,y;if(m.env.bMac){y="DynamicOCRPro_"+Dynamsoft.ProOCRVerInName+".dylib"}else{if(m.env.bLinux){y="DynamicOCRPro_"+Dynamsoft.ProOCRVerInName+".so"}else{if(Dynamsoft.dcp.b64bit){y="DynamicOCRProx64_"+Dynamsoft.ProOCRVerInName+".dll"}else{y="DynamicOCRPro_"+Dynamsoft.ProOCRVerInName+".dll"}}}o(A);z={OCRPro:{Settings:false,Recognize:function(N,K,D){var J=[],H,O,L,I;var G=A;G._resetErr();if(G._isMobileMode()){return G._mobileNotSupport("Addon.OCRPro.Recognize")}H=parseInt(N);if(m.isNaN(H)||!m.isNumber(H)){O=v(A,-2201,"Invalid parameter type.",N);if(m.isFunction(D)){D(O._errorCode,O._errorString,O)}else{m.Errors.WebviewerError(A,O._errorString,O._errorCode)}return false}var F=A._ImgManager.convertClientIndexToServerId(H);if(F==-1){if(m.isFunction(D)){m.Errors.IndexOutOfRange(A);O=v(A,A._errorCode,A._errorString,N);D(O._errorCode,O._errorString,O)}return false}if(!m.License.checkProductKey(A,{OCRPro:true},true)){if(m.isFunction(D)){O=v(A,A._errorCode,A._errorString,N);D(O._errorCode,O._errorString,O)}return false}J.push(F);var M=[],C=this.Settings;var E=A.__innerGetRequestJson(Dynamsoft.DWT.EnumDWT_OCRProType.OCRDT_Index,J,C,M,y);return A.__innerIsOCRTrial(function(P){if(P||m.License.isLTS()){return A.__innerOCRReadFunction("OCRProRecognize",N,"",0,M,E,K,D)}else{return w(C.LicenseChecker,A,"OCRProRecognize",N,"",0,M,E,K,D)}},D)},RecognizeRect:function(X,P,R,G){var N=[],K,M,F,L;var S=A;S._resetErr();if(S._isMobileMode()){return S._mobileNotSupport("Addon.OCRPro.RecognizeRect")}K=parseInt(X);if(m.isNaN(K)||!m.isNumber(K)){M=v(A,-2201,"Invalid parameter type.",X);if(m.isFunction(G)){G(M._errorCode,M._errorString,M)}else{m.Errors.WebviewerError(A,M._errorString,M._errorCode)}return false}var Q=A._ImgManager.convertClientIndexToServerId(K), oControl=A._ImgManager.getImageIdMap(Q),T=(oControl && oControl.imageWidth)?oControl.imageWidth:A.GetImageWidth(K),J=(oControl && oControl.imageHeight)?oControl.imageHeight:A.GetImageHeight(K);if(Q==-1){if(m.isFunction(G)){m.Errors.IndexOutOfRange(A);M=v(A,A._errorCode,A._errorString,X);G(M._errorCode,M._errorString,M)}return false}if(!m.License.checkProductKey(A,{OCRPro:true},true)){if(m.isFunction(G)){M=v(A,A._errorCode,A._errorString,X);G(M._errorCode,M._errorString,M)}return false}if(T>0&&J>0){var V,E,U,W,I,D;for(var O=0;O<P.length;O++){V=P[O];E=V.left;U=V.top;W=V.right;I=V.bottom;if(E<0){E=0}if(U<0){U=0}if(W<0){W=0}if(I<0){I=0}if(E>W){D=E;E=W;W=D}if(U>I){D=U;U=I;I=D}if(W>T){W=T}if(I>J){I=J}V.left=E;V.top=U;V.right=W;V.bottom=I}}N.push(Q);var C=this.Settings;var H=A.__innerGetRequestJson(Dynamsoft.DWT.EnumDWT_OCRProType.OCRDT_Index,N,C,P,y);return A.__innerIsOCRTrial(function(Y){if(Y||m.License.isLTS()){return A.__innerOCRReadFunction("OCRProRecognize",X,"",1,P,H,R,G)}else{return w(C.LicenseChecker,A,"OCRProRecognize",X,"",1,P,H,R,G)}},G)},RecognizeFile:function(D,M,G){var I=A;I._resetErr();if(I._isMobileMode()){return I._mobileNotSupport("Addon.OCRPro.RecognizeFile")}var P,N,K;if(D.length==0){if(m.isFunction(G)){P=Dynamsoft.Lib.NewOCRProResult(A);P._errorCode=-2201;P._errorString="File name cannot be empty.";K=[];N=Dynamsoft.Lib.NewErrorInfo();N.input=D;N.message=P._errorString;N.page=0;K.push(N);P._errorlist=K;G(P._errorCode,P._errorString,P)}return false}if(!m.License.checkProductKey(A,{OCRPro:true},true)){if(m.isFunction(G)){P=Dynamsoft.Lib.NewOCRProResult(A);P._errorCode=A._errorCode;P._errorString=A._errorString;K=[];N=Dynamsoft.Lib.NewErrorInfo();N.input=D;N.message=P._errorString;N.page=0;K.push(N);P._errorlist=K;G(P._errorCode,P._errorString,P)}return false}var J=B.replaceLocalFilename(D);var C=[];if(J.indexOf("|")>0){C=J.split("|")}else{if(J.indexOf(";")>0){C=J.split(";")}else{if(J.indexOf(",")>0){C=J.split(",")}}}var L=[];if(C.length>0){for(var F=0;F<C.length;F++){L.push(C[F])}}else{L.push(J)}var O=[],E=this.Settings;var H=A.__innerGetRequestJson(Dynamsoft.DWT.EnumDWT_OCRProType.OCRDT_File,L,E,O,y);A.__innerIsOCRTrial(function(Q){if(Q||m.License.isLTS()){return A.__innerOCRReadFunction("OCRProRecognize",-1,D,0,O,H,M,G)}else{return w(E.LicenseChecker,A,"OCRProRecognize",-1,D,0,O,H,M,G)}},G)},RecognizeSelectedImages:function(J,D){var G,H,K;var F=A;F._resetErr();if(F._isMobileMode()){return F._mobileNotSupport("Addon.OCRPro.RecognizeSelectedImages")}if(!m.License.checkProductKey(A,{OCRPro:true},true)){if(m.isFunction(D)){var M=Dynamsoft.Lib.NewOCRProResult(A);M._errorCode=A._errorCode;M._errorString=A._errorString;H=[];K=Dynamsoft.Lib.NewErrorInfo();K.input="";K.message=M._errorString;K.page=0;H.push(K);M._errorlist=H;D(M._errorCode,M._errorString,M)}return false}var L=[],C=this.Settings,I=e(A),E=A.__innerGetRequestJson(Dynamsoft.DWT.EnumDWT_OCRProType.OCRDT_Index,I,C,L,y);A.__innerIsOCRTrial(function(N){if(N||m.License.isLTS()){G=A.__innerOCRReadFunction("OCRProRecognize",-1,"",0,L,E,J,D)}else{G=w(C.LicenseChecker,A,"OCRProRecognize",-1,"",0,L,E,J,D)}},D);return G},IsModuleInstalled:function(){var D=A;D._resetErr();if(D._isMobileMode()){return D._mobileNotSupport("Addon.OCRPro.IsModuleInstalled")}var C=D._innerFun("GetAddOnVersion",B.makeParams("proocr",y));return(C!="")}}};A.__addon=A.__addon||{};m.mix(A.__addon,z)};if(m.DynamicLoadAddonFuns){m.DynamicLoadAddonFuns.push(g)}function p(E,H,z,I,B,G,y,C,F,A){var D=this;D.STWAIN=H;D.AjaxFunctionUrl=E;D.FunctionName=z;D.ImageIndex=I;D.FileNames=B;D.Type=G;D.AryZone=y;D.JsonString=C;D.OnSuccess=F;D.OnFailure=A}Dynamsoft.WebTwain.Addon.OCRPro.NewOCRReadPara=function(D,G,z,H,B,F,y,C,E,A){return new p(D,G,z,H,B,F,y,C,E,A)};function s(C,B){var D="";var E=C.responseText;if(E.length==0){var A=Dynamsoft.WebTwain.Addon.OCRPro.NewOCRError();Dynamsoft.Lib.Errors.OCR_LicenseCheckerError(A,B.AjaxFunctionUrl);E=A.responseText}D=f(E);var z=D.split(";");if(z.length==1){B.OnFailure(-1,E,Dynamsoft.Lib.NewOCRProResult())}else{if(z[0]=="true"){var y=function(G,F,H){if(Dynamsoft.Lib.isUndefined(H)){if(Dynamsoft.Lib.isUndefined(F)){B.OnSuccess(G);x(B.AjaxFunctionUrl,G.GetPageCount())}else{B.OnSuccess(G,F);x(B.AjaxFunctionUrl,F.GetPageCount())}}else{B.OnSuccess(G,F,H);x(B.AjaxFunctionUrl,H.GetPageCount())}};B.STWAIN.__innerOCRReadFunction(B.FunctionName,B.ImageIndex,B.FileNames,B.Type,B.AryZone,B.JsonString,y,B.OnFailure)}else{B.OnFailure(z[1],z[2],Dynamsoft.Lib.NewOCRProResult())}}}function w(G,J,z,K,D,I,y,E,H,A){var B=G;var F="DTW_AjaxMethod=CheckLicense&Productkey="+j(Dynamsoft.DWT.ProductKey);var C=Dynamsoft.WebTwain.Addon.OCRPro.NewOCRReadPara(G,J,z,K,D,I,y,E,H,A);return d(B,F,s,C)}function x(A,B){var z=A;var y="DTW_AjaxMethod=WriteOCRCount&OCRCount="+j(B+"");d(z,y,b,null)}function b(z,y){}function a(){var y=this;y.responseText="";y.errorString=""}Dynamsoft.WebTwain.Addon.OCRPro.NewOCRError=function(){return new a()};Dynamsoft.Lib.mix(Dynamsoft.Lib.Errors,{OCR_LicenseCheckerEmpty:function(z){var A=-2601;var y="LicenseChecker cannot be empty.";z.errorString=y;z.responseText=j("false;"+A+";"+y+";")},OCR_LicenseCheckerNotConnect:function(z){var A=-2602;var y="Cannot connect to the LicenseChecker, please check and make sure it's set correctly.";z.errorString=y;z.responseText=j("false;"+A+";"+y+";")},OCR_AccessDenied:function(z){var A=-2603;var y="Access denied.";z.errorString=y;z.responseText=j("false;"+A+";"+y+";")},OCR_LicenseCheckerError:function(z,B){var A=-2604;var y="Error occured in '"+B+"'.";z.errorString=y;z.responseText=j("false;"+A+";"+y+";")},OCR_HTTPError:function(z,A){var B=-2605;var y="HTTP Error "+A+".";z.errorString=y;z.responseText=j("false;"+B+";"+y+";")},OCR_LicenseCheckerUnauthorized:function(z,B){var A=-2606;var y="You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to '"+B+"'.";z.errorString=y;z.responseText=j("false;"+A+";"+y+";")},__last:false});function i(){var y=null,A=window;try{y=new A.ActiveXObject("Msxml2.XMLHTTP")}catch(z){try{y=new A.ActiveXObject("Microsoft.XMLHTTP")}catch(z){y=new XMLHttpRequest()}}return y}function d(z,y,D,C){var A=Dynamsoft.WebTwain.Addon.OCRPro.NewOCRError();if(z==""){Dynamsoft.Lib.Errors.OCR_LicenseCheckerEmpty(A);alert(A.errorString);D(A,C);return false}var B=i();B.open("POST",z,true);B.setRequestHeader("Content-Type","application/x-www-form-urlencoded");B.onreadystatechange=function(){if(B.readyState==4){if(B.status==200){if(D!=null&&typeof(D)=="function"){D(B,C)}}else{if(B.status==401){Dynamsoft.Lib.Errors.OCR_LicenseCheckerUnauthorized(A,C.AjaxFunctionUrl);D(A,C);return false}else{if(B.status==404){Dynamsoft.Lib.Errors.OCR_LicenseCheckerNotConnect(A);alert(A.errorString);D(A,C);return false}else{if(B.status==403){Dynamsoft.Lib.Errors.OCR_AccessDenied(A);D(A,C);return false}else{Dynamsoft.Lib.Errors.OCR_HTTPError(A,B.status);D(A,C);return false}}}}}};if(B&&y){B.send(y)}return true}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var r=new Array(-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);function k(E){var A,C,y;var D,B,z;y=E.length;C=0;A="";while(C<y){D=E.charCodeAt(C++)&255;if(C==y){A+=c.charAt(D>>2);A+=c.charAt((D&3)<<4);A+="==";break}B=E.charCodeAt(C++);if(C==y){A+=c.charAt(D>>2);A+=c.charAt(((D&3)<<4)|((B&240)>>4));A+=c.charAt((B&15)<<2);A+="=";break}z=E.charCodeAt(C++);A+=c.charAt(D>>2);A+=c.charAt(((D&3)<<4)|((B&240)>>4));A+=c.charAt(((B&15)<<2)|((z&192)>>6));A+=c.charAt(z&63)}return A}function t(F){var E,D,B,z;var C,y,A;y=F.length;C=0;A="";while(C<y){do{E=r[F.charCodeAt(C++)&255]}while(C<y&&E==-1);if(E==-1){break}do{D=r[F.charCodeAt(C++)&255]}while(C<y&&D==-1);if(D==-1){break}A+=String.fromCharCode((E<<2)|((D&48)>>4));do{B=F.charCodeAt(C++)&255;if(B==61){return A}B=r[B]}while(C<y&&B==-1);if(B==-1){break}A+=String.fromCharCode(((D&15)<<4)|((B&60)>>2));do{z=F.charCodeAt(C++)&255;if(z==61){return A}z=r[z]}while(C<y&&z==-1);if(z==-1){break}A+=String.fromCharCode(((B&3)<<6)|z)}return A}function u(B){var z,A,y,C;z="";y=B.length;for(A=0;A<y;A++){C=B.charCodeAt(A);if((C>=1)&&(C<=127)){z+=B.charAt(A)}else{if(C>2047){z+=String.fromCharCode(224|((C>>12)&15));z+=String.fromCharCode(128|((C>>6)&63));z+=String.fromCharCode(128|((C>>0)&63))}else{z+=String.fromCharCode(192|((C>>6)&31));z+=String.fromCharCode(128|((C>>0)&63))}}}return z}function l(D){var z,B,y,E;var C,A;z="";y=D.length;B=0;while(B<y){E=D.charCodeAt(B++);switch(E>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:z+=D.charAt(B-1);break;case 12:case 13:C=D.charCodeAt(B++);z+=String.fromCharCode(((E&31)<<6)|(C&63));break;case 14:C=D.charCodeAt(B++);A=D.charCodeAt(B++);z+=String.fromCharCode(((E&15)<<12)|((C&63)<<6)|((A&63)<<0));break}}return z}function j(y){return k(u(y))}function f(y){return l(t(y))}});
/*! 20261015101012
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*
* Module: OCR Connector
* Version: 19.5
* 
*/
var Dynamsoft=self.Dynamsoft||{};Dynamsoft.DWT=Dynamsoft.DWT||{},Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[],Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(e){Dynamsoft.aryAddonReadyFun.push(e)},Dynamsoft.DWT.OCRConnectorVerInName="19.5.0.0922",function(){for(var e=[Dynamsoft.DWT],r=0;r<1;r++){var n=e[r];n.EnumDWT_OCRConnectorOutputFormat={TEXT:0,PDF_PLAIN_TEXT:1,PDF_WITH_EXTRA_TEXTLAYER:2},n.EnumDWT_PageOrientation={AUTO:-1,ANGLE_0:0,ANGLE_90:90,ANGLE_180:180,ANGLE_270:270},n.EnumDWT_PageOrientationDetectionMode={FAST:0,BALANCE:1,PRECISION:2}}}(),Dynamsoft.AddonReady(function(d,e){function r(e,r,n){e._errorCode=r,e._errorString=n}function o(e,r){return"code"in r&&"message"in r&&0!=r.code&&""!=r.message&&(e._errorCode=r.code,e._errorString=r.message,{code:r.code,message:r.message})}d.product.bHTML5Edition&&(d.Errors.OCRConnector_InvalidSupportedPlatforms=function(e){r(e,-2701,"The OCR Connector feature is only supported on 64-bit Windows or macOS.")},d.Errors.OCRConnector_InvalidFilename=function(e){r(e,-2702,"Invalid filename.")},d.DynamicLoadAddonFuns)&&d.DynamicLoadAddonFuns.push(function(a){var e,s,i,c=d.html5.Funs;s=a,i=d.html5.Funs,s.__innerOCRReadFunction=function(e,r){var n=s,e=n._ImgManager.convertClientIndexToServerId(e),e=d.stringify({index:e,options:r});return n._innerFunV2("OCROnnx",["[",e,"]"].join("")).then(function(e){var r=o(n,e);return r?d.Promise.reject(r):e})},s.__innerGetOCRInfo=function(){var n=s;return n._innerFunV2("GetOCROnnxEnv",i.makeParams(Dynamsoft.DWT.OCRConnectorVerInName)).then(function(e){var r=o(n,e);if(e)e.version=Dynamsoft.DWT.OCRConnectorVerInName;return r?d.Promise.reject(r):e})},s.__innerDetectPageOrientation=function(e,r){var n=s,e=n._ImgManager.convertClientIndexToServerId(e),e=d.stringify({index:e,settings:r});return n._innerFunV2("DetectPageOrientation",["[",e,"]"].join("")).then(function(e){var r=o(n,e);return r?d.Promise.reject(r):{angle:e.angle||0,confidence:e.confidence||0}})},s.__innerSaveToPath=function(e,r,n){var o=s,t=[];return d.isArray(e)&&d.each(e,function(e){e=s._ImgManager.convertClientIndexToServerId(e);t.push(e)}),o._innerFunV2("SaveOCRResult",i.makeParams(0,t.join(","),r,n))},s.__innerSaveAsBlob=function(e,n){var r=s,o=[],e=(d.isArray(e)&&d.each(e,function(e){e=s._ImgManager.convertClientIndexToServerId(e);o.push(e)}),["[",1,',"',o.join(","),'",',n,"]"].join(""));return r._sendDataByHttpAsync("SaveOCRResult",e,"arraybuffer",!0).then(function(e){var r="application/pdf";return n==Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.TEXT&&(r="text/plain"),new Blob([e],{type:r})})},s.__innerSaveAsBase64=function(e,r){var n=s,o=[];return d.isArray(e)&&d.each(e,function(e){e=s._ImgManager.convertClientIndexToServerId(e);o.push(e)}),n._innerFunV2("SaveOCRResult",i.makeParams(2,o.join(","),r))},e={OCRConnector:{GetInstalledOCRInfo:function(){var e=a,r="GetInstalledOCRInfo";return e._resetErr(),c.showMask(r),Dynamsoft.dcp.b64bit?d.License.checkProductKey(e,{OCRConnector:!0},!0)?e.__innerGetOCRInfo().finally(function(){c.hideMask(r)}):(c.hideMask(r),d.Promise.reject({code:e._errorCode,message:e._errorString})):(d.Errors.OCRConnector_InvalidSupportedPlatforms(e),c.hideMask(r),d.Promise.reject({code:e._errorCode,message:e._errorString}))},DetectPageOrientation:function(e,r){var n=a,o="DetectPageOrientation";if(n._resetErr(),c.showMask(o),!Dynamsoft.dcp.b64bit)return d.Errors.OCRConnector_InvalidSupportedPlatforms(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});if(!d.License.checkProductKey(n,{OCRConnector:!0},!0))return c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});e=parseInt(e);if(isNaN(e))return d.Errors.InvalidIndex(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});if(e<0||e>=n.HowManyImagesInBuffer)return d.Errors.IndexOutOfRange(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});if(null==r)r={};else if(!d.isObject(r))return d.Errors.InvalidParameter(a),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});return isNaN(r.detectionMode)&&(r.detectionMode=1),n.__innerDetectPageOrientation(e,r).finally(function(){c.hideMask(o)})},Recognize:function(e,r){var n=a,o="Recognize";if(n._resetErr(),c.showMask(o),!Dynamsoft.dcp.b64bit)return d.Errors.OCRConnector_InvalidSupportedPlatforms(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});if(!d.License.checkProductKey(n,{OCRConnector:!0},!0))return c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});e=parseInt(e);if(isNaN(e)||e<0||e>=n.HowManyImagesInBuffer)return d.Errors.IndexOutOfRange(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});if(null==r)r={settings:{}};else if(null==r.settings)r.settings={};else if(!d.isObject(r.settings))return d.Errors.InvalidParameter(a),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});if(isNaN(r.settings.pageOrientation)&&(r.settings.pageOrientation=1),isNaN(r.settings.binarizationThreshold)&&(r.settings.binarizationThreshold=.3),isNaN(r.settings.boxThreshold)&&(r.settings.boxThreshold=.1),null==r.rects)r.rects=[];else if(!d.isArray(r.rects))return d.Errors.IndicesNotArray(a),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString});return n.__innerOCRReadFunction(e,r).finally(function(){c.hideMask(o)})},SaveToPath:function(e,r,n){var o,t=a,s="SaveToPath";return t._resetErr(),c.showMask(s),Dynamsoft.dcp.b64bit?d.License.checkProductKey(t,{OCRConnector:!0},!0)&&t._checkIndices(e)?d.isString(n)&&""!=n&&"/"!=n?(o=parseInt(r),!(isNaN(o)||o<Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.TEXT||o>Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.PDF_WITH_EXTRA_TEXTLAYER)&&(t.IfShowFileDialog||d.isString(n)&&""!==n)?(n=n,r==Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.TEXT&&".txt"!==(n=0<=(r=n.lastIndexOf("/"))?n.slice(r+1):n).slice(-4).toLowerCase()&&(n+=".txt"),r=d.html5.Funs.replaceLocalFilename(n),t.__innerSaveToPath(e,o,r).finally(function(){c.hideMask(s)})):(d.Errors.InvalidValue(t),c.hideMask(s),d.Promise.reject({code:t._errorCode,message:t._errorString}))):(d.Errors.OCRConnector_InvalidFilename(t),c.hideMask(s),d.Promise.reject({code:t._errorCode,message:t._errorString})):(c.hideMask(s),d.Promise.reject({code:t._errorCode,message:t._errorString})):(d.Errors.OCRConnector_InvalidSupportedPlatforms(t),c.hideMask(s),d.Promise.reject({code:t._errorCode,message:t._errorString}))},SaveAsBlob:function(e,r){var n=a,o="SaveAsBlob";return n._resetErr(),c.showMask(o),Dynamsoft.dcp.b64bit?d.License.checkProductKey(n,{OCRConnector:!0},!0)&&n._checkIndices(e)?(r=parseInt(r),isNaN(r)||r<Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.TEXT||r>Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.PDF_WITH_EXTRA_TEXTLAYER?(d.Errors.InvalidValue(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString})):n.__innerSaveAsBlob(e,r).finally(function(){c.hideMask(o)})):(c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString})):(d.Errors.OCRConnector_InvalidSupportedPlatforms(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString}))},SaveAsBase64:function(e,r){var n=a,o="SaveAsBase64";return n._resetErr(),c.showMask(o),Dynamsoft.dcp.b64bit?d.License.checkProductKey(n,{OCRConnector:!0},!0)&&n._checkIndices(e)?(r=parseInt(r),isNaN(r)||r<Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.TEXT||r>Dynamsoft.DWT.EnumDWT_OCRConnectorOutputFormat.PDF_WITH_EXTRA_TEXTLAYER?(d.Errors.InvalidValue(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString})):n.__innerSaveAsBase64(e,r).finally(function(){c.hideMask(o)})):(c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString})):(d.Errors.OCRConnector_InvalidSupportedPlatforms(n),c.hideMask(o),d.Promise.reject({code:n._errorCode,message:n._errorString}))}}},a.__addon=a.__addon||{},d.mix(a.__addon,e)})});
/*! 20261015101011
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*
* Module: Webcam
* Version: 19.5
* 
*/
var Dynamsoft=self.Dynamsoft||{};Dynamsoft.DWT=Dynamsoft.DWT||{},Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[],Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(e){Dynamsoft.aryAddonReadyFun.push(e)},function(){for(var e=[Dynamsoft.DWT],t=0;t<1;t++){var n=e[t];n.EnumDWT_VideoRotateMode={VRM_NONE:0,VRM_90_DEGREES_CLOCKWISE:1,VRM_180_DEGREES_CLOCKWISE:2,VRM_270_DEGREES_CLOCKWISE:3,VRM_FLIP_VERTICAL:4,VRM_FLIP_HORIZONTAL:5},n.EnumDWT_VideoProperty={VP_BRIGHTNESS:0,VP_CONTRAST:1,VP_HUE:2,VP_SATURATION:3,VP_SHARPNESS:4,VP_GAMMA:5,VP_COLORENABLE:6,VP_WHITEBALANCE:7,VP_BACKLIGHTCOMPENSATION:8,VP_GAIN:9},n.EnumDWT_CameraControlProperty={CCP_PAN:0,CCP_TILT:1,CCP_ROLL:2,CCP_ZOOM:3,CCP_EXPOSURE:4,CCP_IRIS:5,CCP_FOCUS:6}}}(),function(){Dynamsoft.Lib.WebcamErrors={InvalidParameter:function(e){e._errorCode=-10001,e._errorString="The parameter is invalid."},VideoNotPlayingWhenCapture:function(e){e._errorCode=-10002,e._errorString="To capture an image, the video must be playing."},VideoNotPlayingWhenGetURL:function(e){e._errorCode=-10003,e._errorString="To get the url for the current frame, the video must be playing."},VideoNotPlayingWhenSetToken:function(e){e._errorCode=-10004,e._errorString="The webcam addon is not available when an access token is enabled."},Success:function(e){e._errorCode=0,e._errorString="Successful."}}}(),function(n){function t(e){var t=this;t._Count=0,t._resultlist=[],t._stwain=e}t.prototype.GetCount=function(){return n.WebcamErrors.Success(this._stwain),this._Count-1},t.prototype.Get=function(e){var t=this;return t._resultlist.length-1<=e||e<0?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(t._stwain,"Get"),""):(n.WebcamErrors.Success(t._stwain),t._resultlist[e])},t.prototype.GetCurrent=function(){var e=this,t=e._resultlist.length;return 0==t?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,"GetCurrent"),""):(n.WebcamErrors.Success(e._stwain),e._resultlist[t-1])},n.NewWebcamValue=function(e){return new t(e)}}(Dynamsoft.Lib),function(t){function n(e){var t=this;t._Count=0,t._resultlist=[],t._stwain=e}n.prototype.GetValue=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),""):(t.WebcamErrors.Success(e._stwain),e._resultlist[0].current)},n.prototype.GetIfAuto=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),!1):(t.WebcamErrors.Success(e._stwain),"true"==e._resultlist[0].auto)},t.NewWebcamSetting=function(e){return new n(e)}}(Dynamsoft.Lib),function(e){function t(e){var t=this;t._Count=0,t._resultlist=[],t._stwain=e}t.prototype.GetMinValue=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),""):e._resultlist[0].min},t.prototype.GetMaxValue=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),""):e._resultlist[0].max},t.prototype.GetSteppingDelta=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),0):e._resultlist[0].step},t.prototype.GetDefaultValue=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),0):e._resultlist[0].defaultValue},t.prototype.GetIfAuto=function(){var e=this;return 0==e._resultlist.length?(Dynamsoft.Lib.Errors.Webcam_InvalidIndex(e._stwain,""),!1):"true"==e._resultlist[0].auto},e.NewWebcamMoreSetting=function(e){return new t(e)}}(Dynamsoft.Lib),Dynamsoft.AddonReady(function(r,e){r.DynamicLoadAddonFuns&&r.DynamicLoadAddonFuns.push(function(n){n._innerSetWebcamValue=function(e){var t=r.NewWebcamValue(n);return e&&r.isArray(e)&&(t._resultlist=e,t._Count=e.length),t},n._innerSetWebcamSetting=function(e){var t=r.NewWebcamSetting(n);return e&&r.isArray(e)&&(t._resultlist=e,t._Count=e.length),t},n._innerSetWebcamMoreSetting=function(e){var t=r.NewWebcamMoreSetting(n);return e&&r.isArray(e)&&(t._resultlist=e,t._Count=e.length),t}}),r.Addon_Events.push("OnFrameCaptured"),r.Addon_Events.push("OnCaptureSuccess"),r.Addon_Events.push("OnCaptureError"),r.Addon_Events.push("OnVideoStopped")}),Dynamsoft.AddonReady(function(c,e){c.product.bHTML5Edition&&c.DynamicLoadAddonFuns&&c.DynamicLoadAddonFuns.push(function(d){var e,s=c.html5.Funs;d.__frameCapturedId=-1,(e=d)._innerWebcamValueFunction=function(e,t){e=this._innerFunRaw(e,t,!1,!1);return this._innerSetWebcamValue(e)},e._innerWebcamSettingFunction=function(e,t){e=this._innerFunRaw(e,t,!1,!1);return this._innerSetWebcamSetting(e)},e._innerWebcamMoreSettingFunction=function(e,t){e=this._innerFunRaw(e,t,!1,!1);return this._innerSetWebcamMoreSetting(e)},e._OnCaptureSuccess=function(e){Dynamsoft.Lib.isFunction(this.__OnCaptureSuccess)&&this.__OnCaptureSuccess()},e._OnCaptureError=function(e){var t=e[1],e=e[2];Dynamsoft.Lib.isFunction(this.__OnCaptureError)&&this.__OnCaptureError(t,e)},e._OnFrameCaptured=function(e){var t=this,n=t.__videoQuality,r=!1,n=n||60;t.__videoDest&&Dynamsoft.Lib.isFunction(t.__videoDest.GetIfShowVideoContainer)&&t.__videoDest.GetIfShowVideoContainer()&&(Dynamsoft.navInfoSync.bIE||!e||e&&e.length<=1||e&&1<e.length&&t.__frameCapturedId!=e[1])&&(e&&1<e.length&&t.__frameCapturedId!=e[1]&&(r=t.__frameCapturedId!=e[1]),t.__frameCapturedId=e[1],t._videoSrc=t.GetImageURL(-1,-1,-1,0,n),Dynamsoft.Lib.isFunction(t.__videoDest.UpdateVideoContainer))&&t.__videoDest.UpdateVideoContainer(t._videoSrc),Dynamsoft.Lib.isFunction(t.__OnFrameCaptured)&&setTimeout(function(){Dynamsoft.Lib.isFunction(t.__OnFrameCaptured)&&t.__OnFrameCaptured(r,e)},200)},e._OnVideoStopped=function(e){var t=e[1],e=e[2];Dynamsoft.Lib.isFunction(this.__OnVideoStopped)&&this.__OnVideoStopped(t,e)},e={Webcam:{IsModuleInstalled:function(){return!0},GetSourceList:function(){var e,t=d;return t._resetErr(),c.License.checkProductKey(t,{Webcam:!0},!0)?(e=t._innerFunRaw("GetWebcamSourceList"),0==t.ErrorCode&&e&&1<e.length&&e.splice(e.length-1,1),e):[]},SelectSource:function(e){var t=d;return t._resetErr(),!!c.License.checkProductKey(t,{Webcam:!0},!0)&&(t.__videoDest&&this._isPlaying()&&""!=t._videoSrc&&Dynamsoft.Lib.isFunction(t.__videoDest.UpdateVideoContainer)&&t.__videoDest.UpdateVideoContainer(t._videoSrc),t._innerFun("SelectWebcam",s.makeParams(e)))},CloseSource:function(){var e=d;return e._resetErr(),this._clear(),e._innerFun("StopCapture")},GetFramePartURL:function(){var e=d;return e._resetErr(),this._isPlaying()?e.GetImageURL(-1,-1,-1,!0,e.__videoQuality):(c.WebcamErrors.VideoNotPlayingWhenGetURL(e),"")},GetFrameURL:function(){var e=d;return e._resetErr(),this._isPlaying()?e.GetImageURL(-1,-1,-1,0,e.__videoQuality):(c.WebcamErrors.VideoNotPlayingWhenGetURL(e),"")},PlayVideo:function(e,t,n,r,i){function o(){return Dynamsoft.Lib.isFunction(i)&&i(d._errorCode,d._errorString),!1}var a=d,u=60;return Dynamsoft.DWT.UseDefaultViewer?e?Dynamsoft.Lib.isFunction(e.ShowVideoContainer)&&Dynamsoft.Lib.isFunction(e.UpdateVideoContainer)&&Dynamsoft.Lib.isFunction(e.GetIfShowVideoContainer)?"1"==Dynamsoft.Lib.product.tokenFlag?(c.WebcamErrors.VideoNotPlayingWhenSetToken(d),o()):Dynamsoft.Lib.License.checkProductKey(d,{Webcam:!0},!0)?(a._resetErr(),a.__videoDest=e,d.__videoQuality=t?u=(u=+t)<1?60:u:u,Dynamsoft.Lib.isFunction(a.__videoDest.ShowVideoContainer)&&a.__videoDest.ShowVideoContainer(!0),Dynamsoft.Lib.isFunction(n)&&(d.__OnFrameCaptured=n),r?(d._innerSend("PlayVideo",s.makeParams("play",u),!0,r,o),!0):d._innerFun("PlayVideo",s.makeParams("play",u))):o():(Dynamsoft.Lib.Errors.ParameterNotDWTObject(d),o()):(Dynamsoft.Lib.Errors.ParameterCannotEmpty(d),o()):(Dynamsoft.Lib.Errors.CannotDoWhenNoViewerJS(d),!1)},PauseVideo:function(e,t){return d._resetErr(),e?(d._innerSend("PlayVideo",s.makeParams("pause"),!0,e,function(){return Dynamsoft.Lib.isFunction(t)&&t(d._errorCode,d._errorString),!1}),!0):d._innerFun("PlayVideo",s.makeParams("pause"))},_clear:function(){var e=d;e.__OnFrameCaptured=!1,e.__videoQuality=60,e.__videoDest&&Dynamsoft.Lib.isFunction(e.__videoDest.UpdateVideoContainer)&&Dynamsoft.Lib.isFunction(e.__videoDest.ShowVideoContainer)&&(e.__videoDest.UpdateVideoContainer("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAANSURBVBhXY/j///9/AAn7A/0FQ0XKAAAAAElFTkSuQmCC"),e._videoSrc="",e.__videoDest.ShowVideoContainer(!1))},_isPlaying:function(){var e=d;return!(!e.__videoDest||!Dynamsoft.Lib.isFunction(e.__videoDest.GetIfShowVideoContainer))&&e.__videoDest.GetIfShowVideoContainer()},StopVideo:function(){var e=d,t=(e._resetErr(),this._clear(),e._innerFun("PlayVideo",s.makeParams("stop"))),n=e._errorCode,r=e._errorString;return e._innerFun("StopCapture"),e._errorCode=n,e._errorString=r,t},CaptureImage:function(e,t){var n=d;if(n._resetErr(),!Dynamsoft.Lib.License.checkProductKey(n,{Webcam:!0},!0))return Dynamsoft.Lib.isFunction(t)&&t(n._errorCode,n._errorString),!1;function r(){s.hideMask(i),Dynamsoft.Lib.isFunction(t)&&t(n._errorCode,n._errorString)}var i="CaptureImage";s.showMask(i),n.__OnCaptureError=r,n._innerSend(i,s.makeParams(!1),!0,function(){s.hideMask(),0==n.ErrorCode?(s.hideMask(i),Dynamsoft.Lib.isFunction(e)&&setTimeout(e,0),Dynamsoft.Lib.License.isLTS()&&Dynamsoft.DWT.lcvrf(d)):r(n.ErrorCode,n.ErrorString)},r)},GetMediaType:function(){var e=d;return e._resetErr(),e._innerWebcamValueFunction("GetMediaType")},SetMediaType:function(e){var t=d;return t._resetErr(),c.isString(e)?t._innerFun("SetMediaType",s.makeParams(e)):(c.Errors.InvalidValue(t),!1)},GetResolution:function(){var e=d,e=(e._resetErr(),e._innerWebcamValueFunction("GetResolution"));if(e&&e._resultlist){var t,n,r=e._resultlist,i=[],o=[];for(""==(n=0<r.length?r[r.length-1]:n)&&0<r.length&&(n=r[0]),t=0;t<r.length-1;t++){for(var a,u=(a=r[t]).toLowerCase().split("x"),s=(_=c=s=void 0,{value:a,p1:parseInt(u[0]),p2:parseInt(u[1])}),c=i,_=c.length-1;0<=_&&c[_].p1>=s.p1&&!(c[_].p1==s.p1&&c[_].p2<s.p2);)c[_+1]=c[_],_--;c[_+1]=s}for(t=0;t<i.length;t++)a=i[t].value,o.push(a);n&&o.push(n),e._resultlist=o,o=i=null}return e},SetResolution:function(e){var t=d;return t._resetErr(),c.isNumber(e)||c.isString(e)?t._innerFun("SetResolution",s.makeParams(e)):(c.Errors.InvalidValue(t),!1)},GetFrameRate:function(){var e=d;return e._resetErr(),e._innerWebcamValueFunction("GetFrameRate")},SetFrameRate:function(e){var t=d;return t._resetErr(),c.isNumber(e)?d._innerFun("SetFrameRate",s.makeParams(e)):(c.Errors.InvalidValue(t),!1)},GetVideoPropertySetting:function(e){var t=d;return t._resetErr(),t._innerWebcamSettingFunction("GetWebcamVideoPropertySetting",s.makeParams(e))},GetVideoPropertyMoreSetting:function(e){var t=d;return t._resetErr(),t._innerWebcamMoreSettingFunction("GetWebcamVideoPropertyMoreSetting",s.makeParams(e))},SetVideoPropertySetting:function(e,t,n){var r=d;return r._resetErr(),r._innerFun("SetWebcamVideoPropertySetting",s.makeParams(e,t,n))},SetVideoRotateMode:function(e){var t=d;return t._resetErr(),t._innerFun("SetVideoRotateMode",s.makeParams(e))},GetCameraControlPropertySetting:function(e){var t=d;return t._resetErr(),t._innerWebcamSettingFunction("GetWebcamCameraControlSetting",s.makeParams(e))},GetCameraControlPropertyMoreSetting:function(e){var t=d;return t._resetErr(),t._innerWebcamMoreSettingFunction("GetWebcamCameraControlMoreSetting",s.makeParams(e))},SetCameraControlPropertySetting:function(e,t,n){var r=d;return r._resetErr(),r._innerFun("SetWebcamCameraControlPropertySetting",s.makeParams(e,t,n))}}},d.__addon=d.__addon||{},c.mix(d.__addon,e)})}),Dynamsoft.AddonReady(function(l,e){l.product.bActiveXEdition&&l.DynamicLoadAddonFuns&&l.DynamicLoadAddonFuns.push(function(d){var m,e;if(!d.getSWebTwain()||!d.getSWebTwain().Addon)return!1;Dynamsoft.navInfoSync.bWin&&Dynamsoft.navInfo.bOSx64&&Dynamsoft.navInfo.bWOW64,m=d.getSWebTwain(),(e=d)._innerRead=function(e){var t;try{t=Dynamsoft.Lib.parse(e)}catch(e){}return t.result},e._innerWebcamValueFunctionPlugin=function(e){e=this._innerRead(e);return this._innerSetWebcamValue(e)},e._innerWebcamSettingFunctionPlugin=function(e){e=this._innerRead(e);return this._innerSetWebcamSetting(e)},e._innerWebcamMoreSettingFunctionPlugin=function(e){e=this._innerRead(e);return this._innerSetWebcamMoreSetting(e)},e={Webcam:{IsModuleInstalled:function(){return!0},GetSourceList:function(){var e,t;return l.License.checkProductKey(d,{Webcam:!0},!0)?(e=m.GetWebcamSourceList(),t=[],l.setErrorString(d),0==d._errorCode&&(t=d._innerRead(e))&&1<t.length&&t.splice(t.length-1,1),t):[]},SelectSource:function(e){return!!l.License.checkProductKey(d,{Webcam:!0},!0)&&(e=m.SelectWebcam(e),l.setErrorString(d),e)},CloseSource:function(){d._playVideoDWT=null;var e=m.StopCapture();return l.setErrorString(d),e},GetFramePartURL:function(){var e;return this._isPlaying()?(e=m.GetDIB(-1),l.setErrorString(d),e):(l.WebcamErrors.VideoNotPlayingWhenGetURL(d),"")},GetFrameURL:function(){return""},PlayVideo:function(e,t,n,r,i){function o(){return d._playVideoDWT=null,Dynamsoft.Lib.isFunction(i)&&i(d.ErrorCode,d.ErrorString),!1}var a;return e&&e.getSWebTwain()?l.License.checkProductKey(d,{Webcam:!0},!0)?(a=e.getSWebTwain().CurrentHWND)?(d._playVideoDWT=e,setTimeout(function(){var e=m.RunWebcamCmd("PlayVideo",a,null,null,n);l.wrapperRet(d,e,r,o)},0),!0):(l.WebcamErrors.InvalidParameter(d),o()):o():(Dynamsoft.Lib.WebcamErrors.InvalidParameter(d),o())},PauseVideo:function(){return!0},StopVideo:function(){d._playVideoDWT=null;var e=m.RunWebcamCmd("StopVideo",0,null,null,null);return l.setErrorString(d),m.StopCapture(),e},CaptureImage:function(e,t){function n(){return Dynamsoft.Lib.isFunction(t)&&t(d.ErrorCode,d.ErrorString),!1}var r;return l.License.checkProductKey(d,{Webcam:!0},!0)?(r=m.RunWebcamCmd("Capture",0,function(){Dynamsoft.Lib.isFunction(e)&&setTimeout(e,0),l.License.isLTS()&&Dynamsoft.DWT.lcvrf(d)},n,null),l.setErrorString(d),r):n()},GetMediaType:function(){var e=d._innerWebcamValueFunctionPlugin(m.GetMediaType());return l.setErrorString(d),e},SetMediaType:function(e){return l.isString(e)?(e=m.SetMediaType(e),l.setErrorString(d),e):(l.Errors.InvalidValue(d),!1)},GetResolution:function(){var e=d._innerWebcamValueFunctionPlugin(m.GetResolution());if(l.setErrorString(d),e&&e._resultlist){var t,n,r=e._resultlist,i=[],o=[];for(0<r.length&&(n=r[r.length-1]),t=0;t<r.length-1;t++){for(var a,u=(a=r[t]).toLowerCase().split("x"),s=(_=c=s=void 0,{value:a,p1:parseInt(u[0]),p2:parseInt(u[1])}),c=i,_=c.length-1;0<=_&&c[_].p1>=s.p1&&!(c[_].p1==s.p1&&c[_].p2<s.p2);)c[_+1]=c[_],_--;c[_+1]=s}for(t=0;t<i.length;t++)a=i[t].value,o.push(a);n&&o.push(n),e._resultlist=o,o=i=null}return e},SetResolution:function(e){return l.isNumber(e)||l.isString(e)?(e=m.SetResolution(e),l.setErrorString(d),e):(l.Errors.InvalidValue(d),!1)},GetFrameRate:function(){var e=d._innerWebcamValueFunctionPlugin(m.GetFrameRate());return l.setErrorString(d),e},SetFrameRate:function(e){return l.isNumber(e)?(e=m.SetFrameRate(e),l.setErrorString(d),e):(l.Errors.InvalidValue(d),!1)},GetVideoPropertySetting:function(e){e=m.GetWebcamVideoPropertySetting(e);return l.setErrorString(d),d._innerWebcamSettingFunctionPlugin(e)},GetVideoPropertyMoreSetting:function(e){e=m.GetWebcamVideoPropertyMoreSetting(e);return l.setErrorString(d),d._innerWebcamMoreSettingFunctionPlugin(e)},SetVideoPropertySetting:function(e,t,n){e=m.SetWebcamVideoPropertySetting(e,t,n);return l.setErrorString(d),e},SetVideoRotateMode:function(e){e=m.SetVideoRotateMode(e);return l.setErrorString(d),e},GetCameraControlPropertySetting:function(e){e=m.GetWebcamCameraControlSetting(e);return l.setErrorString(d),d._innerWebcamSettingFunctionPlugin(e)},GetCameraControlPropertyMoreSetting:function(e){e=m.GetWebcamCameraControlMoreSetting(e);return l.setErrorString(d),d._innerWebcamMoreSettingFunctionPlugin(e)},SetCameraControlPropertySetting:function(e,t,n){e=m.SetWebcamCameraControlPropertySetting(e,t,n);return l.setErrorString(d),e},_isPlaying:function(){return!!d._playVideoDWT}}},d.Addon=d.Addon||{},l.mix(d.Addon,e)})});
/*! 20261015101011
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*
* Module: Upload
* Version: 19.5
* 
*/
var Dynamsoft=window.Dynamsoft||{};!function(e){e.DWT||(e.DWT={}),e.Lib||(e.Lib={})}(Dynamsoft),Dynamsoft.aryAddonReadyFun=Dynamsoft.aryAddonReadyFun||[],Dynamsoft.AddonReady=Dynamsoft.AddonReady||function(e){Dynamsoft.aryAddonReadyFun.push(e)},Dynamsoft.AddonReady(function(u,e){Dynamsoft.DWT.EnumTransferErrorCode={TRANS_OK:0,TRANS_URL_MALFFORMAT:1,TRANS_FAILED_RESOLVE_PROXY:2,TRANS_FAILED_RESOLVE_HOST:3,TRANS_FAILED_CONNECT:4,TRANS_REMOTE_ACCESS_DENIED:5,TRANS_PARTIAL_FILE:6,TRANS_UPLOAD_FAILED:7,TRANS_READ_FAILED:8,TRANS_OUT_OF_MEMORY:9,TRANS_REMOTE_FULL_DISK:10,TRANS_OPERATION_TIMEOUT:11,TRANS_SERVICE_ERROR_404:12,TRANS_SERVICE_ERROR_500:13,TRANS_SERVICE_ERROR_503:14,TRANS_SERVICE_ERROR:15,TRANS_NOT_SEND:16,TRANS_WAITFOR_SEND:17,TRANS_SENDING:18,TRANS_PAUSE:19,TRANS_FINISHED:20,TRANS_NULL_POINTER:21,TRANS_INVALID_ID:22,TRANS_Failed:23,TRANS_SERVICE_ERROR_MORE_THAN_500:24,TRANS_SERVICE_ERROR_LESS_THAN_200:25,TRANS_SERVICE_ERROR_MORE_THAN_300:26,TRANS_CANNOT_FINDFILE:27,TRANS_ABORT:28,TRANS_NOT_FINISHED:29,TRANS_TASK_PREPARE_INIT:30,TRANS_TASK_INIT:31,TRANS_BEYOND_MAXSIZE:32};var f=Dynamsoft,c=u.guid(),r=5,a=(Dynamsoft.dcp,[1,9,4,"0410"]),p="upload_"+a.join(""),n={Version:"1.0",HttpVersion:"1.1",ServerUrl:"",FileName:"",VERIFYPEER:!1,VERIFYHOST:!1,BlockSize:10240,ThreadNum:1,OnUploadTransferPercentage:function(e,n){},OnRunSuccess:function(e){},OnRunFailure:function(e,n,o){}},m=0,T="",F=function(){m=-2,T="Upload failed because the url to upload to is invalid."},i=function(e,n,o){m=-3,e?T="Upload cancelled.":(T=n&&""!=n?"Upload failed with error: "+n:"Upload failed.",n&&""!=n&&(T=T+"("+o+")"))},E=function(){m=-4,T="Upload failed because the file to upload has invalid content."},o=function(){m=-5,T="Invalid upload job id."},R=function(){m=-6,T="Cannot create an upload job."},S=function(){m=-7,T="The file name is incorrect in the upload job."},t=function(){m=-8,T="Can not cancel all jobs when at least one job is still being created."},l=function(){m=0,T=""};function d(){}function s(e){this.job=e}function D(e){this.job=e}d.prototype={runWaiting:0,CreateJob:function(){var e={HttpHeader:{},documents:[],formFields:[],bEvent:!1};return u.mix(e,n),e.SourceValue=new s(e),e.FormField=new D(e),e},Run:function(t){var e,r=this,n='""',o=t.ServerUrl,a="";if(!u.isString(o)||""==o)return t.id=-1,F(),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1),!1;if(!t.documents||!u.isArray(t.documents)||t.documents.length<=0)return t.id=-1,E(),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1),!1;if(!t.ar||!t.cu){Dynamsoft.Lib.License.reparseProductKey();var i=Dynamsoft.DWT.licenseException;if(0!=i.code)return t.id=-1,m=i.code,T=i.message,!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1),!1;if(Dynamsoft.Lib.License.isLTS())return Dynamsoft.DWT.lglic(Dynamsoft.DWT.EnumInstance.dwt_desktop,"").then(function(e){t.ar=e.ar,t.cu=e.cu,r.Run(t)}),!0;u.product.refProductKey&&(n='"'+u.product.refProductKey+'"')}for(t.Url=o,delete t.ServerUrl,e=0;e<t.documents;e++){var l=t.documents[e];if(!u.isString(l.files)||""==l.files)return t.id=-1,S(),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1),!1;u.isString(l.remoteName)&&""!=l.remoteName||(l.remoteName="RemoteFile")}var i=t.SourceValue,d=(delete t.SourceValue,t.FormField),s=(delete t.FormField,u.stringify(t)),s=u.replaceAll(s,'"',"'");t.ServerUrl=o,delete t.Url,t.SourceValue=i,t.FormField=d,o=['{"id":"',c,'","method":"RunUploadFile","version":"',p,'","parameter":[',n,',"',s,'"'],t.ar&&t.cu?(a=[',"',t.ar,'","',t.cu,'",0]}'].join(""),delete t.ar,delete t.cu,o.push(a)):o.push("]}"),i=o.join(""),r.runWaiting++;return Dynamsoft.FileUploader._sendCmd("RunUploadFile",i,function(e){var n;r.runWaiting--,e&&((n=e.UploadId)&&0<n?(t.id=n,f.FileUploader.map[t.id]=t,f.FileUploader.ids.push(e.UploadId),t.OnUploadTransferPercentage&&t.OnUploadTransferPercentage(t,0)):(n=e.errorcode,e=e.errorstring,n&&e?(m=n,T=e):R(),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1)))},function(e,n,o){r.runWaiting--,f.FileUploader.parseHttpErrors(e,n,o),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1)}),!0},Cancel:function(t){var e;return!t.id||t.id<0?(o(),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1),!1):(e='{"id":"'+c+'","method":"DeleteUploadTask","version":"'+p+'","parameter":["'+t.id+'"]}',Dynamsoft.FileUploader._sendCmd("DeleteUploadTask",e,function(e){f.FileUploader.deleteJobById(t.id)},function(e,n,o){f.FileUploader.parseHttpErrors(e,n,o),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1)}),!0)},CancelAllUpload:function(){var o=f.FileUploader.ids,e='{"id":"'+c+'","method":"DeleteUploadTask","version":"'+p+'","parameter":["'+o.join(",")+'"]}';return 0<this.runWaiting?(t(),!1):(this.runWaiting<0&&(this.runWaiting=0),o.length<=0||Dynamsoft.FileUploader._sendCmd("DeleteUploadTask",e,function(e){for(var n=0;n<o.length;n++)f.FileUploader.deleteJobById(o[n]);f.FileUploader.ids=[],f.FileUploader.map=[]},function(e,n,o){f.FileUploader.parseHttpErrors(e,n,o)}),!0)},OnUploadTransferPercentage:function(e,n){},OnRunSuccess:function(e){},OnRunFailure:function(e,n,o){}},(f.SourceValue=s).prototype.Add=function(e,n,o){var t=this.job;u.isString(e)&&""!=e?(o=o||"RemoteFile",e=Dynamsoft.Lib.replaceAll(e,"\\\\","\\\\"),t.documents.push({files:[e],fileName:n,remoteName:o})):(S(),!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,m,T),t.bEvent=!1))},f.FormField=D,f.FileUploader={ids:[],map:{},port:Dynamsoft.dcp.Port,protocol:"https://",ip:"127.0.0.1",wsUrl:"",running:!(D.prototype.Add=function(e,n){var o,t,r=n,a=e;if(null==r&&(r=""),!u.isString(a)||""==a||!u.isString(r))return!1;if(r=encodeURI(r),-1<(a=encodeURI(a)).indexOf("'")||-1<r.indexOf("'"))return!1;for(o=0;o<this.job.formFields.length;o++)if((t=this.job.formFields[o]).name==a)return t.value=r,!0;return this.job.formFields.push({name:a,value:r}),!0}),ws:null,nextLoopTime:600,deleteJobById:function(e){var n;if(l(),e){for(n=0;n<f.FileUploader.ids.length;n++)if(e==f.FileUploader.ids[n]){f.FileUploader.ids.splice(n,1);break}var o=f.FileUploader.map[e];for(o.SourceValue.job=null,delete o.SourceValue,o.FormField.job=null,delete o.FormField,delete f.FileUploader.map[e],n=o.documents.length-1;0<=n;n--)o.documents.splice(n,1);for(n=o.formFields.length-1;0<=n;n--)o.formFields.splice(n,1);var t='{"id":"'+c+'","method":"DeleteUploadTask","version":"'+p+'","parameter":["'+e+'"]}';Dynamsoft.FileUploader._sendCmd("DeleteUploadTask",t)}},_sendCmdByWS:function(e,n,o){var t=f.FileUploader.ws;return t&&t.readyState!=Dynamsoft.DWT.EnumDWT_WebsocketReadyState.CLOSING&&t.readyState!=Dynamsoft.DWT.EnumDWT_WebsocketReadyState.CLOSED||(t=Dynamsoft.DWT.NetManager.newWebsocket(f.FileUploader.wsUrl),f.FileUploader.ws=t),Dynamsoft.DWT.NetManager.postStringDataByWS(t,e).then(function(e){e=u.parse(e);e&&"result"in e?u.isFunction(n)&&n(e.result):u.isFunction(o)&&o()},o),!0},_sendCmd:function(e,n,o,t){return Dynamsoft.DWT.ConnectWithSocket?f.FileUploader._sendCmdByWS(n,o,t):(e={url:[f.FileUploader.protocol,f.FileUploader.ip,":",f.FileUploader.port,"/dcp/",p,"/",e,"?type=1&dsver=",a.join(""),"&ts=",u.now()].join(""),method:"post",dataType:"json",processData:!1,data:n,onSuccess:o,onError:t},Dynamsoft.DWT.Token&&(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+Dynamsoft.DWT.Token),u.ajax(e))},parseHttpErrors:function(e,n,o){var t,e=e&&u.isArray(e)&&2<e.length?(t=e[1],e[2]):(t=n,o);2==e.state&&0==e.status?"abort"===e.statusText?i(!0):F():i(!1,t,e.status)},loadHttpBlob:function(e,n,o,t,r,a,i){e={method:e,url:n,dataType:"blob",async:o,onSuccess:t,onError:function(e,n,o){f.FileUploader.parseHttpErrors(e,n,o),u.isFunction(r)&&r()}};u.isFunction(a)&&(e.beforeSend=function(e){e.addEventListener("progress",function(e){delete e.totalSize,delete e.position,a(e)},!1)}),Dynamsoft.DWT.Token&&(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+Dynamsoft.DWT.Token),u.ajax(e)},_OnPercentDone:function(){},Init:function(e,o,n){if(l(),!Dynamsoft.Lib.detect.bOK)return--r<=0?(u.isFunction(n)&&n(),void(r=5)):void setTimeout(function(){Dynamsoft.FileUploader.Init(e,o,n)},300);function t(){var e,n=Dynamsoft.navInfoSync.bSSL?(e="https://",Dynamsoft.dcp.SSLPort):(e="http://",Dynamsoft.dcp.Port);f.FileUploader.port=n,f.FileUploader.protocol=e,f.FileUploader.ip=Dynamsoft.DWT.Host,f.FileUploader.wsUrl=Dynamsoft.DWT.NetManager.getWsUrl(Dynamsoft.DWT.Host,n),f.FileUploader.running=!0,u.isFunction(o)&&o(new d),setTimeout(f.FileUploader.StatusLoop,500)}Dynamsoft.dcp.detect.bConnected?t():Dynamsoft.DWT.NetManager.checkModuleManager(t,function(){--r<=0?(u.isFunction(n)&&n(),r=5):setTimeout(function(){Dynamsoft.FileUploader.Init(e,o,n)},500)})},Close:function(){var e;Dynamsoft.DWT.ConnectWithSocket&&(e=Dynamsoft.FileUploader.ws)&&(e.readyState!=Dynamsoft.DWT.EnumDWT_WebsocketReadyState.CLOSED&&e.readyState!=Dynamsoft.DWT.EnumDWT_WebsocketReadyState.CLOSING&&e.close(),Dynamsoft.FileUploader.ws=null),Dynamsoft.FileUploader.running=!1},VersionInfo:function(e,t){l();var n="",n=(Dynamsoft.DWT.Token&&(n=['"',Dynamsoft.DWT.Token,'"'].join("")),['{"id":"',c,'","method":"VersionInfo","version":"',p,'","parameter":[',n,"]}"].join(""));return Dynamsoft.FileUploader._sendCmd("VersionInfo",n,e,function(e,n,o){f.FileUploader.parseHttpErrors(e,n,o),u.isFunction(t)&&t(m,T)}),!0},StatusLoop:function(){return l(),f.FileUploader.GetUploadStatus(),f.FileUploader.running&&setTimeout(f.FileUploader.StatusLoop,f.FileUploader.nextLoopTime),!0},GetUploadStatus:function(){var e;return l(),f.FileUploader.ids.length<=0||(e='{"id":"'+c+'","method":"GetUploadStatus","version":"'+p+'","parameter":["'+f.FileUploader.ids.join(",")+'"]}',Dynamsoft.FileUploader._sendCmd("GetUploadStatus",e,function(e){if(u.isArray(e))for(var n=0;n<e.length;n++){var o=(l=e[n]).id,t=f.FileUploader.map[o],r=l.percentage,a=l.errorcode,i=l.response,l=l.errorstring;t&&(a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_FINISHED?(t.OnUploadTransferPercentage(t,100,y(i)),!t.bEvent&&u.isFunction(t.OnRunSuccess)&&(t.bEvent=!0,t.OnRunSuccess(t,y(i)),t.bEvent=!1),f.FileUploader.deleteJobById(o)):a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_OK||a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_NOT_SEND||a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_WAITFOR_SEND||a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_SENDING||a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_PAUSE||a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_TASK_PREPARE_INIT||a==Dynamsoft.DWT.EnumTransferErrorCode.TRANS_TASK_INIT?t.OnUploadTransferPercentage(t,r,y(i)):(!t.bEvent&&u.isFunction(t.OnRunFailure)&&(t.bEvent=!0,t.OnRunFailure(t,a,l,y(i)),t.bEvent=!1),f.FileUploader.deleteJobById(o)))}},function(e,n,o){})),!0}};var _=new Array(-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);function y(e){for(var n,o,t,r,a=e.length,i=0,l="";i<a;){for(;n=_[255&e.charCodeAt(i++)],i<a&&-1==n;);if(-1==n)break;for(;o=_[255&e.charCodeAt(i++)],i<a&&-1==o;);if(-1==o)break;l+=String.fromCharCode(n<<2|(48&o)>>4);do{if(61==(t=255&e.charCodeAt(i++)))return l}while(t=_[t],i<a&&-1==t);if(-1==t)break;l+=String.fromCharCode((15&o)<<4|(60&t)>>2);do{if(61==(r=255&e.charCodeAt(i++)))return l}while(r=_[r],i<a&&-1==r);if(-1==r)break;l+=String.fromCharCode((3&t)<<6|r)}return l}});
/*! 20260922110806 - 20260205134629
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2026, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 19.5
*/

//Dynamsoft.On{actionName} It is a callback function called by Web-TWAIN product. The contents of this function are the default templates of the WebTWAIN. Users can modify the fucntions, but be aware that the function name itself cannot be modified
//Dynamsoft._{functionName} It is a private function used by Dynamsoft.On{actionName}. Users can modify and delete according to their needs.
(function () {
  "use strict";
  var promptDlgWidth = 620,
  ERR_LNADenied = 'Access to the local scanning service is blocked.',
  ERR_LNANotAllowed = 'Please grant access to the local scanning service.';

  if(Dynamsoft.navInfoSync.bMobile) {
    if(screen.width<620) {
      promptDlgWidth = screen.width - 10;
    }
  }
  function isChrome145plus() {
    if (Dynamsoft.navInfoSync.bChrome || Dynamsoft.navInfoSync.bEdge) {
      var ver = parseInt(Dynamsoft.navInfoSync.strBrowserVersion);
      if (ver >= 145) {return true;}
    }
    return false;
  }
  
  function queryLNAPermission() {

    if(Dynamsoft.navInfoSync.bFirefox || Dynamsoft.navInfoSync.bSafari || Dynamsoft.navInfoSync.bIE) {

    } else {
      try{
        return Dynamsoft.Lib.queryLNAPermission(); 
      }catch(_){
      }
    }

    return Dynamsoft.Lib.Promise.resolve({
      state: 'other'
    });
  }

  //----------------------start Install Dialog---------------------------

  var bLNAPermission = false;
  if(navigator.permissions && navigator.permissions.query) {
    queryLNAPermission().then(function(_) {bLNAPermission = true;})['catch'](function(){});
  }
  function isExistLNAPermission() {
    return bLNAPermission;
  }

  //Web TWAIN Service is not detected dialogs
  //Windows
  Dynamsoft.OnWebTwainNotFoundOnWindowsCallback = function (ProductName, InstallerUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) {
    var _this = Dynamsoft,
      objUrl = {
        'default': InstallerUrl
      };
    _this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumWindow, bIE, bSafari, bSSL, strIEVersion, false);
  };

  //Linux
  Dynamsoft.OnWebTwainNotFoundOnLinuxCallback = function (ProductName, strDebUrl, strRpmUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion, iPlatform) {
    var _this = Dynamsoft,
      objUrl = {
        'default': strDebUrl,
        'deb': strDebUrl,
        'rpm': strRpmUrl
      };
    if (!iPlatform) iPlatform = Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux;
    _this._show_install_dialog(ProductName, objUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, false);
  };

  //MacOS
  Dynamsoft.OnWebTwainNotFoundOnMacCallback = function (ProductName, InstallerUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) {
    var _this = Dynamsoft,
      objUrl = {
        'default': InstallerUrl
      };
    _this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumMac, bIE, bSafari, bSSL, strIEVersion, false);
  };

  //Web TWAIN Service is not supported dialogs
  //Mobile Browsers
  Dynamsoft.OnMobileNotSupportCallback = function () {
    var ObjString = [];

    if (Dynamsoft.DWT) {

      ObjString.push('<div class="ds-dwt-ui-dlg-android" style="padding-bottom:30px">');
      ObjString.push('Service Mode does not support your Operating System, please contact the site administrator.');
      ObjString.push('</div>');

      Dynamsoft.DWT.ShowMessage(ObjString.join(''), {
        width: 335,
        headerStyle: 1,
        backgroundStyle: 1
      });
    } else {
      console.log("The Dynamsoft namespace is missing");
    }

  };

  //Error Message - HTTPS is required to allow CORS to function. This error appears when HTTP is detected. (See: https://www.dynamsoft.com/web-twain/docs/faq/http-insecure-websites-in-chromium-browser.html?ver=latest)
  Dynamsoft.OnHTTPCorsError = function (msg) {

    var ObjString = [
      "<div>", msg, "</div>",
      '<div style="margin-top:10px">To fix the issue, please update your website to HTTPS or refer to <br /><a target="_blank" href="https://www.dynamsoft.com/web-twain/docs/faq/http-insecure-websites-in-chromium-browser.html?ver=latest">this article</a> for other workarounds.</div>'
    ].join('');

    Dynamsoft.DWT.ShowMessage(ObjString, {
      width: promptDlgWidth,
      headerStyle: 2
    });
  };

  function getLNA_FAQ_URL(bPromptPermisstion) {

		var params = ["https://dynamsoft.github.io/Dynamic-Web-TWAIN/local-network-access.html"];
    params.push('?permission=');
    params.push(bPromptPermisstion ? "prompt" : 'denied');
    params.push('&browser=');
    if(Dynamsoft.navInfoSync.bChrome) {
      params.push('chrome');
    } else if(Dynamsoft.navInfoSync.bEdge) {
      params.push('edge');
    } else if(Dynamsoft.navInfoSync.bFirefox) {
      params.push('firefox');
    }
    params.push('&browserversion=' + Dynamsoft.navInfoSync.strBrowserVersion);

    return params.join('');
  }

  Dynamsoft._show_install_dialog = function (ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, bNeedUpgrade, serviceVer, expectedVer) {
    var _this = Dynamsoft,
      ObjString, title, subTitle, browserActionNeeded,
      EnumPlatform = Dynamsoft.DWT.EnumDWT_PlatformType,
      bUnix = (iPlatform == EnumPlatform.enumLinux || iPlatform == EnumPlatform.enumEmbed ||
        iPlatform == EnumPlatform.enumChromeOS || iPlatform == EnumPlatform.enumHarmonyOS),
      imagesInBase64 = {
        icn_download: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAABHNCSVQICAgIfAhkiAAABqxJREFUaEPlm01y2zYUxwHJe6cniHMCU7K7tnoCK8uuYp+gzglsn8DOCapuuo1ygsjr2hKz6jLKtpvY61pA/g8ARZDiBwiCnMyYM5omKQnih/fw8L7I2Qu7eNe8o9GvJ/QOKUU0GPBX+s9swrl8ZIzH9Hch5JrzwVrK/59iXF3OKThwFEUHjA1PBgM21WAa0vWSkuDZQgg+Z+z5DvxYmHBXMOAoOnoHuAtMNrKnB4AvkOQjJArJcTV5IdgCcn4Fiat7cQ8WieMnDzDG6yyenAP+Qxzf45n2V2tggE4BeYOJYsL6AsAn/CAhsYCE1k2mCQ2B6g8mUvIzjHmYjskWUj6/b6vy3sBRdAx1ZZf4TQzkN0BexfFy1gSw6l6wQwv2LrCE+PF9s5wzITbXTRcyeY8X8Hh8fIMBMAmF+gSjcxESNL8IKTi7NIv7iMWFtJsvbiNg/eLhn1jtqZnUtRDPt6ENS5nUySByPryFqp+ae66Wy/vrJhrlDKxftvdRGyWSKp+GMiRNJkz3jsdjaNeAtIw0jFSc9raTNXcCJkOClf1MRwxZXSk3Z22NR1PIXTU/muLog73g+zj+Yhi031yga4GNGq00LLvDwJCs22q2hap73ghiTkcZQa9W96O6ZyqBac9CjSFZFhEsBlQW+We6jF1ZaysuZ8vlw3nV/CqBx+Ojj2SgjBpPfhbJFlhxnN3DhYYW75fL5W0ZdCkwYPEQ/0MbqA3BdurjttWaKBqfwWHBCaJ887dx/ADHZ/cqBCanAgbhs36YwRiEcevaQtU9D//gCvdcQiNxTm/eFGlkIfBodEz7lvbrNc45GiToNRodxRQgYL8Z5yXc8Jj7AmNThFY49x1g8o3h1GPvKlU+6GLfQhKSELGYtadE06VItNNIeZR3QXdeiNX/SoGAEOLcx3VzmWCXwPR+MMzA8A7Qf61WD2f2nDLAycbHjd9w44HL5H3u6RqYfAcEHV+1DXqmvbxO5pkBhv7DwWBRl9KlF3cNbEsZW/ODbSu2wPaqdLG3bE3oAzjdy1kPzALW5xgF71DnJBry0djaZ/oA1pp0RHmzfVutt8DY6OSTnnatzn2pdFatU+/LBv5OAUJ+k9eKy+OGviRsGeGt1ipg6+z6AnXOJOE8eGof6Q9YpYi+22d+DrifiKgv4KLto4DTDELWhNeKyvOGPoG1G8sPsVXJ64oNsHa68evEd86vS7/A2rdOgqCXCZxEGH2Fgn1KOAkZE+1VEk7P4PLA2XO7Fj7WL3CSyNBn8ctU6bzYfaSpffHhjSmDVKaDXCWsHQd+UpeYq5pvfruac3jrR+/Ej67wydFmAm/KEZdCuwBnc1T6SHGdi31fGt/rMDGo42EF3pRTKoWuA87CtktE5N9lgKlEubeiYjRcyzc+K5k84wJdBRwSNg155RO2hSrM28EDKu/8deKRdAldBhwS1vYg7VSPDazyQHWJbNeFqJJ0EXBo2Oxxm24LKwGgs5WuNRoX8DLoPHAXsKamrCIlaO0vSfbVTvFsQyn7Bhew6mNhm0HcGjIbuAtYmk+SbqYykR3y5pJ4OusROojIS5oMpF55cZ6WR9pZ4/yip8WEbK0pl6bVJZaqUoWvxG1ojKEtJsKYBDxkDjwtFe0WEwoS8dWlCl9gY0SUYYRkGSTbCax+T3mpqKDUos9ks9kzSew2sNY5/Tegf+9Csnrvbr1GdBVtonypqKSYpg0NkthzHNhvQ4DaY4xG4/+wbf6N45VqSwx16QL+kLoVSktFhcAmEKDOudoCc6jJhhjHLuCXJSNLq3euBeYQEw0xhmsBvxSYJpErMFdGQCEm7TtGVjjVBfxKYNuyNmkN8p24z3N2S5VL1aQW2BgCZP74oUus6zNp32dsyRbVgovGrQXWpl5ZPwvar8/RF6zoObvf0xWWxnECts5Qc1ypf2nc5xgCON/v6aLG9nsbAWtDlvY5Yl+jh5mhlbefLh/dhM6udG+2X79nY2Ct4mmfo1491eDp3cNcJ/mC3mzvfk8v4GRfFzVvSzmYrVb/3NVB1P1/Ul3G9k4gUfqsYKKWFb0nbZvQvYGTCZvmU1IzuKJG3mgMwyTxrQJ927D55Nr6ZD4QOUVcAcBtTzahPuHvtyF6s1sD2+DIS19gT+MbiPyHGurTHUqzqp5makrDf6g719Si1ccd2JfZi4J3fByC7SJmrotWpznBgO0XaV98gKZUTp/xJN3rdXNRksQizAGKBRHzUJD2izsBLiIjjwh7UgX+WmXFoxADk1x/Xvt+tOGwiplbegNuOrGu7v8BEbL8eSr8LDEAAAAASUVORK5CYII=',
        icn_install: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAABHNCSVQICAgIfAhkiAAAB51JREFUaEPtW91V20gU1sje5yQVhK0AY3iPUwGkgiUVhFQQqCBQQZwKAhXEvIPtrSDeCgLPizX7ffPjGY1lz0iWDQ+rc3zg6Gd0v/s/916JbItHr3d0nOdZj6+QMhuYV70WYnFuinMPPI9zI/4timw6nd7dbIss0ebCvV5vL8s67wDyBBDw2+SQ1wB/nWXzW3BgtslK/rOtAIYkB5DQF/ysFNU7pJR/CyFAtJKckmCWPT0AACWbgUGQfvc1/weT1LN45gTP7PtEQjtG+F1A8maN5vA3ArwMVD5q4iRAFtfApdS17gE+gAk5geNHRohXmhlc++mzZVjddXl/I8BU3TzvfMHjp/ql8hH/X47Hd+dNiIg90+8fYV15ZoHj/2FRzCHx+qpeG3Cvd0iufwP3IQUNtCieLptKMwbWXqfU87wL0BkYrVT/ARL/OJ3eK5NJPWoBBthPeS4uzQtvpJyfNeFyKnFV91G7hOhcguHHvF4UEjTcX6WumQy43z/85lS4+DwejxXw5zr6/T6knX81JjUcj+8/ptASBUxVEqL7U8dO+Qhve1pXjVIIaXIPzQvefUjbhnpP4dDex0xrLWAfLGzmH6jwySYesgmo2DMMbVDxa6j4W4KeTO4O1j2zFrBVYwO2F+NejLhtXdeC6UwJmh58nXqvBOxshGo8H7w0yYbMo6QRKkc6dK32MZWAtW2IH8YLfngpNhvTkBS6lwAbtz/RcXb33thmb1BN2CZpsBmWHILx32OgrWbqOD0/CMPmEuCDg8MhXvQXHriZTO433ADEyHPXdWLRYehb+U7E3CRtAwY6sWNg+A4Mpz4VJcDkLtz8Tx1+5nRSs3SSm98Zhj68/7woCmZQDzYkciMCidGXRPNznfp2f2mTfKKU1WaFRwnwwcER4+0A5y+2lRdXscXTKoJi6JsFIXEBlnaKNd7Gsiudf2dfuOFAqHq/BDiQ7l4KJ5vLtKTKldIA8+FHsp4v2V6vf5rnOdR+WXIhLcZEoKHiFZIlJCR6a7mQ8HNJ10mibG84Lw2wN2S+D5bnq+wzBF0lZQXY6bx8RNBWnnFXh1XnMCJYwDAt4YM1RYV9qOotVJXmt/ZA8gSbp5Sf/qSpGMBaVXbtmUmpBQwnha3eeGipt4B9NJSqlGJIx5qSRpr1lce26yvA1o2HL41xr43rVu2wVslRwsRGsOF37h3yCtp3ZpMLShohBxua9YfVDitMBTi0l9gibV03iT8iQ3qSAxVFBshYnZYUmcLBb9JM84B96DQylWPbAJvigPheZ8sqT0iOJNBgbiz2mbiIVSrVFrCqdXzJpoIFnSztnHO9uqbnY/QAp6nIpoyIgXUpJt8kkCFJxOKMefVeE7DGZMkoMuxCWOfgB+dNQa16PgWsq66EqzTfptqkiqFsZ4DrgNXZlbxEqNyD+s6gxKNN8voA8OEvqosNzNuQbn2waZuEVFp1caA7YeymDasUji47dYE69z03WEurxblVwC8FrHFcSrCw4cMZi19tq/RLAutUGs29Nrw0Nx+mTToAE7H5EKgRyzNmUFVxdtVet46p1Lm3VS8N22D1nz2fpeMlgCVRJcDITdEyEZ9Sc1OLKqxBMTkXQo6KQsx0r1c8hFWTXUvWc1gu8WiaWrokPi0heC6wxmE5wG7zEG9TOOnaunVase85wZJmWy5SmwffZcNTq3JKzCHY/XOqGXhl0+TKY4yG1OtL20PNAV3HTd2F+PtnFdsW3UVNRlgpdJEgra6cCiblvsoCQHgytpAPeFWy72duTf1EjI6U66EwS0U8tidQNnkTW8gCVrlpUEqtSlWbRoIYHSnXAfg384FSEc8Ytq0hRYvwzob1aJLtCPjVRV/CuN9sUFx9OIXYTe/xyrSLCudiw+CCs2pCsaS50nl5JlAJFmxQBTftEPVoAnvM0J69TUGkPq8jQ4eMhnQrCvF1pUwgcHLo6JWL5H52Ve4U7NZhVUlXOVifY16SXdlqrOKua9Eo78w5iw+YrtuHbSOX1tN1qd4/VXqx+5KbaVrKul0K8q+hliB+/VGepgnvZWLCsSJXYI+t18Z1mwVG26V8meZOB8Wz9aMDZc3grKU8xTOYoWLRTcB7FxgO1SrfBojUNYJRjaWW7/8jD5aTwegA558WTeVUbu/yvtQuxto6lteonpl5iZ2qZyrDTAjiXMperLAfLdzZNgUWImjMWLwsSRvJ/jBgow22KGDDPWRhAj3ZZhOsqZKqe58/2Zs6AxIFbIlw4ar+BGtdICn3B5O9S9M6q9ZIBswFgglWhJ05p9NnKQS2dY8Jm6ij2fGmej2xWoB1nHYTrAYERoyerrYdb81GHrU33UFsOtlbG7BNTpCYn+uMTE+n439+AnDRliT9ddgqtWVf8z6MPszPm2hXI8CWGO0hu5hO16MJGniGyqX6/OamqdQpTdS5+c3TCb938kYQb5GrI1VtHik2AuyAq894IHF/JkNvJnBOfZOAdHOk//77aAnWDPtDfbGClHSgr2f8pqI0u8E2J36Q6DN/xhOqr+5A5JQIP8FR3yQ0PVjnxg/M2qxVGr6/FQmvAmVKwEpa7lM8iY25/hCLsZMFey1h+ymehALU+1KlDlP/Axl/TQ2HYDZNAAAAAElFTkSuQmCC',
        icn_scan: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAABHNCSVQICAgIfAhkiAAACBBJREFUaEPNW7tuG0cU3VkynQHbVdJF/gJTtLsEsIw06SQB7i0XqW1/gekuqSL3AUx/gaUvMAUknUXRboRUpj8gsNQEBkLu5Jx57ItLzswO9ViAEMXdmbln7p37XpFc4NXr3d9O06THJaRMtsxSt4TIf5vgtzP+jt9G/JtlyWQyeX94UWSJdU7c6/U2kqTzACB3AAGfmEseAPxBksyPsAPTmJnKY9cCGJzcAode4GO5qNaQUn4QQoBoxTnFwSSZnQEAOZtgg8D97i1+xyapsRizgzF3y0RCOkb4vATnzRzt4UcBXgQqzzVxEiCzA+BS4hp6YR+wCSmB48ONEDf1ZnDu2XO7YaHz8vlWgCm6adp5geF7elF5ju/74/H7QRsiXGP6/fuYVz6zwPF9mGVzcDxc1IMB93r3uOuvsfvgggaaZbP9ttx0gbX3yfU07QJ0go1Won8Gjj+ZTI7VkfG9ggAD7NM0FftmwUMp58/a7LIvcU3PUbqE6Oxjw7d5P8skaDh+5TunN+B+/97rQoSz5+PxWAG/qqvf74Pb6e/mSA3H4+MnPrQ4AVOUhOi+07ZTnkPb7oWKkQ8hbZ7h8YJ2H/JsQ7wnUGgPXUdrJeAyWJyZzxDhnRgN2QaUawxNG0T8ACL+PUGfnLzfXDVmJWArxgZsz7V7LuIu6r5mTGdC0NTgq8R7KeDijFCM51vXjbP1zSOnYSpH2nQt1zGNgPXZEG+NFty9LmfWJSE+dC8ANmr/RNvZMG1sRItjN1zE2fs4LvmjUIzwn+ewre08NE5kJVPb6flm3WwuAN7cvDcEwY8x4PDk5DgoAKCrCa35zhds03O+2nbVGsBAJbYNDG+AYa/8bAVwQbA6t1RS0xDi7XgQfQRtueUzVruNyQsQ9xv+/szAIRa0dn27n/SRnJHLKljhVQG8uXmf9paEvmzjF8cA5pp0UaFtR+sAXWxkMsLmP1wAXOPuRptzFAuYm2z0QA7aZVeXSZH2vTuQUHETzhIcEh1a5hyO5S4niwMsh1KmQ84jZXYDkvYHvn4npciJ9Tki5WeauKwAFzIvz2G0VUDe5tK2sHsSdobLPvHiqrPZ7JePHycE3+qC84SYnFye3aFOMoD7e2mavm6jmetUYAGEi8nI13YbMzgAURvVuSQ3/sbXr//+dHp6+rkVWgyyGjvLMpi78VABrv/oM7nOSnSZv1JJusu6mORDmuiDrwXp9arMVIAh68r6g+23fZRVNQlwWVCLdbRTIZHqGQ9dq5vEwRc+B6UohHXHmHCDkfbiFiTiE70pBhX0jiCOrXJXLmIX78tb0A/MdSEyUp4Uz6VzbdDLwOIukgW7wmoyTO5le61iYmxMBWcU3mMjIW98RS0cbDECAKYEXTY3q+YrYywB9vOby6YHATd2u0NuK80esusxgKkYIVVPfX39CmDYXxj55IHvblUBZ0Ot3ZMjwEWuyX/X4wBrd9RfKrWPTzpFHGC5zzCSnCUAcrruu8YAWzY2/BhWAGsFZA2zi8C6N2WjKz1OvsK5Zir1Qq9wwLlDNOEZViaJKtuHyib3UdeUElbBpj5zxD4TCpjrWZxrARwLIHR8FOBCxWtf07W4K0AwGQdVC4q9YDdReFtMsocCLnx8FPdilFY9yC9sdCzUYnyT9QgHvCYtvQjYTkwPTAxjYEPz7y0zc1GAQ414IdJyClf0ThmUS9xDNmCV5OEeEoVJz9d3WOJp+bmWWuPpGFOXLQUTZsoOI3BHPMxqovwLZ+9HXRX4Jug8S/nfOXNQ8PH/xFw/sFgmRKpyUuA6shgSiUVdpvU1pRXARfDgLlNYDpUmqDCNGVfsPAn7B5mKR20zmIxdUSj7FeO/tXMuSoe/zS8kAsFD2Ub5hocco8VX7gBYHmFpDqio5G/0ZiAD2aHPG5hBUVEQuKrqRZyLbRN5RCSEnAQmGFhXLsJDEt8mAdB0Hi/rDIfogsYEQP3HkAmvQmmF0NeY4rFJPAYB0Ly3QyZcBhihI8USee4wkdYhptiFLhiERHHLaAbgLyaoKZJ4Wqx1mIivXokAl0gTcFHNC9lCVj1U90404FKaNq+E5AFDyb56p07qMK7TGTYJfZWcaEzEr4PL1wlwE3eJsVZMs3Fjc6nRJZjXBbB3Mc2YKFUuhftwgGB+1wWyqrR01Q6KZwrHYS9k7OKzGelgYqJS/fOZE54givkCPoKjXKodCtVlB1dudevACq2oUqI+hLmeYRoYVmPD9Vz5fq1VY6Hku/aWB71hKXY3DSqm10EJkaEbQPVrQlr8rlYtD3bqWusA+5/yorLf8pf7lGlfMnY/sKnFklpqf5iafglnlv9yYerVyr0lTee2TJMzcWfLFFREAI2OnuvFacPZt6b04ywXOQFXK/LtOlgviuvloh5rY2AI+8lWSqETcF28+X9oB+tFAK519i506yxb0xswJ6h1sLKnit3p3lp0HcCN2UQXrX2nwq8mZtcOAqwVRNHBaiYZwDl45RKlWLCmzosCWjLQc7Xr7A0GbLQim7QRzdAj01VDfOcrAC9jgTWNh1/MPi6Em3mV8g3O66CNdLUCbInSGrKL3ioVVhrgyci8fnPYluu6naLDd57gwCR4Y8YCTY4YdsZYiijABXD1Go+KX8scYked7hDgZoiR/quzkkZS8qwmclVb+j4r/NW+EZY58QFHr/g1nrr46aJaSo6wLUG9k9D2YkcRPtisDB1B61OMa+HwMlDGt1VZzeJVPIlmbh1c0Hba/pDiVTwJfGFvqoRs6v/IOTkNXX2kbQAAAABJRU5ErkJggg=='
      };

    // npm file mode
    if (bNeedUpgrade) {
      if(parseFloat(serviceVer) < parseFloat(expectedVer))
        title = 'Upgrade your document scanning service'; //'Please follow the steps below to upgrade your local document scanning service.';
      else
        title = 'Update your Dynamic Web TWAIN service';
    }
    else
      title = 'Download the Dynamic Web TWAIN service';
    subTitle = 'Follow the steps below to enable scanning in your browser';
    ObjString = [
      '<div class="dynamsoft-dwt-dlg-title">',
      title,
      "</div>",
      '<div class="dynamsoft-dwt-dlg-subtitle" style="display: none;">',
      subTitle,
      "</div>",
      '<div class="dynamsoft-dwt-dlg-title-error" style="display:none"></div>'
    ];

    if (_this.DWT) {

      var bFirefox = Dynamsoft.navInfoSync.bFirefox;
      if (bUnix || bFirefox) {
        browserActionNeeded = 'RESTART';
      } else {
        browserActionNeeded = 'REFRESH';
      }
      ObjString.push('<div class="dynamsoft-dwt-installdlg-iconholder"> ');

      var left = "134px";
      if(bFirefox) left = "135px";
      ObjString.push('<div class="dynamsoft-dwt-installdlg-splitline" style="left:'+left+'"></div>');
      left = "328px";
      if(bFirefox) left = "329px";
      ObjString.push('<div class="dynamsoft-dwt-installdlg-splitline" style="left:'+left+'"></div>');

      var marginRight = '133px';

      ObjString.push('<img style="margin: 0px ' + marginRight + ' 0px 0px" src="' + imagesInBase64.icn_download + '" alt="download" />');
      ObjString.push('<img style="margin: 2px ' + marginRight + ' 2px 0px" src="' + imagesInBase64.icn_install + '" alt="install" />');
      ObjString.push('<img src="' + imagesInBase64.icn_scan + '" alt="scan" />');
      ObjString.push('<div><span class="dynamsoft-dwt-installdlg-text" style="right: 160px">Download</span>');
      ObjString.push('<span class="dynamsoft-dwt-installdlg-text" style="right: 18px">Install</span>');
      ObjString.push('<span class="dynamsoft-dwt-installdlg-text" style="left: 140px">Scan</span>');
      ObjString.push('</div>');
      ObjString.push('</div>');

      if (bHTML5 && bUnix) {
        ObjString.push('<div style="margin:10px 0 0 60px;">');
        ObjString.push('<div id="dwt-install-url-div">');

        var arm64 = Dynamsoft.navInfo.bArm64,
          mips64 = Dynamsoft.navInfo.bMips64,
          chromeOS = Dynamsoft.navInfoSync.bChromeOS,
          harmonyOS = Dynamsoft.navInfoSync.bHarmonyOS;

        if (arm64 || mips64 || chromeOS || harmonyOS) { } else {
          ObjString.push('<div><input id="dwt-install-url-deb" name="dwt-install-url" type="radio" onclick="Dynamsoft._dwt_change_install_url(\'' + objInstallerUrl.deb + '\')" checked="checked" /><label for="dwt-install-url-deb">64 bit .deb (For Ubuntu/Debian)</label></div>');
          ObjString.push('<div><input id="dwt-install-url-rpm" name="dwt-install-url" type="radio" onclick="Dynamsoft._dwt_change_install_url(\'' + objInstallerUrl.rpm + '\')" /><label for="dwt-install-url-rpm">64 bit .rpm (For Fedora)</label></div>');
        }
        ObjString.push('</div></div>');
      }

      ObjString.push('<div class="ds-download-div"><a id="dwt-btn-install" href="');
      ObjString.push(objInstallerUrl['default']);
      ObjString.push('"');
      if (bHTML5) {
        ObjString.push(' html5="1"');
      } else {
        ObjString.push(' html5="0"');
      }

      ObjString.push(' onclick="Dynamsoft._dcp_dwt_onclickDownloadButton()">Download</a></div>');
      if (bHTML5) {
        if (bIE) {
          ObjString.push('<div class="dynamsoft-dwt-dlg-tail" style="text-align:left; padding-left: 80px">');
          ObjString.push('If you still see the dialog after installing the Dynamic Web TWAIN Service, please<br />');
          ObjString.push('1. Add the website to the zone of trusted sites.<br />');
          ObjString.push('IE | Tools | Internet Options | Security | Trusted Sites.<br />');
          ObjString.push('2. Refresh your browser.');
          ObjString.push('</div>');

        } else {

          ObjString.push('<div class="dynamsoft-dwt-dlg-tail ds-dwt-textLeft" style="padding: 0px 70px 20px 70px;background:#FFFFFF">');

          ObjString.push('<div class="dynamsoft-dwt-dlg-tail-guide">');
          ObjString.push('If you\'re still seeing this dialog after installing the service, refer to the <a target="_blank" href="' + getLNA_FAQ_URL(true) + '">guide</a> for details.');
          ObjString.push('</div>');

          if (bUnix) {
            ObjString.push('<div class="dynamsoft-dwt-dlg-red">');
            ObjString.push('After the installation, please <strong>' + browserActionNeeded + '</strong> your browser. ');
            ObjString.push('</div>');
          }

          ObjString.push('</div>');
        }

      } else {
        ObjString.push('<div class="dynamsoft-dwt-dlg-tail" style="text-align:left; padding-left: 80px">');
        ObjString.push('After the installation, please<br />');
        ObjString.push('1. Restart the browser<br />');
        ObjString.push('2. Allow "DynamicWebTWAIN" add-on to run by right clicking on the Information Bar in the browser.');
        ObjString.push('</div>');
      }
      
      _this.DWT.ShowMessage(ObjString.join(''), {
        width: promptDlgWidth,
        headerStyle: 1
      });
    } else {
      console.log("The Dynamsoft namespace is missing");
    }

    if (Dynamsoft.DWT && Dynamsoft.DWT.OnWebTwainNotFound) {
      Dynamsoft.DWT.OnWebTwainNotFound();
    }
  };

  Dynamsoft._dwt_change_install_url = function (url) {
    var install = document.getElementById('dwt-btn-install');
    if (install)
      install.href = url;
  };

  var reconnectTime = 0;
  Dynamsoft._dcp_dwt_onclickDownloadButton = function() {
    var install = document.getElementById('dwt-install-url-div');
    if (install) {
      install.style.display = 'none';
    }

    var divSubTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-subtitle');
    if (divSubTitle) {
      divSubTitle.style('display','');
    }

    var divTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title');
    if (divTitle) {
      divTitle.html('Install the Dynamic Web TWAIN service');
    }

    var el = document.getElementById('dwt-btn-install');
    if (el) {
      if (el.getAttribute("html5") == "1") {
        var pel = el.parentNode,
        newDiv = document.createElement('div'), newButton = document.createElement('Button');
        newDiv.id = 'dwt-btn-install-div-tips';
        newDiv.style.textAlign = "center";
        newDiv.style.paddingBottom = '15px';
        newDiv.style.font='600 16px/25px "Open Sans", sans-serif';
        newDiv.innerHTML = 'After installation, click below to verify the service is running.';
        newDiv.setAttribute("html5", "1");
        pel.removeChild(el);
        pel.appendChild(newDiv);
        newButton.textContent = "Verify";
        newButton.onclick = function(){
          Dynamsoft._dcp_dwt_onclickInstallButton();
        }
        newButton.className = "dynamsoft-dwt-installdlg-button";
        pel.appendChild(newButton);
      } else {
        var pel = el.parentNode;
        pel.removeChild(el);
      }
    }
    return true;
  };
  Dynamsoft._dcp_dwt_onclickInstallButton = function () {
    var install = document.getElementById('dwt-install-url-div');
    if (install)
      install.style.display = 'none';

    var divTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title');
    if (divTitle) {
      divTitle.style('display','');
    }
    var divTitleErr = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title-error');
    if (divTitleErr) {
      divTitleErr.style('display','none');
    }

    var divSubTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-subtitle');
    if (divSubTitle) {
      divSubTitle.style('display','none');
    }

    var btnVerify = Dynamsoft.Lib.one('.dynamsoft-dwt-installdlg-button');
    if (btnVerify) {
      btnVerify.style('display','none');
    }

    var el = document.getElementById('dwt-btn-install-div-tips');
    if (el) {
      setTimeout(function () {
        if (el.getAttribute("html5") == "1") {
          var pel = el.parentNode;
          el.style.font='22px / 31px "Open Sans", sans-serif';
          el.style.margin = "20px";
          el.innerHTML = 'Connecting to the service...';
          reconnectTime = new Date();
          setTimeout(Dynamsoft._dwt_Reconnect, 10);
        } else {
          var pel = el.parentNode;
          pel.removeChild(el);
        }
      }, 10);
    }
    return true;
  };

  Dynamsoft._dwt_Reconnect = function () {
    var _this = Dynamsoft;
    if (((new Date() - reconnectTime) / 1000) > 10) {
     var el = document.getElementById('dwt-btn-install-div-tips');
     if (el) {
      el.style.font='600 16px/25px "Open Sans", sans-serif';
      el.style.margin = "0px";
      el.innerHTML = 'Make sure your installation is complete and the service is running.';
     }

     var btnVerify = Dynamsoft.Lib.one('.dynamsoft-dwt-installdlg-button');
      if (btnVerify) {
        btnVerify.html('Try Reconnecting');
        btnVerify.style('display','');
        btnVerify.style('width','200px');
      }

      var divTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title');
      if (divTitle) {
        divTitle.style('display','none');
      }
      var divTitleErr = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title-error');
      if (divTitleErr) {
        divTitleErr.html("Couldn't connect to the service.");
        divTitleErr.style('display','');
      }

      return;
    }
    if (_this.DWT) {

      var _timeSpan = 500;
      if (navigator.userAgent.indexOf("Safari") > -1) {
        _timeSpan = 2000;
      }

      _this.DWT.CheckConnectToTheService(function () {
        Dynamsoft.DWT.CloseDialog();
        
		Dynamsoft.DWT.ConnectToTheService();
      }, function () {
        if (Dynamsoft.DWT.NeedCheckWebTwainBySocket()) {
          Dynamsoft.DWT.CheckWebTwainBySocket(function () {
            Dynamsoft.OnHTTPCorsError();
          }, function () {
            setTimeout(Dynamsoft._dwt_Reconnect, _timeSpan);
          }, function () {
            setTimeout(Dynamsoft._dwt_Reconnect, _timeSpan);
          });
          return;
        }
        setTimeout(Dynamsoft._dwt_Reconnect, _timeSpan);
      });
    } else {
      console.log("The Dynamsoft namespace is missing");
    }
  };

  //------------------------end Install Dilaog---------------------------

  //----------------------start Upgrade Dialog---------------------------
  Dynamsoft.OnWebTwainNeedUpgradeCallback = function (ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, serviceVer, expectedVer) {
    Dynamsoft._show_install_dialog(ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, true, true, serviceVer, expectedVer);
  };
  //----------------------end Upgrade Dialog---------------------------

  //----------------------start DLS License -----------------------
  Dynamsoft.OnLTSLicenseError = function (message, code) {

    var addMessage = '',
      ObjString;

    if (code == -2440 || // NetworkError
      code == -2441 || // Timedout
      code == -2443 || // CorsError
      code == -2446 || // LtsJsLoadError
      message.indexOf('Internet connection') > -1 ||
      message.indexOf('Storage') > -1) {

      var purchaseUrl = 'https://www.dynamsoft.com/customer/license/trialLicense?product=dwt&deploymenttype=js';
      addMessage = '<div>You can register for a free 30-day trial <a href="' + purchaseUrl + '" target="_blank" class="dynamsoft-major-color">here</a>. Make sure to select the product Dynamic Web TWAIN.</div>';
    }

    ObjString = [
      message,
      addMessage
    ];

    Dynamsoft.DWT.ShowMessage(ObjString.join(''), {
      width: promptDlgWidth,
      headerStyle: 2
    });
  };

  Dynamsoft.OnLTSConnectionWarning = function () {

    var ObjString = [
      'Warning: You are seeing this dialog because Dynamic Web TWAIN has failed to connect to the License Tracking Server. ',
      'A cached authorization is being used, and you can continue to use the software as usual. ',
      'Please get connected to the network as soon as possible. ',
      Dynamsoft.DWT.isPublicLicense() ? '<a class="dynamsoft-major-color" href="https://www.dynamsoft.com/company/contact/">Contact Dynamsoft</a> ' : 'Contact the site administrator ',
      'for more information.'
    ].join('');

    Dynamsoft.DWT.ShowMessage(ObjString, {
      width: promptDlgWidth,
      caption: 'Warning',
      headerStyle: 2
    });
  };

  Dynamsoft.OnLTSPublicLicenseWarning = function (message) {

    Dynamsoft.DWT.ShowMessage(message, {
      width: promptDlgWidth,
      caption: 'Warning',
      headerStyle: 2
    });
  };

  //--------------------end DLS License-------------------------------

  //----------------------start Product Key -----------------------

  Dynamsoft.OnLicenseExpiredWarning = function (strExpiredDate, remain, trial) {

    var ObjString, strCaption,
      a_online_store = '<a target="_blank" href="https://www.dynamsoft.com/store/dynamic-web-twain/#DynamicWebTWAIN"> online store</a>',
      a_new_key_href = 'https://www.dynamsoft.com/customer/license/trialLicense?product=dwt&utm_source=in-product';

    if (remain > 5 || !trial) {

    } else {

      if (remain > 0) { // 1~5

        var strDays;

        if (remain <= 1) {
          strDays = '1 day';
        } else {
          strDays = parseInt(remain) + ' days';
        }

        strCaption = 'Warning';
        ObjString = [
          '<div style="padding:0 0 10px 0">Kindly note your trial key is expiring in ', strDays, '. Two quick steps to extend your trial:</div>',
          '<div style="margin:0 0 0 10px">1. <a target="_blank" href="', a_new_key_href, '">Request a new trial key</a> and follow the instructions to set the new key</div>',
          '<div style="margin:0 0 0 10px">2. Refresh your scan page and try again</div>',
          '<div style="padding:0">If you are ready to purchase a full license, please go to the ', a_online_store, '.</div>'
        ].join('');

      } else {

        // Trial remain<=0 Expired
        ObjString = [
          '<div style="padding:0">Sorry, your Dynamic Web TWAIN product key expired on ', strExpiredDate, '. You can purchase a full license from the ', a_online_store, '.</div>',
          '<div style="padding:0">Alternatively, you may request a new product key from <a target="_blank" href="', a_new_key_href, '"> this page</a>.</div>'
        ].join('');

      }
      
      if (ObjString) {
        Dynamsoft.DWT.ShowMessage(ObjString, {
          width: promptDlgWidth,
          caption: strCaption,
          headerStyle: 2
        });
      }
    } 

  };

  Dynamsoft.OnLicenseError = Dynamsoft.OnLicenseError || function (message, errorCode) {

    Dynamsoft.DWT.ShowMessage(Dynamsoft.ProcessLicenseErrorContent(message), {
      width: promptDlgWidth,
      headerStyle: 2
    });

  };
  
  Dynamsoft.OnCorsConfigError = function (msg) {

    var ObjString = [
      msg, " Please contact the Administrator to configure 'Access-Control-Allow-Origin'.",
    ].join('');

    Dynamsoft.DWT.ShowMessage(ObjString, {
      width: promptDlgWidth,
      headerStyle: 2
    });
  };

  Dynamsoft.OnBrowserLNADeniedV2_FF = function(msg, bReturnToInstallDialog) {

    var pic = "UklGRkgcAABXRUJQVlA4IDwcAAAQjACdASomAr8APpFEm0slo6MipjGqsLASCWVu/CX3vucy2P0ncZyn4r/DeejZn8r/Zf61y15xeyvPX/bf957Dvzb+svwAfqz52v7Ae5fzBfzz/P/uB7yf+v/ZX3Y/5X1BP7V/nP//2Evoa+XD+5fw2fuT+5vtVf//Wj/LX957Y/8r+T/n344vU3tF7CuRvi59Ev5b9v/zf+A9sP8t/vvyW84/jV/a+oR+Ofyn/Lb3KAL86/pH+t/xP5J/Ir8l/pPRL7If8D3Af5Z/Uf8//af3L/wnth+El5Z7AX8s/r3/A/uv5LfJn/rf4z/Ufut7of0b/Gf9X/NfAL/LP6d/vP75/m/2q+cf2P/u77Kv7Qf/kthlaZOeM0MBBo9Inwi+KJ1kVYNE5vnkMyGZDMhmJArQLUOEnNitP87o0PyEHaiu+eCMIWWNseVw4xVJ0RYJ8ox4SPXp+LkeDgkt8BgdjIroXYbeXq6+KI0gWyIAH6FssrFgmJtCwlxEu4g331erFKFV8vAJnOcBfx62rSuqfEIyr5sSJoRlvsq72becQyMTqjxJuQoVEQAeo7XBgqrm+U4AikP2KKzBpB6y+rauwhhogZS2G8lgkRpv1vfI3EbSdtR+P1vltB2KjQBTqxvQkHRhqPojVsAIc2S1kRzxDtpv5EOpnjPj594LFY5w1ohMZ/eQl0vamsm9Eo20A3A8nS9h5el6DF0Ctqv/ojLIVVHtZdC24m6Sokw9MIYUC76JYGZmcvFDUPAxz209Mu4aH+ughQFIs5/DV1aEaKM7zfT9RdhNiNbXNI2YB+EzvLvzHwrfkjcYltSzfIcy17QrVbdkvlGGa75PmRr2q6hH4ki/0gdf/Soyvxc+OImg1k71Qf/E+R/NPkWM7MXtnw/y0ZTvru/PFukMwChcaA2gz0vaUeyZKngHB3vZp7wAhOPzOLKyLhU4b71qWRo/2mQIaHNPpKU4yi5ZgTzc6E3QjBH8xEcMpmmMI3/eu1wPV78JhFSkQRxEJow1NZPoHrUN9i2gPdXUSh/mK1LZaAObsBoqnGBm8V7DTfEvxLLUeBsaor5Cts33kiVZX8xE9IBsKJA9fuPfvqKpMF/T5Sy0KUXwBRStaatNWmV8OPEd8e7cNR6H1BQNlaPxmEUdjwJpOZxqhuOSgQL3XS906iUZwaC7R8D8Nle4CWUK6MZhrmj06mtW15JAgOVT65tkXuNSdw7B3kIhQCuVZNRsNpqz/NmP9zLnSiNhwSF+feZAyqQIot+BgcJgdP842gFdL1h+yfmLLinkLXCKGTUbDaatLlxgk3SUm4U8mneeCl7M53UAJFb2J82C3LBMF0FNnXSxnvHW9fOltvbKTest4i1HoEfacFkBonN88hmQzIZ1nCY7xIW8EGZn6PFu9isuhCGQEtPjzWfl4uLYPcfN69nq/Q/JDzVTMZ10Qff5u2QSxP+/a6fIWS7HDI9I+BDIOOR7O19wKN/bdkXybuk1ggwmAVMaxnW2nntSocsAAP7+KIC0/kkxO4AcmfeF4Ao1M0Ys3Iqacw2goYkUg7c2QMV/Z054XllRKfLm2Jrv4VzwKZiPma0hd94sVoFUkkR3cxcFbwuWsMkCgD0kh52APKtgAOWW7Yh4kzVqMHaJtS5Xz/60s+M+bWknVVtZivYE1fAwcpVtsuBJjOq5G50ygT3wvDTGI4TpPEymIPA8KVXn79yWj3n71ifMhDCg5dNVtLALdjR3xMLnbp48xTwz90UJ87pVs6qQkPb9FDMpUKq0exIFIQPd4gjkZ6O5Rt28HvtOkIsk1u9pANSo6lY9Y6r0jtKvg+gUxVGTEP2XtO5ehorqj1ft81ozQrKq+ankxNqk7r2v8MqvjYfBld9xgA0iMKYx//QeDNuHIFNl7C+v4oEnevL+d87nskT3C5C4uhNuDe1+vh4qqRBnpbvPH4EELzUxqhLBlmZ3MQk9Toy4ARyrSh4wbDBKyzYZyO2H0f3j3BBmuEzuD0BKYgf/a9IHaYTiIrpEtbJdfvfhqAmtgRuJkw+udoWfRry3Qo7pKKjcJhExzSaZucDsyweFI+lPxjb8UBsj9KmRvb1/uLMaEmcjc729vUuue0KmWD2CtK7kW6Pd12+afhVtxqOl7cBGxqrSnqdRQOROP1qGXlLsJI9DeymgWfcvIC1HCqRPTp30PfX10DMBydANUSJcXWX52UzJ4LWy+1hd/xtGWwr6vjRXWyOWjfD8iRLnV0NVsY1o4krqi3hneMhtYY/2VLHJOyCUcfajOhA8UMKFs1rWNtgTWErR2k/5ZRt+0OW1dO3SF+AoPsrK7SGsax9SKcQ4bUuS0yMF8WXBbtO3HAFl9GkMy7g4Wc1QA6yoXcKIVpEWMNPyHhs6JO+Rm7MKa7j7WSU5tItCs2SveRZdvBCjuVLaIPwXKq/X+2KczJ6/W9X7XKfFhlYzHkc15ngE/mY7yDX5bKdteCB8ait2bkqFDVVOoG612uxSwkMXc0DP0L7sjR6rlXS6eIdEW1i5FevEqvbJNCd6e6pcOV3Yf95zv+/jK/H0U2XVSvxMQztm2eL0I7OvGnKTwAvX1sV86Uj4+skiWYvdYBRH+I2X85slXJyFsP0TBMvMqbpS14/pORikBC7ow+DZ4cEAQRuBj1aY83Wah8X6NJdQ6cezfGqBStUpRdn2jZu2th2W9d9kBKCRd4Af0X2fwLzAUJeGIx7ElbjRq4dgtQX3rqzUIR68QS81jASbjT44V2Lg5u017BYAbdsOWmEcawbqedqZZ/TpSrIyYhszA5+nVaaSargUCe6jqqtTS2zFrk/QbfuZoCEurjz5t5Xl2a3UyWPC2OzCIr6UA5Lthj39l7QFuJdBQbi5kY+mxkQd5G/oVE73fw+EFtbMJYUbhR7/suo9zZMZk9MJmXoSCgurteIS5RYx+uwrzpTRWBDP06jdPxfEtp7lDfBJDR31qmNCKvFo/1C0YaauZwq2Ttg0VP0F4LMTHKP60WWRupJSSzHqpeMFOsvppZEUsfxYb38Fkyk6DGBC5yEzM98TAEa4Rj5qUv+LZv8lKadD1EU6GzDIAAOzXpC/v8MmAxyflBGbQc8+QV94EnYkCiBwKYqXhyiqyAgdgGxIjnw1V7b3TW6tQNDwkOaHpb8w3OKfzUAc/+UfG8o7du8jK/mpemeXQ65CgPNm1SRi/1KkM+adhDAn/pdR7mybncxnxcV6pj4Bjyd2Sv0bYwo3A2c5IImf2fRHr3PhWY0/JrBF9UlWMlpB+pPjVRYpS3taVEOLnba7gUnRSOg9W7MCGXerI/sTFJZDIeR08WX82e/FDDSsj7JKCPfJ5Zl/4OUqu2SiKz/Sb62lHogFN8OXiWYF1cR6nRkQ6HCgHcGiio/yczsGa0CEEPNTeBSrXgt8qsEfdtNhD/AqDDF2VKxMz3Ht7Xz7lCYCnHFRXgEUiNRodjccx4rUjzj6v4BTbSOZjanvcUpVy4rzfOvqnKUAbDQlQxkH46kKc0Wq3BAK8nq8REMd16/UOsfJEzSgqtYegdg/asHoDjJ8opGuLNy4jpIDw9W5/s+4wQmy2QmvO3rJ6CcMqHMJZp800E97V0p/sY8xPxax8oiPN7KvVDE3MsbhTapdhAlSm9li/topGIj35OtbeSz3RZzZpqYNMjLS2gPkul9TwUSThGJnjul234A5cvaZLpBqukJ636RA+4g4T+Un+Uai3TVaIi3g55QtrdrA3hQYpAsRJH63vMxySXtPObabxlw8/JW7NwHsxNDENx/o9rAAKKtLm17Ae5QOFrmcyNgnEhVD51oWekZzZmWHfMqBAsje7ZiYxCGekNX7ovz3r6GmPAiVyzvQuhmg52zMpuEGwd7p9cnWka4jpwZp6sp27VaXbKH315Y0rujaaAM/Amv8WMvXb8b60/NRYaS0dZKqA8UJp/RSKBFmPb6i5edgRrg9j/TwUB964QZrdTxazvVfvENG7isrBssm/KXis9/69sjNaUeFcGUoNaaZDCoEMcnClLRP8A3DgzxEIQfKi0UJBo2LO7h9FYgTeJt2HXHM0XzfzazHgVKWK5dboOYxoYNvOsQwshFVRmAgvlR8ad8QMWlActV8bjmUaknsMtGlIKGfXtx7CydOpE23q34RN9HaNheNQbmWymLtkcSNV0IjNJkYFMs+bhavYuu7ilnPOXwdt9PwPoo8eEFHnMqhDpauQ0/RNDUrFjaKubJ4JtyFBA/FUHDyuh10ShsU5bFutH5U6Q/ORlkcjS9uFi8V9djNTA+5DakTouAv7qLtmLbAOC4lHo8febDISFKf6aa6UERe+enotXThbu2Fp4076pJp/bDYO8/gw4E7fn4yqDrJ8TU7Mb9MrVKlw59M7T5p5GXQL7laMe7YH+ACDM6xETLUkVNjU9TsuOuoSUKEEZmS+MazrnRj+oLR+OUV4/ushlhfSswIpF/V2SSU/YJD/KR2JRw7Uor9OjPQMBFpZ6Pow9C+RagE/UAK9TQiPfFeJSp4U0JQKsJY4W9sS/g17usFACXdIN9hM3+DkTieUWitxW9ypwaRnhy1iesieEyv4bBlLHNOBQ6fYt6lrarCcg+0SwLgLM0kY1mUL69tx84I9hbE/k24EYd7JzFEMzHgbZok66cDlzHuu5E6Kxp09p9fYOyTLtXjJM3PXlRvPkCxdJoFHsZs67KbIt+vnQAknr1i+vK2hGEuSmWSjWOLyhYXIqImy/D5NWr9y1Noe21MAzaX+LsX6atTPmLZdarNCh2t0auTBJS9E6Ok6CQ5+xfy5KsjES3fqzIIzCFm0ZjJLLQFiEkA+uvlVEknFvYLmLt+0b/o5v6TIxx9eSIs2FDoaUKnf4709Dw1sEaWeM59p4oFHRDBjStSQZJhye7yf5wdtf5jBl8YrW9papvC07uhXewaKl8xurqfbTVYf7kJUmSd8aYKky5btGFdrPyIj362xU+35r9vfzVuU6tnSySlmiHb06vbtt3iXUheUdqa5nEiEWtQUzZzk69gpxer2He3kvgf1iDKhHpTK2FN6IsNqGPSj+TwBiR6L+KSR2094lqOs7MHTQ2N86oXrhZRW66X2OCDtJPhjB8ZwyaoyVMvPKhh8mziAV6HYsG4hPvjZ5DMC6Li7MiF7mPnc7vyxTR1OV8jJiqL+WBkPg/0Dzsvj9NiM8nwil2Nt4A1F+FY7e0kA8kcKozoZlxkRbfU62NYDgIUZL01NtK5cb/+9O1a9hrgZqscNT02utDftam2aCusqlMxXkJ2UjP1P0BlBzm1FPrEMO+ElDiA/T9NHyT8cdp2DocE3l6g0SWQgQ2EveKs4/5fKggXOk92pwM+3K2YmQO+bYBRat+A7r7cgtsogM5S9AEZfQUEstpHCqM6DgQxnPZxwN253LMoiQ+L8uBRReK1wtuyWRvPoBIa0Hht84NJn9spkKgib6xQ7DB+mZr0ukqs0UrXQs6TDT8Ee+JgtqLYa9C9+exquKOpABicdPyHTdfT16+fmIUsfPFefnxrbvuITAOROA5L6EDYWpmFs1a86ltPSpQJzORulhp24F5GRIXZfWwi9Cmdd1YfdA88tP0Ze97bkYy/P2Y8FNuXQMsFrGnEZ1h2eu7l8/NzZ1BWaXo7X1ClkYoIQOLtpTPCCC39K09ITa3x+UlyU0//XF7SIYQuT3LwMjdP5aQ44RP/4t88VfTmTbTwCQ6RbZC22rIWEb7ZYHVmQJntxeNA6UEn0X69wKUJyfUOvtkZgtSjuiM/CQbY9+Tiav1W4A1HwHzyJ+z5JMAD3lifjfzVMWm6j4+lAPuUshBeXU874m11UfBZ4jwqqlNrtu2UfKr5NqbbrNGZf9e7Mvn+ySx9gVfYOaheBsSJb14ak1wqXVavI8GCqcNaOskuIvjEkxh6H6zPQX+7bhssI096QCUDHPiElCaYE02LARYvk2d5nUT+0Bmpj0DEo5KE1AxxYdPcDaMLNV2NFdlyRA/Wb5VOvqggYY6vFjJPcYZPoZVKZFnNC9onN0ynQZA4eAVfhn8xiD5xjGK4FjNWtn8GvVAf6DeQg7QI7fIztrsReoEHPet1u3p8brCi5Emz+i+P6jcZIO9j6Z67nBBoZ3310XYbgB9LhQLqNfBNCbpyfrP3kCA628y01MBScR4ldzUNfitqlnuU7nkV3RqjmXZIL19+186Om6pMHjNz119OmyIMMEGzdtaAWzFv/tp2Zu8w4NrK2XDAXZp9iIP4BbNpbmUl/qSciGZj8NEIHeIGnhYpHRrd+AS8+P5P7zZopBDYYFXD5q731Ij9PLxgQL3w3+8QfwXKUJyfPYSqIaDsmHWgW1wFtQI8rPkBRX/AUOsP0zHYfmnO77WFf9ZMSS5oI2qZ4SqrFjqfy2AXyHPxHsCFhqkbMKx8L+EvT22nIldNpOzdi3CLBhRvLLydrscfQcvEQ00E1mL1BcaOX+tY+Tx31WUfjkcGXMmO0qrevY8vHmZm+zqLe2+wWAq2DanB8GZEdqaEwuhRvzuh+/9ngY2SuqDAclVWlHgpQRkSlU4Pb/AyNInxaSQ+GAUu04la7Oswrr1A5TSpaJJ9LfNKFfLfAnjdt4eCjwClyxfRwXVAJyFL3L4h9cSraLxPkPv7OlZVjx1lWbNWPhZgjwWSyMI13PdTdKhCBQc2QTt2tqrRn7KaR87prshwJbD1mAufAD8LV5JAyKmeAkIrjkPTwIuok/S7zRRK17SjmHJrHRYxUnSbbrDWAPqavS/thu+jSYQnC5yIiYgHmkHjHsW7n5cJeZ5myhoGSHdtvQAUkbc8t5QqfuhUd1WWDzlfC2BeKiId5Hq6PCMPjmSPO0cJHAdMBujeg/AincsCfQae34pv84/XjQPBASRfA/sZppZsMBYNCaeGl8WGQ/b5N36csgM2F0XsNlD+/54731Eob02QJa/FmMLvnl3dI2AEj04WuBtAC7rcwGoUI36iiikMvJguo+Tu453BcDhYwQASKJ9yUH9SL0eZrYzaYOKWRO6UGWXviOU3Pr8Gm4HiLxdsPawNi8ybSr5HJ+j5mh9flBSEabD/JkDdQYYRvFpsonc6ZcAcJqjU68MpzN5vz5sAM/3ub4FAGWVwGASEmdiH14OGzBCSzaBTkK/1/qL6qMv+0ft2dY/1efYq11XP6VSpl0nf9mQ5+B+RaFxne0F4TzFvtIB7YX90ntklPQo+SLXHRgURlkkeXWt3iugVdhVWX8TK0dD4LCxH6HMZgDqOIUa539W0Ek82oHLAlhEvxgpM1K5Nsg5QNw5FFuiHT0JbOJRiM7bzsuN2O/rjTgIIHk8xr7374U8B2iyX1Vsy/NSntdDJU42t98TjgpctSdDezxkqK3a2HM2w6IABxoAgo3e15ZwLeW2TALzTKmgKowEwI6n4Lqjbm3x44d+bMwkZxRkLo9Dmb2+xKFmg7MrJAtrJ1b3jJjuBNcAVTKTLJ5GD6sBreXdskU7KLxhSyjj1f/WnmL3PUV0VXBYEcqoABLex3rHcWQ9UbJJ2gT/DxHRHLR628ufhX3a7AXVZL42XY0hOcliOOG0hmKIb5lSKOH+Dh89xJShzjBm6+lg7hdLrKjE/m3yTvOezwWLTTeArEWwUuyzwpdN2XZaCmlSyVtAGWfytUmZgd2IAFAQGbhrdz52J0gqf4j5OGXjkDoEk8xPC+zyXrRyU8FkNAAwC46rL2wskI0xwmkL0mldUsv3xoroXaw8aoRNe05tZCQ+1U8ei5moglDjvhtlpdhwUbD15Vn0wtUt3VrL79JSWw6i9ys2XxKxjwFxl5hs4XOeIqxJFXv7XmMgB1Ir5SpZERRt8AUxUcpB5XWktzsDf3TDZMRAWVnxnmJ2A6DgXwsUuCwcRcUlSF2g4Z3FopokEUhfg0JGpi3826wLNuHSMwoBU1rvdhWxD/xJsgPhR+ZMv5Zt55Y0KteSWcLoNl0Ygb5Pl94nhgBL7p314AYgfd8eQWXjBgZs/eKec4JqbHu7JQOS+WvipX2w/gFC6P28bPcth6zaq5Ar7WLd+AbJusMZVazKTMw1ldeU6QMkIk0+jVrmHh4SR8GWa6qSIxFKWOiJmg8CpHy0PJgGMlRiAANgtg6gkKxzSybDoHgz9QD6gvhD+92eDNirBCx5f2zPxl/Rj1Jyp0f06RQnZ1G4qeLCN0XyYaOiclntq9fVVfGBfa7Ao+cYtw5iaE6lWbrQn9Elpn10JlIbjmpJ6DLjYCoU9KdE3f4wWA7d++XzRpu1hzLgGhtZwsdcuumUycJ+YeB5p6KGCXik+JAe04Fed5dH5qcwGs8sIBObdhyGH7zk5nKLwJbvE74BC4qJyRWUAxLmLvEAHayd/RkOZOKSc8gqu6pLjPwfILROd/0ZpI5f1AkBpxB3O/bOk0S0iWiaJJYdqjERyAsshUaHxE9N8hyRDseXs+CkMOjGpg/3qkFGJNYFbP8WKKPbfBlXSJr8rqPYB96egm0EG/6bj6LwZdP1drXsTKI6mXUnW0wdPtK+j5jgZEdee0J7lk2ShD08RPtLOGiwsZr2CP0INZxuGEdb8qr7Ng+bVcXlTfoGnwirddQlEO7670b1vZWa6NXavkQX7HMwimaeqvXOHlLn9ZK5LOSf+1I0VC19oauHtt9vhmF0Mdsep3QCwImjtrFbXBb1VNxvIag0jsjuumLgB2jcJZwR5ixliA65nFRjUVZe7EiuroLE7YInb4JCS3C8gPMW/IuLOQA9AEdu2uUva62NhooVQOdr25CgX2qOnLtaCPsSchi5UgUK4j4A4KamyKPhTRW8RzB3tzFHeMh8qDQOHW4NyqwUzyitJBQ7CXeYfpBIra53pwynXxgCUleQSHjJ5XBVnnVjhNpeJiLsLhnx3SIS+vpx9yZETbjn8HWNr8OGEG5oto65hfJ9FIQUmiDqqO2orgtTuXbnaiFbKTWtZ9mUS9GH0cAEBdiJx7LTG9accAcwef1wfdNOm0gX5gnVXIiZr0UH0TNWQXlqPxDOmvASFyq6zw7Ep/OriUf6xXQF7TfGAB9EnTOaW4oqJxJt8deStRoDSecYjI61hV7seQMNYXdBS/tEypft+FVjShCcaz2B8iMaCU9fK4ZDuKQ3a/7Ni5mBGfYjH6kZdctaAsM6S60jncM+cSNT03c9n8OgI+591MkvbzR6/ftYJjUDhgkWrRtpfHxPhW3qdv8E6g2JP3UusiYcS60FWQMvuGJEBeUzj2c8hK1J2pIaooWQ/kcdJCaX22y5XfT4mfq9taYJfjmExbz2y9LvqZ6Pmo+BM8Eu341pZmMDf/a9mI7g+fgSE56++hw0nuu3MXjUrqjMmgxZaGxR5g+++1/btKv7X0S/Rhh4fS/umwqez8uRwRH/iKkDA7cl/tn9yRhqmo2aMyTynfO25FH51+ZNu74ImwbCfReDUimQh/8LhVQyOBq3ZMI95BG4QwYBJO9rLMFdLVANDkPmEDdi17EOhbXx9qb2ysWBFbyc7ZNegkFgQHpf/mtSJQugdGz3wexkMKP0DUKyeENwtTeQujr1nrvNcdqBpL6HuwZ8DLkLaVnt8zjrG4MTmoIdgFUFcz0DxtH7g3C5M8rBFvUYY5EU7bPGCitWIKCTATMczvFIAAAA5zonAM0Bwgx0TxMIboqvBkoWlW4BDBwsL89fO2n8AFRNo4AAA";
    var pic1 = "UklGRt4cAABXRUJQVlA4INIcAADwkACdASomAtEAPpFCnEulo6MhoxMa0LASCWdu4WeRCC8fUBvyWnFeSeW5d9rz/QeqX/aeZF69PTB5if2G9aX0p9Ch/3vZA/rf/O9gDzw/V+/xXpmakf5b/u/bF/h/yj9C/xr5r++/kZ69Gc/ri/tvQr+S/Zv8j/VP3P9gv874l/LL+z9QX8q/l/95/M/+9+nr/Q+Czpv+L9A72V+Y/6b+5fu35if8f/WvVP81/rP+b/s/5LfYB/Hf5t/t/7v7G/6rxM/qP+j/Yz4Av5d/Uv99/efy0+l7+J/5v+A/137ce1D88/vn/e/yHwC/y3+o/7/++/539svm0///uD/cP/6+6X+x3//HsiTHl0mqJvBh4DI3NKTs9aJTkOqnNOZfvhPzy6G3UgNMJuSvwFP7mh+7mV/Hi1zDapa5qA+jCFyAwxEk4eAVl54o/sKchmT37KUMl542RXQfBqgMIEIjNymNFghcHQw/NqxSsMu5LcZy5dMfFRixcu4NIFy3rEB7tzgHeCQANgSQuxrLe5SwpxjlPTlRm3oVRYFDnXeb6ZtXQcDn1O101rYKqQCtGEf/zm+x0qKiIJibuO9R6Djv6mC9kuLp2RkICtB5R7Jlx6v9AKxBLezH4X52YCjQAgWIDph6SeJbneiRh7Sr5utRlvky5EhehL3BVF0JF5N5R9hkUatxtMw5+xVlSoIIzt4kBew/qxtpTejxnizH9v17rQBzxIHPfyv0TVoHA3ZVpQpZrKkW78wKvjocPn8pDoiQBVZ9M8VF6TMc3qNkIlRrPIZO0Ae7ChMs2+9yyeN057mr3nlT4YKO3IBN7IEHND8FGkeD49SQdt410GIhyH4zTcV8wwgbp23RQeFvNk47VeakaDviovJ53ierCObfj8zwyixewOUDtu59gMk9dVmZ7UIaB7LUWvZBVmY6uyMBdOzHq4v6vbO/GYgGqXl2Bpol+1qItxmQ3NOGhnSXBIBf7XZIgzT7pvdevmcEszFlY/p+Yb2rw9AZTA6jONOxc0hQ+GUlkBsFaC2LAxoX9/2Swd4OOSE6KMHWMa1kwOsNxbqb7tN5G/rrJgN5zxag6OiGbZk0A50fQUa5BU01RiKmXrVROGpZiZj1+EI94dUEtsMScqAlFC+Cn0J/4MPOt28ObOqdiJARxBnqC6VoLfymBvDMKiPBqVtuGjLckktAXj0EkekJ3tFZykM5XhCpZMZxhh7BaoNQU7ocsOhYbvuqaxUBdg2YWInzohR3bSQj6+0Hp3qdahu0tB0b+usmCwSiZYhOkIs+xlIfIHGXRdxwEZQ5lN6WT83nWaEOZ4LIHfdEse0/nc9HVNlywINAddPBrcB1krKMH0iXpSBVAOOS2op+eVPCzA03OBi06WIXhMOWSzcyEZ57f99aAV33tQRZ609hNu+8TndPlRL6nd0qK6yYCNLsZMBr6xP9a11/syQF18VkqUwDI4aTfqZZkBzEWVuVXUDJFjn/PKoUqJLKKyV+AqAXXxWSvwCbuFHKS/mMVzun6kF+ht6KWis5BVwlq07krQ29FLRWcjHMS1adg9uAAP7gFJg+XwDGOVG6uvsbkcR/SSqGAl69bbqDo/wbNdvC/fl5MOTNLFGa5F2CC7RT/E36iyl5Lxa2+MUnogEr70TMyPuP2ycQ+cJDvGNjYvreBCzcKSDaX2NP0lLIwDLcMVOA2qHuzS/9kezPOOdb1mgYqDo4jQ8JpQT3yvyGsvl3ZB75TsfS7dA1Iw+2ucUzGZ5kOg5uAlQgyd8/2iOJQsrioRp8IIAn2Sp18fV6yrna7e/7qGZsxELtby/rNtF/nEh+05YesYqcAVrBHAQh/UNmeJJvSkQGRWgYvlr1huRt5hQl2c24R+MrsfVvsCkZ93EswUDF2JJTsr+Im4gvlqbRo5MSOTAgdlg7ZGApAs8DbkqKbreHURvYqe1EKkkA+tBUNjj2D45JRxbtdwih3iUfcIwaW1qnw1SoopKUoUF08xZvOMgOQN1FaAJuj3jnWzazpxvTHMC9snCgpyH/x03tG2DTL4zAjFpmlgtJvwhTvfL4sHy/YvpBm//EiGS3Sy5PtxCjiFcvtzFBpBdd8xoypAtFeh0y24nTOfUeRdzuULMo0r72lVZgJ2Q5HZttcGKpjgUbGUjCczpK697ist6qzwix1NDe639Hhvtk1IXxM62SniZ7D7Sj3c59QznPdvAz/WcRSBJkA56gICQqkfD963A2nc939acI28vEd4MiUYS4HkvINGpOpGPhPkN/+HqRJINFk5VRL1fgryv8cyIHWvaCnM3WpKazfXisOQg9g3TSRMME+UCp8YF65AynovDsoFCaF2Lsfs2lMGXhy8JY+L86zwwsdVB/UomcxLv0LY+hYp/iUgXAA7aR3348C4TpPCbWYwxlm0rnHeA8qYDIf+QshAvmKPKFbssujcn39XyWePu4j+Dh1vHOGI9sECiu7G7HJxj2r7kvkbsRtjY1dBxHHFguhxf9Xb0qC+lRuMpXvVQium/djJYE82GrFQIklBbZmQ2ePhvU9edao03nJtRAjYzeu5ehYxhr6yZV2iONlr7txLeIOO+B5KHJvfj2ideP5eU47UWWONIrqHTLlP1980nIa+c6bxx07TeElUJrbjyL38q08t8MdzFXLf4+DtSa9qESEqJhX9v2Q1jMo//+A77L4HiVfZ8pgXsN5h29YEi7V8orZ+/lc5WeruTeq3h2IZDQmMEXHyUiK4bzAZZND5Sfb1CPUtw2Wm+Ck5sVkLiGpfi/PoysItSQIuZEa0mXjTA1cD4QfKHULAEACr/68jJyOzabG3tQWgdTLU6v2pBdLniSE7445bqMt4350Zx5Qww/h6d+MZcNCgVO7liNQRymKpUO0GvaYPkaODph8xGg1FGaQKb43GV5a2JXCGglkFWfxAJY/FpMhcDHkKDGoi80hyRx73FxyPktlbicxTUVs8sdLErWbhK7awAZ+2uVCun1TgfECoX8SFcpQUdVhUToHI8nKGYDE+mdkW7DHcjU+lCPUbtSxfewuUW9QZ11Qd7AgZ7Va/tPM+8zuhO3m898Rjv0Odo4gtrm8gXRuBA1Fgs34NT3LSGhL0ZkfUvClJKTu/R+L9BE04ksss4AhQB2dVIQyEg+ggr+HJjUSEnu1HfgEkSoXfrebg91OQIdSKqkcNWQXtgXsES4YcH0kYe0gSTTa1E48TCvwv59EQX7mgWPDmYD4ihGbUIZyk2pk285i/oNlxDuJnoe5kwfzeKjNq006XiZSs34ZLD6yfC+TwqHvRI0VCjVy9X3hggdP6fBYEOaSTfAgqlqWRztcSDsYWjCL5MSfe0BUuO8gEnR6xIzHlNUgoq46OhzBvfyrVr5zOfUjnnkLkon5DmBEnzXwCDZVKML1x8OGWvMoLSVS8XZsx5eFPl0KA9eZKehiauUY/ykXRXsXPCZizP6wVhwC8MF8ATxoSFYGh4VS2mpjJAre3f0L+SjTvXvDzZ7Qi9uuFG+3AAuDGLAGowCUYFnQlTzp2QCfWQEUGmm/WexpxPogrNLkRobkcajHXs8v41cOS2Mjuru8cGQoLih5qoYhU/xWwKVFtKBLgJwqXNb3wB1lk/d5RoLqg/10/3Z6Y5yhBTYOBvbxBZmiOdag9Cp/z8apy4g+Ekzle1mdWY64/Dsf5ZpXWLD7gF/h97qBEw2TR/B76tkd08GrPv9M4fLLgnYWjxymva9ejhjKyxLMX9OepJrbERH/8hgjXO+Lpunt6B7iWeLGQfy/F+qzRVJISMF54NAkmv7byBqvZHFLXRe7Pby0TrML3V8BiHNPNSG2zlRn/efc18MELm8T8coDLdYgRb69LJw5q3sbZWNREzqwvQhGu84Zmal43XBTIV0W0GviO5mc9NjELdL8MZPrxEOV388iFdZ564KzQbIbmCo+4mvxlL1xnJf9B64lAjj7z0CqvF3xM5BB4Ni6cgsKiUhr5vJ5YHIHkc3mzFn07L+bMSTktgMCSfhdaLK+QzD0rzxAlGaL8mha6dpgbMmt7HMFDXndVQXM9NSigDzlOVZPla/CD/ajuuIOFZurPzgiKmfgxXXeA4BD+Gsl8U4Ysh3TpmpRnnvwB3o3WH9eNtL8k2BfnHuNH7P4MBuht+DzFLBDEn0Iutj23avWJyhxa1I28cKxdAni2kVfx69kvj7w8GuqC4ZVDWhtps5TMimHMK4hIxtoH4eVY1j2VB1MUrJOaD/NGfkV5C1p8INz3C0BpzCrjzZOOQeJA26U+mcJmIO5L3KCn+qlmL/8EUYKS0rsQDNeYb4esmoEwvgVX2wO1EZNIncnT5M26FMg0zzRU9hJLvgf4DK69PiWED8N7FjYV+hSncIiI+ZCQD30tlXq/TNrrJ5Z3umjuQq+xedGeW/xGGOKm9ERdyHYIlis7C0yIkGByGfwa/DGM5ro1JH70rgq89UMD2JPTPjqIQSd0HyNTf0AylZ3KyfZ5dtyp8pZqQdGKdW1sazq9JgSsdQpwrkFuK/alL6i6DNS9e3h48p/gfra4TitiQsBMyHspMKi3hmeGpHvmO11NdaBa1qzApz7Hhm/xxQCydhoLBJ6JJN3XepeMm/CzMgFmbK0qtEkVkl3vIIN2JJRG7F9o9VXQuKb204qDsdMrbH/yX19MPPPB4pzKnz0TgT1wlvwIZncqSZ9PbTQoU+FNNudAgz07TSGoou2dUMl9b2xZWUBcxZadXF4Vupk68Ffk1MIw504/nVexsofvj88NOua7VP14TzsUAz/XaaY/AtQPuJbX2kHkUM/+kODPVYPmOhEvQme3e3ra66i5RYAKYKuIA1fmf3NNtYj3Pu7nJqYMLn9++PHmZThw+usR3LWojfg3nGUKn8KTtQdSz5GW1UzkumdvvhMP3P9wddDsvub2Wqo3GQCjn/LtP1CFEMPXqcSui+q47DCC4KRMyHNdLT9GLGP6Lc74XQKUmD6HRJrAbT4NsXP6i4RVzYZZQWVsyr5kI56lF9BuU62lVdXtREjZUtCUFlMuRYUxzGN7vlOhvyjQeqZXv5EN3rwL/Qg1yWMqRcFMJAZpKCGzF683u2ffCBPL48UT7fiP2+KP83SOz73Yab5BCXnn401zgvx62XefuNj1hXUGasnzLx32uy/JMFHxC4ZbDQlgqHV/sbMzCdz1BVxLo2o9JncAVjiQKEXn/Lc1Z7SUjTsfryVmPuWQhqrceL0QjhXW52Eze+bP+PdJKJK9F6ageMatF8uogW8ytRNM+TYoRbQqA2aru/6ieJTK2afyNKlPtv4sGszEULDV3e5/zX/UmPwMPhWlgFZaav+sqpq+DyT+MaPjCWbQekWs9yM8jrtbVJ0fcc0cIQD0tsJ+E6aESGqK5jtlNP+GzpGDhPPK5Mo55bF9FolXBAGZAVGdBOhbDU/6GDUYh71x5VoEswUPYE+nv1qr60fvhUW74Jl2+Ak3Ox60ushR/kAFiQU5unws4VX2ZV4t13a18m69iqc+Bwn5gNewrSI6qwyrPgjOaTjfayS6vflrgxuZjdpkOR5RtZakXIj53yiuo2K2fP8OhMQFfT1Xf1IenGvJib8E3vueeBelj0U0b6UtmjXTMB7kkXSitc/zTD/joHL4Ko3sbUVty2HB+EaER5UDjZUDnPyoJ5hsPDV2OK8oo/+vEyVLYg30x7XyZVo/oirMu34r6pW5fc0tyqrOTlSbhrUiEqyhQK7/VY4XZ04eK6rc4pvqU41M+Cqmd7OdnVWXMfu4U71zUED18qtxOBju3te5W3uAAPLSJthvw8m8qN0W2090QYeaSuYNcbT4LPwYnkvtAbP2OGem4LYJP9qcI8yQDI+v7yw5T50kl8zgt0jVRvXEYKCD31kurhfD58YTT4T+r5G57Hk+VumQef1CnH3pQD1aRdbf5ERC9BCSe2YbxNRvhsq9ZzfOSBSwiF8G2nx4p/RlE2Gj6cg4r4AiVUVg4KnC4QtbWFJcxP7Y0X8nCaKbQGmk8Mq8G9kddC0E4d5O1AqQaXfjWyE3o66x4wnMn2HE5aFWFFAqUlbZ4zlg30ZlLbALYqiOMVyy1DA9mBxsqxQg/7a6U1q17hGnvlmnIJ3xo61GBoeylwDXWCr4ibtSchA4I491mYx9svX1+bD2pmljCivhCkoIUSaKL9K2L7ZlW/zpxZceGF7AR3ixQ9eMGMSgyID3bVtvEZsqngIp68E1+Pc3vqYVvEPTHmdVvmP8IQW85CMsSg2+jpnaDGY8S8m1Oe6ziVlNx1Z7Ge/+5b4NcFa0iu8qxIyqAvGgzkdl8pnSsH4nNs3R+U+9fXEvJdhn/VQcTkaJx2nDwDC8bM/W2/HvaMc/ZFl+sADKYyGzZmgo7kVI6b6CkhNBH0gQAI0yyf53gS2RqqeL04TOduJ99WVElyC5PR84+6nlGuELBg2penRXLsQCc2D8q9yWpSbzqsS8qwt6xTWBTL6jbZm2TXfVaPmawHp/BF/yef/mEzY0HjOx0iiKOxURWs0kAHG5ZPHBL+zFZMgCIRKtLSMDfx6h/6cKFEZ+oNDDJMwLr6QG8v2CuycVUdU+/0ktG3Ho3QL4V8VsHkYFQBq3T7ZFL1cArK8AUU5x61Y1OQuUco4PaxwH2oerGcwGv14Ssdhco5SmZr2K1FQjyNaU66vwEUwGGIfdujlLoqqg7LTpb6Gee2rWSRi0/tk59opo6YEhkV4vqL/acXVSXcMYfLKg6trNoqkY5Y80dsTaz07OtnqVIdAOYPVvERicZGXsxYgQeu9AHiVTtuG7lRZvAAAAAG/JIOQseDg3jx/SNFXfYVjl5WTKBMbQRV/S3HZYkNyv7x+TbCJ5pm6jo15vz41qK8XRoLvrg0hV2L60B8TQkBpPFNg7M1EezG4H/i5oY/wSabzedvsXZUolkpWQMNPE++nGeY3CoxGVuson3IQODTBbGTWdRzGkSb+tB4mHcARc8QtoObsQucmDmyTZAk6xEL2HBrIpVxeqgFxrvjccg5ywnbexRUU7YqnKip21ysekXoBp4+HhuoV1mzrdGbqUCZFQtEcdRcMcfvXFnsN6zxPKElTw+7uF5QS3NwbERgDzjc7qw1wanKt33VcPQyQoctvLWW5cJPYfou+RCIxuBwiAyhhqJqhVGRA/SK2NN+R17YZTr9k6+m/H6uYkrAen6LWL9igbHiRNxutSOafdLRbp+1zRLhfOm3uPEfjcX7qMLBNa3rsWSVmLqCDvgpmwOHkVoPHGN7N/xuCC1YW2mbJMww2gYdL8sVq6YGN4IKgojgWc/6rgwrb6AddX9AUYTixl3S6IkPbqCfUZ1LR/ICbj83B+seufvmXL8nVLlggS8NHhllSPzxZUX7MfYFdKttjLDGWzu81qGq2ATkTyZmbAWhrPcx0Z3XTmIvPME+P7krnUjB7elJBFtEi1FbvFtuwYXu7ZYVLRQxpl9z4TEBL0avdutzrq3vtlx1BrISjzVcd9bzHli5tOzF9Bhoc6ahVCz+OjOk3FK+JTS9RpyeOy6p7mlCiWYR6VDsZZPdCIBj8NEKlBIcdkwbh+v1qh7R11cAYxncZD4nurRVEffLunekC/NbFKBdAPKtrDZESu7RyvM4MpGNTZ8X+QQ6ZgfitUrz22vMMZ57COFElOr5DpyR/vskuGCBsr21OWNnvVr/1FGeMMBpy3nsttu+EV6ei2yfPIc7c4Pcngx7QxokUGrqqLv2fPCM06ctnfq71iSqifna94x0DJypbCcorFkVB6iULnUs3XtLV/S/HxLa8PHXfHsRRioCyWnSdbSgXC3F5VNA/jozpN7FUEEugfyqCSvEa+W+xTKScdIhD7XvGNREXVMefdD7DYt10q0cBm2q9667M35GqFR5/BClcFYz4yd52Qv1Hd13/dEDglmLaVFbsfkwaFbHOw7VARyw7VHOWvFzzmW04dmx/AW5X0QGrnCet34beqODcVcdaCanJl0CFS1T1NR/5R5YycUZghImN6bSkSD3CftJVb2FAywyTRBaHR+7dN1GoXO3QltoM8was9w7iEDxIf5P543Rce74qs1ZQ5lfkAZGEJtuieSSXZlExRE3sa315VOGaSzk5fyxLweyF37n36k+q1r5MsFLesZPiMC14rgfBeZ0FjN8jijA7jCKcFU/T0x8dSNxF4CGAdoKVwzBLxZMWEPS9Eu28GIRWTtLek9UIuzub4ILLHVqToSvBaChUFNxkDQz+fk7gA0qVz4TftrbwL3MFTV3USUGsBvpZ/3nL4iXAbiB6cEuJhb3Eaq5q09p8R/xLvaKb3FPRLvXBMYiq21GXsjuTp0Em1eHMpyO078bUHSaG4iH4qTxX4TA/kUjTH63MaiqLAHwZpKv0l4aeAFtjtf8IZ7Kca+lBVPc92RKJYGkBEevyvJXEBfAks7mmBZJjjxaUNPkRx/nVvrWSWl1P42yVdXQO6X7FuSaRoFajvizIlrAlyG8mHu5iOnME0Z4QnpbUtN3YMH5cwcCEwYlP9xayZSU6rou92ULQkw/ReLagUfennbG9us51p5tkZCkTgU4Ob3z7F2i7QGrbVECjtFDo/Eroaewc6gPMjW4KQ7SZeUp1FXgy0Ceg17dkWNiGVGTo7327P4DZNf+eYZBmeC1eWh8Xm3jfCXjicZp7xY4g3y6PEyXuXDzJawOysUAPKqNORVcej+Ogi5QtyRYOeOFWwHTI/qyACtd5bgTsv5Q7rfDpk3ffuSJ2onJqLYKviwG4d39X3y2q9Ze1VnZqGMZYSRxeQJWysAopR1J4rt2uWnVzCiUrhnvHqIiOC+x7Te9XgLGOeynF0Th6S2K866INr2XtGJdVLFlvjKT/aT/nP/KjN+xb4wn+Nf+xoP//lmX1Av67835e1Ajg6PVXRDq0SZ839+cLoh0bQ6fI1cUPlJdy6BrLzFu+Gyy+J8UBGh5CaM4jbqM6Z0YswoZ9VkwxhbvfOS78FWbmpEUNcT3Jzm1VQLQ5f8UC+wd/z1Yl7X83ebWs5RwSdbQRj3NcWi+ta9lrT7fe+zoX+rWsvaGh4SoBSCbgNF0mMRUyHUWYcsZdoSp7mVhHbxKXqX91iG62n9NtZl2JD1JKsQo+TSjjSUwEZSq3fDK5YUlRSP+tF1yWg3K4UuIH4kYJVHbIePSBXSWM/rjsM9rmD0bY1eoY3kwA21rKfQNVTP6HRIeRdb8iqskPeIMOdAaOWQG+WcMWt7YRxT0+33X6Zkj3pocWxWNQdEHTQtUFxCV1g2xLjQhv7r1AV00UB2irbZmZuuHwtfmxD0cqSAi1+52qidzbOdqpHoa+RvSPOW1aekS7C4P70yaAibHSzevbcNlIOL9vdX4P/OLqCPu+wX8u+zccI8T3LsDL9HRM4W4XlT0e81hZEpVlVlRAT/vf0tQOuAabv3eWgrzxok6e9uTcCyLRbGcGlwC+ri24K7yBRYsBSI545BeO3wY7vrTFsJtx8dttdEXluNdlUCD5FjoX7Qufw1Op3bT/zapNz6j4vN/nfXmYzvbMFm+Vw0kN+YOLrD235h3odoALCM1cirWtCq555IwYMGmpXbHbEGs8XOi+0+dzBqBx3+VcAdaMXd6unjn85hrHxRXH+BEQyPl3n1ze9g3AE0wCP4ZZgxd6N9UYz/LlOww9gS1imfWBQ6/KKnynYKdBFEcNa9V74IkD6iOMEU1hMreKuFBgvZQSc6kBMBuaX+VJ9CJEXtb0+XGX0csd4rLohRtnuy1arubGUxqFIK+OSgl9mpmeF+El8YtuhlecI/r4UyVgU+QQXmAEbAjGQOEJedrIBI4N5HGDjmniwlsAMsPYBD00gBNlWiGYSjW8029wRCSfm4Dvtf5AxXxhil1XEJEuTVOAAAA";
    var ObjString = [];

    ObjString.push('<div style="color:#606060;font-size:14px;padding:0;">Please grant access to the local scanning service.</div>');
    ObjString.push('<div style="color:#606060;font-size:14px;padding:0;">1. Click "Allow" to grant access.</div>');
    
    ObjString.push('<div><img src="data:image/webp;base64,');
    ObjString.push(pic1);
    ObjString.push('" /></div>');

    ObjString.push('<div style="color:#606060;font-size:14px;padding:5px 0 0 0;">2. If access has been blocked, clear the setting and reload the page.</div>');
    
    ObjString.push('<div><img src="data:image/webp;base64,');
    ObjString.push(pic);
    ObjString.push('" /></div>');

    ObjString.push('<div style="color:#606060;font-size:14px;padding:0;">For more detailed information, please refer to <a target="_blank" href="https://www.dynamsoft.com/web-twain/docs/faq/chromium-142-local-network-access-issue.html">this article</a>.</div>');

    var existDialog = document.querySelector('.ds-dwt-ui-dlg-wrap');
    if (existDialog && bReturnToInstallDialog) {
        var oldDialogContent = existDialog.firstChild;

        var newDiv = document.createElement('div');
        var newString = ['<div class="dynamsoft-dialog"><div class="dynamsoft-dwt-ltsdlg-header"><span style="color: rgb(255, 255, 255); line-height: 35px; margin-left: 15px;">Error</span><div class="dynamsoft-dialog-close dynamsoft-dialog-hide-lna"></div></div><div class="dynamsoft-dwt-ltsdlg-body" style="padding: 25px 30px 20px;">', ObjString.join(''), '</div></div>'].join('');

        newDiv.innerHTML = newString;
        existDialog.appendChild(newDiv);
        oldDialogContent.style.display = 'none';

        document.querySelector('.dynamsoft-dialog-hide-lna').addEventListener('click', function() {
            newDiv.remove();
            oldDialogContent.style.display = '';

            var dlg = document.querySelector('.ds-dwt-ui-dlg');
            dlg.style.position = 'fixed';
            dlg.style.top = '50%';
            dlg.style.transform = 'translate(-50%, -50%)';
        });
    } else {

        Dynamsoft.DWT.ShowMessage(ObjString.join(''), {
            width: promptDlgWidth,
            headerStyle: 2,
            closeButton: false
        });
    }

    var dlg = document.querySelector('.ds-dwt-ui-dlg');
    if(dlg) {
      dlg.style.position = 'absolute';
      dlg.style.top = '15%';
      dlg.style.transform = 'translate(-50%, -10%)';
    }

    var dlgBody = document.querySelector('.dynamsoft-dwt-ltsdlg-body');
    if(dlgBody) {
      dlgBody.style.padding = '15px 30px';
    }

  }

  Dynamsoft.OnBrowserLNADenied = function(msg, bReturnToInstallDialog, bPromptPermisstion)  {

		var strCaption, ObjString, strLNA_FAQ_URL = getLNA_FAQ_URL(bPromptPermisstion);

    if(bPromptPermisstion) {
      // Infomation
      if(Dynamsoft.navInfoSync.bFirefox) {
        strCaption = 'Action Required';
      } else {
        strCaption = 'Permission Required';
      }

      ObjString = [
        '<div style="color:#323234;font:17px/34px">', ERR_LNANotAllowed, '</div>',
        Dynamsoft.navInfoSync.bChrome || Dynamsoft.navInfoSync.bEdge ? '<div style="color:#323234;font:17px/34px">Click "Allow" to grant access.</div>' : '',
        '<div style="color:#323234;font-size:17px;padding:12px 0;">For more detailed information, please refer to <a target="_blank" href="',
        strLNA_FAQ_URL,
        ,'">this article</a>.</div>',
      ].join('');
    } else {
      // Error
      strCaption = 'Access Denied';
      ObjString = [
        '<div style="color:#323234;font:17px/34px">', ERR_LNADenied, '</div>',
        Dynamsoft.navInfoSync.bChrome || Dynamsoft.navInfoSync.bEdge  ? '<div style="color:#323234;font:17px/34px">Please update your site settings to grant access.</div>' : '',
        '<div style="color:#323234;font-size:17px;padding:12px 0;">For more detailed information, please refer to <a target="_blank" href="',
        strLNA_FAQ_URL,
        ,'">this article</a>.</div>',
      ].join('');
    }

    var existDialog = document.querySelector('.ds-dwt-ui-dlg-wrap');
    if(existDialog && bReturnToInstallDialog) {
      var oldDialogContent = existDialog.firstChild,
          newDialogWrapper = [
        '<div class="dynamsoft-dialog"><div class="dynamsoft-dwt-ltsdlg-header"><span style="color: rgb(255, 255, 255); line-height: 35px; margin-left: 15px;">',
        strCaption,
        '</span><div class="dynamsoft-dialog-close dynamsoft-dialog-hide-lna"></div></div><div class="dynamsoft-dwt-ltsdlg-body" style="padding: 25px 40px 20px;">',
        ObjString,
        ,'</div></div>'
      ].join('');

      var newDiv = document.createElement('div');
      Dynamsoft.Lib.setHtml(newDiv, newDialogWrapper);
			existDialog.appendChild(newDiv);
      oldDialogContent.style.display = 'none';

      document.querySelector('.dynamsoft-dialog-hide-lna').addEventListener('click', function(){
        newDiv.remove();
        oldDialogContent.style.display = '';
      });
    } else {

      Dynamsoft.DWT.ShowMessage(ObjString, {
        caption: strCaption,
        width: promptDlgWidth,
        headerStyle: 2,
        closeButton: false
      });
    }

  }

  Dynamsoft.ProcessLicenseErrorContent = function (content) {
    var el = [],
      _content = content;
    if (typeof(_content) != 'string') {
      if (undefined === _content)
        return '';
      if (_content instanceof Error || 'message' in _content)
        _content = _content.message;
      else
        _content = '' + _content;
    }

    var posLeftBracket = _content.indexOf("[");
    var posRightBracket = _content.indexOf("]", posLeftBracket);
    var posLeftParentheses = _content.indexOf("(", posRightBracket);
    var posRightParentheses = _content.indexOf(")", posLeftParentheses);
    if (-1 == posLeftBracket || -1 == posRightBracket || -1 == posLeftParentheses || -1 == posRightParentheses) {
      return _content;
    }

    if (posLeftBracket > 0) {
      el.push(_content.substring(0, posLeftBracket));
    }

    var linkText = _content.substring(posLeftBracket + 1, posRightBracket);
    var linkAddr = _content.substring(posLeftParentheses + 1, posRightParentheses);

    el.push(['<a href="', linkAddr, '" target="_blank" class="dynamsoft-major-color">', linkText, '</a>'].join(''));
    el.push(_content.substring(posRightParentheses + 1));

    return el.join('');
  }
  //--------------------end Product Key-------------------------------


  // -- npm start
  Dynamsoft._show_online_download_dialog = function (objInstallerUrl, bHTML5, iPlatform) {
    var ObjString,
      vers = Dynamsoft.DWT.JSVersion.split(','),
      strV = vers[0] + '.' + vers[1],
      page_path = location.pathname,
      online_url, local_file_path, ext;
    page_path = page_path.substring(0, page_path.lastIndexOf('/') + 1);

    if (iPlatform == Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux) {
      if (arm64 || mips64) {
        if (arm64)
          objInstallerUrl['default'] = getDebPath('arm64');
        else if (mips64)
          objInstallerUrl['default'] = getDebPath('mips64el');
      } else {
      }
    }
    ext = objInstallerUrl['default'].substr(objInstallerUrl['default'].length - 3);

    online_url = ['https://www.dynamsoft.com/web-twain/install-dynamsoft-service/?productId=1000001',
      '&downloadLink=https://demo.dynamsoft.com/DWT/Resources/dist/DynamsoftServiceSetup_',
      strV, '.',
      ext].join('');

    local_file_path = Dynamsoft.Lib.Path.normalize([
      page_path,
      objInstallerUrl['default']
    ].join(''));

    if (iPlatform == Dynamsoft.DWT.EnumDWT_PlatformType.enumWindow) {
      if (local_file_path.indexOf('/') == 0) {
        local_file_path = local_file_path.substr(1);
      }
    }

    ObjString = [
      '<div class="dynamsoft-dwt-ltsdlg-body" style="padding:0 20px 20px 20px">',
      '<div>To support document scanning, please complete one-time installation of the DynamsoftServiceSetup.', ext, ' on this machine.</div>',
      '<div>You can download the file via this trust site:</div>',
      '<div><a id="dwt-btn-install" target="_blank" href="',
      online_url,
      '"><div class="dynamsoft-dwt-dlg-button">Open Site</div></a></div>',
      '<div style="word-break: break-word;">Or, go to <br />',
      local_file_path,
      ' if the file exists.</div>',
      '<div>After the installation, please <strong>REFRESH</strong>  your browser.<br /></div>',
      '</div>'
    ];

    Dynamsoft.DWT.ShowMessage(ObjString.join(''), { width: promptDlgWidth, headerStyle: 1, closeButton: false });
  };
  // -- npm end

})();
/**
 * Basic Configuration (config.js with differences)
 */
Dynamsoft.DWT.AutoLoad = false;
Dynamsoft.DWT.IfAddMD5InUploadHeader = false;
Dynamsoft.DWT.IfConfineMaskWithinTheViewer = false;
