douxiaoyun.js/profiles/douyin-profile/Default/Cache/Cache_Data/f_000428
2026-07-17 22:23:39 +08:00

2 lines
247 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! 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;r<t.length;r+=2)e[r/2]=parseInt(t.substr(r,2),16);return e}function a(t){return t.reduce(function(t,e){return t+e.toString(16).padStart(2,"0")},"")}var s=function(t){for(var e="",r=new Uint8Array(t),n=0;n<r.length;n++)e+=String.fromCharCode(r[n]);return btoa(e)},c=function(t){var e=t.replace(/\s+/g,"");if(e.length%2!=0)throw Error("Hex string must have an even length.");for(var r=new ArrayBuffer(e.length/2),n=new Uint8Array(r),i=0;i<e.length;i+=2)n[i/2]=parseInt(e.substring(i,i+2),16);return r},u=function(t){var e=n.md5.create();return e.update(t),e.hex()},l=function(t){var e=Array.from(new TextEncoder().encode(t),function(t){return String.fromCharCode(t)}).join("");return window.btoa(e)},f=function(t){for(var e=window.atob(t),r=new Uint8Array(e.length),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return new TextDecoder().decode(r)},h=function(t){return s(c(t))}},303418:function(t,e,r){"use strict";r.d(e,{D:function(){return l}});var n=r(116427),i=r(164943),o=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())})},a=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=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},c=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},u=i.sha256.hmac;function l(t,e,r,i){return void 0===i&&(i=32),o(this,void 0,void 0,function(){return a(this,function(l){switch(l.label){case 0:return[4,function(t,e){return o(this,void 0,void 0,function(){return a(this,function(r){switch(r.label){case 0:return(!t||0===t.length)&&(t=new Uint8Array(32)),[4,u(t,e)];case 1:return[2,r.sent()]}})})}(t,e)];case 1:return[2,function(t,e,r){return void 0===r&&(r=32),o(this,void 0,void 0,function(){var i,o,l,f;return a(this,function(a){switch(a.label){case 0:i=new Uint8Array,o="",l=0,a.label=1;case 1:if(!(i.length<r))return[3,3];return l++,f=Uint8Array.from(c(c(c([],s(Array.from(Uint8Array.from((0,n.iv)(o)))),!1),s(Array.from(e)),!1),[l],!1)),[4,u((0,n.iv)(t),f)];case 2:return o=a.sent(),i=Uint8Array.from(c(c([],s(Array.from(i)),!1),s(Array.from(Uint8Array.from((0,n.iv)(o)))),!1)),[3,1];case 3:return[2,Uint8Array.from(i.slice(0,r))]}})})}(l.sent(),r,i)]}})})}},785914:function(t,e,r){"use strict";var n=r(134401),i=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},o=function(t,e){var r=i(t,e);return r<1?"":t.substr(e+2,2*r)},a=function(t,e){var r=c(t,e),n=u(t,e);return t.substr(r,2*n)},s=function(t,e){return t.substr(e,2)+o(t,e)+a(t,e)},c=function(t,e){var r=i(t,e);return r<0?r:e+(r+1)*2},u=function(t,e){var r,i;return""==(r=o(t,e))?-1:(i="8"===r.substr(0,1)?new n(r.substr(2),16):new n(r,16)).intValue()},l=function(t,e){return 2+2*i(t,e)+2*u(t,e)},f=function(t,e){var r,n,i,o=[];r=c(t,e),n=2*u(t,e),"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var a=r;i<=n;){var s=l(t,a);if((i+=s)<=n&&o.push(a),a+=s,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.length;s++){var c=t.substr(o[s],2);if("number"==typeof i&&!h(c)&&a==i||"string"==typeof i&&h(c,i))return d(t,o[s],r,n);!h(c)&&a++}return -1},p=function(t,e,r,n){var i,o;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;return(i=r.shift(),i>=(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<<e)-1,o.prototype.DV=1<<e;o.prototype.FV=4503599627370496,o.prototype.F1=52-e,o.prototype.F2=2*e-52;var s=[];for(n=0,r=48;n<=9;++n)s[r++]=n;for(n=10,r=97;n<36;++n)s[r++]=n;for(n=10,r=65;n<36;++n)s[r++]=n;function c(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function u(t,e){var r=s[t.charCodeAt(e)];return null==r?-1:r}function l(t){var e=a();return e.fromInt(t),e}function f(t){var e,r=1;return 0!=(e=t>>>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<<t.DB-15)-1,this.mt2=2*t.t}d.prototype.convert=function(t){var e=a();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(o.ZERO)>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<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[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)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=r)>=this.DB&&(a-=this.DB)}8==r&&(128&t[0])!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>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<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},o.prototype.lShiftTo=function(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o,a=Math.floor(t/this.DB),s=this.s<<r&this.DM;for(o=this.t-1;o>=0;--o)e[o+a+1]=this[o]>>n|s,s=(this[o]&i)<<r;for(o=a-1;o>=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)-1;e[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)e[a-r-1]|=(this[a]&o)<<i,e[a-r]=this[a]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()},o.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=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<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&o.ZERO.subTo(e,e)},o.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=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.t<n.t){null!=e&&e.fromInt(0),null!=r&&this.copyTo(r);return}null==r&&(r=a());var s=a(),c=this.s,u=t.s,l=this.DB-f(n[n.t-1]);l>0?(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<<this.F1)+(h>1?s[h-2]>>this.F2:0),v=this.FV/p,y=(1<<this.F1)/p,g=1<<this.F2,m=r.t,b=m-h,w=null==e?a():e;for(s.dlShiftTo(b,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(h,w),w.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--b>=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<<s)>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<<e)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%e;if(a-- >0)for(s<this.DB&&(r=this[a]>>s)>0&&(i=!0,o=c(r));a>=0;)s<e?r=(this[a]&(1<<s)-1)<<e-s|this[--a]>>(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<t.length;++c){var l=u(t,c);if(l<0){"-"==t.charAt(c)&&0==this.signum()&&(i=!0);continue}s=e*s+l,++a>=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<<i)-1:n[0]=0,this.fromString(n,256)}},o.prototype.bitwiseTo=function(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},o.prototype.changeBit=function(t,e){var r=o.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},o.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=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<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()},o.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},o.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0){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<t;++s){i.fromInt(_[Math.floor(Math.random()*_.length)]);var c=i.modPow(n,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(e)){for(var u=1;u++<r&&0!=c.compareTo(e);)if(0==(c=c.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=c.compareTo(e))return!1}}return!0},o.prototype.clone=function(){var t=a();return this.copyTo(t),t},o.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return -1}else if(1==this.t)return this[0];else if(0==this.t)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},o.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>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<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?r=(this[t]&(1<<n)-1)<<8-n|this[--t]>>(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<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},o.prototype.shiftLeft=function(t){var e=a();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},o.prototype.shiftRight=function(t){var e=a();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},o.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+function(t){if(0==t)return -1;var e=0;return(65535&t)==0&&(t>>=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;++r)t+=function(t){for(var e=0;0!=t;)t&=t-1,++e;return e}(this[r]^e);return t},o.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:(this[e]&1<<t%this.DB)!=0},o.prototype.setBit=function(t){return this.changeBit(t,v)},o.prototype.clearBit=function(t){return this.changeBit(t,g)},o.prototype.flipBit=function(t){return this.changeBit(t,y)},o.prototype.add=function(t){var e=a();return this.addTo(t,e),e},o.prototype.subtract=function(t){var e=a();return this.subTo(t,e),e},o.prototype.multiply=function(t){var e=a();return this.multiplyTo(t,e),e},o.prototype.divide=function(t){var e=a();return this.divRemTo(t,e,null),e},o.prototype.remainder=function(t){var e=a();return this.divRemTo(t,null,e),e},o.prototype.divideAndRemainder=function(t){var e=a(),r=a();return this.divRemTo(t,e,r),[e,r]},o.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),o=l(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6;n=i<8?new h(e):e.isEven()?new w(e):new d(e);var s=[],c=3,u=r-1,p=(1<<r)-1;if(s[1]=n.convert(this),r>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<<i+1)-1)<<u-i,m>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<<i)==0;)n.sqrTo(o,_),g=o,o=_,_=g,--i<0&&(i=this.DB-1,--m)}return n.revert(o)},o.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return o.ZERO;for(var r=t.clone(),n=this.clone(),i=l(1),a=l(0),s=l(0),c=l(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!a.isEven())&&(i.addTo(this,i),a.subTo(t,a)),i.rShiftTo(1,i)):!a.isEven()&&a.subTo(t,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!c.isEven())&&(s.addTo(this,s),c.subTo(t,c)),s.rShiftTo(1,s)):!c.isEven()&&c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(n)>=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(i<o&&(o=i),o>0&&(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&&n<S;)n*=_[i++];for(n=r.modInt(n);e<i;)if(n%_[e++]==0)return!1}return r.millerRabin(t)},o.prototype.square=function(){var t=a();return this.squareTo(t),t},o.prototype.sqrt=function(){for(var t=o.ZERO.setBit(this.bitLength()/2),e=t;;){var r=t.add(this.divide(t)).shiftRight(1);if(r.equals(t)||r.equals(e))return r;e=t,t=r}},t.exports=o},688551:function(t,e,r){"use strict";r.d(e,{Aq:function(){return a},SS:function(){return s},gp:function(){return c},wU:function(){return u}});var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},i={params_for_special:"uc_login"},o=function(){function t(t,e){var r=t.appId,o=t.config,a=void 0===o?{}:o;this.zeroTrustTea=window.ZTCollector&&new window.ZTCollector("zeroTrustTea"),this.reportAppLog=null,e?(this.reportAppLog=e,i=n(n({},i),(null==a?void 0:a.evtParams)||{})):(this.zeroTrustTea&&this.zeroTrustTea.init({app_id:r,channel:"cn",log:!1,disable_auto_pv:!0,disable_webid:!0}),this.setConfig(a),this.zeroTrustTea&&this.zeroTrustTea.start())}return t.initTea=function(e,r){var n=e.appId,i=e.config;return!this._instance&&(this._instance=new t({appId:n,config:void 0===i?{}:i},r)),this._instance},t.getTea=function(){return this._instance},t.prototype.setEvtParams=function(t){this.reportAppLog?i=n(n({},i),t||{}):this.zeroTrustTea&&this.zeroTrustTea.config({evtParams:t})},t.prototype.setConfig=function(t){void 0===t&&(t={}),this.zeroTrustTea&&this.zeroTrustTea.config(n({_staging_flag:0},t))},t.prototype.sendLog=function(t,e){t&&(this.reportAppLog?this.reportAppLog({eventName:t,params:e}):this.zeroTrustTea&&this.zeroTrustTea.event(t,e))},t.prototype.sendBecon=function(t,e){t&&(this.reportAppLog?this.reportAppLog({eventName:t,params:e}):this.zeroTrustTea&&this.zeroTrustTea.beconEvent(t,e))},t}(),a=function(t,e){var r=t.appId,i=t.webId,a=void 0===i?"":i,s=t.config;o.initTea({appId:(void 0===r?1661:r)||1661,config:n({user_unique_id:a,device_id:a,user_id:a},void 0===s?{}:s)},e)},s=function(t){var e;void 0===t&&(t={}),null===(e=o.getTea())||void 0===e||e.setEvtParams(t)},c=function(t,e){var r;return null===(r=o.getTea())||void 0===r?void 0:r.sendLog(t,n(n({},i),e||{}))},u=function(t,e){var r;return null===(r=o.getTea())||void 0===r?void 0:r.sendBecon(t,n(n({},i),e||{}))}},892478:function(t,e,r){"use strict";r.d(e,{pj:function(){return s},b5:function(){return l},QH:function(){return f},aA:function(){return u},yh:function(){return a},JT:function(){return c}});var n,i,o=r("688551");(i=n||(n={})).logWebBdTicketGuardInit="web_bd_ticket_guard_init",i.logWebBdTicketGuardConsumerResponse="web_bd_ticket_guard_consumer_response",i.logWebBdTicketGuardEnv="web_bd_ticket_guard_env",i.logWebBdTicketGuardLocalMiss="web_bd_ticket_guard_local_miss",i.logWebBdTicketGuardIframeStatusBeforeUnLoad="web_bd_ticket_guard_iframe_status_before_unload",i.logWebBdTicketGuardIframeStatus="web_bd_ticket_guard_iframe_status",i.logWebBdTicketGuardConsumerResponseError="web_bd_ticket_guard_consumer_response_error",i.logWebBdTicketGuardHeaderProviderResponse="web_bd_ticket_guard_header_provider_response",i.logWebBdTicketGuardNewServerData="web_bd_ticket_guard_new_server_data",i.logWebBdTicketDTraitInit="web_bd_ticket_dtrait_init",i.logWebBdTicketDTraitResponse="web_bd_ticket_dtrait_response";var a=function(t,e){var r,i,a,s,c,u="";try{;u=(r=null===(i=null==t?void 0:t.config)||void 0===i?void 0:i.url)?r.startsWith("http")?new URL(r).pathname:r:""}catch(t){}var l=(null===(a=null==t?void 0:t.headers)||void 0===a?void 0:a["bd-ticket-guard-result"])||"-99",f=(null===(s=null==t?void 0:t.headers)||void 0===s?void 0:s["x-tt-logid"])||"",h=(null==t?void 0:t.loginStatus)||"-1",d=(null==t?void 0:t.cookieStatus)||"0",p=(null==t?void 0:t.signVersion)||"0",v=(null==e?void 0:e.dataFrom)||"-99",y=(null==t?void 0:t.cookieCrypt)||"0",g=(null==e?void 0:e.match_md5_local)||"-99",m=(null==e?void 0:e.match_md5_iframe)||"-99",b=e.is_pubkey_ts_sign||"-99",w=(null==e?void 0:e.lost)||"0",_=(null==e?void 0:e.initMatch)||"0",S=(null==e?void 0:e.is_new_cert)||"0",k=(null===(c=null==window?void 0:window.location)||void 0===c?void 0:c.hostname)||"",T=(null==t?void 0:t.webDomain)||"3",C=e.raw_pubkey,x=e.raw_pubkey_base64,E=e.raw_ticket,D=e.raw_ts_sign,K=e.gen_ticket_logid,P=e.gen_ticket_time,I=e.gen_ticket_client_cert,O=e.is_equal_pub;(0,o.gp)(n.logWebBdTicketGuardConsumerResponse,{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,is_new_cert:S,hostname:k,cookie_domain:T}),l>0&&(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;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function O(t){for(var e=t.replace(/-----BEGIN PRIVATE KEY-----/,"").replace(/-----END PRIVATE KEY-----/,"").replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/-----BEGIN CERTIFICATE-----/,"").replace(/-----END CERTIFICATE-----/,"").replace(/\s+/g,""),r=window.atob(e),n=r.length,i=new ArrayBuffer(n),o=new Uint8Array(i),a=0;a<n;a++)o[a]=r.charCodeAt(a);return i}function B(t){if(!/^[0-9a-fA-F]+$/.test(t))throw Error("无效的十六进制字符串");if(t.length<2||t.length%2!=0)throw Error("无效的十六进制长度");var e=t.substring(0,2);if("30"!==e)throw Error("无效的 SPKI 外层标签,期望 30实际 ".concat(e));var r=D().getChildIdx(t,0);if(!r||r.length<2)throw Error("无效的 SPKI 结构:应包含至少两个子项");var n=D().getTLV(t,r[1]).substring(0,2);if("03"!==n)throw Error("期望 BIT STRING (03),实际 ".concat(n));var i=D().getV(t,r[1]);if("00"!==i.substring(0,2))throw Error("BIT STRING 首字节应为 00");var o=i.substring(2);if(!o.startsWith("04"))throw Error("无效的未压缩公钥格式");return o}var L=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())})},A=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},R=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},U=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},M=function(t,e){var r=function(t,e){var r=Error("[Func ".concat(e,"]").concat(t.message));return r.stack=t.stack||r.stack,r};return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];try{var o=t.call.apply(t,U([null],R(n),!1));if(o instanceof Promise)return o.catch(function(t){throw r(t,e)})}catch(t){throw r(t,e)}}};function j(t,e){return L(this,void 0,void 0,function(){var r,n,i,o,a,s;return A(this,function(c){switch(c.label){case 0:return n=(r="private"===e)?"pkcs8":"spki",[4,crypto.subtle.exportKey(n,t)];case 1:return i=c.sent(),o=(0,x.m7)(i),a=r?"-----BEGIN PRIVATE KEY-----":"-----BEGIN PUBLIC KEY-----",s=r?"-----END PRIVATE KEY-----":"-----END PUBLIC KEY-----",[2,"".concat(a,"\n").concat(o,"\n").concat(s)]}})})}var V={};function N(t){return L(this,void 0,void 0,function(){var e,r,n,i,o,a,s;return A(this,function(c){switch(c.label){case 0:if(e=O(t),!(r=(0,x.wb)(e)))throw Error("Invalid PEM format");if((n=D().getIdxbyList(r,0,[0]))<0)throw Error("Failed to find TBSCertificate");if((i=D().getIdxbyList(r,n,[6]))<0)throw Error("Failed to find subjectPublicKeyInfo");return o=D().getTLV(r,i),a=(0,x.y_)(o),[4,crypto.subtle.importKey("spki",a,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"])];case 1:return s=c.sent(),[4,crypto.subtle.exportKey("spki",s)];case 2:return[2,new Uint8Array(c.sent())]}})})}var W=M(function(t,e){return L(this,void 0,void 0,function(){var r,n,i,o,a,s;return A(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),r=O(t),[4,crypto.subtle.importKey("pkcs8",r,{name:"ECDH",namedCurve:"P-256"},!1,["deriveBits"])];case 1:return n=c.sent(),[4,N(e)];case 2:return i=c.sent(),[4,crypto.subtle.importKey("spki",i,{name:"ECDH",namedCurve:"P-256"},!1,[])];case 3:return o=c.sent(),[4,crypto.subtle.deriveBits({name:"ECDH",public:o},n,256)];case 4:return a=c.sent(),[4,(0,K.D)(new Uint8Array([]),new Uint8Array(a),new Uint8Array([]),32)];case 5:return s=c.sent(),[2,{hex:(0,x.Qc)(s),bytes:s}];case 6:throw c.sent();case 7:return[2]}})})},"deriveEcdhKey"),q=M(function(t){return L(this,void 0,void 0,function(){var e,r,n,i;return A(this,function(o){switch(o.label){case 0:return e=O(t),[4,window.crypto.subtle.importKey("pkcs8",e,{name:"ECDSA",namedCurve:"P-256"},!0,["sign"])];case 1:return r=o.sent(),[4,window.crypto.subtle.exportKey("pkcs8",r)];case 2:return n=o.sent(),[2,{privateKeyHex:function(t){if("2a8648ce3d0201"!==function(t){var e={};if(e.algparam=null,"30"!==t.substr(0,2))throw Error("malformed plain PKCS8 private key(code:001)");var r=D().getChildIdx(t,0);if(r.length<3)throw Error("malformed plain PKCS8 private key(code:002)");if("30"!==t.substr(r[1],2))throw Error("malformed PKCS8 private key(code:003)");var n=D().getChildIdx(t,r[1]);if(2!==n.length)throw Error("malformed PKCS8 private key(code:004)");if("06"!==t.substr(n[0],2))throw Error("malformed PKCS8 private key(code:005)");if(e.algoid=D().getV(t,n[0]),"06"===t.substr(n[1],2)&&(e.algparam=D().getV(t,n[1])),"04"!==t.substr(r[2],2))throw Error("malformed PKCS8 private key(code:006)");return e.keyidx=D().getVidx(t,r[2]),e}(t).algoid)throw Error("unsupported ECDSA private key");return{hECOID:D().getVbyListEx(t,0,[1,0],"06"),hCurve:D().getVbyListEx(t,0,[1,1],"06"),hPrv:D().getVbyListEx(t,0,[2,0,1],"04")}}(i=(0,x.wb)(n)).hPrv,privateKeyPKCSHex:i}]}})})},"extractPrivateKeyHexFromPem"),F=M(N,"extractPublicKeyFromX509Cert"),H=M(function(t){return L(this,void 0,void 0,function(){var e,r,n,i,o,a,s;return A(this,function(c){switch(c.label){case 0:return e=O(t),[4,crypto.subtle.importKey("pkcs8",e,{name:"ECDSA",namedCurve:"P-256"},!0,["sign"])];case 1:return r=c.sent(),[4,crypto.subtle.exportKey("jwk",r)];case 2:return i={kty:"EC",crv:(n=c.sent()).crv,x:n.x,y:n.y},[4,crypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:i.crv},!0,["verify"])];case 3:return o=c.sent(),[4,crypto.subtle.exportKey("spki",o)];case 4:return a=c.sent(),[2,{hex:s=(0,x.wb)(a),rawHex:B(s),buffer:a}]}})})},"extractPublicKeyFromPrivateKey"),J=M(function(t){return L(this,void 0,void 0,function(){var e,r,n,i,o;return A(this,function(a){switch(a.label){case 0:if(V[t])return[2,V[t]];return e=O(t),[4,window.crypto.subtle.importKey("spki",e,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"])];case 1:return r=a.sent(),[4,window.crypto.subtle.exportKey("spki",r)];case 2:return n=a.sent(),o={hex:i=(0,x.wb)(n),rawHex:B(i)},V[t]=o,[2,o]}})})},"extractPublicKeyHexFromPem"),G=M(function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o,a,s;return A(this,function(c){switch(c.label){case 0:return t={name:"ECDSA",namedCurve:"P-256"},e=["sign"],[4,window.crypto.subtle.generateKey(t,!0,e)];case 1:return r=c.sent(),a=(o=Promise).all,[4,j(r.privateKey,"private")];case 2:return s=[c.sent()],[4,j(r.publicKey,"public")];case 3:return[4,a.apply(o,[s.concat([c.sent()])])];case 4:return i=(n=R.apply(void 0,[c.sent(),2]))[0],[2,{publicPem:n[1],privatePem:i}]}})})},"generateNewKeyPairPEM"),z=M(function(t,e){return L(this,void 0,void 0,function(){var r,n,i,o;return A(this,function(a){switch(a.label){case 0:return r=O(t),[4,window.crypto.subtle.importKey("pkcs8",r,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"])];case 1:return n=a.sent(),i=new TextEncoder().encode(e),[4,window.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,i)];case 2:var s,c,u,l,f,h,d,p,v,y;return c=(s=new Uint8Array(a.sent())).length/2,u=s.slice(0,c),l=s.slice(c),f=function(t){for(var e=0;e<t.length&&0===t[e];)e++;if(e===t.length)return new Uint8Array([0]);var r=t.slice(e);if(128&r[0]){var n=new Uint8Array(r.length+1);return n.set(r,1),n}return r},h=function(t){if(t<128)return[t];for(var e=[],r=t;r>0;)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;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},Y=function(){function t(){this.extractPrivateKeyHexFromPem=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return q.apply(void 0,Q([],X(t),!1))},this.extractPublicKeyFromPrivateKey=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return H.apply(void 0,Q([],X(t),!1))},this.extractPublicKeyHexFromPem=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return J.apply(void 0,Q([],X(t),!1))},this.verifyWithECDSA=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Z.apply(void 0,Q([],X(t),!1))},this.extractPublicKeyFromX509Cert=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return F.apply(void 0,Q([],X(t),!1))}}return t.prototype.signWithECDSA=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.apply(void 0,Q([],X(t),!1))},t.prototype.deriveEcdhKey=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return W.apply(void 0,Q([],X(t),!1))},t.prototype.generateNewKeyPairPEM=function(){return G()},t}(),$=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},tt=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},te=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},tr=new function(){var t=this;this._provider=void 0,this._pipeline=void 0,this._usage=void 0,this.get=function(e){var r;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return t.init().then(function(t){return(r=t[e]).call.apply(r,te([t],tt(n),!1))})}},this.setUsage=function(e){t._usage=e},this.getUsage=function(){return t.isSupportSystem().then(function(t){return t?"system":"fallback"})},this.isSystemCryptoExists=function(){return!!(window.crypto&&window.crypto.subtle)},this.isSupportSystem=function(){if("string"==typeof t._usage)return t.isSystemCryptoExists()?Promise.resolve("system"===t._usage):Promise.resolve(!1);return Promise.resolve(t.isSystemCryptoExists())},this.init=function(){var e,n,i,o;return e=t,n=void 0,i=void 0,o=function(){var t,e=this;return $(this,function(n){return this._provider?[2,Promise.resolve(this._provider)]:(!this._pipeline&&(t=this.isSupportSystem(),this._pipeline=t.then(function(t){if(t){var n=new Y;return e._provider=n,e._provider}return r.e("16623").then(r.bind(r,358817)).then(function(t){var r=new t.FallbackCryptoAPIProvider;return e._provider=r,e._provider})})),[2,this._pipeline])})},new(i||(i=Promise))(function(t,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(e){var r;e.done?t(e.value):((r=e.value)instanceof i?r:new i(function(t){t(r)})).then(a,s)}c((o=o.apply(e,n||[])).next())})}},tn=tr.get("generateNewKeyPairPEM"),ti=tr.get("signWithECDSA"),to=tr.get("deriveEcdhKey");tr.get("extractPrivateKeyHexFromPem");var ta=tr.get("extractPublicKeyFromPrivateKey"),ts=tr.get("extractPublicKeyHexFromPem");tr.get("verifyWithECDSA");var tc=tr.get("extractPublicKeyFromX509Cert"),tu=tr.setUsage.bind(tr),tl=tr.getUsage.bind(tr),tf=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())})},th=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},td=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},tp=function(t,e){for(var r=!1,n=0;n<t.length;n++)(!(null==e?void 0:e[t[n]])||void 0===(null==e?void 0:e[t[n]]))&&(r=!0);return!!r||!1},tv=function(){function t(){var t=this;this.plugin=null,this._enabled=!0,this._writeOnly=!1,this._check=function(){return tf(t,void 0,void 0,function(){var t;return th(this,function(e){if(!this.plugin)return[2,{pass:!1,reason:"plugin is not init"}];t=this.plugin.check;try{if(!Object.prototype.hasOwnProperty.call(window,"Proxy")||!Object.prototype.hasOwnProperty.call(window,"Reflect"))return[2,{pass:!1,reason:"Proxy or Reflect is not supported"}];if("function"!=typeof t)return[2,{pass:!1,reason:"check is not a function"}];return[2,t()]}catch(t){return[2,{pass:!1,reason:null==t?void 0:t.message}]}return[2]})})}}return t.prototype.init=function(t,e){void 0===e&&(e=!1),this.plugin=t,this._writeOnly=e},t.prototype.proxy=function(t){return tf(this,void 0,void 0,function(){var e,r,n,i,o,a,s=this;return th(this,function(c){return this.plugin?(r=(e=this.plugin).getItems,n=e.setItems,i=function(t){s._enabled=t},o=function(){return s._enabled},a=function(){return s._writeOnly},[2,this._check().then(function(e){return e.pass?{storeSDK:new Proxy(t,{get:function(t,e,s){var c=Reflect.get(t,e,s);return"function"==typeof c?new Proxy(c,{apply:function(t,s,c){var u=ty[e],l=a();if(!u)return Reflect.apply(t,s,c);var f=u.action,h=u.response,d=u.payload;if("getItems"===f){if(!o()||l)return Reflect.apply(t,s,c);var p=d(c);return r.apply(s,p).then(function(e){var r,n=e&&Object.values(e);return!e||"object"!=typeof e||0===n.length||n.some(function(t){return void 0===t})||tp((null==p?void 0:p[0])||[],e)?(i(!1),Reflect.apply(t,s,c)):Array.isArray(p)&&p.length>1&&(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<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},t_=function(){function t(){this.eventMap={}}return t.prototype.on=function(t,e){var r=this.eventMap;r[t]?r[t].push(e):r[t]=[e]},t.prototype.off=function(t,e){var r=this.eventMap;if(r[t]){for(var n=r[t],i=n.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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},tC=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},tx=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},tE=function(t,e){return tk(void 0,void 0,void 0,function(){var r,n;return tT(this,function(i){switch(i.label){case 0:if(!e)return[3,2];return[4,ts(e)];case 1:return r=i.sent().rawHex,[2,(0,x.MU)(r)];case 2:if(!t)return[3,4];return[4,ta(t)];case 3:return n=i.sent().rawHex,[2,(0,x.MU)(n)];case 4:return[2,""]}})})},tD=function(t,e){return tk(void 0,void 0,void 0,function(){var r,n,i;return tT(this,function(i){switch(i.label){case 0:var o;if(i.trys.push([0,2,,3]),!t||!e||"string"!=typeof t)return[2,!1];return r=JSON.parse(t),[4,(o=e,tk(void 0,void 0,void 0,function(){var t;return tT(this,function(e){switch(e.label){case 0:return[4,tc(o)];case 1:return t=e.sent(),[2,(0,x.Qc)(t)]}})}))];case 1:if(n=i.sent(),n===(r||{}).ec_publicKey)return[2,!0];return[2,!1];case 2:return i.sent(),[2,!1];case 3:return[2]}})})},tK=function(t,e){return tk(void 0,void 0,void 0,function(){var r,n,i,o;return tT(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),!t||!e||"string"!=typeof t)return[2,!1];return n=(r=JSON.parse(t)||{}).ec_privateKey,[4,tE(n,r.ec_publicKey)];case 1:if(i=o.sent(),i===e.split(".")[1])return[2,!0];return[2,!1];case 2:return o.sent(),[2,!1];case 3:return[2]}})})},tP=function(t,e,r,n){try{if(!t||!e||!r||!n||"string"!=typeof e||"string"!=typeof n)return!1;var i=(JSON.parse(e||"{}")||{}).ec_publicKey;if(!i)return!1;if((0,x.jT)(JSON.stringify({publicKey:i,cert:r,serverData:n}))===t)return!0}catch(t){}return!1},tI=function(t,e,r){try{if(!t||!e||!r||"string"!=typeof t||"string"!=typeof r)return"";var n=(JSON.parse(t)||{}).ec_publicKey;if(!n)return"";return(0,x.jT)(JSON.stringify({publicKey:n,cert:e,serverData:r}))}catch(t){}return""},tO=function(t){var e,r;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return e?Promise.resolve(e):(!r&&(r=new Promise(function(i,o){t.apply(void 0,tx([],tC(n),!1)).then(function(t){t&&(e=t),i(t),r=void 0}).catch(function(t){o(t),r=void 0})})),r)}};function tB(t){var e;return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return!e&&(e=new Promise(function(n,i){t.apply(void 0,tx([],tC(r),!1)).then(function(t){n(t)}).catch(function(t){return i(t)}).finally(function(){e=void 0})})),e}}var tL=function(){function t(){var t=this;this.list=[],this.count=0,this.maxCount=1,this.provider=function(e){return t.addTask(function(){return new Promise(function(t,r){e().then(function(e){t(e)}).catch(function(t){r(t)})})})},this.wait=function(){t.provider(function(){return Promise.resolve(!0)})},this.list=[],this.count=0}return t.prototype.addTask=function(t){var e=this;return new Promise(function(r){e.list.push(function(){return t().then(function(t){return e.count-=1,e.consume(),r(t),t})}),e.consume()})},t.prototype.consume=function(){if(this.count<this.maxCount&&this.list.length>0){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;o<i.length;o++){var a=i[o];if("cookie"===a.certType){e=!0,r=a.scene;break}}if(e&&r)break}return!!e&&r},tR=r("164943"),tU=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},tM=tR.sha256.hmac,tj=function(t){var e=this;this.pipeline=Promise.resolve(null),this.generateNewKeyPair=tB(function(){return tn()}),this.getKeys=function(){return e.pipeline.then(function(){return{publicKey:e._public_key,privateKey:e._private_key}})},this.sign=function(t){return e.pipeline.then(function(){return ti(e._private_key||"",t)})},this.signWithHmac=function(t,r){var n,i,o,a;return n=e,i=void 0,o=void 0,a=function(){var e,n,i,o;return tU(this,function(a){switch(a.label){case 0:if(!this._private_key)throw Error("private key is empty");return[4,this.pipeline];case 1:return a.sent(),e=Date.now(),n=0,e=Date.now(),i=tM(r,t),o=(0,x.MU)(i),[2,{result:o,times:{hmacTime:n=Date.now()-e}}]}})},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())})},this.verify=function(t,e,r){return!0},this.getCSR=function(){return""},this.comparePubKey=function(t,e){return!0};var r=t.privateKey,n=t.publicKey;r&&n?(this._public_key=n,this._private_key=r):this.pipeline=this.generateNewKeyPair().then(function(t){e._public_key=t.publicPem,e._private_key=t.privatePem})},tV=function(t){try{for(var e="".concat(t,"="),r=document.cookie.split(";"),n=0;n<r.length;n++){var i=r[n].trim();if(0===i.indexOf(e)){var o=i.substring(e.length,i.length);if(o.length>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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},tW=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},tq=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},tF=function(t){return decodeURIComponent(document.cookie.replace(RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(t).replace(/[-.+*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},tH=function(){try{var t="",e=document.location.hostname,r=e.split(".");if(/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(e)||"localhost"===e){var n=document.location.hostname;return n.replace(/^.*?\b\.\b/,"")}var i=[];for(i.unshift(r.pop());i.length<2;)i.unshift(r.pop()),t=i.join(".");return t||document.location.hostname}catch(t){return document.location.hostname}},tJ=function(t,e,r,n){var i,o,a,s,c,u;return void 0===r&&(r="/"),void 0===n&&(n=5184e3),i=t,o=e,a=r,s=tH(),c=n,!(!i||/^(?:expires|max\-age|path|domain|secure)$/i.test(i))&&(document.cookie=encodeURIComponent(i)+"="+encodeURIComponent(o)+(c?"; max-age="+c:"")+(s?"; domain="+s:"")+(a?"; path="+a:""),!0)},tG=function(t,e,r){return!!t&&(document.cookie=encodeURIComponent(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"+(r?"; domain="+r:"")+(e?"; path="+e:""),!0)},tz=function(t,e){void 0===e&&(e="/");var r=document.location.hostname,n=tH();return tG(t,e,r),tG(t,e,n),tG(t,e),!0},tZ=function(){var t=null==window?void 0:window.navigator.userAgent;return/TTElectron/.test(t)?"electron":"web"},tX=function(t,e,r){return function(){for(var n,i,o,a,s=[],c=0;c<arguments.length;c++)s[c]=arguments[c];return n=this,i=void 0,o=void 0,a=function(){return tN(this,function(n){return[2,Promise.race([new Promise(function(t,n){setTimeout(function(){n(Error(r))},e)}),t.apply(null,s)])]})},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())})}},tQ=function(t){var e,r;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return e?Promise.resolve(e):(!r&&(r=new Promise(function(i,o){t.apply(void 0,tq([],tW(n),!1)).then(function(t){t&&(e=t),i(t),r=void 0}).catch(function(t){o(t),r=void 0})})),r)}},tY=function(t){return new Promise(function(e,r){var n=document.createElement("script");n.type="text/javascript",n.src=t,document.getElementsByTagName("head")[0].appendChild(n),n.readyState?n.onreadystatechange=function(){("complete"===n.readyState||"loaded"===n.readyState)&&(n.onreadystatechange=null,e(!0))}:(n.onload=function(){e(!0)},n.onerror=function(t){r(t)})})},t$=function(t){var e=!1;for(var r in t)if(t.hasOwnProperty(r)&&(null===t[r]||void 0===t[r]||""===t[r])){e=!0;break}return e};var t0=(n=function(t,e){return(n=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}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),t1=function(t){function e(){var e=t.call(this)||this;return e.getCookie=function(t){try{return decodeURIComponent(document.cookie.replace(RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(t).replace(/[-.+*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null}catch(t){e.emit("error",{error:t,name:"cookie get item error"})}return null},e.setCookie=function(t,r,n,i,o,a){try{if(!t||/^(?:expires|max\-age|path|domain|secure)$/i.test(t))return!1;return document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(r)+(o?"; max-age="+o:"")+(i?"; domain="+i:"")+(n?"; path="+n:"")+(a?"; secure":""),!0}catch(t){e.emit("error",{error:t,name:"cookie set item error"})}return!1},e.setCookieNoTimeout=function(t,r){e.setCookie(t,r,"/")},e.setCookieWithMaxAge=function(t,r){e.setCookie(t,r,"/",void 0,5184e3)},e.setCookieWithDomain=function(t,r){var n=tH();e.setCookie(t,r,"/",n,5184e3)},e.deleteCookie=function(t,r,n){return!!(t&&e.hasCookie(t))&&(document.cookie=encodeURIComponent(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"+(n?"; domain="+n:"")+(r?"; path="+r:""),!0)},e.deleteAllCookie=function(t){var r=tH(),n=document.location.hostname;e.deleteCookie(t,"/",r),e.deleteCookie(t,"/",n),e.deleteCookie(t,"/")},e.hasCookie=function(t){return RegExp("(?:^|;\\s*)"+encodeURIComponent(t).replace(/[-.+*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},e.getCookieKeys=function(){for(var t=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),e=[],r=0;r<t.length;r++)t[r]&&e.push(decodeURIComponent(t[r]));return e},e}return t0(e,t),e}(t_),t2="security-sdk/s_sdk_server_cert_key",t3=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,"&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");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;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},t9=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())})},et=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ee=function(t){function e(e){void 0===e&&(e={});var r=t.call(this)||this;return r.config={},r.data=null,r.signPromise=null,r.refresh=null,r.updateTimer=null,r.onUpdateCallback=null,r.handleVisibilityChange=function(){"visible"===document.visibilityState&&r.triggerUpdateCheck()},r.config=t7({updateInterval:3e5,timestampValidWindow:9e5},e),r}return t8(e,t),e.getInstance=function(t){return void 0===t&&(t={}),!e.instance&&(e.instance=new e(t)),e.instance},e.prototype.start=function(){this.updateTimer&&this.stop(),this.scheduleNextCheck(),this.bindVisibilityListener()},e.prototype.stop=function(){this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null),this.unbindVisibilityListener()},e.prototype.setUpdateCallback=function(t){this.onUpdateCallback=t},e.prototype.setRefresh=function(t){this.refresh=t},e.prototype.wait=function(){return this.signPromise?this.signPromise:Promise.resolve("")},e.prototype.update=function(t,e){return t9(this,void 0,void 0,function(){var r,n=this;return et(this,function(i){return this.refresh?(r=Date.now(),this.signPromise=this.refresh().then(function(i){var o=i.cryptoSDK,a=i.aesKey,s=i.signValues,c=i.cryptoValues;return o&&a&&s&&c?o.signWithHmac("sec_ts=".concat(t),a).then(function(i){var o=i.result;return n.data={secTs:t,ts:e,updateTime:performance.now(),signResult:o},n.updateCookie(s,c).then(function(t){return n.emit("execute",{action:"ts",op:"update",status:"success",duration:Date.now()-r,ctx:{ts:e}}),t})}):Promise.reject(Error("Update sec miss deps"))}).catch(function(t){return n.emit("error",{name:"sec_ts sign failed",error:t}),""}).finally(function(){n.signPromise=null}),[2,this.signPromise]):[2,Promise.reject(Error("Timestamp refresh not init"))]})})},e.prototype.get=function(){return this.data},e.prototype.updateCookie=function(t,e){return t9(this,void 0,void 0,function(){var r,n,i,o,a,s,c;return et(this,function(u){switch(u.label){case 0:if(!this.data)return[2,Promise.reject(Error("SecData is nil"))];return r=e.ec_publicKey,[4,tE(e.ec_privateKey,r)];case 1:return n=u.sent(),i=t.ts_sign,a=(o=this.data).signResult,s={ree_public_key:n,ts_sign:i,req_content:"sec_ts",req_sign:a,sec_ts:o.secTs},tJ(t5,c=(0,x.rw)(JSON.stringify(s)),"/"),[2,c]}})})},e.prototype.checkNeedUpdate=function(){return!this.data||!this.config.updateInterval||!this.config.timestampValidWindow||performance.now()-this.data.updateTime>=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<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},eS=function(){function t(e){var r=this;this.config={dbName:"secure-store",storeName:"cryptvalues",closeDBTime:2e4},this.getItem=function(t){return r.getItemByKeys([t]).then(function(t){return t[0]})},this.getItemByKeys=function(t){var e=r.config.storeName;return r.transaction(function(){return r.openDB().then(function(r){var n=r.transaction(e,"readonly").objectStore(e);return Promise.all(t.map(function(t){return eb(n.get(t)).then(function(t){return JSON.parse(t||"{}").data})}))})})},this.setItem=function(t,e){return r.setItemByKeys([[t,e]]).then(function(t){return t[0]})},this.setItemByKeys=function(t){var e=r.config.storeName;return r.transaction(function(){return r.openDB().then(function(r){var n=r.transaction(e,"readwrite"),i=n.objectStore(e);return Promise.all(t.map(function(t){var e=t[0],r=t[1],n=JSON.stringify({data:r});return eb(i.get(e)).then(function(t){return t!==n&&i.put(n,e),r})})).then(function(t){return ew(n).then(function(){return t})})})})},this.removeItem=function(t){var e=r.config.storeName;return r.openDB().then(function(r){var n=r.transaction(e,"readwrite"),i=n.objectStore(e).delete(t);return ew(n,i)})},this.getKeys=function(){var t=r.config.storeName;return r.transaction(function(){return r.openDB().then(function(e){var r=e.transaction(t).objectStore(t).openKeyCursor();return new Promise(function(t,e){var n=[];r.onsuccess=function(){r.result?(n.push(r.result.key),r.result.continue()):t(n)},r.onerror=function(){e(r.error)}})})})},this.openDB=function(){var e=r.config,n=e.storeName,i=e.dbName,o=e.closeDBTime;return clearTimeout(ed[i]),ed[i]=setTimeout(function(){t.closeDB(i).catch(function(){})},o),t.openDB(r.config).then(function(e){if(!e.objectStoreNames.contains(n)){var o=e.version+1;return t.closeDB(i).then(function(){return t.openDB(r.config,o)})}return e})},this.transaction=function(t){var e,n,i,o=r.config,a=o.dbName,s=o.onQuotaErrorCallback;return e=a,n=t,i=function(t,e){t&&"function"==typeof s&&s.call(r,e)},ey=ey.then(function(){var t=function(){return n().then(function(t){return eg=0,t}).catch(function(r){if(eg<3)return eg++,eh[e]=void 0,em(e,r).then(function(t){if("function"==typeof i)return i(t.isQuotaError,t.clean)}),t();throw eg=0,r})};return t()})},this.config=e_(e_({},this.config),e||{})}return t.isSupport=function(){return!!ep()},t.openDB=function(e,r){var n=e.dbName,i=e.storeName,o=e.version;if(r&&(eh[n]=void 0),!t.isSupport())return Promise.reject(new ef(ev));var a=ep(),s=function(t,e){return new Promise(function(r,n){var o=a.open(t,e);o.onsuccess=function(){r(o.result)},o.onerror=function(t){var e,r;t.preventDefault(),n(new ef((null===(e=o.error)||void 0===e?void 0:e.name)||"IndexedDBOpenError",null===(r=o.error)||void 0===r?void 0:r.message))},o.onupgradeneeded=function(t){try{(o.result||t.target.result).createObjectStore(i)}catch(t){n(t)}}})};return eh[n]||(eh[n]=new Promise(function(t,e){try{s(n,r||o||1).catch(function(t){if(ek(t))return eT(n).then(function(t){return t?s(n,t):s(n)}).catch(function(){return s(n)});throw t}).then(t).catch(e)}catch(t){e(new ef(ev,t.message))}}))},t.deleteDB=function(e){var r=ep();return r?t.closeDB(e).then(function(){if(null==r?void 0:r.deleteDatabase){var t=null==r?void 0:r.deleteDatabase(e);if(t)return clearTimeout(ed[e]),new Promise(function(e,r){t.onsuccess=function(){e(t.result)},t.onerror=function(){r(null==t?void 0:t.error)}})}return Promise.reject(new ef("IDBDeleteDataBaseError"))}):Promise.reject(new ef("IDBObjectError"))},t.closeDB=function(t){return new Promise(function(e,r){eh[t]?eh[t].then(function(n){!function(){eh[t]=void 0;try{n.close(),e(1)}catch(t){r(t)}}()}).catch(r):e(-1)})},t}(),ek=function(t){return"versionerror"===((null==t?void 0:t.name)||"").toString().toLowerCase()&&(!!(-1!==((null==t?void 0:t.message)||"").indexOf("version")||((null==t?void 0:t.message)||"").match(/\s*less\s*than/i))||-1!==((null==t?void 0:t.message)||"").match(/\s*higher\s*version\s*than\s*/gi)||void 0)},eT=function(t){return new Promise(function(e,r){var n=ep();if(null==n?void 0:n.databases)return n.databases().then(function(r){var n=r.filter(function(e){return e.name===t})[0];e(null==n?void 0:n.version)}).catch(r);r(Error("idb.database is ".concat(typeof(null==n?void 0:n.databases))))})},eC=function(){function t(){var e=this;this.getItem=function(t){return e.getItemByKeys([t]).then(function(t){return t[0]})},this.setItem=function(t,r){return e.setItemByKeys([[t,r]]).then(function(t){return t[0]})},this.getItemByKeys=function(t){return e.openLocalStorage().then(function(e){return t.map(function(t){return JSON.parse(e.getItem(t)||"{}").data})})},this.setItemByKeys=function(t){return e.openLocalStorage().then(function(e){return t.map(function(t){var r=t[0],n=t[1],i=JSON.stringify({data:n});return e.setItem(r,i),n})})},this.removeItem=function(t){return e.openLocalStorage().then(function(e){e.removeItem(t)})},this.getKeys=function(){return e.openLocalStorage().then(function(t){for(var e=[],r=0;r<t.length;r++)t.key(r)&&e.push(t.key(r));return e})},this.openLocalStorage=function(){return t.isSupport()?Promise.resolve(ex()):Promise.reject(new ef("LocalStorageNotSupport"))}}return t.isSupport=function(){var t=ex();if(!t)return!1;try{var e="__x_storage_test__";t.setItem(e,e);var r=t.getItem(e);return t.removeItem(e),e===r}catch(t){return!1}},t}(),ex=function(){return window.localStorage},eE={},eD=function(){function t(){var t=this;this.getItem=function(e){return t.getItemByKeys([e]).then(function(t){return t[0]})},this.setItem=function(e,r){return t.setItemByKeys([[e,r]]).then(function(t){return t[0]})},this.getItemByKeys=function(e){return t.openMStorage().then(function(t){return e.map(function(e){return JSON.parse(t.getItem(e)||"{}").data})})},this.setItemByKeys=function(e){return t.openMStorage().then(function(t){return e.map(function(e){var r=e[0],n=e[1],i=JSON.stringify({data:n});return t.setItem(r,i),n})})},this.removeItem=function(e){return t.openMStorage().then(function(t){t.removeItem(e)})},this.getKeys=function(){return t.openMStorage().then(function(){return Object.keys(eE)})},this.openMStorage=function(){return Promise.resolve({setItem:function(t,e){eE[t]="".concat(e)},getItem:function(t){return eE[t]||null},removeItem:function(t){delete eE[t]}})}}return t.isSupport=function(){return!0},t}(),eK=window,eP=eK.addEventListener,eI=eK.removeEventListener,eO=eK.location,eB=document,eL=function(){return performance.now&&Number(performance.now().toFixed(0))||Date.now()},eA=function(t){var e=t.split("//")||[];return"".concat(e[0],"//").concat(e[1].split("/")[0])},eR=function(t,e){return -1!==t.indexOf("html?")?"".concat(t,"&").concat(e):"".concat(t,"?").concat(e)},eU=function(t,e){for(var r=0;r<t.length;r++)if(-1===e.indexOf(t[r]))return!1;return!0},eM=function(t,e){for(var r=Promise.reject(new ef("WebStorageRunSerialQueueError")),n=function(n){r=r.then(function(r){return"function"==typeof e&&e(r)||void 0===r?t[n]():r}).catch(function(){return t[n]()})},i=0;i<t.length;i++)n(i);return r},ej=function(t){for(var e=Promise.reject(new ef("WebStorageRunSerialQueueIfOneResolveError")),r=function(r){t[r]&&(e=e.then(function(e){return t[r]().catch(function(t){}),e}).catch(function(e){return t[r]()}))},n=0;n<t.length;n++)r(n);return e},eV=function(t){for(var e=Promise.reject(new ef("WebStorageRunSerialQueueIfOneResolveError")),r=function(r){t[r]&&(e=e.then(function(e){return t[r]().catch(function(t){return Promise.resolve(e)})}).catch(function(e){return t[r]()}))},n=0;n<t.length;n++)r(n);return e},eN="J_uc_iframe_box-".concat(Date.now()),eW=function(){var t=function(){var t=document.getElementById(eN);if(t)return t;var e=document.createElement("div");return e.style.display="none",e.id=eN,eB.body.appendChild(e),e};return new Promise(function(e){var r=eB.body,n={appendChild:function(e){t().appendChild(e)}};r?e(n):"loading"===eB.readyState?eB.addEventListener("DOMContentLoaded",function(){e(n)}):e(n)})},eq=!1,eF=function(t){!eq&&t.config.debug&&(eq=!0,t.emit("debug",{name:"OpenMessageLog"}),window.addEventListener("message",function(e){var r=e.data;if(!!eq)"string"==typeof r&&0===r.indexOf("log:")&&t.emit("debug",{name:"Message:Log=".concat(r.substring(4))})}))},eH=function(t){try{eO.origin===ei&&window.parent.postMessage("log:".concat(t),"*")}catch(t){}};var eJ=(a=function(t,e){return(a=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}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),eG=function(){return(eG=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},ez=eO.origin,eZ=function(t){function e(e){var r=t.call(this)||this;return r.dbSetFlag=[],r.getItem=function(t){return r.getItemByKeys([t]).then(function(t){return t[0]})},r.setItem=function(t,e){return r.setItemByKeys([[t,e]]).then(function(t){return t[0]})},r.getItemByKeys=function(t){var e=-1,n=[];return r.db.then(function(e){return eM(e.map(function(e,r){return function(){return e.getItemByKeys(t).then(function(e){return n[r]=t.map(function(t,n){return{from:void 0!==e[n]?r:-1,value:e[n],origin:ez}}),e})}}),function(t){for(var e=0;e<(null==t?void 0:t.length);e++)if(void 0===t[e])return!0;return!1})}).catch(function(n){return r.fallbackDB.getItemByKeys(t).then(function(t){return e=2,t})}).then(function(t){return n[0]?n[0].map(function(t,e){return void 0!==t.value?t:n[1]&&n[1][e]?void 0===n[1][e].value?t:n[1][e]:t}):n[1]?n[1]:t.map(function(t){return{value:t,from:e,origin:ez}})})},r.setItemByKeys=function(t){var e=-1;return r.db.then(function(n){return ej(n.map(function(r,n){return function(){return r.setItemByKeys(t).then(function(t){return e=n,t})}})).catch(function(n){return e=2,r.fallbackDB.setItemByKeys(t)}).then(function(t){return t.map(function(t){return{value:t,from:e,origin:ez}})})}).then(function(t){return t},function(t){throw eH("storage:setItemByKeys:error:".concat(null==t?void 0:t.message)),t})},r.removeItem=function(t){return r.db.then(function(e){return Promise.all(e.map(function(e){return e.removeItem(t)})).then(function(){return r.fallbackDB.removeItem(t)})})},r.config=e||{},r.localDB=new eC,r.db=Promise.resolve([r.localDB,new eS(eG(eG({},(null==e?void 0:e.dbStorage)||{}),{onQuotaErrorCallback:function(){r.emit("log",{name:"QuotaError"})}}))]),r.fallbackDB=new eD,r}return eJ(e,t),e.prototype.getKeys=function(){return this.db.then(function(t){return eM(t.map(function(t){return function(){return t.getKeys()}}),function(t){return void 0===t||0===t.length})})},e}(t_),eX=["security-sdk/s_sdk_crypt_sdk","security-sdk/s_sdk_cert_key","security-sdk/s_sdk_sign_data_key/web_protect"];var eQ=(s=function(t,e){return(s=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}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),eY=function(){return(eY=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},e$={get visibility(){return document.visibilityState}},e0={current:0,max:2},e1="visibilitychange",e2=function(){return"hidden"===document.visibilityState},e3=function(t){function e(e){var r=t.call(this)||this;return r.autoLoadIframeConfig={max:10,current:0,iframeLoadPromise:null},r.reset=function(){var t=r.autoLoadIframeConfig;t.current>=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<e0.max)throw e0.current++,t}else throw t})}).then(function(){if(u.parentNode)return h=1,{startTime:c,endTime:eL(),postMessage:function(t,e){(u.contentWindow||r).postMessage(t,e||"*")},destory:function(){var t;try{null===(t=u.parentNode)||void 0===t||t.removeChild(u)}catch(t){}},isValid:function(){var t;return!!((null==u?void 0:u.parentNode)&&(null===(t=null==u?void 0:u.parentNode)||void 0===t?void 0:t.parentNode))}};throw Error("CreateIframeElementError")}).catch(function(t){var e;h=0;try{null===(e=u.parentNode)||void 0===e||e.removeChild(u)}catch(t){}try{"CreateIframeMainTimeout"===t.name&&o.emit("debug",{name:"CreateIframeMainTimeout"})}catch(t){}throw t})},e}(t_);var e4=(c=function(t,e){return(c=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}c(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),e5=function(){return(e5=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},e6=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},e8=function(t){return"p-".concat(t)},e7=".".concat(location.origin.split(".").slice(-2).join(".")),e9=function(t){function e(e){var r=t.call(this)||this;return r.config={protocol:"Common"},r.loadTime=0,r.startTime=0,r.endTime=0,r.callParentBridgetIndex=0,r.listen=function(){window.parent!==window&&window.parent.postMessage("ACK","*")},r.getIframeState=function(){return{isConnection:"boolean"==typeof r.isConnection?Number(!!r.isConnection):-1,retryCount:r.iframeConnection.autoLoadIframeConfig.current,startTime:r.startTime,endTime:r.endTime,loadTime:r.loadTime,origin:location.origin}},r.postIframeMessage=function(t){var e=r.config.protocol;if(r.window){var n=r.config.url;return r.window.catch(function(t){return r.reConnection()}).then(function(r){r.target.postMessage({protocol:e,data:t},eA(n))})}return Promise.reject(new ef("postMessageError"))},r.postWindowMessage=function(t,e,n,i){void 0===i&&(i="*");var o=r.config.protocol;return new Promise(function(r){t.postMessage({type:e,protocol:o,data:n},i),r()})},r.postParentMessage=function(t,e,n){void 0===n&&(n="*");var i=eK.parent;return i!==eK?r.postWindowMessage(i,t,e,n):Promise.resolve()},r.dispatchParentEvent=function(t,e){return r.postParentMessage("event",{id:e8(r.callParentBridgetIndex++),message:{eventName:t,eventData:e}})},r.callParentBridge=function(t,e,n){var i=e8(r.callParentBridgetIndex++);return Promise.race([new Promise(function(o,a){var s=function(t){var e=t.data;e.id===i&&(r.off("message",s),"reject"===e.promiseStatus?a(new ef("".concat(e.message||"UNKNOW_CallParentBridge_Error"))):o(e.message))};r.on("message",s),r.postParentMessage("function",{id:i,message:{callObj:t,callName:e,callArgs:n}}).catch(a)}),new Promise(function(r,n){setTimeout(function(){n(new ef("CallParentBridgeInvokeTimeout","CallBridge invoke timeout: callObj=".concat(t,";callName=").concat(e,";")))},5e3)})])},r.startConnection=function(t){var e=r.config.url;!r.window&&e&&(r.isStart=!0,r.isConnection=void 0,r.emit("log",{name:"startConnection:".concat(t)}),r.createConnection(e))},r.reStartConection=function(t){r.isStart=!1,r.window&&r.window.then(function(t){return t.target.destory()}).catch(function(){}),r.window=void 0,r.iframeConnection.reset(),r.startConnection(t)},r.start=function(t){return new Promise(function(e){r.config=e5(e5({},r.config||{}),t||{}),r.isStart=!0,r.emit("config"),e()})},r.reConnection=function(){var t=r.config.url;return r.createConnection(t)},r.preCheck=function(){return r.isConnection&&r.isStart&&r.window?r.window.then(function(t){!t.target.isValid()&&r.reStartConection("valid")}):(!r.config.disablePreCheckConnection&&!1===r.isConnection&&r.iframeConnection.autoLoadIframeConfig.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<rr,i=rn;return t.emit("debug",{name:"reCallBridgeWhenTimeout",content:JSON.stringify({isTimeoutId:n,$MessageId:i,$id:u,callName:o,reCallBridgeWhenTimeout:!!re})}),(re=re&&n?re:new Promise(function(e){rr=i,eF(t),t.reStartConection("callBridge"),e()})).then(function(){return h(8e3)})}throw r})}};var ra=(u=function(t,e){return(u=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}u(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),rs=function(){return(rs=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},rc=function(t){function e(e){var r=t.call(this)||this;return r.listen=function(){r.client.listen()},r.setConfig=function(t){return new Promise(function(e){r.config=rs(rs({},r.config||{}),t),r.emit("config",r.config),e()})},r.startStorageChecker=function(){return new Promise(function(t){r.client.isConnection?t():r.client.on("connection",function(){t()})}).then(function(){return ro(r.client,!0,3e3)("config","startChecker",[])})},r.startChecker=function(){return new Promise(function(t,e){var n=(r.config||{}).startStorageCheckerCallBack;null==n||n(),t()})},r.setOriginStorageConfig=function(t){return new Promise(function(t){r.client.isConnection?t():r.client.on("connection",function(){t()})}).then(function(){if(r.client.config.url)return ro(r.client,!0,3e4)("config","setConfig",[t]);throw Error("NoOriginStorageURL")})},r.setItem=function(t,e,n){return r.setItemByKeys([[t,e]],n).then(function(t){return t[0]})},r.getItem=function(t,e){return r.getItemByKeys([t],e).then(function(t){return t[0]})},r.getItemByKeys=function(t,e){var n=e||{},i=n.async,o=n.logger,a=void 0===o||o,s=eL(),c=0,u=0,l=-1,f={},h=function(){if(a)try{c=c||eL(),u=u||c,r.emit("metrics",{name:"getOriginItemByKeys",metrics:{duration:c-s,callTime:c-u,startCallTime:u,startTime:s,endTime:c},categories:rs({status:String(l)},f)})}catch(t){}},d=function(e){l=l>-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;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},rl=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rf=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.")},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;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},rp=function(){function t(t){void 0===t&&(t={}),this.store=new Map,this.queue=new Map,this.disabled=!1,this.agId=t.agId||1}return t.prototype.delete=function(t){this.store.delete(t),this.queue.delete(t),this.clearVersion(t)},t.prototype.clear=function(){this.store.clear(),this.queue.clear()},t.prototype.isEnabled=function(){return!this.disabled},t.prototype.setDisabled=function(t){this.disabled=t,t&&this.clear()},t.prototype.getMultipleWithFetch=function(t,e,r){var n,i,o,a;return n=this,i=void 0,o=void 0,a=function(){var n,i,o,a,s,c,u,l,f,h,d,p,v,y=this;return rl(this,function(g){switch(g.label){case 0:if(!this.disabled)return[3,2];return[4,e(t)];case 1:return[2,{data:r(g.sent()),summary:{total:t.length,hit:0,miss:t.length,pending:0,missKeys:t}}];case 2:n=[],i=[],o={};try{for(s=(a=rf(t)).next();!s.done;s=a.next())c=s.value,this.store.has(c)&&!this.needUpdate(c)?(u=this.store.get(c))&&(o[c]=u.value):this.queue.has(c)?i.push(c):(n.push(c),this.store.has(c)&&this.delete(c))}catch(t){p={error:t}}finally{try{s&&!s.done&&(v=a.return)&&v.call(a)}finally{if(p)throw p.error}}if(0===n.length&&0===i.length)return[2,{data:o,summary:{total:t.length,hit:t.length,miss:0,pending:0,missKeys:[]}}];return l=i.map(function(t){return y.queue.get(t)}),f=n.length>0?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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rb=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.")},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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};var rk=(f=function(t,e){return(f=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}f(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),rT=function(){return(rT=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},rC=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())})},rx=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rE=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="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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rR=tQ(function(){var t,e,r,n;return t=void 0,e=void 0,r=void 0,n=function(){var t;return rA(this,function(e){switch(e.label){case 0:if((null==(t=window)?void 0:t.PassportCollector)&&(null==t?void 0:t.PassportBrowserClient))return[2,{teaCollector:t.PassportCollector,slardarBrowserClient:t.PassportBrowserClient}];return[4,tY("https://lf-ucenter-web.yhgfb-cn-static.com/obj/passport-fe/ucenter_fe/@byted/uc-secure-monitor-base/1.0.4/dist/index.umd.production.js")];case 1:return e.sent(),[2,{teaCollector:null==t?void 0:t.PassportCollector,slardarBrowserClient:t.PassportBrowserClient}]}})},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())})}),rU=function(){return(rU=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},rM=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())})},rj=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rV={params_for_special:"uc_login",hostname:null===(_=null==window?void 0:window.location)||void 0===_?void 0:_.host},rN=[],rW=[],rq=function(){setTimeout(function(){for(var t;rW.length>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;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},r0=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},r1=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>e.indexOf(n)&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)0>e.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;e<arguments.length;e++)t[e]=arguments[e];return!d&&(d=new Promise(function(e,r){h.apply(void 0,tq([],tW(t),!1)).then(function(t){e(t)}).catch(function(t){return r(t)}).finally(function(){d=void 0})})),d}),r8=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},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;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},nt=function(t){if(!t)return{};var e={},r=t;return 0===t.indexOf("?")&&(r=t.slice(1)),r.split("&").forEach(function(t){var r=r8(t.split("="),2),n=r[0],i=r[1];e[n]=decodeURIComponent(void 0===i?"":i)}),e},ne=function(t){if(!t)return nt(location.search.slice(1));var e=t.split("?");return e.length<2?{}:nt(e[e.length-1].split("#")[0])||{}},nr=function(){var t,e;return(null===(t=ne())||void 0===t?!void 0:!t.disableSystemCrypto)&&!!(null===(e=null==window?void 0:window.crypto)||void 0===e?void 0:e.subtle)},nn=function(t){var e,r,n=new Uint8Array(t.reduce(function(t,e){return t+e.byteLength},0)),i=0;try{for(var o=r7(t),a=o.next();!a.done;a=o.next()){var s=a.value;n.set(new Uint8Array(s),i),i+=s.byteLength}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},ni=function(t){return btoa(String.fromCharCode.apply(String,r9([],r8(t),!1)))},no=function(t){for(var e=atob(t),r=new Uint8Array(e.length),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},na=function(t){var e="";return t.forEach(function(t){e+=t.toString(16).padStart(2,"0")}),e},ns=function(t){if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(t);else for(var e=0;e<t.length;e++)t[e]=4294967296*Math.random()|0;return t},nc=function(t){return new Uint8Array(t.match(/.{2}/g).map(function(t){return parseInt(t,16)}))},nu=function(t){var e,r,n="";try{for(var i=r7(t),o=i.next();!o.done;o=i.next()){var a=o.value;n+=String.fromCharCode(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},nl=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())})},nf=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},nh=function(){function t(){var e=this;this.supportSystemCrypto=!1,this.cryptoJS=null,this.initPromise=Promise.resolve(!1),this.getAesKey=function(){return t.getKey()},this.init=function(){return nl(e,void 0,void 0,function(){var t;return nf(this,function(e){switch(e.label){case 0:if(nr())return[3,2];return this.supportSystemCrypto=!1,[4,r.e("84108").then(r.t.bind(r,477502,23))];case 1:return t=e.sent(),this.cryptoJS=t,[3,3];case 2:this.supportSystemCrypto=!0,e.label=3;case 3:return[2,Promise.resolve(!0)]}})})},this.encryptData=function(r,n){return nl(e,void 0,void 0,function(){var e,i;return nf(this,function(o){switch(o.label){case 0:if(e=t.getIv(),!this.supportSystemCrypto)return[3,2];return[4,this.encryptDataWithLocal(r,n,e)];case 1:case 4:return[2,o.sent()];case 2:return[4,this.initPromise];case 3:return o.sent(),i=nc(r),[4,this.encryptDataWithCryptoJS(i,n,e)]}})})},this.encryptDataWithLocal=function(r,n,i){return nl(e,void 0,void 0,function(){var e,o,a;return nf(this,function(s){switch(s.label){case 0:return[4,t.importKey(nc(r))];case 1:return e=s.sent(),o=new TextEncoder().encode(n),[4,crypto.subtle.encrypt({name:"AES-CBC",iv:i},e,o)];case 2:return[2,{cipherText:ni(nn([i,new Uint8Array(a=s.sent())])),encryptedData:ni(new Uint8Array(a)),iv:ni(i)}]}})})},this.encryptDataWithCryptoJS=function(t,r,n){return nl(e,void 0,void 0,function(){var e,i,o,a,s;return nf(this,function(c){switch(c.label){case 0:if(this.cryptoJS)return[3,2];return[4,this.initPromise];case 1:c.sent(),c.label=2;case 2:return e=this.cryptoJS.lib.WordArray.create(n),i=this.cryptoJS.lib.WordArray.create(t),o=new TextEncoder().encode(r),a=this.cryptoJS.lib.WordArray.create(o),[2,{cipherText:ni(nn([n,no(s=this.cryptoJS.AES.encrypt(a,i,{iv:e,mode:this.cryptoJS.mode.CBC,padding:this.cryptoJS.pad.Pkcs7}).ciphertext.toString(this.cryptoJS.enc.Base64))])),encryptedData:s,iv:ni(n)}]}})})},this.getTestResult=function(){return nl(e,void 0,void 0,function(){var e,r,n,i;return nf(this,function(n){switch(n.label){case 0:return e=t.getIv(),r=t.getKey(),[4,this.encryptDataWithLocal(na(r),"hello",e)];case 1:return n.sent(),[4,this.initPromise];case 2:return n.sent(),[4,this.encryptDataWithCryptoJS(r,"hello",e)];case 3:return n.sent(),[2]}})})},this.initPromise=this.init()}return t.getInstance=function(){return!this.instance&&(this.instance=new t),this.instance},t.getIv=function(t){return void 0===t&&(t=16),ns(new Uint8Array(t))},t.getKey=function(t){return void 0===t&&(t=16),ns(new Uint8Array(t))},t.importKey=function(e){return nl(void 0,void 0,void 0,function(){return nf(t,function(t){return[2,crypto.subtle.importKey("raw",e,{name:"AES-CBC"},!1,["encrypt","decrypt"])]})})},t}(),nd=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())})},np=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},nv=function(){function t(){var t=this;this.supportSystemCrypto=!1,this.JSEncrypt=null,this.initPromise=Promise.resolve(!1),this.init=function(){return nd(t,void 0,void 0,function(){var t=this;return np(this,function(e){return[2,r.e("80437").then(r.bind(r,723381)).then(function(e){return t.JSEncrypt=e.default,!0})]})})},this.encryptData=function(e,r){return nd(t,void 0,void 0,function(){var t,n;return np(this,function(i){switch(i.label){case 0:return[4,this.initPromise];case 1:if(i.sent(),!this.JSEncrypt)return[2,""];if((t=new this.JSEncrypt).setPublicKey(e),!1===(n=t.encrypt(r)))return[2,""];return[2,n]}})})},this.initPromise=this.init()}return t.getInstance=function(){return!this.instance&&(this.instance=new t),this.instance},t}(),ny=function(){return(ny=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},ng=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())})},nm=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};window.DTraitUcAesEncrypt=nh.getInstance(),window.DTraitUcRsaEncrypt=nv.getInstance(),window.DTraitUcCryptoJSUtil=T,rR();var nb=!1,nw=tQ(function(t,e){return ng(void 0,void 0,void 0,function(){var r,n;return nm(this,function(i){var o,a,s,c;switch(i.label){case 0:;o=t,a=e,r=o&&o.startsWith("http")?o:6383===a?"https://lf-douyin-pc-web.douyinstatic.com/obj/passport-fe/ucenter_fe/@byted/uc-secure-dtrait-core/".concat(o,"/dist/index.umd.production.js"):"https://lf-ucenter-web.yhgfb-cn-static.com/obj/passport-fe/ucenter_fe/@byted/uc-secure-dtrait-core/".concat(o,"/dist/index.umd.production.js"),i.label=1;case 1:;return i.trys.push([1,3,,4]),[4,(s=function(){return tY(r)},void 0===c&&(c=5),new Promise(function(t,e){var r=function(){s().then(function(e){t(e)}).catch(function(t){c-- >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;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},nW=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())})},nq=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},nF=function(t,e,r,n,i){void 0===i&&(i=!1);try{if(!e)return{needProxy:!1};var o=(t||{}).url;if(!o)return{needProxy:!1};var a=nN({},function(t){var e,r;try{var n=new URL(t,window.location.href),i=n.host,o=n.pathname,a=n.searchParams,s={};try{for(var c=nD(a.entries()),u=c.next();!u.done;u=c.next()){var l=nK(u.value,2),f=l[0],h=l[1];s[f]=h}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}return{host:i,pathname:o,urlObj:n,query:s,fullUrl:t}}catch(e){return{pathname:t}}}(o)||{}),s=a.host,c=a.pathname;if(["mcs.zijieapi.com","mon.zijieapi.com"].includes(s||""))return{needProxy:!1};var u=!1,l=!1,f=!0,h=!1,d=!0,p=void 0,v=void 0;return Object.keys(e).forEach(function(t){var r=e[t];Array.isArray(r)&&r.forEach(function(t){for(var e=t||{},r=e.excludeConsumerPathList,n=void 0===r?[]:r,o=e.providerPathList,a=void 0===o?[]:o,y=e.providerHostPathList,g=void 0===y?[]:y,m=e.onlyProviderPathList,b=void 0===m?[]:m,w=e.consumerHostList,_=void 0===w?[]:w,S=e.consumerPathList,k=void 0===S?[]:S,T=e.consumerHostPathList,C=void 0===T?[]:T,x=e.excludeReportPathList,E=void 0===x?[]:x,D=e.secTsProviderPathList,K=e.excludeSetCachePathList,P=void 0===K?[]:K,I=0;I<E.length;I++)c&&0===c.indexOf(E[I])&&(f=!1);for(var I=0;I<P.length;I++)c&&0===c.indexOf(P[I])&&(d=!1);if(i&&!h){for(var O=nV.concat(void 0===D?[]:D),I=0;I<O.length;I++)c&&0===c.indexOf(O[I])&&(h=!0)}if(n.length>0&&!v){for(var I=0;I<b.length;I++)if(c&&0===c.indexOf(n[I])){u=!1,l=!1;break}}if(b.length>0&&!p){for(var I=0;I<b.length;I++)if(c&&0===c.indexOf(b[I])){u=!0,l=!0,p=t;break}}if(g.length>0&&!p){for(var I=0;I<g.length;I++)if(s&&0==="".concat(s).concat(c).indexOf(g[I])){u=!0,l=!1,p=t;break}}if(a.length>0&&!p){for(var I=0;I<a.length;I++)if(c&&0===c.indexOf(a[I])){u=!0,l=!1,p=t;break}}if(C.length>0&&!v){for(var I=0;I<C.length;I++)if(s&&0==="".concat(s).concat(c).indexOf(C[I])){u=!0,l=!1,v=t;break}}if(_.length>0&&!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;I<k.length;I++)if(c&&0===c.indexOf(k[I])){u=!0,l=!1,v=t;break}}})}),{needProxy:u,onlyProxyResp:l,providerConfig:p,consumerConfig:v,signType:r,initType:n,pathname:c,hostname:s,needReport:f,needUpdateTs:h,needSetCache:d}}catch(t){return{needProxy:!1}}},nH=function(t,e,r,n){return nW(void 0,void 0,void 0,function(){var i,o,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,tv,ty,tg,tm,tb,tw,t_,tS,tk,tT;return nq(this,function(a){switch(a.label){case 0:if(a.trys.push([0,10,,11]),i=(t||{}).headers,o=e.crypt,!i||"string"==typeof i)return[2,Promise.resolve(t)];new Date().getTime();if(c="",u=r.needProxy,l=r.consumerConfig,f=r.providerConfig,r.url,d=r.pathname,r.hostname,y=void 0===(v=r.signType)?"pubKey":v,m=void 0===(g=r.initType)?"pubKey":g,w=void 0!==(b=r.onlyProxyResp)&&b,S=void 0===(_=r.needReport)||_,T=void 0===(k=r.needSetCache)||k,E=void 0===(x=(C=l||f||{}).scene)?"":x,K=void 0===(D=C.certType)?"header":D,P=C.signTimeout,I=!!l,!(u&&!w&&o))return[3,9];return[4,null==o?void 0:o.getKeysInfoWithOrigin({certType:K,scene:E})];case 1:return B=a.sent(),[4,null==o?void 0:o.checkSignData(B)];case 2:A=(L=a.sent()).match_md5_iframe,R=L.match_md5_local,M=(U=(null==B?void 0:B.crypt)||{}).ec_publicKey,U.ec_csr,N=(V=(null==B?void 0:B.sign)||{}).ticket,W=V.ts_sign,F=void 0===(q=V.log_id)?"":q,J=void 0===(H=V.create_time)?0:H,z=void 0===(G=V.client_cert)?"":G,X=(Z=B||{}).cert,Q=Z.b64Cert,Z.dataFrom,$=Z.b64PubKey,tt=Z.b64Csr,te=Z.getKeysInfoTime,tn=void 0,ti="0",to=null==o?void 0:o.getCookieCryptStatus();if(!N&&!W&&to&&(ti="1"),!(N&&M&&l&&d))return[3,5];if(P&&nT(P),!(ts=nC(d,N)))return[3,3];tn=ts.signStr,c=ts.algoType;return[3,5];case 3:return tu=(tc=nJ(t,N,d,(null==l?void 0:l.urlRewriteRules)||[],n)).req_content,tl=tc.sign_data,tf=tc.timestamp,Date.now(),[4,null==o?void 0:o.signWithKeysInfo({sign_data:tl,req_content:tu,timestamp:tf,certType:K,scene:E,keysInfo:B,isNewCert:nj(z)})];case 4:tn=(th=a.sent())&&th.result||"",th&&th.times,c=null==th?void 0:th.algoType,tn&&T&&nx(d,N,tn,c),a.label=5;case 5:return td={tsSign:W||"",initType:m,signType:y,b64PubKey:$,b64Cert:Q,b64Csr:tt,cert:X,algoType:c||void 0},tp=I?nM(td):nU(td),t.headers=nN(nN(nN({},t.headers),tp),{"bd-ticket-guard-version":(null==l?void 0:l.signVersion)||(null==f?void 0:f.signVersion)||2}),tv={url:d||"",ts_sign:W||"",log_id:F},tn?t.headers=nN(nN({},null==t?void 0:t.headers),{"bd-ticket-guard-client-data":tn}):n.reportLog({content:"miss request data",level:"warn",extra:tv}),new Date().getTime(),(tg=(null==o?void 0:o.getStorageStatus())||{}).isConnection,tg.retryCount,tg.startTime,tg.endTime,tg.loadTime,[4,null==o?void 0:o.getUsage()];case 6:if(a.sent(),!(o.enableSecureTimestamp&&o.secureTimestampManager))return[3,8];return[4,o.secureTimestampManager.wait()];case 7:a.sent(),a.label=8;case 8:t.extras=nN(nN({},B||{}),{scene:E,certType:K,match_md5_iframe:A,match_md5_local:R,is_pubkey_ts_sign:nB(W||""),is_new_cert:nj(X)?"1":"0",lost:ti,isPubKeyInit:"pubKey"===m?"1":"0",raw_pubkey:(M||"").replace(/\\n/g,"").replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").slice(0,64),raw_pubkey_base64:($||"").slice(.64),raw_ticket:N,raw_ts_sign:(W||"").slice(0,64),raw_cert:null==X?void 0:X.slice(0,64),gen_ticket_logid:F,gen_ticket_time:J,gen_ticket_client_cert:(z||"").slice(.64),is_equal_pub:$===(z||"").replace("pub.","")?1:0}),a.label=9;case 9:return[3,11];case 10:return tT=a.sent(),n.reportError({error:tT,name:"process request config fail"}),n.reportLog({content:"process request config fail",extra:{content:JSON.stringify(t)}}),n.reportEvent({action:"request",op:"sign",status:"fail",ctx:{path:(null==t?void 0:t.url)||""}}),[3,11];case 11:return[2,Promise.resolve(t)]}})})},nJ=function(t,e,r,n,i){try{var o=(t||{}).url;if(!o)return{req_content:"",sign_data:""};var a=Math.floor(new Date().getTime()/1e3),s=r;return n&&n.length>0&&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,"&timestamp=").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;m<g.length;m++){var b=g[m],w=new RegExp(b);if(y.match(w)){d.length>0&&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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},n0="fetch"in window,n1="Request"in window,n2="Headers"in window,n3=function(t){function e(e){var r=t.call(this)||this;return r.config={},r.updateData=!1,r.login=!1,r.initType="pubKey",r.signType="pubKey",r.nativeXMLHttpRequestOpen=window.XMLHttpRequest.prototype.open,r.nativeXMLHttpRequestSend=window.XMLHttpRequest.prototype.send,r.nativeXMLHttpRequestSetRequestHeader=window.XMLHttpRequest.prototype.setRequestHeader,r.nativeFetch=window.fetch,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.setConfig=function(t){r.config=t},r.setUpdateDataWhenVerifySuccess=function(t){r.updateData=t},r.setLogin=function(t){r.login=t},r.getBdTicketGuardHeader=function(t){return nY(r,void 0,void 0,function(){return n$(this,function(e){var r;return[2,(r={signData:t,crypt:this.params.crypt,signType:"pubKey",certType:"header"},nW(void 0,void 0,void 0,function(){var t,e,n,i,o,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;return nq(this,function(m){switch(m.label){case 0:return t=r.crypt,n=void 0===(e=r.signType)?"pubKey":e,o=void 0===(i=r.certType)?"header":i,s=(a=r.signData||{}).ticket,c=a.ts_sign,u=a.path,l=new Date().getTime(),f={},h="",[4,null==t?void 0:t.getKeysInfoWithOrigin({certType:o,scene:"web_protect"})];case 1:p=((null==(d=m.sent())?void 0:d.crypt)||{}).ec_publicKey,y=(v=d||{}).cert,g=v.b64Cert,v.dataFrom,b=v.b64PubKey,w=v.b64Csr,S=void 0===(_=v.getKeysInfoTime)?0:_;if(C=!1,x=null==t?void 0:t.getCookieCryptStatus(),E=0,!s&&!c,!(s&&p&&u))return[3,4];if(!(D=nC(u,s)))return[3,2];return k=D.signStr,h=D.algoType,C=!0,[3,4];case 2:return K=Math.floor(new Date().getTime()/1e3),P={req_content:"ticket,path,timestamp",sign_data:"ticket=".concat(s,"&path=").concat(u,"&timestamp=").concat(K),timestamp:K},E=Date.now(),[4,null==t?void 0:t.signWithKeysInfo({sign_data:P.sign_data,req_content:P.req_content,timestamp:P.timestamp,certType:o,scene:"web_protect",keysInfo:nN(nN({},d||{}),{sign:{ticket:s,ts_sign:c}})})];case 3:k=(I=m.sent())&&I.result||"",f=I&&I.times||{},h=null==I?void 0:I.algoType,k&&nx(u,s,k,h),m.label=4;case 4:return O=nM({tsSign:c||"",initType:"pubKey",signType:n,b64PubKey:b,b64Cert:g,b64Csr:w,cert:y,algoType:h||void 0}),B=nN(nN({},O),{"bd-ticket-guard-version":2,"bd-ticket-guard-iteration-version":1}),k&&(B=nN(nN({},B),{"bd-ticket-guard-client-data":k})),L=new Date().getTime(),[2,{bdTicketGuardHeaders:B,timeCollect:nN({duration:L-l||"0",signTime:E?Date.now()-E:0,getKeysInfoTime:S},f||{}),extras:{cache:C?"1":"0",server_data:k?"1":"0",algoType:h,path:u,isPubKeySign:nB(c||"")}}]}})}))]})})},r.reportEvent=function(t){r.emit("execute",t)},r.reportError=function(t){r.emit("error",t)},r.reportLog=function(t){r.emit("log",t)},r.params=e,r.monkeyPatchXMLHttpRequest(),r.monkeyPatchFetch(),r}return nQ(e,t),e.prototype.monkeyPatchXMLHttpRequest=function(){var t=this;XMLHttpRequest.prototype.open=function(){this.secureOpenArgs=arguments,t.nativeXMLHttpRequestOpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(){var e,r=this,n=this.secureOpenArgs,i=arguments,o=n[0]||"GET",a=new URL(n[1],window.location.href).toString(),s=nF({method:o,url:a,headers:{}},t.config,t.signType||"pubKey",t.initType||"pubKey",null===(e=t.params.crypt)||void 0===e?void 0:e.enableSecureTimestamp),c=s||{},u=c.needProxy,l=c.needUpdateTs;if(!u&&!l||this.__hijack_secure)return t.nativeXMLHttpRequestSend.apply(this,i);Object.defineProperty(this,"__hijack_secure",{value:!0,enumerable:!1,writable:!1});var f={},h={};if("onloadend"in this&&"function"==typeof this.onloadend){var d=this.onloadend;this.onloadend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nY(r,void 0,void 0,function(){var r,n;return n$(this,function(n){switch(n.label){case 0:if(4!==this.readyState||!("getAllResponseHeaders"in this&&"function"==typeof this.getAllResponseHeaders))return[3,2];return r=nI(this.getAllResponseHeaders()),[4,nz({config:{method:o,url:a,headers:{},extras:h},headers:r||{},reqHeaders:f},t.params,s,t.updateData,t.login,{reportEvent:t.reportEvent,reportError:t.reportError,reportLog:t.reportLog})];case 1:n.sent(),n.label=2;case 2:return[2,d.apply(this,e)]}})})}}else{var p=this.onreadystatechange;"onreadystatechange"in this&&"function"==typeof p?this.onreadystatechange=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nY(r,void 0,void 0,function(){var r,n;return n$(this,function(n){switch(n.label){case 0:if(4!==this.readyState||!("getAllResponseHeaders"in this&&"function"==typeof this.getAllResponseHeaders))return[3,2];return r=nI(this.getAllResponseHeaders()),[4,nz({config:{method:o,url:a,headers:{},extras:h},headers:r||{},reqHeaders:f},t.params,s,t.updateData,t.login,{reportEvent:t.reportEvent,reportError:t.reportError,reportLog:t.reportLog})];case 1:n.sent(),n.label=2;case 2:return[2,p.apply(this,e)]}})})}:this.onreadystatechange=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nY(r,void 0,void 0,function(){var e;return n$(this,function(r){switch(r.label){case 0:if(4!==this.readyState||!("getAllResponseHeaders"in this&&"function"==typeof this.getAllResponseHeaders))return[3,2];return e=nI(this.getAllResponseHeaders()),[4,nz({config:{method:o,url:a,headers:{},extras:h},headers:e||{},reqHeaders:f},t.params,s,t.updateData,t.login,{reportEvent:t.reportEvent,reportError:t.reportError,reportLog:t.reportLog})];case 1:r.sent(),r.label=2;case 2:return[2]}})})}}if(n.length>=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},n8="ztsdk_tcc_config",n7=function(t){var e=t.tccPsm,r=void 0===e?"ucenter.fe.ztsdk":e,n=t.zone,i=void 0===n?"default":n;return new Promise(function(t){var e;if(!window.XMLHttpRequest)return null;e=new XMLHttpRequest;e.open("get","https://lf3-config.bytetcc.com/obj/tcc-config-web/tcc-v2-data-".concat(r,"-").concat(i),!1),e.onreadystatechange=function(){if(4===e.readyState&&200===e.status)try{var r=JSON.parse(e.response).data;if(r&&Object.keys(r).length>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;r<n;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},is=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())})},ic=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},iu=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},il=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},ih=function(t){function e(e){var r,n=this;return(n=t.call(this)||this).config={},n.disableStorageProxy=!1,n.enableSecureTimestamp=!1,n.processSignCookie=function(){var t;try{var e=tF("_bd_ticket_crypt_doamin")||"",r=tF("bd_ticket_guard_client_web_domain")||"3",i=tF("_bd_ticket_crypt_cookie")?"1":"0",o=tF("__security_server_data_status")||"0",a=tF("bd_sign_version")||"0",s=(null===(t=n.cryptoSDK)||void 0===t?void 0:t.isTopBrowser())?"1":"0";return{cookieStatus:o,signVersion:a,cookieCrypt:i,isTopBrowser:s,webDomain:e||"3",webClientDomain:r}}catch(t){t instanceof Error?n._slardarSDK.throw({err:t,extra:{content:"init sign cookie error"}}):n._slardarSDK.throw({err:Error("init sign cookie error"),extra:{content:"init sign cookie error"}})}return{cookieStatus:"0",signVersion:"0",cookieCrypt:"0",isTopBrowser:"0",webDomain:"3",webClientDomain:"3"}},n.setStorageType=function(t){},n.setNextStorageEnable=function(t){void 0===t&&(t=!0),n.storageType=t?"next":void 0},n.setUpdateDataWhenVerifySuccess=function(t){n.secureProxy.setUpdateDataWhenVerifySuccess(t)},n.setDisableGenerateKey=function(t){},n.setNamespace=function(t){n._slardarSDK.setContext({namespace:t}),n.cryptoSDK.setStorageNamespace(t)},n.setAgidAndHost=function(t,e){var r=(window.location||{}).hostname;n._slardarSDK.setContext({agid:t,scope:e||r||""}),n.cryptoSDK.setAgidAndHost(t,e)},n.setDisableCrossStorage=function(t){n.cryptoSDK.setDisableCrossStorage(t)},n.setDisableStorageSignData=function(t){n.cryptoSDK.setDisableStorageSignData(t)},n.setCrossStorageURL=function(t){n.cryptoSDK.setCrossStorageURL(t)},n.setCrossStorageBackURL=function(t){n.cryptoSDK.setCrossStorageBackURL(t)},n.setLoginStatus=function(t){"boolean"==typeof t&&(n._isLogin=t?"1":"0",n.secureProxy.setLogin(t)),"function"==typeof t&&(n._isLoginPromise=t().then(function(t){return n._isLogin=t?"1":"0",t}).catch(function(t){return!1}))},n.disableTccConfig=function(t){n.disableTcc=t},n.setEnableCache=function(t){n.cryptoSDK.setEnableCache(t)},n.setEnableEcdh=function(t){n.enableEcdh=t,n.cryptoSDK.setEnableEcdh(t)},n.setEnableSecureTimestamp=function(t){t&&(n.enableSecureTimestamp=t,n.cryptoSDK.setEnableSecureTimestamp(t))},n.setDisableStorageProxy=function(t){n.disableStorageProxy=t,n.cryptoSDK.setDisableStorageProxy(t)},n.removeSecureTimestamp=function(){return n.cryptoSDK.removeSecureTimestamp()},n.startDataCollect=function(){},n.start=tQ(function(){return is(n,void 0,void 0,function(){var t,e,r=this;return ic(this,function(e){switch(e.label){case 0:if((0,C.b5)({status:"success",performance_time:null==performance?void 0:performance.now()}),this._slardarSDK.dot({name:"ticket_guard_init",metrics:{count:1,performance_time:null==performance?void 0:performance.now()},categories:{status:"success"}}),this.cryptoSDK.start().then(function(){if(r.enableSecureTimestamp&&r.cryptoSDK.secureTimestampManager){var t=function(){if(r._isLogin)return ii(r.aid)};r.cryptoSDK.secureTimestampManager.setUpdateCallback(t),Promise.resolve().then(t)}}),this._slardarSDK.setContext({storage:"next"===this.storageType?"2":"1"}),this.emit("init",{type:"bdTicket"}),this.emit("load",{action:"sdk",op:"init",status:"start"}),this.disableTcc)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,ie.getConfig({tccPsm:"ucenter.fe.ztsdk",zone:"default",key:"ztsdk_config"})];case 2:return(t=e.sent())&&this.aid&&t[this.aid]&&Array.isArray(t[this.aid])&&t[this.aid].forEach(function(t){r.setConfig(t)}),[3,4];case 3:return e.sent(),this.emit("log",{level:"error",content:"tcc config merge error",extra:{aid:this.aid||0}}),[3,4];case 4:return[2,!0]}})})}),n.setUpdateKeys=function(t){n.cryptoSDK.setUpdateKeys(t)},n.setContext=function(t){n.cryptoSDK.setContext(t)},n.setWebId=function(t,e,r){var i;null===(i=null==rB?void 0:rB._instance)||void 0===i||i.setWebId(t),(0,rL.Aq)({appId:e||1661,webId:t,config:{evtParams:{sdk_version:n4,self_platform:tZ()}}},r),n.webid=t,rZ(t),n.emit("load",{action:"sdk",op:"setwebid",status:"success"})},n.setSlardarEnv=function(t){var e;null===(e=null==rB?void 0:rB._instance)||void 0===e||e.setEnv(t)},n.setConfig=function(t){var e=t.scene,r=t.aid;if(n.aid=r,n.config){if(n.config[e]){var i=n.config[e];Array.isArray(i)?(i.push(t),n.config[e]=i):n.config[e]=[t]}else n.config[e]=[t]}else n.config={},n.config[e]=[t];n.cryptoSDK.setConfig(n.config),n.cryptoSDK.setAid(r),n.secureProxy.setConfig(n.config),n.emit("load",{action:"sdk",op:"config",status:"success"})},n.refresh=function(){return is(n,void 0,void 0,function(){return ic(this,function(t){return[2,this.cryptoSDK.refresh()]})})},n.sendEvent=function(t){var e=n.processSignCookie(),r=t.name,i=t.metrics,o=t.categories;n._slardarSDK.dot({name:r,metrics:i,categories:ia(ia(ia({},o||{}),e||{}),{loginStatus:n._isLogin})})},n.setType=function(t){n.cryptoSDK.setType(t),n.secureProxy.setType(t),(0,rL.SS)({init_type:t.initType,sign_type:t.signType}),n._slardarSDK.setContext({initType:t.initType,signType:t.signType,type:t.signType})},n.setCryptoUsage=function(t){return tu(t)},n.initStoragePlugin=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return tm.apply(void 0,il([],iu(t),!1))},n.convertBase64ToString=function(t){return(0,x.gg)(t)},n.convertStringToBase64=function(t){return(0,x.rw)(t)},n.convertHexToBase64=function(t){return(0,x.MU)(t)},n.startDTrait=function(t){var e,r,i=Date.now();return(e=ia(ia({},t||{}),{webId:n.webid,consumerPathList:il(il([],iu(t.consumerPathList||[]),!1),["/passport","/quick_login/v2","/check_qrconnect","/account_login/v2","/one_login"],!1),urlRewriteRules:il(il([],iu(t.urlRewriteRules||[]),!1),[["/quick_login/v2","/passport/sso/quick_login/v2/"],["/check_qrconnect","/passport/sso/check_qrconnect/"],["/account_login/v2","/passport/sso/account_login/v2/"],["/one_login","/passport/sso/one_login/"]],!1)}),r={slardarInstance:n._slardarSDK,teaInstance:{sendLog:rL.gp}},ng(void 0,void 0,void 0,function(){var t,n,i,o,a,s,c,u,l,f,h,d,p,v,y,g,m,b,w,_,S;return nm(this,function(k){switch(k.label){case 0:if(t=null==r?void 0:r.slardarInstance,n=null==r?void 0:r.teaInstance,o=void 0===(i=e.aid)?6383:i,s=void 0===(a=e.consumerPathList)?[]:a,u=void 0===(c=e.urlRewriteRules)?[]:c,f=void 0===(l=e.consumerHostList)?[]:l,h=e.reportAppLog,d=e.webId,v=void 0===(p=e.libraGroup)?"":p,g=void 0===(y=e.delayCollect)?0:y,b=void 0!==(m=e.useBuildIn)&&m,rF.init({appId:o,commonParams:{dTraitVersion:rY},webId:d,reportAppLog:h},{slardarInstance:t,teaInstance:n}),w={centralVersion:"",dTraitVersion:"",edgeVersion:"",urlVersion:"",centralRsaPub:"",edgeRsaPub:""},_=function(){return ng(void 0,void 0,void 0,function(){var t,r,n,i,a,s,c;return nm(this,function(s){switch(s.label){case 0:return t=Date.now(),[4,r6(o).catch(function(t){return rG({content:"[getDTraitParamsWithCache error]: ".concat(t)}),rQ})];case 1:if(w=s.sent(),r=Date.now()-t,nb)return[3,6];n=0,i=0,s.label=2;case 2:return s.trys.push([2,4,,5]),a=Date.now(),[4,nw(w.urlVersion,e.aid)];case 3:return s.sent(),n=Date.now()-a,i=1,[3,5];case 4:return s.sent(),[3,5];case 5:rJ({name:"dtrait_sdk_init",metrics:{url_duration:n,int_duration:r,performance:(null===(c=null==performance?void 0:performance.now)||void 0===c?void 0:c.call(performance))||0},categories:{dataFrom:w.dataFrom,cdn_result:i,aesEncrypt:window.DTraitUcAesEncrypt?1:0,rsaEncrypt:window.DTraitUcRsaEncrypt?1:0,cryptoJSUtil:window.DTraitUcCryptoJSUtil?1:0}}),s.label=6;case 6:return[2]}})})},S=function(){return ng(void 0,void 0,void 0,function(){var t,r,n,i;return nm(this,function(n){switch(n.label){case 0:t=Date.now(),r=0,n.label=1;case 1:if(n.trys.push([1,4,,5]),window.DTraitSDK)return[3,3];return[4,nw("1.0.31",e.aid)];case 2:n.sent(),n.label=3;case 3:return w=ny({},rQ),r=1,[3,5];case 4:return n.sent(),[3,5];case 5:return rJ({name:"dtrait_sdk_init_local",metrics:{duration:Date.now()-t,performance:(null===(i=null==performance?void 0:performance.now)||void 0===i?void 0:i.call(performance))||0},categories:{cdn_result:r,aesEncrypt:window.DTraitUcAesEncrypt?1:0,rsaEncrypt:window.DTraitUcRsaEncrypt?1:0,cryptoJSUtil:window.DTraitUcCryptoJSUtil?1:0}}),[2]}})})},!b)return[3,2];return[4,S()];case 1:return k.sent(),[3,4];case 2:return[4,_()];case 3:k.sent(),k.label=4;case 4:var T,C;return rz({centralVersion:null==w?void 0:w.centralVersion,dTraitVersion:null==w?void 0:w.dTraitVersion,edgeVersion:null==w?void 0:w.edgeVersion,urlVersion:null==w?void 0:w.urlVersion,dTraitContainerSdkVersion:rY,useBuildIn:Number(b||!1)}),T=w,C={dTraitPath:s,dTraitHost:f,urlRewriteRules:u,containerSdkVersion:rY,libraGroup:v,delayCollect:g,monitor:{sendSlardarEvent:rJ,sendSlardarLog:rG,sendTeaLog:rH}},[2,nb=(window.DTraitSDK.default||window.DTraitSDK).getInstance(T,C)]}})})).then(function(){n.emit("init",{type:"dtrait"}),(0,C.aA)({status:"success",duration:Date.now()-i,performance_time:null==performance?void 0:performance.now()}),n._slardarSDK.dot({name:"dtrait_init",metrics:{count:1,duration:Date.now()-i,performance_time:null==performance?void 0:performance.now()},categories:{status:"success"}})}).catch(function(){(0,C.aA)({status:"fail",duration:Date.now()-i,performance_time:null==performance?void 0:performance.now()}),n._slardarSDK.dot({name:"dtrait_init",metrics:{count:1,duration:Date.now()-i,performance_time:null==performance?void 0:performance.now()},categories:{status:"fail"}})}),!0},n.getBdTicketGuardHeader=function(t){return is(n,void 0,void 0,function(){return ic(this,function(e){return[2,this.secureProxy.getBdTicketGuardHeader(t)]})})},n._isLogin="-1",n._slardarSDK=new rB(n4),null===(r=n._slardarSDK)||void 0===r||r.setContext({containerVersion:(null==e?void 0:e.containerVersion)||"default",containerType:(null==e?void 0:e.containerType)||"sdk"}),n.cryptoSDK=new rO({sendEvent:n.sendEvent}),n.cryptoSDK.on("error",function(t){var e=t.error,r=t.name;n._slardarSDK.throw({err:e,extra:{content:r,origin:(null==e?void 0:e.origin)||"",login:n._isLogin}}),n.emit("error",t)}),n.cryptoSDK.on("load",function(t){var e=t.action,r=t.op,i=t.status,o=t.duration,a=t.ctx,s=t.metrics,c="load_".concat(e,"_").concat(r.toLocaleLowerCase()),u=n.processSignCookie();n._isLoginPromise?n._isLoginPromise.then(function(t){n._isLogin=t?"1":"0",n._slardarSDK.dot({name:c,metrics:ia({count:1,duration:o||0},s||{}),categories:ia(ia({satus:i,login:n._isLogin},a||{}),u)})}):n._slardarSDK.dot({name:c,metrics:ia({count:1,duration:o||0},s||{}),categories:ia(ia({satus:i,login:n._isLogin},a||{}),u)}),n.emit("load",t)}),n.cryptoSDK.on("log",function(t){var e=n.processSignCookie(),r=t||{},i=r.level,o=r.extra,a=r.content;n._slardarSDK.log({content:a,extra:ia(ia({},e||{}),o||{}),level:i}),n.emit("log",t)}),n.cryptoSDK.on("execute",function(t){var e=t.action,r=t.op,i=t.status,o=t.duration,a=t.ctx,s=t.metrics,c="execute_".concat(e,"_").concat(r.toLocaleLowerCase()),u=n.processSignCookie();n._isLoginPromise?n._isLoginPromise.then(function(t){n._isLogin=t?"1":"0",n._slardarSDK.dot({name:c,metrics:ia({count:1,duration:o||0},s||{}),categories:ia(ia({satus:i,login:n._isLogin},a||{}),u)})}):n._slardarSDK.dot({name:c,metrics:ia({count:1,duration:o||0},s||{}),categories:ia(ia({satus:i,login:n._isLogin},a||{}),u)}),n.emit("execute",t)}),n.cryptoSDK.on("ready",function(t){var e=t.action,r=t.op,i=t.status,o=t.duration,a=t.ctx,s=t.metrics,c="ready_".concat(e,"_").concat(r.toLocaleLowerCase());n._isLoginPromise?n._isLoginPromise.then(function(t){n._isLogin=t?"1":"0",n._slardarSDK.dot({name:c,metrics:ia({count:1,duration:o||0},s||{}),categories:ia({satus:i,login:n._isLogin},a||{})})}):n._slardarSDK.dot({name:c,metrics:ia({count:1,duration:o||0},s||{}),categories:ia({satus:i,login:n._isLogin},a||{})}),n.emit("execute",t)}),n.secureProxy=new n3({crypt:n.cryptoSDK}),n.secureProxy.on("error",function(t){var e=t.error,r=t.name;n._slardarSDK.throw({err:e,extra:{content:r,login:n._isLogin}}),n.emit("error",t)}),n.secureProxy.on("execute",function(t){var e=t.action,r=t.op,i=t.status,o=t.duration,a=t.ctx,s=t.extras,c=t.metrics,u="execute_".concat(e,"_").concat(r.toLocaleLowerCase()),l=n.processSignCookie();n._isLoginPromise?n._isLoginPromise.then(function(f){n._isLogin=f?"1":"0",!("sign"===r&&"response"===e)&&n._slardarSDK.dot({name:u,metrics:ia({count:1,duration:o||0},c||{}),categories:ia(ia({satus:i},a||{}),l)}),n.emit("execute",ia(ia({},t),{extras:ia({loginStatus:n._isLogin},s||{})}))}).catch(function(t){}):(!("sign"===r&&"response"===e)&&n._slardarSDK.dot({name:u,metrics:ia({count:1,duration:o||0},c||{}),categories:ia(ia({satus:i},a||{}),l)}),n.emit("execute",ia(ia({},t),{extras:ia(ia({loginStatus:n._isLogin},s||{}),l)})))}),n.secureProxy.on("log",function(t){var e=n.processSignCookie(),r=t||{},i=r.level,o=r.extra,a=r.content;n._slardarSDK.log({content:a,extra:ia(ia({},e||{}),o||{}),level:i}),n.emit("log",t)}),window.$SECURE_VERSION=n4,n}return io(e,t),e}(t_);var id=(m=function(t,e){return(m=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}m(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),ip=function(t){function e(r){var n=t.call(this,r)||this;return!e.instance&&(e.instance=n),e.instance}return id(e,t),e}(ih),iv=function(){var t=new ih;return t.on("execute",function(t){var e=t.action,r=t.op,n=t.extras,i=t.ctx,o=t.status;try{"response"===e&&"init"===r?(0,C.yh)(n,i):"iframe"===e&&"getKeys"===r?(0,C.JT)({iframe_status:"success"===o?"1":"0"}):"iframe"===e&&"check"===r?(0,C.pj)({iframe_status:"success"===o?"1":"0"}):("response"===e&&"new"===r||"cookie"===e&&"new"===r)&&(0,C.QH)(n,i)}catch(t){}}),t}},763218:function(t,e,r){"use strict";r.r(e),r.d(e,{createSecureInstance:function(){return a.P},SecureSDK:function(){return y},loadOnlineSecureSDK:function(){return m}});var n,i,o,a=r("291402"),s=r("175605"),c=r("459076"),u=r("892478"),l=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},f=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},h=function(t,e,r){if(r||2==arguments.length)for(var n,i=0,o=e.length;i<o;i++)(n||!(i in e))&&(!n&&(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},d=function(t){return new Promise(function(e,r){var n=document.createElement("script");n.type="text/javascript",n.src=t,document.getElementsByTagName("head")[0].appendChild(n),n.readyState?n.onreadystatechange=function(){("complete"===n.readyState||"loaded"===n.readyState)&&(n.onreadystatechange=null,e(!0))}:(n.onload=function(){e(!0)},n.onerror=function(t){r(t)})})},p="3.2.10",v=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]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};window.ZTCollector=s.Collector,window.ZTcreateBrowserClient=c.createBrowserClient,window.securitySDK=window.securitySDK?window.securitySDK:new a.B({containerType:"sdk",containerVersion:p});var y=window.securitySDK;null==y||y.on("execute",function(t){var e=t.action,r=t.op,n=t.extras,i=t.ctx,o=t.status;try{"response"===e&&"init"===r?(0,u.yh)(n,i):"response"===e&&"init"===r||("iframe"===e&&"getKeys"===r?(0,u.JT)({iframe_status:"success"===o?"1":"0"}):"iframe"===e&&"check"===r?(0,u.pj)({iframe_status:"success"===o?"1":"0"}):("response"===e&&"new"===r||"cookie"===e&&"new"===r)&&(0,u.QH)(n,i))}catch(t){}});var g=function(t){var e;if(!t)return Promise.resolve(!0);return(e=function(){return w(t)},function(){for(var t,r,n,i,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];return t=void 0,r=void 0,n=void 0,i=function(){return l(this,function(t){return[2,Promise.race([new Promise(function(t,e){setTimeout(function(){e(Error("init sdk timeout"))},5e3)}),e.apply(this,o)])]})},new(n||(n=Promise))(function(e,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(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(t){t(r)})).then(a,s)}c((i=i.apply(t,r||[])).next())})})().finally(function(){return Promise.resolve(!0)})};var m=(n=function(t){var e,r,n,i;return e=void 0,r=void 0,n=void 0,i=function(){var e,r,n,i,o;return v(this,function(e){switch(e.label){case 0:if(null===(r=window.ZTSDK)||void 0===r?void 0:r.SecureSDK)return[2,null===(n=window.ZTSDK)||void 0===n?void 0:n.SecureSDK];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,g(t)];case 2:case 3:return e.sent(),[3,4];case 4:if(!(null===(i=window.ZTSDK)||void 0===i?void 0:i.SecureSDK))return[2,new a.B({containerType:"sdk",containerVersion:p})];return[2,null===(o=window.ZTSDK)||void 0===o?void 0:o.SecureSDK]}})},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())})},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i?Promise.resolve(i):(!o&&(o=new Promise(function(e,r){n.apply(void 0,h([],f(t),!1)).then(function(t){t&&(i=t),e(t),o=void 0}).catch(function(t){r(t),o=void 0})})),o)}),b=function(){var t;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}catch(t){return!1}}(),w=function(t){return t.startsWith("https://")?d(t):d(b?"https://lf-ucenter-web.yhgfb-cn-static.com/obj/passport-fe/ucenter_fe/@byted/uc-secure-sdk-online/".concat(t,"/dist/latest/index.umd.production.js"):"https://lf-ucenter-web.yhgfb-cn-static.com/obj/passport-fe/ucenter_fe/@byted/uc-secure-sdk-online/".concat(t,"/dist/index.umd.production.js"))}},866985:function(t,e,r){var n=r(777296);!function(){"use strict";var e="input is invalid type",i="object"==typeof window,o=i?window:{};o.JS_MD5_NO_WINDOW&&(i=!1);var a=!i&&"object"==typeof self,s=!o.JS_MD5_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node;s?o=window:a&&(o=self);var c=!o.JS_MD5_NO_COMMON_JS&&t.exports,u="function"==typeof define&&define.amd,l=!o.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),h=[128,32768,8388608,-2147483648],d=[0,8,16,24],p=["hex","array","digest","buffer","arrayBuffer","base64"],v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),y,g=[];if(l){var m=new ArrayBuffer(68);y=new Uint8Array(m),g=new Uint32Array(m)}var b=Array.isArray;(o.JS_MD5_NO_NODE_JS||!b)&&(b=function(t){return"[object Array]"===Object.prototype.toString.call(t)});var w=ArrayBuffer.isView;l&&(o.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!w)&&(w=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var _=function(t){var r=typeof t;if("string"===r)return[t,!0];if("object"!==r||null===t)throw Error(e);if(l&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!b(t)&&!w(t))throw Error(e);return[t,!1]},S=function(t){return function(e){return new C(!0).update(e)[t]()}},k=function(t){var n,i=r(47069),a=r(413367).Buffer;return n=a.from&&!o.JS_MD5_NO_BUFFER_FROM?a.from:function(t){return new a(t)},function(r){if("string"==typeof r)return i.createHash("md5").update(r,"utf8").digest("hex");if(null==r)throw Error(e);r.constructor===ArrayBuffer&&(r=new Uint8Array(r));return b(r)||w(r)||r.constructor===a?i.createHash("md5").update(n(r)).digest("hex"):t(r)}},T=function(t){return function(e,r){return new x(e,!0).update(r)[t]()}};function C(t){if(t)g[0]=g[16]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=0,this.blocks=g,this.buffer8=y;else if(l){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function x(t,e){var r,n=_(t);if(t=n[0],n[1]){var i,o=[],a=t.length,s=0;for(r=0;r<a;++r)(i=t.charCodeAt(r))<128?o[s++]=i:(i<2048?o[s++]=192|i>>>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<a;){if(this.hashed&&(this.hashed=!1,s[0]=s[16],s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),r){if(l)for(i=this.start;o<a&&i<64;++o)(n=t.charCodeAt(o))<128?c[i++]=n:(n<2048?c[i++]=192|n>>>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<a&&i<64;++o)(n=t.charCodeAt(o))<128?s[i>>>2]|=n<<d[3&i++]:(n<2048?s[i>>>2]|=(192|n>>>6)<<d[3&i++]:(n<55296||n>=57344?s[i>>>2]|=(224|n>>>12)<<d[3&i++]:(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),s[i>>>2]|=(240|n>>>18)<<d[3&i++],s[i>>>2]|=(128|n>>>12&63)<<d[3&i++]),s[i>>>2]|=(128|n>>>6&63)<<d[3&i++]),s[i>>>2]|=(128|63&n)<<d[3&i++])}else if(l)for(i=this.start;o<a&&i<64;++o)c[i++]=t[o];else for(i=this.start;o<a&&i<64;++o)s[i>>>2]|=t[o]<<d[3&i++];this.lastByteIndex=i,this.bytes+=i-this.start,i>=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<p.length;++e){var r=p[e];t[r]=S(r)}return t}();E.md5=E,E.md5.hmac=function(){var t=T("hex");t.create=function(t){return new x(t)},t.update=function(e,r){return t.create(e).update(r)};for(var e=0;e<p.length;++e){var r=p[e];t[r]=T(r)}return t}(),c?t.exports=E:(o.md5=E,u&&define(function(){return E}))}()}}]);