filesbox/web/dist/js/webuploader.js
2024-07-26 14:10:54 +08:00

2 lines
74 KiB
JavaScript

"use strict";var _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A};(function(A,k){var st,f={},g=function(i,e){var n,a,s;if(typeof i=="string")return o(i);for(n=[],a=i.length,s=0;s<a;s++)n.push(o(i[s]));return e.apply(null,n)},h=function(i,e,n){arguments.length===2&&(n=e,e=null),g(e||[],function(){u(i,n,arguments)})},u=function(i,e,n){var a,s={exports:e};typeof e=="function"&&(n.length||(n=[g,s.exports,s]),(a=e.apply(null,n))!==void 0&&(s.exports=a)),f[i]=s.exports},o=function(i){var e=f[i]||A[i];if(!e)throw new Error("`"+i+"` is undefined");return e},t=function(i){var e,n,a,s,l,y;y=function(x){return x&&x.charAt(0).toUpperCase()+x.substr(1)};for(e in f)if(n=i,f.hasOwnProperty(e)){for(a=e.split("/"),l=y(a.pop());s=y(a.shift());)n[s]=n[s]||{},n=n[s];n[l]=f[e]}return i},r=function(i){return A.__dollar=i,t(k(A,h,g))};(typeof moduleKODE=="undefined"?"undefined":_typeof(moduleKODE))==="object"&&_typeof(module.exports)==="object"?module.exports=r():typeof define=="function"&&define.amd?define(["jquery"],r):(st=A.WebUploader,A.WebUploader=r(),A.WebUploader.noConflict=function(){A.WebUploader=st})})(window,function(A,k,st){return k("dollar-third",[],function(){var f=A.require,g=A.__dollar||A.jQuery||A.Zepto||f("jquery")||f("zepto");if(!g)throw new Error("jQuery or Zepto not found!");return g}),k("dollar",["dollar-third"],function(f){return f}),k("promise-third",["dollar"],function(f){return{Deferred:f.Deferred,when:f.when,isPromise:function(g){return g&&typeof g.then=="function"}}}),k("promise",["promise-third"],function(f){return f}),k("base",["dollar","promise"],function(f,g){function h(r,i){return function(){return r.apply(i,arguments)}}function u(r){var i;return Object.create?Object.create(r):(i=function(){},i.prototype=r,new i)}var o=function(){},t=Function.call;return{version:"0.1.8-alpha",$:f,Deferred:g.Deferred,isPromise:g.isPromise,when:g.when,browser:function(r){var i={},e=r.match(/WebKit\/([\d.]+)/),n=r.match(/Chrome\/([\d.]+)/)||r.match(/CriOS\/([\d.]+)/),a=r.match(/MSIE\s([\d\.]+)/)||r.match(/(?:trident)(?:.*rv:([\w.]+))?/i),s=r.match(/Firefox\/([\d.]+)/),l=r.match(/Safari\/([\d.]+)/),y=r.match(/OPR\/([\d.]+)/);return e&&(i.webkit=parseFloat(e[1])),n&&(i.chrome=parseFloat(n[1])),a&&(i.ie=parseFloat(a[1])),s&&(i.firefox=parseFloat(s[1])),l&&(i.safari=parseFloat(l[1])),y&&(i.opera=parseFloat(y[1])),i}(navigator.userAgent),os:function(r){var i={},e=r.match(/(?:Android);?[\s\/]+([\d.]+)?/),n=r.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return e&&(i.android=parseFloat(e[1])),n&&(i.ios=parseFloat(n[1].replace(/_/g,"."))),i}(navigator.userAgent),inherits:function(r,i,e){var n;return typeof i=="function"?(n=i,i=null):n=i&&i.hasOwnProperty("constructor")?i.constructor:function(){return r.apply(this,arguments)},f.extend(!0,n,r,e||{}),n.__super__=r.prototype,n.prototype=u(r.prototype),i&&f.extend(!0,n.prototype,i),n},noop:o,bindFn:h,log:function(){return A.console?h(console.log,console):o}(),nextTick:function(){return function(r){setTimeout(r,1)}}(),slice:function(r){return function(){return t.apply(r,arguments)}}([].slice),guid:function(){var r=0;return function(i){for(var e=(+new Date).toString(32),n=0;n<5;n++)e+=Math.floor(65535*Math.random()).toString(32);return(i||"wu_")+e+(r++).toString(32)}}(),formatSize:function(r,i,e){var n;for(e=e||["B","K","M","G","TB"];(n=e.shift())&&r>1024;)r/=1024;return(n==="B"?r:r.toFixed(i||2))+n}}}),k("mediator",["base"],function(f){function g(e,n,a,s){return t.grep(e,function(l){return l&&(!n||l.e===n)&&(!a||l.cb===a||l.cb._cb===a)&&(!s||l.ctx===s)})}function h(e,n,a){t.each((e||"").split(i),function(s,l){a(l,n)})}function u(e,n){for(var a,s=!1,l=-1,y=e.length;++l<y;)if(a=e[l],a.cb.apply(a.ctx2,n)===!1){s=!0;break}return!s}var o,t=f.$,r=[].slice,i=/\s+/;return o={on:function(e,n,a){var s,l=this;return n?(s=this._events||(this._events=[]),h(e,n,function(y,x){var w={e:y};w.cb=x,w.ctx=a,w.ctx2=a||l,w.id=s.length,s.push(w)}),this):this},once:function(e,n,a){var s=this;return n&&h(e,n,function(l,y){var x=function w(){return s.off(l,w),y.apply(a||s,arguments)};x._cb=y,s.on(l,x,a)}),s},off:function(e,n,a){var s=this._events;return s?e||n||a?(h(e,n,function(l,y){t.each(g(s,l,y,a),function(){delete s[this.id]})}),this):(this._events=[],this):this},trigger:function(e){var n,a,s;return this._events&&e?(n=r.call(arguments,1),a=g(this._events,e),s=g(this._events,"all"),u(a,n)&&u(s,arguments)):this}},t.extend({installTo:function(e){return t.extend(e,o)}},o)}),k("uploader",["base","mediator"],function(f,g){function h(o){this.options=u.extend(!0,{},h.options,o),this._init(this.options)}var u=f.$;return h.options={},g.installTo(h.prototype),u.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",addFileSync:"add-file-sync",addFileEnd:"add-file-end",addFileSingle:"add-file-single",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(o,t){h.prototype[o]=function(){return this.request(t,arguments)}}),u.extend(h.prototype,{state:"pending",_init:function(o){var t=this;t.request("init",o,function(){t.state="ready",t.trigger("ready")})},option:function(o,t){var r=this.options;if(!(arguments.length>1))return o?r[o]:r;u.isPlainObject(t)&&u.isPlainObject(r[o])?u.extend(r[o],t):r[o]=t},getStats:function(){var o=this.request("get-stats");return o?{successNum:o.numOfSuccess,progressNum:o.numOfProgress,cancelNum:o.numOfCancel,invalidNum:o.numOfInvalid,uploadFailNum:o.numOfUploadFailed,queueNum:o.numOfQueue,interruptNum:o.numOfInterrupt}:{}},trigger:function(o){var t=[].slice.call(arguments,1),r=this.options,i="on"+o.substring(0,1).toUpperCase()+o.substring(1);return!(g.trigger.apply(this,arguments)===!1||u.isFunction(r[i])&&r[i].apply(this,t)===!1||u.isFunction(this[i])&&this[i].apply(this,t)===!1||g.trigger.apply(g,[this,o].concat(t))===!1)},destroy:function(){this.request("destroy",arguments),this.off()},request:f.noop}),f.create=h.create=function(o){return new h(o)},f.Uploader=h,h}),k("runtime/runtime",["base","mediator"],function(f,g){function h(r){this.options=u.extend({container:document.body},r),this.uid=f.guid("rt_")}var u=f.$,o={},t=function(r){for(var i in r)if(r.hasOwnProperty(i))return i;return null};return u.extend(h.prototype,{getContainer:function(){var r,i,e=this.options;return this._container?this._container:(r=u(e.container||document.body),i=u(document.createElement("div")),i.attr("id","rt_"+this.uid),i.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),r.append(i),r.addClass("webuploader-container"),this._container=i,this._parent=r,i)},init:f.noop,exec:f.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),h.orders="html5,flash",h.addRuntime=function(r,i){o[r]=i},h.hasRuntime=function(r){return!!(r?o[r]:t(o))},h.create=function(r,i){var e;if(i=i||h.orders,u.each(i.split(/\s*,\s*/g),function(){if(o[this])return e=this,!1}),!(e=e||t(o)))throw new Error("Runtime Error");return new o[e](r)},g.installTo(h.prototype),h}),k("runtime/client",["base","mediator","runtime/runtime"],function(f,g,h){function u(t,r){var i,e=f.Deferred();this.uid=f.guid("client_"),this.runtimeReady=function(n){return e.done(n)},this.connectRuntime=function(n,a){if(i)throw new Error("already connected!");return e.done(a),typeof n=="string"&&o.get(n)&&(i=o.get(n)),i=i||o.get(null,r),i?(f.$.extend(i.options,n),i.__promise.then(e.resolve),i.__client++):(i=h.create(n,n.runtimeOrder),i.__promise=e.promise(),i.once("ready",e.resolve),i.init(),o.add(i),i.__client=1),r&&(i.__standalone=r),i},this.getRuntime=function(){return i},this.disconnectRuntime=function(){i&&(i.__client--,i.__client<=0&&(o.remove(i),delete i.__promise,i.destroy()),i=null)},this.exec=function(){if(i){var n=f.slice(arguments);return t&&n.unshift(t),i.exec.apply(this,n)}},this.getRuid=function(){return i&&i.uid},this.destroy=function(n){return function(){n&&n.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var o;return o=function(){var t={};return{add:function(r){t[r.uid]=r},get:function(r,i){var e;if(r)return t[r];for(e in t)if(!i||!t[e].__standalone)return t[e];return null},remove:function(r){delete t[r.uid]}}}(),g.installTo(u.prototype),u}),k("lib/dnd",["base","mediator","runtime/client"],function(f,g,h){function u(t){t=this.options=o.extend({},u.options,t),t.container=o(t.container),t.container.length&&h.call(this,"DragAndDrop")}var o=f.$;return u.options={accept:null,disableGlobalDnd:!1},f.inherits(h,{constructor:u,init:function(){var t=this;t.connectRuntime(t.options,function(){t.exec("init"),t.trigger("ready")})}}),g.installTo(u.prototype),u}),k("widgets/widget",["base","uploader"],function(f,g){function h(n){if(!n)return!1;var a=n.length,s=o.type(n);return!(n.nodeType!==1||!a)||s==="array"||s!=="function"&&s!=="string"&&(a===0||typeof a=="number"&&a>0&&a-1 in n)}function u(n){this.owner=n,this.options=n.options}var o=f.$,t=g.prototype._init,r=g.prototype.destroy,i={},e=[];return o.extend(u.prototype,{init:f.noop,invoke:function(n,a){var s=this.responseMap;return s&&n in s&&s[n]in this&&o.isFunction(this[s[n]])?this[s[n]].apply(this,a):i},request:function(){return this.owner.request.apply(this.owner,arguments)}}),o.extend(g.prototype,{_init:function(n){var a=this,s=a._widgets=[],l=a.options.disableWidgets||"",y=o.extend(!0,[],e);if(n.widgetList){var x,w={init:"init",destroy:"destroy",name:"anonymous"};o.each(n.widgetList,function(p){w[p.replace(/[A-Z]/g,"-$&").toLowerCase()]=p}),n.widgetList.responseMap=w,x=f.inherits(u,n.widgetList),x._name=w.name,y.push(x)}return o.each(y,function(p,c){(!l||!~l.indexOf(c._name))&&s.push(new c(a))}),t.apply(a,arguments)},request:function(n,a,s){var l,y,x,w,p=0,c=this._widgets,d=c&&c.length,m=[],v=[];for(a=h(a)?a:[a];p<d;p++)l=c[p],(y=l.invoke(n,a))!==i&&(f.isPromise(y)?v.push(y):m.push(y));return s||v.length?(x=f.when.apply(f,v),w=x.pipe?"pipe":"then",x[w](function(){var b=f.Deferred(),U=arguments;return U.length===1&&(U=U[0]),setTimeout(function(){b.resolve(U)},1),b.promise()})[s?w:"done"](s||f.noop)):m[0]},destroy:function(){r.apply(this,arguments),this._widgets=null}}),g.register=u.register=function(n,a){var s,l={init:"init",destroy:"destroy",name:"anonymous"};return arguments.length===1?(a=n,o.each(a,function(y){if(y[0]==="_"||y==="name")return void(y==="name"&&(l.name=a.name));l[y.replace(/[A-Z]/g,"-$&").toLowerCase()]=y})):l=o.extend(l,n),a.responseMap=l,s=f.inherits(u,a),s._name=l.name,e.push(s),s},g.unRegister=u.unRegister=function(n){if(n&&n!=="anonymous")for(var a=e.length;a--;)e[a]._name===n&&e.splice(a,1)},u}),k("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(f,g,h){var u=f.$;return g.options.dnd="",g.register({name:"dnd",init:function(o){if(o.dnd&&this.request("predict-runtime-type")==="html5"){var t,r=this,i=f.Deferred(),e=u.extend({},{disableGlobalDnd:o.disableGlobalDnd,container:o.dnd,accept:o.accept});return this.dnd=t=new h(e),this.owner.dnd=this.dnd,t.once("ready",i.resolve),t.on("filesAccept",function(n){return r.owner.trigger("filesAccept",n)}),t.on("add-file-sync",function(n,a){r.owner.request("add-file-sync",[n,a])}),t.on("add-file-end",function(n){r.owner.request("add-file-end",[n])}),t.on("accept",function(n){return r.owner.trigger("dndAccept",n)}),t.init(),i.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),k("lib/filepaste",["base","mediator","runtime/client"],function(f,g,h){function u(t){t=this.options=o.extend({},t),t.container=o(t.container||document.body),h.call(this,"FilePaste")}var o=f.$;return f.inherits(h,{constructor:u,init:function(){var t=this;t.connectRuntime(t.options,function(){t.exec("init"),t.trigger("ready")})}}),g.installTo(u.prototype),u}),k("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(f,g,h){var u=f.$;return g.register({name:"paste",init:function(o){if(o.paste&&this.request("predict-runtime-type")==="html5"){var t,r=this,i=f.Deferred(),e=u.extend({},{container:o.paste,accept:o.accept});return this.paste=t=new h(e),t.once("ready",i.resolve),t.on("filesAccept",function(n){r.owner.trigger("filesAccept",n)}),t.on("add-file-sync",function(n,a){r.owner.request("add-file-sync",[n,a])}),t.on("add-file-end",function(n){r.owner.request("add-file-end",[n])}),t.init(),i.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),k("lib/blob",["base","runtime/client"],function(f,g){function h(u,o){var t=this;t.source=o,t.ruid=u,this.size=o.size||0,!o.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?this.type="image/"+(this.ext==="jpg"?"jpeg":this.ext):this.type=o.type||"application/octet-stream",g.call(t,"Blob"),this.uid=o.uid||this.uid,u&&t.connectRuntime(u)}return f.inherits(g,{constructor:h,slice:function(u,o){return this.exec("slice",u,o)},getSource:function(){return this.source}}),h}),k("lib/file",["base","lib/blob"],function(f,g){function h(t,r){var i;this.name=r.name||"untitled"+u++,i=o.exec(r.name)?RegExp.$1.toLowerCase():"",!i&&r.type&&(i=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(r.type)?RegExp.$1.toLowerCase():"",this.name+="."+i),this.ext=i,this.lastModifiedDate=r.lastModifiedDate||r.lastModified&&new Date(r.lastModified).toLocaleString()||new Date().toLocaleString(),g.apply(this,arguments)}var u=1,o=/\.([^.]+)$/;return f.inherits(g,h)}),k("lib/filepicker",["base","runtime/client","lib/file"],function(f,g,h){function u(t){if(t=this.options=o.extend({},u.options,t),t.container=o(t.id),!t.container.length)throw new Error("\u6309\u94AE\u6307\u5B9A\u9519\u8BEF");t.innerHTML=t.innerHTML||t.label||t.container.html()||"",t.button=o(t.button||document.createElement("div")),t.button.html(t.innerHTML),t.container.html(t.button),g.call(this,"FilePicker",!0)}var o=f.$;return u.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file",style:"webuploader-pick"},f.inherits(g,{constructor:u,init:function(){var t=this,r=t.options,i=r.button,e=r.style;e&&i.addClass("webuploader-pick"),t.on("all",function(n){var a;switch(n){case"mouseenter":e&&i.addClass("webuploader-pick-hover");break;case"mouseleave":e&&i.removeClass("webuploader-pick-hover");break;case"change":a=t.exec("getFiles"),t.trigger("filesAccept",a);var s=[],l=0,y=function w(){for(var p=l;p<=l+200&&p<a.length;p++){var c=a[p];c=new h(t.getRuid(),c),c._refer=r.container,t.trigger("add-file-sync",s,c)}if((l=p)>=a.length)return clearTimeout(x),void t.trigger("add-file-end",s);x=setTimeout(w,1)},x=setTimeout(y,1)}}),t.connectRuntime(r,function(){t.refresh(),t.exec("init",r),t.trigger("ready")}),this._resizeHandler=f.bindFn(this.refresh,this),o(A).on("resize",this._resizeHandler)},refresh:function(){var t=this.getRuntime().getContainer(),r=this.options.button,i=r[0]&&r[0].offsetWidth||r.outerWidth()||r.width(),e=r[0]&&r[0].offsetHeight||r.outerHeight()||r.height(),n=r.offset();i&&e&&t.css({bottom:"auto",right:"auto",width:i+"px",height:e+"px"}).offset(n)},enable:function(){this.options.button.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var t=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),t.addClass("webuploader-pick-disable")},destroy:function(){var t=this.options.button;o(A).off("resize",this._resizeHandler),t.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),u}),k("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(f,g,h){var u=f.$;return u.extend(g.options,{pick:null,accept:null}),g.register({name:"picker",init:function(o){return this.pickers=[],o.pick&&this.addBtn(o.pick)},refresh:function(){u.each(this.pickers,function(){this.refresh()})},addBtn:function(o){var t=this,r=t.options,i=r.accept,e=[];if(o)return u.isPlainObject(o)||(o={id:o}),u(o.id).each(function(){var n,a,s;s=f.Deferred(),n=u.extend({},o,{accept:u.isPlainObject(i)?[i]:i,swf:r.swf,runtimeOrder:r.runtimeOrder,id:this}),a=new h(n),a.once("ready",s.resolve),a.on("filesAccept",function(l){t.owner.trigger("filesAccept",l)}),a.on("add-file-sync",function(l,y){t.owner.request("add-file-sync",[l,y])}),a.on("add-file-end",function(l){t.owner.request("add-file-end",[l])}),a.on("dialogopen",function(){t.owner.trigger("dialogOpen",a.button)}),a.init(),t.pickers.push(a),e.push(s.promise())}),f.when.apply(f,e)},disable:function(){u.each(this.pickers,function(){this.disable()})},enable:function(){u.each(this.pickers,function(){this.enable()})},destroy:function(){u.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),k("lib/image",["base","runtime/client","lib/blob"],function(f,g,h){function u(t){this.options=o.extend({},u.options,t),g.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var o=f.$;return u.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},f.inherits(g,{constructor:u,info:function(t){return t?(this._info=t,this):this._info},meta:function(t){return t?(this._meta=t,this):this._meta},loadFromBlob:function(t){var r=this,i=t.getRuid();this.connectRuntime(i,function(){r.exec("init",r.options),r.exec("loadFromBlob",t)})},resize:function(){var t=f.slice(arguments);return this.exec.apply(this,["resize"].concat(t))},crop:function(){var t=f.slice(arguments);return this.exec.apply(this,["crop"].concat(t))},getAsDataUrl:function(t){return this.exec("getAsDataUrl",t)},getAsBlob:function(t){var r=this.exec("getAsBlob",t);return new h(this.getRuid(),r)}}),u}),k("widgets/image",["base","uploader","lib/image","widgets/widget"],function(f,g,h){var u,o=f.$;return u=function(t){var r=0,i=[],e=function(){for(var n;i.length&&r<5242880;)n=i.shift(),r+=n[0],n[1]()};return function(n,a,s){i.push([a,s]),n.once("destroy",function(){r-=a,setTimeout(e,1)}),setTimeout(e,1)}}(),o.extend(g.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),g.register({name:"image",makeThumb:function(t,r,i,e){var n,a;if(t=this.request("get-file",t),!t.type.match(/^image/))return void r(!0);n=o.extend({},this.options.thumb),o.isPlainObject(i)&&(n=o.extend(n,i),i=null),i=i||n.width,e=e||n.height,a=new h(n),a.once("load",function(){t._info=t._info||a.info(),t._meta=t._meta||a.meta(),i<=1&&i>0&&(i=t._info.width*i),e<=1&&e>0&&(e=t._info.height*e),a.resize(i,e)}),a.once("complete",function(){r(!1,a.getAsDataUrl(n.type)),a.destroy()}),a.once("error",function(s){r(s||!0),a.destroy()}),u(a,t.source.size,function(){t._info&&a.info(t._info),t._meta&&a.meta(t._meta),a.loadFromBlob(t.source)})},beforeSendFile:function(t){var r,i,e=this.options.compress||this.options.resize,n=e&&e.compressSize||0,a=e&&e.noCompressIfLarger||!1;if(t=this.request("get-file",t),e&&~"image/jpeg,image/jpg".indexOf(t.type)&&!(t.size<n)&&!t._compressed)return e=o.extend({},e),i=f.Deferred(),r=new h(e),i.always(function(){r.destroy(),r=null}),r.once("error",i.reject),r.once("load",function(){var s=e.width,l=e.height;t._info=t._info||r.info(),t._meta=t._meta||r.meta(),s<=1&&s>0&&(s=t._info.width*s),l<=1&&l>0&&(l=t._info.height*l),r.resize(s,l)}),r.once("complete",function(){var s,l;try{s=r.getAsBlob(e.type),l=t.size,(!a||s.size<l)&&(t.source=s,t.size=s.size,t.trigger("resize",s.size,l)),t._compressed=!0,i.resolve()}catch(y){i.resolve()}}),t._info&&r.info(t._info),t._meta&&r.meta(t._meta),r.loadFromBlob(t.source),i.promise()}})}),k("file",["base","mediator"],function(f,g){function h(){return t+r++}function u(n){this.name=n.name||"Untitled",this.size=n.size||0,this.type=n.type||"application/octet-stream",this.lastModifiedDate=n.lastModifiedDate||1*new Date,this.id=h(),this.ext=i.exec(this.name)?RegExp.$1:"",this.statusText="",e[this.id]=u.Status.INITED,this.source=n,this.loaded=0,this.on("error",function(a){this.setStatus(u.Status.ERROR,a)})}var o=f.$,t="WU_FILE_",r=0,i=/\.([^.]+)$/,e={};return o.extend(u.prototype,{setStatus:function(n,a){var s=e[this.id];a!==void 0&&(this.statusText=a),n!==s&&(e[this.id]=n,this.trigger("statuschange",n,s))},getStatus:function(){return e[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete e[this.id]}}),g.installTo(u.prototype),u.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},u}),k("queue",["base","mediator","file"],function(f,g,h){function u(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numOfDeleted:0,numOfInterrupt:0},this._queue=[],this._map={}}var o=f.$,t=h.Status;return o.extend(u.prototype,{append:function(r){return this._queue.push(r),this._fileAdded(r),this},prepend:function(r){return this._queue.unshift(r),this._fileAdded(r),this},getFile:function(r){return typeof r!="string"?r:this._map[r]},fetch:function(r){var i,e,n=this._queue.length;for(r=r||t.QUEUED,i=0;i<n;i++)if(e=this._queue[i],r===e.getStatus())return e;return null},sort:function(r){typeof r=="function"&&this._queue.sort(r)},getFiles:function(){for(var r,i=[].slice.call(arguments,0),e=[],n=0,a=this._queue.length;n<a;n++)r=this._queue[n],i.length&&!~o.inArray(r.getStatus(),i)||e.push(r);return e},removeFile:function(r){this._map[r.id]&&(delete this._map[r.id],this._delFile(r),r.destroy(),this.stats.numOfDeleted++)},_fileAdded:function(r){var i=this;this._map[r.id]||(this._map[r.id]=r,r.on("statuschange",function(e,n){i._onFileStatusChange(e,n)}))},_delFile:function(r){for(var i=this._queue.length-1;i>=0;i--)if(this._queue[i]==r){this._queue.splice(i,1);break}},_onFileStatusChange:function(r,i){var e=this.stats;switch(i){case t.PROGRESS:e.numOfProgress--;break;case t.QUEUED:e.numOfQueue--;break;case t.ERROR:e.numOfUploadFailed--;break;case t.INVALID:e.numOfInvalid--;break;case t.INTERRUPT:e.numOfInterrupt--}switch(r){case t.QUEUED:e.numOfQueue++;break;case t.PROGRESS:e.numOfProgress++;break;case t.ERROR:e.numOfUploadFailed++;break;case t.COMPLETE:e.numOfSuccess++;break;case t.CANCELLED:e.numOfCancel++;break;case t.INVALID:e.numOfInvalid++;break;case t.INTERRUPT:e.numOfInterrupt++}}}),g.installTo(u.prototype),u}),k("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(f,g,h,u,o,t){var r=f.$,i=/\.\w+$/,e=u.Status;return g.register({name:"queue",init:function(n){var a,s,l,y,x,w,p,c=this;if(r.isPlainObject(n.accept)&&(n.accept=[n.accept]),n.accept){for(x=[],l=0,s=n.accept.length;l<s;l++)(y=n.accept[l].extensions)&&x.push(y);x.length&&(w="\\."+x.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),c.accept=new RegExp(w,"i")}if(c.queue=new h,c.stats=c.queue.stats,this.request("predict-runtime-type")==="html5")return a=f.Deferred(),this.placeholder=p=new t("Placeholder"),p.connectRuntime({runtimeOrder:"html5"},function(){c._ruid=p.getRuid(),a.resolve()}),a.promise()},_wrapFile:function(n){if(!(n instanceof u)){if(!(n instanceof o)){if(!this._ruid)throw new Error("Can't add external files.");n=new o(this._ruid,n)}n.isFile=!n.source.isDirectory,n.fullPath=n.source.fullPath||n.source.webkitRelativePath||"",n=new u(n)}return n},acceptFile:function(n){return!(!n||this.accept&&i.exec(n.name)&&!this.accept.test(n.name))},_addFile:function(n){var a=this;if(n=a._wrapFile(n),!!a.owner.trigger("beforeFileQueued",n))return a.queue.append(n),a.owner.trigger("fileQueued",n),n},getFile:function(n){return this.queue.getFile(n)},addFile:function(n){var a=this;n.length||(n=[n]),n=r.map(n,function(s){return a._addFile(s)}),n.length&&(a.owner.trigger("filesQueued",n),a.options.auto&&setTimeout(function(){a.request("start-upload")},20))},addFileSync:function(n,a){var s=this._addFile(a);s&&n.push(s)},addFileEnd:function(n){var a=this;n.length<=0||(a.owner.trigger("filesQueued",n),a.options.auto&&setTimeout(function(){a.request("start-upload")},20))},addFileSingle:function(n){var a=[];this.addFileSync(a,n),this.addFileEnd(a)},getStats:function(){return this.stats},removeFile:function(n,a){var s=this;n=n.id?n:s.queue.getFile(n),this.request("cancel-file",n),a&&this.queue.removeFile(n)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(n,a){var s,l,y,x=this;if(n)return n=n.id?n:x.queue.getFile(n),n.setStatus(e.QUEUED),void(a||x.request("start-upload"));for(s=x.queue.getFiles(e.ERROR),l=0,y=s.length;l<y;l++)n=s[l],n.setStatus(e.QUEUED);x.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new h,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),k("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(f,g){return f.support=function(){return g.hasRuntime.apply(g,arguments)},f.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var h,u,o=this.options.runtimeOrder||g.orders,t=this.type;if(!t){for(o=o.split(/\s*,\s*/g),h=0,u=o.length;h<u;h++)if(g.hasRuntime(o[h])){this.type=t=o[h];break}}return t}})}),k("lib/transport",["base","runtime/client","mediator"],function(f,g,h){function u(t){var r=this;t=r.options=o.extend(!0,{},u.options,t||{}),g.call(this,"Transport"),this._blob=null,this._formData=t.formData||{},this._headers=t.headers||{},this.on("progress",this._timeout),this.on("load error",function(){r.trigger("progress",1),clearTimeout(r._timer)})}var o=f.$;return u.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},o.extend(u.prototype,{appendBlob:function(t,r,i){var e=this,n=e.options;e.getRuid()&&e.disconnectRuntime(),e.connectRuntime(r.ruid,function(){e.exec("init")}),e._blob=r,n.fileVal=t||n.fileVal,n.filename=i||n.filename},append:function(t,r){(t===void 0?"undefined":_typeof(t))==="object"?o.extend(this._formData,t):this._formData[t]=r},setRequestHeader:function(t,r){(t===void 0?"undefined":_typeof(t))==="object"?o.extend(this._headers,t):this._headers[t]=r},send:function(t){this.exec("send",t),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponseHeaders:function(){return this.exec("getResponseHeaders")},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var t=this,r=t.options.timeout;r&&(clearTimeout(t._timer),t._timer=setTimeout(function(){t.abort(),t.trigger("error","timeout")},r))}}),h.installTo(u.prototype),u}),k("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(f,g,h,u){function o(e,n){var a,s,l=[],y=e.source,x=y.size,w=n?Math.ceil(x/n):1,p=0,c=0;for(s={file:e,has:function(){return!!l.length},shift:function(){return l.shift()},unshift:function(d){l.unshift(d)}};c<w;)a=Math.min(n,x-p),l.push({file:e,start:p,end:n?p+a:x,total:x,chunks:w,chunk:c++,cuted:s}),p+=a;return e.blocks=l.concat(),e.remaning=l.length,s}var t=f.$,r=f.isPromise,i=h.Status;t.extend(g.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,chunkRetryDelay:1e3,threads:3,formData:{}}),g.register({name:"upload",init:function(){var e=this.owner,n=this;this.runing=!1,this.progress=!1,e.on("startUpload",function(){n.progress=!0}).on("uploadFinished",function(){n.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=f.bindFn(this._tick,this),e.on("uploadComplete",function(a){a.blocks&&t.each(a.blocks,function(s,l){l.transport&&(l.transport.abort(),l.transport.destroy()),delete l.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(e){var n=this;if(t.each(n.request("get-files",i.INVALID),function(){n.request("remove-file",this)}),e?(e=e.id?e:n.request("get-file",e),e.getStatus()===i.INTERRUPT?(e.setStatus(i.QUEUED),t.each(n.pool,function(s,l){l.file===e&&(l.transport&&l.transport.send(),e.setStatus(i.PROGRESS))})):e.getStatus()!==i.PROGRESS&&e.setStatus(i.QUEUED)):t.each(n.request("get-files",[i.INITED]),function(){this.setStatus(i.QUEUED)}),n.runing)return n.owner.trigger("startUpload",e),f.nextTick(n.__tick);n.runing=!0;var a=[];e||t.each(n.pool,function(s,l){var y=l.file;if(y.getStatus()===i.INTERRUPT){if(n._trigged=!1,a.push(y),l.waiting)return;l.transport?l.transport.send():n._doSend(l)}}),t.each(a,function(){this.setStatus(i.PROGRESS)}),e||t.each(n.request("get-files",i.INTERRUPT),function(){this.setStatus(i.PROGRESS)}),n._trigged=!1,f.nextTick(n.__tick),n.owner.trigger("startUpload")},stopUpload:function(e,n){var a=this;if(e===!0&&(n=e,e=null),a.runing!==!1){if(e)return e=e.id?e:a.request("get-file",e),e.getStatus()!==i.PROGRESS&&e.getStatus()!==i.QUEUED?void 0:(e.setStatus(i.INTERRUPT),t.each(a.pool,function(s,l){l.file===e&&(l.transport&&l.transport.abort(),n&&(a._putback(l),a._popBlock(l)))}),a.owner.trigger("stopUpload",e),f.nextTick(a.__tick));a.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(i.INTERRUPT),n&&t.each(a.pool,function(s,l){l.transport&&l.transport.abort(),l.file.setStatus(i.INTERRUPT)}),a.owner.trigger("stopUpload")}},cancelFile:function(e){e=e.id?e:this.request("get-file",e),e.blocks&&t.each(e.blocks,function(n,a){var s=a.transport;s&&(s.abort(),s.destroy(),delete a.transport)}),e.setStatus(i.CANCELLED),this.owner.trigger("fileDequeued",e)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(e,n){e=e.id?e:this.request("get-file",e),e.setStatus(n||i.COMPLETE),e.skipped=!0,e.blocks&&t.each(e.blocks,function(a,s){var l=s.transport;l&&(l.abort(),l.destroy(),delete s.transport)}),this.owner.trigger("uploadSkip",e)},_tick:function(){var e,n,a=this,s=a.options;if(a._promise)return a._promise.always(a.__tick);a.pool.length<s.threads&&(n=a._nextBlock())?(a._trigged=!1,e=function(l){a._promise=null,l&&l.file&&a._startSend(l),f.nextTick(a.__tick)},a._promise=r(n)?n.always(e):e(n)):a.remaning||a._getStats()&&(a._getStats().numOfQueue||a._getStats().numOfInterrupt)||(a.runing=!1,a._trigged||f.nextTick(function(){a.owner.trigger("uploadFinished")}),a._trigged=!0)},_putback:function(e){var n;e.cuted.unshift(e),~(n=this.stack.indexOf(e.cuted))||(this.remaning++,e.file.remaning++,this.stack.unshift(e.cuted))},_getStack:function(){for(var e,n=0;e=this.stack[n++];){if(e.has()&&e.file.getStatus()===i.PROGRESS)return e;(!e.has()||e.file.getStatus()!==i.PROGRESS&&e.file.getStatus()!==i.INTERRUPT)&&this.stack.splice(--n,1)}return null},_nextBlock:function(){var e,n,a,s,l=this,y=l.options;return(e=this._getStack())?(y.prepareNextFile&&!l.pending.length&&l._prepareNextFile(),e.shift()):l.runing?(!l.pending.length&&l._getStats().numOfQueue&&l._prepareNextFile(),n=l.pending.shift(),a=function(x){return x?(e=o(x,y.chunked?x.chunkSize||y.chunkSize:0),l.stack.push(e),e.shift()):null},r(n)?(s=n.file,n=n[n.pipe?"pipe":"then"](a),n.file=s,n):a(n)):void 0},_prepareNextFile:function(){var e,n=this,a=n.request("fetch-file"),s=n.pending;a&&(e=n.request("before-send-file",a,function(){return a.getStatus()===i.PROGRESS||a.getStatus()===i.INTERRUPT?a:n._finishFile(a)}),n.owner.trigger("uploadStart",a),a.setStatus(i.PROGRESS),e.file=a,e.done(function(){var l=t.inArray(e,s);~l&&s.splice(l,1,a)}),e.fail(function(l){a.setStatus(i.ERROR,l),n.owner.trigger("uploadError",a,l),n.owner.trigger("uploadComplete",a)}),s.push(e))},_popBlock:function(e){var n=t.inArray(e,this.pool);this.pool.splice(n,1),e.file.remaning--,this.remaning--},_startSend:function(e){var n,a=this,s=e.file;if(s.getStatus()!==i.PROGRESS)return void(s.getStatus()===i.INTERRUPT&&a._putback(e));a.pool.push(e),a.remaning++,e.blob=e.chunks===1?s.source:s.source.slice(e.start,e.end),e.waiting=n=a.request("before-send",e,function(){delete e.waiting,s.getStatus()===i.PROGRESS?a._doSend(e):e.file.getStatus()!==i.INTERRUPT&&a._popBlock(e),f.nextTick(a.__tick)}),n.fail(function(){delete e.waiting,s.remaning===1?a._finishFile(s).always(function(){e.percentage=1,a._popBlock(e),a.owner.trigger("uploadComplete",s),f.nextTick(a.__tick)}):(e.percentage=1,a.updateFileProgress(s),a._popBlock(e),f.nextTick(a.__tick))})},_doSend:function(e){var n,a,s=this,l=s.owner,y=t.extend({},s.options,e.options),x=e.file,w=new u(y),p=t.extend({},y.formData),c=t.extend({},y.headers);e.transport=w,w.on("destroy",function(){delete e.transport,s._popBlock(e),f.nextTick(s.__tick)}),w.on("progress",function(d){e.percentage=d,s.updateFileProgress(x)}),n=function(d){var m;return a=w.getResponseAsJson()||{},a._raw=w.getResponse(),a._headers=w.getResponseHeaders(),e.response=a,m=function(v){d=v},l.trigger("uploadAccept",e,a,m)||(d=d||"server"),d},w.on("error",function(d,m){var v,b,U=d.split("|");d=U[0],v=parseFloat(U[1]),b=U[2],e.retried=e.retried||0,x._serverData=w.getResponse(),e.chunks>1&&(~"http,abort".indexOf(d)||e.serverNeedRetry)&&e.retried<y.chunkRetry?(e.retried++,s.retryTimer=setTimeout(function(){w.send()},y.chunkRetryDelay||1e3)):(m||d!=="server"||(d=n(d)),x.setStatus(i.ERROR,d),l.trigger("uploadError",x,d,v,b),l.trigger("uploadComplete",x))}),w.on("load",function(){var d;if(d=n())return void w.trigger("error",d,!0);x.remaning===1?s._finishFile(x,a):w.destroy()}),p=t.extend(p,{id:x.id,name:x.name,type:x.type,lastModifiedDate:x.lastModifiedDate,size:x.size}),e.chunks>1&&t.extend(p,{chunks:e.chunks,chunk:e.chunk}),l.trigger("uploadBeforeSend",e,p,c),w.appendBlob(y.fileVal,e.blob,x.name),w.append(p),w.setRequestHeader(c),w.send()},_finishFile:function(e,n,a){var s=this.owner;return s.request("after-send-file",arguments,function(){e.setStatus(i.COMPLETE),s.trigger("uploadSuccess",e,n,a)}).fail(function(l){e.getStatus()===i.PROGRESS&&e.setStatus(i.ERROR,l),s.trigger("uploadError",e,l)}).always(function(){s.trigger("uploadComplete",e)})},updateFileProgress:function(e){var n=0,a=0;e.blocks&&(t.each(e.blocks,function(s,l){a+=(l.percentage||0)*(l.end-l.start)}),n=a/e.size,this.owner.trigger("uploadProgress",e,n||0))},destroy:function(){clearTimeout(this.retryTimer)}})}),k("widgets/validator",["base","uploader","file","widgets/widget"],function(f,g,h){var u,o=f.$,t={};return u={addValidator:function(r,i){t[r]=i},removeValidator:function(r){delete t[r]}},g.register({name:"validator",init:function(){var r=this;f.nextTick(function(){o.each(t,function(){this.call(r.owner)})})}}),u.addValidator("fileNumLimit",function(){var r=this,i=r.options,e=0,n=parseInt(i.fileNumLimit,10),a=!0;n&&(r.on("beforeFileQueued",function(s){return!!this.trigger("beforeFileQueuedCheckfileNumLimit",s,e)&&(e>=n&&a&&(a=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",n,s),setTimeout(function(){a=!0},1)),!(e>=n))}),r.on("fileQueued",function(){e++}),r.on("fileDequeued",function(){e--}),r.on("reset",function(){e=0}))}),u.addValidator("fileSizeLimit",function(){var r=this,i=r.options,e=0,n=parseInt(i.fileSizeLimit,10),a=!0;n&&(r.on("beforeFileQueued",function(s){var l=e+s.size>n;return l&&a&&(a=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",n,s),setTimeout(function(){a=!0},1)),!l}),r.on("fileQueued",function(s){e+=s.size}),r.on("fileDequeued",function(s){e-=s.size}),r.on("reset",function(){e=0}))}),u.addValidator("fileSingleSizeLimit",function(){var r=this,i=r.options,e=i.fileSingleSizeLimit;e&&r.on("beforeFileQueued",function(n){if(n.size>e)return n.setStatus(h.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",e,n),!1})}),u.addValidator("duplicate",function(){function r(a){for(var s,l=0,y=0,x=a.length;y<x;y++)s=a.charCodeAt(y),l=s+(l<<6)+(l<<16)-l;return l}var i=this,e=i.options,n={};e.duplicate||(i.on("beforeFileQueued",function(a){var s=a.__hash||(a.__hash=r(a.name+a.size+a.lastModifiedDate))}),i.on("fileQueued",function(a){var s=a.__hash;s&&(n[s]=!0)}),i.on("fileDequeued",function(a){var s=a.__hash;s&&delete n[s]}),i.on("reset",function(){n={}}))}),u}),k("lib/md5",["runtime/client","mediator"],function(f,g){function h(){f.call(this,"Md5")}return g.installTo(h.prototype),h.prototype.loadFromBlob=function(u){var o=this;o.getRuid()&&o.disconnectRuntime(),o.connectRuntime(u.ruid,function(){o.exec("init"),o.exec("loadFromBlob",u)})},h.prototype.getResult=function(){return this.exec("getResult")},h}),k("widgets/md5",["base","uploader","lib/md5","lib/blob","widgets/widget"],function(f,g,h,u){return g.register({name:"md5",md5File:function(o,t,r){var i=new h,e=f.Deferred(),n=o instanceof u?o:this.request("get-file",o).source;return i.on("progress load",function(a){a=a||{},e.notify(a.total?a.loaded/a.total:1)}),i.on("complete",function(){e.resolve(i.getResult())}),i.on("error",function(a){e.reject(a)}),arguments.length>1&&(t=t||0,r=r||0,t<0&&(t=n.size+t),r<0&&(r=n.size+r),r=Math.min(r,n.size),n=n.slice(t,r)),i.loadFromBlob(n),e.promise()}})}),k("runtime/compbase",[],function(){function f(g,h){this.owner=g,this.options=g.options,this.getRuntime=function(){return h},this.getRuid=function(){return h.uid},this.trigger=function(){return g.trigger.apply(g,arguments)}}return f}),k("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(f,g,h){function u(){var r={},i=this,e=this.destroy;g.apply(i,arguments),i.type=o,i.exec=function(n,a){var s,l=this,y=l.uid,x=f.slice(arguments,2);if(t[n]&&(s=r[y]=r[y]||new t[n](l,i),s[a]))return s[a].apply(s,x)},i.destroy=function(){return e&&e.apply(this,arguments)}}var o="html5",t={};return f.inherits(g,{constructor:u,init:function(){var r=this;setTimeout(function(){r.trigger("ready")},1)}}),u.register=function(r,i){return t[r]=f.inherits(h,i)},A.Blob&&A.FileReader&&A.DataView&&g.addRuntime(o,u),u}),k("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(f,g){return f.register("Blob",{slice:function(h,u){var o=this.owner.source;return o=(o.slice||o.webkitSlice||o.mozSlice).call(o,h,u),new g(this.getRuid(),o)}})}),k("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(f,g,h){var u=f.$,o="webuploader-dnd-";return g.register("DragAndDrop",{init:function(){var t=this.elem=this.options.container;this.dragEnterHandler=f.bindFn(this._dragEnterHandler,this),this.dragOverHandler=f.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=f.bindFn(this._dragLeaveHandler,this),this.dropHandler=f.bindFn(this._dropHandler,this),this.dndOver=!1;var r=this;u(t).each(function(){var i=u(this);i.on("dragenter",r.dragEnterHandler),i.on("dragover",r.dragOverHandler),i.on("dragleave",r.dragLeaveHandler),i.on("drop",r.dropHandler)}),this.owner.dragAndDrop=this,this.owner.dropFileStart=function(i){var i=i.originalEvent||i,e=i.dataTransfer;r.trigger("filesAccept",e),r._getTansferFiles(e,r.getRuid())},this.options.disableGlobalDnd&&(u(document).on("dragover",this.dragOverHandler),u(document).on("drop",this.dropHandler))},_dragEnterHandler:function(t){var r,i=this,e=i._denied||!1;return t=t.originalEvent||t,i.dndOver||(i.dndOver=!0,r=t.dataTransfer.items,r&&r.length&&(i._denied=e=!i.trigger("accept",r)),i.elem.addClass(o+"over"),i.elem[e?"addClass":"removeClass"](o+"denied")),t.dataTransfer.dropEffect=e?"none":"copy",!1},_dragOverHandler:function(t){var r=this.elem.parent().get(0);return r&&u.contains(r,t.currentTarget),clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,t),!1},_dragLeaveHandler:function(){var t,r=this;return t=function(){r.dndOver=!1,r.elem.removeClass(o+"over "+o+"denied")},clearTimeout(r._leaveTimer),r._leaveTimer=setTimeout(t,100),!1},_dropHandler:function(t){var r,i,e=this,n=e.getRuid(),a=e.elem.parent().get(0);a&&u.contains(a,t.currentTarget),t=t.originalEvent||t,r=t.dataTransfer;try{i=r.getData("text/html")}catch(s){}if(e.dndOver=!1,e.elem.removeClass(o+"over"),r&&!i)return e.trigger("filesAccept",r),e._getTansferFiles(r,n),!1},_getTansferFiles:function(t,r){var i,e,n,a,s,l,y,x=this,w=[],p=[];if(i=t.items,e=t.files,e.length!=0){for(y=!!(i&&i[0]&&i[0].webkitGetAsEntry),s=0,l=e.length;s<l;s++){n=e[s];var a=i&&i[s],c=a&&a.webkitGetAsEntry&&a.webkitGetAsEntry();y&&c&&c.isDirectory?p.push(this._traverseDirectoryTree(c,w,r)):this.addFile(n,w,r)}f.when.apply(f,p).done(function(){w.length&&x.trigger("add-file-end",w)})}},addFile:function(t,r,i){var e=new h(i,t);this.trigger("add-file-sync",r,e)},_traverseDirectoryTree:function(t,r,i){var e=f.Deferred(),n=this;if(t.isFile)t.file(function(x){x.newwebkitRelativePath=t.fullPath,x.fullPath=t.fullPath,n.addFile(x,r,i),e.resolve()});else if(t.isDirectory){var a=t.createReader(),s=[],l=a.readEntries.bind(a,function(x){if(x.length<=0)return void f.when.apply(f,s).then(function(){e.resolve()},e.reject);for(var w=x.length,p=0;p<w;p++)s.push(n._traverseDirectoryTree(x[p],r,i));setTimeout(function(){l()},0)}),y=t.createReader();y.readEntries(function(x){var w=_.trim(t.fullPath,"/").split("/");x.length!=0&&w.length!=1||n.addFile(t,r,i)}),l()}return e.promise()},destroy:function(){var t=this.elem;t&&(t.off("dragenter",this.dragEnterHandler),t.off("dragover",this.dragOverHandler),t.off("dragleave",this.dragLeaveHandler),t.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(u(document).off("dragover",this.dragOverHandler),u(document).off("drop",this.dropHandler)))}})}),k("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(f,g,h){return g.register("FilePaste",{init:function(){var u,o,t,r,i=this.options,e=this.elem=i.container,n=".*";if(i.accept){for(u=[],o=0,t=i.accept.length;o<t;o++)(r=i.accept[o].mimeTypes)&&u.push(r);u.length&&(n=u.join(","),n=n.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=n=new RegExp(n,"i"),this.hander=f.bindFn(this._pasteHander,this),e.on("paste",this.hander)},_pasteHander:function(u){var o,t,r,i,e,n=[],a=this.getRuid();for(u=u.originalEvent||u,o=u.clipboardData.items,i=0,e=o.length;i<e;i++)t=o[i],t.kind==="file"&&(r=t.getAsFile())&&n.push(new h(a,r));if(n.length){u.preventDefault(),u.stopPropagation();var s=[];for(this.trigger("filesAccept",n),i=0;i<n.length;i++)this.trigger("add-file-sync",s,n[i]);this.trigger("add-file-end",s)}},destroy:function(){this.elem.off("paste",this.hander)}})}),k("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(f,g){var h=f.$;return g.register("FilePicker",{init:function(){var u,o,t,r,i,e=this.getRuntime().getContainer(),n=this,a=n.owner,s=n.options,l=this.label=h(document.createElement("label")),y=this.input=h(document.createElement("input"));if(y.attr("type","file"),y.attr("name",s.name),y.addClass("webuploader-element-invisible"),l.on("click",function(x){y.trigger("click"),x.stopPropagation(),a.trigger("dialogopen")}),l.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),s.multiple&&y.attr("multiple","multiple"),s.accept&&s.accept.length>0){for(u=[],o=0,t=s.accept.length;o<t;o++)u.push(s.accept[o].mimeTypes);y.attr("accept",u.join(","))}e.append(y),e.append(l),r=function(x){a.trigger(x.type)},i=function(x){var w;if(x.target.files.length===0)return!1;n.files=x.target.files,w=this.cloneNode(!0),w.value=null,this.parentNode.replaceChild(w,this),y.off(),y=h(w).on("change",i).on("mouseenter mouseleave",r),a.trigger("change")},y.on("change",i),l.on("mouseenter mouseleave",r)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),k("runtime/html5/util",["base"],function(f){var g=A.createObjectURL&&A||A.URL&&URL.revokeObjectURL&&URL||A.webkitURL,h=f.noop,u=h;return g&&(h=function(){return g.createObjectURL.apply(g,arguments)},u=function(){return g.revokeObjectURL.apply(g,arguments)}),{createObjectURL:h,revokeObjectURL:u,dataURL2Blob:function(o){var t,r,i,e,n,a;for(a=o.split(","),t=~a[0].indexOf("base64")?atob(a[1]):decodeURIComponent(a[1]),i=new ArrayBuffer(t.length),r=new Uint8Array(i),e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return n=a[0].split(":")[1].split(";")[0],this.arrayBufferToBlob(i,n)},dataURL2ArrayBuffer:function(o){var t,r,i,e;for(e=o.split(","),t=~e[0].indexOf("base64")?atob(e[1]):decodeURIComponent(e[1]),r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r.buffer},arrayBufferToBlob:function(o,t){var r,i=A.BlobBuilder||A.WebKitBlobBuilder;return i?(r=new i,r.append(o),r.getBlob(t)):new Blob([o],t?{type:t}:{})},canvasToDataUrl:function(o,t,r){return o.toDataURL(t,r/100)},parseMeta:function(o,t){t(!1,{})},updateImageHead:function(o){return o}}}),k("runtime/html5/imagemeta",["runtime/html5/util"],function(f){var g;return g={parsers:{65505:[]},maxMetaDataSize:262144,parse:function(h,u){var o=this,t=new FileReader;t.onload=function(){u(!1,o._parse(this.result)),t=t.onload=t.onerror=null},t.onerror=function(r){u(r.message),t=t.onload=t.onerror=null},h=h.slice(0,o.maxMetaDataSize),t.readAsArrayBuffer(h.getSource())},_parse:function(h,u){if(!(h.byteLength<6)){var o,t,r,i,e=new DataView(h),n=2,a=e.byteLength-4,s=n,l={};if(e.getUint16(0)===65496){for(;n<a&&((o=e.getUint16(n))>=65504&&o<=65519||o===65534)&&(t=e.getUint16(n+2)+2,!(n+t>e.byteLength));){if(r=g.parsers[o],!u&&r)for(i=0;i<r.length;i+=1)r[i].call(g,e,n,t,l);n+=t,s=n}s>6&&(h.slice?l.imageHead=h.slice(2,s):l.imageHead=new Uint8Array(h).subarray(2,s))}return l}},updateImageHead:function(h,u){var o,t,r,i=this._parse(h,!0);return r=2,i.imageHead&&(r=2+i.imageHead.byteLength),t=h.slice?h.slice(r):new Uint8Array(h).subarray(r),o=new Uint8Array(u.byteLength+2+t.byteLength),o[0]=255,o[1]=216,o.set(new Uint8Array(u),2),o.set(new Uint8Array(t),u.byteLength+2),o.buffer}},f.parseMeta=function(){return g.parse.apply(g,arguments)},f.updateImageHead=function(){return g.updateImageHead.apply(g,arguments)},g}),k("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(f,g){var h={};return h.ExifMap=function(){return this},h.ExifMap.prototype.map={Orientation:274},h.ExifMap.prototype.get=function(u){return this[u]||this[this.map[u]]},h.exifTagTypes={1:{getValue:function(u,o){return u.getUint8(o)},size:1},2:{getValue:function(u,o){return String.fromCharCode(u.getUint8(o))},size:1,ascii:!0},3:{getValue:function(u,o,t){return u.getUint16(o,t)},size:2},4:{getValue:function(u,o,t){return u.getUint32(o,t)},size:4},5:{getValue:function(u,o,t){return u.getUint32(o,t)/u.getUint32(o+4,t)},size:8},9:{getValue:function(u,o,t){return u.getInt32(o,t)},size:4},10:{getValue:function(u,o,t){return u.getInt32(o,t)/u.getInt32(o+4,t)},size:8}},h.exifTagTypes[7]=h.exifTagTypes[1],h.getExifValue=function(u,o,t,r,i,e){var n,a,s,l,y,x,w=h.exifTagTypes[r];if(!w)return void f.log("Invalid Exif data: Invalid tag type.");if(n=w.size*i,(a=n>4?o+u.getUint32(t+8,e):t+8)+n>u.byteLength)return void f.log("Invalid Exif data: Invalid data offset.");if(i===1)return w.getValue(u,a,e);for(s=[],l=0;l<i;l+=1)s[l]=w.getValue(u,a+l*w.size,e);if(w.ascii){for(y="",l=0;l<s.length&&(x=s[l])!=="\0";l+=1)y+=x;return y}return s},h.parseExifTag=function(u,o,t,r,i){var e=u.getUint16(t,r);i.exif[e]=h.getExifValue(u,o,t,u.getUint16(t+2,r),u.getUint32(t+4,r),r)},h.parseExifTags=function(u,o,t,r,i){var e,n,a;if(t+6>u.byteLength)return void f.log("Invalid Exif data: Invalid directory offset.");if(e=u.getUint16(t,r),(n=t+2+12*e)+4>u.byteLength)return void f.log("Invalid Exif data: Invalid directory size.");for(a=0;a<e;a+=1)this.parseExifTag(u,o,t+2+12*a,r,i);return u.getUint32(n,r)},h.parseExifData=function(u,o,t,r){var i,e,n=o+10;if(u.getUint32(o+4)===1165519206){if(n+8>u.byteLength)return void f.log("Invalid Exif data: Invalid segment size.");if(u.getUint16(o+8)!==0)return void f.log("Invalid Exif data: Missing byte alignment offset.");switch(u.getUint16(n)){case 18761:i=!0;break;case 19789:i=!1;break;default:return void f.log("Invalid Exif data: Invalid byte alignment marker.")}if(u.getUint16(n+2,i)!==42)return void f.log("Invalid Exif data: Missing TIFF marker.");e=u.getUint32(n+4,i),r.exif=new h.ExifMap,e=h.parseExifTags(u,n,n+e,i,r)}},g.parsers[65505].push(h.parseExifData),h}),k("runtime/html5/jpegencoder",[],function(f,g,h){function u(o){function t(R){for(var F=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],E=0;E<64;E++){var T=tt((F[E]*R+50)/100);T<1?T=1:T>255&&(T=255),K[rt[E]]=T}for(var D=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],O=0;O<64;O++){var C=tt((D[O]*R+50)/100);C<1?C=1:C>255&&(C=255),it[rt[O]]=C}for(var P=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],B=0,H=0;H<8;H++)for(var I=0;I<8;I++)_t[B]=1/(K[rt[B]]*P[H]*P[I]*8),gt[B]=1/(it[rt[B]]*P[H]*P[I]*8),B++}function r(R,F){for(var E=0,T=0,D=new Array,O=1;O<=16;O++){for(var C=1;C<=R[O];C++)D[F[T]]=[],D[F[T]][0]=E,D[F[T]][1]=O,T++,E++;E*=2}return D}function i(){U=r(St,Et),q=r(At,Ot),z=r(Ft,Tt),j=r(Dt,Ut)}function e(){for(var R=1,F=2,E=1;E<=15;E++){for(var T=R;T<F;T++)ut[32767+T]=E,J[32767+T]=[],J[32767+T][1]=E,J[32767+T][0]=T;for(var D=-(F-1);D<=-R;D++)ut[32767+D]=E,J[32767+D]=[],J[32767+D][1]=E,J[32767+D][0]=F-1+D;R<<=1,F<<=1}}function n(){for(var R=0;R<256;R++)M[R]=19595*R,M[R+256>>0]=38470*R,M[R+512>>0]=7471*R+32768,M[R+768>>0]=-11059*R,M[R+1024>>0]=-21709*R,M[R+1280>>0]=32768*R+8421375,M[R+1536>>0]=-27439*R,M[R+1792>>0]=-5329*R}function a(R){for(var F=R[0],E=R[1]-1;E>=0;)F&1<<E&&(nt|=1<<W),E--,--W<0&&(nt==255?(s(255),s(0)):s(nt),W=7,nt=0)}function s(R){ct.push(kt[R])}function l(R){s(R>>8&255),s(255&R)}function y(R,F){var E,T,D,O,C,P,B,H,I,S=0;for(I=0;I<8;++I){E=R[S],T=R[S+1],D=R[S+2],O=R[S+3],C=R[S+4],P=R[S+5],B=R[S+6],H=R[S+7];var N=E+H,L=E-H,X=T+B,Q=T-B,V=D+P,G=D-P,Z=O+C,ot=O-C,Y=N+Z,mt=N-Z,lt=X+V,ft=X-V;R[S]=Y+lt,R[S+4]=Y-lt;var It=.707106781*(ft+mt);R[S+2]=mt+It,R[S+6]=mt-It,Y=ot+G,lt=G+Q,ft=Q+L;var Ct=.382683433*(Y-ft),qt=.5411961*Y+Ct,Pt=1.306562965*ft+Ct,Lt=.707106781*lt,Ht=L+Lt,Bt=L-Lt;R[S+5]=Bt+qt,R[S+3]=Bt-qt,R[S+1]=Ht+Pt,R[S+7]=Ht-Pt,S+=8}for(S=0,I=0;I<8;++I){E=R[S],T=R[S+8],D=R[S+16],O=R[S+24],C=R[S+32],P=R[S+40],B=R[S+48],H=R[S+56];var zt=E+H,vt=E-H,Mt=T+B,jt=T-B,Nt=D+P,$t=D-P,Qt=O+C,Yt=O-C,at=zt+Qt,bt=zt-Qt,dt=Mt+Nt,ht=Mt-Nt;R[S]=at+dt,R[S+32]=at-dt;var Vt=.707106781*(ht+bt);R[S+16]=bt+Vt,R[S+48]=bt-Vt,at=Yt+$t,dt=$t+jt,ht=jt+vt;var Gt=.382683433*(at-ht),Jt=.5411961*at+Gt,Wt=1.306562965*ht+Gt,Xt=.707106781*dt,Zt=vt+Xt,Kt=vt-Xt;R[S+40]=Kt+Jt,R[S+24]=Kt-Jt,R[S+8]=Zt+Wt,R[S+56]=Zt-Wt,S++}var pt;for(I=0;I<64;++I)pt=R[I]*F[I],yt[I]=pt>0?pt+.5|0:pt-.5|0;return yt}function x(){l(65504),l(16),s(74),s(70),s(73),s(70),s(0),s(1),s(1),s(0),l(1),l(1),s(0),s(0)}function w(R,F){l(65472),l(17),s(8),l(F),l(R),s(3),s(1),s(17),s(0),s(2),s(17),s(1),s(3),s(17),s(1)}function p(){l(65499),l(132),s(0);for(var R=0;R<64;R++)s(K[R]);s(1);for(var F=0;F<64;F++)s(it[F])}function c(){l(65476),l(418),s(0);for(var R=0;R<16;R++)s(St[R+1]);for(var F=0;F<=11;F++)s(Et[F]);s(16);for(var E=0;E<16;E++)s(Ft[E+1]);for(var T=0;T<=161;T++)s(Tt[T]);s(1);for(var D=0;D<16;D++)s(At[D+1]);for(var O=0;O<=11;O++)s(Ot[O]);s(17);for(var C=0;C<16;C++)s(Dt[C+1]);for(var P=0;P<=161;P++)s(Ut[P])}function d(){l(65498),l(12),s(3),s(1),s(0),s(2),s(17),s(3),s(17),s(0),s(63),s(0)}function m(R,F,E,T,D){for(var O,C=D[0],P=D[240],B=y(R,F),H=0;H<64;++H)et[rt[H]]=B[H];var I=et[0]-E;E=et[0],I==0?a(T[0]):(O=32767+I,a(T[ut[O]]),a(J[O]));for(var S=63;S>0&&et[S]==0;S--);if(S==0)return a(C),E;for(var N,L=1;L<=S;){for(var X=L;et[L]==0&&L<=S;++L);var Q=L-X;if(Q>=16){N=Q>>4;for(var V=1;V<=N;++V)a(P);Q&=15}O=32767+et[L],a(D[(Q<<4)+ut[O]]),a(J[O]),L++}return S!=63&&a(C),E}function v(){for(var R=String.fromCharCode,F=0;F<256;F++)kt[F]=R(F)}function b(R){if(R<=0&&(R=1),R>100&&(R=100),$!=R){var F=0;F=R<50?Math.floor(5e3/R):Math.floor(200-2*R),t(F),$=R}}var U,q,z,j,$,tt=Math.floor,K=new Array(64),it=new Array(64),_t=new Array(64),gt=new Array(64),J=new Array(65535),ut=new Array(65535),yt=new Array(64),et=new Array(64),ct=[],nt=0,W=7,wt=new Array(64),xt=new Array(64),Rt=new Array(64),kt=new Array(256),M=new Array(2048),rt=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],St=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],Et=[0,1,2,3,4,5,6,7,8,9,10,11],Ft=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],Tt=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],At=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],Ot=[0,1,2,3,4,5,6,7,8,9,10,11],Dt=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Ut=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(R,F){F&&b(F),ct=new Array,nt=0,W=7,l(65496),x(),p(),w(R.width,R.height),c(),d();var E=0,T=0,D=0;nt=0,W=7,this.encode.displayName="_encode_";for(var O,C,P,B,H,I,S,N,L,X=R.data,Q=R.width,V=R.height,G=4*Q,Z=0;Z<V;){for(O=0;O<G;){for(H=G*Z+O,I=H,S=-1,N=0,L=0;L<64;L++)N=L>>3,S=4*(7&L),I=H+N*G+S,Z+N>=V&&(I-=G*(Z+1+N-V)),O+S>=G&&(I-=O+S-G+4),C=X[I++],P=X[I++],B=X[I++],wt[L]=(M[C]+M[P+256>>0]+M[B+512>>0]>>16)-128,xt[L]=(M[C+768>>0]+M[P+1024>>0]+M[B+1280>>0]>>16)-128,Rt[L]=(M[C+1280>>0]+M[P+1536>>0]+M[B+1792>>0]>>16)-128;E=m(wt,_t,E,U,z),T=m(xt,gt,T,q,j),D=m(Rt,gt,D,q,j),O+=32}Z+=8}if(W>=0){var ot=[];ot[1]=W+1,ot[0]=(1<<W+1)-1,a(ot)}l(65497);var Y="data:image/jpeg;base64,"+btoa(ct.join(""));return ct=[],Y},function(){o||(o=50),v(),i(),e(),n(),b(o)}()}return u.encode=function(o,t){return new u(t).encode(o)},u}),k("runtime/html5/androidpatch",["runtime/html5/util","runtime/html5/jpegencoder","base"],function(f,g,h){var u,o=f.canvasToDataUrl;f.canvasToDataUrl=function(t,r,i){var e,n,a,s,l;return h.os.android?(r==="image/jpeg"&&u===void 0&&(s=o.apply(null,arguments),l=s.split(","),s=~l[0].indexOf("base64")?atob(l[1]):decodeURIComponent(l[1]),s=s.substring(0,2),u=s.charCodeAt(0)===255&&s.charCodeAt(1)===216),r!=="image/jpeg"||u?o.apply(null,arguments):(n=t.width,a=t.height,e=t.getContext("2d"),g.encode(e.getImageData(0,0,n,a),i))):o.apply(null,arguments)}}),k("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(f,g,h){return g.register("Image",{modified:!1,init:function(){var u=this,o=new Image;o.onload=function(){u._info={type:u.type,width:this.width,height:this.height},u._metas||u.type!=="image/jpeg"?u.owner.trigger("load"):h.parseMeta(u._blob,function(t,r){u._metas=r,u.owner.trigger("load")})},o.onerror=function(){u.owner.trigger("error")},u._img=o},loadFromBlob:function(u){var o=this,t=o._img;o._blob=u,o.type=u.type,t.src=h.createObjectURL(u.getSource()),o.owner.once("load",function(){h.revokeObjectURL(t.src)})},resize:function(u,o){var t=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,t,u,o),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(u,o,t,r,i){var e=this._canvas||(this._canvas=document.createElement("canvas")),n=this.options,a=this._img,s=a.naturalWidth,l=a.naturalHeight,y=this.getOrientation();i=i||1,e.width=t,e.height=r,n.preserveHeaders||this._rotate2Orientaion(e,y),this._renderImageToCanvas(e,a,-u,-o,s*i,l*i),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(u){var o,t=this._blob,r=this.options;if(u=u||this.type,this.modified||this.type!==u){if(o=this._canvas,u==="image/jpeg"){if(t=h.canvasToDataUrl(o,u,r.quality),r.preserveHeaders&&this._metas&&this._metas.imageHead)return t=h.dataURL2ArrayBuffer(t),t=h.updateImageHead(t,this._metas.imageHead),t=h.arrayBufferToBlob(t,u)}else t=h.canvasToDataUrl(o,u);t=h.dataURL2Blob(t)}return t},getAsDataUrl:function(u){var o=this.options;return u=u||this.type,u==="image/jpeg"?h.canvasToDataUrl(this._canvas,u,o.quality):this._canvas.toDataURL(u)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(u){return u?(this._info=u,this):this._info},meta:function(u){return u?(this._metas=u,this):this._metas},destroy:function(){var u=this._canvas;this._img.onload=null,u&&(u.getContext("2d").clearRect(0,0,u.width,u.height),u.width=u.height=0,this._canvas=null),this._img.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D",this._img=this._blob=null},_resize:function(u,o,t,r){var i,e,n,a,s,l=this.options,y=u.width,x=u.height,w=this.getOrientation();~[5,6,7,8].indexOf(w)&&(t^=r,r^=t,t^=r),i=Math[l.crop?"max":"min"](t/y,r/x),l.allowMagnify||(i=Math.min(1,i)),e=y*i,n=x*i,l.crop?(o.width=t,o.height=r):(o.width=e,o.height=n),a=(o.width-e)/2,s=(o.height-n)/2,l.preserveHeaders||this._rotate2Orientaion(o,w),this._renderImageToCanvas(o,u,a,s,e,n)},_rotate2Orientaion:function(u,o){var t=u.width,r=u.height,i=u.getContext("2d");switch(o){case 5:case 6:case 7:case 8:u.width=r,u.height=t}switch(o){case 2:i.translate(t,0),i.scale(-1,1);break;case 3:i.translate(t,r),i.rotate(Math.PI);break;case 4:i.translate(0,r),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-r);break;case 7:i.rotate(.5*Math.PI),i.translate(t,-r),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-t,0)}},_renderImageToCanvas:function(){function u(t,r,i){var e,n,a,s=document.createElement("canvas"),l=s.getContext("2d"),y=0,x=i,w=i;for(s.width=1,s.height=i,l.drawImage(t,0,0),e=l.getImageData(0,0,1,i).data;w>y;)n=e[4*(w-1)+3],n===0?x=w:y=w,w=x+y>>1;return a=w/i,a===0?1:a}function o(t){var r,i,e=t.naturalWidth,n=t.naturalHeight;return e*n>1048576&&(r=document.createElement("canvas"),r.width=r.height=1,i=r.getContext("2d"),i.drawImage(t,1-e,0),i.getImageData(0,0,1,1).data[3]===0)}return f.os.ios?f.os.ios>=7?function(t,r,i,e,n,a){var s=r.naturalWidth,l=r.naturalHeight,y=u(r,s,l);return t.getContext("2d").drawImage(r,0,0,s*y,l*y,i,e,n,a)}:function(t,r,i,e,n,a){var s,l,y,x,w,p,c,d=r.naturalWidth,m=r.naturalHeight,v=t.getContext("2d"),b=o(r),U=this.type==="image/jpeg",q=1024,z=0,j=0;for(b&&(d/=2,m/=2),v.save(),s=document.createElement("canvas"),s.width=s.height=q,l=s.getContext("2d"),y=U?u(r,d,m):1,x=Math.ceil(q*n/d),w=Math.ceil(q*a/m/y);z<m;){for(p=0,c=0;p<d;)l.clearRect(0,0,q,q),l.drawImage(r,-p,-z),v.drawImage(s,0,0,q,q,i+c,e+j,x,w),p+=q,c+=x;z+=q,j+=w}v.restore(),s=l=null}:function(t){var r=f.slice(arguments,1),i=t.getContext("2d");i.drawImage.apply(i,r)}}()})}),k("runtime/html5/transport",["base","runtime/html5/runtime"],function(f,g){var h=f.noop,u=f.$;return g.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var o,t,r,i=this.owner,e=this.options,n=this._initAjax(),a=i._blob,s=e.server+"?randomnum="+new Date().getTime();e.sendAsBinary?(s+=e.attachInfoToQuery!==!1?(/\?/.test(s)?"&":"?")+u.param(i._formData):"",t=a.getSource()):(o=new FormData,u.each(i._formData,function(l,y){o.append(l,y)}),o.append(e.fileVal,a.getSource(),e.filename||i._formData.name||"")),e.withCredentials&&"withCredentials"in n?(n.open(e.method,s,!0),n.withCredentials=!0):n.open(e.method,s),this._setRequestHeader(n,e.headers),t?(n.overrideMimeType&&n.overrideMimeType("application/octet-stream"),f.os.android?(r=new FileReader,r.onload=function(){n.send(this.result),r=r.onload=null},r.readAsArrayBuffer(t)):n.send(t)):n.send(o)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getResponseHeaders:function(){return this._headers},getStatus:function(){return this._status},abort:function(){var o=this._xhr;o&&(o.upload.onprogress=h,o.onreadystatechange=h,o.abort(),this._xhr=o=null)},destroy:function(){this.abort()},_parseHeader:function(o){var t={};return o&&o.replace(/^([^\:]+):(.*)$/gm,function(r,i,e){t[i.trim()]=e.trim()}),t},_initAjax:function(){var o=this,t=new XMLHttpRequest,r=this.owner,i=this.options;return!this.options.withCredentials||"withCredentials"in t||typeof XDomainRequest=="undefined"||(t=new XDomainRequest),t.upload.onprogress=function(e){var n=0;return e.lengthComputable&&(n=e.loaded/e.total),o.trigger("progress",n)},t.onabort=function(e){},t.ontimeout=function(e){},t.onerror=function(e){var n=e.target},t.onreadystatechange=function(){if(t.readyState===4){t.upload.onprogress=h,t.onreadystatechange=h,o._xhr=null,o._status=t.status;var e="|"+t.status+"|"+t.statusText;return o._response=t.responseText,o._headers=o._parseHeader(t.getAllResponseHeaders()),t.status>=200&&t.status<300?o.trigger("load"):t.status>=500&&t.status<600?o.trigger("error","server"+e):o.trigger("error",o._status?"http"+e:"abort")}},o._xhr=t,t},_setRequestHeader:function(o,t){u.each(t,function(r,i){o.setRequestHeader(r,i)})},_parseJson:function(o){var t;try{t=JSON.parse(o)}catch(r){t={}}return t}})}),k("runtime/html5/md5",["runtime/html5/runtime"],function(f){var g=function(p,c){return p+c&4294967295},h=function(p,c,d,m,v,b){return c=g(g(c,p),g(m,b)),g(c<<v|c>>>32-v,d)},u=function(p,c,d,m,v,b,U){return h(c&d|~c&m,p,c,v,b,U)},o=function(p,c,d,m,v,b,U){return h(c&m|d&~m,p,c,v,b,U)},t=function(p,c,d,m,v,b,U){return h(c^d^m,p,c,v,b,U)},r=function(p,c,d,m,v,b,U){return h(d^(c|~m),p,c,v,b,U)},i=function(p,c){var d=p[0],m=p[1],v=p[2],b=p[3];d=u(d,m,v,b,c[0],7,-680876936),b=u(b,d,m,v,c[1],12,-389564586),v=u(v,b,d,m,c[2],17,606105819),m=u(m,v,b,d,c[3],22,-1044525330),d=u(d,m,v,b,c[4],7,-176418897),b=u(b,d,m,v,c[5],12,1200080426),v=u(v,b,d,m,c[6],17,-1473231341),m=u(m,v,b,d,c[7],22,-45705983),d=u(d,m,v,b,c[8],7,1770035416),b=u(b,d,m,v,c[9],12,-1958414417),v=u(v,b,d,m,c[10],17,-42063),m=u(m,v,b,d,c[11],22,-1990404162),d=u(d,m,v,b,c[12],7,1804603682),b=u(b,d,m,v,c[13],12,-40341101),v=u(v,b,d,m,c[14],17,-1502002290),m=u(m,v,b,d,c[15],22,1236535329),d=o(d,m,v,b,c[1],5,-165796510),b=o(b,d,m,v,c[6],9,-1069501632),v=o(v,b,d,m,c[11],14,643717713),m=o(m,v,b,d,c[0],20,-373897302),d=o(d,m,v,b,c[5],5,-701558691),b=o(b,d,m,v,c[10],9,38016083),v=o(v,b,d,m,c[15],14,-660478335),m=o(m,v,b,d,c[4],20,-405537848),d=o(d,m,v,b,c[9],5,568446438),b=o(b,d,m,v,c[14],9,-1019803690),v=o(v,b,d,m,c[3],14,-187363961),m=o(m,v,b,d,c[8],20,1163531501),d=o(d,m,v,b,c[13],5,-1444681467),b=o(b,d,m,v,c[2],9,-51403784),v=o(v,b,d,m,c[7],14,1735328473),m=o(m,v,b,d,c[12],20,-1926607734),d=t(d,m,v,b,c[5],4,-378558),b=t(b,d,m,v,c[8],11,-2022574463),v=t(v,b,d,m,c[11],16,1839030562),m=t(m,v,b,d,c[14],23,-35309556),d=t(d,m,v,b,c[1],4,-1530992060),b=t(b,d,m,v,c[4],11,1272893353),v=t(v,b,d,m,c[7],16,-155497632),m=t(m,v,b,d,c[10],23,-1094730640),d=t(d,m,v,b,c[13],4,681279174),b=t(b,d,m,v,c[0],11,-358537222),v=t(v,b,d,m,c[3],16,-722521979),m=t(m,v,b,d,c[6],23,76029189),d=t(d,m,v,b,c[9],4,-640364487),b=t(b,d,m,v,c[12],11,-421815835),v=t(v,b,d,m,c[15],16,530742520),m=t(m,v,b,d,c[2],23,-995338651),d=r(d,m,v,b,c[0],6,-198630844),b=r(b,d,m,v,c[7],10,1126891415),v=r(v,b,d,m,c[14],15,-1416354905),m=r(m,v,b,d,c[5],21,-57434055),d=r(d,m,v,b,c[12],6,1700485571),b=r(b,d,m,v,c[3],10,-1894986606),v=r(v,b,d,m,c[10],15,-1051523),m=r(m,v,b,d,c[1],21,-2054922799),d=r(d,m,v,b,c[8],6,1873313359),b=r(b,d,m,v,c[15],10,-30611744),v=r(v,b,d,m,c[6],15,-1560198380),m=r(m,v,b,d,c[13],21,1309151649),d=r(d,m,v,b,c[4],6,-145523070),b=r(b,d,m,v,c[11],10,-1120210379),v=r(v,b,d,m,c[2],15,718787259),m=r(m,v,b,d,c[9],21,-343485551),p[0]=g(d,p[0]),p[1]=g(m,p[1]),p[2]=g(v,p[2]),p[3]=g(b,p[3])},e=function(p){var c,d=[];for(c=0;c<64;c+=4)d[c>>2]=p.charCodeAt(c)+(p.charCodeAt(c+1)<<8)+(p.charCodeAt(c+2)<<16)+(p.charCodeAt(c+3)<<24);return d},n=function(p){var c,d=[];for(c=0;c<64;c+=4)d[c>>2]=p[c]+(p[c+1]<<8)+(p[c+2]<<16)+(p[c+3]<<24);return d},a=function(p){var c,d,m,v,b,U,q=p.length,z=[1732584193,-271733879,-1732584194,271733878];for(c=64;c<=q;c+=64)i(z,e(p.substring(c-64,c)));for(p=p.substring(c-64),d=p.length,m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0;c<d;c+=1)m[c>>2]|=p.charCodeAt(c)<<(c%4<<3);if(m[c>>2]|=128<<(c%4<<3),c>55)for(i(z,m),c=0;c<16;c+=1)m[c]=0;return v=8*q,v=v.toString(16).match(/(.*?)(.{0,8})$/),b=parseInt(v[2],16),U=parseInt(v[1],16)||0,m[14]=b,m[15]=U,i(z,m),z},s=function(p){var c,d,m,v,b,U,q=p.length,z=[1732584193,-271733879,-1732584194,271733878];for(c=64;c<=q;c+=64)i(z,n(p.subarray(c-64,c)));for(p=c-64<q?p.subarray(c-64):new Uint8Array(0),d=p.length,m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0;c<d;c+=1)m[c>>2]|=p[c]<<(c%4<<3);if(m[c>>2]|=128<<(c%4<<3),c>55)for(i(z,m),c=0;c<16;c+=1)m[c]=0;return v=8*q,v=v.toString(16).match(/(.*?)(.{0,8})$/),b=parseInt(v[2],16),U=parseInt(v[1],16)||0,m[14]=b,m[15]=U,i(z,m),z},l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],y=function(p){var c,d="";for(c=0;c<4;c+=1)d+=l[p>>8*c+4&15]+l[p>>8*c&15];return d},x=function(p){var c;for(c=0;c<p.length;c+=1)p[c]=y(p[c]);return p.join("")},w=function(){this.reset()};return function(p){return x(a(p))}("hello")!=="5d41402abc4b2a76b9719d911017c592"&&(g=function(p,c){var d=(65535&p)+(65535&c);return(p>>16)+(c>>16)+(d>>16)<<16|65535&d}),w.prototype.append=function(p){return/[\u0080-\uFFFF]/.test(p)&&(p=unescape(encodeURIComponent(p))),this.appendBinary(p),this},w.prototype.appendBinary=function(p){this._buff+=p,this._length+=p.length;var c,d=this._buff.length;for(c=64;c<=d;c+=64)i(this._state,e(this._buff.substring(c-64,c)));return this._buff=this._buff.substr(c-64),this},w.prototype.end=function(p){var c,d,m=this._buff,v=m.length,b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(c=0;c<v;c+=1)b[c>>2]|=m.charCodeAt(c)<<(c%4<<3);return this._finish(b,v),d=p?this._state:x(this._state),this.reset(),d},w.prototype._finish=function(p,c){var d,m,v,b=c;if(p[b>>2]|=128<<(b%4<<3),b>55)for(i(this._state,p),b=0;b<16;b+=1)p[b]=0;d=8*this._length,d=d.toString(16).match(/(.*?)(.{0,8})$/),m=parseInt(d[2],16),v=parseInt(d[1],16)||0,p[14]=m,p[15]=v,i(this._state,p)},w.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},w.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},w.hash=function(p,c){/[\u0080-\uFFFF]/.test(p)&&(p=unescape(encodeURIComponent(p)));var d=a(p);return c?d:x(d)},w.hashBinary=function(p,c){var d=a(p);return c?d:x(d)},w.ArrayBuffer=function(){this.reset()},w.ArrayBuffer.prototype.append=function(p){var c,d=this._concatArrayBuffer(this._buff,p),m=d.length;for(this._length+=p.byteLength,c=64;c<=m;c+=64)i(this._state,n(d.subarray(c-64,c)));return this._buff=c-64<m?d.subarray(c-64):new Uint8Array(0),this},w.ArrayBuffer.prototype.end=function(p){var c,d,m=this._buff,v=m.length,b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(c=0;c<v;c+=1)b[c>>2]|=m[c]<<(c%4<<3);return this._finish(b,v),d=p?this._state:x(this._state),this.reset(),d},w.ArrayBuffer.prototype._finish=w.prototype._finish,w.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},w.ArrayBuffer.prototype.destroy=w.prototype.destroy,w.ArrayBuffer.prototype._concatArrayBuffer=function(p,c){var d=p.length,m=new Uint8Array(d+c.byteLength);return m.set(p),m.set(new Uint8Array(c),d),m},w.ArrayBuffer.hash=function(p,c){var d=s(new Uint8Array(p));return c?d:x(d)},f.register("Md5",{init:function(){},loadFromBlob:function(p){var c=p.getSource(),d=2*1024*1024,m=Math.ceil(c.size/d),v=0,b=this.owner,U=new w.ArrayBuffer,q=this,z=c.mozSlice||c.webkitSlice||c.slice,j,$;$=new FileReader,j=function(){var tt,K;tt=v*d,K=Math.min(tt+d,c.size),$.onload=function(it){U.append(it.target.result),b.trigger("progress",{total:p.size,loaded:K})},$.onloadend=function(){$.onloadend=$.onload=null,++v<m?setTimeout(j,1):setTimeout(function(){b.trigger("load"),q.result=U.end(),j=p=c=U=null,b.trigger("complete")},50)},$.readAsArrayBuffer(z.call(c,tt,K))},j()},getResult:function(){return this.result}})}),k("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(f,g,h){function u(){function i(y,x){var w,p,c=y.type||y;w=c.split("::"),p=w[0],c=w[1],c==="Ready"&&p===s.uid?s.trigger("ready"):n[p]&&n[p].trigger(c.toLowerCase(),y,x)}var e={},n={},a=this.destroy,s=this,l=f.guid("webuploader_");g.apply(s,arguments),s.type=t,s.exec=function(y,x){var w,p=this,c=p.uid,d=f.slice(arguments,2);return n[c]=p,r[y]&&(e[c]||(e[c]=new r[y](p,s)),w=e[c],w[x])?w[x].apply(w,d):s.flashExec.apply(p,arguments)},A[l]=function(){var y=arguments;setTimeout(function(){i.apply(null,y)},1)},this.jsreciver=l,this.destroy=function(){return a&&a.apply(this,arguments)},this.flashExec=function(y,x){var w=s.getFlash(),p=f.slice(arguments,2);return w.exec(this.uid,y,x,p)}}var o=f.$,t="flash",r={};return f.inherits(g,{constructor:u,init:function(){var i,e=this.getContainer(),n=this.options;e.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+n.swf+'" ',f.browser.ie&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+n.swf+'" /><param name="flashvars" value="uid='+this.uid+"&jsreciver="+this.jsreciver+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',e.html(i)},getFlash:function(){return this._flash?this._flash:(this._flash=o("#"+this.uid).get(0),this._flash)}}),u.register=function(i,e){return e=r[i]=f.inherits(h,o.extend({flashExec:function(){var n=this.owner;return this.getRuntime().flashExec.apply(n,arguments)}},e))},function(){var i;try{i=navigator.plugins["Shockwave Flash"],i=i.description}catch(e){try{i=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){i="0.0"}}return i=i.match(/\d+/g),parseFloat(i[0]+"."+i[1],10)}()>=11.4&&g.addRuntime(t,u),u}),k("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(f,g){var h=f.$;return g.register("FilePicker",{init:function(u){var o,t,r=h.extend({},u);for(o=r.accept&&r.accept.length,t=0;t<o;t++)r.accept[t].title||(r.accept[t].title="Files");delete r.button,delete r.id,delete r.container,this.flashExec("FilePicker","init",r)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),k("runtime/flash/image",["runtime/flash/runtime"],function(f){return f.register("Image",{loadFromBlob:function(g){var h=this.owner;h.info()&&this.flashExec("Image","info",h.info()),h.meta()&&this.flashExec("Image","meta",h.meta()),this.flashExec("Image","loadFromBlob",g.uid)}})}),k("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(f,g,h){var u=f.$;return g.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var o,t=this.owner,r=this.options,i=this._initAjax(),e=t._blob,n=r.server;i.connectRuntime(e.ruid),r.sendAsBinary?(n+=(/\?/.test(n)?"&":"?")+u.param(t._formData),o=e.uid):(u.each(t._formData,function(a,s){i.exec("append",a,s)}),i.exec("appendBlob",r.fileVal,e.uid,r.filename||t._formData.name||"")),this._setRequestHeader(i,r.headers),i.exec("send",{method:r.method,url:n,forceURLStream:r.forceURLStream,mimeType:"application/octet-stream"},o)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},getResponseHeaders:function(){return{}},abort:function(){var o=this._xhr;o&&(o.exec("abort"),o.destroy(),this._xhr=o=null)},destroy:function(){this.abort()},_initAjax:function(){var o=this,t=new h("XMLHttpRequest");return t.on("uploadprogress progress",function(r){var i=r.loaded/r.total;return i=Math.min(1,Math.max(0,i)),o.trigger("progress",i)}),t.on("load",function(){var r,i=t.exec("getStatus"),e=!1,n="";return t.off(),o._xhr=null,i>=200&&i<300?e=!0:i>=500&&i<600?(e=!0,n="server-"+i):n="http-"+i,e&&(o._response=t.exec("getResponse"),o._response=decodeURIComponent(o._response),r=function(a){try{return A.JSON&&A.JSON.parse?JSON.parse(a):new Function("return "+a).call()}catch(s){return{}}},o._responseJson=o._response?r(o._response):{}),t.destroy(),t=null,n?o.trigger("error",n):o.trigger("load")}),t.on("error",function(){var r=t.exec("getStatus"),i=r?"http-"+r:"http";t.off(),o._xhr=null,o.trigger("error",i)}),o._xhr=t,t},_setRequestHeader:function(o,t){u.each(t,function(r,i){o.exec("setRequestHeader",r,i)})}})}),k("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(f,g){return f.register("Blob",{slice:function(h,u){var o=this.flashExec("Blob","slice",h,u);return new g(this.getRuid(),o)}})}),k("runtime/flash/md5",["runtime/flash/runtime"],function(f){return f.register("Md5",{init:function(){},loadFromBlob:function(g){return this.flashExec("Md5","loadFromBlob",g.uid)}})}),k("preset/all",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","widgets/md5","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/androidpatch","runtime/html5/image","runtime/html5/transport","runtime/html5/md5","runtime/flash/filepicker","runtime/flash/image","runtime/flash/transport","runtime/flash/blob","runtime/flash/md5"],function(f){return f}),k("widgets/log",["base","uploader","widgets/widget"],function(f,g){function h(e){var n=o.extend({},u,e),a=t.replace(/^(.*)\?/,"$1"+o.param(n));new Image().src=a}var u,o=f.$,t=" http://static.tieba.baidu.com/tb/pms/img/st.gif??",r=(location.hostname||location.host||"protected").toLowerCase(),i=r&&/baidu/i.exec(r);if(i)return u={dv:3,master:"webuploader",online:/test/.exec(r)?0:1,module:"",product:r,type:0},g.register({name:"log",init:function(){var e=this.owner,n=0,a=0;e.on("error",function(s){h({type:2,c_error_code:s})}).on("uploadError",function(s,l){h({type:2,c_error_code:"UPLOAD_ERROR",c_reason:""+l})}).on("uploadComplete",function(s){n++,a+=s.size}).on("uploadFinished",function(){h({c_count:n,c_size:a}),n=a=0}),h({c_usage:1})}})}),k("webuploader",["preset/all","widgets/log"],function(f){return f}),st("webuploader")});