WordPress/wp-includes/js/plupload/moxie.min.js

3 lines
87 KiB
JavaScript
Raw Normal View History

var MXI_DEBUG=!1;!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f<a.length;++f){if(c=g[a[f]]||e(a[f]),!c)throw"module definition dependecy not found: "+a[f];d.push(c)}b.apply(null,d)}function d(a,d,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(d===b)throw"invalid module definition, dependencies must be specified";if(e===b)throw"invalid module definition, definition function must be specified";c(d,function(){g[a]=e.apply(null,arguments)})}function e(b){for(var c=a,d=b.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function f(c){for(var d=0;d<c.length;d++){for(var e=a,f=c[d],h=f.split(/[.\/]/),i=0;i<h.length-1;++i)e[h[i]]===b&&(e[h[i]]={}),e=e[h[i]];e[h[h.length-1]]=g[f]}}var g={};d("moxie/core/utils/Basic",[],function(){var a=function(a){var b;return a===b?"undefined":null===a?"null":a.nodeType?"node":{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},b=function(d){var e;return c(arguments,function(f,h){h>0&&c(f,function(c,f){c!==e&&(a(d[f])===a(c)&&~g(a(c),["array","object"])?b(d[f],c):d[f]=c)})}),d},c=function(b,c){var d,e,f;if(b)if("number"===a(b.length)){for(f=0,d=b.length;f<d;f++)if(c(b[f],f)===!1)return}else if("object"===a(b))for(e in b)if(b.hasOwnProperty(e)&&c(b[e],e)===!1)return},d=function(b){var c;if(!b||"object"!==a(b))return!0;for(c in b)return!1;return!0},e=function(b,c){function d(e){"function"===a(b[e])&&b[e](function(a){++e<f&&!a?d(e):c(a)})}var e=0,f=b.length;"function"!==a(c)&&(c=function(){}),b&&b.length||c(),d(e)},f=function(a,b){var d=0,e=a.length,f=new Array(e);c(a,function(a,c){a(function(a){if(a)return b(a);var g=[].slice.call(arguments);g.shift(),f[c]=g,d++,d===e&&(f.unshift(null),b.apply(this,f))})})},g=function(a,b){if(b){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c}return-1},h=function(b,c){var d=[];"array"!==a(b)&&(b=[b]),"array"!==a(c)&&(c=[c]);for(var e in b)g(b[e],c)===-1&&d.push(b[e]);return!!d.length&&d},i=function(a,b){var d=[];return c(a,function(a){g(a,b)!==-1&&d.push(a)}),d.length?d:null},j=function(a){var b,c=[];for(b=0;b<a.length;b++)c[b]=a[b];return c},k=function(){var a=0;return function(b){var c,d=(new Date).getTime().toString(32);for(c=0;c<5;c++)d+=Math.floor(65535*Math.random()).toString(32);return(b||"o_")+d+(a++).toString(32)}}(),l=function(a){return a?String.prototype.trim?String.prototype.trim.call(a):a.toString().replace(/^\s*/,"").replace(/\s*$/,""):a},m=function(a){if("string"!=typeof a)return a;var b,c={t:1099511627776,g:1073741824,m:1048576,k:1024};return a=/^([0-9\.]+)([tmgk]?)$/.exec(a.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),b=a[2],a=+a[1],c.hasOwnProperty(b)&&(a*=c[b]),Math.floor(a)},n=function(b){var c=[].slice.call(arguments,1);return b.replace(/%[a-z]/g,function(){var b=c.shift();return"undefined"!==a(b)?b:""})};return{guid:k,typeOf:a,extend:b,each:c,isEmptyObj:d,inSeries:e,inParallel:f,inArray:g,arrayDiff:h,arrayIntersect:i,toArray:j,trim:l,sprintf:n,parseSizeStr:m}}),d("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(a){function b(a,b,c){var d=0,e=0,f=0,g={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},h=function(a){return a=(""+a).replace(/[_\-+]/g,"."),a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),a.length?a.split("."):[-8]},i=function(a){return a?isNaN(a)?g[a]||-7:parseInt(a,10):0};for(a=h(a),b=h(b),e=Math.max(a.length,b.length),d=0;d<e;d++)if(a[d]!=b[d]){if(a[d]=i(a[d]),b[d]=i(b[d]),a[d]<b[d]){f=-1;break}if(a[d]>b[d]){f=1;break}}if(!c)return f;switch(c){case">":case"gt":return f>0;case">=":case"ge":return f>=0;case"<=":case"le":return f<=0;case"==":case"=":case"eq":return 0===f;case"<>":case"!=":case"ne":return 0!==f;case"":case"<":case"lt":return f<0;default:return null}}var c=function(a){var b="",c="?",d="function",e="undefined",f="object",g="name",h="version",i={has:function(a,b){return b.toLowerCase().indexOf(a.toLowerCase())!==-1},lowerize:function(a){return a.toLowerCase()}},j={rgx:function(){for(var b,c,g,h,i,j,k,l=0,m=argumen
}f.call(this),a.extend(this,{uid:a.guid("uid_"),readyState:g.EMPTY,result:null,error:null,readAsBinaryString:function(a){d.call(this,"readAsBinaryString",a)},readAsDataURL:function(a){d.call(this,"readAsDataURL",a)},readAsText:function(a){d.call(this,"readAsText",a)},abort:function(){this.result=null,a.inArray(this.readyState,[g.EMPTY,g.DONE])===-1&&(this.readyState===g.LOADING&&(this.readyState=g.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(h),this.bind("Error",function(a,b){this.readyState=g.DONE,this.error=b},999),this.bind("Load",function(a){this.readyState=g.DONE},999)}var h=["loadstart","progress","load","abort","error","loadend"];return g.EMPTY=0,g.LOADING=1,g.DONE=2,g.prototype=d.instance,g}),d("moxie/core/utils/Url",[],function(){var a=function(b,c){for(var d=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],e=d.length,f={http:80,https:443},g={},h=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,i=h.exec(b||"");e--;)i[e]&&(g[d[e]]=i[e]);if(!g.scheme){c&&"string"!=typeof c||(c=a(c||document.location.href)),g.scheme=c.scheme,g.host=c.host,g.port=c.port;var j="";/^[^\/]/.test(g.path)&&(j=c.path,j=/\/[^\/]*\.[^\/]*$/.test(j)?j.replace(/\/[^\/]+$/,"/"):j.replace(/\/?$/,"/")),g.path=j+(g.path||"")}return g.port||(g.port=f[g.scheme]||80),g.port=parseInt(g.port,10),g.path||(g.path="/"),delete g.source,g},b=function(b){var c={http:80,https:443},d="object"==typeof b?b:a(b);return d.scheme+"://"+d.host+(d.port!==c[d.scheme]?":"+d.port:"")+d.path+(d.query?d.query:"")},c=function(b){function c(a){return[a.scheme,a.host,a.port].join("/")}return"string"==typeof b&&(b=a(b)),c(a())===c(b)};return{parseUrl:a,resolveUrl:b,hasSameOrigin:c}}),d("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(a,b,c){function d(){this.uid=a.guid("uid_"),b.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return d.prototype=c.instance,d}),d("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(a,b,c){return function(){function d(a,b){if(!b.isDetached()){var d=this.connectRuntime(b.ruid).exec.call(this,"FileReaderSync","read",a,b);return this.disconnectRuntime(),d}var e=b.getSource();switch(a){case"readAsBinaryString":return e;case"readAsDataURL":return"data:"+b.type+";base64,"+c.btoa(e);case"readAsText":for(var f="",g=0,h=e.length;g<h;g++)f+=String.fromCharCode(e[g]);return f}}b.call(this),a.extend(this,{uid:a.guid("uid_"),readAsBinaryString:function(a){return d.call(this,"readAsBinaryString",a)},readAsDataURL:function(a){return d.call(this,"readAsDataURL",a)},readAsText:function(a){return d.call(this,"readAsText",a)}})}}),d("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(a,b,c){function d(){var a,d=[];b.extend(this,{append:function(e,f){var g=this,h=b.typeOf(f);f instanceof c?a={name:e,value:f}:"array"===h?(e+="[]",b.each(f,function(a){g.append(e,a)})):"object"===h?b.each(f,function(a,b){g.append(e+"["+b+"]",a)}):"null"===h||"undefined"===h||"number"===h&&isNaN(f)?g.append(e,"false"):d.push({name:e,value:f.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return a&&a.value||null},getBlobName:function(){return a&&a.name||null},each:function(c){b.each(d,function(a){c(a.value,a.name)}),a&&c(a.value,a.name)},destroy:function(){a=null,d=[]}})}return d}),d("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils
break}default:return b}},length:function(){return b?b.byteLength:0},clear:function(){c=b=null}})}function d(b){function c(a,c,d){d=3===arguments.length?d:b.length-c-1,b=b.substr(0,c)+a+b.substr(d+c)}a.extend(this,{readByteAt:function(a){return b.charCodeAt(a)},writeByteAt:function(a,b){c(String.fromCharCode(b),a,1)},SEGMENT:function(a,d,e){switch(arguments.length){case 1:return b.substr(a);case 2:return b.substr(a,d);case 3:c(null!==e?e:"",a,d);break;default:return b}},length:function(){return b?b.length:0},clear:function(){b=null}})}return a.extend(b.prototype,{littleEndian:!1,read:function(a,b){var c,d,e;if(a+b>this.length())throw new Error("You are trying to read outside the source boundaries.");for(d=this.littleEndian?0:-8*(b-1),e=0,c=0;e<b;e++)c|=this.readByteAt(a+e)<<Math.abs(d+8*e);return c},write:function(a,b,c){var d,e;if(a>this.length())throw new Error("You are trying to write outside the source boundaries.");for(d=this.littleEndian?0:-8*(c-1),e=0;e<c;e++)this.writeByteAt(a+e,b>>Math.abs(d+8*e)&255)},BYTE:function(a){return this.read(a,1)},SHORT:function(a){return this.read(a,2)},LONG:function(a){return this.read(a,4)},SLONG:function(a){var b=this.read(a,4);return b>2147483647?b-4294967296:b},CHAR:function(a){return String.fromCharCode(this.read(a,1))},STRING:function(a,b){return this.asArray("CHAR",a,b).join("")},asArray:function(a,b,c){for(var d=[],e=0;e<c;e++)d[e]=this[a](b+e);return d}}),b}),d("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(a,b){return function c(d){var e,f,g,h=[],i=0;if(e=new a(d),65496!==e.SHORT(0))throw e.clear(),new b.ImageError(b.ImageError.WRONG_FORMAT);for(f=2;f<=e.length();)if(g=e.SHORT(f),g>=65488&&g<=65495)f+=2;else{if(65498===g||65497===g)break;i=e.SHORT(f+2)+2,g>=65505&&g<=65519&&h.push({hex:g,name:"APP"+(15&g),start:f,length:i,segment:e.SEGMENT(f,i)}),f+=i}return e.clear(),{headers:h,restore:function(b){var c,d,e;for(e=new a(b),f=65504==e.SHORT(2)?4+e.SHORT(4):2,d=0,c=h.length;d<c;d++)e.SEGMENT(f,0,h[d].segment),f+=h[d].length;return b=e.SEGMENT(),e.clear(),b},strip:function(b){var d,e,f,g;for(f=new c(b),e=f.headers,f.purge(),d=new a(b),g=e.length;g--;)d.SEGMENT(e[g].start,e[g].length,"");return b=d.SEGMENT(),d.clear(),b},get:function(a){for(var b=[],c=0,d=h.length;c<d;c++)h[c].name===a.toUpperCase()&&b.push(h[c].segment);return b},set:function(a,b){var c,d,e,f=[];for("string"==typeof b?f.push(b):f=b,c=d=0,e=h.length;c<e&&(h[c].name===a.toUpperCase()&&(h[c].segment=f[d],h[c].length=f[d].length,d++),!(d>=f.length));c++);},purge:function(){this.headers=h=[]}}}}),d("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(a,c,d){function e(f){function g(c,e){var f,g,h,i,j,m,n,o,p=this,q=[],r={},s={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},t={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(f=p.SHORT(c),g=0;g<f;g++)if(q=[],n=c+2+12*g,h=e[p.SHORT(n)],h!==b){if(i=s[p.SHORT(n+=2)],j=p.LONG(n+=2),m=t[i],!m)throw new d.ImageError(d.ImageError.INVALID_META_ERR);if(n+=4,m*j>4&&(n=p.LONG(n)+l.tiffHeader),n+m*j>=this.length())throw new d.ImageError(d.ImageError.INVALID_META_ERR);"ASCII"!==i?(q=p.asArray(i,n,j),o=1==j?q[0]:q,k.hasOwnProperty(h)&&"object"!=typeof o?r[h]=k[h][o]:r[h]=o):r[h]=a.trim(p.STRING(n,j).replace(/\0$/,""))}return r}function h(a,b,c){var d,e,f,g=0;if("string"==typeof b){var h=j[a.toLowerCase()];for(var i in h)if(h[i]===b){b=i;break}}d=l[a.toLowerCase()+"IFD"],e=this.SHORT(d);for(var k=0;k<e;k++)if(f=d+12*k+2,this.SHORT(f)==b){g=f+8;break}if(!g)return!1;try{this.write(g,c,4)}catch(m){return!1}return!0}var i,j,k,l,m,n;if(c.call(this,f),j={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",