aliyun-rtc-sdk 6.11.7-beta.0 → 6.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- var Oh=Object.defineProperty,Vh=Object.defineProperties;var Uh=Object.getOwnPropertyDescriptors;var Kr=Object.getOwnPropertySymbols,Hh=Object.getPrototypeOf,Sc=Object.prototype.hasOwnProperty,_c=Object.prototype.propertyIsEnumerable,zh=Reflect.get;var On=(fe,ye,we)=>ye in fe?Oh(fe,ye,{enumerable:!0,configurable:!0,writable:!0,value:we}):fe[ye]=we,Ce=(fe,ye)=>{for(var we in ye||(ye={}))Sc.call(ye,we)&&On(fe,we,ye[we]);if(Kr)for(var we of Kr(ye))_c.call(ye,we)&&On(fe,we,ye[we]);return fe},Yt=(fe,ye)=>Vh(fe,Uh(ye));var $r=(fe,ye)=>{var we={};for(var et in fe)Sc.call(fe,et)&&ye.indexOf(et)<0&&(we[et]=fe[et]);if(fe!=null&&Kr)for(var et of Kr(fe))ye.indexOf(et)<0&&_c.call(fe,et)&&(we[et]=fe[et]);return we};var A=(fe,ye,we)=>(On(fe,typeof ye!="symbol"?ye+"":ye,we),we);var Vn=(fe,ye,we)=>zh(Hh(fe),we,ye);var H=(fe,ye,we)=>new Promise((et,Qt)=>{var bt=tt=>{try{lt(we.next(tt))}catch(Rt){Qt(Rt)}},It=tt=>{try{lt(we.throw(tt))}catch(Rt){Qt(Rt)}},lt=tt=>tt.done?et(tt.value):Promise.resolve(tt.value).then(bt,It);lt((we=we.apply(fe,ye)).next())}),qr=function(fe,ye){this[0]=fe,this[1]=ye},yc=(fe,ye,we)=>{var et=(It,lt,tt,Rt)=>{try{var Ze=we[It](lt),Ii=(lt=Ze.value)instanceof qr,ji=Ze.done;Promise.resolve(Ii?lt[0]:lt).then(kt=>Ii?et(It==="return"?It:"next",lt[1]?{done:kt.done,value:kt.value}:kt,tt,Rt):tt({value:kt,done:ji})).catch(kt=>et("throw",kt,tt,Rt))}catch(kt){Rt(kt)}},Qt=It=>bt[It]=lt=>new Promise((tt,Rt)=>et(It,lt,tt,Rt)),bt={};return we=we.apply(fe,ye),bt[Symbol.asyncIterator]=()=>bt,Qt("next"),Qt("throw"),Qt("return"),bt};(function(fe,ye){typeof exports=="object"&&typeof module!="undefined"?ye(exports,require("aliyun-rts-sdk"),require("eventemitter3")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","eventemitter3"],ye):(fe=typeof globalThis!="undefined"?globalThis:fe||self,ye(fe.AliRtcEngine={},fe.AliyunRts,fe.EventEmitter))})(this,function(fe,ye,we){var uc,hc,lc,dc,fc,pc,pt,ci,Ft,Ui,xe,mc;"use strict";var et=Object.defineProperty,Qt=(s,c,e)=>c in s?et(s,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[c]=e,bt=(s,c,e)=>(Qt(s,typeof c!="symbol"?c+"":c,e),e),It={exports:{}},lt={exports:{}},tt,Rt;function Ze(){if(Rt)return tt;Rt=1,Date.now=Date.now||function(){return new Date().getTime()};var s=Date.now(),c=function(){},e=function(){var i=typeof console=="object"?console.warn:c;try{var r={warn:i};r.warn.call(r)}catch(n){return c}return i},t={noop:c,warn:e(),key:"__bl",selfErrKey:"ARMS_SDK_ERROR",selfErrPage:"ARMSSDK",win:typeof window=="object"&&window.document?window:void 0,regionMap:{cn:"https://arms-retcode.aliyuncs.com/r.png?",sg:"https://arms-retcode-sg.aliyuncs.com/r.png?",sg_2:"https://retcode-sg-lazada.arms.aliyuncs.com/r.png?",daily:"http://arms-retcode-daily.alibaba.net/r.png?",daily_2:"https://arms-retcode-daily.alibaba.net/r.png?",daily_3:"http://arms-retcode-daily.aliyun.test/r.png?",us:"https://retcode-us-west-1.arms.aliyuncs.com/r.png?",tw:"https://arms-retcode.orientalgame.com.tw/r.png?",tw_sg:"https://arms-retcode-sg.orientalgame.com.tw/r.png?",hz_finance:"https://arms-retcode-hz-finance.aliyuncs.com/r.png?"},defaultImgUrl:"https://arms-retcode.aliyuncs.com/r.png?",createObject:function(i){if(Object.create)return Object.create(i);var r=function(){};return r.prototype=i,new r},each:function(i,r){var n=0,o=i.length;if(this.T(i,"Array"))for(;n<o&&r.call(i[n],i[n],n)!==!1;n++);else for(n in i)if(r.call(i[n],i[n],n)===!1)break;return i},safetyCall:function(i,r,n){if(typeof i!="function")return n;try{return i.apply(this,r)}catch(o){return n}},T:function(i,r){var n=Object.prototype.toString.call(i).substring(8).replace("]","");return r?n===r:n},duration:function(){var i=Date;try{performance&&this.T(performance.now,"Function")&&(i=performance)}catch(n){i=Date}var r=i.now();return function(){return Math.round(i.now()-r)}},filterByRule:function(){var i=[].slice.call(arguments),r=i.length;if(r<2)return i[0];var n=i[r-1],o=i[0];if(!o)return"";if(!n)return o;var a=this,u=a.T(n),h=i.slice(0,r-1);return u==="Function"?a.safetyCall(n,h,o):u==="Array"?(this.each(n,function(g){h[0]=o=a.filterByRule.apply(a,[].concat(h,g))}),o):u==="Object"?o.replace(n.rule,n.target||""):o.replace(n,"")},ignoreByRule:function(i,r){if(!i||!r)return!1;if((this.isString(r)||r.source||this.T(r)==="Function")&&(r=[r]),!this.isArray(r))return this.warn("[arms] invalid rules of ignore config, (list of) String/RegExp/Funcitons are available"),!1;for(var n,o=[],a=0,u=r.length;a<u;a++)if(n=r[a],this.isString(n))o.push(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(n&&n.source)o.push(n.source);else if(n&&this.T(n)==="Function"&&this.safetyCall(n,[i],!1)===!0)return!0;var h=new RegExp(o.join("|"),"i");return!!(o.length&&h.test&&h.test(i))},J:function(i){if(!i||typeof i!="string")return i;var r=null;try{r=JSON.parse(i)}catch(n){}return r},pick:function(i){return i===1||Math.ceil(Math.random()*i)===1},verifyConfig:function(i){if("sample"in i){var r=i.sample,n=r;r&&/^\d+(\.\d+)?%$/.test(r)&&(n=parseInt(100/parseFloat(r))),0<n&&1>n&&(n=parseInt(1/n)),n>=1&&n<=100?i.sample=n:delete i.sample}return i},on:function(i,r,n,o,a){return i.addEventListener?(a=a||!1,i.addEventListener(r,function u(h){o&&i.removeEventListener(r,u,a),n.call(this,h)},a)):i.attachEvent&&i.attachEvent("on"+r,function u(h){o&&i.detachEvent("on"+r,u),n.call(this,h)}),this},off:function(i,r,n){return n?(i.removeEventListener?i.removeEventListener(r,n):i.detachEvent&&i.detachEvent(r,n),this):this},delay:function(i,r){return r===-1?(i(),null):setTimeout(i,r||0)},ext:function(i){for(var r=1,n=arguments.length;r<n;r++){var o=arguments[r];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(i[a]=o[a])}return i},sub:function(i,r){var n={};return this.each(i,function(o,a){r.indexOf(a)!==-1&&(n[a]=o)}),n},uu:function(){for(var i,r,n=20,o=new Array(n),a=Date.now().toString(36).split("");n-- >0;)r=(i=36*Math.random()|0).toString(36),o[n]=i%3?r:r.toUpperCase();for(var u=0;u<8;u++)o.splice(3*u+2,0,a[u]);return o.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var r=16*Math.random()|0;return(i==="x"?r:3&r|8).toString(16)})},seq:function(){return(s++).toString(36)},decode:function(i){try{i=decodeURIComponent(i)}catch(r){}return i},encode:function(i,r){try{i=r?encodeURIComponent(i).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(i)}catch(n){}return i},serialize:function(i){i=i||{};var r=[];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&i[n]!==void 0&&r.push(n+"="+this.encode(i[n],n==="msg"));return r.join("&")},checkAPI:function(i,r){if(!i||typeof i!="string")return!1;var n=/arms-retcode[\w-]*\.aliyuncs/.test(i);return!n&&r&&(n=/(alicdn\.com)|(mmstat\.com)/.test(i)),!n},checkAutoError:function(i){return!(!i||!i.message)&&!/failed[\w\s]+fetch/i.test(i.message)},cutUrlSearch:function(i){return i&&typeof i=="string"?i.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},removeUrlSearch:function(i){return i&&typeof i=="string"?i.replace(/\?.*$/,""):""},createFakeToString:function(i){return function(){return i+"() { [native code] }"}},checkSameOrigin:function(i,r){if(!r||!i)return!1;var n="//"+r.split("/")[2];return i===r||i.slice(0,r.length+1)===r+"/"||i===n||i.slice(0,n.length+1)===n+"/"||!/^(\/\/|http:|https:).*/.test(i)},getRandIP:function(){for(var i=[],r=0;r<4;r++){var n=Math.floor(256*Math.random());i[r]=(n>15?"":"0")+n.toString(16)}return i.join("").replace(/^0/,"1")},getSortNum:function(i){return i?(i+=1)>=1e3&&i<=9999?i:i<1e3?i+1e3:i%1e4+1e3:1e3},getRandNum:function(i){return i&&typeof i=="string"?i.length<5?this.getNum(5):i.substring(i.length-5):this.getNum(5)},getNum:function(i){for(var r=[],n=0;n<i;n++){var o=Math.floor(16*Math.random());r[n]=o.toString(16)}return r.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(i,r){var n=location&&location.host||"";if(!n)return"";var o=new URL(i).host;if(o===n)return"self";for(var a=0;a<r.length;a+=1)if(o.includes(r[a]))return"cdn";return"others"},parseFetchHeaders:function(i){if(!i)return{};var r={};try{if(typeof i.keys=="function")for(var n=i.keys(),o=n.next();!o.done;){var a=o.value;r[a]=i.get(a),o=n.next()}else r=i}catch(u){r={}}return r},parseXhrHeaders:function(i){if(!i&&typeof i!="string")return{};var r={};try{var n=i.split(`\r
2
- `);r=n.reduce(function(o,a){var u=a.split(": ");return o[u[0]]=u[1],o},{})}catch(o){r={}}return r},getQuerys:function(i){if(!i)return"";var r={},n=[],o="",a="";try{var u=[];if(i.indexOf("?")>=0&&(u=i.substring(i.indexOf("?")+1,i.length).split("&")),u.length>0)for(var h in u)o=(n=u[h].split("="))[0],a=n[1],r[o]=a}catch(g){r={}}return r},getURL:function(i){if(!i)return null;var r={},n=i.length,o=i.indexOf("://");if(o<0)return null;r.protocol=i.substring(0,o+1);var a=i.indexOf("#"),u=i.indexOf("?");a<0&&(a=n),u<0&&(u=a),r.search=i.substring(u,a).substring(0,1e3);var h=i.substring(o+3,u),g=h.indexOf("/");return g<0&&(g=h.length),r.domain=h.substring(0,g).split(":")[0],r.path=h.substring(g,h.length).substring(0,1e3),r},getResType:function(i,r){if(["script","img","other"].indexOf(i)>-1)return i;if(["video"].indexOf(i)>-1)return"media";if(["document","iframe"].indexOf(i)>-1)return"doc";var n=r?this.getURL(r):null,o=n&&n.path?n.path.lastIndexOf("."):-1,a=(o>0?n.path.substr(o+1):"").toLowerCase();if(a){if(["eot","woff","woff2","ttf"].indexOf(a)>-1)return"font";if(a==="css")return"css";if(a==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(i)>-1?"api":"others"},areInOrder:function(){for(var i=1;i<arguments.length;i+=1)if(arguments[i-1]>arguments[i])return!1;return!0},getFetchSnapshot:function(i,r,n){var o,a;try{var u=(i&&typeof i[0]!="string"?i[0].url:i[0])||"",h=(i&&typeof i[0]!="string"?i[0]:i[1])||{},g=h.method.toUpperCase()==="POST"?h.body:this.getQuerys(u);o={originApi:u,method:h.method||"unknown",params:g,response:r||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},a=JSON&&JSON.stringify(o)||"{}"}catch(f){a="{}"}return a},getXhrSnapshot:function(i,r,n){if(!i||!r||!n)return{};var o,a;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),o={originApi:i,method:r,params:this.getQuerys(i),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},a=JSON&&JSON.stringify(o)||"{}"}catch(h){a="{}"}return a},isRobot:function(){var i=["nuhk","googlebot/","googlebot-image","yammybot","openbot","slurp","msnbot","ask jeeves/teoma","ia_archiver","baiduspider","bingbot/","adsbot"];if(!navigator||typeof navigator.userAgent!="string")return!1;try{for(var r=navigator.userAgent.toLowerCase(),n=0;n<i.length;n++){var o=i[n];if(r.lastIndexOf(o)>=0)return!0}}catch(a){this.warn("[arms] useragent parse error")}return!1},isFunction:function(i){return typeof i=="function"},isPlainObject:function(i){return Object.prototype.toString.call(i)==="[object Object]"},isString:function(i){return Object.prototype.toString.call(i)==="[object String]"},isArray:function(i){return Object.prototype.toString.call(i)==="[object Array]"},joinRegExp:function(i){for(var r,n=[],o=0,a=i.length;o<a;o++)r=i[o],this.isString(r)?n.push(r.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):r&&r.source&&n.push(r.source);return new RegExp(n.join("|"),"i")},reWriteMethod:function(i,r,n){if(i!==null){var o=i[r];i[r]=n(o)}},checkSDKError:function(i,r){return!i&&!r?!1:new RegExp(this.selfErrKey,"i").test(i)?!0:!!this.ignoreByRule(r,[/retcode.alicdn.com\/retcode\/bl.js/,/g.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/laz-g-cdn.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/local.taobao.com:8880\/build\/bl/])},sdkError:function(i){return{msg:i,message:this.selfErrKey}},dealParam:function(i,r,n){var o={};try{o=this.isPlainObject(i)?this.ext({key:i.key||"default",val:i.val||i.value||n},i,{begin:Date.now()}):{key:i||"default",val:r||n,begin:Date.now()}}catch(a){this.warn("[retcode] baseLog error: "+a)}return o}};return tt=t,tt}var Ii={exports:{}},ji={exports:{}},kt,Un;function wc(){if(Un)return kt;Un=1;var s=Ze();return kt=function(c,e,t){typeof c=="object"&&(c=s.serialize(c));var i=e+c+(t?"&post_res=":"");window&&window.navigator&&typeof window.navigator.sendBeacon=="function"?window.navigator.sendBeacon(i,t||"&post_res="):s.warn("[arms] navigator.sendBeacon not surported")},kt}var Hn;function Ac(){if(Hn)return ji.exports;Hn=1;var s=Ze(),c=wc(),e="aokcdqn3ly@e629dabd48a9933",t=function(r,n){var o;if(n.t==="error"&&(o=r.requestQueue[0])&&o.t==="error"&&n.msg===o.msg)return n.times=o.times+1,void(r.requestQueue[0]=n);if(n.t==="behavior"){var a=r.requestQueue&&r.requestQueue.length;if(a>0&&r.requestQueue[a-1].t==="behavior"){var u=n.behavior||[];r.requestQueue[a-1].behavior.concat(u)}else r.requestQueue.push(n)}else r.requestQueue.unshift(n);return r.onReady(function(){r.requestTimmer=s.delay(function(){r.clear()},r.requestQueue[0]&&r.requestQueue[0].t==="error"?3e3:-1)}),!0},i=function(r){return this.ver="1.8.36-beta.12",this._conf=s.ext({},i.dftCon),this.sampleCache={},this.requestQueue=[],this.selfQueue=[],this.sdkFlag=!0,this.hash=s.seq(),this.resetPageview(),this.setConfig(r),this.rip=s.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};return i.dftCon={sample:1,pvSample:1,tag:"",imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",region:null,ignore:{ignoreUrls:[],ignoreApis:[],ignoreErrors:[/^Script error\.?$/],ignoreResErrors:[],ignoreResources:[/\/(bl|wl)(.debug)?.js$/]},release:void 0,environment:"prod",beforeReport:null,parseTraceId:null},i.prototype={constructor:i,onReady:function(r){return r()},getPage:function(){var r=this._conf.page;return s.safetyCall(r,[],r+"")},setPage:function(){},setConfig:function(r){r&&typeof r=="object"&&(s.verifyConfig(r),r=this.setImgUrl(r),this._conf=s.ext({},this._conf,r))},setImgUrl:function(r){var n=r.region,o=r.imgUrl;if(n){var a=s.regionMap[n];return r.imgUrl=a||s.defaultImgUrl,r}return o&&(r.imgUrl=o),r},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(r,n,o){c(r,n||this.getConfig("imgUrl"),o)},postData:function(){},commonInfo:function(){return{}},setCommonInfo:function(r){r&&typeof r=="object"&&(this._common=s.ext({},this._common,r))},resetPageview:function(){this.pageview=s.uu(),this.sBegin=Date.now()},getUsername:function(){if(this.username)return this.username;var r=this._conf,n=r&&r.setUsername;if(typeof n=="function")try{var o=n();typeof o=="string"&&(o=o.substr(0,40),this.username=o)}catch(a){s.warn("[arms] setUsername fail",a)}return this.username},getTraceId:function(){var r=this.rip,n=Date.now(),o=s.getSortNum(this.record),a=r+n+o+s.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=a,this.record=o,{"EagleEye-TraceID":a}},getUberTraceId:function(r){var n=this.rip,o=Date.now(),a=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+o+a+s.getNum(2)+u,g=h.substring(0,16);return r=r?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{"uber-trace-id":h+":"+g+":0:"+r,traceId:h}},getB3TraceId:function(r){var n=this.rip,o=Date.now(),a=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+o+a+s.getNum(2)+u,g=h.substring(0,16);return r=r?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{b3:h+"-"+g+"-"+r+"-0","X-B3-TraceId":h,"X-B3-ParentSpanId":"0","X-B3-SpanId":g,"X-B3-Sampled":r}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(r){return r?this._conf[r]:s.ext({},this._conf)},sampling:function(r){return r===1||(typeof this.sampleCache[r]=="boolean"?this.sampleCache[r]:(this.sampleCache[r]=s.pick(r),this.sampleCache[r]))},clear:function(r){var n;clearTimeout(this.requestTimmer),this.requestTimmer=null;for(var o=this._conf&&typeof this._conf.sendRequest=="function";n=this.requestQueue.pop();)if(n.t==="res")this.postData(n,"res");else if(n.t==="error")this.postData(n,"err");else if(n.t==="api")this.postData(n,"apiSnapshot");else if(n.t==="behavior")this.postData(n,"behavior");else if(n.t==="health"&&!o&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(n);else if(n.t==="resource"&&!o&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var a=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,a)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return r&&this.clearSelf(),this},clearSelf:function(){var r;for(clearTimeout(this.Timmer),this.Timmer=null;r=this.selfQueue.pop();)this.postData(r,"err");return this},_lg:function(r,n,o,a){var u=this,h=u._conf,g=u.getPage(),f=h.ignore||{},d=f.ignoreErrors,p=f.ignoreResErrors,l=f.ignoreUrls,m=f.ignoreApis;if(u._isRobot||s.ignoreByRule(g,l)||s.ignoreByRule(s.decode(g),l)||r==="error"&&(s.ignoreByRule(n.msg,d)||s.ignoreByRule(s.decode(n.msg),d))||r==="resourceError"&&(s.ignoreByRule(n.src,p)||s.ignoreByRule(s.decode(n.src),p))||r==="api"&&(s.ignoreByRule(n.api,m)||s.ignoreByRule(s.decode(n.api),m))||!u.checkImgUrl(h.imgUrl)||!n||h.disabled||!h.pid||a===0)return u;var x=n.dl;if(delete n.dl,n=s.ext({t:r,times:1,page:g,tag:h.tag||"",release:h.release||"",environment:h.environment,begin:Date.now(),c1:h.c1,c2:h.c2,c3:h.c3},n,u.commonInfo(),u._common,{pid:h.pid,_v:u.ver,pv_id:u.pageview,username:u.getUsername(),sampling:o||1,dl:x,z:s.seq()}),s.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(v){return u}return a===1?t(u,n):o&&!u.sampling(o)?u:t(u,n)},_self:function(r,n,o){var a=this,u=a._conf;if(r!=="error"||!a.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||o&&!a.sampling(o))return a;n=s.ext({t:r,times:1,page:s.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:a.ver,sampling:o||1,z:s.seq()});var h=a.selfQueue[0];if(h){h.times++;try{h.err&&n.err&&h.err.msg_raw&&n.err.msg_raw&&h.err.msg_raw.split("&").indexOf(n.err.msg_raw)<0&&h.err.msg_raw.length<1e3&&(h.err.msg_raw+="&"+n.err.msg_raw)}catch(g){}}else a.selfQueue.unshift(n),a.onReady(function(){a.sdkFlag&&(a.sdkFlag=!1,a.Timmer=s.delay(function(){a.clearSelf()},1e4))})},custom:function(r,n){if(!r||typeof r!="object")return this;var o=!1,a={begin:Date.now()};return s.each(r,function(u,h){return!(o=h&&h.length<=20)&&s.warn("[retcode] invalid key: "+h),a["x-"+h]=u,o}),o?this._lg("custom",a,n||1):this}},ji.exports=i,ji.exports}var zn;function Ec(){if(zn)return Ii.exports;zn=1;var s=Ze(),c=Ac(),e=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag","apiSnapshot","tag","c1","c2","c3"],t=function(r){var n=(r.key||"default").split("::");return n.length>1?s.ext(r,{group:n[0],key:n[1]}):s.ext(r,{group:"default_group",key:n[0]})},i=function(r){c.call(this,r);var n;try{n=typeof performance=="object"?performance.timing.fetchStart:Date.now()}catch(o){n=Date.now()}return this._startTime=n,this};return i.prototype=s.createObject(c.prototype),s.ext(c.dftCon,{startTime:null}),s.ext(i.prototype,{constructor:i,_super:c,sum:function(r,n,o){try{var a=s.dealParam(r,n,1);return this._lg("sum",t(a),o)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},avg:function(r,n,o){try{var a=s.dealParam(r,n,0);return this._lg("avg",t(a),o)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},percent:function(r,n,o,a){try{return this._lg("percent",t({key:r,subkey:n,val:o||0,begin:Date.now()}),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},msg:function(r,n){if(r&&!(r.length>180))return this.custom({msg:r},n)},error:function(r,n){if(!r)return s.warn("[retcode] invalid param e: "+r),this;arguments.length===1?(typeof r=="string"&&(r={message:r},n={}),typeof r=="object"&&(n=r=r.error||r)):(typeof r=="string"&&(r={message:r}),typeof n!="object"&&(n={}));var o=r.name||"CustomError",a=r.message||"",u=r.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(s.checkSDKError(a,n.filename)){var g=/^Script error\.?$/,f=r.msg||r.message;if(s.ignoreByRule(f,g)||s.ignoreByRule(s.decode(f),g))return this;var d={msg:s.selfErrKey,err:{msg_raw:s.encode(r.msg||r.message)}};return this._self("error",d,1)}for(var p={begin:Date.now(),cate:o,msg:a&&a.substring(0,1e3),stack:u&&u.substring(0,1e3),file:s.removeUrlSearch(n.filename||""),line:n.lineno||"",col:n.colno||"",err:{msg_raw:s.encode(a),stack_raw:s.encode(u)},dl:h},l=["tag","c1","c2","c3"],m=0;m<l.length;m++){var x=l[m];n[x]&&(p[x]=n[x])}var v=(this.getConfig("ignore")||{}).ignoreErrors;return s.ignoreByRule(p.msg,v)||s.ignoreByRule(s.decode(p.msg),v)?this:(this.beforeSend&&this.beforeSend("error",p),this._lg("error",p,1))},behavior:function(r){if(r){var n=typeof r=="object"&&r.behavior?r:{behavior:r};return this.beforeSend&&this.beforeSend("behavior",n),this._lg("behavior",n,1)}},api:function(r,n,o,a,u,h,g,f,d,p,l,m,x,v,b,w){if(!r)return s.warn("[retcode] api is null"),this;if(r=typeof r=="string"?{api:r,success:n,time:o,code:a,msg:u,begin:h,traceId:g,pv_id:f,apiSnapshot:d,domain:p,flag:m,tag:x,c1:v,c2:b,c3:w}:s.sub(r,e),!s.checkAPI(r.api,!0))return this;r.code=r.code||"";var _=r.msg||"";if(_=typeof _=="string"?_.substring(0,1e3):_,r.msg=_,r.success=r.success?1:0,r.time=+r.time,r.begin=r.begin,r.traceId=r.traceId||"",r.pv_id=r.pv_id||"",r.domain=r.domain||"",r.flag=r.flag,r.dl=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"",r.apiSnapshot&&(typeof r.apiSnapshot=="object"&&(r.apiSnapshot=JSON.stringify(r.apiSnapshot)),typeof r.apiSnapshot!="string"&&delete r.apiSnapshot,r.apiSnapshot.length>2e3&&(r.apiSnapshot=r.apiSnapshot.substring(0,2e3))),l&&(r.traceOrigin=l),!r.api||isNaN(r.time))return s.warn("[retcode] invalid time or api"),this;var C=(this.getConfig("ignore")||{}).ignoreApis;return s.ignoreByRule(r.api,C)||s.ignoreByRule(s.decode(r.api),C)?this:r.time<0?this:(this.beforeSend&&this.beforeSend("api",r),this._lg("api",r,r.success&&this.getConfig("sample"),r.flag))},speed:function(r,n,o){var a=this,u=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(r)?(n=typeof n!="number"?Date.now()-u:n>=u?n-u:n,a.speedCache=a.speedCache||{},a.speedCache[r]=n,a.speedCache.begin=u,clearTimeout(a.speedTimmer),a.speedTimmer=setTimeout(function(){o||(a.speedCache.page=a.getPage(!0)),a._lg("speed",a.speedCache),a.speedCache=null},5e3),a):(s.warn("[retcode] invalid point: "+r),a)},performance:function(r){if(r&&typeof r=="object"&&!this.hasSendPerf){var n={},o={},a=this.getConfig("autoSendPerf");if(r.autoSend&&a)return o=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",o,this.getConfig("sample"));if(r.autoSend&&!a)return delete r.autoSend,this.perfData?(o=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",o,this.getConfig("sample"))):void(this.perfData=r);for(var u in r)(/^t([1-9]|1[0])$/.test(u)||u==="ctti"||u==="cfpt")&&(n[u]=r[u]);if(r.autoSend===!0||!a&&(a||this.perfData))return r.autoSend!==!0&&a===!1&&this.perfData?(n=s.ext(this.perfData||{},n),this.hasSendPerf=!0,this._lg("perf",n,this.getConfig("sample"))):void 0;this.perfData=s.ext(this.perfData||{},n)}},resource:function(r,n){if(!r||!s.isPlainObject(r))return s.warn("[arms] invalid param data: "+r),this;var o=Object.keys(r),a=["begin","dom","load","res","dl"],u=!1;for(var h in a)if(o.indexOf(a[h])<0){u=!0;break}if(u)return s.warn("[arms] lack param data: "+r),this;var g={begin:r.begin||Date.now(),dom:r.dom||"",load:r.load||"",res:s.isArray(r.res)?JSON.stringify(r.res):JSON.stringify([]),dl:r.dl||""};return this._lg("res",g,n)},event:function(r,n){if(typeof r=="object"&&r&&r.key){var o={},a=["key","success","time","c1","c2","c3"];for(var u in r)a.indexOf(u)>-1&&(o[u]=r[u]);o.success=r.success===!1?0:1,this._lg("event",o,n)}}}),i._super=c,i._root=c,c.Reporter=i,Ii.exports=i,Ii.exports}var Gr={exports:{}},jn;function Cc(){if(jn)return Gr.exports;jn=1;var s=Ze(),c=typeof window=="object"?window:{},e="catch",t=c.__oFetch_||c.fetch;return t=typeof t=="function"?t:void 0,Gr.exports=function(i,r){var n=-1;typeof i=="object"&&(n=i.z,i=s.serialize(i));var o=r+i;if(t)return t(o,{method:"HEAD",mode:"no-cors"})[e](s.noop);if(c.document&&c.document.createElement){var a="__request_hold_"+n,u=c[a]=new Image;u.onload=u.onerror=function(){c[a]=void 0},u.src=o,u=null}},Gr.exports}var Jr={exports:{}},Wn;function Ic(){if(Wn)return Jr.exports;Wn=1;var s=Ze(),c=typeof window=="object"?window:{},e=c.__oXMLHttpRequest_||c.XMLHttpRequest;return e=typeof e=="function"?e:void 0,Jr.exports=function(t,i){try{var r=new e;r.open("POST",i,!0),r.setRequestHeader("Content-Type","text/plain"),r.send(JSON.stringify(t))}catch(n){s.warn(`[retcode] Failed to log, exception is :
3
- `+n)}},Jr.exports}var Xr,Kn;function Rc(){if(Kn)return Xr;Kn=1;var s=Ze();return Xr=function(c,e){var t=[],i=null,r=e&&e.location&&e.location.href,n=void 0,o=null,a=function(f,d,p){if(f!==null){var l=f[d];f[d]=p(l)}},u=function(f){var d,p,l,m,x,v=[];if(!f||typeof f.tagName!="string")return"";if(v.push(f.tagName.toLowerCase()),typeof f.id=="string"&&v.push("#".concat(f.id)),typeof(d=f.className)=="string")for(p=d.split(/\s+/),x=0;x<p.length;x++)v.push(".".concat(p[x]));var b=["type","name","title","alt","data-arms-attr"];for(x=0;x<b.length;x++)l=b[x],typeof(m=f.getAttribute(l))=="string"&&v.push("[".concat(l,'="').concat(m,'"]'));return v.join("")},h=function(f,d){return function(p){if(p&&p!==o){o=p;var l;try{l=p.target}catch(x){l="<unknown>"}if(l.length!==0){var m={type:"ui.".concat(f),data:{message:function(x){if(!x||x.nodeType!==1)return"";for(var v=x||null,b=[],w=0,_=0,C=3,E="";v&&w++<5&&!((E=u(v))==="html"||w>1&&_+b.length*C+E.length>=80);)b.push(E),_+=E.length,v=v.parentNode;return b.reverse().join(" > ")}(l)},timestamp:Date.now()};f==="click"?i&&i.addBehavior(m):f==="keypress"&&(n||i&&i.addBehavior(m),clearTimeout(n),n=setTimeout(function(){n=void 0},100))}}}},g=function(){if(function(){var l=e&&e.chrome,m=l&&l.app&&l.app.runtime,x="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!m&&x}()){var f=function(l,m){var x={type:"navigation",data:{from:l,to:m}};i&&i.addBehavior(x),r=m},d=e.onpopstate;e.onpopstate=function(){for(var l=arguments.length,m=new Array(l),x=0;x<l;x++)m[x]=arguments[x];var v=e.location.href;if(f(r,v),d)return d.apply(this,m)};var p=function(l){return function(){for(var m=arguments.length,x=new Array(m),v=0;v<m;v++)x[v]=arguments[v];var b=x.length>2?x[2]:void 0;return b&&f(r,String(b)),l.apply(this,x)}};a(e.history,"pushState",p),a(e.history,"replaceState",p)}};s.ext(c.prototype,{addBehavior:function(f){if(this.getConfig("behavior")&&f&&typeof f=="object"){var d={},p=f.data||{};if(f.type)d=p;else{if(typeof p.name!="string"||typeof p.message!="string")return;d.name=p.name.substr(0,20),d.message=p.message.substr(0,200)}d.message&&(d.message=s.encode(d.message));var l={type:f.type||"custom",data:d||{},timestamp:f.timestamp||Date.now(),page:f.page||e&&e.location&&e.location.pathname};return t.push(l),t=t.slice(-100)}},getBehavior:function(){return t||[]},setBehavior:function(f){return f&&(t=f),t},reportBehavior:function(f){var d=this;d.getConfig("behavior")&&(d.sendBhTimer&&(clearTimeout(d.sendBhTimer),d.sendBhTimer=void 0),d.sendBhTimer=setTimeout(function(){t&&t.length>0&&(d.behavior(t),t=[],d.sendBhTimer=void 0,f&&typeof f=="function"&&f())},0))},initBehavior:function(){if(!this.hasInitBehavior&&!i){try{(function(){if(document&&document.referrer&&document.location){var d=document.referrer,p=document.location.href;if(d!==""){var l={type:"navigation",data:{from:d,to:p}};r=p,i&&i.addBehavior(l)}}})(),e&&e.document&&e.document.addEventListener&&(e.document.addEventListener("click",h("click"),!1),e.document.addEventListener("keypress",h("keypress"),!1)),g();var f=this.getConfig("enableConsole");f&&function(d){if(e&&e.console){var p=["debug","info","warn","log","error","assert"];s.isArray(d)&&(p=d);for(var l=0;l<p.length;l++){var m=p[l];m&&s.isString(m)&&e.console[m]&&typeof e.console[m]=="function"&&a(e.console,m,function(x){var v=m;return function(){for(var b=arguments.length,w=new Array(b),_=0;_<b;_++)w[_]=arguments[_];var C={type:"console",data:{level:v,message:w}};if(i&&i.addBehavior(C),v==="error")for(var E=0;E<w.length;E++){var I=w[E];I&&I.message&&I.stack&&i&&i.errorHandler(new ErrorEvent("error",{error:I,message:I.message}))}x&&Function.prototype.apply.call(x,e.console,w)}})}}}(f)}catch(d){s.warn("[arms] error in initBehavior",d)}i=this,this.hasInitBehavior=!0}return this}})},Xr}var $n={},qn;function Zr(){return qn||(qn=1,$n.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),$n}var Yr,Gn;function kc(){if(Gn)return Yr;Gn=1;var s=Ze(),c=Zr(),e=c.TIMING_KEYS;return Yr=function(){var t=s.win||{},i=t.performance;if(!i||typeof i!="object"||typeof i.getEntriesByType!="function")return null;var r={},n=i.timing||{},o=i.getEntriesByType("resource")||[];if(r.begin=n[e[1]]||Date.now(),typeof t.PerformanceNavigationTiming=="function"){var a=i.getEntriesByType("navigation")[0];a&&(n=a)}return s.each({dom:[10,8],load:[14,1]},function(u,h){var g=n[e[u[1]]],f=n[e[u[0]]];if(g>0&&f>0){var d=Math.round(f-g);d>=0&&d<6e5&&(r[h]=d)}}),r.res=JSON.stringify(o),r},Yr}var Qr,Jn;function Tc(){if(Jn)return Qr;Jn=1;var s=Ze(),c=Zr(),e=c.TIMING_KEYS;return Qr=function(){var t=s.win||{},i=t.performance;if(!i||typeof i!="object")return null;var r={},n=i.timing||{},o=Date.now(),a=1;if(typeof t.PerformanceNavigationTiming=="function"){var u=i.getEntriesByType("navigation")[0];u&&(n=u,a=2)}s.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(p,l){var m=n[e[p[1]]],x=n[e[p[0]]];if(a===2||m>0&&x>0){var v=Math.round(x-m);v>=0&&v<6e5&&(r[l]=v)}});var h=t.navigator.connection,g=i.navigation||{};r.ct=h?h.effectiveType||h.type:"";var f=h&&(h.downlink||h.downlinkMax||h.bandwidth)||null;if((f=f>999?999:f)&&(r.bandwidth=f),r.navtype=g.type===1?"Reload":"Other",a===1&&n[e[16]]>0&&n[e[1]]>0){var d=n[e[16]]-n[e[1]];d>=0&&d<36e5&&(r.fpt=d)}return a===1&&n[e[1]]>0?r.begin=n[e[1]]:a===2&&r.load>0?r.begin=o-r.load:r.begin=o,r},Qr}var Xn,Zn;function Dc(){return Zn||(Zn=1,Xn=function(s,c,e){var t=Ze(),i=kc(),r=Tc(),n=null,o=e.documentElement,a=c.innerWidth||o.clientWidth||e.body.clientWidth,u=c.innerHeight||o.clientHeight||e.body.clientHeight,h=c.navigator.connection,g={sr:screen.width+"x"+screen.height,vp:a+"x"+u,ct:h?h.effectiveType||h.type:""},f={},d=function(l,m,x,v,b){if(m===void 0){var w,_;if(!f[l]){w=new RegExp(l+"=([^;]+)");try{_=w.exec(e.cookie)}catch(E){return t.warn("[retcode] can not get cookie:",E),null}_&&(f[l]=_[1])}return f[l]}var C=l+"="+m;C+="; path=/",x&&(C+="; max-age="+x);try{return e.cookie=C,!!e.cookie}catch(E){return t.warn("[retcode] can not set cookie: ",E),!1}},p=function(l){var m=l._conf.uid||d("_nk_")||d("_bl_uid");return!m&&(m=t.uu(),!d("_bl_uid",m,15552e3))?null:m};return t.ext(s.prototype,{activeErrHandler:function(l){return n&&!l?this:(n=this,this)},errorHandler:function(l){if(!l)return this;var m=l.type;if(m==="error"){var x=l.target||l.srcElement;!x||!x.tagName||l.message||l.filename||l.lineno||l.colno?this.error(l.error||{message:l.message},l):this.resourceErrorHandler(l)}else m==="unhandledrejection"&&t.T(l.reason,"Error")&&t.checkAutoError(l.reason)&&this.error(l.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(v){}return this},resourceErrorHandler:function(l){var m=this,x=l.target||l.srcElement;try{var v=m.getSrc(x),b=typeof x.tagName=="string"?x.tagName.toLowerCase():"",w=m.getXPath(x,5),_=t.getURL(v),C={src:v&&v.substring(0,1e3),node_name:b,xpath:w,res_type:t.getResType(b,v),res_name:_.path,domain:_.domain};return m._conf.enableResource&&m.fixResourceStatus&&l.timeStamp&&m.fixResourceStatus({src:v,node_name:b,res_type:t.getResType(b,v),timeStamp:l.timeStamp,domain:_.domain}),m._lg("resourceError",C),m}catch(E){return t.warn("[ARMS] resourceErrorHandler error :",E),m}},getSrc:function(l){var m=l.src||l.href;try{if(!m){var x=(typeof l.tagName=="string"?l.tagName.toLowerCase():"")==="object",v=l.getAttribute("classid")&&l.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||l.getAttribute("type")==="application/x-shockwave-flash";x&&v&&(m=l.getAttribute("data")||l.getAttribute("codebase")),m||(m=l.outerHTML||l.innerHTML)}}catch(b){m=""}return m},getXPath:function(l,m){var x=l.id?"#"+l.id:"",v=typeof l.className=="string"?"."+l.className.split(" ").join("."):"",b=(typeof l.tagName=="string"?l.tagName.toLowerCase():"")+x+v;return l.parentNode&&l.parentNode.tagName&&m-1!=0?this.getXPath(l.parentNode,m-1)+" > "+b:b},sendPerformance:function(l){var m=this;m.onReady(function(){var x=r();x&&x.load&&x.load>0&&(x.page=m.getPage(!0),l&&(x=t.ext(x,l)),x.autoSend=!0,m.performance(x))})},sendResources:function(l){var m=this;m.onReady(function(){var x=i();x&&x.load&&x.load>0&&(x.load&&x.load<=2e3||x.load&&x.load<=8e3&&Math.random()>.05||(x.page=m.getPage(!0),x.dl=location.href,l&&(x=t.ext(x,l)),m._lg("res",x,m.getConfig("sample"))))})},sendPV:function(){var l=this;l.onReady(function(){var m=function(x){var v=p(x),b=c.devicePixelRatio||1;return{uid:v,dt:e.title,dl:location.href,dr:e.referrer,dpr:b.toFixed(2),de:(e.characterSet||e.defaultCharset||"").toLowerCase(),ul:o.lang,begin:Date.now()}}(l);m&&m.uid&&l._lg("pv",m,l.getConfig("pvSample"))})},commonInfo:function(){return g.uid=p(this),g.sid=function(l){if(l.session)return l.session;var m;try{if(typeof window=="object"&&typeof sessionStorage=="object"&&typeof sessionStorage.getItem=="function")return typeof(m=sessionStorage.getItem("_bl_sid"))=="string"?(l.session=m,m):(m=t.uu(),l.session=m,typeof sessionStorage.setItem=="function"&&sessionStorage.setItem("_bl_sid",m),m)}catch(x){t.warn("[ARMS] getSid error :",x)}return l.session=m=t.uu(),m}(this),g},handleUnload:function(l){var m=Date.now();if(m-this._lastUnload<200)return this;this._lastUnload=m,this.sendHealth(l),this.speedCache&&(this._lg("speed",this.speedCache),this.speedCache=null,clearTimeout(this.speedTimmer)),this._conf&&this._conf.enableResource&&this.resourceComboReport(),this.clear(!0)},bindHashChange:function(l){var m=this;if(!l^m.hashChangeHandler)return m;l?(m.hackHistoryState(),m.hashChangeHandler=function(x){var v=m._conf.parseHash(location.hash);v&&m.setPage(v,x!==!1)},m.stateChangeHandler=function(x){var v=m._conf.parseHash(x.detail);v&&m.setPage(v)},t.on(c,"hashchange",m.hashChangeHandler),t.on(c,"historystatechange",m.stateChangeHandler),m.hashChangeHandler(!1)):(t.off(c,"hashchange",m.hashChangeHandler),t.off(c,"historystatechange",m.stateChangeHandler),m.hashChangeHandler=null,m.stateChangeHandler=null)},initHandler:function(){var l=this;if(l.hasInitHandler)return l;var m=l._conf;return t.on(c,"beforeunload",function(){l.handleUnload(0)}),l.bindHashChange(m.enableSPA),l.activeErrHandler(!1),l.hasInitHandler=!0,l}}),t.on(c,"error",function(l){n&&n.errorHandler(l)},!1,!0).on(c,"unhandledrejection",function(l){n&&n.errorHandler(l)}),s}),Xn}var es,Yn;function Bc(){if(Yn)return es;Yn=1;var s=Ze(),c=500;return es=function(e,t,i){function r(g,f,d){var p=0,l=g.tagName;if(l!=="SCRIPT"&&l!=="STYLE"&&l!=="META"&&l!=="HEAD"){var m=g.children?g.children.length:0;if(m>0)for(var x=g.children,v=m-1;v>=0;v--)p+=r(x[v],f+1,p>0);if(p<=0&&!d&&!(g.getBoundingClientRect&&g.getBoundingClientRect().top<o))return 0;p+=1+.5*f}return p}function n(g){for(var f=1;f<g.length;f++)if(g[f].score<g[f-1].score)return g.splice(f,1),n(g);return g}var o=t.innerHeight||0,a=[],u=null,h=0;s.ext(e.prototype,{initFmpObserver:function(g){var f=this;if(!f._conf||!f._conf.useFmp)return null;if(!t.MutationObserver)return s.warn("[retcode] first meaningful paint can not be retrieved"),f.sendPerformance(),null;s.on(t,"beforeunload",function(){f.endObserving(0,!0)});var d=t.MutationObserver;return(u=new d(function(){(function(p){var l=Date.now()-p,m=i.querySelector("body");if(m){var x=0;x+=r(m,1,!1),a.push({score:x,t:l})}else a.push({score:0,t:l})})(f._startTime)})).observe(document,{childList:!0,subtree:!0}),h=1,f.onReady(function(){f.endObserving(g)}),u},endObserving:function(g,f){var d=this;if(u&&h)if(d.fmpTimmer&&(clearTimeout(d.fmpTimmer),d.fmpTimmer=null),f||!function(x,v){var b=Date.now()-x;return!(b>v||b-(a&&a.length&&a[a.length-1].t||0)>2*c)}(d._startTime,g)){u.disconnect(),h=0,a=n(a);for(var p=null,l=1;l<a.length;l++)if(a[l].t>=a[l-1].t){var m=a[l].score-a[l-1].score;(!p||p.rate<=m)&&(p={t:a[l].t,rate:m})}p&&p.t>0&&p.t<36e5?d.sendPerformance({fmp:p.t}):d.sendPerformance()}else d.fmpTimmer=s.delay(function(){d.endObserving(g)},c)}})},es}var Qn,ea;function Pc(){return ea||(ea=1,Qn=function(s,c){var e=Ze(),t=null,i=e.getCurDomain(),r=function(h,g,f,d,p,l,m,x,v,b,w,_,C){var E=e.J(p)||null,I=e.safetyCall(g,[E,d],null);if(!I)return!1;var L=I.code||l,k=!("success"in I)||I.success;h.api(f,k,m,L,I.msg,x,v,b,k?{}:w,i,_,C)},n="fetch",o="__oFetch_",a="__oXMLHttpRequest_",u="XMLHttpRequest";return e.ext(s.prototype,{removeHook:function(h,g){return t&&(g||this===t)?(c[o]&&(c[n]=c[o],delete c[o]),c[a]&&(c[u]=c[a],delete c[a]),t=null,this):this},addHook:function(h){return!h&&t?this:(t||(function(){if(typeof c[n]=="function"){var g=c[n];c[o]=g,c[n]=function(f,d){var p=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),l=t;if(!l||!l.api||d&&(d.method==="HEAD"||d.mode==="no-cors"))return g.apply(c,p);d||(d={});var m=Date.now(),x=l._conf,v=e.duration(),b=(f&&typeof f!="string"?f.url:f)||"",w=b;b=e.cutUrlSearch(b);var _=(x.ignore||{}).ignoreApis,C=x.parseTraceId;if(!e.checkAPI(b,!0)||e.ignoreByRule(b,_))return g.apply(c,p);b=e.filterByRule(b,w,x.ignoreApiPath?x.ignoreApiPath:x.apiHelper);var E=x.enableLinkTrace,I="",L="",k=l.getConfig("pid"),N=null,R=l.getConfig("sample"),M=l.getConfig("linkType"),y=1;if(R&&!l.sampling(R)&&(y=0),E){var V="";try{V=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(K){V=""}var Q=e.checkSameOrigin(w,V);if(l.getConfig("enableApiCors")||Q)if(f&&typeof f!="string")try{if(p[0].headers&&typeof p[0].headers.get=="function"&&typeof p[0].headers.append=="function")switch(M){case"arms":var q=p[0].headers.get("EagleEye-TraceID"),ne=p[0].headers.get("EagleEye-SessionID"),$=p[0].headers.get("EagleEye-pAppName");q?I=q:(I=l.getTraceId()["EagleEye-TraceID"],p[0].headers.append("EagleEye-TraceID",I)),ne?L=ne:(L=l.getPageviewId()["EagleEye-SessionID"],p[0].headers.append("EagleEye-SessionID",L)),$||p[0].headers.append("EagleEye-pAppName",k);break;case"b3":var ie=p[0].headers.get("X-B3-TraceId");if(ie)I=ie;else{var D=l.getB3TraceId(y);p[0].headers.append("X-B3-TraceId",D["X-B3-TraceId"]),p[0].headers.append("X-B3-ParentSpanId",D["X-B3-ParentSpanId"]),p[0].headers.append("X-B3-SpanId",D["X-B3-SpanId"]),p[0].headers.append("X-B3-Sampled",D["X-B3-Sampled"]),p[0].headers.append("X-Request-ID",e.guid()),I=D["X-B3-TraceId"]}L=l.pageview;break;case"tracing":default:var B=p[0].headers.get("uber-trace-id");B?I=B.split(":")[0]:(B=l.getUberTraceId(y),p[0].headers.append("uber-trace-id",B["uber-trace-id"]),I=B.traceId),L=l.pageview}}catch(K){e.warn(`[retcode] fetch failed to set header, exception is :
4
- `+K)}else switch(d.headers=d.headers?d.headers:{},M){case"arms":d.headers["EagleEye-TraceID"]?I=d.headers["EagleEye-TraceID"]:(I=l.getTraceId()["EagleEye-TraceID"],d.headers["EagleEye-TraceID"]=I),d.headers["EagleEye-SessionID"]?L=d.headers["EagleEye-SessionID"]:(L=l.getPageviewId()["EagleEye-SessionID"],d.headers["EagleEye-SessionID"]=L),d.headers["EagleEye-pAppName"]||(d.headers["EagleEye-pAppName"]=k);break;case"b3":if(d.headers["X-B3-TraceId"])I=d.headers["X-B3-TraceId"];else{var z=l.getB3TraceId(y);d.headers["X-B3-TraceId"]=z["X-B3-TraceId"],d.headers["X-B3-ParentSpanId"]=z["X-B3-ParentSpanId"],d.headers["X-B3-SpanId"]=z["X-B3-SpanId"],d.headers["X-B3-Sampled"]=z["X-B3-Sampled"],d.headers["X-Request-ID"]=e.guid(),I=z["X-B3-TraceId"]}L=l.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(d.headers["uber-trace-id"])I=d.headers["uber-trace-id"].split(":")[0];else{var O=l.getUberTraceId(y);d.headers["uber-trace-id"]=O["uber-trace-id"],I=O.traceId}L=l.getPageviewId()["EagleEye-SessionID"]}}return g.apply(c,p).then(function(K){if(!l||!l.api)return K;try{if(!K||typeof K.clone!="function")return K;var be=K.clone(),he=be.headers;if(he&&typeof he.get=="function"){var re=he.get("content-type");if(re&&!/(text)|(json)/.test(re))return K;if(!I){var Ae=e.parseFetchHeaders(he);typeof Ae=="object"&&Ae["eagleeye-traceid"]&&(I=Ae["eagleeye-traceid"],N="response")}}var Le=v();return be.text().then(function(Pe){if(!I&&e.isFunction(C)){var We=C(be,Pe);We&&e.isString(We)&&(I=We)}var Oe=e.getFetchSnapshot(p,Pe,he);be.ok?r(l,x.parseResponse,b,w,Pe,be.status||200,Le,m,I,L,Oe,N,y):(l.api(b,!1,Le,be.status||404,be.statusText,m,I,L,Oe,i,N,y),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:be.url,res_type:"api"}))}),K}catch(Pe){return e.warn("[ARMS] fetch response error :",Pe),K}}).catch(function(K){if(!l||!l.api)throw K;var be=v();throw l.api(b,!1,be,K.name||"Error",K.message,m,I,L,{},i),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:w,res_type:"api"}),K})},c[n].toString=e.createFakeToString(n)}}(),function(){if(typeof c[u]=="function"){var g,f=c[u];c[a]=f;var d=function(p){var l=new f(p),m=t;if(!m||!m.api||!l.addEventListener)return l;var x,v,b,w,_=l.send,C=l.open,E=l.setRequestHeader,I=m._conf,L=(I.ignore||{}).ignoreApis,k=I.parseTraceId,N=m.getConfig("enableLinkTrace"),R="",M="",y="",V=null,Q=m.getConfig("sample"),q=m.getConfig("linkType"),ne=1;return Q&&!m.sampling(Q)&&(ne=0),l.open=function($,ie){g=$;var D=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);C.apply(l,D),w=ie||"",b=e.cutUrlSearch(w);var B=!e.checkAPI(b,!0)||e.ignoreByRule(b,L);if(b=b?e.filterByRule(b,w,I.ignoreApiPath?I.ignoreApiPath:I.apiHelper):"",!B&&N){var z="";try{z=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(he){z=""}var O=e.checkSameOrigin(w,z);if((m.getConfig("enableApiCors")||O)&&E&&typeof E=="function")switch(q){case"arms":R=m.getTraceId()["EagleEye-TraceID"],E.apply(l,["EagleEye-TraceID",R]),M=m.getPageviewId()["EagleEye-SessionID"],E.apply(l,["EagleEye-SessionID",M]),y=m.getConfig("pid"),E.apply(l,["EagleEye-pAppName",y]);break;case"b3":var K=m.getB3TraceId(ne);E.apply(l,["X-B3-TraceId",K["X-B3-TraceId"]]),E.apply(l,["X-B3-ParentSpanId",K["X-B3-ParentSpanId"]]),E.apply(l,["X-B3-SpanId",K["X-B3-SpanId"]]),E.apply(l,["X-B3-Sampled",K["X-B3-Sampled"]]),E.apply(l,["X-Request-ID",e.guid()]),R=K["X-B3-TraceId"],M=m.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var be=m.getUberTraceId(ne);E.apply(l,["uber-trace-id",be["uber-trace-id"]]),R=be.traceId,M=m.getPageviewId()["EagleEye-SessionID"]}}},l.send=function(){x=Date.now(),v=e.duration();var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);_.apply(l,$)},e.on(l,"readystatechange",function(){if(b&&l.readyState===4){var $=v(),ie=e.getXhrSnapshot(w,g,l);if(!R){var D=e.parseXhrHeaders(typeof l.getAllResponseHeaders=="function"&&l.getAllResponseHeaders()||"");typeof D=="object"&&D["eagleeye-traceid"]&&(R=D["eagleeye-traceid"],V="response")}if(!R&&e.isFunction(k)){var B=k(l);B&&e.isString(B)&&(R=B)}if(l.status>=200&&l.status<=299){var z=l.status||200;if(typeof l.getResponseHeader=="function"){var O=l.getResponseHeader("Content-Type");if(O&&!/(text)|(json)/.test(O))return}l.responseType&&l.responseType!=="text"?m.api(b,!0,$,z,"",x,R,M,{},i,V,ne):r(m,I.parseResponse,b,w,l.responseText,z,$,x,R,M,ie,V,ne)}else m.api(b,!1,$,l.status||"FAILED",l.statusText,x,R,M,ie,i,V,ne),I.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:l.responseURL||w,res_type:"api"})}}),l};d.prototype=f.prototype,e.each(Object.keys(f),function(p){d[p]=f[p]}),c[u]=d,c[u].toString=e.createFakeToString(u)}}()),t=this,this)},initHook:function(){return this.hasInitHook?this:(this.getConfig("disableHook")||this.addHook(),this.hasInitHook=!0,this)}}),s}),Qn}var ta,ia;function Lc(){return ia||(ia=1,ta=function(s,c){var e=Ze(),t=c.history||{},i=c.document,r=function(o,a){var u;c.CustomEvent?u=new CustomEvent(o,{detail:a}):((u=i.createEvent("HTMLEvents")).initEvent(o,!1,!0),u.detail=a),c.dispatchEvent(u)},n=function(o){var a=t[o];typeof a=="function"&&(t[o]=function(u,h,g){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),d=location.href,p=a.apply(t,f);if(!g||typeof g!="string"||g===d)return p;try{var l=d.split("#"),m=g.split("#"),x=e.cutUrlSearch(l[0]),v=e.cutUrlSearch(m[0]),b=l[1]&&l[1].replace(/^\/?(.*)/,"$1"),w=m[1]&&m[1].replace(/^\/?(.*)/,"$1");b!==w?r("historystatechange",w):x!==v&&r("historystatechange",v)}catch(_){e.warn("[retcode] error in "+o+": "+_)}return p},t[o].toString=e.createFakeToString(o))};e.ext(s.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),ta}var ts,ra;function Mc(){if(ra)return ts;ra=1;var s=Ze(),c=Zr(),e=c.TIMING_KEYS;return ts=function(t,i){function r(a,u,h){if(a instanceof i.PerformanceResourceTiming&&a.initiatorType){var g=s.getResType(a.initiatorType,a.name),f=u.resourceTypes||[],d=(u.ignore||{}).ignoreResources;if(g&&f.includes(g)&&!s.ignoreByRule(a.name,d)&&!s.ignoreByRule(s.decode(a.name),d)){var p=a[e[0]],l=a[e[1]],m=a[e[2]],x=a[e[3]],v=a[e[4]],b=a[e[5]],w=a[e[6]],_=a[e[7]],C=a[e[8]],E=a[e[18]],I=a[e[19]];if(!h.has(a)&&(!s.areInOrder(p,l,m,x,v,b,w,_,C)||p>_))return;if(E<p&&(E=p),I<p&&(I=l),s.areInOrder(p,E,I,l))return{domain:s.getURL(a.name).domain,res_type:g,src_type:s.getSrcType(a.name,u.cdnHostList),success:1,size:Math.round(a.decodedBodySize),duration:Math.round(a.duration),timeStamp:a.responseEnd,timing:a}}}}var n="_resource-"+Date.now(),o="_resource_error-"+Date.now();s.ext(t.prototype,{initResource:function(){var a=this,u=i.performance,h=i.PerformanceObserver;if(a[o]||(a[o]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var g=u.getEntriesByType("resource")||[];return setTimeout(function(){a.setResource(g)},10),new h(function(f){setTimeout(function(){a.setResource(f.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(a.resourceComboReport.bind(a),5e3)}),a},setResource:function(a){var u=this._conf,h=this[o];if(s.isArray(a)&&a.length){this[n]||(this[n]={});for(var g=this[n],f=0,d=a.length;f<d;f+=1){var p=a[f];if(s.checkAPI(p.name,!1)){var l=r(p,u,h);if(l){var m=l.res_type+"-"+l.domain;m in g||(g[m]=[]),g[m].push(l)}}}return this}},fixResourceStatus:function(a){var u=i.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[o];if(!a.src||!s.checkAPI(a.src,!1))return this;var g=a.timeStamp||u.now(),f=u.getEntriesByName(a.src,"resource");return s.each(f,function(d){h.has(d)||g-d.responseEnd<100&&h.set(d,{success:0})}),this},resourceComboReport:function(){var a=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[o];this[n]={};var g=Object.keys(a);if(g.length!==0){var f=[];s.each(g,function(m){var x=a[m],v={domain:"",res_type:"",src_type:"",size:0,duration:0,count:0,err_count:0,err_duration:0,slow_count:0,slow_duration:0,timings:[]};s.each(x,function(b){var w=b.timing||{},_=h.get(b.timing),C=_?_.success:1,E=b.duration>u?1:0;v.domain=b.domain,v.res_type=b.res_type,v.src_type=b.src_type,v.count+=1,v.duration+=b.duration,v.size+=b.size,C||(v.err_count+=1,v.err_duration+=b.duration),E&&(v.slow_count+=1,v.slow_duration+=b.duration);try{var I=JSON.parse(JSON.stringify(w));I.success=C,I.resourceSlow=u,I.isSlow=E,v.timings.push(I)}catch(L){}}),v.count&&(v.size=Math.round(v.size/v.count),v.duration=Math.round(v.duration/v.count)),v.slow_count&&(v.slow_duration=Math.round(v.slow_duration/v.slow_count)),v.err_count&&(v.err_duration=Math.round(v.err_duration/v.err_count)),v.timings.length>20&&(v.timings.sort(function(b,w){return w.duration-b.duration}),v.timings.length=20),v.timings=encodeURIComponent(JSON.stringify(v.timings)),f.push(v)});var d={_combo:1,resource:JSON.stringify(f)},p=i.navigator.connection;d.ct=p?p.effectiveType||p.type:"";var l=p&&(p.downlink||p.downlinkMax||p.bandwidth)||null;(l=l>999?999:l)&&(d.bandwidth=l),this._lg("resource",d,this.getConfig("sample"))}}})},ts}var sa;function Nc(){if(sa)return lt.exports;sa=1;var s=Ze(),c=Ec(),e=Cc(),t=Ic(),i=s.win,r=i.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,o=function(a){var u=this;return c.call(u,a),u._initialPage=a.page&&s.safetyCall(a.page,[],a.page+"")||null,u._isRobot=s.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,g){h==="error"?u._health.errcount++:h==="api"&&u._health[g.success?"apisucc":"apifail"]++},a.enableInstanceAutoSend!==!1&&(u.initHandler(),u.initHook(),u.initFmpObserver(1e4),u._conf&&u._conf.behavior&&typeof u.initBehavior=="function"&&u.initBehavior(),u._conf&&u._conf.enableResource&&typeof u.initResource=="function"&&u.initResource()),Object.defineProperty&&i.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return o.prototype=s.createObject(c.prototype),s.ext(c._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],resourceHelper:[],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",cdnHostList:[],resourceTypes:["css","script","img","font"],resourceSlow:2e3,disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(a){return(a?s.cutUrlSearch(a.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(a){if(!a||typeof a!="object")return{};var u=a.code,h=a.msg||a.message||a.subMsg||a.errorMsg||a.ret||a.errorResponse||"";return typeof h=="object"&&(u=u||h.code,h=h.msg||h.message||h.info||h.ret||JSON.stringify(h)),{msg:h,code:u,success:!0}}}),s.ext(o.prototype,{constructor:o,_super:c,onReady:function(a){var u=this;if(u.hasReady)return a();r.readyState==="complete"?(u.hasReady=!0,a()):s.on(i,"load",function(){u.hasReady=!0,a()},!0)},getPage:function(a){var u=this._conf,h=u.page,g=location,f=g.host+g.pathname;return h&&!a?s.safetyCall(h,[],h+""):this._initialPage||s.filterByRule(u.ignoreUrlCase?f.toLowerCase():f,g.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(a,u){var h=this,g=h.prevPage;if(u!==!1){if(!a||a===g)return h;h.prevPage=a,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=a;return h._conf.page=a,h},setConfig:function(a,u){if(a&&typeof a=="object"){s.verifyConfig(a),a=this.setImgUrl(a);var h=this._conf;if(this._conf=s.ext({},h,a),!u){var g="disableHook";g in a&&h[g]!==a[g]&&(a[g]?this.removeHook():this.addHook()),(g="enableSPA")in a&&h[g]!==a[g]&&this.bindHashChange(a[g])}}},sendRequest:function(a){e(a,this.getConfig("imgUrl"))},postData:function(a,u){var h={};h[u]=a[u],delete a[u];var g="";typeof a=="object"&&(g=s.serialize(a)),t(h,this.getConfig("imgUrl")+g+"&post_res=")},sendPipe:function(a){var u=this;if(!a||!a.length)return u;try{if(s.T(a[0])==="Array")return s.each(a,function(g){return u.sendPipe(g)});if(s.T(a)!=="Array")return u;var h=a.shift();if(!n.test(h))return u;u[h].apply(u,a)}catch(g){return s.warn("[retcode] error in sendPipe",g),u}},sendHealth:function(){var a=s.ext({},this._health);a.healthy=a.errcount>0?0:1,a.begin=Date.now();var u=a.begin-this.sBegin;a.stay=u,this._lg("health",a,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(a){a=s.ext({pid:this._conf.pid},a);var u=this.__proto__.constructor(a);return a.page&&u.sendPV(),u}}),Rc()(o,i),Dc()(o,i,r),Bc()(o,i,r),Pc()(o,i),Lc()(o,i),Mc()(o,i),o._super=c,o._root=c._root,c.Browser=o,lt.exports=o,lt.exports}var na;function Fc(){if(na)return It.exports;na=1;function s(o,a){var u=e[i]=new t(o);u.sendPipe(a);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[r]=!0,u}function c(){if(e[r])return e[i];var o={},a=[];return i in e&&(o=e[i].config||{},a=e[i].pipe||[]),s(o,a)}var e=window,t=e.BrowserLogger=Nc(),i=Ze().key,r="__hasInitBlSdk";t.singleton=function(o,a){return e[r]?e[i]:s(o,a)},t.createExtraInstance=function(o){o&&typeof o=="object"&&o.enableInstanceAutoSend!==!0&&(o.enableInstanceAutoSend=!1);var a=new t(o),u=a._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&a.sendPV(),u&&u.useFmp||a.sendPerformance(),u&&u.sendResource&&a.sendResources()),a};var n=typeof window=="object"&&!!window.navigator;return n&&e[i]&&(t.bl=c()),It.exports=t,It.exports}function Oc(){return Fc()}var Vc={getArmsLogger:Oc};function Uc(s,c,e){const t=[],i=typeof Object.getOwnPropertyDescriptors=="function"?Object.getOwnPropertyDescriptors(Object.getPrototypeOf(s)):{};for(const n of Object.keys(i))i[n].get&&t.push(n);const r={MediaboxWrapperObjectGetter(n,o){if(typeof o=="string"&&t.indexOf(o)>-1)return Vt(n[o],c+1,e);const a={MediaboxWrapperObjectMethod(...u){return Vt(n[o](...u),c+1,e)}};return typeof n[o]=="function"?a.MediaboxWrapperObjectMethod:c>10?n[o]:Vt(n[o],c+1,e)},MediaboxWrapperObjectSetter(n,o,a){return n[o]=Vt(a,c+1,e),!0}};return new Proxy(s,{get:r.MediaboxWrapperObjectGetter,set:r.MediaboxWrapperObjectSetter})}function Hc(s,c,e){const t={MediaboxWrapperFunctionApply(i,r,n){const o=i.apply(r,n);return Vt(o,c+1,e)},MediaboxWrapperFunctionGet(i,r){const n=Object.getOwnPropertyDescriptor(i,r);if(n&&!n.writable&&!n.configurable)return i[r];const o={MediaboxWrapperFunctionGet(...a){const u=i[r](...a);return Vt(u,c+1,e)}};return typeof i[r]=="function"?o.MediaboxWrapperFunctionGet:Vt(i[r],c+1,e)},MediaboxWrapperClassConstructor(i,r){const n=new i(...r);return Vt(n,c+1,e)}};return new Proxy(s,{apply:t.MediaboxWrapperFunctionApply,get:t.MediaboxWrapperFunctionGet,construct:t.MediaboxWrapperClassConstructor})}function zc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp)&&!(s instanceof Function)}function Vt(s,c,e){return typeof s=="function"?Hc(s,c+1,e):s instanceof Promise?s.then(t=>Vt(t,c+1,e)).catch(t=>(t instanceof Error&&typeof t.stack=="string"&&t.stack.indexOf("MediaboxWrapper")>-1&&e(t),Promise.reject(t))):zc(s)?Uc(s,c+1,e):s}const jc="https://arms-retcode-sg.aliyuncs.com/r.png?",Wc="https://arms-retcode.aliyuncs.com/r.png?",Kc="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",$c={cn:Wc,sg:jc,usw:Kc};class is{constructor(c){bt(this,"armsLogger"),bt(this,"isReady",!1),bt(this,"isDestroyed",!1),bt(this,"options"),bt(this,"queue",[]),bt(this,"helper",{MediaboxWrapperQueue(n){return new Error(n)},MediaboxWrapperInitiative(n){return new Error(n)}}),this.options=c;const{region:e="cn",env:t="prod"}=c,i=n=>{var o;if(this.isDestroyed)return!1;if(n.c1=(o=this.options.cid)!=null?o:window.location.host,n.c2=is.version,this.options.customData&&(n.c3=new URLSearchParams(this.options.customData).toString()),n.t==="error"){if(n.file.indexOf("g.alicdn.com/apsara-media-")>-1||n.file.indexOf("g.alicdn.com/thor-server")>-1||n.stack.indexOf("MediaboxWrapper")>-1){let a=n;return this.options.beforeSend&&(a=this.options.beforeSend(n)),this.isReady?a:(a&&this.queue.push(a),!1)}return!1}return n},r=Vc.getArmsLogger();this.armsLogger=r.singleton({pid:"e1iftji1w7@7ec1cef2cc88733",tag:c.businessName,release:`${c.businessName}_${c.version}`,imgUrl:$c[e],behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:i})}static get version(){return"0.10.0"}wrap(c){return this.options.disabled||typeof Proxy>"u"?c:Vt(c,0,e=>this.armsLogger.error(e))}updateOptions(c){this.options=Ce(Ce({},this.options),c)}setReady(){this.isReady=!0,this.queue.length&&this.queue.forEach(c=>{this.armsLogger.error(this.helper.MediaboxWrapperQueue(c.msg),{filename:c.file,lineno:c.line,colno:c.col})})}report(c,e){this.armsLogger.error(this.helper.MediaboxWrapperInitiative(c),e)}destroy(){this.isDestroyed=!0}}for(var Me=(s=>(s.PullStreamStats="remoteStat",s.RtsSubscribeExceeds="rtsSubscribeExceeds",s.UserJoined="userJoined",s.UserLeft="userLeft",s.Bye="bye",s.MuteAudio="muteAudio",s.UnmuteAudio="unmuteAudio",s.MuteVideo="muteVideo",s.UnmuteVideo="unmuteVideo",s.MuteScreen="muteScreen",s.UnmuteScreen="unmuteScreen",s.Error="error",s))(Me||{}),dt=(s=>(s.Local="local-device-status-change",s.Remote="remote-device-status-change",s))(dt||{}),Z=(s=>(s.Audio="sophon_audio",s.VideoLarge="sophon_video_camera_large",s.VideoSmall="sophon_video_camera_small",s.Screen="sophon_video_screen_share",s))(Z||{}),rs=(s=>(s.Audio="rts audio",s.VideoLarge="rts video",s))(rs||{}),li=(s=>(s.Add="add",s.Delete="delete",s.Replace="replace",s.Stop="stop",s.UnPublish="unpublish",s))(li||{}),Ri=(s=>(s[s.Camera=0]="Camera",s[s.Screen=1]="Screen",s[s.Image=2]="Image",s))(Ri||{}),ur=(s=>(s[s.Microphone=0]="Microphone",s[s.Screen=1]="Screen",s[s.Mixed=2]="Mixed",s))(ur||{}),Ve=(s=>(s.InRoom="inRoom",s.Join="join",s.Publish="publish",s.User="user",s.Resume="resume",s))(Ve||{}),di=(s=>(s[s.MANUAL=0]="MANUAL",s[s.JOINCHANNEL=1]="JOINCHANNEL",s))(di||{}),it=[],ss=0;ss<256;++ss)it.push((ss+256).toString(16).slice(1));function qc(s,c=0){return(it[s[c+0]]+it[s[c+1]]+it[s[c+2]]+it[s[c+3]]+"-"+it[s[c+4]]+it[s[c+5]]+"-"+it[s[c+6]]+it[s[c+7]]+"-"+it[s[c+8]]+it[s[c+9]]+"-"+it[s[c+10]]+it[s[c+11]]+it[s[c+12]]+it[s[c+13]]+it[s[c+14]]+it[s[c+15]]).toLowerCase()}var hr,Gc=new Uint8Array(16);function Jc(){if(!hr&&(hr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hr(Gc)}var Xc=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const aa={randomUUID:Xc};function fi(s,c,e){if(aa.randomUUID&&!c&&!s)return aa.randomUUID();s=s||{};var t=s.random||(s.rng||Jc)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,c){e=e||0;for(var i=0;i<16;++i)c[e+i]=t[i];return c}return qc(t)}var lr=(s=>(s.prod="rs.rtn.aliyuncs.com",s.pre="prs.rtn.aliyuncs.com",s))(lr||{});const ns="6.11.7-beta.0",oa="web";class Ut{static getVersionNumber(){let c=ns.split("."),e="";return c.forEach(t=>{t.length===1?e+="0"+t:e+=t}),parseInt(e)}static queryingParam(c){let e=[];if(c)for(let t in c)e.push(t+"="+c[t]);return e.join("&")}static getQueryParams(c){const t=window.location.search.substring(1).split("&");for(let i=0;i<t.length;i++){const r=t[i].split("=");if(decodeURIComponent(r[0])===c)return decodeURIComponent(r[1])}}static createCallid(c=""){const e=fi();return c&&e&&e.length>c.length?`${c}${e.substring(c.length)}`:e}static checkSubOptionsValid(c){if(c){const{audio:e,video:t,screen:i}=c;if(e===!1&&t===!1&&i===!1)return!1}return!0}static isNetworkAvailable(){return H(this,null,function*(){const c=lr.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${c}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var Ie=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ca(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Zc(s){if(s.__esModule)return s;var c=s.default;if(typeof c=="function"){var e=function t(){return this instanceof t?Reflect.construct(c,arguments,this.constructor):c.apply(this,arguments)};e.prototype=c.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(s).forEach(function(t){var i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return s[t]}})}),e}function Wi(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ua={exports:{}};/*!
1
+ var H0=Object.defineProperty,j0=Object.defineProperties;var W0=Object.getOwnPropertyDescriptors;var Ki=Object.getOwnPropertySymbols,K0=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty,Pa=Object.prototype.propertyIsEnumerable,$0=Reflect.get;var ys=(he,me,ve)=>me in he?H0(he,me,{enumerable:!0,configurable:!0,writable:!0,value:ve}):he[me]=ve,Se=(he,me)=>{for(var ve in me||(me={}))Ba.call(me,ve)&&ys(he,ve,me[ve]);if(Ki)for(var ve of Ki(me))Pa.call(me,ve)&&ys(he,ve,me[ve]);return he},Rt=(he,me)=>j0(he,W0(me));var $i=(he,me)=>{var ve={};for(var $e in he)Ba.call(he,$e)&&me.indexOf($e)<0&&(ve[$e]=he[$e]);if(he!=null&&Ki)for(var $e of Ki(he))me.indexOf($e)<0&&Pa.call(he,$e)&&(ve[$e]=he[$e]);return ve};var A=(he,me,ve)=>(ys(he,typeof me!="symbol"?me+"":me,ve),ve);var As=(he,me,ve)=>$0(K0(he),ve,me);var z=(he,me,ve)=>new Promise(($e,kt)=>{var nt=qe=>{try{Qe(ve.next(qe))}catch(lt){kt(lt)}},dt=qe=>{try{Qe(ve.throw(qe))}catch(lt){kt(lt)}},Qe=qe=>qe.done?$e(qe.value):Promise.resolve(qe.value).then(nt,dt);Qe((ve=ve.apply(he,me)).next())}),qi=function(he,me){this[0]=he,this[1]=me},La=(he,me,ve)=>{var $e=(dt,Qe,qe,lt)=>{try{var je=ve[dt](Qe),Zt=(Qe=je.value)instanceof qi,oi=je.done;Promise.resolve(Zt?Qe[0]:Qe).then(ft=>Zt?$e(dt==="return"?dt:"next",Qe[1]?{done:ft.done,value:ft.value}:ft,qe,lt):qe({value:ft,done:oi})).catch(ft=>$e("throw",ft,qe,lt))}catch(ft){lt(ft)}},kt=dt=>nt[dt]=Qe=>new Promise((qe,lt)=>$e(dt,Qe,qe,lt)),nt={};return ve=ve.apply(he,me),nt[Symbol.asyncIterator]=()=>nt,kt("next"),kt("throw"),kt("return"),nt};(function(he,me){typeof exports=="object"&&typeof module!="undefined"?me(exports,require("aliyun-rts-sdk"),require("eventemitter3")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","eventemitter3"],me):(he=typeof globalThis!="undefined"?globalThis:he||self,me(he.AliRtcEngine={},he.AliyunRts,he.EventEmitter))})(this,function(he,me,ve){var it,Lt,_t,si,fe,Ia;"use strict";var $e=Object.defineProperty,kt=(s,c,e)=>c in s?$e(s,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[c]=e,nt=(s,c,e)=>(kt(s,typeof c!="symbol"?c+"":c,e),e),dt={exports:{}},Qe={exports:{}},qe,lt;function je(){if(lt)return qe;lt=1,Date.now=Date.now||function(){return new Date().getTime()};var s=Date.now(),c=function(){},e=function(){var r=typeof console=="object"?console.warn:c;try{var i={warn:r};i.warn.call(i)}catch(n){return c}return r},t={noop:c,warn:e(),key:"__bl",selfErrKey:"ARMS_SDK_ERROR",selfErrPage:"ARMSSDK",win:typeof window=="object"&&window.document?window:void 0,regionMap:{cn:"https://arms-retcode.aliyuncs.com/r.png?",sg:"https://arms-retcode-sg.aliyuncs.com/r.png?",sg_2:"https://retcode-sg-lazada.arms.aliyuncs.com/r.png?",daily:"http://arms-retcode-daily.alibaba.net/r.png?",daily_2:"https://arms-retcode-daily.alibaba.net/r.png?",daily_3:"http://arms-retcode-daily.aliyun.test/r.png?",us:"https://retcode-us-west-1.arms.aliyuncs.com/r.png?",tw:"https://arms-retcode.orientalgame.com.tw/r.png?",tw_sg:"https://arms-retcode-sg.orientalgame.com.tw/r.png?",hz_finance:"https://arms-retcode-hz-finance.aliyuncs.com/r.png?"},defaultImgUrl:"https://arms-retcode.aliyuncs.com/r.png?",createObject:function(r){if(Object.create)return Object.create(r);var i=function(){};return i.prototype=r,new i},each:function(r,i){var n=0,a=r.length;if(this.T(r,"Array"))for(;n<a&&i.call(r[n],r[n],n)!==!1;n++);else for(n in r)if(i.call(r[n],r[n],n)===!1)break;return r},safetyCall:function(r,i,n){if(typeof r!="function")return n;try{return r.apply(this,i)}catch(a){return n}},T:function(r,i){var n=Object.prototype.toString.call(r).substring(8).replace("]","");return i?n===i:n},duration:function(){var r=Date;try{performance&&this.T(performance.now,"Function")&&(r=performance)}catch(n){r=Date}var i=r.now();return function(){return Math.round(r.now()-i)}},filterByRule:function(){var r=[].slice.call(arguments),i=r.length;if(i<2)return r[0];var n=r[i-1],a=r[0];if(!a)return"";if(!n)return a;var o=this,u=o.T(n),h=r.slice(0,i-1);return u==="Function"?o.safetyCall(n,h,a):u==="Array"?(this.each(n,function(g){h[0]=a=o.filterByRule.apply(o,[].concat(h,g))}),a):u==="Object"?a.replace(n.rule,n.target||""):a.replace(n,"")},ignoreByRule:function(r,i){if(!r||!i)return!1;if((this.isString(i)||i.source||this.T(i)==="Function")&&(i=[i]),!this.isArray(i))return this.warn("[arms] invalid rules of ignore config, (list of) String/RegExp/Funcitons are available"),!1;for(var n,a=[],o=0,u=i.length;o<u;o++)if(n=i[o],this.isString(n))a.push(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(n&&n.source)a.push(n.source);else if(n&&this.T(n)==="Function"&&this.safetyCall(n,[r],!1)===!0)return!0;var h=new RegExp(a.join("|"),"i");return!!(a.length&&h.test&&h.test(r))},J:function(r){if(!r||typeof r!="string")return r;var i=null;try{i=JSON.parse(r)}catch(n){}return i},pick:function(r){return r===1||Math.ceil(Math.random()*r)===1},verifyConfig:function(r){if("sample"in r){var i=r.sample,n=i;i&&/^\d+(\.\d+)?%$/.test(i)&&(n=parseInt(100/parseFloat(i))),0<n&&1>n&&(n=parseInt(1/n)),n>=1&&n<=100?r.sample=n:delete r.sample}return r},on:function(r,i,n,a,o){return r.addEventListener?(o=o||!1,r.addEventListener(i,function u(h){a&&r.removeEventListener(i,u,o),n.call(this,h)},o)):r.attachEvent&&r.attachEvent("on"+i,function u(h){a&&r.detachEvent("on"+i,u),n.call(this,h)}),this},off:function(r,i,n){return n?(r.removeEventListener?r.removeEventListener(i,n):r.detachEvent&&r.detachEvent(i,n),this):this},delay:function(r,i){return i===-1?(r(),null):setTimeout(r,i||0)},ext:function(r){for(var i=1,n=arguments.length;i<n;i++){var a=arguments[i];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])}return r},sub:function(r,i){var n={};return this.each(r,function(a,o){i.indexOf(o)!==-1&&(n[o]=a)}),n},uu:function(){for(var r,i,n=20,a=new Array(n),o=Date.now().toString(36).split("");n-- >0;)i=(r=36*Math.random()|0).toString(36),a[n]=r%3?i:i.toUpperCase();for(var u=0;u<8;u++)a.splice(3*u+2,0,o[u]);return a.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){var i=16*Math.random()|0;return(r==="x"?i:3&i|8).toString(16)})},seq:function(){return(s++).toString(36)},decode:function(r){try{r=decodeURIComponent(r)}catch(i){}return r},encode:function(r,i){try{r=i?encodeURIComponent(r).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(r)}catch(n){}return r},serialize:function(r){r=r||{};var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&r[n]!==void 0&&i.push(n+"="+this.encode(r[n],n==="msg"));return i.join("&")},checkAPI:function(r,i){if(!r||typeof r!="string")return!1;var n=/arms-retcode[\w-]*\.aliyuncs/.test(r);return!n&&i&&(n=/(alicdn\.com)|(mmstat\.com)/.test(r)),!n},checkAutoError:function(r){return!(!r||!r.message)&&!/failed[\w\s]+fetch/i.test(r.message)},cutUrlSearch:function(r){return r&&typeof r=="string"?r.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},removeUrlSearch:function(r){return r&&typeof r=="string"?r.replace(/\?.*$/,""):""},createFakeToString:function(r){return function(){return r+"() { [native code] }"}},checkSameOrigin:function(r,i){if(!i||!r)return!1;var n="//"+i.split("/")[2];return r===i||r.slice(0,i.length+1)===i+"/"||r===n||r.slice(0,n.length+1)===n+"/"||!/^(\/\/|http:|https:).*/.test(r)},getRandIP:function(){for(var r=[],i=0;i<4;i++){var n=Math.floor(256*Math.random());r[i]=(n>15?"":"0")+n.toString(16)}return r.join("").replace(/^0/,"1")},getSortNum:function(r){return r?(r+=1)>=1e3&&r<=9999?r:r<1e3?r+1e3:r%1e4+1e3:1e3},getRandNum:function(r){return r&&typeof r=="string"?r.length<5?this.getNum(5):r.substring(r.length-5):this.getNum(5)},getNum:function(r){for(var i=[],n=0;n<r;n++){var a=Math.floor(16*Math.random());i[n]=a.toString(16)}return i.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(r,i){var n=location&&location.host||"";if(!n)return"";var a=new URL(r).host;if(a===n)return"self";for(var o=0;o<i.length;o+=1)if(a.includes(i[o]))return"cdn";return"others"},parseFetchHeaders:function(r){if(!r)return{};var i={};try{if(typeof r.keys=="function")for(var n=r.keys(),a=n.next();!a.done;){var o=a.value;i[o]=r.get(o),a=n.next()}else i=r}catch(u){i={}}return i},parseXhrHeaders:function(r){if(!r&&typeof r!="string")return{};var i={};try{var n=r.split(`\r
2
+ `);i=n.reduce(function(a,o){var u=o.split(": ");return a[u[0]]=u[1],a},{})}catch(a){i={}}return i},getQuerys:function(r){if(!r)return"";var i={},n=[],a="",o="";try{var u=[];if(r.indexOf("?")>=0&&(u=r.substring(r.indexOf("?")+1,r.length).split("&")),u.length>0)for(var h in u)a=(n=u[h].split("="))[0],o=n[1],i[a]=o}catch(g){i={}}return i},getURL:function(r){if(!r)return null;var i={},n=r.length,a=r.indexOf("://");if(a<0)return null;i.protocol=r.substring(0,a+1);var o=r.indexOf("#"),u=r.indexOf("?");o<0&&(o=n),u<0&&(u=o),i.search=r.substring(u,o).substring(0,1e3);var h=r.substring(a+3,u),g=h.indexOf("/");return g<0&&(g=h.length),i.domain=h.substring(0,g).split(":")[0],i.path=h.substring(g,h.length).substring(0,1e3),i},getResType:function(r,i){if(["script","img","other"].indexOf(r)>-1)return r;if(["video"].indexOf(r)>-1)return"media";if(["document","iframe"].indexOf(r)>-1)return"doc";var n=i?this.getURL(i):null,a=n&&n.path?n.path.lastIndexOf("."):-1,o=(a>0?n.path.substr(a+1):"").toLowerCase();if(o){if(["eot","woff","woff2","ttf"].indexOf(o)>-1)return"font";if(o==="css")return"css";if(o==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(r)>-1?"api":"others"},areInOrder:function(){for(var r=1;r<arguments.length;r+=1)if(arguments[r-1]>arguments[r])return!1;return!0},getFetchSnapshot:function(r,i,n){var a,o;try{var u=(r&&typeof r[0]!="string"?r[0].url:r[0])||"",h=(r&&typeof r[0]!="string"?r[0]:r[1])||{},g=h.method.toUpperCase()==="POST"?h.body:this.getQuerys(u);a={originApi:u,method:h.method||"unknown",params:g,response:i||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},o=JSON&&JSON.stringify(a)||"{}"}catch(f){o="{}"}return o},getXhrSnapshot:function(r,i,n){if(!r||!i||!n)return{};var a,o;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),a={originApi:r,method:i,params:this.getQuerys(r),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},o=JSON&&JSON.stringify(a)||"{}"}catch(h){o="{}"}return o},isRobot:function(){var r=["nuhk","googlebot/","googlebot-image","yammybot","openbot","slurp","msnbot","ask jeeves/teoma","ia_archiver","baiduspider","bingbot/","adsbot"];if(!navigator||typeof navigator.userAgent!="string")return!1;try{for(var i=navigator.userAgent.toLowerCase(),n=0;n<r.length;n++){var a=r[n];if(i.lastIndexOf(a)>=0)return!0}}catch(o){this.warn("[arms] useragent parse error")}return!1},isFunction:function(r){return typeof r=="function"},isPlainObject:function(r){return Object.prototype.toString.call(r)==="[object Object]"},isString:function(r){return Object.prototype.toString.call(r)==="[object String]"},isArray:function(r){return Object.prototype.toString.call(r)==="[object Array]"},joinRegExp:function(r){for(var i,n=[],a=0,o=r.length;a<o;a++)i=r[a],this.isString(i)?n.push(i.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):i&&i.source&&n.push(i.source);return new RegExp(n.join("|"),"i")},reWriteMethod:function(r,i,n){if(r!==null){var a=r[i];r[i]=n(a)}},checkSDKError:function(r,i){return!r&&!i?!1:new RegExp(this.selfErrKey,"i").test(r)?!0:!!this.ignoreByRule(i,[/retcode.alicdn.com\/retcode\/bl.js/,/g.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/laz-g-cdn.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/local.taobao.com:8880\/build\/bl/])},sdkError:function(r){return{msg:r,message:this.selfErrKey}},dealParam:function(r,i,n){var a={};try{a=this.isPlainObject(r)?this.ext({key:r.key||"default",val:r.val||r.value||n},r,{begin:Date.now()}):{key:r||"default",val:i||n,begin:Date.now()}}catch(o){this.warn("[retcode] baseLog error: "+o)}return a}};return qe=t,qe}var Zt={exports:{}},oi={exports:{}},ft,Es;function Na(){if(Es)return ft;Es=1;var s=je();return ft=function(c,e,t){typeof c=="object"&&(c=s.serialize(c));var r=e+c+(t?"&post_res=":"");window&&window.navigator&&typeof window.navigator.sendBeacon=="function"?window.navigator.sendBeacon(r,t||"&post_res="):s.warn("[arms] navigator.sendBeacon not surported")},ft}var ws;function Ma(){if(ws)return oi.exports;ws=1;var s=je(),c=Na(),e="aokcdqn3ly@e629dabd48a9933",t=function(i,n){var a;if(n.t==="error"&&(a=i.requestQueue[0])&&a.t==="error"&&n.msg===a.msg)return n.times=a.times+1,void(i.requestQueue[0]=n);if(n.t==="behavior"){var o=i.requestQueue&&i.requestQueue.length;if(o>0&&i.requestQueue[o-1].t==="behavior"){var u=n.behavior||[];i.requestQueue[o-1].behavior.concat(u)}else i.requestQueue.push(n)}else i.requestQueue.unshift(n);return i.onReady(function(){i.requestTimmer=s.delay(function(){i.clear()},i.requestQueue[0]&&i.requestQueue[0].t==="error"?3e3:-1)}),!0},r=function(i){return this.ver="1.8.36-beta.12",this._conf=s.ext({},r.dftCon),this.sampleCache={},this.requestQueue=[],this.selfQueue=[],this.sdkFlag=!0,this.hash=s.seq(),this.resetPageview(),this.setConfig(i),this.rip=s.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};return r.dftCon={sample:1,pvSample:1,tag:"",imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",region:null,ignore:{ignoreUrls:[],ignoreApis:[],ignoreErrors:[/^Script error\.?$/],ignoreResErrors:[],ignoreResources:[/\/(bl|wl)(.debug)?.js$/]},release:void 0,environment:"prod",beforeReport:null,parseTraceId:null},r.prototype={constructor:r,onReady:function(i){return i()},getPage:function(){var i=this._conf.page;return s.safetyCall(i,[],i+"")},setPage:function(){},setConfig:function(i){i&&typeof i=="object"&&(s.verifyConfig(i),i=this.setImgUrl(i),this._conf=s.ext({},this._conf,i))},setImgUrl:function(i){var n=i.region,a=i.imgUrl;if(n){var o=s.regionMap[n];return i.imgUrl=o||s.defaultImgUrl,i}return a&&(i.imgUrl=a),i},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(i,n,a){c(i,n||this.getConfig("imgUrl"),a)},postData:function(){},commonInfo:function(){return{}},setCommonInfo:function(i){i&&typeof i=="object"&&(this._common=s.ext({},this._common,i))},resetPageview:function(){this.pageview=s.uu(),this.sBegin=Date.now()},getUsername:function(){if(this.username)return this.username;var i=this._conf,n=i&&i.setUsername;if(typeof n=="function")try{var a=n();typeof a=="string"&&(a=a.substr(0,40),this.username=a)}catch(o){s.warn("[arms] setUsername fail",o)}return this.username},getTraceId:function(){var i=this.rip,n=Date.now(),a=s.getSortNum(this.record),o=i+n+a+s.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=o,this.record=a,{"EagleEye-TraceID":o}},getUberTraceId:function(i){var n=this.rip,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+s.getNum(2)+u,g=h.substring(0,16);return i=i?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{"uber-trace-id":h+":"+g+":0:"+i,traceId:h}},getB3TraceId:function(i){var n=this.rip,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+s.getNum(2)+u,g=h.substring(0,16);return i=i?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{b3:h+"-"+g+"-"+i+"-0","X-B3-TraceId":h,"X-B3-ParentSpanId":"0","X-B3-SpanId":g,"X-B3-Sampled":i}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(i){return i?this._conf[i]:s.ext({},this._conf)},sampling:function(i){return i===1||(typeof this.sampleCache[i]=="boolean"?this.sampleCache[i]:(this.sampleCache[i]=s.pick(i),this.sampleCache[i]))},clear:function(i){var n;clearTimeout(this.requestTimmer),this.requestTimmer=null;for(var a=this._conf&&typeof this._conf.sendRequest=="function";n=this.requestQueue.pop();)if(n.t==="res")this.postData(n,"res");else if(n.t==="error")this.postData(n,"err");else if(n.t==="api")this.postData(n,"apiSnapshot");else if(n.t==="behavior")this.postData(n,"behavior");else if(n.t==="health"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(n);else if(n.t==="resource"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var o=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,o)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return i&&this.clearSelf(),this},clearSelf:function(){var i;for(clearTimeout(this.Timmer),this.Timmer=null;i=this.selfQueue.pop();)this.postData(i,"err");return this},_lg:function(i,n,a,o){var u=this,h=u._conf,g=u.getPage(),f=h.ignore||{},l=f.ignoreErrors,p=f.ignoreResErrors,d=f.ignoreUrls,m=f.ignoreApis;if(u._isRobot||s.ignoreByRule(g,d)||s.ignoreByRule(s.decode(g),d)||i==="error"&&(s.ignoreByRule(n.msg,l)||s.ignoreByRule(s.decode(n.msg),l))||i==="resourceError"&&(s.ignoreByRule(n.src,p)||s.ignoreByRule(s.decode(n.src),p))||i==="api"&&(s.ignoreByRule(n.api,m)||s.ignoreByRule(s.decode(n.api),m))||!u.checkImgUrl(h.imgUrl)||!n||h.disabled||!h.pid||o===0)return u;var x=n.dl;if(delete n.dl,n=s.ext({t:i,times:1,page:g,tag:h.tag||"",release:h.release||"",environment:h.environment,begin:Date.now(),c1:h.c1,c2:h.c2,c3:h.c3},n,u.commonInfo(),u._common,{pid:h.pid,_v:u.ver,pv_id:u.pageview,username:u.getUsername(),sampling:a||1,dl:x,z:s.seq()}),s.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(v){return u}return o===1?t(u,n):a&&!u.sampling(a)?u:t(u,n)},_self:function(i,n,a){var o=this,u=o._conf;if(i!=="error"||!o.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||a&&!o.sampling(a))return o;n=s.ext({t:i,times:1,page:s.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:o.ver,sampling:a||1,z:s.seq()});var h=o.selfQueue[0];if(h){h.times++;try{h.err&&n.err&&h.err.msg_raw&&n.err.msg_raw&&h.err.msg_raw.split("&").indexOf(n.err.msg_raw)<0&&h.err.msg_raw.length<1e3&&(h.err.msg_raw+="&"+n.err.msg_raw)}catch(g){}}else o.selfQueue.unshift(n),o.onReady(function(){o.sdkFlag&&(o.sdkFlag=!1,o.Timmer=s.delay(function(){o.clearSelf()},1e4))})},custom:function(i,n){if(!i||typeof i!="object")return this;var a=!1,o={begin:Date.now()};return s.each(i,function(u,h){return!(a=h&&h.length<=20)&&s.warn("[retcode] invalid key: "+h),o["x-"+h]=u,a}),a?this._lg("custom",o,n||1):this}},oi.exports=r,oi.exports}var Cs;function Fa(){if(Cs)return Zt.exports;Cs=1;var s=je(),c=Ma(),e=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag","apiSnapshot","tag","c1","c2","c3"],t=function(i){var n=(i.key||"default").split("::");return n.length>1?s.ext(i,{group:n[0],key:n[1]}):s.ext(i,{group:"default_group",key:n[0]})},r=function(i){c.call(this,i);var n;try{n=typeof performance=="object"?performance.timing.fetchStart:Date.now()}catch(a){n=Date.now()}return this._startTime=n,this};return r.prototype=s.createObject(c.prototype),s.ext(c.dftCon,{startTime:null}),s.ext(r.prototype,{constructor:r,_super:c,sum:function(i,n,a){try{var o=s.dealParam(i,n,1);return this._lg("sum",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},avg:function(i,n,a){try{var o=s.dealParam(i,n,0);return this._lg("avg",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},percent:function(i,n,a,o){try{return this._lg("percent",t({key:i,subkey:n,val:a||0,begin:Date.now()}),o)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},msg:function(i,n){if(i&&!(i.length>180))return this.custom({msg:i},n)},error:function(i,n){if(!i)return s.warn("[retcode] invalid param e: "+i),this;arguments.length===1?(typeof i=="string"&&(i={message:i},n={}),typeof i=="object"&&(n=i=i.error||i)):(typeof i=="string"&&(i={message:i}),typeof n!="object"&&(n={}));var a=i.name||"CustomError",o=i.message||"",u=i.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(s.checkSDKError(o,n.filename)){var g=/^Script error\.?$/,f=i.msg||i.message;if(s.ignoreByRule(f,g)||s.ignoreByRule(s.decode(f),g))return this;var l={msg:s.selfErrKey,err:{msg_raw:s.encode(i.msg||i.message)}};return this._self("error",l,1)}for(var p={begin:Date.now(),cate:a,msg:o&&o.substring(0,1e3),stack:u&&u.substring(0,1e3),file:s.removeUrlSearch(n.filename||""),line:n.lineno||"",col:n.colno||"",err:{msg_raw:s.encode(o),stack_raw:s.encode(u)},dl:h},d=["tag","c1","c2","c3"],m=0;m<d.length;m++){var x=d[m];n[x]&&(p[x]=n[x])}var v=(this.getConfig("ignore")||{}).ignoreErrors;return s.ignoreByRule(p.msg,v)||s.ignoreByRule(s.decode(p.msg),v)?this:(this.beforeSend&&this.beforeSend("error",p),this._lg("error",p,1))},behavior:function(i){if(i){var n=typeof i=="object"&&i.behavior?i:{behavior:i};return this.beforeSend&&this.beforeSend("behavior",n),this._lg("behavior",n,1)}},api:function(i,n,a,o,u,h,g,f,l,p,d,m,x,v,b,y){if(!i)return s.warn("[retcode] api is null"),this;if(i=typeof i=="string"?{api:i,success:n,time:a,code:o,msg:u,begin:h,traceId:g,pv_id:f,apiSnapshot:l,domain:p,flag:m,tag:x,c1:v,c2:b,c3:y}:s.sub(i,e),!s.checkAPI(i.api,!0))return this;i.code=i.code||"";var E=i.msg||"";if(E=typeof E=="string"?E.substring(0,1e3):E,i.msg=E,i.success=i.success?1:0,i.time=+i.time,i.begin=i.begin,i.traceId=i.traceId||"",i.pv_id=i.pv_id||"",i.domain=i.domain||"",i.flag=i.flag,i.dl=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"",i.apiSnapshot&&(typeof i.apiSnapshot=="object"&&(i.apiSnapshot=JSON.stringify(i.apiSnapshot)),typeof i.apiSnapshot!="string"&&delete i.apiSnapshot,i.apiSnapshot.length>2e3&&(i.apiSnapshot=i.apiSnapshot.substring(0,2e3))),d&&(i.traceOrigin=d),!i.api||isNaN(i.time))return s.warn("[retcode] invalid time or api"),this;var I=(this.getConfig("ignore")||{}).ignoreApis;return s.ignoreByRule(i.api,I)||s.ignoreByRule(s.decode(i.api),I)?this:i.time<0?this:(this.beforeSend&&this.beforeSend("api",i),this._lg("api",i,i.success&&this.getConfig("sample"),i.flag))},speed:function(i,n,a){var o=this,u=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(i)?(n=typeof n!="number"?Date.now()-u:n>=u?n-u:n,o.speedCache=o.speedCache||{},o.speedCache[i]=n,o.speedCache.begin=u,clearTimeout(o.speedTimmer),o.speedTimmer=setTimeout(function(){a||(o.speedCache.page=o.getPage(!0)),o._lg("speed",o.speedCache),o.speedCache=null},5e3),o):(s.warn("[retcode] invalid point: "+i),o)},performance:function(i){if(i&&typeof i=="object"&&!this.hasSendPerf){var n={},a={},o=this.getConfig("autoSendPerf");if(i.autoSend&&o)return a=s.ext(this.perfData||{},i),this.hasSendPerf=!0,this._lg("perf",a,this.getConfig("sample"));if(i.autoSend&&!o)return delete i.autoSend,this.perfData?(a=s.ext(this.perfData||{},i),this.hasSendPerf=!0,this._lg("perf",a,this.getConfig("sample"))):void(this.perfData=i);for(var u in i)(/^t([1-9]|1[0])$/.test(u)||u==="ctti"||u==="cfpt")&&(n[u]=i[u]);if(i.autoSend===!0||!o&&(o||this.perfData))return i.autoSend!==!0&&o===!1&&this.perfData?(n=s.ext(this.perfData||{},n),this.hasSendPerf=!0,this._lg("perf",n,this.getConfig("sample"))):void 0;this.perfData=s.ext(this.perfData||{},n)}},resource:function(i,n){if(!i||!s.isPlainObject(i))return s.warn("[arms] invalid param data: "+i),this;var a=Object.keys(i),o=["begin","dom","load","res","dl"],u=!1;for(var h in o)if(a.indexOf(o[h])<0){u=!0;break}if(u)return s.warn("[arms] lack param data: "+i),this;var g={begin:i.begin||Date.now(),dom:i.dom||"",load:i.load||"",res:s.isArray(i.res)?JSON.stringify(i.res):JSON.stringify([]),dl:i.dl||""};return this._lg("res",g,n)},event:function(i,n){if(typeof i=="object"&&i&&i.key){var a={},o=["key","success","time","c1","c2","c3"];for(var u in i)o.indexOf(u)>-1&&(a[u]=i[u]);a.success=i.success===!1?0:1,this._lg("event",a,n)}}}),r._super=c,r._root=c,c.Reporter=r,Zt.exports=r,Zt.exports}var Gi={exports:{}},Is;function Oa(){if(Is)return Gi.exports;Is=1;var s=je(),c=typeof window=="object"?window:{},e="catch",t=c.__oFetch_||c.fetch;return t=typeof t=="function"?t:void 0,Gi.exports=function(r,i){var n=-1;typeof r=="object"&&(n=r.z,r=s.serialize(r));var a=i+r;if(t)return t(a,{method:"HEAD",mode:"no-cors"})[e](s.noop);if(c.document&&c.document.createElement){var o="__request_hold_"+n,u=c[o]=new Image;u.onload=u.onerror=function(){c[o]=void 0},u.src=a,u=null}},Gi.exports}var Ji={exports:{}},Rs;function Va(){if(Rs)return Ji.exports;Rs=1;var s=je(),c=typeof window=="object"?window:{},e=c.__oXMLHttpRequest_||c.XMLHttpRequest;return e=typeof e=="function"?e:void 0,Ji.exports=function(t,r){try{var i=new e;i.open("POST",r,!0),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(t))}catch(n){s.warn(`[retcode] Failed to log, exception is :
3
+ `+n)}},Ji.exports}var Xi,ks;function Ua(){if(ks)return Xi;ks=1;var s=je();return Xi=function(c,e){var t=[],r=null,i=e&&e.location&&e.location.href,n=void 0,a=null,o=function(f,l,p){if(f!==null){var d=f[l];f[l]=p(d)}},u=function(f){var l,p,d,m,x,v=[];if(!f||typeof f.tagName!="string")return"";if(v.push(f.tagName.toLowerCase()),typeof f.id=="string"&&v.push("#".concat(f.id)),typeof(l=f.className)=="string")for(p=l.split(/\s+/),x=0;x<p.length;x++)v.push(".".concat(p[x]));var b=["type","name","title","alt","data-arms-attr"];for(x=0;x<b.length;x++)d=b[x],typeof(m=f.getAttribute(d))=="string"&&v.push("[".concat(d,'="').concat(m,'"]'));return v.join("")},h=function(f,l){return function(p){if(p&&p!==a){a=p;var d;try{d=p.target}catch(x){d="<unknown>"}if(d.length!==0){var m={type:"ui.".concat(f),data:{message:function(x){if(!x||x.nodeType!==1)return"";for(var v=x||null,b=[],y=0,E=0,I=3,C="";v&&y++<5&&!((C=u(v))==="html"||y>1&&E+b.length*I+C.length>=80);)b.push(C),E+=C.length,v=v.parentNode;return b.reverse().join(" > ")}(d)},timestamp:Date.now()};f==="click"?r&&r.addBehavior(m):f==="keypress"&&(n||r&&r.addBehavior(m),clearTimeout(n),n=setTimeout(function(){n=void 0},100))}}}},g=function(){if(function(){var d=e&&e.chrome,m=d&&d.app&&d.app.runtime,x="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!m&&x}()){var f=function(d,m){var x={type:"navigation",data:{from:d,to:m}};r&&r.addBehavior(x),i=m},l=e.onpopstate;e.onpopstate=function(){for(var d=arguments.length,m=new Array(d),x=0;x<d;x++)m[x]=arguments[x];var v=e.location.href;if(f(i,v),l)return l.apply(this,m)};var p=function(d){return function(){for(var m=arguments.length,x=new Array(m),v=0;v<m;v++)x[v]=arguments[v];var b=x.length>2?x[2]:void 0;return b&&f(i,String(b)),d.apply(this,x)}};o(e.history,"pushState",p),o(e.history,"replaceState",p)}};s.ext(c.prototype,{addBehavior:function(f){if(this.getConfig("behavior")&&f&&typeof f=="object"){var l={},p=f.data||{};if(f.type)l=p;else{if(typeof p.name!="string"||typeof p.message!="string")return;l.name=p.name.substr(0,20),l.message=p.message.substr(0,200)}l.message&&(l.message=s.encode(l.message));var d={type:f.type||"custom",data:l||{},timestamp:f.timestamp||Date.now(),page:f.page||e&&e.location&&e.location.pathname};return t.push(d),t=t.slice(-100)}},getBehavior:function(){return t||[]},setBehavior:function(f){return f&&(t=f),t},reportBehavior:function(f){var l=this;l.getConfig("behavior")&&(l.sendBhTimer&&(clearTimeout(l.sendBhTimer),l.sendBhTimer=void 0),l.sendBhTimer=setTimeout(function(){t&&t.length>0&&(l.behavior(t),t=[],l.sendBhTimer=void 0,f&&typeof f=="function"&&f())},0))},initBehavior:function(){if(!this.hasInitBehavior&&!r){try{(function(){if(document&&document.referrer&&document.location){var l=document.referrer,p=document.location.href;if(l!==""){var d={type:"navigation",data:{from:l,to:p}};i=p,r&&r.addBehavior(d)}}})(),e&&e.document&&e.document.addEventListener&&(e.document.addEventListener("click",h("click"),!1),e.document.addEventListener("keypress",h("keypress"),!1)),g();var f=this.getConfig("enableConsole");f&&function(l){if(e&&e.console){var p=["debug","info","warn","log","error","assert"];s.isArray(l)&&(p=l);for(var d=0;d<p.length;d++){var m=p[d];m&&s.isString(m)&&e.console[m]&&typeof e.console[m]=="function"&&o(e.console,m,function(x){var v=m;return function(){for(var b=arguments.length,y=new Array(b),E=0;E<b;E++)y[E]=arguments[E];var I={type:"console",data:{level:v,message:y}};if(r&&r.addBehavior(I),v==="error")for(var C=0;C<y.length;C++){var R=y[C];R&&R.message&&R.stack&&r&&r.errorHandler(new ErrorEvent("error",{error:R,message:R.message}))}x&&Function.prototype.apply.call(x,e.console,y)}})}}}(f)}catch(l){s.warn("[arms] error in initBehavior",l)}r=this,this.hasInitBehavior=!0}return this}})},Xi}var Ds={},Ts;function Zi(){return Ts||(Ts=1,Ds.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),Ds}var Yi,Bs;function za(){if(Bs)return Yi;Bs=1;var s=je(),c=Zi(),e=c.TIMING_KEYS;return Yi=function(){var t=s.win||{},r=t.performance;if(!r||typeof r!="object"||typeof r.getEntriesByType!="function")return null;var i={},n=r.timing||{},a=r.getEntriesByType("resource")||[];if(i.begin=n[e[1]]||Date.now(),typeof t.PerformanceNavigationTiming=="function"){var o=r.getEntriesByType("navigation")[0];o&&(n=o)}return s.each({dom:[10,8],load:[14,1]},function(u,h){var g=n[e[u[1]]],f=n[e[u[0]]];if(g>0&&f>0){var l=Math.round(f-g);l>=0&&l<6e5&&(i[h]=l)}}),i.res=JSON.stringify(a),i},Yi}var Qi,Ps;function Ha(){if(Ps)return Qi;Ps=1;var s=je(),c=Zi(),e=c.TIMING_KEYS;return Qi=function(){var t=s.win||{},r=t.performance;if(!r||typeof r!="object")return null;var i={},n=r.timing||{},a=Date.now(),o=1;if(typeof t.PerformanceNavigationTiming=="function"){var u=r.getEntriesByType("navigation")[0];u&&(n=u,o=2)}s.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(p,d){var m=n[e[p[1]]],x=n[e[p[0]]];if(o===2||m>0&&x>0){var v=Math.round(x-m);v>=0&&v<6e5&&(i[d]=v)}});var h=t.navigator.connection,g=r.navigation||{};i.ct=h?h.effectiveType||h.type:"";var f=h&&(h.downlink||h.downlinkMax||h.bandwidth)||null;if((f=f>999?999:f)&&(i.bandwidth=f),i.navtype=g.type===1?"Reload":"Other",o===1&&n[e[16]]>0&&n[e[1]]>0){var l=n[e[16]]-n[e[1]];l>=0&&l<36e5&&(i.fpt=l)}return o===1&&n[e[1]]>0?i.begin=n[e[1]]:o===2&&i.load>0?i.begin=a-i.load:i.begin=a,i},Qi}var Ls,Ns;function ja(){return Ns||(Ns=1,Ls=function(s,c,e){var t=je(),r=za(),i=Ha(),n=null,a=e.documentElement,o=c.innerWidth||a.clientWidth||e.body.clientWidth,u=c.innerHeight||a.clientHeight||e.body.clientHeight,h=c.navigator.connection,g={sr:screen.width+"x"+screen.height,vp:o+"x"+u,ct:h?h.effectiveType||h.type:""},f={},l=function(d,m,x,v,b){if(m===void 0){var y,E;if(!f[d]){y=new RegExp(d+"=([^;]+)");try{E=y.exec(e.cookie)}catch(C){return t.warn("[retcode] can not get cookie:",C),null}E&&(f[d]=E[1])}return f[d]}var I=d+"="+m;I+="; path=/",x&&(I+="; max-age="+x);try{return e.cookie=I,!!e.cookie}catch(C){return t.warn("[retcode] can not set cookie: ",C),!1}},p=function(d){var m=d._conf.uid||l("_nk_")||l("_bl_uid");return!m&&(m=t.uu(),!l("_bl_uid",m,15552e3))?null:m};return t.ext(s.prototype,{activeErrHandler:function(d){return n&&!d?this:(n=this,this)},errorHandler:function(d){if(!d)return this;var m=d.type;if(m==="error"){var x=d.target||d.srcElement;!x||!x.tagName||d.message||d.filename||d.lineno||d.colno?this.error(d.error||{message:d.message},d):this.resourceErrorHandler(d)}else m==="unhandledrejection"&&t.T(d.reason,"Error")&&t.checkAutoError(d.reason)&&this.error(d.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(v){}return this},resourceErrorHandler:function(d){var m=this,x=d.target||d.srcElement;try{var v=m.getSrc(x),b=typeof x.tagName=="string"?x.tagName.toLowerCase():"",y=m.getXPath(x,5),E=t.getURL(v),I={src:v&&v.substring(0,1e3),node_name:b,xpath:y,res_type:t.getResType(b,v),res_name:E.path,domain:E.domain};return m._conf.enableResource&&m.fixResourceStatus&&d.timeStamp&&m.fixResourceStatus({src:v,node_name:b,res_type:t.getResType(b,v),timeStamp:d.timeStamp,domain:E.domain}),m._lg("resourceError",I),m}catch(C){return t.warn("[ARMS] resourceErrorHandler error :",C),m}},getSrc:function(d){var m=d.src||d.href;try{if(!m){var x=(typeof d.tagName=="string"?d.tagName.toLowerCase():"")==="object",v=d.getAttribute("classid")&&d.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||d.getAttribute("type")==="application/x-shockwave-flash";x&&v&&(m=d.getAttribute("data")||d.getAttribute("codebase")),m||(m=d.outerHTML||d.innerHTML)}}catch(b){m=""}return m},getXPath:function(d,m){var x=d.id?"#"+d.id:"",v=typeof d.className=="string"?"."+d.className.split(" ").join("."):"",b=(typeof d.tagName=="string"?d.tagName.toLowerCase():"")+x+v;return d.parentNode&&d.parentNode.tagName&&m-1!=0?this.getXPath(d.parentNode,m-1)+" > "+b:b},sendPerformance:function(d){var m=this;m.onReady(function(){var x=i();x&&x.load&&x.load>0&&(x.page=m.getPage(!0),d&&(x=t.ext(x,d)),x.autoSend=!0,m.performance(x))})},sendResources:function(d){var m=this;m.onReady(function(){var x=r();x&&x.load&&x.load>0&&(x.load&&x.load<=2e3||x.load&&x.load<=8e3&&Math.random()>.05||(x.page=m.getPage(!0),x.dl=location.href,d&&(x=t.ext(x,d)),m._lg("res",x,m.getConfig("sample"))))})},sendPV:function(){var d=this;d.onReady(function(){var m=function(x){var v=p(x),b=c.devicePixelRatio||1;return{uid:v,dt:e.title,dl:location.href,dr:e.referrer,dpr:b.toFixed(2),de:(e.characterSet||e.defaultCharset||"").toLowerCase(),ul:a.lang,begin:Date.now()}}(d);m&&m.uid&&d._lg("pv",m,d.getConfig("pvSample"))})},commonInfo:function(){return g.uid=p(this),g.sid=function(d){if(d.session)return d.session;var m;try{if(typeof window=="object"&&typeof sessionStorage=="object"&&typeof sessionStorage.getItem=="function")return typeof(m=sessionStorage.getItem("_bl_sid"))=="string"?(d.session=m,m):(m=t.uu(),d.session=m,typeof sessionStorage.setItem=="function"&&sessionStorage.setItem("_bl_sid",m),m)}catch(x){t.warn("[ARMS] getSid error :",x)}return d.session=m=t.uu(),m}(this),g},handleUnload:function(d){var m=Date.now();if(m-this._lastUnload<200)return this;this._lastUnload=m,this.sendHealth(d),this.speedCache&&(this._lg("speed",this.speedCache),this.speedCache=null,clearTimeout(this.speedTimmer)),this._conf&&this._conf.enableResource&&this.resourceComboReport(),this.clear(!0)},bindHashChange:function(d){var m=this;if(!d^m.hashChangeHandler)return m;d?(m.hackHistoryState(),m.hashChangeHandler=function(x){var v=m._conf.parseHash(location.hash);v&&m.setPage(v,x!==!1)},m.stateChangeHandler=function(x){var v=m._conf.parseHash(x.detail);v&&m.setPage(v)},t.on(c,"hashchange",m.hashChangeHandler),t.on(c,"historystatechange",m.stateChangeHandler),m.hashChangeHandler(!1)):(t.off(c,"hashchange",m.hashChangeHandler),t.off(c,"historystatechange",m.stateChangeHandler),m.hashChangeHandler=null,m.stateChangeHandler=null)},initHandler:function(){var d=this;if(d.hasInitHandler)return d;var m=d._conf;return t.on(c,"beforeunload",function(){d.handleUnload(0)}),d.bindHashChange(m.enableSPA),d.activeErrHandler(!1),d.hasInitHandler=!0,d}}),t.on(c,"error",function(d){n&&n.errorHandler(d)},!1,!0).on(c,"unhandledrejection",function(d){n&&n.errorHandler(d)}),s}),Ls}var er,Ms;function Wa(){if(Ms)return er;Ms=1;var s=je(),c=500;return er=function(e,t,r){function i(g,f,l){var p=0,d=g.tagName;if(d!=="SCRIPT"&&d!=="STYLE"&&d!=="META"&&d!=="HEAD"){var m=g.children?g.children.length:0;if(m>0)for(var x=g.children,v=m-1;v>=0;v--)p+=i(x[v],f+1,p>0);if(p<=0&&!l&&!(g.getBoundingClientRect&&g.getBoundingClientRect().top<a))return 0;p+=1+.5*f}return p}function n(g){for(var f=1;f<g.length;f++)if(g[f].score<g[f-1].score)return g.splice(f,1),n(g);return g}var a=t.innerHeight||0,o=[],u=null,h=0;s.ext(e.prototype,{initFmpObserver:function(g){var f=this;if(!f._conf||!f._conf.useFmp)return null;if(!t.MutationObserver)return s.warn("[retcode] first meaningful paint can not be retrieved"),f.sendPerformance(),null;s.on(t,"beforeunload",function(){f.endObserving(0,!0)});var l=t.MutationObserver;return(u=new l(function(){(function(p){var d=Date.now()-p,m=r.querySelector("body");if(m){var x=0;x+=i(m,1,!1),o.push({score:x,t:d})}else o.push({score:0,t:d})})(f._startTime)})).observe(document,{childList:!0,subtree:!0}),h=1,f.onReady(function(){f.endObserving(g)}),u},endObserving:function(g,f){var l=this;if(u&&h)if(l.fmpTimmer&&(clearTimeout(l.fmpTimmer),l.fmpTimmer=null),f||!function(x,v){var b=Date.now()-x;return!(b>v||b-(o&&o.length&&o[o.length-1].t||0)>2*c)}(l._startTime,g)){u.disconnect(),h=0,o=n(o);for(var p=null,d=1;d<o.length;d++)if(o[d].t>=o[d-1].t){var m=o[d].score-o[d-1].score;(!p||p.rate<=m)&&(p={t:o[d].t,rate:m})}p&&p.t>0&&p.t<36e5?l.sendPerformance({fmp:p.t}):l.sendPerformance()}else l.fmpTimmer=s.delay(function(){l.endObserving(g)},c)}})},er}var Fs,Os;function Ka(){return Os||(Os=1,Fs=function(s,c){var e=je(),t=null,r=e.getCurDomain(),i=function(h,g,f,l,p,d,m,x,v,b,y,E,I){var C=e.J(p)||null,R=e.safetyCall(g,[C,l],null);if(!R)return!1;var L=R.code||d,k=!("success"in R)||R.success;h.api(f,k,m,L,R.msg,x,v,b,k?{}:y,r,E,I)},n="fetch",a="__oFetch_",o="__oXMLHttpRequest_",u="XMLHttpRequest";return e.ext(s.prototype,{removeHook:function(h,g){return t&&(g||this===t)?(c[a]&&(c[n]=c[a],delete c[a]),c[o]&&(c[u]=c[o],delete c[o]),t=null,this):this},addHook:function(h){return!h&&t?this:(t||(function(){if(typeof c[n]=="function"){var g=c[n];c[a]=g,c[n]=function(f,l){var p=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),d=t;if(!d||!d.api||l&&(l.method==="HEAD"||l.mode==="no-cors"))return g.apply(c,p);l||(l={});var m=Date.now(),x=d._conf,v=e.duration(),b=(f&&typeof f!="string"?f.url:f)||"",y=b;b=e.cutUrlSearch(b);var E=(x.ignore||{}).ignoreApis,I=x.parseTraceId;if(!e.checkAPI(b,!0)||e.ignoreByRule(b,E))return g.apply(c,p);b=e.filterByRule(b,y,x.ignoreApiPath?x.ignoreApiPath:x.apiHelper);var C=x.enableLinkTrace,R="",L="",k=d.getConfig("pid"),M=null,w=d.getConfig("sample"),N=d.getConfig("linkType"),_=1;if(w&&!d.sampling(w)&&(_=0),C){var V="";try{V=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(K){V=""}var ee=e.checkSameOrigin(y,V);if(d.getConfig("enableApiCors")||ee)if(f&&typeof f!="string")try{if(p[0].headers&&typeof p[0].headers.get=="function"&&typeof p[0].headers.append=="function")switch(N){case"arms":var q=p[0].headers.get("EagleEye-TraceID"),re=p[0].headers.get("EagleEye-SessionID"),$=p[0].headers.get("EagleEye-pAppName");q?R=q:(R=d.getTraceId()["EagleEye-TraceID"],p[0].headers.append("EagleEye-TraceID",R)),re?L=re:(L=d.getPageviewId()["EagleEye-SessionID"],p[0].headers.append("EagleEye-SessionID",L)),$||p[0].headers.append("EagleEye-pAppName",k);break;case"b3":var ie=p[0].headers.get("X-B3-TraceId");if(ie)R=ie;else{var T=d.getB3TraceId(_);p[0].headers.append("X-B3-TraceId",T["X-B3-TraceId"]),p[0].headers.append("X-B3-ParentSpanId",T["X-B3-ParentSpanId"]),p[0].headers.append("X-B3-SpanId",T["X-B3-SpanId"]),p[0].headers.append("X-B3-Sampled",T["X-B3-Sampled"]),p[0].headers.append("X-Request-ID",e.guid()),R=T["X-B3-TraceId"]}L=d.pageview;break;case"tracing":default:var B=p[0].headers.get("uber-trace-id");B?R=B.split(":")[0]:(B=d.getUberTraceId(_),p[0].headers.append("uber-trace-id",B["uber-trace-id"]),R=B.traceId),L=d.pageview}}catch(K){e.warn(`[retcode] fetch failed to set header, exception is :
4
+ `+K)}else switch(l.headers=l.headers?l.headers:{},N){case"arms":l.headers["EagleEye-TraceID"]?R=l.headers["EagleEye-TraceID"]:(R=d.getTraceId()["EagleEye-TraceID"],l.headers["EagleEye-TraceID"]=R),l.headers["EagleEye-SessionID"]?L=l.headers["EagleEye-SessionID"]:(L=d.getPageviewId()["EagleEye-SessionID"],l.headers["EagleEye-SessionID"]=L),l.headers["EagleEye-pAppName"]||(l.headers["EagleEye-pAppName"]=k);break;case"b3":if(l.headers["X-B3-TraceId"])R=l.headers["X-B3-TraceId"];else{var H=d.getB3TraceId(_);l.headers["X-B3-TraceId"]=H["X-B3-TraceId"],l.headers["X-B3-ParentSpanId"]=H["X-B3-ParentSpanId"],l.headers["X-B3-SpanId"]=H["X-B3-SpanId"],l.headers["X-B3-Sampled"]=H["X-B3-Sampled"],l.headers["X-Request-ID"]=e.guid(),R=H["X-B3-TraceId"]}L=d.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(l.headers["uber-trace-id"])R=l.headers["uber-trace-id"].split(":")[0];else{var F=d.getUberTraceId(_);l.headers["uber-trace-id"]=F["uber-trace-id"],R=F.traceId}L=d.getPageviewId()["EagleEye-SessionID"]}}return g.apply(c,p).then(function(K){if(!d||!d.api)return K;try{if(!K||typeof K.clone!="function")return K;var Y=K.clone(),ge=Y.headers;if(ge&&typeof ge.get=="function"){var se=ge.get("content-type");if(se&&!/(text)|(json)/.test(se))return K;if(!R){var xe=e.parseFetchHeaders(ge);typeof xe=="object"&&xe["eagleeye-traceid"]&&(R=xe["eagleeye-traceid"],M="response")}}var Re=v();return Y.text().then(function(Ce){if(!R&&e.isFunction(I)){var Me=I(Y,Ce);Me&&e.isString(Me)&&(R=Me)}var ke=e.getFetchSnapshot(p,Ce,ge);Y.ok?i(d,x.parseResponse,b,y,Ce,Y.status||200,Re,m,R,L,ke,M,_):(d.api(b,!1,Re,Y.status||404,Y.statusText,m,R,L,ke,r,M,_),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:Y.url,res_type:"api"}))}),K}catch(Ce){return e.warn("[ARMS] fetch response error :",Ce),K}}).catch(function(K){if(!d||!d.api)throw K;var Y=v();throw d.api(b,!1,Y,K.name||"Error",K.message,m,R,L,{},r),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:y,res_type:"api"}),K})},c[n].toString=e.createFakeToString(n)}}(),function(){if(typeof c[u]=="function"){var g,f=c[u];c[o]=f;var l=function(p){var d=new f(p),m=t;if(!m||!m.api||!d.addEventListener)return d;var x,v,b,y,E=d.send,I=d.open,C=d.setRequestHeader,R=m._conf,L=(R.ignore||{}).ignoreApis,k=R.parseTraceId,M=m.getConfig("enableLinkTrace"),w="",N="",_="",V=null,ee=m.getConfig("sample"),q=m.getConfig("linkType"),re=1;return ee&&!m.sampling(ee)&&(re=0),d.open=function($,ie){g=$;var T=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);I.apply(d,T),y=ie||"",b=e.cutUrlSearch(y);var B=!e.checkAPI(b,!0)||e.ignoreByRule(b,L);if(b=b?e.filterByRule(b,y,R.ignoreApiPath?R.ignoreApiPath:R.apiHelper):"",!B&&M){var H="";try{H=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(ge){H=""}var F=e.checkSameOrigin(y,H);if((m.getConfig("enableApiCors")||F)&&C&&typeof C=="function")switch(q){case"arms":w=m.getTraceId()["EagleEye-TraceID"],C.apply(d,["EagleEye-TraceID",w]),N=m.getPageviewId()["EagleEye-SessionID"],C.apply(d,["EagleEye-SessionID",N]),_=m.getConfig("pid"),C.apply(d,["EagleEye-pAppName",_]);break;case"b3":var K=m.getB3TraceId(re);C.apply(d,["X-B3-TraceId",K["X-B3-TraceId"]]),C.apply(d,["X-B3-ParentSpanId",K["X-B3-ParentSpanId"]]),C.apply(d,["X-B3-SpanId",K["X-B3-SpanId"]]),C.apply(d,["X-B3-Sampled",K["X-B3-Sampled"]]),C.apply(d,["X-Request-ID",e.guid()]),w=K["X-B3-TraceId"],N=m.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var Y=m.getUberTraceId(re);C.apply(d,["uber-trace-id",Y["uber-trace-id"]]),w=Y.traceId,N=m.getPageviewId()["EagleEye-SessionID"]}}},d.send=function(){x=Date.now(),v=e.duration();var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);E.apply(d,$)},e.on(d,"readystatechange",function(){if(b&&d.readyState===4){var $=v(),ie=e.getXhrSnapshot(y,g,d);if(!w){var T=e.parseXhrHeaders(typeof d.getAllResponseHeaders=="function"&&d.getAllResponseHeaders()||"");typeof T=="object"&&T["eagleeye-traceid"]&&(w=T["eagleeye-traceid"],V="response")}if(!w&&e.isFunction(k)){var B=k(d);B&&e.isString(B)&&(w=B)}if(d.status>=200&&d.status<=299){var H=d.status||200;if(typeof d.getResponseHeader=="function"){var F=d.getResponseHeader("Content-Type");if(F&&!/(text)|(json)/.test(F))return}d.responseType&&d.responseType!=="text"?m.api(b,!0,$,H,"",x,w,N,{},r,V,re):i(m,R.parseResponse,b,y,d.responseText,H,$,x,w,N,ie,V,re)}else m.api(b,!1,$,d.status||"FAILED",d.statusText,x,w,N,ie,r,V,re),R.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:d.responseURL||y,res_type:"api"})}}),d};l.prototype=f.prototype,e.each(Object.keys(f),function(p){l[p]=f[p]}),c[u]=l,c[u].toString=e.createFakeToString(u)}}()),t=this,this)},initHook:function(){return this.hasInitHook?this:(this.getConfig("disableHook")||this.addHook(),this.hasInitHook=!0,this)}}),s}),Fs}var Vs,Us;function $a(){return Us||(Us=1,Vs=function(s,c){var e=je(),t=c.history||{},r=c.document,i=function(a,o){var u;c.CustomEvent?u=new CustomEvent(a,{detail:o}):((u=r.createEvent("HTMLEvents")).initEvent(a,!1,!0),u.detail=o),c.dispatchEvent(u)},n=function(a){var o=t[a];typeof o=="function"&&(t[a]=function(u,h,g){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),l=location.href,p=o.apply(t,f);if(!g||typeof g!="string"||g===l)return p;try{var d=l.split("#"),m=g.split("#"),x=e.cutUrlSearch(d[0]),v=e.cutUrlSearch(m[0]),b=d[1]&&d[1].replace(/^\/?(.*)/,"$1"),y=m[1]&&m[1].replace(/^\/?(.*)/,"$1");b!==y?i("historystatechange",y):x!==v&&i("historystatechange",v)}catch(E){e.warn("[retcode] error in "+a+": "+E)}return p},t[a].toString=e.createFakeToString(a))};e.ext(s.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),Vs}var tr,zs;function qa(){if(zs)return tr;zs=1;var s=je(),c=Zi(),e=c.TIMING_KEYS;return tr=function(t,r){function i(o,u,h){if(o instanceof r.PerformanceResourceTiming&&o.initiatorType){var g=s.getResType(o.initiatorType,o.name),f=u.resourceTypes||[],l=(u.ignore||{}).ignoreResources;if(g&&f.includes(g)&&!s.ignoreByRule(o.name,l)&&!s.ignoreByRule(s.decode(o.name),l)){var p=o[e[0]],d=o[e[1]],m=o[e[2]],x=o[e[3]],v=o[e[4]],b=o[e[5]],y=o[e[6]],E=o[e[7]],I=o[e[8]],C=o[e[18]],R=o[e[19]];if(!h.has(o)&&(!s.areInOrder(p,d,m,x,v,b,y,E,I)||p>E))return;if(C<p&&(C=p),R<p&&(R=d),s.areInOrder(p,C,R,d))return{domain:s.getURL(o.name).domain,res_type:g,src_type:s.getSrcType(o.name,u.cdnHostList),success:1,size:Math.round(o.decodedBodySize),duration:Math.round(o.duration),timeStamp:o.responseEnd,timing:o}}}}var n="_resource-"+Date.now(),a="_resource_error-"+Date.now();s.ext(t.prototype,{initResource:function(){var o=this,u=r.performance,h=r.PerformanceObserver;if(o[a]||(o[a]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var g=u.getEntriesByType("resource")||[];return setTimeout(function(){o.setResource(g)},10),new h(function(f){setTimeout(function(){o.setResource(f.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(o.resourceComboReport.bind(o),5e3)}),o},setResource:function(o){var u=this._conf,h=this[a];if(s.isArray(o)&&o.length){this[n]||(this[n]={});for(var g=this[n],f=0,l=o.length;f<l;f+=1){var p=o[f];if(s.checkAPI(p.name,!1)){var d=i(p,u,h);if(d){var m=d.res_type+"-"+d.domain;m in g||(g[m]=[]),g[m].push(d)}}}return this}},fixResourceStatus:function(o){var u=r.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[a];if(!o.src||!s.checkAPI(o.src,!1))return this;var g=o.timeStamp||u.now(),f=u.getEntriesByName(o.src,"resource");return s.each(f,function(l){h.has(l)||g-l.responseEnd<100&&h.set(l,{success:0})}),this},resourceComboReport:function(){var o=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[a];this[n]={};var g=Object.keys(o);if(g.length!==0){var f=[];s.each(g,function(m){var x=o[m],v={domain:"",res_type:"",src_type:"",size:0,duration:0,count:0,err_count:0,err_duration:0,slow_count:0,slow_duration:0,timings:[]};s.each(x,function(b){var y=b.timing||{},E=h.get(b.timing),I=E?E.success:1,C=b.duration>u?1:0;v.domain=b.domain,v.res_type=b.res_type,v.src_type=b.src_type,v.count+=1,v.duration+=b.duration,v.size+=b.size,I||(v.err_count+=1,v.err_duration+=b.duration),C&&(v.slow_count+=1,v.slow_duration+=b.duration);try{var R=JSON.parse(JSON.stringify(y));R.success=I,R.resourceSlow=u,R.isSlow=C,v.timings.push(R)}catch(L){}}),v.count&&(v.size=Math.round(v.size/v.count),v.duration=Math.round(v.duration/v.count)),v.slow_count&&(v.slow_duration=Math.round(v.slow_duration/v.slow_count)),v.err_count&&(v.err_duration=Math.round(v.err_duration/v.err_count)),v.timings.length>20&&(v.timings.sort(function(b,y){return y.duration-b.duration}),v.timings.length=20),v.timings=encodeURIComponent(JSON.stringify(v.timings)),f.push(v)});var l={_combo:1,resource:JSON.stringify(f)},p=r.navigator.connection;l.ct=p?p.effectiveType||p.type:"";var d=p&&(p.downlink||p.downlinkMax||p.bandwidth)||null;(d=d>999?999:d)&&(l.bandwidth=d),this._lg("resource",l,this.getConfig("sample"))}}})},tr}var Hs;function Ga(){if(Hs)return Qe.exports;Hs=1;var s=je(),c=Fa(),e=Oa(),t=Va(),r=s.win,i=r.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,a=function(o){var u=this;return c.call(u,o),u._initialPage=o.page&&s.safetyCall(o.page,[],o.page+"")||null,u._isRobot=s.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,g){h==="error"?u._health.errcount++:h==="api"&&u._health[g.success?"apisucc":"apifail"]++},o.enableInstanceAutoSend!==!1&&(u.initHandler(),u.initHook(),u.initFmpObserver(1e4),u._conf&&u._conf.behavior&&typeof u.initBehavior=="function"&&u.initBehavior(),u._conf&&u._conf.enableResource&&typeof u.initResource=="function"&&u.initResource()),Object.defineProperty&&r.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return a.prototype=s.createObject(c.prototype),s.ext(c._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],resourceHelper:[],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",cdnHostList:[],resourceTypes:["css","script","img","font"],resourceSlow:2e3,disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(o){return(o?s.cutUrlSearch(o.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(o){if(!o||typeof o!="object")return{};var u=o.code,h=o.msg||o.message||o.subMsg||o.errorMsg||o.ret||o.errorResponse||"";return typeof h=="object"&&(u=u||h.code,h=h.msg||h.message||h.info||h.ret||JSON.stringify(h)),{msg:h,code:u,success:!0}}}),s.ext(a.prototype,{constructor:a,_super:c,onReady:function(o){var u=this;if(u.hasReady)return o();i.readyState==="complete"?(u.hasReady=!0,o()):s.on(r,"load",function(){u.hasReady=!0,o()},!0)},getPage:function(o){var u=this._conf,h=u.page,g=location,f=g.host+g.pathname;return h&&!o?s.safetyCall(h,[],h+""):this._initialPage||s.filterByRule(u.ignoreUrlCase?f.toLowerCase():f,g.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(o,u){var h=this,g=h.prevPage;if(u!==!1){if(!o||o===g)return h;h.prevPage=o,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=o;return h._conf.page=o,h},setConfig:function(o,u){if(o&&typeof o=="object"){s.verifyConfig(o),o=this.setImgUrl(o);var h=this._conf;if(this._conf=s.ext({},h,o),!u){var g="disableHook";g in o&&h[g]!==o[g]&&(o[g]?this.removeHook():this.addHook()),(g="enableSPA")in o&&h[g]!==o[g]&&this.bindHashChange(o[g])}}},sendRequest:function(o){e(o,this.getConfig("imgUrl"))},postData:function(o,u){var h={};h[u]=o[u],delete o[u];var g="";typeof o=="object"&&(g=s.serialize(o)),t(h,this.getConfig("imgUrl")+g+"&post_res=")},sendPipe:function(o){var u=this;if(!o||!o.length)return u;try{if(s.T(o[0])==="Array")return s.each(o,function(g){return u.sendPipe(g)});if(s.T(o)!=="Array")return u;var h=o.shift();if(!n.test(h))return u;u[h].apply(u,o)}catch(g){return s.warn("[retcode] error in sendPipe",g),u}},sendHealth:function(){var o=s.ext({},this._health);o.healthy=o.errcount>0?0:1,o.begin=Date.now();var u=o.begin-this.sBegin;o.stay=u,this._lg("health",o,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(o){o=s.ext({pid:this._conf.pid},o);var u=this.__proto__.constructor(o);return o.page&&u.sendPV(),u}}),Ua()(a,r),ja()(a,r,i),Wa()(a,r,i),Ka()(a,r),$a()(a,r),qa()(a,r),a._super=c,a._root=c._root,c.Browser=a,Qe.exports=a,Qe.exports}var js;function Ja(){if(js)return dt.exports;js=1;function s(a,o){var u=e[r]=new t(a);u.sendPipe(o);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[i]=!0,u}function c(){if(e[i])return e[r];var a={},o=[];return r in e&&(a=e[r].config||{},o=e[r].pipe||[]),s(a,o)}var e=window,t=e.BrowserLogger=Ga(),r=je().key,i="__hasInitBlSdk";t.singleton=function(a,o){return e[i]?e[r]:s(a,o)},t.createExtraInstance=function(a){a&&typeof a=="object"&&a.enableInstanceAutoSend!==!0&&(a.enableInstanceAutoSend=!1);var o=new t(a),u=o._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&o.sendPV(),u&&u.useFmp||o.sendPerformance(),u&&u.sendResource&&o.sendResources()),o};var n=typeof window=="object"&&!!window.navigator;return n&&e[r]&&(t.bl=c()),dt.exports=t,dt.exports}function Xa(){return Ja()}var Za={getArmsLogger:Xa};function Ya(s,c,e){const t=[],r=typeof Object.getOwnPropertyDescriptors=="function"?Object.getOwnPropertyDescriptors(Object.getPrototypeOf(s)):{};for(const n of Object.keys(r))r[n].get&&t.push(n);const i={MediaboxWrapperObjectGetter(n,a){if(typeof a=="string"&&t.indexOf(a)>-1)return xt(n[a],c+1,e);const o={MediaboxWrapperObjectMethod(...u){return xt(n[a](...u),c+1,e)}};return typeof n[a]=="function"?o.MediaboxWrapperObjectMethod:c>10?n[a]:xt(n[a],c+1,e)},MediaboxWrapperObjectSetter(n,a,o){return n[a]=xt(o,c+1,e),!0}};return new Proxy(s,{get:i.MediaboxWrapperObjectGetter,set:i.MediaboxWrapperObjectSetter})}function Qa(s,c,e){const t={MediaboxWrapperFunctionApply(r,i,n){const a=r.apply(i,n);return xt(a,c+1,e)},MediaboxWrapperFunctionGet(r,i){const n=Object.getOwnPropertyDescriptor(r,i);if(n&&!n.writable&&!n.configurable)return r[i];const a={MediaboxWrapperFunctionGet(...o){const u=r[i](...o);return xt(u,c+1,e)}};return typeof r[i]=="function"?a.MediaboxWrapperFunctionGet:xt(r[i],c+1,e)},MediaboxWrapperClassConstructor(r,i){const n=new r(...i);return xt(n,c+1,e)}};return new Proxy(s,{apply:t.MediaboxWrapperFunctionApply,get:t.MediaboxWrapperFunctionGet,construct:t.MediaboxWrapperClassConstructor})}const eo=s=>s!==null&&typeof s=="object",to=s=>Object.prototype.toString.call(s).slice(8,-1),io=s=>Object.isExtensible(s)?to(s)==="Object":!1;function xt(s,c,e){return typeof s=="function"?Qa(s,c+1,e):s instanceof Promise?s.then(t=>xt(t,c+1,e)).catch(t=>(t instanceof Error&&typeof t.stack=="string"&&t.stack.indexOf("MediaboxWrapper")>-1&&e(t),Promise.reject(t))):Array.isArray(s)?s.map(t=>xt(t,c+1,e)):eo(s)&&io(s)?Ya(s,c+1,e):s}const ro="https://arms-retcode-sg.aliyuncs.com/r.png?",so="https://arms-retcode.aliyuncs.com/r.png?",no="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",ao={cn:so,sg:ro,usw:no};class ir{constructor(c){nt(this,"armsLogger"),nt(this,"isReady",!1),nt(this,"isDestroyed",!1),nt(this,"options"),nt(this,"queue",[]),nt(this,"helper",{MediaboxWrapperQueue(n){return new Error(n)},MediaboxWrapperInitiative(n){return new Error(n)}}),this.options=c;const{region:e="cn",env:t="prod"}=c,r=n=>{var a;if(this.isDestroyed)return!1;if(n.c1=(a=this.options.cid)!=null?a:window.location.host,n.c2=ir.version,this.options.customData&&(n.c3=new URLSearchParams(this.options.customData).toString()),n.t==="error"){if(n.file.indexOf("g.alicdn.com/apsara-media-")>-1||n.file.indexOf("g.alicdn.com/thor-server")>-1||n.stack.indexOf("MediaboxWrapper")>-1){let o=n;return this.options.beforeSend&&(o=this.options.beforeSend(n)),this.isReady?o:(o&&this.queue.push(o),!1)}return!1}return n},i=Za.getArmsLogger();this.armsLogger=i.singleton({pid:"e1iftji1w7@7ec1cef2cc88733",tag:c.businessName,release:`${c.businessName}_${c.version}`,imgUrl:ao[e],behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:r})}static get version(){return"0.10.0"}wrap(c){return this.options.disabled||typeof Proxy>"u"?c:xt(c,0,e=>this.armsLogger.error(e))}updateOptions(c){this.options=Se(Se({},this.options),c)}setReady(){this.isReady=!0,this.queue.length&&this.queue.forEach(c=>{this.armsLogger.error(this.helper.MediaboxWrapperQueue(c.msg),{filename:c.file,lineno:c.line,colno:c.col})})}report(c,e){this.armsLogger.error(this.helper.MediaboxWrapperInitiative(c),e)}destroy(){this.isDestroyed=!0}}for(var Ie=(s=>(s.PullStreamStats="remoteStat",s.RtsSubscribeExceeds="rtsSubscribeExceeds",s.UserJoined="userJoined",s.UserLeft="userLeft",s.Bye="bye",s.MuteAudio="muteAudio",s.UnmuteAudio="unmuteAudio",s.MuteVideo="muteVideo",s.UnmuteVideo="unmuteVideo",s.MuteScreen="muteScreen",s.UnmuteScreen="unmuteScreen",s.Error="error",s))(Ie||{}),et=(s=>(s.Local="local-device-status-change",s.Remote="remote-device-status-change",s))(et||{}),Z=(s=>(s.Audio="sophon_audio",s.VideoLarge="sophon_video_camera_large",s.VideoSmall="sophon_video_camera_small",s.Screen="sophon_video_screen_share",s))(Z||{}),rr=(s=>(s.Audio="rts audio",s.VideoLarge="rts video",s))(rr||{}),Ft=(s=>(s.Add="add",s.Delete="delete",s.Replace="replace",s.Stop="stop",s.UnPublish="unpublish",s))(Ft||{}),Yt=(s=>(s[s.Camera=0]="Camera",s[s.Screen=1]="Screen",s[s.Image=2]="Image",s))(Yt||{}),yi=(s=>(s[s.Microphone=0]="Microphone",s[s.Screen=1]="Screen",s[s.Mixed=2]="Mixed",s))(yi||{}),Be=(s=>(s.InRoom="inRoom",s.Join="join",s.Publish="publish",s.User="user",s.Resume="resume",s))(Be||{}),Ot=(s=>(s[s.MANUAL=0]="MANUAL",s[s.JOINCHANNEL=1]="JOINCHANNEL",s))(Ot||{}),Ge=[],sr=0;sr<256;++sr)Ge.push((sr+256).toString(16).slice(1));function oo(s,c=0){return(Ge[s[c+0]]+Ge[s[c+1]]+Ge[s[c+2]]+Ge[s[c+3]]+"-"+Ge[s[c+4]]+Ge[s[c+5]]+"-"+Ge[s[c+6]]+Ge[s[c+7]]+"-"+Ge[s[c+8]]+Ge[s[c+9]]+"-"+Ge[s[c+10]]+Ge[s[c+11]]+Ge[s[c+12]]+Ge[s[c+13]]+Ge[s[c+14]]+Ge[s[c+15]]).toLowerCase()}var Ai,co=new Uint8Array(16);function uo(){if(!Ai&&(Ai=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ai))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ai(co)}var ho=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ws={randomUUID:ho};function Vt(s,c,e){if(Ws.randomUUID&&!c&&!s)return Ws.randomUUID();s=s||{};var t=s.random||(s.rng||uo)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,c){e=e||0;for(var r=0;r<16;++r)c[e+r]=t[r];return c}return oo(t)}var Ei=(s=>(s.prod="rs.rtn.aliyuncs.com",s.pre="prs.rtn.aliyuncs.com",s))(Ei||{});const nr="6.11.7",Ks="web";class At{static getVersionNumber(){let c=nr.split("."),e="";return c.forEach(t=>{t.length===1?e+="0"+t:e+=t}),parseInt(e)}static queryingParam(c){let e=[];if(c)for(let t in c)e.push(t+"="+c[t]);return e.join("&")}static getQueryParams(c){const t=window.location.search.substring(1).split("&");for(let r=0;r<t.length;r++){const i=t[r].split("=");if(decodeURIComponent(i[0])===c)return decodeURIComponent(i[1])}}static createCallid(c=""){const e=Vt();return c&&e&&e.length>c.length?`${c}${e.substring(c.length)}`:e}static checkSubOptionsValid(c){if(c){const{audio:e,video:t,screen:r}=c;if(e===!1&&t===!1&&r===!1)return!1}return!0}static isNetworkAvailable(){return z(this,null,function*(){const c=Ei.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${c}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var _e=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function $s(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function lo(s){if(s.__esModule)return s;var c=s.default;if(typeof c=="function"){var e=function t(){return this instanceof t?Reflect.construct(c,arguments,this.constructor):c.apply(this,arguments)};e.prototype=c.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(s).forEach(function(t){var r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return s[t]}})}),e}function ci(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var qs={exports:{}};/*!
5
5
 
6
6
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
7
7
  <http://stuartk.com/jszip>
@@ -11,11 +11,8 @@ var Oh=Object.defineProperty,Vh=Object.defineProperties;var Uh=Object.getOwnProp
11
11
 
12
12
  JSZip uses the library pako released under the MIT license :
13
13
  https://github.com/nodeca/pako/blob/main/LICENSE
14
- */(function(s,c){(function(e){s.exports=e()})(function(){return function e(t,i,r){function n(u,h){if(!i[u]){if(!t[u]){var g=typeof Wi=="function"&&Wi;if(!h&&g)return g(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[u]={exports:{}};t[u][0].call(d.exports,function(p){var l=t[u][1][p];return n(l||p)},d,d.exports,e,t,i,r)}return i[u].exports}for(var o=typeof Wi=="function"&&Wi,a=0;a<r.length;a++)n(r[a]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(a){for(var u,h,g,f,d,p,l,m=[],x=0,v=a.length,b=v,w=r.getTypeOf(a)!=="string";x<a.length;)b=v-x,g=w?(u=a[x++],h=x<v?a[x++]:0,x<v?a[x++]:0):(u=a.charCodeAt(x++),h=x<v?a.charCodeAt(x++):0,x<v?a.charCodeAt(x++):0),f=u>>2,d=(3&u)<<4|h>>4,p=1<b?(15&h)<<2|g>>6:64,l=2<b?63&g:64,m.push(o.charAt(f)+o.charAt(d)+o.charAt(p)+o.charAt(l));return m.join("")},i.decode=function(a){var u,h,g,f,d,p,l=0,m=0,x="data:";if(a.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var v,b=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&b--,a.charAt(a.length-2)===o.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=n.uint8array?new Uint8Array(0|b):new Array(0|b);l<a.length;)u=o.indexOf(a.charAt(l++))<<2|(f=o.indexOf(a.charAt(l++)))>>4,h=(15&f)<<4|(d=o.indexOf(a.charAt(l++)))>>2,g=(3&d)<<6|(p=o.indexOf(a.charAt(l++))),v[m++]=u,d!==64&&(v[m++]=h),p!==64&&(v[m++]=g);return v}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function u(h,g,f,d,p){this.compressedSize=h,this.uncompressedSize=g,this.crc32=f,this.compression=d,this.compressedContent=p}u.prototype={getContentWorker:function(){var h=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),g=this;return h.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,g,f){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(g.compressWorker(f)).pipe(new a("compressedSize")).withStreamInfo("compression",g)},t.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=function(){for(var o,a=[],u=0;u<256;u++){o=u;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[u]=o}return a}();t.exports=function(o,a){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?function(u,h,g,f){var d=n,p=f+g;u^=-1;for(var l=f;l<p;l++)u=u>>>8^d[255&(u^h[l])];return-1^u}(0|a,o,o.length,0):function(u,h,g,f){var d=n,p=f+g;u^=-1;for(var l=f;l<p;l++)u=u>>>8^d[255&(u^h.charCodeAt(l))];return-1^u}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r=null;r=typeof Promise!="undefined"?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",n=e("pako"),o=e("./utils"),a=e("./stream/GenericWorker"),u=r?"uint8array":"array";function h(g,f){a.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,g.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(f){g.push({data:f,meta:g.meta})}},i.compressWorker=function(g){return new h("Deflate",g)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(d,p){var l,m="";for(l=0;l<p;l++)m+=String.fromCharCode(255&d),d>>>=8;return m}function n(d,p,l,m,x,v){var b,w,_=d.file,C=d.compression,E=v!==u.utf8encode,I=o.transformTo("string",v(_.name)),L=o.transformTo("string",u.utf8encode(_.name)),k=_.comment,N=o.transformTo("string",v(k)),R=o.transformTo("string",u.utf8encode(k)),M=L.length!==_.name.length,y=R.length!==k.length,V="",Q="",q="",ne=_.dir,$=_.date,ie={crc32:0,compressedSize:0,uncompressedSize:0};p&&!l||(ie.crc32=d.crc32,ie.compressedSize=d.compressedSize,ie.uncompressedSize=d.uncompressedSize);var D=0;p&&(D|=8),E||!M&&!y||(D|=2048);var B=0,z=0;ne&&(B|=16),x==="UNIX"?(z=798,B|=function(K,be){var he=K;return K||(he=be?16893:33204),(65535&he)<<16}(_.unixPermissions,ne)):(z=20,B|=function(K){return 63&(K||0)}(_.dosPermissions)),b=$.getUTCHours(),b<<=6,b|=$.getUTCMinutes(),b<<=5,b|=$.getUTCSeconds()/2,w=$.getUTCFullYear()-1980,w<<=4,w|=$.getUTCMonth()+1,w<<=5,w|=$.getUTCDate(),M&&(Q=r(1,1)+r(h(I),4)+L,V+="up"+r(Q.length,2)+Q),y&&(q=r(1,1)+r(h(N),4)+R,V+="uc"+r(q.length,2)+q);var O="";return O+=`
15
- \0`,O+=r(D,2),O+=C.magic,O+=r(b,2),O+=r(w,2),O+=r(ie.crc32,4),O+=r(ie.compressedSize,4),O+=r(ie.uncompressedSize,4),O+=r(I.length,2),O+=r(V.length,2),{fileRecord:g.LOCAL_FILE_HEADER+O+I+V,dirRecord:g.CENTRAL_FILE_HEADER+r(z,2)+O+r(N.length,2)+"\0\0\0\0"+r(B,4)+r(m,4)+I+V+N}}var o=e("../utils"),a=e("../stream/GenericWorker"),u=e("../utf8"),h=e("../crc32"),g=e("../signature");function f(d,p,l,m){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=l,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,a),f.prototype.push=function(d){var p=d.meta.percent||0,l=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,a.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:l?(p+100*(l-m-1))/l:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var l=n(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:l.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,l=n(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(l.dirRecord),p)this.push({data:function(m){return g.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(m.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:l.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var l=this.bytesWritten-d,m=function(x,v,b,w,_){var C=o.transformTo("string",_(w));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(x,2)+r(x,2)+r(v,4)+r(b,4)+r(C.length,2)+C}(this.dirRecords.length,l,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(d){this._sources.push(d);var p=this;return d.on("data",function(l){p.processChunk(l)}),d.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),d.on("error",function(l){p.error(l)}),this},f.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(d){var p=this._sources;if(!a.prototype.error.call(this,d))return!1;for(var l=0;l<p.length;l++)try{p[l].error(d)}catch(m){}return!0},f.prototype.lock=function(){a.prototype.lock.call(this);for(var d=this._sources,p=0;p<d.length;p++)d[p].lock()},t.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(o,a,u){var h=new n(a.streamFiles,u,a.platform,a.encodeFileName),g=0;try{o.forEach(function(f,d){g++;var p=function(v,b){var w=v||b,_=r[w];if(!_)throw new Error(w+" is not a valid compression method !");return _}(d.options.compression,a.compression),l=d.options.compressionOptions||a.compressionOptions||{},m=d.dir,x=d.date;d._compressWorker(p,l).withStreamInfo("file",{name:f,dir:m,date:x,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(h)}),h.entriesCount=g}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var n=new r;for(var o in this)typeof this[o]!="function"&&(n[o]=this[o]);return n}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(n,o){return new r().loadAsync(n,o)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),o=e("./utf8"),a=e("./zipEntries"),u=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function g(f){return new n.Promise(function(d,p){var l=f.decompressed.getContentWorker().pipe(new u);l.on("error",function(m){p(m)}).on("end",function(){l.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}t.exports=function(f,d){var p=this;return d=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&&h.isStream(f)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(l){var m=new a(d);return m.load(l),m}).then(function(l){var m=[n.Promise.resolve(l)],x=l.files;if(d.checkCRC32)for(var v=0;v<x.length;v++)m.push(g(x[v]));return n.Promise.all(m)}).then(function(l){for(var m=l.shift(),x=m.files,v=0;v<x.length;v++){var b=x[v],w=b.fileNameStr,_=r.resolve(b.fileNameStr);p.file(_,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:d.createFolders}),b.dir||(p.file(_).unsafeOriginalName=w)}return m.zipComment.length&&(p.comment=m.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function o(a,u){n.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(u)}r.inherits(o,n),o.prototype._bindStream=function(a){var u=this;(this._stream=a).pause(),a.on("data",function(h){u.push({data:h,meta:{percent:0}})}).on("error",function(h){u.isPaused?this.generatedError=h:u.error(h)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},o.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(o,a,u){r.call(this,a),this._helper=o;var h=this;o.on("data",function(g,f){h.push(g)||h._helper.pause(),u&&u(f)}).on("error",function(g){h.emit("error",g)}).on("end",function(){h.push(null)})}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(r,n){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,n);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,n)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var n=new Buffer(r);return n.fill(0),n},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(e,t,i){function r(_,C,E){var I,L=o.getTypeOf(C),k=o.extend(E||{},h);k.date=k.date||new Date,k.compression!==null&&(k.compression=k.compression.toUpperCase()),typeof k.unixPermissions=="string"&&(k.unixPermissions=parseInt(k.unixPermissions,8)),k.unixPermissions&&16384&k.unixPermissions&&(k.dir=!0),k.dosPermissions&&16&k.dosPermissions&&(k.dir=!0),k.dir&&(_=x(_)),k.createFolders&&(I=m(_))&&v.call(this,I,!0);var N=L==="string"&&k.binary===!1&&k.base64===!1;E&&E.binary!==void 0||(k.binary=!N),(C instanceof g&&C.uncompressedSize===0||k.dir||!C||C.length===0)&&(k.base64=!1,k.binary=!0,C="",k.compression="STORE",L="string");var R=null;R=C instanceof g||C instanceof a?C:p.isNode&&p.isStream(C)?new l(_,C):o.prepareContent(_,C,k.binary,k.optimizedBinaryString,k.base64);var M=new f(_,R,k);this.files[_]=M}var n=e("./utf8"),o=e("./utils"),a=e("./stream/GenericWorker"),u=e("./stream/StreamHelper"),h=e("./defaults"),g=e("./compressedObject"),f=e("./zipObject"),d=e("./generate"),p=e("./nodejsUtils"),l=e("./nodejs/NodejsStreamInputAdapter"),m=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var C=_.lastIndexOf("/");return 0<C?_.substring(0,C):""},x=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},v=function(_,C){return C=C!==void 0?C:h.createFolders,_=x(_),this.files[_]||r.call(this,_,null,{dir:!0,createFolders:C}),this.files[_]};function b(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var w={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var C,E,I;for(C in this.files)I=this.files[C],(E=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&_(E,I)},filter:function(_){var C=[];return this.forEach(function(E,I){_(E,I)&&C.push(I)}),C},file:function(_,C,E){if(arguments.length!==1)return _=this.root+_,r.call(this,_,C,E),this;if(b(_)){var I=_;return this.filter(function(k,N){return!N.dir&&I.test(k)})}var L=this.files[this.root+_];return L&&!L.dir?L:null},folder:function(_){if(!_)return this;if(b(_))return this.filter(function(L,k){return k.dir&&_.test(L)});var C=this.root+_,E=v.call(this,C),I=this.clone();return I.root=E.name,I},remove:function(_){_=this.root+_;var C=this.files[_];if(C||(_.slice(-1)!=="/"&&(_+="/"),C=this.files[_]),C&&!C.dir)delete this.files[_];else for(var E=this.filter(function(L,k){return k.name.slice(0,_.length)===_}),I=0;I<E.length;I++)delete this.files[E[I].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var C,E={};try{if((E=o.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");o.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var I=E.comment||this.comment||"";C=d.generateWorker(this,E,I)}catch(L){(C=new a("error")).error(L)}return new u(C,E.type||"string",E.mimeType)},generateAsync:function(_,C){return this.generateInternalStream(_).accumulate(C)},generateNodeStream:function(_,C){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(C)}};t.exports=w},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(o){r.call(this,o);for(var a=0;a<this.data.length;a++)o[a]=255&o[a]}e("../utils").inherits(n,r),n.prototype.byteAt=function(o){return this.data[this.zero+o]},n.prototype.lastIndexOfSignature=function(o){for(var a=o.charCodeAt(0),u=o.charCodeAt(1),h=o.charCodeAt(2),g=o.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===a&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===g)return f-this.zero;return-1},n.prototype.readAndCheckSignature=function(o){var a=o.charCodeAt(0),u=o.charCodeAt(1),h=o.charCodeAt(2),g=o.charCodeAt(3),f=this.readData(4);return a===f[0]&&u===f[1]&&h===f[2]&&g===f[3]},n.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var a,u=0;for(this.checkOffset(o),a=this.index+o-1;a>=this.index;a--)u=(u<<8)+this.byteAt(a);return this.index+=o,u},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(o){r.call(this,o)}e("../utils").inherits(n,r),n.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(o){r.call(this,o)}e("../utils").inherits(n,r),n.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},n.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},n.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},n.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(o){r.call(this,o)}e("../utils").inherits(n,r),n.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),o=e("./ArrayReader"),a=e("./StringReader"),u=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(g){var f=r.getTypeOf(g);return r.checkSupport(f),f!=="string"||n.uint8array?f==="nodebuffer"?new u(g):n.uint8array?new h(r.transformTo("uint8array",g)):new o(r.transformTo("array",g)):new a(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function o(a){r.call(this,"ConvertWorker to "+a),this.destType=a}n.inherits(o,r),o.prototype.processChunk=function(a){this.push({data:n.transformTo(this.destType,a.data),meta:a.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(a){this.streamInfo.crc32=n(a.data,this.streamInfo.crc32||0),this.push(a)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function o(a){n.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}r.inherits(o,n),o.prototype.processChunk=function(a){if(a){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+a.data.length}n.prototype.processChunk.call(this,a)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function o(a){n.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=r.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}r.inherits(o,n),o.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,u);break;case"uint8array":a=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":a=this.data.slice(this.index,u)}return this.index=u,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(n){this.name=n||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(n){this.emit("data",n)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(n){this.emit("error",n)}return!0},error:function(n){return!this.isFinished&&(this.isPaused?this.generatedError=n:(this.isFinished=!0,this.emit("error",n),this.previous&&this.previous.error(n),this.cleanUp()),!0)},on:function(n,o){return this._listeners[n].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,o){if(this._listeners[n])for(var a=0;a<this._listeners[n].length;a++)this._listeners[n][a].call(this,o)},pipe:function(n){return n.registerPrevious(this)},registerPrevious:function(n){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=n.streamInfo,this.mergeStreamInfo(),this.previous=n;var o=this;return n.on("data",function(a){o.processChunk(a)}),n.on("end",function(){o.end()}),n.on("error",function(a){o.error(a)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var n=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),n=!0),this.previous&&this.previous.resume(),!n},flush:function(){},processChunk:function(n){this.push(n)},withStreamInfo:function(n,o){return this.extraStreamInfo[n]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var n in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,n)&&(this.streamInfo[n]=this.extraStreamInfo[n])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var n="Worker "+this.name;return this.previous?this.previous+" -> "+n:n}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),o=e("./GenericWorker"),a=e("../base64"),u=e("../support"),h=e("../external"),g=null;if(u.nodestream)try{g=e("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function f(p,l){return new h.Promise(function(m,x){var v=[],b=p._internalType,w=p._outputType,_=p._mimeType;p.on("data",function(C,E){v.push(C),l&&l(E)}).on("error",function(C){v=[],x(C)}).on("end",function(){try{var C=function(E,I,L){switch(E){case"blob":return r.newBlob(r.transformTo("arraybuffer",I),L);case"base64":return a.encode(I);default:return r.transformTo(E,I)}}(w,function(E,I){var L,k=0,N=null,R=0;for(L=0;L<I.length;L++)R+=I[L].length;switch(E){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(N=new Uint8Array(R),L=0;L<I.length;L++)N.set(I[L],k),k+=I[L].length;return N;case"nodebuffer":return Buffer.concat(I);default:throw new Error("concat : unsupported type '"+E+"'")}}(b,v),_);m(C)}catch(E){x(E)}v=[]}).resume()})}function d(p,l,m){var x=l;switch(l){case"blob":case"arraybuffer":x="uint8array";break;case"base64":x="string"}try{this._internalType=x,this._outputType=l,this._mimeType=m,r.checkSupport(x),this._worker=p.pipe(new n(x)),p.lock()}catch(v){this._worker=new o("error"),this._worker.error(v)}}d.prototype={accumulate:function(p){return f(this,p)},on:function(p,l){var m=this;return p==="data"?this._worker.on(p,function(x){l.call(m,x.data,x.meta)}):this._worker.on(p,function(){r.delay(l,arguments,m)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},p)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",i.nodebuffer=typeof Buffer!="undefined",i.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=new Blob([r],{type:"application/zip"}).size===0}catch(o){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=n.getBlob("application/zip").size===0}catch(a){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(o){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),o=e("./nodejsUtils"),a=e("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function g(){a.call(this,"utf-8 decode"),this.leftOver=null}function f(){a.call(this,"utf-8 encode")}i.utf8encode=function(d){return n.nodebuffer?o.newBufferFrom(d,"utf-8"):function(p){var l,m,x,v,b,w=p.length,_=0;for(v=0;v<w;v++)(64512&(m=p.charCodeAt(v)))==55296&&v+1<w&&(64512&(x=p.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),v++),_+=m<128?1:m<2048?2:m<65536?3:4;for(l=n.uint8array?new Uint8Array(_):new Array(_),v=b=0;b<_;v++)(64512&(m=p.charCodeAt(v)))==55296&&v+1<w&&(64512&(x=p.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),v++),m<128?l[b++]=m:(m<2048?l[b++]=192|m>>>6:(m<65536?l[b++]=224|m>>>12:(l[b++]=240|m>>>18,l[b++]=128|m>>>12&63),l[b++]=128|m>>>6&63),l[b++]=128|63&m);return l}(d)},i.utf8decode=function(d){return n.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):function(p){var l,m,x,v,b=p.length,w=new Array(2*b);for(l=m=0;l<b;)if((x=p[l++])<128)w[m++]=x;else if(4<(v=u[x]))w[m++]=65533,l+=v-1;else{for(x&=v===2?31:v===3?15:7;1<v&&l<b;)x=x<<6|63&p[l++],v--;1<v?w[m++]=65533:x<65536?w[m++]=x:(x-=65536,w[m++]=55296|x>>10&1023,w[m++]=56320|1023&x)}return w.length!==m&&(w.subarray?w=w.subarray(0,m):w.length=m),r.applyFromCharCode(w)}(d=r.transformTo(n.uint8array?"uint8array":"array",d))},r.inherits(g,a),g.prototype.processChunk=function(d){var p=r.transformTo(n.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var l=p;(p=new Uint8Array(l.length+this.leftOver.length)).set(this.leftOver,0),p.set(l,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=function(v,b){var w;for((b=b||v.length)>v.length&&(b=v.length),w=b-1;0<=w&&(192&v[w])==128;)w--;return w<0||w===0?b:w+u[v[w]]>b?w:b}(p),x=p;m!==p.length&&(n.uint8array?(x=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(x=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:i.utf8decode(x),meta:d.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=g,r.inherits(f,a),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),o=e("./nodejsUtils"),a=e("./external");function u(l){return l}function h(l,m){for(var x=0;x<l.length;++x)m[x]=255&l.charCodeAt(x);return m}e("setimmediate"),i.newBlob=function(l,m){i.checkSupport("blob");try{return new Blob([l],{type:m})}catch(v){try{var x=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return x.append(l),x.getBlob(m)}catch(b){throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(l,m,x){var v=[],b=0,w=l.length;if(w<=x)return String.fromCharCode.apply(null,l);for(;b<w;)m==="array"||m==="nodebuffer"?v.push(String.fromCharCode.apply(null,l.slice(b,Math.min(b+x,w)))):v.push(String.fromCharCode.apply(null,l.subarray(b,Math.min(b+x,w)))),b+=x;return v.join("")},stringifyByChar:function(l){for(var m="",x=0;x<l.length;x++)m+=String.fromCharCode(l[x]);return m},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(l){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch(l){return!1}}()}};function f(l){var m=65536,x=i.getTypeOf(l),v=!0;if(x==="uint8array"?v=g.applyCanBeUsed.uint8array:x==="nodebuffer"&&(v=g.applyCanBeUsed.nodebuffer),v)for(;1<m;)try{return g.stringifyByChunk(l,x,m)}catch(b){m=Math.floor(m/2)}return g.stringifyByChar(l)}function d(l,m){for(var x=0;x<l.length;x++)m[x]=l[x];return m}i.applyFromCharCode=f;var p={};p.string={string:u,array:function(l){return h(l,new Array(l.length))},arraybuffer:function(l){return p.string.uint8array(l).buffer},uint8array:function(l){return h(l,new Uint8Array(l.length))},nodebuffer:function(l){return h(l,o.allocBuffer(l.length))}},p.array={string:f,array:u,arraybuffer:function(l){return new Uint8Array(l).buffer},uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(l)}},p.arraybuffer={string:function(l){return f(new Uint8Array(l))},array:function(l){return d(new Uint8Array(l),new Array(l.byteLength))},arraybuffer:u,uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(new Uint8Array(l))}},p.uint8array={string:f,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return l.buffer},uint8array:u,nodebuffer:function(l){return o.newBufferFrom(l)}},p.nodebuffer={string:f,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return p.nodebuffer.uint8array(l).buffer},uint8array:function(l){return d(l,new Uint8Array(l.length))},nodebuffer:u},i.transformTo=function(l,m){if(m=m||"",!l)return m;i.checkSupport(l);var x=i.getTypeOf(m);return p[x][l](m)},i.resolve=function(l){for(var m=l.split("/"),x=[],v=0;v<m.length;v++){var b=m[v];b==="."||b===""&&v!==0&&v!==m.length-1||(b===".."?x.pop():x.push(b))}return x.join("/")},i.getTypeOf=function(l){return typeof l=="string"?"string":Object.prototype.toString.call(l)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(l)?"nodebuffer":r.uint8array&&l instanceof Uint8Array?"uint8array":r.arraybuffer&&l instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(l){if(!r[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(l){var m,x,v="";for(x=0;x<(l||"").length;x++)v+="\\x"+((m=l.charCodeAt(x))<16?"0":"")+m.toString(16).toUpperCase();return v},i.delay=function(l,m,x){setImmediate(function(){l.apply(x||null,m||[])})},i.inherits=function(l,m){function x(){}x.prototype=m.prototype,l.prototype=new x},i.extend=function(){var l,m,x={};for(l=0;l<arguments.length;l++)for(m in arguments[l])Object.prototype.hasOwnProperty.call(arguments[l],m)&&x[m]===void 0&&(x[m]=arguments[l][m]);return x},i.prepareContent=function(l,m,x,v,b){return a.Promise.resolve(m).then(function(w){return r.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader!="undefined"?new a.Promise(function(_,C){var E=new FileReader;E.onload=function(I){_(I.target.result)},E.onerror=function(I){C(I.target.error)},E.readAsArrayBuffer(w)}):w}).then(function(w){var _=i.getTypeOf(w);return _?(_==="arraybuffer"?w=i.transformTo("uint8array",w):_==="string"&&(b?w=n.decode(w):x&&v!==!0&&(w=function(C){return h(C,r.uint8array?new Uint8Array(C.length):new Array(C.length))}(w))),w):a.Promise.reject(new Error("Can't read the data of '"+l+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),o=e("./signature"),a=e("./zipEntry"),u=e("./support");function h(g){this.files=[],this.loadOptions=g}h.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(f)+", expected "+n.pretty(g)+")")}},isSignature:function(g,f){var d=this.reader.index;this.reader.setIndex(g);var p=this.reader.readString(4)===f;return this.reader.setIndex(d),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var g=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",d=n.transformTo(f,g);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var g,f,d,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[g]={id:g,length:f,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var g,f;for(g=0;g<this.files.length;g++)f=this.files[g],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(g=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(g);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var g=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(g);var f=g;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var p=f-d;if(0<p)this.isSignature(f,o.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(g){this.reader=r(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),o=e("./compressedObject"),a=e("./crc32"),u=e("./utf8"),h=e("./compressions"),g=e("./support");function f(d,p){this.options=d,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var p,l;if(d.skip(22),this.fileNameLength=d.readInt(2),l=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(l),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=function(m){for(var x in h)if(Object.prototype.hasOwnProperty.call(h,x)&&h[x].magic===m)return h[x];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,p,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var p=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(p),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p,l,m,x=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<x;)p=d.readInt(2),l=d.readInt(2),m=d.readData(l),this.extraFields[p]={id:p,length:l,value:m};d.setIndex(x)},handleUTF8:function(){var d=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var l=n.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(l)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var x=n.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(x)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var p=r(d.value);return p.readInt(1)!==1||a(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var p=r(d.value);return p.readInt(1)!==1||a(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(d.length-5))}return null}},t.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(p,l,m){this.name=p,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=l,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var n=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),a=e("./utf8"),u=e("./compressedObject"),h=e("./stream/GenericWorker");r.prototype={internalStream:function(p){var l=null,m="string";try{if(!p)throw new Error("No output type specified.");var x=(m=p.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),l=this._decompressWorker();var v=!this._dataBinary;v&&!x&&(l=l.pipe(new a.Utf8EncodeWorker)),!v&&x&&(l=l.pipe(new a.Utf8DecodeWorker))}catch(b){(l=new h("error")).error(b)}return new n(l,m,"")},async:function(p,l){return this.internalStream(p).accumulate(l)},nodeStream:function(p,l){return this.internalStream(p||"nodebuffer").toNodejsStream(l)},_compressWorker:function(p,l){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new a.Utf8EncodeWorker)),u.createWorkerFrom(m,p,l)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<g.length;d++)r.prototype[g[d]]=f;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(r){var n,o,a=r.MutationObserver||r.WebKitMutationObserver;if(a){var u=0,h=new a(p),g=r.document.createTextNode("");h.observe(g,{characterData:!0}),n=function(){g.data=u=++u%2}}else if(r.setImmediate||r.MessageChannel===void 0)n="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var l=r.document.createElement("script");l.onreadystatechange=function(){p(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},r.document.documentElement.appendChild(l)}:function(){setTimeout(p,0)};else{var f=new r.MessageChannel;f.port1.onmessage=p,n=function(){f.port2.postMessage(0)}}var d=[];function p(){var l,m;o=!0;for(var x=d.length;x;){for(m=d,d=[],l=-1;++l<x;)m[l]();x=d.length}o=!1}t.exports=function(l){d.push(l)!==1||o||n()}}).call(this,typeof Ie!="undefined"?Ie:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var o={},a=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function g(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,x!==n&&l(this,x)}function f(x,v,b){this.promise=x,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function d(x,v,b){r(function(){var w;try{w=v(b)}catch(_){return o.reject(x,_)}w===x?o.reject(x,new TypeError("Cannot resolve promise with itself")):o.resolve(x,w)})}function p(x){var v=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof v=="function")return function(){v.apply(x,arguments)}}function l(x,v){var b=!1;function w(E){b||(b=!0,o.reject(x,E))}function _(E){b||(b=!0,o.resolve(x,E))}var C=m(function(){v(_,w)});C.status==="error"&&w(C.value)}function m(x,v){var b={};try{b.value=x(v),b.status="success"}catch(w){b.status="error",b.value=w}return b}(t.exports=g).prototype.finally=function(x){if(typeof x!="function")return this;var v=this.constructor;return this.then(function(b){return v.resolve(x()).then(function(){return b})},function(b){return v.resolve(x()).then(function(){throw b})})},g.prototype.catch=function(x){return this.then(null,x)},g.prototype.then=function(x,v){if(typeof x!="function"&&this.state===u||typeof v!="function"&&this.state===a)return this;var b=new this.constructor(n);return this.state!==h?d(b,this.state===u?x:v,this.outcome):this.queue.push(new f(b,x,v)),b},f.prototype.callFulfilled=function(x){o.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){d(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){o.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){d(this.promise,this.onRejected,x)},o.resolve=function(x,v){var b=m(p,v);if(b.status==="error")return o.reject(x,b.value);var w=b.value;if(w)l(x,w);else{x.state=u,x.outcome=v;for(var _=-1,C=x.queue.length;++_<C;)x.queue[_].callFulfilled(v)}return x},o.reject=function(x,v){x.state=a,x.outcome=v;for(var b=-1,w=x.queue.length;++b<w;)x.queue[b].callRejected(v);return x},g.resolve=function(x){return x instanceof this?x:o.resolve(new this(n),x)},g.reject=function(x){var v=new this(n);return o.reject(v,x)},g.all=function(x){var v=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,w=!1;if(!b)return this.resolve([]);for(var _=new Array(b),C=0,E=-1,I=new this(n);++E<b;)L(x[E],E);return I;function L(k,N){v.resolve(k).then(function(R){_[N]=R,++C!==b||w||(w=!0,o.resolve(I,_))},function(R){w||(w=!0,o.reject(I,R))})}},g.race=function(x){var v=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,w=!1;if(!b)return this.resolve([]);for(var _=-1,C=new this(n);++_<b;)E=x[_],v.resolve(E).then(function(I){w||(w=!0,o.resolve(C,I))},function(I){w||(w=!0,o.reject(C,I))});var E;return C}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),o=e("./utils/strings"),a=e("./zlib/messages"),u=e("./zlib/zstream"),h=Object.prototype.toString,g=0,f=-1,d=0,p=8;function l(x){if(!(this instanceof l))return new l(x);this.options=n.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},x||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=r.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(b!==g)throw new Error(a[b]);if(v.header&&r.deflateSetHeader(this.strm,v.header),v.dictionary){var w;if(w=typeof v.dictionary=="string"?o.string2buf(v.dictionary):h.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(b=r.deflateSetDictionary(this.strm,w))!==g)throw new Error(a[b]);this._dict_set=!0}}function m(x,v){var b=new l(v);if(b.push(x,!0),b.err)throw b.msg||a[b.err];return b.result}l.prototype.push=function(x,v){var b,w,_=this.strm,C=this.options.chunkSize;if(this.ended)return!1;w=v===~~v?v:v===!0?4:0,typeof x=="string"?_.input=o.string2buf(x):h.call(x)==="[object ArrayBuffer]"?_.input=new Uint8Array(x):_.input=x,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new n.Buf8(C),_.next_out=0,_.avail_out=C),(b=r.deflate(_,w))!==1&&b!==g)return this.onEnd(b),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(n.shrinkBuf(_.output,_.next_out))):this.onData(n.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&b!==1);return w===4?(b=r.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===g):w!==2||(this.onEnd(g),!(_.avail_out=0))},l.prototype.onData=function(x){this.chunks.push(x)},l.prototype.onEnd=function(x){x===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},i.Deflate=l,i.deflate=m,i.deflateRaw=function(x,v){return(v=v||{}).raw=!0,m(x,v)},i.gzip=function(x,v){return(v=v||{}).gzip=!0,m(x,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),o=e("./utils/strings"),a=e("./zlib/constants"),u=e("./zlib/messages"),h=e("./zlib/zstream"),g=e("./zlib/gzheader"),f=Object.prototype.toString;function d(l){if(!(this instanceof d))return new d(l);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},l||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||l&&l.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&!(15&m.windowBits)&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var x=r.inflateInit2(this.strm,m.windowBits);if(x!==a.Z_OK)throw new Error(u[x]);this.header=new g,r.inflateGetHeader(this.strm,this.header)}function p(l,m){var x=new d(m);if(x.push(l,!0),x.err)throw x.msg||u[x.err];return x.result}d.prototype.push=function(l,m){var x,v,b,w,_,C,E=this.strm,I=this.options.chunkSize,L=this.options.dictionary,k=!1;if(this.ended)return!1;v=m===~~m?m:m===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof l=="string"?E.input=o.binstring2buf(l):f.call(l)==="[object ArrayBuffer]"?E.input=new Uint8Array(l):E.input=l,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new n.Buf8(I),E.next_out=0,E.avail_out=I),(x=r.inflate(E,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&L&&(C=typeof L=="string"?o.string2buf(L):f.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,x=r.inflateSetDictionary(this.strm,C)),x===a.Z_BUF_ERROR&&k===!0&&(x=a.Z_OK,k=!1),x!==a.Z_STREAM_END&&x!==a.Z_OK)return this.onEnd(x),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&x!==a.Z_STREAM_END&&(E.avail_in!==0||v!==a.Z_FINISH&&v!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=o.utf8border(E.output,E.next_out),w=E.next_out-b,_=o.buf2string(E.output,b),E.next_out=w,E.avail_out=I-w,w&&n.arraySet(E.output,E.output,b,w,0),this.onData(_)):this.onData(n.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(k=!0)}while((0<E.avail_in||E.avail_out===0)&&x!==a.Z_STREAM_END);return x===a.Z_STREAM_END&&(v=a.Z_FINISH),v===a.Z_FINISH?(x=r.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===a.Z_OK):v!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(E.avail_out=0))},d.prototype.onData=function(l){this.chunks.push(l)},d.prototype.onEnd=function(l){l===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},i.Inflate=d,i.inflate=p,i.inflateRaw=function(l,m){return(m=m||{}).raw=!0,p(l,m)},i.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";i.assign=function(a){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var h=u.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var g in h)h.hasOwnProperty(g)&&(a[g]=h[g])}}return a},i.shrinkBuf=function(a,u){return a.length===u?a:a.subarray?a.subarray(0,u):(a.length=u,a)};var n={arraySet:function(a,u,h,g,f){if(u.subarray&&a.subarray)a.set(u.subarray(h,h+g),f);else for(var d=0;d<g;d++)a[f+d]=u[h+d]},flattenChunks:function(a){var u,h,g,f,d,p;for(u=g=0,h=a.length;u<h;u++)g+=a[u].length;for(p=new Uint8Array(g),u=f=0,h=a.length;u<h;u++)d=a[u],p.set(d,f),f+=d.length;return p}},o={arraySet:function(a,u,h,g,f){for(var d=0;d<g;d++)a[f+d]=u[h+d]},flattenChunks:function(a){return[].concat.apply([],a)}};i.setTyped=function(a){a?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(g){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g){o=!1}for(var a=new r.Buf8(256),u=0;u<256;u++)a[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(g,f){if(f<65537&&(g.subarray&&o||!g.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(g,f));for(var d="",p=0;p<f;p++)d+=String.fromCharCode(g[p]);return d}a[254]=a[254]=1,i.string2buf=function(g){var f,d,p,l,m,x=g.length,v=0;for(l=0;l<x;l++)(64512&(d=g.charCodeAt(l)))==55296&&l+1<x&&(64512&(p=g.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),l++),v+=d<128?1:d<2048?2:d<65536?3:4;for(f=new r.Buf8(v),l=m=0;m<v;l++)(64512&(d=g.charCodeAt(l)))==55296&&l+1<x&&(64512&(p=g.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),l++),d<128?f[m++]=d:(d<2048?f[m++]=192|d>>>6:(d<65536?f[m++]=224|d>>>12:(f[m++]=240|d>>>18,f[m++]=128|d>>>12&63),f[m++]=128|d>>>6&63),f[m++]=128|63&d);return f},i.buf2binstring=function(g){return h(g,g.length)},i.binstring2buf=function(g){for(var f=new r.Buf8(g.length),d=0,p=f.length;d<p;d++)f[d]=g.charCodeAt(d);return f},i.buf2string=function(g,f){var d,p,l,m,x=f||g.length,v=new Array(2*x);for(d=p=0;d<x;)if((l=g[d++])<128)v[p++]=l;else if(4<(m=a[l]))v[p++]=65533,d+=m-1;else{for(l&=m===2?31:m===3?15:7;1<m&&d<x;)l=l<<6|63&g[d++],m--;1<m?v[p++]=65533:l<65536?v[p++]=l:(l-=65536,v[p++]=55296|l>>10&1023,v[p++]=56320|1023&l)}return h(v,p)},i.utf8border=function(g,f){var d;for((f=f||g.length)>g.length&&(f=g.length),d=f-1;0<=d&&(192&g[d])==128;)d--;return d<0||d===0?f:d+a[g[d]]>f?d:f}},{"./common":41}],43:[function(e,t,i){t.exports=function(r,n,o,a){for(var u=65535&r|0,h=r>>>16&65535|0,g=0;o!==0;){for(o-=g=2e3<o?2e3:o;h=h+(u=u+n[a++]|0)|0,--g;);u%=65521,h%=65521}return u|h<<16|0}},{}],44:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,i){var r=function(){for(var n,o=[],a=0;a<256;a++){n=a;for(var u=0;u<8;u++)n=1&n?3988292384^n>>>1:n>>>1;o[a]=n}return o}();t.exports=function(n,o,a,u){var h=r,g=u+a;n^=-1;for(var f=u;f<g;f++)n=n>>>8^h[255&(n^o[f])];return-1^n}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),o=e("./trees"),a=e("./adler32"),u=e("./crc32"),h=e("./messages"),g=0,f=4,d=0,p=-2,l=-1,m=4,x=2,v=8,b=9,w=286,_=30,C=19,E=2*w+1,I=15,L=3,k=258,N=k+L+1,R=42,M=113,y=1,V=2,Q=3,q=4;function ne(S,G){return S.msg=h[G],G}function $(S){return(S<<1)-(4<S?9:0)}function ie(S){for(var G=S.length;0<=--G;)S[G]=0}function D(S){var G=S.state,W=G.pending;W>S.avail_out&&(W=S.avail_out),W!==0&&(n.arraySet(S.output,G.pending_buf,G.pending_out,W,S.next_out),S.next_out+=W,G.pending_out+=W,S.total_out+=W,S.avail_out-=W,G.pending-=W,G.pending===0&&(G.pending_out=0))}function B(S,G){o._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,G),S.block_start=S.strstart,D(S.strm)}function z(S,G){S.pending_buf[S.pending++]=G}function O(S,G){S.pending_buf[S.pending++]=G>>>8&255,S.pending_buf[S.pending++]=255&G}function K(S,G){var W,P,T=S.max_chain_length,F=S.strstart,X=S.prev_length,J=S.nice_match,U=S.strstart>S.w_size-N?S.strstart-(S.w_size-N):0,Y=S.window,pe=S.w_mask,ee=S.prev,_e=S.strstart+k,Te=Y[F+X-1],Re=Y[F+X];S.prev_length>=S.good_match&&(T>>=2),J>S.lookahead&&(J=S.lookahead);do if(Y[(W=G)+X]===Re&&Y[W+X-1]===Te&&Y[W]===Y[F]&&Y[++W]===Y[F+1]){F+=2,W++;do;while(Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&F<_e);if(P=k-(_e-F),F=_e-k,X<P){if(S.match_start=G,J<=(X=P))break;Te=Y[F+X-1],Re=Y[F+X]}}while((G=ee[G&pe])>U&&--T!=0);return X<=S.lookahead?X:S.lookahead}function be(S){var G,W,P,T,F,X,J,U,Y,pe,ee=S.w_size;do{if(T=S.window_size-S.lookahead-S.strstart,S.strstart>=ee+(ee-N)){for(n.arraySet(S.window,S.window,ee,ee,0),S.match_start-=ee,S.strstart-=ee,S.block_start-=ee,G=W=S.hash_size;P=S.head[--G],S.head[G]=ee<=P?P-ee:0,--W;);for(G=W=ee;P=S.prev[--G],S.prev[G]=ee<=P?P-ee:0,--W;);T+=ee}if(S.strm.avail_in===0)break;if(X=S.strm,J=S.window,U=S.strstart+S.lookahead,Y=T,pe=void 0,pe=X.avail_in,Y<pe&&(pe=Y),W=pe===0?0:(X.avail_in-=pe,n.arraySet(J,X.input,X.next_in,pe,U),X.state.wrap===1?X.adler=a(X.adler,J,pe,U):X.state.wrap===2&&(X.adler=u(X.adler,J,pe,U)),X.next_in+=pe,X.total_in+=pe,pe),S.lookahead+=W,S.lookahead+S.insert>=L)for(F=S.strstart-S.insert,S.ins_h=S.window[F],S.ins_h=(S.ins_h<<S.hash_shift^S.window[F+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[F+L-1])&S.hash_mask,S.prev[F&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=F,F++,S.insert--,!(S.lookahead+S.insert<L)););}while(S.lookahead<N&&S.strm.avail_in!==0)}function he(S,G){for(var W,P;;){if(S.lookahead<N){if(be(S),S.lookahead<N&&G===g)return y;if(S.lookahead===0)break}if(W=0,S.lookahead>=L&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),W!==0&&S.strstart-W<=S.w_size-N&&(S.match_length=K(S,W)),S.match_length>=L)if(P=o._tr_tally(S,S.strstart-S.match_start,S.match_length-L),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=L){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else P=o._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(P&&(B(S,!1),S.strm.avail_out===0))return y}return S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?Q:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?y:V}function re(S,G){for(var W,P,T;;){if(S.lookahead<N){if(be(S),S.lookahead<N&&G===g)return y;if(S.lookahead===0)break}if(W=0,S.lookahead>=L&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=L-1,W!==0&&S.prev_length<S.max_lazy_match&&S.strstart-W<=S.w_size-N&&(S.match_length=K(S,W),S.match_length<=5&&(S.strategy===1||S.match_length===L&&4096<S.strstart-S.match_start)&&(S.match_length=L-1)),S.prev_length>=L&&S.match_length<=S.prev_length){for(T=S.strstart+S.lookahead-L,P=o._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-L),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=T&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=L-1,S.strstart++,P&&(B(S,!1),S.strm.avail_out===0))return y}else if(S.match_available){if((P=o._tr_tally(S,0,S.window[S.strstart-1]))&&B(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return y}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(P=o._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?Q:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?y:V}function Ae(S,G,W,P,T){this.good_length=S,this.max_lazy=G,this.nice_length=W,this.max_chain=P,this.func=T}function Le(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*E),this.dyn_dtree=new n.Buf16(2*(2*_+1)),this.bl_tree=new n.Buf16(2*(2*C+1)),ie(this.dyn_ltree),ie(this.dyn_dtree),ie(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(I+1),this.heap=new n.Buf16(2*w+1),ie(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*w+1),ie(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Pe(S){var G;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=x,(G=S.state).pending=0,G.pending_out=0,G.wrap<0&&(G.wrap=-G.wrap),G.status=G.wrap?R:M,S.adler=G.wrap===2?0:1,G.last_flush=g,o._tr_init(G),d):ne(S,p)}function We(S){var G=Pe(S);return G===d&&function(W){W.window_size=2*W.w_size,ie(W.head),W.max_lazy_match=r[W.level].max_lazy,W.good_match=r[W.level].good_length,W.nice_match=r[W.level].nice_length,W.max_chain_length=r[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=L-1,W.match_available=0,W.ins_h=0}(S.state),G}function Oe(S,G,W,P,T,F){if(!S)return p;var X=1;if(G===l&&(G=6),P<0?(X=0,P=-P):15<P&&(X=2,P-=16),T<1||b<T||W!==v||P<8||15<P||G<0||9<G||F<0||m<F)return ne(S,p);P===8&&(P=9);var J=new Le;return(S.state=J).strm=S,J.wrap=X,J.gzhead=null,J.w_bits=P,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=T+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+L-1)/L),J.window=new n.Buf8(2*J.w_size),J.head=new n.Buf16(J.hash_size),J.prev=new n.Buf16(J.w_size),J.lit_bufsize=1<<T+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new n.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=G,J.strategy=F,J.method=W,We(S)}r=[new Ae(0,0,0,0,function(S,G){var W=65535;for(W>S.pending_buf_size-5&&(W=S.pending_buf_size-5);;){if(S.lookahead<=1){if(be(S),S.lookahead===0&&G===g)return y;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var P=S.block_start+W;if((S.strstart===0||S.strstart>=P)&&(S.lookahead=S.strstart-P,S.strstart=P,B(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-N&&(B(S,!1),S.strm.avail_out===0))return y}return S.insert=0,G===f?(B(S,!0),S.strm.avail_out===0?Q:q):(S.strstart>S.block_start&&(B(S,!1),S.strm.avail_out),y)}),new Ae(4,4,8,4,he),new Ae(4,5,16,8,he),new Ae(4,6,32,32,he),new Ae(4,4,16,16,re),new Ae(8,16,32,32,re),new Ae(8,16,128,128,re),new Ae(8,32,128,256,re),new Ae(32,128,258,1024,re),new Ae(32,258,258,4096,re)],i.deflateInit=function(S,G){return Oe(S,G,v,15,8,0)},i.deflateInit2=Oe,i.deflateReset=We,i.deflateResetKeep=Pe,i.deflateSetHeader=function(S,G){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=G,d):p},i.deflate=function(S,G){var W,P,T,F;if(!S||!S.state||5<G||G<0)return S?ne(S,p):p;if(P=S.state,!S.output||!S.input&&S.avail_in!==0||P.status===666&&G!==f)return ne(S,S.avail_out===0?-5:p);if(P.strm=S,W=P.last_flush,P.last_flush=G,P.status===R)if(P.wrap===2)S.adler=0,z(P,31),z(P,139),z(P,8),P.gzhead?(z(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),z(P,255&P.gzhead.time),z(P,P.gzhead.time>>8&255),z(P,P.gzhead.time>>16&255),z(P,P.gzhead.time>>24&255),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(z(P,255&P.gzhead.extra.length),z(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(S.adler=u(S.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(z(P,0),z(P,0),z(P,0),z(P,0),z(P,0),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,3),P.status=M);else{var X=v+(P.w_bits-8<<4)<<8;X|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(X|=32),X+=31-X%31,P.status=M,O(P,X),P.strstart!==0&&(O(P,S.adler>>>16),O(P,65535&S.adler)),S.adler=1}if(P.status===69)if(P.gzhead.extra){for(T=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),D(S),T=P.pending,P.pending!==P.pending_buf_size));)z(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){T=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),D(S),T=P.pending,P.pending===P.pending_buf_size)){F=1;break}F=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,z(P,F)}while(F!==0);P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),F===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){T=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),D(S),T=P.pending,P.pending===P.pending_buf_size)){F=1;break}F=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,z(P,F)}while(F!==0);P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),F===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&D(S),P.pending+2<=P.pending_buf_size&&(z(P,255&S.adler),z(P,S.adler>>8&255),S.adler=0,P.status=M)):P.status=M),P.pending!==0){if(D(S),S.avail_out===0)return P.last_flush=-1,d}else if(S.avail_in===0&&$(G)<=$(W)&&G!==f)return ne(S,-5);if(P.status===666&&S.avail_in!==0)return ne(S,-5);if(S.avail_in!==0||P.lookahead!==0||G!==g&&P.status!==666){var J=P.strategy===2?function(U,Y){for(var pe;;){if(U.lookahead===0&&(be(U),U.lookahead===0)){if(Y===g)return y;break}if(U.match_length=0,pe=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,pe&&(B(U,!1),U.strm.avail_out===0))return y}return U.insert=0,Y===f?(B(U,!0),U.strm.avail_out===0?Q:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?y:V}(P,G):P.strategy===3?function(U,Y){for(var pe,ee,_e,Te,Re=U.window;;){if(U.lookahead<=k){if(be(U),U.lookahead<=k&&Y===g)return y;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=L&&0<U.strstart&&(ee=Re[_e=U.strstart-1])===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]){Te=U.strstart+k;do;while(ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&_e<Te);U.match_length=k-(Te-_e),U.match_length>U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=L?(pe=o._tr_tally(U,1,U.match_length-L),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(pe=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),pe&&(B(U,!1),U.strm.avail_out===0))return y}return U.insert=0,Y===f?(B(U,!0),U.strm.avail_out===0?Q:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?y:V}(P,G):r[P.level].func(P,G);if(J!==Q&&J!==q||(P.status=666),J===y||J===Q)return S.avail_out===0&&(P.last_flush=-1),d;if(J===V&&(G===1?o._tr_align(P):G!==5&&(o._tr_stored_block(P,0,0,!1),G===3&&(ie(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),D(S),S.avail_out===0))return P.last_flush=-1,d}return G!==f?d:P.wrap<=0?1:(P.wrap===2?(z(P,255&S.adler),z(P,S.adler>>8&255),z(P,S.adler>>16&255),z(P,S.adler>>24&255),z(P,255&S.total_in),z(P,S.total_in>>8&255),z(P,S.total_in>>16&255),z(P,S.total_in>>24&255)):(O(P,S.adler>>>16),O(P,65535&S.adler)),D(S),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?d:1)},i.deflateEnd=function(S){var G;return S&&S.state?(G=S.state.status)!==R&&G!==69&&G!==73&&G!==91&&G!==103&&G!==M&&G!==666?ne(S,p):(S.state=null,G===M?ne(S,-3):d):p},i.deflateSetDictionary=function(S,G){var W,P,T,F,X,J,U,Y,pe=G.length;if(!S||!S.state||(F=(W=S.state).wrap)===2||F===1&&W.status!==R||W.lookahead)return p;for(F===1&&(S.adler=a(S.adler,G,pe,0)),W.wrap=0,pe>=W.w_size&&(F===0&&(ie(W.head),W.strstart=0,W.block_start=0,W.insert=0),Y=new n.Buf8(W.w_size),n.arraySet(Y,G,pe-W.w_size,W.w_size,0),G=Y,pe=W.w_size),X=S.avail_in,J=S.next_in,U=S.input,S.avail_in=pe,S.next_in=0,S.input=G,be(W);W.lookahead>=L;){for(P=W.strstart,T=W.lookahead-(L-1);W.ins_h=(W.ins_h<<W.hash_shift^W.window[P+L-1])&W.hash_mask,W.prev[P&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=P,P++,--T;);W.strstart=P,W.lookahead=L-1,be(W)}return W.strstart+=W.lookahead,W.block_start=W.strstart,W.insert=W.lookahead,W.lookahead=0,W.match_length=W.prev_length=L-1,W.match_available=0,S.next_in=J,S.input=U,S.avail_in=X,W.wrap=F,d},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,i){t.exports=function(r,n){var o,a,u,h,g,f,d,p,l,m,x,v,b,w,_,C,E,I,L,k,N,R,M,y,V;o=r.state,a=r.next_in,y=r.input,u=a+(r.avail_in-5),h=r.next_out,V=r.output,g=h-(n-r.avail_out),f=h+(r.avail_out-257),d=o.dmax,p=o.wsize,l=o.whave,m=o.wnext,x=o.window,v=o.hold,b=o.bits,w=o.lencode,_=o.distcode,C=(1<<o.lenbits)-1,E=(1<<o.distbits)-1;e:do{b<15&&(v+=y[a++]<<b,b+=8,v+=y[a++]<<b,b+=8),I=w[v&C];t:for(;;){if(v>>>=L=I>>>24,b-=L,(L=I>>>16&255)===0)V[h++]=65535&I;else{if(!(16&L)){if(!(64&L)){I=w[(65535&I)+(v&(1<<L)-1)];continue t}if(32&L){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}k=65535&I,(L&=15)&&(b<L&&(v+=y[a++]<<b,b+=8),k+=v&(1<<L)-1,v>>>=L,b-=L),b<15&&(v+=y[a++]<<b,b+=8,v+=y[a++]<<b,b+=8),I=_[v&E];i:for(;;){if(v>>>=L=I>>>24,b-=L,!(16&(L=I>>>16&255))){if(!(64&L)){I=_[(65535&I)+(v&(1<<L)-1)];continue i}r.msg="invalid distance code",o.mode=30;break e}if(N=65535&I,b<(L&=15)&&(v+=y[a++]<<b,(b+=8)<L&&(v+=y[a++]<<b,b+=8)),d<(N+=v&(1<<L)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(v>>>=L,b-=L,(L=h-g)<N){if(l<(L=N-L)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(M=x,(R=0)===m){if(R+=p-L,L<k){for(k-=L;V[h++]=x[R++],--L;);R=h-N,M=V}}else if(m<L){if(R+=p+m-L,(L-=m)<k){for(k-=L;V[h++]=x[R++],--L;);if(R=0,m<k){for(k-=L=m;V[h++]=x[R++],--L;);R=h-N,M=V}}}else if(R+=m-L,L<k){for(k-=L;V[h++]=x[R++],--L;);R=h-N,M=V}for(;2<k;)V[h++]=M[R++],V[h++]=M[R++],V[h++]=M[R++],k-=3;k&&(V[h++]=M[R++],1<k&&(V[h++]=M[R++]))}else{for(R=h-N;V[h++]=V[R++],V[h++]=V[R++],V[h++]=V[R++],2<(k-=3););k&&(V[h++]=V[R++],1<k&&(V[h++]=V[R++]))}break}}break}}while(a<u&&h<f);a-=k=b>>3,v&=(1<<(b-=k<<3))-1,r.next_in=a,r.next_out=h,r.avail_in=a<u?u-a+5:5-(a-u),r.avail_out=h<f?f-h+257:257-(h-f),o.hold=v,o.bits=b}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),o=e("./crc32"),a=e("./inffast"),u=e("./inftrees"),h=1,g=2,f=0,d=-2,p=1,l=852,m=592;function x(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(R){var M;return R&&R.state?(M=R.state,R.total_in=R.total_out=M.total=0,R.msg="",M.wrap&&(R.adler=1&M.wrap),M.mode=p,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new r.Buf32(l),M.distcode=M.distdyn=new r.Buf32(m),M.sane=1,M.back=-1,f):d}function w(R){var M;return R&&R.state?((M=R.state).wsize=0,M.whave=0,M.wnext=0,b(R)):d}function _(R,M){var y,V;return R&&R.state?(V=R.state,M<0?(y=0,M=-M):(y=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?d:(V.window!==null&&V.wbits!==M&&(V.window=null),V.wrap=y,V.wbits=M,w(R))):d}function C(R,M){var y,V;return R?(V=new v,(R.state=V).window=null,(y=_(R,M))!==f&&(R.state=null),y):d}var E,I,L=!0;function k(R){if(L){var M;for(E=new r.Buf32(512),I=new r.Buf32(32),M=0;M<144;)R.lens[M++]=8;for(;M<256;)R.lens[M++]=9;for(;M<280;)R.lens[M++]=7;for(;M<288;)R.lens[M++]=8;for(u(h,R.lens,0,288,E,0,R.work,{bits:9}),M=0;M<32;)R.lens[M++]=5;u(g,R.lens,0,32,I,0,R.work,{bits:5}),L=!1}R.lencode=E,R.lenbits=9,R.distcode=I,R.distbits=5}function N(R,M,y,V){var Q,q=R.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new r.Buf8(q.wsize)),V>=q.wsize?(r.arraySet(q.window,M,y-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(V<(Q=q.wsize-q.wnext)&&(Q=V),r.arraySet(q.window,M,y-V,Q,q.wnext),(V-=Q)?(r.arraySet(q.window,M,y-V,V,0),q.wnext=V,q.whave=q.wsize):(q.wnext+=Q,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=Q))),0}i.inflateReset=w,i.inflateReset2=_,i.inflateResetKeep=b,i.inflateInit=function(R){return C(R,15)},i.inflateInit2=C,i.inflate=function(R,M){var y,V,Q,q,ne,$,ie,D,B,z,O,K,be,he,re,Ae,Le,Pe,We,Oe,S,G,W,P,T=0,F=new r.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return d;(y=R.state).mode===12&&(y.mode=13),ne=R.next_out,Q=R.output,ie=R.avail_out,q=R.next_in,V=R.input,$=R.avail_in,D=y.hold,B=y.bits,z=$,O=ie,G=f;e:for(;;)switch(y.mode){case p:if(y.wrap===0){y.mode=13;break}for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(2&y.wrap&&D===35615){F[y.check=0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0),B=D=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&D)<<8)+(D>>8))%31){R.msg="incorrect header check",y.mode=30;break}if((15&D)!=8){R.msg="unknown compression method",y.mode=30;break}if(B-=4,S=8+(15&(D>>>=4)),y.wbits===0)y.wbits=S;else if(S>y.wbits){R.msg="invalid window size",y.mode=30;break}y.dmax=1<<S,R.adler=y.check=1,y.mode=512&D?10:12,B=D=0;break;case 2:for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(y.flags=D,(255&y.flags)!=8){R.msg="unknown compression method",y.mode=30;break}if(57344&y.flags){R.msg="unknown header flags set",y.mode=30;break}y.head&&(y.head.text=D>>8&1),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0)),B=D=0,y.mode=3;case 3:for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.head&&(y.head.time=D),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,F[2]=D>>>16&255,F[3]=D>>>24&255,y.check=o(y.check,F,4,0)),B=D=0,y.mode=4;case 4:for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.head&&(y.head.xflags=255&D,y.head.os=D>>8),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0)),B=D=0,y.mode=5;case 5:if(1024&y.flags){for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.length=D,y.head&&(y.head.extra_len=D),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0)),B=D=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&($<(K=y.length)&&(K=$),K&&(y.head&&(S=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),r.arraySet(y.head.extra,V,q,K,S)),512&y.flags&&(y.check=o(y.check,V,K,q)),$-=K,q+=K,y.length-=K),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if($===0)break e;for(K=0;S=V[q+K++],y.head&&S&&y.length<65536&&(y.head.name+=String.fromCharCode(S)),S&&K<$;);if(512&y.flags&&(y.check=o(y.check,V,K,q)),$-=K,q+=K,S)break e}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if($===0)break e;for(K=0;S=V[q+K++],y.head&&S&&y.length<65536&&(y.head.comment+=String.fromCharCode(S)),S&&K<$;);if(512&y.flags&&(y.check=o(y.check,V,K,q)),$-=K,q+=K,S)break e}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D!==(65535&y.check)){R.msg="header crc mismatch",y.mode=30;break}B=D=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),R.adler=y.check=0,y.mode=12;break;case 10:for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}R.adler=y.check=x(D),B=D=0,y.mode=11;case 11:if(y.havedict===0)return R.next_out=ne,R.avail_out=ie,R.next_in=q,R.avail_in=$,y.hold=D,y.bits=B,2;R.adler=y.check=1,y.mode=12;case 12:if(M===5||M===6)break e;case 13:if(y.last){D>>>=7&B,B-=7&B,y.mode=27;break}for(;B<3;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}switch(y.last=1&D,B-=1,3&(D>>>=1)){case 0:y.mode=14;break;case 1:if(k(y),y.mode=20,M!==6)break;D>>>=2,B-=2;break e;case 2:y.mode=17;break;case 3:R.msg="invalid block type",y.mode=30}D>>>=2,B-=2;break;case 14:for(D>>>=7&B,B-=7&B;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if((65535&D)!=(D>>>16^65535)){R.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&D,B=D=0,y.mode=15,M===6)break e;case 15:y.mode=16;case 16:if(K=y.length){if($<K&&(K=$),ie<K&&(K=ie),K===0)break e;r.arraySet(Q,V,q,K,ne),$-=K,q+=K,ie-=K,ne+=K,y.length-=K;break}y.mode=12;break;case 17:for(;B<14;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(y.nlen=257+(31&D),D>>>=5,B-=5,y.ndist=1+(31&D),D>>>=5,B-=5,y.ncode=4+(15&D),D>>>=4,B-=4,286<y.nlen||30<y.ndist){R.msg="too many length or distance symbols",y.mode=30;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;B<3;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.lens[X[y.have++]]=7&D,D>>>=3,B-=3}for(;y.have<19;)y.lens[X[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,W={bits:y.lenbits},G=u(0,y.lens,0,19,y.lencode,0,y.work,W),y.lenbits=W.bits,G){R.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;Ae=(T=y.lencode[D&(1<<y.lenbits)-1])>>>16&255,Le=65535&T,!((re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(Le<16)D>>>=re,B-=re,y.lens[y.have++]=Le;else{if(Le===16){for(P=re+2;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D>>>=re,B-=re,y.have===0){R.msg="invalid bit length repeat",y.mode=30;break}S=y.lens[y.have-1],K=3+(3&D),D>>>=2,B-=2}else if(Le===17){for(P=re+3;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}B-=re,S=0,K=3+(7&(D>>>=re)),D>>>=3,B-=3}else{for(P=re+7;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}B-=re,S=0,K=11+(127&(D>>>=re)),D>>>=7,B-=7}if(y.have+K>y.nlen+y.ndist){R.msg="invalid bit length repeat",y.mode=30;break}for(;K--;)y.lens[y.have++]=S}}if(y.mode===30)break;if(y.lens[256]===0){R.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,W={bits:y.lenbits},G=u(h,y.lens,0,y.nlen,y.lencode,0,y.work,W),y.lenbits=W.bits,G){R.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,W={bits:y.distbits},G=u(g,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,W),y.distbits=W.bits,G){R.msg="invalid distances set",y.mode=30;break}if(y.mode=20,M===6)break e;case 20:y.mode=21;case 21:if(6<=$&&258<=ie){R.next_out=ne,R.avail_out=ie,R.next_in=q,R.avail_in=$,y.hold=D,y.bits=B,a(R,O),ne=R.next_out,Q=R.output,ie=R.avail_out,q=R.next_in,V=R.input,$=R.avail_in,D=y.hold,B=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;Ae=(T=y.lencode[D&(1<<y.lenbits)-1])>>>16&255,Le=65535&T,!((re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(Ae&&!(240&Ae)){for(Pe=re,We=Ae,Oe=Le;Ae=(T=y.lencode[Oe+((D&(1<<Pe+We)-1)>>Pe)])>>>16&255,Le=65535&T,!(Pe+(re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}D>>>=Pe,B-=Pe,y.back+=Pe}if(D>>>=re,B-=re,y.back+=re,y.length=Le,Ae===0){y.mode=26;break}if(32&Ae){y.back=-1,y.mode=12;break}if(64&Ae){R.msg="invalid literal/length code",y.mode=30;break}y.extra=15&Ae,y.mode=22;case 22:if(y.extra){for(P=y.extra;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.length+=D&(1<<y.extra)-1,D>>>=y.extra,B-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;Ae=(T=y.distcode[D&(1<<y.distbits)-1])>>>16&255,Le=65535&T,!((re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(!(240&Ae)){for(Pe=re,We=Ae,Oe=Le;Ae=(T=y.distcode[Oe+((D&(1<<Pe+We)-1)>>Pe)])>>>16&255,Le=65535&T,!(Pe+(re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}D>>>=Pe,B-=Pe,y.back+=Pe}if(D>>>=re,B-=re,y.back+=re,64&Ae){R.msg="invalid distance code",y.mode=30;break}y.offset=Le,y.extra=15&Ae,y.mode=24;case 24:if(y.extra){for(P=y.extra;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.offset+=D&(1<<y.extra)-1,D>>>=y.extra,B-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){R.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(ie===0)break e;if(K=O-ie,y.offset>K){if((K=y.offset-K)>y.whave&&y.sane){R.msg="invalid distance too far back",y.mode=30;break}be=K>y.wnext?(K-=y.wnext,y.wsize-K):y.wnext-K,K>y.length&&(K=y.length),he=y.window}else he=Q,be=ne-y.offset,K=y.length;for(ie<K&&(K=ie),ie-=K,y.length-=K;Q[ne++]=he[be++],--K;);y.length===0&&(y.mode=21);break;case 26:if(ie===0)break e;Q[ne++]=y.length,ie--,y.mode=21;break;case 27:if(y.wrap){for(;B<32;){if($===0)break e;$--,D|=V[q++]<<B,B+=8}if(O-=ie,R.total_out+=O,y.total+=O,O&&(R.adler=y.check=y.flags?o(y.check,Q,O,ne-O):n(y.check,Q,O,ne-O)),O=ie,(y.flags?D:x(D))!==y.check){R.msg="incorrect data check",y.mode=30;break}B=D=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D!==(4294967295&y.total)){R.msg="incorrect length check",y.mode=30;break}B=D=0}y.mode=29;case 29:G=1;break e;case 30:G=-3;break e;case 31:return-4;case 32:default:return d}return R.next_out=ne,R.avail_out=ie,R.next_in=q,R.avail_in=$,y.hold=D,y.bits=B,(y.wsize||O!==R.avail_out&&y.mode<30&&(y.mode<27||M!==4))&&N(R,R.output,R.next_out,O-R.avail_out)?(y.mode=31,-4):(z-=R.avail_in,O-=R.avail_out,R.total_in+=z,R.total_out+=O,y.total+=O,y.wrap&&O&&(R.adler=y.check=y.flags?o(y.check,Q,O,R.next_out-O):n(y.check,Q,O,R.next_out-O)),R.data_type=y.bits+(y.last?64:0)+(y.mode===12?128:0)+(y.mode===20||y.mode===15?256:0),(z==0&&O===0||M===4)&&G===f&&(G=-5),G)},i.inflateEnd=function(R){if(!R||!R.state)return d;var M=R.state;return M.window&&(M.window=null),R.state=null,f},i.inflateGetHeader=function(R,M){var y;return R&&R.state&&2&(y=R.state).wrap?((y.head=M).done=!1,f):d},i.inflateSetDictionary=function(R,M){var y,V=M.length;return R&&R.state?(y=R.state).wrap!==0&&y.mode!==11?d:y.mode===11&&n(1,M,V,0)!==y.check?-3:N(R,M,V,V)?(y.mode=31,-4):(y.havedict=1,f):d},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(h,g,f,d,p,l,m,x){var v,b,w,_,C,E,I,L,k,N=x.bits,R=0,M=0,y=0,V=0,Q=0,q=0,ne=0,$=0,ie=0,D=0,B=null,z=0,O=new r.Buf16(16),K=new r.Buf16(16),be=null,he=0;for(R=0;R<=15;R++)O[R]=0;for(M=0;M<d;M++)O[g[f+M]]++;for(Q=N,V=15;1<=V&&O[V]===0;V--);if(V<Q&&(Q=V),V===0)return p[l++]=20971520,p[l++]=20971520,x.bits=1,0;for(y=1;y<V&&O[y]===0;y++);for(Q<y&&(Q=y),R=$=1;R<=15;R++)if($<<=1,($-=O[R])<0)return-1;if(0<$&&(h===0||V!==1))return-1;for(K[1]=0,R=1;R<15;R++)K[R+1]=K[R]+O[R];for(M=0;M<d;M++)g[f+M]!==0&&(m[K[g[f+M]]++]=M);if(E=h===0?(B=be=m,19):h===1?(B=n,z-=257,be=o,he-=257,256):(B=a,be=u,-1),R=y,C=l,ne=M=D=0,w=-1,_=(ie=1<<(q=Q))-1,h===1&&852<ie||h===2&&592<ie)return 1;for(;;){for(I=R-ne,k=m[M]<E?(L=0,m[M]):m[M]>E?(L=be[he+m[M]],B[z+m[M]]):(L=96,0),v=1<<R-ne,y=b=1<<q;p[C+(D>>ne)+(b-=v)]=I<<24|L<<16|k|0,b!==0;);for(v=1<<R-1;D&v;)v>>=1;if(v!==0?(D&=v-1,D+=v):D=0,M++,--O[R]==0){if(R===V)break;R=g[f+m[M]]}if(Q<R&&(D&_)!==w){for(ne===0&&(ne=Q),C+=y,$=1<<(q=R-ne);q+ne<V&&!(($-=O[q+ne])<=0);)q++,$<<=1;if(ie+=1<<q,h===1&&852<ie||h===2&&592<ie)return 1;p[w=D&_]=Q<<24|q<<16|C-l|0}}return D!==0&&(p[C+D]=R-ne<<24|64<<16|0),x.bits=Q,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,i){var r=e("../utils/common"),n=0,o=1;function a(T){for(var F=T.length;0<=--F;)T[F]=0}var u=0,h=29,g=256,f=g+1+h,d=30,p=19,l=2*f+1,m=15,x=16,v=7,b=256,w=16,_=17,C=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],I=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],N=new Array(2*(f+2));a(N);var R=new Array(2*d);a(R);var M=new Array(512);a(M);var y=new Array(256);a(y);var V=new Array(h);a(V);var Q,q,ne,$=new Array(d);function ie(T,F,X,J,U){this.static_tree=T,this.extra_bits=F,this.extra_base=X,this.elems=J,this.max_length=U,this.has_stree=T&&T.length}function D(T,F){this.dyn_tree=T,this.max_code=0,this.stat_desc=F}function B(T){return T<256?M[T]:M[256+(T>>>7)]}function z(T,F){T.pending_buf[T.pending++]=255&F,T.pending_buf[T.pending++]=F>>>8&255}function O(T,F,X){T.bi_valid>x-X?(T.bi_buf|=F<<T.bi_valid&65535,z(T,T.bi_buf),T.bi_buf=F>>x-T.bi_valid,T.bi_valid+=X-x):(T.bi_buf|=F<<T.bi_valid&65535,T.bi_valid+=X)}function K(T,F,X){O(T,X[2*F],X[2*F+1])}function be(T,F){for(var X=0;X|=1&T,T>>>=1,X<<=1,0<--F;);return X>>>1}function he(T,F,X){var J,U,Y=new Array(m+1),pe=0;for(J=1;J<=m;J++)Y[J]=pe=pe+X[J-1]<<1;for(U=0;U<=F;U++){var ee=T[2*U+1];ee!==0&&(T[2*U]=be(Y[ee]++,ee))}}function re(T){var F;for(F=0;F<f;F++)T.dyn_ltree[2*F]=0;for(F=0;F<d;F++)T.dyn_dtree[2*F]=0;for(F=0;F<p;F++)T.bl_tree[2*F]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function Ae(T){8<T.bi_valid?z(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function Le(T,F,X,J){var U=2*F,Y=2*X;return T[U]<T[Y]||T[U]===T[Y]&&J[F]<=J[X]}function Pe(T,F,X){for(var J=T.heap[X],U=X<<1;U<=T.heap_len&&(U<T.heap_len&&Le(F,T.heap[U+1],T.heap[U],T.depth)&&U++,!Le(F,J,T.heap[U],T.depth));)T.heap[X]=T.heap[U],X=U,U<<=1;T.heap[X]=J}function We(T,F,X){var J,U,Y,pe,ee=0;if(T.last_lit!==0)for(;J=T.pending_buf[T.d_buf+2*ee]<<8|T.pending_buf[T.d_buf+2*ee+1],U=T.pending_buf[T.l_buf+ee],ee++,J===0?K(T,U,F):(K(T,(Y=y[U])+g+1,F),(pe=E[Y])!==0&&O(T,U-=V[Y],pe),K(T,Y=B(--J),X),(pe=I[Y])!==0&&O(T,J-=$[Y],pe)),ee<T.last_lit;);K(T,b,F)}function Oe(T,F){var X,J,U,Y=F.dyn_tree,pe=F.stat_desc.static_tree,ee=F.stat_desc.has_stree,_e=F.stat_desc.elems,Te=-1;for(T.heap_len=0,T.heap_max=l,X=0;X<_e;X++)Y[2*X]!==0?(T.heap[++T.heap_len]=Te=X,T.depth[X]=0):Y[2*X+1]=0;for(;T.heap_len<2;)Y[2*(U=T.heap[++T.heap_len]=Te<2?++Te:0)]=1,T.depth[U]=0,T.opt_len--,ee&&(T.static_len-=pe[2*U+1]);for(F.max_code=Te,X=T.heap_len>>1;1<=X;X--)Pe(T,Y,X);for(U=_e;X=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Pe(T,Y,1),J=T.heap[1],T.heap[--T.heap_max]=X,T.heap[--T.heap_max]=J,Y[2*U]=Y[2*X]+Y[2*J],T.depth[U]=(T.depth[X]>=T.depth[J]?T.depth[X]:T.depth[J])+1,Y[2*X+1]=Y[2*J+1]=U,T.heap[1]=U++,Pe(T,Y,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(Re,nt){var Wt,Ke,Et,Ue,Zt,Hi,Ot=nt.dyn_tree,Hr=nt.max_code,zr=nt.stat_desc.static_tree,Fn=nt.stat_desc.has_stree,jr=nt.stat_desc.extra_bits,Wr=nt.stat_desc.extra_base,ui=nt.stat_desc.max_length,zi=0;for(Ue=0;Ue<=m;Ue++)Re.bl_count[Ue]=0;for(Ot[2*Re.heap[Re.heap_max]+1]=0,Wt=Re.heap_max+1;Wt<l;Wt++)ui<(Ue=Ot[2*Ot[2*(Ke=Re.heap[Wt])+1]+1]+1)&&(Ue=ui,zi++),Ot[2*Ke+1]=Ue,Hr<Ke||(Re.bl_count[Ue]++,Zt=0,Wr<=Ke&&(Zt=jr[Ke-Wr]),Hi=Ot[2*Ke],Re.opt_len+=Hi*(Ue+Zt),Fn&&(Re.static_len+=Hi*(zr[2*Ke+1]+Zt)));if(zi!==0){do{for(Ue=ui-1;Re.bl_count[Ue]===0;)Ue--;Re.bl_count[Ue]--,Re.bl_count[Ue+1]+=2,Re.bl_count[ui]--,zi-=2}while(0<zi);for(Ue=ui;Ue!==0;Ue--)for(Ke=Re.bl_count[Ue];Ke!==0;)Hr<(Et=Re.heap[--Wt])||(Ot[2*Et+1]!==Ue&&(Re.opt_len+=(Ue-Ot[2*Et+1])*Ot[2*Et],Ot[2*Et+1]=Ue),Ke--)}}(T,F),he(Y,Te,T.bl_count)}function S(T,F,X){var J,U,Y=-1,pe=F[1],ee=0,_e=7,Te=4;for(pe===0&&(_e=138,Te=3),F[2*(X+1)+1]=65535,J=0;J<=X;J++)U=pe,pe=F[2*(J+1)+1],++ee<_e&&U===pe||(ee<Te?T.bl_tree[2*U]+=ee:U!==0?(U!==Y&&T.bl_tree[2*U]++,T.bl_tree[2*w]++):ee<=10?T.bl_tree[2*_]++:T.bl_tree[2*C]++,Y=U,Te=(ee=0)===pe?(_e=138,3):U===pe?(_e=6,3):(_e=7,4))}function G(T,F,X){var J,U,Y=-1,pe=F[1],ee=0,_e=7,Te=4;for(pe===0&&(_e=138,Te=3),J=0;J<=X;J++)if(U=pe,pe=F[2*(J+1)+1],!(++ee<_e&&U===pe)){if(ee<Te)for(;K(T,U,T.bl_tree),--ee!=0;);else U!==0?(U!==Y&&(K(T,U,T.bl_tree),ee--),K(T,w,T.bl_tree),O(T,ee-3,2)):ee<=10?(K(T,_,T.bl_tree),O(T,ee-3,3)):(K(T,C,T.bl_tree),O(T,ee-11,7));Y=U,Te=(ee=0)===pe?(_e=138,3):U===pe?(_e=6,3):(_e=7,4)}}a($);var W=!1;function P(T,F,X,J){O(T,(u<<1)+(J?1:0),3),function(U,Y,pe,ee){Ae(U),ee&&(z(U,pe),z(U,~pe)),r.arraySet(U.pending_buf,U.window,Y,pe,U.pending),U.pending+=pe}(T,F,X,!0)}i._tr_init=function(T){W||(function(){var F,X,J,U,Y,pe=new Array(m+1);for(U=J=0;U<h-1;U++)for(V[U]=J,F=0;F<1<<E[U];F++)y[J++]=U;for(y[J-1]=U,U=Y=0;U<16;U++)for($[U]=Y,F=0;F<1<<I[U];F++)M[Y++]=U;for(Y>>=7;U<d;U++)for($[U]=Y<<7,F=0;F<1<<I[U]-7;F++)M[256+Y++]=U;for(X=0;X<=m;X++)pe[X]=0;for(F=0;F<=143;)N[2*F+1]=8,F++,pe[8]++;for(;F<=255;)N[2*F+1]=9,F++,pe[9]++;for(;F<=279;)N[2*F+1]=7,F++,pe[7]++;for(;F<=287;)N[2*F+1]=8,F++,pe[8]++;for(he(N,f+1,pe),F=0;F<d;F++)R[2*F+1]=5,R[2*F]=be(F,5);Q=new ie(N,E,g+1,f,m),q=new ie(R,I,0,d,m),ne=new ie(new Array(0),L,0,p,v)}(),W=!0),T.l_desc=new D(T.dyn_ltree,Q),T.d_desc=new D(T.dyn_dtree,q),T.bl_desc=new D(T.bl_tree,ne),T.bi_buf=0,T.bi_valid=0,re(T)},i._tr_stored_block=P,i._tr_flush_block=function(T,F,X,J){var U,Y,pe=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(ee){var _e,Te=4093624447;for(_e=0;_e<=31;_e++,Te>>>=1)if(1&Te&&ee.dyn_ltree[2*_e]!==0)return n;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return o;for(_e=32;_e<g;_e++)if(ee.dyn_ltree[2*_e]!==0)return o;return n}(T)),Oe(T,T.l_desc),Oe(T,T.d_desc),pe=function(ee){var _e;for(S(ee,ee.dyn_ltree,ee.l_desc.max_code),S(ee,ee.dyn_dtree,ee.d_desc.max_code),Oe(ee,ee.bl_desc),_e=p-1;3<=_e&&ee.bl_tree[2*k[_e]+1]===0;_e--);return ee.opt_len+=3*(_e+1)+5+5+4,_e}(T),U=T.opt_len+3+7>>>3,(Y=T.static_len+3+7>>>3)<=U&&(U=Y)):U=Y=X+5,X+4<=U&&F!==-1?P(T,F,X,J):T.strategy===4||Y===U?(O(T,2+(J?1:0),3),We(T,N,R)):(O(T,4+(J?1:0),3),function(ee,_e,Te,Re){var nt;for(O(ee,_e-257,5),O(ee,Te-1,5),O(ee,Re-4,4),nt=0;nt<Re;nt++)O(ee,ee.bl_tree[2*k[nt]+1],3);G(ee,ee.dyn_ltree,_e-1),G(ee,ee.dyn_dtree,Te-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,pe+1),We(T,T.dyn_ltree,T.dyn_dtree)),re(T),J&&Ae(T)},i._tr_tally=function(T,F,X){return T.pending_buf[T.d_buf+2*T.last_lit]=F>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&F,T.pending_buf[T.l_buf+T.last_lit]=255&X,T.last_lit++,F===0?T.dyn_ltree[2*X]++:(T.matches++,F--,T.dyn_ltree[2*(y[X]+g+1)]++,T.dyn_dtree[2*B(F)]++),T.last_lit===T.lit_bufsize-1},i._tr_align=function(T){O(T,2,3),K(T,b,N),function(F){F.bi_valid===16?(z(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(r){(function(n,o){if(!n.setImmediate){var a,u,h,g,f=1,d={},p=!1,l=n.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(n);m=m&&m.setTimeout?m:n,a={}.toString.call(n.process)==="[object process]"?function(w){process.nextTick(function(){v(w)})}:function(){if(n.postMessage&&!n.importScripts){var w=!0,_=n.onmessage;return n.onmessage=function(){w=!1},n.postMessage("","*"),n.onmessage=_,w}}()?(g="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b),function(w){n.postMessage(g+w,"*")}):n.MessageChannel?((h=new MessageChannel).port1.onmessage=function(w){v(w.data)},function(w){h.port2.postMessage(w)}):l&&"onreadystatechange"in l.createElement("script")?(u=l.documentElement,function(w){var _=l.createElement("script");_.onreadystatechange=function(){v(w),_.onreadystatechange=null,u.removeChild(_),_=null},u.appendChild(_)}):function(w){setTimeout(v,0,w)},m.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var _=new Array(arguments.length-1),C=0;C<_.length;C++)_[C]=arguments[C+1];var E={callback:w,args:_};return d[f]=E,a(f),f++},m.clearImmediate=x}function x(w){delete d[w]}function v(w){if(p)setTimeout(v,0,w);else{var _=d[w];if(_){p=!0;try{(function(C){var E=C.callback,I=C.args;switch(I.length){case 0:E();break;case 1:E(I[0]);break;case 2:E(I[0],I[1]);break;case 3:E(I[0],I[1],I[2]);break;default:E.apply(o,I)}})(_)}finally{x(w),p=!1}}}}function b(w){w.source===n&&typeof w.data=="string"&&w.data.indexOf(g)===0&&v(+w.data.slice(g.length))}})(typeof self=="undefined"?r===void 0?this:r:self)}).call(this,typeof Ie!="undefined"?Ie:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})})(ua);var Yc=ua.exports;const Qc=ca(Yc),as=(s,c)=>c.some(e=>s instanceof e);let ha,la;function e0(){return ha||(ha=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function t0(){return la||(la=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const os=new WeakMap,cs=new WeakMap,dr=new WeakMap;function i0(s){const c=new Promise((e,t)=>{const i=()=>{s.removeEventListener("success",r),s.removeEventListener("error",n)},r=()=>{e(pi(s.result)),i()},n=()=>{t(s.error),i()};s.addEventListener("success",r),s.addEventListener("error",n)});return dr.set(c,s),c}function r0(s){if(os.has(s))return;const c=new Promise((e,t)=>{const i=()=>{s.removeEventListener("complete",r),s.removeEventListener("error",n),s.removeEventListener("abort",n)},r=()=>{e(),i()},n=()=>{t(s.error||new DOMException("AbortError","AbortError")),i()};s.addEventListener("complete",r),s.addEventListener("error",n),s.addEventListener("abort",n)});os.set(s,c)}let us={get(s,c,e){if(s instanceof IDBTransaction){if(c==="done")return os.get(s);if(c==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return pi(s[c])},set(s,c,e){return s[c]=e,!0},has(s,c){return s instanceof IDBTransaction&&(c==="done"||c==="store")?!0:c in s}};function da(s){us=s(us)}function s0(s){return t0().includes(s)?function(...c){return s.apply(hs(this),c),pi(this.request)}:function(...c){return pi(s.apply(hs(this),c))}}function n0(s){return typeof s=="function"?s0(s):(s instanceof IDBTransaction&&r0(s),as(s,e0())?new Proxy(s,us):s)}function pi(s){if(s instanceof IDBRequest)return i0(s);if(cs.has(s))return cs.get(s);const c=n0(s);return c!==s&&(cs.set(s,c),dr.set(c,s)),c}const hs=s=>dr.get(s);function a0(s,c,{blocked:e,upgrade:t,blocking:i,terminated:r}={}){const n=indexedDB.open(s,c),o=pi(n);return t&&n.addEventListener("upgradeneeded",a=>{t(pi(n.result),a.oldVersion,a.newVersion,pi(n.transaction),a)}),e&&n.addEventListener("blocked",a=>e(a.oldVersion,a.newVersion,a)),o.then(a=>{r&&a.addEventListener("close",()=>r()),i&&a.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),o}const o0=["get","getKey","getAll","getAllKeys","count"],c0=["put","add","delete","clear"],ls=new Map;function fa(s,c){if(!(s instanceof IDBDatabase&&!(c in s)&&typeof c=="string"))return;if(ls.get(c))return ls.get(c);const e=c.replace(/FromIndex$/,""),t=c!==e,i=c0.includes(e);if(!(e in(t?IDBIndex:IDBObjectStore).prototype)||!(i||o0.includes(e)))return;const r=function(n,...o){return H(this,null,function*(){const a=this.transaction(n,i?"readwrite":"readonly");let u=a.store;return t&&(u=u.index(o.shift())),(yield Promise.all([u[e](...o),i&&a.done]))[0]})};return ls.set(c,r),r}da(s=>Yt(Ce({},s),{get:(c,e,t)=>fa(c,e)||s.get(c,e,t),has:(c,e)=>!!fa(c,e)||s.has(c,e)}));const u0=["continue","continuePrimaryKey","advance"],pa={},ds=new WeakMap,ma=new WeakMap,h0={get(s,c){if(!u0.includes(c))return s[c];let e=pa[c];return e||(e=pa[c]=function(...t){ds.set(this,ma.get(this)[c](...t))}),e}};function l0(...s){return yc(this,null,function*(){let c=this;if(c instanceof IDBCursor||(c=yield new qr(c.openCursor(...s))),!c)return;c=c;const e=new Proxy(c,h0);for(ma.set(e,c),dr.set(e,hs(c));c;)yield e,c=yield new qr(ds.get(e)||c.continue()),ds.delete(e)})}function ga(s,c){return c===Symbol.asyncIterator&&as(s,[IDBIndex,IDBObjectStore,IDBCursor])||c==="iterate"&&as(s,[IDBIndex,IDBObjectStore])}da(s=>Yt(Ce({},s),{get(c,e,t){return ga(c,e)?l0:s.get(c,e,t)},has(c,e){return ga(c,e)||s.has(c,e)}}));const d0="AliRTCLog",fr="AliRTCSessiones",pr="AliRTCLogs",f0=()=>H(this,null,function*(){return yield a0(d0,1,{upgrade:c=>{c.createObjectStore(fr,{keyPath:"sid"}).createIndex("sid","sid",{unique:!0});const t=c.createObjectStore(pr,{keyPath:"id",autoIncrement:!0});t.createIndex("sid","sid",{unique:!1}),t.createIndex("date","date",{unique:!1})}})}),p0=(s,c)=>H(this,null,function*(){yield s.add(fr,{sid:c})}),va=(s,c,e,t)=>H(this,null,function*(){yield s.add(pr,{sid:c,log:t,date:e})}),xa=(s,c)=>H(this,null,function*(){return yield s.getAllFromIndex(pr,"sid",c)}),m0=s=>H(this,null,function*(){return yield s.getAllFromIndex(fr,"sid")}),g0=(s,c)=>H(this,null,function*(){yield s.delete(pr,c)}),v0=(s,c)=>H(this,null,function*(){yield s.delete(fr,c)}),ba=((uc=typeof globalThis!="undefined"?globalThis:void 0)==null?void 0:uc.crypto)||((hc=typeof global!="undefined"?global:void 0)==null?void 0:hc.crypto)||((lc=typeof window!="undefined"?window:void 0)==null?void 0:lc.crypto)||((dc=typeof self!="undefined"?self:void 0)==null?void 0:dc.crypto)||((pc=(fc=typeof frames!="undefined"?frames:void 0)==null?void 0:fc[0])==null?void 0:pc.crypto);let fs;ba?fs=s=>{const c=[];for(let e=0,t;e<s;e+=4)c.push(ba.getRandomValues(new Uint32Array(1))[0]);return new Lt(c,s)}:fs=s=>{const c=[],e=t=>{let i=t,r=987654321;const n=4294967295;return()=>{r=36969*(r&65535)+(r>>16)&n,i=18e3*(i&65535)+(i>>16)&n;let o=(r<<16)+i&n;return o/=4294967296,o+=.5,o*(Math.random()>.5?1:-1)}};for(let t=0,i;t<s;t+=4){const r=e((i||Math.random())*4294967296);i=r()*987654071,c.push(r()*4294967296|0)}return new Lt(c,s)};class mr{static create(...c){return new this(...c)}mixIn(c){return Object.assign(this,c)}clone(){const c=new this.constructor;return Object.assign(c,this),c}}class Lt extends mr{constructor(c=[],e=c.length*4){super();let t=c;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){const i=t.byteLength,r=[];for(let n=0;n<i;n+=1)r[n>>>2]|=t[n]<<24-n%4*8;this.words=r,this.sigBytes=i}else this.words=c,this.sigBytes=e}toString(c=x0){return c.stringify(this)}concat(c){const e=this.words,t=c.words,i=this.sigBytes,r=c.sigBytes;if(this.clamp(),i%4)for(let n=0;n<r;n+=1){const o=t[n>>>2]>>>24-n%4*8&255;e[i+n>>>2]|=o<<24-(i+n)%4*8}else for(let n=0;n<r;n+=4)e[i+n>>>2]=t[n>>>2];return this.sigBytes+=r,this}clamp(){const{words:c,sigBytes:e}=this;c[e>>>2]&=4294967295<<32-e%4*8,c.length=Math.ceil(e/4)}clone(){const c=super.clone.call(this);return c.words=this.words.slice(0),c}}A(Lt,"random",fs);const x0={stringify(s){const{words:c,sigBytes:e}=s,t=[];for(let i=0;i<e;i+=1){const r=c[i>>>2]>>>24-i%4*8&255;t.push((r>>>4).toString(16)),t.push((r&15).toString(16))}return t.join("")},parse(s){const c=s.length,e=[];for(let t=0;t<c;t+=2)e[t>>>3]|=parseInt(s.substr(t,2),16)<<24-t%8*4;return new Lt(e,c/2)}},Sa={stringify(s){const{words:c,sigBytes:e}=s,t=[];for(let i=0;i<e;i+=1){const r=c[i>>>2]>>>24-i%4*8&255;t.push(String.fromCharCode(r))}return t.join("")},parse(s){const c=s.length,e=[];for(let t=0;t<c;t+=1)e[t>>>2]|=(s.charCodeAt(t)&255)<<24-t%4*8;return new Lt(e,c)}},_a={stringify(s){try{return decodeURIComponent(escape(Sa.stringify(s)))}catch(c){throw new Error("Malformed UTF-8 data")}},parse(s){return Sa.parse(unescape(encodeURIComponent(s)))}};class b0 extends mr{constructor(){super(),this._minBufferSize=0}reset(){this._data=new Lt,this._nDataBytes=0}_append(c){let e=c;typeof e=="string"&&(e=_a.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(c){let e;const{_data:t,blockSize:i}=this,r=t.words,n=t.sigBytes,o=i*4;let a=n/o;c?a=Math.ceil(a):a=Math.max((a|0)-this._minBufferSize,0);const u=a*i,h=Math.min(u*4,n);if(u){for(let g=0;g<u;g+=i)this._doProcessBlock(r,g);e=r.splice(0,u),t.sigBytes-=h}return new Lt(e,h)}clone(){const c=super.clone.call(this);return c._data=this._data.clone(),c}}class gr extends b0{constructor(c){super(),this.blockSize=512/32,this.cfg=Object.assign(new mr,c),this.reset()}static _createHelper(c){return(e,t)=>new c(t).finalize(e)}static _createHmacHelper(c){return(e,t)=>new S0(c,t).finalize(e)}reset(){super.reset.call(this),this._doReset()}update(c){return this._append(c),this._process(),this}finalize(c){return c&&this._append(c),this._doFinalize()}}class S0 extends mr{constructor(c,e){super();const t=new c;this._hasher=t;let i=e;typeof i=="string"&&(i=_a.parse(i));const r=t.blockSize,n=r*4;i.sigBytes>n&&(i=t.finalize(e)),i.clamp();const o=i.clone();this._oKey=o;const a=i.clone();this._iKey=a;const u=o.words,h=a.words;for(let g=0;g<r;g+=1)u[g]^=1549556828,h[g]^=909522486;o.sigBytes=n,a.sigBytes=n,this.reset()}reset(){const c=this._hasher;c.reset(),c.update(this._iKey)}update(c){return this._hasher.update(c),this}finalize(c){const e=this._hasher,t=e.finalize(c);return e.reset(),e.finalize(this._oKey.clone().concat(t))}}const mi=[];class _0 extends gr{_doReset(){this._hash=new Lt([1732584193,4023233417,2562383102,271733878,3285377520])}_doProcessBlock(c,e){const t=this._hash.words;let i=t[0],r=t[1],n=t[2],o=t[3],a=t[4];for(let u=0;u<80;u+=1){if(u<16)mi[u]=c[e+u]|0;else{const g=mi[u-3]^mi[u-8]^mi[u-14]^mi[u-16];mi[u]=g<<1|g>>>31}let h=(i<<5|i>>>27)+a+mi[u];u<20?h+=(r&n|~r&o)+1518500249:u<40?h+=(r^n^o)+1859775393:u<60?h+=(r&n|r&o|n&o)-1894007588:h+=(r^n^o)-899497514,a=o,o=n,n=r<<30|r>>>2,r=i,i=h}t[0]=t[0]+i|0,t[1]=t[1]+r|0,t[2]=t[2]+n|0,t[3]=t[3]+o|0,t[4]=t[4]+a|0}_doFinalize(){const c=this._data,e=c.words,t=this._nDataBytes*8,i=c.sigBytes*8;return e[i>>>5]|=128<<24-i%32,e[(i+64>>>9<<4)+14]=Math.floor(t/4294967296),e[(i+64>>>9<<4)+15]=t,c.sigBytes=e.length*4,this._process(),this._hash}clone(){const c=super.clone.call(this);return c._hash=this._hash.clone(),c}}const y0=gr._createHmacHelper(_0),Se=[];for(let s=0;s<64;s+=1)Se[s]=Math.abs(Math.sin(s+1))*4294967296|0;const at=(s,c,e,t,i,r,n)=>{const o=s+(c&e|~c&t)+i+n;return(o<<r|o>>>32-r)+c},ot=(s,c,e,t,i,r,n)=>{const o=s+(c&t|e&~t)+i+n;return(o<<r|o>>>32-r)+c},ct=(s,c,e,t,i,r,n)=>{const o=s+(c^e^t)+i+n;return(o<<r|o>>>32-r)+c},ut=(s,c,e,t,i,r,n)=>{const o=s+(e^(c|~t))+i+n;return(o<<r|o>>>32-r)+c};class w0 extends gr{_doReset(){this._hash=new Lt([1732584193,4023233417,2562383102,271733878])}_doProcessBlock(c,e){const t=c;for(let L=0;L<16;L+=1){const k=e+L,N=c[k];t[k]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}const i=this._hash.words,r=t[e+0],n=t[e+1],o=t[e+2],a=t[e+3],u=t[e+4],h=t[e+5],g=t[e+6],f=t[e+7],d=t[e+8],p=t[e+9],l=t[e+10],m=t[e+11],x=t[e+12],v=t[e+13],b=t[e+14],w=t[e+15];let _=i[0],C=i[1],E=i[2],I=i[3];_=at(_,C,E,I,r,7,Se[0]),I=at(I,_,C,E,n,12,Se[1]),E=at(E,I,_,C,o,17,Se[2]),C=at(C,E,I,_,a,22,Se[3]),_=at(_,C,E,I,u,7,Se[4]),I=at(I,_,C,E,h,12,Se[5]),E=at(E,I,_,C,g,17,Se[6]),C=at(C,E,I,_,f,22,Se[7]),_=at(_,C,E,I,d,7,Se[8]),I=at(I,_,C,E,p,12,Se[9]),E=at(E,I,_,C,l,17,Se[10]),C=at(C,E,I,_,m,22,Se[11]),_=at(_,C,E,I,x,7,Se[12]),I=at(I,_,C,E,v,12,Se[13]),E=at(E,I,_,C,b,17,Se[14]),C=at(C,E,I,_,w,22,Se[15]),_=ot(_,C,E,I,n,5,Se[16]),I=ot(I,_,C,E,g,9,Se[17]),E=ot(E,I,_,C,m,14,Se[18]),C=ot(C,E,I,_,r,20,Se[19]),_=ot(_,C,E,I,h,5,Se[20]),I=ot(I,_,C,E,l,9,Se[21]),E=ot(E,I,_,C,w,14,Se[22]),C=ot(C,E,I,_,u,20,Se[23]),_=ot(_,C,E,I,p,5,Se[24]),I=ot(I,_,C,E,b,9,Se[25]),E=ot(E,I,_,C,a,14,Se[26]),C=ot(C,E,I,_,d,20,Se[27]),_=ot(_,C,E,I,v,5,Se[28]),I=ot(I,_,C,E,o,9,Se[29]),E=ot(E,I,_,C,f,14,Se[30]),C=ot(C,E,I,_,x,20,Se[31]),_=ct(_,C,E,I,h,4,Se[32]),I=ct(I,_,C,E,d,11,Se[33]),E=ct(E,I,_,C,m,16,Se[34]),C=ct(C,E,I,_,b,23,Se[35]),_=ct(_,C,E,I,n,4,Se[36]),I=ct(I,_,C,E,u,11,Se[37]),E=ct(E,I,_,C,f,16,Se[38]),C=ct(C,E,I,_,l,23,Se[39]),_=ct(_,C,E,I,v,4,Se[40]),I=ct(I,_,C,E,r,11,Se[41]),E=ct(E,I,_,C,a,16,Se[42]),C=ct(C,E,I,_,g,23,Se[43]),_=ct(_,C,E,I,p,4,Se[44]),I=ct(I,_,C,E,x,11,Se[45]),E=ct(E,I,_,C,w,16,Se[46]),C=ct(C,E,I,_,o,23,Se[47]),_=ut(_,C,E,I,r,6,Se[48]),I=ut(I,_,C,E,f,10,Se[49]),E=ut(E,I,_,C,b,15,Se[50]),C=ut(C,E,I,_,h,21,Se[51]),_=ut(_,C,E,I,x,6,Se[52]),I=ut(I,_,C,E,a,10,Se[53]),E=ut(E,I,_,C,l,15,Se[54]),C=ut(C,E,I,_,n,21,Se[55]),_=ut(_,C,E,I,d,6,Se[56]),I=ut(I,_,C,E,w,10,Se[57]),E=ut(E,I,_,C,g,15,Se[58]),C=ut(C,E,I,_,v,21,Se[59]),_=ut(_,C,E,I,u,6,Se[60]),I=ut(I,_,C,E,m,10,Se[61]),E=ut(E,I,_,C,o,15,Se[62]),C=ut(C,E,I,_,p,21,Se[63]),i[0]=i[0]+_|0,i[1]=i[1]+C|0,i[2]=i[2]+E|0,i[3]=i[3]+I|0}_doFinalize(){const c=this._data,e=c.words,t=this._nDataBytes*8,i=c.sigBytes*8;e[i>>>5]|=128<<24-i%32;const r=Math.floor(t/4294967296),n=t;e[(i+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,e[(i+64>>>9<<4)+14]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,c.sigBytes=(e.length+1)*4,this._process();const o=this._hash,a=o.words;for(let u=0;u<4;u+=1){const h=a[u];a[u]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return o}clone(){const c=super.clone.call(this);return c._hash=this._hash.clone(),c}}const A0=gr._createHelper(w0),E0=(s,c,e)=>{const t=[];let i=0;for(let r=0;r<c;r+=1)if(r%4){const n=e[s.charCodeAt(r-1)]<<r%4*2,o=e[s.charCodeAt(r)]>>>6-r%4*2,a=n|o;t[i>>>2]|=a<<24-i%4*8,i+=1}return Lt.create(t,i)},ya={stringify(s){const{words:c,sigBytes:e}=s,t=this._map;s.clamp();const i=[];for(let n=0;n<e;n+=3){const o=c[n>>>2]>>>24-n%4*8&255,a=c[n+1>>>2]>>>24-(n+1)%4*8&255,u=c[n+2>>>2]>>>24-(n+2)%4*8&255,h=o<<16|a<<8|u;for(let g=0;g<4&&n+g*.75<e;g+=1)i.push(t.charAt(h>>>6*(3-g)&63))}const r=t.charAt(64);if(r)for(;i.length%4;)i.push(r);return i.join("")},parse(s){let c=s.length;const e=this._map;let t=this._reverseMap;if(!t){this._reverseMap=[],t=this._reverseMap;for(let r=0;r<e.length;r+=1)t[e.charCodeAt(r)]=r}const i=e.charAt(64);if(i){const r=s.indexOf(i);r!==-1&&(c=r)}return E0(s,c,t)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},C0=s=>H(this,null,function*(){const c=yield s.arrayBuffer(),e=A0(Lt.create(c));return ya.stringify(e)}),I0=function(c,e,t){const i="x-oss-",r={};let n=[c.toUpperCase(),e["content-md5"]||"",e["content-type"],e["x-oss-date"]];return Object.keys(e).forEach(o=>{const a=o.toLowerCase();a.indexOf(i)===0&&(r[a]=String(e[o]).trim())}),Object.keys(r).sort().forEach(o=>{n.push(`${o}:${r[o]}`)}),n.push(t),n.join(`
16
- `)},R0=(s,c,e,t)=>H(this,null,function*(){const i=I0("PUT",e,t),r=ya.stringify(y0(i,c));return`OSS ${s}:${r}`});var k0=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,T0=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,D0=/[^-+\dA-Z]/g;function ps(s,c,e,t){if(arguments.length===1&&typeof s=="string"&&!/\d/.test(s)&&(c=s,s=void 0),s=s||s===0?s:new Date,s instanceof Date||(s=new Date(s)),isNaN(s))throw TypeError("Invalid date");c=String(wa[c]||c||wa.default);var i=c.slice(0,4);(i==="UTC:"||i==="GMT:")&&(c=c.slice(4),e=!0,i==="GMT:"&&(t=!0));var r=function(){return e?"getUTC":"get"},n=function(){return s[r()+"Date"]()},o=function(){return s[r()+"Day"]()},a=function(){return s[r()+"Month"]()},u=function(){return s[r()+"FullYear"]()},h=function(){return s[r()+"Hours"]()},g=function(){return s[r()+"Minutes"]()},f=function(){return s[r()+"Seconds"]()},d=function(){return s[r()+"Milliseconds"]()},p=function(){return e?0:s.getTimezoneOffset()},l=function(){return B0(s)},m=function(){return P0(s)},x={d:function(){return n()},dd:function(){return St(n())},ddd:function(){return mt.dayNames[o()]},DDD:function(){return Aa({y:u(),m:a(),d:n(),_:r(),dayName:mt.dayNames[o()],short:!0})},dddd:function(){return mt.dayNames[o()+7]},DDDD:function(){return Aa({y:u(),m:a(),d:n(),_:r(),dayName:mt.dayNames[o()+7]})},m:function(){return a()+1},mm:function(){return St(a()+1)},mmm:function(){return mt.monthNames[a()]},mmmm:function(){return mt.monthNames[a()+12]},yy:function(){return String(u()).slice(2)},yyyy:function(){return St(u(),4)},h:function(){return h()%12||12},hh:function(){return St(h()%12||12)},H:function(){return h()},HH:function(){return St(h())},M:function(){return g()},MM:function(){return St(g())},s:function(){return f()},ss:function(){return St(f())},l:function(){return St(d(),3)},L:function(){return St(Math.floor(d()/10))},t:function(){return h()<12?mt.timeNames[0]:mt.timeNames[1]},tt:function(){return h()<12?mt.timeNames[2]:mt.timeNames[3]},T:function(){return h()<12?mt.timeNames[4]:mt.timeNames[5]},TT:function(){return h()<12?mt.timeNames[6]:mt.timeNames[7]},Z:function(){return t?"GMT":e?"UTC":L0(s)},o:function(){return(p()>0?"-":"+")+St(Math.floor(Math.abs(p())/60)*100+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+St(Math.floor(Math.abs(p())/60),2)+":"+St(Math.floor(Math.abs(p())%60),2)},S:function(){return["th","st","nd","rd"][n()%10>3?0:(n()%100-n()%10!=10)*n()%10]},W:function(){return l()},WW:function(){return St(l())},N:function(){return m()}};return c.replace(k0,function(v){return v in x?x[v]():v.slice(1,v.length-1)})}var wa={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},mt={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},St=function(c){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(c).padStart(e,"0")},Aa=function(c){var e=c.y,t=c.m,i=c.d,r=c._,n=c.dayName,o=c.short,a=o===void 0?!1:o,u=new Date,h=new Date;h.setDate(h[r+"Date"]()-1);var g=new Date;g.setDate(g[r+"Date"]()+1);var f=function(){return u[r+"Date"]()},d=function(){return u[r+"Month"]()},p=function(){return u[r+"FullYear"]()},l=function(){return h[r+"Date"]()},m=function(){return h[r+"Month"]()},x=function(){return h[r+"FullYear"]()},v=function(){return g[r+"Date"]()},b=function(){return g[r+"Month"]()},w=function(){return g[r+"FullYear"]()};return p()===e&&d()===t&&f()===i?a?"Tdy":"Today":x()===e&&m()===t&&l()===i?a?"Ysd":"Yesterday":w()===e&&b()===t&&v()===i?a?"Tmw":"Tomorrow":n},B0=function(c){var e=new Date(c.getFullYear(),c.getMonth(),c.getDate());e.setDate(e.getDate()-(e.getDay()+6)%7+3);var t=new Date(e.getFullYear(),0,4);t.setDate(t.getDate()-(t.getDay()+6)%7+3);var i=e.getTimezoneOffset()-t.getTimezoneOffset();e.setHours(e.getHours()-i);var r=(e-t)/(864e5*7);return 1+Math.floor(r)},P0=function(c){var e=c.getDay();return e===0&&(e=7),e},L0=function(c){return(String(c).match(T0)||[""]).pop().replace(D0,"").replace(/GMT\+0000/g,"UTC")};function Ea(s,c,e){Object.defineProperty(s,c,{writable:!0,enumerable:!0,configurable:!0,value:e})}function Ca(s,c,e,t){t?t(()=>{Ea(s,c,e)}):Ea(s,c,e)}Array(32);class M0{constructor(c){this.timer=null,this.time=10,this.count=10,this.arr=[];var e,t;this.time=(e=c.time)!=null?e:10,this.count=(t=c.count)!=null?t:10,c.host.startsWith("http://")||c.host.startsWith("https://")?this.url=c.host+"/logstores/"+c.logstore+"/track":this.url="https://"+c.project+"."+c.host+"/logstores/"+c.logstore+"/track",this.opt=c,c.installUnloadHook&&typeof c.installUnloadHook=="function"&&c.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(c){const e={__logs__:c};return this.opt.tags&&(e.__tags__=this.opt.tags),this.opt.topic&&(e.__topic__=this.opt.topic),this.opt.source&&(e.__source__=this.opt.source),JSON.stringify(e)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const c=this.assemblePayload(this.arr);this.opt.sendPayload(this.url,c)}}transString(c){let e={};for(let t in c)typeof c[t]=="object"?e[t]=JSON.stringify(c[t]):e[t]=String(c[t]);return e}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const c=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){c.sendImmediateInner()},this.time*1e3)}}send(c){const e=this.transString(c);this.arr.push(e),this.sendInner()}sendImmediate(c){const e=this.transString(c);this.arr.push(e),this.sendImmediateInner()}sendBatchLogs(c){const e=c.map(t=>this.transString(t));this.arr.push(...e),this.sendInner()}sendBatchLogsImmediate(c){const e=c.map(t=>this.transString(t));this.arr.push(...e),this.sendImmediateInner()}overwriteTransString(c){this.transString=c.transString}getOpt(){return this.opt}}var N0=(s,c,e)=>new Promise((t,i)=>{var r=a=>{try{o(e.next(a))}catch(u){i(u)}},n=a=>{try{o(e.throw(a))}catch(u){i(u)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(r,n);o((e=e.apply(s,c)).next())});function F0(s,c){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${s}?APIVersion=0.6.0`,c):!1}function Ia(s,c){const e=new window.XMLHttpRequest;e.open("POST",`${s}?APIVersion=0.6.0`,!0),e.send(c)}function O0(s,c){try{if(c.length>=32768){Ia(s,c);return}F0(s,c)||Ia(s,c)}catch(e){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
17
- `+e),console.error("Failed log data:",s))}}function V0(s,c,e){return N0(this,null,function*(){try{s=s.slice(0,-6);const{data:t,header:i}=yield e.process(s,c),r=new window.XMLHttpRequest;r.open("POST",s,!0);for(let n in i)r.setRequestHeader(n,i[n]);r.send(t)}catch(t){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
18
- `+t),console.error("Failed log data:",s))}})}class Ra extends M0{constructor(c){const e=Object.assign({},c,{installUnloadHook:t=>{window.addEventListener("beforeunload",()=>{t()})},sendPayload:(t,i)=>{O0(t,i)}});super(e)}useStsPlugin(c){this.getOpt().sendPayload=(e,t)=>{V0(e,t,c)},this.overwriteTransString(c)}}Ca(window,"SLS_Tracker",Ra);var ka={exports:{}},ms={exports:{}};const U0=Zc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ta;function De(){return Ta||(Ta=1,function(s,c){(function(e,t){s.exports=t()})(Ie,function(){var e=e||function(t,i){var r;if(typeof window!="undefined"&&window.crypto&&(r=window.crypto),typeof self!="undefined"&&self.crypto&&(r=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window!="undefined"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof Ie!="undefined"&&Ie.crypto&&(r=Ie.crypto),!r&&typeof Wi=="function")try{r=U0}catch(v){}var n=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch(v){}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch(v){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function v(){}return function(b){var w;return v.prototype=b,w=new v,v.prototype=null,w}}(),a={},u=a.lib={},h=u.Base=function(){return{extend:function(v){var b=o(this);return v&&b.mixIn(v),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var b in v)v.hasOwnProperty(b)&&(this[b]=v[b]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=u.WordArray=h.extend({init:function(v,b){v=this.words=v||[],b!=i?this.sigBytes=b:this.sigBytes=v.length*4},toString:function(v){return(v||d).stringify(this)},concat:function(v){var b=this.words,w=v.words,_=this.sigBytes,C=v.sigBytes;if(this.clamp(),_%4)for(var E=0;E<C;E++){var I=w[E>>>2]>>>24-E%4*8&255;b[_+E>>>2]|=I<<24-(_+E)%4*8}else for(var L=0;L<C;L+=4)b[_+L>>>2]=w[L>>>2];return this.sigBytes+=C,this},clamp:function(){var v=this.words,b=this.sigBytes;v[b>>>2]&=4294967295<<32-b%4*8,v.length=t.ceil(b/4)},clone:function(){var v=h.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var b=[],w=0;w<v;w+=4)b.push(n());return new g.init(b,v)}}),f=a.enc={},d=f.Hex={stringify:function(v){for(var b=v.words,w=v.sigBytes,_=[],C=0;C<w;C++){var E=b[C>>>2]>>>24-C%4*8&255;_.push((E>>>4).toString(16)),_.push((E&15).toString(16))}return _.join("")},parse:function(v){for(var b=v.length,w=[],_=0;_<b;_+=2)w[_>>>3]|=parseInt(v.substr(_,2),16)<<24-_%8*4;return new g.init(w,b/2)}},p=f.Latin1={stringify:function(v){for(var b=v.words,w=v.sigBytes,_=[],C=0;C<w;C++){var E=b[C>>>2]>>>24-C%4*8&255;_.push(String.fromCharCode(E))}return _.join("")},parse:function(v){for(var b=v.length,w=[],_=0;_<b;_++)w[_>>>2]|=(v.charCodeAt(_)&255)<<24-_%4*8;return new g.init(w,b)}},l=f.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},m=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=l.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var b,w=this._data,_=w.words,C=w.sigBytes,E=this.blockSize,I=E*4,L=C/I;v?L=t.ceil(L):L=t.max((L|0)-this._minBufferSize,0);var k=L*E,N=t.min(k*4,C);if(k){for(var R=0;R<k;R+=E)this._doProcessBlock(_,R);b=_.splice(0,k),w.sigBytes-=N}return new g.init(b,N)},clone:function(){var v=h.clone.call(this);return v._data=this._data.clone(),v},_minBufferSize:0});u.Hasher=m.extend({cfg:h.extend(),init:function(v){this.cfg=this.cfg.extend(v),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(v){return this._append(v),this._process(),this},finalize:function(v){v&&this._append(v);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(v){return function(b,w){return new v.init(w).finalize(b)}},_createHmacHelper:function(v){return function(b,w){return new x.HMAC.init(v,w).finalize(b)}}});var x=a.algo={};return a}(Math);return e})}(ms)),ms.exports}var gs={exports:{}},Da;function vr(){return Da||(Da=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.Base,o=r.WordArray,a=i.x64={};a.Word=n.extend({init:function(u,h){this.high=u,this.low=h}}),a.WordArray=n.extend({init:function(u,h){u=this.words=u||[],h!=t?this.sigBytes=h:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,h=u.length,g=[],f=0;f<h;f++){var d=u[f];g.push(d.high),g.push(d.low)}return o.create(g,this.sigBytes)},clone:function(){for(var u=n.clone.call(this),h=u.words=this.words.slice(0),g=h.length,f=0;f<g;f++)h[f]=h[f].clone();return u}})}(),e})}(gs)),gs.exports}var vs={exports:{}},Ba;function H0(){return Ba||(Ba=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,i=t.lib,r=i.WordArray,n=r.init,o=r.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var u=a.byteLength,h=[],g=0;g<u;g++)h[g>>>2]|=a[g]<<24-g%4*8;n.call(this,h,u)}else n.apply(this,arguments)};o.prototype=r}}(),e.lib.WordArray})}(vs)),vs.exports}var xs={exports:{}},Pa;function z0(){return Pa||(Pa=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Utf16=n.Utf16BE={stringify:function(a){for(var u=a.words,h=a.sigBytes,g=[],f=0;f<h;f+=2){var d=u[f>>>2]>>>16-f%4*8&65535;g.push(String.fromCharCode(d))}return g.join("")},parse:function(a){for(var u=a.length,h=[],g=0;g<u;g++)h[g>>>1]|=a.charCodeAt(g)<<16-g%2*16;return r.create(h,u*2)}},n.Utf16LE={stringify:function(a){for(var u=a.words,h=a.sigBytes,g=[],f=0;f<h;f+=2){var d=o(u[f>>>2]>>>16-f%4*8&65535);g.push(String.fromCharCode(d))}return g.join("")},parse:function(a){for(var u=a.length,h=[],g=0;g<u;g++)h[g>>>1]|=o(a.charCodeAt(g)<<16-g%2*16);return r.create(h,u*2)}};function o(a){return a<<8&4278255360|a>>>8&16711935}}(),e.enc.Utf16})}(xs)),xs.exports}var bs={exports:{}},La;function gi(){return La||(La=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64={stringify:function(a){var u=a.words,h=a.sigBytes,g=this._map;a.clamp();for(var f=[],d=0;d<h;d+=3)for(var p=u[d>>>2]>>>24-d%4*8&255,l=u[d+1>>>2]>>>24-(d+1)%4*8&255,m=u[d+2>>>2]>>>24-(d+2)%4*8&255,x=p<<16|l<<8|m,v=0;v<4&&d+v*.75<h;v++)f.push(g.charAt(x>>>6*(3-v)&63));var b=g.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(a){var u=a.length,h=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var f=0;f<h.length;f++)g[h.charCodeAt(f)]=f}var d=h.charAt(64);if(d){var p=a.indexOf(d);p!==-1&&(u=p)}return o(a,u,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(a,u,h){for(var g=[],f=0,d=0;d<u;d++)if(d%4){var p=h[a.charCodeAt(d-1)]<<d%4*2,l=h[a.charCodeAt(d)]>>>6-d%4*2,m=p|l;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64})}(bs)),bs.exports}var Ss={exports:{}},Ma;function j0(){return Ma||(Ma=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64url={stringify:function(a,u){u===void 0&&(u=!0);var h=a.words,g=a.sigBytes,f=u?this._safe_map:this._map;a.clamp();for(var d=[],p=0;p<g;p+=3)for(var l=h[p>>>2]>>>24-p%4*8&255,m=h[p+1>>>2]>>>24-(p+1)%4*8&255,x=h[p+2>>>2]>>>24-(p+2)%4*8&255,v=l<<16|m<<8|x,b=0;b<4&&p+b*.75<g;b++)d.push(f.charAt(v>>>6*(3-b)&63));var w=f.charAt(64);if(w)for(;d.length%4;)d.push(w);return d.join("")},parse:function(a,u){u===void 0&&(u=!0);var h=a.length,g=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var d=0;d<g.length;d++)f[g.charCodeAt(d)]=d}var p=g.charAt(64);if(p){var l=a.indexOf(p);l!==-1&&(h=l)}return o(a,h,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(a,u,h){for(var g=[],f=0,d=0;d<u;d++)if(d%4){var p=h[a.charCodeAt(d-1)]<<d%4*2,l=h[a.charCodeAt(d)]>>>6-d%4*2,m=p|l;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64url})}(Ss)),Ss.exports}var _s={exports:{}},Na;function vi(){return Na||(Na=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,u=[];(function(){for(var l=0;l<64;l++)u[l]=t.abs(t.sin(l+1))*4294967296|0})();var h=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(l,m){for(var x=0;x<16;x++){var v=m+x,b=l[v];l[v]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var w=this._hash.words,_=l[m+0],C=l[m+1],E=l[m+2],I=l[m+3],L=l[m+4],k=l[m+5],N=l[m+6],R=l[m+7],M=l[m+8],y=l[m+9],V=l[m+10],Q=l[m+11],q=l[m+12],ne=l[m+13],$=l[m+14],ie=l[m+15],D=w[0],B=w[1],z=w[2],O=w[3];D=g(D,B,z,O,_,7,u[0]),O=g(O,D,B,z,C,12,u[1]),z=g(z,O,D,B,E,17,u[2]),B=g(B,z,O,D,I,22,u[3]),D=g(D,B,z,O,L,7,u[4]),O=g(O,D,B,z,k,12,u[5]),z=g(z,O,D,B,N,17,u[6]),B=g(B,z,O,D,R,22,u[7]),D=g(D,B,z,O,M,7,u[8]),O=g(O,D,B,z,y,12,u[9]),z=g(z,O,D,B,V,17,u[10]),B=g(B,z,O,D,Q,22,u[11]),D=g(D,B,z,O,q,7,u[12]),O=g(O,D,B,z,ne,12,u[13]),z=g(z,O,D,B,$,17,u[14]),B=g(B,z,O,D,ie,22,u[15]),D=f(D,B,z,O,C,5,u[16]),O=f(O,D,B,z,N,9,u[17]),z=f(z,O,D,B,Q,14,u[18]),B=f(B,z,O,D,_,20,u[19]),D=f(D,B,z,O,k,5,u[20]),O=f(O,D,B,z,V,9,u[21]),z=f(z,O,D,B,ie,14,u[22]),B=f(B,z,O,D,L,20,u[23]),D=f(D,B,z,O,y,5,u[24]),O=f(O,D,B,z,$,9,u[25]),z=f(z,O,D,B,I,14,u[26]),B=f(B,z,O,D,M,20,u[27]),D=f(D,B,z,O,ne,5,u[28]),O=f(O,D,B,z,E,9,u[29]),z=f(z,O,D,B,R,14,u[30]),B=f(B,z,O,D,q,20,u[31]),D=d(D,B,z,O,k,4,u[32]),O=d(O,D,B,z,M,11,u[33]),z=d(z,O,D,B,Q,16,u[34]),B=d(B,z,O,D,$,23,u[35]),D=d(D,B,z,O,C,4,u[36]),O=d(O,D,B,z,L,11,u[37]),z=d(z,O,D,B,R,16,u[38]),B=d(B,z,O,D,V,23,u[39]),D=d(D,B,z,O,ne,4,u[40]),O=d(O,D,B,z,_,11,u[41]),z=d(z,O,D,B,I,16,u[42]),B=d(B,z,O,D,N,23,u[43]),D=d(D,B,z,O,y,4,u[44]),O=d(O,D,B,z,q,11,u[45]),z=d(z,O,D,B,ie,16,u[46]),B=d(B,z,O,D,E,23,u[47]),D=p(D,B,z,O,_,6,u[48]),O=p(O,D,B,z,R,10,u[49]),z=p(z,O,D,B,$,15,u[50]),B=p(B,z,O,D,k,21,u[51]),D=p(D,B,z,O,q,6,u[52]),O=p(O,D,B,z,I,10,u[53]),z=p(z,O,D,B,V,15,u[54]),B=p(B,z,O,D,C,21,u[55]),D=p(D,B,z,O,M,6,u[56]),O=p(O,D,B,z,ie,10,u[57]),z=p(z,O,D,B,N,15,u[58]),B=p(B,z,O,D,ne,21,u[59]),D=p(D,B,z,O,L,6,u[60]),O=p(O,D,B,z,Q,10,u[61]),z=p(z,O,D,B,E,15,u[62]),B=p(B,z,O,D,y,21,u[63]),w[0]=w[0]+D|0,w[1]=w[1]+B|0,w[2]=w[2]+z|0,w[3]=w[3]+O|0},_doFinalize:function(){var l=this._data,m=l.words,x=this._nDataBytes*8,v=l.sigBytes*8;m[v>>>5]|=128<<24-v%32;var b=t.floor(x/4294967296),w=x;m[(v+64>>>9<<4)+15]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,m[(v+64>>>9<<4)+14]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,l.sigBytes=(m.length+1)*4,this._process();for(var _=this._hash,C=_.words,E=0;E<4;E++){var I=C[E];C[E]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360}return _},clone:function(){var l=o.clone.call(this);return l._hash=this._hash.clone(),l}});function g(l,m,x,v,b,w,_){var C=l+(m&x|~m&v)+b+_;return(C<<w|C>>>32-w)+m}function f(l,m,x,v,b,w,_){var C=l+(m&v|x&~v)+b+_;return(C<<w|C>>>32-w)+m}function d(l,m,x,v,b,w,_){var C=l+(m^x^v)+b+_;return(C<<w|C>>>32-w)+m}function p(l,m,x,v,b,w,_){var C=l+(x^(m|~v))+b+_;return(C<<w|C>>>32-w)+m}i.MD5=o._createHelper(h),i.HmacMD5=o._createHmacHelper(h)}(Math),e.MD5})}(_s)),_s.exports}var ys={exports:{}},Fa;function Oa(){return Fa||(Fa=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.Hasher,o=t.algo,a=[],u=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,g){for(var f=this._hash.words,d=f[0],p=f[1],l=f[2],m=f[3],x=f[4],v=0;v<80;v++){if(v<16)a[v]=h[g+v]|0;else{var b=a[v-3]^a[v-8]^a[v-14]^a[v-16];a[v]=b<<1|b>>>31}var w=(d<<5|d>>>27)+x+a[v];v<20?w+=(p&l|~p&m)+1518500249:v<40?w+=(p^l^m)+1859775393:v<60?w+=(p&l|p&m|l&m)-1894007588:w+=(p^l^m)-899497514,x=m,m=l,l=p<<30|p>>>2,p=d,d=w}f[0]=f[0]+d|0,f[1]=f[1]+p|0,f[2]=f[2]+l|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0},_doFinalize:function(){var h=this._data,g=h.words,f=this._nDataBytes*8,d=h.sigBytes*8;return g[d>>>5]|=128<<24-d%32,g[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),g[(d+64>>>9<<4)+15]=f,h.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});t.SHA1=n._createHelper(u),t.HmacSHA1=n._createHmacHelper(u)}(),e.SHA1})}(ys)),ys.exports}var ws={exports:{}},Va;function As(){return Va||(Va=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,u=[],h=[];(function(){function d(x){for(var v=t.sqrt(x),b=2;b<=v;b++)if(!(x%b))return!1;return!0}function p(x){return(x-(x|0))*4294967296|0}for(var l=2,m=0;m<64;)d(l)&&(m<8&&(u[m]=p(t.pow(l,1/2))),h[m]=p(t.pow(l,1/3)),m++),l++})();var g=[],f=a.SHA256=o.extend({_doReset:function(){this._hash=new n.init(u.slice(0))},_doProcessBlock:function(d,p){for(var l=this._hash.words,m=l[0],x=l[1],v=l[2],b=l[3],w=l[4],_=l[5],C=l[6],E=l[7],I=0;I<64;I++){if(I<16)g[I]=d[p+I]|0;else{var L=g[I-15],k=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,N=g[I-2],R=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;g[I]=k+g[I-7]+R+g[I-16]}var M=w&_^~w&C,y=m&x^m&v^x&v,V=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),Q=(w<<26|w>>>6)^(w<<21|w>>>11)^(w<<7|w>>>25),q=E+Q+M+h[I]+g[I],ne=V+y;E=C,C=_,_=w,w=b+q|0,b=v,v=x,x=m,m=q+ne|0}l[0]=l[0]+m|0,l[1]=l[1]+x|0,l[2]=l[2]+v|0,l[3]=l[3]+b|0,l[4]=l[4]+w|0,l[5]=l[5]+_|0,l[6]=l[6]+C|0,l[7]=l[7]+E|0},_doFinalize:function(){var d=this._data,p=d.words,l=this._nDataBytes*8,m=d.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=t.floor(l/4294967296),p[(m+64>>>9<<4)+15]=l,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=o.clone.call(this);return d._hash=this._hash.clone(),d}});i.SHA256=o._createHelper(f),i.HmacSHA256=o._createHmacHelper(f)}(Math),e.SHA256})}(ws)),ws.exports}var Es={exports:{}},Ua;function W0(){return Ua||(Ua=1,function(s,c){(function(e,t,i){s.exports=t(De(),As())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.algo,o=n.SHA256,a=n.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=o._doFinalize.call(this);return u.sigBytes-=4,u}});t.SHA224=o._createHelper(a),t.HmacSHA224=o._createHmacHelper(a)}(),e.SHA224})}(Es)),Es.exports}var Cs={exports:{}},Ha;function za(){return Ha||(Ha=1,function(s,c){(function(e,t,i){s.exports=t(De(),vr())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.Hasher,n=t.x64,o=n.Word,a=n.WordArray,u=t.algo;function h(){return o.create.apply(o,arguments)}var g=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],f=[];(function(){for(var p=0;p<80;p++)f[p]=h()})();var d=u.SHA512=r.extend({_doReset:function(){this._hash=new a.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(p,l){for(var m=this._hash.words,x=m[0],v=m[1],b=m[2],w=m[3],_=m[4],C=m[5],E=m[6],I=m[7],L=x.high,k=x.low,N=v.high,R=v.low,M=b.high,y=b.low,V=w.high,Q=w.low,q=_.high,ne=_.low,$=C.high,ie=C.low,D=E.high,B=E.low,z=I.high,O=I.low,K=L,be=k,he=N,re=R,Ae=M,Le=y,Pe=V,We=Q,Oe=q,S=ne,G=$,W=ie,P=D,T=B,F=z,X=O,J=0;J<80;J++){var U,Y,pe=f[J];if(J<16)Y=pe.high=p[l+J*2]|0,U=pe.low=p[l+J*2+1]|0;else{var ee=f[J-15],_e=ee.high,Te=ee.low,Re=(_e>>>1|Te<<31)^(_e>>>8|Te<<24)^_e>>>7,nt=(Te>>>1|_e<<31)^(Te>>>8|_e<<24)^(Te>>>7|_e<<25),Wt=f[J-2],Ke=Wt.high,Et=Wt.low,Ue=(Ke>>>19|Et<<13)^(Ke<<3|Et>>>29)^Ke>>>6,Zt=(Et>>>19|Ke<<13)^(Et<<3|Ke>>>29)^(Et>>>6|Ke<<26),Hi=f[J-7],Ot=Hi.high,Hr=Hi.low,zr=f[J-16],Fn=zr.high,jr=zr.low;U=nt+Hr,Y=Re+Ot+(U>>>0<nt>>>0?1:0),U=U+Zt,Y=Y+Ue+(U>>>0<Zt>>>0?1:0),U=U+jr,Y=Y+Fn+(U>>>0<jr>>>0?1:0),pe.high=Y,pe.low=U}var Wr=Oe&G^~Oe&P,ui=S&W^~S&T,zi=K&he^K&Ae^he&Ae,Bh=be&re^be&Le^re&Le,Ph=(K>>>28|be<<4)^(K<<30|be>>>2)^(K<<25|be>>>7),gc=(be>>>28|K<<4)^(be<<30|K>>>2)^(be<<25|K>>>7),Lh=(Oe>>>14|S<<18)^(Oe>>>18|S<<14)^(Oe<<23|S>>>9),Mh=(S>>>14|Oe<<18)^(S>>>18|Oe<<14)^(S<<23|Oe>>>9),vc=g[J],Nh=vc.high,xc=vc.low,Ct=X+Mh,hi=F+Lh+(Ct>>>0<X>>>0?1:0),Ct=Ct+ui,hi=hi+Wr+(Ct>>>0<ui>>>0?1:0),Ct=Ct+xc,hi=hi+Nh+(Ct>>>0<xc>>>0?1:0),Ct=Ct+U,hi=hi+Y+(Ct>>>0<U>>>0?1:0),bc=gc+Bh,Fh=Ph+zi+(bc>>>0<gc>>>0?1:0);F=P,X=T,P=G,T=W,G=Oe,W=S,S=We+Ct|0,Oe=Pe+hi+(S>>>0<We>>>0?1:0)|0,Pe=Ae,We=Le,Ae=he,Le=re,he=K,re=be,be=Ct+bc|0,K=hi+Fh+(be>>>0<Ct>>>0?1:0)|0}k=x.low=k+be,x.high=L+K+(k>>>0<be>>>0?1:0),R=v.low=R+re,v.high=N+he+(R>>>0<re>>>0?1:0),y=b.low=y+Le,b.high=M+Ae+(y>>>0<Le>>>0?1:0),Q=w.low=Q+We,w.high=V+Pe+(Q>>>0<We>>>0?1:0),ne=_.low=ne+S,_.high=q+Oe+(ne>>>0<S>>>0?1:0),ie=C.low=ie+W,C.high=$+G+(ie>>>0<W>>>0?1:0),B=E.low=B+T,E.high=D+P+(B>>>0<T>>>0?1:0),O=I.low=O+X,I.high=z+F+(O>>>0<X>>>0?1:0)},_doFinalize:function(){var p=this._data,l=p.words,m=this._nDataBytes*8,x=p.sigBytes*8;l[x>>>5]|=128<<24-x%32,l[(x+128>>>10<<5)+30]=Math.floor(m/4294967296),l[(x+128>>>10<<5)+31]=m,p.sigBytes=l.length*4,this._process();var v=this._hash.toX32();return v},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});t.SHA512=r._createHelper(d),t.HmacSHA512=r._createHmacHelper(d)}(),e.SHA512})}(Cs)),Cs.exports}var Is={exports:{}},ja;function K0(){return ja||(ja=1,function(s,c){(function(e,t,i){s.exports=t(De(),vr(),za())})(Ie,function(e){return function(){var t=e,i=t.x64,r=i.Word,n=i.WordArray,o=t.algo,a=o.SHA512,u=o.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var h=a._doFinalize.call(this);return h.sigBytes-=16,h}});t.SHA384=a._createHelper(u),t.HmacSHA384=a._createHmacHelper(u)}(),e.SHA384})}(Is)),Is.exports}var Rs={exports:{}},Wa;function $0(){return Wa||(Wa=1,function(s,c){(function(e,t,i){s.exports=t(De(),vr())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.x64,u=a.Word,h=i.algo,g=[],f=[],d=[];(function(){for(var m=1,x=0,v=0;v<24;v++){g[m+5*x]=(v+1)*(v+2)/2%64;var b=x%5,w=(2*m+3*x)%5;m=b,x=w}for(var m=0;m<5;m++)for(var x=0;x<5;x++)f[m+5*x]=x+(2*m+3*x)%5*5;for(var _=1,C=0;C<24;C++){for(var E=0,I=0,L=0;L<7;L++){if(_&1){var k=(1<<L)-1;k<32?I^=1<<k:E^=1<<k-32}_&128?_=_<<1^113:_<<=1}d[C]=u.create(E,I)}})();var p=[];(function(){for(var m=0;m<25;m++)p[m]=u.create()})();var l=h.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],x=0;x<25;x++)m[x]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,x){for(var v=this._state,b=this.blockSize/2,w=0;w<b;w++){var _=m[x+2*w],C=m[x+2*w+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360;var E=v[w];E.high^=C,E.low^=_}for(var I=0;I<24;I++){for(var L=0;L<5;L++){for(var k=0,N=0,R=0;R<5;R++){var E=v[L+5*R];k^=E.high,N^=E.low}var M=p[L];M.high=k,M.low=N}for(var L=0;L<5;L++)for(var y=p[(L+4)%5],V=p[(L+1)%5],Q=V.high,q=V.low,k=y.high^(Q<<1|q>>>31),N=y.low^(q<<1|Q>>>31),R=0;R<5;R++){var E=v[L+5*R];E.high^=k,E.low^=N}for(var ne=1;ne<25;ne++){var k,N,E=v[ne],$=E.high,ie=E.low,D=g[ne];D<32?(k=$<<D|ie>>>32-D,N=ie<<D|$>>>32-D):(k=ie<<D-32|$>>>64-D,N=$<<D-32|ie>>>64-D);var B=p[f[ne]];B.high=k,B.low=N}var z=p[0],O=v[0];z.high=O.high,z.low=O.low;for(var L=0;L<5;L++)for(var R=0;R<5;R++){var ne=L+5*R,E=v[ne],K=p[ne],be=p[(L+1)%5+5*R],he=p[(L+2)%5+5*R];E.high=K.high^~be.high&he.high,E.low=K.low^~be.low&he.low}var E=v[0],re=d[I];E.high^=re.high,E.low^=re.low}},_doFinalize:function(){var m=this._data,x=m.words;this._nDataBytes*8;var v=m.sigBytes*8,b=this.blockSize*32;x[v>>>5]|=1<<24-v%32,x[(t.ceil((v+1)/b)*b>>>5)-1]|=128,m.sigBytes=x.length*4,this._process();for(var w=this._state,_=this.cfg.outputLength/8,C=_/8,E=[],I=0;I<C;I++){var L=w[I],k=L.high,N=L.low;k=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,E.push(N),E.push(k)}return new n.init(E,_)},clone:function(){for(var m=o.clone.call(this),x=m._state=this._state.slice(0),v=0;v<25;v++)x[v]=x[v].clone();return m}});i.SHA3=o._createHelper(l),i.HmacSHA3=o._createHmacHelper(l)}(Math),e.SHA3})}(Rs)),Rs.exports}var ks={exports:{}},Ka;function q0(){return Ka||(Ka=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){/** @preserve
14
+ */(function(s,c){(function(e){s.exports=e()})(function(){return function e(t,r,i){function n(u,h){if(!r[u]){if(!t[u]){var g=typeof ci=="function"&&ci;if(!h&&g)return g(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[u]={exports:{}};t[u][0].call(l.exports,function(p){var d=t[u][1][p];return n(d||p)},l,l.exports,e,t,r,i)}return r[u].exports}for(var a=typeof ci=="function"&&ci,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,r){var i=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(o){for(var u,h,g,f,l,p,d,m=[],x=0,v=o.length,b=v,y=i.getTypeOf(o)!=="string";x<o.length;)b=v-x,g=y?(u=o[x++],h=x<v?o[x++]:0,x<v?o[x++]:0):(u=o.charCodeAt(x++),h=x<v?o.charCodeAt(x++):0,x<v?o.charCodeAt(x++):0),f=u>>2,l=(3&u)<<4|h>>4,p=1<b?(15&h)<<2|g>>6:64,d=2<b?63&g:64,m.push(a.charAt(f)+a.charAt(l)+a.charAt(p)+a.charAt(d));return m.join("")},r.decode=function(o){var u,h,g,f,l,p,d=0,m=0,x="data:";if(o.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var v,b=3*(o=o.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(o.charAt(o.length-1)===a.charAt(64)&&b--,o.charAt(o.length-2)===a.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=n.uint8array?new Uint8Array(0|b):new Array(0|b);d<o.length;)u=a.indexOf(o.charAt(d++))<<2|(f=a.indexOf(o.charAt(d++)))>>4,h=(15&f)<<4|(l=a.indexOf(o.charAt(d++)))>>2,g=(3&l)<<6|(p=a.indexOf(o.charAt(d++))),v[m++]=u,l!==64&&(v[m++]=h),p!==64&&(v[m++]=g);return v}},{"./support":30,"./utils":32}],2:[function(e,t,r){var i=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function u(h,g,f,l,p){this.compressedSize=h,this.uncompressedSize=g,this.crc32=f,this.compression=l,this.compressedContent=p}u.prototype={getContentWorker:function(){var h=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),g=this;return h.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,g,f){return h.pipe(new a).pipe(new o("uncompressedSize")).pipe(g.compressWorker(f)).pipe(new o("compressedSize")).withStreamInfo("compression",g)},t.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){var i=e("./utils"),n=function(){for(var a,o=[],u=0;u<256;u++){a=u;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;o[u]=a}return o}();t.exports=function(a,o){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(u,h,g,f){var l=n,p=f+g;u^=-1;for(var d=f;d<p;d++)u=u>>>8^l[255&(u^h[d])];return-1^u}(0|o,a,a.length,0):function(u,h,g,f){var l=n,p=f+g;u^=-1;for(var d=f;d<p;d++)u=u>>>8^l[255&(u^h.charCodeAt(d))];return-1^u}(0|o,a,a.length,0):0}},{"./utils":32}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){var i=null;i=typeof Promise!="undefined"?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,r){var i=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),u=i?"uint8array":"array";function h(g,f){o.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=f,this.meta={}}r.magic="\b\0",a.inherits(h,o),h.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,g.data),!1)},h.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(f){g.push({data:f,meta:g.meta})}},r.compressWorker=function(g){return new h("Deflate",g)},r.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){function i(l,p){var d,m="";for(d=0;d<p;d++)m+=String.fromCharCode(255&l),l>>>=8;return m}function n(l,p,d,m,x,v){var b,y,E=l.file,I=l.compression,C=v!==u.utf8encode,R=a.transformTo("string",v(E.name)),L=a.transformTo("string",u.utf8encode(E.name)),k=E.comment,M=a.transformTo("string",v(k)),w=a.transformTo("string",u.utf8encode(k)),N=L.length!==E.name.length,_=w.length!==k.length,V="",ee="",q="",re=E.dir,$=E.date,ie={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(ie.crc32=l.crc32,ie.compressedSize=l.compressedSize,ie.uncompressedSize=l.uncompressedSize);var T=0;p&&(T|=8),C||!N&&!_||(T|=2048);var B=0,H=0;re&&(B|=16),x==="UNIX"?(H=798,B|=function(K,Y){var ge=K;return K||(ge=Y?16893:33204),(65535&ge)<<16}(E.unixPermissions,re)):(H=20,B|=function(K){return 63&(K||0)}(E.dosPermissions)),b=$.getUTCHours(),b<<=6,b|=$.getUTCMinutes(),b<<=5,b|=$.getUTCSeconds()/2,y=$.getUTCFullYear()-1980,y<<=4,y|=$.getUTCMonth()+1,y<<=5,y|=$.getUTCDate(),N&&(ee=i(1,1)+i(h(R),4)+L,V+="up"+i(ee.length,2)+ee),_&&(q=i(1,1)+i(h(M),4)+w,V+="uc"+i(q.length,2)+q);var F="";return F+=`
15
+ \0`,F+=i(T,2),F+=I.magic,F+=i(b,2),F+=i(y,2),F+=i(ie.crc32,4),F+=i(ie.compressedSize,4),F+=i(ie.uncompressedSize,4),F+=i(R.length,2),F+=i(V.length,2),{fileRecord:g.LOCAL_FILE_HEADER+F+R+V,dirRecord:g.CENTRAL_FILE_HEADER+i(H,2)+F+i(M.length,2)+"\0\0\0\0"+i(B,4)+i(m,4)+R+V+M}}var a=e("../utils"),o=e("../stream/GenericWorker"),u=e("../utf8"),h=e("../crc32"),g=e("../signature");function f(l,p,d,m){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,this.encodeFileName=m,this.streamFiles=l,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,o),f.prototype.push=function(l){var p=l.meta.percent||0,d=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(l):(this.bytesWritten+=l.data.length,o.prototype.push.call(this,{data:l.data,meta:{currentFile:this.currentFile,percent:d?(p+100*(d-m-1))/d:100}}))},f.prototype.openedSource=function(l){this.currentSourceOffset=this.bytesWritten,this.currentFile=l.file.name;var p=this.streamFiles&&!l.file.dir;if(p){var d=n(l,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(l){this.accumulate=!1;var p=this.streamFiles&&!l.file.dir,d=n(l,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)this.push({data:function(m){return g.DATA_DESCRIPTOR+i(m.crc32,4)+i(m.compressedSize,4)+i(m.uncompressedSize,4)}(l),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var l=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var d=this.bytesWritten-l,m=function(x,v,b,y,E){var I=a.transformTo("string",E(y));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(x,2)+i(x,2)+i(v,4)+i(b,4)+i(I.length,2)+I}(this.dirRecords.length,d,l,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(l){this._sources.push(l);var p=this;return l.on("data",function(d){p.processChunk(d)}),l.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),l.on("error",function(d){p.error(d)}),this},f.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(l){var p=this._sources;if(!o.prototype.error.call(this,l))return!1;for(var d=0;d<p.length;d++)try{p[d].error(l)}catch(m){}return!0},f.prototype.lock=function(){o.prototype.lock.call(this);for(var l=this._sources,p=0;p<l.length;p++)l[p].lock()},t.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){var i=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(a,o,u){var h=new n(o.streamFiles,u,o.platform,o.encodeFileName),g=0;try{a.forEach(function(f,l){g++;var p=function(v,b){var y=v||b,E=i[y];if(!E)throw new Error(y+" is not a valid compression method !");return E}(l.options.compression,o.compression),d=l.options.compressionOptions||o.compressionOptions||{},m=l.dir,x=l.date;l._compressWorker(p,d).withStreamInfo("file",{name:f,dir:m,date:x,comment:l.comment||"",unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions}).pipe(h)}),h.entriesCount=g}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var n=new i;for(var a in this)typeof this[a]!="function"&&(n[a]=this[a]);return n}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(n,a){return new i().loadAsync(n,a)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){var i=e("./utils"),n=e("./external"),a=e("./utf8"),o=e("./zipEntries"),u=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function g(f){return new n.Promise(function(l,p){var d=f.decompressed.getContentWorker().pipe(new u);d.on("error",function(m){p(m)}).on("end",function(){d.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):l()}).resume()})}t.exports=function(f,l){var p=this;return l=i.extend(l||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(f)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,l.optimizedBinaryString,l.base64).then(function(d){var m=new o(l);return m.load(d),m}).then(function(d){var m=[n.Promise.resolve(d)],x=d.files;if(l.checkCRC32)for(var v=0;v<x.length;v++)m.push(g(x[v]));return n.Promise.all(m)}).then(function(d){for(var m=d.shift(),x=m.files,v=0;v<x.length;v++){var b=x[v],y=b.fileNameStr,E=i.resolve(b.fileNameStr);p.file(E,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:l.createFolders}),b.dir||(p.file(E).unsafeOriginalName=y)}return m.zipComment.length&&(p.comment=m.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){var i=e("../utils"),n=e("../stream/GenericWorker");function a(o,u){n.call(this,"Nodejs stream input adapter for "+o),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,n),a.prototype._bindStream=function(o){var u=this;(this._stream=o).pause(),o.on("data",function(h){u.push({data:h,meta:{percent:0}})}).on("error",function(h){u.isPaused?this.generatedError=h:u.error(h)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){var i=e("readable-stream").Readable;function n(a,o,u){i.call(this,o),this._helper=a;var h=this;a.on("data",function(g,f){h.push(g)||h._helper.pause(),u&&u(f)}).on("error",function(g){h.emit("error",g)}).on("end",function(){h.push(null)})}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){t.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(i,n){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,n);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,n)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var n=new Buffer(i);return n.fill(0),n},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(e,t,r){function i(E,I,C){var R,L=a.getTypeOf(I),k=a.extend(C||{},h);k.date=k.date||new Date,k.compression!==null&&(k.compression=k.compression.toUpperCase()),typeof k.unixPermissions=="string"&&(k.unixPermissions=parseInt(k.unixPermissions,8)),k.unixPermissions&&16384&k.unixPermissions&&(k.dir=!0),k.dosPermissions&&16&k.dosPermissions&&(k.dir=!0),k.dir&&(E=x(E)),k.createFolders&&(R=m(E))&&v.call(this,R,!0);var M=L==="string"&&k.binary===!1&&k.base64===!1;C&&C.binary!==void 0||(k.binary=!M),(I instanceof g&&I.uncompressedSize===0||k.dir||!I||I.length===0)&&(k.base64=!1,k.binary=!0,I="",k.compression="STORE",L="string");var w=null;w=I instanceof g||I instanceof o?I:p.isNode&&p.isStream(I)?new d(E,I):a.prepareContent(E,I,k.binary,k.optimizedBinaryString,k.base64);var N=new f(E,w,k);this.files[E]=N}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),u=e("./stream/StreamHelper"),h=e("./defaults"),g=e("./compressedObject"),f=e("./zipObject"),l=e("./generate"),p=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),m=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var I=E.lastIndexOf("/");return 0<I?E.substring(0,I):""},x=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},v=function(E,I){return I=I!==void 0?I:h.createFolders,E=x(E),this.files[E]||i.call(this,E,null,{dir:!0,createFolders:I}),this.files[E]};function b(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var I,C,R;for(I in this.files)R=this.files[I],(C=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&E(C,R)},filter:function(E){var I=[];return this.forEach(function(C,R){E(C,R)&&I.push(R)}),I},file:function(E,I,C){if(arguments.length!==1)return E=this.root+E,i.call(this,E,I,C),this;if(b(E)){var R=E;return this.filter(function(k,M){return!M.dir&&R.test(k)})}var L=this.files[this.root+E];return L&&!L.dir?L:null},folder:function(E){if(!E)return this;if(b(E))return this.filter(function(L,k){return k.dir&&E.test(L)});var I=this.root+E,C=v.call(this,I),R=this.clone();return R.root=C.name,R},remove:function(E){E=this.root+E;var I=this.files[E];if(I||(E.slice(-1)!=="/"&&(E+="/"),I=this.files[E]),I&&!I.dir)delete this.files[E];else for(var C=this.filter(function(L,k){return k.name.slice(0,E.length)===E}),R=0;R<C.length;R++)delete this.files[C[R].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var I,C={};try{if((C=a.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");a.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var R=C.comment||this.comment||"";I=l.generateWorker(this,C,R)}catch(L){(I=new o("error")).error(L)}return new u(I,C.type||"string",C.mimeType)},generateAsync:function(E,I){return this.generateInternalStream(E).accumulate(I)},generateNodeStream:function(E,I){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(I)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){var i=e("./DataReader");function n(a){i.call(this,a);for(var o=0;o<this.data.length;o++)a[o]=255&a[o]}e("../utils").inherits(n,i),n.prototype.byteAt=function(a){return this.data[this.zero+a]},n.prototype.lastIndexOfSignature=function(a){for(var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),g=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===o&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===g)return f-this.zero;return-1},n.prototype.readAndCheckSignature=function(a){var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),g=a.charCodeAt(3),f=this.readData(4);return o===f[0]&&u===f[1]&&h===f[2]&&g===f[3]},n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){var i=e("../utils");function n(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var o,u=0;for(this.checkOffset(a),o=this.index+a-1;o>=this.index;o--)u=(u<<8)+this.byteAt(o);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,r){var i=e("./Uint8ArrayReader");function n(a){i.call(this,a)}e("../utils").inherits(n,i),n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){var i=e("./DataReader");function n(a){i.call(this,a)}e("../utils").inherits(n,i),n.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},n.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},n.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){var i=e("./ArrayReader");function n(a){i.call(this,a)}e("../utils").inherits(n,i),n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var o=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){var i=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),u=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(g){var f=i.getTypeOf(g);return i.checkSupport(f),f!=="string"||n.uint8array?f==="nodebuffer"?new u(g):n.uint8array?new h(i.transformTo("uint8array",g)):new a(i.transformTo("array",g)):new o(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){var i=e("./GenericWorker"),n=e("../utils");function a(o){i.call(this,"ConvertWorker to "+o),this.destType=o}n.inherits(a,i),a.prototype.processChunk=function(o){this.push({data:n.transformTo(this.destType,o.data),meta:o.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){var i=e("./GenericWorker"),n=e("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,i),a.prototype.processChunk=function(o){this.streamInfo.crc32=n(o.data,this.streamInfo.crc32||0),this.push(o)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){var i=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataLengthProbe for "+o),this.propName=o,this.withStreamInfo(o,0)}i.inherits(a,n),a.prototype.processChunk=function(o){if(o){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+o.data.length}n.prototype.processChunk.call(this,o)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){var i=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,o.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=i.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}i.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var o=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":o=this.data.substring(this.index,u);break;case"uint8array":o=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":o=this.data.slice(this.index,u)}return this.index=u,this.push({data:o,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){function i(n){this.name=n||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(n){this.emit("data",n)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(n){this.emit("error",n)}return!0},error:function(n){return!this.isFinished&&(this.isPaused?this.generatedError=n:(this.isFinished=!0,this.emit("error",n),this.previous&&this.previous.error(n),this.cleanUp()),!0)},on:function(n,a){return this._listeners[n].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,a){if(this._listeners[n])for(var o=0;o<this._listeners[n].length;o++)this._listeners[n][o].call(this,a)},pipe:function(n){return n.registerPrevious(this)},registerPrevious:function(n){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=n.streamInfo,this.mergeStreamInfo(),this.previous=n;var a=this;return n.on("data",function(o){a.processChunk(o)}),n.on("end",function(){a.end()}),n.on("error",function(o){a.error(o)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var n=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),n=!0),this.previous&&this.previous.resume(),!n},flush:function(){},processChunk:function(n){this.push(n)},withStreamInfo:function(n,a){return this.extraStreamInfo[n]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var n in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,n)&&(this.streamInfo[n]=this.extraStreamInfo[n])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var n="Worker "+this.name;return this.previous?this.previous+" -> "+n:n}},t.exports=i},{}],29:[function(e,t,r){var i=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),u=e("../support"),h=e("../external"),g=null;if(u.nodestream)try{g=e("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function f(p,d){return new h.Promise(function(m,x){var v=[],b=p._internalType,y=p._outputType,E=p._mimeType;p.on("data",function(I,C){v.push(I),d&&d(C)}).on("error",function(I){v=[],x(I)}).on("end",function(){try{var I=function(C,R,L){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",R),L);case"base64":return o.encode(R);default:return i.transformTo(C,R)}}(y,function(C,R){var L,k=0,M=null,w=0;for(L=0;L<R.length;L++)w+=R[L].length;switch(C){case"string":return R.join("");case"array":return Array.prototype.concat.apply([],R);case"uint8array":for(M=new Uint8Array(w),L=0;L<R.length;L++)M.set(R[L],k),k+=R[L].length;return M;case"nodebuffer":return Buffer.concat(R);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,v),E);m(I)}catch(C){x(C)}v=[]}).resume()})}function l(p,d,m){var x=d;switch(d){case"blob":case"arraybuffer":x="uint8array";break;case"base64":x="string"}try{this._internalType=x,this._outputType=d,this._mimeType=m,i.checkSupport(x),this._worker=p.pipe(new n(x)),p.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}l.prototype={accumulate:function(p){return f(this,p)},on:function(p,d){var m=this;return p==="data"?this._worker.on(p,function(x){d.call(m,x.data,x.meta)}):this._worker.on(p,function(){i.delay(d,arguments,m)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},p)}},t.exports=l},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",r.nodebuffer=typeof Buffer!="undefined",r.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=new Blob([i],{type:"application/zip"}).size===0}catch(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=n.getBlob("application/zip").size===0}catch(o){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(a){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){for(var i=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function g(){o.call(this,"utf-8 decode"),this.leftOver=null}function f(){o.call(this,"utf-8 encode")}r.utf8encode=function(l){return n.nodebuffer?a.newBufferFrom(l,"utf-8"):function(p){var d,m,x,v,b,y=p.length,E=0;for(v=0;v<y;v++)(64512&(m=p.charCodeAt(v)))==55296&&v+1<y&&(64512&(x=p.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),v++),E+=m<128?1:m<2048?2:m<65536?3:4;for(d=n.uint8array?new Uint8Array(E):new Array(E),v=b=0;b<E;v++)(64512&(m=p.charCodeAt(v)))==55296&&v+1<y&&(64512&(x=p.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),v++),m<128?d[b++]=m:(m<2048?d[b++]=192|m>>>6:(m<65536?d[b++]=224|m>>>12:(d[b++]=240|m>>>18,d[b++]=128|m>>>12&63),d[b++]=128|m>>>6&63),d[b++]=128|63&m);return d}(l)},r.utf8decode=function(l){return n.nodebuffer?i.transformTo("nodebuffer",l).toString("utf-8"):function(p){var d,m,x,v,b=p.length,y=new Array(2*b);for(d=m=0;d<b;)if((x=p[d++])<128)y[m++]=x;else if(4<(v=u[x]))y[m++]=65533,d+=v-1;else{for(x&=v===2?31:v===3?15:7;1<v&&d<b;)x=x<<6|63&p[d++],v--;1<v?y[m++]=65533:x<65536?y[m++]=x:(x-=65536,y[m++]=55296|x>>10&1023,y[m++]=56320|1023&x)}return y.length!==m&&(y.subarray?y=y.subarray(0,m):y.length=m),i.applyFromCharCode(y)}(l=i.transformTo(n.uint8array?"uint8array":"array",l))},i.inherits(g,o),g.prototype.processChunk=function(l){var p=i.transformTo(n.uint8array?"uint8array":"array",l.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=function(v,b){var y;for((b=b||v.length)>v.length&&(b=v.length),y=b-1;0<=y&&(192&v[y])==128;)y--;return y<0||y===0?b:y+u[v[y]]>b?y:b}(p),x=p;m!==p.length&&(n.uint8array?(x=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(x=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:r.utf8decode(x),meta:l.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=g,i.inherits(f,o),f.prototype.processChunk=function(l){this.push({data:r.utf8encode(l.data),meta:l.meta})},r.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){var i=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function u(d){return d}function h(d,m){for(var x=0;x<d.length;++x)m[x]=255&d.charCodeAt(x);return m}e("setimmediate"),r.newBlob=function(d,m){r.checkSupport("blob");try{return new Blob([d],{type:m})}catch(v){try{var x=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return x.append(d),x.getBlob(m)}catch(b){throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(d,m,x){var v=[],b=0,y=d.length;if(y<=x)return String.fromCharCode.apply(null,d);for(;b<y;)m==="array"||m==="nodebuffer"?v.push(String.fromCharCode.apply(null,d.slice(b,Math.min(b+x,y)))):v.push(String.fromCharCode.apply(null,d.subarray(b,Math.min(b+x,y)))),b+=x;return v.join("")},stringifyByChar:function(d){for(var m="",x=0;x<d.length;x++)m+=String.fromCharCode(d[x]);return m},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(d){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch(d){return!1}}()}};function f(d){var m=65536,x=r.getTypeOf(d),v=!0;if(x==="uint8array"?v=g.applyCanBeUsed.uint8array:x==="nodebuffer"&&(v=g.applyCanBeUsed.nodebuffer),v)for(;1<m;)try{return g.stringifyByChunk(d,x,m)}catch(b){m=Math.floor(m/2)}return g.stringifyByChar(d)}function l(d,m){for(var x=0;x<d.length;x++)m[x]=d[x];return m}r.applyFromCharCode=f;var p={};p.string={string:u,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return p.string.uint8array(d).buffer},uint8array:function(d){return h(d,new Uint8Array(d.length))},nodebuffer:function(d){return h(d,a.allocBuffer(d.length))}},p.array={string:f,array:u,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return a.newBufferFrom(d)}},p.arraybuffer={string:function(d){return f(new Uint8Array(d))},array:function(d){return l(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:u,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return a.newBufferFrom(new Uint8Array(d))}},p.uint8array={string:f,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:u,nodebuffer:function(d){return a.newBufferFrom(d)}},p.nodebuffer={string:f,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return p.nodebuffer.uint8array(d).buffer},uint8array:function(d){return l(d,new Uint8Array(d.length))},nodebuffer:u},r.transformTo=function(d,m){if(m=m||"",!d)return m;r.checkSupport(d);var x=r.getTypeOf(m);return p[x][d](m)},r.resolve=function(d){for(var m=d.split("/"),x=[],v=0;v<m.length;v++){var b=m[v];b==="."||b===""&&v!==0&&v!==m.length-1||(b===".."?x.pop():x.push(b))}return x.join("/")},r.getTypeOf=function(d){return typeof d=="string"?"string":Object.prototype.toString.call(d)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(d)?"nodebuffer":i.uint8array&&d instanceof Uint8Array?"uint8array":i.arraybuffer&&d instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(d){if(!i[d.toLowerCase()])throw new Error(d+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(d){var m,x,v="";for(x=0;x<(d||"").length;x++)v+="\\x"+((m=d.charCodeAt(x))<16?"0":"")+m.toString(16).toUpperCase();return v},r.delay=function(d,m,x){setImmediate(function(){d.apply(x||null,m||[])})},r.inherits=function(d,m){function x(){}x.prototype=m.prototype,d.prototype=new x},r.extend=function(){var d,m,x={};for(d=0;d<arguments.length;d++)for(m in arguments[d])Object.prototype.hasOwnProperty.call(arguments[d],m)&&x[m]===void 0&&(x[m]=arguments[d][m]);return x},r.prepareContent=function(d,m,x,v,b){return o.Promise.resolve(m).then(function(y){return i.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)&&typeof FileReader!="undefined"?new o.Promise(function(E,I){var C=new FileReader;C.onload=function(R){E(R.target.result)},C.onerror=function(R){I(R.target.error)},C.readAsArrayBuffer(y)}):y}).then(function(y){var E=r.getTypeOf(y);return E?(E==="arraybuffer"?y=r.transformTo("uint8array",y):E==="string"&&(b?y=n.decode(y):x&&v!==!0&&(y=function(I){return h(I,i.uint8array?new Uint8Array(I.length):new Array(I.length))}(y))),y):o.Promise.reject(new Error("Can't read the data of '"+d+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){var i=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),u=e("./support");function h(g){this.files=[],this.loadOptions=g}h.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(f)+", expected "+n.pretty(g)+")")}},isSignature:function(g,f){var l=this.reader.index;this.reader.setIndex(g);var p=this.reader.readString(4)===f;return this.reader.setIndex(l),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var g=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",l=n.transformTo(f,g);this.zipComment=this.loadOptions.decodeFileName(l)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var g,f,l,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),f=this.reader.readInt(4),l=this.reader.readData(f),this.zip64ExtensibleData[g]={id:g,length:f,value:l}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var g,f;for(g=0;g<this.files.length;g++)f=this.files[g],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(g=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(g);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var g=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(g);var f=g;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var l=this.centralDirOffset+this.centralDirSize;this.zip64&&(l+=20,l+=12+this.zip64EndOfCentralSize);var p=f-l;if(0<p)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(g){this.reader=i(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){var i=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),u=e("./utf8"),h=e("./compressions"),g=e("./support");function f(l,p){this.options=l,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(l){var p,d;if(l.skip(22),this.fileNameLength=l.readInt(2),d=l.readInt(2),this.fileName=l.readData(this.fileNameLength),l.skip(d),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=function(m){for(var x in h)if(Object.prototype.hasOwnProperty.call(h,x)&&h[x].magic===m)return h[x];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,l.readData(this.compressedSize))},readCentralPart:function(l){this.versionMadeBy=l.readInt(2),l.skip(2),this.bitFlag=l.readInt(2),this.compressionMethod=l.readString(2),this.date=l.readDate(),this.crc32=l.readInt(4),this.compressedSize=l.readInt(4),this.uncompressedSize=l.readInt(4);var p=l.readInt(2);if(this.extraFieldsLength=l.readInt(2),this.fileCommentLength=l.readInt(2),this.diskNumberStart=l.readInt(2),this.internalFileAttributes=l.readInt(2),this.externalFileAttributes=l.readInt(4),this.localHeaderOffset=l.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");l.skip(p),this.readExtraFields(l),this.parseZIP64ExtraField(l),this.fileComment=l.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var l=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),l==0&&(this.dosPermissions=63&this.externalFileAttributes),l==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var l=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=l.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=l.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=l.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=l.readInt(4))}},readExtraFields:function(l){var p,d,m,x=l.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});l.index+4<x;)p=l.readInt(2),d=l.readInt(2),m=l.readData(d),this.extraFields[p]={id:p,length:d,value:m};l.setIndex(x)},handleUTF8:function(){var l=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var d=n.transformTo(l,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(d)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var x=n.transformTo(l,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(x)}}},findExtraFieldUnicodePath:function(){var l=this.extraFields[28789];if(l){var p=i(l.value);return p.readInt(1)!==1||o(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(l.length-5))}return null},findExtraFieldUnicodeComment:function(){var l=this.extraFields[25461];if(l){var p=i(l.value);return p.readInt(1)!==1||o(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(l.length-5))}return null}},t.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){function i(p,d,m){this.name=p,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=d,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),u=e("./compressedObject"),h=e("./stream/GenericWorker");i.prototype={internalStream:function(p){var d=null,m="string";try{if(!p)throw new Error("No output type specified.");var x=(m=p.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),d=this._decompressWorker();var v=!this._dataBinary;v&&!x&&(d=d.pipe(new o.Utf8EncodeWorker)),!v&&x&&(d=d.pipe(new o.Utf8DecodeWorker))}catch(b){(d=new h("error")).error(b)}return new n(d,m,"")},async:function(p,d){return this.internalStream(p).accumulate(d)},nodeStream:function(p,d){return this.internalStream(p||"nodebuffer").toNodejsStream(d)},_compressWorker:function(p,d){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new o.Utf8EncodeWorker)),u.createWorkerFrom(m,p,d)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},l=0;l<g.length;l++)i.prototype[g[l]]=f;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(i){var n,a,o=i.MutationObserver||i.WebKitMutationObserver;if(o){var u=0,h=new o(p),g=i.document.createTextNode("");h.observe(g,{characterData:!0}),n=function(){g.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)n="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var d=i.document.createElement("script");d.onreadystatechange=function(){p(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},i.document.documentElement.appendChild(d)}:function(){setTimeout(p,0)};else{var f=new i.MessageChannel;f.port1.onmessage=p,n=function(){f.port2.postMessage(0)}}var l=[];function p(){var d,m;a=!0;for(var x=l.length;x;){for(m=l,l=[],d=-1;++d<x;)m[d]();x=l.length}a=!1}t.exports=function(d){l.push(d)!==1||a||n()}}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,r){var i=e("immediate");function n(){}var a={},o=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function g(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,x!==n&&d(this,x)}function f(x,v,b){this.promise=x,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function l(x,v,b){i(function(){var y;try{y=v(b)}catch(E){return a.reject(x,E)}y===x?a.reject(x,new TypeError("Cannot resolve promise with itself")):a.resolve(x,y)})}function p(x){var v=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof v=="function")return function(){v.apply(x,arguments)}}function d(x,v){var b=!1;function y(C){b||(b=!0,a.reject(x,C))}function E(C){b||(b=!0,a.resolve(x,C))}var I=m(function(){v(E,y)});I.status==="error"&&y(I.value)}function m(x,v){var b={};try{b.value=x(v),b.status="success"}catch(y){b.status="error",b.value=y}return b}(t.exports=g).prototype.finally=function(x){if(typeof x!="function")return this;var v=this.constructor;return this.then(function(b){return v.resolve(x()).then(function(){return b})},function(b){return v.resolve(x()).then(function(){throw b})})},g.prototype.catch=function(x){return this.then(null,x)},g.prototype.then=function(x,v){if(typeof x!="function"&&this.state===u||typeof v!="function"&&this.state===o)return this;var b=new this.constructor(n);return this.state!==h?l(b,this.state===u?x:v,this.outcome):this.queue.push(new f(b,x,v)),b},f.prototype.callFulfilled=function(x){a.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){l(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){a.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){l(this.promise,this.onRejected,x)},a.resolve=function(x,v){var b=m(p,v);if(b.status==="error")return a.reject(x,b.value);var y=b.value;if(y)d(x,y);else{x.state=u,x.outcome=v;for(var E=-1,I=x.queue.length;++E<I;)x.queue[E].callFulfilled(v)}return x},a.reject=function(x,v){x.state=o,x.outcome=v;for(var b=-1,y=x.queue.length;++b<y;)x.queue[b].callRejected(v);return x},g.resolve=function(x){return x instanceof this?x:a.resolve(new this(n),x)},g.reject=function(x){var v=new this(n);return a.reject(v,x)},g.all=function(x){var v=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,y=!1;if(!b)return this.resolve([]);for(var E=new Array(b),I=0,C=-1,R=new this(n);++C<b;)L(x[C],C);return R;function L(k,M){v.resolve(k).then(function(w){E[M]=w,++I!==b||y||(y=!0,a.resolve(R,E))},function(w){y||(y=!0,a.reject(R,w))})}},g.race=function(x){var v=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,y=!1;if(!b)return this.resolve([]);for(var E=-1,I=new this(n);++E<b;)C=x[E],v.resolve(C).then(function(R){y||(y=!0,a.resolve(I,R))},function(R){y||(y=!0,a.reject(I,R))});var C;return I}},{immediate:36}],38:[function(e,t,r){var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){var i=e("./zlib/deflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/messages"),u=e("./zlib/zstream"),h=Object.prototype.toString,g=0,f=-1,l=0,p=8;function d(x){if(!(this instanceof d))return new d(x);this.options=n.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:l,to:""},x||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(b!==g)throw new Error(o[b]);if(v.header&&i.deflateSetHeader(this.strm,v.header),v.dictionary){var y;if(y=typeof v.dictionary=="string"?a.string2buf(v.dictionary):h.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(b=i.deflateSetDictionary(this.strm,y))!==g)throw new Error(o[b]);this._dict_set=!0}}function m(x,v){var b=new d(v);if(b.push(x,!0),b.err)throw b.msg||o[b.err];return b.result}d.prototype.push=function(x,v){var b,y,E=this.strm,I=this.options.chunkSize;if(this.ended)return!1;y=v===~~v?v:v===!0?4:0,typeof x=="string"?E.input=a.string2buf(x):h.call(x)==="[object ArrayBuffer]"?E.input=new Uint8Array(x):E.input=x,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new n.Buf8(I),E.next_out=0,E.avail_out=I),(b=i.deflate(E,y))!==1&&b!==g)return this.onEnd(b),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(n.shrinkBuf(E.output,E.next_out))):this.onData(n.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&b!==1);return y===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===g):y!==2||(this.onEnd(g),!(E.avail_out=0))},d.prototype.onData=function(x){this.chunks.push(x)},d.prototype.onEnd=function(x){x===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},r.Deflate=d,r.deflate=m,r.deflateRaw=function(x,v){return(v=v||{}).raw=!0,m(x,v)},r.gzip=function(x,v){return(v=v||{}).gzip=!0,m(x,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){var i=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),u=e("./zlib/messages"),h=e("./zlib/zstream"),g=e("./zlib/gzheader"),f=Object.prototype.toString;function l(d){if(!(this instanceof l))return new l(d);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},d||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||d&&d.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&!(15&m.windowBits)&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var x=i.inflateInit2(this.strm,m.windowBits);if(x!==o.Z_OK)throw new Error(u[x]);this.header=new g,i.inflateGetHeader(this.strm,this.header)}function p(d,m){var x=new l(m);if(x.push(d,!0),x.err)throw x.msg||u[x.err];return x.result}l.prototype.push=function(d,m){var x,v,b,y,E,I,C=this.strm,R=this.options.chunkSize,L=this.options.dictionary,k=!1;if(this.ended)return!1;v=m===~~m?m:m===!0?o.Z_FINISH:o.Z_NO_FLUSH,typeof d=="string"?C.input=a.binstring2buf(d):f.call(d)==="[object ArrayBuffer]"?C.input=new Uint8Array(d):C.input=d,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new n.Buf8(R),C.next_out=0,C.avail_out=R),(x=i.inflate(C,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&L&&(I=typeof L=="string"?a.string2buf(L):f.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,x=i.inflateSetDictionary(this.strm,I)),x===o.Z_BUF_ERROR&&k===!0&&(x=o.Z_OK,k=!1),x!==o.Z_STREAM_END&&x!==o.Z_OK)return this.onEnd(x),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&x!==o.Z_STREAM_END&&(C.avail_in!==0||v!==o.Z_FINISH&&v!==o.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=a.utf8border(C.output,C.next_out),y=C.next_out-b,E=a.buf2string(C.output,b),C.next_out=y,C.avail_out=R-y,y&&n.arraySet(C.output,C.output,b,y,0),this.onData(E)):this.onData(n.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(k=!0)}while((0<C.avail_in||C.avail_out===0)&&x!==o.Z_STREAM_END);return x===o.Z_STREAM_END&&(v=o.Z_FINISH),v===o.Z_FINISH?(x=i.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===o.Z_OK):v!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(C.avail_out=0))},l.prototype.onData=function(d){this.chunks.push(d)},l.prototype.onEnd=function(d){d===o.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=d,this.msg=this.strm.msg},r.Inflate=l,r.inflate=p,r.inflateRaw=function(d,m){return(m=m||{}).raw=!0,p(d,m)},r.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){var i=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";r.assign=function(o){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var h=u.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var g in h)h.hasOwnProperty(g)&&(o[g]=h[g])}}return o},r.shrinkBuf=function(o,u){return o.length===u?o:o.subarray?o.subarray(0,u):(o.length=u,o)};var n={arraySet:function(o,u,h,g,f){if(u.subarray&&o.subarray)o.set(u.subarray(h,h+g),f);else for(var l=0;l<g;l++)o[f+l]=u[h+l]},flattenChunks:function(o){var u,h,g,f,l,p;for(u=g=0,h=o.length;u<h;u++)g+=o[u].length;for(p=new Uint8Array(g),u=f=0,h=o.length;u<h;u++)l=o[u],p.set(l,f),f+=l.length;return p}},a={arraySet:function(o,u,h,g,f){for(var l=0;l<g;l++)o[f+l]=u[h+l]},flattenChunks:function(o){return[].concat.apply([],o)}};r.setTyped=function(o){o?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,a))},r.setTyped(i)},{}],42:[function(e,t,r){var i=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(g){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g){a=!1}for(var o=new i.Buf8(256),u=0;u<256;u++)o[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(g,f){if(f<65537&&(g.subarray&&a||!g.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(g,f));for(var l="",p=0;p<f;p++)l+=String.fromCharCode(g[p]);return l}o[254]=o[254]=1,r.string2buf=function(g){var f,l,p,d,m,x=g.length,v=0;for(d=0;d<x;d++)(64512&(l=g.charCodeAt(d)))==55296&&d+1<x&&(64512&(p=g.charCodeAt(d+1)))==56320&&(l=65536+(l-55296<<10)+(p-56320),d++),v+=l<128?1:l<2048?2:l<65536?3:4;for(f=new i.Buf8(v),d=m=0;m<v;d++)(64512&(l=g.charCodeAt(d)))==55296&&d+1<x&&(64512&(p=g.charCodeAt(d+1)))==56320&&(l=65536+(l-55296<<10)+(p-56320),d++),l<128?f[m++]=l:(l<2048?f[m++]=192|l>>>6:(l<65536?f[m++]=224|l>>>12:(f[m++]=240|l>>>18,f[m++]=128|l>>>12&63),f[m++]=128|l>>>6&63),f[m++]=128|63&l);return f},r.buf2binstring=function(g){return h(g,g.length)},r.binstring2buf=function(g){for(var f=new i.Buf8(g.length),l=0,p=f.length;l<p;l++)f[l]=g.charCodeAt(l);return f},r.buf2string=function(g,f){var l,p,d,m,x=f||g.length,v=new Array(2*x);for(l=p=0;l<x;)if((d=g[l++])<128)v[p++]=d;else if(4<(m=o[d]))v[p++]=65533,l+=m-1;else{for(d&=m===2?31:m===3?15:7;1<m&&l<x;)d=d<<6|63&g[l++],m--;1<m?v[p++]=65533:d<65536?v[p++]=d:(d-=65536,v[p++]=55296|d>>10&1023,v[p++]=56320|1023&d)}return h(v,p)},r.utf8border=function(g,f){var l;for((f=f||g.length)>g.length&&(f=g.length),l=f-1;0<=l&&(192&g[l])==128;)l--;return l<0||l===0?f:l+o[g[l]]>f?l:f}},{"./common":41}],43:[function(e,t,r){t.exports=function(i,n,a,o){for(var u=65535&i|0,h=i>>>16&65535|0,g=0;a!==0;){for(a-=g=2e3<a?2e3:a;h=h+(u=u+n[o++]|0)|0,--g;);u%=65521,h%=65521}return u|h<<16|0}},{}],44:[function(e,t,r){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){var i=function(){for(var n,a=[],o=0;o<256;o++){n=o;for(var u=0;u<8;u++)n=1&n?3988292384^n>>>1:n>>>1;a[o]=n}return a}();t.exports=function(n,a,o,u){var h=i,g=u+o;n^=-1;for(var f=u;f<g;f++)n=n>>>8^h[255&(n^a[f])];return-1^n}},{}],46:[function(e,t,r){var i,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),u=e("./crc32"),h=e("./messages"),g=0,f=4,l=0,p=-2,d=-1,m=4,x=2,v=8,b=9,y=286,E=30,I=19,C=2*y+1,R=15,L=3,k=258,M=k+L+1,w=42,N=113,_=1,V=2,ee=3,q=4;function re(S,G){return S.msg=h[G],G}function $(S){return(S<<1)-(4<S?9:0)}function ie(S){for(var G=S.length;0<=--G;)S[G]=0}function T(S){var G=S.state,W=G.pending;W>S.avail_out&&(W=S.avail_out),W!==0&&(n.arraySet(S.output,G.pending_buf,G.pending_out,W,S.next_out),S.next_out+=W,G.pending_out+=W,S.total_out+=W,S.avail_out-=W,G.pending-=W,G.pending===0&&(G.pending_out=0))}function B(S,G){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,G),S.block_start=S.strstart,T(S.strm)}function H(S,G){S.pending_buf[S.pending++]=G}function F(S,G){S.pending_buf[S.pending++]=G>>>8&255,S.pending_buf[S.pending++]=255&G}function K(S,G){var W,P,D=S.max_chain_length,O=S.strstart,X=S.prev_length,J=S.nice_match,U=S.strstart>S.w_size-M?S.strstart-(S.w_size-M):0,Q=S.window,ue=S.w_mask,te=S.prev,pe=S.strstart+k,we=Q[O+X-1],ye=Q[O+X];S.prev_length>=S.good_match&&(D>>=2),J>S.lookahead&&(J=S.lookahead);do if(Q[(W=G)+X]===ye&&Q[W+X-1]===we&&Q[W]===Q[O]&&Q[++W]===Q[O+1]){O+=2,W++;do;while(Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&O<pe);if(P=k-(pe-O),O=pe-k,X<P){if(S.match_start=G,J<=(X=P))break;we=Q[O+X-1],ye=Q[O+X]}}while((G=te[G&ue])>U&&--D!=0);return X<=S.lookahead?X:S.lookahead}function Y(S){var G,W,P,D,O,X,J,U,Q,ue,te=S.w_size;do{if(D=S.window_size-S.lookahead-S.strstart,S.strstart>=te+(te-M)){for(n.arraySet(S.window,S.window,te,te,0),S.match_start-=te,S.strstart-=te,S.block_start-=te,G=W=S.hash_size;P=S.head[--G],S.head[G]=te<=P?P-te:0,--W;);for(G=W=te;P=S.prev[--G],S.prev[G]=te<=P?P-te:0,--W;);D+=te}if(S.strm.avail_in===0)break;if(X=S.strm,J=S.window,U=S.strstart+S.lookahead,Q=D,ue=void 0,ue=X.avail_in,Q<ue&&(ue=Q),W=ue===0?0:(X.avail_in-=ue,n.arraySet(J,X.input,X.next_in,ue,U),X.state.wrap===1?X.adler=o(X.adler,J,ue,U):X.state.wrap===2&&(X.adler=u(X.adler,J,ue,U)),X.next_in+=ue,X.total_in+=ue,ue),S.lookahead+=W,S.lookahead+S.insert>=L)for(O=S.strstart-S.insert,S.ins_h=S.window[O],S.ins_h=(S.ins_h<<S.hash_shift^S.window[O+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[O+L-1])&S.hash_mask,S.prev[O&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=O,O++,S.insert--,!(S.lookahead+S.insert<L)););}while(S.lookahead<M&&S.strm.avail_in!==0)}function ge(S,G){for(var W,P;;){if(S.lookahead<M){if(Y(S),S.lookahead<M&&G===g)return _;if(S.lookahead===0)break}if(W=0,S.lookahead>=L&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),W!==0&&S.strstart-W<=S.w_size-M&&(S.match_length=K(S,W)),S.match_length>=L)if(P=a._tr_tally(S,S.strstart-S.match_start,S.match_length-L),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=L){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else P=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(P&&(B(S,!1),S.strm.avail_out===0))return _}return S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?ee:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?_:V}function se(S,G){for(var W,P,D;;){if(S.lookahead<M){if(Y(S),S.lookahead<M&&G===g)return _;if(S.lookahead===0)break}if(W=0,S.lookahead>=L&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=L-1,W!==0&&S.prev_length<S.max_lazy_match&&S.strstart-W<=S.w_size-M&&(S.match_length=K(S,W),S.match_length<=5&&(S.strategy===1||S.match_length===L&&4096<S.strstart-S.match_start)&&(S.match_length=L-1)),S.prev_length>=L&&S.match_length<=S.prev_length){for(D=S.strstart+S.lookahead-L,P=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-L),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=D&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=L-1,S.strstart++,P&&(B(S,!1),S.strm.avail_out===0))return _}else if(S.match_available){if((P=a._tr_tally(S,0,S.window[S.strstart-1]))&&B(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return _}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(P=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?ee:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?_:V}function xe(S,G,W,P,D){this.good_length=S,this.max_lazy=G,this.nice_length=W,this.max_chain=P,this.func=D}function Re(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*C),this.dyn_dtree=new n.Buf16(2*(2*E+1)),this.bl_tree=new n.Buf16(2*(2*I+1)),ie(this.dyn_ltree),ie(this.dyn_dtree),ie(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(R+1),this.heap=new n.Buf16(2*y+1),ie(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*y+1),ie(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ce(S){var G;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=x,(G=S.state).pending=0,G.pending_out=0,G.wrap<0&&(G.wrap=-G.wrap),G.status=G.wrap?w:N,S.adler=G.wrap===2?0:1,G.last_flush=g,a._tr_init(G),l):re(S,p)}function Me(S){var G=Ce(S);return G===l&&function(W){W.window_size=2*W.w_size,ie(W.head),W.max_lazy_match=i[W.level].max_lazy,W.good_match=i[W.level].good_length,W.nice_match=i[W.level].nice_length,W.max_chain_length=i[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=L-1,W.match_available=0,W.ins_h=0}(S.state),G}function ke(S,G,W,P,D,O){if(!S)return p;var X=1;if(G===d&&(G=6),P<0?(X=0,P=-P):15<P&&(X=2,P-=16),D<1||b<D||W!==v||P<8||15<P||G<0||9<G||O<0||m<O)return re(S,p);P===8&&(P=9);var J=new Re;return(S.state=J).strm=S,J.wrap=X,J.gzhead=null,J.w_bits=P,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=D+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+L-1)/L),J.window=new n.Buf8(2*J.w_size),J.head=new n.Buf16(J.hash_size),J.prev=new n.Buf16(J.w_size),J.lit_bufsize=1<<D+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new n.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=G,J.strategy=O,J.method=W,Me(S)}i=[new xe(0,0,0,0,function(S,G){var W=65535;for(W>S.pending_buf_size-5&&(W=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Y(S),S.lookahead===0&&G===g)return _;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var P=S.block_start+W;if((S.strstart===0||S.strstart>=P)&&(S.lookahead=S.strstart-P,S.strstart=P,B(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-M&&(B(S,!1),S.strm.avail_out===0))return _}return S.insert=0,G===f?(B(S,!0),S.strm.avail_out===0?ee:q):(S.strstart>S.block_start&&(B(S,!1),S.strm.avail_out),_)}),new xe(4,4,8,4,ge),new xe(4,5,16,8,ge),new xe(4,6,32,32,ge),new xe(4,4,16,16,se),new xe(8,16,32,32,se),new xe(8,16,128,128,se),new xe(8,32,128,256,se),new xe(32,128,258,1024,se),new xe(32,258,258,4096,se)],r.deflateInit=function(S,G){return ke(S,G,v,15,8,0)},r.deflateInit2=ke,r.deflateReset=Me,r.deflateResetKeep=Ce,r.deflateSetHeader=function(S,G){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=G,l):p},r.deflate=function(S,G){var W,P,D,O;if(!S||!S.state||5<G||G<0)return S?re(S,p):p;if(P=S.state,!S.output||!S.input&&S.avail_in!==0||P.status===666&&G!==f)return re(S,S.avail_out===0?-5:p);if(P.strm=S,W=P.last_flush,P.last_flush=G,P.status===w)if(P.wrap===2)S.adler=0,H(P,31),H(P,139),H(P,8),P.gzhead?(H(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),H(P,255&P.gzhead.time),H(P,P.gzhead.time>>8&255),H(P,P.gzhead.time>>16&255),H(P,P.gzhead.time>>24&255),H(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),H(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(H(P,255&P.gzhead.extra.length),H(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(S.adler=u(S.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(H(P,0),H(P,0),H(P,0),H(P,0),H(P,0),H(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),H(P,3),P.status=N);else{var X=v+(P.w_bits-8<<4)<<8;X|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(X|=32),X+=31-X%31,P.status=N,F(P,X),P.strstart!==0&&(F(P,S.adler>>>16),F(P,65535&S.adler)),S.adler=1}if(P.status===69)if(P.gzhead.extra){for(D=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>D&&(S.adler=u(S.adler,P.pending_buf,P.pending-D,D)),T(S),D=P.pending,P.pending!==P.pending_buf_size));)H(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>D&&(S.adler=u(S.adler,P.pending_buf,P.pending-D,D)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){D=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>D&&(S.adler=u(S.adler,P.pending_buf,P.pending-D,D)),T(S),D=P.pending,P.pending===P.pending_buf_size)){O=1;break}O=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,H(P,O)}while(O!==0);P.gzhead.hcrc&&P.pending>D&&(S.adler=u(S.adler,P.pending_buf,P.pending-D,D)),O===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){D=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>D&&(S.adler=u(S.adler,P.pending_buf,P.pending-D,D)),T(S),D=P.pending,P.pending===P.pending_buf_size)){O=1;break}O=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,H(P,O)}while(O!==0);P.gzhead.hcrc&&P.pending>D&&(S.adler=u(S.adler,P.pending_buf,P.pending-D,D)),O===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&T(S),P.pending+2<=P.pending_buf_size&&(H(P,255&S.adler),H(P,S.adler>>8&255),S.adler=0,P.status=N)):P.status=N),P.pending!==0){if(T(S),S.avail_out===0)return P.last_flush=-1,l}else if(S.avail_in===0&&$(G)<=$(W)&&G!==f)return re(S,-5);if(P.status===666&&S.avail_in!==0)return re(S,-5);if(S.avail_in!==0||P.lookahead!==0||G!==g&&P.status!==666){var J=P.strategy===2?function(U,Q){for(var ue;;){if(U.lookahead===0&&(Y(U),U.lookahead===0)){if(Q===g)return _;break}if(U.match_length=0,ue=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,ue&&(B(U,!1),U.strm.avail_out===0))return _}return U.insert=0,Q===f?(B(U,!0),U.strm.avail_out===0?ee:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?_:V}(P,G):P.strategy===3?function(U,Q){for(var ue,te,pe,we,ye=U.window;;){if(U.lookahead<=k){if(Y(U),U.lookahead<=k&&Q===g)return _;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=L&&0<U.strstart&&(te=ye[pe=U.strstart-1])===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]){we=U.strstart+k;do;while(te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&pe<we);U.match_length=k-(we-pe),U.match_length>U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=L?(ue=a._tr_tally(U,1,U.match_length-L),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(ue=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),ue&&(B(U,!1),U.strm.avail_out===0))return _}return U.insert=0,Q===f?(B(U,!0),U.strm.avail_out===0?ee:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?_:V}(P,G):i[P.level].func(P,G);if(J!==ee&&J!==q||(P.status=666),J===_||J===ee)return S.avail_out===0&&(P.last_flush=-1),l;if(J===V&&(G===1?a._tr_align(P):G!==5&&(a._tr_stored_block(P,0,0,!1),G===3&&(ie(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),T(S),S.avail_out===0))return P.last_flush=-1,l}return G!==f?l:P.wrap<=0?1:(P.wrap===2?(H(P,255&S.adler),H(P,S.adler>>8&255),H(P,S.adler>>16&255),H(P,S.adler>>24&255),H(P,255&S.total_in),H(P,S.total_in>>8&255),H(P,S.total_in>>16&255),H(P,S.total_in>>24&255)):(F(P,S.adler>>>16),F(P,65535&S.adler)),T(S),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?l:1)},r.deflateEnd=function(S){var G;return S&&S.state?(G=S.state.status)!==w&&G!==69&&G!==73&&G!==91&&G!==103&&G!==N&&G!==666?re(S,p):(S.state=null,G===N?re(S,-3):l):p},r.deflateSetDictionary=function(S,G){var W,P,D,O,X,J,U,Q,ue=G.length;if(!S||!S.state||(O=(W=S.state).wrap)===2||O===1&&W.status!==w||W.lookahead)return p;for(O===1&&(S.adler=o(S.adler,G,ue,0)),W.wrap=0,ue>=W.w_size&&(O===0&&(ie(W.head),W.strstart=0,W.block_start=0,W.insert=0),Q=new n.Buf8(W.w_size),n.arraySet(Q,G,ue-W.w_size,W.w_size,0),G=Q,ue=W.w_size),X=S.avail_in,J=S.next_in,U=S.input,S.avail_in=ue,S.next_in=0,S.input=G,Y(W);W.lookahead>=L;){for(P=W.strstart,D=W.lookahead-(L-1);W.ins_h=(W.ins_h<<W.hash_shift^W.window[P+L-1])&W.hash_mask,W.prev[P&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=P,P++,--D;);W.strstart=P,W.lookahead=L-1,Y(W)}return W.strstart+=W.lookahead,W.block_start=W.strstart,W.insert=W.lookahead,W.lookahead=0,W.match_length=W.prev_length=L-1,W.match_available=0,S.next_in=J,S.input=U,S.avail_in=X,W.wrap=O,l},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){t.exports=function(i,n){var a,o,u,h,g,f,l,p,d,m,x,v,b,y,E,I,C,R,L,k,M,w,N,_,V;a=i.state,o=i.next_in,_=i.input,u=o+(i.avail_in-5),h=i.next_out,V=i.output,g=h-(n-i.avail_out),f=h+(i.avail_out-257),l=a.dmax,p=a.wsize,d=a.whave,m=a.wnext,x=a.window,v=a.hold,b=a.bits,y=a.lencode,E=a.distcode,I=(1<<a.lenbits)-1,C=(1<<a.distbits)-1;e:do{b<15&&(v+=_[o++]<<b,b+=8,v+=_[o++]<<b,b+=8),R=y[v&I];t:for(;;){if(v>>>=L=R>>>24,b-=L,(L=R>>>16&255)===0)V[h++]=65535&R;else{if(!(16&L)){if(!(64&L)){R=y[(65535&R)+(v&(1<<L)-1)];continue t}if(32&L){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}k=65535&R,(L&=15)&&(b<L&&(v+=_[o++]<<b,b+=8),k+=v&(1<<L)-1,v>>>=L,b-=L),b<15&&(v+=_[o++]<<b,b+=8,v+=_[o++]<<b,b+=8),R=E[v&C];i:for(;;){if(v>>>=L=R>>>24,b-=L,!(16&(L=R>>>16&255))){if(!(64&L)){R=E[(65535&R)+(v&(1<<L)-1)];continue i}i.msg="invalid distance code",a.mode=30;break e}if(M=65535&R,b<(L&=15)&&(v+=_[o++]<<b,(b+=8)<L&&(v+=_[o++]<<b,b+=8)),l<(M+=v&(1<<L)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=L,b-=L,(L=h-g)<M){if(d<(L=M-L)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(N=x,(w=0)===m){if(w+=p-L,L<k){for(k-=L;V[h++]=x[w++],--L;);w=h-M,N=V}}else if(m<L){if(w+=p+m-L,(L-=m)<k){for(k-=L;V[h++]=x[w++],--L;);if(w=0,m<k){for(k-=L=m;V[h++]=x[w++],--L;);w=h-M,N=V}}}else if(w+=m-L,L<k){for(k-=L;V[h++]=x[w++],--L;);w=h-M,N=V}for(;2<k;)V[h++]=N[w++],V[h++]=N[w++],V[h++]=N[w++],k-=3;k&&(V[h++]=N[w++],1<k&&(V[h++]=N[w++]))}else{for(w=h-M;V[h++]=V[w++],V[h++]=V[w++],V[h++]=V[w++],2<(k-=3););k&&(V[h++]=V[w++],1<k&&(V[h++]=V[w++]))}break}}break}}while(o<u&&h<f);o-=k=b>>3,v&=(1<<(b-=k<<3))-1,i.next_in=o,i.next_out=h,i.avail_in=o<u?u-o+5:5-(o-u),i.avail_out=h<f?f-h+257:257-(h-f),a.hold=v,a.bits=b}},{}],49:[function(e,t,r){var i=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),u=e("./inftrees"),h=1,g=2,f=0,l=-2,p=1,d=852,m=592;function x(w){return(w>>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(w){var N;return w&&w.state?(N=w.state,w.total_in=w.total_out=N.total=0,w.msg="",N.wrap&&(w.adler=1&N.wrap),N.mode=p,N.last=0,N.havedict=0,N.dmax=32768,N.head=null,N.hold=0,N.bits=0,N.lencode=N.lendyn=new i.Buf32(d),N.distcode=N.distdyn=new i.Buf32(m),N.sane=1,N.back=-1,f):l}function y(w){var N;return w&&w.state?((N=w.state).wsize=0,N.whave=0,N.wnext=0,b(w)):l}function E(w,N){var _,V;return w&&w.state?(V=w.state,N<0?(_=0,N=-N):(_=1+(N>>4),N<48&&(N&=15)),N&&(N<8||15<N)?l:(V.window!==null&&V.wbits!==N&&(V.window=null),V.wrap=_,V.wbits=N,y(w))):l}function I(w,N){var _,V;return w?(V=new v,(w.state=V).window=null,(_=E(w,N))!==f&&(w.state=null),_):l}var C,R,L=!0;function k(w){if(L){var N;for(C=new i.Buf32(512),R=new i.Buf32(32),N=0;N<144;)w.lens[N++]=8;for(;N<256;)w.lens[N++]=9;for(;N<280;)w.lens[N++]=7;for(;N<288;)w.lens[N++]=8;for(u(h,w.lens,0,288,C,0,w.work,{bits:9}),N=0;N<32;)w.lens[N++]=5;u(g,w.lens,0,32,R,0,w.work,{bits:5}),L=!1}w.lencode=C,w.lenbits=9,w.distcode=R,w.distbits=5}function M(w,N,_,V){var ee,q=w.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new i.Buf8(q.wsize)),V>=q.wsize?(i.arraySet(q.window,N,_-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(V<(ee=q.wsize-q.wnext)&&(ee=V),i.arraySet(q.window,N,_-V,ee,q.wnext),(V-=ee)?(i.arraySet(q.window,N,_-V,V,0),q.wnext=V,q.whave=q.wsize):(q.wnext+=ee,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=ee))),0}r.inflateReset=y,r.inflateReset2=E,r.inflateResetKeep=b,r.inflateInit=function(w){return I(w,15)},r.inflateInit2=I,r.inflate=function(w,N){var _,V,ee,q,re,$,ie,T,B,H,F,K,Y,ge,se,xe,Re,Ce,Me,ke,S,G,W,P,D=0,O=new i.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!w||!w.state||!w.output||!w.input&&w.avail_in!==0)return l;(_=w.state).mode===12&&(_.mode=13),re=w.next_out,ee=w.output,ie=w.avail_out,q=w.next_in,V=w.input,$=w.avail_in,T=_.hold,B=_.bits,H=$,F=ie,G=f;e:for(;;)switch(_.mode){case p:if(_.wrap===0){_.mode=13;break}for(;B<16;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(2&_.wrap&&T===35615){O[_.check=0]=255&T,O[1]=T>>>8&255,_.check=a(_.check,O,2,0),B=T=0,_.mode=2;break}if(_.flags=0,_.head&&(_.head.done=!1),!(1&_.wrap)||(((255&T)<<8)+(T>>8))%31){w.msg="incorrect header check",_.mode=30;break}if((15&T)!=8){w.msg="unknown compression method",_.mode=30;break}if(B-=4,S=8+(15&(T>>>=4)),_.wbits===0)_.wbits=S;else if(S>_.wbits){w.msg="invalid window size",_.mode=30;break}_.dmax=1<<S,w.adler=_.check=1,_.mode=512&T?10:12,B=T=0;break;case 2:for(;B<16;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(_.flags=T,(255&_.flags)!=8){w.msg="unknown compression method",_.mode=30;break}if(57344&_.flags){w.msg="unknown header flags set",_.mode=30;break}_.head&&(_.head.text=T>>8&1),512&_.flags&&(O[0]=255&T,O[1]=T>>>8&255,_.check=a(_.check,O,2,0)),B=T=0,_.mode=3;case 3:for(;B<32;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}_.head&&(_.head.time=T),512&_.flags&&(O[0]=255&T,O[1]=T>>>8&255,O[2]=T>>>16&255,O[3]=T>>>24&255,_.check=a(_.check,O,4,0)),B=T=0,_.mode=4;case 4:for(;B<16;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}_.head&&(_.head.xflags=255&T,_.head.os=T>>8),512&_.flags&&(O[0]=255&T,O[1]=T>>>8&255,_.check=a(_.check,O,2,0)),B=T=0,_.mode=5;case 5:if(1024&_.flags){for(;B<16;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}_.length=T,_.head&&(_.head.extra_len=T),512&_.flags&&(O[0]=255&T,O[1]=T>>>8&255,_.check=a(_.check,O,2,0)),B=T=0}else _.head&&(_.head.extra=null);_.mode=6;case 6:if(1024&_.flags&&($<(K=_.length)&&(K=$),K&&(_.head&&(S=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),i.arraySet(_.head.extra,V,q,K,S)),512&_.flags&&(_.check=a(_.check,V,K,q)),$-=K,q+=K,_.length-=K),_.length))break e;_.length=0,_.mode=7;case 7:if(2048&_.flags){if($===0)break e;for(K=0;S=V[q+K++],_.head&&S&&_.length<65536&&(_.head.name+=String.fromCharCode(S)),S&&K<$;);if(512&_.flags&&(_.check=a(_.check,V,K,q)),$-=K,q+=K,S)break e}else _.head&&(_.head.name=null);_.length=0,_.mode=8;case 8:if(4096&_.flags){if($===0)break e;for(K=0;S=V[q+K++],_.head&&S&&_.length<65536&&(_.head.comment+=String.fromCharCode(S)),S&&K<$;);if(512&_.flags&&(_.check=a(_.check,V,K,q)),$-=K,q+=K,S)break e}else _.head&&(_.head.comment=null);_.mode=9;case 9:if(512&_.flags){for(;B<16;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(T!==(65535&_.check)){w.msg="header crc mismatch",_.mode=30;break}B=T=0}_.head&&(_.head.hcrc=_.flags>>9&1,_.head.done=!0),w.adler=_.check=0,_.mode=12;break;case 10:for(;B<32;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}w.adler=_.check=x(T),B=T=0,_.mode=11;case 11:if(_.havedict===0)return w.next_out=re,w.avail_out=ie,w.next_in=q,w.avail_in=$,_.hold=T,_.bits=B,2;w.adler=_.check=1,_.mode=12;case 12:if(N===5||N===6)break e;case 13:if(_.last){T>>>=7&B,B-=7&B,_.mode=27;break}for(;B<3;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}switch(_.last=1&T,B-=1,3&(T>>>=1)){case 0:_.mode=14;break;case 1:if(k(_),_.mode=20,N!==6)break;T>>>=2,B-=2;break e;case 2:_.mode=17;break;case 3:w.msg="invalid block type",_.mode=30}T>>>=2,B-=2;break;case 14:for(T>>>=7&B,B-=7&B;B<32;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if((65535&T)!=(T>>>16^65535)){w.msg="invalid stored block lengths",_.mode=30;break}if(_.length=65535&T,B=T=0,_.mode=15,N===6)break e;case 15:_.mode=16;case 16:if(K=_.length){if($<K&&(K=$),ie<K&&(K=ie),K===0)break e;i.arraySet(ee,V,q,K,re),$-=K,q+=K,ie-=K,re+=K,_.length-=K;break}_.mode=12;break;case 17:for(;B<14;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(_.nlen=257+(31&T),T>>>=5,B-=5,_.ndist=1+(31&T),T>>>=5,B-=5,_.ncode=4+(15&T),T>>>=4,B-=4,286<_.nlen||30<_.ndist){w.msg="too many length or distance symbols",_.mode=30;break}_.have=0,_.mode=18;case 18:for(;_.have<_.ncode;){for(;B<3;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}_.lens[X[_.have++]]=7&T,T>>>=3,B-=3}for(;_.have<19;)_.lens[X[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,W={bits:_.lenbits},G=u(0,_.lens,0,19,_.lencode,0,_.work,W),_.lenbits=W.bits,G){w.msg="invalid code lengths set",_.mode=30;break}_.have=0,_.mode=19;case 19:for(;_.have<_.nlen+_.ndist;){for(;xe=(D=_.lencode[T&(1<<_.lenbits)-1])>>>16&255,Re=65535&D,!((se=D>>>24)<=B);){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(Re<16)T>>>=se,B-=se,_.lens[_.have++]=Re;else{if(Re===16){for(P=se+2;B<P;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(T>>>=se,B-=se,_.have===0){w.msg="invalid bit length repeat",_.mode=30;break}S=_.lens[_.have-1],K=3+(3&T),T>>>=2,B-=2}else if(Re===17){for(P=se+3;B<P;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}B-=se,S=0,K=3+(7&(T>>>=se)),T>>>=3,B-=3}else{for(P=se+7;B<P;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}B-=se,S=0,K=11+(127&(T>>>=se)),T>>>=7,B-=7}if(_.have+K>_.nlen+_.ndist){w.msg="invalid bit length repeat",_.mode=30;break}for(;K--;)_.lens[_.have++]=S}}if(_.mode===30)break;if(_.lens[256]===0){w.msg="invalid code -- missing end-of-block",_.mode=30;break}if(_.lenbits=9,W={bits:_.lenbits},G=u(h,_.lens,0,_.nlen,_.lencode,0,_.work,W),_.lenbits=W.bits,G){w.msg="invalid literal/lengths set",_.mode=30;break}if(_.distbits=6,_.distcode=_.distdyn,W={bits:_.distbits},G=u(g,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,W),_.distbits=W.bits,G){w.msg="invalid distances set",_.mode=30;break}if(_.mode=20,N===6)break e;case 20:_.mode=21;case 21:if(6<=$&&258<=ie){w.next_out=re,w.avail_out=ie,w.next_in=q,w.avail_in=$,_.hold=T,_.bits=B,o(w,F),re=w.next_out,ee=w.output,ie=w.avail_out,q=w.next_in,V=w.input,$=w.avail_in,T=_.hold,B=_.bits,_.mode===12&&(_.back=-1);break}for(_.back=0;xe=(D=_.lencode[T&(1<<_.lenbits)-1])>>>16&255,Re=65535&D,!((se=D>>>24)<=B);){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(xe&&!(240&xe)){for(Ce=se,Me=xe,ke=Re;xe=(D=_.lencode[ke+((T&(1<<Ce+Me)-1)>>Ce)])>>>16&255,Re=65535&D,!(Ce+(se=D>>>24)<=B);){if($===0)break e;$--,T+=V[q++]<<B,B+=8}T>>>=Ce,B-=Ce,_.back+=Ce}if(T>>>=se,B-=se,_.back+=se,_.length=Re,xe===0){_.mode=26;break}if(32&xe){_.back=-1,_.mode=12;break}if(64&xe){w.msg="invalid literal/length code",_.mode=30;break}_.extra=15&xe,_.mode=22;case 22:if(_.extra){for(P=_.extra;B<P;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}_.length+=T&(1<<_.extra)-1,T>>>=_.extra,B-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=23;case 23:for(;xe=(D=_.distcode[T&(1<<_.distbits)-1])>>>16&255,Re=65535&D,!((se=D>>>24)<=B);){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(!(240&xe)){for(Ce=se,Me=xe,ke=Re;xe=(D=_.distcode[ke+((T&(1<<Ce+Me)-1)>>Ce)])>>>16&255,Re=65535&D,!(Ce+(se=D>>>24)<=B);){if($===0)break e;$--,T+=V[q++]<<B,B+=8}T>>>=Ce,B-=Ce,_.back+=Ce}if(T>>>=se,B-=se,_.back+=se,64&xe){w.msg="invalid distance code",_.mode=30;break}_.offset=Re,_.extra=15&xe,_.mode=24;case 24:if(_.extra){for(P=_.extra;B<P;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}_.offset+=T&(1<<_.extra)-1,T>>>=_.extra,B-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){w.msg="invalid distance too far back",_.mode=30;break}_.mode=25;case 25:if(ie===0)break e;if(K=F-ie,_.offset>K){if((K=_.offset-K)>_.whave&&_.sane){w.msg="invalid distance too far back",_.mode=30;break}Y=K>_.wnext?(K-=_.wnext,_.wsize-K):_.wnext-K,K>_.length&&(K=_.length),ge=_.window}else ge=ee,Y=re-_.offset,K=_.length;for(ie<K&&(K=ie),ie-=K,_.length-=K;ee[re++]=ge[Y++],--K;);_.length===0&&(_.mode=21);break;case 26:if(ie===0)break e;ee[re++]=_.length,ie--,_.mode=21;break;case 27:if(_.wrap){for(;B<32;){if($===0)break e;$--,T|=V[q++]<<B,B+=8}if(F-=ie,w.total_out+=F,_.total+=F,F&&(w.adler=_.check=_.flags?a(_.check,ee,F,re-F):n(_.check,ee,F,re-F)),F=ie,(_.flags?T:x(T))!==_.check){w.msg="incorrect data check",_.mode=30;break}B=T=0}_.mode=28;case 28:if(_.wrap&&_.flags){for(;B<32;){if($===0)break e;$--,T+=V[q++]<<B,B+=8}if(T!==(4294967295&_.total)){w.msg="incorrect length check",_.mode=30;break}B=T=0}_.mode=29;case 29:G=1;break e;case 30:G=-3;break e;case 31:return-4;case 32:default:return l}return w.next_out=re,w.avail_out=ie,w.next_in=q,w.avail_in=$,_.hold=T,_.bits=B,(_.wsize||F!==w.avail_out&&_.mode<30&&(_.mode<27||N!==4))&&M(w,w.output,w.next_out,F-w.avail_out)?(_.mode=31,-4):(H-=w.avail_in,F-=w.avail_out,w.total_in+=H,w.total_out+=F,_.total+=F,_.wrap&&F&&(w.adler=_.check=_.flags?a(_.check,ee,F,w.next_out-F):n(_.check,ee,F,w.next_out-F)),w.data_type=_.bits+(_.last?64:0)+(_.mode===12?128:0)+(_.mode===20||_.mode===15?256:0),(H==0&&F===0||N===4)&&G===f&&(G=-5),G)},r.inflateEnd=function(w){if(!w||!w.state)return l;var N=w.state;return N.window&&(N.window=null),w.state=null,f},r.inflateGetHeader=function(w,N){var _;return w&&w.state&&2&(_=w.state).wrap?((_.head=N).done=!1,f):l},r.inflateSetDictionary=function(w,N){var _,V=N.length;return w&&w.state?(_=w.state).wrap!==0&&_.mode!==11?l:_.mode===11&&n(1,N,V,0)!==_.check?-3:M(w,N,V,V)?(_.mode=31,-4):(_.havedict=1,f):l},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){var i=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(h,g,f,l,p,d,m,x){var v,b,y,E,I,C,R,L,k,M=x.bits,w=0,N=0,_=0,V=0,ee=0,q=0,re=0,$=0,ie=0,T=0,B=null,H=0,F=new i.Buf16(16),K=new i.Buf16(16),Y=null,ge=0;for(w=0;w<=15;w++)F[w]=0;for(N=0;N<l;N++)F[g[f+N]]++;for(ee=M,V=15;1<=V&&F[V]===0;V--);if(V<ee&&(ee=V),V===0)return p[d++]=20971520,p[d++]=20971520,x.bits=1,0;for(_=1;_<V&&F[_]===0;_++);for(ee<_&&(ee=_),w=$=1;w<=15;w++)if($<<=1,($-=F[w])<0)return-1;if(0<$&&(h===0||V!==1))return-1;for(K[1]=0,w=1;w<15;w++)K[w+1]=K[w]+F[w];for(N=0;N<l;N++)g[f+N]!==0&&(m[K[g[f+N]]++]=N);if(C=h===0?(B=Y=m,19):h===1?(B=n,H-=257,Y=a,ge-=257,256):(B=o,Y=u,-1),w=_,I=d,re=N=T=0,y=-1,E=(ie=1<<(q=ee))-1,h===1&&852<ie||h===2&&592<ie)return 1;for(;;){for(R=w-re,k=m[N]<C?(L=0,m[N]):m[N]>C?(L=Y[ge+m[N]],B[H+m[N]]):(L=96,0),v=1<<w-re,_=b=1<<q;p[I+(T>>re)+(b-=v)]=R<<24|L<<16|k|0,b!==0;);for(v=1<<w-1;T&v;)v>>=1;if(v!==0?(T&=v-1,T+=v):T=0,N++,--F[w]==0){if(w===V)break;w=g[f+m[N]]}if(ee<w&&(T&E)!==y){for(re===0&&(re=ee),I+=_,$=1<<(q=w-re);q+re<V&&!(($-=F[q+re])<=0);)q++,$<<=1;if(ie+=1<<q,h===1&&852<ie||h===2&&592<ie)return 1;p[y=T&E]=ee<<24|q<<16|I-d|0}}return T!==0&&(p[I+T]=w-re<<24|64<<16|0),x.bits=ee,0}},{"../utils/common":41}],51:[function(e,t,r){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){var i=e("../utils/common"),n=0,a=1;function o(D){for(var O=D.length;0<=--O;)D[O]=0}var u=0,h=29,g=256,f=g+1+h,l=30,p=19,d=2*f+1,m=15,x=16,v=7,b=256,y=16,E=17,I=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=new Array(2*(f+2));o(M);var w=new Array(2*l);o(w);var N=new Array(512);o(N);var _=new Array(256);o(_);var V=new Array(h);o(V);var ee,q,re,$=new Array(l);function ie(D,O,X,J,U){this.static_tree=D,this.extra_bits=O,this.extra_base=X,this.elems=J,this.max_length=U,this.has_stree=D&&D.length}function T(D,O){this.dyn_tree=D,this.max_code=0,this.stat_desc=O}function B(D){return D<256?N[D]:N[256+(D>>>7)]}function H(D,O){D.pending_buf[D.pending++]=255&O,D.pending_buf[D.pending++]=O>>>8&255}function F(D,O,X){D.bi_valid>x-X?(D.bi_buf|=O<<D.bi_valid&65535,H(D,D.bi_buf),D.bi_buf=O>>x-D.bi_valid,D.bi_valid+=X-x):(D.bi_buf|=O<<D.bi_valid&65535,D.bi_valid+=X)}function K(D,O,X){F(D,X[2*O],X[2*O+1])}function Y(D,O){for(var X=0;X|=1&D,D>>>=1,X<<=1,0<--O;);return X>>>1}function ge(D,O,X){var J,U,Q=new Array(m+1),ue=0;for(J=1;J<=m;J++)Q[J]=ue=ue+X[J-1]<<1;for(U=0;U<=O;U++){var te=D[2*U+1];te!==0&&(D[2*U]=Y(Q[te]++,te))}}function se(D){var O;for(O=0;O<f;O++)D.dyn_ltree[2*O]=0;for(O=0;O<l;O++)D.dyn_dtree[2*O]=0;for(O=0;O<p;O++)D.bl_tree[2*O]=0;D.dyn_ltree[2*b]=1,D.opt_len=D.static_len=0,D.last_lit=D.matches=0}function xe(D){8<D.bi_valid?H(D,D.bi_buf):0<D.bi_valid&&(D.pending_buf[D.pending++]=D.bi_buf),D.bi_buf=0,D.bi_valid=0}function Re(D,O,X,J){var U=2*O,Q=2*X;return D[U]<D[Q]||D[U]===D[Q]&&J[O]<=J[X]}function Ce(D,O,X){for(var J=D.heap[X],U=X<<1;U<=D.heap_len&&(U<D.heap_len&&Re(O,D.heap[U+1],D.heap[U],D.depth)&&U++,!Re(O,J,D.heap[U],D.depth));)D.heap[X]=D.heap[U],X=U,U<<=1;D.heap[X]=J}function Me(D,O,X){var J,U,Q,ue,te=0;if(D.last_lit!==0)for(;J=D.pending_buf[D.d_buf+2*te]<<8|D.pending_buf[D.d_buf+2*te+1],U=D.pending_buf[D.l_buf+te],te++,J===0?K(D,U,O):(K(D,(Q=_[U])+g+1,O),(ue=C[Q])!==0&&F(D,U-=V[Q],ue),K(D,Q=B(--J),X),(ue=R[Q])!==0&&F(D,J-=$[Q],ue)),te<D.last_lit;);K(D,b,O)}function ke(D,O){var X,J,U,Q=O.dyn_tree,ue=O.stat_desc.static_tree,te=O.stat_desc.has_stree,pe=O.stat_desc.elems,we=-1;for(D.heap_len=0,D.heap_max=d,X=0;X<pe;X++)Q[2*X]!==0?(D.heap[++D.heap_len]=we=X,D.depth[X]=0):Q[2*X+1]=0;for(;D.heap_len<2;)Q[2*(U=D.heap[++D.heap_len]=we<2?++we:0)]=1,D.depth[U]=0,D.opt_len--,te&&(D.static_len-=ue[2*U+1]);for(O.max_code=we,X=D.heap_len>>1;1<=X;X--)Ce(D,Q,X);for(U=pe;X=D.heap[1],D.heap[1]=D.heap[D.heap_len--],Ce(D,Q,1),J=D.heap[1],D.heap[--D.heap_max]=X,D.heap[--D.heap_max]=J,Q[2*U]=Q[2*X]+Q[2*J],D.depth[U]=(D.depth[X]>=D.depth[J]?D.depth[X]:D.depth[J])+1,Q[2*X+1]=Q[2*J+1]=U,D.heap[1]=U++,Ce(D,Q,1),2<=D.heap_len;);D.heap[--D.heap_max]=D.heap[1],function(ye,Ze){var vt,He,ut,Pe,Xt,ni,yt=Ze.dyn_tree,zi=Ze.max_code,Hi=Ze.stat_desc.static_tree,_s=Ze.stat_desc.has_stree,ji=Ze.stat_desc.extra_bits,Wi=Ze.stat_desc.extra_base,Nt=Ze.stat_desc.max_length,ai=0;for(Pe=0;Pe<=m;Pe++)ye.bl_count[Pe]=0;for(yt[2*ye.heap[ye.heap_max]+1]=0,vt=ye.heap_max+1;vt<d;vt++)Nt<(Pe=yt[2*yt[2*(He=ye.heap[vt])+1]+1]+1)&&(Pe=Nt,ai++),yt[2*He+1]=Pe,zi<He||(ye.bl_count[Pe]++,Xt=0,Wi<=He&&(Xt=ji[He-Wi]),ni=yt[2*He],ye.opt_len+=ni*(Pe+Xt),_s&&(ye.static_len+=ni*(Hi[2*He+1]+Xt)));if(ai!==0){do{for(Pe=Nt-1;ye.bl_count[Pe]===0;)Pe--;ye.bl_count[Pe]--,ye.bl_count[Pe+1]+=2,ye.bl_count[Nt]--,ai-=2}while(0<ai);for(Pe=Nt;Pe!==0;Pe--)for(He=ye.bl_count[Pe];He!==0;)zi<(ut=ye.heap[--vt])||(yt[2*ut+1]!==Pe&&(ye.opt_len+=(Pe-yt[2*ut+1])*yt[2*ut],yt[2*ut+1]=Pe),He--)}}(D,O),ge(Q,we,D.bl_count)}function S(D,O,X){var J,U,Q=-1,ue=O[1],te=0,pe=7,we=4;for(ue===0&&(pe=138,we=3),O[2*(X+1)+1]=65535,J=0;J<=X;J++)U=ue,ue=O[2*(J+1)+1],++te<pe&&U===ue||(te<we?D.bl_tree[2*U]+=te:U!==0?(U!==Q&&D.bl_tree[2*U]++,D.bl_tree[2*y]++):te<=10?D.bl_tree[2*E]++:D.bl_tree[2*I]++,Q=U,we=(te=0)===ue?(pe=138,3):U===ue?(pe=6,3):(pe=7,4))}function G(D,O,X){var J,U,Q=-1,ue=O[1],te=0,pe=7,we=4;for(ue===0&&(pe=138,we=3),J=0;J<=X;J++)if(U=ue,ue=O[2*(J+1)+1],!(++te<pe&&U===ue)){if(te<we)for(;K(D,U,D.bl_tree),--te!=0;);else U!==0?(U!==Q&&(K(D,U,D.bl_tree),te--),K(D,y,D.bl_tree),F(D,te-3,2)):te<=10?(K(D,E,D.bl_tree),F(D,te-3,3)):(K(D,I,D.bl_tree),F(D,te-11,7));Q=U,we=(te=0)===ue?(pe=138,3):U===ue?(pe=6,3):(pe=7,4)}}o($);var W=!1;function P(D,O,X,J){F(D,(u<<1)+(J?1:0),3),function(U,Q,ue,te){xe(U),te&&(H(U,ue),H(U,~ue)),i.arraySet(U.pending_buf,U.window,Q,ue,U.pending),U.pending+=ue}(D,O,X,!0)}r._tr_init=function(D){W||(function(){var O,X,J,U,Q,ue=new Array(m+1);for(U=J=0;U<h-1;U++)for(V[U]=J,O=0;O<1<<C[U];O++)_[J++]=U;for(_[J-1]=U,U=Q=0;U<16;U++)for($[U]=Q,O=0;O<1<<R[U];O++)N[Q++]=U;for(Q>>=7;U<l;U++)for($[U]=Q<<7,O=0;O<1<<R[U]-7;O++)N[256+Q++]=U;for(X=0;X<=m;X++)ue[X]=0;for(O=0;O<=143;)M[2*O+1]=8,O++,ue[8]++;for(;O<=255;)M[2*O+1]=9,O++,ue[9]++;for(;O<=279;)M[2*O+1]=7,O++,ue[7]++;for(;O<=287;)M[2*O+1]=8,O++,ue[8]++;for(ge(M,f+1,ue),O=0;O<l;O++)w[2*O+1]=5,w[2*O]=Y(O,5);ee=new ie(M,C,g+1,f,m),q=new ie(w,R,0,l,m),re=new ie(new Array(0),L,0,p,v)}(),W=!0),D.l_desc=new T(D.dyn_ltree,ee),D.d_desc=new T(D.dyn_dtree,q),D.bl_desc=new T(D.bl_tree,re),D.bi_buf=0,D.bi_valid=0,se(D)},r._tr_stored_block=P,r._tr_flush_block=function(D,O,X,J){var U,Q,ue=0;0<D.level?(D.strm.data_type===2&&(D.strm.data_type=function(te){var pe,we=4093624447;for(pe=0;pe<=31;pe++,we>>>=1)if(1&we&&te.dyn_ltree[2*pe]!==0)return n;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return a;for(pe=32;pe<g;pe++)if(te.dyn_ltree[2*pe]!==0)return a;return n}(D)),ke(D,D.l_desc),ke(D,D.d_desc),ue=function(te){var pe;for(S(te,te.dyn_ltree,te.l_desc.max_code),S(te,te.dyn_dtree,te.d_desc.max_code),ke(te,te.bl_desc),pe=p-1;3<=pe&&te.bl_tree[2*k[pe]+1]===0;pe--);return te.opt_len+=3*(pe+1)+5+5+4,pe}(D),U=D.opt_len+3+7>>>3,(Q=D.static_len+3+7>>>3)<=U&&(U=Q)):U=Q=X+5,X+4<=U&&O!==-1?P(D,O,X,J):D.strategy===4||Q===U?(F(D,2+(J?1:0),3),Me(D,M,w)):(F(D,4+(J?1:0),3),function(te,pe,we,ye){var Ze;for(F(te,pe-257,5),F(te,we-1,5),F(te,ye-4,4),Ze=0;Ze<ye;Ze++)F(te,te.bl_tree[2*k[Ze]+1],3);G(te,te.dyn_ltree,pe-1),G(te,te.dyn_dtree,we-1)}(D,D.l_desc.max_code+1,D.d_desc.max_code+1,ue+1),Me(D,D.dyn_ltree,D.dyn_dtree)),se(D),J&&xe(D)},r._tr_tally=function(D,O,X){return D.pending_buf[D.d_buf+2*D.last_lit]=O>>>8&255,D.pending_buf[D.d_buf+2*D.last_lit+1]=255&O,D.pending_buf[D.l_buf+D.last_lit]=255&X,D.last_lit++,O===0?D.dyn_ltree[2*X]++:(D.matches++,O--,D.dyn_ltree[2*(_[X]+g+1)]++,D.dyn_dtree[2*B(O)]++),D.last_lit===D.lit_bufsize-1},r._tr_align=function(D){F(D,2,3),K(D,b,M),function(O){O.bi_valid===16?(H(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(D)}},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(i){(function(n,a){if(!n.setImmediate){var o,u,h,g,f=1,l={},p=!1,d=n.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(n);m=m&&m.setTimeout?m:n,o={}.toString.call(n.process)==="[object process]"?function(y){process.nextTick(function(){v(y)})}:function(){if(n.postMessage&&!n.importScripts){var y=!0,E=n.onmessage;return n.onmessage=function(){y=!1},n.postMessage("","*"),n.onmessage=E,y}}()?(g="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b),function(y){n.postMessage(g+y,"*")}):n.MessageChannel?((h=new MessageChannel).port1.onmessage=function(y){v(y.data)},function(y){h.port2.postMessage(y)}):d&&"onreadystatechange"in d.createElement("script")?(u=d.documentElement,function(y){var E=d.createElement("script");E.onreadystatechange=function(){v(y),E.onreadystatechange=null,u.removeChild(E),E=null},u.appendChild(E)}):function(y){setTimeout(v,0,y)},m.setImmediate=function(y){typeof y!="function"&&(y=new Function(""+y));for(var E=new Array(arguments.length-1),I=0;I<E.length;I++)E[I]=arguments[I+1];var C={callback:y,args:E};return l[f]=C,o(f),f++},m.clearImmediate=x}function x(y){delete l[y]}function v(y){if(p)setTimeout(v,0,y);else{var E=l[y];if(E){p=!0;try{(function(I){var C=I.callback,R=I.args;switch(R.length){case 0:C();break;case 1:C(R[0]);break;case 2:C(R[0],R[1]);break;case 3:C(R[0],R[1],R[2]);break;default:C.apply(a,R)}})(E)}finally{x(y),p=!1}}}}function b(y){y.source===n&&typeof y.data=="string"&&y.data.indexOf(g)===0&&v(+y.data.slice(g.length))}})(typeof self=="undefined"?i===void 0?this:i:self)}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})})(qs);var fo=qs.exports;const po=$s(fo),ar=(s,c)=>c.some(e=>s instanceof e);let Gs,Js;function mo(){return Gs||(Gs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function go(){return Js||(Js=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const or=new WeakMap,cr=new WeakMap,wi=new WeakMap;function vo(s){const c=new Promise((e,t)=>{const r=()=>{s.removeEventListener("success",i),s.removeEventListener("error",n)},i=()=>{e(Ut(s.result)),r()},n=()=>{t(s.error),r()};s.addEventListener("success",i),s.addEventListener("error",n)});return wi.set(c,s),c}function xo(s){if(or.has(s))return;const c=new Promise((e,t)=>{const r=()=>{s.removeEventListener("complete",i),s.removeEventListener("error",n),s.removeEventListener("abort",n)},i=()=>{e(),r()},n=()=>{t(s.error||new DOMException("AbortError","AbortError")),r()};s.addEventListener("complete",i),s.addEventListener("error",n),s.addEventListener("abort",n)});or.set(s,c)}let ur={get(s,c,e){if(s instanceof IDBTransaction){if(c==="done")return or.get(s);if(c==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return Ut(s[c])},set(s,c,e){return s[c]=e,!0},has(s,c){return s instanceof IDBTransaction&&(c==="done"||c==="store")?!0:c in s}};function Xs(s){ur=s(ur)}function bo(s){return go().includes(s)?function(...c){return s.apply(hr(this),c),Ut(this.request)}:function(...c){return Ut(s.apply(hr(this),c))}}function So(s){return typeof s=="function"?bo(s):(s instanceof IDBTransaction&&xo(s),ar(s,mo())?new Proxy(s,ur):s)}function Ut(s){if(s instanceof IDBRequest)return vo(s);if(cr.has(s))return cr.get(s);const c=So(s);return c!==s&&(cr.set(s,c),wi.set(c,s)),c}const hr=s=>wi.get(s);function _o(s,c,{blocked:e,upgrade:t,blocking:r,terminated:i}={}){const n=indexedDB.open(s,c),a=Ut(n);return t&&n.addEventListener("upgradeneeded",o=>{t(Ut(n.result),o.oldVersion,o.newVersion,Ut(n.transaction),o)}),e&&n.addEventListener("blocked",o=>e(o.oldVersion,o.newVersion,o)),a.then(o=>{i&&o.addEventListener("close",()=>i()),r&&o.addEventListener("versionchange",u=>r(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const yo=["get","getKey","getAll","getAllKeys","count"],Ao=["put","add","delete","clear"],dr=new Map;function Zs(s,c){if(!(s instanceof IDBDatabase&&!(c in s)&&typeof c=="string"))return;if(dr.get(c))return dr.get(c);const e=c.replace(/FromIndex$/,""),t=c!==e,r=Ao.includes(e);if(!(e in(t?IDBIndex:IDBObjectStore).prototype)||!(r||yo.includes(e)))return;const i=function(n,...a){return z(this,null,function*(){const o=this.transaction(n,r?"readwrite":"readonly");let u=o.store;return t&&(u=u.index(a.shift())),(yield Promise.all([u[e](...a),r&&o.done]))[0]})};return dr.set(c,i),i}Xs(s=>Rt(Se({},s),{get:(c,e,t)=>Zs(c,e)||s.get(c,e,t),has:(c,e)=>!!Zs(c,e)||s.has(c,e)}));const Eo=["continue","continuePrimaryKey","advance"],Ys={},lr=new WeakMap,Qs=new WeakMap,wo={get(s,c){if(!Eo.includes(c))return s[c];let e=Ys[c];return e||(e=Ys[c]=function(...t){lr.set(this,Qs.get(this)[c](...t))}),e}};function Co(...s){return La(this,null,function*(){let c=this;if(c instanceof IDBCursor||(c=yield new qi(c.openCursor(...s))),!c)return;c=c;const e=new Proxy(c,wo);for(Qs.set(e,c),wi.set(e,hr(c));c;)yield e,c=yield new qi(lr.get(e)||c.continue()),lr.delete(e)})}function en(s,c){return c===Symbol.asyncIterator&&ar(s,[IDBIndex,IDBObjectStore,IDBCursor])||c==="iterate"&&ar(s,[IDBIndex,IDBObjectStore])}Xs(s=>Rt(Se({},s),{get(c,e,t){return en(c,e)?Co:s.get(c,e,t)},has(c,e){return en(c,e)||s.has(c,e)}}));const Io="AliRTCLog",Ci="AliRTCSessiones",Ii="AliRTCLogs",Ro=()=>z(this,null,function*(){return yield _o(Io,1,{upgrade:c=>{c.createObjectStore(Ci,{keyPath:"sid"}).createIndex("sid","sid",{unique:!0});const t=c.createObjectStore(Ii,{keyPath:"id",autoIncrement:!0});t.createIndex("sid","sid",{unique:!1}),t.createIndex("date","date",{unique:!1})}})}),ko=(s,c)=>z(this,null,function*(){yield s.add(Ci,{sid:c})}),tn=(s,c,e,t)=>z(this,null,function*(){yield s.add(Ii,{sid:c,log:t,date:e})}),rn=(s,c)=>z(this,null,function*(){return yield s.getAllFromIndex(Ii,"sid",c)}),Do=s=>z(this,null,function*(){return yield s.getAllFromIndex(Ci,"sid")}),sn=(s,c)=>z(this,null,function*(){yield s.delete(Ii,c)}),To=(s,c)=>z(this,null,function*(){yield s.delete(Ci,c)});var nn={exports:{}},fr={exports:{}};const Bo=lo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var an;function Ee(){return an||(an=1,function(s,c){(function(e,t){s.exports=t()})(_e,function(){var e=e||function(t,r){var i;if(typeof window!="undefined"&&window.crypto&&(i=window.crypto),typeof self!="undefined"&&self.crypto&&(i=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window!="undefined"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof _e!="undefined"&&_e.crypto&&(i=_e.crypto),!i&&typeof ci=="function")try{i=Bo}catch(v){}var n=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch(v){}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch(v){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function v(){}return function(b){var y;return v.prototype=b,y=new v,v.prototype=null,y}}(),o={},u=o.lib={},h=u.Base=function(){return{extend:function(v){var b=a(this);return v&&b.mixIn(v),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var b in v)v.hasOwnProperty(b)&&(this[b]=v[b]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=u.WordArray=h.extend({init:function(v,b){v=this.words=v||[],b!=r?this.sigBytes=b:this.sigBytes=v.length*4},toString:function(v){return(v||l).stringify(this)},concat:function(v){var b=this.words,y=v.words,E=this.sigBytes,I=v.sigBytes;if(this.clamp(),E%4)for(var C=0;C<I;C++){var R=y[C>>>2]>>>24-C%4*8&255;b[E+C>>>2]|=R<<24-(E+C)%4*8}else for(var L=0;L<I;L+=4)b[E+L>>>2]=y[L>>>2];return this.sigBytes+=I,this},clamp:function(){var v=this.words,b=this.sigBytes;v[b>>>2]&=4294967295<<32-b%4*8,v.length=t.ceil(b/4)},clone:function(){var v=h.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var b=[],y=0;y<v;y+=4)b.push(n());return new g.init(b,v)}}),f=o.enc={},l=f.Hex={stringify:function(v){for(var b=v.words,y=v.sigBytes,E=[],I=0;I<y;I++){var C=b[I>>>2]>>>24-I%4*8&255;E.push((C>>>4).toString(16)),E.push((C&15).toString(16))}return E.join("")},parse:function(v){for(var b=v.length,y=[],E=0;E<b;E+=2)y[E>>>3]|=parseInt(v.substr(E,2),16)<<24-E%8*4;return new g.init(y,b/2)}},p=f.Latin1={stringify:function(v){for(var b=v.words,y=v.sigBytes,E=[],I=0;I<y;I++){var C=b[I>>>2]>>>24-I%4*8&255;E.push(String.fromCharCode(C))}return E.join("")},parse:function(v){for(var b=v.length,y=[],E=0;E<b;E++)y[E>>>2]|=(v.charCodeAt(E)&255)<<24-E%4*8;return new g.init(y,b)}},d=f.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},m=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=d.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var b,y=this._data,E=y.words,I=y.sigBytes,C=this.blockSize,R=C*4,L=I/R;v?L=t.ceil(L):L=t.max((L|0)-this._minBufferSize,0);var k=L*C,M=t.min(k*4,I);if(k){for(var w=0;w<k;w+=C)this._doProcessBlock(E,w);b=E.splice(0,k),y.sigBytes-=M}return new g.init(b,M)},clone:function(){var v=h.clone.call(this);return v._data=this._data.clone(),v},_minBufferSize:0});u.Hasher=m.extend({cfg:h.extend(),init:function(v){this.cfg=this.cfg.extend(v),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(v){return this._append(v),this._process(),this},finalize:function(v){v&&this._append(v);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(v){return function(b,y){return new v.init(y).finalize(b)}},_createHmacHelper:function(v){return function(b,y){return new x.HMAC.init(v,y).finalize(b)}}});var x=o.algo={};return o}(Math);return e})}(fr)),fr.exports}var pr={exports:{}},on;function Ri(){return on||(on=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.Base,a=i.WordArray,o=r.x64={};o.Word=n.extend({init:function(u,h){this.high=u,this.low=h}}),o.WordArray=n.extend({init:function(u,h){u=this.words=u||[],h!=t?this.sigBytes=h:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,h=u.length,g=[],f=0;f<h;f++){var l=u[f];g.push(l.high),g.push(l.low)}return a.create(g,this.sigBytes)},clone:function(){for(var u=n.clone.call(this),h=u.words=this.words.slice(0),g=h.length,f=0;f<g;f++)h[f]=h[f].clone();return u}})}(),e})}(pr)),pr.exports}var mr={exports:{}},cn;function Po(){return cn||(cn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,r=t.lib,i=r.WordArray,n=i.init,a=i.init=function(o){if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),(o instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array)&&(o=new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),o instanceof Uint8Array){for(var u=o.byteLength,h=[],g=0;g<u;g++)h[g>>>2]|=o[g]<<24-g%4*8;n.call(this,h,u)}else n.apply(this,arguments)};a.prototype=i}}(),e.lib.WordArray})}(mr)),mr.exports}var gr={exports:{}},un;function Lo(){return un||(un=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.enc;n.Utf16=n.Utf16BE={stringify:function(o){for(var u=o.words,h=o.sigBytes,g=[],f=0;f<h;f+=2){var l=u[f>>>2]>>>16-f%4*8&65535;g.push(String.fromCharCode(l))}return g.join("")},parse:function(o){for(var u=o.length,h=[],g=0;g<u;g++)h[g>>>1]|=o.charCodeAt(g)<<16-g%2*16;return i.create(h,u*2)}},n.Utf16LE={stringify:function(o){for(var u=o.words,h=o.sigBytes,g=[],f=0;f<h;f+=2){var l=a(u[f>>>2]>>>16-f%4*8&65535);g.push(String.fromCharCode(l))}return g.join("")},parse:function(o){for(var u=o.length,h=[],g=0;g<u;g++)h[g>>>1]|=a(o.charCodeAt(g)<<16-g%2*16);return i.create(h,u*2)}};function a(o){return o<<8&4278255360|o>>>8&16711935}}(),e.enc.Utf16})}(gr)),gr.exports}var vr={exports:{}},hn;function zt(){return hn||(hn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.enc;n.Base64={stringify:function(o){var u=o.words,h=o.sigBytes,g=this._map;o.clamp();for(var f=[],l=0;l<h;l+=3)for(var p=u[l>>>2]>>>24-l%4*8&255,d=u[l+1>>>2]>>>24-(l+1)%4*8&255,m=u[l+2>>>2]>>>24-(l+2)%4*8&255,x=p<<16|d<<8|m,v=0;v<4&&l+v*.75<h;v++)f.push(g.charAt(x>>>6*(3-v)&63));var b=g.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(o){var u=o.length,h=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var f=0;f<h.length;f++)g[h.charCodeAt(f)]=f}var l=h.charAt(64);if(l){var p=o.indexOf(l);p!==-1&&(u=p)}return a(o,u,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(o,u,h){for(var g=[],f=0,l=0;l<u;l++)if(l%4){var p=h[o.charCodeAt(l-1)]<<l%4*2,d=h[o.charCodeAt(l)]>>>6-l%4*2,m=p|d;g[f>>>2]|=m<<24-f%4*8,f++}return i.create(g,f)}}(),e.enc.Base64})}(vr)),vr.exports}var xr={exports:{}},dn;function No(){return dn||(dn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.enc;n.Base64url={stringify:function(o,u){u===void 0&&(u=!0);var h=o.words,g=o.sigBytes,f=u?this._safe_map:this._map;o.clamp();for(var l=[],p=0;p<g;p+=3)for(var d=h[p>>>2]>>>24-p%4*8&255,m=h[p+1>>>2]>>>24-(p+1)%4*8&255,x=h[p+2>>>2]>>>24-(p+2)%4*8&255,v=d<<16|m<<8|x,b=0;b<4&&p+b*.75<g;b++)l.push(f.charAt(v>>>6*(3-b)&63));var y=f.charAt(64);if(y)for(;l.length%4;)l.push(y);return l.join("")},parse:function(o,u){u===void 0&&(u=!0);var h=o.length,g=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var l=0;l<g.length;l++)f[g.charCodeAt(l)]=l}var p=g.charAt(64);if(p){var d=o.indexOf(p);d!==-1&&(h=d)}return a(o,h,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(o,u,h){for(var g=[],f=0,l=0;l<u;l++)if(l%4){var p=h[o.charCodeAt(l-1)]<<l%4*2,d=h[o.charCodeAt(l)]>>>6-l%4*2,m=p|d;g[f>>>2]|=m<<24-f%4*8,f++}return i.create(g,f)}}(),e.enc.Base64url})}(xr)),xr.exports}var br={exports:{}},ln;function Ht(){return ln||(ln=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,u=[];(function(){for(var d=0;d<64;d++)u[d]=t.abs(t.sin(d+1))*4294967296|0})();var h=o.MD5=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(d,m){for(var x=0;x<16;x++){var v=m+x,b=d[v];d[v]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var y=this._hash.words,E=d[m+0],I=d[m+1],C=d[m+2],R=d[m+3],L=d[m+4],k=d[m+5],M=d[m+6],w=d[m+7],N=d[m+8],_=d[m+9],V=d[m+10],ee=d[m+11],q=d[m+12],re=d[m+13],$=d[m+14],ie=d[m+15],T=y[0],B=y[1],H=y[2],F=y[3];T=g(T,B,H,F,E,7,u[0]),F=g(F,T,B,H,I,12,u[1]),H=g(H,F,T,B,C,17,u[2]),B=g(B,H,F,T,R,22,u[3]),T=g(T,B,H,F,L,7,u[4]),F=g(F,T,B,H,k,12,u[5]),H=g(H,F,T,B,M,17,u[6]),B=g(B,H,F,T,w,22,u[7]),T=g(T,B,H,F,N,7,u[8]),F=g(F,T,B,H,_,12,u[9]),H=g(H,F,T,B,V,17,u[10]),B=g(B,H,F,T,ee,22,u[11]),T=g(T,B,H,F,q,7,u[12]),F=g(F,T,B,H,re,12,u[13]),H=g(H,F,T,B,$,17,u[14]),B=g(B,H,F,T,ie,22,u[15]),T=f(T,B,H,F,I,5,u[16]),F=f(F,T,B,H,M,9,u[17]),H=f(H,F,T,B,ee,14,u[18]),B=f(B,H,F,T,E,20,u[19]),T=f(T,B,H,F,k,5,u[20]),F=f(F,T,B,H,V,9,u[21]),H=f(H,F,T,B,ie,14,u[22]),B=f(B,H,F,T,L,20,u[23]),T=f(T,B,H,F,_,5,u[24]),F=f(F,T,B,H,$,9,u[25]),H=f(H,F,T,B,R,14,u[26]),B=f(B,H,F,T,N,20,u[27]),T=f(T,B,H,F,re,5,u[28]),F=f(F,T,B,H,C,9,u[29]),H=f(H,F,T,B,w,14,u[30]),B=f(B,H,F,T,q,20,u[31]),T=l(T,B,H,F,k,4,u[32]),F=l(F,T,B,H,N,11,u[33]),H=l(H,F,T,B,ee,16,u[34]),B=l(B,H,F,T,$,23,u[35]),T=l(T,B,H,F,I,4,u[36]),F=l(F,T,B,H,L,11,u[37]),H=l(H,F,T,B,w,16,u[38]),B=l(B,H,F,T,V,23,u[39]),T=l(T,B,H,F,re,4,u[40]),F=l(F,T,B,H,E,11,u[41]),H=l(H,F,T,B,R,16,u[42]),B=l(B,H,F,T,M,23,u[43]),T=l(T,B,H,F,_,4,u[44]),F=l(F,T,B,H,q,11,u[45]),H=l(H,F,T,B,ie,16,u[46]),B=l(B,H,F,T,C,23,u[47]),T=p(T,B,H,F,E,6,u[48]),F=p(F,T,B,H,w,10,u[49]),H=p(H,F,T,B,$,15,u[50]),B=p(B,H,F,T,k,21,u[51]),T=p(T,B,H,F,q,6,u[52]),F=p(F,T,B,H,R,10,u[53]),H=p(H,F,T,B,V,15,u[54]),B=p(B,H,F,T,I,21,u[55]),T=p(T,B,H,F,N,6,u[56]),F=p(F,T,B,H,ie,10,u[57]),H=p(H,F,T,B,M,15,u[58]),B=p(B,H,F,T,re,21,u[59]),T=p(T,B,H,F,L,6,u[60]),F=p(F,T,B,H,ee,10,u[61]),H=p(H,F,T,B,C,15,u[62]),B=p(B,H,F,T,_,21,u[63]),y[0]=y[0]+T|0,y[1]=y[1]+B|0,y[2]=y[2]+H|0,y[3]=y[3]+F|0},_doFinalize:function(){var d=this._data,m=d.words,x=this._nDataBytes*8,v=d.sigBytes*8;m[v>>>5]|=128<<24-v%32;var b=t.floor(x/4294967296),y=x;m[(v+64>>>9<<4)+15]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,m[(v+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,d.sigBytes=(m.length+1)*4,this._process();for(var E=this._hash,I=E.words,C=0;C<4;C++){var R=I[C];I[C]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return E},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});function g(d,m,x,v,b,y,E){var I=d+(m&x|~m&v)+b+E;return(I<<y|I>>>32-y)+m}function f(d,m,x,v,b,y,E){var I=d+(m&v|x&~v)+b+E;return(I<<y|I>>>32-y)+m}function l(d,m,x,v,b,y,E){var I=d+(m^x^v)+b+E;return(I<<y|I>>>32-y)+m}function p(d,m,x,v,b,y,E){var I=d+(x^(m|~v))+b+E;return(I<<y|I>>>32-y)+m}r.MD5=a._createHelper(h),r.HmacMD5=a._createHmacHelper(h)}(Math),e.MD5})}(br)),br.exports}var Sr={exports:{}},fn;function pn(){return fn||(fn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.Hasher,a=t.algo,o=[],u=a.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,g){for(var f=this._hash.words,l=f[0],p=f[1],d=f[2],m=f[3],x=f[4],v=0;v<80;v++){if(v<16)o[v]=h[g+v]|0;else{var b=o[v-3]^o[v-8]^o[v-14]^o[v-16];o[v]=b<<1|b>>>31}var y=(l<<5|l>>>27)+x+o[v];v<20?y+=(p&d|~p&m)+1518500249:v<40?y+=(p^d^m)+1859775393:v<60?y+=(p&d|p&m|d&m)-1894007588:y+=(p^d^m)-899497514,x=m,m=d,d=p<<30|p>>>2,p=l,l=y}f[0]=f[0]+l|0,f[1]=f[1]+p|0,f[2]=f[2]+d|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0},_doFinalize:function(){var h=this._data,g=h.words,f=this._nDataBytes*8,l=h.sigBytes*8;return g[l>>>5]|=128<<24-l%32,g[(l+64>>>9<<4)+14]=Math.floor(f/4294967296),g[(l+64>>>9<<4)+15]=f,h.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});t.SHA1=n._createHelper(u),t.HmacSHA1=n._createHmacHelper(u)}(),e.SHA1})}(Sr)),Sr.exports}var _r={exports:{}},mn;function yr(){return mn||(mn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,u=[],h=[];(function(){function l(x){for(var v=t.sqrt(x),b=2;b<=v;b++)if(!(x%b))return!1;return!0}function p(x){return(x-(x|0))*4294967296|0}for(var d=2,m=0;m<64;)l(d)&&(m<8&&(u[m]=p(t.pow(d,1/2))),h[m]=p(t.pow(d,1/3)),m++),d++})();var g=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new n.init(u.slice(0))},_doProcessBlock:function(l,p){for(var d=this._hash.words,m=d[0],x=d[1],v=d[2],b=d[3],y=d[4],E=d[5],I=d[6],C=d[7],R=0;R<64;R++){if(R<16)g[R]=l[p+R]|0;else{var L=g[R-15],k=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,M=g[R-2],w=(M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10;g[R]=k+g[R-7]+w+g[R-16]}var N=y&E^~y&I,_=m&x^m&v^x&v,V=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),ee=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),q=C+ee+N+h[R]+g[R],re=V+_;C=I,I=E,E=y,y=b+q|0,b=v,v=x,x=m,m=q+re|0}d[0]=d[0]+m|0,d[1]=d[1]+x|0,d[2]=d[2]+v|0,d[3]=d[3]+b|0,d[4]=d[4]+y|0,d[5]=d[5]+E|0,d[6]=d[6]+I|0,d[7]=d[7]+C|0},_doFinalize:function(){var l=this._data,p=l.words,d=this._nDataBytes*8,m=l.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=t.floor(d/4294967296),p[(m+64>>>9<<4)+15]=d,l.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});r.SHA256=a._createHelper(f),r.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256})}(_r)),_r.exports}var Ar={exports:{}},gn;function Mo(){return gn||(gn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),yr())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.algo,a=n.SHA256,o=n.SHA224=a.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=4,u}});t.SHA224=a._createHelper(o),t.HmacSHA224=a._createHmacHelper(o)}(),e.SHA224})}(Ar)),Ar.exports}var Er={exports:{}},vn;function xn(){return vn||(vn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Ri())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.Hasher,n=t.x64,a=n.Word,o=n.WordArray,u=t.algo;function h(){return a.create.apply(a,arguments)}var g=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],f=[];(function(){for(var p=0;p<80;p++)f[p]=h()})();var l=u.SHA512=i.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(p,d){for(var m=this._hash.words,x=m[0],v=m[1],b=m[2],y=m[3],E=m[4],I=m[5],C=m[6],R=m[7],L=x.high,k=x.low,M=v.high,w=v.low,N=b.high,_=b.low,V=y.high,ee=y.low,q=E.high,re=E.low,$=I.high,ie=I.low,T=C.high,B=C.low,H=R.high,F=R.low,K=L,Y=k,ge=M,se=w,xe=N,Re=_,Ce=V,Me=ee,ke=q,S=re,G=$,W=ie,P=T,D=B,O=H,X=F,J=0;J<80;J++){var U,Q,ue=f[J];if(J<16)Q=ue.high=p[d+J*2]|0,U=ue.low=p[d+J*2+1]|0;else{var te=f[J-15],pe=te.high,we=te.low,ye=(pe>>>1|we<<31)^(pe>>>8|we<<24)^pe>>>7,Ze=(we>>>1|pe<<31)^(we>>>8|pe<<24)^(we>>>7|pe<<25),vt=f[J-2],He=vt.high,ut=vt.low,Pe=(He>>>19|ut<<13)^(He<<3|ut>>>29)^He>>>6,Xt=(ut>>>19|He<<13)^(ut<<3|He>>>29)^(ut>>>6|He<<26),ni=f[J-7],yt=ni.high,zi=ni.low,Hi=f[J-16],_s=Hi.high,ji=Hi.low;U=Ze+zi,Q=ye+yt+(U>>>0<Ze>>>0?1:0),U=U+Xt,Q=Q+Pe+(U>>>0<Xt>>>0?1:0),U=U+ji,Q=Q+_s+(U>>>0<ji>>>0?1:0),ue.high=Q,ue.low=U}var Wi=ke&G^~ke&P,Nt=S&W^~S&D,ai=K&ge^K&xe^ge&xe,M0=Y&se^Y&Re^se&Re,F0=(K>>>28|Y<<4)^(K<<30|Y>>>2)^(K<<25|Y>>>7),Ra=(Y>>>28|K<<4)^(Y<<30|K>>>2)^(Y<<25|K>>>7),O0=(ke>>>14|S<<18)^(ke>>>18|S<<14)^(ke<<23|S>>>9),V0=(S>>>14|ke<<18)^(S>>>18|ke<<14)^(S<<23|ke>>>9),ka=g[J],U0=ka.high,Da=ka.low,ht=X+V0,Mt=O+O0+(ht>>>0<X>>>0?1:0),ht=ht+Nt,Mt=Mt+Wi+(ht>>>0<Nt>>>0?1:0),ht=ht+Da,Mt=Mt+U0+(ht>>>0<Da>>>0?1:0),ht=ht+U,Mt=Mt+Q+(ht>>>0<U>>>0?1:0),Ta=Ra+M0,z0=F0+ai+(Ta>>>0<Ra>>>0?1:0);O=P,X=D,P=G,D=W,G=ke,W=S,S=Me+ht|0,ke=Ce+Mt+(S>>>0<Me>>>0?1:0)|0,Ce=xe,Me=Re,xe=ge,Re=se,ge=K,se=Y,Y=ht+Ta|0,K=Mt+z0+(Y>>>0<ht>>>0?1:0)|0}k=x.low=k+Y,x.high=L+K+(k>>>0<Y>>>0?1:0),w=v.low=w+se,v.high=M+ge+(w>>>0<se>>>0?1:0),_=b.low=_+Re,b.high=N+xe+(_>>>0<Re>>>0?1:0),ee=y.low=ee+Me,y.high=V+Ce+(ee>>>0<Me>>>0?1:0),re=E.low=re+S,E.high=q+ke+(re>>>0<S>>>0?1:0),ie=I.low=ie+W,I.high=$+G+(ie>>>0<W>>>0?1:0),B=C.low=B+D,C.high=T+P+(B>>>0<D>>>0?1:0),F=R.low=F+X,R.high=H+O+(F>>>0<X>>>0?1:0)},_doFinalize:function(){var p=this._data,d=p.words,m=this._nDataBytes*8,x=p.sigBytes*8;d[x>>>5]|=128<<24-x%32,d[(x+128>>>10<<5)+30]=Math.floor(m/4294967296),d[(x+128>>>10<<5)+31]=m,p.sigBytes=d.length*4,this._process();var v=this._hash.toX32();return v},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});t.SHA512=i._createHelper(l),t.HmacSHA512=i._createHmacHelper(l)}(),e.SHA512})}(Er)),Er.exports}var wr={exports:{}},bn;function Fo(){return bn||(bn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Ri(),xn())})(_e,function(e){return function(){var t=e,r=t.x64,i=r.Word,n=r.WordArray,a=t.algo,o=a.SHA512,u=a.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var h=o._doFinalize.call(this);return h.sigBytes-=16,h}});t.SHA384=o._createHelper(u),t.HmacSHA384=o._createHmacHelper(u)}(),e.SHA384})}(wr)),wr.exports}var Cr={exports:{}},Sn;function Oo(){return Sn||(Sn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Ri())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.x64,u=o.Word,h=r.algo,g=[],f=[],l=[];(function(){for(var m=1,x=0,v=0;v<24;v++){g[m+5*x]=(v+1)*(v+2)/2%64;var b=x%5,y=(2*m+3*x)%5;m=b,x=y}for(var m=0;m<5;m++)for(var x=0;x<5;x++)f[m+5*x]=x+(2*m+3*x)%5*5;for(var E=1,I=0;I<24;I++){for(var C=0,R=0,L=0;L<7;L++){if(E&1){var k=(1<<L)-1;k<32?R^=1<<k:C^=1<<k-32}E&128?E=E<<1^113:E<<=1}l[I]=u.create(C,R)}})();var p=[];(function(){for(var m=0;m<25;m++)p[m]=u.create()})();var d=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],x=0;x<25;x++)m[x]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,x){for(var v=this._state,b=this.blockSize/2,y=0;y<b;y++){var E=m[x+2*y],I=m[x+2*y+1];E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360;var C=v[y];C.high^=I,C.low^=E}for(var R=0;R<24;R++){for(var L=0;L<5;L++){for(var k=0,M=0,w=0;w<5;w++){var C=v[L+5*w];k^=C.high,M^=C.low}var N=p[L];N.high=k,N.low=M}for(var L=0;L<5;L++)for(var _=p[(L+4)%5],V=p[(L+1)%5],ee=V.high,q=V.low,k=_.high^(ee<<1|q>>>31),M=_.low^(q<<1|ee>>>31),w=0;w<5;w++){var C=v[L+5*w];C.high^=k,C.low^=M}for(var re=1;re<25;re++){var k,M,C=v[re],$=C.high,ie=C.low,T=g[re];T<32?(k=$<<T|ie>>>32-T,M=ie<<T|$>>>32-T):(k=ie<<T-32|$>>>64-T,M=$<<T-32|ie>>>64-T);var B=p[f[re]];B.high=k,B.low=M}var H=p[0],F=v[0];H.high=F.high,H.low=F.low;for(var L=0;L<5;L++)for(var w=0;w<5;w++){var re=L+5*w,C=v[re],K=p[re],Y=p[(L+1)%5+5*w],ge=p[(L+2)%5+5*w];C.high=K.high^~Y.high&ge.high,C.low=K.low^~Y.low&ge.low}var C=v[0],se=l[R];C.high^=se.high,C.low^=se.low}},_doFinalize:function(){var m=this._data,x=m.words;this._nDataBytes*8;var v=m.sigBytes*8,b=this.blockSize*32;x[v>>>5]|=1<<24-v%32,x[(t.ceil((v+1)/b)*b>>>5)-1]|=128,m.sigBytes=x.length*4,this._process();for(var y=this._state,E=this.cfg.outputLength/8,I=E/8,C=[],R=0;R<I;R++){var L=y[R],k=L.high,M=L.low;k=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,M=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,C.push(M),C.push(k)}return new n.init(C,E)},clone:function(){for(var m=a.clone.call(this),x=m._state=this._state.slice(0),v=0;v<25;v++)x[v]=x[v].clone();return m}});r.SHA3=a._createHelper(d),r.HmacSHA3=a._createHmacHelper(d)}(Math),e.SHA3})}(Cr)),Cr.exports}var Ir={exports:{}},_n;function Vo(){return _n||(_n=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){/** @preserve
19
16
  (c) 2012 by Cédric Mesnil. All rights reserved.
20
17
 
21
18
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -24,18 +21,21 @@ var Oh=Object.defineProperty,Vh=Object.defineProperties;var Uh=Object.getOwnProp
24
21
  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
25
22
 
26
23
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- */return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,u=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=n.create([0,1518500249,1859775393,2400959708,2840853838]),p=n.create([1352829926,1548603684,1836072691,2053994217,0]),l=a.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(C,E){for(var I=0;I<16;I++){var L=E+I,k=C[L];C[L]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}var N=this._hash.words,R=d.words,M=p.words,y=u.words,V=h.words,Q=g.words,q=f.words,ne,$,ie,D,B,z,O,K,be,he;z=ne=N[0],O=$=N[1],K=ie=N[2],be=D=N[3],he=B=N[4];for(var re,I=0;I<80;I+=1)re=ne+C[E+y[I]]|0,I<16?re+=m($,ie,D)+R[0]:I<32?re+=x($,ie,D)+R[1]:I<48?re+=v($,ie,D)+R[2]:I<64?re+=b($,ie,D)+R[3]:re+=w($,ie,D)+R[4],re=re|0,re=_(re,Q[I]),re=re+B|0,ne=B,B=D,D=_(ie,10),ie=$,$=re,re=z+C[E+V[I]]|0,I<16?re+=w(O,K,be)+M[0]:I<32?re+=b(O,K,be)+M[1]:I<48?re+=v(O,K,be)+M[2]:I<64?re+=x(O,K,be)+M[3]:re+=m(O,K,be)+M[4],re=re|0,re=_(re,q[I]),re=re+he|0,z=he,he=be,be=_(K,10),K=O,O=re;re=N[1]+ie+be|0,N[1]=N[2]+D+he|0,N[2]=N[3]+B+z|0,N[3]=N[4]+ne+O|0,N[4]=N[0]+$+K|0,N[0]=re},_doFinalize:function(){var C=this._data,E=C.words,I=this._nDataBytes*8,L=C.sigBytes*8;E[L>>>5]|=128<<24-L%32,E[(L+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,C.sigBytes=(E.length+1)*4,this._process();for(var k=this._hash,N=k.words,R=0;R<5;R++){var M=N[R];N[R]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return k},clone:function(){var C=o.clone.call(this);return C._hash=this._hash.clone(),C}});function m(C,E,I){return C^E^I}function x(C,E,I){return C&E|~C&I}function v(C,E,I){return(C|~E)^I}function b(C,E,I){return C&I|E&~I}function w(C,E,I){return C^(E|~I)}function _(C,E){return C<<E|C>>>32-E}i.RIPEMD160=o._createHelper(l),i.HmacRIPEMD160=o._createHmacHelper(l)}(),e.RIPEMD160})}(ks)),ks.exports}var Ts={exports:{}},$a;function Ds(){return $a||($a=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){(function(){var t=e,i=t.lib,r=i.Base,n=t.enc,o=n.Utf8,a=t.algo;a.HMAC=r.extend({init:function(u,h){u=this._hasher=new u.init,typeof h=="string"&&(h=o.parse(h));var g=u.blockSize,f=g*4;h.sigBytes>f&&(h=u.finalize(h)),h.clamp();for(var d=this._oKey=h.clone(),p=this._iKey=h.clone(),l=d.words,m=p.words,x=0;x<g;x++)l[x]^=1549556828,m[x]^=909522486;d.sigBytes=p.sigBytes=f,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var h=this._hasher,g=h.finalize(u);h.reset();var f=h.finalize(this._oKey.clone().concat(g));return f}})})()})}(Ts)),Ts.exports}var Bs={exports:{}},qa;function G0(){return qa||(qa=1,function(s,c){(function(e,t,i){s.exports=t(De(),As(),Ds())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.SHA256,u=o.HMAC,h=o.PBKDF2=r.extend({cfg:r.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,f){for(var d=this.cfg,p=u.create(d.hasher,g),l=n.create(),m=n.create([1]),x=l.words,v=m.words,b=d.keySize,w=d.iterations;x.length<b;){var _=p.update(f).finalize(m);p.reset();for(var C=_.words,E=C.length,I=_,L=1;L<w;L++){I=p.finalize(I),p.reset();for(var k=I.words,N=0;N<E;N++)C[N]^=k[N]}l.concat(_),v[0]++}return l.sigBytes=b*4,l}});t.PBKDF2=function(g,f,d){return h.create(d).compute(g,f)}}(),e.PBKDF2})}(Bs)),Bs.exports}var Ps={exports:{}},Ga;function ei(){return Ga||(Ga=1,function(s,c){(function(e,t,i){s.exports=t(De(),Oa(),Ds())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.MD5,u=o.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:a,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var f,d=this.cfg,p=d.hasher.create(),l=n.create(),m=l.words,x=d.keySize,v=d.iterations;m.length<x;){f&&p.update(f),f=p.update(h).finalize(g),p.reset();for(var b=1;b<v;b++)f=p.finalize(f),p.reset();l.concat(f)}return l.sigBytes=x*4,l}});t.EvpKDF=function(h,g,f){return u.create(f).compute(h,g)}}(),e.EvpKDF})}(Ps)),Ps.exports}var Ls={exports:{}},Ja;function Ye(){return Ja||(Ja=1,function(s,c){(function(e,t,i){s.exports=t(De(),ei())})(Ie,function(e){e.lib.Cipher||function(t){var i=e,r=i.lib,n=r.Base,o=r.WordArray,a=r.BufferedBlockAlgorithm,u=i.enc;u.Utf8;var h=u.Base64,g=i.algo,f=g.EvpKDF,d=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(k,N){return this.create(this._ENC_XFORM_MODE,k,N)},createDecryptor:function(k,N){return this.create(this._DEC_XFORM_MODE,k,N)},init:function(k,N,R){this.cfg=this.cfg.extend(R),this._xformMode=k,this._key=N,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(k){return this._append(k),this._process()},finalize:function(k){k&&this._append(k);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function k(N){return typeof N=="string"?L:C}return function(N){return{encrypt:function(R,M,y){return k(M).encrypt(N,R,M,y)},decrypt:function(R,M,y){return k(M).decrypt(N,R,M,y)}}}}()});r.StreamCipher=d.extend({_doFinalize:function(){var k=this._process(!0);return k},blockSize:1});var p=i.mode={},l=r.BlockCipherMode=n.extend({createEncryptor:function(k,N){return this.Encryptor.create(k,N)},createDecryptor:function(k,N){return this.Decryptor.create(k,N)},init:function(k,N){this._cipher=k,this._iv=N}}),m=p.CBC=function(){var k=l.extend();k.Encryptor=k.extend({processBlock:function(R,M){var y=this._cipher,V=y.blockSize;N.call(this,R,M,V),y.encryptBlock(R,M),this._prevBlock=R.slice(M,M+V)}}),k.Decryptor=k.extend({processBlock:function(R,M){var y=this._cipher,V=y.blockSize,Q=R.slice(M,M+V);y.decryptBlock(R,M),N.call(this,R,M,V),this._prevBlock=Q}});function N(R,M,y){var V,Q=this._iv;Q?(V=Q,this._iv=t):V=this._prevBlock;for(var q=0;q<y;q++)R[M+q]^=V[q]}return k}(),x=i.pad={},v=x.Pkcs7={pad:function(k,N){for(var R=N*4,M=R-k.sigBytes%R,y=M<<24|M<<16|M<<8|M,V=[],Q=0;Q<M;Q+=4)V.push(y);var q=o.create(V,M);k.concat(q)},unpad:function(k){var N=k.words[k.sigBytes-1>>>2]&255;k.sigBytes-=N}};r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:m,padding:v}),reset:function(){var k;d.reset.call(this);var N=this.cfg,R=N.iv,M=N.mode;this._xformMode==this._ENC_XFORM_MODE?k=M.createEncryptor:(k=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==k?this._mode.init(this,R&&R.words):(this._mode=k.call(M,this,R&&R.words),this._mode.__creator=k)},_doProcessBlock:function(k,N){this._mode.processBlock(k,N)},_doFinalize:function(){var k,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),k=this._process(!0)):(k=this._process(!0),N.unpad(k)),k},blockSize:128/32});var b=r.CipherParams=n.extend({init:function(k){this.mixIn(k)},toString:function(k){return(k||this.formatter).stringify(this)}}),w=i.format={},_=w.OpenSSL={stringify:function(k){var N,R=k.ciphertext,M=k.salt;return M?N=o.create([1398893684,1701076831]).concat(M).concat(R):N=R,N.toString(h)},parse:function(k){var N,R=h.parse(k),M=R.words;return M[0]==1398893684&&M[1]==1701076831&&(N=o.create(M.slice(2,4)),M.splice(0,4),R.sigBytes-=16),b.create({ciphertext:R,salt:N})}},C=r.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(k,N,R,M){M=this.cfg.extend(M);var y=k.createEncryptor(R,M),V=y.finalize(N),Q=y.cfg;return b.create({ciphertext:V,key:R,iv:Q.iv,algorithm:k,mode:Q.mode,padding:Q.padding,blockSize:k.blockSize,formatter:M.format})},decrypt:function(k,N,R,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var y=k.createDecryptor(R,M).finalize(N.ciphertext);return y},_parse:function(k,N){return typeof k=="string"?N.parse(k,this):k}}),E=i.kdf={},I=E.OpenSSL={execute:function(k,N,R,M,y){if(M||(M=o.random(64/8)),y)var V=f.create({keySize:N+R,hasher:y}).compute(k,M);else var V=f.create({keySize:N+R}).compute(k,M);var Q=o.create(V.words.slice(N),R*4);return V.sigBytes=N*4,b.create({key:V,iv:Q,salt:M})}},L=r.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:I}),encrypt:function(k,N,R,M){M=this.cfg.extend(M);var y=M.kdf.execute(R,k.keySize,k.ivSize,M.salt,M.hasher);M.iv=y.iv;var V=C.encrypt.call(this,k,N,y.key,M);return V.mixIn(y),V},decrypt:function(k,N,R,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var y=M.kdf.execute(R,k.keySize,k.ivSize,N.salt,M.hasher);M.iv=y.iv;var V=C.decrypt.call(this,k,N,y.key,M);return V}})}()})}(Ls)),Ls.exports}var Ms={exports:{}},Xa;function J0(){return Xa||(Xa=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize;i.call(this,r,n,a,o),this._prevBlock=r.slice(n,n+a)}}),t.Decryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize,u=r.slice(n,n+a);i.call(this,r,n,a,o),this._prevBlock=u}});function i(r,n,o,a){var u,h=this._iv;h?(u=h.slice(0),this._iv=void 0):u=this._prevBlock,a.encryptBlock(u,0);for(var g=0;g<o;g++)r[n+g]^=u[g]}return t}(),e.mode.CFB})}(Ms)),Ms.exports}var Ns={exports:{}},Za;function X0(){return Za||(Za=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize,u=this._iv,h=this._counter;u&&(h=this._counter=u.slice(0),this._iv=void 0);var g=h.slice(0);o.encryptBlock(g,0),h[a-1]=h[a-1]+1|0;for(var f=0;f<a;f++)r[n+f]^=g[f]}});return t.Decryptor=i,t}(),e.mode.CTR})}(Ns)),Ns.exports}var Fs={exports:{}},Ya;function Z0(){return Ya||(Ya=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){/** @preserve
24
+ */return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,u=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),p=n.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=a.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(I,C){for(var R=0;R<16;R++){var L=C+R,k=I[L];I[L]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}var M=this._hash.words,w=l.words,N=p.words,_=u.words,V=h.words,ee=g.words,q=f.words,re,$,ie,T,B,H,F,K,Y,ge;H=re=M[0],F=$=M[1],K=ie=M[2],Y=T=M[3],ge=B=M[4];for(var se,R=0;R<80;R+=1)se=re+I[C+_[R]]|0,R<16?se+=m($,ie,T)+w[0]:R<32?se+=x($,ie,T)+w[1]:R<48?se+=v($,ie,T)+w[2]:R<64?se+=b($,ie,T)+w[3]:se+=y($,ie,T)+w[4],se=se|0,se=E(se,ee[R]),se=se+B|0,re=B,B=T,T=E(ie,10),ie=$,$=se,se=H+I[C+V[R]]|0,R<16?se+=y(F,K,Y)+N[0]:R<32?se+=b(F,K,Y)+N[1]:R<48?se+=v(F,K,Y)+N[2]:R<64?se+=x(F,K,Y)+N[3]:se+=m(F,K,Y)+N[4],se=se|0,se=E(se,q[R]),se=se+ge|0,H=ge,ge=Y,Y=E(K,10),K=F,F=se;se=M[1]+ie+Y|0,M[1]=M[2]+T+ge|0,M[2]=M[3]+B+H|0,M[3]=M[4]+re+F|0,M[4]=M[0]+$+K|0,M[0]=se},_doFinalize:function(){var I=this._data,C=I.words,R=this._nDataBytes*8,L=I.sigBytes*8;C[L>>>5]|=128<<24-L%32,C[(L+64>>>9<<4)+14]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,I.sigBytes=(C.length+1)*4,this._process();for(var k=this._hash,M=k.words,w=0;w<5;w++){var N=M[w];M[w]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return k},clone:function(){var I=a.clone.call(this);return I._hash=this._hash.clone(),I}});function m(I,C,R){return I^C^R}function x(I,C,R){return I&C|~I&R}function v(I,C,R){return(I|~C)^R}function b(I,C,R){return I&R|C&~R}function y(I,C,R){return I^(C|~R)}function E(I,C){return I<<C|I>>>32-C}r.RIPEMD160=a._createHelper(d),r.HmacRIPEMD160=a._createHmacHelper(d)}(),e.RIPEMD160})}(Ir)),Ir.exports}var Rr={exports:{}},yn;function kr(){return yn||(yn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){(function(){var t=e,r=t.lib,i=r.Base,n=t.enc,a=n.Utf8,o=t.algo;o.HMAC=i.extend({init:function(u,h){u=this._hasher=new u.init,typeof h=="string"&&(h=a.parse(h));var g=u.blockSize,f=g*4;h.sigBytes>f&&(h=u.finalize(h)),h.clamp();for(var l=this._oKey=h.clone(),p=this._iKey=h.clone(),d=l.words,m=p.words,x=0;x<g;x++)d[x]^=1549556828,m[x]^=909522486;l.sigBytes=p.sigBytes=f,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var h=this._hasher,g=h.finalize(u);h.reset();var f=h.finalize(this._oKey.clone().concat(g));return f}})})()})}(Rr)),Rr.exports}var Dr={exports:{}},An;function Uo(){return An||(An=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),yr(),kr())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.Base,n=r.WordArray,a=t.algo,o=a.SHA256,u=a.HMAC,h=a.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:o,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,f){for(var l=this.cfg,p=u.create(l.hasher,g),d=n.create(),m=n.create([1]),x=d.words,v=m.words,b=l.keySize,y=l.iterations;x.length<b;){var E=p.update(f).finalize(m);p.reset();for(var I=E.words,C=I.length,R=E,L=1;L<y;L++){R=p.finalize(R),p.reset();for(var k=R.words,M=0;M<C;M++)I[M]^=k[M]}d.concat(E),v[0]++}return d.sigBytes=b*4,d}});t.PBKDF2=function(g,f,l){return h.create(l).compute(g,f)}}(),e.PBKDF2})}(Dr)),Dr.exports}var Tr={exports:{}},En;function Dt(){return En||(En=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),pn(),kr())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.Base,n=r.WordArray,a=t.algo,o=a.MD5,u=a.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:o,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var f,l=this.cfg,p=l.hasher.create(),d=n.create(),m=d.words,x=l.keySize,v=l.iterations;m.length<x;){f&&p.update(f),f=p.update(h).finalize(g),p.reset();for(var b=1;b<v;b++)f=p.finalize(f),p.reset();d.concat(f)}return d.sigBytes=x*4,d}});t.EvpKDF=function(h,g,f){return u.create(f).compute(h,g)}}(),e.EvpKDF})}(Tr)),Tr.exports}var Br={exports:{}},wn;function We(){return wn||(wn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Dt())})(_e,function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,a=i.WordArray,o=i.BufferedBlockAlgorithm,u=r.enc;u.Utf8;var h=u.Base64,g=r.algo,f=g.EvpKDF,l=i.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(k,M){return this.create(this._ENC_XFORM_MODE,k,M)},createDecryptor:function(k,M){return this.create(this._DEC_XFORM_MODE,k,M)},init:function(k,M,w){this.cfg=this.cfg.extend(w),this._xformMode=k,this._key=M,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(k){return this._append(k),this._process()},finalize:function(k){k&&this._append(k);var M=this._doFinalize();return M},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function k(M){return typeof M=="string"?L:I}return function(M){return{encrypt:function(w,N,_){return k(N).encrypt(M,w,N,_)},decrypt:function(w,N,_){return k(N).decrypt(M,w,N,_)}}}}()});i.StreamCipher=l.extend({_doFinalize:function(){var k=this._process(!0);return k},blockSize:1});var p=r.mode={},d=i.BlockCipherMode=n.extend({createEncryptor:function(k,M){return this.Encryptor.create(k,M)},createDecryptor:function(k,M){return this.Decryptor.create(k,M)},init:function(k,M){this._cipher=k,this._iv=M}}),m=p.CBC=function(){var k=d.extend();k.Encryptor=k.extend({processBlock:function(w,N){var _=this._cipher,V=_.blockSize;M.call(this,w,N,V),_.encryptBlock(w,N),this._prevBlock=w.slice(N,N+V)}}),k.Decryptor=k.extend({processBlock:function(w,N){var _=this._cipher,V=_.blockSize,ee=w.slice(N,N+V);_.decryptBlock(w,N),M.call(this,w,N,V),this._prevBlock=ee}});function M(w,N,_){var V,ee=this._iv;ee?(V=ee,this._iv=t):V=this._prevBlock;for(var q=0;q<_;q++)w[N+q]^=V[q]}return k}(),x=r.pad={},v=x.Pkcs7={pad:function(k,M){for(var w=M*4,N=w-k.sigBytes%w,_=N<<24|N<<16|N<<8|N,V=[],ee=0;ee<N;ee+=4)V.push(_);var q=a.create(V,N);k.concat(q)},unpad:function(k){var M=k.words[k.sigBytes-1>>>2]&255;k.sigBytes-=M}};i.BlockCipher=l.extend({cfg:l.cfg.extend({mode:m,padding:v}),reset:function(){var k;l.reset.call(this);var M=this.cfg,w=M.iv,N=M.mode;this._xformMode==this._ENC_XFORM_MODE?k=N.createEncryptor:(k=N.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==k?this._mode.init(this,w&&w.words):(this._mode=k.call(N,this,w&&w.words),this._mode.__creator=k)},_doProcessBlock:function(k,M){this._mode.processBlock(k,M)},_doFinalize:function(){var k,M=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(M.pad(this._data,this.blockSize),k=this._process(!0)):(k=this._process(!0),M.unpad(k)),k},blockSize:128/32});var b=i.CipherParams=n.extend({init:function(k){this.mixIn(k)},toString:function(k){return(k||this.formatter).stringify(this)}}),y=r.format={},E=y.OpenSSL={stringify:function(k){var M,w=k.ciphertext,N=k.salt;return N?M=a.create([1398893684,1701076831]).concat(N).concat(w):M=w,M.toString(h)},parse:function(k){var M,w=h.parse(k),N=w.words;return N[0]==1398893684&&N[1]==1701076831&&(M=a.create(N.slice(2,4)),N.splice(0,4),w.sigBytes-=16),b.create({ciphertext:w,salt:M})}},I=i.SerializableCipher=n.extend({cfg:n.extend({format:E}),encrypt:function(k,M,w,N){N=this.cfg.extend(N);var _=k.createEncryptor(w,N),V=_.finalize(M),ee=_.cfg;return b.create({ciphertext:V,key:w,iv:ee.iv,algorithm:k,mode:ee.mode,padding:ee.padding,blockSize:k.blockSize,formatter:N.format})},decrypt:function(k,M,w,N){N=this.cfg.extend(N),M=this._parse(M,N.format);var _=k.createDecryptor(w,N).finalize(M.ciphertext);return _},_parse:function(k,M){return typeof k=="string"?M.parse(k,this):k}}),C=r.kdf={},R=C.OpenSSL={execute:function(k,M,w,N,_){if(N||(N=a.random(64/8)),_)var V=f.create({keySize:M+w,hasher:_}).compute(k,N);else var V=f.create({keySize:M+w}).compute(k,N);var ee=a.create(V.words.slice(M),w*4);return V.sigBytes=M*4,b.create({key:V,iv:ee,salt:N})}},L=i.PasswordBasedCipher=I.extend({cfg:I.cfg.extend({kdf:R}),encrypt:function(k,M,w,N){N=this.cfg.extend(N);var _=N.kdf.execute(w,k.keySize,k.ivSize,N.salt,N.hasher);N.iv=_.iv;var V=I.encrypt.call(this,k,M,_.key,N);return V.mixIn(_),V},decrypt:function(k,M,w,N){N=this.cfg.extend(N),M=this._parse(M,N.format);var _=N.kdf.execute(w,k.keySize,k.ivSize,M.salt,N.hasher);N.iv=_.iv;var V=I.decrypt.call(this,k,M,_.key,N);return V}})}()})}(Br)),Br.exports}var Pr={exports:{}},Cn;function zo(){return Cn||(Cn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize;r.call(this,i,n,o,a),this._prevBlock=i.slice(n,n+o)}}),t.Decryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize,u=i.slice(n,n+o);r.call(this,i,n,o,a),this._prevBlock=u}});function r(i,n,a,o){var u,h=this._iv;h?(u=h.slice(0),this._iv=void 0):u=this._prevBlock,o.encryptBlock(u,0);for(var g=0;g<a;g++)i[n+g]^=u[g]}return t}(),e.mode.CFB})}(Pr)),Pr.exports}var Lr={exports:{}},In;function Ho(){return In||(In=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize,u=this._iv,h=this._counter;u&&(h=this._counter=u.slice(0),this._iv=void 0);var g=h.slice(0);a.encryptBlock(g,0),h[o-1]=h[o-1]+1|0;for(var f=0;f<o;f++)i[n+f]^=g[f]}});return t.Decryptor=r,t}(),e.mode.CTR})}(Lr)),Lr.exports}var Nr={exports:{}},Rn;function jo(){return Rn||(Rn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){/** @preserve
28
25
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
29
26
  * derived from CryptoJS.mode.CTR
30
27
  * Jan Hruby jhruby.web@gmail.com
31
- */return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var a=o>>16&255,u=o>>8&255,h=o&255;a===255?(a=0,u===255?(u=0,h===255?h=0:++h):++u):++a,o=0,o+=a<<16,o+=u<<8,o+=h}else o+=1<<24;return o}function r(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var n=t.Encryptor=t.extend({processBlock:function(o,a){var u=this._cipher,h=u.blockSize,g=this._iv,f=this._counter;g&&(f=this._counter=g.slice(0),this._iv=void 0),r(f);var d=f.slice(0);u.encryptBlock(d,0);for(var p=0;p<h;p++)o[a+p]^=d[p]}});return t.Decryptor=n,t}(),e.mode.CTRGladman})}(Fs)),Fs.exports}var Os={exports:{}},Qa;function Y0(){return Qa||(Qa=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.OFB=function(){var t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize,u=this._iv,h=this._keystream;u&&(h=this._keystream=u.slice(0),this._iv=void 0),o.encryptBlock(h,0);for(var g=0;g<a;g++)r[n+g]^=h[g]}});return t.Decryptor=i,t}(),e.mode.OFB})}(Os)),Os.exports}var Vs={exports:{}},eo;function Q0(){return eo||(eo=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.ECB=function(){var t=e.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(i,r){this._cipher.encryptBlock(i,r)}}),t.Decryptor=t.extend({processBlock:function(i,r){this._cipher.decryptBlock(i,r)}}),t}(),e.mode.ECB})}(Vs)),Vs.exports}var Us={exports:{}},to;function eu(){return to||(to=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.AnsiX923={pad:function(t,i){var r=t.sigBytes,n=i*4,o=n-r%n,a=r+o-1;t.clamp(),t.words[a>>>2]|=o<<24-a%4*8,t.sigBytes+=o},unpad:function(t){var i=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=i}},e.pad.Ansix923})}(Us)),Us.exports}var Hs={exports:{}},io;function tu(){return io||(io=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.Iso10126={pad:function(t,i){var r=i*4,n=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(t){var i=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=i}},e.pad.Iso10126})}(Hs)),Hs.exports}var zs={exports:{}},ro;function iu(){return ro||(ro=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.Iso97971={pad:function(t,i){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,i)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971})}(zs)),zs.exports}var js={exports:{}},so;function ru(){return so||(so=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.ZeroPadding={pad:function(t,i){var r=i*4;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var i=t.words,r=t.sigBytes-1,r=t.sigBytes-1;r>=0;r--)if(i[r>>>2]>>>24-r%4*8&255){t.sigBytes=r+1;break}}},e.pad.ZeroPadding})}(js)),js.exports}var Ws={exports:{}},no;function su(){return no||(no=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}(Ws)),Ws.exports}var Ks={exports:{}},ao;function nu(){return ao||(ao=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.CipherParams,o=i.enc,a=o.Hex,u=i.format;u.Hex={stringify:function(h){return h.ciphertext.toString(a)},parse:function(h){var g=a.parse(h);return n.create({ciphertext:g})}}}(),e.format.Hex})}(Ks)),Ks.exports}var $s={exports:{}},oo;function au(){return oo||(oo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.BlockCipher,n=t.algo,o=[],a=[],u=[],h=[],g=[],f=[],d=[],p=[],l=[],m=[];(function(){for(var b=[],w=0;w<256;w++)w<128?b[w]=w<<1:b[w]=w<<1^283;for(var _=0,C=0,w=0;w<256;w++){var E=C^C<<1^C<<2^C<<3^C<<4;E=E>>>8^E&255^99,o[_]=E,a[E]=_;var I=b[_],L=b[I],k=b[L],N=b[E]*257^E*16843008;u[_]=N<<24|N>>>8,h[_]=N<<16|N>>>16,g[_]=N<<8|N>>>24,f[_]=N;var N=k*16843009^L*65537^I*257^_*16843008;d[E]=N<<24|N>>>8,p[E]=N<<16|N>>>16,l[E]=N<<8|N>>>24,m[E]=N,_?(_=I^b[b[b[k^I]]],C^=b[b[C]]):_=C=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=r.extend({_doReset:function(){var b;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var w=this._keyPriorReset=this._key,_=w.words,C=w.sigBytes/4,E=this._nRounds=C+6,I=(E+1)*4,L=this._keySchedule=[],k=0;k<I;k++)k<C?L[k]=_[k]:(b=L[k-1],k%C?C>6&&k%C==4&&(b=o[b>>>24]<<24|o[b>>>16&255]<<16|o[b>>>8&255]<<8|o[b&255]):(b=b<<8|b>>>24,b=o[b>>>24]<<24|o[b>>>16&255]<<16|o[b>>>8&255]<<8|o[b&255],b^=x[k/C|0]<<24),L[k]=L[k-C]^b);for(var N=this._invKeySchedule=[],R=0;R<I;R++){var k=I-R;if(R%4)var b=L[k];else var b=L[k-4];R<4||k<=4?N[R]=b:N[R]=d[o[b>>>24]]^p[o[b>>>16&255]]^l[o[b>>>8&255]]^m[o[b&255]]}}},encryptBlock:function(b,w){this._doCryptBlock(b,w,this._keySchedule,u,h,g,f,o)},decryptBlock:function(b,w){var _=b[w+1];b[w+1]=b[w+3],b[w+3]=_,this._doCryptBlock(b,w,this._invKeySchedule,d,p,l,m,a);var _=b[w+1];b[w+1]=b[w+3],b[w+3]=_},_doCryptBlock:function(b,w,_,C,E,I,L,k){for(var N=this._nRounds,R=b[w]^_[0],M=b[w+1]^_[1],y=b[w+2]^_[2],V=b[w+3]^_[3],Q=4,q=1;q<N;q++){var ne=C[R>>>24]^E[M>>>16&255]^I[y>>>8&255]^L[V&255]^_[Q++],$=C[M>>>24]^E[y>>>16&255]^I[V>>>8&255]^L[R&255]^_[Q++],ie=C[y>>>24]^E[V>>>16&255]^I[R>>>8&255]^L[M&255]^_[Q++],D=C[V>>>24]^E[R>>>16&255]^I[M>>>8&255]^L[y&255]^_[Q++];R=ne,M=$,y=ie,V=D}var ne=(k[R>>>24]<<24|k[M>>>16&255]<<16|k[y>>>8&255]<<8|k[V&255])^_[Q++],$=(k[M>>>24]<<24|k[y>>>16&255]<<16|k[V>>>8&255]<<8|k[R&255])^_[Q++],ie=(k[y>>>24]<<24|k[V>>>16&255]<<16|k[R>>>8&255]<<8|k[M&255])^_[Q++],D=(k[V>>>24]<<24|k[R>>>16&255]<<16|k[M>>>8&255]<<8|k[y&255])^_[Q++];b[w]=ne,b[w+1]=$,b[w+2]=ie,b[w+3]=D},keySize:256/32});t.AES=r._createHelper(v)}(),e.AES})}($s)),$s.exports}var qs={exports:{}},co;function ou(){return co||(co=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.BlockCipher,o=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=o.DES=n.extend({_doReset:function(){for(var x=this._key,v=x.words,b=[],w=0;w<56;w++){var _=a[w]-1;b[w]=v[_>>>5]>>>31-_%32&1}for(var C=this._subKeys=[],E=0;E<16;E++){for(var I=C[E]=[],L=h[E],w=0;w<24;w++)I[w/6|0]|=b[(u[w]-1+L)%28]<<31-w%6,I[4+(w/6|0)]|=b[28+(u[w+24]-1+L)%28]<<31-w%6;I[0]=I[0]<<1|I[0]>>>31;for(var w=1;w<7;w++)I[w]=I[w]>>>(w-1)*4+3;I[7]=I[7]<<5|I[7]>>>27}for(var k=this._invSubKeys=[],w=0;w<16;w++)k[w]=C[15-w]},encryptBlock:function(x,v){this._doCryptBlock(x,v,this._subKeys)},decryptBlock:function(x,v){this._doCryptBlock(x,v,this._invSubKeys)},_doCryptBlock:function(x,v,b){this._lBlock=x[v],this._rBlock=x[v+1],p.call(this,4,252645135),p.call(this,16,65535),l.call(this,2,858993459),l.call(this,8,16711935),p.call(this,1,1431655765);for(var w=0;w<16;w++){for(var _=b[w],C=this._lBlock,E=this._rBlock,I=0,L=0;L<8;L++)I|=g[L][((E^_[L])&f[L])>>>0];this._lBlock=E,this._rBlock=C^I}var k=this._lBlock;this._lBlock=this._rBlock,this._rBlock=k,p.call(this,1,1431655765),l.call(this,8,16711935),l.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),x[v]=this._lBlock,x[v+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function p(x,v){var b=(this._lBlock>>>x^this._rBlock)&v;this._rBlock^=b,this._lBlock^=b<<x}function l(x,v){var b=(this._rBlock>>>x^this._lBlock)&v;this._lBlock^=b,this._rBlock^=b<<x}t.DES=n._createHelper(d);var m=o.TripleDES=n.extend({_doReset:function(){var x=this._key,v=x.words;if(v.length!==2&&v.length!==4&&v.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var b=v.slice(0,2),w=v.length<4?v.slice(0,2):v.slice(2,4),_=v.length<6?v.slice(0,2):v.slice(4,6);this._des1=d.createEncryptor(r.create(b)),this._des2=d.createEncryptor(r.create(w)),this._des3=d.createEncryptor(r.create(_))},encryptBlock:function(x,v){this._des1.encryptBlock(x,v),this._des2.decryptBlock(x,v),this._des3.encryptBlock(x,v)},decryptBlock:function(x,v){this._des3.decryptBlock(x,v),this._des2.encryptBlock(x,v),this._des1.decryptBlock(x,v)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=n._createHelper(m)}(),e.TripleDES})}(qs)),qs.exports}var Gs={exports:{}},uo;function cu(){return uo||(uo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var h=this._key,g=h.words,f=h.sigBytes,d=this._S=[],p=0;p<256;p++)d[p]=p;for(var p=0,l=0;p<256;p++){var m=p%f,x=g[m>>>2]>>>24-m%4*8&255;l=(l+d[p]+x)%256;var v=d[p];d[p]=d[l],d[l]=v}this._i=this._j=0},_doProcessBlock:function(h,g){h[g]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var h=this._S,g=this._i,f=this._j,d=0,p=0;p<4;p++){g=(g+1)%256,f=(f+h[g])%256;var l=h[g];h[g]=h[f],h[f]=l,d|=h[(h[g]+h[f])%256]<<24-p*8}return this._i=g,this._j=f,d}t.RC4=r._createHelper(o);var u=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)a.call(this)}});t.RC4Drop=r._createHelper(u)}(),e.RC4})}(Gs)),Gs.exports}var Js={exports:{}},ho;function uu(){return ho||(ho=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.StreamCipher,n=t.algo,o=[],a=[],u=[],h=n.Rabbit=r.extend({_doReset:function(){for(var f=this._key.words,d=this.cfg.iv,p=0;p<4;p++)f[p]=(f[p]<<8|f[p]>>>24)&16711935|(f[p]<<24|f[p]>>>8)&4278255360;var l=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],m=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var p=0;p<4;p++)g.call(this);for(var p=0;p<8;p++)m[p]^=l[p+4&7];if(d){var x=d.words,v=x[0],b=x[1],w=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C=w>>>16|_&4294901760,E=_<<16|w&65535;m[0]^=w,m[1]^=C,m[2]^=_,m[3]^=E,m[4]^=w,m[5]^=C,m[6]^=_,m[7]^=E;for(var p=0;p<4;p++)g.call(this)}},_doProcessBlock:function(f,d){var p=this._X;g.call(this),o[0]=p[0]^p[5]>>>16^p[3]<<16,o[1]=p[2]^p[7]>>>16^p[5]<<16,o[2]=p[4]^p[1]>>>16^p[7]<<16,o[3]=p[6]^p[3]>>>16^p[1]<<16;for(var l=0;l<4;l++)o[l]=(o[l]<<8|o[l]>>>24)&16711935|(o[l]<<24|o[l]>>>8)&4278255360,f[d+l]^=o[l]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,d=this._C,p=0;p<8;p++)a[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var p=0;p<8;p++){var l=f[p]+d[p],m=l&65535,x=l>>>16,v=((m*m>>>17)+m*x>>>15)+x*x,b=((l&4294901760)*l|0)+((l&65535)*l|0);u[p]=v^b}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}t.Rabbit=r._createHelper(h)}(),e.Rabbit})}(Js)),Js.exports}var Xs={exports:{}},lo;function hu(){return lo||(lo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.StreamCipher,n=t.algo,o=[],a=[],u=[],h=n.RabbitLegacy=r.extend({_doReset:function(){var f=this._key.words,d=this.cfg.iv,p=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],l=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var m=0;m<4;m++)g.call(this);for(var m=0;m<8;m++)l[m]^=p[m+4&7];if(d){var x=d.words,v=x[0],b=x[1],w=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C=w>>>16|_&4294901760,E=_<<16|w&65535;l[0]^=w,l[1]^=C,l[2]^=_,l[3]^=E,l[4]^=w,l[5]^=C,l[6]^=_,l[7]^=E;for(var m=0;m<4;m++)g.call(this)}},_doProcessBlock:function(f,d){var p=this._X;g.call(this),o[0]=p[0]^p[5]>>>16^p[3]<<16,o[1]=p[2]^p[7]>>>16^p[5]<<16,o[2]=p[4]^p[1]>>>16^p[7]<<16,o[3]=p[6]^p[3]>>>16^p[1]<<16;for(var l=0;l<4;l++)o[l]=(o[l]<<8|o[l]>>>24)&16711935|(o[l]<<24|o[l]>>>8)&4278255360,f[d+l]^=o[l]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,d=this._C,p=0;p<8;p++)a[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var p=0;p<8;p++){var l=f[p]+d[p],m=l&65535,x=l>>>16,v=((m*m>>>17)+m*x>>>15)+x*x,b=((l&4294901760)*l|0)+((l&65535)*l|0);u[p]=v^b}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}t.RabbitLegacy=r._createHelper(h)}(),e.RabbitLegacy})}(Xs)),Xs.exports}var Zs={exports:{}},fo;function lu(){return fo||(fo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.BlockCipher,n=t.algo;const o=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],u=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function g(m,x){let v=x>>24&255,b=x>>16&255,w=x>>8&255,_=x&255,C=m.sbox[0][v]+m.sbox[1][b];return C=C^m.sbox[2][w],C=C+m.sbox[3][_],C}function f(m,x,v){let b=x,w=v,_;for(let C=0;C<o;++C)b=b^m.pbox[C],w=g(m,b)^w,_=b,b=w,w=_;return _=b,b=w,w=_,w=w^m.pbox[o],b=b^m.pbox[o+1],{left:b,right:w}}function d(m,x,v){let b=x,w=v,_;for(let C=o+1;C>1;--C)b=b^m.pbox[C],w=g(m,b)^w,_=b,b=w,w=_;return _=b,b=w,w=_,w=w^m.pbox[1],b=b^m.pbox[0],{left:b,right:w}}function p(m,x,v){for(let E=0;E<4;E++){m.sbox[E]=[];for(let I=0;I<256;I++)m.sbox[E][I]=u[E][I]}let b=0;for(let E=0;E<o+2;E++)m.pbox[E]=a[E]^x[b],b++,b>=v&&(b=0);let w=0,_=0,C=0;for(let E=0;E<o+2;E+=2)C=f(m,w,_),w=C.left,_=C.right,m.pbox[E]=w,m.pbox[E+1]=_;for(let E=0;E<4;E++)for(let I=0;I<256;I+=2)C=f(m,w,_),w=C.left,_=C.right,m.sbox[E][I]=w,m.sbox[E][I+1]=_;return!0}var l=n.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,x=m.words,v=m.sigBytes/4;p(h,x,v)}},encryptBlock:function(m,x){var v=f(h,m[x],m[x+1]);m[x]=v.left,m[x+1]=v.right},decryptBlock:function(m,x){var v=d(h,m[x],m[x+1]);m[x]=v.left,m[x+1]=v.right},blockSize:64/32,keySize:128/32,ivSize:64/32});t.Blowfish=r._createHelper(l)}(),e.Blowfish})}(Zs)),Zs.exports}(function(s,c){(function(e,t,i){s.exports=t(De(),vr(),H0(),z0(),gi(),j0(),vi(),Oa(),As(),W0(),za(),K0(),$0(),q0(),Ds(),G0(),ei(),Ye(),J0(),X0(),Z0(),Y0(),Q0(),eu(),tu(),iu(),ru(),su(),nu(),au(),ou(),cu(),uu(),hu(),lu())})(Ie,function(e){return e})})(ka);var du=ka.exports;const Ys=ca(du);function fu(s){return Ys.MD5(s).toString().toUpperCase()}function pu(s,c,e,t,i,r,n,o){var a;let u="";r.set("x-log-apiversion","0.6.0"),r.set("x-log-signaturemethod","hmac-sha1"),u+=s+`
28
+ */return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(a){if((a>>24&255)===255){var o=a>>16&255,u=a>>8&255,h=a&255;o===255?(o=0,u===255?(u=0,h===255?h=0:++h):++u):++o,a=0,a+=o<<16,a+=u<<8,a+=h}else a+=1<<24;return a}function i(a){return(a[0]=r(a[0]))===0&&(a[1]=r(a[1])),a}var n=t.Encryptor=t.extend({processBlock:function(a,o){var u=this._cipher,h=u.blockSize,g=this._iv,f=this._counter;g&&(f=this._counter=g.slice(0),this._iv=void 0),i(f);var l=f.slice(0);u.encryptBlock(l,0);for(var p=0;p<h;p++)a[o+p]^=l[p]}});return t.Decryptor=n,t}(),e.mode.CTRGladman})}(Nr)),Nr.exports}var Mr={exports:{}},kn;function Wo(){return kn||(kn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.OFB=function(){var t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize,u=this._iv,h=this._keystream;u&&(h=this._keystream=u.slice(0),this._iv=void 0),a.encryptBlock(h,0);for(var g=0;g<o;g++)i[n+g]^=h[g]}});return t.Decryptor=r,t}(),e.mode.OFB})}(Mr)),Mr.exports}var Fr={exports:{}},Dn;function Ko(){return Dn||(Dn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.ECB=function(){var t=e.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(r,i){this._cipher.encryptBlock(r,i)}}),t.Decryptor=t.extend({processBlock:function(r,i){this._cipher.decryptBlock(r,i)}}),t}(),e.mode.ECB})}(Fr)),Fr.exports}var Or={exports:{}},Tn;function $o(){return Tn||(Tn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.AnsiX923={pad:function(t,r){var i=t.sigBytes,n=r*4,a=n-i%n,o=i+a-1;t.clamp(),t.words[o>>>2]|=a<<24-o%4*8,t.sigBytes+=a},unpad:function(t){var r=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=r}},e.pad.Ansix923})}(Or)),Or.exports}var Vr={exports:{}},Bn;function qo(){return Bn||(Bn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.Iso10126={pad:function(t,r){var i=r*4,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(t){var r=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=r}},e.pad.Iso10126})}(Vr)),Vr.exports}var Ur={exports:{}},Pn;function Go(){return Pn||(Pn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971})}(Ur)),Ur.exports}var zr={exports:{}},Ln;function Jo(){return Ln||(Ln=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.ZeroPadding={pad:function(t,r){var i=r*4;t.clamp(),t.sigBytes+=i-(t.sigBytes%i||i)},unpad:function(t){for(var r=t.words,i=t.sigBytes-1,i=t.sigBytes-1;i>=0;i--)if(r[i>>>2]>>>24-i%4*8&255){t.sigBytes=i+1;break}}},e.pad.ZeroPadding})}(zr)),zr.exports}var Hr={exports:{}},Nn;function Xo(){return Nn||(Nn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}(Hr)),Hr.exports}var jr={exports:{}},Mn;function Zo(){return Mn||(Mn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.CipherParams,a=r.enc,o=a.Hex,u=r.format;u.Hex={stringify:function(h){return h.ciphertext.toString(o)},parse:function(h){var g=o.parse(h);return n.create({ciphertext:g})}}}(),e.format.Hex})}(jr)),jr.exports}var Wr={exports:{}},Fn;function Yo(){return Fn||(Fn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Dt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.BlockCipher,n=t.algo,a=[],o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[];(function(){for(var b=[],y=0;y<256;y++)y<128?b[y]=y<<1:b[y]=y<<1^283;for(var E=0,I=0,y=0;y<256;y++){var C=I^I<<1^I<<2^I<<3^I<<4;C=C>>>8^C&255^99,a[E]=C,o[C]=E;var R=b[E],L=b[R],k=b[L],M=b[C]*257^C*16843008;u[E]=M<<24|M>>>8,h[E]=M<<16|M>>>16,g[E]=M<<8|M>>>24,f[E]=M;var M=k*16843009^L*65537^R*257^E*16843008;l[C]=M<<24|M>>>8,p[C]=M<<16|M>>>16,d[C]=M<<8|M>>>24,m[C]=M,E?(E=R^b[b[b[k^R]]],I^=b[b[I]]):E=I=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=i.extend({_doReset:function(){var b;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var y=this._keyPriorReset=this._key,E=y.words,I=y.sigBytes/4,C=this._nRounds=I+6,R=(C+1)*4,L=this._keySchedule=[],k=0;k<R;k++)k<I?L[k]=E[k]:(b=L[k-1],k%I?I>6&&k%I==4&&(b=a[b>>>24]<<24|a[b>>>16&255]<<16|a[b>>>8&255]<<8|a[b&255]):(b=b<<8|b>>>24,b=a[b>>>24]<<24|a[b>>>16&255]<<16|a[b>>>8&255]<<8|a[b&255],b^=x[k/I|0]<<24),L[k]=L[k-I]^b);for(var M=this._invKeySchedule=[],w=0;w<R;w++){var k=R-w;if(w%4)var b=L[k];else var b=L[k-4];w<4||k<=4?M[w]=b:M[w]=l[a[b>>>24]]^p[a[b>>>16&255]]^d[a[b>>>8&255]]^m[a[b&255]]}}},encryptBlock:function(b,y){this._doCryptBlock(b,y,this._keySchedule,u,h,g,f,a)},decryptBlock:function(b,y){var E=b[y+1];b[y+1]=b[y+3],b[y+3]=E,this._doCryptBlock(b,y,this._invKeySchedule,l,p,d,m,o);var E=b[y+1];b[y+1]=b[y+3],b[y+3]=E},_doCryptBlock:function(b,y,E,I,C,R,L,k){for(var M=this._nRounds,w=b[y]^E[0],N=b[y+1]^E[1],_=b[y+2]^E[2],V=b[y+3]^E[3],ee=4,q=1;q<M;q++){var re=I[w>>>24]^C[N>>>16&255]^R[_>>>8&255]^L[V&255]^E[ee++],$=I[N>>>24]^C[_>>>16&255]^R[V>>>8&255]^L[w&255]^E[ee++],ie=I[_>>>24]^C[V>>>16&255]^R[w>>>8&255]^L[N&255]^E[ee++],T=I[V>>>24]^C[w>>>16&255]^R[N>>>8&255]^L[_&255]^E[ee++];w=re,N=$,_=ie,V=T}var re=(k[w>>>24]<<24|k[N>>>16&255]<<16|k[_>>>8&255]<<8|k[V&255])^E[ee++],$=(k[N>>>24]<<24|k[_>>>16&255]<<16|k[V>>>8&255]<<8|k[w&255])^E[ee++],ie=(k[_>>>24]<<24|k[V>>>16&255]<<16|k[w>>>8&255]<<8|k[N&255])^E[ee++],T=(k[V>>>24]<<24|k[w>>>16&255]<<16|k[N>>>8&255]<<8|k[_&255])^E[ee++];b[y]=re,b[y+1]=$,b[y+2]=ie,b[y+3]=T},keySize:256/32});t.AES=i._createHelper(v)}(),e.AES})}(Wr)),Wr.exports}var Kr={exports:{}},On;function Qo(){return On||(On=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Dt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.BlockCipher,a=t.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=a.DES=n.extend({_doReset:function(){for(var x=this._key,v=x.words,b=[],y=0;y<56;y++){var E=o[y]-1;b[y]=v[E>>>5]>>>31-E%32&1}for(var I=this._subKeys=[],C=0;C<16;C++){for(var R=I[C]=[],L=h[C],y=0;y<24;y++)R[y/6|0]|=b[(u[y]-1+L)%28]<<31-y%6,R[4+(y/6|0)]|=b[28+(u[y+24]-1+L)%28]<<31-y%6;R[0]=R[0]<<1|R[0]>>>31;for(var y=1;y<7;y++)R[y]=R[y]>>>(y-1)*4+3;R[7]=R[7]<<5|R[7]>>>27}for(var k=this._invSubKeys=[],y=0;y<16;y++)k[y]=I[15-y]},encryptBlock:function(x,v){this._doCryptBlock(x,v,this._subKeys)},decryptBlock:function(x,v){this._doCryptBlock(x,v,this._invSubKeys)},_doCryptBlock:function(x,v,b){this._lBlock=x[v],this._rBlock=x[v+1],p.call(this,4,252645135),p.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),p.call(this,1,1431655765);for(var y=0;y<16;y++){for(var E=b[y],I=this._lBlock,C=this._rBlock,R=0,L=0;L<8;L++)R|=g[L][((C^E[L])&f[L])>>>0];this._lBlock=C,this._rBlock=I^R}var k=this._lBlock;this._lBlock=this._rBlock,this._rBlock=k,p.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),x[v]=this._lBlock,x[v+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function p(x,v){var b=(this._lBlock>>>x^this._rBlock)&v;this._rBlock^=b,this._lBlock^=b<<x}function d(x,v){var b=(this._rBlock>>>x^this._lBlock)&v;this._lBlock^=b,this._rBlock^=b<<x}t.DES=n._createHelper(l);var m=a.TripleDES=n.extend({_doReset:function(){var x=this._key,v=x.words;if(v.length!==2&&v.length!==4&&v.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var b=v.slice(0,2),y=v.length<4?v.slice(0,2):v.slice(2,4),E=v.length<6?v.slice(0,2):v.slice(4,6);this._des1=l.createEncryptor(i.create(b)),this._des2=l.createEncryptor(i.create(y)),this._des3=l.createEncryptor(i.create(E))},encryptBlock:function(x,v){this._des1.encryptBlock(x,v),this._des2.decryptBlock(x,v),this._des3.encryptBlock(x,v)},decryptBlock:function(x,v){this._des3.decryptBlock(x,v),this._des2.encryptBlock(x,v),this._des1.decryptBlock(x,v)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=n._createHelper(m)}(),e.TripleDES})}(Kr)),Kr.exports}var $r={exports:{}},Vn;function ec(){return Vn||(Vn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Dt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.StreamCipher,n=t.algo,a=n.RC4=i.extend({_doReset:function(){for(var h=this._key,g=h.words,f=h.sigBytes,l=this._S=[],p=0;p<256;p++)l[p]=p;for(var p=0,d=0;p<256;p++){var m=p%f,x=g[m>>>2]>>>24-m%4*8&255;d=(d+l[p]+x)%256;var v=l[p];l[p]=l[d],l[d]=v}this._i=this._j=0},_doProcessBlock:function(h,g){h[g]^=o.call(this)},keySize:256/32,ivSize:0});function o(){for(var h=this._S,g=this._i,f=this._j,l=0,p=0;p<4;p++){g=(g+1)%256,f=(f+h[g])%256;var d=h[g];h[g]=h[f],h[f]=d,l|=h[(h[g]+h[f])%256]<<24-p*8}return this._i=g,this._j=f,l}t.RC4=i._createHelper(a);var u=n.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)o.call(this)}});t.RC4Drop=i._createHelper(u)}(),e.RC4})}($r)),$r.exports}var qr={exports:{}},Un;function tc(){return Un||(Un=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Dt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.StreamCipher,n=t.algo,a=[],o=[],u=[],h=n.Rabbit=i.extend({_doReset:function(){for(var f=this._key.words,l=this.cfg.iv,p=0;p<4;p++)f[p]=(f[p]<<8|f[p]>>>24)&16711935|(f[p]<<24|f[p]>>>8)&4278255360;var d=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],m=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var p=0;p<4;p++)g.call(this);for(var p=0;p<8;p++)m[p]^=d[p+4&7];if(l){var x=l.words,v=x[0],b=x[1],y=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,E=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,I=y>>>16|E&4294901760,C=E<<16|y&65535;m[0]^=y,m[1]^=I,m[2]^=E,m[3]^=C,m[4]^=y,m[5]^=I,m[6]^=E,m[7]^=C;for(var p=0;p<4;p++)g.call(this)}},_doProcessBlock:function(f,l){var p=this._X;g.call(this),a[0]=p[0]^p[5]>>>16^p[3]<<16,a[1]=p[2]^p[7]>>>16^p[5]<<16,a[2]=p[4]^p[1]>>>16^p[7]<<16,a[3]=p[6]^p[3]>>>16^p[1]<<16;for(var d=0;d<4;d++)a[d]=(a[d]<<8|a[d]>>>24)&16711935|(a[d]<<24|a[d]>>>8)&4278255360,f[l+d]^=a[d]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,l=this._C,p=0;p<8;p++)o[p]=l[p];l[0]=l[0]+1295307597+this._b|0,l[1]=l[1]+3545052371+(l[0]>>>0<o[0]>>>0?1:0)|0,l[2]=l[2]+886263092+(l[1]>>>0<o[1]>>>0?1:0)|0,l[3]=l[3]+1295307597+(l[2]>>>0<o[2]>>>0?1:0)|0,l[4]=l[4]+3545052371+(l[3]>>>0<o[3]>>>0?1:0)|0,l[5]=l[5]+886263092+(l[4]>>>0<o[4]>>>0?1:0)|0,l[6]=l[6]+1295307597+(l[5]>>>0<o[5]>>>0?1:0)|0,l[7]=l[7]+3545052371+(l[6]>>>0<o[6]>>>0?1:0)|0,this._b=l[7]>>>0<o[7]>>>0?1:0;for(var p=0;p<8;p++){var d=f[p]+l[p],m=d&65535,x=d>>>16,v=((m*m>>>17)+m*x>>>15)+x*x,b=((d&4294901760)*d|0)+((d&65535)*d|0);u[p]=v^b}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}t.Rabbit=i._createHelper(h)}(),e.Rabbit})}(qr)),qr.exports}var Gr={exports:{}},zn;function ic(){return zn||(zn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Dt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.StreamCipher,n=t.algo,a=[],o=[],u=[],h=n.RabbitLegacy=i.extend({_doReset:function(){var f=this._key.words,l=this.cfg.iv,p=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],d=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var m=0;m<4;m++)g.call(this);for(var m=0;m<8;m++)d[m]^=p[m+4&7];if(l){var x=l.words,v=x[0],b=x[1],y=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,E=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,I=y>>>16|E&4294901760,C=E<<16|y&65535;d[0]^=y,d[1]^=I,d[2]^=E,d[3]^=C,d[4]^=y,d[5]^=I,d[6]^=E,d[7]^=C;for(var m=0;m<4;m++)g.call(this)}},_doProcessBlock:function(f,l){var p=this._X;g.call(this),a[0]=p[0]^p[5]>>>16^p[3]<<16,a[1]=p[2]^p[7]>>>16^p[5]<<16,a[2]=p[4]^p[1]>>>16^p[7]<<16,a[3]=p[6]^p[3]>>>16^p[1]<<16;for(var d=0;d<4;d++)a[d]=(a[d]<<8|a[d]>>>24)&16711935|(a[d]<<24|a[d]>>>8)&4278255360,f[l+d]^=a[d]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,l=this._C,p=0;p<8;p++)o[p]=l[p];l[0]=l[0]+1295307597+this._b|0,l[1]=l[1]+3545052371+(l[0]>>>0<o[0]>>>0?1:0)|0,l[2]=l[2]+886263092+(l[1]>>>0<o[1]>>>0?1:0)|0,l[3]=l[3]+1295307597+(l[2]>>>0<o[2]>>>0?1:0)|0,l[4]=l[4]+3545052371+(l[3]>>>0<o[3]>>>0?1:0)|0,l[5]=l[5]+886263092+(l[4]>>>0<o[4]>>>0?1:0)|0,l[6]=l[6]+1295307597+(l[5]>>>0<o[5]>>>0?1:0)|0,l[7]=l[7]+3545052371+(l[6]>>>0<o[6]>>>0?1:0)|0,this._b=l[7]>>>0<o[7]>>>0?1:0;for(var p=0;p<8;p++){var d=f[p]+l[p],m=d&65535,x=d>>>16,v=((m*m>>>17)+m*x>>>15)+x*x,b=((d&4294901760)*d|0)+((d&65535)*d|0);u[p]=v^b}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}t.RabbitLegacy=i._createHelper(h)}(),e.RabbitLegacy})}(Gr)),Gr.exports}var Jr={exports:{}},Hn;function rc(){return Hn||(Hn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Dt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.BlockCipher,n=t.algo;const a=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],u=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function g(m,x){let v=x>>24&255,b=x>>16&255,y=x>>8&255,E=x&255,I=m.sbox[0][v]+m.sbox[1][b];return I=I^m.sbox[2][y],I=I+m.sbox[3][E],I}function f(m,x,v){let b=x,y=v,E;for(let I=0;I<a;++I)b=b^m.pbox[I],y=g(m,b)^y,E=b,b=y,y=E;return E=b,b=y,y=E,y=y^m.pbox[a],b=b^m.pbox[a+1],{left:b,right:y}}function l(m,x,v){let b=x,y=v,E;for(let I=a+1;I>1;--I)b=b^m.pbox[I],y=g(m,b)^y,E=b,b=y,y=E;return E=b,b=y,y=E,y=y^m.pbox[1],b=b^m.pbox[0],{left:b,right:y}}function p(m,x,v){for(let C=0;C<4;C++){m.sbox[C]=[];for(let R=0;R<256;R++)m.sbox[C][R]=u[C][R]}let b=0;for(let C=0;C<a+2;C++)m.pbox[C]=o[C]^x[b],b++,b>=v&&(b=0);let y=0,E=0,I=0;for(let C=0;C<a+2;C+=2)I=f(m,y,E),y=I.left,E=I.right,m.pbox[C]=y,m.pbox[C+1]=E;for(let C=0;C<4;C++)for(let R=0;R<256;R+=2)I=f(m,y,E),y=I.left,E=I.right,m.sbox[C][R]=y,m.sbox[C][R+1]=E;return!0}var d=n.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,x=m.words,v=m.sigBytes/4;p(h,x,v)}},encryptBlock:function(m,x){var v=f(h,m[x],m[x+1]);m[x]=v.left,m[x+1]=v.right},decryptBlock:function(m,x){var v=l(h,m[x],m[x+1]);m[x]=v.left,m[x+1]=v.right},blockSize:64/32,keySize:128/32,ivSize:64/32});t.Blowfish=i._createHelper(d)}(),e.Blowfish})}(Jr)),Jr.exports}(function(s,c){(function(e,t,r){s.exports=t(Ee(),Ri(),Po(),Lo(),zt(),No(),Ht(),pn(),yr(),Mo(),xn(),Fo(),Oo(),Vo(),kr(),Uo(),Dt(),We(),zo(),Ho(),jo(),Wo(),Ko(),$o(),qo(),Go(),Jo(),Xo(),Zo(),Yo(),Qo(),ec(),tc(),ic(),rc())})(_e,function(e){return e})})(nn);var Xr=nn.exports;const ui=$s(Xr),jn=ui.enc.Base64,sc=ui.lib.WordArray,nc=s=>z(this,null,function*(){const c=yield s.arrayBuffer(),e=Xr.MD5(sc.create(c));return jn.stringify(e)}),ac=function(c,e,t){const r="x-oss-",i={};let n=[c.toUpperCase(),e["content-md5"]||"",e["content-type"],e["x-oss-date"]];return Object.keys(e).forEach(a=>{const o=a.toLowerCase();o.indexOf(r)===0&&(i[o]=String(e[a]).trim())}),Object.keys(i).sort().forEach(a=>{n.push(`${a}:${i[a]}`)}),n.push(t),n.join(`
29
+ `)},oc=(s,c,e,t)=>z(this,null,function*(){const r=ac("PUT",e,t),i=jn.stringify(Xr.HmacSHA1(r,c));return`OSS ${s}:${i}`});var cc=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,uc=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,hc=/[^-+\dA-Z]/g;function Zr(s,c,e,t){if(arguments.length===1&&typeof s=="string"&&!/\d/.test(s)&&(c=s,s=void 0),s=s||s===0?s:new Date,s instanceof Date||(s=new Date(s)),isNaN(s))throw TypeError("Invalid date");c=String(Wn[c]||c||Wn.default);var r=c.slice(0,4);(r==="UTC:"||r==="GMT:")&&(c=c.slice(4),e=!0,r==="GMT:"&&(t=!0));var i=function(){return e?"getUTC":"get"},n=function(){return s[i()+"Date"]()},a=function(){return s[i()+"Day"]()},o=function(){return s[i()+"Month"]()},u=function(){return s[i()+"FullYear"]()},h=function(){return s[i()+"Hours"]()},g=function(){return s[i()+"Minutes"]()},f=function(){return s[i()+"Seconds"]()},l=function(){return s[i()+"Milliseconds"]()},p=function(){return e?0:s.getTimezoneOffset()},d=function(){return dc(s)},m=function(){return lc(s)},x={d:function(){return n()},dd:function(){return at(n())},ddd:function(){return rt.dayNames[a()]},DDD:function(){return Kn({y:u(),m:o(),d:n(),_:i(),dayName:rt.dayNames[a()],short:!0})},dddd:function(){return rt.dayNames[a()+7]},DDDD:function(){return Kn({y:u(),m:o(),d:n(),_:i(),dayName:rt.dayNames[a()+7]})},m:function(){return o()+1},mm:function(){return at(o()+1)},mmm:function(){return rt.monthNames[o()]},mmmm:function(){return rt.monthNames[o()+12]},yy:function(){return String(u()).slice(2)},yyyy:function(){return at(u(),4)},h:function(){return h()%12||12},hh:function(){return at(h()%12||12)},H:function(){return h()},HH:function(){return at(h())},M:function(){return g()},MM:function(){return at(g())},s:function(){return f()},ss:function(){return at(f())},l:function(){return at(l(),3)},L:function(){return at(Math.floor(l()/10))},t:function(){return h()<12?rt.timeNames[0]:rt.timeNames[1]},tt:function(){return h()<12?rt.timeNames[2]:rt.timeNames[3]},T:function(){return h()<12?rt.timeNames[4]:rt.timeNames[5]},TT:function(){return h()<12?rt.timeNames[6]:rt.timeNames[7]},Z:function(){return t?"GMT":e?"UTC":fc(s)},o:function(){return(p()>0?"-":"+")+at(Math.floor(Math.abs(p())/60)*100+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+at(Math.floor(Math.abs(p())/60),2)+":"+at(Math.floor(Math.abs(p())%60),2)},S:function(){return["th","st","nd","rd"][n()%10>3?0:(n()%100-n()%10!=10)*n()%10]},W:function(){return d()},WW:function(){return at(d())},N:function(){return m()}};return c.replace(cc,function(v){return v in x?x[v]():v.slice(1,v.length-1)})}var Wn={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},rt={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},at=function(c){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(c).padStart(e,"0")},Kn=function(c){var e=c.y,t=c.m,r=c.d,i=c._,n=c.dayName,a=c.short,o=a===void 0?!1:a,u=new Date,h=new Date;h.setDate(h[i+"Date"]()-1);var g=new Date;g.setDate(g[i+"Date"]()+1);var f=function(){return u[i+"Date"]()},l=function(){return u[i+"Month"]()},p=function(){return u[i+"FullYear"]()},d=function(){return h[i+"Date"]()},m=function(){return h[i+"Month"]()},x=function(){return h[i+"FullYear"]()},v=function(){return g[i+"Date"]()},b=function(){return g[i+"Month"]()},y=function(){return g[i+"FullYear"]()};return p()===e&&l()===t&&f()===r?o?"Tdy":"Today":x()===e&&m()===t&&d()===r?o?"Ysd":"Yesterday":y()===e&&b()===t&&v()===r?o?"Tmw":"Tomorrow":n},dc=function(c){var e=new Date(c.getFullYear(),c.getMonth(),c.getDate());e.setDate(e.getDate()-(e.getDay()+6)%7+3);var t=new Date(e.getFullYear(),0,4);t.setDate(t.getDate()-(t.getDay()+6)%7+3);var r=e.getTimezoneOffset()-t.getTimezoneOffset();e.setHours(e.getHours()-r);var i=(e-t)/(864e5*7);return 1+Math.floor(i)},lc=function(c){var e=c.getDay();return e===0&&(e=7),e},fc=function(c){return(String(c).match(uc)||[""]).pop().replace(hc,"").replace(/GMT\+0000/g,"UTC")};function $n(s,c,e){Object.defineProperty(s,c,{writable:!0,enumerable:!0,configurable:!0,value:e})}function qn(s,c,e,t){t?t(()=>{$n(s,c,e)}):$n(s,c,e)}Array(32);class pc{constructor(c){this.timer=null,this.time=10,this.count=10,this.arr=[];var e,t;this.time=(e=c.time)!=null?e:10,this.count=(t=c.count)!=null?t:10,c.host.startsWith("http://")||c.host.startsWith("https://")?this.url=c.host+"/logstores/"+c.logstore+"/track":this.url="https://"+c.project+"."+c.host+"/logstores/"+c.logstore+"/track",this.opt=c,c.installUnloadHook&&typeof c.installUnloadHook=="function"&&c.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(c){const e={__logs__:c};return this.opt.tags&&(e.__tags__=this.opt.tags),this.opt.topic&&(e.__topic__=this.opt.topic),this.opt.source&&(e.__source__=this.opt.source),JSON.stringify(e)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const c=this.assemblePayload(this.arr);this.opt.sendPayload(this.url,c)}}transString(c){let e={};for(let t in c)typeof c[t]=="object"?e[t]=JSON.stringify(c[t]):e[t]=String(c[t]);return e}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const c=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){c.sendImmediateInner()},this.time*1e3)}}send(c){const e=this.transString(c);this.arr.push(e),this.sendInner()}sendImmediate(c){const e=this.transString(c);this.arr.push(e),this.sendImmediateInner()}sendBatchLogs(c){const e=c.map(t=>this.transString(t));this.arr.push(...e),this.sendInner()}sendBatchLogsImmediate(c){const e=c.map(t=>this.transString(t));this.arr.push(...e),this.sendImmediateInner()}overwriteTransString(c){this.transString=c.transString}getOpt(){return this.opt}}var mc=(s,c,e)=>new Promise((t,r)=>{var i=o=>{try{a(e.next(o))}catch(u){r(u)}},n=o=>{try{a(e.throw(o))}catch(u){r(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,n);a((e=e.apply(s,c)).next())});function gc(s,c){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${s}?APIVersion=0.6.0`,c):!1}function Gn(s,c){const e=new window.XMLHttpRequest;e.open("POST",`${s}?APIVersion=0.6.0`,!0),e.send(c)}function vc(s,c){try{if(c.length>=32768){Gn(s,c);return}gc(s,c)||Gn(s,c)}catch(e){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
30
+ `+e),console.error("Failed log data:",s))}}function xc(s,c,e){return mc(this,null,function*(){try{s=s.slice(0,-6);const{data:t,header:r}=yield e.process(s,c),i=new window.XMLHttpRequest;i.open("POST",s,!0);for(let n in r)i.setRequestHeader(n,r[n]);i.send(t)}catch(t){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
31
+ `+t),console.error("Failed log data:",s))}})}class Jn extends pc{constructor(c){const e=Object.assign({},c,{installUnloadHook:t=>{window.addEventListener("beforeunload",()=>{t()})},sendPayload:(t,r)=>{vc(t,r)}});super(e)}useStsPlugin(c){this.getOpt().sendPayload=(e,t)=>{xc(e,t,c)},this.overwriteTransString(c)}}qn(window,"SLS_Tracker",Jn);function bc(s){return ui.MD5(s).toString().toUpperCase()}function Sc(s,c,e,t,r,i,n,a){var o;let u="";i.set("x-log-apiversion","0.6.0"),i.set("x-log-signaturemethod","hmac-sha1"),u+=s+`
32
32
  `+n+`
33
- `+((a=r.get("Content-Type"))!=null?a:"")+`
34
- `+o+`
35
- `;const h=(p,l)=>p[0].localeCompare(l[0]),g=p=>p[0].startsWith("x-log-")||p[0].startsWith("x-acs-");try{const p=[...r.entries()].filter(g).sort(h).map(l=>l[0]+":"+l[1]+`
36
- `).join("");u+=p}catch(p){}u+=c,i.size>0&&(u+="?");try{u+=[...i.entries()].sort(h).map(p=>p[0]+"="+p[1]).join("&")}catch(p){}const f=Ys.HmacSHA1(u,t).toString(Ys.enc.Base64),d="LOG "+e+":"+f;return r.set("Authorization",d),r.set("x-log-date",o),d}var mu=(s,c,e)=>new Promise((t,i)=>{var r=a=>{try{o(e.next(a))}catch(u){i(u)}},n=a=>{try{o(e.throw(a))}catch(u){i(u)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(r,n);o((e=e.apply(s,c)).next())});function gu(s){return mu(this,null,function*(){const c=new Date;if(s.refreshSTSTokenInterval||(s.refreshSTSTokenInterval=3e5),!s.stsTokenFreshTime||+c-s.stsTokenFreshTime>=s.refreshSTSTokenInterval){s.stsTokenFreshTime=c;try{yield s.refreshSTSToken()}catch(e){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
37
- `+e)}}return null})}var vu=(s,c,e)=>new Promise((t,i)=>{var r=a=>{try{o(e.next(a))}catch(u){i(u)}},n=a=>{try{o(e.throw(a))}catch(u){i(u)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(r,n);o((e=e.apply(s,c)).next())});function po(s){return{transString:function(c){let e={},t=0,i=!1;for(let r in c){if((r==="time"||r==="__time__")&&typeof c[r]=="number"){t=c[r],i=!0;continue}typeof c[r]=="object"?e[r]=JSON.stringify(c[r]):e[r]=String(c[r])}return e.__time__=i?t:Math.floor(new Date().getTime()/1e3),e},process:function(c,e){return vu(this,null,function*(){yield gu(s);let t=c.slice(c.indexOf("/logstores")),i=e.length,r=fu(e),n=new Date().toUTCString(),o=new Map,a=new Map([["Content-Type","application/json"],["Content-MD5",r],["x-log-bodyrawsize",i.toString()]]);s.securityToken&&a.set("x-acs-security-token",s.securityToken),pu("POST",t,s.accessKeyId,s.accessKeySecret,o,a,r,n);let u=Object.fromEntries(a);return{data:e,header:u}})}}}typeof window!="undefined"&&Ca(window,"stsPlugin",po);var xu="2.0.0-beta.3",ki="",mo="?",Qs="function",ti="undefined",Ti="object",en="string",Ki="major",oe="model",te="name",ae="type",ge="vendor",se="version",gt="architecture",Di="console",Be="mobile",ze="tablet",_t="smarttv",xr="wearable",go="xr",tn="embedded",vo="user-agent",rn=500,sn="brands",xi="formFactors",nn="fullVersionList",Bi="platform",an="platformVersion",br="bitness",ii="sec-ch-ua",bu=ii+"-full-version-list",Su=ii+"-arch",_u=ii+"-"+br,yu=ii+"-form-factors",wu=ii+"-"+Be,Au=ii+"-"+oe,xo=ii+"-"+Bi,Eu=xo+"-version",bo=[sn,nn,Be,oe,Bi,an,gt,xi,br],yt="browser",Kt="cpu",Ht="device",$t="engine",Tt="os",Pi="result",Sr="Amazon",$i="Apple",So="ASUS",_o="BlackBerry",_r="Google",yo="Huawei",wo="Lenovo",on="LG",yr="Microsoft",Ao="Motorola",wr="Samsung",Eo="Sharp",Ar="Sony",cn="Xiaomi",un="Zebra",Li="Mobile ",Mi=" Browser",Er="Chrome",Cu="Edge",qi="Firefox",Gi="Opera",Co="Facebook",Io="Sogou",hn="Windows",Iu=typeof window!==ti,vt=Iu&&window.navigator?window.navigator:void 0,ri=vt&&vt.userAgentData?vt.userAgentData:void 0,Ru=function(s,c){var e={},t=c;if(!Ir(c)){t={};for(var i in c)for(var r in c[i])t[r]=c[i][r].concat(t[r]?t[r]:[])}for(var n in s)e[n]=t[n]&&t[n].length%2===0?t[n].concat(s[n]):s[n];return e},Cr=function(s){for(var c={},e=0;e<s.length;e++)c[s[e].toUpperCase()]=s[e];return c},ln=function(s,c){if(typeof s===Ti&&s.length>0){for(var e in s)if(si(s[e])==si(c))return!0;return!1}return Ni(s)?si(c).indexOf(si(s))!==-1:!1},Ir=function(s,c){for(var e in s)return/^(browser|cpu|device|engine|os)$/.test(e)||(c?Ir(s[e]):!1)},Ni=function(s){return typeof s===en},dn=function(s){if(s){for(var c=[],e=bi(/\\?\"/g,s).split(","),t=0;t<e.length;t++)if(e[t].indexOf(";")>-1){var i=Xi(e[t]).split(";v=");c[t]={brand:i[0],version:i[1]}}else c[t]=Xi(e[t]);return c}},si=function(s){return Ni(s)?s.toLowerCase():s},fn=function(s){return Ni(s)?bi(/[^\d\.]/g,s).split(".")[0]:void 0},qt=function(s){for(var c in s){var e=s[c];typeof e==Ti&&e.length==2?this[e[0]]=e[1]:this[e]=void 0}return this},bi=function(s,c){return Ni(c)?c.replace(s,ki):c},Ji=function(s){return bi(/\\?\"/g,s)},Xi=function(s,c){if(Ni(s))return s=bi(/^\s\s*/,s),typeof c===ti?s:s.substring(0,rn)},Ro=function(s,c){if(!(!s||!c))for(var e=0,t,i,r,n,o,a;e<c.length&&!o;){var u=c[e],h=c[e+1];for(t=i=0;t<u.length&&!o&&u[t];)if(o=u[t++].exec(s),o)for(r=0;r<h.length;r++)a=o[++i],n=h[r],typeof n===Ti&&n.length>0?n.length===2?typeof n[1]==Qs?this[n[0]]=n[1].call(this,a):this[n[0]]=n[1]:n.length===3?typeof n[1]===Qs&&!(n[1].exec&&n[1].test)?this[n[0]]=a?n[1].call(this,a,n[2]):void 0:this[n[0]]=a?a.replace(n[1],n[2]):void 0:n.length===4&&(this[n[0]]=a?n[3].call(this,a.replace(n[1],n[2])):void 0):this[n]=a||void 0;e+=2}},Rr=function(s,c){for(var e in c)if(typeof c[e]===Ti&&c[e].length>0){for(var t=0;t<c[e].length;t++)if(ln(c[e][t],s))return e===mo?void 0:e}else if(ln(c[e],s))return e===mo?void 0:e;return c.hasOwnProperty("*")?c["*"]:s},ko={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},To={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Do={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[se,[te,Li+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[se,[te,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[te,se],[/opios[\/ ]+([\w\.]+)/i],[se,[te,Gi+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[se,[te,Gi+" GX"]],[/\bopr\/([\w\.]+)/i],[se,[te,Gi]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[se,[te,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[te,se],[/\bddg\/([\w\.]+)/i],[se,[te,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[se,[te,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[se,[te,"WeChat"]],[/konqueror\/([\w\.]+)/i],[se,[te,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[se,[te,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[se,[te,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[se,[te,"Smart "+wo+Mi]],[/(avast|avg)\/([\w\.]+)/i],[[te,/(.+)/,"$1 Secure"+Mi],se],[/\bfocus\/([\w\.]+)/i],[se,[te,qi+" Focus"]],[/\bopt\/([\w\.]+)/i],[se,[te,Gi+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[se,[te,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[se,[te,"Dolphin"]],[/coast\/([\w\.]+)/i],[se,[te,Gi+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[se,[te,"MIUI"+Mi]],[/fxios\/([\w\.-]+)/i],[se,[te,Li+qi]],[/\bqihu|(qi?ho?o?|360)browser/i],[[te,"360"+Mi]],[/\b(qq)\/([\w\.]+)/i],[[te,/(.+)/,"$1Browser"],se],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[te,/(.+)/,"$1"+Mi],se],[/samsungbrowser\/([\w\.]+)/i],[se,[te,wr+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[te,/_/g," "],se],[/metasr[\/ ]?([\d\.]+)/i],[se,[te,Io+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[te,Io+" Mobile"],se],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[te,se],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[te],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[te,Co],se],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[te,se],[/\bgsa\/([\w\.]+) .*safari\//i],[se,[te,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[se,[te,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[se,[te,Er+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[te,Er+" WebView"],se],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[se,[te,"Android"+Mi]],[/chrome\/([\w\.]+) mobile/i],[se,[te,Li+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[te,se],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[se,[te,Li+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[te,Li+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[se,te],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[te,[se,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[te,se],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[te,Li+qi],se],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[te,"Netscape"],se],[/(wolvic)\/([\w\.]+)/i],[te,se],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[se,[te,qi+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[te,[se,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[te,[se,/[^\d\.]+./,ki]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[gt,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[gt,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[gt,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[gt,"armhf"]],[/windows (ce|mobile); ppc;/i],[[gt,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[gt,/ower/,ki,si]],[/(sun4\w)[;\)]/i],[[gt,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[gt,si]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[oe,[ge,wr],[ae,ze]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[oe,[ge,wr],[ae,Be]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[oe,[ge,$i],[ae,Be]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[oe,[ge,$i],[ae,ze]],[/(macintosh);/i],[oe,[ge,$i]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[oe,[ge,Eo],[ae,Be]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[oe,[ge,yo],[ae,ze]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[oe,[ge,yo],[ae,Be]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[oe,/_/g," "],[ge,cn],[ae,Be]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[oe,/_/g," "],[ge,cn],[ae,ze]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[oe,[ge,"OPPO"],[ae,Be]],[/\b(opd2\d{3}a?) bui/i],[oe,[ge,"OPPO"],[ae,ze]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[oe,[ge,"Vivo"],[ae,Be]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[oe,[ge,"Realme"],[ae,Be]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[oe,[ge,Ao],[ae,Be]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[oe,[ge,Ao],[ae,ze]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[oe,[ge,on],[ae,ze]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[oe,[ge,on],[ae,Be]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[oe,[ge,wo],[ae,ze]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[oe,/_/g," "],[ge,"Nokia"],[ae,Be]],[/(pixel c)\b/i],[oe,[ge,_r],[ae,ze]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[oe,[ge,_r],[ae,Be]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[oe,[ge,Ar],[ae,Be]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[oe,"Xperia Tablet"],[ge,Ar],[ae,ze]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[oe,[ge,"OnePlus"],[ae,Be]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[oe,[ge,Sr],[ae,ze]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[oe,/(.+)/g,"Fire Phone $1"],[ge,Sr],[ae,Be]],[/(playbook);[-\w\),; ]+(rim)/i],[oe,ge,[ae,ze]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[oe,[ge,_o],[ae,Be]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[oe,[ge,So],[ae,ze]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[oe,[ge,So],[ae,Be]],[/(nexus 9)/i],[oe,[ge,"HTC"],[ae,ze]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[ge,[oe,/_/g," "],[ae,Be]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[oe,[ge,"Acer"],[ae,ze]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[oe,[ge,"Meizu"],[ae,Be]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[oe,[ge,"Ulefone"],[ae,Be]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[ge,oe,[ae,Be]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[ge,oe,[ae,ze]],[/(surface duo)/i],[oe,[ge,yr],[ae,ze]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[oe,[ge,"Fairphone"],[ae,Be]],[/(shield[\w ]+) b/i],[oe,[ge,"Nvidia"],[ae,ze]],[/(sprint) (\w+)/i],[ge,oe,[ae,Be]],[/(kin\.[onetw]{3})/i],[[oe,/\./g," "],[ge,yr],[ae,Be]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[oe,[ge,un],[ae,ze]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[oe,[ge,un],[ae,Be]],[/smart-tv.+(samsung)/i],[ge,[ae,_t]],[/hbbtv.+maple;(\d+)/i],[[oe,/^/,"SmartTV"],[ge,wr],[ae,_t]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[ge,on],[ae,_t]],[/(apple) ?tv/i],[ge,[oe,$i+" TV"],[ae,_t]],[/crkey/i],[[oe,Er+"cast"],[ge,_r],[ae,_t]],[/droid.+aft(\w+)( bui|\))/i],[oe,[ge,Sr],[ae,_t]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[oe,[ge,Eo],[ae,_t]],[/(bravia[\w ]+)( bui|\))/i],[oe,[ge,Ar],[ae,_t]],[/(mitv-\w{5}) bui/i],[oe,[ge,cn],[ae,_t]],[/Hbbtv.*(technisat) (.*);/i],[ge,oe,[ae,_t]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[ge,Xi],[oe,Xi],[ae,_t]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[ae,_t]],[/(ouya)/i,/(nintendo) (\w+)/i],[ge,oe,[ae,Di]],[/droid.+; (shield) bui/i],[oe,[ge,"Nvidia"],[ae,Di]],[/(playstation \w+)/i],[oe,[ge,Ar],[ae,Di]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[oe,[ge,yr],[ae,Di]],[/((pebble))app/i],[ge,oe,[ae,xr]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[oe,[ge,$i],[ae,xr]],[/droid.+; (wt63?0{2,3})\)/i],[oe,[ge,un],[ae,xr]],[/droid.+; (glass) \d/i],[oe,[ge,_r],[ae,go]],[/(quest( \d| pro)?)/i],[oe,[ge,Co],[ae,go]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[ge,[ae,tn]],[/(aeobc)\b/i],[oe,[ge,Sr],[ae,tn]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[oe,[ae,Be]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[oe,[ae,ze]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[ae,ze]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[ae,Be]],[/(android[-\w\. ]{0,9});.+buil/i],[oe,[ge,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[se,[te,Cu+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[se,[te,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[te,se],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[se,te]],os:[[/microsoft (windows) (vista|xp)/i],[te,se],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[te,[se,Rr,ko]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[se,Rr,ko],[te,hn]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[se,/_/g,"."],[te,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[te,"macOS"],[se,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[se,te],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[te,se],[/\(bb(10);/i],[se,[te,_o]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[se,[te,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[se,[te,qi+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[se,[te,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[se,[te,"watchOS"]],[/crkey\/([\d\.]+)/i],[se,[te,Er+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[te,"Chrome OS"],se],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[te,se],[/(sunos) ?([\w\.\d]*)/i],[[te,"Solaris"],se],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[te,se]]},kr=function(){var s={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return qt.call(s.init,[[yt,[te,se,Ki,ae]],[Kt,[gt]],[Ht,[ae,oe,ge]],[$t,[te,se]],[Tt,[te,se]]]),qt.call(s.isIgnore,[[yt,[se,Ki]],[$t,[se]],[Tt,[se]]]),qt.call(s.isIgnoreRgx,[[yt,/ ?browser$/i],[Tt,/ ?os$/i]]),qt.call(s.toString,[[yt,[te,se]],[Kt,[gt]],[Ht,[ge,oe]],[$t,[te,se]],[Tt,[te,se]]]),s}(),ku=function(s,c){var e=kr.init[c],t=kr.isIgnore[c]||0,i=kr.isIgnoreRgx[c]||0,r=kr.toString[c]||0;function n(){qt.call(this,e)}return n.prototype.getItem=function(){return s},n.prototype.withClientHints=function(){return ri?ri.getHighEntropyValues(bo).then(function(o){return s.setCH(new Bo(o,!1)).parseCH().get()}):s.parseCH().get()},n.prototype.withFeatureCheck=function(){return s.detectFeature().get()},c!=Pi&&(n.prototype.is=function(o){var a=!1;for(var u in this)if(this.hasOwnProperty(u)&&!ln(t,u)&&si(i?bi(i,this[u]):this[u])==si(i?bi(i,o):o)){if(a=!0,o!=ti)break}else if(o==ti&&a){a=!a;break}return a},n.prototype.toString=function(){var o=ki;for(var a in r)typeof this[r[a]]!==ti&&(o+=(o?" ":ki)+this[r[a]]);return o||ti}),ri||(n.prototype.then=function(o){var a=this,u=function(){for(var g in a)a.hasOwnProperty(g)&&(this[g]=a[g])};u.prototype={is:n.prototype.is,toString:n.prototype.toString};var h=new u;return o(h),h}),new n};function Bo(s,c){if(s=s||{},qt.call(this,bo),c)qt.call(this,[[sn,dn(s[ii])],[nn,dn(s[bu])],[Be,/\?1/.test(s[wu])],[oe,Ji(s[Au])],[Bi,Ji(s[xo])],[an,Ji(s[Eu])],[gt,Ji(s[Su])],[xi,dn(s[yu])],[br,Ji(s[_u])]]);else for(var e in s)this.hasOwnProperty(e)&&typeof s[e]!==ti&&(this[e]=s[e])}function Po(s,c,e,t){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,r){return this.data[i]=r,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(vt&&vt.userAgent==this.ua)switch(this.itemType){case yt:vt.brave&&typeof vt.brave.isBrave==Qs&&this.set(te,"Brave");break;case Ht:!this.get(ae)&&ri&&ri[Be]&&this.set(ae,Be),this.get(oe)=="Macintosh"&&vt&&typeof vt.standalone!==ti&&vt.maxTouchPoints&&vt.maxTouchPoints>2&&this.set(oe,"iPad").set(ae,ze);break;case Tt:!this.get(te)&&ri&&ri[Bi]&&this.set(te,ri[Bi]);break;case Pi:var i=this.data,r=function(n){return i[n].getItem().detectFeature().get()};this.set(yt,r(yt)).set(Kt,r(Kt)).set(Ht,r(Ht)).set($t,r($t)).set(Tt,r(Tt))}return this},this.parseUA=function(){return this.itemType!=Pi&&Ro.call(this.data,this.ua,this.rgxMap),this.itemType==yt&&this.set(Ki,fn(this.get(se))),this},this.parseCH=function(){var i=this.uaCH,r=this.rgxMap;switch(this.itemType){case yt:var n=i[nn]||i[sn],o;if(n)for(var a in n){var u=bi(/(Google|Microsoft) /,n[a].brand||n[a]),h=n[a].version;!/not.a.brand/i.test(u)&&(!o||/chrom/i.test(o)&&!/chromi/i.test(u))&&(this.set(te,u).set(se,h).set(Ki,fn(h)),o=u)}break;case Kt:var g=i[gt];g&&(g&&i[br]=="64"&&(g+="64"),Ro.call(this.data,g+";",r));break;case Ht:if(i[Be]&&this.set(ae,Be),i[oe]&&this.set(oe,i[oe]),i[oe]=="Xbox"&&this.set(ae,Di).set(ge,yr),i[xi]){var f;if(typeof i[xi]!="string")for(var d=0;!f&&d<i[xi].length;)f=Rr(i[xi][d++],To);else f=Rr(i[xi],To);this.set(ae,f)}break;case Tt:var p=i[Bi];if(p){var l=i[an];p==hn&&(l=parseInt(fn(l),10)>=13?"11":"10"),this.set(te,p).set(se,l)}this.get(te)==hn&&i[oe]=="Xbox"&&this.set(te,"Xbox").set(se,void 0);break;case Pi:var m=this.data,x=function(v){return m[v].getItem().setCH(i).parseCH().get()};this.set(yt,x(yt)).set(Kt,x(Kt)).set(Ht,x(Ht)).set($t,x($t)).set(Tt,x(Tt))}return this},qt.call(this,[["itemType",s],["ua",c],["uaCH",t],["rgxMap",e],["data",ku(this,s)]]),this}function Gt(s,c,e){if(typeof s===Ti?(Ir(s,!0)?(typeof c===Ti&&(e=c),c=s):(e=s,c=void 0),s=void 0):typeof s===en&&!Ir(c,!0)&&(e=c,c=void 0),!(this instanceof Gt))return new Gt(s,c,e).getResult();var t=typeof s===en?s:vt&&vt.userAgent?vt.userAgent:e&&e[vo]?e[vo]:ki,i=new Bo(e,!0),r=c?Ru(Do,c):Do,n=function(o){return o==Pi?function(){return new Po(o,t,r,i).set("ua",t).set(yt,this.getBrowser()).set(Kt,this.getCPU()).set(Ht,this.getDevice()).set($t,this.getEngine()).set(Tt,this.getOS()).get()}:function(){return new Po(o,t,r[o],i).parseUA().get()}};return qt.call(this,[["getBrowser",n(yt)],["getCPU",n(Kt)],["getDevice",n(Ht)],["getEngine",n($t)],["getOS",n(Tt)],["getResult",n(Pi)],["getUA",function(){return t}],["setUA",function(o){return Ni(o)&&(t=o.length>rn?Xi(o,rn):o),this}]]).setUA(t),this}Gt.VERSION=xu,Gt.BROWSER=Cr([te,se,Ki,ae]),Gt.CPU=Cr([gt]),Gt.DEVICE=Cr([oe,ge,ae,Di,Be,_t,ze,xr,tn]),Gt.ENGINE=Gt.OS=Cr([te,se]);const{BrowserUtil:pn,SystenUtil:Lo}=ye.AliRTS;class Mo{constructor(){A(this,"tracker");A(this,"param");A(this,"msgCacheArr",[]);A(this,"index",0);A(this,"stsOpt");A(this,"slsToken");A(this,"ossToken");A(this,"uaParserResult");this.uaParserResult=new Gt().getResult()}createTracker(){if(!this.tracker&&this.slsToken&&this.param){const c=this.slsToken;this.ossToken&&(this.param.ossbn=this.ossToken.bucket_name,this.param.ossep=this.ossToken.region_endpoint);const e=new Ra({host:c.region_endpoint,project:c.project,logstore:c.log_store_stats}),t={accessKeyId:c.access_key_id,accessKeySecret:c.access_key_secret,securityToken:c.security_token,refreshSTSToken:()=>{this.slsToken&&(t.accessKeyId=this.slsToken.access_key_id,t.accessKeySecret=this.slsToken.access_key_secret,t.securityToken=this.slsToken.security_token)}};this.stsOpt=t;const i=po(t);e.useStsPlugin(i),this.tracker=e,this.msgCacheArr.forEach((r,n)=>{var o,a;(a=this.tracker)==null||a.send(Ce(Yt(Ce({},this.param),{stat_log_id:`${((o=this.param)==null?void 0:o.sesid)||"nosession"}-${n}`}),r))}),this.index=this.index+this.msgCacheArr.length,this.msgCacheArr=[]}}start(c){this.initParam(c),this.createTracker()}updateToken(c,e){this.slsToken=c,this.ossToken=e,this.createTracker()}stop(){this.tracker=void 0}sendReport(c){var e,t;if(c.tm=Date.now(),!this.tracker){this.msgCacheArr.push(c);return}(t=this.tracker)==null||t.send(Ce(Yt(Ce({bt:pn.browserName||"unknown"},this.param),{stat_log_id:`${((e=this.param)==null?void 0:e.sesid)||"nosession"}-${this.index}`}),c)),this.index++}initParam(c){let e=localStorage.getItem("AliRtcUUID");e||(e=fi(),localStorage.setItem("AliRtcUUID",e)),localStorage.getItem("AliRtcUUID")&&(this.param||(this.param={apid:c.appId,usrid:c.userId,statsvrs:"0.6.1",evetid:0,sesid:c.sessionId,sessionId:c.sessionId,channelid:c.channelId,usrn:c.userId,osn:Lo.systemName,osv:Lo.systemVersion,deb:this.uaParserResult.device.vendor,den:`${this.uaParserResult.device.model} ${this.uaParserResult.engine.name}/${this.uaParserResult.engine.version} ${this.uaParserResult.browser.name}/${this.uaParserResult.browser.version}`,udid:e,sdkvrs:ns,acs:"Unknown",cput:this.uaParserResult.cpu.architecture||"",dm:`${window.location.protocol}//${window.location.host}`,bt:pn.browserName,bv:pn.browserVersion,envir:"PRODUCT",args:""}))}}const Fe=(s,c=1,e=6e4,t=0)=>{let i=s;return i||(i=0),Math.min(e,Math.max(t,Math.round(i*c)))},Dt=(s,c,e=2e7,t=0)=>{let i=c;(!c||c<0||c>1e4)&&(i=1e3);let r=s;return r||(r=0),Math.min(e,Math.max(t,Math.round(r/(i/1e3))))},Si=(s,c)=>{if(c===0)return 0;let e=s;return(!e||e<0)&&(e=0),+((e||0)/c*100).toFixed(2)},No=s=>s>=0&&s<=1?Fe(Math.floor(32767*s),1,32767):0,je=(s,c)=>{var t,i,r;let e=((t=s._last)==null?void 0:t[c])||0;return s.ssrc&&((i=s._last)!=null&&i.ssrc)&&s.ssrc!==((r=s._last)==null?void 0:r.ssrc)&&(e=0),((s==null?void 0:s[c])||0)-e},Tu=(s,c)=>{var e,t,i;return(((e=s==null?void 0:s._source)==null?void 0:e[c])||0)-(((i=(t=s==null?void 0:s._last)==null?void 0:t._source)==null?void 0:i[c])||0)},Fo=(s,c)=>Fe(je(s,c),1e3,1e4),_i=(s,c=2e7)=>Fe(s,1,c),or=class or{constructor(c){A(this,"engine");A(this,"logClient");A(this,"authInfo");this.logClient=new Mo,this.engine=c}static getLogClient(){return this.staticClient||(this.staticClient=new Mo),this.staticClient}static reportOSSUpload(c,e,t=0){or.getLogClient().sendReport({errmsg:`${e}/${c}.log`,errtype:t,evetid:70017,sesid:c,sessionId:c,stat_log_id:`${c}-70017`})}start(c){this.authInfo=c,this.logClient.start(c)}updateToken(c,e){this.logClient.updateToken(c,e),or.getLogClient().updateToken(c,e)}stop(){this.logClient.stop()}reportPublishMonitor(c,e,t,i,r){const n=t.msid;if(!n||r.length<=0)return;const o=n===Z.Audio,a={ctm:Math.floor(r[0].timestamp||0)},u=[],h=[],g=[],f=[],d=[],p=[],l=[],m=[],x=[],v=[],b=[],w=[],_=[],C=[],E=[],I=[],L=[],k=[],N=[];try{if(r.forEach(R=>{var O,K,be,he,re,Ae;if(!R)return;const M=(O=R._last)!=null&&O.timestamp?R.timestamp-R._last.timestamp:1e3,y=je(R,"bytesSent"),V=je(R,"headerBytesSent"),Q=Dt(Fe(y+V,8,2e7),M);u.push(Q);const q=Dt(Fe(y,8,2e7),M);h.push(q);const ne=Dt(Fe(V,8,2e7),M);g.push(ne);const $=je(R,"packetsSent"),ie=Dt($,M);f.push(ie);const D=je(R,"packetsLost"),B=Dt(D,M);d.push(B);const z=Si(D,$);if(p.push(z),o)(K=R._source)!=null&&K.audioLevel&&l.push(No(R._source.audioLevel)),m.push(0);else{x.push(Fo(R,"totalEncodeTime")),v.push(_i((be=R._source)==null?void 0:be.framesPerSecond,100)),b.push(_i((he=R._source)==null?void 0:he.framesPerSecond,100)),w.push(_i(R.framesPerSecond,100)),_.push(_i((re=R._source)==null?void 0:re.height,4400)),C.push(_i((Ae=R._source)==null?void 0:Ae.width,7700)),E.push(_i(R.frameHeight,4400)),I.push(_i(R.frameWidth,7700));const Le=je(R,"totalPacketSendDelay");L.push(Fe(Le,1/(D||1),2e3));const Pe=je(R,"qpSum");k.push(Fe(Pe,1/(R.framesPerSecond||1),51)),N.push(0)}}),a.sbr=u.join(","),a.mbrs=h.join(","),a.pbrs=g.join(","),a.ps=f.join(","),a.pl=d.join(","),a.plr=p.join(","),o){const R=(i==null?void 0:i.getSettings().sampleRate)||0;a.ailevel=l.join(","),a.arpc=m.join(","),a.arsr=R,a.aesr=R,a.publevel=-90,a.rawlevel=-90}else a.em=x.join(","),a.cfps=v.join(","),a.ifps=b.join(","),a.sfps=w.join(","),a.ih=_.join(","),a.iw=C.join(","),a.sh=E.join(","),a.sw=I.join(","),a.sd=L.join(","),a.aqp=k.join(","),a.caf=N.join(","),a.can=N.join(","),a.cav=h.join(","),a.ifimax=N.join(","),a.ifimin=N.join(","),a.efimax=N.join(","),a.efimin=N.join(","),a.sfimax=N.join(","),a.sfimin=N.join(","),a.apsnr=N.join(",")}catch(R){}this.log({evetid:10070,traceid:e,calid:c,args:this.data2String(Ce({calid:c,tckid:n,traceid:e,src:t.ssrc,codec:t.codec},a))})}reportSubscribeMonitor(c,e,t,i,r){const n=i.msid;if(!n||r.length<=0)return;const o=n===Z.Audio,a={ctm:Math.floor(r[0].timestamp||0)},u=[],h=[],g=[],f=[],d=[],p=[],l=[],m=[],x=[],v=[],b=[],w=[],_=[],C=[],E=[],I=[],L=[],k=[],N=[],R=[],M=[],y=[],V=[],Q=[],q=[],ne=[],$=[],ie=[],D=[],B=[],z=[],O=[],K=[],be=[];try{r.forEach(he=>{var Y,pe;if(!he)return;const re=(Y=he._last)!=null&&Y.timestamp?he.timestamp-he._last.timestamp:1e3,Ae=je(he,"bytesReceived"),Le=je(he,"headerBytesReceived"),Pe=Dt(Fe(Ae+Le,8,2e7),re);u.push(Pe);const We=Dt(Fe(Ae,8,2e7),re);h.push(We);const Oe=Dt(Fe(Le,8,2e7),re);g.push(Oe);const S=je(he,"packetsReceived"),G=Dt(S,re);f.push(G);const W=je(he,"packetsLost"),P=Dt(W,re);d.push(P);const T=Si(W,S);p.push(T);const F=Fe(he.jitterBufferDelay,1e3/he.jitterBufferEmittedCount,3e4);l.push(F);const X=je(he,"fecPacketsReceived");w.push(Si(X,S));const J=je(he,"retransmittedPacketsReceived"),U=S+W-J;if(x.push(Si(S-J,U)),v.push(Si(W,U)),m.push(Si(J,U)),b.push(U),K.push(0),be.push(""),o){C.push(No(he.audioLevel));const ee=Tu(he,"synthesizedSamplesEvents");E.push(ee);const _e=Fo(he,"synthesizedSamplesDuration");I.push(_e);const Te=Si(_e,re);_.push(Te),L.push(0)}else{const ee=(pe=he._last)!=null&&pe.totalInterFrameDelay?he.totalInterFrameDelay-he._last.totalInterFrameDelay:0;k.push(Fe(ee,1e3/(he.framesDecoded||30),500)),N.push(Fe(he.framesPerSecond,1,100)),R.push(Fe(he.framesPerSecond,1,100)),M.push(Fe(he.frameHeight,1,4400)),y.push(Fe(he.frameWidth,1,7700));const _e=je(he,"totalProcessingDelay");V.push(Fe(_e,1e3/(he.framesDecoded||30),12e4));const Te=je(he,"nackCount");q.push(Te);const Re=je(he,"pliCount");Q.push(Re);const nt=je(he,"qpSum");ne.push(Fe(nt,1/(he.framesPerSecond||1),51)),$.push(Fe(he.framesDropped));const Wt=je(he,"totalFreezesDuration");ie.push(Fe(Wt,1e3,3e4));const Ke=je(he,"jitterBufferEmittedCount"),Et=je(he,"jitterBufferDelay");D.push(Fe(Et,1e3/(Ke||1),3e4));const Ue=je(he,"jitterBufferTargetDelay");B.push(Fe(Ue,1e3/(Ke||1),3e4));const Zt=je(he,"jitterBufferMinimumDelay");z.push(Fe(Zt,1e3/(Ke||1),3e4)),O.push(Fe(he.framesPerSecond,1,100))}}),a.rbr=u.join(","),a.mbrs=h.join(","),a.pbrs=g.join(","),a.pr=f.join(","),a.pl=d.join(","),a.plr=p.join(","),a.jd=l.join(","),a.fecr=w.join(","),a.retransr=m.join(","),a.baser=x.join(","),a.basel=v.join(","),a.recoverr=K.join(","),a.alll=v.join(","),a.totalc=b.join(","),o?(a.er=_.join(","),a.aolevel=C.join(","),a.asrc=L.join(","),a.scnt=E.join(","),a.sdura=I.join(",")):(a.dm=k.join(","),a.dfps=N.join(","),a.rfps=R.join(","),a.rh=M.join(","),a.rw=y.join(","),a.fpt=be.join(","),a.ns=q.join(","),a.pliss=Q.join(","),a.aqp=ne.join(","),a.ofimax=K.join(","),a.ofimin=K.join(","),a.dfimax=K.join(","),a.dfimin=K.join(","),a.rfimax=K.join(","),a.rfimin=K.join(","),a.vrstutter=ie.join(","),a.cdm=D.join(","),a.tdm=B.join(","),a.pdm=z.join(","),a.ofps=O.join(","),a.dfbd=$.join(","))}catch(he){}this.log({evetid:10080,traceid:t,rmtid:e,calid:c,args:this.data2String(Ce({calid:c,rmtid:e,tckid:n,traceid:t,src:i.ssrc,codec:i.codec},a))})}reportNetworkMonitor(c){if(c.length<=0)return;const e=[],t=[],i=[],r=[],n=[],o=[],a=[],u=[],h=[],g=[];c.forEach((d,p)=>{var m;const l=(m=d._last)!=null&&m.timestamp?d.timestamp-d._last.timestamp:1e3;e.push(Fe(d.currentRoundTripTime,1e3)),t.push(Fe(d.availableOutgoingBitrate,8,2e8)),i.push(Dt(Fe(d.bytesSent,8,2e7),l,25e6)),r.push(Dt(Fe(d.bytesReceived,8,2e7),l,25e6)),n.push(0),o.push(0),p%5===0&&(a.push(""),u.push(""),h.push(""),g.push(""))});const f={ctm:Math.floor(c[0].timestamp||0),rtt:e.join(","),bsps:i.join(","),brps:r.join(","),cpu:a.join(","),mem:u.join(","),sysmem:h.join(","),systotalmem:g.join(","),audioonly:this.engine.isAudioOnly()?1:0};this.log({evetid:10071,args:this.data2String(Ce({asb:t.join(","),abms:n.join(","),vbms:o.join(",")},f))}),this.log({evetid:10081,args:this.data2String(Ce({},f))})}reportJoin(c,e,t=""){var g,f;const{start:i,rs:r=0,re:n=0}=e,o=Date.now()-i,a=n-r;let u=0;r&&(u=r-i);let h=0;n&&(h=n-r),this.log({evetid:10010,args:this.data2String({sesid:((g=this.authInfo)==null?void 0:g.sessionId)||"",joitm:o,rslt:c,gslbtm:0,dnstm:0,avcftm:0,gslbrslt:0,dnsrslt:0,avcfrslt:0,mode:2,jrtc:a,usrn:(f=this.authInfo)==null?void 0:f.userId,mgt:"cdn",cttc:u,iptc:h,ndn:1,gslbloc:1,ccag:0,ucag:0,cpg:0,upg:0,tid:t})})}reportJoinConnection(c){this.log({evetid:20002,args:this.data2String(Ce({transretrynum:0,ldnstc:0,tcptc:0,ssltc:0,url:""},c))})}reportLeave(c,e,t){this.log({evetid:10020,args:this.data2String({lvetm:c,rslt:e,tid:t})})}reportPublish(c,e,t,i,r,n,o,a,u,h,g){this.log({evetid:c?10032:10030,calid:t,args:this.data2String({calid:t,url:e,isvl:i?1:0,isvs:r?1:0,isvss:n?1:0,isaudio:o?1:0,rslt:a,tid:"123",pubtm:Date.now()-g,pctid:u,pubtid:h,isvp:0,isarecording:0,isad:0,isdc:0,pubretry:0,pbrttimes:0})})}reportPublishFirstPacket(c,e,t,i,r,n,o,a,u){const h=Date.now();this.log({evetid:c?10033:10031,calid:e,args:this.data2String({calid:e,fpst:h-t,tckid:n,est:t,pctid:o,pubtid:a,totaltm:h-r,jorm:u===di.JOINCHANNEL?1:0,cptc:0,sptc:i-t,iptc:0,ipc2fptc:0,dctc:0,patc:0})})}reportUnpublish(c,e,t,i){var r;this.log({evetid:10040,args:this.data2String({calid:c,unpubtm:e,rslt:t,tid:i,sesid:((r=this.authInfo)==null?void 0:r.sessionId)||""})})}reportSubscribe(c,e,t,i,r,n,o,a,u,h){this.log({evetid:10050,calid:c,rmtid:e,args:this.data2String(Ce({calid:c,rmtid:e,isvl:t?1:0,isvs:i?1:0,isvss:r?1:0,isaudio:n?1:0,rslt:o,tid:a,subtm:u,isvp:0,isaplaying:0,isad:0,isdc:0,subretry:0,sbrttimes:0},h))})}reportSubscribeFirstPacket(c,e,t,i,r){this.log({evetid:c?10054:10051,calid:e,rmtid:t,args:this.data2String(Ce({calid:e,rmtid:t,tckid:i,cptc:0,iptc:0,ipc2fptc:0,dctc:0,patc:0},r))})}reportSubscribeFirstFrame(c,e,t,i,r){this.log({evetid:c?10055:10052,calid:e,rmtid:t,args:this.data2String(Ce({calid:e,rmtid:t,tckid:i},r))}),this.log({evetid:c?10058:10057,args:this.data2String(Ce({calid:e,rmtid:t,tckid:i},r))})}reportUnsubscribe(c,e,t,i,r){this.log({evetid:10060,calid:c,args:this.data2String({calid:c,rmtid:e,unsubtm:t,rslt:i,tid:r})})}reportMute(c,e,t){this.log({evetid:11030,args:this.data2String({calid:c,rmtid:"",enable:e?1:0,mt:t})})}reportRoleUpdate(c,e){this.log({evetid:11040,args:this.data2String({or:c||"",nr:e,ctm:Date.now(),rslt:0})})}reportRoleUpdateResult(c,e,t,i){this.log({evetid:11041,args:this.data2String({or:c||"",nr:e,ctm:t,rslt:i})})}reportVideoProfile(c){this.log({evetid:20074,args:this.data2String({pf:c,tckid:"sophon_camera_large"})})}reportScreenProfile(c){this.log({evetid:20074,args:this.data2String({pf:c,tckid:"sophon_screenshare"})})}reportError(c){this.log({evetid:10091,args:this.data2String({rslt:c.code||-1})})}reportWarning(c){this.log({evetid:10092,args:this.data2String({rslt:-1,errmsg:c})})}reportRoomServerEvent(c,e,t,i){this.log({evetid:20005,args:this.data2String({calid:"",rmtid:"",rt:c?0:1,dr:c?"s":"r",mt:e,ri:t,cs:1,srt:Date.now(),rspc:i.code||"",mc:JSON.stringify(i)})})}reportTranscodingError(c,e){this.log({evetid:10101,args:this.data2String({rslt:c,taskid:e})})}reportBye(c){var e;this.log({evetid:10093,args:this.data2String({rslt:c,sesid:((e=this.authInfo)==null?void 0:e.sessionId)||""})})}reportAudio(c,e,t){var i;this.log({evetid:80013,args:this.data2String({rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})}),this.log({evetid:80014,args:this.data2String({sesid:((i=this.authInfo)==null?void 0:i.sessionId)||"",rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})})}reportScreen(c,e){var t,i;this.log({evetid:90013,args:this.data2String({rslt:c?-1:0,vcms:e,vde:c.code?c.code:-1,sesid:((t=this.authInfo)==null?void 0:t.sessionId)||""})}),this.log({evetid:90014,args:this.data2String({rslt:c?-1:0,vcms:e,vde:c.code?c.code:-1,sesid:((i=this.authInfo)==null?void 0:i.sessionId)||""})})}reportScreenStop(c){this.log({evetid:90019,args:this.data2String({rslt:c?c.code||-1:0})}),this.log({evetid:90020,args:this.data2String({rslt:c?c.code||-1:0})})}reportSwitchCamera(c){var e;this.log({evetid:90025,args:this.data2String({rslt:0,td:c,sesid:((e=this.authInfo)==null?void 0:e.sessionId)||""})})}reportPublishProfile(c,e){this.log({evetid:10201,args:this.data2String(Ce({tckid:c},e))})}reportSDKCreated(c){this.log({evetid:70011,createtm:Date.now()-c,tm:c})}reportJoinInvoked(c){this.log({evetid:70012,jnnonce:c.nonce||"",jntoken:c.token||"",jntm:c.timestamp||""})}reportJoinResult(c){this.log({evetid:70013,rslt:c?c.code||-1:0,dnsrslt:0})}reportSTSResult(c){this.log({evetid:70014,rslt:c,asty:1})}reportLeaveInvoked(){this.log({evetid:70015})}reportSEIMessage(c,e,t,i,r){this.log({evetid:40301,args:this.data2String({tm:Date.now(),sei_pt:c,sei_len:e,sei_rep:t,sei_delay:i,sei_key:r})})}log(c){c&&(c.tm=new Date().getTime(),le.debug("[ConsoleLogger]","log",c),this.logClient.sendReport(c))}data2String(c){let e="";for(let t in c)e.length&&(e+="&"),e+=t+"="+c[t];return e}};A(or,"staticClient");let Zi=or;var mn=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.API=2]="API",s[s.WARNING=3]="WARNING",s[s.ERROR=4]="ERROR",s[s.NONE=5]="NONE",s))(mn||{});class Tr{constructor(){A(this,"dbPromise");A(this,"stsToken");A(this,"enable");A(this,"logLevel");A(this,"logToConsole");A(this,"logToServer");A(this,"appId");A(this,"sessionId");A(this,"logCache",[]);A(this,"logMethod",(c,e=console.log)=>(...t)=>{if(!this.enable||this.logLevel>c)return;let i=this.getCurrentTime();this.logToConsole&&e(i,...t);let r=Tr.paramArrayToString(t);c>0&&this.addLog(r)});A(this,"d",this.logMethod(0,console.debug));A(this,"i",this.logMethod(1));A(this,"w",this.logMethod(3,console.warn));A(this,"e",this.logMethod(4,(...c)=>{const[e,...t]=c;console.error(e,"<error>",t)}));A(this,"ev",this.logMethod(2));A(this,"a",this.logMethod(2,(...c)=>{const[e,...t]=c;if(t.length>2){const i=`${t[1]}`;i.startsWith("__g__")&&console.group(`${i.substring(5)}_${t[2]}`)}console.log(e,...t)}));A(this,"ar",this.logMethod(2,(...c)=>{const[e,...t]=c;console.log(e,...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));A(this,"ae",this.logMethod(2,(...c)=>{const[e,...t]=c;console.error(e,"<error>",...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));this.logLevel=3,this.logToConsole=!0,this.logToServer=!1,this.appId="",this.sessionId="",this.enable=!0,this.dbPromise=f0()}static toString(c){let e;if(c instanceof Error)e=c.message;else if(typeof c=="string")e=c;else try{e=JSON.stringify(c)}catch(t){e="undefined"}return e}changeConfig(c){c.enable!==void 0&&(this.enable=c.enable),c.logLevel!==void 0&&c.logLevel>=0&&c.logLevel<=5&&(this.logLevel=c.logLevel),c.logToConsole!==void 0&&(this.logToConsole=c.logToConsole),c.logToServer!==void 0&&(this.logToServer=c.logToServer)}updateSTSToken(c){const e=!!this.stsToken;this.stsToken=c,!e&&c&&this.tryUploadHistorySessionLog()}updateSessionDateLog(c,e,t){return H(this,null,function*(){if(!c||!e||!t||t.length===0||!this.stsToken)return;const i=new Qc;i.file(`${c}.log`,t.map(f=>f.log||"").join(`
38
- `));const r=yield i.generateAsync({type:"blob"}),n=yield C0(r),o=ps(new Date,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),a={"x-oss-date":o,"content-md5":n,"content-type":"application/zip"};a.date=o,a["x-oss-security-token"]=this.stsToken.security_token;const u=`client/${e}/${this.appId}/${c}.zip`;a.authorization=yield R0(this.stsToken.access_key_id,this.stsToken.access_key_secret,a,`/${this.stsToken.bucket_name}/${u}`);const h=`https://${this.stsToken.bucket_name}.${this.stsToken.region_endpoint}/${u}`,g=yield fetch(h,{method:"PUT",headers:a,body:r});if(g.status===200){Zi.reportOSSUpload(c,e);const f=yield this.dbPromise;t.forEach(d=>{g0(f,d.id)})}else Zi.reportOSSUpload(c,e,g.status)})}uploadSessionLog(c){c&&this.dbPromise.then(e=>H(this,null,function*(){if(!this.stsToken)return;const t=yield xa(e,c),i={},r=[];t.forEach(n=>{const o=n.date;i[o]||(i[o]=[],r.push(o)),i[o].push(n)}),Promise.all(r.map(n=>this.updateSessionDateLog(c,n,i[n]))).then(()=>H(this,null,function*(){(yield xa(e,c)).length===0&&v0(e,c)}))}))}tryUploadHistorySessionLog(){this.dbPromise.then(c=>H(this,null,function*(){(yield m0(c)).filter(t=>t.sid!==this.sessionId).forEach(t=>{this.uploadSessionLog(t.sid)})}))}uploadCurrent(){this.uploadSessionLog(this.sessionId)}setSessionID(c,e){!c||!e||(this.appId=c,this.dbPromise.then(t=>{this.sessionId=e,p0(t,e),this.logCache&&(this.logCache.forEach(i=>{va(t,this.sessionId,i.date,`${i.log}`)}),this.logCache=[])}))}addLog(c){const e=this.getCurrentTime(),t=this.getCurrentDate(),i=`${e} ${c}`;this.sessionId?this.dbPromise.then(r=>{va(r,this.sessionId,t,i)}):this.logCache.push({date:t,log:i})}getCurrentTime(){return ps(new Date,"HH:MM:ss.l")}getCurrentDate(){return ps(new Date,"yyyymmdd")}static paramArrayToString(c){let e="";for(let t=0;t<c.length;t++){e!==""&&(e+=" ");let i=Tr.toString(c[t]);e+=i}return e}}class le{static getLogger(){return this.logger||(this.logger=new Tr),this.logger}static setLogLevel(c){this.getLogger().changeConfig({logLevel:c})}static config(c){this.getLogger().changeConfig(c)}static updateToken(c){this.getLogger().updateSTSToken(c)}static setSessionID(c,e){this.getLogger().setSessionID(c,e)}static uploadLog(){this.getLogger().uploadCurrent()}static interface(...c){this.getLogger().a("[API]",...c)}static interfaceResult(c,e,t,...i){t?this.getLogger().ar("[ARE]",c,e,...i):this.getLogger().ae("[ARE]",c,e,...i)}static event(...c){this.getLogger().ev("[EVT]",...c)}static debug(...c){this.getLogger().d("[DBG]",...c)}static info(...c){this.getLogger().i("[INF]",...c)}static warn(...c){this.getLogger().w("[WARN]",...c)}static error(...c){this.getLogger().e("[ERR]",...c)}}A(le,"logger");const Du=s=>H(this,null,function*(){const c=new ye.AliRTS.SupportUtil;let e={support:!1,detail:{isWebRTCSupported:c.checkMediaDevices()&&c.checkWebRtcSupport(),isH264DecodeSupported:!1,isH264EncodeSupported:!1,isScreenShareSupported:!1,isSendMediaExtensionMsgSupported:!1,isBrowserSupported:c.checkBrowser({errorCode:0,message:""})}};if(e.support=e.detail.isWebRTCSupported&&e.detail.isBrowserSupported,c.checkWebRtcSupport()&&s!=="sendonly"){const t=yield c.checkH264Decode();e.detail.isH264DecodeSupported=t,e.support=e.support&&t}if(c.checkWebRtcSupport()&&s!=="recvonly"){const t=yield c.checkH264Encode();e.detail.isH264EncodeSupported=t,e.support=e.support&&t}return e.detail.isScreenShareSupported=c.checkWebRtcSupport()&&c.checkScreenCapture()&&!ye.AliRTS.SystenUtil.isAndroid&&!ye.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=c.checkWebRtcSupport()&&c.checkEncodedTransformSupport(),e});var Qe=(s=>(s[s.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",s[s.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",s))(Qe||{}),Oo=(s=>(s[s.PRE_PROCESSOR=0]="PRE_PROCESSOR",s[s.POST_PROCESSOR=1]="POST_PROCESSOR",s))(Oo||{}),Dr=(s=>(s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO",s[s.BOTH=2]="BOTH",s))(Dr||{});class Fi extends we{constructor(e,t=Qe.AliRtcSdkStreamTypeCapture,i=1){super();A(this,"name");A(this,"options");A(this,"type",0);A(this,"streamType");A(this,"trackType");A(this,"zIndex",1);A(this,"_isEnable",!0);A(this,"lastInputAudioTrack");A(this,"lastOutputAudioTrack");A(this,"lastInputVideoTrack");A(this,"lastOutputVideoTrack");A(this,"_hasCleared",!0);this.name=e,this.streamType=t,this.trackType=i,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}init(){return H(this,null,function*(){})}enable(){this._isEnable||(this._isEnable=!0,this.init(),this.emit("enabled"))}disable(){this._isEnable&&(this._isEnable=!1,this.clear(),this.emit("disabled"))}get isEnable(){return this._isEnable}audioUpdated(e){var t,i;return((t=this.lastInputAudioTrack)==null?void 0:t.id)!==((i=e.currentAudioTrack)==null?void 0:i.id)}videoUpdated(e){var t,i;return((t=this.lastInputVideoTrack)==null?void 0:t.id)!==((i=e.currentVideoTrack)==null?void 0:i.id)}execute(e,t){return H(this,null,function*(){const i=this.shouldUpdate(e,t);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,this._hasCleared||i?(yield this.process(e,t),this._hasCleared=!1):(this.lastOutputAudioTrack&&(this.trackType===2||this.trackType===0)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===2||this.trackType===1)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack})}clear(e){this._hasCleared=!0,this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}var Yi=(s=>(s[s.LiveTranscodingSingle=0]="LiveTranscodingSingle",s[s.LiveTranscodingMix=1]="LiveTranscodingMix",s))(Yi||{}),gn=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingAudio=1]="LiveTranscodingAudio",s[s.LiveTranscodingVideo=2]="LiveTranscodingVideo",s))(gn||{}),Oi=(s=>(s[s.LiveTranscodingCamera=0]="LiveTranscodingCamera",s[s.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",s))(Oi||{});const Qi={0:"camera",1:"shareScreen"};var vn=(s=>(s[s.LiveTranscoding_Profile_1IN_1080P=0]="LiveTranscoding_Profile_1IN_1080P",s[s.LiveTranscoding_Profile_1IN_720P=1]="LiveTranscoding_Profile_1IN_720P",s[s.LiveTranscoding_Profile_1IN_360P=2]="LiveTranscoding_Profile_1IN_360P",s[s.LiveTranscoding_Profile_2IN_1080P=3]="LiveTranscoding_Profile_2IN_1080P",s[s.LiveTranscoding_Profile_2IN_720P=4]="LiveTranscoding_Profile_2IN_720P",s[s.LiveTranscoding_Profile_2IN_360P=5]="LiveTranscoding_Profile_2IN_360P",s[s.LiveTranscoding_Profile_4IN_1080P=6]="LiveTranscoding_Profile_4IN_1080P",s[s.LiveTranscoding_Profile_4IN_720P=7]="LiveTranscoding_Profile_4IN_720P",s[s.LiveTranscoding_Profile_4IN_360P=8]="LiveTranscoding_Profile_4IN_360P",s[s.LiveTranscoding_Profile_9IN_1080P=9]="LiveTranscoding_Profile_9IN_1080P",s[s.LiveTranscoding_Profile_9IN_720P=10]="LiveTranscoding_Profile_9IN_720P",s[s.LiveTranscoding_Profile_9IN_360P=11]="LiveTranscoding_Profile_9IN_360P",s[s.LiveTranscoding_Profile_12IN_1080P=12]="LiveTranscoding_Profile_12IN_1080P",s[s.LiveTranscoding_Profile_12IN_720P=13]="LiveTranscoding_Profile_12IN_720P",s[s.LiveTranscoding_Profile_12IN_360P=14]="LiveTranscoding_Profile_12IN_360P",s[s.LiveTranscoding_Profile_16IN_1080P=15]="LiveTranscoding_Profile_16IN_1080P",s[s.LiveTranscoding_Profile_16IN_720P=16]="LiveTranscoding_Profile_16IN_720P",s[s.LiveTranscoding_Profile_16IN_360P=17]="LiveTranscoding_Profile_16IN_360P",s[s.LiveTranscoding_Profile_Mixed=9999]="LiveTranscoding_Profile_Mixed",s))(vn||{});const Bu={0:"1IN_1080P",1:"1IN_720P",2:"1IN_360P",3:"2IN_1080P",4:"2IN_720P",5:"2IN_360P",6:"4IN_1080P",7:"4IN_720P",8:"4IN_360P",9:"9IN_1080P",10:"9IN_720P",11:"9IN_360P",12:"12IN_1080P",13:"12IN_720P",14:"12IN_360P",15:"16IN_1080P",16:"16IN_720P",17:"16IN_360P",9999:"Mixed_Audio"};var Br=(s=>(s[s.LiveTranscoding_HZ_48000=48e3]="LiveTranscoding_HZ_48000",s[s.LiveTranscoding_HZ_44100=44100]="LiveTranscoding_HZ_44100",s[s.LiveTranscoding_HZ_32000=32e3]="LiveTranscoding_HZ_32000",s[s.LiveTranscoding_HZ_16000=16e3]="LiveTranscoding_HZ_16000",s[s.LiveTranscoding_HZ_8000=8e3]="LiveTranscoding_HZ_8000",s))(Br||{}),er=(s=>(s[s.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",s[s.LiveTranscodingBody=1]="LiveTranscodingBody",s))(er||{}),tr=(s=>(s[s.NOTO_SERIF_CJKSC_REGULAR=0]="NOTO_SERIF_CJKSC_REGULAR",s[s.ALIBABA_PUHUITI_REGULAR=1]="ALIBABA_PUHUITI_REGULAR",s[s.ALIBABA_PUHUITI_BOLD=2]="ALIBABA_PUHUITI_BOLD",s[s.ALIBABA_PUHUITI_Heavy=3]="ALIBABA_PUHUITI_Heavy",s[s.ALIBABA_PUHUITI_LIGHT=4]="ALIBABA_PUHUITI_LIGHT",s[s.ALIBABA_PUHUITI_MEDIUM=5]="ALIBABA_PUHUITI_MEDIUM",s))(tr||{}),xn=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingCrop=1]="LiveTranscodingCrop",s[s.LiveTranscodingFill=2]="LiveTranscodingFill",s))(xn||{}),Pr=(s=>(s[s.LiveTranscodingNormal=0]="LiveTranscodingNormal",s[s.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",s))(Pr||{}),bn=(s=>(s[s.LiveTranscodingState_IDLE=0]="LiveTranscodingState_IDLE",s[s.LiveTranscodingState_CONNNECT=1]="LiveTranscodingState_CONNNECT",s[s.LiveTranscodingState_RUNNING=2]="LiveTranscodingState_RUNNING",s[s.LiveTranscodingState_RECOVERING=3]="LiveTranscodingState_RECOVERING",s[s.LiveTranscodingState_FAILURE=4]="LiveTranscodingState_FAILURE",s[s.LiveTranscodingState_END=5]="LiveTranscodingState_END",s))(bn||{}),zt=(s=>(s[s.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",s[s.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",s[s.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",s[s.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",s[s.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",s[s.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",s[s.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",s[s.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",s[s.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",s))(zt||{}),Sn=(s=>(s[s.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",s[s.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",s[s.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",s))(Sn||{}),xt=(s=>(s[s.MPU_TASK_TRANSACTION_START=0]="MPU_TASK_TRANSACTION_START",s[s.MPU_TASK_TRANSACTION_UPDATE=1]="MPU_TASK_TRANSACTION_UPDATE",s[s.MPU_TASK_TRANSACTION_STOP=2]="MPU_TASK_TRANSACTION_STOP",s[s.MPU_TASK_TRANSACTION_LIST=3]="MPU_TASK_TRANSACTION_LIST",s[s.MPU_TASK_TRANSACTION_POLLING=4]="MPU_TASK_TRANSACTION_POLLING",s[s.MPU_TASK_TRANSACTION_ACKNOWLEDGE=5]="MPU_TASK_TRANSACTION_ACKNOWLEDGE",s[s.MPU_TASK_TRANSACTION_END=6]="MPU_TASK_TRANSACTION_END",s))(xt||{});const Pu={0:"/libra/v1/sdk/start-task",1:"/libra/v1/sdk/update-task",2:"/libra/v1/sdk/stop-task",3:"/libra/v1/sdk/list-task",4:"/libra/v1/sdk/polling",5:"/libra/v1/sdk/acknowledge",6:"/"};class _n{constructor(c,e,t,i,r,n,o,a){A(this,"videoWidth");A(this,"videoHeight");A(this,"videoFramerate",20);A(this,"videoBitrate",2e3);A(this,"videoGop",30);A(this,"audioSamplerate",Br.LiveTranscoding_HZ_44100);A(this,"audioBitrate",500);A(this,"audioChannels",1);this.videoWidth=c,this.videoHeight=e,t&&(this.videoFramerate=t),i&&(this.videoBitrate=i),r&&(this.videoGop=r),n&&(this.audioSamplerate=n),o&&(this.audioBitrate=o),a&&(this.audioChannels=a)}}const yn=s=>((s&16711680)>>16)+(s&65280)+((s&255)<<16),Bt=(s=0,c)=>{if(c==0)return 0;let e=s/c;return e<0&&(e=0),e>1&&(e=1),e};class Lr{constructor(c,e,t){A(this,"mixMode",Yi.LiveTranscodingSingle);A(this,"singleParam");A(this,"mixParam");c&&(this.mixMode=c),e&&(this.singleParam=e),t&&(this.mixParam=t)}toJson(c,e,t,i,r){const n={appid:e.appId,channelid:e.channelId};if(c===xt.MPU_TASK_TRANSACTION_POLLING||c===xt.MPU_TASK_TRANSACTION_LIST||c===xt.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return c===xt.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=r),n;if(n.taskid=t,c!==xt.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,i&&(n.streamurl=i),this.mixMode===Yi.LiveTranscodingSingle){const o=this.singleParam;if(o){n.streamtype=o.streamType,o.sourceType===Oi.LiveTranscodingShareScreen?n.sourcetype=Qi[o.sourceType]:n.sourcetype=Qi[Oi.LiveTranscodingCamera];const a=[];o.userId&&a.push(o.userId),n.subspecusers=a}}else if(c===xt.MPU_TASK_TRANSACTION_START||c===xt.MPU_TASK_TRANSACTION_UPDATE){const o=this.mixParam;if(o){o.taskProfile&&(n.taskprofile=Bu[o.taskProfile]);const a=o.encodeParam||new _n(1280,720);let u=a.videoWidth,h=a.videoHeight;const g={};Object.keys(a).forEach(d=>{const p=a[d];p>0&&(g[d.toLowerCase()]=p)}),g.lowbitratehighquality=0,n.encodeparam=g,n.backgrounds=o.backgrounds.map(d=>d.toJson(u,h)),n.watermarks=o.watermarks.map(d=>d.toJson(u,h)),n.clockwidgets=o.clockWidgets.map(d=>d.toJson(u,h));const f=o.users.map(d=>d.userId);n.subspecusers=[...new Set(f)],n.layouts=[{audiomixcount:o.users.length,panes:o.users.map((d,p)=>d.toJson(p,u,h,o.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=o.cropMode,n.backgroundcolor=yn(o.backgroundColor),n.taskmode=o.mediaProcessMode}}}return n}}var Jt=(s=>(s.pre="pre",s.prod="prod",s))(Jt||{}),Xt=(s=>(s.AliRtcSdkCommunication="communication",s.AliRtcSdkInteractiveLive="interactive_live",s.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",s))(Xt||{}),ni=(s=>(s.AliRtcSdkInteractive="interactive",s.AliRtcSdkLive="live",s))(ni||{}),jt=(s=>(s[s.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",s[s.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",s[s.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",s[s.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",s[s.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",s[s.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",s[s.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",s))(jt||{}),$e=(s=>(s[s.AliEngineLocalDeviceExceptionTypeUnknown=0]="AliEngineLocalDeviceExceptionTypeUnknown",s[s.AliEngineLocalDeviceExceptionTypeMicOpenFail=1]="AliEngineLocalDeviceExceptionTypeMicOpenFail",s[s.AliEngineLocalDeviceExceptionTypeMicInterrupt=2]="AliEngineLocalDeviceExceptionTypeMicInterrupt",s[s.AliEngineLocalDeviceExceptionTypeMicAuthFail=3]="AliEngineLocalDeviceExceptionTypeMicAuthFail",s[s.AliEngineLocalDeviceExceptionTypeMicNotAvailable=4]="AliEngineLocalDeviceExceptionTypeMicNotAvailable",s[s.AliEngineLocalDeviceExceptionTypeSpeakerOpenFail=5]="AliEngineLocalDeviceExceptionTypeSpeakerOpenFail",s[s.AliEngineLocalDeviceExceptionTypeSpeakerInterrupt=6]="AliEngineLocalDeviceExceptionTypeSpeakerInterrupt",s[s.AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable=7]="AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable",s[s.AliEngineLocalDeviceExceptionTypeAudioDeviceException=8]="AliEngineLocalDeviceExceptionTypeAudioDeviceException",s[s.AliEngineLocalDeviceExceptionTypeCameraOpenFail=9]="AliEngineLocalDeviceExceptionTypeCameraOpenFail",s[s.AliEngineLocalDeviceExceptionTypeCameraInterrupt=10]="AliEngineLocalDeviceExceptionTypeCameraInterrupt",s[s.AliEngineLocalDeviceExceptionTypeCameraAuthFail=11]="AliEngineLocalDeviceExceptionTypeCameraAuthFail",s[s.AliEngineLocalDeviceExceptionTypeDisplayException=12]="AliEngineLocalDeviceExceptionTypeDisplayException",s[s.AliEngineLocalDeviceExceptionTypeVideoDeviceException=13]="AliEngineLocalDeviceExceptionTypeVideoDeviceException",s))($e||{}),Ne=(s=>(s[s.AliRtcConnectionStatusInit=0]="AliRtcConnectionStatusInit",s[s.AliRtcConnectionStatusDisconnected=1]="AliRtcConnectionStatusDisconnected",s[s.AliRtcConnectionStatusConnecting=2]="AliRtcConnectionStatusConnecting",s[s.AliRtcConnectionStatusConnected=3]="AliRtcConnectionStatusConnected",s[s.AliRtcConnectionStatusReconnecting=4]="AliRtcConnectionStatusReconnecting",s[s.AliRtcConnectionStatusFailed=5]="AliRtcConnectionStatusFailed",s))(Ne||{}),yi=(s=>(s[s.AliRtcConnectionChangedDummyReason=0]="AliRtcConnectionChangedDummyReason",s[s.AliRtcConnectionMediaPathChanged=1]="AliRtcConnectionMediaPathChanged",s[s.AliRtcConnectionSignalingHeartbeatTimeout=2]="AliRtcConnectionSignalingHeartbeatTimeout",s[s.AliRtcConnectionSignalingHeartbeatAlive=3]="AliRtcConnectionSignalingHeartbeatAlive",s[s.AliRtcConnectionSignalingHttpDnsResolved=4]="AliRtcConnectionSignalingHttpDnsResolved",s[s.AliRtcConnectionSignalingHttpDnsFailure=5]="AliRtcConnectionSignalingHttpDnsFailure",s[s.AliRtcConnectionSignalingGslbFailure=6]="AliRtcConnectionSignalingGslbFailure",s[s.AliRtcConnectionSignalingGslbSuccess=7]="AliRtcConnectionSignalingGslbSuccess",s[s.AliRtcConnectionSignalingJoinRoomFailure=8]="AliRtcConnectionSignalingJoinRoomFailure",s[s.AliRtcConnectionSignalingJoinRoomSuccess=9]="AliRtcConnectionSignalingJoinRoomSuccess",s[s.AliRtcConnectionSignalingLeaveRoom=10]="AliRtcConnectionSignalingLeaveRoom",s[s.AliRtcConnectionSignalingConnecting=11]="AliRtcConnectionSignalingConnecting",s[s.AliRtcConnectionChangedNetworkInterrupted=12]="AliRtcConnectionChangedNetworkInterrupted",s))(yi||{}),wn=(s=>(s[s.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",s[s.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",s[s.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",s))(wn||{}),Vi=(s=>(s[s.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",s[s.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",s[s.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",s))(Vi||{}),ke=(s=>(s[s.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",s[s.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",s[s.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",s[s.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",s))(ke||{}),Ee=(s=>(s[s.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",s[s.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",s[s.AliRtcStatePublishing=2]="AliRtcStatePublishing",s[s.AliRtcStatePublished=3]="AliRtcStatePublished",s))(Ee||{}),He=(s=>(s[s.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",s[s.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",s[s.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",s[s.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",s))(He||{}),rt=(s=>(s[s.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",s[s.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",s[s.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",s))(rt||{}),ir=(s=>(s[s.CAMERA_INVALID=-1]="CAMERA_INVALID",s[s.CAMERA_REAR=0]="CAMERA_REAR",s[s.CAMERA_FRONT=1]="CAMERA_FRONT",s))(ir||{});const Vo=10,Uo=5e3,Vr=class Vr extends we{constructor(e){super();A(this,"ws");A(this,"socketStatus",0);A(this,"wsUrl","");A(this,"lastConnectStartTime",0);A(this,"maxConnectRetryCount",Vo);A(this,"connectRetryCount",0);A(this,"gotErr",!1);A(this,"closedByInvoke",!0);A(this,"isReconnecting",!1);A(this,"networkAvailableChecked",!0);this.maxConnectRetryCount=e!=null?e:Vo,this.onOpen=this.onOpen.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),this.onClose=this.onClose.bind(this)}get connectUrl(){return this.wsUrl}get connectStatus(){return this.socketStatus}start(e){this.wsUrl=e,this.initWebSocket()}send(e){return this.ws&&this.socketStatus===2?(this.ws.send(JSON.stringify(e)),!0):!1}close(){this.closedByInvoke=!0,this.uninitWebscoket()}reconnect(){this.emit("onReconnectStart"),this.isReconnecting=!0,this.initWebSocket()}onOpen(e){this.socketStatus=2,this.connectRetryCount=0,this.networkAvailableChecked=!1,this.closedByInvoke=!1,this.gotErr=!1,this.isReconnecting=!1,this.emit("onOpen",e)}onMessage(e){this.emit("onMessage",e)}onError(e){this.isReconnecting&&this.emit("onReconnectFail",e),this.emit("onError",e),this.isReconnecting=!1,this.gotErr=!0}onClose(e){return H(this,null,function*(){const t=this.socketStatus;if(le.info(Vr.logName,`onClose, status: ${t}, retryCount: ${this.connectRetryCount}`),t!==0||this.connectRetryCount)if(yield Ut.isNetworkAvailable()){if(!this.networkAvailableChecked&&!this.closedByInvoke&&!this.gotErr){this.reconnect();return}this.networkAvailableChecked=!0,this.emit("onAuthInvalid")}else{if(this.connectRetryCount||this.emit("onNetworkError"),this.closedByInvoke)return;this.connectRetryCount+=1,this.connectRetryCount>this.maxConnectRetryCount?this.emit("onConnectFail"):Date.now()-this.lastConnectStartTime>=Uo?this.reconnect():window.setTimeout(()=>{this.reconnect()},Uo)}this.socketStatus=0,this.emit("onClose",e)})}initWebSocket(){this.uninitWebscoket(),this.socketStatus=1,this.lastConnectStartTime=Date.now(),this.ws=new WebSocket(this.wsUrl),this.ws.addEventListener("open",this.onOpen),this.ws.addEventListener("message",this.onMessage),this.ws.addEventListener("error",this.onError),this.ws.addEventListener("close",this.onClose)}uninitWebscoket(){this.ws&&(this.ws.removeEventListener("open",this.onOpen),this.ws.removeEventListener("message",this.onMessage),this.ws.removeEventListener("error",this.onError),this.ws.removeEventListener("close",this.onClose),this.ws.close(),this.ws=void 0,this.socketStatus=0)}};A(Vr,"logName","Socket");let An=Vr;var qe=(s=>(s.KEEPALIVE="keepalive",s.JOINCHANNEL="joinchannel",s.NOTIFYJOIN="notifyjoin",s.NOTIFYSTATUS="notifystatus",s.STATUSREPORT="statusreport",s.LEAVECHANNEL="leavechannel",s.NOTIFYLEAVE="notifyleave",s.NOTIFYPUBLISH="notifypublish",s.BYE="bye",s.RECONNECT="reconnect",s.PUBLISH="publish",s.REFRESHURL="refreshurl",s.UNSUBSCRIBE="unsubscribe",s.ROLEUPDATE="roleupdate",s))(qe||{});class Lu{constructor(c,e){A(this,"authInfo");A(this,"userName");A(this,"seqIndex",0);this.authInfo=c,this.userName=e}get roleAuth(){if(this.authInfo.role){const{timestamp:c,nonce:e,token:t,role:i}=this.authInfo;return{timestamp:c,nonce:e,token:t,tokenrole:i}}}refreshAuthInfo(c){this.authInfo=c}getSeqIndex(){return this.seqIndex}createKeepAlivePackage(){return this.createBaseSendPackage("keepalive")}createJoinPackage(){let c=this.createBaseSendPackage("joinchannel");return c.header.displayName=this.userName,c.header.clientversion=Ut.getVersionNumber().toString(),c.header.platform=oa,this.roleAuth&&(c.data.auth=this.roleAuth),c}crateLeavePackage(){return this.createBaseSendPackage("leavechannel")}createStatusPackage(c){let e=this.createBaseSendPackage("statusreport");return e.header.displayName=this.userName,e.data.status=c,e}createPublishPackage(){let c=this.createBaseSendPackage("publish");return c.data.users=[{}],this.roleAuth&&(c.data.auth=this.roleAuth),c}createRoleUpdatePackage(){let c=this.createBaseSendPackage("roleupdate");return c.header.displayName=this.userName,c}createReconnectPackage(c){let e=this.createBaseSendPackage("reconnect");return e.header.displayName=this.userName,e.header.clientversion=Ut.getVersionNumber().toString(),e.header.platform=oa,e.data=Ce(Ce({},e.data),c!=null?c:{}),this.roleAuth&&(e.data.auth=this.roleAuth),e}createRefreshUrlPackage(){let c=this.createBaseSendPackage("refreshurl");return c.header.displayName=this.userName,c}createResponsePackage(c,e){return{version:1,code:200,tid:c,msgtype:e}}createBaseSendPackage(c){var t;return++this.seqIndex,{version:1,msgtype:c,tid:fi(),header:{appid:this.authInfo.appId,channelid:this.authInfo.channelId,sessionid:(t=this.authInfo.sessionId)!=null?t:"",userid:this.authInfo.userId},data:{seq:this.seqIndex}}}}var de=(s=>(s[s.ERR_JOIN_ALREADY_JOINED=16843521]="ERR_JOIN_ALREADY_JOINED",s[s.ERR_JOIN_BAD_APPID=33620481]="ERR_JOIN_BAD_APPID",s[s.ERR_JOIN_INVALID_APPID=33620482]="ERR_JOIN_INVALID_APPID",s[s.ERR_JOIN_BAD_CHANNEL=33620484]="ERR_JOIN_BAD_CHANNEL",s[s.ERR_JOIN_INVALID_CHANNEL=33620483]="ERR_JOIN_INVALID_CHANNEL",s[s.ERR_JOIN_BAD_TOKEN=33620485]="ERR_JOIN_BAD_TOKEN",s[s.ERR_JOIN_TIMEOUT=16908804]="ERR_JOIN_TIMEOUT",s[s.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD=16974081]="ERR_JOIN_ERR_JOIN_BAD_PARAMBAD",s[s.ERR_JOIN_CHANNEL_FAILED=16974338]="ERR_JOIN_CHANNEL_FAILED",s[s.ERR_LOG_ALREADY_INIT=16974085]="ERR_LOG_ALREADY_INIT",s[s.ERR_LOG_ROOT_PATH_ERROR=16974086]="ERR_LOG_ROOT_PATH_ERROR",s[s.ERR_MIC_OPEN_FAIL=17040388]="ERR_MIC_OPEN_FAIL",s[s.ERR_SPEAKER_OPEN_FAIL=17040389]="ERR_SPEAKER_OPEN_FAIL",s[s.ERR_MIC_INTERRUPT=17040390]="ERR_MIC_INTERRUPT",s[s.ERR_SPEAKER_INTERRUPT=17040391]="ERR_SPEAKER_INTERRUPT",s[s.ERR_MIC_AUTH_FAIL=17040392]="ERR_MIC_AUTH_FAIL",s[s.ERR_MIC_NOT_AVAILABLE=17040393]="ERR_MIC_NOT_AVAILABLE",s[s.ERR_SPEAKER_NO_AVAILABLE=17040400]="ERR_SPEAKER_NO_AVAILABLE",s[s.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",s[s.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",s[s.ERR_VIDEO_DISPLAY_OPEN_FAIL=17039873]="ERR_VIDEO_DISPLAY_OPEN_FAIL",s[s.ERR_VIDEO_DISPLAY_INTERRUPT=1064992]="ERR_VIDEO_DISPLAY_INTERRUPT",s[s.ERR_ICE_CONNECTION_CONNECT_FAIL=17105409]="ERR_ICE_CONNECTION_CONNECT_FAIL",s[s.ERR_ICE_CONNECTION_RECONNECT_FAI=17105410]="ERR_ICE_CONNECTION_RECONNECT_FAI",s[s.ERR_ICE_CONNECTION_MOBILITY_FAIL=17105411]="ERR_ICE_CONNECTION_MOBILITY_FAIL",s[s.ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT=16908812]="ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT",s[s.ERR_LATENCY_LIVE_COMMUNICATION_FAILED=17235971]="ERR_LATENCY_LIVE_COMMUNICATION_FAILED",s[s.ERR_LATENCY_LIVE_MEIDASETTING_FAILED=17235972]="ERR_LATENCY_LIVE_MEIDASETTING_FAILED",s[s.ERR_LATENCY_LIVE_NONE_BROADCASTER=17235973]="ERR_LATENCY_LIVE_NONE_BROADCASTER",s[s.ERR_LATENCY_LIVE_NEED_RESTART=17235974]="ERR_LATENCY_LIVE_NEED_RESTART",s[s.ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER=17235975]="ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER",s[s.ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE=17235976]="ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE",s[s.ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION=17235977]="ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION",s[s.ERR_SDK_PUBLISH_INVAILD=16974597]="ERR_SDK_PUBLISH_INVAILD",s[s.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL=16843782]="ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL",s[s.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED=16843859]="ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED",s[s.ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR=16843860]="ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR",s[s.ERR_SDK_SUBSCRIBE_INVAILD=16974852]="ERR_SDK_SUBSCRIBE_INVAILD",s[s.ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL=16844112]="ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL",s[s.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",s[s.ERR_SDK_INVALID_STATE=16974340]="ERR_SDK_INVALID_STATE",s[s.ERR_INVALID_ARGUMENTS=16974083]="ERR_INVALID_ARGUMENTS",s[s.ERR_SESSION_REMOVED=33620229]="ERR_SESSION_REMOVED",s[s.ERR_SDK_UPDATE_ROLE_CHANNEL=16908801]="ERR_SDK_UPDATE_ROLE_CHANNEL",s[s.ERR_INNER=-1]="ERR_INNER",s[s.ERR_SDK_MPU_TASK_PUBLISH_OK=0]="ERR_SDK_MPU_TASK_PUBLISH_OK",s[s.ERR_SDK_MPU_TASK_STREAM_NOT_FOUND=17825793]="ERR_SDK_MPU_TASK_STREAM_NOT_FOUND",s[s.ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST=17825794]="ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST",s[s.ERR_SDK_MPU_TASK_INVALID_PARAM=17825795]="ERR_SDK_MPU_TASK_INVALID_PARAM",s[s.ERR_SDK_MPU_TASK_INTERNAL_ERROR=17825796]="ERR_SDK_MPU_TASK_INTERNAL_ERROR",s[s.ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR=17825797]="ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR",s[s.ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR=17825798]="ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR",s[s.ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT=17825799]="ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT",s[s.ERR_SDK_MPU_TASK_NOT_AUTHORIZED=17825800]="ERR_SDK_MPU_TASK_NOT_AUTHORIZED",s[s.ERR_SDK_CHANNEL_RELAY_STATE_ERROR=18874369]="ERR_SDK_CHANNEL_RELAY_STATE_ERROR",s[s.ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW=18874370]="ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW",s[s.ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED=18874371]="ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED",s[s.ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID=18874372]="ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID",s[s.ERR_SDK_CHANNEL_RELAY_ROLE_ERROR=18874373]="ERR_SDK_CHANNEL_RELAY_ROLE_ERROR",s[s.ERR_SDK_CHANNEL_RELAY_INVALID_PARAM=18874374]="ERR_SDK_CHANNEL_RELAY_INVALID_PARAM",s[s.ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR=18874375]="ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR",s))(de||{});class ce extends Error{constructor(e,t,i){super(t);A(this,"_code");A(this,"_extra");this._code=e,this._extra=i}static fromError(e,t=-1,i=""){return new ce(t,e.message||e.reason||i||"error",e.extraInfo)}get code(){return this._code}set code(e){this._code=e}get reason(){return this.message}get extra(){return this._extra}}const Mu=3e4,At=class At extends we{constructor(e,t,i,r,n,o){super();A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"slsReporter");A(this,"wsClient");A(this,"packageCreater");A(this,"keepAliveTimer",0);A(this,"packageCache",new Map);A(this,"isFirstConnect",!0);A(this,"aliveChecker",0);A(this,"reconnectData");this.authInfo=e,this.userName=t,this.packageCreater=new Lu(e,t),this.channelProfile=i,this.clientRole=r,this.slsReporter=n,this.wsClient=new An(o),this.wsClient.on("onOpen",this.onOpen.bind(this)),this.wsClient.on("onMessage",this.onMessage.bind(this)),this.wsClient.on("onError",this.onError.bind(this)),this.wsClient.on("onClose",this.onClose.bind(this)),this.wsClient.on("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.on("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.on("onNetworkError",this.onNetworkError.bind(this)),this.wsClient.on("onReconnectStart",this.onReconnectStart.bind(this)),this.wsClient.on("onReconnectFail",this.onReconnectFail.bind(this))}get retryCount(){return this.wsClient.connectRetryCount}start(e){this.wsClient.start(e)}startKeepAlive(){this.keepAliveTimer===0&&(this.keepAliveTimer=window.setInterval(()=>{let e=this.packageCreater.createKeepAlivePackage();this.sendPackage(e)},5e3)),this.checkAlive()}stopKeepAlive(){this.keepAliveTimer!==0&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=0),this.aliveChecker&&(window.clearTimeout(this.aliveChecker),this.aliveChecker=0)}sendPkgCache(){this.packageCache.forEach(e=>{this.wsClient.send(e)})}leave(){let e=this.packageCreater.crateLeavePackage();this.sendPackage(e)}reportStatus(e){let t=this.packageCreater.createStatusPackage(e);this.sendPackage(t)}publish(e){let t=this.packageCreater.createPublishPackage();t.data.users=[],e.subscribe.signal=this.wsClient.connectUrl;const{tracks:i,resume:r}=e;i.forEach(n=>{const{codec:o,ssrc:a}=n;n.userdata=JSON.stringify({codec:o}),n.ssrc=`${a}`,r&&(n.attr={reason:"reconnect"})}),t.data.users.push(e),this.sendPackage(t)}roleUpdate(e){let t=this.packageCreater.createRoleUpdatePackage();t.data.clientrole=e,this.sendPackage(t)}refreshUrl(e){const t=this.packageCreater.createRefreshUrlPackage();t.data=Ce(Yt(Ce({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){le.info(`[${At.logName}] close`),this.stopKeepAlive(),this.wsClient.off("onOpen",this.onOpen.bind(this)),this.wsClient.off("onMessage",this.onMessage.bind(this)),this.wsClient.off("onError",this.onError.bind(this)),this.wsClient.off("onClose",this.onClose.bind(this)),this.wsClient.off("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.off("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.off("onReconnectStart"),this.wsClient.off("onReconnectFail"),this.wsClient.close()}sendPackage(e){[qe.KEEPALIVE,qe.RECONNECT,qe.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e),e.msgtype!==qe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!0,e.msgtype,e.tid,e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(le.info(`[${At.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===Xt.AliRtcSdkInteractiveLive||this.channelProfile===Xt.AliRtcSdkInteractiveWithLowLatencyLive)&&(e.data.configure.clientrole=this.clientRole),this.sendPackage(e)}else{this.stopKeepAlive();const e=this.packageCreater.createReconnectPackage(this.reconnectData);this.sendPackage(e)}}onMessage(e){try{let t=JSON.parse(e.data);this.packageCache.delete(t.tid),this.onRecvMessage(t),t!=null&&t.msgtype&&(t==null?void 0:t.msgtype)!==qe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!1,t.msgtype,t.tid,t)}catch(t){le.warn(`[${At.logName}] onMessage err`,t,e)}}onError(e){le.warn(`[${At.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){le.warn(`[${At.logName}] onConnectFail`);const e=new ce(de.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){le.warn(`[${At.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){le.warn(`[${At.logName}] onNetworkError`);const e=new ce(de.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){le.info(`[${At.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new ce(de.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{le.info(`[${At.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},Mu)}onRecvMessage(e){switch(e.msgtype!==qe.KEEPALIVE&&le.info(`[${At.logName}] recv msg: ${e.msgtype}`),e.msgtype){case qe.JOINCHANNEL:this.onJoinResult(e);break;case qe.KEEPALIVE:this.onKeepAliveRsp();break;case qe.PUBLISH:this.onPublishResult(e);break;case qe.NOTIFYJOIN:this.onNotifyJoin(e);break;case qe.NOTIFYSTATUS:this.onNotifyStatus(e);break;case qe.LEAVECHANNEL:this.onLeaveResult(e);break;case qe.NOTIFYLEAVE:this.onNotifyLeave(e);break;case qe.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case qe.STATUSREPORT:this.onStatusReport(e);break;case qe.BYE:this.onBye(e);break;case qe.ROLEUPDATE:this.onRoleUpdateResult(e);break;case qe.REFRESHURL:this.onRefreshUrlResult(e);break;case qe.RECONNECT:this.onReconnectResult(e);break}}onJoinResult(e){this.isFirstConnect=!1,this.emit("onJoinChannelResult",e)}onLeaveResult(e){this.emit("onLeaveResult",e.code,e.tid)}onPublishResult(e){this.emit("onPublishResult",e.code,e.tid,e.description)}onRoleUpdateResult(e){this.emit("onRoleUpdateResult",e.code,e.tid,e.description)}onRefreshUrlResult(e){this.emit("onRefreshUrlResult",e)}onReconnectResult(e){if(e.code===200)this.sendPkgCache(),this.startKeepAlive(),this.emit("onReconnectSuccess",e.data.users);else{const t=new ce(de.ERR_INNER,`reconnect failed, code: ${e.code};description: ${e.description}`);e.code===403&&(t.code=403),this.emit("onReconnectFail",t),this.close()}}onNotifyJoin(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e&&e.data&&e.data.users&&this.emit("onNotifyJoin",e.data.users)}onNotifyStatus(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.status&&e.data.status.length&&this.emit("onNotifyStatus",e.data.status)}onNotifyLeave(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyLeave",e.data.users)}onNotifyPublish(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyPublish",e.data.users)}onStatusReport(e){this.emit("onStatusReport",e.code,e.tid,e.description)}onBye(e){this.stopKeepAlive(),this.emit("onBye",e.reason,e.description)}};A(At,"logName","RSMessageCenter");let En=At;const j=(s,c)=>(e,t,i)=>{const r=i.value;return i.value=function(...n){var g;const o=`[${((g=e.constructor)==null?void 0:g.logName)||""}]`,a=Date.now();let u=[];if(s)try{u=s(n)}catch(f){}le.interface(o,t,...u);const h=r.apply(this,n);return Promise.resolve(h).then(f=>f).catch(f=>f).then(f=>{var m;let d="";const p=f instanceof Error,l=p&&((m=e.constructor)==null?void 0:m.logError);if(!(!c&&!p)){if(l)d=f;else if(p)d=f.message||"";else if(c)if(f===void 0)d="";else try{d=c(f)}catch(x){}else return;le.interfaceResult(o,t,!(p&&l),`${Date.now()-a}ms`,d)}}),h},i},ue=s=>s;var Nu=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Cn=(s,c,e,t)=>{for(var i=t>1?void 0:t?Fu(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&Nu(c,e,i),i};const Mr=(pt=class extends we{constructor(e,t,i,r=Jt.prod){super();A(this,"messageCenter");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"slsReporter");A(this,"reconnectData");A(this,"roomServerUri","");this.channelProfile=e,this.clientRole=t,this.slsReporter=i,this.reconnectData={role:{channelprofile:e,clientrole:t}};const n=r===Jt.pre?lr.pre:lr.prod;this.roomServerUri=`wss://${n}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){le.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,i){return H(this,null,function*(){return new Promise((r,n)=>{const o={};this.authInfo=e,this.userName=t,this.messageCenter=new En(e,t,this.channelProfile,this.clientRole,this.slsReporter,i),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",u=>{var h,g,f;if(le.info(`[${pt.logName}]`,"join result: ",u),o.taskretrynum=((h=this.messageCenter)==null?void 0:h.retryCount)||0,u.code==200){(g=this.messageCenter)==null||g.sendPkgCache(),(f=this.messageCenter)==null||f.startKeepAlive();let d=u.data;d.tid=u.tid,d.users=u.data.users,d.timestamp=u.timestamp,o.est&&(o.joinconnecttc=Date.now()-o.est),this.slsReporter.reportJoinConnection(o),r(d)}else this.reset(),n(this.handleSignalError(u.code,u.reason,de.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new ce(de.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),le.info(`[${pt.logName}]`,"start ws connecting roomserver and auto join when connected");const a={appid:this.authInfo.appId,callid:this.authInfo.sessionId,channelid:this.authInfo.channelId,userid:this.authInfo.userId,nonce:this.authInfo.nonce||"",timestamp:this.authInfo.timestamp,token:this.authInfo.token,authtype:"app",tid:fi()};e.role&&(a.tokenrole=e.role),o.est=Date.now(),this.messageCenter.start(this.roomServerUri+"?"+Ut.queryingParam(a))})})}leave(){return le.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(i,r)=>{le.info(`[${pt.logName}]`,"recv leave response "+i),i===200?(this.updateReconnectData(),this.reset(),e({tid:r})):t(this.handleSignalError(i,"leave error"))}),le.info(`[${pt.logName}]`,"send leave request"),this.messageCenter.leave()):(le.info(`[${pt.logName}]`,"no message center, ok to leave"),e({tid:""}))})}publish(e){return new Promise((t,i)=>{var r;this.messageCenter?(this.messageCenter.once("onPublishResult",(n,o,a)=>{le.info(`[${pt.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Yt(Ce({},this.reconnectData),{publish:{users:[e]}})),t({tid:o})):i(this.handleSignalError(n,`publish error, ${a}`))}),this.authInfo&&(e.sessionid=(r=this.authInfo.sessionId)!=null?r:""),e.callid||(e.callid=fi()),le.info(`[${pt.logName}]`,"assign callid "+e.callid+" and send publish request"),this.messageCenter.publish(e)):i(this.handleSignalError(-1,"publish error, no message center"))})}roleUpdate(e){return new Promise((t,i)=>{if(!this.messageCenter){i(this.handleSignalError(-1,"role update error, no message center"));return}this.messageCenter.on("onRoleUpdateResult",(r,n,o)=>{var a,u;le.info(`[${pt.logName}]`,"recv role update response "+r),r===200?((u=(a=this.reconnectData)==null?void 0:a.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):i(this.handleSignalError(r,`role update error, ${o}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return le.info(`[${pt.logName}]`,"refreshUrl .."),new Promise((t,i)=>{if(!this.messageCenter){i(this.handleSignalError(-1,"refresh url error, no message center"));return}this.messageCenter.on("onRefreshUrlResult",r=>{const{code:n,description:o,data:a={}}=r||{};le.info("recv refresh url response "+n),n===200?t(a):i(this.handleSignalError(n,`refresh url error, ${o}`))}),le.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return le.info(`[${pt.logName}]`,"reportStatus "+e),new Promise((t,i)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(r,n)=>{r===200?t():i(new ce(r,n))}),this.messageCenter.reportStatus(e)):i(new ce(-1,"No messageCenter"))})}handleSignalError(e,t,i=de.ERR_INNER){const r=`signal error: code - ${e}; description - ${t}`;return new ce(i,r)}refreshAuthInfo(e){return H(this,null,function*(){var t;this.authInfo&&(this.authInfo=e,(t=this.messageCenter)==null||t.refreshAuthInfo(this.authInfo))})}initMessageCenter(){var e,t,i,r,n,o,a,u,h,g,f,d;(e=this.messageCenter)==null||e.on("onKeepAliveRsp",()=>{this.emit("onKeepAliveRsp")}),(t=this.messageCenter)==null||t.on("onNotifyJoin",p=>{this.emit("onNotifyJoin",p)}),(i=this.messageCenter)==null||i.on("onNotifyStatus",p=>{this.emit("onNotifyStatus",p)}),(r=this.messageCenter)==null||r.on("onNotifyLeave",p=>{this.emit("onNotifyLeave",p)}),(n=this.messageCenter)==null||n.on("onNotifyPublish",p=>{this.emit("onNotifyPublish",p)}),(o=this.messageCenter)==null||o.on("onBye",(p,l)=>{this.emit("onBye",p,l)}),(a=this.messageCenter)==null||a.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(u=this.messageCenter)==null||u.on("onReconnectSuccess",p=>{this.emit("onReconnectSuccess",p)}),(h=this.messageCenter)==null||h.on("onReconnectFail",p=>{this.emit("onReconnectFail",p)}),(g=this.messageCenter)==null||g.on("onConnectFail",p=>{this.emit("onConnectFail",p),this.reset()}),(f=this.messageCenter)==null||f.on("onNetworkError",p=>{this.emit("onNetworkError",p)}),(d=this.messageCenter)==null||d.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},A(pt,"logName","RoomServerSignaling"),pt);Cn([j()],Mr.prototype,"join",1),Cn([j()],Mr.prototype,"publish",1),Cn([j()],Mr.prototype,"roleUpdate",1);let Ou=Mr;const Vu="https://pgw.rtn.aliyuncs.com",Uu="https://gw.rtn.aliyuncs.com",cr=class cr extends we{constructor(e,t){super();A(this,"env");A(this,"authInfo");A(this,"timer");A(this,"slsReporter");A(this,"requestToken",()=>H(this,null,function*(){if(!this.authInfo)return;const{appId:e,channelId:t,userId:i,nonce:r="",token:n,timestamp:o,sessionId:a,role:u}=this.authInfo;let h=Uu;this.env===Jt.pre&&(h=Vu);const g=`${h}/gslb/v1/stsupdate?appid=${e}&channelid=${t}&userid=${i}&nonce=${r}&token=${n}&timestamp=${o}&session=${a}${u?`&tokenrole=${u}`:""}&slstoken=true&osstoken=true&tokensid=false`;fetch(g).then(f=>f.json()).then(f=>{var d,p;if(f.code===0){const l=(d=f.data)==null?void 0:d.oss,m=(p=f.data)==null?void 0:p.sls;return this.emit("onTokenUpdate",l,m),le.event(`[${cr.logName}]`,"getToken",l,m),f}this.slsReporter.reportSTSResult(200)}).catch(f=>{this.slsReporter.reportSTSResult(-1),le.error(`[${cr.logName}]`,"getToken",f.message)})}));this.slsReporter=e,this.env=t}refreshAuthInfo(e){this.authInfo=e}startSTSUpdate(e){this.authInfo=e,this.requestToken(),this.timer&&clearInterval(this.timer),this.timer=window.setInterval(()=>{this.requestToken()},1e3*60*10)}clear(){this.timer&&clearInterval(this.timer)}};A(cr,"logName","StsManager");let In=cr;class Hu extends we{constructor(e,t,i,r=Jt.prod){super();A(this,"signaling");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"env",Jt.prod);A(this,"maxConnectRetryCount");A(this,"stsManager");A(this,"slsReporter");this.channelProfile=e,this.clientRole=t,this.env=r,this.slsReporter=i,this.stsManager=new In(i,r)}reset(){var e;le.info("[signalingmanager] reset"),(e=this.signaling)==null||e.reset(),this.stsManager.clear(),this.signaling=void 0,this.authInfo=void 0}join(e,t=e.userId,i,r){return this.maxConnectRetryCount=i,this.userName=t,new Promise((n,o)=>{this.signaling?o(new ce(de.ERR_JOIN_ALREADY_JOINED,"already joined")):(le.info("[signalingmanager] create signaling"),this.signaling=new Ou(this.channelProfile,this.clientRole,this.slsReporter,this.env),this.initSignaling(),r&&(r.rs=Date.now()),this.signaling.join(e,t,i).then(a=>{this.authInfo=e,r&&(r.re=Date.now()),n(a)}).catch(a=>{this.reset(),o(a)}),this.stsManager.startSTSUpdate(e))})}retryJoin(){const e=this.authInfo;this.reset(),e&&this.join(e,this.userName,this.maxConnectRetryCount)}leave(){return new Promise((e,t)=>{this.signaling?this.signaling.leave().then(i=>{this.reset(),e(i)}).catch(i=>{t(i)}):e({tid:""})})}publish(e){return new Promise((t,i)=>{var r;this.signaling&&this.authInfo?(e.userid=this.authInfo.userId,e.displayname=(r=this.userName)!=null?r:this.authInfo.userId,this.signaling.publish(e).then(n=>{t(n)}).catch(n=>{i(n)})):i(new ce(de.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL,"no signaling"))})}reportStatus(e){return new Promise((t,i)=>{this.signaling?this.signaling.reportStatus(e).then(()=>{t()}).catch(r=>{i(r)}):i(new ce(-1,"no signaling"))})}setClientRole(e){return H(this,null,function*(){const t=this.clientRole;if(!this.signaling){this.clientRole=e;return}const i=Date.now();try{const r=yield this.signaling.roleUpdate(e);return this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-i,0),r}catch(r){this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-i,r.code||-1)}})}setChannelProfile(e){this.signaling?this.signaling.setChannelProfile(e):this.channelProfile=e}refreshUrl(e){return this.signaling?this.signaling.refreshUrl(e):Promise.reject(new ce(de.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return H(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=Ce(Ce({},this.authInfo),e),(t=this.signaling)==null||t.refreshAuthInfo(this.authInfo),this.stsManager.refreshAuthInfo(this.authInfo))}catch(i){throw i}})}initSignaling(){var e,t,i,r,n,o,a,u,h,g,f,d,p;(e=this.signaling)==null||e.on("onKeepAliveRsp",this.onKeepAliveRsp.bind(this)),(t=this.signaling)==null||t.on("onNotifyJoin",this.onNotifyJoin.bind(this)),(i=this.signaling)==null||i.on("onNotifyStatus",this.onNotifyStatus.bind(this)),(r=this.signaling)==null||r.on("onNotifyLeave",this.onNotifyLeave.bind(this)),(n=this.signaling)==null||n.on("onNotifyPublish",this.onNotifyPublish.bind(this)),(o=this.signaling)==null||o.on("onBye",this.onBye.bind(this)),(a=this.signaling)==null||a.on("onReconnectStart",this.onReconnectStart.bind(this)),(u=this.signaling)==null||u.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(h=this.signaling)==null||h.on("onReconnectFail",this.onReconnectFail.bind(this)),(g=this.signaling)==null||g.on("onConnectFail",this.onConnectFail.bind(this)),(f=this.signaling)==null||f.on("onNetworkError",this.onNetworkError.bind(this)),(d=this.signaling)==null||d.on("onAuthInvalid",this.onAuthInvalid.bind(this)),(p=this.signaling)==null||p.on("onError",this.onError.bind(this))}onKeepAliveRsp(){this.emit("onKeepAliveRsp")}onNotifyJoin(e){this.emit("onNotifyJoin",e)}onNotifyStatus(e){this.emit("onNotifyStatus",e)}onNotifyLeave(e){this.emit("onNotifyLeave",e)}onNotifyPublish(e){this.emit("onNotifyPublish",e)}onBye(e,t){this.emit("onBye",e,t)}onConnectFail(e){this.reset(),this.emit("onConnectFail",e)}onNetworkError(e){this.emit("onNetworkError",e)}onAuthInvalid(e){}onReconnectStart(){this.emit("onReconnectStart")}onReconnectSuccess(e){this.emit("onReconnectSuccess",e)}onReconnectFail(e){this.emit("onReconnectFail",e)}onError(e){this.emit("onError",e)}}const Ci=class Ci{static getInstance(){return Ci.instance||(Ci.instance=new AudioContext),Ci.instance.resume(),Ci.instance}};A(Ci,"instance");let Rn=Ci;function zu(s,c,e,t,i){let r=t,n=0,o;const a=s.createAnalyser();a.fftSize=256;const u=new Uint8Array(a.frequencyBinCount);c.connect(a),a.connect(e);const h=()=>{o&&window.clearInterval(o)},g=()=>{o=window.setInterval(()=>{a.getByteFrequencyData(u);let f=Math.round(u.reduce((d,p)=>d+p)/u.length);f=Math.min(100,f),n=f,i&&i(f)},r)};return g(),{updateInterval:f=>{h(),r=f,g()},getLevel:()=>n,dispose:()=>{h(),c.disconnect(),a.disconnect()}}}class ju extends we{constructor(){super();A(this,"audioContext");A(this,"stream");A(this,"sourceNode");A(this,"analyser");this.audioContext=Rn.getInstance(),this.stream=new MediaStream}getLevel(){return this.analyser?this.analyser.getLevel():0}start(e,t=1e3){this.sourceNode&&this.stop(),this.stream.addTrack(e),this.sourceNode=this.audioContext.createMediaStreamSource(this.stream);const i=this.audioContext.createMediaStreamDestination();this.analyser=zu(this.audioContext,this.sourceNode,i,t,r=>{this.emit("audioLevel",r)})}stop(){this.analyser&&this.analyser.dispose(),this.analyser=void 0,this.sourceNode=void 0,this.stream.getAudioTracks().forEach(e=>{this.stream.removeTrack(e)})}dispose(){this.stop()}}class Ho extends we{constructor(e,t,i,r){super();A(this,"uid");A(this,"name");A(this,"rtsManager");A(this,"callId","");A(this,"audioLevelMonitor");A(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=t,this.rtsManager=i,this.audioVolumeIndicationInterval=r,this.audioLevelMonitor=new ju}get userId(){return this.uid}get displayname(){return this.name}createCallId(){this.callId||(this.callId=Ut.createCallid())}setUserInfo(e,t){this.uid=e,this.name=t}refreshUserInfo(e){this.uid=e}getAudioLevel(){return this.audioLevelMonitor.getLevel()}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval=e}clear(){this.audioLevelMonitor.dispose()}}class zo{static getCurrentStatus(c){let e=0;c.micOpen&&(e+=1),c.micInterrupted&&(e+=2),c.cameraOpen&&(e+=4),c.screenShare&&(e+=128),c.audioDisable&&(e+=8),c.videoDisable&&(e+=16),c.screenDisable&&(e+=256);let t=e.toString(16);for(;t.length<16;)t="0"+t;return t}static parseStatus(c){let e=parseInt(c,16);return{micOpen:!!(e&1),micInterrupted:!!(e&2),cameraOpen:!!(e&4),screenShare:!!(e&128),audioDisable:!!(e&8),videoDisable:!!(e&16),screenDisable:!!(e&256),backgroundMode:!!(e&32),accompanyPlaying:!!(e&64)}}}const jo="customVideoProfile",Wo="customScreenProfile",rr={width:1280,height:720,frameRate:30,maxBitrate:2e3},sr={width:1920,height:1080,frameRate:30,maxBitrate:2600},Wu={1e4:$e.AliEngineLocalDeviceExceptionTypeUnknown,2e4:$e.AliEngineLocalDeviceExceptionTypeUnknown,10001:$e.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:$e.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:$e.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:$e.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:$e.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:$e.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10011:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10012:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10013:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10014:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10019:$e.AliEngineLocalDeviceExceptionTypeDisplayException},Ku=s=>s.getAudioTracks()[0];function Ko(s){var c;if(((c=s==null?void 0:s.nodeName)==null?void 0:c.toLowerCase())==="video")return s.setAttribute("playsinline",""),s;if(typeof s=="string"){let e=document.getElementById(s);if(e){if(e.nodeName.toLocaleLowerCase()==="video")return e.setAttribute("playsinline",""),e;throw new ce(de.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new ce(de.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new ce(de.ERR_INVALID_ARGUMENTS,"element id should be string")}function kn(s){var e;const c=[];if(Array.isArray(s))s.forEach(t=>{try{c.push(Ko(t))}catch(i){}});else if(typeof s=="string"||((e=s==null?void 0:s.nodeName)==null?void 0:e.toLowerCase())==="video")try{c.push(Ko(s))}catch(t){}return c}function wi(s){return new Promise(c=>setTimeout(c,s))}const $o=(s,c)=>{const e=()=>(s.muted=!0,Promise.race([wi(500),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let t;return s.srcObject!==c?(s.load(),s.srcObject=c,t=s.play(),s._playPromise=t):t=Promise.resolve(),t}));return new Promise(t=>{if(ye.AliRTS.BrowserUtil.isMicroMessenger){const i=window.top!==window.self,r=window.WeixinJSBridge||window.top.WeixinJSBridge;r?r.invoke("getNetworkType",{},()=>{t(e())}):(i?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{r.invoke("getNetworkType",{},()=>{t(e())})}),setTimeout(()=>{t(e())},1e3)}else t(e())})},ai=s=>{Promise.race([wi(100),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{s.srcObject=null,s._playPromise=void 0})};var $u=Object.defineProperty,qu=Object.getOwnPropertyDescriptor,Xe=(s,c,e,t)=>{for(var i=t>1?void 0:t?qu(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&$u(c,e,i),i};const qo=30;class Nr extends we{constructor(){super();A(this,"state");A(this,"time");this.state=Ee.AliRtcStatePublishIdle,this.time=Date.now()}setState(e){const t=this.state,i=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-i)/1e3))}}const Ge=(ci=class extends Ho{constructor(e){const{rtsManager:t,localStreamManager:i,slsReporter:r,signalingManager:n,audioVolumeIndicationInterval:o}=e;super("","",t,o);A(this,"url","");A(this,"joinTime",0);A(this,"_isPublishing",!1);A(this,"publishPromise",Promise.resolve(""));A(this,"previewElements",[]);A(this,"screenPreviewElements",[]);A(this,"streamManager");A(this,"streamTracks");A(this,"publishId",fi());A(this,"signalingManager");A(this,"traceId","");A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});A(this,"candidateDataCache",[]);A(this,"pcMediaStatsMap",{});A(this,"slsReporter");A(this,"audioPubState");A(this,"videoPubState");A(this,"videoSmallPubState");A(this,"screenPubState");A(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=i,this.signalingManager=n,this.slsReporter=r,this.streamManager.on("trackended",a=>{this.onTrackEnd(a)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Nr,this.audioPubState.on("change",(a,u,h)=>{this.emit("audioPublishStateChanged",a,u,h)}),this.videoPubState=new Nr,this.videoPubState.on("change",(a,u,h)=>{this.emit("videoPublishStateChanged",a,u,h)}),this.videoSmallPubState=new Nr,this.videoSmallPubState.on("change",(a,u,h)=>{this.emit("dualStreamPublishStateChanged",a,u,h)}),this.screenPubState=new Nr,this.screenPubState.on("change",(a,u,h)=>{this.emit("screenPublishStateChanged",a,u,h)}),this.startStreamMonitor()}get joined(){return!!this.uid}get isPublishing(){return this._isPublishing}get publishStreams(){return this.streamManager.publishStreams}get cameraTrack(){return this.streamManager.cameraStreamInfo.originVideoTrack}get screenTrack(){return this.streamManager.screenStreamInfo.originVideoTrack}get audioTrack(){return this.streamManager.cameraStreamInfo.originAudioTrack}get hasCamera(){return!!this.streamManager.cameraStreamInfo.originVideoTrack}get hasMicrophone(){return!!this.streamManager.cameraStreamInfo.originAudioTrack}get hasScreenShare(){return!!this.streamManager.screenStreamInfo.originVideoTrack}get hasCameraTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===Z.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===Z.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===Z.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="audio"&&t&&r===Z.Audio))}get cameraDirection(){var e,t;return(t=(e=this.streamManager.cameraStreamInfo)==null?void 0:e.cameraVideoConstraints)==null?void 0:t.facingMode}get audioCaptureDisabled(){return this.streamManager.audioCaptureDisabled}get cameraCaptureDisabled(){return this.streamManager.cameraCaptureDisabled}get publishLocalVideoStreamEnabled(){return this.streamManager.publishLocalVideoStreamEnabled}get publishLocalAudioStreamEnabled(){return this.streamManager.publishLocalAudioStreamEnabled}get publishLocalScreenStreamEnabled(){return this.streamManager.publishLocalScreenStreamEnabled}setPublishLocalAudioStreamEnabled(e){this.streamManager.publishLocalAudioStreamEnabled=e}setPublishLocalVideoStreamEnabled(e){this.streamManager.publishLocalVideoStreamEnabled=e}setPublishLocalScreenStreamEnabled(e){this.streamManager.publishLocalScreenStreamEnabled=e}initInfo(e,t){this.joinTime=Date.now(),this.rtsManager.localJoinTime=this.joinTime,this.setUserInfo(e.userId,e.userId),this.url=t,this.callId=e.sessionId||Ut.createCallid(),this.updatePubId()}setVideoProfile(e,t){return H(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return H(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return H(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===ir.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===ir.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new ce(de.ERR_CAMERA_OPEN_FAIL,`camera direction set to ${e} failed`)}setCameraDeviceId(e){this.streamManager.setCameraVideoConstraints({deviceId:e})}muteLocalCamera(e){this.streamManager.setCameraMuted(e),this.slsReporter.reportMute(this.callId,!e,"video")}muteLocalMic(e){this.streamManager.setAudioMuted(e),this.slsReporter.reportMute(this.callId,!e,"audio")}muteLocalScreen(e){this.streamManager.setScreenMuted(e),this.slsReporter.reportMute(this.callId,!e,"screen")}setMicrophoneDeviceId(e){this.streamManager.setMicAudioConstraints({deviceId:e})}updatePubId(){this.publishId=fi()}clearPublishState(){this.streamTracks=void 0}clear(){return H(this,null,function*(){Vn(ci.prototype,this,"clear").call(this),this._isPublishing&&(yield this.unPublish()),this.stopPreview(),this.resetPreviewElements(),this.resetSecondayPreviewElements(),this.clearStream(),this.streamManager.cameraCaptureDisabled=!1})}resetElement(e){this.previewElements.includes(e)&&(ai(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(ai(e),this.screenPreviewElements.splice(this.screenPreviewElements.indexOf(e),1))}setPreviewElement(e){const{videoElement:t,screen:i}=e;i?this.screenPreviewElements.includes(t)||this.screenPreviewElements.push(t):this.previewElements.includes(t)||this.previewElements.push(t)}setViewConfig(e,t){if(!e){t===ke.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![ke.AliRtcVideoTrackCamera,ke.AliRtcVideoTrackScreen].includes(t))throw new ce(de.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(i=>{this.setPreviewElement({videoElement:i,screen:t===ke.AliRtcVideoTrackScreen})})}startCameraCapture(e){return H(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream(e)})}stopCameraCapture(){return H(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}stopAudioCapture(){return H(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return H(this,null,function*(){const{videoElement:t,screen:i}=e!=null?e:{};try{let r=i?this.streamManager.screenStreamInfo.previewStream:this.streamManager.cameraStreamInfo.previewStream;if(!t)throw new ce(de.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!r){le.info(`[${ci.logName}]`,"preview no stream founded");return}return $o(t,r.mediaStream),this.setPreviewElement(e),r.mediaStream}catch(r){const n=de.ERR_INNER;throw ce.fromError(r,n,"preview failed")}})}previewAll(e){return H(this,null,function*(){const{primary:t=!0,screen:i=!0}=e!=null?e:{};if(t&&this.previewElements.length)for(let r=0;r<this.previewElements.length;r++){const n=this.previewElements[r];yield this.preview({videoElement:n})}if(i&&this.screenPreviewElements.length)for(let r=0;r<this.screenPreviewElements.length;r++){const n=this.screenPreviewElements[r];yield this.preview({videoElement:n,screen:!0})}})}stopPreview(e){const{videoElement:t,primary:i=!0,screen:r=!0}=e||{};if(!t)i&&(this.previewElements.forEach(n=>{ai(n)}),this.previewElements=[]),r&&(this.screenPreviewElements.forEach(n=>{ai(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(o=>o===t);if(n>=0)this.previewElements.splice(n,1),ai(t);else{const o=this.screenPreviewElements.findIndex(a=>a===t);o>=0&&(this.screenPreviewElements.splice(o,1),ai(t))}}}resumePublish(){return H(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return H(this,null,function*(){try{const t=yield this.streamManager.createLocalStream(e);return t!=null&&t.audioTrack&&this.audioVolumeIndicationInterval>0&&this.audioLevelMonitor.start(t.audioTrack,this.audioVolumeIndicationInterval),e.video?this.previewAll({primary:!0}):e.screen&&this.previewAll({screen:!0}),t}catch(t){const i=Wu[t.errorCode];throw i&&(e.audio?this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeMic,i,""):e.video?this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeCamera,i,""):e.screen?this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeDisplay,i,""):this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeUnknown,i,"")),t}})}stopLocalStream(e){return H(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,i){return H(this,null,function*(){var n,o;if(!e&&!t)return;if(e&&!t){const a={};return i===Z.Audio?a.audio=!0:i===Z.VideoLarge||i===Z.VideoSmall?(a.video=!0,a.vMsid=i):i===Z.Screen&&(a.screen=!0),yield this.publishDeleteTracks(a)}const r={};if(t!=null&&t.hasVideo&&(r.isScreen=i===Z.Screen,r.vMsid=i),t!=null&&t.hasAudio&&(r.aMsid=i),!e&&t)return yield this.publishAdd(t,r,!1);if(e&&t){const a=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((o=t.audioTrack)==null?void 0:o.id);if(a!==u)return yield this.publishReplace(t,r)}})}reportAudioProfile(){const e=this.streamManager.cameraStreamInfo.audioProfile||"standard",t=ye.AliRTS.AudioProfileMap.get(e);this.slsReporter.reportPublishProfile(Z.Audio,{a_profile:e,bits:(t==null?void 0:t.maxBitrate)||0,samplerate:(t==null?void 0:t.sampleRate)||0,channel:(t==null?void 0:t.channelCount)||0})}reportVideoProfile(){const e=this.streamManager.cameraStreamInfo.videoProfile||"",t=ye.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(Z.VideoLarge,{v_profile:e,wdth:(t==null?void 0:t.width)||0,hgt:(t==null?void 0:t.height)||0,fps:(t==null?void 0:t.frameRate)||0,bitrate:(t==null?void 0:t.maxBitrate)||0})}reportScreenProfile(){const e=this.streamManager.screenStreamInfo.videoProfile||"",t=ye.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(Z.Screen,{v_profile:e,wdth:(t==null?void 0:t.width)||0,hgt:(t==null?void 0:t.height)||0,fps:(t==null?void 0:t.frameRate)||0,bitrate:(t==null?void 0:t.maxBitrate)||0})}startPublish(){return H(this,arguments,function*(e=!1,t=di.MANUAL){if(!this.joined)return;this.createCallId();const i=yield this.streamManager.publishStreams,{audio:r,video:n,videoSmall:o,screen:a}=i;try{const u=new Date().getTime();r&&this.audioPubState.setState(Ee.AliRtcStatePublishing),n&&this.videoPubState.setState(Ee.AliRtcStatePublishing),o&&this.videoSmallPubState.setState(Ee.AliRtcStatePublishing),a&&this.screenPubState.setState(Ee.AliRtcStatePublishing),this.publishPromise=this.rtsManager.publish(this.url,this.callId,e,t);const h=yield this.publishPromise;this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=h,r&&(this.trackTraceIdMap[Z.Audio]=h,this.reportAudioProfile()),o&&(this.trackTraceIdMap[Z.VideoSmall]=h),n&&(this.trackTraceIdMap[Z.VideoLarge]=h,this.reportVideoProfile()),a&&(this.trackTraceIdMap[Z.Screen]=h,this.reportScreenProfile());const g={type:li.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:e,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceId:h};yield this.syncPublishToRoomServer(g,i,u),r&&this.audioPubState.setState(Ee.AliRtcStatePublished),n&&this.videoPubState.setState(Ee.AliRtcStatePublished),o&&this.videoSmallPubState.setState(Ee.AliRtcStatePublished),a&&this.screenPubState.setState(Ee.AliRtcStatePublished)}catch(u){throw r&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),n&&this.videoPubState.setState(Ee.AliRtcStateNoPublish),o&&this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),a&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),u}})}publishUpdate(){return H(this,null,function*(){var r,n,o,a;if(!this._isPublishing)return;yield this.publishPromise;const e=this.streamManager.publishStreams;let t;const i=new Date().getTime();try{const u=(r=this.streamTracks)==null?void 0:r.find(({ssrc:x,type:v,msid:b})=>v==="audio"&&x&&b===Z.Audio),h=yield this.compareAndPublish(u,e.audio,Z.Audio);h&&(t=h);const g=(n=this.streamTracks)==null?void 0:n.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.VideoLarge),f=yield this.compareAndPublish(g,e.video,Z.VideoLarge);f&&(t=f);const d=(o=this.streamTracks)==null?void 0:o.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.VideoSmall),p=yield this.compareAndPublish(d,e.videoSmall,Z.VideoSmall);p&&(t=p);const l=(a=this.streamTracks)==null?void 0:a.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.Screen),m=yield this.compareAndPublish(l,e.screen,Z.Screen);if(m&&(t=m),!t)return;yield this.syncPublishToRoomServer(t,e,i)}catch(u){const{code:h}=u!=null?u:{},g=this.url;throw h===403&&g&&(yield this.refreshPushStreamUrl(),t=yield this.publishUpdate()),u}return t})}syncPublishToRoomServer(e,t,i){return H(this,null,function*(){if(!e)throw new ce(de.ERR_INNER,"sync publish to room server failed because no publishInfo");const r=yield this.signalingManager.publish(e);e.signaltid=r.tid})}refreshPushStreamUrl(){return H(this,null,function*(){const e=new ce(de.ERR_INNER,"refresh push stream url error"),t=this.url;if(!t)throw e;const i=yield this.signalingManager.refreshUrl({pushstreamurl:t});if(!(i!=null&&i.pushstreamurl))throw e;this.url=i==null?void 0:i.pushstreamurl})}publishAdd(e,t,i=!1,r=0){return H(this,null,function*(){this.createCallId();const n=(t==null?void 0:t.aMsid)===Z.Audio,o=(t==null?void 0:t.vMsid)===Z.VideoLarge,a=(t==null?void 0:t.vMsid)===Z.VideoSmall,u=(t==null?void 0:t.vMsid)===Z.Screen;n&&this.audioPubState.setState(Ee.AliRtcStatePublishing),o&&this.videoPubState.setState(Ee.AliRtcStatePublishing),a&&this.videoSmallPubState.setState(Ee.AliRtcStatePublishing),u&&this.screenPubState.setState(Ee.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,this.callId,t,!1,0,!0);n&&(this.audioPubState.setState(Ee.AliRtcStatePublished),this.reportAudioProfile(),this.trackTraceIdMap[Z.Audio]=h),o&&(this.videoPubState.setState(Ee.AliRtcStatePublished),this.reportVideoProfile(),this.trackTraceIdMap[Z.VideoLarge]=h),a&&(this.videoSmallPubState.setState(Ee.AliRtcStatePublished),this.trackTraceIdMap[Z.VideoSmall]=h),u&&(this.screenPubState.setState(Ee.AliRtcStatePublished),this.reportScreenProfile(),this.trackTraceIdMap[Z.Screen]=h),this.streamTracks=this.rtsManager.publishingTracks;const g={type:li.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:i,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceid:h};return this.reportSelfDeviceStatus(),this.monitorTimerId||this.startStreamMonitor(),g}catch(h){let g=de.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED),o&&(this.videoPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED),a&&(this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED),u&&(this.screenPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&r<3)return this.publishAdd(e,t,i,r+1);throw ce.fromError(h,g,"publish add failed")}})}publishReplace(e,t){return H(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.streamTracks=this.rtsManager.publishingTracks;const i={type:li.Replace,userid:this.userId,sessionid:"",pubid:this.publishId,displayname:this.name,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks};return this.reportSelfDeviceStatus(),i}catch(i){throw ce.fromError(i,de.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return H(this,null,function*(){const t={type:li.Delete,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{return yield this.rtsManager.publishDelete(this.url,e),this.streamTracks=this.rtsManager.publishingTracks,e.audio&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),e.video&&(e.vMsid===Z.VideoSmall?this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish):this.videoPubState.setState(Ee.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(i){throw ce.fromError(i,de.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return H(this,null,function*(){var t;if(!this._isPublishing)throw new ce(de.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");le.info(`[${ci.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const i=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,o=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),i&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),r&&this.videoPubState.setState(Ee.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),o&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),this.traceId="",(t=this.streamTracks)==null||t.forEach(u=>{this.reportPublishMonitor(u)}),this.streamTracks=[];const a={type:li.Stop,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};return this.syncPublishToRoomServer(a,{},e),a}catch(i){throw ce.fromError(i,de.ERR_INNER,"publish stop failed")}})}unPublish(){return H(this,null,function*(){var i;const e=new Date().getTime();let t={type:li.UnPublish,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{if(this._isPublishing){const r=this.hasAudioTrackInMS,n=this.hasCameraTrackInMS,o=this.hasCameraDualTrackInMS,a=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),(i=this.streamTracks)==null||i.forEach(u=>{this.reportPublishMonitor(u)}),this.streamTracks=[],this.stopStreamMonitor(),r&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),n&&this.videoPubState.setState(Ee.AliRtcStateNoPublish),o&&this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),a&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.slsReporter.reportUnpublish(this.callId||"",e,0,""),t}catch(r){throw ce.fromError(r,de.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(dt.Local,this.getDeviceStatus())}getDeviceStatus(){var t,i,r,n;let e={micOpen:!1,micInterrupted:!1,cameraOpen:!1,screenShare:!1,audioDisable:!0,videoDisable:!0,screenDisable:!0,backgroundMode:!1,accompanyPlaying:!1};return e.cameraOpen=this.hasCamera,e.micOpen=this.hasMicrophone,e.screenShare=this.hasScreenShare,e.audioDisable=!((t=this.streamManager.cameraStreamInfo.originAudioTrack)!=null&&t.enabled),e.videoDisable=!((i=this.streamManager.cameraStreamInfo.originVideoTrack)!=null&&i.enabled),e.screenDisable=!this.hasScreenShare||!((n=(r=this.streamManager.screenStreamInfo)==null?void 0:r.originVideoTrack)!=null&&n.enabled),zo.getCurrentStatus(e)}resetPreviewElements(){this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements=[]}getMediaStats(e){return this.pcMediaStatsMap[e]}reportPublishMonitor(e){const t=e.msid;if(!t)return;let i;try{t===Z.Audio?i=this.rtsManager.getStreamByMsid({url:this.url,aMsid:t}).audioTrack:i=this.rtsManager.getStreamByMsid({url:this.url,vMsid:t}).videoTrack}catch(r){}this.slsReporter.reportPublishMonitor(this.callId,this.trackTraceIdMap[t]||"",e,i,this.monitorDataCache[t]),this.monitorDataCache[t]=[]}reportNetwork(){this.slsReporter.reportNetworkMonitor(this.candidateDataCache),this.candidateDataCache=[]}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>H(this,null,function*(){var e,i;try{const r=yield this.rtsManager.getPCStats();let n;r==null||r.forEach(a=>{a.type==="media-source"||a.type==="media-playout"?a.id&&(this.pcMediaStatsMap[a.id]=a):a.type==="candidate-pair"&&a.state==="succeeded"&&(n=a)});let o;if(((e=this.candidateDataCache)==null?void 0:e.length)>0){const t=this.candidateDataCache[this.candidateDataCache.length-1]||{},{_last:u}=t;o=$r(t,["_last"])}((i=this.candidateDataCache)==null?void 0:i.length)>=qo&&this.reportNetwork(),n&&(n._last=o,this.candidateDataCache.push(n)),(this.streamTracks||[]).forEach(a=>{const u=a.msid;if(!u)return;let h;u===Z.Audio?h=this.rtsManager.getPublishAudioStats(this.url):h=this.rtsManager.getPublishVideoStats(this.url,u),h.then(f=>{if(!f.timestamp)return;this.monitorDataCache[u]||(this.monitorDataCache[u]=[]);const d=this.getMediaStats(f.mediaSourceId);f._source=d;const p=this.monitorDataCache[u];let l;if((p==null?void 0:p.length)>0){const m=p[p.length-1]||{},{_last:v}=m;l=$r(m,["_last"])}(p==null?void 0:p.length)>=qo&&this.reportPublishMonitor(a),f._last=l,this.monitorDataCache[u].push(f)})})}catch(r){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0)}clearStream(){this.streamManager.stop(),this.audioPubState.setState(Ee.AliRtcStatePublishIdle),this.videoPubState.setState(Ee.AliRtcStatePublishIdle),this.videoSmallPubState.setState(Ee.AliRtcStatePublishIdle),this.screenPubState.setState(Ee.AliRtcStatePublishIdle)}getCurrentCameraDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originVideoTrack)==null?void 0:e.getSettings().deviceId}getCurrentMicDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originAudioTrack)==null?void 0:e.getSettings().deviceId}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.streamManager.cameraStreamInfo.originAudioTrack&&this.audioLevelMonitor.start(this.streamManager.cameraStreamInfo.originAudioTrack,e),this.audioVolumeIndicationInterval=e)}sendSEI(e,t,i){return H(this,null,function*(){if(!this.url)return;let r=0;return!t||t<1?r=1:r=t-1,this.rtsManager.sendSEI(this.url,e,r,i)})}getStats(){return H(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const n=yield this.rtsManager.getPublishAudioStats(this.url);n&&e.push({stats:n,track:Vi.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoLarge);n&&t.push({track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeHigh,stats:n})}if(this.hasCameraDualTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoSmall);n&&t.push({track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeLow,stats:n})}if(this.hasScreenTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.Screen);n&&t.push({track:ke.AliRtcVideoTrackScreen,stats:n})}let i;const r=yield this.rtsManager.getPCStats();return r==null||r.forEach(n=>{n.type==="transport"&&(i=n)}),{audio:e,video:t,transport:i}})}},A(ci,"logName","LocalUser"),ci);Xe([j()],Ge.prototype,"clearPublishState",1),Xe([j()],Ge.prototype,"clear",1),Xe([j()],Ge.prototype,"setViewConfig",1),Xe([j()],Ge.prototype,"startCameraCapture",1),Xe([j()],Ge.prototype,"stopCameraCapture",1),Xe([j()],Ge.prototype,"stopAudioCapture",1),Xe([j()],Ge.prototype,"stopPreview",1),Xe([j()],Ge.prototype,"resumePublish",1),Xe([j()],Ge.prototype,"createLocalStream",1),Xe([j()],Ge.prototype,"stopLocalStream",1),Xe([j(ue)],Ge.prototype,"startPublish",1),Xe([j(([s])=>[s])],Ge.prototype,"syncPublishToRoomServer",1),Xe([j()],Ge.prototype,"refreshPushStreamUrl",1),Xe([j(([s,c,e])=>[JSON.stringify(e)])],Ge.prototype,"publishAdd",1),Xe([j(([s,c])=>[JSON.stringify(c)])],Ge.prototype,"publishReplace",1),Xe([j(ue)],Ge.prototype,"publishDeleteTracks",1),Xe([j()],Ge.prototype,"publishStop",1),Xe([j()],Ge.prototype,"unPublish",1),Xe([j(([s,c,e])=>[s.length,c,e])],Ge.prototype,"sendSEI",1);let Go=Ge;var Ai=(s=>(s.OPUS="opus",s.H264="H264",s.UNKONWN="",s))(Ai||{}),Ei=(s=>(s.VideoTrackEnded="videoTrackEnded",s.AudioTrackEnded="audioTrackEnded",s.ScreenTrackEnded="screenTrackEnded",s))(Ei||{});const Gu=s=>{const c=new MediaStream;return c.addTrack(s),c},Jo=s=>H(this,null,function*(){return yield ye.AliRTS.createStream({custom:!0,mediaStream:s})}),nr=s=>H(this,null,function*(){const c=Gu(s);return yield Jo(c)}),Ju=s=>{const{audio:c,video:e,screen:t}=s;if(e&&t)throw new ce(de.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!c&&!t)},Xu=s=>s===Z.Audio||s===rs.Audio,Zu=s=>s===Z.VideoLarge||s===rs.VideoLarge,Yu=s=>s===Z.VideoSmall,Qu=s=>s===Z.Screen;var eh=Object.defineProperty,th=Object.getOwnPropertyDescriptor,ih=(s,c,e,t)=>{for(var i=t>1?void 0:t?th(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&eh(c,e,i),i};class Fr extends we{constructor(){super();A(this,"audioInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"videoLargeInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"videoSmallInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"screenInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"audioVolume",1);A(this,"audioMuted",!1);A(this,"userStatus")}getAudioInfo(){return this.audioInfo}getVideoSmallInfo(){return this.videoSmallInfo}getVideoLargeInfo(){return this.videoLargeInfo}getScreenInfo(){return this.screenInfo}get subscribingInfos(){return[this.audioInfo,this.videoLargeInfo,this.videoSmallInfo,this.screenInfo].filter(e=>e.msid&&e.subscribed)}get hasAudio(){return this.audioInfo.ssrc!==""}get hasVideo(){return this.videoLargeInfo.ssrc!==""||this.videoSmallInfo.ssrc!==""}get hasVideoLarge(){return this.videoLargeInfo.ssrc!==""}get hasVideoSmall(){return this.videoSmallInfo.ssrc!==""}get hasScreen(){return this.screenInfo.ssrc!==""}get isAudioSubscribing(){return!!this.audioInfo.subscribed}get isVideoSubscribing(){return!!this.videoLargeInfo.subscribed||!!this.videoSmallInfo.subscribed}get isVideoLargeSubscribing(){return!!this.videoLargeInfo.subscribed}get isVideoSmallSubscribing(){return!!this.videoSmallInfo.subscribed}get isScreenSubscribing(){return!!this.screenInfo.subscribed}get audioCodec(){return this.audioInfo.codec}get videoCodec(){return this.hasVideoLarge?this.videoLargeInfo.codec:this.hasVideoSmall?this.videoSmallInfo.codec:this.hasScreen?this.screenInfo.codec:Ai.UNKONWN}get audioTrackInfo(){return this.hasAudio?Vi.AliRtcAudioTrackMic:Vi.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?ke.AliRtcVideoTrackBoth:this.hasVideo?ke.AliRtcVideoTrackCamera:this.hasScreen?ke.AliRtcVideoTrackScreen:ke.AliRtcVideoTrackNo}updateTracks(e){let t="",i="",r="",n="";return e?(e.forEach(o=>{var h;let a=Ai.UNKONWN;const u=((h=o==null?void 0:o.attr)==null?void 0:h.reason)==="reconnect";if(o.userdata){const{codec:g}=JSON.parse(o.userdata);g&&(a=g)}Xu(o.msid)?(t=o.ssrc,this.audioInfo.msid=o.msid,this.audioInfo.codec=a,u&&(this.audioInfo.subscribed=!1)):Yu(o.msid)?(r=o.ssrc,this.videoSmallInfo.msid=o.msid,this.videoSmallInfo.codec=a,u&&(this.videoSmallInfo.subscribed=!1)):Zu(o.msid)?(i=o.ssrc,this.videoLargeInfo.msid=o.msid,this.videoLargeInfo.codec=a,u&&(this.videoLargeInfo.subscribed=!1)):Qu(o.msid)&&(n=o.ssrc,this.screenInfo.msid=o.msid,this.screenInfo.codec=a,u&&(this.screenInfo.subscribed=!1))}),this.updateRemoteTrackSsrc(t,i,r,n)):this.updateRemoteTrackSsrc(t,i,r,n),{}}updateRemoteTrackSsrc(e,t,i,r){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=i,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=r}updateRemoteTrackSubState(e){return e.video!==void 0&&((e.vMsid===this.videoSmallInfo.msid||!e.vMsid)&&(this.videoSmallInfo.subscribed=e.video),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribed=e.video)),e.screen!==void 0&&(this.screenInfo.subscribed=e.screen),e.audio!==void 0&&(this.audioInfo.subscribed=e.audio),{audioInfo:this.audioInfo,videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo,screenInfo:this.screenInfo}}updateRemoteUserDeviceStatus(e){let t=zo.parseStatus(e);const{audioDisable:i,videoDisable:r,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=i&&(this.userStatus.audioDisable=i,this.emit(dt.Remote,i?Me.MuteAudio:Me.UnmuteAudio)),this.userStatus.videoDisable!=r&&(this.userStatus.videoDisable=r,this.emit(dt.Remote,r?Me.MuteVideo:Me.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(dt.Remote,n?Me.MuteScreen:Me.UnmuteScreen))):(this.userStatus=t,this.emit(dt.Remote,i?Me.MuteAudio:Me.UnmuteAudio),this.emit(dt.Remote,r?Me.MuteVideo:Me.UnmuteVideo),this.emit(dt.Remote,n?Me.MuteScreen:Me.UnmuteScreen)),!1}}A(Fr,"logName","RemoteStreamInfo"),ih([j()],Fr.prototype,"updateRemoteTrackSubState",1);class Xo{constructor(c){A(this,"remoteUser");this.remoteUser=c}get userId(){return this.remoteUser.userId}get displayName(){return this.remoteUser.displayname}get isMuteAudioPlaying(){return this.remoteUser.getAudioMuted()}get hasAudio(){return this.remoteUser.hasAudioTrack}get hasCamera(){return this.remoteUser.hasVideoTrack}get hasCameraLarge(){return this.remoteUser.hasVideoLargeTrack}get hasCameraSmall(){return this.remoteUser.hasVideoSmallTrack}get hasScreenShare(){return this.remoteUser.hasScreenTrack}get isAudioSubscribing(){return this.remoteUser.isAudioSubscribing}get isVideoSubscribing(){return this.remoteUser.isVideoSubscribing}get isVideoLargeSubscribing(){return this.remoteUser.isVideoLargeSubscribing}get isVideoSmallSubscribing(){return this.remoteUser.isVideoSmallSubscribing}get isScreenSubscribing(){return this.remoteUser.isScreenSubscribing}}var rh=Object.defineProperty,sh=Object.getOwnPropertyDescriptor,st=(s,c,e,t)=>{for(var i=t>1?void 0:t?sh(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&rh(c,e,i),i};class ar extends we{constructor(){super();A(this,"state");A(this,"time");A(this,"_enabled");this.state=He.AliRtcStateSubscribeIdle,this.time=Date.now(),this._enabled=!0}setState(e){if(this.state===e)return;const t=this.state,i=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-i)/1e3))}get currentState(){return this.state}getEnabled(){return this._enabled}setEnabled(e){this._enabled=e}}const nh=30,Ur=class Ur extends Ho{constructor(e){var f;const{userId:t,displayName:i,rtsManager:r,usersViewMap:n,slsReporter:o,signalingManager:a,localUser:u,audioVolumeIndicationInterval:h,playoutVolume:g}=e;super(t,i,r,h);A(this,"remoteCallid","");A(this,"remoteUserInfo");A(this,"localUser");A(this,"lastPubId","");A(this,"stream");A(this,"screenStream");A(this,"viewMap");A(this,"audioTrack");A(this,"audioElement");A(this,"subscribed",!1);A(this,"mediaStream");A(this,"secondaryMediaStream");A(this,"prevSubConfig");A(this,"signalingManager");A(this,"slsReporter");A(this,"wantSubAudio",!1);A(this,"wantSubVideo",!1);A(this,"wantSubScreen",!1);A(this,"defaultVideoStreamType",rt.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioSubState");A(this,"videoSubState");A(this,"videoLargeSubState",new ar);A(this,"videoSmallSubState",new ar);A(this,"screenSubState");A(this,"streamInfo");A(this,"streamUrl","");A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});this.streamInfo=new Fr,this.remoteUserInfo=new Xo(this),this.streamInfo.on(dt.Remote,d=>{this.emit(dt.Remote,d,this.userId)}),this.signalingManager=a,this.viewMap=(f=n[t])!=null?f:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.slsReporter=o,this.localUser=u,this.audioSubState=new ar,this.audioSubState.on("change",(d,p,l)=>{this.emit("audioSubscribeStateChanged",this.uid,d,p,l)}),this.videoSubState=new ar,this.videoSubState.on("change",(d,p,l)=>{this.emit("videoSubscribeStateChanged",this.uid,d,p,l)}),this.screenSubState=new ar,this.screenSubState.on("change",(d,p,l)=>{this.emit("screenSubscribeStateChanged",this.uid,d,p,l)}),this.playoutVolume=g}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e}setRemoteDefaultVideoStreamType(e){e!==this.defaultVideoStreamType&&(this.defaultVideoStreamType=e,this.updateSubscribe(Ve.User))}setAudioMuted(e){this.audioMuted=e,this.toggleAudio(!e)}setPlayoutVolume(e){this.playoutVolume=e,this.audioElement&&(this.audioElement.volume=e)}getAudioMuted(){return this.audioMuted}get hasAudioTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasAudio)}get hasVideoTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideo)}get hasVideoLargeTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoLarge)}get hasVideoSmallTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoSmall)}get hasScreenTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasScreen)}get isAudioSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isAudioSubscribing)}get isVideoSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSubscribing)}get isVideoLargeSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoLargeSubscribing)}get isVideoSmallSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSmallSubscribing)}get isScreenSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isScreenSubscribing)}get audioEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.audioTrack)!=null&&t.enabled)}get videoEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get screenEnabled(){var e,t;return!!((t=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,t){if(t!==ke.AliRtcVideoTrackScreen&&t!==ke.AliRtcVideoTrackCamera)throw new ce(de.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?kn(e).forEach(r=>{r.setAttribute("playsinline",""),ye.AliRTS.BrowserUtil.isMicroMessenger&&(r.setAttribute("x5-video-player-type","h5-page"),r.setAttribute("x5-playsinline",""),ye.AliRTS.SystenUtil.isAndroid||ye.AliRTS.SystenUtil.isIos&&r.setAttribute("x-webkit-airplay","allow")),t===ke.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(r):this.viewMap.cameraViews.push(r),this.play(r,t===ke.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===ke.AliRtcVideoTrackScreen),t===ke.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return H(this,null,function*(){var t;e&&this.doStopSubscribe(this.streamUrl),Vn(Ur.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),(t=this.streamInfo)==null||t.removeAllListeners(dt.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,i,r){return H(this,null,function*(){var o;return this.remoteCallid=e,this.streamUrl=t!=null?t:"",this.callId=e!=null?e:"",this.streamInfo||(this.streamInfo=new Fr),(o=this.streamInfo)==null?void 0:o.updateTracks(r)})}subscribe(r,n){return H(this,arguments,function*(e,t,i=Date.now()){var d;let o=e;if(!o){const{hasAudio:p,hasVideo:l,hasScreen:m}=(d=this.streamInfo)!=null?d:{};o={audio:this.wantSubAudio&&p,video:this.wantSubVideo&&l,screen:this.wantSubScreen&&m}}const{screen:a,audio:u,video:h,vMsid:g}=o,f=[];(h||u)&&f.push({audio:u,video:h,vMsid:g}),a&&f.push({screen:a}),f.length!==0&&(yield Promise.all(f.map(p=>this.subscribeProxy(p,t||Ve.User,i))))})}subscribeProxy(e,t,i){return H(this,null,function*(){var o,a,u,h;let r=new Date().getTime(),n="";try{e.audio&&this.audioSubState.setState(He.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===He.AliRtcStateSubscribeIdle||this.videoSubState.currentState===He.AliRtcStateNoSubscribe)&&this.videoSubState.setState(He.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(He.AliRtcStateSubscribing);const g=yield this.rtsManager.subscribe({remoteUser:this,options:e},t,((o=this.localUser)==null?void 0:o.callId)||"",this.callId,i);this.streamInfo.updateRemoteTrackSubState(e),n=g.traceId||"";const{stream:f}=g;if(e.audio){this.trackTraceIdMap[Z.Audio]=n;const p=f.audioTrack;p&&(this.audioTrack=p,(a=f.mediaStream)==null||a.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(He.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(e.vMsid===Z.VideoSmall?(this.trackTraceIdMap[Z.VideoSmall]=n,this.videoSmallSubState.setState(He.AliRtcStateSubscribed)):(this.trackTraceIdMap[Z.VideoLarge]=n,this.videoLargeSubState.setState(He.AliRtcStateSubscribed)),this.videoSubState.setState(He.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(f,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.trackTraceIdMap[Z.Screen]=n,this.screenSubState.setState(He.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(f));const d=new Date().getTime()-r;this.slsReporter.reportSubscribe(((u=this.localUser)==null?void 0:u.callId)||"",this.callId,!!e.video&&e.vMsid===Z.VideoLarge,!!e.video&&e.vMsid===Z.VideoSmall,!!e.screen,!!e.audio,0,"",d,{pctid:this.rtsManager.pcTraceId,subtid:n,ajsub:t===Ve.Join?1:0,url:this.streamUrl,est:r}),this.startStreamMonitor()}catch(g){const f=new Date().getTime()-r;g&&(g.message=`user(${this.uid}) subscribe error, ${(g==null?void 0:g.message)||""}`);let d=de.ERR_INNER;e.audio&&(d=de.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED),e.video&&(e.vMsid===Z.VideoSmall?d=de.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED:d=de.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED),e.screen&&(d=de.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED),this.slsReporter.reportSubscribe(((h=this.localUser)==null?void 0:h.callId)||"",this.callId,!!e.video&&e.vMsid===Z.VideoLarge,!!e.video&&e.vMsid===Z.VideoSmall,!!e.screen,!!e.audio,d,"",f,{pctid:this.rtsManager.pcTraceId,subtid:"",ajsub:t===Ve.Join?1:0,url:this.streamUrl,est:r});const p=ce.fromError(g,d);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return H(this,null,function*(){const{audio:t,video:i,screen:r,vMsid:n}=e,o=[];(t||i)&&o.push({audio:t,video:i,vMsid:n}),r&&o.push({screen:r}),o.length!==0&&(yield Promise.all(o.map(a=>this.subscribeDeleteProxy(a))))})}subscribeDeleteProxy(e){return H(this,null,function*(){try{const t=yield this.rtsManager.subscibeDelete({remoteUser:this,options:e}),{stream:i}=t!=null?t:{},r={};e.audio===!0&&(r.audio=!1,this.audioSubState.setState(He.AliRtcStateNoSubscribe)),e.video===!0&&(r.video=!1,e.vMsid===Z.VideoSmall?(this.videoSmallSubState.setState(He.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===He.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===He.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(He.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(He.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===He.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===He.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(He.AliRtcStateNoSubscribe))),e.screen===!0&&(r.screen=!1,this.screenSubState.setState(He.AliRtcStateNoSubscribe));const{callId:n,remoteCallid:o}=this,a={callid:n,remoteCallid:o,remoteStream:i};return e.audio&&(this.audioLevelMonitor.stop(),this.stopPlayAudio(),this.audioTrack=void 0),this.streamInfo.updateRemoteTrackSubState({audio:e.audio===!0?!1:void 0,video:e.video===!0?!1:void 0,screen:e.screen===!0?!1:void 0,vMsid:e.vMsid}),a}catch(t){throw ce.fromError(t,de.ERR_INNER,"subscribe delete failed")}})}restore(){this.callId="",this.clearStream(),this.clearScreenStream(),this.audioTrack=void 0,this.streamInfo.updateRemoteTrackSubState({audio:!1,video:!1,screen:!1})}resumeAudio(){return H(this,null,function*(){var e;return(e=this.audioElement)==null?void 0:e.play()})}resumeVideo(e){return H(this,null,function*(){if(!e||e===ke.AliRtcVideoTrackCamera||e===ke.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===ke.AliRtcVideoTrackScreen||e===ke.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return H(this,null,function*(){var i,r;let t=new Date().getTime();try{let n;e?n=yield this.subscribeDeleteTracks(e):n=yield this.doStopSubscribe(this.streamUrl),this.slsReporter.reportUnsubscribe(((i=this.localUser)==null?void 0:i.callId)||(n==null?void 0:n.callid)||"",this.callId,new Date().getTime()-t,0,"")}catch(n){throw this.slsReporter.reportUnsubscribe(((r=this.localUser)==null?void 0:r.callId)||"",this.callId,new Date().getTime()-t,0,""),n}})}doStopSubscribe(e){return H(this,null,function*(){var r,n,o,a;const{callId:t,remoteCallid:i}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{this.stopStreamMonitor(),this.streamInfo.subscribingInfos.forEach(h=>{this.reportSubscribeMonitor(h)}),yield this.rtsManager.subscibeStop(e),this.restore();const u={callid:t,remoteCallid:i,remoteStream:this.stream};return this.callId="",u}catch(u){if(((a=(o=(n=(r=u==null?void 0:u.extraInfo)==null?void 0:r.parsedData)==null?void 0:n.streams)==null?void 0:o[0])==null?void 0:a.res_code)!==404)throw ce.fromError(u,de.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return H(this,null,function*(){this.stream&&this.stream.videoTrack&&e.mediaStream&&t&&(yield new Promise(i=>{let r,n;if(e.mediaStream){n=document.createElement("video");const o=()=>{le.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",o,!1),n=void 0,clearTimeout(r),i(!0)};n.addEventListener("canplaythrough",o,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else i(!0);r=window.setTimeout(()=>{le.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,i(!0)},3e3)}),this.updateSubscribe(Ve.User)),this.stream=e,this.playAll(),!this.subscribed&&e&&(this.subscribed=!0),e.hasAudio&&this.isAudioSubscribing&&e.enableAudio(),e.hasVideo&&this.isVideoSubscribing&&e.enableVideo()})}updateScreenStream(e){this.screenStream=e,this.playAll(!0),!this.subscribed&&e&&(this.subscribed=!0),e.hasVideo&&this.isScreenSubscribing&&e.enableVideo()}clearStream(){var e;(e=this.stream)==null||e.stop(),this.stream=void 0}clearScreenStream(){var e;(e=this.screenStream)==null||e.stop(),this.screenStream=void 0}updateSubscribe(e){var n,o,a,u,h,g,f,d;const t=Date.now(),i={},r={};return this.wantSubAudio&&!this.isAudioSubscribing&&((n=this.streamInfo)!=null&&n.hasAudio)?i.audio=!0:(!this.wantSubAudio||!((o=this.streamInfo)!=null&&o.hasAudio))&&this.isAudioSubscribing&&(r.audio=!0),this.wantSubVideo&&((a=this.streamInfo)!=null&&a.hasVideo)?(this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((u=this.streamInfo)!=null&&u.hasVideoSmall)?(i.video=!0,i.vMsid=Z.VideoSmall):!this.isVideoLargeSubscribing&&((h=this.streamInfo)!=null&&h.hasVideoLarge)&&!(this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(i.video=!0,i.vMsid=Z.VideoLarge),this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(r.video=!0,r.vMsid=Z.VideoLarge):this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(r.video=!0,r.vMsid=Z.VideoSmall)):(!this.wantSubVideo||!((g=this.streamInfo)!=null&&g.hasVideo))&&this.isVideoSubscribing&&(r.video=!0,r.vMsid=this.streamInfo.isVideoSmallSubscribing?Z.VideoSmall:Z.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((f=this.streamInfo)!=null&&f.hasScreen)?i.screen=!0:(!this.wantSubScreen||!((d=this.streamInfo)!=null&&d.hasScreen))&&this.isScreenSubscribing&&(r.screen=!0),(i.audio||i.video||i.screen)&&(this.createCallId(),this.subscribe(i,e,t)),r.audio&&r.video&&r.screen?this.stopSubscribe():(r.audio||r.video||r.screen)&&this.subscribeDeleteTracks(r),{addOption:i,deleteOption:r}}handleAutoPlayFailed(){this.emit("remoteAudioAutoPlayFail",this.uid);const e=()=>{this.resumeAudio().then(()=>{document.removeEventListener("click",e,!1),document.removeEventListener("touchstart",e,!1)})};document.addEventListener("click",e,!1),document.addEventListener("touchstart",e,!1)}handleVideoPlayFailded(e,t){this.emit("remoteVideoAutoPlayFail",this.uid,t);const i=()=>{var n;const r=(n=t===ke.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===r&&this.play(e,t===ke.AliRtcVideoTrackScreen),document.removeEventListener("click",i,!1),document.removeEventListener("touchstart",i,!1)};document.addEventListener("click",i,!1),document.addEventListener("touchstart",i,!1)}playAudio(){return H(this,null,function*(){var t,i;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.audioElement.volume=this.playoutVolume),((i=(t=this.audioElement.srcObject)==null?void 0:t.getAudioTracks())==null?void 0:i[0])!==this.audioTrack){let r=this.audioElement.srcObject;r?r.getAudioTracks().forEach(n=>{r.removeTrack(n)}):(r=new MediaStream,this.audioElement.srcObject=r),r.addTrack(this.audioTrack)}this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()});const e=this.audioElement;this.audioElement.addEventListener("playing",function r(){e.removeEventListener("playing",r),ye.AliRTS.SystenUtil.isIos&&parseInt(ye.AliRTS.SystenUtil.systemVersion)<=14&&(e.muted||(e.pause(),e.play()))})})}stopPlayAudio(){this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null)}playAll(e=!1){e?(this.viewMap.screenViews||[]).forEach(t=>{this.play(t,e)}):(this.viewMap.cameraViews||[]).forEach(t=>{this.play(t,e)})}play(e,t=!1){const i=t?this.screenStream:this.stream;!e||!i||!i.mediaStream||$o(e,i.mediaStream).catch(r=>{r.code===20||r.name==="AbortError"||this.handleVideoPlayFailded(e,t?ke.AliRtcVideoTrackScreen:ke.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{ai(t)}):this.viewMap.cameraViews.forEach(t=>{ai(t)})}toggleAudio(e=!0){this.audioSubState.setEnabled(e),this.audioTrack&&(this.audioTrack.enabled=e)}toggleVideo(e=!0){this.videoSubState.setEnabled(e),this.stream&&(e?this.stream.enableVideo():this.stream.disableVideo())}toggleScreen(e=!0){this.screenSubState.setEnabled(e),this.screenStream&&(e?this.screenStream.enableVideo():this.screenStream.disableVideo())}getStats(){return H(this,null,function*(){var i,r;const e=[];if(this.isAudioSubscribing){const n=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);n&&e.push({uid:this.uid,track:Vi.AliRtcAudioTrackMic,stats:n})}const t=[];if((i=this.streamInfo)!=null&&i.isVideoLargeSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoLarge);n&&t.push({uid:this.uid,track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeHigh,stats:n})}if((r=this.streamInfo)!=null&&r.isVideoSmallSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoSmall);n&&t.push({uid:this.uid,track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeLow,stats:n})}if(this.isScreenSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.Screen);n&&t.push({uid:this.uid,track:ke.AliRtcVideoTrackScreen,stats:n})}return{audio:e,video:t}})}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.audioTrack&&this.audioLevelMonitor.start(this.audioTrack,e),this.audioVolumeIndicationInterval=e)}reportSubscribeMonitor(e){var i;const t=e.msid;t&&(this.slsReporter.reportSubscribeMonitor(((i=this.localUser)==null?void 0:i.callId)||"",this.callId,this.trackTraceIdMap[t]||"",e,this.monitorDataCache[t]),this.monitorDataCache[t]=[])}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>H(this,null,function*(){try{if(this.streamInfo.subscribingInfos.length===0){this.stopStreamMonitor();return}this.streamInfo.subscribingInfos.forEach(e=>{const t=e.msid;if(!t)return;let i;const r=t===Z.Audio;r?i=this.rtsManager.getSubscribeAudioStats(this.streamUrl):i=this.rtsManager.getSubscribeVideoStats(this.streamUrl,t),i.then(n=>{var h;if(!n.timestamp)return;this.monitorDataCache[t]||(this.monitorDataCache[t]=[]);const o=this.monitorDataCache[t];let a;if((o==null?void 0:o.length)>0){const u=o[o.length-1]||{},{_last:f}=u;a=$r(u,["_last"])}(o==null?void 0:o.length)>=nh&&this.reportSubscribeMonitor(e),n._last=a,r&&(n._source=(h=this.localUser)==null?void 0:h.getMediaStats(n.playoutId)),this.monitorDataCache[t].push(n)})})}catch(e){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0)}};A(Ur,"logName","RemoteUser");let Je=Ur;st([j()],Je.prototype,"clear",1),st([j()],Je.prototype,"updateRemoteUserDeviceStatus",1),st([j()],Je.prototype,"updateRemoteTracks",1),st([j(ue)],Je.prototype,"subscribe",1),st([j()],Je.prototype,"subscribeProxy",1),st([j(ue)],Je.prototype,"subscribeDeleteProxy",1),st([j()],Je.prototype,"restore",1),st([j(ue)],Je.prototype,"stopSubscribe",1),st([j(ue)],Je.prototype,"doStopSubscribe",1),st([j()],Je.prototype,"clearStream",1),st([j()],Je.prototype,"clearScreenStream",1),st([j()],Je.prototype,"updateSubscribe",1),st([j()],Je.prototype,"playAudio",1),st([j()],Je.prototype,"stopPlayAudio",1),st([j(ue)],Je.prototype,"playAll",1),st([j()],Je.prototype,"play",1),st([j()],Je.prototype,"stopPlayAll",1);var oi=(s=>(s[s.AliRtcPluginErrorCodeSuccess=0]="AliRtcPluginErrorCodeSuccess",s[s.AliRtcPluginErrorCodeFailed=-1]="AliRtcPluginErrorCodeFailed",s[s.AliRtcPluginErrorNoFindPlugin=-2]="AliRtcPluginErrorNoFindPlugin",s[s.AliRtcPluginErrorParameterError=-3]="AliRtcPluginErrorParameterError",s[s.AliRtcPluginErrorLoadError=-4]="AliRtcPluginErrorLoadError",s[s.AliRtcPluginErrorCreateError=-5]="AliRtcPluginErrorCreateError",s[s.AliRtcPluginErrorInitError=-6]="AliRtcPluginErrorInitError",s[s.AliRtcPluginErrorInitTokenError=-7]="AliRtcPluginErrorInitTokenError",s))(oi||{});class ah extends we{constructor(){super(...arguments);A(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new ce(oi.AliRtcPluginErrorCreateError,`Plugin ${e.name} already exists`);this.plugins.set(e.name,e),t&&e.setOptions(t),this.emit("added",e),e.on("enabled",()=>this.emit("added",e)),e.on("disabled",()=>this.emit("removed",e)),e.on("updated",()=>this.emit("updated",e))}remove(e){const t=this.plugins.get(e);if(!t)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),t.removeAllListeners(),this.emit("removed",t)}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var oh=Object.defineProperty,ch=Object.getOwnPropertyDescriptor,ft=(s,c,e,t)=>{for(var i=t>1?void 0:t?ch(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&oh(c,e,i),i};const Or=([s])=>{const{remoteUser:c,options:e}=s;return[`user(${c.userId})`,e]},ht=(Ft=class extends we{constructor(e,t){super();A(this,"rts");A(this,"encodedInsertableStreams",!0);A(this,"audioRedEnabled",!1);A(this,"localStreamManager");A(this,"slsReporter");A(this,"connecting",!1);A(this,"connected",!1);A(this,"_pcTraceId","");A(this,"_localJoinTime",0);A(this,"connectionResolve");A(this,"connectingPromise");A(this,"dcResolve");A(this,"dcConnectingPromise");A(this,"_publishingTracks",[]);this.rts=ye.AliRTS.createClient(),this.localStreamManager=e,this.slsReporter=t,this.rts.on("connectStatusChange",i=>{var r,n,o,a;if(le.event(`[${Ft.logName}]`,"rts connectStatusChange to:",i.status),i.status===ye.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.emit("disconnected"),this.setConnected(!1),this.slsReporter.reportWarning("rts disconnected");else if(i.status===ye.EConnectStatus.CONNECT_STATUS_RECONNECTING)this.emit("reconnecting"),this.setConnected(!1),this.slsReporter.reportWarning("rts reconnecting");else if(i.status===ye.EConnectStatus.CONNECT_STATUS_CONNECTED){this.setConnected(!0);const u=(a=(o=(n=(r=this.rts.commonController)==null?void 0:r.peerCore)==null?void 0:n.getSignal())==null?void 0:o.getDatachannelCore())==null?void 0:a.readyState;le.event(Ft.logName,"dcReadyState:",u),u==="open"&&this.dcResolve&&this.dcResolve(!0),this.emit("connected")}}),this.rts.on("datachannelStatusChange",i=>{le.event(`[${Ft.logName}]`,"rts datachannelStatusChange to:",i.status),i.status===ye.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):i.status===ye.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(r=>{this.dcResolve=r}),console.warn("DC DisConnected"))}),this.rts.on("receivedSEI",i=>{this.emit("seimessage",i.url,i.sei.payloadType,i.sei.data)})}get pcTraceId(){return this._pcTraceId}set localJoinTime(e){this._localJoinTime=e}setEncodedInsertableStreams(e){this.encodedInsertableStreams=e}setAudioRedEnabled(e){var t;if(e!==this.audioRedEnabled){try{const r=[...((t=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:t.codecs)||[]];if(r.length>0){if(e){const n=r.findIndex(a=>a.mimeType==="audio/red"),o=r.findIndex(a=>a.mimeType==="audio/opus");if(n>-1&&o>-1&&n>o){const a=r[o];r[o]=r[n],r[n]=a}}this.rts.setSenderCodecPreferences({audio:r}),this.rts.setReceiverCodecPreferences({audio:r})}}catch(i){}this.audioRedEnabled=e}}destroy(){this.rts.unpublish()}startConnect(){this.connecting=!0,this.connectingPromise=new Promise(e=>{this.connectionResolve=e}),this.dcConnectingPromise=new Promise(e=>{this.dcResolve=e})}setConnected(e){var t;this.connected=e,this.connecting=!1,(t=this.connectionResolve)==null||t.call(this,!0),e||(this.dcConnectingPromise=new Promise(i=>{this.dcResolve=i}))}get isConnecting(){return this.connecting}get isConnected(){return this.connected}get publishingTracks(){return this._publishingTracks}getPubMsid(e,t){const{aMsid:i,vMsid:r}=t!=null?t:{},n={};return e.hasAudio&&(n.aMsid=[i!=null?i:Z.Audio]),e.hasScreen&&(n.vMsid=[Z.Screen]),e.hasVideo&&(n.vMsid=[r!=null?r:t!=null&&t.isScreen?Z.Screen:Z.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:i,ssrc:r,codec:n,type:o,trackId:a})=>({msid:t,from:i,type:o,ssrc:`${r}`,codec:n!=null?n:"",trackId:a})))}httpPublish(n,o){return H(this,arguments,function*(e,t,i=!1,r=di.MANUAL){const{publishStream:a,videoSmallStream:u,screenStream:h,vMsid:g}=yield this.localStreamManager.createHTTPPublishStream();if(!a)return"";const f=this.getPubMsid(a,{vMsid:g});f.retryTimes=0,this.encodedInsertableStreams&&(f.encodedInsertableStreams=!0);let d=!a.hasVideo,p=g;try{this.startConnect();const l=Date.now(),m=yield this.rts.publish(e,a,f);this.slsReporter.reportPublish(i,e,t,a.hasVideo&&(!g||g===Z.VideoLarge),a.hasVideo&&g===Z.VideoSmall,a.hasVideo&&g===Z.Screen,a.hasAudio,0,m,m,l);const x=Date.now();return this._pcTraceId=m,this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),u&&(yield this.publishAdd(e,u,t,{vMsid:Z.VideoSmall},i),d=!1,p=Z.VideoSmall),h&&(yield this.publishAdd(e,h,t,{vMsid:Z.Screen},i),d=!1,p=Z.Screen),yield this.waitPublishSender(e,d,p),this.slsReporter.reportPublishFirstPacket(i,t,l,x,this._localJoinTime,d?Z.Audio:f.vMsid,m||"",m||"",r),m}catch(l){throw this.setConnected(!1),l}})}waitPublishSender(e,t=!1,i){return H(this,null,function*(){const r=(n,o)=>{let a=0;const u=()=>(t?this.rts.getPublishAudioStats(e,i):this.rts.getPublishVideoStats(e,i)).then(g=>!(g.bytesSent>0)&&a<n?(a++,new Promise(d=>setTimeout(()=>d(u()),o))):Promise.resolve());return u()};return Promise.race([wi(1e3),r(5,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return H(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return H(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(h,g,f,d){return H(this,arguments,function*(e,t,i,r,n=!1,o=0,a=!1,u=di.MANUAL){var m,x,v,b,w,_,C,E;yield this.dcConnectingPromise;const p=Date.now(),l=this.getPubMsid(t,r);try{const I=yield this.rts.publishAdd([Ce({url:e,stream:t,updateSourceStream:!1},l)]);if(I){const L=Date.now(),[k]=I;return this.slsReporter.reportPublish(!1,e,i,((m=l.vMsid)==null?void 0:m[0])===Z.VideoLarge,((x=l.vMsid)==null?void 0:x[0])===Z.VideoSmall,((v=l.vMsid)==null?void 0:v[0])===Z.Screen,((b=l.aMsid)==null?void 0:b[0])===Z.Audio,0,this.pcTraceId,k.traceId||"",p),this.updatePublishingTracks(k.trackInfoList),a&&(yield this.waitPublishSender(e,!t.hasVideo,t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)),this.slsReporter.reportPublishFirstPacket(n||o>0,i,p,L,this._localJoinTime,(t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)||"",this.pcTraceId,k.traceId||"",u),k.traceId||""}}catch(I){if(this.slsReporter.reportPublish(!1,e,i,((w=l.vMsid)==null?void 0:w[0])===Z.VideoLarge,((_=l.vMsid)==null?void 0:_[0])===Z.VideoSmall,((C=l.vMsid)==null?void 0:C[0])===Z.Screen,((E=l.aMsid)==null?void 0:E[0])===Z.Audio,I.errorCode||-1,this.pcTraceId,"",p),I.errorCode===15006&&o<3)return yield this.publishAdd(e,t,i,r,n,o+1);throw I}return""})}publishDelete(e,t){return H(this,null,function*(){var h,g,f,d,p,l,m,x;yield this.dcConnectingPromise;const i=(g=(h=this.publishingTracks)==null?void 0:h.find(({msid:v})=>v===Z.Audio))==null?void 0:g.msid,r=(d=(f=this.publishingTracks)==null?void 0:f.find(({msid:v})=>v===Z.VideoLarge))==null?void 0:d.msid,n=(l=(p=this.publishingTracks)==null?void 0:p.find(({msid:v})=>v===Z.Screen))==null?void 0:l.msid,o=[];t.screen&&n?o.push(n):t.video&&o.push(t.vMsid||r);const a=[];t.audio&&i&&a.push(i),le.event(Ft.logName,"publishDelete",{streamUrl:e,aMsid:a,vMsid:o});const[u]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:a,vMsid:o}]))||[];return le.event(Ft.logName,"publishDelete",{result:u}),u&&this.updatePublishingTracks(u.trackInfoList),((x=(m=u==null?void 0:u.trackInfoList)==null?void 0:m[0])==null?void 0:x.trackId)||""})}publishReplace(e,t,i){return H(this,null,function*(){var u,h;yield this.dcConnectingPromise;const{vMsid:r,aMsid:n}=i!=null?i:{},o=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:r,aMsid:n}]),[a]=o;return this.updatePublishingTracks(a.trackInfoList),((h=(u=a==null?void 0:a.trackInfoList)==null?void 0:u[0])==null?void 0:h.trackId)||""})}publishStop(e){return H(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}unpublish(){return H(this,null,function*(){yield this.rts.unpublish(),this.connecting=!1,this.connected=!1})}getSubConfig(e,t){let i=t!=null?t:{};t||(i={audio:!0,video:!0,screen:!0});const r={};return i.audio&&(r.aMsid=[(e==null?void 0:e.getAudioInfo().msid)||Z.Audio]),i.video?i.vMsid?r.vMsid=[i.vMsid]:e!=null&&e.hasVideoLarge?r.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||Z.VideoLarge]:e!=null&&e.hasVideoSmall?r.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||Z.VideoSmall]:r.vMsid=[Z.VideoLarge]:i.screen&&e!=null&&e.hasScreen&&(r.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||Z.Screen]),r}httpSubscribe(e){return H(this,null,function*(){const{remoteUser:t,options:i}=e;let r=t.streamUrl;i.video||i.screen?i!=null&&i.audio||(r+="@subaudio=no"):r+="@subvideo=no";const n=this.getSubConfig(t.streamInfo,i);n.retryTimes=0,this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0);try{this.startConnect();const o=yield this.rts.subscribe(r,n);return this._pcTraceId=o.traceId,this.setConnected(!0),{traceId:o.traceId,stream:o}}catch(o){throw this.setConnected(!1),o}})}subscribeAdd(e){return H(this,null,function*(){var n,o,a,u;const{remoteUser:t,options:i}=e,r=Yt(Ce({url:t.streamUrl,subAudio:!!i.audio,subVideo:!!(i.screen||i.video)},this.getSubConfig(t.streamInfo,i)),{targetStream:i.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeAdd([r]))[0]}catch(h){if(((u=(a=(o=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:o.streams)==null?void 0:a[0])==null?void 0:u.res_code)===508)return this.emit("subscribeexceeds"),null;throw ce.fromError(h)}})}subscibeDelete(e){return H(this,null,function*(){var n,o,a,u;yield this.dcConnectingPromise;const{remoteUser:t,options:i}=e,r=Yt(Ce({url:t.streamUrl,subAudio:!!i.audio,subVideo:!!(i.screen||i.video)},this.getSubConfig(t.streamInfo,i)),{targetStream:i.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeDeleteTracks([r]))[0]}catch(h){if(((u=(a=(o=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:o.streams)==null?void 0:a[0])==null?void 0:u.res_code)===404)return;throw h}})}subscibeStop(e){return H(this,null,function*(){var t,i,r,n;try{yield this.rts.subscribeStop([{url:e}])}catch(o){if(((n=(r=(i=(t=o==null?void 0:o.extraInfo)==null?void 0:t.parsedData)==null?void 0:i.streams)==null?void 0:r[0])==null?void 0:n.res_code)===404)return;throw o}})}publish(n,o){return H(this,arguments,function*(e,t,i=!1,r=di.MANUAL){let a="";if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let u=!1,h;const{audio:g,video:f,videoSmall:d,screen:p}=this.localStreamManager.publishStreams;g&&(a=yield this.publishAdd(e,g,t,{aMsid:Z.Audio},i),u=!0,h=Z.Audio,yield wi(100)),f&&(a=yield this.publishAdd(e,f,t,{vMsid:Z.VideoLarge},i),u=!1,h=Z.VideoLarge,yield wi(100)),d&&(a=yield this.publishAdd(e,d,t,{vMsid:Z.VideoSmall},i),u=!1,h=Z.VideoSmall,yield wi(100)),p&&(a=yield this.publishAdd(e,p,t,{isScreen:!0,vMsid:Z.Screen},i),u=!1,h=Z.Screen),h&&(yield this.waitPublishSender(e,u,h))}else a=yield this.httpPublish(e,t,i,r);return a})}subscribe(e,t,i,r,n){return H(this,null,function*(){const{options:o,remoteUser:a}=e;if(o.video&&o.screen)throw new ce(de.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let u,h=Date.now();this.connected?(yield this.dcConnectingPromise,h=Date.now(),u=yield this.subscribeAdd(e)):u=yield this.httpSubscribe(e);const g=Date.now();let f=Z.VideoLarge,d=o.video||o.screen,p=o.audio;o.video&&o.vMsid?f=o.vMsid:o.screen&&(f=Z.Screen);let l=0,m=0,x=0,v=0;return((w,_)=>{let C=0;const E=()=>{let I;return p&&!x&&(I=this.rts.getSubscribeAudioStats(a.streamUrl).then(L=>{if(L.packetsReceived>0&&(l=Date.now()),L.audioLevel>0)x=Date.now();else if(!d)return C<w?(C++,new Promise(k=>setTimeout(()=>k(E()),_))):!1;return!0})),d&&!v&&(I=this.rts.getSubscribeVideoStats(a.streamUrl,f).then(L=>{if(L.packetsReceived>0&&(m=Date.now()),L.framesDecoded>0)v=Date.now();else return C<w?(C++,new Promise(k=>setTimeout(()=>k(E()),_))):(le.error(`[${Ft.logName}]`,"checkInStatsWithRetry fail"),!1);return!0})),Promise.resolve(I)};return E()})(20,100).then(()=>{m&&this.slsReporter.reportSubscribeFirstPacket(t===Ve.Resume,i,r,f,{fprt:m-h,ifsprtc:v?v-h:0,ajsub:t===Ve.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:g-h}),v&&this.slsReporter.reportSubscribeFirstFrame(t===Ve.Resume,i,r,f,{fvfrt:v-h,fp2fftc:v-m,ajsub:t===Ve.Join?1:0,tffrtc:t===Ve.Join?v-this.localJoinTime:v-n,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",fvfdtc:v-h}),l&&this.slsReporter.reportSubscribeFirstPacket(t===Ve.Resume,i,r,Z.Audio,{fprt:l-h,ifsprtc:x?x-h:0,ajsub:t===Ve.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:g-h})}),u})}getSubscribeVideoStats(e,t){return H(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return H(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}getStreamByMsid(e){return this.rts.commonController.streamManager.getStreamByMsid(e)}getPCStats(){return H(this,null,function*(){var e,t;return(t=(e=this.rts.commonController.peerCore)==null?void 0:e.pc)==null?void 0:t.getStats()})}sendSEI(e,t,i,r){return H(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:Z.VideoLarge,data:t,repeatCount:i,payloadType:r})})}},A(Ft,"logName","RtsManager"),Ft);ft([j()],ht.prototype,"updatePublishingTracks",1),ft([j(ue,ue)],ht.prototype,"httpPublish",1),ft([j(ue,ue)],ht.prototype,"waitPublishSender",1),ft([j(([s,c,e])=>[s,JSON.stringify(e)],ue)],ht.prototype,"publishAdd",1),ft([j(ue,ue)],ht.prototype,"publishDelete",1),ft([j(([s,c,e])=>[s,JSON.stringify(e)])],ht.prototype,"publishReplace",1),ft([j(ue)],ht.prototype,"publishStop",1),ft([j()],ht.prototype,"unpublish",1),ft([j(Or,({traceId:s})=>s)],ht.prototype,"httpSubscribe",1),ft([j(Or,({traceId:s})=>s)],ht.prototype,"subscribeAdd",1),ft([j(Or)],ht.prototype,"subscibeDelete",1),ft([j(ue)],ht.prototype,"subscibeStop",1),ft([j(ue)],ht.prototype,"publish",1),ft([j(Or)],ht.prototype,"subscribe",1),ft([j()],ht.prototype,"sendSEI",1);let uh=ht;class Tn{constructor(){A(this,"profile");A(this,"profileMap",new Map);A(this,"audioProfile");A(this,"contentHint")}updateProfile(c,e){e&&this.profileMap.set(c,e),this.profile=c}get videoProfile(){return this.profile}updateAudioProfile(c){this.audioProfile=c}setContentHint(c,e){e&&(this.contentHint=e),this.contentHint&&c&&(c.contentHint=this.contentHint)}setVideoProfile(c,e,t=!1){return H(this,null,function*(){if(!this.profile)return;const i=this.profileMap.get(this.profile)||(e==null?void 0:e.VideoProfileMap.get(this.profile));if(i){if(!t&&c&&c.applyConstraints)try{yield c.applyConstraints(i)}catch(r){}e&&(e==null||e.VideoProfileMap.set(this.profile,i),yield e.setVideoProfile(this.profile))}})}}class Dn extends we{constructor(e){super();A(this,"type");A(this,"originVideoTrack");A(this,"videoSource");A(this,"_videoMuted",!1);A(this,"originAudioTrack");A(this,"audioSource");A(this,"_audioMuted",!1);A(this,"_targetVideoTrack");A(this,"_targetDualVideoTrack");A(this,"_targetAudioTrack");A(this,"_publishVideoStream");A(this,"_publishDualVideoStream");A(this,"_publishAudioStream");A(this,"_previewStream");A(this,"plugins",[]);A(this,"_profileManager");A(this,"cameraVideoConstraints");A(this,"micAudioConstraints");A(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});A(this,"onAudioTrackEnded",()=>{this.emit("audiotrackended")});this.type=e}get profileManager(){return this._profileManager}get audioProfile(){var e;return(e=this.profileManager)==null?void 0:e.audioProfile}updateSource(e,t,i){return H(this,null,function*(){var o,a,u,h,g,f;const{videoTrack:r,audioTrack:n}=e;r&&((o=this.originVideoTrack)==null||o.removeEventListener("ended",this.onVideoTrackEnded)),n&&((a=this.originAudioTrack)==null||a.removeEventListener("ended",this.onAudioTrackEnded)),this.type===Qe.AliRtcSdkStreamTypeScreen?this.stop():(r&&((u=this.originVideoTrack)==null||u.stop()),n&&((h=this.originAudioTrack)==null||h.stop())),r&&(this.originVideoTrack=r,(g=this.originVideoTrack)==null||g.addEventListener("ended",this.onVideoTrackEnded),this.videoSource=t||Ri.Camera,this.updateVideoTrack(r)),n&&(this.originAudioTrack=n,(f=this.originAudioTrack)==null||f.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=i||ur.Microphone,this.updateAudioTrack(n))})}get currentProfile(){var e;return(e=this.profileManager)==null?void 0:e.profile}get currentVideoTrack(){return this._targetVideoTrack}get currentDualVideoTrack(){return this._targetDualVideoTrack}get publishVideoStream(){return this._publishVideoStream}get publishDualVideoStream(){return this._publishDualVideoStream}get currentAudioTrack(){return this._targetAudioTrack}get publishAudioStream(){return this._publishAudioStream}get previewStream(){return this._previewStream}updateVideoTrack(e,t=!1){return H(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return H(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return H(this,null,function*(){(this._targetAudioTrack!==e||t)&&(this._targetAudioTrack=e)})}setAudioMuted(e){var t,i;this._audioMuted=e,e?(t=this.publishAudioStream)==null||t.disableAudio():(i=this.publishAudioStream)==null||i.enableAudio()}get isAudioMuted(){return this._audioMuted}setVideoMuted(e){var t,i;this._videoMuted=e,e?(t=this.publishVideoStream)==null||t.disableVideo():(i=this.publishVideoStream)==null||i.enableVideo()}get isVideoMuted(){return this._videoMuted}process(e){return H(this,null,function*(){var t,i,r,n,o,a,u,h,g,f,d,p;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const l of this.plugins)try{yield l.execute(this,e)}catch(m){console.error(`error in plugin-${l.name}, error: ${m}`)}this._targetVideoTrack?((i=(t=this._publishVideoStream)==null?void 0:t.videoTrack)==null?void 0:i.id)!==this._targetVideoTrack.id&&(this._publishVideoStream=yield nr(this._targetVideoTrack),this.setVideoMuted(this._videoMuted),(r=this.profileManager)==null||r.setVideoProfile(this.originVideoTrack,this._publishVideoStream,!0),(n=this.profileManager)==null||n.setContentHint(this._targetVideoTrack),this.previewStream?(o=this.previewStream)==null||o.mergeStream(this._publishVideoStream):this._previewStream=yield nr(this._targetVideoTrack)):(this._publishVideoStream=void 0,(a=this.previewStream)==null||a.deleteTracks({video:!0})),this._targetDualVideoTrack?((h=(u=this._publishDualVideoStream)==null?void 0:u.videoTrack)==null?void 0:h.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield nr(this._targetDualVideoTrack),this._videoMuted?this._publishDualVideoStream.disableVideo():this._publishDualVideoStream.enableVideo()):this._publishDualVideoStream=void 0,this._targetAudioTrack?((f=(g=this._publishAudioStream)==null?void 0:g.audioTrack)==null?void 0:f.id)!==this._targetAudioTrack.id&&(this._publishAudioStream=yield nr(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(d=this.previewStream)==null||d.mergeStream(this._publishAudioStream):this._previewStream=yield nr(this._targetAudioTrack)):(this._publishAudioStream=void 0,(p=this.previewStream)==null||p.deleteTracks({audio:!0}))})}stopVideo(){var e,t;this.originVideoTrack&&((e=this.originVideoTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originVideoTrack)==null||t.stop(),this.originVideoTrack=void 0),this.updateVideoTrack(void 0)}stopAudio(){var e,t;this.originAudioTrack&&((e=this.originAudioTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originAudioTrack)==null||t.stop(),this.originAudioTrack=void 0),this.updateAudioTrack(void 0)}stop(){this.stopVideo(),this.stopAudio()}updateVideoProfile(e,t){return H(this,null,function*(){this._profileManager||(this._profileManager=new Tn),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===Qe.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new Tn),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return H(this,null,function*(){this._profileManager||(this._profileManager=new Tn),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return H(this,null,function*(){var t;yield(t=this.profileManager)==null?void 0:t.setVideoProfile(void 0,e)})}addPlugin(e){const t=this.plugins.findIndex(i=>i.zIndex>e.zIndex);t>-1?this.plugins.splice(t,0,e):this.plugins.push(e)}removePlugin(e){const t=this.plugins.indexOf(e);return t>-1?(e.clear(this),this.plugins.splice(t,1),!0):!1}}var hh=Object.defineProperty,lh=Object.getOwnPropertyDescriptor,Mt=(s,c,e,t)=>{for(var i=t>1?void 0:t?lh(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&hh(c,e,i),i};const Pt=(Ui=class extends we{constructor(e,t){super();A(this,"pluginManager");A(this,"slsReporter");A(this,"publishingCameraVideoStream");A(this,"publishingScreenVideoStream");A(this,"cameraStreamInfo",new Dn(Qe.AliRtcSdkStreamTypeCapture));A(this,"screenStreamInfo",new Dn(Qe.AliRtcSdkStreamTypeScreen));A(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);A(this,"_audioCaptureDisabled",!1);A(this,"_cameraCaptureDisabled",!1);A(this,"_publishLocalAudioStreamEnabled",!0);A(this,"_publishLocalVideoStreamEnabled",!0);A(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e,this.slsReporter=t;const i=r=>H(this,null,function*(){if(le.info(`[${Ui.logName}]`,"plugin added",r.name),!r.isSupported("6.11.7-beta.0")){console.warn(`${r.name} is not supported!!!`),r.emit("unsupported");return}try{yield r.init()}catch(n){r.emit("error",ce.fromError(n,oi.AliRtcPluginErrorInitError))}r.streamType===Qe.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(r),yield this.cameraStreamInfo.process(this.streamInfos)),r.streamType===Qe.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(r),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(jo,rr),this.cameraStreamInfo.on("videotrackended",()=>H(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",Ei.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>H(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",Ei.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(Wo,sr),this.screenStreamInfo.on("videotrackended",()=>H(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",Ei.ScreenTrackEnded)})),this.pluginManager.on("added",i),this.pluginManager.on("removed",r=>H(this,null,function*(){this.cameraStreamInfo.removePlugin(r)&&(yield this.cameraStreamInfo.process(this.streamInfos)),this.screenStreamInfo.removePlugin(r)&&(yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")})),this.pluginManager.on("updated",()=>H(this,null,function*(){yield this.updateStreams()}))}get hasCamera(){return!!this.cameraStreamInfo.originVideoTrack}get audioCaptureDisabled(){return this._audioCaptureDisabled}set audioCaptureDisabled(e){this._audioCaptureDisabled=e}get cameraCaptureDisabled(){return this._cameraCaptureDisabled}setAudioMuted(e){this.cameraStreamInfo.setAudioMuted(e)}get isAudioMuted(){return this.cameraStreamInfo.isAudioMuted}setCameraMuted(e){this.cameraStreamInfo.setVideoMuted(e)}get isCameraMuted(){return this.cameraStreamInfo.isVideoMuted}setScreenMuted(e){this.screenStreamInfo.setVideoMuted(e)}get isScreenMuted(){return this.screenStreamInfo.isVideoMuted}set cameraCaptureDisabled(e){this._cameraCaptureDisabled=e}get publishLocalAudioStreamEnabled(){return this._publishLocalAudioStreamEnabled}set publishLocalAudioStreamEnabled(e){this._publishLocalAudioStreamEnabled=e}get publishLocalVideoStreamEnabled(){return this._publishLocalVideoStreamEnabled}set publishLocalVideoStreamEnabled(e){this._publishLocalVideoStreamEnabled=e}get publishLocalScreenStreamEnabled(){return this._publishLocalScreenStreamEnabled}set publishLocalScreenStreamEnabled(e){this._publishLocalScreenStreamEnabled=e}updateStreams(){return H(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return H(this,null,function*(){var e,t,i,r;if((e=this.cameraStreamInfo.cameraVideoConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.cameraVideoConstraints)==null?void 0:t.deviceId;const o=yield ye.AliRTS.getCameraList();o.find(a=>a.deviceId===n)||(n=(r=(i=o.find(a=>!!a.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return H(this,null,function*(){var e,t,i,r;if((e=this.cameraStreamInfo.micAudioConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.micAudioConstraints)==null?void 0:t.deviceId;const o=yield ye.AliRTS.getMicList();o.find(a=>a.deviceId===n)||(n=(r=(i=o.find(a=>!!a.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return H(this,null,function*(){var g;const{screen:t,mediaStream:i,videoProfile:r,screenProfile:n}=e;let{video:o,audio:a}=e;const u=Ju(e);let h;if(u){i||(o===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),o=Ce({},this.cameraStreamInfo.cameraVideoConstraints)):typeof o=="object"&&(yield this.setAvailableCameraDeviceId(),o=Ce(Ce({},o),this.cameraStreamInfo.cameraVideoConstraints)),a===void 0&&this.audioCaptureDisabled?a=!1:a&&(a===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),a=Ce({},this.cameraStreamInfo.micAudioConstraints)):typeof a=="object"&&(yield this.setAvailableMicrophoneDeviceId(),a=Ce(Ce({},a),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1));const f=Date.now();try{h=yield ye.AliRTS.createStream({audio:a,video:o,screen:t,custom:!!i,mediaStream:i,skipProfile:!0}),a&&!i&&this.slsReporter.reportAudio(null,Date.now()-f,((g=h==null?void 0:h.audioTrack)==null?void 0:g.label)||""),t&&!i&&this.slsReporter.reportScreen(null,Date.now()-f)}catch(d){throw a&&!i&&this.slsReporter.reportAudio(d,Date.now()-f,""),t&&!i&&this.slsReporter.reportScreen(null,Date.now()-f),d}if(t)yield this.screenStreamInfo.updateSource(h,Ri.Screen,ur.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,Ri.Camera,ur.Microphone),h.hasVideo&&(yield this.setVideoProfile(r),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof a=="boolean"){const d=this.cameraStreamInfo.audioProfile;d&&(yield h.setAudioProfile(d))}}return ye.AliRTS.SystenUtil.isIos&&ye.AliRTS.SystenUtil.compareVersion("15.1")&&!ye.AliRTS.SystenUtil.compareVersion("15.2")&&(yield wi(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return H(this,null,function*(){const{screen:t,video:i,audio:r}=e!=null?e:{};let n=!1;i&&this.cameraStreamInfo.originVideoTrack&&(n=!0,this.cameraStreamInfo.stopVideo(),this.publishingCameraVideoStream=void 0),r&&this.cameraStreamInfo.originAudioTrack&&(n=!0,this.cameraStreamInfo.stopAudio()),t&&this.screenStreamInfo.originVideoTrack&&(n=!0,this.screenStreamInfo.stop(),this.publishingScreenVideoStream=void 0,this.slsReporter.reportScreenStop(null)),n&&(yield this.updateStreams())})}get publishStreams(){const{publishLocalVideoStreamEnabled:e,publishLocalAudioStreamEnabled:t,publishLocalScreenStreamEnabled:i}=this;return{video:e?this.cameraStreamInfo.publishVideoStream:void 0,videoSmall:e?this.cameraStreamInfo.publishDualVideoStream:void 0,audio:t?this.cameraStreamInfo.publishAudioStream:void 0,screen:i?this.screenStreamInfo.publishVideoStream:void 0}}createHTTPPublishStream(){return H(this,null,function*(){var a,u,h,g;let e,t=!1,i,r,n;const o=yield this.publishStreams;try{if(!o.audio&&!o.video&&!o.videoSmall&&!o.screen)throw new ce(de.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const f=new MediaStream;(a=o.audio)!=null&&a.audioTrack&&f.addTrack(o.audio.audioTrack),(u=o.video)!=null&&u.videoTrack?(f.addTrack(o.video.videoTrack),r=o.videoSmall,n=o.screen):(h=o.screen)!=null&&h.videoTrack&&(i=Z.Screen,f.addTrack((g=o.screen)==null?void 0:g.videoTrack),t=!0),e=yield Jo(f),t?(this.screenStreamInfo.cloneVideoProfile(e),this.publishingScreenVideoStream=e):(this.cameraStreamInfo.cloneVideoProfile(e),this.publishingCameraVideoStream=e)}catch(f){}return{publishStream:e,videoSmallStream:r,screenStream:n,vMsid:i}})}stop(){this.cameraStreamInfo.stop(),this.screenStreamInfo.stop()}setVideoProfile(e,t){return H(this,null,function*(){yield this.cameraStreamInfo.updateVideoProfile(e,t),this.publishingCameraVideoStream&&this.cameraStreamInfo.cloneVideoProfile(this.publishingCameraVideoStream)})}setVideoContentHint(e){this.cameraStreamInfo.setVideoContentHint(e)}setAudioProfile(e){return H(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return H(this,null,function*(){yield this.screenStreamInfo.updateVideoProfile(e,t),this.publishingScreenVideoStream&&this.screenStreamInfo.cloneVideoProfile(this.publishingScreenVideoStream)})}setScreenContentHint(e){this.screenStreamInfo.setVideoContentHint(e)}setCameraVideoConstraints(e){var t;this.cameraStreamInfo.cameraVideoConstraints=Ce(Ce({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=Ce(Ce({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},A(Ui,"logName","LocalStreamManager"),Ui);Mt([j(([s])=>{const{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:o}=s;return[{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:o}]})],Pt.prototype,"createLocalStream",1),Mt([j(ue)],Pt.prototype,"stopLocalStream",1),Mt([j()],Pt.prototype,"createHTTPPublishStream",1),Mt([j()],Pt.prototype,"stop",1),Mt([j(ue)],Pt.prototype,"setVideoProfile",1),Mt([j(ue)],Pt.prototype,"setVideoContentHint",1),Mt([j(ue)],Pt.prototype,"setAudioProfile",1),Mt([j(ue)],Pt.prototype,"setScreenProfile",1),Mt([j(ue)],Pt.prototype,"setScreenContentHint",1),Mt([j(ue)],Pt.prototype,"setCameraVideoConstraints",1),Mt([j(ue)],Pt.prototype,"setMicAudioConstraints",1);let dh=Pt;var fh=Object.defineProperty,ph=Object.getOwnPropertyDescriptor,Nt=(s,c,e,t)=>{for(var i=t>1?void 0:t?ph(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&fh(c,e,i),i};class wt extends we{constructor(e){super();A(this,"self");A(this,"userMap",{});A(this,"usersViewMap",{});A(this,"rtsManager");A(this,"localStreamManager");A(this,"authInfo");A(this,"signalingManager");A(this,"pluginManager");A(this,"slsReporter");A(this,"statsMonitorId");A(this,"autoSubAudio",!0);A(this,"autoSubVideo",!0);A(this,"autoSubScreen",!0);A(this,"wantSubAudio",!0);A(this,"wantSubVideo",!0);A(this,"wantSubScreen",!0);A(this,"defaultStreamType",rt.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioVolumeIndicationInterval",0);A(this,"indicationTimer",0);const{signalingManager:t,slsReporter:i}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.slsReporter=i,this.pluginManager=new ah,this.localStreamManager=new dh(this.pluginManager,this.slsReporter),this.rtsManager=new uh(this.localStreamManager,this.slsReporter),this.self=new Go({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{le.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})}),this.signalingManager.stsManager.on("onTokenUpdate",(e,t)=>{le.updateToken(e),this.slsReporter.updateToken(t,e)})}isAutoSubAudio(){return this.autoSubAudio}setAutoSubAudio(e){this.autoSubAudio=e}isAutoSubVideo(){return this.autoSubVideo}setAutoSubVideo(e){this.autoSubVideo=e}isAutoSubScreen(){return this.autoSubScreen}setAutoSubScreen(e){this.autoSubScreen=e}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e,this.remoteUsers.forEach(t=>{t.setWantSubAudio(e),t.updateSubscribe(Ve.User)})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe(Ve.User)})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe(Ve.User)})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var i;(i=this.getRemoteUser(e))==null||i.setRemoteDefaultVideoStreamType(t)}setAudioMuted(e){this.audioMuted=e,this.remoteUsers.forEach(t=>{t.setAudioMuted(e)})}setLocalViewConfig(e,t){var r;if(!e)return(r=this.publisher)==null?void 0:r.setViewConfig(null,t);const i=kn(e);i.length!==0&&i.forEach(n=>{var o,a;(o=this.publisher)==null||o.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:u=[],screenViews:h=[]})=>{u.includes(n)&&u.splice(u.indexOf(n),1),h.includes(n)&&h.splice(h.indexOf(n),1)}),(a=this.publisher)==null||a.setViewConfig(i,t)})}setRemoteViewConfig(e,t,i){var n,o;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,i);const r=kn(t);r.length!==0&&(r.forEach(a=>{var u;(u=this.publisher)==null||u.resetElement(a),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:g=[]})=>{h.includes(a)&&h.splice(h.indexOf(a),1),g.includes(a)&&g.splice(g.indexOf(a),1)})}),(o=this.userMap[e])==null||o.setViewConfig(r,i))}get channel(){var e;return(e=this.authInfo)==null?void 0:e.channelId}get userId(){var e;return(e=this.authInfo)==null?void 0:e.userId}get remoteUsers(){return Object.values(this.userMap)}get publisher(){return this.self}get isSubscribing(){var e;return((e=this.remoteUsers)!=null?e:[]).some(t=>{var a;const{isAudioSubscribing:i,isVideoLargeSubscribing:r,isVideoSmallSubscribing:n,isScreenSubscribing:o}=(a=t.streamInfo)!=null?a:{};return i||r||n||o})}onRemotePublishStateChange(e){var f;const{userid:t,callid:i,subscribe:r,pubid:n="",tracks:o}=e,a=(f=r==null?void 0:r.pullstreamurl)!=null?f:"";let u=this.getRemoteUser(t);if(!u)return;const h=u.streamInfo.audioTrackInfo,g=u.streamInfo.videoTrackInfo;u.updateRemoteTracks(i,a,n,o),u.updateSubscribe(Ve.Publish),(h!==u.streamInfo.audioTrackInfo||g!==u.streamInfo.videoTrackInfo)&&this.emit("remoteTrackAvailableChange",t,u.streamInfo.audioTrackInfo,u.streamInfo.videoTrackInfo)}init(e,t){var i;this.authInfo=e,this.self||(this.self=new Go({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})),this.self.enableAudioVolumeIndication(this.audioVolumeIndicationInterval),(i=this.self)==null||i.initInfo(e,t.pushstreamurl),t.users.forEach(r=>{const n=r.userid;if(n){const o=this.addUser(n,r.displayname,Ve.InRoom),{callid:a,subscribe:u,tracks:h}=r;o.updateRemoteTracks(a,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,o.streamInfo.audioTrackInfo,o.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}clear(){return H(this,null,function*(){var e;this.stopStatsMonitor();for(let t in this.userMap)this.userMap[t]&&(yield this.userMap[t].clear(),delete this.userMap[t]);yield(e=this.self)==null?void 0:e.clear(),this.authInfo=void 0})}startStatsMonitor(){this.statsMonitorId=window.setInterval(()=>H(this,null,function*(){if(this.publisher){const{audio:i,video:r,transport:n}=yield this.publisher.getStats();i&&i.length>0&&this.emit("rtcLocalAudioStats",i),r&&r.length>0&&this.emit("rtcLocalVideoStats",r),n&&this.emit("rtcStats",n)}const e=[],t=[];for(const i of this.remoteUsers){const{audio:r,video:n}=yield i.getStats();r&&r.forEach(o=>{e.push(o)}),n&&n.forEach(o=>{t.push(o)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),t.length>0&&this.emit("rtcRemoteVideoStats",t)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}addUser(e,t,i){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t,i)),this.userMap[e]}executeAddUser(e,t,i){const r=new Je({userId:e,displayName:t,rtsManager:this.rtsManager,signalingManager:this.signalingManager,usersViewMap:this.usersViewMap,slsReporter:this.slsReporter,localUser:this.self,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,playoutVolume:this.playoutVolume});return r.on(dt.Remote,this.onRemoteDeviceStatusChange.bind(this)),r.on(Me.PullStreamStats,this.onRemoteStatReport.bind(this)),r.on(Me.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),r.on("audioSubscribeStateChanged",(n,o,a,u)=>{this.emit("audioSubscribeStateChanged",n,o,a,u,this.channel||"")}),r.on("videoSubscribeStateChanged",(n,o,a,u)=>{this.emit("videoSubscribeStateChanged",n,o,a,u,this.channel||"")}),r.on("screenSubscribeStateChanged",(n,o,a,u)=>{this.emit("screenSubscribeStateChanged",n,o,a,u,this.channel||"")}),r.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),r.on("remoteVideoAutoPlayFail",(n,o)=>{this.emit("remoteVideoAutoPlayFail",n,o)}),r.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n)}),r.setWantSubAudio(this.autoSubAudio&&this.wantSubAudio),r.setWantSubVideo(this.autoSubVideo&&this.wantSubVideo),r.setWantSubScreen(this.autoSubScreen&&this.wantSubScreen),r.setRemoteDefaultVideoStreamType(this.defaultStreamType),r.setAudioMuted(this.audioMuted),(this.autoSubAudio||this.autoSubVideo||this.autoSubScreen)&&r.updateSubscribe(i),r}onRemoteDeviceStatusChange(e,t){e===Me.MuteAudio?this.emit("userAudioMuted",t,!0):e===Me.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===Me.MuteVideo?this.emit("userVideoMuted",t,!0):e===Me.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===Me.MuteScreen?this.emit("userScreenMuted",t,!0):e===Me.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,i){this.emit(Me.PullStreamStats,e,t,i)}onSubscribeExceeds(e,t){this.emit(Me.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return H(this,null,function*(){e.userid&&this.userMap[e.userid]&&(yield this.userMap[e.userid].clear(!1),delete this.userMap[e.userid])})}updateUsers(e){const t=[],i=[],r={};e.forEach(a=>{a.userid&&(this.userMap[a.userid]?(i.push(a),r[a.userid]=this.userMap[a.userid]):(t.push(a),r[a.userid]=this.executeAddUser(a.userid,a.displayname,Ve.Resume)))});const n=Object.keys(this.userMap),o=[];return n.forEach(a=>{r[a]||o.push({userid:a,reason:"",leavecode:wn.AliRtcUserOfflineQuit})}),this.userMap=r,{joinList:t,leaveList:o,presentList:i}}getRemoteUser(e){return this.userMap[e]}updateRemoteUserDeviceStatus(e){e&&e.userid&&this.userMap[e.userid]&&this.userMap[e.userid].updateRemoteUserDeviceStatus(e.status)}updateAudioWant(e,t){const i=this.userMap[e];if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubAudio(t),t?i.updateSubscribe(Ve.User):i.stopSubscribe({audio:!0})}updateVideoWant(e,t){const i=this.userMap[e];if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubVideo(t),t?i.updateSubscribe(Ve.User):i.stopSubscribe({video:!0})}updateScreenWant(e,t){const i=this.userMap[e];if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubScreen(t),t?i.updateSubscribe(Ve.User):i.stopSubscribe({screen:!0})}stopIndication(){this.indicationTimer&&window.clearInterval(this.indicationTimer)}startIndication(e){this.stopIndication(),this.indicationTimer=window.setInterval(()=>{var i;const t=this.remoteUsers.map(r=>({userId:r.userId,volume:r.getAudioLevel()||0}));t.unshift({userId:"",volume:((i=this.self)==null?void 0:i.getAudioLevel())||0}),this.emit("audioVolume",t)},e)}enableAudioVolumeIndication(e){var t;this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.stopIndication(),e>0&&this.startIndication(e),this.audioVolumeIndicationInterval=e,this.remoteUsers.forEach(i=>{i.enableAudioVolumeIndication(e)}),(t=this.self)==null||t.enableAudioVolumeIndication(e))}setPlayoutVolume(e){this.playoutVolume=e,this.remoteUsers.forEach(t=>{t.setPlayoutVolume(e)})}refreshAuthInfo(e){var t;this.authInfo&&(this.authInfo=Ce(Ce({},this.authInfo),e)),e.userId&&((t=this.self)==null||t.refreshUserInfo(e.userId))}setEnableMediaExtensionMsg(e){this.rtsManager.setEncodedInsertableStreams(e)}setAudioRedEnabled(e){this.rtsManager.setAudioRedEnabled(e)}}A(wt,"logName","BizControl"),Nt([j()],wt.prototype,"init",1),Nt([j()],wt.prototype,"clear",1),Nt([j(ue)],wt.prototype,"addUser",1),Nt([j()],wt.prototype,"removeLeftUser",1),Nt([j()],wt.prototype,"updateUsers",1),Nt([j(ue)],wt.prototype,"updateAudioWant",1),Nt([j(ue)],wt.prototype,"updateVideoWant",1),Nt([j(ue)],wt.prototype,"updateScreenWant",1),Nt([j()],wt.prototype,"stopIndication",1),Nt([j()],wt.prototype,"startIndication",1),Nt([j()],wt.prototype,"enableAudioVolumeIndication",1);const Bn=s=>H(this,null,function*(){const c=new Uint8Array(160).fill(170),e=new TextEncoder().encode(s),t=yield window.crypto.subtle.importKey("raw",c,{name:"HMAC",hash:{name:"SHA-1"}},!1,["sign"]),i=yield window.crypto.subtle.sign("HMAC",t,e);return Array.from(new Uint8Array(i)).map(r=>r.toString(16).padStart(2,"0")).join("")});class mh{constructor(c){A(this,"authInfo");A(this,"slsReporter");this.slsReporter=c}doRequest(c,e){var u;const t=this.authInfo;if(!t)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const i="https://gw.rtn.aliyuncs.com",r=Pu[c],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:Ut.createCallid(),tokensid:!1,session:(u=t.sessionId)!=null?u:Ut.createCallid()},o=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),a=`${i}${r}?${o}`;return fetch(a,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)}).then(h=>h.status!==200?(this.slsReporter.reportTranscodingError(h.status,e.taskid||""),Promise.reject(new ce(de.ERR_INNER,`transcoding request failed, status: ${h.status}`))):h).catch(h=>Promise.reject(new ce(de.ERR_INNER,`transcoding request failed, err: ${h.message}`)))}setAuthInfo(c){this.authInfo=c}clear(){this.authInfo=void 0}startPublishLiveStream(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=yield Bn(c.split("?")[0]),i=xt.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}startPublishLiveStreamWithTaskId(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=xt.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}updatePublishLiveStream(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=yield Bn(c.split("?")[0]),i=xt.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}updatePublishLiveStreamWithTaskId(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=xt.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}stopPublishLiveStream(c){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const e=yield Bn(c.split("?")[0]),t=xt.MPU_TASK_TRANSACTION_STOP,i=new Lr().toJson(t,this.authInfo,e,c);return this.doRequest(t,i)})}stopPublishLiveStreamWithTaskId(c){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const e=xt.MPU_TASK_TRANSACTION_STOP,t=new Lr().toJson(e,this.authInfo,c);return this.doRequest(e,t)}refreshAuthInfo(c){this.authInfo&&this.setAuthInfo(Ce(Ce({},this.authInfo),c))}}class Zo{constructor(c){A(this,"name","COMMON");this.name=c||this.name}info(...c){}warn(...c){}print(c,...e){const t=c.toLowerCase();t&&console[t](`[${c}][${this.name}]`,...e)}}A(Zo,"LEVEL",0);class gh{constructor(){A(this,"logger",new Zo("AudioMixer"));A(this,"audioContext",new AudioContext);A(this,"audioDestination",this.audioContext.createMediaStreamDestination());A(this,"audioTrack",Ku(this.audioDestination.stream));A(this,"sourceNodeMap",{})}get sourceNodeList(){return Object.values(this.sourceNodeMap).map(c=>c.sourceNode).filter(c=>!!c)}get gainNodeList(){return Object.values(this.sourceNodeMap).map(c=>c.gainNode).filter(c=>!!c)}get sourceCount(){return this.sourceNodeList.length}resume(){var c;return(c=this.audioContext)==null?void 0:c.resume()}addTrack(c){this.connectTrack(c)}hasTrack(c){return!!this.sourceNodeMap[c]}removeTrack(c){const{sourceNode:e,gainNode:t}=this.sourceNodeMap[c]||{};t==null||t.disconnect(),e==null||e.disconnect(),delete this.sourceNodeMap[c],e?this.logger.info("SourceNode disconnected. Active source node:",this.sourceNodeList.length):this.logger.warn(`SourceNode ${c} does not exit. Active source node: ${this.sourceNodeList.length}`)}getAudioTrack(){return this.audioTrack}setVolume(c,e){const{gainNode:t}=this.sourceNodeMap[e]||{};t?(this.logger.info(`Setting node(${e}) volume to ${this.scale(c)}`),t.gain.value=this.scale(c)):this.logger.warn(`GainNode ${e} does not exit.`)}reset(){this.disconnectSourceNode(),this.sourceNodeMap={}}dispose(){var c;this.reset(),(c=this.audioTrack)==null||c.stop(),this.audioDestination.disconnect(),this.audioContext.close()}connectTrack(c){if(!this.audioContext)return this.logger.warn("AudioContext not initialized");let e=new MediaStream;e.addTrack(c);const t=this.audioContext.createMediaStreamSource(e),i=this.audioContext.createGain();i.gain.value=1,t.connect(i),i.connect(this.audioDestination),this.sourceNodeMap[c.id]={track:c,sourceNode:t,gainNode:i},this.logger.info("New sourceNode connected. Active source node:",this.sourceNodeList.length)}disconnectSourceNode(){this.sourceNodeList.forEach(c=>c.disconnect()),this.gainNodeList.forEach(c=>c.disconnect())}scale(c){return c/100}}const vh=4;class xh extends Fi{constructor(){super("audioMixer",Qe.AliRtcSdkStreamTypeCapture,Dr.AUDIO);A(this,"audioMixer");A(this,"primaryAudioTrackId");A(this,"screenAudioTrackId");A(this,"dirty",!1);this.zIndex=8}get initOptions(){return{audio:1,screen:1}}setOptions(e){Object.entries(e).forEach(([t,i])=>{this.isValidVolume(i)&&(this.options[t]=i)}),this.dirty=!0,this.emit("updated")}isSupported(){return"AudioContext"in window}shouldUpdate(e,t){var n,o;if(e.type!==Qe.AliRtcSdkStreamTypeCapture)return!1;const i=t.find(a=>a.type===Qe.AliRtcSdkStreamTypeCapture),r=t.find(a=>a.type===Qe.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=i==null?void 0:i.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((o=r==null?void 0:r.currentAudioTrack)==null?void 0:o.id)&&!this.dirty)}process(e,t){return H(this,null,function*(){var o,a;this.dirty=!1;const i=t.find(u=>u.type===Qe.AliRtcSdkStreamTypeScreen),r=e.currentAudioTrack,n=i==null?void 0:i.currentAudioTrack;if(!n&&this.options.audio===1){this.audioMixer&&(this.audioMixer.dispose(),this.audioMixer=void 0),this.primaryAudioTrackId=r==null?void 0:r.id,e.updateAudioTrack(r);return}this.audioMixer||(this.audioMixer=new gh),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(r==null?void 0:r.id)!==this.primaryAudioTrackId&&((o=this.audioMixer)==null||o.removeTrack(this.primaryAudioTrackId)),r&&!this.audioMixer.hasTrack(r==null?void 0:r.id)&&this.audioMixer.addTrack(r),this.primaryAudioTrackId=r==null?void 0:r.id,this.screenAudioTrackId&&(n==null?void 0:n.id)!==this.screenAudioTrackId&&((a=this.audioMixer)==null||a.removeTrack(this.screenAudioTrackId)),n&&!this.audioMixer.hasTrack(n==null?void 0:n.id)&&this.audioMixer.addTrack(n),this.screenAudioTrackId=n==null?void 0:n.id,this.updateVolume(),e.updateAudioTrack(this.audioMixer.getAudioTrack())})}isValidVolume(e){return e!==void 0&&e>=0&&e<=vh}updateVolume(){this.audioMixer&&(this.primaryAudioTrackId&&this.audioMixer.setVolume(this.options.audio*100,this.primaryAudioTrackId),this.screenAudioTrackId&&this.audioMixer.setVolume(this.options.screen*100,this.screenAudioTrackId))}clear(e){var t;(t=this.audioMixer)==null||t.dispose(),super.clear(e)}}class Pn{constructor(c,e){A(this,"originTrack");A(this,"originVideo");A(this,"targetWidth");A(this,"targetHeight");A(this,"targetFrameRate");A(this,"targetCanvas");A(this,"animationFrameId");A(this,"resultTrack");this.targetWidth=e.width,this.targetHeight=e.height,this.targetFrameRate=e.frameRate,this.originTrack=c,this.originVideo=document.createElement("video"),this.originVideo.muted=!0,this.originVideo.autoplay=!0,this.originVideo.controls=!1,this.targetCanvas=document.createElement("canvas"),this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight}updateOptions(c){this.targetWidth=c.width,this.targetHeight=c.height,this.targetFrameRate=c.frameRate,this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight,this.resultTrack&&this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})}dispose(){}getVideoTrack(){return this.resultTrack||(this.resultTrack=this.targetCanvas.captureStream().getVideoTracks()[0],this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})),this.resultTrack}cancelAnimation(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}getPositionAndSize(c,e,t,i){const r=e/c,n=i/t;let o=t,a=i,u=0,h=0;return n>r?(o=Math.round(a/r),u=Math.round((t-o)/2)):n<r&&(a=Math.round(o*r),h=Math.round((i-a)/2)),{x:u,y:h,width:o,height:a}}}class bh extends Pn{constructor(e,t){super(e,t);A(this,"targetCtx");this.targetCtx=this.targetCanvas.getContext("2d"),this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.initStream(e)}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender)}startRender(){this.cancelAnimation();const e=()=>{if(!this.targetCtx)return;const t=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight);this.targetCtx.drawImage(this.originVideo,0,0,this.originVideo.videoWidth,this.originVideo.videoHeight,t.x,t.y,t.width,t.height),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e))};e()}stopRender(){this.cancelAnimation()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.pause(),this.originVideo.srcObject=null}}const Sh=`
33
+ `+((o=i.get("Content-Type"))!=null?o:"")+`
34
+ `+a+`
35
+ `;const h=(p,d)=>p[0].localeCompare(d[0]),g=p=>p[0].startsWith("x-log-")||p[0].startsWith("x-acs-");try{const p=[...i.entries()].filter(g).sort(h).map(d=>d[0]+":"+d[1]+`
36
+ `).join("");u+=p}catch(p){}u+=c,r.size>0&&(u+="?");try{u+=[...r.entries()].sort(h).map(p=>p[0]+"="+p[1]).join("&")}catch(p){}const f=ui.HmacSHA1(u,t).toString(ui.enc.Base64),l="LOG "+e+":"+f;return i.set("Authorization",l),i.set("x-log-date",a),l}var _c=(s,c,e)=>new Promise((t,r)=>{var i=o=>{try{a(e.next(o))}catch(u){r(u)}},n=o=>{try{a(e.throw(o))}catch(u){r(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,n);a((e=e.apply(s,c)).next())});function yc(s){return _c(this,null,function*(){const c=new Date;if(s.refreshSTSTokenInterval||(s.refreshSTSTokenInterval=3e5),!s.stsTokenFreshTime||+c-s.stsTokenFreshTime>=s.refreshSTSTokenInterval){s.stsTokenFreshTime=c;try{yield s.refreshSTSToken()}catch(e){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
37
+ `+e)}}return null})}var Ac=(s,c,e)=>new Promise((t,r)=>{var i=o=>{try{a(e.next(o))}catch(u){r(u)}},n=o=>{try{a(e.throw(o))}catch(u){r(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,n);a((e=e.apply(s,c)).next())});function Xn(s){return{transString:function(c){let e={},t=0,r=!1;for(let i in c){if((i==="time"||i==="__time__")&&typeof c[i]=="number"){t=c[i],r=!0;continue}typeof c[i]=="object"?e[i]=JSON.stringify(c[i]):e[i]=String(c[i])}return e.__time__=r?t:Math.floor(new Date().getTime()/1e3),e},process:function(c,e){return Ac(this,null,function*(){yield yc(s);let t=c.slice(c.indexOf("/logstores")),r=e.length,i=bc(e),n=new Date().toUTCString(),a=new Map,o=new Map([["Content-Type","application/json"],["Content-MD5",i],["x-log-bodyrawsize",r.toString()]]);s.securityToken&&o.set("x-acs-security-token",s.securityToken),Sc("POST",t,s.accessKeyId,s.accessKeySecret,a,o,i,n);let u=Object.fromEntries(o);return{data:e,header:u}})}}}typeof window!="undefined"&&qn(window,"stsPlugin",Xn);const{BrowserUtil:Ec}=me.AliRTS,Qt={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Gecko:"Gecko",WebKit:"WebKit"},ki=(s,c)=>{const e=c.match(s);return e&&e.length>0&&e[1]||""},wc=[{test:[/\sedg\//i,[/edg([ea]|ios)/i]],describe(s){if(/\sedg\//i.test(s))return{name:Qt.Blink};const e=ki(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:Qt.EdgeHTML,version:e}}},{test:[/trident/i],describe(s){const c={name:Qt.Trident},e=ki(/trident\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test(s){const c=/gecko/i.test(s),e=/like gecko/i.test(s);return c&&!e},describe(s){const c={name:Qt.Gecko},e=ki(/gecko\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Qt.Blink}}},{test:[/(apple)?webkit/i],describe(s){const c={name:Qt.WebKit},e=ki(/webkit\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}}],Yr=(s,c)=>s.find(e=>{if(typeof e.test=="function")return e.test(c);if(Array.isArray(e.test))return e.test.some(t=>typeof t=="string"?c.indexOf(t)>-1:t instanceof RegExp?t.test(c):!1)}),Cc=()=>{try{const s=navigator.userAgent||"",c=Yr(wc,s);if(c){const e=c.describe(s);return`${e.name}/${e.version||Ec.browserVersion}`}}catch(s){}return navigator.userAgent},Ic=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],Rc=()=>{let s="unknown";try{const c=navigator.userAgent||"",e=Yr(Ic,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},kc=[{test:[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],describe(){return"Samsung"}},{test:[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i,/\((ipad);[-\w\),; ]+apple/i,/(macintosh);/i],describe(){return"Apple"}},{test:[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],describe(){return"Huawei"}},{test:[/(?:honor)([-\w ]+)[;\)]/i],describe(){return"Honor"}},{test:[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],describe(){return"Xiaomi"}},{test:[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],describe(){return"Oppo"}},{test:[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],describe(){return"Vivo"}},{test:[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],describe(){return"Realme"}},{test:[/(pixel c)\b/i,/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],describe(){return"Google"}},{test:[/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],describe(){return"ZTE"}},{test:[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],describe(){return"Meizu"}}],Dc=()=>{let s="Unknown";try{const c=navigator.userAgent||"",e=Yr(kc,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},{BrowserUtil:Qr,SystenUtil:Zn}=me.AliRTS;class Yn{constructor(){A(this,"tracker");A(this,"param");A(this,"msgCacheArr",[]);A(this,"index",0);A(this,"stsOpt");A(this,"slsToken");A(this,"ossToken")}createTracker(){if(!this.tracker&&this.slsToken&&this.param){const c=this.slsToken;this.ossToken&&(this.param.ossbn=this.ossToken.bucket_name,this.param.ossep=this.ossToken.region_endpoint);const e=new Jn({host:c.region_endpoint,project:c.project,logstore:c.log_store_stats}),t={accessKeyId:c.access_key_id,accessKeySecret:c.access_key_secret,securityToken:c.security_token,refreshSTSToken:()=>{this.slsToken&&(t.accessKeyId=this.slsToken.access_key_id,t.accessKeySecret=this.slsToken.access_key_secret,t.securityToken=this.slsToken.security_token)}};this.stsOpt=t;const r=Xn(t);e.useStsPlugin(r),this.tracker=e,this.msgCacheArr.forEach((i,n)=>{var a,o;(o=this.tracker)==null||o.send(Se(Rt(Se({},this.param),{stat_log_id:`${((a=this.param)==null?void 0:a.sesid)||"nosession"}-${n}`}),i))}),this.index=this.index+this.msgCacheArr.length,this.msgCacheArr=[]}}start(c){this.initParam(c),this.createTracker()}updateToken(c,e){this.slsToken=c,this.ossToken=e,this.createTracker()}stop(){this.tracker=void 0}sendReport(c){var e,t;if(c.tm=Date.now(),!this.tracker){this.msgCacheArr.push(c);return}(t=this.tracker)==null||t.send(Se(Rt(Se({bt:Qr.browserName||"unknown"},this.param),{stat_log_id:`${((e=this.param)==null?void 0:e.sesid)||"nosession"}-${this.index}`}),c)),this.index++}initParam(c){let e=localStorage.getItem("AliRtcUUID");e||(e=Vt(),localStorage.setItem("AliRtcUUID",e)),this.param||(this.param={apid:c.appId,usrid:c.userId,statsvrs:"0.6.1",evetid:0,sesid:c.sessionId,sessionId:c.sessionId,channelid:c.channelId,usrn:c.userId,osn:Zn.systemName,osv:Zn.systemVersion,deb:Dc(),den:Cc(),udid:e,sdkvrs:nr,acs:"Unknown",cput:Rc(),dm:`${window.location.protocol}//${window.location.host}`,bt:Qr.browserName,bv:Qr.browserVersion,envir:"PRODUCT",args:""})}}const Te=(s,c=1,e=6e4,t=0)=>{let r=s;return r||(r=0),Math.min(e,Math.max(t,Math.round(r*c)))},pt=(s,c,e=2e7,t=0)=>{let r=c;(!c||c<0||c>1e4)&&(r=1e3);let i=s;return i||(i=0),Math.min(e,Math.max(t,Math.round(i/(r/1e3))))},jt=(s,c)=>{if(c===0)return 0;let e=s;return(!e||e<0)&&(e=0),+((e||0)/c*100).toFixed(2)},Qn=s=>s>=0&&s<=1?Te(Math.floor(32767*s),1,32767):0,Ne=(s,c)=>{var t,r,i;let e=((t=s._last)==null?void 0:t[c])||0;return s.ssrc&&((r=s._last)!=null&&r.ssrc)&&s.ssrc!==((i=s._last)==null?void 0:i.ssrc)&&(e=0),((s==null?void 0:s[c])||0)-e},Tc=(s,c)=>{var e,t,r;return(((e=s==null?void 0:s._source)==null?void 0:e[c])||0)-(((r=(t=s==null?void 0:s._last)==null?void 0:t._source)==null?void 0:r[c])||0)},ea=(s,c)=>Te(Ne(s,c),1e3,1e4),Wt=(s,c=2e7)=>Te(s,1,c),Si=class Si{constructor(c){A(this,"engine");A(this,"logClient");A(this,"authInfo");this.logClient=new Yn,this.engine=c}static getLogClient(){return this.staticClient||(this.staticClient=new Yn),this.staticClient}static reportOSSUpload(c,e,t=0){Si.getLogClient().sendReport({errmsg:`${e}/${c}.log`,errtype:t,evetid:70017,sesid:c,sessionId:c,stat_log_id:`${c}-70017`})}start(c){this.authInfo=c,this.logClient.start(c)}updateToken(c,e){this.logClient.updateToken(c,e),Si.getLogClient().updateToken(c,e)}stop(){this.logClient.stop()}reportPublishMonitor(c,e,t,r,i){if(!t||i.length<=0)return;const n=t===Z.Audio,a={ctm:Math.floor(i[0].timestamp||0),src:i[0].ssrc||"",codec:i[0]._codec||""},o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[],x=[],v=[],b=[],y=[],E=[],I=[],C=[],R=[],L=[],k=[];try{if(i.forEach(M=>{var H,F,K,Y,ge,se;if(!M||!M.timestamp)return;const w=(H=M._last)!=null&&H.timestamp?M.timestamp-M._last.timestamp:1e3,N=Ne(M,"bytesSent"),_=Ne(M,"headerBytesSent"),V=pt(Te(N+_,8,2e7),w);o.push(V);const ee=pt(Te(N,8,2e7),w);u.push(ee);const q=pt(Te(_,8,2e7),w);h.push(q);const re=Ne(M,"packetsSent"),$=pt(re,w);g.push($);const ie=Ne(M,"packetsLost"),T=pt(ie,w);f.push(T);const B=jt(ie,re);if(l.push(B),n)(F=M._source)!=null&&F.audioLevel&&p.push(Qn(M._source.audioLevel)),d.push(0);else{m.push(ea(M,"totalEncodeTime")),x.push(Wt((K=M._source)==null?void 0:K.framesPerSecond,100)),v.push(Wt((Y=M._source)==null?void 0:Y.framesPerSecond,100)),b.push(Wt(M.framesPerSecond,100)),y.push(Wt((ge=M._source)==null?void 0:ge.height,4400)),E.push(Wt((se=M._source)==null?void 0:se.width,7700)),I.push(Wt(M.frameHeight,4400)),C.push(Wt(M.frameWidth,7700));const xe=Ne(M,"totalPacketSendDelay");R.push(Te(xe,1/(ie||1),2e3));const Re=Ne(M,"qpSum");L.push(Te(Re,1/(M.framesPerSecond||1),51)),k.push(0)}}),a.sbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.ps=g.join(","),a.pl=f.join(","),a.plr=l.join(","),n){const M=(r==null?void 0:r.getSettings().sampleRate)||0;a.ailevel=p.join(","),a.arpc=d.join(","),a.arsr=M,a.aesr=M,a.publevel=-90,a.rawlevel=-90}else a.em=m.join(","),a.cfps=x.join(","),a.ifps=v.join(","),a.sfps=b.join(","),a.ih=y.join(","),a.iw=E.join(","),a.sh=I.join(","),a.sw=C.join(","),a.sd=R.join(","),a.aqp=L.join(","),a.caf=k.join(","),a.can=k.join(","),a.cav=u.join(","),a.ifimax=k.join(","),a.ifimin=k.join(","),a.efimax=k.join(","),a.efimin=k.join(","),a.sfimax=k.join(","),a.sfimin=k.join(","),a.apsnr=k.join(",")}catch(M){}this.log({evetid:10070,traceid:e,calid:c,args:this.data2String(Se({calid:c,tckid:t,traceid:e},a))})}reportSubscribeMonitor(c,e,t,r,i){if(!r||!i||i.length<=0)return;const n=r===Z.Audio,a={ctm:Math.floor(i[0].timestamp||0),src:i[0].ssrc||"",codec:i[0]._codec||""},o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[],x=[],v=[],b=[],y=[],E=[],I=[],C=[],R=[],L=[],k=[],M=[],w=[],N=[],_=[],V=[],ee=[],q=[],re=[],$=[],ie=[],T=[],B=[],H=[],F=[],K=[];try{i.forEach(Y=>{var U,Q;if(!Y||!Y.timestamp)return;const ge=(U=Y._last)!=null&&U.timestamp?Y.timestamp-Y._last.timestamp:1e3,se=Ne(Y,"bytesReceived"),xe=Ne(Y,"headerBytesReceived"),Re=pt(Te(se+xe,8,2e7),ge);o.push(Re);const Ce=pt(Te(se,8,2e7),ge);u.push(Ce);const Me=pt(Te(xe,8,2e7),ge);h.push(Me);const ke=Ne(Y,"packetsReceived"),S=pt(ke,ge);g.push(S);const G=Ne(Y,"packetsLost"),W=pt(G,ge);f.push(W);const P=jt(G,ke);l.push(P);const D=Te(Y.jitterBufferDelay,1e3/Y.jitterBufferEmittedCount,3e4);p.push(D);const O=Ne(Y,"fecPacketsReceived");b.push(jt(O,ke));const X=Ne(Y,"retransmittedPacketsReceived"),J=ke+G-X;if(m.push(jt(ke-X,J)),x.push(jt(G,J)),d.push(jt(X,J)),v.push(J),F.push(0),K.push(""),n){E.push(Qn(Y.audioLevel));const ue=Tc(Y,"synthesizedSamplesEvents");I.push(ue);const te=ea(Y,"synthesizedSamplesDuration");C.push(te);const pe=jt(te,ge);y.push(pe),R.push(0)}else{const ue=(Q=Y._last)!=null&&Q.totalInterFrameDelay?Y.totalInterFrameDelay-Y._last.totalInterFrameDelay:0;L.push(Te(ue,1e3/(Y.framesDecoded||30),500)),k.push(Te(Y.framesPerSecond,1,100)),M.push(Te(Y.framesPerSecond,1,100)),w.push(Te(Y.frameHeight,1,4400)),N.push(Te(Y.frameWidth,1,7700));const te=Ne(Y,"totalProcessingDelay");_.push(Te(te,1e3/(Y.framesDecoded||30),12e4));const pe=Ne(Y,"nackCount");ee.push(pe);const we=Ne(Y,"pliCount");V.push(we);const ye=Ne(Y,"qpSum");q.push(Te(ye,1/(Y.framesPerSecond||1),51)),re.push(Te(Y.framesDropped));const Ze=Ne(Y,"totalFreezesDuration");$.push(Te(Ze,1e3,3e4));const vt=Ne(Y,"jitterBufferEmittedCount"),He=Ne(Y,"jitterBufferDelay");ie.push(Te(He,1e3/(vt||1),3e4));const ut=Ne(Y,"jitterBufferTargetDelay");T.push(Te(ut,1e3/(vt||1),3e4));const Pe=Ne(Y,"jitterBufferMinimumDelay");B.push(Te(Pe,1e3/(vt||1),3e4)),H.push(Te(Y.framesPerSecond,1,100))}}),a.rbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.pr=g.join(","),a.pl=f.join(","),a.plr=l.join(","),a.jd=p.join(","),a.fecr=b.join(","),a.retransr=d.join(","),a.baser=m.join(","),a.basel=x.join(","),a.recoverr=F.join(","),a.alll=x.join(","),a.totalc=v.join(","),n?(a.er=y.join(","),a.aolevel=E.join(","),a.asrc=R.join(","),a.scnt=I.join(","),a.sdura=C.join(",")):(a.dm=L.join(","),a.dfps=k.join(","),a.rfps=M.join(","),a.rh=w.join(","),a.rw=N.join(","),a.fpt=K.join(","),a.ns=ee.join(","),a.pliss=V.join(","),a.aqp=q.join(","),a.ofimax=F.join(","),a.ofimin=F.join(","),a.dfimax=F.join(","),a.dfimin=F.join(","),a.rfimax=F.join(","),a.rfimin=F.join(","),a.vrstutter=$.join(","),a.cdm=ie.join(","),a.tdm=T.join(","),a.pdm=B.join(","),a.ofps=H.join(","),a.dfbd=re.join(","))}catch(Y){}this.log({evetid:10080,traceid:t,rmtid:e,calid:c,args:this.data2String(Se({calid:c,rmtid:e,tckid:r,traceid:t},a))})}reportNetworkMonitor(c){if(c.length<=0)return;const e=[],t=[],r=[],i=[],n=[],a=[],o=[],u=[],h=[],g=[];c.forEach((l,p)=>{var m;if(!l.timestamp)return;const d=(m=l._last)!=null&&m.timestamp?l.timestamp-l._last.timestamp:1e3;e.push(Te(l.currentRoundTripTime,1e3)),t.push(Te(l.availableOutgoingBitrate,8,2e8)),r.push(pt(Te(l.bytesSent,8,2e7),d,25e6)),i.push(pt(Te(l.bytesReceived,8,2e7),d,25e6)),n.push(0),a.push(0),p%5===0&&(o.push(""),u.push(""),h.push(""),g.push(""))});const f={ctm:Math.floor(c[0].timestamp||0),rtt:e.join(","),bsps:r.join(","),brps:i.join(","),cpu:o.join(","),mem:u.join(","),sysmem:h.join(","),systotalmem:g.join(","),audioonly:this.engine.isAudioOnly()?1:0};this.log({evetid:10071,args:this.data2String(Se({asb:t.join(","),abms:n.join(","),vbms:a.join(",")},f))}),this.log({evetid:10081,args:this.data2String(Se({},f))})}reportJoin(c,e,t=""){var g,f;const{start:r,rs:i=0,re:n=0}=e,a=Date.now()-r,o=n-i;let u=0;i&&(u=i-r);let h=0;n&&(h=n-i),this.log({evetid:10010,args:this.data2String({sesid:((g=this.authInfo)==null?void 0:g.sessionId)||"",joitm:a,rslt:c,gslbtm:0,dnstm:0,avcftm:0,gslbrslt:0,dnsrslt:0,avcfrslt:0,mode:2,jrtc:o,usrn:(f=this.authInfo)==null?void 0:f.userId,mgt:"cdn",cttc:u,iptc:h,ndn:1,gslbloc:1,ccag:0,ucag:0,cpg:0,upg:0,tid:t})})}reportJoinConnection(c){this.log({evetid:20002,args:this.data2String(Se({transretrynum:0,ldnstc:0,tcptc:0,ssltc:0,url:""},c))})}reportLeave(c,e,t){this.log({evetid:10020,args:this.data2String({lvetm:c,rslt:e,tid:t})})}reportPublish(c,e,t,r,i,n,a,o,u,h,g){this.log({evetid:c?10032:10030,calid:t,args:this.data2String({calid:t,url:e,isvl:r?1:0,isvs:i?1:0,isvss:n?1:0,isaudio:a?1:0,rslt:o,tid:"123",pubtm:Date.now()-g,pctid:u,pubtid:h,isvp:0,isarecording:0,isad:0,isdc:0,pubretry:0,pbrttimes:0})})}reportPublishFirstPacket(c,e,t,r,i,n,a,o,u){const h=Date.now();this.log({evetid:c?10033:10031,calid:e,args:this.data2String({calid:e,fpst:h-t,tckid:n,est:t,pctid:a,pubtid:o,totaltm:h-i,jorm:u===Ot.JOINCHANNEL?1:0,cptc:0,sptc:r-t,iptc:0,ipc2fptc:0,dctc:0,patc:0})})}reportUnpublish(c,e,t,r){var i;this.log({evetid:10040,args:this.data2String({calid:c,unpubtm:e,rslt:t,tid:r,sesid:((i=this.authInfo)==null?void 0:i.sessionId)||""})})}reportSubscribe(c,e,t,r,i,n,a,o,u,h){this.log({evetid:10050,calid:c,rmtid:e,args:this.data2String(Se({calid:c,rmtid:e,isvl:t?1:0,isvs:r?1:0,isvss:i?1:0,isaudio:n?1:0,rslt:a,tid:o,subtm:u,isvp:0,isaplaying:0,isad:0,isdc:0,subretry:0,sbrttimes:0},h))})}reportSubscribeFirstPacket(c,e,t,r,i){this.log({evetid:c?10054:10051,calid:e,rmtid:t,args:this.data2String(Se({calid:e,rmtid:t,tckid:r,cptc:0,iptc:0,ipc2fptc:0,dctc:0,patc:0},i))})}reportSubscribeFirstFrame(c,e,t,r,i){this.log({evetid:c?10055:10052,calid:e,rmtid:t,args:this.data2String(Se({calid:e,rmtid:t,tckid:r},i))}),this.log({evetid:c?10058:10057,args:this.data2String(Se({calid:e,rmtid:t,tckid:r},i))})}reportUnsubscribe(c,e,t,r,i){this.log({evetid:10060,calid:c,args:this.data2String({calid:c,rmtid:e,unsubtm:t,rslt:r,tid:i})})}reportMute(c,e,t){this.log({evetid:11030,args:this.data2String({calid:c,rmtid:"",enable:e?1:0,mt:t})})}reportRoleUpdate(c,e){this.log({evetid:11040,args:this.data2String({or:c||"",nr:e,ctm:Date.now(),rslt:0})})}reportRoleUpdateResult(c,e,t,r){this.log({evetid:11041,args:this.data2String({or:c||"",nr:e,ctm:t,rslt:r})})}reportVideoProfile(c){this.log({evetid:20074,args:this.data2String({pf:c,tckid:"sophon_camera_large"})})}reportScreenProfile(c){this.log({evetid:20074,args:this.data2String({pf:c,tckid:"sophon_screenshare"})})}reportError(c){this.log({evetid:10091,args:this.data2String({rslt:c.code||-1})})}reportWarning(c){this.log({evetid:10092,args:this.data2String({rslt:-1,errmsg:c})})}reportRoomServerEvent(c,e,t,r){this.log({evetid:20005,args:this.data2String({calid:"",rmtid:"",rt:c?0:1,dr:c?"s":"r",mt:e,ri:t,cs:1,srt:Date.now(),rspc:r.code||"",mc:JSON.stringify(r)})})}reportTranscodingError(c,e){this.log({evetid:10101,args:this.data2String({rslt:c,taskid:e})})}reportBye(c){var e;this.log({evetid:10093,args:this.data2String({rslt:c,sesid:((e=this.authInfo)==null?void 0:e.sessionId)||""})})}reportAudio(c,e,t){var r;this.log({evetid:80013,args:this.data2String({rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})}),this.log({evetid:80014,args:this.data2String({sesid:((r=this.authInfo)==null?void 0:r.sessionId)||"",rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})})}reportScreen(c,e){var t,r;this.log({evetid:90013,args:this.data2String({rslt:c?-1:0,vcms:e,vde:c.code?c.code:-1,sesid:((t=this.authInfo)==null?void 0:t.sessionId)||""})}),this.log({evetid:90014,args:this.data2String({rslt:c?-1:0,vcms:e,vde:c.code?c.code:-1,sesid:((r=this.authInfo)==null?void 0:r.sessionId)||""})})}reportScreenStop(c){this.log({evetid:90019,args:this.data2String({rslt:c?c.code||-1:0})}),this.log({evetid:90020,args:this.data2String({rslt:c?c.code||-1:0})})}reportSwitchCamera(c){var e;this.log({evetid:90025,args:this.data2String({rslt:0,td:c,sesid:((e=this.authInfo)==null?void 0:e.sessionId)||""})})}reportPublishProfile(c,e){this.log({evetid:10201,args:this.data2String(Se({tckid:c},e))})}reportSDKCreated(c){this.log({evetid:70011,createtm:Date.now()-c,tm:c})}reportJoinInvoked(c){this.log({evetid:70012,jnnonce:c.nonce||"",jntoken:c.token||"",jntm:c.timestamp||""})}reportJoinResult(c){this.log({evetid:70013,rslt:c?c.code||-1:0,dnsrslt:0})}reportSTSResult(c){this.log({evetid:70014,rslt:c,asty:1})}reportLeaveInvoked(){this.log({evetid:70015})}reportSEIMessage(c,e,t,r,i){this.log({evetid:40301,args:this.data2String({tm:Date.now(),sei_pt:c,sei_len:e,sei_rep:t,sei_delay:r,sei_key:i})})}log(c){c&&(c.tm=new Date().getTime(),oe.debug("[ConsoleLogger]","log",c),this.logClient.sendReport(c))}data2String(c){let e="";for(let t in c)e.length&&(e+="&"),e+=t+"="+c[t];return e}};A(Si,"staticClient");let hi=Si;const Bc=1e3*60*60*24*7,Pc=s=>{if(s.length!==8)return new Date;const c=parseInt(s.substring(0,4),10),e=parseInt(s.substring(4,6),10)-1,t=parseInt(s.substring(6,8),10);if(isNaN(c)||isNaN(e)||isNaN(t))return new Date;const r=new Date(c,e,t);return isNaN(r.getTime())?new Date:r};var es=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.API=2]="API",s[s.WARNING=3]="WARNING",s[s.ERROR=4]="ERROR",s[s.NONE=5]="NONE",s))(es||{});class Di{constructor(){A(this,"dbPromise");A(this,"stsToken");A(this,"logLevel");A(this,"logToConsole");A(this,"logToServer");A(this,"appId");A(this,"sessionId");A(this,"logCache",[]);A(this,"logMethod",(c,e=console.log)=>(...t)=>{if(this.logLevel>c)return;let r=this.getCurrentTime();this.logToConsole&&e(r,...t);let i=Di.paramArrayToString(t);c>0&&this.addLog(i)});A(this,"d",this.logMethod(0,console.debug));A(this,"i",this.logMethod(1));A(this,"w",this.logMethod(3,console.warn));A(this,"e",this.logMethod(4,(...c)=>{const[e,...t]=c;console.error(e,"<error>",t)}));A(this,"ev",this.logMethod(2));A(this,"a",this.logMethod(2,(...c)=>{const[e,...t]=c;if(t.length>2){const r=`${t[1]}`;r.startsWith("__g__")&&console.group(`${r.substring(5)}_${t[2]}`)}console.log(e,...t)}));A(this,"ar",this.logMethod(2,(...c)=>{const[e,...t]=c;console.log(e,...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));A(this,"ae",this.logMethod(2,(...c)=>{const[e,...t]=c;console.error(e,"<error>",...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));this.logLevel=3,this.logToConsole=!0,this.logToServer=!0,this.appId="",this.sessionId="",this.dbPromise=Ro()}static toString(c){let e;if(c instanceof Error)e=c.message;else if(typeof c=="string")e=c;else try{e=JSON.stringify(c)}catch(t){e="undefined"}return e}changeConfig(c){c.logLevel!==void 0&&c.logLevel>=0&&c.logLevel<=5&&(this.logLevel=c.logLevel),c.logToConsole!==void 0&&(this.logToConsole=c.logToConsole),c.logToServer!==void 0&&(this.logToServer=c.logToServer)}updateSTSToken(c){const e=!!this.stsToken;this.stsToken=c,!e&&c&&this.tryUploadHistorySessionLog()}uploadSessionDateLog(c,e,t){return z(this,null,function*(){if(!c||!e||!t||t.length===0||!this.stsToken)return;const r=new po;r.file(`${c}.log`,t.map(f=>f.log||"").join(`
38
+ `));const i=yield r.generateAsync({type:"blob"}),n=yield nc(i),a=Zr(new Date,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),o={"x-oss-date":a,"content-md5":n,"content-type":"application/zip"};o.date=a,o["x-oss-security-token"]=this.stsToken.security_token;const u=`client/${e}/${this.appId}/${c}.zip`;o.authorization=yield oc(this.stsToken.access_key_id,this.stsToken.access_key_secret,o,`/${this.stsToken.bucket_name}/${u}`);const h=`https://${this.stsToken.bucket_name}.${this.stsToken.region_endpoint}/${u}`,g=yield fetch(h,{method:"PUT",headers:o,body:i});if(g.status===200){hi.reportOSSUpload(c,e);const f=yield this.dbPromise;t.forEach(l=>{sn(f,l.id)})}else hi.reportOSSUpload(c,e,g.status)})}uploadSessionLog(c){c&&this.dbPromise.then(e=>z(this,null,function*(){if(!this.stsToken)return;const t=yield rn(e,c),r={},i=[];t.forEach(n=>{const a=n.date;if(Date.now()-Pc(a).getTime()>Bc)try{sn(e,n.id)}catch(o){}else r[a]||(r[a]=[],i.push(a)),r[a].push(n)}),Promise.all(i.map(n=>this.uploadSessionDateLog(c,n,r[n]))).then(()=>z(this,null,function*(){(yield rn(e,c)).length===0&&To(e,c)}))}))}tryUploadHistorySessionLog(){this.dbPromise.then(c=>z(this,null,function*(){(yield Do(c)).filter(t=>t.sid!==this.sessionId).forEach(t=>{this.uploadSessionLog(t.sid)})}))}uploadCurrent(){const c=this.sessionId;this.sessionId="",this.uploadSessionLog(c)}setSessionID(c,e){!c||!e||(this.appId=c,this.dbPromise.then(t=>{this.sessionId=e,ko(t,e),this.logCache&&(this.logCache.forEach(r=>{tn(t,this.sessionId,r.date,`${r.log}`)}),this.logCache=[])}))}addLog(c){if(!this.logToServer)return;const e=this.getCurrentTime(),t=this.getCurrentDate(),r=`${e} ${c}`;this.sessionId?this.dbPromise.then(i=>{tn(i,this.sessionId,t,r)}):this.logCache.push({date:t,log:r})}getCurrentTime(){return Zr(new Date,"HH:MM:ss.l")}getCurrentDate(){return Zr(new Date,"yyyymmdd")}static paramArrayToString(c){let e="";for(let t=0;t<c.length;t++){e!==""&&(e+=" ");let r=Di.toString(c[t]);e+=r}return e}}class oe{static getLogger(){return this.logger||(this.logger=new Di),this.logger}static setLogLevel(c){this.getLogger().changeConfig({logLevel:c})}static config(c){this.getLogger().changeConfig(c)}static updateToken(c){this.getLogger().updateSTSToken(c)}static setSessionID(c,e){this.getLogger().setSessionID(c,e)}static uploadLog(){this.getLogger().uploadCurrent()}static interface(...c){this.getLogger().a("[API]",...c)}static interfaceResult(c,e,t,...r){t?this.getLogger().ar("[ARE]",c,e,...r):this.getLogger().ae("[ARE]",c,e,...r)}static event(...c){this.getLogger().ev("[EVT]",...c)}static debug(...c){this.getLogger().d("[DBG]",...c)}static info(...c){this.getLogger().i("[INF]",...c)}static warn(...c){this.getLogger().w("[WARN]",...c)}static error(...c){this.getLogger().e("[ERR]",...c)}}A(oe,"logger");const Lc=s=>z(this,null,function*(){const c=new me.AliRTS.SupportUtil;let e={support:!1,detail:{isWebRTCSupported:c.checkMediaDevices()&&c.checkWebRtcSupport(),isH264DecodeSupported:!1,isH264EncodeSupported:!1,isScreenShareSupported:!1,isSendMediaExtensionMsgSupported:!1,isBrowserSupported:c.checkBrowser({errorCode:0,message:""})}};if(e.support=e.detail.isWebRTCSupported&&e.detail.isBrowserSupported,c.checkWebRtcSupport()&&s!=="sendonly"){const t=yield c.checkH264Decode();e.detail.isH264DecodeSupported=t,e.support=e.support&&t}if(c.checkWebRtcSupport()&&s!=="recvonly"){const t=yield c.checkH264Encode();e.detail.isH264EncodeSupported=t,e.support=e.support&&t}return e.detail.isScreenShareSupported=c.checkWebRtcSupport()&&c.checkScreenCapture()&&!me.AliRTS.SystenUtil.isAndroid&&!me.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=c.checkWebRtcSupport()&&c.checkEncodedTransformSupport(),e});var Ke=(s=>(s[s.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",s[s.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",s))(Ke||{}),ta=(s=>(s[s.PRE_PROCESSOR=0]="PRE_PROCESSOR",s[s.POST_PROCESSOR=1]="POST_PROCESSOR",s))(ta||{}),Ti=(s=>(s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO",s[s.BOTH=2]="BOTH",s))(Ti||{});class ei extends ve{constructor(e,t=Ke.AliRtcSdkStreamTypeCapture,r=1){super();A(this,"name");A(this,"options");A(this,"type",0);A(this,"streamType");A(this,"trackType");A(this,"zIndex",1);A(this,"_isEnable",!0);A(this,"lastInputAudioTrack");A(this,"lastOutputAudioTrack");A(this,"lastInputVideoTrack");A(this,"lastOutputVideoTrack");A(this,"_hasCleared",!0);this.name=e,this.streamType=t,this.trackType=r,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}init(){return z(this,null,function*(){})}enable(){this._isEnable||(this._isEnable=!0,this.init(),this.emit("enabled"))}disable(){this._isEnable&&(this._isEnable=!1,this.clear(),this.emit("disabled"))}get isEnable(){return this._isEnable}audioUpdated(e){var t,r;return((t=this.lastInputAudioTrack)==null?void 0:t.id)!==((r=e.currentAudioTrack)==null?void 0:r.id)}videoUpdated(e){var t,r;return((t=this.lastInputVideoTrack)==null?void 0:t.id)!==((r=e.currentVideoTrack)==null?void 0:r.id)}execute(e,t){return z(this,null,function*(){const r=this.shouldUpdate(e,t);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,this._hasCleared||r?(yield this.process(e,t),this._hasCleared=!1):(this.lastOutputAudioTrack&&(this.trackType===2||this.trackType===0)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===2||this.trackType===1)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack})}clear(e){this._hasCleared=!0,this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}var di=(s=>(s[s.LiveTranscodingSingle=0]="LiveTranscodingSingle",s[s.LiveTranscodingMix=1]="LiveTranscodingMix",s))(di||{}),ts=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingAudio=1]="LiveTranscodingAudio",s[s.LiveTranscodingVideo=2]="LiveTranscodingVideo",s))(ts||{}),ti=(s=>(s[s.LiveTranscodingCamera=0]="LiveTranscodingCamera",s[s.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",s))(ti||{});const li={0:"camera",1:"shareScreen"};var is=(s=>(s[s.LiveTranscoding_Profile_1IN_1080P=0]="LiveTranscoding_Profile_1IN_1080P",s[s.LiveTranscoding_Profile_1IN_720P=1]="LiveTranscoding_Profile_1IN_720P",s[s.LiveTranscoding_Profile_1IN_360P=2]="LiveTranscoding_Profile_1IN_360P",s[s.LiveTranscoding_Profile_2IN_1080P=3]="LiveTranscoding_Profile_2IN_1080P",s[s.LiveTranscoding_Profile_2IN_720P=4]="LiveTranscoding_Profile_2IN_720P",s[s.LiveTranscoding_Profile_2IN_360P=5]="LiveTranscoding_Profile_2IN_360P",s[s.LiveTranscoding_Profile_4IN_1080P=6]="LiveTranscoding_Profile_4IN_1080P",s[s.LiveTranscoding_Profile_4IN_720P=7]="LiveTranscoding_Profile_4IN_720P",s[s.LiveTranscoding_Profile_4IN_360P=8]="LiveTranscoding_Profile_4IN_360P",s[s.LiveTranscoding_Profile_9IN_1080P=9]="LiveTranscoding_Profile_9IN_1080P",s[s.LiveTranscoding_Profile_9IN_720P=10]="LiveTranscoding_Profile_9IN_720P",s[s.LiveTranscoding_Profile_9IN_360P=11]="LiveTranscoding_Profile_9IN_360P",s[s.LiveTranscoding_Profile_12IN_1080P=12]="LiveTranscoding_Profile_12IN_1080P",s[s.LiveTranscoding_Profile_12IN_720P=13]="LiveTranscoding_Profile_12IN_720P",s[s.LiveTranscoding_Profile_12IN_360P=14]="LiveTranscoding_Profile_12IN_360P",s[s.LiveTranscoding_Profile_16IN_1080P=15]="LiveTranscoding_Profile_16IN_1080P",s[s.LiveTranscoding_Profile_16IN_720P=16]="LiveTranscoding_Profile_16IN_720P",s[s.LiveTranscoding_Profile_16IN_360P=17]="LiveTranscoding_Profile_16IN_360P",s[s.LiveTranscoding_Profile_Mixed=9999]="LiveTranscoding_Profile_Mixed",s))(is||{});const Nc={0:"1IN_1080P",1:"1IN_720P",2:"1IN_360P",3:"2IN_1080P",4:"2IN_720P",5:"2IN_360P",6:"4IN_1080P",7:"4IN_720P",8:"4IN_360P",9:"9IN_1080P",10:"9IN_720P",11:"9IN_360P",12:"12IN_1080P",13:"12IN_720P",14:"12IN_360P",15:"16IN_1080P",16:"16IN_720P",17:"16IN_360P",9999:"Mixed_Audio"};var Bi=(s=>(s[s.LiveTranscoding_HZ_48000=48e3]="LiveTranscoding_HZ_48000",s[s.LiveTranscoding_HZ_44100=44100]="LiveTranscoding_HZ_44100",s[s.LiveTranscoding_HZ_32000=32e3]="LiveTranscoding_HZ_32000",s[s.LiveTranscoding_HZ_16000=16e3]="LiveTranscoding_HZ_16000",s[s.LiveTranscoding_HZ_8000=8e3]="LiveTranscoding_HZ_8000",s))(Bi||{}),fi=(s=>(s[s.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",s[s.LiveTranscodingBody=1]="LiveTranscodingBody",s))(fi||{}),pi=(s=>(s[s.NOTO_SERIF_CJKSC_REGULAR=0]="NOTO_SERIF_CJKSC_REGULAR",s[s.ALIBABA_PUHUITI_REGULAR=1]="ALIBABA_PUHUITI_REGULAR",s[s.ALIBABA_PUHUITI_BOLD=2]="ALIBABA_PUHUITI_BOLD",s[s.ALIBABA_PUHUITI_Heavy=3]="ALIBABA_PUHUITI_Heavy",s[s.ALIBABA_PUHUITI_LIGHT=4]="ALIBABA_PUHUITI_LIGHT",s[s.ALIBABA_PUHUITI_MEDIUM=5]="ALIBABA_PUHUITI_MEDIUM",s))(pi||{}),rs=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingCrop=1]="LiveTranscodingCrop",s[s.LiveTranscodingFill=2]="LiveTranscodingFill",s))(rs||{}),Pi=(s=>(s[s.LiveTranscodingNormal=0]="LiveTranscodingNormal",s[s.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",s))(Pi||{}),ss=(s=>(s[s.LiveTranscodingState_IDLE=0]="LiveTranscodingState_IDLE",s[s.LiveTranscodingState_CONNNECT=1]="LiveTranscodingState_CONNNECT",s[s.LiveTranscodingState_RUNNING=2]="LiveTranscodingState_RUNNING",s[s.LiveTranscodingState_RECOVERING=3]="LiveTranscodingState_RECOVERING",s[s.LiveTranscodingState_FAILURE=4]="LiveTranscodingState_FAILURE",s[s.LiveTranscodingState_END=5]="LiveTranscodingState_END",s))(ss||{}),Et=(s=>(s[s.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",s[s.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",s[s.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",s[s.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",s[s.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",s[s.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",s[s.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",s[s.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",s[s.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",s))(Et||{}),ns=(s=>(s[s.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",s[s.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",s[s.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",s))(ns||{}),st=(s=>(s[s.MPU_TASK_TRANSACTION_START=0]="MPU_TASK_TRANSACTION_START",s[s.MPU_TASK_TRANSACTION_UPDATE=1]="MPU_TASK_TRANSACTION_UPDATE",s[s.MPU_TASK_TRANSACTION_STOP=2]="MPU_TASK_TRANSACTION_STOP",s[s.MPU_TASK_TRANSACTION_LIST=3]="MPU_TASK_TRANSACTION_LIST",s[s.MPU_TASK_TRANSACTION_POLLING=4]="MPU_TASK_TRANSACTION_POLLING",s[s.MPU_TASK_TRANSACTION_ACKNOWLEDGE=5]="MPU_TASK_TRANSACTION_ACKNOWLEDGE",s[s.MPU_TASK_TRANSACTION_END=6]="MPU_TASK_TRANSACTION_END",s))(st||{});const Mc={0:"/libra/v1/sdk/start-task",1:"/libra/v1/sdk/update-task",2:"/libra/v1/sdk/stop-task",3:"/libra/v1/sdk/list-task",4:"/libra/v1/sdk/polling",5:"/libra/v1/sdk/acknowledge",6:"/"};class as{constructor(c,e,t,r,i,n,a,o){A(this,"videoWidth");A(this,"videoHeight");A(this,"videoFramerate",20);A(this,"videoBitrate",2e3);A(this,"videoGop",30);A(this,"audioSamplerate",Bi.LiveTranscoding_HZ_44100);A(this,"audioBitrate",500);A(this,"audioChannels",1);this.videoWidth=c,this.videoHeight=e,t&&(this.videoFramerate=t),r&&(this.videoBitrate=r),i&&(this.videoGop=i),n&&(this.audioSamplerate=n),a&&(this.audioBitrate=a),o&&(this.audioChannels=o)}}const os=s=>((s&16711680)>>16)+(s&65280)+((s&255)<<16),mt=(s=0,c)=>{if(c==0)return 0;let e=s/c;return e<0&&(e=0),e>1&&(e=1),e};class Li{constructor(c,e,t){A(this,"mixMode",di.LiveTranscodingSingle);A(this,"singleParam");A(this,"mixParam");c&&(this.mixMode=c),e&&(this.singleParam=e),t&&(this.mixParam=t)}toJson(c,e,t,r,i){const n={appid:e.appId,channelid:e.channelId};if(c===st.MPU_TASK_TRANSACTION_POLLING||c===st.MPU_TASK_TRANSACTION_LIST||c===st.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return c===st.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=i),n;if(n.taskid=t,c!==st.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,r&&(n.streamurl=r),this.mixMode===di.LiveTranscodingSingle){const a=this.singleParam;if(a){n.streamtype=a.streamType,a.sourceType===ti.LiveTranscodingShareScreen?n.sourcetype=li[a.sourceType]:n.sourcetype=li[ti.LiveTranscodingCamera];const o=[];a.userId&&o.push(a.userId),n.subspecusers=o}}else if(c===st.MPU_TASK_TRANSACTION_START||c===st.MPU_TASK_TRANSACTION_UPDATE){const a=this.mixParam;if(a){a.taskProfile&&(n.taskprofile=Nc[a.taskProfile]);const o=a.encodeParam||new as(1280,720);let u=o.videoWidth,h=o.videoHeight;const g={};Object.keys(o).forEach(l=>{const p=o[l];p>0&&(g[l.toLowerCase()]=p)}),g.lowbitratehighquality=0,n.encodeparam=g,n.backgrounds=a.backgrounds.map(l=>l.toJson(u,h)),n.watermarks=a.watermarks.map(l=>l.toJson(u,h)),n.clockwidgets=a.clockWidgets.map(l=>l.toJson(u,h));const f=a.users.map(l=>l.userId);n.subspecusers=[...new Set(f)],n.layouts=[{audiomixcount:a.users.length,panes:a.users.map((l,p)=>l.toJson(p,u,h,a.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=a.cropMode,n.backgroundcolor=os(a.backgroundColor),n.taskmode=a.mediaProcessMode}}}return n}}var Ct=(s=>(s.pre="pre",s.prod="prod",s))(Ct||{}),It=(s=>(s.AliRtcSdkCommunication="communication",s.AliRtcSdkInteractiveLive="interactive_live",s.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",s))(It||{}),Tt=(s=>(s.AliRtcSdkInteractive="interactive",s.AliRtcSdkLive="live",s))(Tt||{}),wt=(s=>(s[s.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",s[s.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",s[s.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",s[s.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",s[s.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",s[s.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",s[s.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",s))(wt||{}),Fe=(s=>(s[s.AliEngineLocalDeviceExceptionTypeUnknown=0]="AliEngineLocalDeviceExceptionTypeUnknown",s[s.AliEngineLocalDeviceExceptionTypeMicOpenFail=1]="AliEngineLocalDeviceExceptionTypeMicOpenFail",s[s.AliEngineLocalDeviceExceptionTypeMicInterrupt=2]="AliEngineLocalDeviceExceptionTypeMicInterrupt",s[s.AliEngineLocalDeviceExceptionTypeMicAuthFail=3]="AliEngineLocalDeviceExceptionTypeMicAuthFail",s[s.AliEngineLocalDeviceExceptionTypeMicNotAvailable=4]="AliEngineLocalDeviceExceptionTypeMicNotAvailable",s[s.AliEngineLocalDeviceExceptionTypeSpeakerOpenFail=5]="AliEngineLocalDeviceExceptionTypeSpeakerOpenFail",s[s.AliEngineLocalDeviceExceptionTypeSpeakerInterrupt=6]="AliEngineLocalDeviceExceptionTypeSpeakerInterrupt",s[s.AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable=7]="AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable",s[s.AliEngineLocalDeviceExceptionTypeAudioDeviceException=8]="AliEngineLocalDeviceExceptionTypeAudioDeviceException",s[s.AliEngineLocalDeviceExceptionTypeCameraOpenFail=9]="AliEngineLocalDeviceExceptionTypeCameraOpenFail",s[s.AliEngineLocalDeviceExceptionTypeCameraInterrupt=10]="AliEngineLocalDeviceExceptionTypeCameraInterrupt",s[s.AliEngineLocalDeviceExceptionTypeCameraAuthFail=11]="AliEngineLocalDeviceExceptionTypeCameraAuthFail",s[s.AliEngineLocalDeviceExceptionTypeDisplayException=12]="AliEngineLocalDeviceExceptionTypeDisplayException",s[s.AliEngineLocalDeviceExceptionTypeVideoDeviceException=13]="AliEngineLocalDeviceExceptionTypeVideoDeviceException",s))(Fe||{}),De=(s=>(s[s.AliRtcConnectionStatusInit=0]="AliRtcConnectionStatusInit",s[s.AliRtcConnectionStatusDisconnected=1]="AliRtcConnectionStatusDisconnected",s[s.AliRtcConnectionStatusConnecting=2]="AliRtcConnectionStatusConnecting",s[s.AliRtcConnectionStatusConnected=3]="AliRtcConnectionStatusConnected",s[s.AliRtcConnectionStatusReconnecting=4]="AliRtcConnectionStatusReconnecting",s[s.AliRtcConnectionStatusFailed=5]="AliRtcConnectionStatusFailed",s))(De||{}),Kt=(s=>(s[s.AliRtcConnectionChangedDummyReason=0]="AliRtcConnectionChangedDummyReason",s[s.AliRtcConnectionMediaPathChanged=1]="AliRtcConnectionMediaPathChanged",s[s.AliRtcConnectionSignalingHeartbeatTimeout=2]="AliRtcConnectionSignalingHeartbeatTimeout",s[s.AliRtcConnectionSignalingHeartbeatAlive=3]="AliRtcConnectionSignalingHeartbeatAlive",s[s.AliRtcConnectionSignalingHttpDnsResolved=4]="AliRtcConnectionSignalingHttpDnsResolved",s[s.AliRtcConnectionSignalingHttpDnsFailure=5]="AliRtcConnectionSignalingHttpDnsFailure",s[s.AliRtcConnectionSignalingGslbFailure=6]="AliRtcConnectionSignalingGslbFailure",s[s.AliRtcConnectionSignalingGslbSuccess=7]="AliRtcConnectionSignalingGslbSuccess",s[s.AliRtcConnectionSignalingJoinRoomFailure=8]="AliRtcConnectionSignalingJoinRoomFailure",s[s.AliRtcConnectionSignalingJoinRoomSuccess=9]="AliRtcConnectionSignalingJoinRoomSuccess",s[s.AliRtcConnectionSignalingLeaveRoom=10]="AliRtcConnectionSignalingLeaveRoom",s[s.AliRtcConnectionSignalingConnecting=11]="AliRtcConnectionSignalingConnecting",s[s.AliRtcConnectionChangedNetworkInterrupted=12]="AliRtcConnectionChangedNetworkInterrupted",s))(Kt||{}),cs=(s=>(s[s.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",s[s.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",s[s.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",s))(cs||{}),ii=(s=>(s[s.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",s[s.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",s[s.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",s))(ii||{}),Ae=(s=>(s[s.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",s[s.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",s[s.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",s[s.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",s))(Ae||{}),be=(s=>(s[s.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",s[s.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",s[s.AliRtcStatePublishing=2]="AliRtcStatePublishing",s[s.AliRtcStatePublished=3]="AliRtcStatePublished",s))(be||{}),Le=(s=>(s[s.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",s[s.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",s[s.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",s[s.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",s))(Le||{}),Je=(s=>(s[s.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",s[s.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",s[s.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",s))(Je||{}),mi=(s=>(s[s.CAMERA_INVALID=-1]="CAMERA_INVALID",s[s.CAMERA_REAR=0]="CAMERA_REAR",s[s.CAMERA_FRONT=1]="CAMERA_FRONT",s))(mi||{});const ia=10,ra=5e3,Vi=class Vi extends ve{constructor(e){super();A(this,"ws");A(this,"socketStatus",0);A(this,"wsUrl","");A(this,"lastConnectStartTime",0);A(this,"maxConnectRetryCount",ia);A(this,"connectRetryCount",0);A(this,"gotErr",!1);A(this,"closedByInvoke",!0);A(this,"isReconnecting",!1);A(this,"networkAvailableChecked",!0);this.maxConnectRetryCount=e!=null?e:ia,this.onOpen=this.onOpen.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),this.onClose=this.onClose.bind(this)}get connectUrl(){return this.wsUrl}get connectStatus(){return this.socketStatus}start(e){this.wsUrl=e,this.initWebSocket()}send(e){return this.ws&&this.socketStatus===2?(this.ws.send(JSON.stringify(e)),!0):!1}close(){this.closedByInvoke=!0,this.uninitWebscoket()}reconnect(){this.emit("onReconnectStart"),this.isReconnecting=!0,this.initWebSocket()}onOpen(e){this.socketStatus=2,this.connectRetryCount=0,this.networkAvailableChecked=!1,this.closedByInvoke=!1,this.gotErr=!1,this.isReconnecting=!1,this.emit("onOpen",e)}onMessage(e){this.emit("onMessage",e)}onError(e){this.isReconnecting&&this.emit("onReconnectFail",e),this.emit("onError",e),this.isReconnecting=!1,this.gotErr=!0}onClose(e){return z(this,null,function*(){const t=this.socketStatus;if(oe.info(Vi.logName,`onClose, status: ${t}, retryCount: ${this.connectRetryCount}`),t!==0||this.connectRetryCount)if(yield At.isNetworkAvailable()){if(!this.networkAvailableChecked&&!this.closedByInvoke&&!this.gotErr){this.reconnect();return}this.networkAvailableChecked=!0,this.emit("onAuthInvalid")}else{if(this.connectRetryCount||this.emit("onNetworkError"),this.closedByInvoke)return;this.connectRetryCount+=1,this.connectRetryCount>this.maxConnectRetryCount?this.emit("onConnectFail"):Date.now()-this.lastConnectStartTime>=ra?this.reconnect():window.setTimeout(()=>{this.reconnect()},ra)}this.socketStatus=0,this.emit("onClose",e)})}initWebSocket(){this.uninitWebscoket(),this.socketStatus=1,this.lastConnectStartTime=Date.now(),this.ws=new WebSocket(this.wsUrl),this.ws.addEventListener("open",this.onOpen),this.ws.addEventListener("message",this.onMessage),this.ws.addEventListener("error",this.onError),this.ws.addEventListener("close",this.onClose)}uninitWebscoket(){this.ws&&(this.ws.removeEventListener("open",this.onOpen),this.ws.removeEventListener("message",this.onMessage),this.ws.removeEventListener("error",this.onError),this.ws.removeEventListener("close",this.onClose),this.ws.close(),this.ws=void 0,this.socketStatus=0)}};A(Vi,"logName","Socket");let us=Vi;var Oe=(s=>(s.KEEPALIVE="keepalive",s.JOINCHANNEL="joinchannel",s.NOTIFYJOIN="notifyjoin",s.NOTIFYSTATUS="notifystatus",s.STATUSREPORT="statusreport",s.LEAVECHANNEL="leavechannel",s.NOTIFYLEAVE="notifyleave",s.NOTIFYPUBLISH="notifypublish",s.BYE="bye",s.RECONNECT="reconnect",s.PUBLISH="publish",s.REFRESHURL="refreshurl",s.UNSUBSCRIBE="unsubscribe",s.ROLEUPDATE="roleupdate",s))(Oe||{});class Fc{constructor(c,e){A(this,"authInfo");A(this,"userName");A(this,"seqIndex",0);this.authInfo=c,this.userName=e}get roleAuth(){if(this.authInfo.role){const{timestamp:c,nonce:e,token:t,role:r}=this.authInfo;return{timestamp:c,nonce:e,token:t,tokenrole:r}}}refreshAuthInfo(c){this.authInfo=c}getSeqIndex(){return this.seqIndex}createKeepAlivePackage(){return this.createBaseSendPackage("keepalive")}createJoinPackage(){let c=this.createBaseSendPackage("joinchannel");return c.header.displayName=this.userName,c.header.clientversion=At.getVersionNumber().toString(),c.header.platform=Ks,this.roleAuth&&(c.data.auth=this.roleAuth),c}crateLeavePackage(){return this.createBaseSendPackage("leavechannel")}createStatusPackage(c){let e=this.createBaseSendPackage("statusreport");return e.header.displayName=this.userName,e.data.status=c,e}createPublishPackage(){let c=this.createBaseSendPackage("publish");return c.data.users=[{}],this.roleAuth&&(c.data.auth=this.roleAuth),c}createRoleUpdatePackage(){let c=this.createBaseSendPackage("roleupdate");return c.header.displayName=this.userName,c}createReconnectPackage(c){let e=this.createBaseSendPackage("reconnect");return e.header.displayName=this.userName,e.header.clientversion=At.getVersionNumber().toString(),e.header.platform=Ks,e.data=Se(Se({},e.data),c!=null?c:{}),this.roleAuth&&(e.data.auth=this.roleAuth),e}createRefreshUrlPackage(){let c=this.createBaseSendPackage("refreshurl");return c.header.displayName=this.userName,c}createResponsePackage(c,e){return{version:1,code:200,tid:c,msgtype:e}}createBaseSendPackage(c){var t;return++this.seqIndex,{version:1,msgtype:c,tid:Vt(),header:{appid:this.authInfo.appId,channelid:this.authInfo.channelId,sessionid:(t=this.authInfo.sessionId)!=null?t:"",userid:this.authInfo.userId},data:{seq:this.seqIndex}}}}var ce=(s=>(s[s.ERR_JOIN_ALREADY_JOINED=16843521]="ERR_JOIN_ALREADY_JOINED",s[s.ERR_JOIN_BAD_APPID=33620481]="ERR_JOIN_BAD_APPID",s[s.ERR_JOIN_INVALID_APPID=33620482]="ERR_JOIN_INVALID_APPID",s[s.ERR_JOIN_BAD_CHANNEL=33620484]="ERR_JOIN_BAD_CHANNEL",s[s.ERR_JOIN_INVALID_CHANNEL=33620483]="ERR_JOIN_INVALID_CHANNEL",s[s.ERR_JOIN_BAD_TOKEN=33620485]="ERR_JOIN_BAD_TOKEN",s[s.ERR_JOIN_TIMEOUT=16908804]="ERR_JOIN_TIMEOUT",s[s.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD=16974081]="ERR_JOIN_ERR_JOIN_BAD_PARAMBAD",s[s.ERR_JOIN_CHANNEL_FAILED=16974338]="ERR_JOIN_CHANNEL_FAILED",s[s.ERR_LOG_ALREADY_INIT=16974085]="ERR_LOG_ALREADY_INIT",s[s.ERR_LOG_ROOT_PATH_ERROR=16974086]="ERR_LOG_ROOT_PATH_ERROR",s[s.ERR_MIC_OPEN_FAIL=17040388]="ERR_MIC_OPEN_FAIL",s[s.ERR_SPEAKER_OPEN_FAIL=17040389]="ERR_SPEAKER_OPEN_FAIL",s[s.ERR_MIC_INTERRUPT=17040390]="ERR_MIC_INTERRUPT",s[s.ERR_SPEAKER_INTERRUPT=17040391]="ERR_SPEAKER_INTERRUPT",s[s.ERR_MIC_AUTH_FAIL=17040392]="ERR_MIC_AUTH_FAIL",s[s.ERR_MIC_NOT_AVAILABLE=17040393]="ERR_MIC_NOT_AVAILABLE",s[s.ERR_SPEAKER_NO_AVAILABLE=17040400]="ERR_SPEAKER_NO_AVAILABLE",s[s.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",s[s.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",s[s.ERR_VIDEO_DISPLAY_OPEN_FAIL=17039873]="ERR_VIDEO_DISPLAY_OPEN_FAIL",s[s.ERR_VIDEO_DISPLAY_INTERRUPT=1064992]="ERR_VIDEO_DISPLAY_INTERRUPT",s[s.ERR_ICE_CONNECTION_CONNECT_FAIL=17105409]="ERR_ICE_CONNECTION_CONNECT_FAIL",s[s.ERR_ICE_CONNECTION_RECONNECT_FAI=17105410]="ERR_ICE_CONNECTION_RECONNECT_FAI",s[s.ERR_ICE_CONNECTION_MOBILITY_FAIL=17105411]="ERR_ICE_CONNECTION_MOBILITY_FAIL",s[s.ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT=16908812]="ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT",s[s.ERR_LATENCY_LIVE_COMMUNICATION_FAILED=17235971]="ERR_LATENCY_LIVE_COMMUNICATION_FAILED",s[s.ERR_LATENCY_LIVE_MEIDASETTING_FAILED=17235972]="ERR_LATENCY_LIVE_MEIDASETTING_FAILED",s[s.ERR_LATENCY_LIVE_NONE_BROADCASTER=17235973]="ERR_LATENCY_LIVE_NONE_BROADCASTER",s[s.ERR_LATENCY_LIVE_NEED_RESTART=17235974]="ERR_LATENCY_LIVE_NEED_RESTART",s[s.ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER=17235975]="ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER",s[s.ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE=17235976]="ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE",s[s.ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION=17235977]="ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION",s[s.ERR_SDK_PUBLISH_INVAILD=16974597]="ERR_SDK_PUBLISH_INVAILD",s[s.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL=16843782]="ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL",s[s.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED=16843859]="ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED",s[s.ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR=16843860]="ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR",s[s.ERR_SDK_SUBSCRIBE_INVAILD=16974852]="ERR_SDK_SUBSCRIBE_INVAILD",s[s.ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL=16844112]="ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL",s[s.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",s[s.ERR_SDK_INVALID_STATE=16974340]="ERR_SDK_INVALID_STATE",s[s.ERR_INVALID_ARGUMENTS=16974083]="ERR_INVALID_ARGUMENTS",s[s.ERR_SESSION_REMOVED=33620229]="ERR_SESSION_REMOVED",s[s.ERR_SDK_UPDATE_ROLE_CHANNEL=16908801]="ERR_SDK_UPDATE_ROLE_CHANNEL",s[s.ERR_INNER=-1]="ERR_INNER",s[s.ERR_SDK_MPU_TASK_PUBLISH_OK=0]="ERR_SDK_MPU_TASK_PUBLISH_OK",s[s.ERR_SDK_MPU_TASK_STREAM_NOT_FOUND=17825793]="ERR_SDK_MPU_TASK_STREAM_NOT_FOUND",s[s.ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST=17825794]="ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST",s[s.ERR_SDK_MPU_TASK_INVALID_PARAM=17825795]="ERR_SDK_MPU_TASK_INVALID_PARAM",s[s.ERR_SDK_MPU_TASK_INTERNAL_ERROR=17825796]="ERR_SDK_MPU_TASK_INTERNAL_ERROR",s[s.ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR=17825797]="ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR",s[s.ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR=17825798]="ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR",s[s.ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT=17825799]="ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT",s[s.ERR_SDK_MPU_TASK_NOT_AUTHORIZED=17825800]="ERR_SDK_MPU_TASK_NOT_AUTHORIZED",s[s.ERR_SDK_CHANNEL_RELAY_STATE_ERROR=18874369]="ERR_SDK_CHANNEL_RELAY_STATE_ERROR",s[s.ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW=18874370]="ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW",s[s.ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED=18874371]="ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED",s[s.ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID=18874372]="ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID",s[s.ERR_SDK_CHANNEL_RELAY_ROLE_ERROR=18874373]="ERR_SDK_CHANNEL_RELAY_ROLE_ERROR",s[s.ERR_SDK_CHANNEL_RELAY_INVALID_PARAM=18874374]="ERR_SDK_CHANNEL_RELAY_INVALID_PARAM",s[s.ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR=18874375]="ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR",s))(ce||{});class ne extends Error{constructor(e,t,r){super(t);A(this,"_code");A(this,"_extra");this._code=e,this._extra=r}static fromError(e,t=-1,r=""){return new ne(t,e.message||e.reason||r||"error",e.extraInfo)}get code(){return this._code}set code(e){this._code=e}get reason(){return this.message}get extra(){return this._extra}}const Oc=3e4,ct=class ct extends ve{constructor(e,t,r,i,n,a){super();A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"slsReporter");A(this,"wsClient");A(this,"packageCreater");A(this,"keepAliveTimer",0);A(this,"packageCache",new Map);A(this,"isFirstConnect",!0);A(this,"aliveChecker",0);A(this,"reconnectData");this.authInfo=e,this.userName=t,this.packageCreater=new Fc(e,t),this.channelProfile=r,this.clientRole=i,this.slsReporter=n,this.wsClient=new us(a),this.wsClient.on("onOpen",this.onOpen.bind(this)),this.wsClient.on("onMessage",this.onMessage.bind(this)),this.wsClient.on("onError",this.onError.bind(this)),this.wsClient.on("onClose",this.onClose.bind(this)),this.wsClient.on("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.on("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.on("onNetworkError",this.onNetworkError.bind(this)),this.wsClient.on("onReconnectStart",this.onReconnectStart.bind(this)),this.wsClient.on("onReconnectFail",this.onReconnectFail.bind(this))}get retryCount(){return this.wsClient.connectRetryCount}start(e){this.wsClient.start(e)}startKeepAlive(){this.keepAliveTimer===0&&(this.keepAliveTimer=window.setInterval(()=>{let e=this.packageCreater.createKeepAlivePackage();this.sendPackage(e)},5e3)),this.checkAlive()}stopKeepAlive(){this.keepAliveTimer!==0&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=0),this.aliveChecker&&(window.clearTimeout(this.aliveChecker),this.aliveChecker=0)}sendPkgCache(){this.packageCache.forEach(e=>{this.wsClient.send(e)})}leave(){let e=this.packageCreater.crateLeavePackage();this.sendPackage(e)}reportStatus(e){let t=this.packageCreater.createStatusPackage(e);this.sendPackage(t)}publish(e){let t=this.packageCreater.createPublishPackage();t.data.users=[],e.subscribe.signal=this.wsClient.connectUrl;const{tracks:r,resume:i}=e;r.forEach(n=>{const{codec:a,ssrc:o}=n;n.userdata=JSON.stringify({codec:a}),n.ssrc=`${o}`,i&&(n.attr={reason:"reconnect"})}),t.data.users.push(e),this.sendPackage(t)}roleUpdate(e){let t=this.packageCreater.createRoleUpdatePackage();t.data.clientrole=e,this.sendPackage(t)}refreshUrl(e){const t=this.packageCreater.createRefreshUrlPackage();t.data=Se(Rt(Se({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){oe.info(`[${ct.logName}] close`),this.stopKeepAlive(),this.wsClient.off("onOpen",this.onOpen.bind(this)),this.wsClient.off("onMessage",this.onMessage.bind(this)),this.wsClient.off("onError",this.onError.bind(this)),this.wsClient.off("onClose",this.onClose.bind(this)),this.wsClient.off("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.off("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.off("onReconnectStart"),this.wsClient.off("onReconnectFail"),this.wsClient.close()}sendPackage(e){[Oe.KEEPALIVE,Oe.RECONNECT,Oe.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e),e.msgtype!==Oe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!0,e.msgtype,e.tid,e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(oe.info(`[${ct.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===It.AliRtcSdkInteractiveLive||this.channelProfile===It.AliRtcSdkInteractiveWithLowLatencyLive)&&(e.data.configure.clientrole=this.clientRole),this.sendPackage(e)}else{this.stopKeepAlive();const e=this.packageCreater.createReconnectPackage(this.reconnectData);this.sendPackage(e)}}onMessage(e){try{let t=JSON.parse(e.data);this.packageCache.delete(t.tid),this.onRecvMessage(t),t!=null&&t.msgtype&&(t==null?void 0:t.msgtype)!==Oe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!1,t.msgtype,t.tid,t)}catch(t){oe.warn(`[${ct.logName}] onMessage err`,t,e)}}onError(e){oe.warn(`[${ct.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){oe.warn(`[${ct.logName}] onConnectFail`);const e=new ne(ce.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){oe.warn(`[${ct.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){oe.warn(`[${ct.logName}] onNetworkError`);const e=new ne(ce.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){oe.info(`[${ct.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new ne(ce.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{oe.info(`[${ct.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},Oc)}onRecvMessage(e){switch(e.msgtype!==Oe.KEEPALIVE&&oe.info(`[${ct.logName}] recv msg: ${e.msgtype}`),e.msgtype){case Oe.JOINCHANNEL:this.onJoinResult(e);break;case Oe.KEEPALIVE:this.onKeepAliveRsp();break;case Oe.PUBLISH:this.onPublishResult(e);break;case Oe.NOTIFYJOIN:this.onNotifyJoin(e);break;case Oe.NOTIFYSTATUS:this.onNotifyStatus(e);break;case Oe.LEAVECHANNEL:this.onLeaveResult(e);break;case Oe.NOTIFYLEAVE:this.onNotifyLeave(e);break;case Oe.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case Oe.STATUSREPORT:this.onStatusReport(e);break;case Oe.BYE:this.onBye(e);break;case Oe.ROLEUPDATE:this.onRoleUpdateResult(e);break;case Oe.REFRESHURL:this.onRefreshUrlResult(e);break;case Oe.RECONNECT:this.onReconnectResult(e);break}}onJoinResult(e){this.isFirstConnect=!1,this.emit("onJoinChannelResult",e)}onLeaveResult(e){this.emit("onLeaveResult",e.code,e.tid)}onPublishResult(e){this.emit("onPublishResult",e.code,e.tid,e.description)}onRoleUpdateResult(e){this.emit("onRoleUpdateResult",e.code,e.tid,e.description)}onRefreshUrlResult(e){this.emit("onRefreshUrlResult",e)}onReconnectResult(e){if(e.code===200)this.sendPkgCache(),this.startKeepAlive(),this.emit("onReconnectSuccess",e.data.users);else{const t=new ne(ce.ERR_INNER,`reconnect failed, code: ${e.code};description: ${e.description}`);e.code===403&&(t.code=403),this.emit("onReconnectFail",t),this.close()}}onNotifyJoin(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e&&e.data&&e.data.users&&this.emit("onNotifyJoin",e.data.users)}onNotifyStatus(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.status&&e.data.status.length&&this.emit("onNotifyStatus",e.data.status)}onNotifyLeave(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyLeave",e.data.users)}onNotifyPublish(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyPublish",e.data.users)}onStatusReport(e){this.emit("onStatusReport",e.code,e.tid,e.description)}onBye(e){this.stopKeepAlive(),this.emit("onBye",e.reason,e.description)}};A(ct,"logName","RSMessageCenter");let hs=ct;const j=(s,c)=>(e,t,r)=>{const i=r.value;return r.value=function(...n){var g;const a=`[${((g=e.constructor)==null?void 0:g.logName)||""}]`,o=Date.now();let u=[];if(s)try{u=s(n)}catch(f){}oe.interface(a,t,...u);const h=i.apply(this,n);return Promise.resolve(h).then(f=>f).catch(f=>f).then(f=>{var m;let l="";const p=f instanceof Error,d=p&&((m=e.constructor)==null?void 0:m.logError);if(!(!c&&!p)){if(d)l=f;else if(p)l=f.message||"";else if(c)if(f===void 0)l="";else try{l=c(f)}catch(x){}else return;oe.interfaceResult(a,t,!(p&&d),`${Date.now()-o}ms`,l)}}),h},r},ae=s=>s;var Vc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,ds=(s,c,e,t)=>{for(var r=t>1?void 0:t?Uc(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&Vc(c,e,r),r};const Ni=(it=class extends ve{constructor(e,t,r,i=Ct.prod){super();A(this,"messageCenter");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"slsReporter");A(this,"reconnectData");A(this,"roomServerUri","");this.channelProfile=e,this.clientRole=t,this.slsReporter=r,this.reconnectData={role:{channelprofile:e,clientrole:t}};const n=i===Ct.pre?Ei.pre:Ei.prod;this.roomServerUri=`wss://${n}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){oe.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,r){return z(this,null,function*(){return new Promise((i,n)=>{const a={};this.authInfo=e,this.userName=t,this.messageCenter=new hs(e,t,this.channelProfile,this.clientRole,this.slsReporter,r),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",u=>{var h,g,f;if(oe.info(`[${it.logName}]`,"join result: ",u),a.taskretrynum=((h=this.messageCenter)==null?void 0:h.retryCount)||0,u.code==200){(g=this.messageCenter)==null||g.sendPkgCache(),(f=this.messageCenter)==null||f.startKeepAlive();let l=u.data;l.tid=u.tid,l.users=u.data.users,l.timestamp=u.timestamp,a.est&&(a.joinconnecttc=Date.now()-a.est),this.slsReporter.reportJoinConnection(a),i(l)}else this.reset(),n(this.handleSignalError(u.code,u.reason,ce.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new ne(ce.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),oe.info(`[${it.logName}]`,"start ws connecting roomserver and auto join when connected");const o={appid:this.authInfo.appId,callid:this.authInfo.sessionId,channelid:this.authInfo.channelId,userid:this.authInfo.userId,nonce:this.authInfo.nonce||"",timestamp:this.authInfo.timestamp,token:this.authInfo.token,authtype:"app",tid:Vt()};e.role&&(o.tokenrole=e.role),a.est=Date.now(),this.messageCenter.start(this.roomServerUri+"?"+At.queryingParam(o))})})}leave(){return oe.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(r,i)=>{oe.info(`[${it.logName}]`,"recv leave response "+r),r===200?(this.updateReconnectData(),this.reset(),e({tid:i})):t(this.handleSignalError(r,"leave error"))}),oe.info(`[${it.logName}]`,"send leave request"),this.messageCenter.leave()):(oe.info(`[${it.logName}]`,"no message center, ok to leave"),e({tid:""}))})}publish(e){return new Promise((t,r)=>{var i;this.messageCenter?(this.messageCenter.once("onPublishResult",(n,a,o)=>{oe.info(`[${it.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Rt(Se({},this.reconnectData),{publish:{users:[e]}})),t({tid:a})):r(this.handleSignalError(n,`publish error, ${o}`))}),this.authInfo&&(e.sessionid=(i=this.authInfo.sessionId)!=null?i:""),e.callid||(e.callid=Vt()),oe.info(`[${it.logName}]`,"assign callid "+e.callid+" and send publish request"),this.messageCenter.publish(e)):r(this.handleSignalError(-1,"publish error, no message center"))})}roleUpdate(e){return new Promise((t,r)=>{if(!this.messageCenter){r(this.handleSignalError(-1,"role update error, no message center"));return}this.messageCenter.on("onRoleUpdateResult",(i,n,a)=>{var o,u;oe.info(`[${it.logName}]`,"recv role update response "+i),i===200?((u=(o=this.reconnectData)==null?void 0:o.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):r(this.handleSignalError(i,`role update error, ${a}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return oe.info(`[${it.logName}]`,"refreshUrl .."),new Promise((t,r)=>{if(!this.messageCenter){r(this.handleSignalError(-1,"refresh url error, no message center"));return}this.messageCenter.on("onRefreshUrlResult",i=>{const{code:n,description:a,data:o={}}=i||{};oe.info("recv refresh url response "+n),n===200?t(o):r(this.handleSignalError(n,`refresh url error, ${a}`))}),oe.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return oe.info(`[${it.logName}]`,"reportStatus "+e),new Promise((t,r)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(i,n)=>{i===200?t():r(new ne(i,n))}),this.messageCenter.reportStatus(e)):r(new ne(-1,"No messageCenter"))})}handleSignalError(e,t,r=ce.ERR_INNER){const i=`signal error: code - ${e}; description - ${t}`;return new ne(r,i)}refreshAuthInfo(e){return z(this,null,function*(){var t;this.authInfo&&(this.authInfo=e,(t=this.messageCenter)==null||t.refreshAuthInfo(this.authInfo))})}initMessageCenter(){var e,t,r,i,n,a,o,u,h,g,f,l;(e=this.messageCenter)==null||e.on("onKeepAliveRsp",()=>{this.emit("onKeepAliveRsp")}),(t=this.messageCenter)==null||t.on("onNotifyJoin",p=>{this.emit("onNotifyJoin",p)}),(r=this.messageCenter)==null||r.on("onNotifyStatus",p=>{this.emit("onNotifyStatus",p)}),(i=this.messageCenter)==null||i.on("onNotifyLeave",p=>{this.emit("onNotifyLeave",p)}),(n=this.messageCenter)==null||n.on("onNotifyPublish",p=>{this.emit("onNotifyPublish",p)}),(a=this.messageCenter)==null||a.on("onBye",(p,d)=>{this.emit("onBye",p,d)}),(o=this.messageCenter)==null||o.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(u=this.messageCenter)==null||u.on("onReconnectSuccess",p=>{this.emit("onReconnectSuccess",p)}),(h=this.messageCenter)==null||h.on("onReconnectFail",p=>{this.emit("onReconnectFail",p)}),(g=this.messageCenter)==null||g.on("onConnectFail",p=>{this.emit("onConnectFail",p),this.reset()}),(f=this.messageCenter)==null||f.on("onNetworkError",p=>{this.emit("onNetworkError",p)}),(l=this.messageCenter)==null||l.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},A(it,"logName","RoomServerSignaling"),it);ds([j()],Ni.prototype,"join",1),ds([j()],Ni.prototype,"publish",1),ds([j()],Ni.prototype,"roleUpdate",1);let zc=Ni;const Hc="https://pgw.rtn.aliyuncs.com",jc="https://gw.rtn.aliyuncs.com",sa=10*60*1e3,Wc=12,_i=class _i extends ve{constructor(e,t){super();A(this,"env");A(this,"authInfo");A(this,"timer");A(this,"slsReporter");A(this,"expiration",0);A(this,"skipTime",0);A(this,"requestToken",()=>z(this,null,function*(){if(this.skipTime=0,!this.authInfo)return;const{appId:e,channelId:t,userId:r,nonce:i="",token:n,timestamp:a,sessionId:o,role:u}=this.authInfo;let h=jc;this.env===Ct.pre&&(h=Hc);const g=`${h}/gslb/v1/stsupdate?appid=${e}&channelid=${t}&userid=${r}&nonce=${i}&token=${n}&timestamp=${a}&session=${o}${u?`&tokenrole=${u}`:""}&slstoken=true&osstoken=true&tokensid=false`;fetch(g).then(f=>f.json()).then(f=>{var l,p;if(f.code===0){const d=(l=f.data)==null?void 0:l.oss,m=(p=f.data)==null?void 0:p.sls;return this.expiration=d.expiration||m.expiration,this.emit("onTokenUpdate",d,m),oe.event(`[${_i.logName}]`,"getToken",d,m),f}this.slsReporter.reportSTSResult(200)}).catch(f=>{this.slsReporter.reportSTSResult(-1),oe.error(`[${_i.logName}]`,"getToken",f.message)})}));this.slsReporter=e,this.env=t}refreshAuthInfo(e){this.authInfo=e}startSTSUpdate(e){this.authInfo=e,this.requestToken(),this.timer&&clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.expiration&&Math.floor((Date.now()+sa*1.5)/1e3)<this.expiration&&this.skipTime<Wc){this.skipTime+=1;return}this.requestToken()},sa)}clear(){this.timer&&clearInterval(this.timer)}};A(_i,"logName","StsManager");let ls=_i;class Kc extends ve{constructor(e,t,r,i=Ct.prod){super();A(this,"signaling");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"env",Ct.prod);A(this,"maxConnectRetryCount");A(this,"stsManager");A(this,"slsReporter");this.channelProfile=e,this.clientRole=t,this.env=i,this.slsReporter=r,this.stsManager=new ls(r,i)}reset(){var e;oe.info("[signalingmanager] reset"),(e=this.signaling)==null||e.reset(),this.stsManager.clear(),this.signaling=void 0,this.authInfo=void 0}join(e,t=e.userId,r,i){return this.maxConnectRetryCount=r,this.userName=t,new Promise((n,a)=>{this.signaling?a(new ne(ce.ERR_JOIN_ALREADY_JOINED,"already joined")):(oe.info("[signalingmanager] create signaling"),this.signaling=new zc(this.channelProfile,this.clientRole,this.slsReporter,this.env),this.initSignaling(),i&&(i.rs=Date.now()),this.signaling.join(e,t,r).then(o=>{this.authInfo=e,i&&(i.re=Date.now()),n(o)}).catch(o=>{this.reset(),a(o)}),this.stsManager.startSTSUpdate(e))})}retryJoin(){const e=this.authInfo;this.reset(),e&&this.join(e,this.userName,this.maxConnectRetryCount)}leave(){return new Promise((e,t)=>{this.signaling?this.signaling.leave().then(r=>{this.reset(),e(r)}).catch(r=>{t(r)}):e({tid:""})})}publish(e){return new Promise((t,r)=>{var i;this.signaling&&this.authInfo?(e.userid=this.authInfo.userId,e.displayname=(i=this.userName)!=null?i:this.authInfo.userId,this.signaling.publish(e).then(n=>{t(n)}).catch(n=>{r(n)})):r(new ne(ce.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL,"no signaling"))})}reportStatus(e){return new Promise((t,r)=>{this.signaling?this.signaling.reportStatus(e).then(()=>{t()}).catch(i=>{r(i)}):r(new ne(-1,"no signaling"))})}setClientRole(e){return z(this,null,function*(){const t=this.clientRole;if(!this.signaling){this.clientRole=e;return}const r=Date.now();try{const i=yield this.signaling.roleUpdate(e);return this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-r,0),i}catch(i){this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-r,i.code||-1)}})}setChannelProfile(e){this.signaling?this.signaling.setChannelProfile(e):this.channelProfile=e}refreshUrl(e){return this.signaling?this.signaling.refreshUrl(e):Promise.reject(new ne(ce.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return z(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=Se(Se({},this.authInfo),e),(t=this.signaling)==null||t.refreshAuthInfo(this.authInfo),this.stsManager.refreshAuthInfo(this.authInfo))}catch(r){throw r}})}initSignaling(){var e,t,r,i,n,a,o,u,h,g,f,l,p;(e=this.signaling)==null||e.on("onKeepAliveRsp",this.onKeepAliveRsp.bind(this)),(t=this.signaling)==null||t.on("onNotifyJoin",this.onNotifyJoin.bind(this)),(r=this.signaling)==null||r.on("onNotifyStatus",this.onNotifyStatus.bind(this)),(i=this.signaling)==null||i.on("onNotifyLeave",this.onNotifyLeave.bind(this)),(n=this.signaling)==null||n.on("onNotifyPublish",this.onNotifyPublish.bind(this)),(a=this.signaling)==null||a.on("onBye",this.onBye.bind(this)),(o=this.signaling)==null||o.on("onReconnectStart",this.onReconnectStart.bind(this)),(u=this.signaling)==null||u.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(h=this.signaling)==null||h.on("onReconnectFail",this.onReconnectFail.bind(this)),(g=this.signaling)==null||g.on("onConnectFail",this.onConnectFail.bind(this)),(f=this.signaling)==null||f.on("onNetworkError",this.onNetworkError.bind(this)),(l=this.signaling)==null||l.on("onAuthInvalid",this.onAuthInvalid.bind(this)),(p=this.signaling)==null||p.on("onError",this.onError.bind(this))}onKeepAliveRsp(){this.emit("onKeepAliveRsp")}onNotifyJoin(e){this.emit("onNotifyJoin",e)}onNotifyStatus(e){this.emit("onNotifyStatus",e)}onNotifyLeave(e){this.emit("onNotifyLeave",e)}onNotifyPublish(e){this.emit("onNotifyPublish",e)}onBye(e,t){this.emit("onBye",e,t)}onConnectFail(e){this.reset(),this.emit("onConnectFail",e)}onNetworkError(e){this.emit("onNetworkError",e)}onAuthInvalid(e){}onReconnectStart(){this.emit("onReconnectStart")}onReconnectSuccess(e){this.emit("onReconnectSuccess",e)}onReconnectFail(e){this.emit("onReconnectFail",e)}onError(e){this.emit("onError",e)}}const Jt=class Jt{static getInstance(){return Jt.instance||(Jt.instance=new AudioContext),Jt.instance.resume(),Jt.instance}};A(Jt,"instance");let ri=Jt;function $c(s,c,e,t,r){let i=t,n=0,a;const o=s.createAnalyser();o.fftSize=256;const u=new Uint8Array(o.frequencyBinCount);c.connect(o),o.connect(e);const h=()=>{a&&window.clearInterval(a)},g=()=>{a=window.setInterval(()=>{o.getByteFrequencyData(u);let f=Math.round(u.reduce((l,p)=>l+p)/u.length);f=Math.min(100,f),n=f,r&&r(f)},i)};return g(),{updateInterval:f=>{h(),i=f,g()},getLevel:()=>n,dispose:()=>{h(),c.disconnect(),o.disconnect()}}}class qc extends ve{constructor(){super();A(this,"audioContext");A(this,"stream");A(this,"sourceNode");A(this,"analyser");this.audioContext=ri.getInstance(),this.stream=new MediaStream}getLevel(){return this.analyser?this.analyser.getLevel():0}start(e,t=1e3){this.sourceNode&&this.stop(),this.stream.addTrack(e),this.sourceNode=this.audioContext.createMediaStreamSource(this.stream);const r=this.audioContext.createMediaStreamDestination();this.analyser=$c(this.audioContext,this.sourceNode,r,t,i=>{this.emit("audioLevel",i)})}stop(){this.analyser&&this.analyser.dispose(),this.analyser=void 0,this.sourceNode=void 0,this.stream.getAudioTracks().forEach(e=>{this.stream.removeTrack(e)})}dispose(){this.stop()}}class na extends ve{constructor(e,t,r,i){super();A(this,"uid");A(this,"name");A(this,"rtsManager");A(this,"callId","");A(this,"audioLevelMonitor");A(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=t,this.rtsManager=r,this.audioVolumeIndicationInterval=i,this.audioLevelMonitor=new qc}get userId(){return this.uid}get displayname(){return this.name}createCallId(){this.callId||(this.callId=At.createCallid())}setUserInfo(e,t){this.uid=e,this.name=t}refreshUserInfo(e){this.uid=e}getAudioLevel(){return this.audioLevelMonitor.getLevel()}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval=e}clear(){this.audioLevelMonitor.dispose()}}class aa{static getCurrentStatus(c){let e=0;c.micOpen&&(e+=1),c.micInterrupted&&(e+=2),c.cameraOpen&&(e+=4),c.screenShare&&(e+=128),c.audioDisable&&(e+=8),c.videoDisable&&(e+=16),c.screenDisable&&(e+=256);let t=e.toString(16);for(;t.length<16;)t="0"+t;return t}static parseStatus(c){let e=parseInt(c,16);return{micOpen:!!(e&1),micInterrupted:!!(e&2),cameraOpen:!!(e&4),screenShare:!!(e&128),audioDisable:!!(e&8),videoDisable:!!(e&16),screenDisable:!!(e&256),backgroundMode:!!(e&32),accompanyPlaying:!!(e&64)}}}const oa="customVideoProfile",ca="customScreenProfile",gi={width:1280,height:720,frameRate:30,maxBitrate:2e3},vi={width:1920,height:1080,frameRate:30,maxBitrate:2600},Gc={1e4:Fe.AliEngineLocalDeviceExceptionTypeUnknown,2e4:Fe.AliEngineLocalDeviceExceptionTypeUnknown,10001:Fe.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:Fe.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:Fe.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:Fe.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:Fe.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:Fe.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10011:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10012:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10013:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10014:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10019:Fe.AliEngineLocalDeviceExceptionTypeDisplayException},Jc=s=>s.getAudioTracks()[0];function ua(s){var c;if(((c=s==null?void 0:s.nodeName)==null?void 0:c.toLowerCase())==="video")return s.setAttribute("playsinline",""),s;if(typeof s=="string"){let e=document.getElementById(s);if(e){if(e.nodeName.toLocaleLowerCase()==="video")return e.setAttribute("playsinline",""),e;throw new ne(ce.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new ne(ce.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new ne(ce.ERR_INVALID_ARGUMENTS,"element id should be string")}function fs(s){var e;const c=[];if(Array.isArray(s))s.forEach(t=>{try{c.push(ua(t))}catch(r){}});else if(typeof s=="string"||((e=s==null?void 0:s.nodeName)==null?void 0:e.toLowerCase())==="video")try{c.push(ua(s))}catch(t){}return c}function $t(s){return new Promise(c=>setTimeout(c,s))}const ha=(s,c)=>{const e=()=>(s.muted=!0,Promise.race([$t(500),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let t;return s.srcObject!==c?(s.load(),s.srcObject=c,t=s.play(),s._playPromise=t):t=Promise.resolve(),t}));return new Promise(t=>{if(me.AliRTS.BrowserUtil.isMicroMessenger){const r=window.top!==window.self,i=window.WeixinJSBridge||window.top.WeixinJSBridge;i?i.invoke("getNetworkType",{},()=>{t(e())}):(r?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{i.invoke("getNetworkType",{},()=>{t(e())})}),setTimeout(()=>{t(e())},1e3)}else t(e())})},Bt=s=>{Promise.race([$t(100),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{s.srcObject=null,s._playPromise=void 0})};var Xc=Object.defineProperty,Zc=Object.getOwnPropertyDescriptor,ze=(s,c,e,t)=>{for(var r=t>1?void 0:t?Zc(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&Xc(c,e,r),r};const da=30;class Mi extends ve{constructor(){super();A(this,"state");A(this,"time");this.state=be.AliRtcStatePublishIdle,this.time=Date.now()}setState(e){const t=this.state,r=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-r)/1e3))}}const Ve=(Lt=class extends na{constructor(e){const{rtsManager:t,localStreamManager:r,slsReporter:i,signalingManager:n,audioVolumeIndicationInterval:a,parameter:o}=e;super("","",t,a);A(this,"url","");A(this,"joinTime",0);A(this,"_isPublishing",!1);A(this,"publishPromise",Promise.resolve(""));A(this,"previewElements",[]);A(this,"screenPreviewElements",[]);A(this,"streamManager");A(this,"streamTracks");A(this,"publishId",Vt());A(this,"signalingManager");A(this,"traceId","");A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});A(this,"candidateDataCache",[]);A(this,"pcMediaStatsMap",{});A(this,"slsReporter");A(this,"audioPubState");A(this,"videoPubState");A(this,"videoSmallPubState");A(this,"screenPubState");A(this,"parameter",{});A(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=r,this.signalingManager=n,this.slsReporter=i,this.parameter=o,this.streamManager.on("trackended",u=>{this.onTrackEnd(u)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Mi,this.audioPubState.on("change",(u,h,g)=>{this.emit("audioPublishStateChanged",u,h,g)}),this.videoPubState=new Mi,this.videoPubState.on("change",(u,h,g)=>{this.emit("videoPublishStateChanged",u,h,g)}),this.videoSmallPubState=new Mi,this.videoSmallPubState.on("change",(u,h,g)=>{this.emit("dualStreamPublishStateChanged",u,h,g)}),this.screenPubState=new Mi,this.screenPubState.on("change",(u,h,g)=>{this.emit("screenPublishStateChanged",u,h,g)}),this.startStreamMonitor()}get joined(){return!!this.uid}get isPublishing(){return this._isPublishing}get publishStreams(){return this.streamManager.publishStreams}get cameraTrack(){return this.streamManager.cameraStreamInfo.originVideoTrack}get screenTrack(){return this.streamManager.screenStreamInfo.originVideoTrack}get audioTrack(){return this.streamManager.cameraStreamInfo.originAudioTrack}get hasCamera(){return!!this.streamManager.cameraStreamInfo.originVideoTrack}get hasMicrophone(){return!!this.streamManager.cameraStreamInfo.originAudioTrack}get hasScreenShare(){return!!this.streamManager.screenStreamInfo.originVideoTrack}get hasCameraTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="video"&&t&&i===Z.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="video"&&t&&i===Z.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="video"&&t&&i===Z.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="audio"&&t&&i===Z.Audio))}get cameraDirection(){var e,t;return(t=(e=this.streamManager.cameraStreamInfo)==null?void 0:e.cameraVideoConstraints)==null?void 0:t.facingMode}get audioCaptureDisabled(){return this.streamManager.audioCaptureDisabled}get cameraCaptureDisabled(){return this.streamManager.cameraCaptureDisabled}get publishLocalVideoStreamEnabled(){return this.streamManager.publishLocalVideoStreamEnabled}get publishLocalAudioStreamEnabled(){return this.streamManager.publishLocalAudioStreamEnabled}get publishLocalScreenStreamEnabled(){return this.streamManager.publishLocalScreenStreamEnabled}setPublishLocalAudioStreamEnabled(e){this.streamManager.publishLocalAudioStreamEnabled=e}setPublishLocalVideoStreamEnabled(e){this.streamManager.publishLocalVideoStreamEnabled=e}setPublishLocalScreenStreamEnabled(e){this.streamManager.publishLocalScreenStreamEnabled=e}initInfo(e,t){this.joinTime=Date.now(),this.rtsManager.localJoinTime=this.joinTime,this.setUserInfo(e.userId,e.userId),this.url=t,this.callId=e.sessionId||At.createCallid(),this.updatePubId()}setVideoProfile(e,t){return z(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return z(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return z(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===mi.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===mi.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new ne(ce.ERR_CAMERA_OPEN_FAIL,`camera direction set to ${e} failed`)}setCameraDeviceId(e){this.streamManager.setCameraVideoConstraints({deviceId:e})}muteLocalCamera(e){this.streamManager.setCameraMuted(e),this.slsReporter.reportMute(this.callId,!e,"video")}muteLocalMic(e){this.streamManager.setAudioMuted(e),this.slsReporter.reportMute(this.callId,!e,"audio")}muteLocalScreen(e){this.streamManager.setScreenMuted(e),this.slsReporter.reportMute(this.callId,!e,"screen")}setMicrophoneDeviceId(e){this.streamManager.setMicAudioConstraints({deviceId:e})}updatePubId(){this.publishId=Vt()}clearPublishState(){this.streamTracks=void 0}clear(){return z(this,null,function*(){As(Lt.prototype,this,"clear").call(this),this._isPublishing&&(yield this.unPublish()),this.stopPreview(),this.resetPreviewElements(),this.resetSecondayPreviewElements(),this.clearStream(),this.streamManager.cameraCaptureDisabled=!1})}resetElement(e){this.previewElements.includes(e)&&(Bt(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(Bt(e),this.screenPreviewElements.splice(this.screenPreviewElements.indexOf(e),1))}setPreviewElement(e){const{videoElement:t,screen:r}=e;r?this.screenPreviewElements.includes(t)||this.screenPreviewElements.push(t):this.previewElements.includes(t)||this.previewElements.push(t)}setViewConfig(e,t){if(!e){t===Ae.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![Ae.AliRtcVideoTrackCamera,Ae.AliRtcVideoTrackScreen].includes(t))throw new ne(ce.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(r=>{this.setPreviewElement({videoElement:r,screen:t===Ae.AliRtcVideoTrackScreen})})}startCameraCapture(e){return z(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream(e)})}stopCameraCapture(){return z(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}stopAudioCapture(){return z(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return z(this,null,function*(){const{videoElement:t,screen:r}=e!=null?e:{};try{let i=r?this.streamManager.screenStreamInfo.previewStream:this.streamManager.cameraStreamInfo.previewStream;if(!t)throw new ne(ce.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!i){oe.info(`[${Lt.logName}]`,"preview no stream founded");return}return ha(t,i.mediaStream),this.setPreviewElement(e),i.mediaStream}catch(i){const n=ce.ERR_INNER;throw ne.fromError(i,n,"preview failed")}})}previewAll(e){return z(this,null,function*(){const{primary:t=!0,screen:r=!0}=e!=null?e:{};if(t&&this.previewElements.length)for(let i=0;i<this.previewElements.length;i++){const n=this.previewElements[i];yield this.preview({videoElement:n})}if(r&&this.screenPreviewElements.length)for(let i=0;i<this.screenPreviewElements.length;i++){const n=this.screenPreviewElements[i];yield this.preview({videoElement:n,screen:!0})}})}stopPreview(e){const{videoElement:t,primary:r=!0,screen:i=!0}=e||{};if(!t)r&&(this.previewElements.forEach(n=>{Bt(n)}),this.previewElements=[]),i&&(this.screenPreviewElements.forEach(n=>{Bt(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(a=>a===t);if(n>=0)this.previewElements.splice(n,1),Bt(t);else{const a=this.screenPreviewElements.findIndex(o=>o===t);a>=0&&(this.screenPreviewElements.splice(a,1),Bt(t))}}}resumePublish(){return z(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return z(this,null,function*(){try{const t=yield this.streamManager.createLocalStream(e);return t!=null&&t.audioTrack&&this.audioVolumeIndicationInterval>0&&this.audioLevelMonitor.start(t.audioTrack,this.audioVolumeIndicationInterval),e.video?this.previewAll({primary:!0}):e.screen&&this.previewAll({screen:!0}),t}catch(t){const r=Gc[t.errorCode];throw r&&(e.audio?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,r,""):e.video?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,r,""):e.screen?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,r,""):this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeUnknown,r,"")),t}})}stopLocalStream(e){return z(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,r){return z(this,null,function*(){var n,a;if(!e&&!t)return;if(e&&!t){const o={};return r===Z.Audio?o.audio=!0:r===Z.VideoLarge||r===Z.VideoSmall?(o.video=!0,o.vMsid=r):r===Z.Screen&&(o.screen=!0),yield this.publishDeleteTracks(o)}const i={};if(t!=null&&t.hasVideo&&(i.isScreen=r===Z.Screen,i.vMsid=r),t!=null&&t.hasAudio&&(i.aMsid=r),!e&&t)return yield this.publishAdd(t,i,!1);if(e&&t){const o=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((a=t.audioTrack)==null?void 0:a.id);if(o!==u)return yield this.publishReplace(t,i)}})}reportAudioProfile(){const e=this.streamManager.cameraStreamInfo.audioProfile||"standard",t=me.AliRTS.AudioProfileMap.get(e);this.slsReporter.reportPublishProfile(Z.Audio,{a_profile:e,bits:(t==null?void 0:t.maxBitrate)||0,samplerate:(t==null?void 0:t.sampleRate)||0,channel:(t==null?void 0:t.channelCount)||0})}reportVideoProfile(){const e=this.streamManager.cameraStreamInfo.videoProfile||"",t=me.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(Z.VideoLarge,{v_profile:e,wdth:(t==null?void 0:t.width)||0,hgt:(t==null?void 0:t.height)||0,fps:(t==null?void 0:t.frameRate)||0,bitrate:(t==null?void 0:t.maxBitrate)||0})}reportScreenProfile(){const e=this.streamManager.screenStreamInfo.videoProfile||"",t=me.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(Z.Screen,{v_profile:e,wdth:(t==null?void 0:t.width)||0,hgt:(t==null?void 0:t.height)||0,fps:(t==null?void 0:t.frameRate)||0,bitrate:(t==null?void 0:t.maxBitrate)||0})}startPublish(){return z(this,arguments,function*(e=!1,t=Ot.MANUAL){if(!this.joined)return;this.createCallId();const r=yield this.streamManager.publishStreams,{audio:i,video:n,videoSmall:a,screen:o}=r;try{const u=new Date().getTime();i&&this.audioPubState.setState(be.AliRtcStatePublishing),n&&this.videoPubState.setState(be.AliRtcStatePublishing),a&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),o&&this.screenPubState.setState(be.AliRtcStatePublishing),this.publishPromise=this.rtsManager.publish(this.url,this.callId,e,t);const h=yield this.publishPromise;this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=h,i&&(this.trackTraceIdMap[Z.Audio]=h,this.reportAudioProfile()),a&&(this.trackTraceIdMap[Z.VideoSmall]=h),n&&(this.trackTraceIdMap[Z.VideoLarge]=h,this.reportVideoProfile()),o&&(this.trackTraceIdMap[Z.Screen]=h,this.reportScreenProfile());const g={type:Ft.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:e,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceId:h};yield this.syncPublishToRoomServer(g,r,u),i&&this.audioPubState.setState(be.AliRtcStatePublished),n&&this.videoPubState.setState(be.AliRtcStatePublished),a&&this.videoSmallPubState.setState(be.AliRtcStatePublished),o&&this.screenPubState.setState(be.AliRtcStatePublished)}catch(u){throw i&&this.audioPubState.setState(be.AliRtcStateNoPublish),n&&this.videoPubState.setState(be.AliRtcStateNoPublish),a&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),o&&this.screenPubState.setState(be.AliRtcStateNoPublish),u}})}publishUpdate(){return z(this,null,function*(){var i,n,a,o;if(!this._isPublishing)return;yield this.publishPromise;const e=this.streamManager.publishStreams;let t;const r=new Date().getTime();try{const u=(i=this.streamTracks)==null?void 0:i.find(({ssrc:x,type:v,msid:b})=>v==="audio"&&x&&b===Z.Audio),h=yield this.compareAndPublish(u,e.audio,Z.Audio);h&&(t=h);const g=(n=this.streamTracks)==null?void 0:n.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.VideoLarge),f=yield this.compareAndPublish(g,e.video,Z.VideoLarge);f&&(t=f);const l=(a=this.streamTracks)==null?void 0:a.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.VideoSmall),p=yield this.compareAndPublish(l,e.videoSmall,Z.VideoSmall);p&&(t=p);const d=(o=this.streamTracks)==null?void 0:o.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.Screen),m=yield this.compareAndPublish(d,e.screen,Z.Screen);if(m&&(t=m),!t)return;yield this.syncPublishToRoomServer(t,e,r)}catch(u){const{code:h}=u!=null?u:{},g=this.url;throw h===403&&g&&(yield this.refreshPushStreamUrl(),t=yield this.publishUpdate()),u}return t})}syncPublishToRoomServer(e,t,r){return z(this,null,function*(){if(!e)throw new ne(ce.ERR_INNER,"sync publish to room server failed because no publishInfo");const i=yield this.signalingManager.publish(e);e.signaltid=i.tid})}refreshPushStreamUrl(){return z(this,null,function*(){const e=new ne(ce.ERR_INNER,"refresh push stream url error"),t=this.url;if(!t)throw e;const r=yield this.signalingManager.refreshUrl({pushstreamurl:t});if(!(r!=null&&r.pushstreamurl))throw e;this.url=r==null?void 0:r.pushstreamurl})}publishAdd(e,t,r=!1,i=0){return z(this,null,function*(){this.createCallId();const n=(t==null?void 0:t.aMsid)===Z.Audio,a=(t==null?void 0:t.vMsid)===Z.VideoLarge,o=(t==null?void 0:t.vMsid)===Z.VideoSmall,u=(t==null?void 0:t.vMsid)===Z.Screen;n&&this.audioPubState.setState(be.AliRtcStatePublishing),a&&this.videoPubState.setState(be.AliRtcStatePublishing),o&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),u&&this.screenPubState.setState(be.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,this.callId,t,!1,0,!0);n&&(this.audioPubState.setState(be.AliRtcStatePublished),this.reportAudioProfile(),this.trackTraceIdMap[Z.Audio]=h),a&&(this.videoPubState.setState(be.AliRtcStatePublished),this.reportVideoProfile(),this.trackTraceIdMap[Z.VideoLarge]=h),o&&(this.videoSmallPubState.setState(be.AliRtcStatePublished),this.trackTraceIdMap[Z.VideoSmall]=h),u&&(this.screenPubState.setState(be.AliRtcStatePublished),this.reportScreenProfile(),this.trackTraceIdMap[Z.Screen]=h),this.streamTracks=this.rtsManager.publishingTracks;const g={type:Ft.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:r,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceid:h};return this.reportSelfDeviceStatus(),this.monitorTimerId||this.startStreamMonitor(),g}catch(h){let g=ce.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(be.AliRtcStateNoPublish),g=ce.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED),a&&(this.videoPubState.setState(be.AliRtcStateNoPublish),g=ce.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED),o&&(this.videoSmallPubState.setState(be.AliRtcStateNoPublish),g=ce.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED),u&&(this.screenPubState.setState(be.AliRtcStateNoPublish),g=ce.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&i<3)return this.publishAdd(e,t,r,i+1);throw ne.fromError(h,g,"publish add failed")}})}publishReplace(e,t){return z(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.streamTracks=this.rtsManager.publishingTracks;const r={type:Ft.Replace,userid:this.userId,sessionid:"",pubid:this.publishId,displayname:this.name,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks};return this.reportSelfDeviceStatus(),r}catch(r){throw ne.fromError(r,ce.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return z(this,null,function*(){const t={type:Ft.Delete,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{return yield this.rtsManager.publishDelete(this.url,e),this.streamTracks=this.rtsManager.publishingTracks,e.audio&&this.audioPubState.setState(be.AliRtcStateNoPublish),e.video&&(e.vMsid===Z.VideoSmall?this.videoSmallPubState.setState(be.AliRtcStateNoPublish):this.videoPubState.setState(be.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(be.AliRtcStateNoPublish),t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(r){throw ne.fromError(r,ce.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return z(this,null,function*(){if(!this._isPublishing)throw new ne(ce.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");oe.info(`[${Lt.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const t=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,i=this.hasCameraDualTrackInMS,n=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),t&&this.audioPubState.setState(be.AliRtcStateNoPublish),r&&this.videoPubState.setState(be.AliRtcStateNoPublish),i&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),n&&this.screenPubState.setState(be.AliRtcStateNoPublish),this.traceId="",Object.keys(this.monitorDataCache).forEach(o=>{this.reportPublishMonitor(o)}),this.streamTracks=[];const a={type:Ft.Stop,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};return this.syncPublishToRoomServer(a,{},e),a}catch(t){throw ne.fromError(t,ce.ERR_INNER,"publish stop failed")}})}unPublish(){return z(this,null,function*(){const e=new Date().getTime();let t={type:Ft.UnPublish,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{if(this._isPublishing){const r=this.hasAudioTrackInMS,i=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,a=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),this.streamTracks=[],this.stopStreamMonitor(),r&&this.audioPubState.setState(be.AliRtcStateNoPublish),i&&this.videoPubState.setState(be.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),a&&this.screenPubState.setState(be.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.slsReporter.reportUnpublish(this.callId||"",e,0,""),t}catch(r){throw ne.fromError(r,ce.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(et.Local,this.getDeviceStatus())}getDeviceStatus(){var t,r,i,n;let e={micOpen:!1,micInterrupted:!1,cameraOpen:!1,screenShare:!1,audioDisable:!0,videoDisable:!0,screenDisable:!0,backgroundMode:!1,accompanyPlaying:!1};return e.cameraOpen=this.hasCamera,e.micOpen=this.hasMicrophone,e.screenShare=this.hasScreenShare,e.audioDisable=!((t=this.streamManager.cameraStreamInfo.originAudioTrack)!=null&&t.enabled),e.videoDisable=!((r=this.streamManager.cameraStreamInfo.originVideoTrack)!=null&&r.enabled),e.screenDisable=!this.hasScreenShare||!((n=(i=this.streamManager.screenStreamInfo)==null?void 0:i.originVideoTrack)!=null&&n.enabled),aa.getCurrentStatus(e)}resetPreviewElements(){this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements=[]}getMediaStats(e){return this.pcMediaStatsMap[e]}reportPublishMonitor(e){if(!e)return;let t;try{e===Z.Audio?t=this.rtsManager.getStreamByMsid({url:this.url,aMsid:e}).audioTrack:t=this.rtsManager.getStreamByMsid({url:this.url,vMsid:e}).videoTrack}catch(r){}this.slsReporter.reportPublishMonitor(this.callId,this.trackTraceIdMap[e]||"",e,t,this.monitorDataCache[e]),this.monitorDataCache[e]=[]}reportNetwork(){this.slsReporter.reportNetworkMonitor(this.candidateDataCache),this.candidateDataCache=[]}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>z(this,null,function*(){var e,r;try{const i=yield this.rtsManager.getPCStats();let n;i==null||i.forEach(u=>{u.type==="media-source"||u.type==="media-playout"?u.id&&(this.pcMediaStatsMap[u.id]=u):u.type==="candidate-pair"&&u.state==="succeeded"&&(n=u)});let a;if(((e=this.candidateDataCache)==null?void 0:e.length)>0){const t=this.candidateDataCache[this.candidateDataCache.length-1]||{},{_last:h}=t;a=$i(t,["_last"])}((r=this.candidateDataCache)==null?void 0:r.length)>=da&&this.reportNetwork(),n&&(n._last=a,this.candidateDataCache.push(n));let o=Object.keys(this.monitorDataCache).filter(u=>{var h;return((h=this.monitorDataCache[u])==null?void 0:h.length)>0});(this.streamTracks||[]).forEach(u=>{const h=u.msid;if(!h)return;o.includes(h)&&(o=o.filter(l=>l!==h));let g;h===Z.Audio?g=this.rtsManager.getPublishAudioStats(this.url):g=this.rtsManager.getPublishVideoStats(this.url,h),g.then(l=>{if(!l.timestamp)return;this.monitorDataCache[h]||(this.monitorDataCache[h]=[]);const p=this.getMediaStats(l.mediaSourceId);l._source=p;const d=this.monitorDataCache[h];let m;if((d==null?void 0:d.length)>0){const x=d[d.length-1]||{},{_last:b}=x;m=$i(x,["_last"])}(d==null?void 0:d.length)>=da&&this.reportPublishMonitor(h),l._last=m,l._codec=u.codec||"",this.monitorDataCache[h].push(l)})}),o.forEach(u=>{this.reportPublishMonitor(u)})}catch(i){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportPublishMonitor(e)})}clearStream(){this.streamManager.stop(),this.audioPubState.setState(be.AliRtcStatePublishIdle),this.videoPubState.setState(be.AliRtcStatePublishIdle),this.videoSmallPubState.setState(be.AliRtcStatePublishIdle),this.screenPubState.setState(be.AliRtcStatePublishIdle)}getCurrentCameraDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originVideoTrack)==null?void 0:e.getSettings().deviceId}getCurrentMicDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originAudioTrack)==null?void 0:e.getSettings().deviceId}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.streamManager.cameraStreamInfo.originAudioTrack&&this.audioLevelMonitor.start(this.streamManager.cameraStreamInfo.originAudioTrack,e),this.audioVolumeIndicationInterval=e)}sendSEI(e,t,r){return z(this,null,function*(){if(!this.url)return;let i=0;return!t||t<1?i=1:i=t-1,this.rtsManager.sendSEI(this.url,e,i,r)})}getStats(){return z(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const n=yield this.rtsManager.getPublishAudioStats(this.url);n&&e.push({stats:n,track:ii.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoLarge);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeHigh,stats:n})}if(this.hasCameraDualTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoSmall);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeLow,stats:n})}if(this.hasScreenTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.Screen);n&&t.push({track:Ae.AliRtcVideoTrackScreen,stats:n})}let r;const i=yield this.rtsManager.getPCStats();return i==null||i.forEach(n=>{n.type==="candidate-pair"&&n.state==="succeeded"&&(r=n)}),{audio:e,video:t,candidate:r}})}},A(Lt,"logName","LocalUser"),Lt);ze([j()],Ve.prototype,"clearPublishState",1),ze([j()],Ve.prototype,"clear",1),ze([j()],Ve.prototype,"setViewConfig",1),ze([j()],Ve.prototype,"startCameraCapture",1),ze([j()],Ve.prototype,"stopCameraCapture",1),ze([j()],Ve.prototype,"stopAudioCapture",1),ze([j()],Ve.prototype,"stopPreview",1),ze([j()],Ve.prototype,"resumePublish",1),ze([j()],Ve.prototype,"createLocalStream",1),ze([j()],Ve.prototype,"stopLocalStream",1),ze([j(ae)],Ve.prototype,"startPublish",1),ze([j(([s])=>[s])],Ve.prototype,"syncPublishToRoomServer",1),ze([j()],Ve.prototype,"refreshPushStreamUrl",1),ze([j(([s,c,e])=>[JSON.stringify(e)])],Ve.prototype,"publishAdd",1),ze([j(([s,c])=>[JSON.stringify(c)])],Ve.prototype,"publishReplace",1),ze([j(ae)],Ve.prototype,"publishDeleteTracks",1),ze([j()],Ve.prototype,"publishStop",1),ze([j()],Ve.prototype,"unPublish",1),ze([j(([s,c,e])=>[s.length,c,e])],Ve.prototype,"sendSEI",1);let la=Ve;var qt=(s=>(s.OPUS="opus",s.H264="H264",s.UNKONWN="",s))(qt||{}),Gt=(s=>(s.VideoTrackEnded="videoTrackEnded",s.AudioTrackEnded="audioTrackEnded",s.ScreenTrackEnded="screenTrackEnded",s))(Gt||{});const Yc=s=>{const c=new MediaStream;return c.addTrack(s),c},fa=s=>z(this,null,function*(){return yield me.AliRTS.createStream({custom:!0,mediaStream:s})}),xi=s=>z(this,null,function*(){const c=Yc(s);return yield fa(c)}),Qc=s=>{const{audio:c,video:e,screen:t}=s;if(e&&t)throw new ne(ce.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!c&&!t)},e0=s=>s===Z.Audio||s===rr.Audio,t0=s=>s===Z.VideoLarge||s===rr.VideoLarge,i0=s=>s===Z.VideoSmall,r0=s=>s===Z.Screen;var s0=Object.defineProperty,n0=Object.getOwnPropertyDescriptor,a0=(s,c,e,t)=>{for(var r=t>1?void 0:t?n0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&s0(c,e,r),r};class Fi extends ve{constructor(){super();A(this,"audioInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"videoLargeInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"videoSmallInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"screenInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"audioVolume",1);A(this,"audioMuted",!1);A(this,"userStatus")}getAudioInfo(){return this.audioInfo}getVideoSmallInfo(){return this.videoSmallInfo}getVideoLargeInfo(){return this.videoLargeInfo}getScreenInfo(){return this.screenInfo}get subscribingInfos(){return[this.audioInfo,this.videoLargeInfo,this.videoSmallInfo,this.screenInfo].filter(e=>e.msid&&e.subscribed)}get hasAudio(){return this.audioInfo.ssrc!==""}get hasVideo(){return this.videoLargeInfo.ssrc!==""||this.videoSmallInfo.ssrc!==""}get hasVideoLarge(){return this.videoLargeInfo.ssrc!==""}get hasVideoSmall(){return this.videoSmallInfo.ssrc!==""}get hasScreen(){return this.screenInfo.ssrc!==""}get isAudioSubscribing(){return!!this.audioInfo.subscribed}get isVideoSubscribing(){return!!this.videoLargeInfo.subscribed||!!this.videoSmallInfo.subscribed}get isVideoLargeSubscribing(){return!!this.videoLargeInfo.subscribed}get isVideoSmallSubscribing(){return!!this.videoSmallInfo.subscribed}get isScreenSubscribing(){return!!this.screenInfo.subscribed}get audioCodec(){return this.audioInfo.codec}get videoCodec(){return this.hasVideoLarge?this.videoLargeInfo.codec:this.hasVideoSmall?this.videoSmallInfo.codec:this.hasScreen?this.screenInfo.codec:qt.UNKONWN}get audioTrackInfo(){return this.hasAudio?ii.AliRtcAudioTrackMic:ii.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?Ae.AliRtcVideoTrackBoth:this.hasVideo?Ae.AliRtcVideoTrackCamera:this.hasScreen?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackNo}updateTracks(e){let t="",r="",i="",n="";return e?(e.forEach(a=>{var h;let o=qt.UNKONWN;const u=((h=a==null?void 0:a.attr)==null?void 0:h.reason)==="reconnect";if(a.userdata){const{codec:g}=JSON.parse(a.userdata);g&&(o=g)}e0(a.msid)?(t=a.ssrc,this.audioInfo.msid=a.msid,this.audioInfo.codec=o,u&&(this.audioInfo.subscribed=!1)):i0(a.msid)?(i=a.ssrc,this.videoSmallInfo.msid=a.msid,this.videoSmallInfo.codec=o,u&&(this.videoSmallInfo.subscribed=!1)):t0(a.msid)?(r=a.ssrc,this.videoLargeInfo.msid=a.msid,this.videoLargeInfo.codec=o,u&&(this.videoLargeInfo.subscribed=!1)):r0(a.msid)&&(n=a.ssrc,this.screenInfo.msid=a.msid,this.screenInfo.codec=o,u&&(this.screenInfo.subscribed=!1))}),this.updateRemoteTrackSsrc(t,r,i,n)):this.updateRemoteTrackSsrc(t,r,i,n),{}}updateRemoteTrackSsrc(e,t,r,i){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=r,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=i}updateRemoteTrackSubState(e){return e.video!==void 0&&((e.vMsid===this.videoSmallInfo.msid||!e.vMsid)&&(this.videoSmallInfo.subscribed=e.video),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribed=e.video)),e.screen!==void 0&&(this.screenInfo.subscribed=e.screen),e.audio!==void 0&&(this.audioInfo.subscribed=e.audio),{audioInfo:this.audioInfo,videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo,screenInfo:this.screenInfo}}updateRemoteUserDeviceStatus(e){let t=aa.parseStatus(e);const{audioDisable:r,videoDisable:i,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=r&&(this.userStatus.audioDisable=r,this.emit(et.Remote,r?Ie.MuteAudio:Ie.UnmuteAudio)),this.userStatus.videoDisable!=i&&(this.userStatus.videoDisable=i,this.emit(et.Remote,i?Ie.MuteVideo:Ie.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(et.Remote,n?Ie.MuteScreen:Ie.UnmuteScreen))):(this.userStatus=t,this.emit(et.Remote,r?Ie.MuteAudio:Ie.UnmuteAudio),this.emit(et.Remote,i?Ie.MuteVideo:Ie.UnmuteVideo),this.emit(et.Remote,n?Ie.MuteScreen:Ie.UnmuteScreen)),!1}}A(Fi,"logName","RemoteStreamInfo"),a0([j()],Fi.prototype,"updateRemoteTrackSubState",1);class pa{constructor(c){A(this,"remoteUser");this.remoteUser=c}get userId(){return this.remoteUser.userId}get displayName(){return this.remoteUser.displayname}get isMuteAudioPlaying(){return this.remoteUser.getAudioMuted()}get hasAudio(){return this.remoteUser.hasAudioTrack}get hasCamera(){return this.remoteUser.hasVideoTrack}get hasCameraLarge(){return this.remoteUser.hasVideoLargeTrack}get hasCameraSmall(){return this.remoteUser.hasVideoSmallTrack}get hasScreenShare(){return this.remoteUser.hasScreenTrack}get isAudioSubscribing(){return this.remoteUser.isAudioSubscribing}get isVideoSubscribing(){return this.remoteUser.isVideoSubscribing}get isVideoLargeSubscribing(){return this.remoteUser.isVideoLargeSubscribing}get isVideoSmallSubscribing(){return this.remoteUser.isVideoSmallSubscribing}get isScreenSubscribing(){return this.remoteUser.isScreenSubscribing}}var o0=Object.defineProperty,c0=Object.getOwnPropertyDescriptor,Xe=(s,c,e,t)=>{for(var r=t>1?void 0:t?c0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&o0(c,e,r),r};class bi extends ve{constructor(){super();A(this,"state");A(this,"time");A(this,"_enabled");this.state=Le.AliRtcStateSubscribeIdle,this.time=Date.now(),this._enabled=!0}setState(e){if(this.state===e)return;const t=this.state,r=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-r)/1e3))}get currentState(){return this.state}getEnabled(){return this._enabled}setEnabled(e){this._enabled=e}}const u0=30,Ui=class Ui extends na{constructor(e){var l;const{userId:t,displayName:r,rtsManager:i,usersViewMap:n,slsReporter:a,signalingManager:o,localUser:u,audioVolumeIndicationInterval:h,playoutVolume:g,parameter:f}=e;super(t,r,i,h);A(this,"remoteCallid","");A(this,"remoteUserInfo");A(this,"localUser");A(this,"lastPubId","");A(this,"stream");A(this,"screenStream");A(this,"viewMap");A(this,"audioTrack");A(this,"audioElement");A(this,"subscribed",!1);A(this,"mediaStream");A(this,"secondaryMediaStream");A(this,"prevSubConfig");A(this,"signalingManager");A(this,"slsReporter");A(this,"wantSubAudio",!1);A(this,"wantSubVideo",!1);A(this,"wantSubScreen",!1);A(this,"defaultVideoStreamType",Je.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"playoutGainNode");A(this,"audioSubState");A(this,"videoSubState");A(this,"videoLargeSubState",new bi);A(this,"videoSmallSubState",new bi);A(this,"screenSubState");A(this,"streamInfo");A(this,"streamUrl","");A(this,"parameter",{});A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});A(this,"handleAudioContextSuspended",e=>{e.target.state==="suspended"&&this.emit("remoteAudioPlayError",this.uid,"AudioContext suspended")});this.streamInfo=new Fi,this.remoteUserInfo=new pa(this),this.parameter=f,this.streamInfo.on(et.Remote,p=>{this.emit(et.Remote,p,this.userId)}),this.signalingManager=o,this.viewMap=(l=n[t])!=null?l:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.slsReporter=a,this.localUser=u,this.audioSubState=new bi,this.audioSubState.on("change",(p,d,m)=>{this.emit("audioSubscribeStateChanged",this.uid,p,d,m)}),this.videoSubState=new bi,this.videoSubState.on("change",(p,d,m)=>{this.emit("videoSubscribeStateChanged",this.uid,p,d,m)}),this.screenSubState=new bi,this.screenSubState.on("change",(p,d,m)=>{this.emit("screenSubscribeStateChanged",this.uid,p,d,m)}),this.playoutVolume=g}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e}setRemoteDefaultVideoStreamType(e){e!==this.defaultVideoStreamType&&(this.defaultVideoStreamType=e,this.updateSubscribe(Be.User))}setAudioMuted(e){this.audioMuted=e,this.toggleAudio(!e)}setPlayoutVolume(e){if(this.playoutVolume=e,this.audioElement)if(this.parameter.enableAudioContextPlayoutVolume)if(this.playoutGainNode)this.playoutGainNode.gain.value=e;else{const t=this.audioElement.srcObject;if(t){const r=ri.getInstance();r.addEventListener("statechange",this.handleAudioContextSuspended);const i=r.createMediaStreamSource(t);this.audioElement.muted=!0,this.playoutGainNode=r.createGain(),i.connect(this.playoutGainNode),this.playoutGainNode.gain.value=e,this.playoutGainNode.connect(r.destination)}}else this.audioElement.volume=e}getAudioMuted(){return this.audioMuted}get hasAudioTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasAudio)}get hasVideoTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideo)}get hasVideoLargeTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoLarge)}get hasVideoSmallTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoSmall)}get hasScreenTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasScreen)}get isAudioSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isAudioSubscribing)}get isVideoSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSubscribing)}get isVideoLargeSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoLargeSubscribing)}get isVideoSmallSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSmallSubscribing)}get isScreenSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isScreenSubscribing)}get audioEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.audioTrack)!=null&&t.enabled)}get videoEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get screenEnabled(){var e,t;return!!((t=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,t){if(t!==Ae.AliRtcVideoTrackScreen&&t!==Ae.AliRtcVideoTrackCamera)throw new ne(ce.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?fs(e).forEach(i=>{i.setAttribute("playsinline",""),me.AliRTS.BrowserUtil.isMicroMessenger&&(i.setAttribute("x5-video-player-type","h5-page"),i.setAttribute("x5-playsinline",""),me.AliRTS.SystenUtil.isAndroid||me.AliRTS.SystenUtil.isIos&&i.setAttribute("x-webkit-airplay","allow")),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(i):this.viewMap.cameraViews.push(i),this.play(i,t===Ae.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===Ae.AliRtcVideoTrackScreen),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return z(this,null,function*(){var t;e&&this.doStopSubscribe(this.streamUrl),As(Ui.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),this.playoutGainNode&&(this.playoutGainNode.disconnect(),this.playoutGainNode=void 0,ri.getInstance().removeEventListener("statechange",this.handleAudioContextSuspended)),(t=this.streamInfo)==null||t.removeAllListeners(et.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,r,i){return z(this,null,function*(){var a;return this.remoteCallid=e,this.streamUrl=t!=null?t:"",this.callId=e!=null?e:"",this.streamInfo||(this.streamInfo=new Fi),(a=this.streamInfo)==null?void 0:a.updateTracks(i)})}subscribe(i,n){return z(this,arguments,function*(e,t,r=Date.now()){var l;let a=e;if(!a){const{hasAudio:p,hasVideo:d,hasScreen:m}=(l=this.streamInfo)!=null?l:{};a={audio:this.wantSubAudio&&p,video:this.wantSubVideo&&d,screen:this.wantSubScreen&&m}}const{screen:o,audio:u,video:h,vMsid:g}=a,f=[];(h||u)&&f.push({audio:u,video:h,vMsid:g}),o&&f.push({screen:o}),f.length!==0&&(yield Promise.all(f.map(p=>this.subscribeProxy(p,t||Be.User,r))))})}subscribeProxy(e,t,r){return z(this,null,function*(){var a,o,u,h;let i=new Date().getTime(),n="";try{e.audio&&this.audioSubState.setState(Le.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===Le.AliRtcStateSubscribeIdle||this.videoSubState.currentState===Le.AliRtcStateNoSubscribe)&&this.videoSubState.setState(Le.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(Le.AliRtcStateSubscribing);const g=yield this.rtsManager.subscribe({remoteUser:this,options:e},t,((a=this.localUser)==null?void 0:a.callId)||"",this.callId,r);this.streamInfo.updateRemoteTrackSubState(e),n=g.traceId||"";const{stream:f}=g;if(e.audio){this.trackTraceIdMap[Z.Audio]=n;const p=f.audioTrack;p&&(this.audioTrack=p,(o=f.mediaStream)==null||o.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(Le.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(e.vMsid===Z.VideoSmall?(this.trackTraceIdMap[Z.VideoSmall]=n,this.videoSmallSubState.setState(Le.AliRtcStateSubscribed)):(this.trackTraceIdMap[Z.VideoLarge]=n,this.videoLargeSubState.setState(Le.AliRtcStateSubscribed)),this.videoSubState.setState(Le.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(f,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.trackTraceIdMap[Z.Screen]=n,this.screenSubState.setState(Le.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(f));const l=new Date().getTime()-i;this.slsReporter.reportSubscribe(((u=this.localUser)==null?void 0:u.callId)||"",this.callId,!!e.video&&e.vMsid===Z.VideoLarge,!!e.video&&e.vMsid===Z.VideoSmall,!!e.screen,!!e.audio,0,"",l,{pctid:this.rtsManager.pcTraceId,subtid:n,ajsub:t===Be.Join?1:0,url:this.streamUrl,est:i}),this.startStreamMonitor()}catch(g){const f=new Date().getTime()-i;g&&(g.message=`user(${this.uid}) subscribe error, ${(g==null?void 0:g.message)||""}`);let l=ce.ERR_INNER;e.audio&&(l=ce.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED),e.video&&(e.vMsid===Z.VideoSmall?l=ce.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED:l=ce.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED),e.screen&&(l=ce.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED),this.slsReporter.reportSubscribe(((h=this.localUser)==null?void 0:h.callId)||"",this.callId,!!e.video&&e.vMsid===Z.VideoLarge,!!e.video&&e.vMsid===Z.VideoSmall,!!e.screen,!!e.audio,l,"",f,{pctid:this.rtsManager.pcTraceId,subtid:"",ajsub:t===Be.Join?1:0,url:this.streamUrl,est:i});const p=ne.fromError(g,l);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return z(this,null,function*(){const{audio:t,video:r,screen:i,vMsid:n}=e,a=[];(t||r)&&a.push({audio:t,video:r,vMsid:n}),i&&a.push({screen:i}),a.length!==0&&(yield Promise.all(a.map(o=>this.subscribeDeleteProxy(o))))})}subscribeDeleteProxy(e){return z(this,null,function*(){try{const t=yield this.rtsManager.subscibeDelete({remoteUser:this,options:e}),{stream:r}=t!=null?t:{},i={};e.audio===!0&&(i.audio=!1,this.audioSubState.setState(Le.AliRtcStateNoSubscribe)),e.video===!0&&(i.video=!1,e.vMsid===Z.VideoSmall?(this.videoSmallSubState.setState(Le.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===Le.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===Le.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Le.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(Le.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===Le.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===Le.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Le.AliRtcStateNoSubscribe))),e.screen===!0&&(i.screen=!1,this.screenSubState.setState(Le.AliRtcStateNoSubscribe));const{callId:n,remoteCallid:a}=this,o={callid:n,remoteCallid:a,remoteStream:r};return e.audio&&(this.audioLevelMonitor.stop(),this.stopPlayAudio(),this.audioTrack=void 0),this.streamInfo.updateRemoteTrackSubState({audio:e.audio===!0?!1:void 0,video:e.video===!0?!1:void 0,screen:e.screen===!0?!1:void 0,vMsid:e.vMsid}),o}catch(t){throw ne.fromError(t,ce.ERR_INNER,"subscribe delete failed")}})}restore(){this.callId="",this.clearStream(),this.clearScreenStream(),this.audioTrack=void 0,this.streamInfo.updateRemoteTrackSubState({audio:!1,video:!1,screen:!1})}resumeAudio(){return z(this,null,function*(){var t;const e=ri.getInstance();return e.state!=="running"&&e.resume(),(t=this.audioElement)==null?void 0:t.play()})}resumeVideo(e){return z(this,null,function*(){if(!e||e===Ae.AliRtcVideoTrackCamera||e===Ae.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===Ae.AliRtcVideoTrackScreen||e===Ae.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return z(this,null,function*(){var r,i;let t=new Date().getTime();try{let n;e?n=yield this.subscribeDeleteTracks(e):n=yield this.doStopSubscribe(this.streamUrl),this.slsReporter.reportUnsubscribe(((r=this.localUser)==null?void 0:r.callId)||(n==null?void 0:n.callid)||"",this.callId,new Date().getTime()-t,0,"")}catch(n){throw this.slsReporter.reportUnsubscribe(((i=this.localUser)==null?void 0:i.callId)||"",this.callId,new Date().getTime()-t,0,""),n}})}doStopSubscribe(e){return z(this,null,function*(){var i,n,a,o;const{callId:t,remoteCallid:r}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{this.stopStreamMonitor(),yield this.rtsManager.subscibeStop(e),this.restore();const u={callid:t,remoteCallid:r,remoteStream:this.stream};return this.callId="",u}catch(u){if(((o=(a=(n=(i=u==null?void 0:u.extraInfo)==null?void 0:i.parsedData)==null?void 0:n.streams)==null?void 0:a[0])==null?void 0:o.res_code)!==404)throw ne.fromError(u,ce.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return z(this,null,function*(){this.stream&&this.stream.videoTrack&&e.mediaStream&&t&&(yield new Promise(r=>{let i,n;if(e.mediaStream){n=document.createElement("video");const a=()=>{oe.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",a,!1),n=void 0,clearTimeout(i),r(!0)};n.addEventListener("canplaythrough",a,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else r(!0);i=window.setTimeout(()=>{oe.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,r(!0)},3e3)}),this.updateSubscribe(Be.User)),this.stream=e,this.playAll(),!this.subscribed&&e&&(this.subscribed=!0),e.hasAudio&&this.isAudioSubscribing&&e.enableAudio(),e.hasVideo&&this.isVideoSubscribing&&e.enableVideo()})}updateScreenStream(e){this.screenStream=e,this.playAll(!0),!this.subscribed&&e&&(this.subscribed=!0),e.hasVideo&&this.isScreenSubscribing&&e.enableVideo()}clearStream(){var e;(e=this.stream)==null||e.stop(),this.stream=void 0}clearScreenStream(){var e;(e=this.screenStream)==null||e.stop(),this.screenStream=void 0}updateSubscribe(e){var n,a,o,u,h,g,f,l;const t=Date.now(),r={},i={};return this.wantSubAudio&&!this.isAudioSubscribing&&((n=this.streamInfo)!=null&&n.hasAudio)?r.audio=!0:(!this.wantSubAudio||!((a=this.streamInfo)!=null&&a.hasAudio))&&this.isAudioSubscribing&&(i.audio=!0),this.wantSubVideo&&((o=this.streamInfo)!=null&&o.hasVideo)?(this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((u=this.streamInfo)!=null&&u.hasVideoSmall)?(r.video=!0,r.vMsid=Z.VideoSmall):!this.isVideoLargeSubscribing&&((h=this.streamInfo)!=null&&h.hasVideoLarge)&&!(this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(r.video=!0,r.vMsid=Z.VideoLarge),this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(i.video=!0,i.vMsid=Z.VideoLarge):this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(i.video=!0,i.vMsid=Z.VideoSmall)):(!this.wantSubVideo||!((g=this.streamInfo)!=null&&g.hasVideo))&&this.isVideoSubscribing&&(i.video=!0,i.vMsid=this.streamInfo.isVideoSmallSubscribing?Z.VideoSmall:Z.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((f=this.streamInfo)!=null&&f.hasScreen)?r.screen=!0:(!this.wantSubScreen||!((l=this.streamInfo)!=null&&l.hasScreen))&&this.isScreenSubscribing&&(i.screen=!0),(r.audio||r.video||r.screen)&&(this.createCallId(),this.subscribe(r,e,t)),i.audio&&i.video&&i.screen?this.stopSubscribe():(i.audio||i.video||i.screen)&&this.subscribeDeleteTracks(i),{addOption:r,deleteOption:i}}handleAutoPlayFailed(){this.emit("remoteAudioAutoPlayFail",this.uid);const e=()=>{this.resumeAudio().then(()=>{document.removeEventListener("click",e,!1),document.removeEventListener("touchstart",e,!1)})};document.addEventListener("click",e,!1),document.addEventListener("touchstart",e,!1)}handleVideoPlayFailded(e,t){this.emit("remoteVideoAutoPlayFail",this.uid,t);const r=()=>{var n;const i=(n=t===Ae.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===i&&this.play(e,t===Ae.AliRtcVideoTrackScreen),document.removeEventListener("click",r,!1),document.removeEventListener("touchstart",r,!1)};document.addEventListener("click",r,!1),document.addEventListener("touchstart",r,!1)}playAudio(){return z(this,null,function*(){var t,r;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.setPlayoutVolume(this.playoutVolume)),((r=(t=this.audioElement.srcObject)==null?void 0:t.getAudioTracks())==null?void 0:r[0])!==this.audioTrack){let i=this.audioElement.srcObject;i?i.getAudioTracks().forEach(n=>{i.removeTrack(n)}):(i=new MediaStream,this.audioElement.srcObject=i),i.addTrack(this.audioTrack)}this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()});const e=this.audioElement;this.audioElement.addEventListener("playing",function i(){e.removeEventListener("playing",i),me.AliRTS.SystenUtil.isIos&&parseInt(me.AliRTS.SystenUtil.systemVersion)<=14&&(e.muted||(e.pause(),e.play()))})})}stopPlayAudio(){this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null)}playAll(e=!1){e?(this.viewMap.screenViews||[]).forEach(t=>{this.play(t,e)}):(this.viewMap.cameraViews||[]).forEach(t=>{this.play(t,e)})}play(e,t=!1){const r=t?this.screenStream:this.stream;!e||!r||!r.mediaStream||ha(e,r.mediaStream).catch(i=>{i.code===20||i.name==="AbortError"||this.handleVideoPlayFailded(e,t?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{Bt(t)}):this.viewMap.cameraViews.forEach(t=>{Bt(t)})}toggleAudio(e=!0){this.audioSubState.setEnabled(e),this.audioTrack&&(this.audioTrack.enabled=e)}toggleVideo(e=!0){this.videoSubState.setEnabled(e),this.stream&&(e?this.stream.enableVideo():this.stream.disableVideo())}toggleScreen(e=!0){this.screenSubState.setEnabled(e),this.screenStream&&(e?this.screenStream.enableVideo():this.screenStream.disableVideo())}getStats(){return z(this,null,function*(){var r,i;const e=[];if(this.isAudioSubscribing){const n=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);n&&e.push({uid:this.uid,track:ii.AliRtcAudioTrackMic,stats:n})}const t=[];if((r=this.streamInfo)!=null&&r.isVideoLargeSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoLarge);n&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeHigh,stats:n})}if((i=this.streamInfo)!=null&&i.isVideoSmallSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoSmall);n&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeLow,stats:n})}if(this.isScreenSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.Screen);n&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackScreen,stats:n})}return{audio:e,video:t}})}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.audioTrack&&this.audioLevelMonitor.start(this.audioTrack,e),this.audioVolumeIndicationInterval=e)}reportSubscribeMonitor(e){var t;e&&(this.slsReporter.reportSubscribeMonitor(((t=this.localUser)==null?void 0:t.callId)||"",this.callId,this.trackTraceIdMap[e]||"",e,this.monitorDataCache[e]),this.monitorDataCache[e]=[])}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>z(this,null,function*(){try{if(this.streamInfo.subscribingInfos.length===0){this.stopStreamMonitor();return}let e=Object.keys(this.monitorDataCache).filter(t=>{var r;return((r=this.monitorDataCache[t])==null?void 0:r.length)>0});this.streamInfo.subscribingInfos.forEach(t=>{const r=t.msid;if(!r)return;e.includes(r)&&(e=e.filter(a=>a!==r));let i;const n=r===Z.Audio;n?i=this.rtsManager.getSubscribeAudioStats(this.streamUrl):i=this.rtsManager.getSubscribeVideoStats(this.streamUrl,r),i.then(a=>{var g;if(!a.timestamp)return;this.monitorDataCache[r]||(this.monitorDataCache[r]=[]);const o=this.monitorDataCache[r];let u;if((o==null?void 0:o.length)>0){const h=o[o.length-1]||{},{_last:l}=h;u=$i(h,["_last"])}(o==null?void 0:o.length)>=u0&&this.reportSubscribeMonitor(r),a._last=u,a._codec=t.codec,n&&(a._source=(g=this.localUser)==null?void 0:g.getMediaStats(a.playoutId)),this.monitorDataCache[r].push(a)})}),e.forEach(t=>{this.reportSubscribeMonitor(t)})}catch(e){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportSubscribeMonitor(e)})}};A(Ui,"logName","RemoteUser");let Ue=Ui;Xe([j()],Ue.prototype,"clear",1),Xe([j()],Ue.prototype,"updateRemoteUserDeviceStatus",1),Xe([j()],Ue.prototype,"updateRemoteTracks",1),Xe([j(ae)],Ue.prototype,"subscribe",1),Xe([j()],Ue.prototype,"subscribeProxy",1),Xe([j(ae)],Ue.prototype,"subscribeDeleteProxy",1),Xe([j()],Ue.prototype,"restore",1),Xe([j(ae)],Ue.prototype,"stopSubscribe",1),Xe([j(ae)],Ue.prototype,"doStopSubscribe",1),Xe([j()],Ue.prototype,"clearStream",1),Xe([j()],Ue.prototype,"clearScreenStream",1),Xe([j()],Ue.prototype,"updateSubscribe",1),Xe([j()],Ue.prototype,"playAudio",1),Xe([j()],Ue.prototype,"stopPlayAudio",1),Xe([j(ae)],Ue.prototype,"playAll",1),Xe([j()],Ue.prototype,"play",1),Xe([j()],Ue.prototype,"stopPlayAll",1);var Pt=(s=>(s[s.AliRtcPluginErrorCodeSuccess=0]="AliRtcPluginErrorCodeSuccess",s[s.AliRtcPluginErrorCodeFailed=-1]="AliRtcPluginErrorCodeFailed",s[s.AliRtcPluginErrorNoFindPlugin=-2]="AliRtcPluginErrorNoFindPlugin",s[s.AliRtcPluginErrorParameterError=-3]="AliRtcPluginErrorParameterError",s[s.AliRtcPluginErrorLoadError=-4]="AliRtcPluginErrorLoadError",s[s.AliRtcPluginErrorCreateError=-5]="AliRtcPluginErrorCreateError",s[s.AliRtcPluginErrorInitError=-6]="AliRtcPluginErrorInitError",s[s.AliRtcPluginErrorInitTokenError=-7]="AliRtcPluginErrorInitTokenError",s))(Pt||{});class h0 extends ve{constructor(){super(...arguments);A(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new ne(Pt.AliRtcPluginErrorCreateError,`Plugin ${e.name} already exists`);this.plugins.set(e.name,e),t&&e.setOptions(t),this.emit("added",e),e.on("enabled",()=>this.emit("added",e)),e.on("disabled",()=>this.emit("removed",e)),e.on("updated",()=>this.emit("updated",e))}remove(e){const t=this.plugins.get(e);if(!t)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),t.removeAllListeners(),this.emit("removed",t)}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var d0=Object.defineProperty,l0=Object.getOwnPropertyDescriptor,tt=(s,c,e,t)=>{for(var r=t>1?void 0:t?l0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&d0(c,e,r),r};const Oi=([s])=>{const{remoteUser:c,options:e}=s;return[`user(${c.userId})`,e]},Ye=(_t=class extends ve{constructor(e,t){super();A(this,"rts");A(this,"encodedInsertableStreams",!0);A(this,"audioRedEnabled",!1);A(this,"localStreamManager");A(this,"slsReporter");A(this,"connecting",!1);A(this,"connected",!1);A(this,"_pcTraceId","");A(this,"_localJoinTime",0);A(this,"connectionResolve");A(this,"connectingPromise");A(this,"dcResolve");A(this,"dcConnectingPromise");A(this,"_publishingTracks",[]);this.rts=me.AliRTS.createClient(),this.localStreamManager=e,this.slsReporter=t,this.rts.on("connectStatusChange",r=>{var i,n,a,o;if(oe.event(`[${_t.logName}]`,"rts connectStatusChange to:",r.status),r.status===me.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.emit("disconnected"),this.setConnected(!1),this.slsReporter.reportWarning("rts disconnected");else if(r.status===me.EConnectStatus.CONNECT_STATUS_RECONNECTING)this.emit("reconnecting"),this.setConnected(!1),this.slsReporter.reportWarning("rts reconnecting");else if(r.status===me.EConnectStatus.CONNECT_STATUS_CONNECTED){this.setConnected(!0);const u=(o=(a=(n=(i=this.rts.commonController)==null?void 0:i.peerCore)==null?void 0:n.getSignal())==null?void 0:a.getDatachannelCore())==null?void 0:o.readyState;oe.event(_t.logName,"dcReadyState:",u),u==="open"&&this.dcResolve&&this.dcResolve(!0),this.emit("connected")}}),this.rts.on("datachannelStatusChange",r=>{oe.event(`[${_t.logName}]`,"rts datachannelStatusChange to:",r.status),r.status===me.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):r.status===me.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(i=>{this.dcResolve=i}),console.warn("DC DisConnected"))}),this.rts.on("receivedSEI",r=>{this.emit("seimessage",r.url,r.sei.payloadType,r.sei.data)})}get pcTraceId(){return this._pcTraceId}set localJoinTime(e){this._localJoinTime=e}setEncodedInsertableStreams(e){this.encodedInsertableStreams=e}setAudioRedEnabled(e){var t;if(e!==this.audioRedEnabled){try{const i=[...((t=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:t.codecs)||[]];if(i.length>0){if(e){const n=i.findIndex(o=>o.mimeType==="audio/red"),a=i.findIndex(o=>o.mimeType==="audio/opus");if(n>-1&&a>-1&&n>a){const o=i[a];i[a]=i[n],i[n]=o}}this.rts.setSenderCodecPreferences({audio:i}),this.rts.setReceiverCodecPreferences({audio:i})}}catch(r){}this.audioRedEnabled=e}}destroy(){this.rts.unpublish()}startConnect(){this.connecting=!0,this.connectingPromise=new Promise(e=>{this.connectionResolve=e}),this.dcConnectingPromise=new Promise(e=>{this.dcResolve=e})}setConnected(e){var t;this.connected=e,this.connecting=!1,(t=this.connectionResolve)==null||t.call(this,!0),e||(this.dcConnectingPromise=new Promise(r=>{this.dcResolve=r}))}get isConnecting(){return this.connecting}get isConnected(){return this.connected}get publishingTracks(){return this._publishingTracks}getPubMsid(e,t){const{aMsid:r,vMsid:i}=t!=null?t:{},n={};return e.hasAudio&&(n.aMsid=[r!=null?r:Z.Audio]),e.hasScreen&&(n.vMsid=[Z.Screen]),e.hasVideo&&(n.vMsid=[i!=null?i:t!=null&&t.isScreen?Z.Screen:Z.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:r,ssrc:i,codec:n,type:a,trackId:o})=>({msid:t,from:r,type:a,ssrc:`${i}`,codec:n!=null?n:"",trackId:o})))}httpPublish(n,a){return z(this,arguments,function*(e,t,r=!1,i=Ot.MANUAL){const{publishStream:o,videoSmallStream:u,screenStream:h,vMsid:g}=yield this.localStreamManager.createHTTPPublishStream();if(!o)return"";const f=this.getPubMsid(o,{vMsid:g});f.retryTimes=0,this.encodedInsertableStreams&&(f.encodedInsertableStreams=!0);let l=!o.hasVideo,p=g;try{this.startConnect();const d=Date.now(),m=yield this.rts.publish(e,o,f);this.slsReporter.reportPublish(r,e,t,o.hasVideo&&(!g||g===Z.VideoLarge),o.hasVideo&&g===Z.VideoSmall,o.hasVideo&&g===Z.Screen,o.hasAudio,0,m,m,d);const x=Date.now();return this._pcTraceId=m,this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),u&&(yield this.publishAdd(e,u,t,{vMsid:Z.VideoSmall},r),l=!1,p=Z.VideoSmall),h&&(yield this.publishAdd(e,h,t,{vMsid:Z.Screen},r),l=!1,p=Z.Screen),yield this.waitPublishSender(e,l,p),this.slsReporter.reportPublishFirstPacket(r,t,d,x,this._localJoinTime,l?Z.Audio:f.vMsid,m||"",m||"",i),m}catch(d){throw this.setConnected(!1),d}})}waitPublishSender(e,t=!1,r){return z(this,null,function*(){const i=(n,a)=>{let o=0;const u=()=>(t?this.rts.getPublishAudioStats(e,r):this.rts.getPublishVideoStats(e,r)).then(g=>!(g.bytesSent>0)&&o<n?(o++,new Promise(l=>setTimeout(()=>l(u()),a))):Promise.resolve());return u()};return Promise.race([$t(1e3),i(5,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return z(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return z(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(h,g,f,l){return z(this,arguments,function*(e,t,r,i,n=!1,a=0,o=!1,u=Ot.MANUAL){var m,x,v,b,y,E,I,C;yield this.dcConnectingPromise;const p=Date.now(),d=this.getPubMsid(t,i);try{const R=yield this.rts.publishAdd([Se({url:e,stream:t,updateSourceStream:!1},d)]);if(R){const L=Date.now(),[k]=R;return this.slsReporter.reportPublish(!1,e,r,((m=d.vMsid)==null?void 0:m[0])===Z.VideoLarge,((x=d.vMsid)==null?void 0:x[0])===Z.VideoSmall,((v=d.vMsid)==null?void 0:v[0])===Z.Screen,((b=d.aMsid)==null?void 0:b[0])===Z.Audio,0,this.pcTraceId,k.traceId||"",p),this.updatePublishingTracks(k.trackInfoList),o&&(yield this.waitPublishSender(e,!t.hasVideo,t.hasVideo?i==null?void 0:i.vMsid:i==null?void 0:i.aMsid)),this.slsReporter.reportPublishFirstPacket(n||a>0,r,p,L,this._localJoinTime,(t.hasVideo?i==null?void 0:i.vMsid:i==null?void 0:i.aMsid)||"",this.pcTraceId,k.traceId||"",u),k.traceId||""}}catch(R){if(this.slsReporter.reportPublish(!1,e,r,((y=d.vMsid)==null?void 0:y[0])===Z.VideoLarge,((E=d.vMsid)==null?void 0:E[0])===Z.VideoSmall,((I=d.vMsid)==null?void 0:I[0])===Z.Screen,((C=d.aMsid)==null?void 0:C[0])===Z.Audio,R.errorCode||-1,this.pcTraceId,"",p),R.errorCode===15006&&a<3)return yield this.publishAdd(e,t,r,i,n,a+1);throw R}return""})}publishDelete(e,t){return z(this,null,function*(){var h,g,f,l,p,d,m,x;yield this.dcConnectingPromise;const r=(g=(h=this.publishingTracks)==null?void 0:h.find(({msid:v})=>v===Z.Audio))==null?void 0:g.msid,i=(l=(f=this.publishingTracks)==null?void 0:f.find(({msid:v})=>v===Z.VideoLarge))==null?void 0:l.msid,n=(d=(p=this.publishingTracks)==null?void 0:p.find(({msid:v})=>v===Z.Screen))==null?void 0:d.msid,a=[];t.screen&&n?a.push(n):t.video&&a.push(t.vMsid||i);const o=[];t.audio&&r&&o.push(r),oe.event(_t.logName,"publishDelete",{streamUrl:e,aMsid:o,vMsid:a});const[u]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:o,vMsid:a}]))||[];return oe.event(_t.logName,"publishDelete",{result:u}),u&&this.updatePublishingTracks(u.trackInfoList),((x=(m=u==null?void 0:u.trackInfoList)==null?void 0:m[0])==null?void 0:x.trackId)||""})}publishReplace(e,t,r){return z(this,null,function*(){var u,h;yield this.dcConnectingPromise;const{vMsid:i,aMsid:n}=r!=null?r:{},a=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:i,aMsid:n}]),[o]=a;return this.updatePublishingTracks(o.trackInfoList),((h=(u=o==null?void 0:o.trackInfoList)==null?void 0:u[0])==null?void 0:h.trackId)||""})}publishStop(e){return z(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}unpublish(){return z(this,null,function*(){yield this.rts.unpublish(),this.connecting=!1,this.connected=!1})}getSubConfig(e,t){let r=t!=null?t:{};t||(r={audio:!0,video:!0,screen:!0});const i={};return r.audio&&(i.aMsid=[(e==null?void 0:e.getAudioInfo().msid)||Z.Audio]),r.video?r.vMsid?i.vMsid=[r.vMsid]:e!=null&&e.hasVideoLarge?i.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||Z.VideoLarge]:e!=null&&e.hasVideoSmall?i.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||Z.VideoSmall]:i.vMsid=[Z.VideoLarge]:r.screen&&e!=null&&e.hasScreen&&(i.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||Z.Screen]),i}httpSubscribe(e){return z(this,null,function*(){const{remoteUser:t,options:r}=e;let i=t.streamUrl;r.video||r.screen?r!=null&&r.audio||(i+="@subaudio=no"):i+="@subvideo=no";const n=this.getSubConfig(t.streamInfo,r);n.retryTimes=0,this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0);try{this.startConnect();const a=yield this.rts.subscribe(i,n);return this._pcTraceId=a.traceId,this.setConnected(!0),{traceId:a.traceId,stream:a}}catch(a){throw this.setConnected(!1),a}})}subscribeAdd(e){return z(this,null,function*(){var n,a,o,u;const{remoteUser:t,options:r}=e,i=Rt(Se({url:t.streamUrl,subAudio:!!r.audio,subVideo:!!(r.screen||r.video)},this.getSubConfig(t.streamInfo,r)),{targetStream:r.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeAdd([i]))[0]}catch(h){if(((u=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===508)return this.emit("subscribeexceeds"),null;throw ne.fromError(h)}})}subscibeDelete(e){return z(this,null,function*(){var n,a,o,u;yield this.dcConnectingPromise;const{remoteUser:t,options:r}=e,i=Rt(Se({url:t.streamUrl,subAudio:!!r.audio,subVideo:!!(r.screen||r.video)},this.getSubConfig(t.streamInfo,r)),{targetStream:r.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeDeleteTracks([i]))[0]}catch(h){if(((u=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===404)return;throw h}})}subscibeStop(e){return z(this,null,function*(){var t,r,i,n;try{yield this.rts.subscribeStop([{url:e}])}catch(a){if(((n=(i=(r=(t=a==null?void 0:a.extraInfo)==null?void 0:t.parsedData)==null?void 0:r.streams)==null?void 0:i[0])==null?void 0:n.res_code)===404)return;throw a}})}publish(n,a){return z(this,arguments,function*(e,t,r=!1,i=Ot.MANUAL){let o="";if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let u=!1,h;const{audio:g,video:f,videoSmall:l,screen:p}=this.localStreamManager.publishStreams;g&&(o=yield this.publishAdd(e,g,t,{aMsid:Z.Audio},r),u=!0,h=Z.Audio,yield $t(100)),f&&(o=yield this.publishAdd(e,f,t,{vMsid:Z.VideoLarge},r),u=!1,h=Z.VideoLarge,yield $t(100)),l&&(o=yield this.publishAdd(e,l,t,{vMsid:Z.VideoSmall},r),u=!1,h=Z.VideoSmall,yield $t(100)),p&&(o=yield this.publishAdd(e,p,t,{isScreen:!0,vMsid:Z.Screen},r),u=!1,h=Z.Screen),h&&(yield this.waitPublishSender(e,u,h))}else o=yield this.httpPublish(e,t,r,i);return o})}subscribe(e,t,r,i,n){return z(this,null,function*(){const{options:a,remoteUser:o}=e;if(a.video&&a.screen)throw new ne(ce.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let u,h=Date.now();this.connected?(yield this.dcConnectingPromise,h=Date.now(),u=yield this.subscribeAdd(e)):u=yield this.httpSubscribe(e);const g=Date.now();let f=Z.VideoLarge,l=a.video||a.screen,p=a.audio;a.video&&a.vMsid?f=a.vMsid:a.screen&&(f=Z.Screen);let d=0,m=0,x=0;return((b,y)=>{let E=0;const I=()=>{let C;return p&&!d&&(C=this.rts.getSubscribeAudioStats(o.streamUrl).then(R=>{if(R.packetsReceived>0)d=Date.now();else if(!l)return E<b?(E++,new Promise(L=>setTimeout(()=>L(I()),y))):!1;return!0})),l&&!x&&(C=this.rts.getSubscribeVideoStats(o.streamUrl,f).then(R=>{if(R.packetsReceived>0&&(m=Date.now()),R.framesDecoded>0)x=Date.now();else return E<b?(E++,new Promise(L=>setTimeout(()=>L(I()),y))):(oe.error(`[${_t.logName}]`,"checkInStatsWithRetry fail"),!1);return!0})),Promise.resolve(C)};return I()})(20,100).then(()=>{m&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,r,i,f,{fprt:m-h,ifsprtc:x?x-h:0,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:g-h}),x&&this.slsReporter.reportSubscribeFirstFrame(t===Be.Resume,r,i,f,{fvfrt:x-h,fp2fftc:x-m,ajsub:t===Be.Join?1:0,tffrtc:t===Be.Join?x-this.localJoinTime:x-n,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",fvfdtc:x-h}),d&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,r,i,Z.Audio,{fprt:d-h,ifsprtc:d-h,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:g-h})}),u})}getSubscribeVideoStats(e,t){return z(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return z(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}getStreamByMsid(e){return this.rts.commonController.streamManager.getStreamByMsid(e)}getPCStats(){return z(this,null,function*(){var e,t;return(t=(e=this.rts.commonController.peerCore)==null?void 0:e.pc)==null?void 0:t.getStats()})}sendSEI(e,t,r,i){return z(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:Z.VideoLarge,data:t,repeatCount:r,payloadType:i})})}},A(_t,"logName","RtsManager"),_t);tt([j()],Ye.prototype,"updatePublishingTracks",1),tt([j(ae,ae)],Ye.prototype,"httpPublish",1),tt([j(ae,ae)],Ye.prototype,"waitPublishSender",1),tt([j(([s,c,e])=>[s,JSON.stringify(e)],ae)],Ye.prototype,"publishAdd",1),tt([j(ae,ae)],Ye.prototype,"publishDelete",1),tt([j(([s,c,e])=>[s,JSON.stringify(e)])],Ye.prototype,"publishReplace",1),tt([j(ae)],Ye.prototype,"publishStop",1),tt([j()],Ye.prototype,"unpublish",1),tt([j(Oi,({traceId:s})=>s)],Ye.prototype,"httpSubscribe",1),tt([j(Oi,({traceId:s})=>s)],Ye.prototype,"subscribeAdd",1),tt([j(Oi)],Ye.prototype,"subscibeDelete",1),tt([j(ae)],Ye.prototype,"subscibeStop",1),tt([j(ae)],Ye.prototype,"publish",1),tt([j(Oi)],Ye.prototype,"subscribe",1),tt([j()],Ye.prototype,"sendSEI",1);let f0=Ye;class ps{constructor(){A(this,"profile");A(this,"profileMap",new Map);A(this,"audioProfile");A(this,"contentHint")}updateProfile(c,e){e&&this.profileMap.set(c,e),this.profile=c}get videoProfile(){return this.profile}updateAudioProfile(c){this.audioProfile=c}setContentHint(c,e){e&&(this.contentHint=e),this.contentHint&&c&&(c.contentHint=this.contentHint)}setVideoProfile(c,e,t=!1){return z(this,null,function*(){if(!this.profile)return;const r=this.profileMap.get(this.profile)||(e==null?void 0:e.VideoProfileMap.get(this.profile));if(r){if(!t&&c&&c.applyConstraints)try{yield c.applyConstraints(r)}catch(i){}e&&(e==null||e.VideoProfileMap.set(this.profile,r),yield e.setVideoProfile(this.profile))}})}}class ms extends ve{constructor(e){super();A(this,"type");A(this,"originVideoTrack");A(this,"videoSource");A(this,"_videoMuted",!1);A(this,"originAudioTrack");A(this,"audioSource");A(this,"_audioMuted",!1);A(this,"_targetVideoTrack");A(this,"_targetDualVideoTrack");A(this,"_targetAudioTrack");A(this,"_publishVideoStream");A(this,"_publishDualVideoStream");A(this,"_publishAudioStream");A(this,"_previewStream");A(this,"plugins",[]);A(this,"_profileManager");A(this,"cameraVideoConstraints");A(this,"micAudioConstraints");A(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});A(this,"onAudioTrackEnded",()=>{this.emit("audiotrackended")});this.type=e}get profileManager(){return this._profileManager}get audioProfile(){var e;return(e=this.profileManager)==null?void 0:e.audioProfile}updateSource(e,t,r){return z(this,null,function*(){var a,o,u,h,g,f;const{videoTrack:i,audioTrack:n}=e;i&&((a=this.originVideoTrack)==null||a.removeEventListener("ended",this.onVideoTrackEnded)),n&&((o=this.originAudioTrack)==null||o.removeEventListener("ended",this.onAudioTrackEnded)),this.type===Ke.AliRtcSdkStreamTypeScreen?this.stop():(i&&((u=this.originVideoTrack)==null||u.stop()),n&&((h=this.originAudioTrack)==null||h.stop())),i&&(this.originVideoTrack=i,(g=this.originVideoTrack)==null||g.addEventListener("ended",this.onVideoTrackEnded),this.videoSource=t||Yt.Camera,this.updateVideoTrack(i)),n&&(this.originAudioTrack=n,(f=this.originAudioTrack)==null||f.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=r||yi.Microphone,this.updateAudioTrack(n))})}get currentProfile(){var e;return(e=this.profileManager)==null?void 0:e.profile}get currentVideoTrack(){return this._targetVideoTrack}get currentDualVideoTrack(){return this._targetDualVideoTrack}get publishVideoStream(){return this._publishVideoStream}get publishDualVideoStream(){return this._publishDualVideoStream}get currentAudioTrack(){return this._targetAudioTrack}get publishAudioStream(){return this._publishAudioStream}get previewStream(){return this._previewStream}updateVideoTrack(e,t=!1){return z(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return z(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return z(this,null,function*(){(this._targetAudioTrack!==e||t)&&(this._targetAudioTrack=e)})}setAudioMuted(e){var t,r;this._audioMuted=e,e?(t=this.publishAudioStream)==null||t.disableAudio():(r=this.publishAudioStream)==null||r.enableAudio()}get isAudioMuted(){return this._audioMuted}setVideoMuted(e){var t,r;this._videoMuted=e,e?(t=this.publishVideoStream)==null||t.disableVideo():(r=this.publishVideoStream)==null||r.enableVideo()}get isVideoMuted(){return this._videoMuted}process(e){return z(this,null,function*(){var t,r,i,n,a,o,u,h,g,f,l,p;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const d of this.plugins)try{yield d.execute(this,e)}catch(m){console.error(`error in plugin-${d.name}, error: ${m}`)}this._targetVideoTrack?((r=(t=this._publishVideoStream)==null?void 0:t.videoTrack)==null?void 0:r.id)!==this._targetVideoTrack.id&&(this._publishVideoStream=yield xi(this._targetVideoTrack),this.setVideoMuted(this._videoMuted),(i=this.profileManager)==null||i.setVideoProfile(this.originVideoTrack,this._publishVideoStream,!0),(n=this.profileManager)==null||n.setContentHint(this._targetVideoTrack),this.previewStream?(a=this.previewStream)==null||a.mergeStream(this._publishVideoStream):this._previewStream=yield xi(this._targetVideoTrack)):(this._publishVideoStream=void 0,(o=this.previewStream)==null||o.deleteTracks({video:!0})),this._targetDualVideoTrack?((h=(u=this._publishDualVideoStream)==null?void 0:u.videoTrack)==null?void 0:h.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield xi(this._targetDualVideoTrack),this._videoMuted?this._publishDualVideoStream.disableVideo():this._publishDualVideoStream.enableVideo()):this._publishDualVideoStream=void 0,this._targetAudioTrack?((f=(g=this._publishAudioStream)==null?void 0:g.audioTrack)==null?void 0:f.id)!==this._targetAudioTrack.id&&(this._publishAudioStream=yield xi(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(l=this.previewStream)==null||l.mergeStream(this._publishAudioStream):this._previewStream=yield xi(this._targetAudioTrack)):(this._publishAudioStream=void 0,(p=this.previewStream)==null||p.deleteTracks({audio:!0}))})}stopVideo(){var e,t;this.originVideoTrack&&((e=this.originVideoTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originVideoTrack)==null||t.stop(),this.originVideoTrack=void 0),this.updateVideoTrack(void 0)}stopAudio(){var e,t;this.originAudioTrack&&((e=this.originAudioTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originAudioTrack)==null||t.stop(),this.originAudioTrack=void 0),this.updateAudioTrack(void 0)}stop(){this.stopVideo(),this.stopAudio()}updateVideoProfile(e,t){return z(this,null,function*(){this._profileManager||(this._profileManager=new ps),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===Ke.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new ps),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return z(this,null,function*(){this._profileManager||(this._profileManager=new ps),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return z(this,null,function*(){var t;yield(t=this.profileManager)==null?void 0:t.setVideoProfile(void 0,e)})}addPlugin(e){const t=this.plugins.findIndex(r=>r.zIndex>e.zIndex);t>-1?this.plugins.splice(t,0,e):this.plugins.push(e)}removePlugin(e){const t=this.plugins.indexOf(e);return t>-1?(e.clear(this),this.plugins.splice(t,1),!0):!1}}var p0=Object.defineProperty,m0=Object.getOwnPropertyDescriptor,bt=(s,c,e,t)=>{for(var r=t>1?void 0:t?m0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&p0(c,e,r),r};const gt=(si=class extends ve{constructor(e,t){super();A(this,"pluginManager");A(this,"slsReporter");A(this,"publishingCameraVideoStream");A(this,"publishingScreenVideoStream");A(this,"cameraStreamInfo",new ms(Ke.AliRtcSdkStreamTypeCapture));A(this,"screenStreamInfo",new ms(Ke.AliRtcSdkStreamTypeScreen));A(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);A(this,"_audioCaptureDisabled",!1);A(this,"_cameraCaptureDisabled",!1);A(this,"_publishLocalAudioStreamEnabled",!0);A(this,"_publishLocalVideoStreamEnabled",!0);A(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e,this.slsReporter=t;const r=i=>z(this,null,function*(){if(oe.info(`[${si.logName}]`,"plugin added",i.name),!i.isSupported("6.11.7")){console.warn(`${i.name} is not supported!!!`),i.emit("unsupported");return}try{yield i.init()}catch(n){i.emit("error",ne.fromError(n,Pt.AliRtcPluginErrorInitError))}i.streamType===Ke.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(i),yield this.cameraStreamInfo.process(this.streamInfos)),i.streamType===Ke.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(i),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(oa,gi),this.cameraStreamInfo.on("videotrackended",()=>z(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",Gt.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>z(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",Gt.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(ca,vi),this.screenStreamInfo.on("videotrackended",()=>z(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",Gt.ScreenTrackEnded)})),this.pluginManager.on("added",r),this.pluginManager.on("removed",i=>z(this,null,function*(){this.cameraStreamInfo.removePlugin(i)&&(yield this.cameraStreamInfo.process(this.streamInfos)),this.screenStreamInfo.removePlugin(i)&&(yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")})),this.pluginManager.on("updated",()=>z(this,null,function*(){yield this.updateStreams()}))}get hasCamera(){return!!this.cameraStreamInfo.originVideoTrack}get audioCaptureDisabled(){return this._audioCaptureDisabled}set audioCaptureDisabled(e){this._audioCaptureDisabled=e}get cameraCaptureDisabled(){return this._cameraCaptureDisabled}setAudioMuted(e){this.cameraStreamInfo.setAudioMuted(e)}get isAudioMuted(){return this.cameraStreamInfo.isAudioMuted}setCameraMuted(e){this.cameraStreamInfo.setVideoMuted(e)}get isCameraMuted(){return this.cameraStreamInfo.isVideoMuted}setScreenMuted(e){this.screenStreamInfo.setVideoMuted(e)}get isScreenMuted(){return this.screenStreamInfo.isVideoMuted}set cameraCaptureDisabled(e){this._cameraCaptureDisabled=e}get publishLocalAudioStreamEnabled(){return this._publishLocalAudioStreamEnabled}set publishLocalAudioStreamEnabled(e){this._publishLocalAudioStreamEnabled=e}get publishLocalVideoStreamEnabled(){return this._publishLocalVideoStreamEnabled}set publishLocalVideoStreamEnabled(e){this._publishLocalVideoStreamEnabled=e}get publishLocalScreenStreamEnabled(){return this._publishLocalScreenStreamEnabled}set publishLocalScreenStreamEnabled(e){this._publishLocalScreenStreamEnabled=e}updateStreams(){return z(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return z(this,null,function*(){var e,t,r,i;if((e=this.cameraStreamInfo.cameraVideoConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.cameraVideoConstraints)==null?void 0:t.deviceId;const a=yield me.AliRTS.getCameraList();a.find(o=>o.deviceId===n)||(n=(i=(r=a.find(o=>!!o.deviceId))==null?void 0:r.deviceId)!=null?i:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return z(this,null,function*(){var e,t,r,i;if((e=this.cameraStreamInfo.micAudioConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.micAudioConstraints)==null?void 0:t.deviceId;const a=yield me.AliRTS.getMicList();a.find(o=>o.deviceId===n)||(n=(i=(r=a.find(o=>!!o.deviceId))==null?void 0:r.deviceId)!=null?i:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return z(this,null,function*(){var g;const{screen:t,mediaStream:r,videoProfile:i,screenProfile:n}=e;let{video:a,audio:o}=e;const u=Qc(e);let h;if(u){r||(a===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),a=Se({},this.cameraStreamInfo.cameraVideoConstraints)):typeof a=="object"&&(yield this.setAvailableCameraDeviceId(),a=Se(Se({},a),this.cameraStreamInfo.cameraVideoConstraints)),o===void 0&&this.audioCaptureDisabled?o=!1:o&&(o===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),o=Se({},this.cameraStreamInfo.micAudioConstraints)):typeof o=="object"&&(yield this.setAvailableMicrophoneDeviceId(),o=Se(Se({},o),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1));const f=Date.now();try{h=yield me.AliRTS.createStream({audio:o,video:a,screen:t,custom:!!r,mediaStream:r,skipProfile:!0}),o&&!r&&this.slsReporter.reportAudio(null,Date.now()-f,((g=h==null?void 0:h.audioTrack)==null?void 0:g.label)||""),t&&!r&&this.slsReporter.reportScreen(null,Date.now()-f)}catch(l){throw o&&!r&&this.slsReporter.reportAudio(l,Date.now()-f,""),t&&!r&&this.slsReporter.reportScreen(null,Date.now()-f),l}if(t)yield this.screenStreamInfo.updateSource(h,Yt.Screen,yi.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,Yt.Camera,yi.Microphone),h.hasVideo&&(yield this.setVideoProfile(i),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof o=="boolean"){const l=this.cameraStreamInfo.audioProfile;l&&(yield h.setAudioProfile(l))}}return me.AliRTS.SystenUtil.isIos&&me.AliRTS.SystenUtil.compareVersion("15.1")&&!me.AliRTS.SystenUtil.compareVersion("15.2")&&(yield $t(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return z(this,null,function*(){const{screen:t,video:r,audio:i}=e!=null?e:{};let n=!1;r&&this.cameraStreamInfo.originVideoTrack&&(n=!0,this.cameraStreamInfo.stopVideo(),this.publishingCameraVideoStream=void 0),i&&this.cameraStreamInfo.originAudioTrack&&(n=!0,this.cameraStreamInfo.stopAudio()),t&&this.screenStreamInfo.originVideoTrack&&(n=!0,this.screenStreamInfo.stop(),this.publishingScreenVideoStream=void 0,this.slsReporter.reportScreenStop(null)),n&&(yield this.updateStreams())})}get publishStreams(){const{publishLocalVideoStreamEnabled:e,publishLocalAudioStreamEnabled:t,publishLocalScreenStreamEnabled:r}=this;return{video:e?this.cameraStreamInfo.publishVideoStream:void 0,videoSmall:e?this.cameraStreamInfo.publishDualVideoStream:void 0,audio:t?this.cameraStreamInfo.publishAudioStream:void 0,screen:r?this.screenStreamInfo.publishVideoStream:void 0}}createHTTPPublishStream(){return z(this,null,function*(){var o,u,h,g;let e,t=!1,r,i,n;const a=yield this.publishStreams;try{if(!a.audio&&!a.video&&!a.videoSmall&&!a.screen)throw new ne(ce.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const f=new MediaStream;(o=a.audio)!=null&&o.audioTrack&&f.addTrack(a.audio.audioTrack),(u=a.video)!=null&&u.videoTrack?(f.addTrack(a.video.videoTrack),i=a.videoSmall,n=a.screen):(h=a.screen)!=null&&h.videoTrack&&(r=Z.Screen,f.addTrack((g=a.screen)==null?void 0:g.videoTrack),t=!0),e=yield fa(f),t?(this.screenStreamInfo.cloneVideoProfile(e),this.publishingScreenVideoStream=e):(this.cameraStreamInfo.cloneVideoProfile(e),this.publishingCameraVideoStream=e)}catch(f){}return{publishStream:e,videoSmallStream:i,screenStream:n,vMsid:r}})}stop(){this.cameraStreamInfo.stop(),this.screenStreamInfo.stop()}setVideoProfile(e,t){return z(this,null,function*(){yield this.cameraStreamInfo.updateVideoProfile(e,t),this.publishingCameraVideoStream&&this.cameraStreamInfo.cloneVideoProfile(this.publishingCameraVideoStream)})}setVideoContentHint(e){this.cameraStreamInfo.setVideoContentHint(e)}setAudioProfile(e){return z(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return z(this,null,function*(){yield this.screenStreamInfo.updateVideoProfile(e,t),this.publishingScreenVideoStream&&this.screenStreamInfo.cloneVideoProfile(this.publishingScreenVideoStream)})}setScreenContentHint(e){this.screenStreamInfo.setVideoContentHint(e)}setCameraVideoConstraints(e){var t;this.cameraStreamInfo.cameraVideoConstraints=Se(Se({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=Se(Se({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},A(si,"logName","LocalStreamManager"),si);bt([j(([s])=>{const{audio:c,video:e,screen:t,custom:r,skipProfile:i,videoProfile:n,screenProfile:a}=s;return[{audio:c,video:e,screen:t,custom:r,skipProfile:i,videoProfile:n,screenProfile:a}]})],gt.prototype,"createLocalStream",1),bt([j(ae)],gt.prototype,"stopLocalStream",1),bt([j()],gt.prototype,"createHTTPPublishStream",1),bt([j()],gt.prototype,"stop",1),bt([j(ae)],gt.prototype,"setVideoProfile",1),bt([j(ae)],gt.prototype,"setVideoContentHint",1),bt([j(ae)],gt.prototype,"setAudioProfile",1),bt([j(ae)],gt.prototype,"setScreenProfile",1),bt([j(ae)],gt.prototype,"setScreenContentHint",1),bt([j(ae)],gt.prototype,"setCameraVideoConstraints",1),bt([j(ae)],gt.prototype,"setMicAudioConstraints",1);let g0=gt;var v0=Object.defineProperty,x0=Object.getOwnPropertyDescriptor,St=(s,c,e,t)=>{for(var r=t>1?void 0:t?x0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&v0(c,e,r),r};class ot extends ve{constructor(e){super();A(this,"self");A(this,"userMap",{});A(this,"usersViewMap",{});A(this,"rtsManager");A(this,"localStreamManager");A(this,"authInfo");A(this,"signalingManager");A(this,"pluginManager");A(this,"slsReporter");A(this,"statsMonitorId");A(this,"autoSubAudio",!0);A(this,"autoSubVideo",!0);A(this,"autoSubScreen",!0);A(this,"wantSubAudio",!0);A(this,"wantSubVideo",!0);A(this,"wantSubScreen",!0);A(this,"defaultStreamType",Je.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioVolumeIndicationInterval",0);A(this,"indicationTimer",0);A(this,"parameter",{});const{signalingManager:t,slsReporter:r}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.slsReporter=r,this.pluginManager=new h0,this.localStreamManager=new g0(this.pluginManager,this.slsReporter),this.rtsManager=new f0(this.localStreamManager,this.slsReporter),this.self=new la({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,parameter:this.parameter})}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{oe.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})}),this.signalingManager.stsManager.on("onTokenUpdate",(e,t)=>{oe.updateToken(e),this.slsReporter.updateToken(t,e)})}isAutoSubAudio(){return this.autoSubAudio}setAutoSubAudio(e){this.autoSubAudio=e}isAutoSubVideo(){return this.autoSubVideo}setAutoSubVideo(e){this.autoSubVideo=e}isAutoSubScreen(){return this.autoSubScreen}setAutoSubScreen(e){this.autoSubScreen=e}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e,this.remoteUsers.forEach(t=>{t.setWantSubAudio(e),t.updateSubscribe(Be.User)})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe(Be.User)})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe(Be.User)})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var r;(r=this.getRemoteUser(e))==null||r.setRemoteDefaultVideoStreamType(t)}setAudioMuted(e){this.audioMuted=e,this.remoteUsers.forEach(t=>{t.setAudioMuted(e)})}setLocalViewConfig(e,t){var i;if(!e)return(i=this.publisher)==null?void 0:i.setViewConfig(null,t);const r=fs(e);r.length!==0&&r.forEach(n=>{var a,o;(a=this.publisher)==null||a.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:u=[],screenViews:h=[]})=>{u.includes(n)&&u.splice(u.indexOf(n),1),h.includes(n)&&h.splice(h.indexOf(n),1)}),(o=this.publisher)==null||o.setViewConfig(r,t)})}setRemoteViewConfig(e,t,r){var n,a;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,r);const i=fs(t);i.length!==0&&(i.forEach(o=>{var u;(u=this.publisher)==null||u.resetElement(o),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:g=[]})=>{h.includes(o)&&h.splice(h.indexOf(o),1),g.includes(o)&&g.splice(g.indexOf(o),1)})}),(a=this.userMap[e])==null||a.setViewConfig(i,r))}get channel(){var e;return(e=this.authInfo)==null?void 0:e.channelId}get userId(){var e;return(e=this.authInfo)==null?void 0:e.userId}get remoteUsers(){return Object.values(this.userMap)}get publisher(){return this.self}get isSubscribing(){var e;return((e=this.remoteUsers)!=null?e:[]).some(t=>{var o;const{isAudioSubscribing:r,isVideoLargeSubscribing:i,isVideoSmallSubscribing:n,isScreenSubscribing:a}=(o=t.streamInfo)!=null?o:{};return r||i||n||a})}onRemotePublishStateChange(e){var f;const{userid:t,callid:r,subscribe:i,pubid:n="",tracks:a}=e,o=(f=i==null?void 0:i.pullstreamurl)!=null?f:"";let u=this.getRemoteUser(t);if(!u)return;const h=u.streamInfo.audioTrackInfo,g=u.streamInfo.videoTrackInfo;u.updateRemoteTracks(r,o,n,a),u.updateSubscribe(Be.Publish),(h!==u.streamInfo.audioTrackInfo||g!==u.streamInfo.videoTrackInfo)&&this.emit("remoteTrackAvailableChange",t,u.streamInfo.audioTrackInfo,u.streamInfo.videoTrackInfo)}init(e,t){var r;this.authInfo=e,this.self||(this.self=new la({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,parameter:this.parameter})),this.self.enableAudioVolumeIndication(this.audioVolumeIndicationInterval),(r=this.self)==null||r.initInfo(e,t.pushstreamurl),t.users.forEach(i=>{const n=i.userid;if(n){const a=this.addUser(n,i.displayname,Be.InRoom),{callid:o,subscribe:u,tracks:h}=i;a.updateRemoteTracks(o,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,a.streamInfo.audioTrackInfo,a.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}clear(){return z(this,null,function*(){var e;this.stopStatsMonitor();for(let t in this.userMap)this.userMap[t]&&(yield this.userMap[t].clear(),delete this.userMap[t]);yield(e=this.self)==null?void 0:e.clear(),this.authInfo=void 0})}startStatsMonitor(){this.statsMonitorId=window.setInterval(()=>z(this,null,function*(){if(this.publisher){const{audio:r,video:i,candidate:n}=yield this.publisher.getStats();r&&r.length>0&&this.emit("rtcLocalAudioStats",r),i&&i.length>0&&this.emit("rtcLocalVideoStats",i),n&&this.emit("rtcStats",n)}const e=[],t=[];for(const r of this.remoteUsers){const{audio:i,video:n}=yield r.getStats();i&&i.forEach(a=>{e.push(a)}),n&&n.forEach(a=>{t.push(a)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),t.length>0&&this.emit("rtcRemoteVideoStats",t)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}addUser(e,t,r){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t,r)),this.userMap[e]}executeAddUser(e,t,r){const i=new Ue({userId:e,displayName:t,rtsManager:this.rtsManager,signalingManager:this.signalingManager,usersViewMap:this.usersViewMap,slsReporter:this.slsReporter,localUser:this.self,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,playoutVolume:this.playoutVolume,parameter:this.parameter});return i.on(et.Remote,this.onRemoteDeviceStatusChange.bind(this)),i.on(Ie.PullStreamStats,this.onRemoteStatReport.bind(this)),i.on(Ie.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),i.on("audioSubscribeStateChanged",(n,a,o,u)=>{this.emit("audioSubscribeStateChanged",n,a,o,u,this.channel||"")}),i.on("videoSubscribeStateChanged",(n,a,o,u)=>{this.emit("videoSubscribeStateChanged",n,a,o,u,this.channel||"")}),i.on("screenSubscribeStateChanged",(n,a,o,u)=>{this.emit("screenSubscribeStateChanged",n,a,o,u,this.channel||"")}),i.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),i.on("remoteVideoAutoPlayFail",(n,a)=>{this.emit("remoteVideoAutoPlayFail",n,a)}),i.on("remoteAudioPlayError",(n,a)=>{this.emit("remoteAudioPlayError",n,a)}),i.on("remoteVideoPlayError",(n,a)=>{this.emit("remoteVideoPlayError",n,a)}),i.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n)}),i.setWantSubAudio(this.autoSubAudio&&this.wantSubAudio),i.setWantSubVideo(this.autoSubVideo&&this.wantSubVideo),i.setWantSubScreen(this.autoSubScreen&&this.wantSubScreen),i.setRemoteDefaultVideoStreamType(this.defaultStreamType),i.setAudioMuted(this.audioMuted),(this.autoSubAudio||this.autoSubVideo||this.autoSubScreen)&&i.updateSubscribe(r),i}onRemoteDeviceStatusChange(e,t){e===Ie.MuteAudio?this.emit("userAudioMuted",t,!0):e===Ie.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===Ie.MuteVideo?this.emit("userVideoMuted",t,!0):e===Ie.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===Ie.MuteScreen?this.emit("userScreenMuted",t,!0):e===Ie.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,r){this.emit(Ie.PullStreamStats,e,t,r)}onSubscribeExceeds(e,t){this.emit(Ie.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return z(this,null,function*(){e.userid&&this.userMap[e.userid]&&(yield this.userMap[e.userid].clear(!1),delete this.userMap[e.userid])})}updateUsers(e){const t=[],r=[],i={};e.forEach(o=>{o.userid&&(this.userMap[o.userid]?(r.push(o),i[o.userid]=this.userMap[o.userid]):(t.push(o),i[o.userid]=this.executeAddUser(o.userid,o.displayname,Be.Resume)))});const n=Object.keys(this.userMap),a=[];return n.forEach(o=>{i[o]||a.push({userid:o,reason:"",leavecode:cs.AliRtcUserOfflineQuit})}),this.userMap=i,{joinList:t,leaveList:a,presentList:r}}getRemoteUser(e){return this.userMap[e]}updateRemoteUserDeviceStatus(e){e&&e.userid&&this.userMap[e.userid]&&this.userMap[e.userid].updateRemoteUserDeviceStatus(e.status)}updateAudioWant(e,t){const r=this.userMap[e];if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubAudio(t),t?r.updateSubscribe(Be.User):r.stopSubscribe({audio:!0})}updateVideoWant(e,t){const r=this.userMap[e];if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubVideo(t),t?r.updateSubscribe(Be.User):r.stopSubscribe({video:!0})}updateScreenWant(e,t){const r=this.userMap[e];if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubScreen(t),t?r.updateSubscribe(Be.User):r.stopSubscribe({screen:!0})}stopIndication(){this.indicationTimer&&window.clearInterval(this.indicationTimer)}startIndication(e){this.stopIndication(),this.indicationTimer=window.setInterval(()=>{var r;const t=this.remoteUsers.map(i=>({userId:i.userId,volume:i.getAudioLevel()||0}));t.unshift({userId:"",volume:((r=this.self)==null?void 0:r.getAudioLevel())||0}),this.emit("audioVolume",t)},e)}enableAudioVolumeIndication(e){var t;this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.stopIndication(),e>0&&this.startIndication(e),this.audioVolumeIndicationInterval=e,this.remoteUsers.forEach(r=>{r.enableAudioVolumeIndication(e)}),(t=this.self)==null||t.enableAudioVolumeIndication(e))}setPlayoutVolume(e){this.playoutVolume=e,this.remoteUsers.forEach(t=>{t.setPlayoutVolume(e)})}refreshAuthInfo(e){var t;this.authInfo&&(this.authInfo=Se(Se({},this.authInfo),e)),e.userId&&((t=this.self)==null||t.refreshUserInfo(e.userId))}setEnableMediaExtensionMsg(e){this.rtsManager.setEncodedInsertableStreams(e)}setAudioRedEnabled(e){this.rtsManager.setAudioRedEnabled(e)}setParameter(e){const t=JSON.parse(e);Object.keys(t).forEach(r=>{this.parameter[r]=t[r]})}getParameter(){return JSON.stringify(this.parameter)}}A(ot,"logName","BizControl"),St([j()],ot.prototype,"init",1),St([j()],ot.prototype,"clear",1),St([j(ae)],ot.prototype,"addUser",1),St([j()],ot.prototype,"removeLeftUser",1),St([j()],ot.prototype,"updateUsers",1),St([j(ae)],ot.prototype,"updateAudioWant",1),St([j(ae)],ot.prototype,"updateVideoWant",1),St([j(ae)],ot.prototype,"updateScreenWant",1),St([j()],ot.prototype,"stopIndication",1),St([j()],ot.prototype,"startIndication",1),St([j()],ot.prototype,"enableAudioVolumeIndication",1);const gs=s=>z(this,null,function*(){const c=new Uint8Array(160).fill(170),e=new TextEncoder().encode(s),t=yield window.crypto.subtle.importKey("raw",c,{name:"HMAC",hash:{name:"SHA-1"}},!1,["sign"]),r=yield window.crypto.subtle.sign("HMAC",t,e);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")});class b0{constructor(c){A(this,"authInfo");A(this,"slsReporter");this.slsReporter=c}doRequest(c,e){var u;const t=this.authInfo;if(!t)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const r="https://gw.rtn.aliyuncs.com",i=Mc[c],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:At.createCallid(),tokensid:!1,session:(u=t.sessionId)!=null?u:At.createCallid()},a=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),o=`${r}${i}?${a}`;return fetch(o,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)}).then(h=>h.status!==200?(this.slsReporter.reportTranscodingError(h.status,e.taskid||""),Promise.reject(new ne(ce.ERR_INNER,`transcoding request failed, status: ${h.status}`))):h).catch(h=>Promise.reject(new ne(ce.ERR_INNER,`transcoding request failed, err: ${h.message}`)))}setAuthInfo(c){this.authInfo=c}clear(){this.authInfo=void 0}startPublishLiveStream(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield gs(c.split("?")[0]),r=st.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(r,this.authInfo,t,c);return this.doRequest(r,i)})}startPublishLiveStreamWithTaskId(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=st.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(t,this.authInfo,c);return this.doRequest(t,r)})}updatePublishLiveStream(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield gs(c.split("?")[0]),r=st.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(r,this.authInfo,t,c);return this.doRequest(r,i)})}updatePublishLiveStreamWithTaskId(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=st.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(t,this.authInfo,c);return this.doRequest(t,r)})}stopPublishLiveStream(c){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=yield gs(c.split("?")[0]),t=st.MPU_TASK_TRANSACTION_STOP,r=new Li().toJson(t,this.authInfo,e,c);return this.doRequest(t,r)})}stopPublishLiveStreamWithTaskId(c){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=st.MPU_TASK_TRANSACTION_STOP,t=new Li().toJson(e,this.authInfo,c);return this.doRequest(e,t)}refreshAuthInfo(c){this.authInfo&&this.setAuthInfo(Se(Se({},this.authInfo),c))}}class ma{constructor(c){A(this,"name","COMMON");this.name=c||this.name}info(...c){}warn(...c){}print(c,...e){const t=c.toLowerCase();t&&console[t](`[${c}][${this.name}]`,...e)}}A(ma,"LEVEL",0);class S0{constructor(){A(this,"logger",new ma("AudioMixer"));A(this,"audioContext",new AudioContext);A(this,"audioDestination",this.audioContext.createMediaStreamDestination());A(this,"audioTrack",Jc(this.audioDestination.stream));A(this,"sourceNodeMap",{})}get sourceNodeList(){return Object.values(this.sourceNodeMap).map(c=>c.sourceNode).filter(c=>!!c)}get gainNodeList(){return Object.values(this.sourceNodeMap).map(c=>c.gainNode).filter(c=>!!c)}get sourceCount(){return this.sourceNodeList.length}resume(){var c;return(c=this.audioContext)==null?void 0:c.resume()}addTrack(c){this.connectTrack(c)}hasTrack(c){return!!this.sourceNodeMap[c]}removeTrack(c){const{sourceNode:e,gainNode:t}=this.sourceNodeMap[c]||{};t==null||t.disconnect(),e==null||e.disconnect(),delete this.sourceNodeMap[c],e?this.logger.info("SourceNode disconnected. Active source node:",this.sourceNodeList.length):this.logger.warn(`SourceNode ${c} does not exit. Active source node: ${this.sourceNodeList.length}`)}getAudioTrack(){return this.audioTrack}setVolume(c,e){const{gainNode:t}=this.sourceNodeMap[e]||{};t?(this.logger.info(`Setting node(${e}) volume to ${this.scale(c)}`),t.gain.value=this.scale(c)):this.logger.warn(`GainNode ${e} does not exit.`)}reset(){this.disconnectSourceNode(),this.sourceNodeMap={}}dispose(){var c;this.reset(),(c=this.audioTrack)==null||c.stop(),this.audioDestination.disconnect(),this.audioContext.close()}connectTrack(c){if(!this.audioContext)return this.logger.warn("AudioContext not initialized");let e=new MediaStream;e.addTrack(c);const t=this.audioContext.createMediaStreamSource(e),r=this.audioContext.createGain();r.gain.value=1,t.connect(r),r.connect(this.audioDestination),this.sourceNodeMap[c.id]={track:c,sourceNode:t,gainNode:r},this.logger.info("New sourceNode connected. Active source node:",this.sourceNodeList.length)}disconnectSourceNode(){this.sourceNodeList.forEach(c=>c.disconnect()),this.gainNodeList.forEach(c=>c.disconnect())}scale(c){return c/100}}const _0=4;class y0 extends ei{constructor(){super("audioMixer",Ke.AliRtcSdkStreamTypeCapture,Ti.AUDIO);A(this,"audioMixer");A(this,"primaryAudioTrackId");A(this,"screenAudioTrackId");A(this,"dirty",!1);this.zIndex=8}get initOptions(){return{audio:1,screen:1}}setOptions(e){Object.entries(e).forEach(([t,r])=>{this.isValidVolume(r)&&(this.options[t]=r)}),this.dirty=!0,this.emit("updated")}isSupported(){return"AudioContext"in window}shouldUpdate(e,t){var n,a;if(e.type!==Ke.AliRtcSdkStreamTypeCapture)return!1;const r=t.find(o=>o.type===Ke.AliRtcSdkStreamTypeCapture),i=t.find(o=>o.type===Ke.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=r==null?void 0:r.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((a=i==null?void 0:i.currentAudioTrack)==null?void 0:a.id)&&!this.dirty)}process(e,t){return z(this,null,function*(){var a,o;this.dirty=!1;const r=t.find(u=>u.type===Ke.AliRtcSdkStreamTypeScreen),i=e.currentAudioTrack,n=r==null?void 0:r.currentAudioTrack;if(!n&&this.options.audio===1){this.audioMixer&&(this.audioMixer.dispose(),this.audioMixer=void 0),this.primaryAudioTrackId=i==null?void 0:i.id,e.updateAudioTrack(i);return}this.audioMixer||(this.audioMixer=new S0),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(i==null?void 0:i.id)!==this.primaryAudioTrackId&&((a=this.audioMixer)==null||a.removeTrack(this.primaryAudioTrackId)),i&&!this.audioMixer.hasTrack(i==null?void 0:i.id)&&this.audioMixer.addTrack(i),this.primaryAudioTrackId=i==null?void 0:i.id,this.screenAudioTrackId&&(n==null?void 0:n.id)!==this.screenAudioTrackId&&((o=this.audioMixer)==null||o.removeTrack(this.screenAudioTrackId)),n&&!this.audioMixer.hasTrack(n==null?void 0:n.id)&&this.audioMixer.addTrack(n),this.screenAudioTrackId=n==null?void 0:n.id,this.updateVolume(),e.updateAudioTrack(this.audioMixer.getAudioTrack())})}isValidVolume(e){return e!==void 0&&e>=0&&e<=_0}updateVolume(){this.audioMixer&&(this.primaryAudioTrackId&&this.audioMixer.setVolume(this.options.audio*100,this.primaryAudioTrackId),this.screenAudioTrackId&&this.audioMixer.setVolume(this.options.screen*100,this.screenAudioTrackId))}clear(e){var t;(t=this.audioMixer)==null||t.dispose(),super.clear(e)}}class vs{constructor(c,e){A(this,"originTrack");A(this,"originVideo");A(this,"targetWidth");A(this,"targetHeight");A(this,"targetFrameRate");A(this,"targetCanvas");A(this,"animationFrameId");A(this,"resultTrack");this.targetWidth=e.width,this.targetHeight=e.height,this.targetFrameRate=e.frameRate,this.originTrack=c,this.originVideo=document.createElement("video"),this.originVideo.muted=!0,this.originVideo.autoplay=!0,this.originVideo.controls=!1,this.targetCanvas=document.createElement("canvas"),this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight}updateOptions(c){this.targetWidth=c.width,this.targetHeight=c.height,this.targetFrameRate=c.frameRate,this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight,this.resultTrack&&this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})}dispose(){}getVideoTrack(){return this.resultTrack||(this.resultTrack=this.targetCanvas.captureStream().getVideoTracks()[0],this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})),this.resultTrack}cancelAnimation(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}getPositionAndSize(c,e,t,r){const i=e/c,n=r/t;let a=t,o=r,u=0,h=0;return n>i?(a=Math.round(o/i),u=Math.round((t-a)/2)):n<i&&(o=Math.round(a*i),h=Math.round((r-o)/2)),{x:u,y:h,width:a,height:o}}}class A0 extends vs{constructor(e,t){super(e,t);A(this,"targetCtx");this.targetCtx=this.targetCanvas.getContext("2d"),this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.initStream(e)}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender)}startRender(){this.cancelAnimation();const e=()=>{if(!this.targetCtx)return;const t=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight);this.targetCtx.drawImage(this.originVideo,0,0,this.originVideo.videoWidth,this.originVideo.videoHeight,t.x,t.y,t.width,t.height),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e))};e()}stopRender(){this.cancelAnimation()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.pause(),this.originVideo.srcObject=null}}const E0=`
39
39
  attribute vec2 a_position;
40
40
  attribute vec2 a_texCoord;
41
41
 
@@ -56,7 +56,7 @@ void main() {
56
56
 
57
57
  v_texCoord = a_texCoord;
58
58
  }
59
- `,_h=`
59
+ `,w0=`
60
60
  precision mediump float;
61
61
 
62
62
  varying lowp vec2 v_texCoord;
@@ -65,7 +65,7 @@ uniform sampler2D u_texture;
65
65
  void main() {
66
66
  gl_FragColor = texture2D(u_texture, v_texCoord);
67
67
  }
68
- `;function yh(){let s;try{const c=document.createElement("canvas");c.width=1,c.height=1;const e={alpha:!1,depth:!1,stencil:!1,antialias:!1,preferLowPowerToHighPerformance:!0};s=c.getContext("webgl2",e)}catch(c){return!1}return!!s}function wh(s){const c=s.createTexture();return s.bindTexture(s.TEXTURE_2D,c),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),c}function Yo(s,c,e){const t=s.createShader(c);if(!t){console.error("create shader failed");return}return s.shaderSource(t,e),s.compileShader(t),s.getShaderParameter(t,s.COMPILE_STATUS)?t:(console.error(`An error occurred compiling the shaders: ${s.getShaderInfoLog(t)}`),s.deleteShader(t),null)}function Ah(s,c,e){const t=Yo(s,s.VERTEX_SHADER,c),i=Yo(s,s.FRAGMENT_SHADER,e),r=s.createProgram();if(!(!r||!t||!i))return s.attachShader(r,t),s.attachShader(r,i),s.linkProgram(r),s.getProgramParameter(r,s.LINK_STATUS)?r:(console.error(`Unable to initialize the shader program: ${s.getProgramInfoLog(r)}`),null)}function Eh(s,c,e,t=0,i=0){const r=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,r);const n=t,o=i,a=c+t,u=e+i,h=[n,o,a,o,n,u,n,u,a,o,a,u];return s.bufferData(s.ARRAY_BUFFER,new Float32Array(h),s.STATIC_DRAW),r}class Qo extends Pn{constructor(e,t){super(e,t);A(this,"targetCtx");A(this,"targetTexture");A(this,"locationMap");this.targetCtx=this.targetCanvas.getContext("webgl2"),this.locationMap={},this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.updateBuffer=this.updateBuffer.bind(this),this.initGL(),this.initStream(e)}static isSupport(){return yh()}initGL(){const e=this.targetCtx;if(!e)return;this.targetTexture=wh(e);const t=Ah(e,Sh,_h);if(!t){console.log("[ScalerWebGL] program is null.");return}e.useProgram(t);const i=e.getAttribLocation(t,"a_position"),r=e.getAttribLocation(t,"a_texCoord"),n=e.getUniformLocation(t,"u_resolution");if(!n){console.log("[ScalerWebGL] resolutionLocation is null.");return}const o=e.getUniformLocation(t,"u_texture");if(!o){console.log("[ScalerWebGL] textureLocation is null.");return}this.locationMap={program:t,positionLocation:i,texCoordLocation:r,resolutionLocation:n,textureLocation:o},this.updateBuffer()}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender),this.originVideo.addEventListener("resize",this.updateBuffer)}startRender(){this.cancelAnimation();const e=()=>{this.targetCtx&&(this.renderTexture(),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e)))};e()}updateBuffer(){const e=this.targetCtx,t=this.locationMap.positionLocation,i=this.locationMap.texCoordLocation,r=this.locationMap.resolutionLocation;if(!e||!this.originVideo.videoWidth||!this.originVideo.videoHeight)return;const n=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight),o=Eh(e,n.width,n.height,n.x,n.y);e.enableVertexAttribArray(t),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(t,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i);const a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,a),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),e.uniform2f(r,this.targetWidth,this.targetHeight)}renderTexture(){const e=this.targetTexture,t=this.targetCtx,i=this.locationMap.textureLocation;!e||!t||(t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.originVideo),t.useProgram(this.locationMap.program),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.uniform1i(i,0),t.viewport(0,0,t.canvas.width,t.canvas.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,6))}stopRender(){this.cancelAnimation()}updateOptions(e){super.updateOptions(e),this.updateBuffer()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.removeEventListener("resize",this.updateBuffer),this.originVideo.pause(),this.originVideo.srcObject=null}}const Ch=`
68
+ `;function C0(){let s;try{const c=document.createElement("canvas");c.width=1,c.height=1;const e={alpha:!1,depth:!1,stencil:!1,antialias:!1,preferLowPowerToHighPerformance:!0};s=c.getContext("webgl2",e)}catch(c){return!1}return!!s}function I0(s){const c=s.createTexture();return s.bindTexture(s.TEXTURE_2D,c),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),c}function ga(s,c,e){const t=s.createShader(c);if(!t){console.error("create shader failed");return}return s.shaderSource(t,e),s.compileShader(t),s.getShaderParameter(t,s.COMPILE_STATUS)?t:(console.error(`An error occurred compiling the shaders: ${s.getShaderInfoLog(t)}`),s.deleteShader(t),null)}function R0(s,c,e){const t=ga(s,s.VERTEX_SHADER,c),r=ga(s,s.FRAGMENT_SHADER,e),i=s.createProgram();if(!(!i||!t||!r))return s.attachShader(i,t),s.attachShader(i,r),s.linkProgram(i),s.getProgramParameter(i,s.LINK_STATUS)?i:(console.error(`Unable to initialize the shader program: ${s.getProgramInfoLog(i)}`),null)}function k0(s,c,e,t=0,r=0){const i=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,i);const n=t,a=r,o=c+t,u=e+r,h=[n,a,o,a,n,u,n,u,o,a,o,u];return s.bufferData(s.ARRAY_BUFFER,new Float32Array(h),s.STATIC_DRAW),i}class va extends vs{constructor(e,t){super(e,t);A(this,"targetCtx");A(this,"targetTexture");A(this,"locationMap");this.targetCtx=this.targetCanvas.getContext("webgl2"),this.locationMap={},this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.updateBuffer=this.updateBuffer.bind(this),this.initGL(),this.initStream(e)}static isSupport(){return C0()}initGL(){const e=this.targetCtx;if(!e)return;this.targetTexture=I0(e);const t=R0(e,E0,w0);if(!t){console.log("[ScalerWebGL] program is null.");return}e.useProgram(t);const r=e.getAttribLocation(t,"a_position"),i=e.getAttribLocation(t,"a_texCoord"),n=e.getUniformLocation(t,"u_resolution");if(!n){console.log("[ScalerWebGL] resolutionLocation is null.");return}const a=e.getUniformLocation(t,"u_texture");if(!a){console.log("[ScalerWebGL] textureLocation is null.");return}this.locationMap={program:t,positionLocation:r,texCoordLocation:i,resolutionLocation:n,textureLocation:a},this.updateBuffer()}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender),this.originVideo.addEventListener("resize",this.updateBuffer)}startRender(){this.cancelAnimation();const e=()=>{this.targetCtx&&(this.renderTexture(),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e)))};e()}updateBuffer(){const e=this.targetCtx,t=this.locationMap.positionLocation,r=this.locationMap.texCoordLocation,i=this.locationMap.resolutionLocation;if(!e||!this.originVideo.videoWidth||!this.originVideo.videoHeight)return;const n=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight),a=k0(e,n.width,n.height,n.x,n.y);e.enableVertexAttribArray(t),e.bindBuffer(e.ARRAY_BUFFER,a),e.vertexAttribPointer(t,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r);const o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0),e.uniform2f(i,this.targetWidth,this.targetHeight)}renderTexture(){const e=this.targetTexture,t=this.targetCtx,r=this.locationMap.textureLocation;!e||!t||(t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.originVideo),t.useProgram(this.locationMap.program),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.uniform1i(r,0),t.viewport(0,0,t.canvas.width,t.canvas.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,6))}stopRender(){this.cancelAnimation()}updateOptions(e){super.updateOptions(e),this.updateBuffer()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.removeEventListener("resize",this.updateBuffer),this.originVideo.pause(),this.originVideo.srcObject=null}}const D0=`
69
69
  var targetOptions={
70
70
  width: 320,
71
71
  height: 180,
@@ -150,4 +150,4 @@ onmessage = function(evt) {
150
150
  break;
151
151
  }
152
152
  }
153
- `;class ec extends Pn{constructor(e,t){super(e,t);A(this,"processor");A(this,"trackGenerator");A(this,"worker");this.processor=new MediaStreamTrackProcessor({track:e}),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.startTransform()}static isSupport(){return"MediaStreamTrackProcessor"in window&&"MediaStreamTrackGenerator"in window&&"TransformStream"in window&&"VideoFrame"in window}startTransform(){const e=new Blob([Ch],{type:"text/javascript"}),i=(window.URL||window.webkitURL).createObjectURL(e);this.worker=new Worker(i);const{readable:r}=this.processor,{writable:n}=this.trackGenerator;this.worker.postMessage({type:"startRender",readable:r,writable:n,width:this.targetWidth,height:this.targetHeight,frameRate:this.targetFrameRate},[r,n])}updateOptions(e){super.updateOptions(e),this.worker&&this.worker.postMessage(Ce({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class Ln{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(c,e){return ec.isSupport()?new ec(c,e):Qo.isSupport()?new Qo(c,e):new bh(c,e)}}class Ih extends Fi{constructor(){super(...arguments);A(this,"hasVideoTrack",!1);A(this,"videoScaler")}get initOptions(){return{width:320,height:180,frameRate:15}}setOptions(e){var t;this.options=e,(t=this.videoScaler)==null||t.updateOptions(e)}isSupported(){return Ln.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return H(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const i=this.options||this.initOptions;this.videoScaler=Ln.getInstance(e.currentVideoTrack,i)}const t=this.videoScaler.getVideoTrack();t&&e.updateDualVideoTrack(t)}else e.updateDualVideoTrack(),this.emit("updated"),this.videoScaler&&this.videoScaler.dispose()})}clear(e){super.clear(e),this.hasVideoTrack=!1,e==null||e.updateDualVideoTrack()}}class Mn{static checkString(c){return typeof c=="string"}static checkNumber(c){return typeof c=="number"}static checkHtmlVideoElement(c){return c&&c.nodeName==="VIDEO"}static checkHtmlAudioElement(c){return c&&c.nodeName==="AUDIO"}static checkAuthInfo(c){if(!c)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!c.appId)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!c.channelId)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!c.userId)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(c.timestamp){if(!Mn.checkNumber(c.timestamp))return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return c.token?null:new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no token founded")}static checkMediaStreamTrack(c){return c instanceof MediaStreamTrack}static checkVideoEncoderConfiguration(c){return c&&(c.width||c.height||c.frameRate||c.bitrateMax)}}class tc{constructor(c){A(this,"taskProfile");A(this,"encodeParam");A(this,"users",[]);A(this,"backgroundColor",0);A(this,"backgrounds",[]);A(this,"watermarks",[]);A(this,"clockWidgets",[]);A(this,"cropMode");A(this,"mediaProcessMode");this.taskProfile=c}}class ic{constructor(c,e,t){A(this,"userId");A(this,"streamType");A(this,"sourceType");this.userId=c,this.streamType=e,this.sourceType=t}}class rc{constructor(c,e,t,i=0,r=16777215,n=tr.NOTO_SERIF_CJKSC_REGULAR){A(this,"x");A(this,"y");A(this,"fontSize");A(this,"zOrder");A(this,"fontColor");A(this,"fontType");this.x=c,this.y=e,this.fontSize=t,this.zOrder=i,this.fontColor=r,this.fontType=n}toJson(c,e){return{x:Bt(this.x,c),y:Bt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:yn(this.fontColor),zorder:this.zOrder}}}var sc=(s=>(s[s.NOT_DISPLAY=0]="NOT_DISPLAY",s[s.ALWAYS=1]="ALWAYS",s[s.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",s))(sc||{});class Nn{constructor(c,e,t,i,r,n=0,o=1,a=1){A(this,"url");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"alpha");A(this,"display",1);A(this,"zOrder");this.url=c,this.x=e,this.y=t,this.width=i,this.height=r,this.zOrder=n,this.alpha=o,this.display=a}toJson(c,e){return{url:this.url,alpha:this.alpha,display:this.display,x:Bt(this.x,c),y:Bt(this.y,e),width:Bt(this.width,c),height:Bt(this.height,e),zorder:this.zOrder}}}A(Nn,"DisplayType",sc);class nc{constructor(c,e,t,i,r=0,n=16777215,o=tr.NOTO_SERIF_CJKSC_REGULAR){A(this,"text");A(this,"x");A(this,"y");A(this,"fontSize");A(this,"zOrder");A(this,"fontColor");A(this,"fontType");this.text=c,this.x=e,this.y=t,this.fontSize=i,this.zOrder=r,this.fontColor=n,this.fontType=o}toJson(c,e){return{text:this.text,x:Bt(this.x,c),y:Bt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:yn(this.fontColor),zorder:this.zOrder}}}class ac{constructor(c,e,t,i,r,n=0,o){A(this,"userId");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"zOrder");A(this,"sourceType");A(this,"segmentType",er.LiveTranscodingNoBody);A(this,"images",[]);A(this,"texts",[]);typeof c=="number"?this.userId=c.toString():this.userId=c,this.x=e,this.y=t,this.width=i,this.height=r,this.zOrder=n,o&&(this.sourceType=o)}toJson(c,e,t,i){const r={paneid:c,majorpane:0,x:Bt(this.x,e),y:Bt(this.y,t),width:Bt(this.width,e),height:Bt(this.height,t),zorder:this.zOrder,userid:this.userId,images:this.images.map(n=>n.toJson(e,t)),texts:this.texts.map(n=>n.toJson(e,t))};return this.sourceType&&Qi[this.sourceType]?r.sourcetype=Qi[this.sourceType]:r.sourcetype=Qi[Oi.LiveTranscodingCamera],this.segmentType&&i===Pr.LiveTranscodingVirtualBackground?r.segmenttype=this.segmentType:r.segmenttype=er.LiveTranscodingNoBody,r}}class Rh extends Fi{constructor(){super("AliRtcScreenStandardize",Qe.AliRtcSdkStreamTypeScreen);A(this,"canvas");A(this,"lastWidth");A(this,"lastHeight");A(this,"hasScreenTrack",!1)}get initOptions(){return{base:4}}setOptions(e){this.options=e}isSupported(){return!(typeof TransformStream=="undefined"||typeof MediaStreamTrackProcessor=="undefined"||typeof MediaStreamTrackGenerator=="undefined")}updateProcessCanvas(e,t){if(this.canvas&&this.lastWidth===e&&this.lastHeight===t)return;const i=Math.ceil(e/this.options.base)*this.options.base,r=Math.ceil(t/this.options.base)*this.options.base;if(this.canvas||(this.canvas=document.createElement("canvas")),this.canvas.width=i,this.canvas.height=r,this.lastWidth&&e>this.lastWidth||this.lastHeight&&t>this.lastHeight){const n=this.canvas.getContext("2d");n&&n.clearRect(0,0,i,r)}this.lastWidth=e,this.lastHeight=t}shouldUpdate(e){return this.hasScreenTrack!==(!!e.originVideoTrack&&e.videoSource===Ri.Screen)}handleFrame(e,t){return H(this,null,function*(){var o;const{displayWidth:i,displayHeight:r}=e;if(!i||!r||i%this.options.base===0&&r%this.options.base===0)return this.clear(t),e;this.updateProcessCanvas(i,r);const n=(o=this.canvas)==null?void 0:o.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,i,r);const a=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),a}return e})}process(e){return H(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==Ri.Screen){this.clear(e),this.hasScreenTrack=!1;return}const t=new MediaStreamTrackProcessor({track:e.originVideoTrack}),i=new MediaStreamTrackGenerator({kind:"video"}),r=new MediaStream([i]),n=this,o=new TransformStream({transform(g,f){return H(this,null,function*(){const d=yield n.handleFrame(g,e);yield f.enqueue(d),d==null||d.close()})}});t.readable.pipeThrough(o).pipeTo(i.writable);const a=(h=r.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(a),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}var kh=Object.defineProperty,Th=Object.getOwnPropertyDescriptor,ve=(s,c,e,t)=>{for(var i=t>1?void 0:t?Th(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&kh(c,e,i),i};const me=(xe=class extends we{constructor(e){super();A(this,"channelProfile");A(this,"clientRole");A(this,"signalingManager");A(this,"bizControl");A(this,"liveTranscoding");A(this,"maxSignalingConnectRetryCount");A(this,"slsReporter");A(this,"connectState",Ne.AliRtcConnectionStatusInit);A(this,"networkError",!1);A(this,"audioMixerPlugin");A(this,"dualVideoPlugin");A(this,"_audioOnlyMode",!1);A(this,"_authInfoWillExpireTimer",null);A(this,"_authInfoExpiredTimer",null);A(this,"_serverCheckAuthInfoTimestamp",null);A(this,"_localCheckAuthInfoTimestamp",null);const t=Date.now();this.slsReporter=new Zi(this),this.channelProfile=Xt.AliRtcSdkCommunication,this.clientRole=ni.AliRtcSdkLive,this.liveTranscoding=new mh(this.slsReporter),this.signalingManager=new Hu(this.channelProfile,this.clientRole,this.slsReporter,(e==null?void 0:e.env)===Jt.pre?Jt.pre:Jt.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.bizControl=new wt({slsReporter:this.slsReporter,signalingManager:this.signalingManager}),this.addBizControlListeners(),this.addPublisherListeners(),this.audioMixerPlugin=new xh,this.enablePlugin(this.audioMixerPlugin),this.dualVideoPlugin=new Ih("dualVideoPlugin"),this.enablePlugin(new Rh),this.slsReporter.reportSDKCreated(t)}static getSdkVersion(){return ns}static setLogLevel(e){le.setLogLevel(e)}static getInstance(e){return xe._instance||(xe._instance=new xe(e)),xe._instance}destroy(){xe._instance=void 0}get channel(){return this.bizControl.channel}get userId(){return this.bizControl.userId}get remoteUsers(){return this.bizControl.remoteUsers}get publisher(){return this.bizControl.publisher}get publishAudioStream(){var e;return(e=this.publisher)==null?void 0:e.publishStreams.audio}get isPublishing(){const{publisher:e}=this.bizControl;return e?e.isPublishing:!1}get currentRoleCanPublish(){return this.channelProfile===Xt.AliRtcSdkCommunication||this.clientRole===ni.AliRtcSdkInteractive}resetState(){return H(this,null,function*(){yield this.bizControl.clear(),this.connectState=Ne.AliRtcConnectionStatusDisconnected,this.networkError=!1,this.signalingManager.reset(),this.liveTranscoding.clear(),this.slsReporter.stop(),yield this.publishLocalAudioStream(!0),yield this.publishLocalVideoStream(!0),yield this.publishLocalScreenShareStream(!0)})}stopPublish(e){return H(this,null,function*(){var t,i,r;e?yield(t=this.publisher)==null?void 0:t.stopLocalStream(e):(yield(i=this.publisher)==null?void 0:i.publishStop(),(r=this.publisher)==null||r.stopPreview())})}addPublisherListeners(){var e,t,i,r,n,o,a,u,h;(e=this.publisher)==null||e.on(dt.Local,g=>{le.event("[Publisher] Device Status Change",g),this.onLocalDeviceStatusChange(g)}),(t=this.publisher)==null||t.on(Ei.VideoTrackEnded,()=>{le.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeCamera,$e.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(i=this.publisher)==null||i.on(Ei.ScreenTrackEnded,()=>{le.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeDisplay,$e.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(r=this.publisher)==null||r.on(Ei.AudioTrackEnded,()=>{le.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeMic,$e.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(g,f,d="")=>{this.emit("localDeviceException",g,f,d)}),(o=this.publisher)==null||o.on("audioPublishStateChanged",(g,f,d)=>{var p;this.emit("audioPublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")}),(a=this.publisher)==null||a.on("videoPublishStateChanged",(g,f,d)=>{var p;this.emit("videoPublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(g,f,d)=>{var p;this.emit("dualStreamPublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(g,f,d)=>{var p;this.emit("screenSharePublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")})}addBizControlListeners(){this.bizControl.rtsManager.on("disconnected",()=>H(this,null,function*(){le.event(`[${xe.logName}]`,"RTS Disconnected"),(yield Ut.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.bizControl.rtsManager.on("subscribeexceeds",()=>H(this,null,function*(){yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList()})),this.bizControl.rtsManager.on("seimessage",(e,t,i)=>{const r=this.remoteUsers.find(n=>n.streamUrl===e);r&&this.emit("mediaExtensionMsgReceived",r.userId,i,t)}),this.bizControl.on(dt.Remote,(e,t)=>{le.event(`[${xe.logName}]`,"RemoteUser Device Status Change",e,t)}),this.bizControl.on("remoteTrackAvailableChange",(e,t,i)=>{this.emit("remoteTrackAvailableNotify",e,t,i)}),this.bizControl.on("audioSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("audioSubscribeStateChanged",e,t,i,r,n)}),this.bizControl.on("videoSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("videoSubscribeStateChanged",e,t,i,r,n)}),this.bizControl.on("screenSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("screenShareSubscribeStateChanged",e,t,i,r,n)}),this.bizControl.on("userAudioMuted",(e,t)=>{this.emit("userAudioMuted",e,t)}),this.bizControl.on("userVideoMuted",(e,t)=>{this.emit("userVideoMuted",e,t)}),this.bizControl.on("userScreenMuted",(e,t)=>{this.emit("userScreenMuted",e,t)}),this.bizControl.on("audioVolume",e=>{this.emit("audioVolume",e)}),this.bizControl.on("remoteAudioAutoPlayFail",e=>{this.emit("remoteAudioAutoPlayFail",e)}),this.bizControl.on("remoteVideoAutoPlayFail",(e,t)=>{this.emit("remoteVideoAutoPlayFail",e,t)}),this.bizControl.on("rtcStats",e=>{this.emit("rtcStats",e)}),this.bizControl.on("rtcLocalAudioStats",e=>{this.emit("rtcLocalAudioStats",e)}),this.bizControl.on("rtcLocalVideoStats",e=>{this.emit("rtcLocalVideoStats",e)}),this.bizControl.on("rtcRemoteAudioStats",e=>{this.emit("rtcRemoteAudioStats",e)}),this.bizControl.on("rtcRemoteVideoStats",e=>{this.emit("rtcRemoteVideoStats",e)}),this.bizControl.on("remoteSubscribeError",e=>{this.emit("onOccurError",e),this.slsReporter.reportError(e)})}addSignalingManagerListeners(){this.signalingManager.on("onKeepAliveRsp",()=>{this.networkError&&(le.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{le.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{le.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.bizControl.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{le.event("[Signaling] Notify Leave ",e),e.forEach(t=>{this.emit("remoteUserOffLineNotify",t.userid,t.leavecode),this.bizControl.removeLeftUser(t)})}),this.signalingManager.on("onBye",(e,t)=>{le.event("[Signaling] Bye ",e,t),this.slsReporter.reportError({message:`reason: ${e}, description: ${t}`}),this.emit("bye",e),this.leaveChannel(!0),this.slsReporter.reportBye(e)}),this.signalingManager.on("onConnectFail",e=>{le.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=Ne.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusFailed,yi.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{this.slsReporter.reportWarning("signaling network error"),le.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{le.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{le.event("[Signaling] Reconnect Start "),this.connectState=Ne.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusReconnecting,yi.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{le.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{this.slsReporter.reportWarning("signaling reconnect fail: ${err.code}"),le.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{this.slsReporter.reportWarning("signaling error: ${err.message}"),le.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=Ne.AliRtcConnectionStatusDisconnected,(e=this.publisher)!=null&&e.isPublishing&&((t=this.publisher)==null||t.clearPublishState()),this.networkError=!1}handleUsersJoin(e){e.forEach(t=>{const i=t.userid;if(i){const r=this.bizControl.addUser(i,t.displayname,Ve.Join);le.event(`[${xe.logName}]`,Me.UserJoined,r)}})}onLocalDeviceStatusChange(e){le.event(`[${xe.logName}]`,dt.Local,e),this.signalingManager.reportStatus(e).then(()=>{le.debug("[signaling] reportStatus suc")}).catch(t=>{le.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return H(this,null,function*(){var e;try{yield(e=this.publisher)==null?void 0:e.resumePublish()}catch(t){const{code:i}=t;if(i===10205){let n=1;try{yield new Promise((o,a)=>{const u=setInterval(()=>H(this,null,function*(){var h;n>1&&(clearInterval(u),a()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),o()}catch(g){const{code:f}=g;f!==10205&&(clearInterval(u),a())}}),1e3)})}catch(o){}}}})}onNetworkRecovery(e){return H(this,null,function*(){var t;le.event(xe.logName,"onNetworkRecovery",{users:e}),this.networkError&&(this.networkError=!1,(t=this.publisher)==null||t.reportSelfDeviceStatus(),!this.bizControl.rtsManager.isConnected&&this.bizControl.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.connectState=Ne.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusConnected,yi.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return H(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:i,presentList:r}=this.bizControl.updateUsers(e);le.info(`[${xe.logName}]`,"resumeSubList",{joinList:t,leaveList:i,presentList:r}),this.handleUsersJoin(t),i.forEach(n=>{le.event(xe.logName,Me.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,wn.AliRtcUserOfflineQuit)});for(let n=0;n<r.length;n++){const o=r[n],a=o.userid,u=this.bizControl.getRemoteUser(a);this.bizControl.onRemotePublishStateChange(o),u==null||u.restore(),u==null||u.updateSubscribe(Ve.Resume)}}else for(let t=0;t<this.remoteUsers.length;t++){const i=this.remoteUsers[t];try{i.restore(),i.updateSubscribe(Ve.Resume)}catch(r){}}})}onNetworkError(){this.connectState===Ne.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=Ne.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusDisconnected,yi.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.slsReporter.reportError(e),le.event(xe.logName,Me.Error,e)}setEnableDualVideoStream(e,t){t&&this.dualVideoPlugin.setOptions(t);const i=this.bizControl.pluginManager.has(this.dualVideoPlugin.name);e?!i&&this.enablePlugin(this.dualVideoPlugin):i&&this.removePlugin(this.dualVideoPlugin.name)}hadPushStream(e){if(!(this.publisher&&e))throw new ce(de.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![Ne.AliRtcConnectionStatusInit,Ne.AliRtcConnectionStatusDisconnected,Ne.AliRtcConnectionStatusFailed].includes(this.connectState))throw new ce(de.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===Xt.AliRtcSdkCommunication&&(this.clientRole=ni.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}setClientRole(e){return H(this,null,function*(){var t,i,r,n,o;try{if(this.channelProfile===Xt.AliRtcSdkCommunication)return;if(!Object.values(ni).includes(e))throw new ce(de.ERR_INVALID_ARGUMENTS,`set client role error, role value(${e}) is invalid`);if(this.clientRole===e)return;this.slsReporter.reportRoleUpdate(this.clientRole,e),this.isInCall()?this.clientRole===ni.AliRtcSdkInteractive?(this.bizControl.isSubscribing?(yield this.stopPublish(),yield(t=this.publisher)==null?void 0:t.clearStream()):yield(i=this.publisher)==null?void 0:i.unPublish(),yield this.signalingManager.setClientRole(e)):(yield this.signalingManager.setClientRole(e),yield this.startDefaultDevicesCapture(),(r=this.publisher)!=null&&r.isPublishing||(yield(n=this.publisher)==null?void 0:n.startPublish()),yield(o=this.publisher)==null?void 0:o.previewAll()):yield this.signalingManager.setClientRole(e),this.clientRole=e}catch(a){throw a.code===403&&this.emit("authInfoExpired"),a}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new ce(de.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new ce(de.ERR_INNER,"can not change audioRedEnabled in call");this.bizControl.setAudioRedEnabled(e)}setCheckAuthInfoTimer(e,t){const i=(e-t)*1e3;this._authInfoExpiredTimer=window.setTimeout(()=>{this.emit("authInfoExpired")},i),this._authInfoWillExpireTimer=window.setTimeout(()=>{this.emit("authInfoWillExpire")},i-3e4),this._serverCheckAuthInfoTimestamp=t,this._localCheckAuthInfoTimestamp=+Date.now()/1e3}clearCheckAuthInfoTimer(){this._authInfoExpiredTimer&&window.clearTimeout(this._authInfoExpiredTimer),this._authInfoWillExpireTimer&&window.clearTimeout(this._authInfoWillExpireTimer)}startDefaultDevicesCapture(){return H(this,null,function*(){var i,r;let e=[],t;try{this._audioOnlyMode||(e=yield xe.getCameraList(),e.length||le.warn(`${[xe.logName]}`,"No media neither devices can be captured")),t=yield xe.getMicrophoneList(),t.length||le.warn(`${[xe.logName]}`,"No media neither devices can be captured");const{hasCamera:n,hasMicrophone:o,hasScreenShare:a,audioCaptureDisabled:u,publishLocalAudioStreamEnabled:h,publishLocalVideoStreamEnabled:g}=(i=this.publisher)!=null?i:{};if(n||o||a)return;!n&&g&&!this._audioOnlyMode&&e.length&&!((r=this.publisher)!=null&&r.cameraCaptureDisabled)&&(yield this.enableLocalVideo(!0)),!o&&h&&!u&&t.length&&(yield this.startAudioCapture())}catch(n){throw n}})}joinChannel(e,t,i,r){return H(this,null,function*(){var h,g,f,d,p,l,m,x,v,b;let n=r,o;if(typeof e=="string"){n=r;try{const w=JSON.parse(window.atob(e));if(o={appId:w.appid,channelId:w.channelid,userId:w.userid,timestamp:w.timestamp,nonce:w.nonce,token:w.token},o.channelId!==t)throw new Error("channelId is not equal");if(o.userId!==i)throw new Error("userId is not equal")}catch(w){throw new ce(de.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${w.message||""}`)}}else o=e,n=t;const a={start:Date.now()};let u=Mn.checkAuthInfo(o);if(Ne.AliRtcConnectionStatusInit===this.connectState||Ne.AliRtcConnectionStatusDisconnected===this.connectState||Ne.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=Ne.AliRtcConnectionStatusConnecting,u)throw this.connectState=Ne.AliRtcConnectionStatusFailed,this.slsReporter.reportJoin(u.code,a,""),this.slsReporter.reportJoinResult(u),u;o.sessionId=Ut.createCallid("web"),le.setSessionID(o.appId,o.sessionId),this.slsReporter.start(o);try{const C=yield this.signalingManager.join(o,n,this.maxSignalingConnectRetryCount,a);this.connectState=Ne.AliRtcConnectionStatusConnected,(h=this.publisher)==null||h.reportSelfDeviceStatus(),this.bizControl.init(o,C),this.setCheckAuthInfoTimer(o.timestamp,C.timestamp),this.liveTranscoding.setAuthInfo(o),this.slsReporter.reportJoin(0,a,C.tid),this.slsReporter.reportJoinResult(null)}catch(C){const E=(g=C.code)!=null?g:-1,I=C.reason||C.message||"";throw this.connectState=Ne.AliRtcConnectionStatusDisconnected,this.slsReporter.reportJoin(E,a,""),this.slsReporter.reportJoinResult(C),new ce(E,I)}let w=!1,_=!1;try{this.currentRoleCanPublish&&(yield this.startDefaultDevicesCapture(),w=!!((f=this.publisher)!=null&&f.publishStreams.audio),_=!!((d=this.publisher)!=null&&d.publishStreams.video)||!!((p=this.publisher)!=null&&p.publishStreams.videoSmall)||!!((l=this.publisher)!=null&&l.publishStreams.screen),Object.values((x=(m=this.publisher)==null?void 0:m.publishStreams)!=null?x:{}).some(C=>C)&&(yield(v=this.publisher)==null?void 0:v.startPublish(!1,di.JOINCHANNEL),yield(b=this.publisher)==null?void 0:b.previewAll())),this.remoteUsers.forEach(C=>{C.updateSubscribe(Ve.Join)})}catch(C){w&&this.emit("onOccurError",new ce(de.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED,`join channel auto publish audio stream failed, ${C.message||""}`)),_&&this.emit("onOccurError",new ce(de.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED,`join channel auto publish video stream failed, ${C.message||""}`))}}else{const w=new ce(de.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===Ne.AliRtcConnectionStatusConnecting&&(w.message="Repeated operation during login"),this.slsReporter.reportJoin(w.code,a,""),w}})}leaveChannel(e=!1){return H(this,null,function*(){var i;this.slsReporter.reportLeaveInvoked();let t=new Date().getTime();if(Ne.AliRtcConnectionStatusConnected===this.connectState)try{let r;e||(r=yield this.signalingManager.leave()),this.clearCheckAuthInfoTimer(),yield this.resetState(),this.slsReporter.reportLeave(new Date().getTime()-t,0,(i=r==null?void 0:r.tid)!=null?i:""),le.uploadLog();return}catch(r){throw this.slsReporter.reportLeave(new Date().getTime()-t,r.code,r.reason),r}else{yield this.resetState(),this.slsReporter.reportLeave(0,0,"");return}})}isInCall(){return this.connectState===Ne.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return H(this,null,function*(){const{userId:t,nonce:i,timestamp:r,token:n,role:o}=e,a={userId:t,nonce:i,timestamp:r,token:n,role:o};try{yield this.signalingManager.refreshAuthInfo(a),this.bizControl.refreshAuthInfo(a),this.liveTranscoding.refreshAuthInfo(a),this.clearCheckAuthInfoTimer(),this._serverCheckAuthInfoTimestamp&&this._localCheckAuthInfoTimestamp&&e.timestamp&&this.setCheckAuthInfoTimer(e.timestamp,this._serverCheckAuthInfoTimestamp+(Date.now()-this._localCheckAuthInfoTimestamp))}catch(u){throw u}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return H(this,null,function*(){var t,i,r;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===Ne.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasMicrophone?yield(r=this.publisher)==null?void 0:r.publishUpdate():yield this.startAudioCapture():yield this.stopPublish({audio:!0}))})}isLocalAudioStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalAudioStreamEnabled)!=null?t:!0}setDefaultSubscribeAllRemoteAudioStreams(e){this.bizControl.setAutoSubAudio(e)}subscribeAllRemoteAudioStreams(e){this.bizControl.setWantSubAudio(e)}subscribeRemoteAudioStream(e,t){if(t&&!this.bizControl.isWantSubAudio)throw new ce(de.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.bizControl.updateAudioWant(e,t)}resumeRemoteAudioStream(e){const t=this.bizControl.getRemoteUser(e);t&&t.resumeAudio()}publishLocalVideoStream(e){return H(this,null,function*(){var t,i,r;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===Ne.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasCamera?yield(r=this.publisher)==null?void 0:r.publishUpdate():yield this.enableLocalVideo():yield this.stopPublish({video:!0}))})}isLocalVideoStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?t:!0}setRemoteDefaultVideoStreamType(e){[rt.AliRtcVideoStreamTypeHigh,rt.AliRtcVideoStreamTypeLow].includes(e)&&this.bizControl.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[rt.AliRtcVideoStreamTypeHigh,rt.AliRtcVideoStreamTypeLow].includes(t)&&this.bizControl.setRemoteUserVideoStreamType(e,t)}setDefaultSubscribeAllRemoteVideoStreams(e){this.bizControl.setAutoSubVideo(e),this.bizControl.setAutoSubScreen(e)}subscribeAllRemoteVideoStreams(e){this.bizControl.setWantSubVideo(e),this.bizControl.setWantSubScreen(e)}subscribeRemoteMediaStream(e,t,i,r){const n=this.bizControl.getRemoteUser(e);if(!n)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i&&(t===ke.AliRtcVideoTrackScreen||t===ke.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),i&&(t===ke.AliRtcVideoTrackCamera||t===ke.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(r),n.updateSubscribe(Ve.User)}resumeRemoteMediaStream(e,t){const i=this.bizControl.getRemoteUser(e);i&&i.resumeVideo(t)}getOnlineRemoteUsers(){return this.bizControl.remoteUsers.map(e=>e.userId)}getUserInfo(e){var t;return(t=this.bizControl.getRemoteUser(e))==null?void 0:t.remoteUserInfo}isUserOnline(e){return!!this.bizControl.remoteUsers.find(t=>t.userId===e)}startScreenShare(e){return H(this,null,function*(){var o;const t={video:!1,audio:!1},{audio:i=!1,videoTrack:r,audioTrack:n}=e||{};if(r||n){t.screen=!0;const a=new MediaStream;r&&a.addTrack(r),n&&a.addTrack(n),t.mediaStream=a}else t.screen=i?{audio:!0}:!0;yield(o=this.publisher)==null?void 0:o.createLocalStream(t)})}stopScreenShare(){return H(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return H(this,null,function*(){var r;const{frameRate:t=sr.frameRate,bitrate:i=sr.maxBitrate}=e;yield(r=this.publisher)==null?void 0:r.setScreenProfile(Wo,{width:sr.width,height:sr.height,frameRate:t,maxBitrate:i})})}setScreenShareContentHint(e){return H(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return H(this,null,function*(){var i,r,n;(i=this.publisher)==null||i.setPublishLocalScreenStreamEnabled(e),this.connectState===Ne.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasScreenShare?yield(n=this.publisher)==null?void 0:n.publishUpdate():yield this.startScreenShare(t):yield this.stopPublish({screen:!0}))})}isScreenSharePublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalScreenStreamEnabled)!=null?t:!0}setAudioShareVolume(e){if(typeof e!="number")throw new ce(de.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({screen:Math.max(0,Math.min(e,400))/100})}enableAudioVolumeIndication(e){this.bizControl.enableAudioVolumeIndication(e)}muteLocalMic(e=!1){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Me.MuteAudio:Me.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const i=this.bizControl.getRemoteUser(e);if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.bizControl.setAudioMuted(e)}startAudioCapture(e){return H(this,null,function*(){var i;const t={audio:e||!0};yield(i=this.publisher)==null?void 0:i.createLocalStream(t)})}stopAudioCapture(){var e;(e=this.publisher)==null||e.stopAudioCapture()}switchMicrophone(e,t){return H(this,null,function*(){var i,r,n,o;if(yield(i=this.publisher)==null?void 0:i.setMicrophoneDeviceId(e),!((r=this.publisher)!=null&&r.audioCaptureDisabled)){if(t){yield(n=this.publisher)==null?void 0:n.createLocalStream({audio:!0,mediaStream:new MediaStream([t])});return}yield(o=this.publisher)==null?void 0:o.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new ce(de.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({audio:Math.max(0,Math.min(e,400))/100})}setPlayoutVolume(e){if(typeof e!="number")throw new ce(de.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setPlayoutVolume(Math.max(0,Math.min(e,100))/100)}setRemoteAudioVolume(e,t){const i=this.bizControl.getRemoteUser(e);if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new ce(de.ERR_INVALID_ARGUMENTS,"volume must be a number");i.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return H(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return H(this,null,function*(){var i;if(!e)return(i=this.publisher)==null?void 0:i.audioTrack;const t=this.bizControl.getRemoteUser(e);return t==null?void 0:t.getAudioTrack})}setLocalViewConfig(e,t){return H(this,null,function*(){var i,r,n;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot set local view in audio only mode");(i=this.bizControl)==null||i.setLocalViewConfig(e,t),t===ke.AliRtcVideoTrackCamera&&((r=this.publisher)!=null&&r.hasCamera)?yield this.startPreview():t===ke.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return H(this,null,function*(){var u,h,g;const{width:t=rr.width,height:i=rr.height,frameRate:r=rr.frameRate,bitrate:n=rr.maxBitrate,cameraDirection:o,deviceId:a}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(jo,{width:t,height:i,frameRate:r,maxBitrate:n}),o!==void 0&&((h=this.publisher)==null||h.setCameraDirection(o)),a&&((g=this.publisher)==null||g.setCameraDeviceId(a))})}setCameraCapturerContentHint(e){return H(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return H(this,null,function*(){var t,i,r,n,o,a,u,h,g,f,d;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot enable local video in audio only mode");if(e){(i=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&i.video&&((o=(n=(r=this.publisher)==null?void 0:r.publishStreams)==null?void 0:n.video)==null||o.disableVideo(),(g=(h=(u=(a=this.publisher)==null?void 0:a.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||g.stop());const p={video:!0};yield(f=this.publisher)==null?void 0:f.startCameraCapture(p)}else yield(d=this.publisher)==null?void 0:d.stopCameraCapture()})}muteLocalCamera(e){return H(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Me.MuteVideo:Me.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return H(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Me.MuteScreen:Me.UnmuteScreen),(t=this.publisher)==null||t.muteLocalScreen(e)})}setRemoteViewConfig(e,t,i){this.bizControl.setRemoteViewConfig(t,e,i)}isCameraOn(){var e,t;return(t=(e=this.publisher)==null?void 0:e.hasCamera)!=null?t:!1}switchCamera(e,t){return H(this,null,function*(){var r,n,o,a,u,h,g,f,d,p,l,m,x;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot switch camera in audio only mode");const i={};if(e?(i.deviceId=e,this.slsReporter.reportSwitchCamera(e)):(i.cameraDirection=((r=this.publisher)==null?void 0:r.cameraDirection)==="environment"?ir.CAMERA_FRONT:ir.CAMERA_REAR,this.slsReporter.reportSwitchCamera(((n=this.publisher)==null?void 0:n.cameraDirection)||"")),yield this.setCameraCapturerConfiguration(i),!((o=this.publisher)!=null&&o.cameraCaptureDisabled)){(u=(a=this.publisher)==null?void 0:a.publishStreams)!=null&&u.video&&((f=(g=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:g.video)==null||f.disableVideo(),(m=(l=(p=(d=this.publisher)==null?void 0:d.publishStreams)==null?void 0:p.video)==null?void 0:l.videoTrack)==null||m.stop());const v={video:!0};t&&(v.mediaStream=new MediaStream([t])),yield(x=this.publisher)==null?void 0:x.createLocalStream(v)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return H(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot start preview camera in audio only mode");(e=this.publisher)!=null&&e.hasCamera||(yield this.enableLocalVideo(!0)),yield(t=this.publisher)==null?void 0:t.previewAll({screen:!1})})}startPreviewScreen(e){return H(this,null,function*(){var t,i;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot start preview screen share in audio only mode");(t=this.publisher)!=null&&t.hasScreenShare||(yield this.startScreenShare(e)),yield(i=this.publisher)==null?void 0:i.previewAll({primary:!1})})}stopPreview(){return H(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return H(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return H(this,null,function*(){var n,o,a,u;const{userId:t,streamType:i}=e;if(!t)return i===Qe.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(o=this.publisher)==null?void 0:o.screenTrack;const r=this.bizControl.getRemoteUser(t);return i===Qe.AliRtcSdkStreamTypeCapture?(a=r==null?void 0:r.getCameraStream)==null?void 0:a.videoTrack:(u=r==null?void 0:r.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return H(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return H(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return H(this,null,function*(){return this.liveTranscoding.stopPublishLiveStream(e)})}stopPublishLiveStreamWithTaskId(e){return this.liveTranscoding.stopPublishLiveStreamWithTaskId(e)}setEnableMediaExtensionMsg(e){var t;(t=this.bizControl)==null||t.setEnableMediaExtensionMsg(!!e)}sendMediaExtensionMsg(e,t){return H(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,i){return H(this,null,function*(){var r;if(!this.publisher||!this.isPublishing)throw new ce(de.ERR_INNER,"you should publish first");return this.slsReporter.reportSEIMessage(i,e.byteLength,t,0,!1),(r=this.publisher)==null?void 0:r.sendSEI(e,t,i)})}enablePlugin(e,t){this.bizControl.pluginManager.add(e,t)}removePlugin(e){this.bizControl.pluginManager.remove(e)}setPluginOption(e,t){const i=this.bizControl.pluginManager.get(e);i&&t&&i.setOptions(t)}getPluginOption(e){const t=this.bizControl.pluginManager.get(e);return t==null?void 0:t.getOptions()}isBeautyAvailable(){return this.bizControl.pluginManager.has("AliRtcBeauty")}isBeautyEnabled(){const e=this.bizControl.pluginManager.get("AliRtcBeauty");if(!e)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");return!!(e!=null&&e.isEnable)}setBeautyEffect(e,t){const i=this.bizControl.pluginManager.get("AliRtcBeauty");if(!i)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");e?i.enable():i.disable(),i.setOptions({basicBeauty:{skinBuffing:Math.max(Math.min(1,+t.smoothnessLevel),0),whitening:Math.max(Math.min(1,+t.whiteningLevel),0)}})}enableBackgroundExchange(e,t){const i=this.bizControl.pluginManager.get("AliRtcBeauty");if(!i||!i.isEnable)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const r={setSegmentBackgroundImage:{backgroundImgUrl:e?t:""}};e&&(r.segmentBackgroundProcess={enable:!1}),i.setOptions(r)}enableBackgroundBlur(e){const t=this.bizControl.pluginManager.get("AliRtcBeauty");if(!t||!t.isEnable)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const i={segmentBackgroundProcess:{type:0,enable:e}};e&&(i.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(i)}},A(xe,"logName","AliRtcEngine"),A(xe,"logError",!0),A(xe,"isSupported",Du),A(xe,"isDualVideoStreamSupported",Ln.isSupport),A(xe,"getCameraList",()=>H(xe,null,function*(){return(yield ye.AliRTS.getCameraList()).filter(t=>t.deviceId)})),A(xe,"getMicrophoneList",()=>H(xe,null,function*(){return(yield ye.AliRTS.getMicList()).filter(t=>t.deviceId)})),A(xe,"getSpeakerList",()=>H(xe,null,function*(){return(yield ye.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),A(xe,"_instance"),A(xe,"AliRtcSdkChannelProfile",Xt),A(xe,"AliRtcSdkClientRole",ni),A(xe,"AliRtcVideoStreamType",rt),A(xe,"AliRtcVideoTrack",ke),A(xe,"AliRtcAudioTrack",Vi),A(xe,"AliRtcPublishState",Ee),A(xe,"AliRtcSubscribeState",He),A(xe,"AliRtcRawDataStreamType",Qe),A(xe,"AliRtcLogLevel",mn),A(xe,"AliRtcEngineLocalDeviceType",jt),A(xe,"AliRtcEngineLocalDeviceExceptionType",$e),A(xe,"AliRtcConnectionStatus",Ne),A(xe,"AliRtcConnectionStatusChangeReason",yi),A(xe,"AliRtcPlugin",Fi),A(xe,"AliRtcPluginTrackType",Dr),A(xe,"AliRtcLiveTranscodingParam",Lr),A(xe,"AliRtcLiveTranscodingEncodeParam",_n),A(xe,"AliRtcLiveTranscodingMixParam",tc),A(xe,"AliRtcLiveTranscodingSingleParam",ic),A(xe,"AliRtcTranscodingClockWidget",rc),A(xe,"AliRtcTranscodingImage",Nn),A(xe,"AliRtcTranscodingText",nc),A(xe,"AliRtcTranscodingUser",ac),A(xe,"AliRtcLiveTranscodingMixMode",Yi),A(xe,"AliRtcLiveTranscodingStreamType",gn),A(xe,"AliRtcLiveTranscodingSourceType",Oi),A(xe,"AliRtcLiveTranscodingTaskProfile",vn),A(xe,"AliRtcLiveTranscodingAudioSampleRate",Br),A(xe,"AliRtcLiveTranscodingSegmentType",er),A(xe,"AliRtcLiveTranscodingFontType",tr),A(xe,"AliRtcLiveTranscodingCropMode",xn),A(xe,"AliRtcLiveTranscodingMediaProcessMode",Pr),A(xe,"AliRtcLiveTranscodingState",bn),A(xe,"AliRtcLiveTranscodingErrorCode",zt),A(xe,"AliRtcTrascodingPublishTaskStatus",Sn),A(xe,"Plugin",Fi),xe);ve([j()],me.prototype,"destroy",1),ve([j()],me.prototype,"resetState",1),ve([j(ue)],me.prototype,"stopPublish",1),ve([j()],me.prototype,"backToUnpublishStatus",1),ve([j()],me.prototype,"resumePublishForNetworkRecovery",1),ve([j()],me.prototype,"onNetworkRecovery",1),ve([j()],me.prototype,"resumeSubList",1),ve([j(ue)],me.prototype,"setEnableDualVideoStream",1),ve([j(ue)],me.prototype,"setChannelProfile",1),ve([j(ue)],me.prototype,"setClientRole",1),ve([j(ue)],me.prototype,"setAudioOnlyMode",1),ve([j()],me.prototype,"clearCheckAuthInfoTimer",1),ve([j(ue)],me.prototype,"joinChannel",1),ve([j(ue)],me.prototype,"leaveChannel",1),ve([j(ue)],me.prototype,"refreshAuthInfo",1),ve([j(ue)],me.prototype,"publishLocalAudioStream",1),ve([j(ue)],me.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),ve([j(ue)],me.prototype,"subscribeAllRemoteAudioStreams",1),ve([j(ue)],me.prototype,"subscribeRemoteAudioStream",1),ve([j(ue)],me.prototype,"resumeRemoteAudioStream",1),ve([j(ue)],me.prototype,"publishLocalVideoStream",1),ve([j(ue)],me.prototype,"setRemoteDefaultVideoStreamType",1),ve([j(ue)],me.prototype,"setRemoteUserVideoStreamType",1),ve([j(ue)],me.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),ve([j(ue)],me.prototype,"subscribeAllRemoteVideoStreams",1),ve([j(ue)],me.prototype,"subscribeRemoteMediaStream",1),ve([j(ue)],me.prototype,"resumeRemoteMediaStream",1),ve([j(([s])=>[`${s==null?void 0:s.audio}`])],me.prototype,"startScreenShare",1),ve([j()],me.prototype,"stopScreenShare",1),ve([j(ue)],me.prototype,"setScreenShareConfiguration",1),ve([j(ue)],me.prototype,"setScreenShareContentHint",1),ve([j()],me.prototype,"publishLocalScreenShareStream",1),ve([j(ue)],me.prototype,"setAudioShareVolume",1),ve([j(ue)],me.prototype,"enableAudioVolumeIndication",1),ve([j(ue)],me.prototype,"muteLocalMic",1),ve([j(ue)],me.prototype,"muteRemoteAudioPlaying",1),ve([j(ue)],me.prototype,"muteAllRemoteAudioPlaying",1),ve([j(ue)],me.prototype,"startAudioCapture",1),ve([j()],me.prototype,"stopAudioCapture",1),ve([j(ue)],me.prototype,"switchMicrophone",1),ve([j(ue)],me.prototype,"setRecordingVolume",1),ve([j(ue)],me.prototype,"setPlayoutVolume",1),ve([j(ue)],me.prototype,"setRemoteAudioVolume",1),ve([j(ue)],me.prototype,"setAudioProfile",1),ve([j(ue)],me.prototype,"getAudioTrack",1),ve([j(ue)],me.prototype,"setLocalViewConfig",1),ve([j(ue)],me.prototype,"setCameraCapturerConfiguration",1),ve([j(ue)],me.prototype,"setCameraCapturerContentHint",1),ve([j(ue)],me.prototype,"enableLocalVideo",1),ve([j(ue)],me.prototype,"muteLocalCamera",1),ve([j(ue)],me.prototype,"muteLocalScreen",1),ve([j(ue)],me.prototype,"setRemoteViewConfig",1),ve([j(ue)],me.prototype,"switchCamera",1),ve([j()],me.prototype,"startPreview",1),ve([j()],me.prototype,"startPreviewScreen",1),ve([j()],me.prototype,"stopPreview",1),ve([j()],me.prototype,"stopPreviewScreen",1),ve([j()],me.prototype,"startPublishLiveStream",1),ve([j()],me.prototype,"updatePublishLiveStream",1),ve([j()],me.prototype,"updatePublishLiveStreamWithTaskId",1),ve([j()],me.prototype,"stopPublishLiveStream",1),ve([j()],me.prototype,"stopPublishLiveStreamWithTaskId",1),ve([j(ue)],me.prototype,"setEnableMediaExtensionMsg",1),ve([j(([s,c,e])=>[s.byteLength,c,e])],me.prototype,"sendMediaExtensionMsgEx",1),ve([j(([s,c])=>[s.name||"",c])],me.prototype,"enablePlugin",1),ve([j(ue)],me.prototype,"removePlugin",1),ve([j(ue)],me.prototype,"setPluginOption",1),ve([j(ue)],me.prototype,"getPluginOption",1),ve([j(ue)],me.prototype,"setBeautyEffect",1),ve([j(ue)],me.prototype,"enableBackgroundExchange",1),ve([j(ue)],me.prototype,"enableBackgroundBlur",1),ve([j(ue)],me,"setLogLevel",1);let oc=me;const cc=new is({businessName:"imp-web-rtc",version:(mc=oc.getSdkVersion())!=null?mc:"unknown",env:"prod"});cc.setReady();const Dh=cc.wrap(oc);fe.AliRtcConnectionStatus=Ne,fe.AliRtcConnectionStatusChangeReason=yi,fe.AliRtcEngineLocalDeviceExceptionType=$e,fe.AliRtcEngineLocalDeviceType=jt,fe.AliRtcErrorCode=de,fe.AliRtcLiveTranscodingAudioSampleRate=Br,fe.AliRtcLiveTranscodingCropMode=xn,fe.AliRtcLiveTranscodingEncodeParam=_n,fe.AliRtcLiveTranscodingErrorCode=zt,fe.AliRtcLiveTranscodingFontType=tr,fe.AliRtcLiveTranscodingMediaProcessMode=Pr,fe.AliRtcLiveTranscodingMixMode=Yi,fe.AliRtcLiveTranscodingMixParam=tc,fe.AliRtcLiveTranscodingParam=Lr,fe.AliRtcLiveTranscodingSegmentType=er,fe.AliRtcLiveTranscodingSingleParam=ic,fe.AliRtcLiveTranscodingSourceType=Oi,fe.AliRtcLiveTranscodingState=bn,fe.AliRtcLiveTranscodingStreamType=gn,fe.AliRtcLiveTranscodingTaskProfile=vn,fe.AliRtcLocalStreamInfo=Dn,fe.AliRtcLogLevel=mn,fe.AliRtcPlugin=Fi,fe.AliRtcPluginTrackType=Dr,fe.AliRtcPluginType=Oo,fe.AliRtcPublishState=Ee,fe.AliRtcRawDataStreamType=Qe,fe.AliRtcRemoteUserInfo=Xo,fe.AliRtcSdkChannelProfile=Xt,fe.AliRtcSdkClientRole=ni,fe.AliRtcSubscribeState=He,fe.AliRtcTranscodingClockWidget=rc,fe.AliRtcTranscodingImage=Nn,fe.AliRtcTranscodingText=nc,fe.AliRtcTranscodingUser=ac,fe.AliRtcTrascodingPublishTaskStatus=Sn,fe.AliRtcVideoStreamType=rt,fe.AliRtcVideoTrack=ke,fe.default=Dh,Object.defineProperties(fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
153
+ `;class xa extends vs{constructor(e,t){super(e,t);A(this,"processor");A(this,"trackGenerator");A(this,"worker");this.processor=new MediaStreamTrackProcessor({track:e}),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.startTransform()}static isSupport(){return"MediaStreamTrackProcessor"in window&&"MediaStreamTrackGenerator"in window&&"TransformStream"in window&&"VideoFrame"in window}startTransform(){const e=new Blob([D0],{type:"text/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(e);this.worker=new Worker(r);const{readable:i}=this.processor,{writable:n}=this.trackGenerator;this.worker.postMessage({type:"startRender",readable:i,writable:n,width:this.targetWidth,height:this.targetHeight,frameRate:this.targetFrameRate},[i,n])}updateOptions(e){super.updateOptions(e),this.worker&&this.worker.postMessage(Se({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class xs{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(c,e){return xa.isSupport()?new xa(c,e):va.isSupport()?new va(c,e):new A0(c,e)}}class T0 extends ei{constructor(){super(...arguments);A(this,"hasVideoTrack",!1);A(this,"videoScaler")}get initOptions(){return{width:320,height:180,frameRate:15}}setOptions(e){var t;this.options=e,(t=this.videoScaler)==null||t.updateOptions(e)}isSupported(){return xs.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return z(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const r=this.options||this.initOptions;this.videoScaler=xs.getInstance(e.currentVideoTrack,r)}const t=this.videoScaler.getVideoTrack();t&&e.updateDualVideoTrack(t)}else e.updateDualVideoTrack(),this.emit("updated"),this.videoScaler&&this.videoScaler.dispose()})}clear(e){super.clear(e),this.hasVideoTrack=!1,e==null||e.updateDualVideoTrack()}}class bs{static checkString(c){return typeof c=="string"}static checkNumber(c){return typeof c=="number"}static checkHtmlVideoElement(c){return c&&c.nodeName==="VIDEO"}static checkHtmlAudioElement(c){return c&&c.nodeName==="AUDIO"}static checkAuthInfo(c){if(!c)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!c.appId)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!c.channelId)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!c.userId)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(c.timestamp){if(!bs.checkNumber(c.timestamp))return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return c.token?null:new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no token founded")}static checkMediaStreamTrack(c){return c instanceof MediaStreamTrack}static checkVideoEncoderConfiguration(c){return c&&(c.width||c.height||c.frameRate||c.bitrateMax)}}class ba{constructor(c){A(this,"taskProfile");A(this,"encodeParam");A(this,"users",[]);A(this,"backgroundColor",0);A(this,"backgrounds",[]);A(this,"watermarks",[]);A(this,"clockWidgets",[]);A(this,"cropMode");A(this,"mediaProcessMode");this.taskProfile=c}}class Sa{constructor(c,e,t){A(this,"userId");A(this,"streamType");A(this,"sourceType");this.userId=c,this.streamType=e,this.sourceType=t}}class _a{constructor(c,e,t,r=0,i=16777215,n=pi.NOTO_SERIF_CJKSC_REGULAR){A(this,"x");A(this,"y");A(this,"fontSize");A(this,"zOrder");A(this,"fontColor");A(this,"fontType");this.x=c,this.y=e,this.fontSize=t,this.zOrder=r,this.fontColor=i,this.fontType=n}toJson(c,e){return{x:mt(this.x,c),y:mt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:os(this.fontColor),zorder:this.zOrder}}}var ya=(s=>(s[s.NOT_DISPLAY=0]="NOT_DISPLAY",s[s.ALWAYS=1]="ALWAYS",s[s.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",s))(ya||{});class Ss{constructor(c,e,t,r,i,n=0,a=1,o=1){A(this,"url");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"alpha");A(this,"display",1);A(this,"zOrder");this.url=c,this.x=e,this.y=t,this.width=r,this.height=i,this.zOrder=n,this.alpha=a,this.display=o}toJson(c,e){return{url:this.url,alpha:this.alpha,display:this.display,x:mt(this.x,c),y:mt(this.y,e),width:mt(this.width,c),height:mt(this.height,e),zorder:this.zOrder}}}A(Ss,"DisplayType",ya);class Aa{constructor(c,e,t,r,i=0,n=16777215,a=pi.NOTO_SERIF_CJKSC_REGULAR){A(this,"text");A(this,"x");A(this,"y");A(this,"fontSize");A(this,"zOrder");A(this,"fontColor");A(this,"fontType");this.text=c,this.x=e,this.y=t,this.fontSize=r,this.zOrder=i,this.fontColor=n,this.fontType=a}toJson(c,e){return{text:this.text,x:mt(this.x,c),y:mt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:os(this.fontColor),zorder:this.zOrder}}}class Ea{constructor(c,e,t,r,i,n=0,a){A(this,"userId");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"zOrder");A(this,"sourceType");A(this,"segmentType",fi.LiveTranscodingNoBody);A(this,"images",[]);A(this,"texts",[]);typeof c=="number"?this.userId=c.toString():this.userId=c,this.x=e,this.y=t,this.width=r,this.height=i,this.zOrder=n,a&&(this.sourceType=a)}toJson(c,e,t,r){const i={paneid:c,majorpane:0,x:mt(this.x,e),y:mt(this.y,t),width:mt(this.width,e),height:mt(this.height,t),zorder:this.zOrder,userid:this.userId,images:this.images.map(n=>n.toJson(e,t)),texts:this.texts.map(n=>n.toJson(e,t))};return this.sourceType&&li[this.sourceType]?i.sourcetype=li[this.sourceType]:i.sourcetype=li[ti.LiveTranscodingCamera],this.segmentType&&r===Pi.LiveTranscodingVirtualBackground?i.segmenttype=this.segmentType:i.segmenttype=fi.LiveTranscodingNoBody,i}}class B0 extends ei{constructor(){super("AliRtcScreenStandardize",Ke.AliRtcSdkStreamTypeScreen);A(this,"canvas");A(this,"lastWidth");A(this,"lastHeight");A(this,"hasScreenTrack",!1)}get initOptions(){return{base:4}}setOptions(e){this.options=e}isSupported(){return!(typeof TransformStream=="undefined"||typeof MediaStreamTrackProcessor=="undefined"||typeof MediaStreamTrackGenerator=="undefined")}updateProcessCanvas(e,t){if(this.canvas&&this.lastWidth===e&&this.lastHeight===t)return;const r=Math.ceil(e/this.options.base)*this.options.base,i=Math.ceil(t/this.options.base)*this.options.base;if(this.canvas||(this.canvas=document.createElement("canvas")),this.canvas.width=r,this.canvas.height=i,this.lastWidth&&e>this.lastWidth||this.lastHeight&&t>this.lastHeight){const n=this.canvas.getContext("2d");n&&n.clearRect(0,0,r,i)}this.lastWidth=e,this.lastHeight=t}shouldUpdate(e){return this.hasScreenTrack!==(!!e.originVideoTrack&&e.videoSource===Yt.Screen)}handleFrame(e,t){return z(this,null,function*(){var a;const{displayWidth:r,displayHeight:i}=e;if(!r||!i||r%this.options.base===0&&i%this.options.base===0)return this.clear(t),e;this.updateProcessCanvas(r,i);const n=(a=this.canvas)==null?void 0:a.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,r,i);const o=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),o}return e})}process(e){return z(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==Yt.Screen){this.clear(e),this.hasScreenTrack=!1;return}const t=new MediaStreamTrackProcessor({track:e.originVideoTrack}),r=new MediaStreamTrackGenerator({kind:"video"}),i=new MediaStream([r]),n=this,a=new TransformStream({transform(g,f){return z(this,null,function*(){const l=yield n.handleFrame(g,e);yield f.enqueue(l),l==null||l.close()})}});t.readable.pipeThrough(a).pipeTo(r.writable);const o=(h=i.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(o),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}var P0=Object.defineProperty,L0=Object.getOwnPropertyDescriptor,le=(s,c,e,t)=>{for(var r=t>1?void 0:t?L0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&P0(c,e,r),r};const de=(fe=class extends ve{constructor(e){super();A(this,"channelProfile");A(this,"clientRole");A(this,"signalingManager");A(this,"bizControl");A(this,"liveTranscoding");A(this,"maxSignalingConnectRetryCount");A(this,"slsReporter");A(this,"connectState",De.AliRtcConnectionStatusInit);A(this,"networkError",!1);A(this,"audioMixerPlugin");A(this,"dualVideoPlugin");A(this,"_audioOnlyMode",!1);A(this,"_authInfoWillExpireTimer",null);A(this,"_authInfoExpiredTimer",null);A(this,"_serverCheckAuthInfoTimestamp",null);A(this,"_localCheckAuthInfoTimestamp",null);const t=Date.now();this.slsReporter=new hi(this),this.channelProfile=It.AliRtcSdkCommunication,this.clientRole=Tt.AliRtcSdkLive,this.liveTranscoding=new b0(this.slsReporter),this.signalingManager=new Kc(this.channelProfile,this.clientRole,this.slsReporter,(e==null?void 0:e.env)===Ct.pre?Ct.pre:Ct.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.bizControl=new ot({slsReporter:this.slsReporter,signalingManager:this.signalingManager}),this.addBizControlListeners(),this.addPublisherListeners(),this.audioMixerPlugin=new y0,this.enablePlugin(this.audioMixerPlugin),this.dualVideoPlugin=new T0("dualVideoPlugin"),this.enablePlugin(new B0),this.slsReporter.reportSDKCreated(t)}static getSdkVersion(){return nr}static setLogLevel(e){oe.setLogLevel(e)}static getInstance(e){return fe._instance||(fe._instance=new fe(e)),fe._instance}destroy(){fe._instance=void 0}get channel(){return this.bizControl.channel}get userId(){return this.bizControl.userId}get remoteUsers(){return this.bizControl.remoteUsers}get publisher(){return this.bizControl.publisher}get publishAudioStream(){var e;return(e=this.publisher)==null?void 0:e.publishStreams.audio}get isPublishing(){const{publisher:e}=this.bizControl;return e?e.isPublishing:!1}get currentRoleCanPublish(){return this.channelProfile===It.AliRtcSdkCommunication||this.clientRole===Tt.AliRtcSdkInteractive}resetState(){return z(this,null,function*(){yield this.bizControl.clear(),this.connectState=De.AliRtcConnectionStatusDisconnected,this.networkError=!1,this.signalingManager.reset(),this.liveTranscoding.clear(),this.slsReporter.stop(),yield this.publishLocalAudioStream(!0),yield this.publishLocalVideoStream(!0),yield this.publishLocalScreenShareStream(!0)})}stopPublish(e){return z(this,null,function*(){var t,r,i;e?yield(t=this.publisher)==null?void 0:t.stopLocalStream(e):(yield(r=this.publisher)==null?void 0:r.publishStop(),(i=this.publisher)==null||i.stopPreview())})}addPublisherListeners(){var e,t,r,i,n,a,o,u,h;(e=this.publisher)==null||e.on(et.Local,g=>{oe.event("[Publisher] Device Status Change",g),this.onLocalDeviceStatusChange(g)}),(t=this.publisher)==null||t.on(Gt.VideoTrackEnded,()=>{oe.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,Fe.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(r=this.publisher)==null||r.on(Gt.ScreenTrackEnded,()=>{oe.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,Fe.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(i=this.publisher)==null||i.on(Gt.AudioTrackEnded,()=>{oe.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,Fe.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(g,f,l="")=>{this.emit("localDeviceException",g,f,l)}),(a=this.publisher)==null||a.on("audioPublishStateChanged",(g,f,l)=>{var p;this.emit("audioPublishStateChanged",g,f,l,(p=this.channel)!=null?p:"")}),(o=this.publisher)==null||o.on("videoPublishStateChanged",(g,f,l)=>{var p;this.emit("videoPublishStateChanged",g,f,l,(p=this.channel)!=null?p:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(g,f,l)=>{var p;this.emit("dualStreamPublishStateChanged",g,f,l,(p=this.channel)!=null?p:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(g,f,l)=>{var p;this.emit("screenSharePublishStateChanged",g,f,l,(p=this.channel)!=null?p:"")})}addBizControlListeners(){this.bizControl.rtsManager.on("disconnected",()=>z(this,null,function*(){oe.event(`[${fe.logName}]`,"RTS Disconnected"),(yield At.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.bizControl.rtsManager.on("subscribeexceeds",()=>z(this,null,function*(){yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList()})),this.bizControl.rtsManager.on("seimessage",(e,t,r)=>{const i=this.remoteUsers.find(n=>n.streamUrl===e);i&&this.emit("mediaExtensionMsgReceived",i.userId,r,t)}),this.bizControl.on(et.Remote,(e,t)=>{oe.event(`[${fe.logName}]`,"RemoteUser Device Status Change",e,t)}),this.bizControl.on("remoteTrackAvailableChange",(e,t,r)=>{this.emit("remoteTrackAvailableNotify",e,t,r)}),this.bizControl.on("audioSubscribeStateChanged",(e,t,r,i,n)=>{this.emit("audioSubscribeStateChanged",e,t,r,i,n)}),this.bizControl.on("videoSubscribeStateChanged",(e,t,r,i,n)=>{this.emit("videoSubscribeStateChanged",e,t,r,i,n)}),this.bizControl.on("screenSubscribeStateChanged",(e,t,r,i,n)=>{this.emit("screenShareSubscribeStateChanged",e,t,r,i,n)}),this.bizControl.on("userAudioMuted",(e,t)=>{this.emit("userAudioMuted",e,t)}),this.bizControl.on("userVideoMuted",(e,t)=>{this.emit("userVideoMuted",e,t)}),this.bizControl.on("userScreenMuted",(e,t)=>{this.emit("userScreenMuted",e,t)}),this.bizControl.on("audioVolume",e=>{this.emit("audioVolume",e)}),this.bizControl.on("remoteAudioAutoPlayFail",e=>{this.emit("remoteAudioAutoPlayFail",e)}),this.bizControl.on("remoteVideoAutoPlayFail",(e,t)=>{this.emit("remoteVideoAutoPlayFail",e,t)}),this.bizControl.on("remoteAudioPlayError",(e,t)=>{this.emit("remoteAudioPlayError",e,t)}),this.bizControl.on("remoteVideoPlayError",(e,t)=>{this.emit("remoteVideoPlayError",e,t)}),this.bizControl.on("rtcStats",e=>{this.emit("rtcStats",e)}),this.bizControl.on("rtcLocalAudioStats",e=>{this.emit("rtcLocalAudioStats",e)}),this.bizControl.on("rtcLocalVideoStats",e=>{this.emit("rtcLocalVideoStats",e)}),this.bizControl.on("rtcRemoteAudioStats",e=>{this.emit("rtcRemoteAudioStats",e)}),this.bizControl.on("rtcRemoteVideoStats",e=>{this.emit("rtcRemoteVideoStats",e)}),this.bizControl.on("remoteSubscribeError",e=>{this.emit("onOccurError",e),this.slsReporter.reportError(e)})}addSignalingManagerListeners(){this.signalingManager.on("onKeepAliveRsp",()=>{this.networkError&&(oe.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{oe.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{oe.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.bizControl.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{oe.event("[Signaling] Notify Leave ",e),e.forEach(t=>{this.emit("remoteUserOffLineNotify",t.userid,t.leavecode),this.bizControl.removeLeftUser(t)})}),this.signalingManager.on("onBye",(e,t)=>{oe.event("[Signaling] Bye ",e,t),this.slsReporter.reportError({message:`reason: ${e}, description: ${t}`}),this.emit("bye",e),this.leaveChannel(!0),this.slsReporter.reportBye(e)}),this.signalingManager.on("onConnectFail",e=>{oe.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=De.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",De.AliRtcConnectionStatusFailed,Kt.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{this.slsReporter.reportWarning("signaling network error"),oe.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{oe.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{oe.event("[Signaling] Reconnect Start "),this.connectState=De.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",De.AliRtcConnectionStatusReconnecting,Kt.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{oe.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{this.slsReporter.reportWarning("signaling reconnect fail: ${err.code}"),oe.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{this.slsReporter.reportWarning("signaling error: ${err.message}"),oe.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=De.AliRtcConnectionStatusDisconnected,(e=this.publisher)!=null&&e.isPublishing&&((t=this.publisher)==null||t.clearPublishState()),this.networkError=!1}handleUsersJoin(e){e.forEach(t=>{const r=t.userid;if(r){const i=this.bizControl.addUser(r,t.displayname,Be.Join);oe.event(`[${fe.logName}]`,Ie.UserJoined,i)}})}onLocalDeviceStatusChange(e){oe.event(`[${fe.logName}]`,et.Local,e),this.signalingManager.reportStatus(e).then(()=>{oe.debug("[signaling] reportStatus suc")}).catch(t=>{oe.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return z(this,null,function*(){var e;try{yield(e=this.publisher)==null?void 0:e.resumePublish()}catch(t){const{code:r}=t;if(r===10205){let n=1;try{yield new Promise((a,o)=>{const u=setInterval(()=>z(this,null,function*(){var h;n>1&&(clearInterval(u),o()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),a()}catch(g){const{code:f}=g;f!==10205&&(clearInterval(u),o())}}),1e3)})}catch(a){}}}})}onNetworkRecovery(e){return z(this,null,function*(){var t;oe.event(fe.logName,"onNetworkRecovery",{users:e}),this.networkError&&(this.networkError=!1,(t=this.publisher)==null||t.reportSelfDeviceStatus(),!this.bizControl.rtsManager.isConnected&&this.bizControl.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.connectState=De.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",De.AliRtcConnectionStatusConnected,Kt.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return z(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:r,presentList:i}=this.bizControl.updateUsers(e);oe.info(`[${fe.logName}]`,"resumeSubList",{joinList:t,leaveList:r,presentList:i}),this.handleUsersJoin(t),r.forEach(n=>{oe.event(fe.logName,Ie.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,cs.AliRtcUserOfflineQuit)});for(let n=0;n<i.length;n++){const a=i[n],o=a.userid,u=this.bizControl.getRemoteUser(o);this.bizControl.onRemotePublishStateChange(a),u==null||u.restore(),u==null||u.updateSubscribe(Be.Resume)}}else for(let t=0;t<this.remoteUsers.length;t++){const r=this.remoteUsers[t];try{r.restore(),r.updateSubscribe(Be.Resume)}catch(i){}}})}onNetworkError(){this.connectState===De.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=De.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",De.AliRtcConnectionStatusDisconnected,Kt.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.slsReporter.reportError(e),oe.event(fe.logName,Ie.Error,e)}setEnableDualVideoStream(e,t){t&&this.dualVideoPlugin.setOptions(t);const r=this.bizControl.pluginManager.has(this.dualVideoPlugin.name);e?!r&&this.enablePlugin(this.dualVideoPlugin):r&&this.removePlugin(this.dualVideoPlugin.name)}hadPushStream(e){if(!(this.publisher&&e))throw new ne(ce.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![De.AliRtcConnectionStatusInit,De.AliRtcConnectionStatusDisconnected,De.AliRtcConnectionStatusFailed].includes(this.connectState))throw new ne(ce.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===It.AliRtcSdkCommunication&&(this.clientRole=Tt.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}setClientRole(e){return z(this,null,function*(){var t,r,i,n,a;try{if(this.channelProfile===It.AliRtcSdkCommunication)return;if(!Object.values(Tt).includes(e))throw new ne(ce.ERR_INVALID_ARGUMENTS,`set client role error, role value(${e}) is invalid`);if(this.clientRole===e)return;this.slsReporter.reportRoleUpdate(this.clientRole,e),this.isInCall()?this.clientRole===Tt.AliRtcSdkInteractive?(this.bizControl.isSubscribing?(yield this.stopPublish(),yield(t=this.publisher)==null?void 0:t.clearStream()):yield(r=this.publisher)==null?void 0:r.unPublish(),yield this.signalingManager.setClientRole(e)):(yield this.signalingManager.setClientRole(e),yield this.startDefaultDevicesCapture(),(i=this.publisher)!=null&&i.isPublishing||(yield(n=this.publisher)==null?void 0:n.startPublish()),yield(a=this.publisher)==null?void 0:a.previewAll()):yield this.signalingManager.setClientRole(e),this.clientRole=e}catch(o){throw o.code===403&&this.emit("authInfoExpired"),o}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new ne(ce.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new ne(ce.ERR_INNER,"can not change audioRedEnabled in call");this.bizControl.setAudioRedEnabled(e)}setCheckAuthInfoTimer(e,t){const r=(e-t)*1e3;this._authInfoExpiredTimer=window.setTimeout(()=>{this.emit("authInfoExpired")},r),this._authInfoWillExpireTimer=window.setTimeout(()=>{this.emit("authInfoWillExpire")},r-3e4),this._serverCheckAuthInfoTimestamp=t,this._localCheckAuthInfoTimestamp=+Date.now()/1e3}clearCheckAuthInfoTimer(){this._authInfoExpiredTimer&&window.clearTimeout(this._authInfoExpiredTimer),this._authInfoWillExpireTimer&&window.clearTimeout(this._authInfoWillExpireTimer)}startDefaultDevicesCapture(){return z(this,null,function*(){var r,i;let e=[],t;try{this._audioOnlyMode||(e=yield fe.getCameraList(),e.length||oe.warn(`${[fe.logName]}`,"No media neither devices can be captured")),t=yield fe.getMicrophoneList(),t.length||oe.warn(`${[fe.logName]}`,"No media neither devices can be captured");const{hasCamera:n,hasMicrophone:a,hasScreenShare:o,audioCaptureDisabled:u,publishLocalAudioStreamEnabled:h,publishLocalVideoStreamEnabled:g}=(r=this.publisher)!=null?r:{};if(n||a||o)return;!n&&g&&!this._audioOnlyMode&&e.length&&!((i=this.publisher)!=null&&i.cameraCaptureDisabled)&&(yield this.enableLocalVideo(!0)),!a&&h&&!u&&t.length&&(yield this.startAudioCapture())}catch(n){throw n}})}joinChannel(e,t,r,i){return z(this,null,function*(){var h,g,f,l,p,d,m,x,v,b;let n=i,a;if(typeof e=="string"){n=i;try{const y=JSON.parse(window.atob(e));if(a={appId:y.appid,channelId:y.channelid,userId:y.userid,timestamp:y.timestamp,nonce:y.nonce,token:y.token},a.channelId!==t)throw new Error("channelId is not equal");if(a.userId!==r)throw new Error("userId is not equal")}catch(y){throw new ne(ce.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${y.message||""}`)}}else a=e,n=t;const o={start:Date.now()};let u=bs.checkAuthInfo(a);if(De.AliRtcConnectionStatusInit===this.connectState||De.AliRtcConnectionStatusDisconnected===this.connectState||De.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=De.AliRtcConnectionStatusConnecting,u)throw this.connectState=De.AliRtcConnectionStatusFailed,this.slsReporter.reportJoin(u.code,o,""),this.slsReporter.reportJoinResult(u),u;a.sessionId=At.createCallid("web"),oe.setSessionID(a.appId,a.sessionId),this.slsReporter.start(a);try{const I=yield this.signalingManager.join(a,n,this.maxSignalingConnectRetryCount,o);this.connectState=De.AliRtcConnectionStatusConnected,(h=this.publisher)==null||h.reportSelfDeviceStatus(),this.bizControl.init(a,I),this.setCheckAuthInfoTimer(a.timestamp,I.timestamp),this.liveTranscoding.setAuthInfo(a),this.slsReporter.reportJoin(0,o,I.tid),this.slsReporter.reportJoinResult(null)}catch(I){const C=(g=I.code)!=null?g:-1,R=I.reason||I.message||"";throw this.connectState=De.AliRtcConnectionStatusDisconnected,this.slsReporter.reportJoin(C,o,""),this.slsReporter.reportJoinResult(I),new ne(C,R)}let y=!1,E=!1;try{this.currentRoleCanPublish&&(yield this.startDefaultDevicesCapture(),y=!!((f=this.publisher)!=null&&f.publishStreams.audio),E=!!((l=this.publisher)!=null&&l.publishStreams.video)||!!((p=this.publisher)!=null&&p.publishStreams.videoSmall)||!!((d=this.publisher)!=null&&d.publishStreams.screen),Object.values((x=(m=this.publisher)==null?void 0:m.publishStreams)!=null?x:{}).some(I=>I)&&(yield(v=this.publisher)==null?void 0:v.startPublish(!1,Ot.JOINCHANNEL),yield(b=this.publisher)==null?void 0:b.previewAll())),this.remoteUsers.forEach(I=>{I.updateSubscribe(Be.Join)})}catch(I){y&&this.emit("onOccurError",new ne(ce.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED,`join channel auto publish audio stream failed, ${I.message||""}`)),E&&this.emit("onOccurError",new ne(ce.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED,`join channel auto publish video stream failed, ${I.message||""}`))}}else{const y=new ne(ce.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===De.AliRtcConnectionStatusConnecting&&(y.message="Repeated operation during login"),this.slsReporter.reportJoin(y.code,o,""),y}})}leaveChannel(e=!1){return z(this,null,function*(){var r;this.slsReporter.reportLeaveInvoked();let t=new Date().getTime();if(De.AliRtcConnectionStatusConnected===this.connectState)try{let i;e||(i=yield this.signalingManager.leave()),this.clearCheckAuthInfoTimer(),yield this.resetState(),this.slsReporter.reportLeave(new Date().getTime()-t,0,(r=i==null?void 0:i.tid)!=null?r:""),oe.uploadLog();return}catch(i){throw this.slsReporter.reportLeave(new Date().getTime()-t,i.code,i.reason),i}else{yield this.resetState(),this.slsReporter.reportLeave(0,0,"");return}})}isInCall(){return this.connectState===De.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return z(this,null,function*(){const{userId:t,nonce:r,timestamp:i,token:n,role:a}=e,o={userId:t,nonce:r,timestamp:i,token:n,role:a};try{yield this.signalingManager.refreshAuthInfo(o),this.bizControl.refreshAuthInfo(o),this.liveTranscoding.refreshAuthInfo(o),this.clearCheckAuthInfoTimer(),this._serverCheckAuthInfoTimestamp&&this._localCheckAuthInfoTimestamp&&e.timestamp&&this.setCheckAuthInfoTimer(e.timestamp,this._serverCheckAuthInfoTimestamp+(Date.now()-this._localCheckAuthInfoTimestamp))}catch(u){throw u}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return z(this,null,function*(){var t,r,i;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===De.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasMicrophone?yield(i=this.publisher)==null?void 0:i.publishUpdate():yield this.startAudioCapture():yield this.stopPublish({audio:!0}))})}isLocalAudioStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalAudioStreamEnabled)!=null?t:!0}setDefaultSubscribeAllRemoteAudioStreams(e){this.bizControl.setAutoSubAudio(e)}subscribeAllRemoteAudioStreams(e){this.bizControl.setWantSubAudio(e)}subscribeRemoteAudioStream(e,t){if(t&&!this.bizControl.isWantSubAudio)throw new ne(ce.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.bizControl.updateAudioWant(e,t)}resumeRemoteAudioStream(e){const t=this.bizControl.getRemoteUser(e);t&&t.resumeAudio()}publishLocalVideoStream(e){return z(this,null,function*(){var t,r,i;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===De.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasCamera?yield(i=this.publisher)==null?void 0:i.publishUpdate():yield this.enableLocalVideo():yield this.stopPublish({video:!0}))})}isLocalVideoStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?t:!0}setRemoteDefaultVideoStreamType(e){[Je.AliRtcVideoStreamTypeHigh,Je.AliRtcVideoStreamTypeLow].includes(e)&&this.bizControl.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[Je.AliRtcVideoStreamTypeHigh,Je.AliRtcVideoStreamTypeLow].includes(t)&&this.bizControl.setRemoteUserVideoStreamType(e,t)}setDefaultSubscribeAllRemoteVideoStreams(e){this.bizControl.setAutoSubVideo(e),this.bizControl.setAutoSubScreen(e)}subscribeAllRemoteVideoStreams(e){this.bizControl.setWantSubVideo(e),this.bizControl.setWantSubScreen(e)}subscribeRemoteMediaStream(e,t,r,i){const n=this.bizControl.getRemoteUser(e);if(!n)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r&&(t===Ae.AliRtcVideoTrackScreen||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),r&&(t===Ae.AliRtcVideoTrackCamera||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(i),n.updateSubscribe(Be.User)}resumeRemoteMediaStream(e,t){const r=this.bizControl.getRemoteUser(e);r&&r.resumeVideo(t)}getOnlineRemoteUsers(){return this.bizControl.remoteUsers.map(e=>e.userId)}getUserInfo(e){var t;return(t=this.bizControl.getRemoteUser(e))==null?void 0:t.remoteUserInfo}isUserOnline(e){return!!this.bizControl.remoteUsers.find(t=>t.userId===e)}startScreenShare(e){return z(this,null,function*(){var a;const t={video:!1,audio:!1},{audio:r=!1,videoTrack:i,audioTrack:n}=e||{};if(i||n){t.screen=!0;const o=new MediaStream;i&&o.addTrack(i),n&&o.addTrack(n),t.mediaStream=o}else t.screen=r?{audio:!0}:!0;yield(a=this.publisher)==null?void 0:a.createLocalStream(t)})}stopScreenShare(){return z(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return z(this,null,function*(){var i;const{frameRate:t=vi.frameRate,bitrate:r=vi.maxBitrate}=e;yield(i=this.publisher)==null?void 0:i.setScreenProfile(ca,{width:vi.width,height:vi.height,frameRate:t,maxBitrate:r})})}setScreenShareContentHint(e){return z(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return z(this,null,function*(){var r,i,n;(r=this.publisher)==null||r.setPublishLocalScreenStreamEnabled(e),this.connectState===De.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasScreenShare?yield(n=this.publisher)==null?void 0:n.publishUpdate():yield this.startScreenShare(t):yield this.stopPublish({screen:!0}))})}isScreenSharePublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalScreenStreamEnabled)!=null?t:!0}setAudioShareVolume(e){if(typeof e!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({screen:Math.max(0,Math.min(e,400))/100})}enableAudioVolumeIndication(e){this.bizControl.enableAudioVolumeIndication(e)}muteLocalMic(e=!1){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Ie.MuteAudio:Ie.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const r=this.bizControl.getRemoteUser(e);if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.bizControl.setAudioMuted(e)}startAudioCapture(e){return z(this,null,function*(){var r;const t={audio:e||!0};yield(r=this.publisher)==null?void 0:r.createLocalStream(t)})}stopAudioCapture(){var e;(e=this.publisher)==null||e.stopAudioCapture()}switchMicrophone(e,t){return z(this,null,function*(){var r,i,n,a;if(yield(r=this.publisher)==null?void 0:r.setMicrophoneDeviceId(e),!((i=this.publisher)!=null&&i.audioCaptureDisabled)){if(t){yield(n=this.publisher)==null?void 0:n.createLocalStream({audio:!0,mediaStream:new MediaStream([t])});return}yield(a=this.publisher)==null?void 0:a.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({audio:Math.max(0,Math.min(e,400))/100})}setPlayoutVolume(e){if(typeof e!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setPlayoutVolume(Math.max(0,Math.min(e,100))/100)}setRemoteAudioVolume(e,t){const r=this.bizControl.getRemoteUser(e);if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");r.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return z(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return z(this,null,function*(){var r;if(!e)return(r=this.publisher)==null?void 0:r.audioTrack;const t=this.bizControl.getRemoteUser(e);return t==null?void 0:t.getAudioTrack})}setLocalViewConfig(e,t){return z(this,null,function*(){var r,i,n;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot set local view in audio only mode");(r=this.bizControl)==null||r.setLocalViewConfig(e,t),t===Ae.AliRtcVideoTrackCamera&&((i=this.publisher)!=null&&i.hasCamera)?yield this.startPreview():t===Ae.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return z(this,null,function*(){var u,h,g;const{width:t=gi.width,height:r=gi.height,frameRate:i=gi.frameRate,bitrate:n=gi.maxBitrate,cameraDirection:a,deviceId:o}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(oa,{width:t,height:r,frameRate:i,maxBitrate:n}),a!==void 0&&((h=this.publisher)==null||h.setCameraDirection(a)),o&&((g=this.publisher)==null||g.setCameraDeviceId(o))})}setCameraCapturerContentHint(e){return z(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return z(this,null,function*(){var t,r,i,n,a,o,u,h,g,f,l;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot enable local video in audio only mode");if(e){(r=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&r.video&&((a=(n=(i=this.publisher)==null?void 0:i.publishStreams)==null?void 0:n.video)==null||a.disableVideo(),(g=(h=(u=(o=this.publisher)==null?void 0:o.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||g.stop());const p={video:!0};yield(f=this.publisher)==null?void 0:f.startCameraCapture(p)}else yield(l=this.publisher)==null?void 0:l.stopCameraCapture()})}muteLocalCamera(e){return z(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Ie.MuteVideo:Ie.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return z(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Ie.MuteScreen:Ie.UnmuteScreen),(t=this.publisher)==null||t.muteLocalScreen(e)})}setRemoteViewConfig(e,t,r){this.bizControl.setRemoteViewConfig(t,e,r)}isCameraOn(){var e,t;return(t=(e=this.publisher)==null?void 0:e.hasCamera)!=null?t:!1}switchCamera(e,t){return z(this,null,function*(){var i,n,a,o,u,h,g,f,l,p,d,m,x;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot switch camera in audio only mode");const r={};if(e?(r.deviceId=e,this.slsReporter.reportSwitchCamera(e)):(r.cameraDirection=((i=this.publisher)==null?void 0:i.cameraDirection)==="environment"?mi.CAMERA_FRONT:mi.CAMERA_REAR,this.slsReporter.reportSwitchCamera(((n=this.publisher)==null?void 0:n.cameraDirection)||"")),yield this.setCameraCapturerConfiguration(r),!((a=this.publisher)!=null&&a.cameraCaptureDisabled)){(u=(o=this.publisher)==null?void 0:o.publishStreams)!=null&&u.video&&((f=(g=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:g.video)==null||f.disableVideo(),(m=(d=(p=(l=this.publisher)==null?void 0:l.publishStreams)==null?void 0:p.video)==null?void 0:d.videoTrack)==null||m.stop());const v={video:!0};t&&(v.mediaStream=new MediaStream([t])),yield(x=this.publisher)==null?void 0:x.createLocalStream(v)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return z(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot start preview camera in audio only mode");(e=this.publisher)!=null&&e.hasCamera||(yield this.enableLocalVideo(!0)),yield(t=this.publisher)==null?void 0:t.previewAll({screen:!1})})}startPreviewScreen(e){return z(this,null,function*(){var t,r;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot start preview screen share in audio only mode");(t=this.publisher)!=null&&t.hasScreenShare||(yield this.startScreenShare(e)),yield(r=this.publisher)==null?void 0:r.previewAll({primary:!1})})}stopPreview(){return z(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return z(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return z(this,null,function*(){var n,a,o,u;const{userId:t,streamType:r}=e;if(!t)return r===Ke.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(a=this.publisher)==null?void 0:a.screenTrack;const i=this.bizControl.getRemoteUser(t);return r===Ke.AliRtcSdkStreamTypeCapture?(o=i==null?void 0:i.getCameraStream)==null?void 0:o.videoTrack:(u=i==null?void 0:i.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return z(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return z(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return z(this,null,function*(){return this.liveTranscoding.stopPublishLiveStream(e)})}stopPublishLiveStreamWithTaskId(e){return this.liveTranscoding.stopPublishLiveStreamWithTaskId(e)}setEnableMediaExtensionMsg(e){var t;(t=this.bizControl)==null||t.setEnableMediaExtensionMsg(!!e)}sendMediaExtensionMsg(e,t){return z(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,r){return z(this,null,function*(){var i;if(!this.publisher||!this.isPublishing)throw new ne(ce.ERR_INNER,"you should publish first");return this.slsReporter.reportSEIMessage(r,e.byteLength,t,0,!1),(i=this.publisher)==null?void 0:i.sendSEI(e,t,r)})}enablePlugin(e,t){this.bizControl.pluginManager.add(e,t)}removePlugin(e){this.bizControl.pluginManager.remove(e)}setPluginOption(e,t){const r=this.bizControl.pluginManager.get(e);r&&t&&r.setOptions(t)}getPluginOption(e){const t=this.bizControl.pluginManager.get(e);return t==null?void 0:t.getOptions()}isBeautyAvailable(){return this.bizControl.pluginManager.has("AliRtcBeauty")}isBeautyEnabled(){const e=this.bizControl.pluginManager.get("AliRtcBeauty");if(!e)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");return!!(e!=null&&e.isEnable)}setBeautyEffect(e,t){const r=this.bizControl.pluginManager.get("AliRtcBeauty");if(!r)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");e?r.enable():r.disable(),r.setOptions({basicBeauty:{skinBuffing:Math.max(Math.min(1,+t.smoothnessLevel),0),whitening:Math.max(Math.min(1,+t.whiteningLevel),0)}})}enableBackgroundExchange(e,t){const r=this.bizControl.pluginManager.get("AliRtcBeauty");if(!r||!r.isEnable)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const i={setSegmentBackgroundImage:{backgroundImgUrl:e?t:""}};e&&(i.segmentBackgroundProcess={enable:!1}),r.setOptions(i)}enableBackgroundBlur(e){const t=this.bizControl.pluginManager.get("AliRtcBeauty");if(!t||!t.isEnable)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const r={segmentBackgroundProcess:{type:0,enable:e}};e&&(r.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(r)}setParameter(e){this.bizControl.setParameter(e)}getParameter(){return this.bizControl.getParameter()}},A(fe,"logName","AliRtcEngine"),A(fe,"logError",!0),A(fe,"isSupported",Lc),A(fe,"isDualVideoStreamSupported",xs.isSupport),A(fe,"getCameraList",()=>z(fe,null,function*(){return(yield me.AliRTS.getCameraList()).filter(t=>t.deviceId)})),A(fe,"getMicrophoneList",()=>z(fe,null,function*(){return(yield me.AliRTS.getMicList()).filter(t=>t.deviceId)})),A(fe,"getSpeakerList",()=>z(fe,null,function*(){return(yield me.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),A(fe,"_instance"),A(fe,"AliRtcSdkChannelProfile",It),A(fe,"AliRtcSdkClientRole",Tt),A(fe,"AliRtcVideoStreamType",Je),A(fe,"AliRtcVideoTrack",Ae),A(fe,"AliRtcAudioTrack",ii),A(fe,"AliRtcPublishState",be),A(fe,"AliRtcSubscribeState",Le),A(fe,"AliRtcRawDataStreamType",Ke),A(fe,"AliRtcLogLevel",es),A(fe,"AliRtcEngineLocalDeviceType",wt),A(fe,"AliRtcEngineLocalDeviceExceptionType",Fe),A(fe,"AliRtcConnectionStatus",De),A(fe,"AliRtcConnectionStatusChangeReason",Kt),A(fe,"AliRtcPlugin",ei),A(fe,"AliRtcPluginTrackType",Ti),A(fe,"AliRtcLiveTranscodingParam",Li),A(fe,"AliRtcLiveTranscodingEncodeParam",as),A(fe,"AliRtcLiveTranscodingMixParam",ba),A(fe,"AliRtcLiveTranscodingSingleParam",Sa),A(fe,"AliRtcTranscodingClockWidget",_a),A(fe,"AliRtcTranscodingImage",Ss),A(fe,"AliRtcTranscodingText",Aa),A(fe,"AliRtcTranscodingUser",Ea),A(fe,"AliRtcLiveTranscodingMixMode",di),A(fe,"AliRtcLiveTranscodingStreamType",ts),A(fe,"AliRtcLiveTranscodingSourceType",ti),A(fe,"AliRtcLiveTranscodingTaskProfile",is),A(fe,"AliRtcLiveTranscodingAudioSampleRate",Bi),A(fe,"AliRtcLiveTranscodingSegmentType",fi),A(fe,"AliRtcLiveTranscodingFontType",pi),A(fe,"AliRtcLiveTranscodingCropMode",rs),A(fe,"AliRtcLiveTranscodingMediaProcessMode",Pi),A(fe,"AliRtcLiveTranscodingState",ss),A(fe,"AliRtcLiveTranscodingErrorCode",Et),A(fe,"AliRtcTrascodingPublishTaskStatus",ns),A(fe,"Plugin",ei),fe);le([j()],de.prototype,"destroy",1),le([j()],de.prototype,"resetState",1),le([j(ae)],de.prototype,"stopPublish",1),le([j()],de.prototype,"backToUnpublishStatus",1),le([j()],de.prototype,"resumePublishForNetworkRecovery",1),le([j()],de.prototype,"onNetworkRecovery",1),le([j()],de.prototype,"resumeSubList",1),le([j(ae)],de.prototype,"setEnableDualVideoStream",1),le([j(ae)],de.prototype,"setChannelProfile",1),le([j(ae)],de.prototype,"setClientRole",1),le([j(ae)],de.prototype,"setAudioOnlyMode",1),le([j()],de.prototype,"clearCheckAuthInfoTimer",1),le([j(ae)],de.prototype,"joinChannel",1),le([j(ae)],de.prototype,"leaveChannel",1),le([j(ae)],de.prototype,"refreshAuthInfo",1),le([j(ae)],de.prototype,"publishLocalAudioStream",1),le([j(ae)],de.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),le([j(ae)],de.prototype,"subscribeAllRemoteAudioStreams",1),le([j(ae)],de.prototype,"subscribeRemoteAudioStream",1),le([j(ae)],de.prototype,"resumeRemoteAudioStream",1),le([j(ae)],de.prototype,"publishLocalVideoStream",1),le([j(ae)],de.prototype,"setRemoteDefaultVideoStreamType",1),le([j(ae)],de.prototype,"setRemoteUserVideoStreamType",1),le([j(ae)],de.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),le([j(ae)],de.prototype,"subscribeAllRemoteVideoStreams",1),le([j(ae)],de.prototype,"subscribeRemoteMediaStream",1),le([j(ae)],de.prototype,"resumeRemoteMediaStream",1),le([j(([s])=>[`${s==null?void 0:s.audio}`])],de.prototype,"startScreenShare",1),le([j()],de.prototype,"stopScreenShare",1),le([j(ae)],de.prototype,"setScreenShareConfiguration",1),le([j(ae)],de.prototype,"setScreenShareContentHint",1),le([j()],de.prototype,"publishLocalScreenShareStream",1),le([j(ae)],de.prototype,"setAudioShareVolume",1),le([j(ae)],de.prototype,"enableAudioVolumeIndication",1),le([j(ae)],de.prototype,"muteLocalMic",1),le([j(ae)],de.prototype,"muteRemoteAudioPlaying",1),le([j(ae)],de.prototype,"muteAllRemoteAudioPlaying",1),le([j(ae)],de.prototype,"startAudioCapture",1),le([j()],de.prototype,"stopAudioCapture",1),le([j(ae)],de.prototype,"switchMicrophone",1),le([j(ae)],de.prototype,"setRecordingVolume",1),le([j(ae)],de.prototype,"setPlayoutVolume",1),le([j(ae)],de.prototype,"setRemoteAudioVolume",1),le([j(ae)],de.prototype,"setAudioProfile",1),le([j(ae)],de.prototype,"getAudioTrack",1),le([j(ae)],de.prototype,"setLocalViewConfig",1),le([j(ae)],de.prototype,"setCameraCapturerConfiguration",1),le([j(ae)],de.prototype,"setCameraCapturerContentHint",1),le([j(ae)],de.prototype,"enableLocalVideo",1),le([j(ae)],de.prototype,"muteLocalCamera",1),le([j(ae)],de.prototype,"muteLocalScreen",1),le([j(ae)],de.prototype,"setRemoteViewConfig",1),le([j(ae)],de.prototype,"switchCamera",1),le([j()],de.prototype,"startPreview",1),le([j()],de.prototype,"startPreviewScreen",1),le([j()],de.prototype,"stopPreview",1),le([j()],de.prototype,"stopPreviewScreen",1),le([j()],de.prototype,"startPublishLiveStream",1),le([j()],de.prototype,"updatePublishLiveStream",1),le([j()],de.prototype,"updatePublishLiveStreamWithTaskId",1),le([j()],de.prototype,"stopPublishLiveStream",1),le([j()],de.prototype,"stopPublishLiveStreamWithTaskId",1),le([j(ae)],de.prototype,"setEnableMediaExtensionMsg",1),le([j(([s,c,e])=>[s.byteLength,c,e])],de.prototype,"sendMediaExtensionMsgEx",1),le([j(([s,c])=>[s.name||"",c])],de.prototype,"enablePlugin",1),le([j(ae)],de.prototype,"removePlugin",1),le([j(ae)],de.prototype,"setPluginOption",1),le([j(ae)],de.prototype,"getPluginOption",1),le([j(ae)],de.prototype,"setBeautyEffect",1),le([j(ae)],de.prototype,"enableBackgroundExchange",1),le([j(ae)],de.prototype,"enableBackgroundBlur",1),le([j(ae)],de.prototype,"setParameter",1),le([j(ae)],de,"setLogLevel",1);let wa=de;const Ca=new ir({businessName:"imp-web-rtc",version:(Ia=wa.getSdkVersion())!=null?Ia:"unknown",env:"prod",disabled:window.AliRtcOptionsDisableProxy===!0});Ca.setReady();const N0=Ca.wrap(wa);he.AliRtcConnectionStatus=De,he.AliRtcConnectionStatusChangeReason=Kt,he.AliRtcEngineLocalDeviceExceptionType=Fe,he.AliRtcEngineLocalDeviceType=wt,he.AliRtcErrorCode=ce,he.AliRtcLiveTranscodingAudioSampleRate=Bi,he.AliRtcLiveTranscodingCropMode=rs,he.AliRtcLiveTranscodingEncodeParam=as,he.AliRtcLiveTranscodingErrorCode=Et,he.AliRtcLiveTranscodingFontType=pi,he.AliRtcLiveTranscodingMediaProcessMode=Pi,he.AliRtcLiveTranscodingMixMode=di,he.AliRtcLiveTranscodingMixParam=ba,he.AliRtcLiveTranscodingParam=Li,he.AliRtcLiveTranscodingSegmentType=fi,he.AliRtcLiveTranscodingSingleParam=Sa,he.AliRtcLiveTranscodingSourceType=ti,he.AliRtcLiveTranscodingState=ss,he.AliRtcLiveTranscodingStreamType=ts,he.AliRtcLiveTranscodingTaskProfile=is,he.AliRtcLocalStreamInfo=ms,he.AliRtcLogLevel=es,he.AliRtcPlugin=ei,he.AliRtcPluginTrackType=Ti,he.AliRtcPluginType=ta,he.AliRtcPublishState=be,he.AliRtcRawDataStreamType=Ke,he.AliRtcRemoteUserInfo=pa,he.AliRtcSdkChannelProfile=It,he.AliRtcSdkClientRole=Tt,he.AliRtcSubscribeState=Le,he.AliRtcTranscodingClockWidget=_a,he.AliRtcTranscodingImage=Ss,he.AliRtcTranscodingText=Aa,he.AliRtcTranscodingUser=Ea,he.AliRtcTrascodingPublishTaskStatus=ns,he.AliRtcVideoStreamType=Je,he.AliRtcVideoTrack=Ae,he.default=N0,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});