text: !function(n){function o(e,t){var n,i,r;if("string"==typeof e)return s(e);for(n=[],i=e.length,r=0;r<i;r++)n.push(s(e[r]));return t.apply(null,n)}function t(e,t,n){2===arguments.length&&(n=t,t=null),o(t||[],function(){r(e,n,arguments)})}function e(e){return n.__dollar=e,function(e){var t,n,i,r,o,s;for(t in s=function(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)},a)if(n=e,a.hasOwnProperty(t)){for(o=s((i=t.split("/")).pop());r=s(i.shift());)n[r]=n[r]||{},n=n[r];n[o]=a[t]}return e}(function(_,e,t){return e("dollar-third",[],function(){var e=_.__dollar||_.jQuery||_.Zepto;if(!e)throw new Error("jQuery or Zepto not found!");return e}),e("dollar",["dollar-third"],function(e){return e}),e("promise-third",["dollar"],function(e){return{Deferred:e.Deferred,when:e.when,isPromise:function(e){return e&&"function"==typeof e.then}}}),e("promise",["promise-third"],function(e){return e}),e("base",["dollar","promise"],function(r,e){function t(){}var i,n,o,s,a,u,c,l,f,h,d,p,g,m,v=Function.call;function b(e,t){return function(){return e.apply(t,arguments)}}return{version:"0.1.5",$:r,Deferred:e.Deferred,isPromise:e.isPromise,when:e.when,browser:(c=navigator.userAgent,l={},f=c.match(/WebKit\/([\d.]+)/),h=c.match(/Chrome\/([\d.]+)/)||c.match(/CriOS\/([\d.]+)/),d=c.match(/MSIE\s([\d\.]+)/)||c.match(/(?:trident)(?:.*rv:([\w.]+))?/i),p=c.match(/Firefox\/([\d.]+)/),g=c.match(/Safari\/([\d.]+)/),m=c.match(/OPR\/([\d.]+)/),f&&(l.webkit=parseFloat(f[1])),h&&(l.chrome=parseFloat(h[1])),d&&(l.ie=parseFloat(d[1])),p&&(l.firefox=parseFloat(p[1])),g&&(l.safari=parseFloat(g[1])),m&&(l.opera=parseFloat(m[1])),l),os:(o=navigator.userAgent,s={},a=o.match(/(?:Android);?[\s\/]+([\d.]+)?/),u=o.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/),a&&(s.android=parseFloat(a[1])),u&&(s.ios=parseFloat(u[1].replace(/_/g,"."))),s),inherits:function(e,t,n){var i;return"function"==typeof t?(i=t,t=null):i=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},r.extend(!0,i,e,n||{}),i.__super__=e.prototype,i.prototype=function(e){var t;return Object.create?Object.create(e):((t=function(){}).prototype=e,new t)}(e.prototype),t&&r.extend(!0,i.prototype,t),i},noop:t,bindFn:b,log:_.console?b(console.log,console):t,nextTick:function(e){setTimeout(e,1)},slice:(n=[].slice,function(){return v.apply(n,arguments)}),guid:(i=0,function(e){for(var t=(+new Date).toString(32),n=0;n<5;n++)t+=Math.floor(65535*Math.random()).toString(32);return(e||"wu_")+t+(i++).toString(32)}),formatSize:function(e,t,n){var i;for(n=n||["B","K","M","G","TB"];(i=n.shift())&&1024<e;)e/=1024;return("B"===i?e:e.toFixed(t||2))+i}}}),e("mediator",["base"],function(e){var t,r=e.$,o=[].slice,s=/\s+/;function a(e,t,n,i){return r.grep(e,function(e){return e&&(!t||e.e===t)&&(!n||e.cb===n||e.cb._cb===n)&&(!i||e.ctx===i)})}function u(e,n,i){r.each((e||"").split(s),function(e,t){i(t,n)})}function c(e,t){for(var n,i=!1,r=-1,o=e.length;++r<o;)if(!1===(n=e[r]).cb.apply(n.ctx2,t)){i=!0;break}return!i}return t={on:function(e,t,i){var r,o=this;return t&&(r=this._events||(this._events=[]),u(e,t,function(e,t){var n={e:e};n.cb=t,n.ctx=i,n.ctx2=i||o,n.id=r.length,r.push(n)})),this},once:function(e,t,i){var r=this;return t&&u(e,t,function(e,t){var n=function(){return r.off(e,n),t.apply(i||r,arguments)};n._cb=t,r.on(e,n,i)}),r},off:function(e,t,n){var i=this._events;return i&&(e||t||n?u(e,t,function(e,t){r.each(a(i,e,t,n),function(){delete i[this.id]})}):this._events=[]),this},trigger:function(e){var t,n,i;return this._events&&e?(t=o.call(arguments,1),n=a(this._events,e),i=a(this._events,"all"),c(n,t)&&c(i,arguments)):this}},r.extend({installTo:function(e){return r.extend(e,t)}},t)}),e("uploader",["base","mediator"],function(e,r){var o=e.$;function n(e){this.options=o.extend(!0,{},n.options,e),this._init(this.options)}return n.options={},r.installTo(n.prototype),o.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",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(e,t){n.prototype[e]=function(){return this.request(t,arguments)}}),o.extend(n.prototype,{state:"pending",_init:function(e){var t=this;t.request("init",e,function(){t.state="ready",t.trigger("ready")})},option:function(e,t){var n=this.options;if(!(1<arguments.length))return e?n[e]:n;o.isPlainObject(t)&&o.isPlainObject(n[e])?o.extend(n[e],t):n[e]=t},getStats:function(){var e=this.request("get-stats");return e?{successNum:e.numOfSuccess,progressNum:e.numOfProgress,cancelNum:e.numOfCancel,invalidNum:e.numOfInvalid,uploadFailNum:e.numOfUploadFailed,queueNum:e.numOfQueue,interruptNum:e.numofInterrupt}:{}},trigger:function(e){var t=[].slice.call(arguments,1),n=this.options,i="on"+e.substring(0,1).toUpperCase()+e.substring(1);return!(!1===r.trigger.apply(this,arguments)||o.isFunction(n[i])&&!1===n[i].apply(this,t)||o.isFunction(this[i])&&!1===this[i].apply(this,t)||!1===r.trigger.apply(r,[this,e].concat(t)))},destroy:function(){this.request("destroy",arguments),this.off()},request:e.noop}),e.create=n.create=function(e){return new n(e)},e.Uploader=n}),e("runtime/runtime",["base","mediator"],function(t,e){function i(e){for(var t in e)if(e.hasOwnProperty(t))return t;return null}var r=t.$,o={};function s(e){this.options=r.extend({container:document.body},e),this.uid=t.guid("rt_")}return r.extend(s.prototype,{getContainer:function(){var e,t,n=this.options;return this._container?this._container:(e=r(n.container||document.body),(t=r(document.createElement("div"))).attr("id","rt_"+this.uid),t.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.append(t),e.addClass("webuploader-container"),this._container=t,this._parent=e,t)},init:t.noop,exec:t.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),s.orders="html5,flash",s.addRuntime=function(e,t){o[e]=t},s.hasRuntime=function(e){return!!(e?o[e]:i(o))},s.create=function(e,t){var n;if(t=t||s.orders,r.each(t.split(/\s*,\s*/g),function(){if(o[this])return n=this,!1}),!(n=n||i(o)))throw new Error("Runtime Error");return new o[n](e)},e.installTo(s.prototype),s}),e("runtime/client",["base","mediator","runtime/runtime"],function(o,e,s){var a,i;function t(t,n){var i,e,r=o.Deferred();this.uid=o.guid("client_"),this.runtimeReady=function(e){return r.done(e)},this.connectRuntime=function(e,t){if(i)throw new Error("already connected!");return r.done(t),"string"==typeof e&&a.get(e)&&(i=a.get(e)),(i=i||a.get(null,n))?(o.$.extend(i.options,e),i.__promise.then(r.resolve),i.__client++):((i=s.create(e,e.runtimeOrder)).__promise=r.promise(),i.once("ready",r.resolve),i.init(),a.add(i),i.__client=1),n&&(i.__standalone=n),i},this.getRuntime=function(){return i},this.disconnectRuntime=function(){i&&(i.__client--,i.__client<=0&&(a.remove(i),delete i.__promise,i.destroy()),i=null)},this.exec=function(){if(i){var e=o.slice(arguments);return t&&e.unshift(t),i.exec.apply(this,e)}},this.getRuid=function(){return i&&i.uid},this.destroy=(e=this.destroy,function(){e&&e.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()})}return i={},a={add:function(e){i[e.uid]=e},get:function(e,t){var n;if(e)return i[e];for(n in i)if(!t||!i[n].__standalone)return i[n];return null},remove:function(e){delete i[e.uid]}},e.installTo(t.prototype),t}),e("lib/dnd",["base","mediator","runtime/client"],function(e,t,n){var i=e.$;function r(e){(e=this.options=i.extend({},r.options,e)).container=i(e.container),e.container.length&&n.call(this,"DragAndDrop")}return r.options={accept:null,disableGlobalDnd:!1},e.inherits(n,{constructor:r,init:function(){var e=this;e.connectRuntime(e.options,function(){e.exec("init"),e.trigger("ready")})}}),t.installTo(r.prototype),r}),e("widgets/widget",["base","uploader"],function(f,e){var h=f.$,t=e.prototype._init,n=e.prototype.destroy,d={},o=[];function r(e){this.owner=e,this.options=e.options}return h.extend(r.prototype,{init:f.noop,invoke:function(e,t){var n=this.responseMap;return n&&e in n&&n[e]in this&&h.isFunction(this[n[e]])?this[n[e]].apply(this,t):d},request:function(){return this.owner.request.apply(this.owner,arguments)}}),h.extend(e.prototype,{_init:function(){var n=this,i=n._widgets=[],r=n.options.disableWidgets||"";return h.each(o,function(e,t){r&&~r.indexOf(t._name)||i.push(new t(n))}),t.apply(n,arguments)},request:function(e,t,n){var i,r,o,s=0,a=this._widgets,u=a&&a.length,c=[],l=[];for(t=function(e){if(!e)return!1;var t=e.length,n=h.type(e);return!(1!==e.nodeType||!t)||("array"===n||"function"!==n&&"string"!==n&&(0===t||"number"==typeof t&&0<t&&t-1 in e))}(t)?t:[t];s<u;s++)(i=a[s].invoke(e,t))!==d&&(f.isPromise(i)?l.push(i):c.push(i));return n||l.length?(r=f.when.apply(f,l))[o=r.pipe?"pipe":"then"](function(){var e=f.Deferred(),t=arguments;return 1===t.length&&(t=t[0]),setTimeout(function(){e.resolve(t)},1),e.promise()})[n?o:"done"](n||f.noop):c[0]},destroy:function(){n.apply(this,arguments),this._widgets=null}}),e.register=r.register=function(e,t){var n,i={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(t=e,h.each(t,function(e){"_"!==e[0]&&"name"!==e?i[e.replace(/[A-Z]/g,"-$&").toLowerCase()]=e:"name"===e&&(i.name=t.name)})):i=h.extend(i,e),t.responseMap=i,(n=f.inherits(r,t))._name=i.name,o.push(n),n},e.unRegister=r.unRegister=function(e){if(e&&"anonymous"!==e)for(var t=o.length;t--;)o[t]._name===e&&o.splice(t,1)},r}),e("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(o,e,s){var a=o.$;return e.options.dnd="",e.register({name:"dnd",init:function(e){if(e.dnd&&"html5"===this.request("predict-runtime-type")){var t,n=this,i=o.Deferred(),r=a.extend({},{disableGlobalDnd:e.disableGlobalDnd,container:e.dnd,accept:e.accept});return this.dnd=t=new s(r),t.once("ready",i.resolve),t.on("drop",function(e){n.request("add-file",[e])}),t.on("accept",function(e){return n.owner.trigger("dndAccept",e)}),t.init(),i.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),e("lib/filepaste",["base","mediator","runtime/client"],function(e,t,n){var i=e.$;function r(e){(e=this.options=i.extend({},e)).container=i(e.container||document.body),n.call(this,"FilePaste")}return e.inherits(n,{constructor:r,init:function(){var e=this;e.connectRuntime(e.options,function(){e.exec("init"),e.trigger("ready")})}}),t.installTo(r.prototype),r}),e("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(o,e,s){var a=o.$;return e.register({name:"paste",init:function(e){if(e.paste&&"html5"===this.request("predict-runtime-type")){var t,n=this,i=o.Deferred(),r=a.extend({},{container:e.paste,accept:e.accept});return this.paste=t=new s(r),t.once("ready",i.resolve),t.on("paste",function(e){n.owner.request("add-file",[e])}),t.init(),i.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),e("lib/blob",["base","runtime/client"],function(e,n){function t(e,t){this.source=t,this.ruid=e,this.size=t.size||0,!t.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?this.type="image/"+("jpg"===this.ext?"jpeg":this.ext):this.type=t.type||"application/octet-stream",n.call(this,"Blob"),this.uid=t.uid||this.uid,e&&this.connectRuntime(e)}return e.inherits(n,{constructor:t,slice:function(e,t){return this.exec("slice",e,t)},getSource:function(){return this.source}}),t}),e("lib/file",["base","lib/blob"],function(e,i){var r=1,o=/\.([^.]+)$/;return e.inherits(i,function(e,t){var n;this.name=t.name||"untitled"+r++,!(n=o.exec(t.name)?RegExp.$1.toLowerCase():"")&&t.type&&(n=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(t.type)?RegExp.$1.toLowerCase():"",this.name+="."+n),this.ext=n,this.lastModifiedDate=t.lastModifiedDate||(new Date).toLocaleString(),i.apply(this,arguments)})}),e("lib/filepicker",["base","runtime/client","lib/file"],function(e,t,o){var s=e.$;function n(e){if((e=this.options=s.extend({},n.options,e)).container=s(e.id),!e.container.length)throw new Error("按钮指定错误");e.innerHTML=e.innerHTML||e.label||e.container.html()||"",e.button=s(e.button||document.createElement("div")),e.button.html(e.innerHTML),e.container.html(e.button),t.call(this,"FilePicker",!0)}return n.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},e.inherits(t,{constructor:n,init:function(){var n=this,i=n.options,r=i.button;r.addClass("webuploader-pick"),n.on("all",function(e){var t;switch(e){case"mouseenter":r.addClass("webuploader-pick-hover");break;case"mouseleave":r.removeClass("webuploader-pick-hover");break;case"change":t=n.exec("getFiles"),n.trigger("select",s.map(t,function(e){return(e=new o(n.getRuid(),e))._refer=i.container,e}),i.container)}}),n.connectRuntime(i,function(){n.refresh(),n.exec("init",i),n.trigger("ready")}),this._resizeHandler=e.bindFn(this.refresh,this),s(_).on("resize",this._resizeHandler)},refresh:function(){var e=this.getRuntime().getContainer(),t=this.options.button,n=t.outerWidth?t.outerWidth():t.width(),i=t.outerHeight?t.outerHeight():t.height(),r=t.offset();n&&i&&e.css({bottom:"auto",right:"auto",width:n+"px",height:i+"px"}).offset(r)},enable:function(){this.options.button.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var e=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),e.addClass("webuploader-pick-disable")},destroy:function(){var e=this.options.button;s(_).off("resize",this._resizeHandler),e.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),n}),e("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(u,e,c){var l=u.$;return l.extend(e.options,{pick:null,accept:null}),e.register({name:"picker",init:function(e){return this.pickers=[],e.pick&&this.addBtn(e.pick)},refresh:function(){l.each(this.pickers,function(){this.refresh()})},addBtn:function(i){var r=this,o=r.options,s=o.accept,a=[];if(i)return l.isPlainObject(i)||(i={id:i}),l(i.id).each(function(){var e,t,n;n=u.Deferred(),e=l.extend({},i,{accept:l.isPlainObject(s)?[s]:s,swf:o.swf,runtimeOrder:o.runtimeOrder,id:this}),(t=new c(e)).once("ready",n.resolve),t.on("select",function(e){r.owner.request("add-file",[e])}),t.init(),r.pickers.push(t),a.push(n.promise())}),u.when.apply(u,a)},disable:function(){l.each(this.pickers,function(){this.disable()})},enable:function(){l.each(this.pickers,function(){this.enable()})},destroy:function(){l.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),e("lib/image",["base","runtime/client","lib/blob"],function(t,n,i){var r=t.$;function o(e){this.options=r.extend({},o.options,e),n.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}return o.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},t.inherits(n,{constructor:o,info:function(e){return e?(this._info=e,this):this._info},meta:function(e){return e?(this._meta=e,this):this._meta},loadFromBlob:function(e){var t=this,n=e.getRuid();this.connectRuntime(n,function(){t.exec("init",t.options),t.exec("loadFromBlob",e)})},resize:function(){var e=t.slice(arguments);return this.exec.apply(this,["resize"].concat(e))},crop:function(){var e=t.slice(arguments);return this.exec.apply(this,["crop"].concat(e))},getAsDataUrl:function(e){return this.exec("getAsDataUrl",e)},getAsBlob:function(e){var t=this.exec("getAsBlob",e);return new i(this.getRuid(),t)}}),o}),e("widgets/image",["base","uploader","lib/image","widgets/widget"],function(t,e,a){var s,i,r,u=t.$;function o(){for(var e;r.length&&i<5242880;)e=r.shift(),i+=e[0],e[1]()}return i=0,r=[],s=function(e,t,n){r.push([t,n]),e.once("destroy",function(){i-=t,setTimeout(o,1)}),setTimeout(o,1)},u.extend(e.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}}),e.register({name:"image",makeThumb:function(e,t,n,i){var r,o;(e=this.request("get-file",e)).type.match(/^image/)?(r=u.extend({},this.options.thumb),u.isPlainObject(n)&&(r=u.extend(r,n),n=null),n=n||r.width,i=i||r.height,(o=new a(r)).once("load",function(){e._info=e._info||o.info(),e._meta=e._meta||o.meta(),n<=1&&0<n&&(n=e._info.width*n),i<=1&&0<i&&(i=e._info.height*i),o.resize(n,i)}),o.once("complete",function(){t(!1,o.getAsDataUrl(r.type)),o.destroy()}),o.once("error",function(e){t(e||!0),o.destroy()}),s(o,e.source.size,function(){e._info&&o.info(e._info),e._meta&&o.meta(e._meta),o.loadFromBlob(e.source)})):t(!0)},beforeSendFile:function(n){var i,r,o=this.options.compress||this.options.resize,e=o&&o.compressSize||0,s=o&&o.noCompressIfLarger||!1;if(n=this.request("get-file",n),o&&~"image/jpeg,image/jpg".indexOf(n.type)&&!(n.size<e)&&!n._compressed)return o=u.extend({},o),r=t.Deferred(),i=new a(o),r.always(function(){i.destroy(),i=null}),i.once("error",r.reject),i.once("load",function(){var e=o.width,t=o.height;n._info=n._info||i.info(),n._meta=n._meta||i.meta(),e<=1&&0<e&&(e=n._info.width*e),t<=1&&0<t&&(t=n._info.height*t),i.resize(e,t)}),i.once("complete",function(){var e,t;try{e=i.getAsBlob(o.type),t=n.size,(!s||e.size<t)&&(n.source=e,n.size=e.size,n.trigger("resize",e.size,t)),n._compressed=!0,r.resolve()}catch(e){r.resolve()}}),n._info&&i.info(n._info),n._meta&&i.meta(n._meta),i.loadFromBlob(n.source),r.promise()}})}),e("file",["base","mediator"],function(e,t){var n=e.$,i="WU_FILE_",r=0,o=/\.([^.]+)$/,s={};function a(e){this.name=e.name||"Untitled",this.size=e.size||0,this.type=e.type||"application/octet-stream",this.lastModifiedDate=e.lastModifiedDate||1*new Date,this.id=i+r++,this.ext=o.exec(this.name)?RegExp.$1:"",this.statusText="",s[this.id]=a.Status.INITED,this.source=e,this.loaded=0,this.on("error",function(e){this.setStatus(a.Status.ERROR,e)})}return n.extend(a.prototype,{setStatus:function(e,t){var n=s[this.id];void 0!==t&&(this.statusText=t),e!==n&&(s[this.id]=e,this.trigger("statuschange",e,n))},getStatus:function(){return s[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete s[this.id]}}),t.installTo(a.prototype),a.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},a}),e("queue",["base","mediator","file"],function(e,t,n){var o=e.$,r=n.Status;function i(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}return o.extend(i.prototype,{append:function(e){return this._queue.push(e),this._fileAdded(e),this},prepend:function(e){return this._queue.unshift(e),this._fileAdded(e),this},getFile:function(e){return"string"!=typeof e?e:this._map[e]},fetch:function(e){var t,n,i=this._queue.length;for(e=e||r.QUEUED,t=0;t<i;t++)if(e===(n=this._queue[t]).getStatus())return n;return null},sort:function(e){"function"==typeof e&&this._queue.sort(e)},getFiles:function(){for(var e,t=[].slice.call(arguments,0),n=[],i=0,r=this._queue.length;i<r;i++)e=this._queue[i],t.length&&!~o.inArray(e.getStatus(),t)||n.push(e);return n},removeFile:function(e){this._map[e.id]&&(delete this._map[e.id],e.destroy(),this.stats.numofDeleted++)},_fileAdded:function(e){var n=this;this._map[e.id]||(this._map[e.id]=e).on("statuschange",function(e,t){n._onFileStatusChange(e,t)})},_onFileStatusChange:function(e,t){var n=this.stats;switch(t){case r.PROGRESS:n.numOfProgress--;break;case r.QUEUED:n.numOfQueue--;break;case r.ERROR:n.numOfUploadFailed--;break;case r.INVALID:n.numOfInvalid--;break;case r.INTERRUPT:n.numofInterrupt--}switch(e){case r.QUEUED:n.numOfQueue++;break;case r.PROGRESS:n.numOfProgress++;break;case r.ERROR:n.numOfUploadFailed++;break;case r.COMPLETE:n.numOfSuccess++;break;case r.CANCELLED:n.numOfCancel++;break;case r.INVALID:n.numOfInvalid++;break;case r.INTERRUPT:n.numofInterrupt++}}}),t.installTo(i.prototype),i}),e("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(c,e,l,t,n,f){var h=c.$,i=/\.\w+$/,o=t.Status;return e.register({name:"queue",init:function(e){var t,n,i,r,o,s,a,u=this;if(h.isPlainObject(e.accept)&&(e.accept=[e.accept]),e.accept){for(o=[],i=0,n=e.accept.length;i<n;i++)(r=e.accept[i].extensions)&&o.push(r);o.length&&(s="\\."+o.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),u.accept=new RegExp(s,"i")}if(u.queue=new l,u.stats=u.queue.stats,"html5"===this.request("predict-runtime-type"))return t=c.Deferred(),this.placeholder=a=new f("Placeholder"),a.connectRuntime({runtimeOrder:"html5"},function(){u._ruid=a.getRuid(),t.resolve()}),t.promise()},_wrapFile:function(e){if(!(e instanceof t)){if(!(e instanceof n)){if(!this._ruid)throw new Error("Can't add external files.");e=new n(this._ruid,e)}e=new t(e)}return e},acceptFile:function(e){return!(!e||!e.size||this.accept&&i.exec(e.name)&&!this.accept.test(e.name))},_addFile:function(e){var t=this;if(e=t._wrapFile(e),t.owner.trigger("beforeFileQueued",e)){if(t.acceptFile(e))return t.queue.append(e),t.owner.trigger("fileQueued",e),e;t.owner.trigger("error","Q_TYPE_DENIED",e)}},getFile:function(e){return this.queue.getFile(e)},addFile:function(e){var t=this;e.length||(e=[e]),e=h.map(e,function(e){return t._addFile(e)}),t.owner.trigger("filesQueued",e),t.options.auto&&setTimeout(function(){t.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(e,t){e=e.id?e:this.queue.getFile(e),this.request("cancel-file",e),t&&this.queue.removeFile(e)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(e,t){var n,i,r;if(e)return(e=e.id?e:this.queue.getFile(e)).setStatus(o.QUEUED),void(t||this.request("start-upload"));for(i=0,r=(n=this.queue.getFiles(o.ERROR)).length;i<r;i++)(e=n[i]).setStatus(o.QUEUED);this.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new l,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),e("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(e,r){return e.support=function(){return r.hasRuntime.apply(r,arguments)},e.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var e,t,n=this.options.runtimeOrder||r.orders,i=this.type;if(!i)for(e=0,t=(n=n.split(/\s*,\s*/g)).length;e<t;e++)if(r.hasRuntime(n[e])){this.type=i=n[e];break}return i}})}),e("lib/transport",["base","runtime/client","mediator"],function(e,n,t){var i=e.$;function r(e){var t=this;e=t.options=i.extend(!0,{},r.options,e||{}),n.call(this,"Transport"),this._blob=null,this._formData=e.formData||{},this._headers=e.headers||{},this.on("progress",this._timeout),this.on("load error",function(){t.trigger("progress",1),clearTimeout(t._timer)})}return r.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},i.extend(r.prototype,{appendBlob:function(e,t,n){var i=this,r=i.options;i.getRuid()&&i.disconnectRuntime(),i.connectRuntime(t.ruid,function(){i.exec("init")}),i._blob=t,r.fileVal=e||r.fileVal,r.filename=n||r.filename},append:function(e,t){"object"==typeof e?i.extend(this._formData,e):this._formData[e]=t},setRequestHeader:function(e,t){"object"==typeof e?i.extend(this._headers,e):this._headers[e]=t},send:function(e){this.exec("send",e),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var e=this,t=e.options.timeout;t&&(clearTimeout(e._timer),e._timer=setTimeout(function(){e.abort(),e.trigger("error","timeout")},t))}}),t.installTo(r.prototype),r}),e("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(l,e,t,f){var h=l.$,s=l.isPromise,d=t.Status;h.extend(e.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),e.register({name:"upload",init:function(){var e=this.owner,t=this;this.runing=!1,this.progress=!1,e.on("startUpload",function(){t.progress=!0}).on("uploadFinished",function(){t.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=l.bindFn(this._tick,this),e.on("uploadComplete",function(e){e.blocks&&h.each(e.blocks,function(e,t){t.transport&&(t.transport.abort(),t.transport.destroy()),delete t.transport}),delete e.blocks,delete e.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(n){var i=this;if(h.each(i.request("get-files",d.INVALID),function(){i.request("remove-file",this)}),n)if((n=n.id?n:i.request("get-file",n)).getStatus()===d.INTERRUPT)h.each(i.pool,function(e,t){t.file===n&&t.transport&&t.transport.send()}),n.setStatus(d.QUEUED);else{if(n.getStatus()===d.PROGRESS)return;n.setStatus(d.QUEUED)}else h.each(i.request("get-files",[d.INITED]),function(){this.setStatus(d.QUEUED)});if(!i.runing){i.runing=!0;var r=[];for(h.each(i.pool,function(e,t){var n=t.file;n.getStatus()===d.INTERRUPT&&(r.push(n),i._trigged=!1,t.transport&&t.transport.send())});n=r.shift();)n.setStatus(d.PROGRESS);n||h.each(i.request("get-files",d.INTERRUPT),function(){this.setStatus(d.PROGRESS)}),i._trigged=!1,l.nextTick(i.__tick),i.owner.trigger("startUpload")}},stopUpload:function(n,e){var i=this;if(!0===n&&(e=n,n=null),!1!==i.runing){if(n){if((n=n.id?n:i.request("get-file",n)).getStatus()!==d.PROGRESS&&n.getStatus()!==d.QUEUED)return;return n.setStatus(d.INTERRUPT),h.each(i.pool,function(e,t){t.file===n&&(t.transport&&t.transport.abort(),i._putback(t),i._popBlock(t))}),l.nextTick(i.__tick)}i.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(d.INTERRUPT),e&&h.each(i.pool,function(e,t){t.transport&&t.transport.abort(),t.file.setStatus(d.INTERRUPT)}),i.owner.trigger("stopUpload")}},cancelFile:function(e){(e=e.id?e:this.request("get-file",e)).blocks&&h.each(e.blocks,function(e,t){var n=t.transport;n&&(n.abort(),n.destroy(),delete t.transport)}),e.setStatus(d.CANCELLED),this.owner.trigger("fileDequeued",e)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(e,t){(e=e.id?e:this.request("get-file",e)).setStatus(t||d.COMPLETE),e.skipped=!0,e.blocks&&h.each(e.blocks,function(e,t){var n=t.transport;n&&(n.abort(),n.destroy(),delete t.transport)}),this.owner.trigger("uploadSkip",e)},_tick:function(){var e,t,n=this,i=n.options;if(n._promise)return n._promise.always(n.__tick);n.pool.length<i.threads&&(t=n._nextBlock())?(n._trigged=!1,e=function(e){n._promise=null,e&&e.file&&n._startSend(e),l.nextTick(n.__tick)},n._promise=s(t)?t.always(e):e(t)):n.remaning||n._getStats().numOfQueue||n._getStats().numofInterrupt||(n.runing=!1,n._trigged||l.nextTick(function(){n.owner.trigger("uploadFinished")}),n._trigged=!0)},_putback:function(e){e.cuted.unshift(e),~this.stack.indexOf(e.cuted)||this.stack.unshift(e.cuted)},_getStack:function(){for(var e,t=0;e=this.stack[t++];){if(e.has()&&e.file.getStatus()===d.PROGRESS)return e;e.has()&&(e.file.getStatus()===d.PROGRESS||e.file.getStatus()===d.INTERRUPT)||this.stack.splice(--t,1)}return null},_nextBlock:function(){var t,e,n,i,r=this,o=r.options;return(t=this._getStack())?(o.prepareNextFile&&!r.pending.length&&r._prepareNextFile(),t.shift()):r.runing?(!r.pending.length&&r._getStats().numOfQueue&&r._prepareNextFile(),e=r.pending.shift(),n=function(e){return e?(t=function(e,t){var n,i,r=[],o=e.source.size,s=t?Math.ceil(o/t):1,a=0,u=0;for(i={file:e,has:function(){return!!r.length},shift:function(){return r.shift()},unshift:function(e){r.unshift(e)}};u<s;)n=Math.min(t,o-a),r.push({file:e,start:a,end:t?a+n:o,total:o,chunks:s,chunk:u++,cuted:i}),a+=n;return e.blocks=r.concat(),e.remaning=r.length,i}(e,o.chunked?o.chunkSize:0),r.stack.push(t),t.shift()):null},s(e)?(i=e.file,(e=e[e.pipe?"pipe":"then"](n)).file=i,e):n(e)):void 0},_prepareNextFile:function(){var t,n=this,i=n.request("fetch-file"),r=n.pending;i&&(t=n.request("before-send-file",i,function(){return i.getStatus()===d.PROGRESS||i.getStatus()===d.INTERRUPT?i:n._finishFile(i)}),n.owner.trigger("uploadStart",i),i.setStatus(d.PROGRESS),t.file=i,t.done(function(){var e=h.inArray(t,r);~e&&r.splice(e,1,i)}),t.fail(function(e){i.setStatus(d.ERROR,e),n.owner.trigger("uploadError",i,e),n.owner.trigger("uploadComplete",i)}),r.push(t))},_popBlock:function(e){var t=h.inArray(e,this.pool);this.pool.splice(t,1),e.file.remaning--,this.remaning--},_startSend:function(e){var t=this,n=e.file;n.getStatus()===d.PROGRESS?(t.pool.push(e),t.remaning++,e.blob=1===e.chunks?n.source:n.source.slice(e.start,e.end),t.request("before-send",e,function(){n.getStatus()===d.PROGRESS?t._doSend(e):(t._popBlock(e),l.nextTick(t.__tick))}).fail(function(){1===n.remaning?t._finishFile(n).always(function(){e.percentage=1,t._popBlock(e),t.owner.trigger("uploadComplete",n),l.nextTick(t.__tick)}):(e.percentage=1,t.updateFileProgress(n),t._popBlock(e),l.nextTick(t.__tick))})):n.getStatus()===d.INTERRUPT&&t._putback(e)},_doSend:function(n){var i,r,t=this,o=t.owner,s=t.options,a=n.file,u=new f(s),e=h.extend({},s.formData),c=h.extend({},s.headers);(n.transport=u).on("destroy",function(){delete n.transport,t._popBlock(n),l.nextTick(t.__tick)}),u.on("progress",function(e){n.percentage=e,t.updateFileProgress(a)}),i=function(t){var e;return(r=u.getResponseAsJson()||{})._raw=u.getResponse(),e=function(e){t=e},o.trigger("uploadAccept",n,r,e)||(t=t||"server"),t},u.on("error",function(e,t){n.retried=n.retried||0,1<n.chunks&&~"http,abort".indexOf(e)&&n.retried<s.chunkRetry?(n.retried++,u.send()):(t||"server"!==e||(e=i(e)),a.setStatus(d.ERROR,e),o.trigger("uploadError",a,e),o.trigger("uploadComplete",a))}),u.on("load",function(){var e;(e=i())?u.trigger("error",e,!0):1===a.remaning?t._finishFile(a,r):u.destroy()}),e=h.extend(e,{id:a.id,name:a.name,type:a.type,lastModifiedDate:a.lastModifiedDate,size:a.size}),1<n.chunks&&h.extend(e,{chunks:n.chunks,chunk:n.chunk}),o.trigger("uploadBeforeSend",n,e,c),u.appendBlob(s.fileVal,n.blob,a.name),u.append(e),u.setRequestHeader(c),u.send()},_finishFile:function(t,e,n){var i=this.owner;return i.request("after-send-file",arguments,function(){t.setStatus(d.COMPLETE),i.trigger("uploadSuccess",t,e,n)}).fail(function(e){t.getStatus()===d.PROGRESS&&t.setStatus(d.ERROR,e),i.trigger("uploadError",t,e)}).always(function(){i.trigger("uploadComplete",t)})},updateFileProgress:function(e){var t,n=0;e.blocks&&(h.each(e.blocks,function(e,t){n+=(t.percentage||0)*(t.end-t.start)}),t=n/e.size,this.owner.trigger("uploadProgress",e,t||0))}})}),e("widgets/validator",["base","uploader","file","widgets/widget"],function(t,e,n){var i,r=t.$,o={};return i={addValidator:function(e,t){o[e]=t},removeValidator:function(e){delete o[e]}},e.register({name:"validator",init:function(){var e=this;t.nextTick(function(){r.each(o,function(){this.call(e.owner)})})}}),i.addValidator("fileNumLimit",function(){var e=this,t=e.options,n=0,i=parseInt(t.fileNumLimit,10),r=!0;i&&(e.on("beforeFileQueued",function(e){return i<=n&&r&&(r=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",i,e),setTimeout(function(){r=!0},1)),!(i<=n)}),e.on("fileQueued",function(){n++}),e.on("fileDequeued",function(){n--}),e.on("reset",function(){n=0}))}),i.addValidator("fileSizeLimit",function(){var e=this,t=e.options,n=0,i=parseInt(t.fileSizeLimit,10),r=!0;i&&(e.on("beforeFileQueued",function(e){var t=n+e.size>i;return t&&r&&(r=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",i,e),setTimeout(function(){r=!0},1)),!t}),e.on("fileQueued",function(e){n+=e.size}),e.on("fileDequeued",function(e){n-=e.size}),e.on("reset",function(){n=0}))}),i.addValidator("fileSingleSizeLimit",function(){var t=this.options.fileSingleSizeLimit;t&&this.on("beforeFileQueued",function(e){if(e.size>t)return e.setStatus(n.Status.INVALID,"exceed_size"),this.trigger("error","文件大小超出限制，最大为："+t/1048576+"M",t,e),!1})}),i.addValidator("duplicate",function(){var e=this,t=e.options,n={};t.duplicate||(e.on("beforeFileQueued",function(e){var t=e.__hash||(e.__hash=function(e){for(var t=0,n=0,i=e.length;n<i;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t}(e.name+e.size+e.lastModifiedDate));if(n[t])return this.trigger("error","F_DUPLICATE",e),!1}),e.on("fileQueued",function(e){var t=e.__hash;t&&(n[t]=!0)}),e.on("fileDequeued",function(e){var t=e.__hash;t&&delete n[t]}),e.on("reset",function(){n={}}))}),i}),e("lib/md5",["runtime/client","mediator"],function(e,t){function n(){e.call(this,"Md5")}return t.installTo(n.prototype),n.prototype.loadFromBlob=function(e){var t=this;t.getRuid()&&t.disconnectRuntime(),t.connectRuntime(e.ruid,function(){t.exec("init"),t.exec("loadFromBlob",e)})},n.prototype.getResult=function(){return this.exec("getResult")},n}),e("widgets/md5",["base","uploader","lib/md5","lib/blob","widgets/widget"],function(s,e,a,u){return e.register({name:"md5",md5File:function(e,t,n){var i=new a,r=s.Deferred(),o=e instanceof u?e:this.request("get-file",e).source;return i.on("progress load",function(e){e=e||{},r.notify(e.total?e.loaded/e.total:1)}),i.on("complete",function(){r.resolve(i.getResult())}),i.on("error",function(e){r.reject(e)}),1<arguments.length&&(n=n||0,(t=t||0)<0&&(t=o.size+t),n<0&&(n=o.size+n),n=Math.min(n,o.size),o=o.slice(t,n)),i.loadFromBlob(o),r.promise()}})}),e("runtime/compbase",[],function(){return function(e,t){this.owner=e,this.options=e.options,this.getRuntime=function(){return t},this.getRuid=function(){return t.uid},this.trigger=function(){return e.trigger.apply(e,arguments)}}}),e("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(a,t,n){var u={};function e(){var o={},s=this,e=this.destroy;t.apply(s,arguments),s.type="html5",s.exec=function(e,t){var n,i=this.uid,r=a.slice(arguments,2);if(u[e]&&(n=o[i]=o[i]||new u[e](this,s))[t])return n[t].apply(n,r)},s.destroy=function(){return e&&e.apply(this,arguments)}}return a.inherits(t,{constructor:e,init:function(){var e=this;setTimeout(function(){e.trigger("ready")},1)}}),e.register=function(e,t){return u[e]=a.inherits(n,t)},_.Blob&&_.FileReader&&_.DataView&&t.addRuntime("html5",e),e}),e("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(e,i){return e.register("Blob",{slice:function(e,t){var n=this.owner.source;return n=(n.slice||n.webkitSlice||n.mozSlice).call(n,e,t),new i(this.getRuid(),n)}})}),e("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(f,e,s){var a=f.$,u="webuploader-dnd-";return e.register("DragAndDrop",{init:function(){var e=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,e.on("dragenter",this.dragEnterHandler),e.on("dragover",this.dragOverHandler),e.on("dragleave",this.dragLeaveHandler),e.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(a(document).on("dragover",this.dragOverHandler),a(document).on("drop",this.dropHandler))},_dragEnterHandler:function(e){var t,n=this,i=n._denied||!1;return e=e.originalEvent||e,n.dndOver||(n.dndOver=!0,(t=e.dataTransfer.items)&&t.length&&(n._denied=i=!n.trigger("accept",t)),n.elem.addClass(u+"over"),n.elem[i?"addClass":"removeClass"](u+"denied")),e.dataTransfer.dropEffect=i?"none":"copy",!1},_dragOverHandler:function(e){var t=this.elem.parent().get(0);return t&&!a.contains(t,e.currentTarget)||(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,e)),!1},_dragLeaveHandler:function(){var e,t=this;return e=function(){t.dndOver=!1,t.elem.removeClass(u+"over "+u+"denied")},clearTimeout(t._leaveTimer),t._leaveTimer=setTimeout(e,100),!1},_dropHandler:function(e){var t,n,i=this,r=i.getRuid(),o=i.elem.parent().get(0);if(o&&!a.contains(o,e.currentTarget))return!1;t=(e=e.originalEvent||e).dataTransfer;try{n=t.getData("text/html")}catch(e){}return n?void 0:(i._getTansferFiles(t,function(e){i.trigger("drop",a.map(e,function(e){return new s(r,e)}))}),i.dndOver=!1,i.elem.removeClass(u+"over"),!1)},_getTansferFiles:function(e,t){var n,i,r,o,s,a,u,c=[],l=[];for(n=e.items,i=e.files,u=!(!n||!n[0].webkitGetAsEntry),s=0,a=i.length;s<a;s++)r=i[s],o=n&&n[s],u&&o.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(o.webkitGetAsEntry(),c)):c.push(r);f.when.apply(f,l).done(function(){c.length&&t(c)})},_traverseDirectoryTree:function(e,o){var s=f.Deferred(),a=this;return e.isFile?e.file(function(e){o.push(e),s.resolve()}):e.isDirectory&&e.createReader().readEntries(function(e){var t,n=e.length,i=[],r=[];for(t=0;t<n;t++)i.push(a._traverseDirectoryTree(e[t],r));f.when.apply(f,i).then(function(){o.push.apply(o,r),s.resolve()},s.reject)}),s.promise()},destroy:function(){var e=this.elem;e&&(e.off("dragenter",this.dragEnterHandler),e.off("dragover",this.dragOverHandler),e.off("dragleave",this.dragLeaveHandler),e.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(a(document).off("dragover",this.dragOverHandler),a(document).off("drop",this.dropHandler)))}})}),e("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,e,u){return e.register("FilePaste",{init:function(){var e,t,n,i,r=this.options,o=this.elem=r.container,s=".*";if(r.accept){for(e=[],t=0,n=r.accept.length;t<n;t++)(i=r.accept[t].mimeTypes)&&e.push(i);e.length&&(s=(s=e.join(",")).replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=s=new RegExp(s,"i"),this.hander=a.bindFn(this._pasteHander,this),o.on("paste",this.hander)},_pasteHander:function(e){var t,n,i,r,o,s=[],a=this.getRuid();for(r=0,o=(t=(e=e.originalEvent||e).clipboardData.items).length;r<o;r++)"file"===(n=t[r]).kind&&(i=n.getAsFile())&&s.push(new u(a,i));s.length&&(e.preventDefault(),e.stopPropagation(),this.trigger("paste",s))},destroy:function(){this.elem.off("paste",this.hander)}})}),e("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(e,t){var l=e.$;return t.register("FilePicker",{init:function(){var e,t,n,i,r=this.getRuntime().getContainer(),o=this,s=o.owner,a=o.options,u=this.label=l(document.createElement("label")),c=this.input=l(document.createElement("input"));if(c.attr("type","file"),c.attr("name",a.name),c.addClass("webuploader-element-invisible"),u.on("click",function(){c.trigger("click")}),u.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),a.multiple&&c.attr("multiple","multiple"),a.accept&&0<a.accept.length){for(e=[],t=0,n=a.accept.length;t<n;t++)e.push(a.accept[t].mimeTypes);c.attr("accept",e.join(","))}r.append(c),r.append(u),i=function(e){s.trigger(e.type)},c.on("change",function(e){var t,n=arguments.callee;o.files=e.target.files,(t=this.cloneNode(!0)).value=null,this.parentNode.replaceChild(t,this),c.off(),c=l(t).on("change",n).on("mouseenter mouseleave",i),s.trigger("change")}),u.on("mouseenter mouseleave",i)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),e("runtime/html5/util",["base"],function(e){var t=_.createObjectURL&&_||_.URL&&URL.revokeObjectURL&&URL||_.webkitURL,n=e.noop,i=n;return t&&(n=function(){return t.createObjectURL.apply(t,arguments)},i=function(){return t.revokeObjectURL.apply(t,arguments)}),{createObjectURL:n,revokeObjectURL:i,dataURL2Blob:function(e){var t,n,i,r,o,s;for(t=~(s=e.split(","))[0].indexOf("base64")?atob(s[1]):decodeURIComponent(s[1]),i=new ArrayBuffer(t.length),n=new Uint8Array(i),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return o=s[0].split(":")[1].split(";")[0],this.arrayBufferToBlob(i,o)},dataURL2ArrayBuffer:function(e){var t,n,i,r;for(t=~(r=e.split(","))[0].indexOf("base64")?atob(r[1]):decodeURIComponent(r[1]),n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer},arrayBufferToBlob:function(e,t){var n,i=_.BlobBuilder||_.WebKitBlobBuilder;return i?((n=new i).append(e),n.getBlob(t)):new Blob([e],t?{type:t}:{})},canvasToDataUrl:function(e,t,n){return e.toDataURL(t,n/100)},parseMeta:function(e,t){t(!1,{})},updateImageHead:function(e){return e}}}),e("runtime/html5/imagemeta",["runtime/html5/util"],function(e){var f;return f={parsers:{65505:[]},maxMetaDataSize:262144,parse:function(e,t){var n=this,i=new FileReader;i.onload=function(){t(!1,n._parse(this.result)),i=i.onload=i.onerror=null},i.onerror=function(e){t(e.message),i=i.onload=i.onerror=null},e=e.slice(0,n.maxMetaDataSize),i.readAsArrayBuffer(e.getSource())},_parse:function(e,t){if(!(e.byteLength<6)){var n,i,r,o,s=new DataView(e),a=2,u=s.byteLength-4,c=a,l={};if(65496===s.getUint16(0)){for(;a<u&&(65504<=(n=s.getUint16(a))&&n<=65519||65534===n)&&!(a+(i=s.getUint16(a+2)+2)>s.byteLength);){if(r=f.parsers[n],!t&&r)for(o=0;o<r.length;o+=1)r[o].call(f,s,a,i,l);c=a+=i}6<c&&(e.slice?l.imageHead=e.slice(2,c):l.imageHead=new Uint8Array(e).subarray(2,c))}return l}},updateImageHead:function(e,t){var n,i,r,o=this._parse(e,!0);return r=2,o.imageHead&&(r=2+o.imageHead.byteLength),i=e.slice?e.slice(r):new Uint8Array(e).subarray(r),(n=new Uint8Array(t.byteLength+2+i.byteLength))[0]=255,n[1]=216,n.set(new Uint8Array(t),2),n.set(new Uint8Array(i),t.byteLength+2),n.buffer}},e.parseMeta=function(){return f.parse.apply(f,arguments)},e.updateImageHead=function(){return f.updateImageHead.apply(f,arguments)},f}),e("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(d,e){var p={ExifMap:function(){return this}};return p.ExifMap.prototype.map={Orientation:274},p.ExifMap.prototype.get=function(e){return this[e]||this[this.map[e]]},p.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,n){return e.getUint16(t,n)},size:2},4:{getValue:function(e,t,n){return e.getUint32(t,n)},size:4},5:{getValue:function(e,t,n){return e.getUint32(t,n)/e.getUint32(t+4,n)},size:8},9:{getValue:function(e,t,n){return e.getInt32(t,n)},size:4},10:{getValue:function(e,t,n){return e.getInt32(t,n)/e.getInt32(t+4,n)},size:8}},p.exifTagTypes[7]=p.exifTagTypes[1],p.getExifValue=function(e,t,n,i,r,o){var s,a,u,c,l,f,h=p.exifTagTypes[i];if(h){if(!((a=4<(s=h.size*r)?t+e.getUint32(n+8,o):n+8)+s>e.byteLength)){if(1===r)return h.getValue(e,a,o);for(u=[],c=0;c<r;c+=1)u[c]=h.getValue(e,a+c*h.size,o);if(h.ascii){for(l="",c=0;c<u.length&&"\0"!==(f=u[c]);c+=1)l+=f;return l}return u}d.log("Invalid Exif data: Invalid data offset.")}else d.log("Invalid Exif data: Invalid tag type.")},p.parseExifTag=function(e,t,n,i,r){var o=e.getUint16(n,i);r.exif[o]=p.getExifValue(e,t,n,e.getUint16(n+2,i),e.getUint32(n+4,i),i)},p.parseExifTags=function(e,t,n,i,r){var o,s,a;if(n+6>e.byteLength)d.log("Invalid Exif data: Invalid directory offset.");else{if(!((s=n+2+12*(o=e.getUint16(n,i)))+4>e.byteLength)){for(a=0;a<o;a+=1)this.parseExifTag(e,t,n+2+12*a,i,r);return e.getUint32(s,i)}d.log("Invalid Exif data: Invalid directory size.")}},p.parseExifData=function(e,t,n,i){var r,o,s=t+10;if(1165519206===e.getUint32(t+4))if(s+8>e.byteLength)d.log("Invalid Exif data: Invalid segment size.");else if(0===e.getUint16(t+8)){switch(e.getUint16(s)){case 18761:r=!0;break;case 19789:r=!1;break;default:return void d.log("Invalid Exif data: Invalid byte alignment marker.")}42===e.getUint16(s+2,r)?(o=e.getUint32(s+4,r),i.exif=new p.ExifMap,o=p.parseExifTags(e,s,s+o,r,i)):d.log("Invalid Exif data: Missing TIFF marker.")}else d.log("Invalid Exif data: Missing byte alignment offset.")},e.parsers[65505].push(p.parseExifData),p}),e("runtime/html5/jpegencoder",[],function(e,t,n){function i(e){Math.round;var w,x,R,E,t,f=Math.floor,k=new Array(64),S=new Array(64),T=new Array(64),F=new Array(64),v=new Array(65535),b=new Array(65535),Z=new Array(64),_=new Array(64),A=[],U=0,D=7,O=new Array(64),I=new Array(64),C=new Array(64),n=new Array(256),q=new Array(2048),y=[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],B=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],P=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],M=[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],H=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],j=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],N=[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];function i(e,t){for(var n=0,i=0,r=new Array,o=1;o<=16;o++){for(var s=1;s<=e[o];s++)r[t[i]]=[],r[t[i]][0]=n,r[t[i]][1]=o,i++,n++;n*=2}return r}function $(e){for(var t=e[0],n=e[1]-1;0<=n;)t&1<<n&&(U|=1<<D),n--,--D<0&&(255==U?(Q(255),Q(0)):Q(U),D=7,U=0)}function Q(e){A.push(n[e])}function V(e){Q(e>>8&255),Q(255&e)}function G(e,t,n,i,r){for(var o,s=r[0],a=r[240],u=function(e,t){var n,i,r,o,s,a,u,c,l,f,h=0;for(l=0;l<8;++l){n=e[h],i=e[h+1],r=e[h+2],o=e[h+3],s=e[h+4],a=e[h+5],u=e[h+6];var d=n+(c=e[h+7]),p=n-c,g=i+u,m=i-u,v=r+a,b=r-a,_=o+s,y=o-s,w=d+_,x=d-_,R=g+v,E=g-v;e[h]=w+R,e[h+4]=w-R;var k=.707106781*(E+x);e[h+2]=x+k,e[h+6]=x-k;var S=.382683433*((w=y+b)-(E=m+p)),T=.5411961*w+S,F=1.306562965*E+S,A=.707106781*(R=b+m),U=p+A,D=p-A;e[h+5]=D+T,e[h+3]=D-T,e[h+1]=U+F,e[h+7]=U-F,h+=8}for(l=h=0;l<8;++l){n=e[h],i=e[h+8],r=e[h+16],o=e[h+24],s=e[h+32],a=e[h+40],u=e[h+48];var O=n+(c=e[h+56]),I=n-c,C=i+u,q=i-u,B=r+a,L=r-a,P=o+s,M=o-s,H=O+P,z=O-P,j=C+B,N=C-B;e[h]=H+j,e[h+32]=H-j;var $=.707106781*(N+z);e[h+16]=z+$,e[h+48]=z-$;var Q=.382683433*((H=M+L)-(N=q+I)),V=.5411961*H+Q,G=1.306562965*N+Q,W=.707106781*(j=L+q),J=I+W,X=I-W;e[h+40]=X+V,e[h+24]=X-V,e[h+8]=J+G,e[h+56]=J-G,h++}for(l=0;l<64;++l)f=e[l]*t[l],Z[l]=0<f?.5+f|0:f-.5|0;return Z}(e,t),c=0;c<64;++c)_[y[c]]=u[c];var l=_[0]-n;n=_[0],0==l?$(i[0]):($(i[b[o=32767+l]]),$(v[o]));for(var f=63;0<f&&0==_[f];f--);if(0==f)return $(s),n;for(var h,d=1;d<=f;){for(var p=d;0==_[d]&&d<=f;++d);var g=d-p;if(16<=g){h=g>>4;for(var m=1;m<=h;++m)$(a);g&=15}o=32767+_[d],$(r[(g<<4)+b[o]]),$(v[o]),d++}return 63!=f&&$(s),n}function W(e){if(e<=0&&(e=1),100<e&&(e=100),t!=e){(function(e){for(var t=[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],n=0;n<64;n++){var i=f((t[n]*e+50)/100);i<1?i=1:255<i&&(i=255),k[y[n]]=i}for(var r=[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 s=f((r[o]*e+50)/100);s<1?s=1:255<s&&(s=255),S[y[o]]=s}for(var a=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],u=0,c=0;c<8;c++)for(var l=0;l<8;l++)T[u]=1/(k[y[u]]*a[c]*a[l]*8),F[u]=1/(S[y[u]]*a[c]*a[l]*8),u++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),t=e}}this.encode=function(e,t){t&&W(t),A=new Array,U=0,D=7,V(65496),V(65504),V(16),Q(74),Q(70),Q(73),Q(70),Q(0),Q(1),Q(1),Q(0),V(1),V(1),Q(0),Q(0),function(){V(65499),V(132),Q(0);for(var e=0;e<64;e++)Q(k[e]);Q(1);for(var t=0;t<64;t++)Q(S[t])}(),function(e,t){V(65472),V(17),Q(8),V(t),V(e),Q(3),Q(1),Q(17),Q(0),Q(2),Q(17),Q(1),Q(3),Q(17),Q(1)}(e.width,e.height),function(){V(65476),V(418),Q(0);for(var e=0;e<16;e++)Q(B[e+1]);for(var t=0;t<=11;t++)Q(L[t]);Q(16);for(var n=0;n<16;n++)Q(P[n+1]);for(var i=0;i<=161;i++)Q(M[i]);Q(1);for(var r=0;r<16;r++)Q(H[r+1]);for(var o=0;o<=11;o++)Q(z[o]);Q(17);for(var s=0;s<16;s++)Q(j[s+1]);for(var a=0;a<=161;a++)Q(N[a])}(),V(65498),V(12),Q(3),Q(1),Q(0),Q(2),Q(17),Q(3),Q(17),Q(0),Q(63),Q(0);var n=0,i=0,r=0;U=0,D=7,this.encode.displayName="_encode_";for(var o,s,a,u,c,l,f,h,d,p=e.data,g=e.width,m=e.height,v=4*g,b=0;b<m;){for(o=0;o<v;){for(l=c=v*b+o,f=-1,d=h=0;d<64;d++)l=c+(h=d>>3)*v+(f=4*(7&d)),m<=b+h&&(l-=v*(b+1+h-m)),v<=o+f&&(l-=o+f-v+4),s=p[l++],a=p[l++],u=p[l++],O[d]=(q[s]+q[a+256>>0]+q[u+512>>0]>>16)-128,I[d]=(q[s+768>>0]+q[a+1024>>0]+q[u+1280>>0]>>16)-128,C[d]=(q[s+1280>>0]+q[a+1536>>0]+q[u+1792>>0]>>16)-128;n=G(O,T,n,w,R),i=G(I,F,i,x,E),r=G(C,F,r,x,E),o+=32}b+=8}if(0<=D){var _=[];_[1]=D+1,_[0]=(1<<D+1)-1,$(_)}V(65497);var y="data:image/jpeg;base64,"+btoa(A.join(""));return A=[],y},e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)n[t]=e(t)}(),w=i(B,L),x=i(H,z),R=i(P,M),E=i(j,N),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var i=e;i<t;i++)b[32767+i]=n,v[32767+i]=[],v[32767+i][1]=n,v[32767+i][0]=i;for(var r=-(t-1);r<=-e;r++)b[32767+r]=n,v[32767+r]=[],v[32767+r][1]=n,v[32767+r][0]=t-1+r;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)q[e]=19595*e,q[e+256>>0]=38470*e,q[e+512>>0]=7471*e+32768,q[e+768>>0]=-11059*e,q[e+1024>>0]=-21709*e,q[e+1280>>0]=32768*e+8421375,q[e+1536>>0]=-27439*e,q[e+1792>>0]=-5329*e}(),W(e)}return i.encode=function(e,t){return new i(t).encode(e)},i}),e("runtime/html5/androidpatch",["runtime/html5/util","runtime/html5/jpegencoder","base"],function(e,u,c){var l,f=e.canvasToDataUrl;e.canvasToDataUrl=function(e,t,n){var i,r,o,s,a;return c.os.android?("image/jpeg"===t&&void 0===l&&(s=(s=~(a=(s=f.apply(null,arguments)).split(","))[0].indexOf("base64")?atob(a[1]):decodeURIComponent(a[1])).substring(0,2),l=255===s.charCodeAt(0)&&216===s.charCodeAt(1)),"image/jpeg"!==t||l?f.apply(null,arguments):(r=e.width,o=e.height,i=e.getContext("2d"),u.encode(i.getImageData(0,0,r,o),n))):f.apply(null,arguments)}}),e("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(i,e,r){return e.register("Image",{modified:!1,init:function(){var n=this,e=new Image;e.onload=function(){n._info={type:n.type,width:this.width,height:this.height},n._metas||"image/jpeg"!==n.type?n.owner.trigger("load"):r.parseMeta(n._blob,function(e,t){n._metas=t,n.owner.trigger("load")})},e.onerror=function(){n.owner.trigger("error")},n._img=e},loadFromBlob:function(e){var t=this._img;this._blob=e,this.type=e.type,t.src=r.createObjectURL(e.getSource()),this.owner.once("load",function(){r.revokeObjectURL(t.src)})},resize:function(e,t){var n=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,n,e,t),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(e,t,n,i,r){var o=this._canvas||(this._canvas=document.createElement("canvas")),s=this.options,a=this._img,u=a.naturalWidth,c=a.naturalHeight,l=this.getOrientation();r=r||1,o.width=n,o.height=i,s.preserveHeaders||this._rotate2Orientaion(o,l),this._renderImageToCanvas(o,a,-e,-t,u*r,c*r),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(e){var t,n=this._blob,i=this.options;if(e=e||this.type,this.modified||this.type!==e){if(t=this._canvas,"image/jpeg"===e){if(n=r.canvasToDataUrl(t,e,i.quality),i.preserveHeaders&&this._metas&&this._metas.imageHead)return n=r.dataURL2ArrayBuffer(n),n=r.updateImageHead(n,this._metas.imageHead),n=r.arrayBufferToBlob(n,e)}else n=r.canvasToDataUrl(t,e);n=r.dataURL2Blob(n)}return n},getAsDataUrl:function(e){var t=this.options;return"image/jpeg"===(e=e||this.type)?r.canvasToDataUrl(this._canvas,e,t.quality):this._canvas.toDataURL(e)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(e){return e?(this._info=e,this):this._info},meta:function(e){return e?(this._meta=e,this):this._meta},destroy:function(){var e=this._canvas;this._img.onload=null,e&&(e.getContext("2d").clearRect(0,0,e.width,e.height),e.width=e.height=0,this._canvas=null),this._img.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D",this._img=this._blob=null},_resize:function(e,t,n,i){var r,o,s,a,u,c=this.options,l=e.width,f=e.height,h=this.getOrientation();~[5,6,7,8].indexOf(h)&&(n^=i,n^=i^=n),r=Math[c.crop?"max":"min"](n/l,i/f),c.allowMagnify||(r=Math.min(1,r)),o=l*r,s=f*r,c.crop?(t.width=n,t.height=i):(t.width=o,t.height=s),a=(t.width-o)/2,u=(t.height-s)/2,c.preserveHeaders||this._rotate2Orientaion(t,h),this._renderImageToCanvas(t,e,a,u,o,s)},_rotate2Orientaion:function(e,t){var n=e.width,i=e.height,r=e.getContext("2d");switch(t){case 5:case 6:case 7:case 8:e.width=i,e.height=n}switch(t){case 2:r.translate(n,0),r.scale(-1,1);break;case 3:r.translate(n,i),r.rotate(Math.PI);break;case 4:r.translate(0,i),r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI),r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI),r.translate(0,-i);break;case 7:r.rotate(.5*Math.PI),r.translate(n,-i),r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI),r.translate(-n,0)}},_renderImageToCanvas:function(){if(!i.os.ios)return function(e){var t=i.slice(arguments,1),n=e.getContext("2d");n.drawImage.apply(n,t)};function w(e,t,n){var i,r,o=document.createElement("canvas"),s=o.getContext("2d"),a=0,u=n,c=n;for(o.width=1,o.height=n,s.drawImage(e,0,0),i=s.getImageData(0,0,1,n).data;a<c;)0===i[4*(c-1)+3]?u=c:a=c,c=u+a>>1;return 0==(r=c/n)?1:r}if(7<=i.os.ios)return function(e,t,n,i,r,o){var s=t.naturalWidth,a=t.naturalHeight,u=w(t,0,a);return e.getContext("2d").drawImage(t,0,0,s*u,a*u,n,i,r,o)};return function(e,t,n,i,r,o){var s,a,u,c,l,f,h,d=t.naturalWidth,p=t.naturalHeight,g=e.getContext("2d"),m=function(e){var t,n,i=e.naturalWidth;return 1048576<i*e.naturalHeight&&((t=document.createElement("canvas")).width=t.height=1,(n=t.getContext("2d")).drawImage(e,1-i,0),0===n.getImageData(0,0,1,1).data[3])}(t),v="image/jpeg"===this.type,b=1024,_=0,y=0;for(m&&(d/=2,p/=2),g.save(),(s=document.createElement("canvas")).width=s.height=b,a=s.getContext("2d"),u=v?w(t,0,p):1,c=Math.ceil(b*r/d),l=Math.ceil(b*o/p/u);_<p;){for(h=f=0;f<d;)a.clearRect(0,0,b,b),a.drawImage(t,-f,-_),g.drawImage(s,0,0,b,b,n+h,i+y,c,l),f+=b,h+=c;_+=b,y+=l}g.restore(),s=a=null}}()})}),e("runtime/html5/transport",["base","runtime/html5/runtime"],function(u,e){var t=u.noop,c=u.$;return e.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var n,e,t,i=this.owner,r=this.options,o=this._initAjax(),s=i._blob,a=r.server;r.sendAsBinary?(a+=(/\?/.test(a)?"&":"?")+c.param(i._formData),e=s.getSource()):(n=new FormData,c.each(i._formData,function(e,t){n.append(e,t)}),n.append(r.fileVal,s.getSource(),r.filename||i._formData.name||"")),r.withCredentials&&"withCredentials"in o?(o.open(r.method,a,!0),o.withCredentials=!0):o.open(r.method,a),this._setRequestHeader(o,r.headers),e?(o.overrideMimeType&&o.overrideMimeType("application/octet-stream"),u.os.android?((t=new FileReader).onload=function(){o.send(this.result),t=t.onload=null},t.readAsArrayBuffer(e)):o.send(e)):o.send(n)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var e=this._xhr;e&&(e.upload.onprogress=t,e.onreadystatechange=t,e.abort(),this._xhr=e=null)},destroy:function(){this.abort()},_initAjax:function(){var n=this,e=new XMLHttpRequest;return!this.options.withCredentials||"withCredentials"in e||"undefined"==typeof XDomainRequest||(e=new XDomainRequest),e.upload.onprogress=function(e){var t=0;return e.lengthComputable&&(t=e.loaded/e.total),n.trigger("progress",t)},e.onreadystatechange=function(){if(4===e.readyState)return e.upload.onprogress=t,e.onreadystatechange=t,n._xhr=null,n._status=e.status,200<=e.status&&e.status<300?(n._response=e.responseText,n.trigger("load")):500<=e.status&&e.status<600?(n._response=e.responseText,n.trigger("error","server")):n.trigger("error",n._status?"http":"abort")},n._xhr=e},_setRequestHeader:function(n,e){c.each(e,function(e,t){n.setRequestHeader(e,t)})},_parseJson:function(e){var t;try{t=JSON.parse(e)}catch(e){t={}}return t}})}),e("runtime/html5/md5",["runtime/html5/runtime"],function(e){function a(e,t,n,i,r,o){return t=g(g(t,e),g(i,o)),g(t<<r|t>>>32-r,n)}function s(e,t,n,i,r,o,s){return a(t&n|~t&i,e,t,r,o,s)}function u(e,t,n,i,r,o,s){return a(t&i|n&~i,e,t,r,o,s)}function c(e,t,n,i,r,o,s){return a(t^n^i,e,t,r,o,s)}function l(e,t,n,i,r,o,s){return a(n^(t|~i),e,t,r,o,s)}function f(e,t){var n=e[0],i=e[1],r=e[2],o=e[3];n=s(n,i,r,o,t[0],7,-680876936),o=s(o,n,i,r,t[1],12,-389564586),r=s(r,o,n,i,t[2],17,606105819),i=s(i,r,o,n,t[3],22,-1044525330),n=s(n,i,r,o,t[4],7,-176418897),o=s(o,n,i,r,t[5],12,1200080426),r=s(r,o,n,i,t[6],17,-1473231341),i=s(i,r,o,n,t[7],22,-45705983),n=s(n,i,r,o,t[8],7,1770035416),o=s(o,n,i,r,t[9],12,-1958414417),r=s(r,o,n,i,t[10],17,-42063),i=s(i,r,o,n,t[11],22,-1990404162),n=s(n,i,r,o,t[12],7,1804603682),o=s(o,n,i,r,t[13],12,-40341101),r=s(r,o,n,i,t[14],17,-1502002290),i=s(i,r,o,n,t[15],22,1236535329),n=u(n,i,r,o,t[1],5,-165796510),o=u(o,n,i,r,t[6],9,-1069501632),r=u(r,o,n,i,t[11],14,643717713),i=u(i,r,o,n,t[0],20,-373897302),n=u(n,i,r,o,t[5],5,-701558691),o=u(o,n,i,r,t[10],9,38016083),r=u(r,o,n,i,t[15],14,-660478335),i=u(i,r,o,n,t[4],20,-405537848),n=u(n,i,r,o,t[9],5,568446438),o=u(o,n,i,r,t[14],9,-1019803690),r=u(r,o,n,i,t[3],14,-187363961),i=u(i,r,o,n,t[8],20,1163531501),n=u(n,i,r,o,t[13],5,-1444681467),o=u(o,n,i,r,t[2],9,-51403784),r=u(r,o,n,i,t[7],14,1735328473),i=u(i,r,o,n,t[12],20,-1926607734),n=c(n,i,r,o,t[5],4,-378558),o=c(o,n,i,r,t[8],11,-2022574463),r=c(r,o,n,i,t[11],16,1839030562),i=c(i,r,o,n,t[14],23,-35309556),n=c(n,i,r,o,t[1],4,-1530992060),o=c(o,n,i,r,t[4],11,1272893353),r=c(r,o,n,i,t[7],16,-155497632),i=c(i,r,o,n,t[10],23,-1094730640),n=c(n,i,r,o,t[13],4,681279174),o=c(o,n,i,r,t[0],11,-358537222),r=c(r,o,n,i,t[3],16,-722521979),i=c(i,r,o,n,t[6],23,76029189),n=c(n,i,r,o,t[9],4,-640364487),o=c(o,n,i,r,t[12],11,-421815835),r=c(r,o,n,i,t[15],16,530742520),i=c(i,r,o,n,t[2],23,-995338651),n=l(n,i,r,o,t[0],6,-198630844),o=l(o,n,i,r,t[7],10,1126891415),r=l(r,o,n,i,t[14],15,-1416354905),i=l(i,r,o,n,t[5],21,-57434055),n=l(n,i,r,o,t[12],6,1700485571),o=l(o,n,i,r,t[3],10,-1894986606),r=l(r,o,n,i,t[10],15,-1051523),i=l(i,r,o,n,t[1],21,-2054922799),n=l(n,i,r,o,t[8],6,1873313359),o=l(o,n,i,r,t[15],10,-30611744),r=l(r,o,n,i,t[6],15,-1560198380),i=l(i,r,o,n,t[13],21,1309151649),n=l(n,i,r,o,t[4],6,-145523070),o=l(o,n,i,r,t[11],10,-1120210379),r=l(r,o,n,i,t[2],15,718787259),i=l(i,r,o,n,t[9],21,-343485551),e[0]=g(n,e[0]),e[1]=g(i,e[1]),e[2]=g(r,e[2]),e[3]=g(o,e[3])}function h(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function d(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,n,i,r,o,s,a=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=a;t+=64)f(u,h(e.substring(t-64,t)));for(n=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<n;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),55<t)for(f(u,i),t=0;t<16;t+=1)i[t]=0;return r=(r=8*a).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),s=parseInt(r[1],16)||0,i[14]=o,i[15]=s,f(u,i),u}function n(e){var t,n="";for(t=0;t<4;t+=1)n+=r[e>>8*t+4&15]+r[e>>8*t&15];return n}function p(e){var t;for(t=0;t<e.length;t+=1)e[t]=n(e[t]);return e.join("")}function t(){this.reset()}var g=function(e,t){return e+t&4294967295},r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==p(i("hello"))&&(g=function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}),t.prototype.append=function(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),this.appendBinary(e),this},t.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)f(this._state,h(this._buff.substring(t-64,t)));return this._buff=this._buff.substr(t-64),this},t.prototype.end=function(e){var t,n,i=this._buff,r=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<r;t+=1)o[t>>2]|=i.charCodeAt(t)<<(t%4<<3);return this._finish(o,r),n=e?this._state:p(this._state),this.reset(),n},t.prototype._finish=function(e,t){var n,i,r,o=t;if(e[o>>2]|=128<<(o%4<<3),55<o)for(f(this._state,e),o=0;o<16;o+=1)e[o]=0;n=(n=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(n[2],16),r=parseInt(n[1],16)||0,e[14]=i,e[15]=r,f(this._state,e)},t.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},t.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},t.hash=function(e,t){/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e)));var n=i(e);return t?n:p(n)},t.hashBinary=function(e,t){var n=i(e);return t?n:p(n)},(t.ArrayBuffer=function(){this.reset()}).prototype.append=function(e){var t,n=this._concatArrayBuffer(this._buff,e),i=n.length;for(this._length+=e.byteLength,t=64;t<=i;t+=64)f(this._state,d(n.subarray(t-64,t)));return this._buff=t-64<i?n.subarray(t-64):new Uint8Array(0),this},t.ArrayBuffer.prototype.end=function(e){var t,n,i=this._buff,r=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<r;t+=1)o[t>>2]|=i[t]<<(t%4<<3);return this._finish(o,r),n=e?this._state:p(this._state),this.reset(),n},t.ArrayBuffer.prototype._finish=t.prototype._finish,t.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},t.ArrayBuffer.prototype.destroy=t.prototype.destroy,t.ArrayBuffer.prototype._concatArrayBuffer=function(e,t){var n=e.length,i=new Uint8Array(n+t.byteLength);return i.set(e),i.set(new Uint8Array(t),n),i},t.ArrayBuffer.hash=function(e,t){var n=function(e){var t,n,i,r,o,s,a=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=a;t+=64)f(u,d(e.subarray(t-64,t)));for(n=(e=t-64<a?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<n;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),55<t)for(f(u,i),t=0;t<16;t+=1)i[t]=0;return r=(r=8*a).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),s=parseInt(r[1],16)||0,i[14]=o,i[15]=s,f(u,i),u}(new Uint8Array(e));return t?n:p(n)},e.register("Md5",{init:function(){},loadFromBlob:function(n){var i,r,o=n.getSource(),s=2097152,a=Math.ceil(o.size/s),u=0,c=this.owner,l=new t.ArrayBuffer,f=this,h=o.mozSlice||o.webkitSlice||o.slice;r=new FileReader,(i=function(){var e,t;e=u*s,t=Math.min(e+s,o.size),r.onload=function(e){l.append(e.target.result),c.trigger("progress",{total:n.size,loaded:t})},r.onloadend=function(){r.onloadend=r.onload=null,++u<a?setTimeout(i,1):setTimeout(function(){c.trigger("load"),f.result=l.end(),i=n=o=l=null,c.trigger("complete")},50)},r.readAsArrayBuffer(h.call(o,e,t))})()},getResult:function(){return this.result}})}),e("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(u,n,i){var r=u.$,c={};function e(){var o={},s={},e=this.destroy,a=this,t=u.guid("webuploader_");n.apply(a,arguments),a.type="flash",a.exec=function(e,t){var n,i=this.uid,r=u.slice(arguments,2);return s[i]=this,c[e]&&(o[i]||(o[i]=new c[e](this,a)),(n=o[i])[t])?n[t].apply(n,r):a.flashExec.apply(this,arguments)},_[t]=function(){var e=arguments;setTimeout(function(){(function(e,t){var n,i,r=e.type||e;i=(n=r.split("::"))[0],"Ready"===(r=n[1])&&i===a.uid?a.trigger("ready"):s[i]&&s[i].trigger(r.toLowerCase(),e,t)}).apply(null,e)},1)},this.jsreciver=t,this.destroy=function(){return e&&e.apply(this,arguments)},this.flashExec=function(e,t){var n=a.getFlash(),i=u.slice(arguments,2);return n.exec(this.uid,e,t,i)}}return u.inherits(n,{constructor:e,init:function(){var e,t=this.getContainer(),n=this.options;t.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),e='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+n.swf+'" ',u.browser.ie&&(e+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),e+='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>',t.html(e)},getFlash:function(){return this._flash||(this._flash=r("#"+this.uid).get(0)),this._flash}}),e.register=function(e,t){return t=c[e]=u.inherits(i,r.extend({flashExec:function(){var e=this.owner;return this.getRuntime().flashExec.apply(e,arguments)}},t))},11.4<=function(){var t;try{t=(t=navigator.plugins["Shockwave Flash"]).description}catch(e){try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(e){t="0.0"}}return t=t.match(/\d+/g),parseFloat(t[0]+"."+t[1],10)}()&&n.addRuntime("flash",e),e}),e("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(e,t){var r=e.$;return t.register("FilePicker",{init:function(e){var t,n,i=r.extend({},e);for(t=i.accept&&i.accept.length,n=0;n<t;n++)i.accept[n].title||(i.accept[n].title="Files");delete i.button,delete i.id,delete i.container,this.flashExec("FilePicker","init",i)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),e("runtime/flash/image",["runtime/flash/runtime"],function(e){return e.register("Image",{loadFromBlob:function(e){var t=this.owner;t.info()&&this.flashExec("Image","info",t.info()),t.meta()&&this.flashExec("Image","meta",t.meta()),this.flashExec("Image","loadFromBlob",e.uid)}})}),e("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(e,t,n){var s=e.$;return t.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var e,t=this.owner,n=this.options,i=this._initAjax(),r=t._blob,o=n.server;i.connectRuntime(r.ruid),n.sendAsBinary?(o+=(/\?/.test(o)?"&":"?")+s.param(t._formData),e=r.uid):(s.each(t._formData,function(e,t){i.exec("append",e,t)}),i.exec("appendBlob",n.fileVal,r.uid,n.filename||t._formData.name||"")),this._setRequestHeader(i,n.headers),i.exec("send",{method:n.method,url:o,forceURLStream:n.forceURLStream,mimeType:"application/octet-stream"},e)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var e=this._xhr;e&&(e.exec("abort"),e.destroy(),this._xhr=e=null)},destroy:function(){this.abort()},_initAjax:function(){var r=this,o=new n("XMLHttpRequest");return o.on("uploadprogress progress",function(e){var t=e.loaded/e.total;return t=Math.min(1,Math.max(0,t)),r.trigger("progress",t)}),o.on("load",function(){var e,t=o.exec("getStatus"),n=!1,i="";return o.off(),r._xhr=null,200<=t&&t<300?n=!0:i=500<=t&&t<600?(n=!0,"server"):"http",n&&(r._response=o.exec("getResponse"),r._response=decodeURIComponent(r._response),e=_.JSON&&_.JSON.parse||function(e){try{return new Function("return "+e).call()}catch(e){return{}}},r._responseJson=r._response?e(r._response):{}),o.destroy(),o=null,i?r.trigger("error",i):r.trigger("load")}),o.on("error",function(){o.off(),r._xhr=null,r.trigger("error","http")}),r._xhr=o},_setRequestHeader:function(n,e){s.each(e,function(e,t){n.exec("setRequestHeader",e,t)})}})}),e("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(e,i){return e.register("Blob",{slice:function(e,t){var n=this.flashExec("Blob","slice",e,t);return new i(n.uid,n)}})}),e("runtime/flash/md5",["runtime/flash/runtime"],function(e){return e.register("Md5",{init:function(){},loadFromBlob:function(e){return this.flashExec("Md5","loadFromBlob",e.uid)}})}),e("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(e){return e}),e("webuploader",["preset/all"],function(e){return e}),t("webuploader")}(n,t,o))}var i,a={},r=function(e,t,n){var i,r={exports:t};"function"==typeof t&&(n.length||(n=[o,r.exports,r]),void 0!==(i=t.apply(null,n))&&(r.exports=i)),a[e]=r.exports},s=function(e){var t=a[e]||n[e];if(!t)throw new Error("`"+e+"` is undefined");return t};"object"==typeof module&&"object"==typeof module.exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):(i=n.WebUploader,n.WebUploader=e(),n.WebUploader.noConflict=function(){n.WebUploader=i})}(window);