@zegocloud/zego-uikit-prebuilt
Version:
zegocloud prebuilt meeting webrtc sdk
2 lines • 5.12 MB
JavaScript
/*! For license information please see zego-uikit-prebuilt.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var A in i)("object"==typeof exports?exports:e)[A]=i[A]}}("undefined"!=typeof self?self:this,(()=>(()=>{var __webpack_modules__={3770:function(e,t,i){"undefined"!=typeof self&&self,e.exports=function(e,t,i,A,o){return n=[function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.LinkedList=t.ListNode=t.ENUM_NETWORK_STATE=t.SOCKET_DISCONNECT=t.errorList=t.Queue=t.getSeq=t.E_CLIENT_TYPE=t.ENUM_LOG_LEVEL=t.ZEGO_BROWSER_TYPE=t.ZEGO_ENV=t.PROTO_VERSION=void 0,t.PROTO_VERSION="1.0.6",(o=t.ZEGO_ENV||(t.ZEGO_ENV={}))[o.BROWSER=0]="BROWSER",o[o.WEIXINMINI=1]="WEIXINMINI",(o=t.ZEGO_BROWSER_TYPE||(t.ZEGO_BROWSER_TYPE={}))[o.IE=0]="IE",o[o.FIREFOX=1]="FIREFOX",o[o.CHROME=2]="CHROME",o[o.SAFARI=3]="SAFARI",o[o.OPERA=4]="OPERA",o[o.WEIXIN=5]="WEIXIN",o[o.WEIXINMINI=6]="WEIXINMINI",o[o.UNKOWN=7]="UNKOWN",t.ENUM_LOG_LEVEL={DEBUG:0,INFO:1,WARN:2,ERROR:3,REPORT:99,DISABLE:100,debug:0,info:1,warn:2,error:3,report:99,disable:100},(o=t.E_CLIENT_TYPE||(t.E_CLIENT_TYPE={}))[o.ClientType_None=0]="ClientType_None",o[o.ClientType_H5=1]="ClientType_H5",o[o.ClientType_SmallPragram=2]="ClientType_SmallPragram",o[o.ClientType_Webrtc=3]="ClientType_Webrtc",t.getSeq=(A=1,function(){return A++}),r.prototype.isEmpty=function(){return 0==this.items.length},r.prototype.enqueue=function(e){this.items.push(e)},r.prototype.dequeue=function(){return this.isEmpty()?"Underflow":this.items.shift()},r.prototype.front=function(){return this.isEmpty()?"No elements in Queue":this.items[0]},r.prototype.size=function(){return this.items.length},r.prototype.clear=function(){this.items=[]},r.prototype.all=function(){return this.items};var A,o=r;function r(){this.items=[],this.items=[]}t.Queue=o,t.errorList={TIMEOUT:{code:100001,msg:"network timeout"},DATAEXIST:{code:100002,msg:"data exist"},BROKEN:{code:100003,msg:"network broken"}},t.SOCKET_DISCONNECT=-1,(o=t.ENUM_NETWORK_STATE||(t.ENUM_NETWORK_STATE={}))[o.offline=0]="offline",o[o.online=1]="online",Object.defineProperty(s.prototype,"id",{get:function(){return this.h||null},set:function(e){this.h=e},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"data",{get:function(){return this.v},set:function(e){this.v=e},enumerable:!1,configurable:!0}),s.prototype.hasNext=function(){return this.next&&this.next.id},s.prototype.hasPrev=function(){return this.prev&&this.prev.id};var n=s;function s(e,t){void 0===e&&(e=null),void 0===t&&(t=null),this.next=null,this.prev=null,this.h=e,this.v=t}function a(){this.start=new n,this.end=new n,this.g=0,this._=0,this.start.next=this.end,this.start.prev=null,this.end.prev=this.start,this.end.next=null}t.ListNode=n,a.prototype.insertBefore=function(e,t){return(t=new n(this.g,t)).next=e,t.prev=e.prev,e.prev&&(e.prev.next=t),e.prev=t,++this.g,++this._,t},a.prototype.addLast=function(e){return this.insertBefore(this.end,e)},a.prototype.add=function(e){return this.addLast(e)},a.prototype.getFirst=function(){return 0===this._?null:this.start.next},a.prototype.getLast=function(){return 0===this._?null:this.end.prev},a.prototype.size=function(){return this._},a.prototype.getFromFirst=function(e){var t=0,i=this.start.next;if(0<=e)for(;t<e&&null!==i;)i=i.next,++t;else i=null;if(null===i)throw"Index out of bounds.";return i},a.prototype.get=function(e){return 0===e?this.getFirst():e===this._-1?this.getLast():this.getFromFirst(e)},a.prototype.remove=function(e){return e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),--this._,e},a.prototype.removeFirst=function(){return 0<this._&&this.start.next?this.remove(this.start.next):null},a.prototype.removeLast=function(){return 0<this._&&this.end.prev?this.remove(this.end.prev):null},a.prototype.removeAll=function(){this.start.next=this.end,this.end.prev=this.start,this._=0,this.g=0},a.prototype.each=function(e){for(var t=this.start;t.hasNext();)e(t=t.next)},a.prototype.find=function(e){for(var t=this.start,i=!1,A=null;t.hasNext()&&!i;)e(t=t.next)&&(A=t,i=!0);return A},a.prototype.map=function(e){for(var t=this.start,i=[];t.hasNext();)e(t=t.next)&&i.push(t);return i},a.prototype.push=function(e){return this.addLast(e)},a.prototype.unshift=function(e){0<this._?this.insertBefore(this.start.next,e):this.insertBefore(this.end,e)},a.prototype.pop=function(){return this.removeLast()},a.prototype.shift=function(){return this.removeFirst()},t.LinkedList=a},function(e,t,i){var A=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var A,o,r=i.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(A=r.next()).done;)n.push(A.value)}catch(e){o={error:e}}finally{try{A&&!A.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n},o=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(A(arguments[t]));return e},r=(Object.defineProperty(t,"u",{value:!0}),t.ContextAPI=t.suppressInstrumentation=t.ROOT_CONTEXT=t.BaseContext=t.setSpan=t.getSpanContext=t.getSpan=t.createContextKey=void 0,i(16));function n(e){return Symbol.for(e)}var s=(t.createContextKey=n)("OpenTelemetry Context Key SUPPRESS_INSTRUMENTATION"),a=n("OpenTelemetry Context Key SPAN");function g(e){return e.getValue(a)||void 0}function I(e){this.O=e,this.S=new r.StackContextManager}t.getSpan=g,t.getSpanContext=function(e){return null==(e=g(e))?void 0:e.context()},t.setSpan=function(e,t){return e.setValue(a,t)},t.BaseContext=i=function e(t){var i=this;i.M=t?new Map(t):new Map,i.getValue=function(e){return i.M.get(e)},i.setValue=function(t,A){var o=new e(i.M);return o.M.set(t,A),o},i.deleteValue=function(t){var A=new e(i.M);return A.M.delete(t),A}},t.ROOT_CONTEXT=new i,t.suppressInstrumentation=function(e){return e.setValue(s,!0)},I.getInstance=function(e){return void 0===e&&(e="context"),this.j||(this.j=new I(e)),this.j},I.prototype.active=function(){return this.S.active()},I.prototype.with=function(e,t,i){for(var A,r=[],n=3;n<arguments.length;n++)r[n-3]=arguments[n];return(A=this.T()).with.apply(A,o([e,t,i],r))},I.prototype.T=function(){return this.S},t.ContextAPI=I},function(e,t,i){var A,o;Object.defineProperty(t,"u",{value:!0}),t.INVALID_SPAN_CONTEXT=t.INVALID_TRACEID=t.INVALID_SPANID=t.TraceFlags=t.SpanKind=t.SpanStatusCode=void 0,(A=t.SpanStatusCode||(t.SpanStatusCode={}))[A.UNSET=0]="UNSET",A[A.OK=1]="OK",A[A.ERROR=2]="ERROR",(A=t.SpanKind||(t.SpanKind={}))[A.INTERNAL=0]="INTERNAL",A[A.SERVER=1]="SERVER",A[A.CLIENT=2]="CLIENT",A[A.PRODUCER=3]="PRODUCER",A[A.CONSUMER=4]="CONSUMER",(o=A=t.TraceFlags||(t.TraceFlags={}))[o.NONE=0]="NONE",o[o.SAMPLED=1]="SAMPLED",t.INVALID_SPANID="0000000000000000",t.INVALID_TRACEID="00000000000000000000000000000000",t.INVALID_SPAN_CONTEXT={traceId:t.INVALID_TRACEID,spanId:t.INVALID_SPANID,traceFlags:A.NONE}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.log=t.ZegoLog=void 0,o.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.join("")},o.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e.join("");console.debug(i)},o.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.join("")},o.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.join("")},o.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e.join("");console.error(i)};var A=o;function o(){}A=new(t.ZegoLog=A),t.log=A},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.FAIL_TIME=t.FAIL_MAX_COUNT=t.FAIL_COUNT=t.STORE_SIZE=t.CACHE_SIZE=t.BUCKET_CONFIG=t.DEFAULT_CONFIG=void 0,t.DEFAULT_CONFIG={importantLevel:0,reportSize:3e3,reportNum:10,bps:16e3,netTimeout:10},t.BUCKET_CONFIG={bucketSize:1e4,tokensPerInterval:1600},t.CACHE_SIZE={totalAvailCache:102400,cacheMaxSize:2e4,cacheDelPer:.2},t.STORE_SIZE={totalDBSize:2048e3,storeDelPer:.2},t.FAIL_COUNT=5,t.FAIL_MAX_COUNT=10,t.FAIL_TIME=30},function(e,t,i){var A=this&&this.__importDefault||function(e){return e&&e.u?e:{default:e}},o=(Object.defineProperty(t,"u",{value:!0}),t.uuid=t.calculateMemSize=t.analyzeKey=t.getCurrentTime=t.getCurrentEnv=t.getBrowser=void 0,i(0)),r=A(i(31)),n=(t.getBrowser=function(){var e=window.navigator.userAgent,t=null!=window.ActiveXObject&&-1!=e.indexOf("MSIE"),i=-1!=e.indexOf("Firefox"),A=null!=window.opr,r=e.indexOf("Chrome")&&window.chrome,n=-1!=e.indexOf("Safari")&&-1!=e.indexOf("Version");return e=e.toLowerCase().match(/MicroMessenger/i)&&"micromessenger"===e.toLowerCase().match(/MicroMessenger/i)[0],t?o.ZEGO_BROWSER_TYPE.IE:i?o.ZEGO_BROWSER_TYPE.FIREFOX:A?o.ZEGO_BROWSER_TYPE.OPERA:r?o.ZEGO_BROWSER_TYPE.CHROME:n?o.ZEGO_BROWSER_TYPE.SAFARI:e?o.ZEGO_BROWSER_TYPE.WEIXIN:o.ZEGO_BROWSER_TYPE.UNKOWN},t.getCurrentEnv=function(){var e=window.navigator.userAgent;return new Promise((function(t){-1==e.indexOf("MicroMessage")?t(o.ZEGO_ENV.BROWSER):wx.miniProgram.getEnv((function(e){e.miniprogram}))}))},["00","01","02","03","04","05","06","07","08","09"]);t.getCurrentTime=function(){var e=new Date;return[e.getFullYear()+"/",(n[e.getMonth()+1]||e.getMonth()+1)+"/",(n[e.getDate()]||e.getDate())+" ",(n[e.getHours()]||e.getHours())+":",(n[e.getMinutes()]||e.getMinutes())+":",n[e.getSeconds()]||e.getSeconds(),"."+e.getTime()%1e3].join("")},t.analyzeKey=function(e){return e=e.split("_"),{level:Number(e[0]),timestamp:e[1],seq:e[2]}},t.calculateMemSize=function(e){return r.default(e)},t.uuid=function(e,t){var i,A,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[];if(t=t||o.length,e)for(i=0;i<e;i++)r[i]=o[0|Math.random()*t];else for(r[8]=r[13]=r[18]=r[23]="-",r[14]="4",i=0;i<36;i++)r[i]||(A=0|16*Math.random(),r[i]=o[19==i?3&A|8:A]);return r.join("")}},function(e,t,i){var A=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],A=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&A>=e.length?void 0:e)&&e[A++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var A,o,r=i.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(A=r.next()).done;)n.push(A.value)}catch(e){o={error:e}}finally{try{A&&!A.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n};function r(e){var t,i,o;if(null!=e&&Array.isArray(e))try{for(var r=A(e),n=r.next();!n.done;n=r.next()){var s=n.value;if(null!=s)if(o){if(typeof s!==o)return!1}else o=typeof s}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return!0}Object.defineProperty(t,"u",{value:!0}),t.sanitizeAttributes=t.isAttributeValue=void 0,t.isAttributeValue=r,t.sanitizeAttributes=function(e){var t,i,n={};if(null!=e&&"object"==typeof e)try{for(var s=A(Object.entries(e)),a=s.next();!a.done;a=s.next()){var g=o(a.value,2),I=g[0],h=g[1];r(h)&&(Array.isArray(h)?n[I]=h.slice():n[I]=h)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}return n}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.IdGenerator=void 0;var A=Array(32);function o(e){return function(){for(var t=0;t<2*e;t++)A[t]=Math.floor(16*Math.random())+48,58<=A[t]&&(A[t]+=39);return String.fromCharCode.apply(null,A.slice(0,2*e))}}t.IdGenerator=function(){this.generateTraceId=o(16),this.generateSpanId=o(8),this.generateEventId=o(4)}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.Resource=t.SDK_INFO=t.SemanticResourceAttributes=void 0,t.SemanticResourceAttributes={PROCESS_RUNTIME_NAME:"process.runtime.name",TELEMETRY_SDK_NAME:"telemetry.sdk.name",TELEMETRY_SDK_LANGUAGE:"telemetry.sdk.language",TELEMETRY_SDK_VERSION:"telemetry.sdk.version"},t.SDK_INFO=((A={})[t.SemanticResourceAttributes.TELEMETRY_SDK_NAME]="opentelemetry",A[t.SemanticResourceAttributes.PROCESS_RUNTIME_NAME]="browser",A[t.SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]="webjs",A[t.SemanticResourceAttributes.TELEMETRY_SDK_VERSION]=t.VERSION,A),o.empty=function(){return o.EMPTY},o.createTelemetrySDKResource=function(){var e;return new o(((e={})[t.SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]=t.SDK_INFO[t.SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE],e[t.SemanticResourceAttributes.TELEMETRY_SDK_NAME]=t.SDK_INFO[t.SemanticResourceAttributes.TELEMETRY_SDK_NAME],e[t.SemanticResourceAttributes.TELEMETRY_SDK_VERSION]=t.SDK_INFO[t.SemanticResourceAttributes.TELEMETRY_SDK_VERSION],e))},o.prototype.merge=function(e){return e&&Object.keys(e.attributes).length?new o(Object.assign({},this.attributes,e.attributes)):this},o.EMPTY=new o({});var A=o;function o(e){this.attributes=e}t.Resource=A},function(e,t,i){var A=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],A=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&A>=e.length?void 0:e)&&e[A++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var A,o,r=i.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(A=r.next()).done;)n.push(A.value)}catch(e){o={error:e}}finally{try{A&&!A.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n},r=(Object.defineProperty(t,"u",{value:!0}),t.Span=void 0,i(6)),n=i(1),s=i(2),a=i(7),g=i(17);function I(e,t,i,A,o,r,n,g){void 0===g&&(g=[]),this.attributes={},this.links=[],this.events=[],this.status={code:s.SpanStatusCode.UNSET},this.endTime=0,this.N=!1,this.A=0,this.exported=!0,this.R=e.context,this.reporter=e.reporter,this.spanProcessor=e.spanProcessor,this.parentTracer=e,this.name=i,this.level=A,this.spanContext=o,this.parentSpanId=n,this.kind=r,this.links=g,this.startTime=Date.now(),this.resource=e.resource,this.instrumentationLibrary=e.instrumentationLibrary,this.k=e.getActiveTraceParams(),this.I=new a.IdGenerator}I.prototype.context=function(){return this.spanContext},I.prototype.setAttribute=function(e,t){return null==t||0===e.length||!r.isAttributeValue(t)||Object.keys(this.attributes).length>=this.k.numberOfAttributesPerSpan&&!Object.prototype.hasOwnProperty.call(this.attributes,e)||(this.attributes[e]=t),this},I.prototype.appendAttribute=function(e,t){return null==t||0===e.length||!r.isAttributeValue(t)||Object.keys(this.attributes).length>=this.k.numberOfAttributesPerSpan&&!Object.prototype.hasOwnProperty.call(this.attributes,e)||(this.attributes[e]&&Array.isArray(this.attributes[e])?this.attributes[e].push(t):this.attributes[e]=[t]),this},I.prototype.setAttributes=function(e){var t,i;try{for(var r=A(Object.entries(e)),n=r.next();!n.done;n=r.next()){var s=o(n.value,2),a=s[0],g=s[1];this.setAttribute(a,g)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return this},I.prototype.addEvent=function(e,t,i){this.events.length>=this.k.numberOfEventsPerSpan&&this.events.shift();var A=this.I.generateEventId();return g.isTimeInput(t)&&(void 0===i&&(i=t),t=void 0),void 0===i&&(i=g.hrTime()),this.events.push({name:e,attributes:t,time:g.timeInputToHrTime(i),event_id:A}),this},I.prototype.setStatus=function(e){return this.status=e,this},I.prototype.updateName=function(e){return this.name=e,this},I.prototype.end=function(e){var t,i=this;this.D()||(this.N=!0,this.resource=this.parentTracer.resource,this.spanProcessor.spanBeforeEnd&&this.spanProcessor.spanBeforeEnd(this),t=g.getCurrentTime(),this.setAttribute("e_time_s",t),this.endTime=Date.now(),this.A=this.endTime-this.startTime,this.R.with(n.suppressInstrumentation(this.R.active()),(function(){var t=i.P(i);i.spanProcessor.spanEnd&&i.spanProcessor.spanEnd(t,i.level),t.droped||!1===e||(delete t.droped,i.reporter.report(JSON.stringify(t),i.level))})))},I.prototype.spanReport=function(){var e=this.P(this);this.reporter.report(JSON.stringify(e),this.level)},I.prototype.isRecording=function(){return!1===this.N},Object.defineProperty(I.prototype,"duration",{get:function(){return this.A},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"ended",{get:function(){return this.N},enumerable:!1,configurable:!0}),I.prototype.D=function(){return this.N,this.N},I.prototype.P=function(e){var t=[],i=(e.events.forEach((function(e){var i={};Object.keys(e).forEach((function(t){"name"===t&&(i[t]=e[t]),"time"===t&&(i.timestamp=g.hrTimeToMilliseconds(e[t])),"attributes"===t&&(i.tags=e[t])})),t.push(i)})),[]);return e.links.forEach((function(e){i.push({span_id:e.context.spanId,trace_id:e.context.traceId})})),{trace_id:e.spanContext.traceId,parent_span_id:e.parentSpanId,name:e.name,span_id:e.spanContext.spanId,kind:e.kind,start_time:e.startTime,end_time:e.endTime,duration:e.duration,logs:t,tags:e.attributes,links:i}},t.Span=I},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.ZegoSpan=void 0;var A=i(3),o=i(9);function r(e,t){this.spanId=e,this.span=t}r.prototype.setAttribute=function(e,t){var i=this;return this.span?this.span.setAttribute(e,t):this.B().then((function(){i.span&&i.span.setAttribute(e,t)})),this},r.prototype.setAttributes=function(e){var t=this;return this.span?this.span.setAttributes(e):this.B().then((function(){t.span&&t.span.setAttributes(e)})),this},r.prototype.appendAttribute=function(e,t){var i=this;return this.span?this.span.appendAttribute(e,t):this.B().then((function(){i.span&&i.span.appendAttribute(e,t)})),this},r.prototype.addEvent=function(e,t,i){var A=this;return this.span?this.span.addEvent(e,t,i):this.B().then((function(){A.span&&A.span.addEvent(e,t,i)})),this},r.prototype.setStatus=function(e){var t=this;return this.span?this.span.setStatus(e):this.B().then((function(){t.span&&t.span.setStatus(e)})),this},r.prototype.updateName=function(e){var t=this;return this.span?this.span.updateName(e):this.B().then((function(){t.span&&t.span.updateName(e)})),this},r.prototype.end=function(e){var t=this;void 0===e&&(e=!0),this.span?this.span.end(e):this.B(!0).then((function(){t.span&&t.span.end(e),t.U()}))},r.prototype.setSpanActive=function(e){this.activeCallback=e},r.prototype.setSpanEnd=function(e){this.endCallback=e},r.prototype.spanReport=function(){var e;null!=(e=this.span)&&e.spanReport()},r.prototype.U=function(){this.J()||(this.L(this.spanId),this.endCallback&&this.endCallback(this.spanInfo))},r.prototype.J=function(){return"noop"===this.spanId},r.prototype.B=function(e){var t=this;return void 0===e&&(e=!1),new Promise((function(i,A){t.store.getItem(t.spanId).then((function(A){var n=new o.Span(r.tracer,r.tracer.context.active(),A.name,A.level,A.spanContext,A.kind,A.parentSpanId,A.links);n.setStatus(A.status),n.setAttributes(A.attributes),t.span=n,t.activeCallback&&t.activeCallback(t.spanId,e),i()})).catch((function(e){A(e)}))}))},r.prototype.L=function(e){var t=this;this.store.getItem(e).then((function(i){i&&t.store.removeItem(e).then((function(){A.log.log("remove suc")})).catch((function(e){A.log.warn("remove fail")}))}))},t.ZegoSpan=r},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.createZegoStore=t.ZegoWechatMiniStore=t.ZEGO_ENV=void 0;var A,o,r=i(12),n=((o=A=t.ZEGO_ENV||(t.ZEGO_ENV={}))[o.BROWSER=0]="BROWSER",o[o.WEIXINMINI=1]="WEIXINMINI",i(3)),s=(a.prototype.getItem=function(e){var t=this;return new Promise((function(i,A){try{i(wx.getStorageSync(t.keyPrefix+e))}catch(i){A(i)}}))},a.prototype.setItem=function(e,t){var i=this;return new Promise((function(A,o){try{wx.setStorageSync(i.keyPrefix+e,t),A()}catch(A){o(A)}}))},a.prototype.removeItem=function(e){var t=this;return new Promise((function(i,A){try{i(wx.removeStorageSync(t.keyPrefix+e))}catch(i){A(i)}}))},a.prototype.clear=function(){return new Promise((function(e,t){try{wx.clearStorageSync(),e()}catch(e){t(e)}}))},a.prototype.keys=function(){var e=this;return new Promise((function(t,i){try{var A=wx.getStorageInfoSync().keys,o=(n.log.warn("keys",A),[]);A.forEach((function(t){0==t.indexOf(e.keyPrefix)&&o.push(t.replace(e.keyPrefix,""))})),n.log.warn("keyArr",JSON.stringify(o)),o.sort(),t(o)}catch(t){i(t)}}))},a);function a(e){this.storeName=e,this.keyPrefix=e+"/",this.storeName}t.ZegoWechatMiniStore=s,t.createZegoStore=function(e,t,i){return t===A.BROWSER?r.createInstance({name:e+":"+(i||"store")}):new s(e)}},function(t,i){t.exports=e},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.DynamicCode=t.ZegoTracer=t.ZegoSpan=void 0;var A=i(14),o=(Object.defineProperty(t,"ZegoTracer",{enumerable:!0,get:function(){return A.ZegoTracer}}),i(46)),r=(Object.defineProperty(t,"DynamicCode",{enumerable:!0,get:function(){return o.DynamicCode}}),i(10));Object.defineProperty(t,"ZegoSpan",{enumerable:!0,get:function(){return r.ZegoSpan}})},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.ZegoTracer=void 0;var A=i(15),o=i(21),r=i(10),n=i(22),s=i(3),a=i(1),g=i(8),I=i(23),h=i(39),c=i(11),C=i(44),u=i(45);function l(e){this.q=n.DEFAULT_MAX_SPAN_SIZE,this.level=0,this.log=new C.ZegoLog,this.stateCenter=new u.StateCenter(this.log),this.stateCenter.proxyCtrl=e}l.prototype.init=function(e){this.options=e,this.name=e.product,this.reporter=new I.ZegoDataReport(this.name,this.stateCenter),this.reporter.init({appID:e.appID,env:e.env||0,importantLevel:e.importantLevel,levels:e.levels,deviceID:e.deviceID,bps:e.bps,serverUrl:e.serverUrl}),this.tracer=new A.Tracer({name:this.name,version:e.version},{resource:new g.Resource(e.resources)},this.reporter,{spanStart:e.spanStart,spanBeforeEnd:e.spanBeforeEnd,spanEnd:e.spanEnd}),this.reporter.setProcessData(this.tracer.resource.attributes),this.C(this.options),this.dyStore=c.createZegoStore(e.product+"_"+e.appID+"_dy",e.env||0)},l.prototype.C=function(e){this.rootSpan=this.tracer.startSpan("root",0);var t=a.setSpan(this.tracer.context.active(),this.rootSpan);this.tracer.context.T().M=t,this.rootSpan.end()},l.prototype.createSpan=function(e,t,i){var A,g;return e<=this.level?(A=i&&i.parent?a.setSpan(this.tracer.context.active(),i.parent.span):a.setSpan(this.tracer.context.active(),this.rootSpan),g=[],i&&i.linkSpans&&(i.linkSpans.forEach((function(e){g.push({context:e.span.context()})})),delete i.linkSpans),t=this.tracer.startSpan(t,e,Object.assign({},i,{links:g}),A),e=new r.ZegoSpan(t.spanContext.spanId,t),r.ZegoSpan.tracer=this.tracer,e):(s.log.warn("createSpan level not fix"),new r.ZegoSpan(n.NOOP_SPAN_ID,new o.NoopSpan))},l.prototype.setLogger=function(e){this.stateCenter.logger=e},l.prototype.setTimeOffset=function(e){this.reporter.setTimeOffset(e)},l.prototype.setWaitNtpTimeout=function(e){this.reporter.setWaitNtpTimeout(e)},l.prototype.setLogLevel=function(e){return this.stateCenter.F.setLogLevel(e)},l.prototype.startReport=function(e){return this.reporter.startReport(e)},l.prototype.setConfig=function(e){this.reporter.setConfig(e)},l.prototype.loadJs=function(e,t,i,A,o,r){return h.loadJS(e,this.dyStore,t,i,A,o,r)},l.prototype.flush=function(e){this.reporter.flush(e)},l.prototype.setUnloadState=function(e){this.reporter.setUnloadState(e)},l.prototype.shutdown=function(){this.reporter.saveDataBeforeUnload()},l.prototype.destroy=function(){this.reporter.uninit()},l.prototype.setSampleConfig=function(e){this.level=e.level||this.level},l.prototype.setResource=function(e){this.tracer.setResource(e),this.reporter.setProcessData(this.tracer.resource.attributes)},l.prototype.setNetStateCheck=function(){this.reporter.setNetStateCheck()},t.ZegoTracer=l},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.Tracer=void 0;var A=i(6),o=i(1),r=i(2),n=i(7),s=i(8),a=i(9),g=i(18),I=i(19);function h(e,t,i,A){var r=I.mergeConfig(t);this.k=r.traceParams,this.I=new n.IdGenerator,this.resource=null!=(r=t.resource)?r:s.Resource.createTelemetrySDKResource(),this.instrumentationLibrary=e,t=Math.random().toString(36).slice(-6),this.context=new o.ContextAPI(t),this.reporter=i,this.spanProcessor=A||{}}h.prototype.startSpan=function(e,t,i,n){var s,I,h,c=((e,t)=>{if(!e.root)return o.getSpanContext(t)})(i=void 0===i?{}:i,n=void 0===n?this.context.active():n),C=this.I.generateSpanId(),u=(c&&g.isSpanContextValid(c)?(s=c.traceId,I=c.traceState,h=c.spanId):s=this.I.generateTraceId(),c=null!=(c=i.kind)?c:r.SpanKind.INTERNAL,null!=(u=i.links)?u:[]),l=(i=A.sanitizeAttributes(i.attributes),r.TraceFlags.NONE);return(n=new a.Span(this,n,e,t,{traceId:s,spanId:C,traceFlags:l,traceState:I},c,h,u)).setAttributes(i),this.spanProcessor.spanStart&&this.spanProcessor.spanStart(n),n},h.prototype.setResource=function(e){this.resource=this.resource.merge(new s.Resource(e))},h.prototype.getActiveTraceParams=function(){return this.k},t.Tracer=h},function(e,t,i){var A=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var A,o,r=i.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(A=r.next()).done;)n.push(A.value)}catch(e){o={error:e}}finally{try{A&&!A.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n},o=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(A(arguments[t]));return e},r=(Object.defineProperty(t,"u",{value:!0}),t.StackContextManager=void 0,i(1));function n(){this.W=!1,this.M=r.ROOT_CONTEXT}n.prototype.X=function(e,t){function i(){for(var i=this,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];return A.with(t,(function(){return e.apply(i,o)}))}void 0===t&&(t=r.ROOT_CONTEXT);var A=this;return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),i},n.prototype.active=function(){return this.M},n.prototype.bind=function(e,t){return void 0===(t=void 0===t?r.ROOT_CONTEXT:t)&&(t=this.active()),"function"==typeof e?this.X(e,t):e},n.prototype.disable=function(){return this.M=r.ROOT_CONTEXT,this.W=!1,this},n.prototype.enable=function(){return this.W||(this.W=!0,this.M=r.ROOT_CONTEXT),this},n.prototype.with=function(e,t,i){for(var A=[],n=3;n<arguments.length;n++)A[n-3]=arguments[n];var s=this.M;this.M=e||r.ROOT_CONTEXT;try{return t.call.apply(t,o([i],A))}finally{this.M=s}},t.StackContextManager=n},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.getCurrentTime=t.isTimeInput=t.hrTimeToMilliseconds=t.hrTimeDuration=t.timeInputToHrTime=t.isTimeInputHrTime=t.hrTime=void 0;var A=9,o=Math.pow(10,A),r=["00","01","02","03","04","05","06","07","08","09"];function n(e){e/=1e3;var t=Math.trunc(e);return[t,Number((e-t).toFixed(A))*o]}function s(){var e,t=performance.timeOrigin;return"number"!=typeof t?(e=performance).timing&&e.timing.fetchStart:t}function a(e){var t=n(s()),i=(e=n("number"==typeof e?e:performance.now()),t[0]+e[0]);return o<(t=t[1]+e[1])&&(t-=o,i+=1),[i,t]}function g(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}t.hrTime=a,t.isTimeInputHrTime=g,t.timeInputToHrTime=function(e){if(g(e))return e;if("number"==typeof e)return(e<s()?a:n)(e);if(e instanceof Date)return n(e.getTime());throw TypeError("Invalid input type")},t.hrTimeDuration=function(e,t){var i=t[0]-e[0];return(t=t[1]-e[1])<0&&(--i,t+=o),[i,t]},t.hrTimeToMilliseconds=function(e){return Math.round(1e3*e[0]+e[1]/1e6)},t.isTimeInput=function(e){return g(e)||"number"==typeof e||e instanceof Date},t.getCurrentTime=function(){var e=new Date;return[e.getFullYear()+"/",(r[e.getMonth()+1]||e.getMonth()+1)+"/",(r[e.getDate()]||e.getDate())+" ",(r[e.getHours()]||e.getHours())+":",(r[e.getMinutes()]||e.getMinutes())+":",r[e.getSeconds()]||e.getSeconds(),"."+e.getTime()%1e3].join("")}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.isSpanContextValid=t.isValidSpanId=t.isValidTraceId=t.INVALID_SPAN_CONTEXT=t.INVALID_TRACEID=t.INVALID_SPANID=void 0,i=i(2);var A=/^([0-9a-f]{32})$/i,o=/^[0-9a-f]{16}$/i;function r(e){return A.test(e)&&e!==t.INVALID_TRACEID}function n(e){return o.test(e)&&e!==t.INVALID_SPANID}t.INVALID_SPANID="0000000000000000",t.INVALID_TRACEID="00000000000000000000000000000000",t.INVALID_SPAN_CONTEXT={traceId:t.INVALID_TRACEID,spanId:t.INVALID_SPANID,traceFlags:i.TraceFlags.NONE},t.isValidTraceId=r,t.isValidSpanId=n,t.isSpanContextValid=function(e){return r(e.traceId)&&n(e.spanId)}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.mergeConfig=void 0;var A=i(20);t.mergeConfig=function(e){var t=Object.assign({},A.DEFAULT_CONFIG,e);return t.traceParams=Object.assign({},A.DEFAULT_CONFIG.traceParams,e.traceParams||{}),t}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.DEFAULT_CONFIG=void 0,t.DEFAULT_CONFIG={traceParams:{numberOfAttributesPerSpan:128,numberOfLinksPerSpan:128,numberOfEventsPerSpan:128}}},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.NoopSpan=void 0;var A=i(2);function o(e){void 0===e&&(e=A.INVALID_SPAN_CONTEXT),this.K=e}o.prototype.context=function(){return this.K},o.prototype.setAttribute=function(e,t){return this},o.prototype.appendAttribute=function(e,t){return this},o.prototype.setAttributes=function(e){return this},o.prototype.addEvent=function(e,t,i){return this},o.prototype.setStatus=function(e){return this},o.prototype.updateName=function(e){return this},o.prototype.end=function(e){},o.prototype.isRecording=function(){return!1},o.prototype.spanReport=function(){},o.prototype.recordException=function(e,t){},t.NoopSpan=o},function(e,t,i){Object.defineProperty(t,"u",{value:!0}),t.NOOP_SPAN_ID=t.SCHEDULED_DELAY_MILLIS=t.DEFAULT_MAX_SPAN_SIZE=t.readSpanKeys=void 0,t.readSpanKeys=["name","level","kind","spanContext","parentSpanId","startTime","endTime","status","attributes","links","events","duration","ended","resource","instrumentationLibrary"],t.DEFAULT_MAX_SPAN_SIZE=1e3,t.SCHEDULED_DELAY_MILLIS=3e3,t.NOOP_SPAN_ID="noop"},function(e,t,i){var A=this&&this.__assign||function(){return(A=Object.assign||function(e){for(var t,i=1,A=arguments.length;i<A;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,i,A){return new(i=i||Promise)((function(o,r){function n(e){try{a(A.next(e))}catch(e){r(e)}}function s(e){try{a(A.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?o(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(n,s)}a((A=A.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var i,A,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},n={next:s(0),throw:s(1),return:s(2)};return"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){var a=[n,s];if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,A&&(o=2&a[0]?A.return:a[0]?A.throw||((o=A.return)&&o.call(A),0):A.next)&&!(o=o.call(A,a[1])).done)return o;switch(A=0,(a=o?[2&a[0],o.value]:a)[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,A=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(o=0<(o=r.trys).length&&o[o.length-1])&&(6===a[0]||2===a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3]))r.label=a[1];else if(6===a[0]&&r.label<o[1])r.label=o[1],o=a;else{if(!(o&&r.label<o[2])){o[2]&&r.ops.pop(),r.trys.pop();continue}r.label=o[2],r.ops.push(a)}}a=t.call(e,r)}catch(s){a=[6,s],A=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}},n=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var A,o,r=i.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(A=r.next()).done;)n.push(A.value)}catch(e){o={error:e}}finally{try{A&&!A.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n},s=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],A=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&A>=e.length?void 0:e)&&e[A++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},g=(Object.defineProperty(t,"u",{value:!0}),t.ZegoDataReport=void 0,i(0)),I=i(24),h=i(30),c=i(38),C=i(5),u=i(4);function l(e,t){this.G=t,this.QUEUE_MAX=100,this.cacheMaxSize=u.CACHE_SIZE.cacheMaxSize,this.cacheDelPer=u.CACHE_SIZE.cacheDelPer,this.state="normal",this.forceDataTotalLen=0,this.reportPackagesSize=0,this.staticConfig={totalAvailCache:u.CACHE_SIZE.totalAvailCache,totalDBSize:u.STORE_SIZE.totalDBSize,bps:1600},this.dataInDb=[],this.listenerList={progressUpdate:[],forceResult:[],postFail:[],dataDroped:[]},this.tempBuffer=[],this.traceType={MEM_I_API:0,MEM_O_DONE:0,MEM_O_DUMP:0,MEM_I_LOAD:0,DB_O_DROP:0,DB_O_DONE:0,DB_I_BACKUP:0},this.isPaused=!1,this.pro="json",this.isLoadReportData=!1,this.dropCount=0,this.timeInterval=!1,this.isWaitNtpTimeout=!1,this.waitNtpTimeout=2e3,this.postDataState="",this.product=e,this.reportMap=new Map}l.prototype.init=function(e){return o(this,void 0,void 0,(function(){var t=this;return r(this,(function(i){switch(i.label){case 0:return this.config=A(A({},u.DEFAULT_CONFIG),e),this.config.env%2!=1&&this.H(),this.zegoService=new I.ZegoService(this.config.env||g.ZEGO_ENV.BROWSER,this.config.bps||u.DEFAULT_CONFIG.bps,this.product,this.pro,this.G),this.zegoService.setLogUrlParams({product:this.product,signature:this.config.token||"",appid:this.config.appID,id_name:this.config.userID||"",deviceid:this.config.deviceID||""}),this.config.serverUrl&&this.zegoService.setLogServer(this.config.serverUrl),this.zegoService.setPostSucCallback(this.product,this.Y.bind(this)),this.zegoService.setPostFailCallback(this.product,(function(e){return o(t,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return this.G.logger.warn("zt.zd.i fail"),this.postDataState="fail",this.dropCount++,this.V(e),[4,this.Z(1)];case 1:return t.sent(),this.$("postFail"),[2]}}))}))})),this.tt(),this.storeHandler=new h.ZegoStoreHandler(this.product+"_"+this.config.appID+"_datareporter",C.uuid(6),this.config,this.traceType,this.staticConfig,this.G,this.product),this.storeHandler.setDropCallBack((function(e){t.traceType.DB_O_DROP+=C.calculateMemSize(e),t.$("dataDroped",e)})),[4,this.storeHandler.loadPendingData()];case 1:return i.sent(),this.storeHandler.init().then((function(){t.it()})).catch((function(e){})),this.nt(),this.rt(),this.et(),[2]}}))}))},l.prototype.uninit=function(){this.isWaitNtpTimeout=!1,this.ntpTimer&&(clearTimeout(this.ntpTimer),this.ntpTimer=null),this.zegoService.destroy()},l.prototype.setConfig=function(e){"object"==typeof e&&"number"==typeof e.bps&&(this.config.bps=e.bps,this.zegoService.setBps(this.config.bps)),"object"==typeof e&&"number"==typeof e.totalDBSize&&(this.staticConfig.totalDBSize=e.totalDBSize),"object"==typeof e&&"string"==typeof e.serverUrl&&""!==e.serverUrl&&(this.config.serverUrl=e.serverUrl,this.zegoService.setLogServer(this.config.serverUrl))},l.prototype.pause=function(){this.isPaused=!0},l.prototype.resume=function(){this.isPaused=!1;var e=this.pendingQueue.getPendingDataInfo(),t=e.pendingDataSize;this.st(t,e.size)},l.prototype.startReport=function(e){var t=e.get("userID"),i=e.get("token");return!(!t||"string"!=typeof t||!i||"string"!=typeof i||(this.startCommonField=e,this.config.userID=t,this.config.token=i,this.zegoService.setLogUrlParams({product:this.product,signature:this.config.token,appid:this.config.appID,id_name:this.config.userID||"",deviceid:this.config.deviceID||""}),this.ut()&&this.ot(),(t=e.get("serverUrl"))&&(this.config.serverUrl=t,this.zegoService.setLogServer(this.config.serverUrl)),this.isConfigOK(this.config)&&(e=(i=this.pendingQueue.getPendingDataInfo()).pendingDataSize,this.st(e,i.size)),0))},l.prototype.setTimeOffset=function(e){var t=this;this.clientTimeOffset=e,this.tempBuffer.forEach((function(e){(e=e.data).tags.time_offset||(e.tags.time_offset=t.clientTimeOffset)})),this.config.userID&&this.ot()},l.prototype.setProcessData=function(e){this.G.processData=e},l.prototype.on=function(e,t){return this.ht(e,t)},l.prototype.off=function(e,t){return this.ct(e,t)},l.prototype.report=function(e,t){var i;if(15e3<e.length)return!1;try{i=JSON.parse(e)}catch(e){return!1}return this.G.F.debug(e+" "+t),(null!=i&&i.id_name||null!=(e=null==i?void 0:i.tags)&&e.id_name||this.config.userID)&&this.ut()?(null!=i&&i.id_name||null!=(e=null==i?void 0:i.tags)&&e.id_name?this.clientTimeOffset&&(i.tags.time_offset=this.clientTimeOffset):(this.clientTimeOffset&&(i.tags.time_offset=this.clientTimeOffset),i.tags.id_name=this.config.userID),this.ft(JSON.stringify(i),t)):this.tempBuffer.push({data:i,level:t}),!0},l.prototype.setUnloadState=function(e){this.unloadLevel=e,this.state="unload"},l.prototype.ft=function(e,t){var i=this,A=C.calculateMemSize(e),o=(this.traceType.MEM_I_API+=A,g.getSeq()),r=(new Date).getTime(),n={seq:o,content:e,level:t,timestamp:r};"unload"===this.state?void 0!==this.unloadLevel&&t<=this.unloadLevel?(this.storeHandler.saveDataToStorage(n),this.pendingQueue.enqueue(n,t)):this.G.F.debug("level is low"):t<=this.config.importantLevel?(n.key=t+"_"+r+"_"+o,this.dataInDb.push(n.key),this.storeHandler.storeData(n).then((function(e){i.pendingQueue.enqueue(n,t),i.traceType.DB_I_BACKUP+=A})).catch((function(e){var A=i.dataInDb.findIndex((function(e){return e===n.key}));-1<A&&i.dataInDb.splice(A,1),i.pendingQueue.enqueue(n,t)}))):this.pendingQueue.enqueue(n,t),"force"===this.state&&(r=C.calculateMemSize(e),this.forceDataTotalLen+=r)},l.prototype.ut=function(){return this.isWaitNtpTimeout||void 0!==this.clientTimeOffset},l.prototype.ot=function(){var e,t=this.tempBuffer.shift();t&&(e=t.data,t=t.level,e.tags.id_name=this.config.userID,this.ft(JSON.stringify(e),t),this.ot())},l.prototype.isConfigOK=function(e){return""!==e.userID&&""!==e.token&&""!==e.server},l.prototype.testSize=function(e){},l.prototype.flush=function(e){var t;"force"!==this.state&&(this.state="force",t=16e6,"object"==typeof e&&"number"==typeof e.bps&&(t=e.bps),this.zegoService.setBps(t),this.forceDataTotalLen=this.storeHandler.storeSize+this.pendingQueue.pendingDataSize+this.reportPackagesSize,0<(t=(e=this.pendingQueue.getPendingDataInfo()).pendingDataSize)?this.st(t,e.size):this.it())},l.prototype.setWaitNtpTimeout=function(e){this.waitNtpTimeout=e},l.prototype.rt=function(){var e=this;this.ntpTimer=setTimeout((function(){e.isWaitNtpTimeout=!0,e.config.userID&&e.ot()}),this.waitNtpTimeout)},l.prototype.nt=function(){var e=this,t=(this.G.F.debug("startReportTimer "+new Date),this.timeInterval=!0,this.pendingQueue.getPendingDataInfo()),i=t.pendingDataSize;this.st(i,t.size),this.reportTimer=window.setTimeout((function(){e.nt()}),3e4)},l.prototype.et=function(){return o(this,void 0,void 0,(function(){var e,t,i=this;return r(this,(function(A){switch(A.label){case 0:return t=this.pendingQueue.getPendingDataInfo(),e=t.pendingDataSize,t=t.size,e>this.config.reportSize||t>this.config.reportNum?[4,this.st(e,t)]:[3,2];case 1:return A.sent(),[3,3];case 2:this.it(),A.label=3;case 3:return this.checkDataTimer=window.setTimeout((function(){i.et()}),15e3),[2]}}))}))},l.prototype.H=function(){var e=this,t=navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPhone/i);navigator.userAgent.indexOf("Firefox"),window.addEventListener(t?"pagehide":"beforeunload",(function(){window.event&&(window.event.cancelBubble=!0),e.saveDataBeforeUnload()}))},l.prototype.saveDataBeforeUnload=function(){(e=this.pendingQueue.readStoreData(1)).totalLen;var e=e.storeArr,t=(this.storeHandler.resetCommonStore(),[]);t.push.apply(t,s(e)),e=this.zegoService.readReportQueueData(),t.push.apply(t,s(e)),0<t.length&&this.storeHandler.storePendingData(t)},l.prototype.setNetStateCheck=function(){"fail"===this.postDataState&&this.zegoService.handleNetConnect()},l.prototype.Y=function(e,t,i){return o(this,void 0,void 0,(function(){var i,A,o,n,s,a=this;return r(this,(function(r){switch(r.label){case 0:for(this.G.F.debug("post suc"),this.postDataState="suc",e.forEach((function(e){a.traceType.MEM_O_DONE+=C.calculateMemSize(e.content)})),i=function(t){var i=e[t];A.storeHandler.removeDataItem(i).then((function(e){i.key&&a.reportMap.delete(i.key)})).catch((function(e){}))},A=this,o=0;o<e.length;o++)i(o);return this.reportPackagesSize-=t,s=this.pendingQueue.getPendingDataInfo(),n=s.pendingDataSize,s=s.size,n>this.config.reportSize||s>this.config.reportNum?[4,this.st(n,s)]:[3,2];case 1:return r.sent(),[3,3];case 2:this.it(),r.label=3;case 3:return"force"===this.state&&0==this.reportPackagesSize&&(n=this.reportPackagesSize+this.pendingQueue.pendingDataSize+this.storeHandler.storeSize,s=1-Number((n/this.forceDataTotalLen).toFixed(2)),this.listenerList.progressUpdate&&this.$("progressUpdate",s),0<this.storeHandler.storeSize)&&this.it((function(e){0===e&&(a.state="normal",a.zegoService.setBps(a.config.bps||u.DEFAULT_CONFIG.bps),a.listenerList.forceSuccessCallback)&&a.$("forceResult","SUCCESS")})),[2]}}))}))},l.prototype.st=function(e,t){return o(this,void 0,void 0,(function(){var i,A,o,n,s;return r(this,(function(r){switch(r.label){case 0:return e>this.config.reportSize||t>this.config.reportNum||["force","unload"].includes(this.state)||this.timeInterval?(this.timeInterval=!1,!this.isPaused&&this.config.userID&&this.config.token&&this.config.serverUrl?[3,3]:(this.G.F.debug("isPaused "+this.isPaused+" "+this.userID+" "+this.config.token+" "+this.config.serverUrl),e>=this.cacheMaxSize||this.staticConfig.totalAvailCache<=0?[4,this.Z(this.cacheDelPer)]:[3,2])):[3,7];case 1:r.sent(),r.label=2;case 2:return[2];case 3:return this.zegoService.reportAllowed()?[3,6]:(this.zegoService.resumeReport(),e>=this.cacheMaxSize||this.staticConfig.totalAvailCache<=0?[4,this.Z(this.cacheDelPer)]:[3,5]);case 4:r.sent(),r.label=5;case 5:return[2];case 6:if(o=this.pendingQueue.readReportData(this.config.reportSize),i=o.totalLen,o=o.reportDataArr,i<=0)return[2];for(o=this.lt(o),A=o.packageArr,o=o.packageLen,this.zegoService.report(A,o,this.product,"unload"===this.state),n=0;n<A.length;n++)s=A[n],this.reportMap.set(s.key,s);this.reportPackagesSize+=o,this.pendingQueue.refresh(i),r.label=7;case 7:return[2]}}))}))},l.prototype.tt=function(){var e=this;this.pendingQueue=new c.PendingQueue(this.config.levels,this.product,this.staticConfig,this.G),this.pendingQueue.setListener({enCallback:function(t,i,A){return o(e,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.st(A,i)];case 1:return e.sent(),[2]}}))}))}})},l.prototype.vt=function(){var e=this;this.storeHandler.readStoreDataItem().then((function(t){var i=C.calculateMemSize(t.content);e.traceType.MEM_I_LOAD+=i,e.pendingQueue.enqueue(t,t.level)})).catch((function(e){}))},l.prototype.Z=function(e){return o(this,void 0,void 0,(function(){var t,i,A,o,n,s,g,I,h;return r(this,(function(c){switch(c.label){case 0:i=this.pendingQueue.readStoreData(e),t=i.totalLen,i=i.storeArr,A=function(e){var i,A;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,o.dt(e,t)];case 1:return r.sent(),i=e.level+"_"+e.timestamp+"_"+e.seq,-1<(A=o.dataInDb.findIndex((function(e){return e===i})))&&o.dataInDb.splice(A,1),[3,3];case 2:return r.sent(),[3,3];case 3:return[2]}}))},o=this,c.label=1;case 1:c.trys.push([1,6,7,8]),n=a(i),s=n.next(),c.label=2;case 2:return s.done?[3,5]:(g=s.value,[5,A(g)]);case 3:c.sent(),c.label=4;case 4:return s=n.next(),[3,2];case 5:return[3,8];case 6:return g=c.sent(),I={error:g},[3,8];case 7:try{s&&!s.done&&(h=n.return)&&h.call(n)}finally{if(I)throw I.error}return[7];case 8:return[2]}}))}))},l.prototype.V=function(e){var t=this;e.length&&e.forEach((function(e){t.storeHandler.storeData(e).then((function(i){var A=C.calculateMemSize(e.content);t.traceType.MEM_O_DUMP+=A})).catch((function(e){}))}))},l.prototype.dt=function(e,t){var i=this;return new Promise((function(t,A){return o(i,void 0,void 0,(function(){var i;return r(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storeHandler.storeData(e)];case 1:return o.sent(),i=C.calculateMemSize(e.content),this.traceType.MEM_O_DUMP+=i,t(),[3,3];case 2:return i=o.sent(),A(i),[3,3];case 3:return[2]}}))}))}))},l.prototype.it=function(e){var t=this;this.storeHandler.storeSize<=0||this.isLoadReportData||(this.isLoadReportData=!0,this.storeHandler.loadDBData(this.config.reportSize,5,Math.floor(this.cacheMaxSize/3),(function(e){return-1<t.dataInDb.indexOf(e)})).then((function(i){t.isLoadReportData=!1,i.datas.forEach((function(e){var i;t.reportMap.has(e.key)||t.pendingQueue.findInQueue(e)||(i=C.calculateMemSize(e.content),t.traceType.MEM_I_LOAD+=i,t.pendingQueue.enqueue(e,e.level),t.dataInDb.push(e.key))})),e&&e(i.len)})).catch((function(e){t.isLoadReportData=!1})))},l.prototype.lt=function(e){var t=this,i=0;return e.forEach((function(e){var A,o,r=JSON.parse(e.content);if(t.startCommonField)try{for(var s=a(t.startCommonField),g=s.next();!g.done;g=s.next()){var I=n(g.value,2),h=I[0],c=I[1];"userID"!==h&&"token"!==h&&"serverUrl"!==h&&(r[h]=c)}}catch(e){A={error:e}}finally{try{g&&!g.done&&(o=s.return)&&o.call(s)}finally{if(A)throw A.error}}i+=C.calculateMemSize(r),e.content=JSON.stringify(r)})),{packageArr:e,packageLen:i}},l.prototype.ht=function(e,t){return!!this.listenerList[e]&&"function"==typeof t&&(-1==this.listenerList[e].indexOf(t)&&this.listenerList[e].push(t),!0)},l.prototype.ct=function(e,t){var i;return!!this.listenerList[e]&&(i=this.listenerList[e],t?i.splice(i.indexOf(t),1):this.listenerList[e]=[],!0)},l.prototype.$=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];this.listenerList[e]&&this.listenerList[e].forEach((function(e){try{e.apply(void 0,s(t))}catch(e){}}))},t.ZegoDataReport=l},function(e,t,i){var A=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var A,o,r=i.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(A=r.next()).done;)n.push(A.value)}catch(e){o={error:e}}finally{try{A&&!A.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n},o=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(A(arguments[t]));return e},r=(Object.defineProperty(t,"u",{value:!0}),t.ZegoService=void 0,i(0)),n=i(25),s=i(29),a=i(4);function g(e,t,i,A,o){var s,a,g,I=this;this.yt=e,this.wt=i,this.bt=A,this.G=o,this.isDestroy=!1,this.packageLen=0,this.packagesDataSize=0,this.PACKAGE_MAX_LEN=5,this.msgID=0,this.logUploadTimer=null,this.logUploadInterval=1e4,this.logCacheSend=[],this.logCacheMax=100,this.gt=1e3,this.postSucCallbackList={},this.postFailCallbackList={},this.failCount=0,this.failStartTime=0,this.netWorkFail=!1,this.networkState=r.ENUM_NETWORK_STATE.online,this.state=0,this._t=(a=s=0,g=function(){a=s=0},{onOpen:function(){s=performance.now()},onClose:function(){0<s&&(performance.now()-s<100?(a++,I.G.logger.info("zt.rzs.wfsc frequently shutdown.")):g())},isOutOfMaxTimes:function(){return 10<=a}}),this.Ot={offline:function(){I.networkState=r.ENUM_NETWORK_STATE.offline},online:function(e){I.handleNetConnect()}},this.bindWindowListener(),this.networkState=r.ENUM_NETWORK_STATE.online,this.service=new n.LogService(e,i,A,o),this.service.onHbTimeout=function(){I.G.logger.warn("zt.rzs.ohbto hb timeout."),I.socketReconnect(!0,!0)},this.setBps(t),this.reportQueue=new r.Queue}g.prototype.destroy=function(){this.St(),this.logUploadTimer&&clearTimeout(this.logUploadTimer),this.reportQueue.clear(),window.removeEventListener("offline",this.Ot.offline),window.removeEventListener("online",this.Ot.online),this.isDestroy=!0},g.prototype.bindWindowListener=function(){window.addEventListener("offline",this.Ot.offline),window.addEventListener("online",this.Ot.online)},g.prototype.handleNetConnect=function(){var e;this.networkState=r.ENUM_NETWORK_STATE.online,1===this.logType?this.socketReconnect():(e=this.url,this.url="",this.setLogServer(e)),this.netWorkFail=!1},g.prototype.setLogServer=function(e){try{return e.startsWith("wss:")||e.startsWith("ws:")?(this.logType=1,this.Mt(e)):e.startsWith("https:")||e.startsWith("http:")?(this.logType=2,this.Et(e)):this.logType=0,!0}catch(e){return!1}},g.prototype.setLogUrlParams=function(e){this.logParams=e},g.prototype.Mt=function(e){var t=this;this.url!=e&&(this.url=e)&&(this.St(),this.logParams.id_name)&&(this._t.isOutOfMaxTimes()?(this.G.logger.warn("zt.rzs.owsls frequently shutdown too many times. cannot create socket anymore."),this.state=0):(this.state=1,e+="?product="+this.logParams.product+"&appid="+this.logParams.appid+"&token="+encodeURIComponent(this.logParams.signature)+"&deviceid="+this.logParams.deviceid+"&id_name="+this.logParams.id_name,this.service.createSocket(e),this.service.openHandler((function(){t.service.onPush(),t.service.startCheck(),t.G.logger.info("zt.rzs.owsls socket open"),t.openHandler(),t._t.onOpen()})),this.service.closeHandler((function(e){t.G.logger.warn("zt.rzs.owsls socket close "+JSON.stringify(e.code||e)),t.state=0,t.service.closeSocket(),t._t.onClose(),t.service.url&&t.socketReconnect(!1)})),this.service.errorHandler((function(e){t.G.logger.warn("zt.rzs.owsls socket error "+JSON.stringify(e.code||e)),t.state=0,t.service.closeSocket(),t.service.url&&t.socketReconnect(!1)}))))},g.prototype.St=function(){this.service.closeSocket(!0),this.jt&&(clearTimeout(this.jt),this.jt=void 0)},g.prototype.Et=function(e){(this.url=e)&&this.Tt()},g.prototype.Tt=function(){this.logUploadTimer&&(clearInterval(this.logUploadTimer),this.logUploadTimer=null)},g.prototype.Nt=function(e,t,i,A){this.yt===r.ZEGO_ENV.BROWSER?this.At(e,t,i,A):this.SendHttpsLogWeChatMini(e,t,i,A)},g.prototype.At=function(e,t,i,A){var o=this,r=(e=JSON.stringify({body:{data:e}}),new XMLHttpRequest);r.onreadystatechange=function(){if(4==r.readyState)if(200==r.status){if(0!=r.responseText.length)try{var e=JSON.parse(r.responseText).interval;"number"==typeof e&&o.logUploadInterval!==e&&o.Et(o.url),i&&i()}catch(e){A&&A()}}else A&&A()},r.open("POST",this.url,!0),r.send(e)},g.prototype.SendHttpsLogWeChatMini=function(e,t,i,A){var o=this;e={appid:this.logParams.appid+"",timestamp:(new Date).getTime()+"",tok