!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.COS=e():t.COS=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="D:\\github\\cos-wx-sdk-v5\\demo\\lib",e(e.s=2)}([function(t,e,n){"use strict";(function(e){function r(t){return encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function o(t){return u(t,function(t){return"object"==typeof t?o(t):t})}function i(t,e){return s(e,function(n,r){t[r]=e[r]}),t}function a(t){return t instanceof Array}function s(t,e){for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)}function u(t,e){var n=a(t)?[]:{};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r],r));return n}var c=n(8),l=n(9),f=n(10),h=n(11),d=function(t){t=t||{};var e=t.SecretId,n=t.SecretKey,o=(t.method||t.Method||"get").toLowerCase(),i=t.pathname||t.Key||"/",a=t.params||"",s=t.headers||"";if(0!==i.indexOf("/")&&(i="/"+i),!e)return console.error("lack of param SecretId");if(!n)return console.error("lack of param SecretKey");var u=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e.sort()},c=function(t){var e,n,o,i=[],a=u(t);for(e=0;e-1||"deleteMultipleObject"===t||"multipartList"===t?n&&r:!(t.indexOf("Object")>-1||t.indexOf("multipart")>-1||"sliceUploadFile"===t||"abortUploadTask"===t)||n&&r&&o},C=function(t,e){var n={gz:"ap-guangzhou",tj:"ap-beijing-2",sh:"ap-shanghai",cd:"ap-chengdu"};return function(r,o){if(o=o||function(){},"getService"!==t&&"abortUploadTask"!==t){if(!v(t,r))return void o({error:"lack of required params"});if(r.Region&&n[r.Region])return void o({error:"Region should be "+n[r.Region]});if(r.Region&&r.Region.indexOf("cos.")>-1)return void o({error:'Region should not be start with "cos."'});if(r.Bucket){if(!/^(.+)-(\d+)$/.test(r.Bucket))if(r.AppId)r.Bucket=r.Bucket+"-"+r.AppId;else{if(!this.options.AppId)return void o({error:'Bucket should format as "test-1250000000".'});r.Bucket=r.Bucket+"-"+this.options.AppId}r.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete r.AppId)}r.Key&&"/"===r.Key.substr(0,1)&&(r.Key=r.Key.substr(1))}var i=e.call(this,r,o);if("getAuth"===t||"getObjectUrl"===t)return i}},m=function(t,e){function n(){if(o=0,e&&"function"==typeof e){r=Date.now();var n,i=Math.max(0,Math.round((s-a)/((r-u)/1e3)*100)/100);n=0===s&&0===t?1:Math.round(s/t*100)/100||0,u=r,a=s;try{e({loaded:s,total:t,speed:i,percent:n})}catch(t){}}}var r,o,i=this,a=0,s=0,u=Date.now();return function(e,r){if(e&&(s=e.loaded,t=e.total),r)clearTimeout(o),n();else{if(o)return;o=setTimeout(n,i.options.ProgressInterval)}}},A={apiWrapper:C,getAuth:d,xml2json:f,json2xml:h,md5:c,clearKey:p,binaryBase64:g,extend:i,isArray:a,each:s,map:u,clone:o,uuid:y,throttleOnProgress:m};t.exports=A}).call(e,n(1).Buffer)},function(t,e,n){"use strict";(function(t){function r(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),i.alloc(+t)}function y(t,e){if(i.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(t).length;default:if(r)return z(t).length;e=(""+e).toLowerCase(),r=!0}}function v(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return S(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function C(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=i.from(e,r)),i.isBuffer(e))return 0===e.length?-1:A(t,e,n,r,o);if("number"==typeof e)return e&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):A(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function A(t,e,n,r,o){function i(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}var c;if(o){var l=-1;for(c=n;cs&&(n=s-u),c=n;c>=0;c--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a239?4:i>223?3:i>191?2:1;if(o+s<=n){var u,c,l,f;switch(s){case 1:i<128&&(a=i);break;case 2:u=t[o+1],128==(192&u)&&(f=(31&i)<<6|63&u)>127&&(a=f);break;case 3:u=t[o+1],c=t[o+2],128==(192&u)&&128==(192&c)&&(f=(15&i)<<12|(63&u)<<6|63&c)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:u=t[o+1],c=t[o+2],l=t[o+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(f=(15&i)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&f<1114112&&(a=f)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=s}return b(r)}function b(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var n="",r=0;rr)&&(n=r);for(var o="",i=e;in)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,n,r,o,a){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(r?o:1-o)}function U(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(r?o:3-o)&255}function j(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,n,r,o){return o||j(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,n,r,23,4),n+4}function N(t,e,n,r,o){return o||j(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,n,r,52,8),n+8}function K(t){if(t=G(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function G(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){e=e||1/0;for(var n,r=t.length,o=null,i=[],a=0;a55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(t){for(var e=[],n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function W(t){return Z.toByteArray(K(t))}function X(t,e,n,r){for(var o=0;o=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function J(t){return t!==t}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var Z=n(5),V=n(6),$=n(7);e.Buffer=i,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),i.poolSize=8192,i._augment=function(t){return t.__proto__=i.prototype,t},i.from=function(t,e,n){return a(null,t,e,n)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(t,e,n){return u(null,t,e,n)},i.allocUnsafe=function(t){return c(null,t)},i.allocUnsafeSlow=function(t){return c(null,t)},i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,a=Math.min(n,r);o0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},i.prototype.compare=function(t,e,n,r,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var a=o-r,s=n-e,u=Math.min(a,s),c=this.slice(r,o),l=t.slice(e,n),f=0;fo)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return x(this,t,e,n);case"ascii":return w(this,t,e,n);case"latin1":case"binary":return R(this,t,e,n);case"base64":return B(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(o*=256);)r+=this[t+--e]*o;return r},i.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||D(t,e,this.length);for(var r=this[t],o=1,i=0;++i=o&&(r-=Math.pow(2,8*e)),r},i.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||D(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){M(this,t,e,n,Math.pow(2,8*n)-1,0)}var o=1,i=0;for(this[e]=255&t;++i=0&&(i*=256);)this[e+o]=t/i&255;return e+n},i.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,1,255,0),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},i.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);M(this,t,e,n,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},i.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);M(this,t,e,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,1,127,-128),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},i.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},i.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--o)t[o+e]=this[o+n];else if(a<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function o(t){return 3*t.length/4-r(t)}function i(t){var e,n,o,i,a,s=t.length;i=r(t),a=new f(3*s/4-i),n=i>0?s-4:s;var u=0;for(e=0;e>16&255,a[u++]=o>>8&255,a[u++]=255&o;return 2===i?(o=l[t.charCodeAt(e)]<<2|l[t.charCodeAt(e+1)]>>4,a[u++]=255&o):1===i&&(o=l[t.charCodeAt(e)]<<10|l[t.charCodeAt(e+1)]<<4|l[t.charCodeAt(e+2)]>>2,a[u++]=o>>8&255,a[u++]=255&o),a}function a(t){return c[t>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}function s(t,e,n){for(var r,o=[],i=e;iu?u:a+16383));return 1===r?(e=t[n-1],o+=c[e>>2],o+=c[e<<4&63],o+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],o+=c[e>>10],o+=c[e>>4&63],o+=c[e<<2&63],o+="="),i.push(o),i.join("")}e.byteLength=o,e.toByteArray=i,e.fromByteArray=u;for(var c=[],l=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d>1,l=-7,f=n?o-1:0,h=n?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),i-=c}return(d?-1:1)*a*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+f>=1?h/u:h*Math.pow(2,1-f),e*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,o),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;t[n+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[n+d]=255&a,d+=p,a/=256,c-=8);t[n+d-p]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){var n=function(t){function e(t,e){return t<>>32-e}function n(t,e){var n,r,o,i,a;return o=2147483648&t,i=2147483648&e,n=1073741824&t,r=1073741824&e,a=(1073741823&t)+(1073741823&e),n&r?2147483648^a^o^i:n|r?1073741824&a?3221225472^a^o^i:1073741824^a^o^i:a^o^i}function r(t,e,n){return t&e|~t&n}function o(t,e,n){return t&n|e&~n}function i(t,e,n){return t^e^n}function a(t,e,n){return e^(t|~n)}function s(t,o,i,a,s,u,c){return t=n(t,n(n(r(o,i,a),s),c)),n(e(t,u),o)}function u(t,r,i,a,s,u,c){return t=n(t,n(n(o(r,i,a),s),c)),n(e(t,u),r)}function c(t,r,o,a,s,u,c){return t=n(t,n(n(i(r,o,a),s),c)),n(e(t,u),r)}function l(t,r,o,i,s,u,c){return t=n(t,n(n(a(r,o,i),s),c)),n(e(t,u),r)}function f(t){var e,n,r="",o="";for(n=0;n<=3;n++)e=t>>>8*n&255,o="0"+e.toString(16),r+=o.substr(o.length-2,2);return r}var h,d,p,g,y,v,C,m,A,_=Array();for(t=function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(t),_=function(t){for(var e,n=t.length,r=n+8,o=(r-r%64)/64,i=16*(o+1),a=Array(i-1),s=0,u=0;u>>29,a}(t),v=1732584193,C=4023233417,m=2562383102,A=271733878,h=0;h<_.length;h+=16)d=v,p=C,g=m,y=A,v=s(v,C,m,A,_[h+0],7,3614090360),A=s(A,v,C,m,_[h+1],12,3905402710),m=s(m,A,v,C,_[h+2],17,606105819),C=s(C,m,A,v,_[h+3],22,3250441966),v=s(v,C,m,A,_[h+4],7,4118548399),A=s(A,v,C,m,_[h+5],12,1200080426),m=s(m,A,v,C,_[h+6],17,2821735955),C=s(C,m,A,v,_[h+7],22,4249261313),v=s(v,C,m,A,_[h+8],7,1770035416),A=s(A,v,C,m,_[h+9],12,2336552879),m=s(m,A,v,C,_[h+10],17,4294925233),C=s(C,m,A,v,_[h+11],22,2304563134),v=s(v,C,m,A,_[h+12],7,1804603682),A=s(A,v,C,m,_[h+13],12,4254626195),m=s(m,A,v,C,_[h+14],17,2792965006),C=s(C,m,A,v,_[h+15],22,1236535329),v=u(v,C,m,A,_[h+1],5,4129170786),A=u(A,v,C,m,_[h+6],9,3225465664),m=u(m,A,v,C,_[h+11],14,643717713),C=u(C,m,A,v,_[h+0],20,3921069994),v=u(v,C,m,A,_[h+5],5,3593408605),A=u(A,v,C,m,_[h+10],9,38016083),m=u(m,A,v,C,_[h+15],14,3634488961),C=u(C,m,A,v,_[h+4],20,3889429448),v=u(v,C,m,A,_[h+9],5,568446438),A=u(A,v,C,m,_[h+14],9,3275163606),m=u(m,A,v,C,_[h+3],14,4107603335),C=u(C,m,A,v,_[h+8],20,1163531501),v=u(v,C,m,A,_[h+13],5,2850285829),A=u(A,v,C,m,_[h+2],9,4243563512),m=u(m,A,v,C,_[h+7],14,1735328473),C=u(C,m,A,v,_[h+12],20,2368359562),v=c(v,C,m,A,_[h+5],4,4294588738),A=c(A,v,C,m,_[h+8],11,2272392833),m=c(m,A,v,C,_[h+11],16,1839030562),C=c(C,m,A,v,_[h+14],23,4259657740),v=c(v,C,m,A,_[h+1],4,2763975236),A=c(A,v,C,m,_[h+4],11,1272893353),m=c(m,A,v,C,_[h+7],16,4139469664),C=c(C,m,A,v,_[h+10],23,3200236656),v=c(v,C,m,A,_[h+13],4,681279174),A=c(A,v,C,m,_[h+0],11,3936430074),m=c(m,A,v,C,_[h+3],16,3572445317),C=c(C,m,A,v,_[h+6],23,76029189),v=c(v,C,m,A,_[h+9],4,3654602809),A=c(A,v,C,m,_[h+12],11,3873151461),m=c(m,A,v,C,_[h+15],16,530742520),C=c(C,m,A,v,_[h+2],23,3299628645),v=l(v,C,m,A,_[h+0],6,4096336452),A=l(A,v,C,m,_[h+7],10,1126891415),m=l(m,A,v,C,_[h+14],15,2878612391),C=l(C,m,A,v,_[h+5],21,4237533241),v=l(v,C,m,A,_[h+12],6,1700485571),A=l(A,v,C,m,_[h+3],10,2399980690),m=l(m,A,v,C,_[h+10],15,4293915773),C=l(C,m,A,v,_[h+1],21,2240044497),v=l(v,C,m,A,_[h+8],6,1873313359),A=l(A,v,C,m,_[h+15],10,4264355552),m=l(m,A,v,C,_[h+6],15,2734768916),C=l(C,m,A,v,_[h+13],21,1309151649),v=l(v,C,m,A,_[h+4],6,4149444226),A=l(A,v,C,m,_[h+11],10,3174756917),m=l(m,A,v,C,_[h+2],15,718787259),C=l(C,m,A,v,_[h+9],21,3951481745),v=n(v,d),C=n(C,p),m=n(m,g),A=n(A,y);return(f(v)+f(C)+f(m)+f(A)).toLowerCase()};t.exports=n},function(t,e){var n=n||function(t,e){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(t){o.prototype=this;var e=new o;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes;if(t=t.sigBytes,this.clamp(),r%4)for(var o=0;o>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else e.push.apply(e,n);return this.sigBytes+=t,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new a.init(n,e/2)}},c=s.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new a.init(n,e)}},l=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0);if(e=s*i,o=t.min(4*e,o),e){for(var u=0;uc;c++){if(16>c)i[c]=0|t[e+c];else{var l=i[c-3]^i[c-8]^i[c-14]^i[c-16];i[c]=l<<1|l>>>31}l=(r<<5|r>>>27)+u+i[c],l=20>c?l+(1518500249+(o&a|~o&s)):40>c?l+(1859775393+(o^a^s)):60>c?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),u=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=o._createHelper(e),t.HmacSHA1=o._createHmacHelper(e)}(),function(){var t=n,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,n){t=this._hasher=new t.init,"string"==typeof n&&(n=e.parse(n));var r=t.blockSize,o=4*r;n.sigBytes>o&&(n=t.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,u=a.words,c=0;c>>2]>>>24-i%4*8&255,s=e[i+1>>>2]>>>24-(i+1)%4*8&255,u=e[i+2>>>2]>>>24-(i+2)%4*8&255,c=a<<16|s<<8|u,l=0;l<4&&i+.75*l>>6*(3-l)&63));var f=r.charAt(64);if(f)for(;o.length%4;)o.push(f);return o.join("")},parse:function(t){var e=t.length,n=this._map,o=n.charAt(64);if(o){var i=t.indexOf(o);-1!=i&&(e=i)}for(var a=[],s=0,u=0;u>>6-u%4*2;a[s>>>2]|=(c|l)<<24-s%4*8,s++}return r.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.exports=n},function(t,e){var n=function(t){"use strict";function e(t){var e=t.localName;return null==e&&(e=t.baseName),null!=e&&""!=e||(e=t.nodeName),e}function n(t){return t.prefix}function r(t){return"string"==typeof t?t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):t}function o(t,e,n,r){for(var o=0;o0&&o(t.arrayAccessFormPaths,e,n,r)&&(e[n]=[e[n]])}function a(t){var e=t.split(/[-T:+Z]/g),n=new Date(e[0],e[1]-1,e[2]),r=e[5].split(".");if(n.setHours(e[3],e[4],r[0]),r.length>1&&n.setMilliseconds(r[1]),e[6]&&e[7]){var o=60*e[6]+Number(e[7]);o=0+("-"==(/\d\d-\d\d:\d\d$/.test(t)?"-":"+")?-1*o:o),n.setMinutes(n.getMinutes()-o-n.getTimezoneOffset())}else-1!==t.indexOf("Z",t.length-1)&&(n=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())));return n}function s(e,n,r){if(t.datetimeAccessFormPaths.length>0){var i=r.split(".#")[0];return o(t.datetimeAccessFormPaths,e,n,i)?a(e):e}return e}function u(e,n,r,i){return!(n==x.ELEMENT_NODE&&t.xmlElementsFilter.length>0)||o(t.xmlElementsFilter,e,r,i)}function c(r,o){if(r.nodeType==x.DOCUMENT_NODE){for(var a=new Object,l=r.childNodes,f=0;f1&&null!=a.__text&&t.skipEmptyTextNodesForObj&&(t.stripWhitespaces&&""==a.__text||""==a.__text.trim())&&delete a.__text:a=a.__cdata,delete a.__cnt,!t.enableToStringFunc||null==a.__text&&null==a.__cdata||(a.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),a}if(r.nodeType==x.TEXT_NODE||r.nodeType==x.CDATA_SECTION_NODE)return r.nodeValue}function l(e,n,o,i){var a="<"+(null!=e&&null!=e.__prefix?e.__prefix+":":"")+n;if(null!=o)for(var s=0;s":">"}function f(t,e){return""}function h(t,e){return-1!==t.indexOf(e,t.length-e.length)}function d(e,n){return!!("property"==t.arrayAccessForm&&h(n.toString(),"_asArray")||0==n.toString().indexOf(t.attributePrefix)||0==n.toString().indexOf("__")||e[n]instanceof Function)}function p(t){var e=0;if(t instanceof Object)for(var n in t)d(t,n)||e++;return e}function g(e,n,r){return 0==t.jsonPropertiesFilter.length||""==r||o(t.jsonPropertiesFilter,e,n,r)}function y(e){var n=[];if(e instanceof Object)for(var r in e)-1==r.toString().indexOf("__")&&0==r.toString().indexOf(t.attributePrefix)&&n.push(r);return n}function v(e){var n="";return null!=e.__cdata&&(n+=""),null!=e.__text&&(t.escapeMode?n+=r(e.__text):n+=e.__text),n}function C(e){var n="";return e instanceof Object?n+=v(e):null!=e&&(t.escapeMode?n+=r(e):n+=e),n}function m(t,e){return""===t?e:t+"."+e}function A(t,e,n,r){var o="";if(0==t.length)o+=l(t,e,n,!0);else for(var i=0;i0)for(var r in t)if(!d(t,r)&&(""==e||g(t,r,m(e,r)))){var o=t[r],i=y(o);if(null==o||void 0==o)n+=l(o,r,i,!0);else if(o instanceof Object)if(o instanceof Array)n+=A(o,r,i,e);else if(o instanceof Date)n+=l(o,r,i,!1),n+=o.toISOString(),n+=f(o,r);else{var a=p(o);a>0||null!=o.__text||null!=o.__cdata?(n+=l(o,r,i,!1),n+=_(o,m(e,r)),n+=f(o,r)):n+=l(o,r,i,!0)}else n+=l(o,r,i,!1),n+=C(o),n+=f(o,r)}return n+=C(t)}t=t||{},function(){void 0===t.escapeMode&&(t.escapeMode=!0),t.attributePrefix=t.attributePrefix||"_",t.arrayAccessForm=t.arrayAccessForm||"none",t.emptyNodeForm=t.emptyNodeForm||"text",void 0===t.enableToStringFunc&&(t.enableToStringFunc=!0),t.arrayAccessFormPaths=t.arrayAccessFormPaths||[],void 0===t.skipEmptyTextNodesForObj&&(t.skipEmptyTextNodesForObj=!0),void 0===t.stripWhitespaces&&(t.stripWhitespaces=!0),t.datetimeAccessFormPaths=t.datetimeAccessFormPaths||[],void 0===t.useDoubleQuotes&&(t.useDoubleQuotes=!1),t.xmlElementsFilter=t.xmlElementsFilter||[],t.jsonPropertiesFilter=t.jsonPropertiesFilter||[],void 0===t.keepCData&&(t.keepCData=!1)}();var x={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};this.parseXmlString=function(t){if(void 0===t)return null;var e;if(DOMParser){var n=new DOMParser,r=null;try{r=n.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(t){r=null}try{e=n.parseFromString(t,"text/xml"),null!=r&&e.getElementsByTagNameNS(r,"parsererror").length>0&&(e=null)}catch(t){e=null}}else 0==t.indexOf("")+2)),e=new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(t);return e},this.asArray=function(t){return void 0===t||null==t?[]:t instanceof Array?t:[t]},this.toXmlDateTime=function(t){return t instanceof Date?t.toISOString():"number"==typeof t?new Date(t).toISOString():null},this.asDateTime=function(t){return"string"==typeof t?a(t):t},this.xml2json=function(t){return c(t)},this.xml_str2json=function(t){var e=this.parseXmlString(t);return null!=e?this.xml2json(e):null},this.json2xml_str=function(t){return _(t,"")},this.json2xml=function(t){var e=this.json2xml_str(t);return this.parseXmlString(e)},this.getVersion=function(){return"1.2.0"}},r=function(t){var e=new DOMParser,r=e.parseFromString(t,"text/xml"),o=new n,i=o.xml2json(r);return i.html&&i.getElementsByTagName("parsererror").length?null:i};t.exports=r},function(t,e){function n(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(o,"")}var r=new RegExp("^([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�])|^((x|X)(m|M)(l|L))|([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�-.0-9·̀-ͯ‿⁀])","g"),o=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,i=function(t){var e=[];if(t instanceof Object)for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},a=function(t,e){var o=function(t,n,o,i,a){var s=void 0!==e.indent?e.indent:"\t",u=e.prettyPrint?"\n"+new Array(i).join(s):"";e.removeIllegalNameCharacters&&(t=t.replace(r,"_"));var c=[u,"<",t,o||""];return n&&n.length>0?(c.push(">"),c.push(n),a&&c.push(u),c.push("")):c.push("/>"),c.join("")};return function t(r,a,s){var u=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?u="array":r instanceof Date&&(u="date"),u){case"array":var c=[];return r.map(function(e){c.push(t(e,1,s+1))}),e.prettyPrint&&c.push("\n"),c.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":var l=[];for(var f in r)if(r[f]instanceof Array)for(var h in r[f])l.push(o(f,t(r[f][h],0,s+1),null,s+1,i(r[f][h]).length));else l.push(o(f,t(r[f],0,s+1),null,s+1));return e.prettyPrint&&l.length>0&&l.push("\n"),l.join("");case"function":return r();default:return e.escape?n(r):""+r}}(t,0,0)},s=function(t){var e=['"),e.join("")},u=function(t,e){e||(e={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" "});var n=this.Buffer||function(){};if("string"==typeof t||t instanceof n)try{t=JSON.parse(t.toString())}catch(t){return!1}var r="",o="";return e&&("object"==typeof e?(e.xmlHeader&&(r=s(!!e.xmlHeader.standalone)),void 0!==e.docType&&(o="")):r=s()),e=e||{},[r,e.prettyPrint&&o?"\n":"",o,a(t,e)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")};t.exports=u},function(t,e){var n=function(t){var e={},n=function(t){return!e[t]&&(e[t]=[]),e[t]};t.on=function(t,e){n(t).push(e)},t.off=function(t,e){for(var r=n(t),o=r.length-1;o>=0;o--)e===r[o]&&r.splice(o,1)},t.emit=function(t,e){for(var r=n(t).map(function(t){return t}),o=0;o-1&&(r[o]=t[o]);var i=t.Body;if(!i||"string"!=typeof i)return void e({error:"params body format error, Only allow Buffer, Stream, Blob."});r["Content-Length"]=i.length,L.call(this,{TaskId:t.TaskId,method:"PUT",Bucket:t.Bucket,Region:t.Region,Key:t.Key,headers:r,body:i},function(r,o){if(r)return e(r);if(o&&o.headers&&o.headers.etag){var i=D({domain:n.options.Domain,bucket:t.Bucket,region:t.Region,object:t.Key});return e(null,{Location:i,ETag:o.headers.etag,statusCode:o.statusCode,headers:o.headers})}e(null,o)})}function B(t,e){var n=this,r={};r["Cache-Control"]=t.CacheControl,r["Content-Disposition"]=t.ContentDisposition,r["Content-Encoding"]=t.ContentEncoding,r["Content-MD5"]=t.ContentMD5,r["Content-Length"]=t.ContentLength,r["Content-Type"]=t.ContentType,r.Expect=t.Expect,r.Expires=t.Expires,r["x-cos-acl"]=t.ACL,r["x-cos-grant-read"]=t.GrantRead,r["x-cos-grant-write"]=t.GrantWrite,r["x-cos-grant-full-control"]=t.GrantFullControl,r["x-cos-storage-class"]=t.StorageClass;var o=t.FilePath;for(var i in t)i.indexOf("x-cos-meta-")>-1&&(r[i]=t[i]);var a=j.throttleOnProgress.call(n,r["Content-Length"],t.onProgress);L.call(this,{method:"POST",Bucket:t.Bucket,Region:t.Region,Key:t.Key,headers:r,filePath:o,onProgress:a},function(r,o){if(a(null,!0),r)return e(r);if(o&&o.headers&&o.headers.etag){var i=D({domain:n.options.Domain,bucket:t.Bucket,region:t.Region,object:t.Key});return e(null,{Location:i,ETag:o.headers.etag,statusCode:o.statusCode,headers:o.headers})}e(null,o)})}function E(t,e){L.call(this,{method:"DELETE",Bucket:t.Bucket,Region:t.Region,Key:t.Key},function(t,n){if(t){var r=t.statusCode;return r&&204===r?e(null,{statusCode:r}):r&&404===r?e(null,{BucketNotFound:!0,statusCode:r}):e(t)}e(null,{statusCode:n.statusCode,headers:n.headers})})}function T(t,e){L.call(this,{method:"GET",Bucket:t.Bucket,Region:t.Region,Key:t.Key,action:"?acl"},function(t,n){if(t)return e(t);var r=n.AccessControlPolicy.Owner||{},o=n.AccessControlPolicy.AccessControlList.Grant||[];o=j.isArray(o)?o:[o];var i=I(n.AccessControlPolicy);n.headers&&n.headers["x-cos-acl"]&&(i.ACL=n.headers["x-cos-acl"]),i=j.extend(i,{Owner:r,Grants:o,statusCode:n.statusCode,headers:n.headers}),e(null,i)})}function k(t,e){var n={};n["x-cos-acl"]=t.ACL,n["x-cos-grant-read"]=t.GrantRead,n["x-cos-grant-write"]=t.GrantWrite,n["x-cos-grant-full-control"]=t.GrantFullControl;var r="";if(t.AccessControlPolicy){var o=j.clone(t.AccessControlPolicy||{}),i=o.Grants||o.Grant;i=j.isArray(i)?i:[i],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:i},r=j.json2xml({AccessControlPolicy:o}),n["Content-MD5"]=j.binaryBase64(j.md5(r)),n["Content-Type"]="application/xml"}L.call(this,{method:"PUT",Bucket:t.Bucket,Region:t.Region,Key:t.Key,action:"?acl",headers:n,body:r},function(t,n){if(t)return e(t);e(null,{statusCode:n.statusCode,headers:n.headers})})}function b(t,e){var n={};n.Origin=t.Origin,n["Access-Control-Request-Method"]=t.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=t.AccessControlRequestHeaders,L.call(this,{method:"OPTIONS",Bucket:t.Bucket,Region:t.Region,Key:t.Key,headers:n},function(t,n){if(t)return t.statusCode&&403==t.statusCode?e(null,{OptionsForbidden:!0,statusCode:t.statusCode}):e(t);var r=n.headers||{};e(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})}function S(t,e){var n={};n["x-cos-copy-source"]=t.CopySource,n["x-cos-metadata-directive"]=t.MetadataDirective,n["x-cos-copy-source-If-Modified-Since"]=t.CopySourceIfModifiedSince,n["x-cos-copy-source-If-Unmodified-Since"]=t.CopySourceIfUnmodifiedSince,n["x-cos-copy-source-If-Match"]=t.CopySourceIfMatch,n["x-cos-copy-source-If-None-Match"]=t.CopySourceIfNoneMatch,n["x-cos-storage-class"]=t.StorageClass,n["x-cos-acl"]=t.ACL,n["x-cos-grant-read"]=t.GrantRead,n["x-cos-grant-write"]=t.GrantWrite,n["x-cos-grant-full-control"]=t.GrantFullControl,n["Cache-Control"]=t.CacheControl,n["Content-Disposition"]=t.ContentDisposition,n["Content-Encoding"]=t.ContentEncoding,n["Content-Length"]=t.ContentLength,n["Content-Type"]=t.ContentType,n.Expect=t.Expect,n.Expires=t.Expires;for(var r in t)r.indexOf("x-cos-meta-")>-1&&(n[r]=t[r]);L.call(this,{method:"PUT",Bucket:t.Bucket,Region:t.Region,Key:t.Key,headers:n},function(t,n){if(t)return e(t);var r=j.clone(n.CopyObjectResult);j.extend(r,{statusCode:n.statusCode,headers:n.headers}),e(null,r)})}function P(t){return j.getAuth({Method:t.Method,Key:t.Key,Expires:t.Expires,SecretId:t.SecretId||this.options.SecretId||"",SecretKey:t.SecretKey||this.options.SecretKey||""})}function O(t,e){var n=this,r=D({domain:n.options.Domain,bucket:t.Bucket,region:t.Region,object:t.Key});if(void 0!==t.Sign&&!t.Sign)return e(null,{Url:r}),r;var o=M.call(this,{Method:t.Method||"get",Key:t.Key},function(t){if(e){var n={Url:r+"?sign="+encodeURIComponent(t.Authorization)};t.XCosSecurityToken&&(n.XCosSecurityToken=t.XCosSecurityToken),t.ClientIP&&(n.ClientIP=t.ClientIP),t.ClientUA&&(n.ClientUA=t.ClientUA),t.Token&&(n.Token=t.Token),setTimeout(function(){e(null,n)})}});return o?r+"?sign="+encodeURIComponent(o):r}function I(t){var e={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},n={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},r=t.AccessControlList.Grant;r&&(r=j.isArray(r)?r:[r]);var o={READ:0,WRITE:0,FULL_CONTROL:0};return r.length&&j.each(r,function(r){"qcs::cam::anyone:anyone"===r.Grantee.ID||"http://cam.qcloud.com/groups/global/AllUsers"===r.Grantee.URI?o[r.Permission]=1:r.Grantee.ID!==t.Owner.ID&&e[n[r.Permission]].push('id="'+r.Grantee.ID+'"')}),o.FULL_CONTROL||o.WRITE&&o.READ?e.ACL="public-read-write":o.READ?e.ACL="public-read":e.ACL="private",j.each(n,function(t){e[t]=e[t].join(",")}),e}function D(t){var e=t.bucket,n=e.substr(0,e.lastIndexOf("-")),r=e.substr(e.lastIndexOf("-")+1),o=t.domain,i=t.region,a=t.object,s=t.action;o||(o=["cn-south","cn-south-2","cn-north","cn-east","cn-southwest","sg"].indexOf(i)>-1?"{{Bucket}}-{{AppId}}.{{Region}}.myqcloud.com":"{{Bucket}}-{{AppId}}.cos.{{Region}}.myqcloud.com"),o=o.replace(/\{\{AppId\}\}/gi,r).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,i).replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(o)||(o="https://"+o),"/"===o.slice(-1)&&(o=o.slice(0,-1));var u=o;return a&&(u+="/"+encodeURIComponent(a).replace(/%2F/g,"/")),s&&(u+=s),t.isLocation&&(u=u.replace(/^https?:\/\//,"")),u}function M(t,e){var n=this;if(n.options.getAuthorization)n.options.getAuthorization.call(n,{Method:t.Method,Key:t.Key},function(t){"string"==typeof t&&(t={Authorization:t}),e&&e(t)});else{if(!n.options.getSTS){var r=j.getAuth({SecretId:t.SecretId||n.options.SecretId,SecretKey:t.SecretKey||n.options.SecretKey,Method:t.Method,Key:t.Key});return e&&e({Authorization:r}),r}var o=t.Bucket||"";n._StsMap=n._StsMap||{};var i=n._StsMap[o]||{},a=function(){var n=j.getAuth({SecretId:i.SecretId,SecretKey:i.SecretKey,Method:t.Method,Key:t.Key}),r={Authorization:n,XCosSecurityToken:i.XCosSecurityToken||"",Token:i.Token||"",ClientIP:i.ClientIP||"",ClientUA:i.ClientUA||""};e&&e(r)};i.ExpiredTime&&i.ExpiredTime-(Date.now()/1e3>60)?a():n.options.getSTS.call(n,{Bucket:o},function(t){i=n._StsMap[o]=t||{},a()})}return""}function L(t,e){var n=this,r=t.action||"post"!==t.method.toLowerCase()?t.Key:"";M.call(n,{Method:t.method,Key:r},function(r){t.AuthData=r,U.call(n,t,e)})}function U(t,e){var n=this,r=t.TaskId;if(!r||n._isRunningTask(r)){var o=t.Bucket,i=t.Region,a=t.Key,s=t.action,u=t.method||"GET",c=t.headers||{},l=t.url,f=t.body,h=t.filePath,d=t.json,p=t.rawBody,g=t.qs,y={url:l||D({domain:n.options.Domain,bucket:o,region:i,object:a,action:s}),method:u,headers:c||{},filePath:h,qs:g,body:f,json:d};y.headers.Authorization=t.AuthData.Authorization,t.AuthData.Token&&(y.headers.token=t.AuthData.Token),t.AuthData.ClientIP&&(y.headers.clientIP=t.AuthData.ClientIP),t.AuthData.ClientUA&&(y.headers.clientUA=t.AuthData.ClientUA),t.AuthData.XCosSecurityToken&&(y.headers["x-cos-security-token"]=t.AuthData.XCosSecurityToken),y.headers&&(y.headers=j.clearKey(y.headers)),y.qs&&(y.qs=j.clearKey(y.qs)),y=j.clearKey(y),t.onProgress&&"function"==typeof t.onProgress&&(y.onProgress=function(e){if(!r||n._isRunningTask(r)){var o=e?e.loaded:0;t.onProgress({loaded:o,total:e.total})}});var v=F(y,function(t,o,i){var a=function(t,i){r&&n.off("inner-kill-task",C),r&&!n._isRunningTask(r)||(t?(t=t||{},o&&o.statusCode&&(t.statusCode=o.statusCode),o&&o.headers&&(t.headers=o.headers),e(t,null)):(i=i||{},o&&o.statusCode&&(i.statusCode=o.statusCode),o&&o.headers&&(i.headers=o.headers),e(null,i)))};if(t)return void a({error:t});var s;try{s=j.xml2json(i)||{}}catch(t){s=i||{}}var u=o.statusCode;return 200!==u&&204!==u&&206!==u?void a({error:s.Error||s}):(p&&(s={},s.body=i),s.Error?void a({error:s.Error}):void a(null,s))}),C=function(t){t.TaskId===r&&(v&&v.abort&&v.abort(),n.off("inner-kill-task",C))};r&&n.on("inner-kill-task",C)}}var j=n(0),F=n(15),N={getService:r,putBucket:a,getBucket:i,headBucket:o,deleteBucket:s,getBucketAcl:u,putBucketAcl:c,getBucketCors:l,putBucketCors:f,deleteBucketCors:h,getBucketLocation:p,putBucketTagging:v,getBucketTagging:y,deleteBucketTagging:C,getBucketPolicy:g,putBucketPolicy:d,getBucketLifecycle:A,putBucketLifecycle:m,deleteBucketLifecycle:_,getObject:w,headObject:x,putObject:R,postObject:B,deleteObject:E,getObjectAcl:T,putObjectAcl:k,optionsObject:b,putObjectCopy:S,getObjectUrl:O,getAuth:P};j.each(N,function(t,n){e[n]=j.apiWrapper(n,t)})}).call(e,n(1).Buffer)},function(t,e){var n=function(t){var e,n,r,o=[],i=Object.keys(t);for(e=0;e-1?"&":"?")+h),wx.request({url:a,method:s,header:i,dataType:"text",data:t.body,success:function(t){c(null,t)},fail:function(t){c(t.errMsg,t)}})}return r};t.exports=r}])});