!function(){"use strict";var a,t,c,n,r,i,e,o,s,h,u,f,l,p,g,d,y,S=S||(a=Math,l=(p={}).lib={},t=l.Base={extend:function(e){m.prototype=this;var t=new m;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=l.WordArray=t.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||n).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var i=0;i>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=a.ceil(t/4)},clone:function(){var e=t.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new c.init(n,t/2)}},r=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new c.init(n,t)}},i=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(r.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return r.parse(unescape(encodeURIComponent(e)))}},e=l.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=i.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,n=t.words,r=t.sigBytes,i=this.blockSize,o=r/(4*i),o=e?a.ceil(o):a.max((0|o)-this._minBufferSize,0),r=a.min(4*(e=o*i),r);if(e){for(var s=0;s>>31,n=(i<<5|i>>>27)+c+f[h],n=h<20?n+(1518500249+(o&s|~o&a)):h<40?n+(1859775393+(o^s^a)):h<60?n+((o&s|o&a|s&a)-1894007588):n+((o^s^a)-899497514),c=a,a=s,s=o<<30|o>>>2,o=i,i=n;r[0]=r[0]+i|0,r[1]=r[1]+o|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(64+r>>>9<<4)]=Math.floor(n/4294967296),t[15+(64+r>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=u.clone.call(this);return e._hash=this._hash.clone(),e}}),s.SHA1=u._createHelper(l),s.HmacSHA1=u._createHmacHelper(l),g=(p=S).enc.Utf8,p.algo.HMAC=p.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=g.parse(t));var n=e.blockSize,r=4*n;(t=t.sigBytes>r?e.finalize(t):t).clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),i=e.words,o=t.words,s=0;s>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=r.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){for(var t,n,r=e.length,i=this._map,o=i.charAt(64),s=(o&&-1!=(o=e.indexOf(o))&&(r=o),[]),a=0,c=0;c>>6-c%4*2,s[a>>>2]|=(t|n)<<24-a%4*8,a++);return y.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function w(e){var t,n,r,i,o,s,a,c,h,u,f,l,p,g,d,y,m,w;return e.SecretId?e.SecretKey?"4.0"===e.Version?(n=(t=e).Pathname||"/",r=t.Expires,s=i="",(o=t.Bucket.match(/^(.+)-(\d+)$/))&&(i=o[1],s=o[2]),o=parseInt(Math.random()*Math.pow(2,32)),a=parseInt(Date.now()/1e3),r=a+(void 0===r?900:+r||0),n="/"+s+"/"+i+encodeURIComponent(n).replace(/%2F/g,"/"),s="a="+s+"&b="+i+"&k="+t.SecretId+"&e="+r+"&t="+a+"&r="+o+"&f="+n,i=S.HmacSHA1(s,t.SecretKey),r=S.enc.Utf8.parse(s),a=i.concat(r).toString(S.enc.Base64),console.log("sign:",a),o=v(s,t.SecretKey),console.log("res:",o),console.log("sign1:",A(o)),console.log("sign2:",A(s)),console.log("sign2:",A(o+s)),a):"post-object-policy"===e.Version?(n=e,i=Math.round(Date.now()/1e3),r=i+(n.Expires||900),i=i+";"+r,r=JSON.stringify({expiration:new Date(1e3*r).toISOString(),conditions:[{"q-sign-algorithm":"sha1"},{"q-ak":n.SecretId},{"q-sign-time":i},{bucket:n.Bucket},{key:n.Key}]}),t=v(i,n.SecretKey),o=B(r),o=v(o,t),{policyObj:JSON.parse(r),policy:A(r),qSignAlgorithm:"sha1",qAk:n.SecretId,qKeyTime:i,qSignature:o}):(s=(e=e||{}).SecretId,a=e.SecretKey,m=(e.Method||"get").toLowerCase(),c=e.Query||{},h=e.Headers||{},w=e.Pathname||"/",e=e.Expires,u=function(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(t);return n.sort(function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:t