"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;s1024;)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;++l1))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=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.size0&&(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=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;l1&&(~"http,abort".indexOf(d)||e.serverNeedRetry)&&e.retried1&&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;y1&&(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;s0){for(u=[],o=0,t=s.accept.length;o=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;i6&&(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;lu.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;au.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>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<>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>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<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=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<>>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>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>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>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>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>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',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=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")});