/*! For license information please see 19511.3e658d1f.js.LICENSE.txt */ (self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["19511"],{116427:function(t,e,r){"use strict";r.d(e,{MU:function(){return h},Qc:function(){return a},gg:function(){return f},iv:function(){return o},jT:function(){return u},m7:function(){return s},rw:function(){return l},wb:function(){return i},y_:function(){return c}});var n=r(866985);function i(t){var e=new Uint8Array(t),r="";return e.forEach(function(t){r+=t.toString(16).padStart(2,"0")}),r}function o(t){for(var e=new Uint8Array(t.length/2),r=0;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},c=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i=n)break}return o},h=function(t,e){t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return -1}if(void 0===e)return(192&r)==128||!1;try{var r,n,i=e.match(/^\[[0-9]+\]$/);if(null==i||(n=parseInt(e.substr(1,e.length-1),10))>31)return!1;if((192&r)==128&&(31&r)==n)return!0;return!1}catch(t){return!1}},d=function(t,e,r,n){if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=f(t,e);for(var i,o,a=0,s=0;s=(o=f(t,e)).length)?-1:p(t,o[i],r,n)};t.exports={getLblen:i,getL:o,getVidx:c,getVblen:u,getTLVblen:l,getChildIdx:f,getV:a,getTLV:s,getVbyListEx:function(t,e,r,n,i){var o,s;return -1==(o=d(t,e,r,n))?null:(s=a(t,o),"03"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},getIdxbyListEx:d,getTLVbyList:function(t,e,r,n){var i=p(t,e,r,n);return -1==i||i>=t.length?null:s(t,i)},getIdxbyList:p}},134401:function(t){"use strict";var e,r,n,i=true;function o(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function a(){return new o(null)}i&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(t,e,r,n,i,o){for(var a=32767&e,s=e>>15;--o>=0;){var c=32767&this[t],u=this[t++]>>15,l=s*c+u*a;i=((c=a*c+((32767&l)<<15)+r[n]+(1073741823&i))>>>30)+(l>>>15)+s*u+(i>>>30),r[n++]=1073741823&c}return i},e=30):i&&"Netscape"!=navigator.appName?(o.prototype.am=function(t,e,r,n,i,o){for(;--o>=0;){var a=e*this[t++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=67108863&a}return i},e=26):(o.prototype.am=function(t,e,r,n,i,o){for(var a=16383&e,s=e>>14;--o>=0;){var c=16383&this[t],u=this[t++]>>14,l=s*c+u*a;i=((c=a*c+((16383&l)<<14)+r[n]+i)>>28)+(l>>14)+s*u,r[n++]=268435455&c}return i},e=28),o.prototype.DB=e,o.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function h(t){this.m=t}h.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},h.prototype.revert=function(t){return t},h.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},h.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},h.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};function d(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},d.prototype.revert=function(t){var e=a();return t.copyTo(e),this.reduce(e),e},d.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},d.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},d.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};o.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},o.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},o.prototype.fromString=function(t,e){if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else if(4==e)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var r,n=t.length,i=!1,a=0;--n>=0;){var s=8==r?255&t[n]:u(t,n);if(s<0){"-"==t.charAt(n)&&(i=!0);continue}i=!1,0==a?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-a):this[this.t-1]|=s<=this.DB&&(a-=this.DB)}8==r&&(128&t[0])!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},o.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},o.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--o)e[o+a+1]=this[o]>>n|s,s=(this[o]&i)<=0;--o)e[o]=0;e[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},o.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,o=(1<>n;for(var a=r+1;a>n;n>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},o.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},o.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(l,s),i.lShiftTo(l,r)):(n.copyTo(s),i.copyTo(r));var h=s.t,d=s[h-1];if(0!=d){var p=d*(1<1?s[h-2]>>this.F2:0),v=this.FV/p,y=(1<=0&&(r[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(h,w),w.subTo(s,s);s.t=0;){var _=r[--m]==d?this.DM:Math.floor(r[m]*v+(r[m-1]+g)*y);if((r[m]+=s.am(0,_,r,b,0,h))<_)for(s.dlShiftTo(b,w),r.subTo(w,r);r[m]<--_;)r.subTo(w,r)}null!=e&&(r.drShiftTo(h,e),c!=u&&o.ZERO.subTo(e,e)),r.t=h,r.clamp(),l>0&&r.rShiftTo(l,r),c<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if((1&t)==0)return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},o.prototype.isEven=function(){return(this.t>0?1&this[0]:this.s)==0},o.prototype.exp=function(t,e){if(t>4294967295||t<1)return o.ONE;var r=a(),n=a(),i=e.convert(this),s=f(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var c=r;r=n,n=c}return e.revert(r)},o.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var e,r,n=(1<0)for(s>s)>0&&(i=!0,o=c(r));a>=0;)s>(s+=this.DB-e):(r=this[a]>>(s-=e)&n,s<=0&&(s+=this.DB,--a)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},o.prototype.negate=function(){var t=a();return o.ZERO.subTo(this,t),t},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this[this.t-1]^this.s&this.DM)},o.prototype.mod=function(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(o.ZERO)>0&&t.subTo(e,e),e},o.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new h(e):new d(e),this.exp(t,r)},o.ZERO=l(0),o.ONE=l(1);function p(t,e){return t&e}function v(t,e){return t|e}function y(t,e){return t^e}function g(t,e){return t&~e}function m(){}function b(t){return t}m.prototype.convert=b,m.prototype.revert=b,m.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},m.prototype.sqrTo=function(t,e){t.squareTo(e)};function w(t){this.r2=a(),this.q3=a(),o.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}w.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(0>t.compareTo(this.m))return t;var e=a();return t.copyTo(e),this.reduce(e),e},w.prototype.revert=function(t){return t},w.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>t.compareTo(this.r2);)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},w.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},w.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var _=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],S=67108864/_[_.length-1];o.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},o.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=l(r),i=a(),o=a(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},o.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,a=0,s=0,c=0;c=r&&(this.dMultiply(n),this.dAddOffset(s,0),a=0,s=0)}a>0&&(this.dMultiply(Math.pow(e,a)),this.dAddOffset(s,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(t,e,r){if("number"==typeof e){if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),!this.testBit(t-1)&&this.bitwiseTo(o.ONE.shiftLeft(t-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(o.ONE.shiftLeft(t-1),this)}else{var n=[],i=7&t;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},o.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},o.prototype.multiplyLowerTo=function(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(e-this.t,0);n0){if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t}return r},o.prototype.millerRabin=function(t){var e=this.subtract(o.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>_.length&&(t=_.length);for(var i=a(),s=0;s>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},o.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<=0;)n<8?r=(this[t]&(1<>(n+=this.DB-8):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),(128&r)!=0&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},o.prototype.equals=function(t){return 0==this.compareTo(t)},o.prototype.min=function(t){return 0>this.compareTo(t)?this:t},o.prototype.max=function(t){return this.compareTo(t)>0?this:t},o.prototype.and=function(t){var e=a();return this.bitwiseTo(t,p,e),e},o.prototype.or=function(t){var e=a();return this.bitwiseTo(t,v,e),e},o.prototype.xor=function(t){var e=a();return this.bitwiseTo(t,y,e),e},o.prototype.andNot=function(t){var e=a();return this.bitwiseTo(t,g,e),e},o.prototype.not=function(){for(var t=a(),e=0;e>=16,e+=16),(255&t)==0&&(t>>=8,e+=8),(15&t)==0&&(t>>=4,e+=4),(3&t)==0&&(t>>=2,e+=2),(1&t)==0&&++e,e}(this[t]);return this.s<0?this.t*this.DB:-1},o.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r=this.t?0!=this.s:(this[e]&1<1){var v=a();for(n.sqrTo(s[1],v);c<=p;)s[c]=a(),n.mulTo(v,s[c-2],s[c]),c+=2}var y,g,m=t.t-1,b=!0,_=a();for(i=f(t[m])-1;m>=0;){for(i>=u?y=t[m]>>i-u&p:(y=(t[m]&(1<0&&(y|=t[m-1]>>this.DB+i-u)),c=r;(1&y)==0;)y>>=1,--c;if((i-=c)<0&&(i+=this.DB,--m),b)s[y].copyTo(o),b=!1;else{for(;c>1;)n.sqrTo(o,_),n.sqrTo(_,o),c-=2;c>0?n.sqrTo(o,_):(g=o,o=_,_=g),n.mulTo(_,s[y],o)}for(;m>=0&&(t[m]&1<=0?(r.subTo(n,r),e&&i.subTo(s,i),a.subTo(c,a)):(n.subTo(r,n),e&&s.subTo(i,s),c.subTo(a,c))}return 0!=n.compareTo(o.ONE)?o.ZERO:c.compareTo(t)>=0?c.subtract(t):0>c.signum()?(c.addTo(t,c),0>c.signum())?c.add(t):c:c},o.prototype.pow=function(t){return this.exp(t,new m)},o.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(0>e.compareTo(r)){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=_[_.length-1]){for(e=0;e<_.length;++e)if(r[0]==_[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<_.length;){for(var n=_[e],i=e+1;i<_.length&&n0&&(0,o.gp)(n.logWebBdTicketGuardConsumerResponseError,{logid:f,path:u,error_code:l,login_status:h,sign_version:p,cookie_status:d,data_from:v,cookie_crypt:y,match_md5_local:g,match_md5_iframe:m,is_pubkey_ts_sign:b,lost:w,init_match:_,is_new_cert:S,hostname:k,cookie_domain:T,raw_pubkey:C,raw_pubkey_base64:x,raw_ticket:E,raw_ts_sign:D,gen_ticket_logid:K,gen_ticket_time:P,gen_ticket_client_cert:I,is_equal_pub:O})},s=function(t){(0,o.wU)(n.logWebBdTicketGuardIframeStatusBeforeUnLoad,t)},c=function(t){(0,o.gp)(n.logWebBdTicketGuardIframeStatus,t)},u=function(t){return(0,o.gp)(n.logWebBdTicketDTraitInit,t)},l=function(t){return(0,o.gp)(n.logWebBdTicketGuardInit,t)},f=function(t,e){var r,i={pathname:(null==e?void 0:e.path)||"",new_gen_ticket:null==e?void 0:e.new_gen_ticket,new_gen_ts_sign:null==e?void 0:e.new_gen_ts_sign,new_gen_logid:null==e?void 0:e.new_gen_logid,new_gen_create_time:null==e?void 0:e.new_gen_create_time,new_gen_publib_key:null==e?void 0:e.new_gen_publib_key,type:(null==e?void 0:e.type)||"unknown",hostname:(null===(r=null==window?void 0:window.location)||void 0===r?void 0:r.hostname)||""};return(0,o.gp)(n.logWebBdTicketGuardNewServerData,i)}},291402:function(t,e,r){"use strict";r.d(e,{B:function(){return ip},P:function(){return iv}});var n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b,w,_,S,k,T={};r.r(T),r.d(T,{base642buff:function(){return no},buff2base64:function(){return ni},bufferConcat:function(){return nn},getQuery:function(){return ne},getRandomValues:function(){return ns},hexToUint8Array:function(){return nc},isSupportSystemCrypto:function(){return nr},parseQuery:function(){return nt},uint8ArrayToHex:function(){return na},unit8ArrayToString:function(){return nu}});var C=r("892478"),x=r("116427"),E=r("785914"),D=r.n(E),K=r("303418"),P=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},I=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},U=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0;)e.unshift(255&r),r>>>=8;return I([128|e.length],P(e),!1)},p=(d=function(t){var e=f(t);return I(I([2],P(h(e.length)),!1),P(e),!1)})(u),v=d(l),y=I(I([],P(p),!1),P(v),!1),o=new Uint8Array(I(I([48],P(h(y.length)),!1),P(y),!1)).buffer,[2,{hex:(0,x.wb)(o),buffer:o}]}})})},"signWithECDSA"),Z=M(function(t,e,r){return L(this,void 0,void 0,function(){var n,i,o;return A(this,function(a){switch(a.label){case 0:return n=O(t),[4,window.crypto.subtle.importKey("spki",n,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])];case 1:return i=a.sent(),o=new TextEncoder().encode(r),[4,window.crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},i,e,o)];case 2:return[2,a.sent()]}})})},"verifyWithECDSA"),X=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},Q=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},te=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},tp=function(t,e){for(var r=!1,n=0;n1&&(null===(r=p[1])||void 0===r?void 0:r.meta)===!0?h({data:Object.fromEntries(Object.entries(e).map(function(t){var e=td(t,2),r=e[0];return[r,{key:r,value:e[1],from:"2",origin:""}]})),from:"2"},c):h(e,c)}).catch(function(){return Reflect.apply(t,s,c)})}if("setItems"===f){var v=Reflect.apply(t,s,c),y=d(c);return n.apply(s,y).then(function(t){return h(t,c)}).catch(function(){return v})}return Reflect.apply(t,s,c)}}):c}}),checkResult:e}:{storeSDK:t,checkResult:e}}).catch(function(e){return{storeSDK:t,checkResult:{pass:!1,reason:e.message||"check fn call failed"}}})]):[2,Promise.resolve({storeSDK:t,checkResult:{pass:!1,reason:"plguin is not init"}})]})})},t}(),ty=((b={}).setItems={action:"setItems",payload:function(t){return t},response:function(){return{cross:"0"}}},b.getItems={action:"getItems",payload:function(t){return t},response:function(t,e){return t}},b),tg=new tv,tm=tg.init.bind(tg),tb=tg.proxy.bind(tg),tw=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i=0;i--)(!e||n[i]===e)&&n.splice(i,1)}},t.prototype.emit=function(t,e){var r=this.eventMap[t];r&&tw([],r,!0).forEach(function(t){t(e)})},t.prototype.has=function(t,e){var r=this.eventMap;if(r[t])return"function"!=typeof e||-1!==r[t].indexOf(e);return!1},t}();function tS(){var t,e;try{return!!navigator.userAgent.match(/chrome\/[\d.]+/gi)&&!!(null==navigator?void 0:navigator.userAgentData)||!!(null===(t=navigator.storage)||void 0===t?void 0:t.getDirectory)||!!navigator.canShare||-1!==((null===(e=window.Promise)||void 0===e?void 0:e.allSettled)||"").toString().indexOf("[native code]")&&!!(Number((navigator.userAgent.match(/Chrome\/(\d+\.+\d+)/)||[])[1])>=76&&window.visualViewport)}catch(t){return!1}}var tk=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})},tT=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},tx=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0){this.count+=1;var t=this.list.shift();t&&t()}},t}(),tA=function(t){void 0===t&&(t={});var e=!1,r="";for(var n in t)if("string"==typeof n&&Array.isArray(t[n])){for(var i=t[n],o=0;o0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)return decodeURIComponent(o)}}}catch(t){}return""},tN=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},tq=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i=200&&e.status<300)try{var i=JSON.parse(e.response);"success"!==i.message&&n(Error((null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.description)||i.message||"get cert error")),r(i)}catch(t){n(t)}},e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.setRequestHeader("Accept","application/json");var i={server_data:"1",aid:String(t)},o=Object.keys(i).map(function(t){return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(i[t]))}).join(",");e.send(o)})},t4=tB(function(t,e){void 0===e&&(e=!0);var r=Date.now();try{if(e){var n=localStorage.getItem(t2);if(n&&"string"==typeof n){var i=JSON.parse(n),o=i.cert,a=i.sn;if(i.createdTime+864e5>r)return Promise.resolve({cert:o,sn:a})}}return tX(t3,3e3,"get cert timeout")(t).then(function(t){var e=(t||{}).data,r=void 0===e?{}:e,n=r.server_cert,i=void 0===n?"":n,o=r.server_sn,a=void 0===o?"":o;return i&&a?(localStorage.setItem(t2,JSON.stringify({cert:i,sn:a,createdTime:Date.now()})),{cert:i,sn:a}):Promise.reject(Error("get empty cert"))})}catch(t){return Promise.reject(t)}}),t5="bd_ticket_guard_client_data_v2",t6=function(){tz(t5)};var t8=(i=function(t,e){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),t7=function(){return(t7=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=this.config.timestampValidWindow},e.prototype.triggerUpdateCheck=function(){this.checkNeedUpdate()&&this.onUpdateCallback&&this.onUpdateCallback()},e.prototype.scheduleNextCheck=function(){var t=this;this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=window.setTimeout(function(){t.triggerUpdateCheck(),t.scheduleNextCheck()},this.config.updateInterval)},e.prototype.bindVisibilityListener=function(){document.addEventListener("visibilitychange",this.handleVisibilityChange)},e.prototype.unbindVisibilityListener=function(){document.removeEventListener("visibilitychange",this.handleVisibilityChange)},e}(t_),er="4.0.3",en=tS(),ei="https://lf-zt.douyin.com",eo="".concat(ei,"/obj/uc-assets/zt/"),ea=function(t,e,r){return"".concat(t).concat("@byted/x-storage-web","/").concat(e||er,"/dist/").concat(r||(en?"latest":"page"),"/index.html")},es=function(t){try{localStorage.setItem("X_STORAGE_FALLBACK_VERSION",t)}catch(t){}},ec=function(){try{return localStorage.getItem("X_STORAGE_FALLBACK_VERSION")}catch(t){}},eu=function(){var t=ec();if(t)return ea(eo,t)};var el=(o=function(t,e){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),ef=function(t){function e(e,r,n){var i=t.call(this,r)||this;return i.message=r||"",i.name=e,i.origin=n||location.origin,i}return el(e,t),e}(Error),eh={},ed={},ep=function(){try{return indexedDB||window.indexedDB||webkitIndexedDB||mozIndexedDB||OIndexedDB}catch(t){return}},ev="DBStorageNotSupport",ey=Promise.resolve(),eg=0,em=function(t,e){return Promise.resolve({isQuotaError:"quotaexceedederror"===((null==e?void 0:e.name)||"").toLowerCase(),clean:function(e){var r=ep(),n=null==r?void 0:r.deleteDatabase(e||t);return new Promise(function(t){n?(n.onsuccess=function(){t()},n.onerror=function(){t()}):t()})}})},eb=function(t){return new Promise(function(e,r){t.onsuccess=function(){e(t.result)},t.onerror=function(){r(t.error)}})},ew=function(t,e){return new Promise(function(r,n){t.oncomplete=function(){r()},t.onabort=t.onerror=function(){var t,r=e?e.error||(null===(t=e.transaction)||void 0===t?void 0:t.error):{name:"TransactionAbortOrError",message:""};n(new ef((null==r?void 0:r.name)||"TransactionAbortOrError",(null==r?void 0:r.message)||""))}})},e_=function(){return(e_=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.max&&(t.max+=10),t.iframeLoadPromise=null,e0.current>=e0.max&&(e0.max+=3)},r.loadWindow=function(){var t=r.config,e=t.url,n=t.ackTimeout,i=r.autoLoadIframeConfig;return new Promise(function(t){setTimeout(t,0===i.current?0:100)}).then(function(){if(!e)throw Error("URL Error");var t=i.current===i.max?eR(e,"t=".concat(Date.now())):e;return r.createIframeElement(t,n)}).catch(function(t){if(i.current>=i.max){if(e2())return new Promise(function(t){var e=function(){!e2()&&(document.removeEventListener(e1,e),t(1))};document.addEventListener(e1,e)}).then(function(){return r.loadWindow().then(function(t){return r.emit("log",{name:"visibilityChangeLoadWindowSuccuess"}),t})});var e=eu();if(e)return r.emit("debug",{name:"StartFireFallbackURL",content:e}),r.createIframeElement(e,n).then(function(t){return r.emit("debug",{name:"EndFireFallbackURL",content:e}),t.fallback=!0,t}).catch(function(e){throw r.emit("debug",{name:"fireFallbackURLError",content:"".concat(null==e?void 0:e.name,":").concat(null==e?void 0:e.message)}),t});throw t}return i.current++,r.loadWindow()})},r.createPostMessageFlight=function(t,e){void 0===e&&(e=3e3);var n,i=eL(),o=i,a=function(t){r.config.debug&&r.emit("metrics",{name:"PostMessageFlight",metrics:{startTime:i,endTime:o,loadTime:o-i},categories:{status:t,retryCount:String(e0.current),version:er}})};return Promise.race([new Promise(function(e,r){var i="ACK_0_".concat(Math.random()),a=function(t){t.data==="ACK_1_".concat(i)&&(clearTimeout(n),o=eL(),e(),eI("message",a))};eP("message",a);try{t(i)}catch(t){r(new ef("PostMessageWindowError",null==t?void 0:t.message))}}),new Promise(function(t,r){n=setTimeout(function(){o=eL(),r(new ef("PostMessageTimeout"))},e)})]).then(function(){a("1")}).catch(function(t){throw a("0"),t})},r.config=eY({ackTimeout:2e3},e||{}),r}return eQ(e,t),e.prototype.setConfig=function(t){this.config={ackTimeout:t.ackTimeout||this.config.ackTimeout,url:t.url||this.config.url}},e.prototype.start=function(){var t=this.autoLoadIframeConfig;return t.iframeLoadPromise=t.iframeLoadPromise||this.loadWindow()},e.prototype.createIframeElement=function(t,e){var r,n,i,o=this,a=e||this.config.ackTimeout,s=this.autoLoadIframeConfig,c=eL(),u=eB.createElement("iframe"),l=c,f=!1,h=-1;return u.style.display="none",u.src=t,eW().then(function(e){var o=Promise.race([new Promise(function(t,e){u.onload=function(){l=eL(),!f&&(n=setTimeout(function(){!f&&e(new ef("CreateIframeError",JSON.stringify(eY(eY({startTime:c,endTime:l,loadTime:l-c},e$),{current:s.current,max:s.max}))))},a||2e3))}}),new Promise(function(e,o){var a=function(s){try{-1===h&&"ACK"===s.data&&eA(t)===s.origin&&(f=!0,r=s.source,clearTimeout(n),clearTimeout(i),e(),eI("message",a))}catch(t){o(t)}};eP("message",a)}),new Promise(function(t,e){i=setTimeout(function(){e(new ef("CreateIframeMainTimeout"))},12e4)})]);return e.appendChild(u),o}).then(function(){return o.createPostMessageFlight(function(e){var n=eA(t);(u.contentWindow||r).postMessage(e,n)}).catch(function(t){if("PostMessageWindowError"===t.name){if(e0.current=r.iframeConnection.autoLoadIframeConfig.max&&r.reStartConection("reConnection"),Promise.resolve())},r.onMessage=function(t){var e,n,i,o,a=function(e,r){var n;try{null===(n=t.source)||void 0===n||n.postMessage("SOCKET_ERROR_".concat(e,"@").concat(r),t.origin)}catch(t){}};try{var s=r.config,c=s.url,u=s.protocol,l=s.allowOrigin,f=!!c&&eA(c)===t.origin,h=c?f:!!e6([e7],void 0===l?[]:l,!0).filter(function(e){return -1!==t.origin.lastIndexOf(e)})[0];try{!t.origin&&r.emit("debug",{name:"eventLostOrigin",content:JSON.stringify(t.data||{})})}catch(t){}if(h){if("string"==typeof t.data&&0===t.data.indexOf("ACK_0_"))try{null===(e=t.source)||void 0===e||e.postMessage("ACK_1_".concat(t.data),t.origin)}catch(t){}else if((null===(n=t.data)||void 0===n?void 0:n.protocol)===u)try{r.emit("message",{type:null===(i=t.data)||void 0===i?void 0:i.type,data:null===(o=t.data)||void 0===o?void 0:o.data,origin:t.origin,sourceWindow:t.source})}catch(e){a(500,JSON.stringify(t.data)),r.emit("debug",{name:"postMessage:protocol:error:".concat(null==e?void 0:e.message)})}}}catch(t){a(501,"".concat(t.message)),r.emit("debug",{name:"SomePostMessageEventError",content:null==t?void 0:t.message})}},r.initMessageEvent=function(){r.removeMessageEvent(),window.addEventListener("message",r.onMessage),r.emit("debug",{name:"initMessageEvent"})},r.removeMessageEvent=function(){window.addEventListener("message",r.onMessage)},r.config=e5(e5({},r.config),e||{}),r.iframeConnection=new e3,r.startConnection("init"),r.on("config",function(){r.startConnection("config")}),r.initMessageEvent(),r.on("connection",function(t){r.loadTime=t.endTime-t.startTime,r.startTime=t.startTime,r.endTime=t.endTime,r.isConnection=!0,r.config.enableFallback&&!t.target.fallback&&es(er),r.emit("debug",{name:"ConnectionSuccess"}),r.initMessageEvent()}),r.iframeConnection.on("debug",function(t){r.emit("debug",t)}),r.iframeConnection.on("log",function(t){r.emit("log",t)}),r.iframeConnection.on("metrics",function(t){r.emit("metrics",t)}),r.on("connectionFail",function(t){var e=r.config.downgradeCSPURL;if(r.isConnection=!1,r.emit("error",new ef("Connection:".concat(t.name),t.message)),r.emit("debug",{name:"connectionFail"}),e&&(null==t?void 0:t.message.indexOf("Content Security Policy"))!==-1){var n,i,o="string"==typeof e?e:ea(eo,void 0,"page");o&&r.config.url!==o&&(r.emit("debug",{name:"fireDefaultPageURL",content:o}),r.config.url=o,r.reStartConection("csp"))}}),eP("message",function(t){"string"==typeof t.data&&(-1!==t.data.indexOf("SOCKET_ERROR_")?r.emit("error",new ef("SCOKET_ERROR",t.data)):-1!==t.data.indexOf("Version:")&&r.emit("debug",{name:"SocketVersion",content:t.data.split(":")[1]}))}),r}return e4(e,t),e.prototype.createConnection=function(t){var e=this,r=this.config.ackTimeout,n=eL(),i=this.iframeConnection.autoLoadIframeConfig.max;this.iframeConnection.setConfig({url:i>10?eR(t,"t=".concat(i)):t,ackTimeout:r});var o=this.iframeConnection.start().then(function(t){var r={target:t,startTime:n,endTime:eL()};return e.emit("connection",e5({},r)),r}).catch(function(t){throw e.emit("connectionFail",new ef("".concat(t.name||"ConnectionError"),t.message)),t});return this.window=o},e}(t_),rt=function(t){return function(e){return t.then(function(t){return Promise.resolve(e()).then(function(){return t})},function(t){return Promise.resolve(e()).then(function(){throw t})})}},re=null,rr=-1,rn=0,ri={},ro=function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=8e3);var n=t.postIframeMessage;return function(i,o,a){var s,c,u=rn++;var l=(s=u,"".concat(s)),f=!1;if("string"!=typeof i||"string"!=typeof o)return Promise.reject(new ef("CallBridgeParameterError","callObj:".concat(i,", callName:").concat(o)));var h=function(e){return t.emit("debug",{name:"PostMessageId=".concat(l),content:"".concat(i,":").concat(o)}),ri[l]={},ri[l].st=eL(),Promise.race([t.window.then(function(){return new Promise(function(e,r){var s=function(n){try{var i;(i=n.data).id===l&&ri[l]&&!ri[l].et&&(ri[l].et=eL(),t.emit("debug",{name:"BackPostMessageId=".concat(l)}),clearTimeout(c),t.off("message",s),"reject"===i.promiseStatus?r(new ef("".concat(i.message||"UNKNOW_CallBridge_Error"))):e(i.message),delete ri[l])}catch(t){r(t)}};t.on("message",s),n({id:l,message:{callObj:i,callName:o,callArgs:a}}).catch(r)})}),new Promise(function(r,n){c=setTimeout(function(){ri[l].timeout=eL(),n(new ef("CallBridgeInvokeTimeout:".concat(i,":").concat(o),"".concat(JSON.stringify({iframe:t.getIframeState(),id:l}))))},e)})])};return t.preCheck().then(function(){return h(r)}).catch(function(r){if(!0===t.isConnection&&e&&-1!==((null==r?void 0:r.name)||"").indexOf("CallBridgeInvokeTimeout")){var n=u-1?l:1;try{e.forEach(function(e,r){["from","origin","status","code"].forEach(function(n){var i=t[r],o=i.split("/"),a="status"===n?String(e.value?1:0):String(e[n]);"undefined"!==a&&(f["".concat(o[1]||i,"_").concat(n)]=a)})})}catch(t){}},p=function(){var e=r.client.config.url;u=eL();var n=function(){return ro(r.client)("storage","getItemByKeys",[t]).then(function(e){return c=eL(),l=2,Promise.all(e.map(function(e,n){return void 0===e.value&&(l=3),void 0===e.value?r.storage.getItem(t[n]):e}))})};if(e)return void 0!==i?Promise.race([n(),new Promise(function(t){setTimeout(t,"number"==typeof i?i:1e3)}).then(function(){return r.storage.getItemByKeys(t)})]):ej([n,function(){return r.storage.getItemByKeys(t).then(function(t){return t.map(function(t){return t.code=1001,t})})}]);return r.storage.getItemByKeys(t)};return r.getLocalItemWithSignByKeys(t).then(function(t){var e=t.values,r=t.st,n=t.et;return s=r,c=n,l=12,d(e),h(),e}).catch(function(){return rt(p().catch(function(){return r.storage.getItemByKeys(t)}).then(function(t){return d(t),t}).catch(function(t){throw l=0,t}))(h)})},r.setItemByKeys=function(t,e){var n=e||{},i=n.async,o=n.logger,a=void 0===o||o,s=eL(),c=0,u=-1,l=0,f=0,h={},d={end:!1,sync:!1,resolve:function(){}},p=function(e){u=u>-1?u:1;try{e.forEach(function(e,r){["from","origin","status"].forEach(function(n){var i=t[r][0],o=i.split("/");h["".concat(o[1]||i,"_").concat(n)]="status"===n?String(e.value?1:0):String(e[n])})})}catch(t){}};new Promise(function(t){d.resolve=t}).then(function(){if(a)try{c=c||eL(),r.emit("metrics",{name:"setOriginItemByKeys",metrics:{duration:c-s,callTime:c-f,startCallTime:f,startTime:s,endTime:c,retryCount:l},categories:rs({status:String(u)},h)})}catch(t){}});var v=function(t){d[t]=!0,d.end&&d.sync&&d.resolve()};return rt((function(t){var e,n,o=r.client.config.url;f=eL();var a=function(e){return ro(r.client,!0,e)("storage","setItemByKeys",[t]).then(function(t){return u=2,p(t),c=eL(),t})};if(o){;if(void 0!==i)return Promise.race([rt(a(3e4).catch(function(t){var e="".concat(null==t?void 0:t.name,"@").concat(null==t?void 0:t.message);return l++,a().catch(function(n){throw r.emit("log",{name:"callBridgeSetItemByKeysRetryError",content:JSON.stringify({iframe:r.client.getIframeState(),errorMessage:e})}),t})}))(v.bind(null,"sync")),new Promise(function(t){setTimeout(t,"number"==typeof i?i:1e3)}).then(function(){return r.storage.setItemByKeys(t)})]);return eV([(n={timeout:2500,result:[{value:"timeout",from:"timeout",origin:"timeout"}]},e=function(){return rt(a())(v.bind(null,"sync"))},void 0===n&&(n={}),function(){var t=n.timeout,r=void 0===t?3e3:t;return Promise.race([new Promise(function(t){setTimeout(function(){t(n.result||{})},r)}),e()])}),function(){return r.storage.setItemByKeys(t)}])}return r.storage.setItemByKeys(t)})(t).catch(function(){return r.storage.setItemByKeys(t)}).catch(function(t){throw u=0,t}).then(function(t){return p(t),t}))(v.bind(null,"end"))},r.removeItem=function(t){return r.client.config.url?Promise.all([r.storage.removeItem(t),ro(r.client)("storage","removeItem",[t])]).then(function(){}):r.storage.removeItem(t)},r.getLocalItemWithSignByKeys=function(t){var e;if((null===(e=r.sign)||void 0===e?void 0:e.verify)&&eU(t,eX)){var n=eL();return r.storage.localDB.getItemByKeys(eX).then(function(e){return r.sign.verify(e).then(function(r){if(r)return t.map(function(t){return{value:e[eX.indexOf(t)],origin:location.origin,from:0,code:304}});throw Error("VerifySignFail")}).then(function(t){return{values:t,st:n,et:eL()}})})}return Promise.reject(Error("NotVerifySignFunction"))},r.initBirdgeEvent=function(){r.client.on("message",function(t){var e=t.data,n=t.origin,i=t.type,o=t.sourceWindow,a=(e||{}).id;if("event"===i){var s=e.message||{},c=s.eventName,u=s.eventData;if("error"===c)r.emit("error",new ef(u.name,u.message,u.origin));else if("log"===c)return r.emit("log",u)}else{var l=e.message||{},f=l.callObj,h=l.callName,d=l.callArgs,p=function(t,e){return r.client.postWindowMessage(o,"function",{id:a,promiseStatus:t,message:e},n)};if(-1!==["storage","storageX","client","sign","config","logger"].indexOf(f))try{eH("".concat(f,"-").concat(h)),(-1!==["storage","config"].indexOf(f)?r:r[f])[h].apply(r,void 0===d?[]:d).then(p.bind(null,"resolve")).catch(function(t){p("reject",t.name||t.message||"UnknowMessageError").catch(function(){})})}catch(t){p("reject","UnknowMessageError").catch(function(){})}}})},r.config=rs({debug:!1,hostname:location.hostname},e||{}),r.client=new e9(rs(rs({},r.config.scoket||{}),{protocol:r.config.protocol,allowOrigin:r.config.allowOrigin,debug:r.config.debug,url:r.config.url})),r.storage=new eZ(r.config.storage),r.storageX=r.storage,r.config.verifySignMethod&&(r.sign=rs(rs({},r.sign||{}),{verify:function(t){return Promise.resolve(r.config.verifySignMethod(t))}})),r.logger={metrics:function(t){return r.emit("metrics",t),Promise.resolve()}},r.initBirdgeEvent(),r.on("error",function(t){!r.config.disableReportLogger&&r.client.dispatchParentEvent("error",{name:t.name,message:t.message,origin:t.origin}).catch(function(){})}),r.on("log",function(t){!r.config.disableReportLogger&&r.client.dispatchParentEvent("log",t).catch(function(){})}),r.on("debug",function(t){r.config.debug&&r.emit("log",rs(rs({},t),{name:"Debug:".concat(t.name)}))}),r.client.on("error",function(t){t.name="Socket:".concat(t.name),r.emit("error",t)}),r.storage.on("error",function(t){var e;r.emit("error",((e=t).name="".concat("WebStorage",":").concat(e.name),e))}),r.storage.on("log",function(t){r.emit("log",t)}),r.client.on("log",function(t){r.emit("log",t)}),r.client.on("metrics",function(t){r.emit("metrics",t)}),r.client.on("debug",function(t){r.emit("debug",t)}),r.client.start().catch(function(t){r.emit("error",new ef("StartSocketClientError",t.message))}),r}return ra(e,t),e}(t_),ru=function(){return(ru=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rh=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},rd=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0?e(n).then(function(t){var e=r(t);return Object.entries(e).forEach(function(t){var e=rh(t,2),r=e[0],n=e[1];"string"==typeof n&&y.cache(r,n)}),e}):Promise.resolve({}),n.forEach(function(t){y.queue.set(t,f.then(function(e){var r;return(r={})[t]=e[t]||"",r}))}),[4,Promise.all(rd([f],rh(l),!1))];case 3:return h=g.sent(),d=ru({},o),h.forEach(function(t){Object.assign(d,t)}),rd(rd([],rh(n),!1),rh(i),!1).forEach(function(t){y.queue.delete(t)}),[2,{data:d,summary:{total:t.length,hit:Object.keys(o).length,miss:n.length,pending:i.length,missKeys:n}}]}})},new(o||(o=Promise))(function(t,e){function r(t){try{c(a.next(t))}catch(t){e(t)}}function s(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var n;e.done?t(e.value):((n=e.value)instanceof o?n:new o(function(t){t(n)})).then(r,s)}c((a=a.apply(n,i||[])).next())})},t.prototype.setMultiple=function(t){var e,r;if(!this.disabled)try{for(var n=rf(t),i=n.next();!i.done;i=n.next()){var o=i.value,a=o.key,s=o.value;this.set(a,s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.getStats=function(){return{size:this.store.size,enabled:!this.disabled,agId:this.agId}},t.prototype.set=function(t,e){if(!this.disabled&&!!e){var r=this.updateVersion(t);this.store.set(t,{value:e,version:r})}},t.prototype.cache=function(t,e){if(!this.disabled&&""!==e&&void 0!==e){var r,n=this.getCookie(t);r=n&&!this.store.has(t)?n:this.updateVersion(t),this.store.set(t,{value:e,version:r})}},t.prototype.needUpdate=function(t){var e=this.store.get(t);return(!e||this.getCookie(t)!==e.version)&&!0},t.prototype.updateVersion=function(t){var e="xxxxxxxx-4xxx-yxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)});return tJ(this.generateCookieKey(t),e),e},t.prototype.clearVersion=function(t){tz(this.generateCookieKey(t))},t.prototype.getCookie=function(t){return tF(this.generateCookieKey(t))||""},t.prototype.generateCookieKey=function(t){var e,r;return e=t,r=this.agId,"".concat("__security_mc","_").concat(r,"_").concat(e.replace(/\//g,"_").replace(/^security-sdk\_s_sdk/,"sk"))},t}(),rv=function(t,e){var r=window.location.hostname;return e||-1===r.indexOf("douyin.com")?t?"https://lf-zt.douyin.com/obj/uc-assets/zt/":"https://lf-ucenter-web.yhgfb-cn-static.com/obj/passport-fe/ucenter_fe/":"https://lf-zt.douyin.com/obj/uc-assets/zt/"};var ry=(l=function(t,e){return(l=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),rg=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})},rm=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rw=function(t){function e(e){var r=t.call(this)||this;return r.crossStatus=!1,r.initLoadIframePromise=function(){return new Promise(function(t){r.storage?r.storage.client.on("connection",function(){r.crossStatus=!0,t()}):t()})},r.createStorageKey=function(t){var e=r.config.namespace;return e?"security-sdk/".concat(e,"/").concat(t):"security-sdk/".concat(t)},r.emitError=function(t,e){r.emit("error",{error:t,name:e})},r.verifySignMethod=function(t){try{var e=tV("_bd_ticket_crypt_cookie")||"";if(t&&Array.isArray(t)&&3===t.length){var n=t[0],i=t[1],o=t[2];return tP(e,n,i,o)}}catch(t){r.emitError(t,"verify sign method error")}return!1},r.config=e,r.disableCrossStorage=e.disableCrossStorage||!1,r.cache=new rp({agId:e.agid}),!e.enableCache&&r.cache.setDisabled(!0),r.initStorage(),r}return ry(e,t),e.prototype.initStorage=function(){this.disableCrossStorage?this.initLocalStorage():this.initCrossOriginStorage()},e.prototype.initCrossOriginStorage=function(){var t=this,e=this.config,r=e.url,n=e.fallbackCacheOriginURL,i=e.sendEvent,o=e.ztIframe,a=ea(rv(void 0!==o&&o,e.agid));this.localStore=new eZ,this.storage=new rc({url:r||a||"",protocol:"SERCURE",fallback:n,verifySignMethod:this.verifySignMethod}),this.storage.on("error",function(e){t.emitError(e,"storage error")}),this.storage.on("log",function(e){var r=e||{},n=r.name,i=r.content;t.emit("log",{extra:{content:i||""},content:n,level:"info"})}),this.storage.on("metrics",function(t){var e=t||{},r=e.name,n=e.metrics,o=e.categories;r&&"string"==typeof r?null==i||i({name:"storage_".concat(r),metrics:n,categories:o}):null==i||i({name:"storage_event_without_name",metrics:n,categories:o})}),this.loadIframePromise=this.initLoadIframePromise()},e.prototype.initLocalStorage=function(){var t=this;this.localStore=new eZ,this.localStore.on("log",function(e){var r=e||{},n=r.name,i=r.content;t.emit("log",{extra:{content:i||""},content:n,level:"info"})}),this.localStore.on("error",function(e){t.emitError(e,"storage error")})},e.prototype.getItems=function(t,e){return rg(this,void 0,void 0,function(){var r;return rm(this,function(n){switch(n.label){case 0:if(n.trys.push([0,6,,7]),(null==e?void 0:e.meta)!==!0)return[3,2];return[4,this.getItemsWithOrigin(t,e)];case 1:case 3:case 5:return[2,n.sent()];case 2:if(!(null==e?void 0:e.local))return[3,4];return[4,this.getLocalItems(t)];case 4:return[4,this.getCrossItems(t)];case 6:if(r=n.sent(),this.emitError(r,"get items error"),(null==e?void 0:e.meta)===!0)return[2,{data:{}}];return[2,{}];case 7:return[2]}})})},e.prototype.setItems=function(t,e){return rg(this,void 0,void 0,function(){var r;return rm(this,function(n){switch(n.label){case 0:if(n.trys.push([0,4,,5]),!(null==e?void 0:e.local))return[3,2];return[4,this.setLocalItems(t)];case 1:case 3:return[2,n.sent()];case 2:return[4,this.setCrossItems(t,e)];case 4:return r=n.sent(),this.emitError(r,"set items error"),[2,{}];case 5:return[2]}})})},e.prototype.delete=function(t){var e,r;return rg(this,void 0,void 0,function(){var n,i,o,a,s,c,u;return rm(this,function(l){switch(l.label){case 0:l.trys.push([0,11,,12]),l.label=1;case 1:l.trys.push([1,8,9,10]),i=(n=rb(t)).next(),l.label=2;case 2:if(i.done)return[3,7];if(o=i.value,a=this.createStorageKey(o),this.cache.delete(o),!this.disableCrossStorage)return[3,4];return[4,null===(e=this.localStore)||void 0===e?void 0:e.removeItem(a)];case 3:return l.sent(),[3,6];case 4:return[4,null===(r=this.storage)||void 0===r?void 0:r.removeItem(a)];case 5:l.sent(),l.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return c={error:l.sent()},[3,10];case 9:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(c)throw c.error}return[7];case 10:return[3,12];case 11:return s=l.sent(),this.emitError(s,"delete items error"),[3,12];case 12:return[2]}})})},e.prototype.getCrossItems=function(t){return rg(this,void 0,void 0,function(){var e=this;return rm(this,function(r){switch(r.label){case 0:return[4,this.cache.getMultipleWithFetch(t,function(t){return rg(e,void 0,void 0,function(){var e,r,n,i,o=this;return rm(this,function(a){switch(a.label){case 0:if(e=t.map(function(t){return o.createStorageKey(t)}),!this.disableCrossStorage)return[3,2];return[4,null===(n=this.localStore)||void 0===n?void 0:n.getItemByKeys(e)];case 1:return r=a.sent(),[3,4];case 2:return[4,null===(i=this.storage)||void 0===i?void 0:i.getItemByKeys(e)];case 3:r=a.sent(),a.label=4;case 4:return[2,{response:r,uncachedKeys:t}]}})})},function(t){var e={},r=t.response,n=t.uncachedKeys;return r&&Array.isArray(r)&&r.forEach(function(t,r){var i=(t||{}).value,o=n[r];o&&(e[o]=i||"")}),e})];case 1:return[2,r.sent().data]}})})},e.prototype.getLocalItems=function(t){var e,r,n;return rg(this,void 0,void 0,function(){var i,o,a,s=this;return rm(this,function(c){switch(c.label){case 0:if(i=t.map(function(t){return s.createStorageKey(t)}),!this.disableCrossStorage)return[3,2];return[4,null===(e=this.localStore)||void 0===e?void 0:e.getItemByKeys(i)];case 1:return o=c.sent(),[3,4];case 2:return[4,null===(n=null===(r=this.storage)||void 0===r?void 0:r.storage)||void 0===n?void 0:n.getItemByKeys(i)];case 3:o=c.sent(),c.label=4;case 4:return a={},o&&Array.isArray(o)&&o.length===t.length?o.forEach(function(e,r){var n=(e||{}).value;a[t[r]]=n||""}):t.forEach(function(t){a[t]=""}),[2,a]}})})},e.prototype.getItemsWithOrigin=function(t,e){var r,n;return rg(this,void 0,void 0,function(){var i,o,a,s,c=this;return rm(this,function(u){switch(u.label){case 0:if(i=t.map(function(t){return c.createStorageKey(t)}),!((null==e?void 0:e.local)||this.disableCrossStorage))return[3,2];return[4,null===(r=this.localStore)||void 0===r?void 0:r.getItemByKeys(i)];case 1:return o=u.sent(),[3,4];case 2:return[4,null===(n=this.storage)||void 0===n?void 0:n.getItemByKeys(i)];case 3:o=u.sent(),u.label=4;case 4:return a={},s="1",o&&Array.isArray(o)&&o.length===t.length?o.forEach(function(e,r){var n=e||{},i=n.value,o=n.from,c=n.origin,u=t[r];c&&-1===c.indexOf("lf-zt.douyin.com")&&(s="0");var l="number"==typeof o?o.toString():"-99";a[u]={key:u,value:i||"",from:l,origin:c||"-1"}}):t.forEach(function(t){a[t]={key:t,value:"",from:"-98",origin:"-2"}}),[2,{data:a,from:s}]}})})},e.prototype.setCrossItems=function(t,e){var r,n;return rg(this,void 0,void 0,function(){var i,o,a,s,c=this;return rm(this,function(u){switch(u.label){case 0:if(0===t.length)return[2,{}];if(i=t.map(function(t){var e=t.key,r=t.value;return[c.createStorageKey(e),r]}),this.cache.setMultiple(t),!this.disableCrossStorage)return[3,2];return[4,null===(r=this.localStore)||void 0===r?void 0:r.setItemByKeys(i)];case 1:return o=u.sent(),[3,4];case 2:return a=(null==e?void 0:e.sync)?void 0:{async:3e3},[4,null===(n=this.storage)||void 0===n?void 0:n.setItemByKeys(i,a)];case 3:o=u.sent(),u.label=4;case 4:return s="0",o&&Array.isArray(o)&&o.length===t.length&&o.forEach(function(t){var e=(t||{}).origin;e&&-1!==e.indexOf("lf-zt.douyin.com")&&(s="1")}),[2,{cross:s}]}})})},e.prototype.setLocalItems=function(t){var e,r;return rg(this,void 0,void 0,function(){var n,i,o,a,s,c,u,l;return rm(this,function(f){switch(f.label){case 0:f.trys.push([0,7,8,9]),i=(n=rb(t)).next(),f.label=1;case 1:if(i.done)return[3,6];if(a=(o=i.value).key,s=o.value,c=this.createStorageKey(a),!this.disableCrossStorage)return[3,3];return[4,null===(e=this.localStore)||void 0===e?void 0:e.setItem(c,s)];case 2:return f.sent(),[3,5];case 3:return[4,null===(r=this.storage)||void 0===r?void 0:r.storage.setItem(c,s)];case 4:f.sent(),f.label=5;case 5:return i=n.next(),[3,1];case 6:return[3,9];case 7:return u={error:f.sent()},[3,9];case 8:try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2,{cross:"0"}]}})})},e.prototype.getStorageStatus=function(){var t;return null===(t=this.storage)||void 0===t?void 0:t.client.getIframeState()},e.prototype.getIframeStatus=function(){return this.crossStatus},e.prototype.startStorageChecker=function(){var t,e=this;null===(t=this.storage)||void 0===t||t.startStorageChecker().catch(function(t){e.emitError(t,"start storage checker error")})},e.prototype.getCacheStats=function(){return this.cache.getStats()},e}(t_),r_=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})},rS=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},rD="s_sdk_crypt_sdk",rK="s_sdk_cert_key",rP="s_sdk_sign_data_key",rI="_bd_ticket_crypt_cookie",rO=function(t){function e(e){var r=t.call(this)||this;return r.signType="pubKey",r.initType="pubKey",r.enableEcdh=!0,r.enableCache=!0,r.enableSecureTimestamp=!1,r.secureTimestampManager=null,r.disableStorageProxy=!1,r.setType=function(t){var e=t.initType,n=t.signType;r.signType=void 0===n?"pubKey":n,r.initType=void 0===e?"pubKey":e},r.setDisableStorageSignData=function(t){r._disableStorageSignData=t},r.setCrossStorageURL=function(t){r._iframeURL=t},r.setCrossStorageBackURL=function(t){r._iframeBackURL=t},r.setDisableCrossStorage=function(t){r._disableCrossStorage=t},r.setStorageNamespace=function(t){r._storageNamespace=t},r.setAgidAndHost=function(t,e){if(r._agid=t,e){r._storageNamespace="".concat(t,"_").concat(e);return}var n=tH();if(1===t&&"douyin.com"===n){r._ztIframe=!0;return}var i=n.split(".")[0];r._storageNamespace="".concat(t,"_").concat(i||"default")},r.setUpdateKeys=function(t){r.updateKeys=t},r.setConfig=function(t){r.config=t},r.setAid=function(t){r.aid=t},r.setContext=function(t){var e=t.disableCrossStorage,n=t.updateKeys,i=t.storageNamespace,o=t.iframeBackURL,a=t.iframeURL,s=t.signType,c=t.initType,u=t.disableStorageSignData;r.signType=void 0===s?"pubKey":s,r.initType=void 0===c?"pubKey":c,r._disableCrossStorage=void 0!==e&&e,r._storageNamespace=i,r._iframeBackURL=o,r._iframeURL=a,r.updateKeys=void 0!==n&&n,r._disableStorageSignData=void 0!==u&&u},r.start=function(){return rC(r,void 0,void 0,function(){var t,e=this;return rx(this,function(r){if(this.initIframeKeys(),this.enableEcdh)try{this.initECDHKey()}catch(t){this.reportError(t,"Pre init ECDH key")}return this.initPubKey(),this.enableSecureTimestamp&&(this.secureTimestampManager=ee.getInstance(),this.secureTimestampManager.setRefresh(function(){return Promise.all([e.initECDHKey(),e.getKeysInfoWithOrigin({certType:"cookie",scene:"web_protect"})]).then(function(t){var r=rE(t,2),n=r[0],i=r[1],o=i.sign,a=i.crypt;return{cryptoSDK:e.cryptoSDK,signValues:o,cryptoValues:a,aesKey:n}})}),this.secureTimestampManager.start(),this.secureTimestampManager.on("execute",function(t){e.emit("execute",t)}),this.secureTimestampManager.on("error",function(t){e.emit("error",t)})),(t=tA(this.config))&&this._initCookie(t),[2]})})},r.initIframeStore=function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o,a=this;return rx(this,function(i){switch(i.label){case 0:if(t=this._iframeURL,!this.cookieOperate&&(this.cookieOperate=new t1,null===(o=this.cookieOperate)||void 0===o||o.on("error",function(t){a.emit("error",t)})),this._storeV2)return[3,5];if(e=(this.initConfig||{}).sendEvent,this._storeV2=new rw({agid:this._agid,ztIframe:this._ztIframe,url:t,fallbackCacheOriginURL:this._iframeBackURL,sendEvent:e,disableCrossStorage:this._disableCrossStorage,namespace:this._storageNamespace,enableCache:this.enableCache}),this._storeV2.on("error",function(t){a.emit("error",t)}),this._storeV2.on("load",function(t){a.emit("load",t)}),this._storeV2.on("execute",function(t){a.emit("execute",t)}),this._storeV2.on("log",function(t){a.emit("log",t)}),this.disableStorageProxy)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,tb(this._storeV2)];case 2:return r=i.sent(),this._storeV2=r.storeSDK,n=r.checkResult,this.emit("log",{extra:{content:(null==n?void 0:n.reason)||"",pass:(null==n?void 0:n.pass)?"1":"0"},content:"storage plugin check result",level:"info"}),[3,4];case 3:return i.sent(),[3,4];case 4:var s;return this._storeSDK=(s=this._storeV2,{get:function(t){return r_(this,void 0,void 0,function(){return rS(this,function(e){switch(e.label){case 0:return[4,s.getItems([t])];case 1:return[2,e.sent()[t]||""]}})})},set:function(t,e,r){return r_(this,void 0,void 0,function(){return rS(this,function(n){return[2,s.setItems([{key:t,value:e}],{sync:r})]})})},delete:function(t){return r_(this,void 0,void 0,function(){return rS(this,function(e){switch(e.label){case 0:return[4,s.delete([t])];case 1:return e.sent(),[2]}})})},getItems:function(t){return r_(this,void 0,void 0,function(){return rS(this,function(e){return[2,s.getItems(t)]})})},setItems:function(t,e){return r_(this,void 0,void 0,function(){var r;return rS(this,function(n){return r=t.map(function(t,r){return{key:t,value:e[r]}}),[2,s.setItems(r,{})]})})},getItemsWithOrigin:function(t){return r_(this,void 0,void 0,function(){return rS(this,function(e){switch(e.label){case 0:return[4,s.getItems(t,{meta:!0})];case 1:return[2,e.sent()]}})})},getLocalItem:function(t){return r_(this,void 0,void 0,function(){return rS(this,function(e){switch(e.label){case 0:return[4,s.getItems([t],{local:!0})];case 1:return[2,e.sent()[t]||""]}})})},setLocalItem:function(t,e){return r_(this,void 0,void 0,function(){return rS(this,function(r){switch(r.label){case 0:return[4,s.setItems([{key:t,value:e}],{local:!0})];case 1:return r.sent(),[2]}})})},getLocalItems:function(t){return r_(this,void 0,void 0,function(){return rS(this,function(e){return[2,s.getItems(t,{local:!0})]})})},getIframeStatus:function(){return s.getIframeStatus()},getStorageStatus:function(){return s.getStorageStatus()},startStorageChecker:function(){s.startStorageChecker()}}),[2,!0];case 5:return[2]}})})},r.initIframeKeys=tB(function(){return rC(r,void 0,void 0,function(){return rx(this,function(t){switch(t.label){case 0:return[4,this.initIframeStore()];case 1:return t.sent(),this._checkCryptKeys(),[2]}})})}),r.initECDHKey=tO(function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o;return rx(this,function(a){switch(a.label){case 0:if(this._ecdh_key)return[2,this._ecdh_key];return[4,this._checkCryptKeys()];case 1:return a.sent(),[4,t4(this.aid||0,!0)];case 2:return t=a.sent().cert,[4,null===(o=this.cryptoSDK)||void 0===o?void 0:o.getKeys()];case 3:if(r=(e=a.sent()||{}).privateKey,n=e.publicKey,!r||!n)return[2,new Uint8Array([])];return[4,to(r,t)];case 4:return i=a.sent().bytes,this._ecdh_key=i,[2,i]}})})}),r.initPubKey=tO(function(){return rC(r,void 0,void 0,function(){var t,e,r,n;return rx(this,function(i){switch(i.label){case 0:return[4,this._checkCryptKeys()];case 1:return i.sent(),[4,null===(n=this.cryptoSDK)||void 0===n?void 0:n.getKeys()];case 2:if(e=(t=i.sent()||{}).privateKey,(r=t.publicKey)&&e)return[2,tE(e,r)];return[2]}})})}),r._initCookie=tO(function(t){return rC(r,void 0,void 0,function(){var e;return rx(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this._processServerCookie(t)];case 1:return r.sent(),[4,this._processCookie()];case 2:return r.sent(),[2,!0];case 3:return e=r.sent(),this.reportError(e,"Init Cookie Error"),[3,4];case 4:return[2,!1]}})})}),r._checkCryptKeys=tO(function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o,a,s,c,u,l,f;return rx(this,function(h){switch(h.label){case 0:return h.trys.push([0,11,,12]),[4,this.initIframeKeys()];case 1:return h.sent(),t=this._getInitKeys(),[4,null===(f=this._storeSDK)||void 0===f?void 0:f.getItems(t)];case 2:if(r=(e=h.sent())&&e[rD],this._initData=e||{},!(r&&"string"==typeof r))return[3,9];h.label=3;case 3:if(h.trys.push([3,7,,9]),o=(i=(n=JSON.parse(r))||{}).ec_privateKey,a=i.ec_publicKey,s=i.ec_csr,!(!o||!a||"cert"===this.initType&&!s))return[3,5];return this._initData={},this.emit("load",{action:"keys",op:"check",status:"fail"}),[4,this._initCert()];case 4:case 8:return[2,h.sent()];case 5:return this.cryptoSDK=new tj({privateKey:o,publicKey:a}),[4,this.cryptoSDK.pipeline];case 6:return h.sent(),this._cryptObject=n,this._cryptData=r,this.emit("load",{action:"sdk",op:"init",duration:this.getPerfomanceTimes(),status:"success"}),[2,!0];case 7:return c=h.sent(),this.emit("load",{action:"keys",op:"check",status:"fail"}),this.emit("error",{error:c,name:"check crypt data error"}),this._initData={},[4,this._initCert()];case 9:return[4,this._initCert()];case 10:return u=h.sent(),this.emit("load",{action:"sdk",op:"init",duration:this.getPerfomanceTimes(),status:"success"}),[2,u];case 11:return l=h.sent(),this.emit("load",{action:"sdk",op:"init",status:"fail"}),this.reportError(l,"check_crypt_keys_error"),[2,!1];case 12:return[2]}})})}),r.getPerfomanceTimes=function(){var t,e=0;try{e=(null===(t=window.performance)||void 0===t?void 0:t.now())||new Date().getTime()}catch(t){}return e},r._getInitKeys=function(){try{var t=[rD,rK],e="".concat(rP,"/web_protect");return t.push(e),t}catch(t){r.emit("error",{error:t,name:"get init keys error"})}return[rD,rK]},r._processCookie=function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o,a,s,c,u,l,f,h,d,p;return rx(this,function(v){switch(v.label){case 0:return v.trys.push([0,6,,7]),[4,this.initIframeKeys()];case 1:return v.sent(),[4,this._checkCryptKeys()];case 2:if(v.sent(),!(!this._hasProcessServerData||"pubKey"===this.initType))return[3,4];return[4,this.checkCookieMd5()];case 3:v.sent(),v.label=4;case 4:if(null===(l=null===(u=this._storeSDK)||void 0===u?void 0:u.startStorageChecker)||void 0===l||l.call(u),e=(t=this._cryptObject||{}).ec_privateKey,r=t.ec_publicKey,n=t.ec_csr,"cert"===this.initType&&!n||!e)return[2];return[4,tE(e,r)];case 5:return i=v.sent(),o="cert"===this.initType?{"bd-ticket-guard-client-csr":n||""}:{"bd-ticket-guard-ree-public-key":i,"bd-ticket-guard-web-version":2},a=rT({"bd-ticket-guard-version":2,"bd-ticket-guard-iteration-version":1},o),s=(0,x.rw)(JSON.stringify(a)),null===(f=this.cookieOperate)||void 0===f||f.deleteAllCookie("bd_ticket_guard_client_data"),null===(h=this.cookieOperate)||void 0===h||h.setCookieWithDomain("bd_ticket_guard_client_data",s),null===(d=this.cookieOperate)||void 0===d||d.setCookieWithDomain("bd_ticket_guard_client_web_domain","2"),this.emit("execute",{action:"cookie",op:"setItem",status:"success",ctx:{type:"client"}}),[3,7];case 6:return c=v.sent(),this.emit("log",{extra:{err:c.toString(),cookie:(null===(p=this.cookieOperate)||void 0===p?void 0:p.getCookie("bd_ticket_guard_client_data"))||""},content:"process cookie fail",level:"error"}),this.reportError(c,"Process Cookie Error"),this.emit("execute",{action:"cookie",op:"setItem",status:"fail",ctx:{type:"client"}}),[3,7];case 7:return[2]}})})},r.checkCookieMd5=function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b=this;return rx(this,function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),[4,this.initIframeKeys()];case 1:if(w.sent(),!(t=(null===(f=this.cookieOperate)||void 0===f?void 0:f.getCookie(rI))||""))return[2,!1];if(tP(t,this._cryptData,this._initData[rK],this._initData["".concat(rP,"/web_protect")]))return e=[rD,rK,"".concat(rP,"/web_protect")],r=[this._cryptData||"",this._initData[rK]||"",this._initData["".concat(rP,"/web_protect")]||""],null===(h=this.loadIframePromise)||void 0===h||h.then(function(){var t;return null===(t=b._storeSDK)||void 0===t?void 0:t.setItems(e,r,2).then(function(t){var r,n=(t||{}).cross,i=void 0===n?"0":n;return null===(r=b._storeSDK)||void 0===r?void 0:r.getItems(e).then(function(t){var e,r=tP((null===(e=b.cookieOperate)||void 0===e?void 0:e.getCookie(rI))||"",null==t?void 0:t[rD],null==t?void 0:t[rK],null==t?void 0:t["".concat(rP,"/web_protect")]);b.emit("load",{action:"cookie",op:"process",status:"success",ctx:{type:"1",scene:"callback",correct:r?"1":"0",cross:i}})})})}).catch(function(t){b.emit("load",{action:"cookie",op:"process",status:"fail",ctx:{type:"1",scene:"callback"}}),b.emit("error",{error:t,name:"async data fail"})}),this.emit("load",{action:"cookie",op:"process",status:"success",ctx:{type:"1"}}),this.initMatch=!0,[2];return[4,null===(d=this._storeSDK)||void 0===d?void 0:d.getLocalItem(rD)];case 2:if(n=w.sent(),tP(t,n,(null===(p=this._initData)||void 0===p?void 0:p[rK])||"",(null===(v=this._initData)||void 0===v?void 0:v["".concat(rP,"/web_protect")])||""))return i=[rD,rK,"".concat(rP,"/web_protect")],o=[n||"",this._initData[rK]||"",this._initData["".concat(rP,"/web_protect")]||""],this._processCryptData(n,"check cookie md5 error"),null===(y=this.loadIframePromise)||void 0===y||y.then(function(){var t;return null===(t=b._storeSDK)||void 0===t?void 0:t.setItems(i,o,2).then(function(t){var e,r=(t||{}).cross,n=void 0===r?"0":r;return null===(e=b._storeSDK)||void 0===e?void 0:e.getItems(i).then(function(t){var e,r=tP((null===(e=b.cookieOperate)||void 0===e?void 0:e.getCookie(rI))||"",null==t?void 0:t[rD],null==t?void 0:t[rK],null==t?void 0:t["".concat(rP,"/web_protect")]);b.emit("load",{action:"cookie",op:"process",status:"success",ctx:{type:"2",scene:"callback",correct:r?"1":"0",cross:n}})})})}).catch(function(t){b.emit("load",{action:"cookie",op:"process",status:"fail",ctx:{type:"2",scene:"callback"}}),b.emit("error",{error:t,name:"async data fail"})}),this.emit("load",{action:"cookie",op:"process",status:"success",ctx:{type:"2"}}),this.initMatch=!0,[2];return a=this._getInitKeys(),[4,null===(g=this._storeSDK)||void 0===g?void 0:g.getLocalItems(a)];case 3:if(s=w.sent(),tP(t,null==s?void 0:s[rD],null==s?void 0:s[rK],null==s?void 0:s["".concat(rP,"/web_protect")]))return c=[rD,rK,"".concat(rP,"/web_protect")],u=[null==s?void 0:s[rD],null==s?void 0:s[rK],null==s?void 0:s["".concat(rP,"/web_protect")]],this._processCryptData((null==s?void 0:s[rD])||"","check cookie md5 error"),null===(m=this.loadIframePromise)||void 0===m||m.then(function(){var t;return null===(t=b._storeSDK)||void 0===t?void 0:t.setItems(c,u,2).then(function(t){var e,r=(t||{}).cross,n=void 0===r?"0":r;return null===(e=b._storeSDK)||void 0===e?void 0:e.getItems(c).then(function(t){var e,r=tP((null===(e=b.cookieOperate)||void 0===e?void 0:e.getCookie(rI))||"",null==t?void 0:t[rD],null==t?void 0:t[rK],null==t?void 0:t["".concat(rP,"/web_protect")]);b.emit("load",{action:"cookie",op:"process",status:"success",ctx:{type:"3",scene:"callback",correct:r?"1":"0",cross:n}})})})}).catch(function(t){b.emit("load",{action:"cookie",op:"process",status:"fail",ctx:{type:"3",scene:"callback"}}),b.emit("error",{error:t,name:"async data fail"})}),this.emit("load",{action:"cookie",op:"process",status:"success",ctx:{type:"3"}}),this.initMatch=!0,[2];return this.emit("load",{action:"cookie",op:"process",status:"fail"}),[3,5];case 4:return l=w.sent(),this.emit("error",{error:l,name:"check cookie md5 fail"}),[3,5];case 5:return[2]}})})},r._processCryptData=function(t,e){try{if(!t||"string"!=typeof t)return;var n=JSON.parse(t),i=n||{},o=i.ec_privateKey,a=i.ec_publicKey;i.ec_csr,r._cryptData=t,r._initData[rD]=t,r._cryptObject=n,r.cryptoSDK=new tj({privateKey:o,publicKey:a})}catch(t){r.emit("error",{error:t,name:e||"process crypt data error"})}},r._compareCookieWithCache=function(t,e){return!!e&&!!t&&(e===t||!1)},r._processServerCookie=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b,w,_,S,k,T,C,E,D,K,P,I,O,B,L,A,R,U,M,j,V,N,W,q,F,H,J,G,z,Z,X,Q,Y;return rx(this,function($){switch($.label){case 0:return $.trys.push([0,13,,14]),[4,this.initIframeKeys()];case 1:return $.sent(),[4,this._checkCryptKeys()];case 2:if($.sent(),e=(null===(M=this.cookieOperate)||void 0===M?void 0:M.getCookie("bd_ticket_guard_server_data"))||"",r=tV("bd_ticket_guard_server_data")||"",(e||r)&&this.emit("log",{extra:{equal:e===r?"1":"0",s1:e?"1":"0",s2:r?"1":"0"},content:"get_cookie_two",level:"info"}),n=e||r,(i=(null===(j=this.cookieOperate)||void 0===j?void 0:j.getCookie("bd_ticket_guard_web_domain"))||"")&&(this.emit("execute",{op:"check",action:"server_data",status:"success",ctx:{server:n?"1":"0",server2:r?"1":"0",domain:i}}),null===(V=this.cookieOperate)||void 0===V||V.setCookieWithDomain("_bd_ticket_crypt_doamin",i)),!n)return[3,11];if(o=new Date().getTime(),a=decodeURIComponent(n),l=void 0===(u=(c=JSON.parse(s=(0,x.gg)(a))||{}).client_cert)?"":u,f=c.log_id,h=c.create_time,d=c.ticket,v=void 0===(p=c.ts_sign)?"":p,y=["".concat(rP,"/").concat(t)],g=[s],!l)return[3,9];return this._initData[rK]=l,y.push(rK),g.push(l),[4,tD(this._cryptData,l)];case 3:return m=$.sent(),[4,tK(this._cryptData,l)];case 4:if(b=$.sent(),!(!m&&!b))return[3,8];return[4,null===(N=this._storeSDK)||void 0===N?void 0:N.getLocalItem(rD)];case 5:return[4,tD(w=$.sent(),l)];case 6:return _=$.sent(),[4,tK(w,l)];case 7:return S=$.sent(),w&&(_||S)?(y.push(rD),g.push(w),this._processCryptData(w,"process local server cert error"),k=new Date().getTime(),(T=tI(w,l,s))&&(null===(W=this.cookieOperate)||void 0===W||W.setCookieWithDomain(rI,T)),C=new Date().getTime(),this.emit("log",{extra:{md5:T,md5Cookie:(null===(q=this.cookieOperate)||void 0===q?void 0:q.getCookie(rI))||"",duration:C-k},content:"generate keys info success local",level:"info"}),this.emit("load",{action:"cookie",op:"check",status:"success",ctx:{type:"local"}})):(this.emit("load",{action:"cookie",op:"check",status:"fail",ctx:{type:"local",local:w?"1":"0",localCorrect:_?"1":"0"}}),D=(E=this._cryptObject||{}).ec_csr,K=E.ec_publicKey,this.emit("log",{content:"generate keys info success fail",level:"info",extra:{csr:D||"",pub:K||"",cert:l||""}})),[3,9];case 8:this._cryptData&&y.push(rD),this._cryptData&&g.push(this._cryptData),(T=tI(this._cryptData,l,s))&&(null===(F=this.cookieOperate)||void 0===F||F.setCookieWithDomain(rI,T)),this.emit("log",{extra:{md5:T,md5Cookie:(null===(H=this.cookieOperate)||void 0===H?void 0:H.getCookie(rI))||""},content:"gen keys cookie",level:"info"}),this.emit("load",{action:"cookie",op:"check",status:"success",ctx:{type:"init"}}),$.label=9;case 9:return[4,null===(J=this._storeSDK)||void 0===J?void 0:J.setItems(y,g)];case 10:$.sent(),this.emit("execute",{action:"response",op:"new",status:"success",ctx:{new_gen_ticket:d,new_gen_ts_sign:v.slice(.64),new_gen_logid:f,new_gen_create_time:h,new_gen_publib_key:l.replace("pub.","").slice(.64),type:"cookies"}}),null===(G=this.cookieOperate)||void 0===G||G.deleteAllCookie("bd_ticket_guard_server_data"),i&&(null===(z=this.cookieOperate)||void 0===z||z.deleteAllCookie("bd_ticket_guard_web_domain"));try{I=(P=JSON.parse(s||"{}")||{}).ts_sign,O=void 0===I?"":I,B=P.log_id,L=void 0===B?"":B,this.emit("log",{extra:{ts_sign:O,log_id:L},content:"process server cookie",level:"info"})}catch(t){}A=(null===(Z=this.cookieOperate)||void 0===Z?void 0:Z.getCookie("bd_ticket_guard_server_data"))?"0":"1",R=new Date().getTime(),this.emit("execute",{action:"cookie",op:"setItem",status:"success",duration:R>o?R-o:0,ctx:{type:"server",deleteStatus:A}});try{null===(X=this.cookieOperate)||void 0===X||X.setCookieWithDomain("__security_server_data_status","1"),this.emit("execute",{action:"cookie",op:"process",status:"success"})}catch(t){this.emit("execute",{action:"cookie",op:"process",status:"fail"}),this.emit("log",{content:"set process server cookie error",level:"error"})}return this._hasProcessServerData=!0,[3,12];case 11:!n&&i&&(null===(Q=this.cookieOperate)||void 0===Q||Q.deleteAllCookie("bd_ticket_guard_web_domain"),this.emit("log",{content:"process_web_domain",level:"info",extra:{cookie:(null==document?void 0:document.cookie)||"",domain:(null===(Y=this.cookieOperate)||void 0===Y?void 0:Y.getCookie("bd_ticket_guard_web_domain"))||""}})),$.label=12;case 12:return[2,!0];case 13:return U=$.sent(),this.emit("log",{extra:{cookie:null==document?void 0:document.cookie},content:"Process server Cookie Error",level:"error"}),this.reportError(U,"process server cookie Error"),this.emit("execute",{action:"cookie",op:"setItem",status:"fail",ctx:{type:"server"}}),[3,14];case 14:return[2,!1]}})})},r._initCert=function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o,a,s,c,u,l;return rx(this,function(f){switch(f.label){case 0:return f.trys.push([0,6,,7]),[4,this.initIframeKeys()];case 1:return f.sent(),[4,this._getCertificatePem()];case 2:return e=(t=f.sent()).ec_privateKey,r=t.ec_publicKey,n=t.ec_csr,[4,null===(a=this._storeSDK)||void 0===a?void 0:a.getLocalItem(rD)];case 3:if((i=f.sent())&&"string"==typeof i)return this._cryptData=i,this._cryptObject=JSON.parse(i),this.cryptoSDK=new tj({privateKey:null===(s=this._cryptObject)||void 0===s?void 0:s.ec_privateKey,publicKey:null===(c=this._cryptObject)||void 0===c?void 0:c.ec_publicKey}),this._initData={cryptCacheKey:i},this.emit("ready",{action:"keys",op:"init",status:"fail",ctx:{type:"check"}}),[2,!0];return this._cryptObject={ec_privateKey:e,ec_publicKey:r,ec_csr:n},this._cryptData=JSON.stringify(this._cryptObject),[4,null===(u=this._storeSDK)||void 0===u?void 0:u.setLocalItem(rD,this._cryptData)];case 4:return f.sent(),[4,null===(l=this._storeSDK)||void 0===l?void 0:l.set(rD,this._cryptData)];case 5:return f.sent(),this._initData={cryptCacheKey:this._cryptData},[2,!0];case 6:return o=f.sent(),this.emit("load",{action:"keys",op:"init",status:"fail"}),this.reportError(o,"init_cert_error"),[2,!1];case 7:return[2]}})})},r.getCertificate=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a;return rx(this,function(s){switch(s.label){case 0:e=t.certType,r=t.scene,s.label=1;case 1:return s.trys.push([1,9,,10]),[4,this.initIframeKeys()];case 2:return s.sent(),[4,this._checkCryptKeys()];case 3:if(s.sent(),"cookie"!==e)return[3,6];return[4,this._initCookie(r)];case 4:return s.sent(),[4,this._processServerCookie(r)];case 5:s.sent(),s.label=6;case 6:return[4,null===(o=this.setSignValueScheduler)||void 0===o?void 0:o.wait()];case 7:return s.sent(),[4,null===(a=this._storeSDK)||void 0===a?void 0:a.get(rK)];case 8:if(n=s.sent())return this.emit("log",{extra:{cert:n||""},content:"Get Cert Success",level:"info"}),[2,(0,x.rw)(n)];return this.emit("log",{extra:{cert:n||""},content:"Get Cert Fail",level:"info"}),[2,!1];case 9:return i=s.sent(),this.reportError(i,"get cert fail"),[3,10];case 10:return[2,!1]}})})},r.getPubKey=function(){return rC(r,void 0,void 0,function(){var t,e,r,n;return rx(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this._checkCryptKeys()];case 1:if(i.sent(),e=(t=this._cryptObject||{}).ec_privateKey,r=t.ec_publicKey,!e)return[3,3];return[4,tE(e,r)];case 2:return[2,i.sent()];case 3:return[3,5];case 4:return n=i.sent(),this.reportError(n,"get pubkey error"),[3,5];case 5:return[2,""]}})})},r.getCertSignRequest=function(){return rC(r,void 0,void 0,function(){var t,e;return rx(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._checkCryptKeys()];case 1:if(r.sent(),t=(this._cryptObject||{}).ec_csr)return[2,(0,x.rw)(t)];return[2,""];case 2:return e=r.sent(),this.reportError(e,"get csr error"),[3,3];case 3:return[2,""]}})})},r._signValueWithIframe=function(t,e,n,i){return rC(r,void 0,void 0,function(){var r,i,o,a,s,c,u,l,f,h,d,p;return rx(this,function(o){switch(o.label){case 0:return o.trys.push([0,10,,11]),[4,this.initIframeKeys()];case 1:if(o.sent(),i=(r=JSON.parse(t)||{}).client_cert,r.ts_sign,r.ticket,this._disableStorageSignData)return[3,3];return[4,null===(f=this._storeSDK)||void 0===f?void 0:f.set("".concat(rP,"/").concat(e),t,!0)];case 2:o.sent(),o.label=3;case 3:if(this._signData=t,!n)return[3,6];if(!(s=i))return[3,5];return[4,null===(h=this._storeSDK)||void 0===h?void 0:h.set("".concat(rK),i,!0)];case 4:s=o.sent(),o.label=5;case 5:return[3,9];case 6:if(!this._storageNamespace)return[3,9];if(!(c=i))return[3,8];return[4,null===(d=this._storeSDK)||void 0===d?void 0:d.set("".concat(rK),i,!0)];case 7:c=o.sent(),o.label=8;case 8:o.label=9;case 9:return"web_protect"===e&&(u=tI(this._cryptData,i,t),null===(p=this.cookieOperate)||void 0===p||p.setCookieWithDomain(rI,u)),[2,!0];case 10:return l=o.sent(),this.reportError(l,"sign value error"),[2,!1];case 11:return[2]}})})},r.setSignValue=function(t){var e,n,i=t||{},o=i.sign,a=i.scene,s=i.namespace,c=i.logCtx;try{if("string"==typeof o)n=(0,x.gg)(o);else{if("object"!=typeof o)return!1;n=JSON.stringify(o)}return null===(e=r.setSignValueScheduler)||void 0===e||e.provider(function(){return r._signValueWithIframe(n,a,s,c)}),!0}catch(t){return r.reportError(t,"set signValue Error"),!1}},r.setSignValueAsync=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s;return rx(this,function(c){switch(c.label){case 0:r=(e=t||{}).sign,n=e.scene,i=e.namespace,o=e.logCtx,c.label=1;case 1:if(c.trys.push([1,3,,4]),"string"==typeof r)a=(0,x.gg)(r);else{if("object"!=typeof r)return[2,!1];a=JSON.stringify(r)}return[4,this._signValueWithIframe(a,n,i,o)];case 2:return c.sent(),[2,!0];case 3:return s=c.sent(),this.reportError(s,"set signValue Error"),[2,!1];case 4:return[2]}})})},r.clearSignData=function(t){return rC(r,void 0,void 0,function(){var e,r,n;return rx(this,function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.initIframeKeys()];case 1:return e.sent(),[4,null===(r=this._storeSDK)||void 0===r?void 0:r.delete("".concat(rP,"/").concat(t))];case 2:if(e.sent(),this._signData="",!this._storageNamespace)return[3,4];return[4,null===(n=this._storeSDK)||void 0===n?void 0:n.delete("".concat(rK))];case 3:e.sent(),e.label=4;case 4:return[2,!0];case 5:return e.sent(),[2,!1];case 6:return[2]}})})},r.sign=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g;return rx(this,function(m){switch(m.label){case 0:e=t.sign_data,r=t.req_content,n=t.timestamp,o=void 0===(i=t.certType)?"header":i,a=t.scene,m.label=1;case 1:return m.trys.push([1,13,,14]),[4,this.initIframeKeys()];case 2:return m.sent(),[4,this._checkCryptKeys()];case 3:if(m.sent(),"cookie"!==o)return[3,6];return[4,this._initCookie(a)];case 4:return m.sent(),[4,this._processServerCookie(a||"")];case 5:m.sent(),m.label=6;case 6:if("header"!==o)return[3,8];return[4,null===(v=this.setSignValueScheduler)||void 0===v?void 0:v.wait()];case 7:m.sent(),m.label=8;case 8:if(s=void 0,this._disableStorageSignData)return[3,10];return[4,null===(y=this._storeSDK)||void 0===y?void 0:y.get("".concat(rP,"/").concat(a))];case 9:return s=m.sent(),[3,11];case 10:s=this._signData,m.label=11;case 11:if(u=(c=JSON.parse(s||"{}")).ticket,l=c.ts_sign,!e&&!u)return this.emit("log",{content:"sign ticket is empty",level:"error"}),[2,""];return[4,null===(g=this.cryptoSDK)||void 0===g?void 0:g.sign(e||u)];case 12:return f=m.sent(),h=(0,x.MU)((null==f?void 0:f.hex)||""),d={ts_sign:l,req_content:r||e||u,req_sign:h,timestamp:n||Math.floor(new Date().getTime()/1e3)},this.emit("log",{extra:{ts_sign:l},content:"sign data success",level:"info"}),[2,(0,x.rw)(JSON.stringify(d)||"")];case 13:return p=m.sent(),this.emit("log",{extra:{sign_data:e||""},content:"sign data error",level:"error"}),this.reportError(p,"sign error"),[3,14];case 14:return[2,""]}})})},r.pureSign=function(t){return rC(r,void 0,void 0,function(){var e,r,n;return rx(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,null===(n=this.cryptoSDK)||void 0===n?void 0:n.sign(t)];case 1:return e=i.sent(),[2,(0,x.MU)((null==e?void 0:e.hex)||"")];case 2:return r=i.sent(),this.reportError(r,"pure sign fail"),[2,""];case 3:return[2]}})})},r.getTSSign=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c;return rx(this,function(u){switch(u.label){case 0:r=void 0===(e=t.certType)?"header":e,n=t.scene,u.label=1;case 1:return u.trys.push([1,12,,13]),[4,this.initIframeKeys()];case 2:return u.sent(),[4,this._checkCryptKeys()];case 3:if(u.sent(),"cookie"!==r)return[3,6];return[4,this._initCookie(n)];case 4:return u.sent(),[4,this._processServerCookie(n)];case 5:u.sent(),u.label=6;case 6:if("header"!==r)return[3,8];return[4,null===(s=this.setSignValueScheduler)||void 0===s?void 0:s.wait()];case 7:u.sent(),u.label=8;case 8:if(i=void 0,this._disableStorageSignData)return[3,10];return[4,null===(c=this._storeSDK)||void 0===c?void 0:c.get("".concat(rP,"/").concat(n))];case 9:if(!(i=u.sent()))return this.emit("log",{extra:{content:i||""},content:"get tssign fail",level:"info"}),[2,!1];return[3,11];case 10:i=this._signData,u.label=11;case 11:return o=JSON.parse(i||"{}").ts_sign,this.emit("log",{extra:{content:o||""},content:"get tssign success",level:"info"}),[2,o];case 12:return a=u.sent(),this.reportError(a,"get ts sign Error"),[3,13];case 13:return[2,!1]}})})},r.getTicket=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s;return rx(this,function(c){switch(c.label){case 0:e=t.certType,r=t.scene,c.label=1;case 1:return c.trys.push([1,12,,13]),[4,this.initIframeKeys()];case 2:return c.sent(),[4,this._checkCryptKeys()];case 3:if(c.sent(),"cookie"!==e)return[3,6];return[4,this._initCookie(r)];case 4:return c.sent(),[4,this._processServerCookie(r)];case 5:return c.sent(),[3,8];case 6:if("header"!==e)return[3,8];return[4,null===(a=this.setSignValueScheduler)||void 0===a?void 0:a.wait()];case 7:c.sent(),c.label=8;case 8:if(n=void 0,this._disableStorageSignData)return[3,10];return[4,null===(s=this._storeSDK)||void 0===s?void 0:s.get("".concat(rP,"/").concat(r))];case 9:if(!(n=c.sent()))return this.emit("log",{content:"Get Ticket Fail",level:"error"}),[2,!1];return[3,11];case 10:n=this._signData,c.label=11;case 11:return i=(JSON.parse(n||"{}")||{}).ticket,this.emit("log",{extra:{storage_sign_data:n||"",ticket:i||""},content:"Get Ticket Success",level:"info"}),[2,i];case 12:return o=c.sent(),this.reportError(o,"Get Ticket Error"),[2,!1];case 13:return[2]}})})},r._getCertificatePem=function(){return rC(r,void 0,void 0,function(){var t,e,r,n,i,o,a,s,c,u;return rx(this,function(l){switch(l.label){case 0:return t=new Date().getTime(),this.cryptoSDK=new tj({}),[4,null===(c=this.cryptoSDK)||void 0===c?void 0:c.getKeys()];case 1:return n=void 0===(r=(e=l.sent()||{}).publicKey)?"":r,o=void 0===(i=e.privateKey)?"":i,a=null===(u=this.cryptoSDK)||void 0===u?void 0:u.getCSR(),s=new Date().getTime(),this.emit("load",{action:"keys",op:"init",duration:s>t?s-t:0,status:"success",ctx:{pri:o?"1":"0",pub:n?"1":"0"}}),[2,{ec_publicKey:n,ec_privateKey:o,ec_csr:a}]}})})},r._checkCert=function(t){return!0},r.refresh=function(){return rC(r,void 0,void 0,function(){var t,e;return rx(this,function(r){switch(r.label){case 0:return this._cryptData=void 0,this._cryptObject=void 0,this._signData=void 0,[4,this.initIframeKeys()];case 1:return r.sent(),[4,null===(t=this._storeSDK)||void 0===t?void 0:t.delete(rD)];case 2:return r.sent(),[4,null===(e=this._storeSDK)||void 0===e?void 0:e.delete(rK)];case 3:return r.sent(),this._storeSDK=void 0,[2,this.start()]}})})},r.reportError=function(t,e,n,i,o){try{if(r.emit("error",{error:t,name:e}),n&&i){var a=Array.isArray(o)&&o.length>0&&o[0];if("string"==typeof a)r.emit("log",{content:"report error",extra:{key:a||""},level:"error"});else if(a&&Array.isArray(a)){var s={};a.forEach(function(t){s["".concat(t.replace(/\//g,"_"))]="1"}),r.emit("log",{content:"report error",extra:rT({},s||{}),level:"error"})}}}catch(t){r.emit("error",{error:t,name:"report error"})}},r.getKeysInfo=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b,w;return rx(this,function(_){switch(_.label){case 0:e=Date.now(),r=t.certType,n=t.scene,_.label=1;case 1:return _.trys.push([1,11,,12]),[4,this.initIframeKeys()];case 2:return _.sent(),[4,this._checkCryptKeys()];case 3:if(_.sent(),"cookie"!==r)return[3,6];return[4,this._initCookie(n)];case 4:return _.sent(),[4,this._processServerCookie(n)];case 5:return _.sent(),[3,8];case 6:if("header"!==r)return[3,8];return[4,null===(b=this.setSignValueScheduler)||void 0===b?void 0:b.wait()];case 7:_.sent(),_.label=8;case 8:return i=[rD,rK,"".concat(rP,"/").concat(n)],[4,null===(w=this._storeSDK)||void 0===w?void 0:w.getItems(i)];case 9:if(!(o=_.sent()))return this.emit("log",{content:"Get Keys Info Fail",level:"error"}),[2,{}];return a=o[rD],s=o[rK],c=o["".concat(rP,"/").concat(n)],l=(u=JSON.parse(a||"{}")||{}).ec_privateKey,f=u.ec_publicKey,h=u.ec_csr,p=(d=JSON.parse(c||"{}")||{}).ticket,v=d.ts_sign,y=d.client_cert,[4,tE(l,f)];case 10:return g=_.sent()||"",this.emit("log",{extra:{server_data:c||"",cert_data:s||"",csr:h||""},content:"Get Keys Info Success",level:"info"}),[2,{crypt:{ec_privateKey:l,ec_publicKey:f},cert:s,sign:{ticket:p,ts_sign:v,client_cert:y},b64Cert:(0,x.rw)(s||""),b64PubKey:g,b64Csr:(0,x.rw)(h||""),getKeysInfoTime:Date.now()-e||0}];case 11:return m=_.sent(),this.reportError(m,"Get Ticket Fail"),[3,12];case 12:return[2,{}]}})})},r.getKeysInfoWithOrigin=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b,w,_,S,k,T,C,E,D,K,P,I,O,B,L,A,R,U,M;return rx(this,function(j){switch(j.label){case 0:r={current:e=Date.now(),check:0,wait:0,get:0,parse:0},n=t.certType,i=t.scene,j.label=1;case 1:return j.trys.push([1,11,,12]),[4,this.initIframeKeys()];case 2:return j.sent(),[4,this._checkCryptKeys()];case 3:if(j.sent(),r.check=Date.now()-r.current,r.current=Date.now(),"cookie"!==n)return[3,6];return[4,this._initCookie(i)];case 4:return j.sent(),[4,this._processServerCookie(i)];case 5:return j.sent(),[3,8];case 6:if("header"!==n)return[3,8];return[4,null===(R=this.setSignValueScheduler)||void 0===R?void 0:R.wait()];case 7:j.sent(),j.label=8;case 8:return r.wait=Date.now()-r.current,r.current=Date.now(),o=[rD,rK,"".concat(rP,"/").concat(i)],[4,null===(U=this._storeSDK)||void 0===U?void 0:U.getItemsWithOrigin(o)];case 9:if(a=j.sent(),r.get=Date.now()-r.current,r.current=Date.now(),!a)return this.emit("log",{content:"get keysinfo fail",level:"error"}),[2,{}];return u=void 0===(c=(s=a||{}).data)?{}:c,f=void 0===(l=s.from)?"0":l,h=Object.values(u),d=u[rD],p=u[rK],v=u["".concat(rP,"/").concat(i)],b=(m=JSON.parse((g=void 0===(y=(d||{}).value)?"":y)||"{}")||{}).ec_privateKey,w=m.ec_publicKey,_=m.ec_csr,S=(null==v?void 0:v.value)||"",k=(null==p?void 0:p.value)||"",C=(T=JSON.parse(S||"{}")||{}).ticket,E=T.ts_sign,D=T.client_cert,P=void 0===(K=T.log_id)?"":K,O=void 0===(I=T.create_time)?0:I,[4,tE(b,w)];case 10:return B=j.sent()||"",r.parse=Date.now()-r.current,this.emit("log",{extra:{log_id:P,ts_sign:E},content:"get keysinfo success",level:"info"}),L=Date.now()-e||0,[2,{crypt:{ec_privateKey:b,ec_publicKey:w},cryptData:g,cert:k,sign:{ticket:C,ts_sign:E,client_cert:D,log_id:P,create_time:O},b64Cert:(0,x.rw)(k||""),b64PubKey:B,b64Csr:(0,x.rw)(_||""),serverData:S,dataFrom:f,items:h,getKeysInfoTime:L,cacheEnabled:null===(M=this._memoryCache)||void 0===M?void 0:M.isEnabled()}];case 11:return A=j.sent(),this.reportError(A,"Get Ticket catch"),[3,12];case 12:return[2,{}]}})})},r.signWithKeysInfo=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b,w,_,S,k,T,C,E,D,K,P,I,O,B,L;return rx(this,function(A){switch(A.label){case 0:e=t.sign_data,r=t.req_content,n=t.timestamp,i=t.certType,o=t.scene,a=t.keysInfo,c=void 0===(s=t.isNewCert)||s,A.label=1;case 1:return A.trys.push([1,17,,18]),[4,this._checkCryptKeys()];case 2:if(A.sent(),"cookie"!==i)return[3,5];return[4,this._initCookie(o)];case 3:return A.sent(),[4,this._processServerCookie(o||"")];case 4:A.sent(),A.label=5;case 5:if("header"!==i)return[3,7];return[4,null===(P=this.setSignValueScheduler)||void 0===P?void 0:P.wait()];case 6:A.sent(),A.label=7;case 7:if(u=a.sign,l=a.crypt,!u)return this.emit("log",{content:"sign data fail",level:"info",extra:{content:"sign data is null"}}),[2,null];if(h=(f=u||{}).ticket,d=f.ts_sign,!e&&!h)return this.emit("log",{content:"sign data fail",level:"info",extra:{content:"sign data and ticket is null"}}),[2,null];if(v=(p=l||{}).ec_privateKey,y=p.ec_publicKey,this.cryptoSDK=new tj({privateKey:v,publicKey:y}),g="",m=this.enableEcdh&&c,b=Date.now(),w={},!m)return[3,14];A.label=8;case 8:if(A.trys.push([8,13,,14]),_=Date.now(),S=void 0,!this._ecdh_key)return[3,9];return S=this._ecdh_key,[3,11];case 9:return[4,this.initECDHKey()];case 10:S=A.sent(),A.label=11;case 11:return w.ecdhTime=Date.now()-_,[4,null===(I=this.cryptoSDK)||void 0===I?void 0:I.signWithHmac(e||h,S)];case 12:return g=(k=A.sent()).result,Object.assign(w,k.times),[3,14];case 13:return T=A.sent(),m=!1,this.emit("log",{level:"error",content:"sign with hmac failed",extra:{message:(null==T?void 0:T.message)||""}}),[3,14];case 14:if(m)return[3,16];return[4,null===(O=this.cryptoSDK)||void 0===O?void 0:O.sign(e||h)];case 15:C=A.sent(),g=(0,x.MU)(C.hex||""),A.label=16;case 16:return E=Date.now()-b,D={ts_sign:d,req_content:r||e||h,req_sign:g,timestamp:n||Math.floor(new Date().getTime()/1e3)},this.emit("log",{extra:{ts_sign:d},content:"sign data success",level:"info"}),[2,{result:(0,x.rw)(JSON.stringify(D)||""),times:rT({calTime:E},w),algoType:m?"hmac":"ecdsa"}];case 17:return K=A.sent(),this.emit("log",{extra:{sign_data:e||"",req_content:r||"",certType:i||"",scene:o||"",csr:(null===(B=null==a?void 0:a.crypt)||void 0===B?void 0:B.ec_csr)||"",cert:a.cert||"",sign:(null===(L=a.sign)||void 0===L?void 0:L.ticket)||""},content:"sign data with keys Info is error",level:"error"}),this.reportError(K,"sign error"),[3,18];case 18:return[2,null]}})})},r.setKeysAndValues=function(t,e){var n,i="",o="",a="";null===(n=r._storeSDK)||void 0===n||n.setItems(t,e,2).then(function(n){t.forEach(function(t,r){var n=e[r];t===rD?i=n:t===rK?o=n:t==="".concat(rP,"/web_protect")&&(a=n)});var s,c,u=tI(i,o,a);u&&(null===(s=r.cookieOperate)||void 0===s||s.setCookieWithDomain(rI,u)),r.emit("log",{extra:{md5:u,md5Cookie:(null===(c=r.cookieOperate)||void 0===c?void 0:c.getCookie(rI))||""},content:"generate crypt key success sign success",level:"info"})}).catch(function(t){r.emit("error",{error:t,name:"update keys when sign error"})})},r.b642str=function(t){return(0,x.gg)(t)},r.getIframeStatus=function(){var t;return null===(t=r._storeSDK)||void 0===t?void 0:t.getIframeStatus()},r.getCookieCryptStatus=function(){var t;return(null===(t=r.cookieOperate)||void 0===t?!!void 0:!!t.getCookie(rI))||!1},r.getStorageStatus=function(){var t;return null===(t=r._storeSDK)||void 0===t?void 0:t.getStorageStatus()},r.checkSignData=function(t){return rC(r,void 0,void 0,function(){var e,r,n,i,o,a,s,c,u,l,f,h;return rx(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),!(e=(null===(f=this.cookieOperate)||void 0===f?void 0:f.getCookie(rI))||""))return[2,{match_md5_local:"-99",match_md5_iframe:"-99"}];return n=(r=t||{}).cryptData,i=r.cert,o=r.serverData,r.dataFrom,s=tP(e,n,i,o),c=this._getInitKeys(),[4,this.initIframeKeys()];case 1:return a.sent(),[4,null===(h=this._storeSDK)||void 0===h?void 0:h.getLocalItems(c)];case 2:return u=a.sent(),[2,{match_md5_local:tP(e,null==u?void 0:u[rD],null==u?void 0:u[rK],null==u?void 0:u["".concat(rP,"/web_protect")])?"1":"-99",match_md5_iframe:s?"1":"-99"}];case 3:return l=a.sent(),this.emit("error",{error:l,name:"check sign data error"}),[3,4];case 4:return[2,{match_md5_local:"-99",match_md5_iframe:"-99"}]}})})},r.isTopBrowser=function(){return tS()},r.setEnableEcdh=function(t){r.enableEcdh=t},r.setEnableCache=function(t){r.enableCache=t},r.setDisableStorageProxy=function(t){r.disableStorageProxy=t},r.setEnableSecureTimestamp=function(t){r.enableSecureTimestamp=t},r.removeSecureTimestamp=function(){return t6()},r.getUsage=function(){return tl()},r.initConfig=e,r.setSignValueScheduler=new tL,r._initData={},r._hasProcessServerData=!1,r.initMatch=!1,r.config={},r}return rk(e,t),e}(t_),rB=function(){function t(e){var r,n,i,o,a,s,c=this;if(this.setContext=function(t){var e;for(var r in t)null===(e=c.accountApiSlardar)||void 0===e||e.call(c,"context.set",r,t[r])},this.setWebId=function(e){var r,n;null===(n=null===(r=null==t?void 0:t._instance)||void 0===r?void 0:r.accountApiSlardar)||void 0===n||n.call(r,"config",{userId:e})},this.setEnv=function(e){var r,n,i,o;null===(n=null===(r=null==t?void 0:t._instance)||void 0===r?void 0:r.accountApiSlardar)||void 0===n||n.call(r,"config",{env:e}),null===(o=null===(i=null==t?void 0:t._instance)||void 0===i?void 0:i.accountApiSlardar)||void 0===o||o.call(i,"config")},!t._instance){this.accountApiSlardar=null==window?void 0:window.ZTClientInstance,!this.accountApiSlardar&&(this.accountApiSlardar=null===(r=null==window?void 0:window.ZTcreateBrowserClient)||void 0===r?void 0:r.call(window),null===(n=this.accountApiSlardar)||void 0===n||n.call(this,"init",{bid:"uc_secure_sdk",pid:null===(i=null==window?void 0:window.location)||void 0===i?void 0:i.host,env:"online",plugins:{tti:!1,fmp:!1,performance:!1,resource:!1,resourceError:!1,pageview:!1,jsError:{onerror:!1,onunhandledrejection:!1,dedupe:!1,captureGlobalAsync:!1},breadcrumb:{dom:!1},ajax:{autoWrap:!1,ignoreUrls:[/^((?!\/passport\/).)*$/],collectBodyOnError:!0},fetch:{autoWrap:!1,ignoreUrls:[/^((?!\/passport\/).)*$/],collectBodyOnError:!0},blankScreen:{autoDetect:!1,screenshot:!1}}})),null===(o=this.accountApiSlardar)||void 0===o||o.call(this,"start");var u=this.checkEnv();null===(a=this.accountApiSlardar)||void 0===a||a.call(this,"context.set","container",u),null===(s=this.accountApiSlardar)||void 0===s||s.call(this,"context.set","sdkversion",e),t._instance=this}return t._instance}return t.getSlardar=function(){return this._instance},t.clearSlardar=function(){this._instance=null},t.prototype.dot=function(e){var r,n;try{null===(n=null===(r=null==t?void 0:t._instance)||void 0===r?void 0:r.accountApiSlardar)||void 0===n||n.call(r,"sendEvent",e)}catch(t){}},t.prototype.log=function(e){var r,n;try{null===(n=null===(r=null==t?void 0:t._instance)||void 0===r?void 0:r.accountApiSlardar)||void 0===n||n.call(r,"sendLog",e)}catch(t){}},t.prototype.throw=function(e){var r,n;try{var i=e.err,o=e.extra;null===(n=null===(r=null==t?void 0:t._instance)||void 0===r?void 0:r.accountApiSlardar)||void 0===n||n.call(r,"captureException",i instanceof Error?i:Error(i.toString),o)}catch(t){}},t.prototype.checkEnv=function(){var t=null==window?void 0:window.navigator.userAgent;return/TTElectron/.test(t)?"electron":"web"},t}(),rL=r("688551"),rA=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0;){var e=rW.shift();e&&(null===(t=null==rF?void 0:rF._instance)||void 0===t||t[e.func](e.args))}},80),setTimeout(function(){for(;rN.length>0;){var t=rN.shift();t&&(null==rF||rF[t.func](t.args))}},1e3)},rF=function(){function t(t,e){var r=this;this.passportTeaEvent=null,this.slardarInstance=null,this.setWebId=function(t){var e,n;t&&(null===(e=r.passportSlardar)||void 0===e||e.call(r,"config",{userId:t}),null===(n=r.passportTea)||void 0===n||n.config({user_unique_id:t,device_id:t}))};var n=e||{},i=n.slardarInstance,o=n.teaInstance;this.initSlardar(t,i),this.initTea(rU(rU({},t),{reportAppLog:null==o?void 0:o.sendLog}))}return t.sendTeaLog=function(t,e){var r,n;try{null===(n=null===(r=this._instance)||void 0===r?void 0:r.passportTeaEvent)||void 0===n||n.call(r,t,rU(rU({},rV),e||{}))}catch(t){}},t.sendSlardarEvent=function(t){var e,r,n,i,o,a;if(null===(r=null===(e=this._instance)||void 0===e?void 0:e.slardarInstance)||void 0===r?void 0:r.dot){null===(i=null===(n=this._instance)||void 0===n?void 0:n.slardarInstance)||void 0===i||i.dot(t);return}try{null===(a=null===(o=this._instance)||void 0===o?void 0:o.passportSlardar)||void 0===a||a.call(o,"sendEvent",t)}catch(t){}},t.sendSlardarLog=function(t){var e,r,n,i,o,a;if(null===(r=null===(e=this._instance)||void 0===e?void 0:e.slardarInstance)||void 0===r?void 0:r.log){null===(i=null===(n=this._instance)||void 0===n?void 0:n.slardarInstance)||void 0===i||i.log(t);return}try{null===(a=null===(o=this._instance)||void 0===o?void 0:o.passportSlardar)||void 0===a||a.call(o,"sendLog",t)}catch(t){}},t.init=function(e,r){return rM(this,void 0,void 0,function(){return rj(this,function(n){switch(n.label){case 0:if(this._instance)return[3,3];if(null==r?void 0:r.slardarInstance)return[3,2];return[4,rR()];case 1:n.sent(),n.label=2;case 2:this.isInitSuccess=!0,this._instance=new t(e,r),rq(),n.label=3;case 3:return[2,this._instance]}})})},t.prototype.initTea=function(t){return rM(this,void 0,void 0,function(){var e,r,n,i;return rj(this,function(o){switch(o.label){case 0:if(e=t.webId,!(null==t?void 0:t.reportAppLog))return[3,1];return this.passportTeaEvent=t.reportAppLog,[3,3];case 1:return r=t.appId,[4,rR()];case 2:(i=(n=o.sent().teaCollector)&&new n("dTraitTea"))&&i.init({app_id:r,channel:"cn",log:!1,disable_auto_pv:!0,disable_webid:!0}),i&&i.start(),e&&i.config({user_unique_id:e,device_id:e}),this.passportTea=i,this.passportTeaEvent=function(t,e){i.event(t,e)},o.label=3;case 3:return[2]}})})},t.prototype.initSlardar=function(t,e){var r,n,i,o;return rM(this,void 0,void 0,function(){var a,s;return rj(this,function(c){switch(c.label){case 0:if(e)return this.slardarInstance=e,[2];return a=t.webId,[4,rR()];case 1:return s=c.sent().slardarBrowserClient,this.passportSlardar=s(),null===(r=this.passportSlardar)||void 0===r||r.call(this,"init",{bid:"uc_dtrait_sdk",pid:null===(n=null==window?void 0:window.location)||void 0===n?void 0:n.host,env:"online",plugins:{tti:!1,fmp:!1,performance:!1,resource:!1,resourceError:!1,pageview:!1,jsError:{onerror:!1,onunhandledrejection:!1,dedupe:!1,captureGlobalAsync:!1},breadcrumb:{dom:!1},ajax:{autoWrap:!1},fetch:{autoWrap:!1},blankScreen:{autoDetect:!1,screenshot:!1}}}),a&&(null===(i=this.passportSlardar)||void 0===i||i.call(this,"config",{userId:a})),null===(o=this.passportSlardar)||void 0===o||o.call(this,"start"),[2]}})})},t.prototype.setConfig=function(t){var e,r;for(var n in rV=rU(rU({},rV||{}),t||{}),t)null===(e=this.slardarInstance)||void 0===e||e.setContext(rV),null===(r=this.passportSlardar)||void 0===r||r.call(this,"context.set",n,t[n])},t.isInitSuccess=!1,t}(),rH=function(t,e){if(!(null==rF?void 0:rF._instance)){rN.push({func:"sendTeaLog",args:e});return}return rF.sendTeaLog(t,e)},rJ=function(t){if(!(null==rF?void 0:rF._instance)){rN.push({func:"sendSlardarEvent",args:t});return}return null==rF?void 0:rF.sendSlardarEvent(t)},rG=function(t){if(!(null==rF?void 0:rF._instance)){rN.push({func:"sendSlardarLog",args:t});return}return null==rF?void 0:rF.sendSlardarLog(t)},rz=function(t){var e;if(!(null==rF?void 0:rF._instance)){rW.push({func:"setConfig",args:t});return}return null===(e=null==rF?void 0:rF._instance)||void 0===e?void 0:e.setConfig(t)},rZ=function(t){var e;null===(e=null==rF?void 0:rF._instance)||void 0===e||e.setWebId(t)},rX="dtrait-sdk/s_sdk_server_cert_key",rQ={urlVersion:"1.0.31",centralRsaPub:"LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJDZ0tDQVFFQTQrZHZ2WTd1TStvcGMrbkxHL0R1bVNlRm83YVZjSW0xTE8rbVVJcldwclJ6UDBhMUdwRVEKNHF0TzlNUmYvbHdFSXgzOCs0Qlo0WE9HemV2VnR1VXZmSU9VRTdBVHRRVzdGS0pmNVBuU0xDSTYvazB2bDFGQwpMVVNWbUVQNnFQSnJJalo0elhvcWkzeXVOWisxb2RiUkEvL0dIZ2NnU3l5eWFMcXp3amtwV0dYb3VNWW12WXNTCnBway9mdjJFV0FCc3RQTnhXYTRFT0JDYWRUVVBrWE5RNzZOQkVQOXh6ZkpTMjB3aUR2MW9TL3ZLdnJTVXBXY0oKbmF6a2tCdnFRYmJBcVZiUUZURi9EUGlrcHB1NlpUNmxHSVh2SktDcmVlRmlIQTJxSzZ0UzE4U1dWSFc5QVJ6MQorcGpCMWVxSUlZdG9oV3BUMkI0ME9DNE84dFZlQkFuYmlRSURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0=",centralVersion:"d0",edgeRsaPub:"LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJDZ0tDQVFFQXlFQkQ0MXQzcWpqL1NOaU5rT3BBbnNGdGZKZ0F5MGF5VTZCbEJ3RS9EZVZjNkdWV0xWUk4KWjdiMWRuRHVmQk5iUm1XQjlZeWVyYm1FOFFDM2lPOXp1NVFWd2x4SGV2ZEN0ZFFyeDZpQzF3QVRoaHFjdTNIYgprZ1dsazZ1Ylk5MXRvRFhNd0k2WGdmRUoyVEJsdHVSbklXRjR5RDVEaEc2c3lSSVNmNTRMWGY0WjgzbzlGcXNvCmlsNkV3cVZCbEU3dXlIY3dJOTA5WDg4Rlc3MXFLdmJMU040OGJlQ0EwbzFmZitqbmhRakNBTDZqbUR2dUhJeWEKUk1vYm1wRFVOLzQ3L3NHbDNzNDlFOEZFSEFXUmk5d1cyc2NZUDBJTkJXUlR5RlRHcG9GUGlqekJFUndnYzdrWQozVno3ZytSMXd2RkxUSEVITEtYUWFwTHpEMWR5Uk81YUt3SURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K",edgeVersion:"d0",dTraitVersion:"0"},rY="1.0.25",r$=function(){return(r$=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.indexOf(n)&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(t);ie.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},r2=function(t){if(!window.XMLHttpRequest||!window.FormData)return Promise.reject(Error("not support XMLHttpRequest"));var e=new XMLHttpRequest;return new Promise(function(r,n){e.open("POST","".concat("/passport/ticket_guard/get_client_cert/","?aid=").concat(t,"&type=trait&sdk_version=").concat(rY,"&is_from_ttaccountsdk=1")),e.onreadystatechange=function(){var t;if(4===e.readyState&&e.status>=200&&e.status<300)try{var i=JSON.parse(e.response);"success"!==i.message&&n(Error((null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.description)||i.message||"get cert error")),r(i)}catch(t){n(t)}},e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.setRequestHeader("Accept","application/json"),e.setRequestHeader("x-tt-passport-csrf-token",tF("passport_csrf_token")||tF("passport_csrf_token_default")||"");var i={server_data:"1",need_session_dtrait:"1"},o=Object.keys(i).map(function(t){return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(i[t]))}).join("&");e.send(o)})},r3=function(){try{var t=localStorage.getItem(rX),e=Date.now();if(t&&"string"==typeof t){var r=JSON.parse(atob(t)),n=r.createdTime,i=r1(r,["createdTime"]);if(n+864e5>e)return i}}catch(t){return null}},r4=function(t){try{localStorage.setItem(rX,btoa(JSON.stringify(r$(r$({},t||{}),{createdTime:Date.now()}))))}catch(t){return null}},r5=function(){try{localStorage.removeItem(rX)}catch(t){return null}};var r6=(h=function(t,e){void 0===e&&(e=!0);try{if(e){var r=r3();if(r&&!t$(r))return Promise.resolve(r$(r$({},r),{dataFrom:"local"}));r5()}return tX(r2,3e3,"get cert timeout")(t).then(function(t){var e,r,n,i;return e=void 0,r=void 0,n=void 0,i=function(){var e,r;return r0(this,function(n){if(e=(t||{}).data,t$(e))throw Error("get empty cert");return r={centralRsaPub:null==e?void 0:e["x-tt-session-dtrait-pk1"],centralVersion:null==e?void 0:e["x-tt-session-dtrait-pk1-version"],edgeRsaPub:null==e?void 0:e["x-tt-session-dtrait-pk2"],edgeVersion:null==e?void 0:e["x-tt-session-dtrait-pk2-version"],urlVersion:null==e?void 0:e["x-tt-session-dtrait-fe-url-version"],dTraitVersion:null==e?void 0:e["x-tt-session-dtrait-version"]},r4(r),[2,r$(r$(r$({},rQ),r),{dataFrom:"remote"})]})},new(n||(n=Promise))(function(t,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n(function(t){t(r)})).then(a,s)}c((i=i.apply(e,r||[])).next())})}).catch(function(t){return Promise.reject(t)})}catch(t){return Promise.reject(t)}},function(){for(var t=[],e=0;e0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},r7=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r9=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?r():e(t)})};r()}))];case 2:return i.sent(),[2,Promise.resolve(!0)];case 3:return n=i.sent(),rG({content:"[loadResource error]: ".concat(n)}),[2,Promise.reject(n)];case 4:return[2]}})})}),n_=18e6,nS={},nk=!1,nT=function(t){!nk&&(n_=t),nk=!0},nC=function(t,e){try{var r=nS[t];if(!r)return null;var n=r.timeout,i=r.signStr,o=r.ticket,a=r.algoType;if(o!==e||new Date().getTime()>=n)return null;if(i)return{signStr:i,algoType:a}}catch(t){}return null},nx=function(t,e,r,n){try{var i=new Date().getTime(),o=i+n_;nS[t]={timeout:o,signStr:r,ticket:e,createTime:i,algoType:n}}catch(t){}},nE=function(){nS={}},nD=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nK=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},nP=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];function nI(t){var e,r,n,i={};return t?(t.split("\n").forEach(function(t){if(n=t.indexOf(":"),e=t.substr(0,n).trim().toLowerCase(),r=t.substr(n+1).trim(),e){if(!(i[e]&&nP.indexOf(e)>=0))"set-cookie"===e?i[e]=(i[e]?i[e]:[]).concat([r]):i[e]=i[e]?i[e]+", "+r:r}}),i):i}var nO=function(t){try{if(!t)return"";if(t.startsWith("http"))return new URL(t).pathname}catch(t){}return t};(p=S||(S={})).V0="v0",p.V1="v1",p.V2="v2";var nB=function(t){return t.slice(0,4)};(v=k||(k={})).ECDSA="ecdsa",v.HMAC="hmac";var nL=function(t){if(t)switch(t.slice(0,4)){case"ts.1":return S.V1;case"ts.2":break;default:return S.V0}return S.V2},nA=function(t){var e=t.b64Cert,r=t.b64Csr;return e?{"bd-ticket-guard-client-cert":e||""}:{"bd-ticket-guard-client-csr":r||""}},nR=function(t){var e=t.b64PubKey,r=t.version;return{"bd-ticket-guard-ree-public-key":e,"bd-ticket-guard-web-version":void 0===r?2:r,"bd-ticket-guard-web-sign-type":t.algoType===k.HMAC?1:0}},nU=function(t){var e=t.initType,r=t.b64PubKey,n=t.b64Cert,i=t.b64Csr;return"cert"===(void 0===e?"pubKey":e)?nA({b64Cert:n,b64Csr:i}):nR({b64PubKey:r,version:2})},nM=function(t){var e=t.signType,r=t.b64PubKey,n=t.b64Cert,i=t.b64Csr,o=t.tsSign,a=(t.cert,t.algoType),s=nL(void 0===o?"":o);if("cert"===(void 0===e?"pubKey":e))return nA({b64Cert:n,b64Csr:i});switch(s){case S.V1:return nR({b64PubKey:r,version:1,algoType:a});case S.V2:return nR({b64PubKey:r,version:2,algoType:a});default:return nA({b64Cert:n,b64Csr:i})}},nj=function(t){return(!t||"string"==typeof t&&-1!==t.indexOf("pub."))&&!0},nV=["/passport/web/sms_login","/passport/web/sms_login_only","/passport/web/email/login","/passport/web/email/code_login","/passport/web/email/quick_login","/passport/web/web_login","/passport/web/check_qrconnect","/passport/web/user/login","/passport/web/one_login","/passport/token/beat/web","/passport/user_info/get_sec_ts"],nN=function(){return(nN=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&!v){for(var I=0;I0&&!p){for(var I=0;I0&&!p){for(var I=0;I0&&!p){for(var I=0;I0&&!v){for(var I=0;I0&&!v){for(var I=0;I<_.length;I++)if(s&&0===s.indexOf(_[I])){u=!0,l=!1,v=t;break}}if(k.length>0&&!v){for(var I=0;I0&&n.forEach(function(t){if(t instanceof Array&&t.length>1){var e=t[0],r=t[1],n=new RegExp(e);o.match(n)&&(s=r)}}),{req_content:"ticket,path,timestamp",sign_data:"ticket=".concat(e,"&path=").concat(s,"×tamp=").concat(a),timestamp:a}}catch(t){return null==i||i.reportError({error:t,name:"request process sign data fail"}),{req_content:"",sign_data:""}}},nG=function(t){return"number"==typeof t?t.toString():"-99"},nz=function(t,e,r,n,i,o){return nW(void 0,void 0,void 0,function(){var a,s,c,u,l,f,h,d,p,v,y,g,m,b,w,_,S,k,T,C,x,E,D,K,P,I,O,B,L,A,R,U,M,j,V,N,W,q,F,H,J,G,z,Z,X,Q,Y,$,tt,te,tr,tn,ti,to,ta,ts,tc,tu,tl,tf,th,td,tp;return nq(this,function(j){switch(j.label){case 0:return j.trys.push([0,9,,10]),[4,null==(a=e.crypt)?void 0:a.getUsage()];case 1:if(s=j.sent(),u=void 0===(c=((null==t?void 0:t.config)||{}).extras)?{}:c,f=void 0===(l=t.headers)?{}:l,d=(h=u||{}).dataFrom,p=h.match_md5_local,v=h.match_md5_iframe,y=h.is_pubkey_ts_sign,g=h.is_new_cert,m=h.lost,b=h.isPubKeyInit,w=h.raw_pubkey,_=h.raw_pubkey_base64,S=h.raw_ticket,k=h.raw_ts_sign,T=h.gen_ticket_logid,C=h.gen_ticket_time,x=h.gen_ticket_client_cert,E=h.is_equal_pub,D=h.raw_cert,P=(K=(null==a?void 0:a.getStorageStatus())||{}).isConnection,I=K.retryCount,O=K.startTime,B=K.endTime,L=K.loadTime,(null==t?void 0:t.reqHeaders)&&(null===(td=null==t?void 0:t.reqHeaders)||void 0===td?void 0:td["bd-ticket-guard-version"])&&o.reportEvent({action:"response",op:"sign",status:"finish",ctx:{url:nO(null==t?void 0:t.config.url)||"",crossStatus:(null==a?void 0:a.getIframeStatus())?"1":"0",lost:m,dataFrom:d||"-99",match_md5_local:p,match_md5_iframe:v,initMatch:(null==a?void 0:a.initMatch)?"1":"0",isConnection:nG(P),retryCount:nG(I),is_pubkey_ts_sign:y,is_new_cert:g,isPubKeyInit:b,usage:s||"unknown"},metrics:{startTime:O||0,endTime:B||0,loadTime:L||0},extras:t}),A=new Date().getTime(),R=r.needProxy,U=r.providerConfig,M=r.signType,V=r.hostname,N=r.pathname,q=void 0===(W=r.needReport)||W,H=void 0!==(F=r.needUpdateTs)&&F,G=(J=U||{}).scene,z=J.namespace,!((R||H)&&a))return[3,8];if(Z=f["bd-ticket-guard-server-data"]||"",X=f["bd-ticket-guard-result"]||"-99",Q=f["bd-ticket-guard-sec-result"]||"-99",Y=f["x-tt-logid"]||"",te=null==(tt=($=Z&&a.b642str(Z))&&JSON.parse($))?void 0:tt.ticket,tr=null==tt?void 0:tt.log_id,tn=((null==tt?void 0:tt.ts_sign)||"").slice(.64),ti=null==tt?void 0:tt.create_time,to=((null==tt?void 0:tt.client_cert)||"").replace("pub.","").slice(.64),ta={url:nO(null===(tp=null==t?void 0:t.config)||void 0===tp?void 0:tp.url)||"",logId:Y},!(te&&G&&z))return[3,3];return[4,a.setSignValueAsync({sign:tt,scene:G,namespace:z,logCtx:ta})];case 2:return j.sent(),[3,4];case 3:te&&G&&a.setSignValue({sign:tt,scene:G,logCtx:ta}),j.label=4;case 4:try{Z&&!G&&o.reportLog({content:"ts_sign_data lost scene",extra:nN({},ta),level:"info"})}catch(t){}if(te&&o.reportEvent({action:"response",op:"new",status:"success",duration:0,ctx:{url:N||"",path:N||"",new_gen_ticket:te,new_gen_ts_sign:tn,new_gen_logid:tr,new_gen_create_time:ti,new_gen_publib_key:to,type:"header"},metrics:{count:1}}),ts=nZ(X,u,t,e,n,i,o),tc=new Date().getTime(),X&&Number(X)>0&&(nE(),o.reportLog({content:"response verify error",extra:nN({},ta),level:"info"})),tu=a.secureTimestampManager,!(H&&tu))return[3,7];if(tl=t.headers["bd-ticket-guard-sec-ts"],tf=t.headers["bd-ticket-guard-ts"],!(tl&&tf))return[3,6];return[4,tu.update(tl,tf)];case 5:return j.sent(),[3,7];case 6:o.reportLog({content:"lost sec ts",extra:nN({},ta),level:"info"}),j.label=7;case 7:q&&o.reportEvent({action:"response",op:"init",status:"success",duration:tc>A?tc-A:0,ctx:nN({url:N||"",path:N||"",lost:m,verify:X,verifyTs:Q,dataFrom:d||"-99",initMatch:(null==a?void 0:a.initMatch)?"1":"0",isNewCert:g,isPubkeyTssign:y,isHasNewTssign:Z?"1":"0",updateTs:H?"1":"0",usage:s||"unknown",hostname:V||"",sec:tu?"1":"0",raw_pubkey:w,raw_pubkey_base64:_,raw_ticket:S,raw_ts_sign:k,gen_ticket_logid:T,gen_ticket_time:C,gen_ticket_client_cert:x,is_equal_pub:E,logId:Y,raw_cert:D},ts||{}),metrics:{startTime:O||0,endTime:B||0,loadTime:L||0},extras:t}),j.label=8;case 8:case 10:return[2,t];case 9:return th=j.sent(),o.reportEvent({action:"response",op:"init",status:"fail",ctx:{url:nO(null==t?void 0:t.config.url)||""}}),o.reportError({error:th,name:"get sign data error in response"}),[3,10]}})})},nZ=function(t,e,r,n,i,o,a){var s;try{var c=n.crypt,u=e||{},l=u.certType,f=u.items,h=void 0===f?[]:f,d=[],p=[],v=(null===(s=null==r?void 0:r.reqHeaders)||void 0===s?void 0:s["bd-ticket-guard-client-data"])?"1":"0",y=((null==r?void 0:r.config)||{}).url;if("header"===l)return{};if("cookie"===l&&(h&&Array.isArray(h)&&h.forEach(function(t){var e=t||{},r=e.key,n=e.value;e.from,e.origin,n&&(d.push(r),p.push(n))}),"-99"===t&&i&&y)){for(var g=["/aweme/v1/web/commit/item/digg","/aweme/v1/web/commit/follow/user","/aweme/v1/web/comment/publish","/web/api/media/aweme/create"],m=0;m0&&c.setKeysAndValues(d,p);break}}}return nN(nN({},{server:v}),{})}catch(t){a.reportError({error:t,name:"process Request Header Error"})}return{}},nX=function(t){var e,r,n={};return n["bd-ticket-guard-server-data"]=(null===(e=null==t?void 0:t.headers)||void 0===e?void 0:e.get("bd-ticket-guard-server-data"))||"",n["bd-ticket-guard-result"]=(null===(r=null==t?void 0:t.headers)||void 0===r?void 0:r.get("bd-ticket-guard-result"))||"",n};var nQ=(y=function(t,e){return(y=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),nY=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})},n$=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=3&&!1===n[2])return t.nativeXMLHttpRequestSend.apply(this,i);null==nH||nH({method:o,url:a,headers:{}},t.params,s,{reportEvent:t.reportEvent,reportError:t.reportError,reportLog:t.reportLog}).then(function(e){var n=e||{},o=n.headers,a=void 0===o?{}:o,s=n.extras;return h=void 0===s?{}:s,Object.keys(a).forEach(function(e){f[e]=a[e],t.nativeXMLHttpRequestSetRequestHeader.call(r,e,a[e])}),t.nativeXMLHttpRequestSend.apply(r,i)})}},e.prototype.monkeyPatchFetch=function(){if(!!n0){var t=this;window.fetch=function(e,r){var n,i,o,a,s=this;n1&&e instanceof Request?(o=e.url,a=e.method):(o=e,a=r&&r.method?r.method:"GET");var c=nF({method:a,url:o,headers:{}},t.config,t.signType||"pubKey",t.initType||"pubKey",null===(n=t.params.crypt)||void 0===n?void 0:n.enableSecureTimestamp),u=c||{},l=u.needProxy,f=u.needUpdateTs;return!l&&!f||(null===(i=null==r?void 0:r.headers)||void 0===i?void 0:i["bd-ticket-guard-version"])?t.nativeFetch.apply(this,[e,r]):nH({method:a,url:o,headers:{}},t.params,c,{reportEvent:t.reportEvent,reportError:t.reportError,reportLog:t.reportLog}).then(function(n){var i=n||{},u=i.headers,l=i.extras,f=void 0===l?{}:l;try{n1&&e instanceof Request?Object.keys(u).forEach(function(t){e.headers.set(t,u[t])}):((r=r||{}).headers=r.headers||{},n2&&(null==r?void 0:r.headers)instanceof Headers?Object.keys(u).forEach(function(t){var e,n;null===(n=null===(e=null==r?void 0:r.headers)||void 0===e?void 0:e.set)||void 0===n||n.call(e,t,u[t])}):r&&r.headers&&Array.isArray(r.headers)?Object.keys(u).forEach(function(t){var e;r&&r.headers&&Array.isArray(r.headers)&&(null===(e=null==r?void 0:r.headers)||void 0===e||e.push([t,u[t]]))}):Object.keys(u).forEach(function(t){r.headers[t]=u[t]}))}catch(t){}return t.nativeFetch.apply(s,[e,r]).then(function(e){var r,n,i,s,l={};if(null==e?void 0:e.headers){if("function"==typeof(null===(r=null==e?void 0:e.headers)||void 0===r?void 0:r.forEach))null===(i=null===(n=null==e?void 0:e.headers)||void 0===n?void 0:n.forEach)||void 0===i||i.call(n,function(t,e){l[e]=t});else if("function"==typeof(null===(s=null==e?void 0:e.headers)||void 0===s?void 0:s.get)){var h=nX(e);Object.keys(h).forEach(function(t){l[t]=h[t]})}return nz({config:{method:a,url:o,headers:{},extras:f},headers:l,reqHeaders:u},t.params,c,t.updateData,t.login,{reportEvent:t.reportEvent,reportError:t.reportError,reportLog:t.reportLog}).then(function(){return e}).catch(function(t){return e})}return e})})}}},e}(t_),n4="3.3.10",n5=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})},n6=function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)return Object.keys(r).forEach(function(t){r[t]=JSON.parse(r[t])}),n9(n8,r),t(r);return null}catch(t){return null}},e.send()})},n9=function(t,e){try{var r={value:e,expire:new Date().getTime()+216e5};window.localStorage.setItem(t,JSON.stringify(r))}catch(t){}},it=function(t){try{var e=window.localStorage.getItem(t);if(!e)return null;var r=JSON.parse(e),n=r.value,i=r.expire;if(new Date().getTime()>i)return null;return n}catch(t){return null}},ie=function(){function t(){}return t.init=function(e){var r=e.tccPsm,n=e.zone,i=void 0===n?"default":n,o=this;return function(){return n5(this,void 0,void 0,function(){return n6(this,function(e){switch(e.label){case 0:return o._instance=new t,[4,n7({tccPsm:r,zone:i})];case 1:return[2,e.sent()]}})})}()},t.getConfig=function(t){var e=t.tccPsm,r=t.zone,n=void 0===r?"default":r,i=t.key;return n5(this,void 0,void 0,function(){var t,r,o,a;return n6(this,function(s){switch(s.label){case 0:if(t="".concat(e.split(".").join("-"),"-").concat(n),!(o=it(n8)))return[3,1];return r=o,[3,6];case 1:if(!(this._instance&&this._config[t]))return[3,2];return r=this._config[t],[3,6];case 2:if(!(this._instance&&!this._config[t]))return[3,4];return[4,n7({tccPsm:e,zone:n})];case 3:return a=s.sent(),this._config[t]=a,r=a,[3,6];case 4:return[4,this.init({tccPsm:e,zone:n})];case 5:a=s.sent(),this._config[t]=a,r=a,s.label=6;case 6:if(i)return[2,(null==r?void 0:r[i])||r];return[2,r]}})})},t._config={},t}();function ir(t){return Object.keys(t).map(function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(String(t[e])))}).join("&")}var ii=function(t){var e;return function(t,e){void 0===e&&(e={});var r=e.method,n=void 0===r?"GET":r,i=e.headers,o=void 0===i?{}:i,a=e.timeout,s=void 0===a?1e4:a,c=e.data,u=e.cacheKey,l=e.cacheExpire,f=void 0===l?3e5:l;if(u){var h=function(t){try{var e=localStorage.getItem(t);if(!e)return null;var r=JSON.parse(e);if(Date.now()>r.timestamp+r.expire)return localStorage.removeItem(t),null;return r.data}catch(t){return null}}(u);if(h)return Promise.resolve(h)}return window.XMLHttpRequest?new Promise(function(e,r){var i=new XMLHttpRequest,a=t,l=null;if("GET"===n.toUpperCase()&&c&&"object"==typeof c){var h=ir(c);a+=(t.includes("?")?"&":"?")+h}else c&&(l="string"==typeof c?c:ir(c));i.open(n,a),i.timeout=s,"GET"!==n.toUpperCase()&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("Accept","application/json"),Object.keys(o).forEach(function(t){i.setRequestHeader(t,o[t])}),i.onloadend=function(){var t,n,o=(t=i.getAllResponseHeaders(),n={},t?(t.trim().split("\r\n").forEach(function(t){var e=t.split(": ");2===e.length&&(n[e[0].toLowerCase()]=e[1])}),n):n);if(i.status>=200&&i.status<300){var a=void 0;try{a=JSON.parse(i.responseText)}catch(t){a=i.responseText}var s={data:a,status:i.status,statusText:i.statusText,headers:o};u&&!function(t,e,r){try{var n={data:e,timestamp:Date.now(),expire:r};localStorage.setItem(t,JSON.stringify(n))}catch(t){}}(u,s,f),e(s)}else r(Error("Request failed with status ".concat(i.status,": ").concat(i.statusText)))},i.onerror=function(){r(Error("Network error occurred"))},i.ontimeout=function(){r(Error("Request timeout after ".concat(s,"ms")))},i.send(l)}):Promise.reject(Error("XMLHttpRequest is not supported"))}("/passport/user_info/get_sec_ts/?aid=".concat(t,"&is_from_ttaccountsdk=1"),{method:"POST",data:((e={aid:t}).is_from_ttaccountsdk=1,e)})};var io=(g=function(t,e){return(g=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),ia=function(){return(ia=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},il=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},h=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]>>6:(i<55296||i>=57344?o[s++]=224|i>>>12:(i=65536+((1023&i)<<10|1023&t.charCodeAt(++r)),o[s++]=240|i>>>18,o[s++]=128|i>>>12&63),o[s++]=128|i>>>6&63),o[s++]=128|63&i);t=o}t.length>64&&(t=new C(!0).update(t).array());var c=[],u=[];for(r=0;r<64;++r){var l=t[r]||0;c[r]=92^l,u[r]=54^l}C.call(this,e),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=e}C.prototype.update=function(t){if(this.finalized)throw Error("finalize already called");var e=_(t);t=e[0];for(var r=e[1],n,i,o=0,a=t.length,s=this.blocks,c=this.buffer8;o>>6:(n<55296||n>=57344?c[i++]=224|n>>>12:(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),c[i++]=240|n>>>18,c[i++]=128|n>>>12&63),c[i++]=128|n>>>6&63),c[i++]=128|63&n);else for(i=this.start;o>>2]|=n<>>2]|=(192|n>>>6)<=57344?s[i>>>2]|=(224|n>>>12)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|63&n)<>>2]|=t[o]<=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},C.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>>2]|=h[3&e],e>=56&&(!this.hashed&&this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},C.prototype.hash=function(){var t,e,r,n,i,o,a=this.blocks;this.first?(r=((r=(-271733879^(n=((n=(-1732584194^2004318071&(t=((t=a[0]-680876937)<<7|t>>>25)-271733879<<0))+a[1]-117830708)<<12|n>>>20)+t<<0)&(-271733879^t))+a[2]-1126478375)<<17|r>>>15)+n<<0,e=((e=(t^r&(n^t))+a[3]-1316259209)<<22|e>>>10)+r<<0):(t=this.h0,e=this.h1,r=this.h2,t+=((n=this.h3)^e&(r^n))+a[0]-680876936,n+=(r^(t=(t<<7|t>>>25)+e<<0)&(e^r))+a[1]-389564586,r+=(e^(n=(n<<12|n>>>20)+t<<0)&(t^e))+a[2]+606105819,e+=(t^(r=(r<<17|r>>>15)+n<<0)&(n^t))+a[3]-1044525330,e=(e<<22|e>>>10)+r<<0),t+=(n^e&(r^n))+a[4]-176418897,n+=(r^(t=(t<<7|t>>>25)+e<<0)&(e^r))+a[5]+1200080426,r+=(e^(n=(n<<12|n>>>20)+t<<0)&(t^e))+a[6]-1473231341,e+=(t^(r=(r<<17|r>>>15)+n<<0)&(n^t))+a[7]-45705983,t+=(n^(e=(e<<22|e>>>10)+r<<0)&(r^n))+a[8]+1770035416,n+=(r^(t=(t<<7|t>>>25)+e<<0)&(e^r))+a[9]-1958414417,r+=(e^(n=(n<<12|n>>>20)+t<<0)&(t^e))+a[10]-42063,e+=(t^(r=(r<<17|r>>>15)+n<<0)&(n^t))+a[11]-1990404162,t+=(n^(e=(e<<22|e>>>10)+r<<0)&(r^n))+a[12]+1804603682,n+=(r^(t=(t<<7|t>>>25)+e<<0)&(e^r))+a[13]-40341101,r+=(e^(n=(n<<12|n>>>20)+t<<0)&(t^e))+a[14]-1502002290,e+=(t^(r=(r<<17|r>>>15)+n<<0)&(n^t))+a[15]+1236535329,e=(e<<22|e>>>10)+r<<0,t+=(r^n&(e^r))+a[1]-165796510,t=(t<<5|t>>>27)+e<<0,n+=(e^r&(t^e))+a[6]-1069501632,n=(n<<9|n>>>23)+t<<0,r+=(t^e&(n^t))+a[11]+643717713,r=(r<<14|r>>>18)+n<<0,e+=(n^t&(r^n))+a[0]-373897302,e=(e<<20|e>>>12)+r<<0,t+=(r^n&(e^r))+a[5]-701558691,t=(t<<5|t>>>27)+e<<0,n+=(e^r&(t^e))+a[10]+38016083,n=(n<<9|n>>>23)+t<<0,r+=(t^e&(n^t))+a[15]-660478335,r=(r<<14|r>>>18)+n<<0,e+=(n^t&(r^n))+a[4]-405537848,e=(e<<20|e>>>12)+r<<0,t+=(r^n&(e^r))+a[9]+568446438,t=(t<<5|t>>>27)+e<<0,n+=(e^r&(t^e))+a[14]-1019803690,n=(n<<9|n>>>23)+t<<0,r+=(t^e&(n^t))+a[3]-187363961,r=(r<<14|r>>>18)+n<<0,e+=(n^t&(r^n))+a[8]+1163531501,e=(e<<20|e>>>12)+r<<0,t+=(r^n&(e^r))+a[13]-1444681467,t=(t<<5|t>>>27)+e<<0,n+=(e^r&(t^e))+a[2]-51403784,n=(n<<9|n>>>23)+t<<0,r+=(t^e&(n^t))+a[7]+1735328473,r=(r<<14|r>>>18)+n<<0,e+=(n^t&(r^n))+a[12]-1926607734,t+=((i=(e=(e<<20|e>>>12)+r<<0)^r)^n)+a[5]-378558,n+=(i^(t=(t<<4|t>>>28)+e<<0))+a[8]-2022574463,r+=((o=(n=(n<<11|n>>>21)+t<<0)^t)^e)+a[11]+1839030562,e+=(o^(r=(r<<16|r>>>16)+n<<0))+a[14]-35309556,t+=((i=(e=(e<<23|e>>>9)+r<<0)^r)^n)+a[1]-1530992060,n+=(i^(t=(t<<4|t>>>28)+e<<0))+a[4]+1272893353,r+=((o=(n=(n<<11|n>>>21)+t<<0)^t)^e)+a[7]-155497632,e+=(o^(r=(r<<16|r>>>16)+n<<0))+a[10]-1094730640,t+=((i=(e=(e<<23|e>>>9)+r<<0)^r)^n)+a[13]+681279174,n+=(i^(t=(t<<4|t>>>28)+e<<0))+a[0]-358537222,r+=((o=(n=(n<<11|n>>>21)+t<<0)^t)^e)+a[3]-722521979,e+=(o^(r=(r<<16|r>>>16)+n<<0))+a[6]+76029189,t+=((i=(e=(e<<23|e>>>9)+r<<0)^r)^n)+a[9]-640364487,n+=(i^(t=(t<<4|t>>>28)+e<<0))+a[12]-421815835,r+=((o=(n=(n<<11|n>>>21)+t<<0)^t)^e)+a[15]+530742520,e+=(o^(r=(r<<16|r>>>16)+n<<0))+a[2]-995338651,e=(e<<23|e>>>9)+r<<0,t+=(r^(e|~n))+a[0]-198630844,t=(t<<6|t>>>26)+e<<0,n+=(e^(t|~r))+a[7]+1126891415,n=(n<<10|n>>>22)+t<<0,r+=(t^(n|~e))+a[14]-1416354905,r=(r<<15|r>>>17)+n<<0,e+=(n^(r|~t))+a[5]-57434055,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~n))+a[12]+1700485571,t=(t<<6|t>>>26)+e<<0,n+=(e^(t|~r))+a[3]-1894986606,n=(n<<10|n>>>22)+t<<0,r+=(t^(n|~e))+a[10]-1051523,r=(r<<15|r>>>17)+n<<0,e+=(n^(r|~t))+a[1]-2054922799,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~n))+a[8]+1873313359,t=(t<<6|t>>>26)+e<<0,n+=(e^(t|~r))+a[15]-30611744,n=(n<<10|n>>>22)+t<<0,r+=(t^(n|~e))+a[6]-1560198380,r=(r<<15|r>>>17)+n<<0,e+=(n^(r|~t))+a[13]+1309151649,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~n))+a[4]-145523070,t=(t<<6|t>>>26)+e<<0,n+=(e^(t|~r))+a[11]-1120210379,n=(n<<10|n>>>22)+t<<0,r+=(t^(n|~e))+a[2]+718787259,r=(r<<15|r>>>17)+n<<0,e+=(n^(r|~t))+a[9]-343485551,e=(e<<21|e>>>11)+r<<0,this.first?(this.h0=t+1732584193<<0,this.h1=e-271733879<<0,this.h2=r-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0)},C.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3;return f[t>>>4&15]+f[15&t]+f[t>>>12&15]+f[t>>>8&15]+f[t>>>20&15]+f[t>>>16&15]+f[t>>>28&15]+f[t>>>24&15]+f[e>>>4&15]+f[15&e]+f[e>>>12&15]+f[e>>>8&15]+f[e>>>20&15]+f[e>>>16&15]+f[e>>>28&15]+f[e>>>24&15]+f[r>>>4&15]+f[15&r]+f[r>>>12&15]+f[r>>>8&15]+f[r>>>20&15]+f[r>>>16&15]+f[r>>>28&15]+f[r>>>24&15]+f[n>>>4&15]+f[15&n]+f[n>>>12&15]+f[n>>>8&15]+f[n>>>20&15]+f[n>>>16&15]+f[n>>>28&15]+f[n>>>24&15]},C.prototype.toString=C.prototype.hex,C.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255,255&n,n>>>8&255,n>>>16&255,n>>>24&255]},C.prototype.array=C.prototype.digest,C.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},C.prototype.buffer=C.prototype.arrayBuffer,C.prototype.base64=function(){for(var t,e,r,n="",i=this.array(),o=0;o<15;)t=i[o++],e=i[o++],r=i[o++],n+=v[t>>>2]+v[(t<<4|e>>>4)&63]+v[(e<<2|r>>>6)&63]+v[63&r];return n+=v[(t=i[o])>>>2]+v[t<<4&63]+"=="},x.prototype=new C,x.prototype.finalize=function(){if(C.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();C.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(t),C.prototype.finalize.call(this)}};var E=function(){var t=S("hex");s&&(t=k(t)),t.create=function(){return new C},t.update=function(e){return t.create().update(e)};for(var e=0;e