var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.checkStringArgs=function(d,f,g){if(null==d)throw new TypeError("The 'this' value for String.prototype."+g+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+g+" must not be a regular expression");return d+""};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,f,g){if(d==Array.prototype||d==Object.prototype)return d;d[f]=g.value;return d};
$jscomp.getGlobal=function(d){d=["object"==typeof globalThis&&globalThis,d,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var f=0;f<d.length;++f){var g=d[f];if(g&&g.Math==Math)return g}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};
$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(d,f){var g=$jscomp.propertyToPolyfillSymbol[f];if(null==g)return d[f];g=d[g];return void 0!==g?g:d[f]};$jscomp.polyfill=function(d,f,g,h){f&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(d,f,g,h):$jscomp.polyfillUnisolated(d,f,g,h))};
$jscomp.polyfillUnisolated=function(d,f,g,h){g=$jscomp.global;d=d.split(".");for(h=0;h<d.length-1;h++){var k=d[h];if(!(k in g))return;g=g[k]}d=d[d.length-1];h=g[d];f=f(h);f!=h&&null!=f&&$jscomp.defineProperty(g,d,{configurable:!0,writable:!0,value:f})};
$jscomp.polyfillIsolated=function(d,f,g,h){var k=d.split(".");d=1===k.length;h=k[0];h=!d&&h in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var p=0;p<k.length-1;p++){var q=k[p];if(!(q in h))return;h=h[q]}k=k[k.length-1];g=$jscomp.IS_SYMBOL_NATIVE&&"es6"===g?h[k]:null;f=f(g);null!=f&&(d?$jscomp.defineProperty($jscomp.polyfills,k,{configurable:!0,writable:!0,value:f}):f!==g&&(void 0===$jscomp.propertyToPolyfillSymbol[k]&&(g=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[k]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(k):$jscomp.POLYFILL_PREFIX+g+"$"+k),$jscomp.defineProperty(h,$jscomp.propertyToPolyfillSymbol[k],{configurable:!0,writable:!0,value:f})))};$jscomp.polyfill("String.prototype.startsWith",function(d){return d?d:function(f,g){var h=$jscomp.checkStringArgs(this,f,"startsWith");f+="";var k=h.length,p=f.length;g=Math.max(0,Math.min(g|0,h.length));for(var q=0;q<p&&g<k;)if(h[g++]!=f[q++])return!1;return q>=p}},"es6","es3");
$jscomp.arrayIteratorImpl=function(d){var f=0;return function(){return f<d.length?{done:!1,value:d[f++]}:{done:!0}}};$jscomp.arrayIterator=function(d){return{next:$jscomp.arrayIteratorImpl(d)}};$jscomp.initSymbol=function(){};
$jscomp.polyfill("Symbol",function(d){if(d)return d;var f=function(p,q){this.$jscomp$symbol$id_=p;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:q})};f.prototype.toString=function(){return this.$jscomp$symbol$id_};var g="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",h=0,k=function(p){if(this instanceof k)throw new TypeError("Symbol is not a constructor");return new f(g+(p||"")+"_"+h++,p)};return k},"es6","es3");
$jscomp.polyfill("Symbol.iterator",function(d){if(d)return d;d=Symbol("Symbol.iterator");for(var f="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),g=0;g<f.length;g++){var h=$jscomp.global[f[g]];"function"===typeof h&&"function"!=typeof h.prototype[d]&&$jscomp.defineProperty(h.prototype,d,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return d},"es6",
"es3");$jscomp.iteratorPrototype=function(d){d={next:d};d[Symbol.iterator]=function(){return this};return d};$jscomp.iteratorFromArray=function(d,f){d instanceof String&&(d+="");var g=0,h=!1,k={next:function(){if(!h&&g<d.length){var p=g++;return{value:f(p,d[p]),done:!1}}h=!0;return{done:!0,value:void 0}}};k[Symbol.iterator]=function(){return k};return k};$jscomp.polyfill("Array.prototype.keys",function(d){return d?d:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6","es3");
(function(){function d(a,c,b){c=a.getKey(c);var e=a.uploaders[c];e&&e.destroy(b);delete a.uploaders[c]}function f(a){var c=this._ctrl;a=c._wgt;var b=a.desktop;b=zk.ajaxURI("/upload?uuid="+a.uuid+"&dtid="+b.id+"&sid="+c.sid,{desktop:b,au:!0});a=this.form;a.action=b;b=a.parentNode;b.parentNode.removeChild(b);c._formDetached=!0;if(this.files&&1!=this.files.length){c=this.files;b=[];for(var e=c.length;e--;)b.unshift(c[e].name);b=b.join(",")}else b=this.value;c=this._ctrl;e=b;b=c.getKey(c.sid);a=new zul.Uploader(c,
b,a,e);zul.Upload.start(a)&&(c.uploaders[b]=a);c.sid++;c.initContent()}function g(a,c){c=a.getWidget();var b=zul.UploadViewer.flman;c&&(b&&b.desktop||(b&&b.detach(),zul.UploadViewer.flman=b=new zul.UploadManager,c.getPage().appendChild(b)),b.removeFile(a),b.addFile(a))}function h(a,c){if(zul.UploadManager)return g(a,c);zk.load("zul.wgt,zul.box",function(){zul.UploadManager=zk.$extends(zul.wgt.Popup,{$init:function(){this.$supers("$init",arguments);this._files={};this.setSclass("z-fileupload-manager")},
onFloatUp:function(b){this.isVisible()&&this.setTopmost()},getFileItem:function(b){return this._files[b]||zk.Widget.$(b)},addFile:function(b){var e=b.id,n=b.flnm,l=this.getFileItem(e);if(!l){l=new zul.wgt.Div({uuid:e,children:[new zul.wgt.Label({value:n+":"}),new zul.box.Box({mold:"horizontal",children:[new zul.wgt.Progressmeter({id:e,sclass:"z-fileupload-progress"}),new zul.wgt.Div({sclass:"z-fileupload-remove z-icon-times",listeners:{onClick:function(){b.cancel()}}})]}),new zul.wgt.Label({id:e+
"_total"}),new zul.wgt.Separator]});try{this.appendChild(l)}catch(m){zk.debugLog(m.message||m)}this._files[e]=l}return l},updateFile:function(b,e,n){b=b.id;var l=this.getFileItem(b);l&&(l.$f(b).setValue(e),l.$f(b+"_total").setValue(n))},removeFile:function(b){b=b.id;var e=this.getFileItem(b);e&&e.detach();delete this._files[b];0===Object.keys(this._files).length&&this.close()},open:function(b,e){this.$super("open",b,null,e||"after_start",{sendOnOpen:!1,disableMask:!0})}});g(a,c)})}if(zk.opera)var k=
[],p,q=function(){for(var a=k.length;a--;)k[a].sync()};zul.Upload=zk.$extends(zk.Object,{sid:0,$init:function(a,c,b){this.uploaders={};this.suppressedErrors=[];var e;b=b.split(",");for(var n=0,l=b.length;n<l;n++){var m=b[n].trim();m.startsWith("maxsize=")?this.maxsize=m.match(new RegExp(/maxsize=([^,]*)/))[1]:m.startsWith("multiple=")?this.multiple=m.match(new RegExp(/multiple=([^,]*)/))[1]:m.startsWith("accept=")?this.accept=m.match(new RegExp(/accept=([^,]*)/))[1]:m.startsWith("suppressedErrors=")?
this.suppressedErrors=m.match(new RegExp(/suppressedErrors=([^,]*)/))[1].split("|"):"native"==m?this.isNative=!0:"true"!=m&&(e=m)}this._clsnm=e||"";this._wgt=a;this._parent=c;a._tooltiptext&&(this._tooltiptext=a._tooltiptext);this.initContent()},sync:function(){if(!this._formDetached){var a=this._wgt.$n(),c=this._parent,b=c?c.lastChild:a.nextSibling;c=b.firstChild.firstChild;var e=zk(a).revisedOffset(),n=jq(b).css({top:"0",left:"0"}).zk.revisedOffset();b=b.style;var l=11>zk.ie;b.top=e[1]-n[1]+"px";
b.left=e[0]-n[0]+"px";c.style.height=(l?a.offsetHeight:"0")+"px";c.style.width=(l?a.offsetWidth:"0")+"px"}},initContent:function(){var a=this._wgt,c=this._parent,b=a.$n(),e='<span class="z-upload"'+(this._tooltiptext?' title="'+zUtl.encodeXML(this._tooltiptext)+'"':"")+'><form enctype="multipart/form-data" method="POST"><input name="file" type="file"'+("true"==this.multiple?' multiple="" multiple':"")+(this.accept?' accept="'+this.accept.replace(/\|/g,",")+'"':"")+' hidefocus="true" tabindex="-1" style="height:'+
b.offsetHeight+'px"/></form></span>';c?jq(c).append(e):jq(a).after(e);delete this._formDetached;if(!a._autodisable_self){var n=this;setTimeout(function(){n.sync()},50)}c=this._outer=c?c.lastChild:b.nextSibling;this._inp=e=c.firstChild.firstChild;zk.opera&&(c.style.position="absolute",k.length||(p=setInterval(q,1500)),k.push(this));e.z$proxy=b;e._ctrl=this;jq(e).change(f);10>=zk.ie&&jq(e).hover(function(){jq(a).addClass("z-upload-hover")},function(){jq(a).removeClass("z-upload-hover")})},openFileDialog:function(){jq(this._inp).click()},
destroy:function(){zk.opera&&(k.$remove(this),p&&!k.length&&(clearInterval(p),p=null));jq(this._outer).remove();this._wgt=this._parent=this._inp=null;for(var a in this.uploaders){var c=this.uploaders[a];c&&(delete this.uploaders[a],c.destroy())}},getKey:function(a){return(this._wgt?this._wgt.uuid:"")+"_uplder_"+a},cancel:function(a){d(this,a)},finish:function(a){d(this,a,!0)}},{error:function(a,c,b){var e=zk.Widget.$(c);if(e){var n=a.match("^([\\w-]+?):"),l=e._uplder;l=l?l.suppressedErrors:[];if(n){a=
a.replace(n[0],"");var m=n[1]}m&&-1!==l.indexOf(m)||jq.alert(a,{desktop:e.desktop,icon:"ERROR"});zul.Upload.close(c,b)}},close:function(a,c){(a=zk.Widget.$(a))&&a._uplder&&a._uplder.cancel(c)},sendResult:function(a,c,b){(a=zk.Widget.$(a))&&a._uplder&&(a._uplder.finish(b),zAu.send(new zk.Event(a.desktop,"updateResult",{contentId:c,wid:a.uuid,sid:b})))},isFinish:function(a){a=("string"==typeof a?a:a.uuid)+"_uplder_";for(var c=zul.Upload.files,b=c.length;b--;)if(c[0].id.startsWith(a))return!1;return!0},
start:function(a){var c=zul.Upload.files;a&&c.push(a);c[0]&&!c[0].isStart&&(c[0].isStart=!0,c[0].start());return!0},destroy:function(a){for(var c=zul.Upload.files,b=c.length;b--;)if(c[b].id==a.id){c.splice(b,1);break}zul.Upload.start()},files:[]});zul.Uploader=zk.$extends(zk.Object,{$init:function(a,c,b,e){this.id=c;this.flnm=e;this._upload=a;this._form=b;this._parent=b.parentNode;this._sid=a.sid;this._wgt=a._wgt;var n,l=this;a._clsnm?zk.$import(a._clsnm,function(m){n=new m(l,e)}):n=new zul.UploadViewer(this,
e);this.viewer=n},getWidget:function(){return this._wgt},destroy:function(a){this.end(a);this._form&&(jq(this._form.parentNode).remove(),jq("#"+this.id+"_ifm").remove());this._form=this._upload=this._wgt=null},start:function(){function a(){jq.ajax({type:"POST",url:zk.ajaxURI("/upload",{desktop:c.desktop,au:!0}),data:n,dataType:"text",success:function(l){var m=l.split(",");l.startsWith("error:")?(e._echo=!0,zul.Uploader.clearInterval(e.id),c&&(e.cancel(),zul.Upload.error(l.substring(6,l.length),c.uuid,
e._sid))):l.startsWith("ignore")||e.update(zk.parseInt(m[0]),zk.parseInt(m[1]))||zul.Uploader.clearInterval(e.id)},complete:function(l,m){var r;if("404"==(r=l.getResponseHeader("ZK-Error"))||"410"==r||"error"==m||404==m||405==m||410==m)if(zul.Uploader.clearInterval(e.id),l=e.getWidget())e.cancel(),zul.Upload.error("server-out-of-service:"+msgzk.FAILED_TO_RESPONSE,l.uuid,e._sid)}})}var c=this._wgt,b=this.id+"_ifm";document.body.appendChild(this._parent);jq("#"+b).length||jq.newFrame(b);this._form.target=
b;this._form.submit();this._form.style.display="none";var e=this,n="cmd=uploadInfo&dtid="+c.desktop.id+"&wid="+c.uuid+"&sid="+this._sid;zul.Uploader._tmupload&&clearInterval(zul.Uploader._tmupload);a.id=this.id;zul.Uploader.clearInterval=function(l){a.id==l&&(clearInterval(zul.Uploader._tmupload),zul.Uploader._tmupload=void 0)};zul.Uploader._tmupload=setInterval(a,100);zul.wgt.ADBS.autodisable(c)},cancel:function(){zul.Uploader.clearInterval(this.id);this._upload&&this._upload.cancel(this._sid)},
update:function(a,c){if(!this.getWidget()||0>=c)if(this._echo)this.end();else return!0;else if(zul.Uploader._tmupload)return this._echo=!0,0<=a&&100>=a&&this.viewer.update(a,c),0<=a&&100>a;return!1},end:function(a){this.viewer.destroy(a);zul.Upload.destroy(this);this._echo=!0;var c,b,e;(a=this._wgt)&&(c=this._upload)&&(b=c._aded)&&(a._uplder=null,b.onResponse(),c._aded=null,a._uplder.destroy(),(e=c._parent)&&!jq(e).parents("html").length&&(c._parent=a._getUploadRef(),c.initContent()),a._uplder=c,
a._uplder.sync(),delete a._autodisable_self)}});zul.UploadViewer=zk.$extends(zk.Object,{$init:function(a,c){this._uplder=a;h(a,c)},update:function(a,c){var b=zul.UploadViewer.flman;b&&(b.isOpen()||b.open(this._uplder.getWidget()),b.updateFile(this._uplder,a,msgzk.FILE_SIZE+Math.round(c/1024)+msgzk.KBYTES))},destroy:function(){var a=zul.UploadViewer.flman;a&&a.removeFile(this._uplder)}})})();
