Files
2026-03-04 15:32:30 +08:00

5 lines
102 KiB
JavaScript

import e from"@tencentcloud/lite-chat/basic";export{default as TIM,default as TencentCloudChat}from"@tencentcloud/lite-chat/basic";import t from"@tencentcloud/trtc-component-wx";export{default as TRTCCloud}from"@tencentcloud/trtc-component-wx";function n(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(t){o(t)}}function s(e){try{l(i.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var i={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,o||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,a=new Array(o);r<o;r++)a[r]=i[r].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,o),!0;case 6:return c.fn.call(c.context,t,i,r,o,a),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var f,v=c.length;for(u=0;u<v;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;case 4:c[u].fn.call(c[u].context,t,i,r);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];c[u].fn.apply(c[u].context,l)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||a(this,o);else{for(var l=0,u=[],c=s.length;l<c;l++)(s[l].fn!==t||r&&!s[l].once||i&&s[l].context!==i)&&u.push(s[l]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}({get exports(){return i},set exports(e){i=e}});var r,o,a,s,l,u,c,d=i;!function(e){e[e.ERR_FAILED=-1]="ERR_FAILED"}(r||(r={})),function(e){e.ERROR="onError",e.SDK_READY="sdkReady",e.KICKED_OUT="onKickedOffLine",e.onUserSigExpired="onUserSigExpired",e.ON_CALL_BEGIN="onCallBegin",e.INVITED="onInvited",e.ON_CALL_RECEIVED="onCallReceived",e.USER_ACCEPT="onUserAccept",e.USER_ENTER="onUserJoin",e.USER_LEAVE="onUserLeave",e.REJECT="onUserReject",e.NO_RESP="onUserNoResponse",e.LINE_BUSY="onUserLineBusy",e.CALLING_CANCEL="onCallingCancel",e.ON_CALL_CANCELED="onCallCancelled",e.ON_CALL_END="onCallEnd",e.CALL_END="onCallEnd",e.CALLING_END="onCallEnd",e.USER_VIDEO_AVAILABLE="onUserVideoAvailable",e.USER_AUDIO_AVAILABLE="onUserAudioAvailable",e.USER_VOICE_VOLUME="onUserVoiceVolumeChanged",e.GROUP_CALL_INVITEE_LIST_UPDATE="onGroupCallInviteeListUpdate",e.CALL_TYPE_CHANGED="onCallMediaTypeChanged",e.DEVICED_UPDATED="onDeviceUpdated",e.ON_USER_NETWORK_QUALITY_CHANGED="onUserNetworkQualityChanged",e.MESSAGE_SENT_BY_ME="onMessageSentByMe",e.onDeviceChange="onDeviceChange",e.ON_CALL_NOT_CONNECTED="onCallNotConnected",e.ON_USER_INVITING="onUserInviting"}(o||(o={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO"}(a||(a={})),function(e){e.EAR="ear",e.SPEAKER="speaker"}(s||(s={})),function(e){e[e.FRONT=0]="FRONT",e[e.BACK=1]="BACK"}(l||(l={})),function(e){e[e.APNs=0]="APNs",e[e.VoIP=1]="VoIP"}(u||(u={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.RELEASE=1]="RELEASE",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR",e[e.NONE=4]="NONE"}(c||(c={}));var f,v,h,p,m,g,y,_="3.4.13";!function(e){e[e.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",e[e.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",e[e.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",e[e.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",e[e.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080"}(f||(f={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(v||(v={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(h||(h={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(p||(p={}));class C{constructor(e="",t="",n="",i="",r=""){this.deviceId=e,this.deviceName=t,this.kind=n,this.label=i,this.groupId=r}}class T{constructor(e=f.TRTCVideoResolution_640_480,t=15,n=550){this.videoResolution=e,this.videoFps=t,this.videoBitrate=n}}!function(e){e[e.TRTCVideoRotation0=0]="TRTCVideoRotation0",e[e.TRTCVideoRotation90=1]="TRTCVideoRotation90",e[e.TRTCVideoRotation180=2]="TRTCVideoRotation180",e[e.TRTCVideoRotation270=3]="TRTCVideoRotation270"}(m||(m={}));class E{constructor(e=m.TRTCVideoRotation0,t=v.TRTCVideoFillMode_Fit,n=h.TRTCVideoMirrorType_Disable){this.rotation=e,this.fillMode=t,this.mirrorType=n}}!function(e){e[e.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",e[e.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",e[e.TRTCQuality_Good=2]="TRTCQuality_Good",e[e.TRTCQuality_Poor=3]="TRTCQuality_Poor",e[e.TRTCQuality_Bad=4]="TRTCQuality_Bad",e[e.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",e[e.TRTCQuality_Down=6]="TRTCQuality_Down"}(g||(g={})),function(e){e[e.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",e[e.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",e[e.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",e[e.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",e[e.TRTCLogLevelError=4]="TRTCLogLevelError",e[e.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",e[e.TRTCLogLevelNone=6]="TRTCLogLevelNone"}(y||(y={}));const b={cover:v.TRTCVideoFillMode_Fill,fill:v.TRTCVideoFillMode_Fill,contain:v.TRTCVideoFillMode_Fit},R="string",S="object",w="array",I="function",A="undefined",O={ELECTRON:"electron",WEB:"web",MINI_PROGRAM:"miniProgram"},D="麦克风权限授权",N="使用语音通话,需要在设置中对麦克风进行授权允许",P="麦克风、摄像头权限授权",L="使用视频通话,需要在设置中对麦克风、摄像头进行授权允许",k="去设置",V="麦克风权限未开启",$="在设置-应用-微信-权限中开启麦克风权限,以正常使用音视频通话功能",M="麦克风/摄像头权限未开启",U="在设置-应用-微信-权限中开启麦克风/摄像头权限,以正常使用音视频通话功能",F="前往设置",x="authorized",j="scope.record",J="scope.camera",W="cameraAuthorized",B="microphoneAuthorized",G=65535;var K;!function(e){e[e.UNKNOWN=65535]="UNKNOWN",e[e.ERROR_REQUEST_REPEATED=-1204]="ERROR_REQUEST_REPEATED"}(K||(K={}));const H=function(e){return typeof e===R},Y=function(e){return null!==e&&typeof e===S},Q=function(e){return typeof Array.isArray===I?Array.isArray(e):ee(e)===w},z=function(e){return typeof e===A},q=function(e){return Q(e)||Y(e)},X=function(e){return typeof e===I},Z=function(e){return e instanceof Error},ee=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()};Date.now||(Date.now=function(){return(new Date).getTime()});const te=function(e){return JSON.stringify(e,["message","code"])};function ne(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}function ie(e){if("string"!=typeof e)return e;let t;try{const n=JSON.parse(e);t="object"==typeof n&&n?n:e}catch(n){t=e}return t}function re(e){e=e||32;const t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";let n="";for(let i=0;i<e;i++)n+=t.charAt(Math.floor(48*Math.random()));return n}function oe(e){return n(this,void 0,void 0,function*(){if(!e)return!1;const{microphone:t=!1,camera:i=!1}=e;try{const e=(yield function(){return new Promise((e,t)=>n(this,void 0,void 0,function*(){wx.getSetting({success:t=>{let n=null;n=wx.$TUICallKitPlugin?t.miniprogramAuthSetting:t.authSetting,e(n)},fail:e=>{t(e)}})}))}())||!1,r=e[j],o=e[J];return t&&i?r&&o:t?r:!!i&&o}catch(r){return!1}})}function ae(e){if(!e)return!1;const{microphone:t=!1,camera:n=!1}=e,i=wx.getAppAuthorizeSetting(),r=i[B]===x,o=i[W]===x;return t&&n?r&&o:t?r:!!n&&o}function se(e={}){let t={title:e.title,desc:e.description||"",extension:e.extension||"",is_disable_push:e.isDisablePush||!1,ios_push_type:e.iOSPushType||0,android_push_type:e.androidPushType||0,ignore_ios_badge:!!e.ignoreIOSBadge,android_vivo_classification:e.androidVIVOClassification};return e.iOSSound&&(t.ios_sound=e.iOSSound),e.androidSound&&(t.android_sound=e.androidSound),e.androidOPPOChannelID&&(t.android_oppo_channel_id=e.androidOPPOChannelID),e.androidFCMChannelID&&(t.android_fcm_channel_id=e.androidFCMChannelID),e.androidXiaoMiChannelID&&(t.android_xiaomi_channel_id=e.androidXiaoMiChannelID),e.androidHuaWeiCategory&&(t.android_huawei_category=e.androidHuaWeiCategory),t}const le={ERROR_REQUEST_REPEATED:({fnName:e})=>`you are already ${e}(), cannot repeated call '${e}'.`,UNKNOWN_ERROR:({fnName:e,error:t})=>`'${e}' throw unknown exception${t?`, error: ${t.toString()}.`:"."}`},ue={ERROR_REQUEST_REPEATED:({fnName:e})=>`你已经调用 ${e}(), 请勿重复调用 '${e}'。`};class ce extends Error{constructor({name:e="",code:t=G,message:n="",messageParams:i={},extraCode:r="",fnName:o=""}){super(n||function({code:e,params:t,enableDocLink:n=!1,languageList:i=["en","zh-CN"]}){let r,o="";const a=K[e];try{i.forEach(e=>{switch(e){case"en":r=le[a];break;case"zh-CN":r=ue[a]}X(r)?(o=o?`${o} `:o,o+=r(t)):H(r)&&(o=r)})}catch(s){r=le.UNKNOWN_ERROR}return n&&(o+=" doc:"),o}({code:t,params:Object.assign({fnName:o},i)})),this.name="TUICallEngineError",this.message="",this.functionName="",this.name=e||this.name,this.code=t,this.functionName=o||this.functionName,this.message=n||this.message}getCode(){return this.code}}const de={[o.ERROR]:["code","message"],[o.KICKED_OUT]:["message"],[o.onUserSigExpired]:[],[o.ON_CALL_RECEIVED]:["callerId","calleeIdList","chatGroupID","callMediaType","userData","roomID","strRoomID","callId","callRole"],[o.ON_CALL_BEGIN]:["roomID","strRoomID","callMediaType","callRole","callId","chatGroupID"],[o.ON_CALL_END]:["roomID","strRoomID","callMediaType","callRole","callId","totalTime","reason","userID","chatGroupID"],[o.LINE_BUSY]:["userID"],[o.REJECT]:["userID"],[o.USER_ACCEPT]:["userID"],[o.ON_CALL_CANCELED]:["userID","callId","roomID","strRoomID","callMediaType","callRole"],[o.NO_RESP]:["userIDList"],[o.ON_USER_INVITING]:["userID"],[o.USER_ENTER]:["userID"],[o.USER_LEAVE]:["userID"],[o.USER_AUDIO_AVAILABLE]:["userID","isAudioAvailable"],[o.USER_VIDEO_AVAILABLE]:["userID","isVideoAvailable"],[o.USER_VOICE_VOLUME]:["userID","isVideoAvailable"],[o.ON_USER_NETWORK_QUALITY_CHANGED]:["network"],[o.ON_CALL_NOT_CONNECTED]:["userID","callId","roomID","strRoomID","callMediaType","callRole","reason","chatGroupID"],[o.onDeviceChange]:["deviceId","type","state"]};function fe(e,t){const n=ie(t),i=de[e],r={};if(e===o.ON_CALL_RECEIVED)i.forEach((e,t)=>{r[e]="userIDList"===e&&1===t?Array.from(new Set(ie(n[t]))):n[t]});else i.forEach((e,t)=>{r[e]=n[t]});return r}var ve,he;ve="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var pe=function(){},me=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],ge=me.length;ge--;)he=me[ge],console[he]||(ve[he]=pe);ve.methods=me;var ye,_e=ve;const Ce="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Te=(null===window||void 0===window?void 0:window.navigator)&&(null===(ye=null===window||void 0===window?void 0:window.navigator)||void 0===ye?void 0:ye.userAgent)||"",Ee=/iPad/i.test(Te),be=/iPhone/i.test(Te)&&!Ee,Re=/iPod/i.test(Te),Se=be||Ee||Re,we=/Android/i.test(Te),Ie=new RegExp("HeadlessChrome","i").test(Te);var Ae=0,Oe="%cCallEngine%c%s",De="padding: 1px 4px;border-radius: 3px;color: #fff;background: #444;",Ne="display: inline",Pe=!(Se||we||Ie);function Le(){var e=new Date;return"[".concat(e.toLocaleTimeString("en-US",{hour12:!1}),".").concat(function(e){var t;switch(e.toString().length){case 1:t="00".concat(e);break;case 2:t="0".concat(e);break;default:t=e}return t}(e.getMilliseconds()),"]")}var ke={_data:[],_length:0,_visible:!1,arguments2String:function(e,t){var n;if(1===t.length)n="".concat(Le()," <").concat(e,"> ").concat(t[0]);else{n="".concat(Le()," <").concat(e,"> ");for(var i=0,r=t.length;i<r;i++)q(t[i])?Z(t[i])?n+=te(t[i]):n+=JSON.stringify(t[i]):n+=t[i],n+=" "}return n},info:function(){if(Ae<=1){var e=this.arguments2String("INFO",arguments);ke.record(e,"info"),Pe?_e.info(Oe,De,Ne,e):_e.info(e)}},error:function(){if(Ae<=3){var e=this.arguments2String("ERROR",arguments);ke.record(e,"error"),Pe?_e.error(Oe,De,Ne,e):_e.error(e)}},setLevel:function(e){e<4&&_e.log("".concat(Le(),"set level from ").concat(Ae," to ").concat(e)),Ae=e},getLevel:function(){return Ae},record:function(e,t){1100===ke._length&&(ke._data.splice(0,100),ke._length=1e3),ke._length++,ke._data.push("".concat(e," [").concat(t,"] \n"))}};function Ve(e){return n(this,void 0,void 0,function*(){if(e===a.AUDIO||e===a.VIDEO)return new Promise((t,i)=>n(this,void 0,void 0,function*(){const r={microphone:!0,camera:e===a.VIDEO},o=function(e){if(!e)return!1;const{microphone:t=!1,camera:n=!1}=e,i=wx.getAppAuthorizeSetting(),r=i[B]===x,o=i[W]===x;if(t&&n)return r&&o;if(t)return r;if(n)return o;return!1}(r);if(!o&&e===a.AUDIO){Me(V,$),i({callType:e,hasAppDevicePermission:o})}if(!o&&e===a.VIDEO){Me(M,U),i({callType:e,hasAppDevicePermission:o})}const s=yield function(e){return n(this,void 0,void 0,function*(){if(!e)return!1;const{microphone:t=!1,camera:n=!1}=e;try{const e=(yield getAuthSetting())||!1,i=e[j],r=e[J];return t&&n?i&&r:t?i:!!n&&r}catch(i){return!1}})}(r);if(!s&&e===a.AUDIO)try{yield Ue({scope:j})}catch(l){const t=D;$e(t,N),i({callType:e,text:t})}if(!s&&e===a.VIDEO)try{if((yield function(e){return n(this,void 0,void 0,function*(){return yield Promise.all(e.map(e=>n(this,void 0,void 0,function*(){try{return{status:"fulfilled",value:yield e}}catch(t){return{status:"rejected",reason:t}}})))})}([Ue({scope:j}),Ue({scope:J})])).find(e=>"rejected"===(null==e?void 0:e.status))){const t=P;$e(t,L),i({callType:e,text:t})}}catch(l){console.debug(l)}t()}))})}function $e(e,t){wx.showModal({title:e,content:t,confirmText:k,success:e=>{e.confirm&&wx.openSetting()}})}function Me(e,t){wx.showModal({title:e,content:t,confirmText:F,success:e=>{e.confirm&&wx.openAppAuthorizeSetting()}})}function Ue(e){return n(this,void 0,void 0,function*(){wx.$TUICallKitPlugin?yield wx.authorizeForMiniProgram(e):yield wx.authorize(e)})}const Fe=function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n},xe=function(){},je=function(){const e=new WeakSet;return function(t,n){if(n instanceof Error)return`Error.message: ${n.message} \n Error.stack: ${n.stack}`;if("object"==typeof n&&null!==n){if(e.has(n))return`[Circular ${t||"root"}]`;e.add(n)}return n}},Je=function(e){if("string"==typeof e)return e;try{return e instanceof Error?(JSON.stringify(e,je())||"undefined").replace(/"/gim,""):JSON.stringify(e,je())||"undefined"}catch(t){return`error happen when aegis stringify: \n ${t.message} \n ${t.stack}`}},We=[],Be=()=>{let e;const t=new Promise(t=>{e=t});return We.push({promise:t,resolve:e}),t};let Ge=0;function Ke(e){return n(this,void 0,void 0,function*(){try{for(;Ge>=2;)yield Be();return Ge++,yield new Promise((t,n)=>{wx.request(Object.assign(Object.assign({},e),{success(e){t(e)},fail(e){n(e)}}))})}catch(t){return Promise.reject(t)}finally{Ge--,We.length&&(We[0].resolve(),We.shift())}})}const He=e=>n(void 0,void 0,void 0,function*(){var{url:t,data:n,header:i={},method:r="GET",dataType:o,responseType:a}=e,s=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["url","data","header","method","dataType","responseType"]);return Ke(Object.assign({url:t,data:n,header:i,method:r,dataType:o,responseType:a},s))}),Ye=({table:e})=>(t,n)=>{try{const i=null==t?void 0:t.map(e=>{let t={};return Object.keys(e).forEach(n=>{if(Fe(e[n]))try{t[n]=Je(e[n])}catch(i){console.debug(i)}else t[n]="level"===n?e[n]+"":"time"===n?new Date(e[n]).toISOString():e[n]}),t});n({table:e,report:i})}catch(i){console.debug(i)}},Qe=(e,t)=>{let n,i=[];return(r,o)=>{if(Array.isArray(r)?i=i.concat(r):i.push(r),t&&i.length>=t||e.sendNow&&i.length>0)return o(i.splice(0,i.length)),void(n&&clearTimeout(n));n&&clearTimeout(n),n=setTimeout(()=>{n=null,i.length>0&&o(i.splice(0,i.length))},e.delay||1e3)}};var ze;!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARING=2]="WARING",e[e.ERROR=3]="ERROR"}(ze||(ze={}));const qe={metric:!0,context:!0},Xe=(e,t,n=0)=>Fe(e)?Fe(t)?(Object.keys(t).forEach(i=>{const r=e[i],o=t[i];e[i]=qe[i]&&0===n?Xe(r,o,1):o}),e):e:Fe(t)?t:{};class Ze{constructor(e){this.uploadChannel="",this.sendEsPipe=null,this._logLevel=ze.INFO,this._getReportDataList=[],this._blacklist=[],this.updateBlacklist()}updateEsConfig(e){try{if(e){this.esConfig=e;const{url:i,table:r}=e;i&&r&&(this.uploadChannel=i,this.sendEsPipe=(e=>{if(!e||!e.reduce||!e.length)throw new TypeError("createPipeline need at least one function param");return 1===e.length?(t,n)=>{e[0](t,n||xe)}:e.reduce((e,t)=>(n,i=xe)=>e(n,e=>null==t?void 0:t(e,i)))})([(t=this,(e,n)=>{try{const{sdkappid:i}=e,r=t.getBlackList();if(null==r?void 0:r.includes(String(i)))throw new Error("this sdkappid in blacklist");n(e)}catch(i){console.debug(i)}}),Qe(this,5),Ye({table:r}),(e,t)=>{try{e=e||{};let{logs:n=[]}=e;e.logs=null==n?void 0:n.map(e=>{const t=102400,n=e.contents;return Object.keys(n).forEach(e=>{const i=n[e];try{i&&i.length>t&&(n[e]=null==i?void 0:i.substring(0,t))}catch(r){console.debug("size of content > limitSize"),n[e]=Je(i).substring(0,t)}}),e}),t(e)}catch(n){console.debug(n)}},e=>n(this,void 0,void 0,function*(){let t=0;const r=()=>n(this,void 0,void 0,function*(){try{yield this.send({url:i,data:e})}catch(n){t<=2?(t++,setTimeout(()=>{r()},1e3)):console.debug(n)}});r()})]))}}catch(i){console.debug(i)}var t}updateGetReportData(e){"function"==typeof e&&this._getReportDataList.push(e)}updateBlacklist(){return n(this,void 0,void 0,function*(){try{const{data:e}=yield He({url:"https://jsonschema.qpic.cn/87084b1b6d263426b92926cfa5fa23af/18f29786d25587b5eb162d5e9f724b1e/blackList"}),t=null==e?void 0:e.blackList;"string"==typeof t&&(this._blacklist=t.split(","))}catch(e){console.debug("update blacklist fail",e)}})}getBlackList(){return this._blacklist}setLogLevel(e){"number"!=typeof e&&(e=ze.INFO),this._logLevel=e}createLogFunc(e){return(t,n)=>{this.log(t,n,{level:e})}}info(e,t){this.log(e,t,{level:ze.INFO})}debug(e,t){this.log(e,t,{level:ze.DEBUG})}warn(e,t){this.log(e,t,{level:ze.WARING})}error(e,t){this.log(e,t,{level:ze.ERROR})}log(e,t,n){try{const{level:i}=n||{};if(this._logLevel<=i){const n=this.getCommonReportData(),r=Xe(n,Object.assign({level:i,method:e},t));"function"==typeof this.sendEsPipe&&this.sendEsPipe(r)}}catch(i){console.debug(i)}}getCommonReportData(){let e={};for(let t=0;t<this._getReportDataList.length;t++)e=Xe(e,this._getReportDataList[t]());return e}send(e){return n(this,void 0,void 0,function*(){const{url:t,data:n}=e||{};try{t&&(yield He({url:t,data:n,method:"post"}))}catch(i){throw console.debug(i),new Error(i)}})}}let et=null;function tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function it(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ut(i.key),i)}}function rt(e,t,n){return t&&it(e.prototype,t),n&&it(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ot(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function o(n,i,r,o){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return at(u,"_invoke",function(n,i,r){var o,s,l,u=0,c=r||[],d=!1,f={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,a}};function v(n,i){for(s=n,l=i,t=0;!d&&u&&!r&&t<c.length;t++){var r,o=c[t],v=f.p,h=o[2];n>3?(r=h===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=v&&((r=n<2&&v<o[1])?(s=0,f.v=i,f.n=o[1]):v<h&&(r=n<3||o[0]>i||i>h)&&(o[4]=n,o[5]=i,f.n=h,s=0))}if(r||n>1)return a;throw d=!0,i}return function(r,c,h){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&v(c,h),s=c,l=h;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),v(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(r="next"),t=o[r]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(i,f))!==a)break}catch(t){o=e,s=1,l=t}finally{u=1}}return{value:t,done:d}}}(n,r,o),!0),u}var a={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(at(t={},i,function(){return this}),t),d=u.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,at(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=u,at(d,"constructor",u),at(u,"constructor",l),l.displayName="GeneratorFunction",at(u,r,"GeneratorFunction"),at(d),at(d,r,"Generator"),at(d,i,function(){return this}),at(d,"toString",function(){return"[object Generator]"}),(ot=function(){return{w:o,m:f}})()}function at(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}at=function(e,t,n,i){function o(t,n){at(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},at(e,t,n,i)}function st(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(e,t)||dt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lt(e){return function(e){if(Array.isArray(e))return tt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||dt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ut(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function ct(e){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ct(e)}function dt(e,t){if(e){if("string"==typeof e)return tt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tt(e,t):void 0}}var ft,vt=(ft="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){e=void 0!==(e=e||{})?e:{};var t,n,i=WXWebAssembly;e.ready=new Promise(function(e,i){t=e,n=i});var r=Object.assign({},e),o="./this.program",a="object"==("undefined"==typeof window?"undefined":ct(window)),s="function"==typeof importScripts;"object"==("undefined"==typeof process?"undefined":ct(process))&&"object"==ct(process.versions)&&process.versions.node;var l="";(a||s)&&(s?l=self.location.href:"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),ft&&(l=ft),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"");var u,c=e.print||console.log.bind(console),d=e.printErr||console.warn.bind(console);Object.assign(e,r),r=null,e.arguments&&e.arguments,e.thisProgram&&(o=e.thisProgram),e.quit&&e.quit,e.wasmBinary&&e.wasmBinary,e.noExitRuntime,"object"!=ct(i)&&M("no native wasm support detected");var f,v,h,p,m,g,y,_,C,T,E=!1,b="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(e,t,n){for(var i=t+n,r=t;e[r]&&!(r>=i);)++r;if(r-t>16&&e.buffer&&b)return b.decode(e.subarray(t,r));for(var o="";t<r;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var l=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|l:(7&a)<<18|s<<12|l<<6|63&e[t++])<65536)o+=String.fromCharCode(a);else{var u=a-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}function S(e,t){return e?R(h,e,t):""}function w(e,t,n,i){if(!(i>0))return 0;for(var r=n,o=n+i-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++]=s}else if(s<=2047){if(n+1>=o)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=o)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-r}function I(e){for(var t=0,n=0;n<e.length;++n){var i=e.charCodeAt(n);i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++n)),i<=127?++t:t+=i<=2047?2:i<=65535?3:4}return t}e.INITIAL_MEMORY;var A=[],O=[],D=[];function N(e){A.unshift(e)}function P(e){D.unshift(e)}var L,k,V=0,$=null;function M(t){e.onAbort&&e.onAbort(t),d(t="Aborted("+t+")"),E=!0,t+=". Build with -sASSERTIONS for more info.";var i=new Error(t);throw n(i),i}function U(t){for(;t.length>0;)t.shift()(e)}function F(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}(L="RTCCallEngine.wasm").startsWith("data:application/octet-stream;base64,")||(k=L,L=e.locateFile?e.locateFile(k,l):l+k);var x=void 0;function j(e){for(var t="",n=e;h[n];)t+=x[h[n++]];return t}var J={},W={},B={};function G(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function K(e,t){return e=G(e),function(){return t.apply(this,arguments)}}function H(e,t){var n=K(t,function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var Y=void 0;function Q(e){throw new Y(e)}var z=void 0;function q(e){throw new z(e)}function X(e,t,n){function i(t){var i=n(t);i.length!==e.length&&q("Mismatched type converter count");for(var r=0;r<e.length;++r)Z(e[r],i[r])}e.forEach(function(e){B[e]=t});var r=new Array(t.length),o=[],a=0;t.forEach(function(e,t){W.hasOwnProperty(e)?r[t]=W[e]:(o.push(e),J.hasOwnProperty(e)||(J[e]=[]),J[e].push(function(){r[t]=W[e],++a===o.length&&i(r)}))}),0===o.length&&i(r)}function Z(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=t.name;if(e||Q('type "'+i+'" must have a positive integer typeid pointer'),W.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;Q("Cannot register type '"+i+"' twice")}if(W[e]=t,delete B[e],J.hasOwnProperty(e)){var r=J[e];delete J[e],r.forEach(function(e){return e()})}}function ee(e){if(!(this instanceof Ee))return!1;if(!(e instanceof Ee))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,i=e.$$.ptrType.registeredClass,r=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;i.baseClass;)r=i.upcast(r),i=i.baseClass;return t===i&&n===r}function te(e){Q(e.$$.ptrType.registeredClass.name+" instance already deleted")}var ne=!1;function ie(e){}function re(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function oe(e,t,n){if(t===n)return e;if(void 0===n.baseClass)return null;var i=oe(e,t,n.baseClass);return null===i?null:n.downcast(i)}var ae={};function se(){return Object.keys(ve).length}function le(){var e=[];for(var t in ve)ve.hasOwnProperty(t)&&e.push(ve[t]);return e}var ue=[];function ce(){for(;ue.length;){var e=ue.pop();e.$$.deleteScheduled=!1,e.delete()}}var de=void 0;function fe(e){de=e,ue.length&&de&&de(ce)}var ve={};function he(e,t){return t=function(e,t){for(void 0===t&&Q("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),ve[t]}function pe(e,t){return t.ptrType&&t.ptr||q("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&q("Both smartPtrType and smartPtr must be specified"),t.count={value:1},ge(Object.create(e,{$$:{value:t}}))}function me(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=he(this.registeredClass,t);if(void 0!==n){if(0===n.$$.count.value)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var i=n.clone();return this.destructor(e),i}function r(){return this.isSmartPointer?pe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,a=this.registeredClass.getActualType(t),s=ae[a];if(!s)return r.call(this);o=this.isConst?s.constPointerType:s.pointerType;var l=oe(t,this.registeredClass,o.registeredClass);return null===l?r.call(this):this.isSmartPointer?pe(o.registeredClass.instancePrototype,{ptrType:o,ptr:l,smartPtrType:this,smartPtr:e}):pe(o.registeredClass.instancePrototype,{ptrType:o,ptr:l})}function ge(e){return"undefined"==typeof FinalizationRegistry?(ge=function(e){return e},e):(ne=new FinalizationRegistry(function(e){re(e.$$)}),ge=function(e){var t=e.$$;if(t.smartPtr){var n={$$:t};ne.register(e,n,e)}return e},ie=function(e){return ne.unregister(e)},ge(e))}function ye(){if(this.$$.ptr||te(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=ge(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function _e(){this.$$.ptr||te(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),ie(this),re(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ce(){return!this.$$.ptr}function Te(){return this.$$.ptr||te(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),ue.push(this),1===ue.length&&de&&de(ce),this.$$.deleteScheduled=!0,this}function Ee(){}function be(e,t,n){if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Q("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}}function Re(e,t,n,i,r,o,a,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=i,this.baseClass=r,this.getActualType=o,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function Se(e,t,n){for(;t!==n;)t.upcast||Q("Expected null or instance of "+n.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function we(e,t){if(null===t)return this.isReference&&Q("null is not a valid "+this.name),0;t.$$||Q('Cannot pass "'+ze(t)+'" as a '+this.name),t.$$.ptr||Q("Cannot pass deleted object as a pointer of type "+this.name);var n=t.$$.ptrType.registeredClass;return Se(t.$$.ptr,n,this.registeredClass)}function Ie(e,t){var n;if(null===t)return this.isReference&&Q("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,n),n):0;t.$$||Q('Cannot pass "'+ze(t)+'" as a '+this.name),t.$$.ptr||Q("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Q("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var i=t.$$.ptrType.registeredClass;if(n=Se(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:Q("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var r=t.clone();n=this.rawShare(n,Qe.toHandle(function(){r.delete()})),null!==e&&e.push(this.rawDestructor,n)}break;default:Q("Unsupporting sharing policy")}return n}function Ae(e,t){if(null===t)return this.isReference&&Q("null is not a valid "+this.name),0;t.$$||Q('Cannot pass "'+ze(t)+'" as a '+this.name),t.$$.ptr||Q("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Q("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;return Se(t.$$.ptr,n,this.registeredClass)}function Oe(e){return this.fromWireType(g[e>>2])}function De(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Ne(e){this.rawDestructor&&this.rawDestructor(e)}function Pe(e){null!==e&&e.delete()}function Le(e,t,n,i,r,o,a,s,l,u,c){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=i,this.isSmartPointer=r,this.pointeeType=o,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,r||void 0!==t.baseClass?this.toWireType=Ie:i?(this.toWireType=we,this.destructorFunction=null):(this.toWireType=Ae,this.destructorFunction=null)}var ke=[];function Ve(e){var t=ke[e];return t||(e>=ke.length&&(ke.length=e+1),ke[e]=t=T.get(e)),t}function $e(t,n,i){return t.includes("j")?function(t,n,i){var r=e["dynCall_"+t];return i&&i.length?r.apply(null,[n].concat(i)):r.call(null,n)}(t,n,i):Ve(n).apply(null,i)}function Me(e,t){var n,i,r,o=(e=j(e)).includes("j")?(n=e,i=t,r=[],function(){return r.length=0,Object.assign(r,arguments),$e(n,i,r)}):Ve(t);return"function"!=typeof o&&Q("unknown function pointer with signature "+e+": "+t),o}var Ue=void 0;function Fe(e){var t=kt(e),n=j(t);return Pt(t),n}function xe(e,t){var n=[],i={};throw t.forEach(function e(t){i[t]||W[t]||(B[t]?B[t].forEach(e):(n.push(t),i[t]=!0))}),new Ue(e+": "+n.map(Fe).join([", "]))}function je(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function Je(e,t,n,i,r){var o=t.length;o<2&&Q("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==n,s=!1,l=1;l<t.length;++l)if(null!==t[l]&&void 0===t[l].destructorFunction){s=!0;break}var u="void"!==t[0].name,c=o-2,d=new Array(c),f=[],v=[];return function(){var n;arguments.length!==c&&Q("function "+e+" called with "+arguments.length+" arguments, expected "+c+" args!"),v.length=0,f.length=a?2:1,f[0]=r,a&&(n=t[1].toWireType(v,this),f[1]=n);for(var o=0;o<c;++o)d[o]=t[o+2].toWireType(v,arguments[o]),f.push(d[o]);return function(e){if(s)je(v);else for(var i=a?1:2;i<t.length;i++){var r=1===i?n:d[i-2];null!==t[i].destructorFunction&&t[i].destructorFunction(r)}if(u)return t[0].fromWireType(e)}(i.apply(null,f))}}function We(e,t){for(var n=[],i=0;i<e;i++)n.push(y[t+4*i>>2]);return n}var Be=[],Ge=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ke(e){e>4&&0===--Ge[e].refcount&&(Ge[e]=void 0,Be.push(e))}function He(){for(var e=0,t=5;t<Ge.length;++t)void 0!==Ge[t]&&++e;return e}function Ye(){for(var e=5;e<Ge.length;++e)if(void 0!==Ge[e])return Ge[e];return null}var Qe={toValue:function(e){return e||Q("Cannot use deleted val. handle = "+e),Ge[e].value},toHandle:function(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=Be.length?Be.pop():Ge.length;return Ge[t]={refcount:1,value:e},t}}};function ze(e){if(null===e)return"null";var t=ct(e);return"object"===t||"array"===t||"function"===t?e.toString():""+e}function qe(e,t){switch(t){case 2:return function(e){return this.fromWireType(_[e>>2])};case 3:return function(e){return this.fromWireType(C[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Xe(e,t,n){switch(t){case 0:return n?function(e){return v[e]}:function(e){return h[e]};case 1:return n?function(e){return p[e>>1]}:function(e){return m[e>>1]};case 2:return n?function(e){return g[e>>2]}:function(e){return y[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var Ze="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function et(e,t){for(var n=e,i=n>>1,r=i+t/2;!(i>=r)&&m[i];)++i;if((n=i<<1)-e>32&&Ze)return Ze.decode(h.subarray(e,n));for(var o="",a=0;!(a>=t/2);++a){var s=p[e+2*a>>1];if(0==s)break;o+=String.fromCharCode(s)}return o}function tt(e,t,n){if(void 0===n&&(n=2147483647),n<2)return 0;for(var i=t,r=(n-=2)<2*e.length?n/2:e.length,o=0;o<r;++o){var a=e.charCodeAt(o);p[t>>1]=a,t+=2}return p[t>>1]=0,t-i}function it(e){return 2*e.length}function at(e,t){for(var n=0,i="";!(n>=t/4);){var r=g[e+4*n>>2];if(0==r)break;if(++n,r>=65536){var o=r-65536;i+=String.fromCharCode(55296|o>>10,56320|1023&o)}else i+=String.fromCharCode(r)}return i}function ut(e,t,n){if(void 0===n&&(n=2147483647),n<4)return 0;for(var i=t,r=i+n-4,o=0;o<e.length;++o){var a=e.charCodeAt(o);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),g[t>>2]=a,(t+=4)+4>r)break}return g[t>>2]=0,t-i}function dt(e){for(var t=0,n=0;n<e.length;++n){var i=e.charCodeAt(n);i>=55296&&i<=57343&&++n,t+=4}return t}function vt(e,t){var n=W[e];return void 0===n&&Q(t+" has unknown type "+Fe(e)),n}function ht(e,t){for(var n=new Array(e),i=0;i<e;++i)n[i]=vt(y[t+4*i>>2],"parameter "+i);return n}var pt={};function mt(e){var t=pt[e];return void 0===t?j(e):t}var gt=[];function yt(){if("object"==("undefined"==typeof globalThis?"undefined":ct(globalThis)))return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==("undefined"==typeof $$$embind_global$$$?"undefined":ct($$$embind_global$$$))&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==("undefined"==typeof $$$embind_global$$$?"undefined":ct($$$embind_global$$$)))return $$$embind_global$$$;if("object"==("undefined"==typeof global?"undefined":ct(global))&&e(global)?$$$embind_global$$$=global:"object"==("undefined"==typeof self?"undefined":ct(self))&&e(self)&&($$$embind_global$$$=self),"object"==("undefined"==typeof $$$embind_global$$$?"undefined":ct($$$embind_global$$$)))return $$$embind_global$$$;throw Error("unable to get global object.")}var _t,Ct=[],Tt={};_t=function(){return performance.now()};var Et={};function bt(){if(!bt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==("undefined"==typeof navigator?"undefined":ct(navigator))&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:o||"./this.program"};for(var t in Et)void 0===Et[t]?delete e[t]:e[t]=Et[t];var n=[];for(var t in e)n.push(t+"="+e[t]);bt.strings=n}return bt.strings}var Rt=[null,[],[]];function St(e,t){var n=Rt[e];0===t||10===t?((1===e?c:d)(R(n,0)),n.length=0):n.push(t)}function wt(e){return e%4==0&&(e%100!=0||e%400==0)}var It=[31,29,31,30,31,30,31,31,30,31,30,31],At=[31,28,31,30,31,30,31,31,30,31,30,31];function Ot(e,t,n,i){var r=g[i+40>>2],o={tm_sec:g[i>>2],tm_min:g[i+4>>2],tm_hour:g[i+8>>2],tm_mday:g[i+12>>2],tm_mon:g[i+16>>2],tm_year:g[i+20>>2],tm_wday:g[i+24>>2],tm_yday:g[i+28>>2],tm_isdst:g[i+32>>2],tm_gmtoff:g[i+36>>2],tm_zone:r?S(r):""},a=S(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var l in s)a=a.replace(new RegExp(l,"g"),s[l]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,n){for(var i="number"==typeof e?e.toString():e||"";i.length<t;)i=n[0]+i;return i}function f(e,t){return d(e,t,"0")}function h(e,t){function n(e){return e<0?-1:e>0?1:0}var i;return 0===(i=n(e.getFullYear()-t.getFullYear()))&&0===(i=n(e.getMonth()-t.getMonth()))&&(i=n(e.getDate()-t.getDate())),i}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=function(e,t){for(var n=new Date(e.getTime());t>0;){var i=wt(n.getFullYear()),r=n.getMonth(),o=(i?It:At)[r];if(!(t>o-n.getDate()))return n.setDate(n.getDate()+t),n;t-=o-n.getDate()+1,n.setDate(1),r<11?n.setMonth(r+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),i=new Date(t.getFullYear()+1,0,4),r=p(n),o=p(i);return h(r,t)<=0?h(o,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var y={"%a":function(e){return u[e.tm_wday].substring(0,3)},"%A":function(e){return u[e.tm_wday]},"%b":function(e){return c[e.tm_mon].substring(0,3)},"%B":function(e){return c[e.tm_mon]},"%C":function(e){return f((e.tm_year+1900)/100|0,2)},"%d":function(e){return f(e.tm_mday,2)},"%e":function(e){return d(e.tm_mday,2," ")},"%g":function(e){return m(e).toString().substring(2)},"%G":function(e){return m(e)},"%H":function(e){return f(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),f(t,2)},"%j":function(e){return f(e.tm_mday+function(e,t){for(var n=0,i=0;i<=t;n+=e[i++]);return n}(wt(e.tm_year+1900)?It:At,e.tm_mon-1),3)},"%m":function(e){return f(e.tm_mon+1,2)},"%M":function(e){return f(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return f(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=e.tm_yday+7-e.tm_wday;return f(Math.floor(t/7),2)},"%V":function(e){var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var n=(e.tm_wday+371-e.tm_yday)%7;4==n||3==n&&wt(e.tm_year)||(t=1)}}else{t=52;var i=(e.tm_wday+7-e.tm_yday-1)%7;(4==i||5==i&&wt(e.tm_year%400-1))&&t++}return f(t,2)},"%w":function(e){return e.tm_wday},"%W":function(e){var t=e.tm_yday+7-(e.tm_wday+6)%7;return f(Math.floor(t/7),2)},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,n=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(n?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var l in a=a.replace(/%%/g,"\0\0"),y)a.includes(l)&&(a=a.replace(new RegExp(l,"g"),y[l](o)));var _=function(e,t,n){var i=n>0?n:I(e)+1,r=new Array(i),o=w(e,r,0,r.length);return t&&(r.length=o),r}(a=a.replace(/\0\0/g,"%"),!1);return _.length>t?0:(function(e,t){v.set(e,t)}(_,e),_.length-1)}!function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);x=e}(),Y=e.BindingError=H(Error,"BindingError"),z=e.InternalError=H(Error,"InternalError"),Ee.prototype.isAliasOf=ee,Ee.prototype.clone=ye,Ee.prototype.delete=_e,Ee.prototype.isDeleted=Ce,Ee.prototype.deleteLater=Te,e.getInheritedInstanceCount=se,e.getLiveInheritedInstances=le,e.flushPendingDeletes=ce,e.setDelayFunction=fe,Le.prototype.getPointee=De,Le.prototype.destructor=Ne,Le.prototype.argPackAdvance=8,Le.prototype.readValueFromPointer=Oe,Le.prototype.deleteObject=Pe,Le.prototype.fromWireType=me,Ue=e.UnboundTypeError=H(Error,"UnboundTypeError"),e.count_emval_handles=He,e.get_first_emval=Ye;var Dt={__assert_fail:function(e,t,n,i){M("Assertion failed: "+S(e)+", at: "+[t?S(t):"unknown filename",n,i?S(i):"unknown function"])},_embind_register_bigint:function(e,t,n,i,r){},_embind_register_bool:function(e,t,n,i,r){var o=F(n);Z(e,{name:t=j(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?i:r},argPackAdvance:8,readValueFromPointer:function(e){var i;if(1===n)i=v;else if(2===n)i=p;else{if(4!==n)throw new TypeError("Unknown boolean type size: "+t);i=g}return this.fromWireType(i[e>>o])},destructorFunction:null})},_embind_register_class:function(t,n,i,r,o,a,s,l,u,c,d,f,v){d=j(d),a=Me(o,a),l&&(l=Me(s,l)),c&&(c=Me(u,c)),v=Me(f,v);var h=G(d);!function(t,n,i){e.hasOwnProperty(t)?((void 0===i||void 0!==e[t].overloadTable&&void 0!==e[t].overloadTable[i])&&Q("Cannot register public name '"+t+"' twice"),be(e,t,t),e.hasOwnProperty(i)&&Q("Cannot register multiple overloads of a function with the same number of arguments ("+i+")!"),e[t].overloadTable[i]=n):(e[t]=n,void 0!==i&&(e[t].numArguments=i))}(h,function(){xe("Cannot construct "+d+" due to unbound types",[r])}),X([t,n,i],r?[r]:[],function(n){var i,o;n=n[0],o=r?(i=n.registeredClass).instancePrototype:Ee.prototype;var s=K(h,function(){if(Object.getPrototypeOf(this)!==u)throw new Y("Use 'new' to construct "+d);if(void 0===f.constructor_body)throw new Y(d+" has no accessible constructor");var e=f.constructor_body[arguments.length];if(void 0===e)throw new Y("Tried to invoke ctor of "+d+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(f.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)}),u=Object.create(o,{constructor:{value:s}});s.prototype=u;var f=new Re(d,s,u,v,i,a,l,c),p=new Le(d,f,!0,!1,!1),m=new Le(d+"*",f,!1,!1,!1),g=new Le(d+" const*",f,!1,!0,!1);return ae[t]={pointerType:m,constPointerType:g},function(t,n,i){e.hasOwnProperty(t)||q("Replacing nonexistant public symbol"),void 0!==e[t].overloadTable&&void 0!==i?e[t].overloadTable[i]=n:(e[t]=n,e[t].argCount=i)}(h,s),[p,m,g]})},_embind_register_class_class_function:function(e,t,n,i,r,o,a){var s=We(n,i);t=j(t),o=Me(r,o),X([],[e],function(e){var i=(e=e[0]).name+"."+t;function r(){xe("Cannot call "+i+" due to unbound types",s)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var l=e.registeredClass.constructor;return void 0===l[t]?(r.argCount=n-1,l[t]=r):(be(l,t,i),l[t].overloadTable[n-1]=r),X([],s,function(e){var r=[e[0],null].concat(e.slice(1)),s=Je(i,r,null,o,a);return void 0===l[t].overloadTable?(s.argCount=n-1,l[t]=s):l[t].overloadTable[n-1]=s,[]}),[]})},_embind_register_class_constructor:function(e,t,n,i,r,o){var a;t>0||M(a);var s=We(t,n);r=Me(i,r),X([],[e],function(e){var n="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Y("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=function(){xe("Cannot construct "+e.name+" due to unbound types",s)},X([],s,function(i){return i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Je(n,i,null,r,o),[]}),[]})},_embind_register_class_function:function(e,t,n,i,r,o,a,s){var l=We(n,i);t=j(t),o=Me(r,o),X([],[e],function(e){var i=(e=e[0]).name+"."+t;function r(){xe("Cannot call "+i+" due to unbound types",l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,c=u[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===n-2?(r.argCount=n-2,r.className=e.name,u[t]=r):(be(u,t,i),u[t].overloadTable[n-2]=r),X([],l,function(r){var s=Je(i,r,e,o,a);return void 0===u[t].overloadTable?(s.argCount=n-2,u[t]=s):u[t].overloadTable[n-2]=s,[]}),[]})},_embind_register_emval:function(e,t){Z(e,{name:t=j(t),fromWireType:function(e){var t=Qe.toValue(e);return Ke(e),t},toWireType:function(e,t){return Qe.toHandle(t)},argPackAdvance:8,readValueFromPointer:Oe,destructorFunction:null})},_embind_register_float:function(e,t,n){var i=F(n);Z(e,{name:t=j(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:qe(t,i),destructorFunction:null})},_embind_register_integer:function(e,t,n,i,r){t=j(t);var o=F(n),a=function(e){return e};if(0===i){var s=32-8*n;a=function(e){return e<<s>>>s}}var l=t.includes("unsigned");Z(e,{name:t,fromWireType:a,toWireType:l?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Xe(t,o,0!==i),destructorFunction:null})},_embind_register_memory_view:function(e,t,n){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function r(e){var t=y,n=t[e>>=2],r=t[e+1];return new i(f,r,n)}Z(e,{name:n=j(n),fromWireType:r,argPackAdvance:8,readValueFromPointer:r},{ignoreDuplicateRegistrations:!0})},_embind_register_smart_ptr:function(e,t,n,i,r,o,a,s,l,u,c,d){n=j(n),o=Me(r,o),s=Me(a,s),u=Me(l,u),d=Me(c,d),X([e],[t],function(e){return e=e[0],[new Le(n,e.registeredClass,!1,!1,!0,e,i,o,s,u,d)]})},_embind_register_std_string:function(e,t){var n="std::string"===(t=j(t));Z(e,{name:t,fromWireType:function(e){var t,i=y[e>>2],r=e+4;if(n)for(var o=r,a=0;a<=i;++a){var s=r+a;if(a==i||0==h[s]){var l=S(o,s-o);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),o=s+1}}else{var u=new Array(i);for(a=0;a<i;++a)u[a]=String.fromCharCode(h[r+a]);t=u.join("")}return Pt(e),t},toWireType:function(e,t){var i;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r="string"==typeof t;r||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||Q("Cannot pass non-string to std::string"),i=n&&r?I(t):t.length;var o=Lt(4+i+1),a=o+4;if(y[o>>2]=i,n&&r)w(t,h,a,i+1);else if(r)for(var s=0;s<i;++s){var l=t.charCodeAt(s);l>255&&(Pt(a),Q("String has UTF-16 code units that do not fit in 8 bits")),h[a+s]=l}else for(s=0;s<i;++s)h[a+s]=t[s];return null!==e&&e.push(Pt,o),o},argPackAdvance:8,readValueFromPointer:Oe,destructorFunction:function(e){Pt(e)}})},_embind_register_std_wstring:function(e,t,n){var i,r,o,a,s;n=j(n),2===t?(i=et,r=tt,a=it,o=function(){return m},s=1):4===t&&(i=at,r=ut,a=dt,o=function(){return y},s=2),Z(e,{name:n,fromWireType:function(e){for(var n,r=y[e>>2],a=o(),l=e+4,u=0;u<=r;++u){var c=e+4+u*t;if(u==r||0==a[c>>s]){var d=i(l,c-l);void 0===n?n=d:(n+=String.fromCharCode(0),n+=d),l=c+t}}return Pt(e),n},toWireType:function(e,i){"string"!=typeof i&&Q("Cannot pass non-string to C++ string type "+n);var o=a(i),l=Lt(4+o+t);return y[l>>2]=o>>s,r(i,l+4,o+t),null!==e&&e.push(Pt,l),l},argPackAdvance:8,readValueFromPointer:Oe,destructorFunction:function(e){Pt(e)}})},_embind_register_void:function(e,t){Z(e,{isVoid:!0,name:t=j(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},_emscripten_date_now:function(){return Date.now()},_emscripten_get_now_is_monotonic:function(){return!0},_emval_as:function(e,t,n){e=Qe.toValue(e),t=vt(t,"emval::as");var i=[],r=Qe.toHandle(i);return y[n>>2]=r,t.toWireType(i,e)},_emval_call:function(e,t,n,i){e=Qe.toValue(e);for(var r=ht(t,n),o=new Array(t),a=0;a<t;++a){var s=r[a];o[a]=s.readValueFromPointer(i),i+=s.argPackAdvance}var l=e.apply(void 0,o);return Qe.toHandle(l)},_emval_call_method:function(e,t,n,i,r){return(e=gt[e])(t=Qe.toValue(t),n=mt(n),function(e){var t=[];return y[e>>2]=Qe.toHandle(t),t}(i),r)},_emval_call_void_method:function(e,t,n,i){(e=gt[e])(t=Qe.toValue(t),n=mt(n),null,i)},_emval_decref:Ke,_emval_get_global:function(e){return 0===e?Qe.toHandle(yt()):(e=mt(e),Qe.toHandle(yt()[e]))},_emval_get_method_caller:function(e,t){var n=ht(e,t),i=n[0],r=i.name+"_$"+n.slice(1).map(function(e){return e.name}).join("_")+"$",o=Ct[r];if(void 0!==o)return o;var a,s,l=new Array(e-1);return a=function(t,r,o,a){for(var s=0,u=0;u<e-1;++u)l[u]=n[u+1].readValueFromPointer(a+s),s+=n[u+1].argPackAdvance;var c=t[r].apply(t,l);for(u=0;u<e-1;++u)n[u+1].deleteObject&&n[u+1].deleteObject(l[u]);if(!i.isVoid)return i.toWireType(o,c)},s=gt.length,gt.push(a),o=s,Ct[r]=o,o},_emval_get_module_property:function(t){return t=mt(t),Qe.toHandle(e[t])},_emval_get_property:function(e,t){return e=Qe.toValue(e),t=Qe.toValue(t),Qe.toHandle(e[t])},_emval_incref:function(e){e>4&&(Ge[e].refcount+=1)},_emval_instanceof:function(e,t){return(e=Qe.toValue(e))instanceof(t=Qe.toValue(t))},_emval_is_number:function(e){return"number"==typeof(e=Qe.toValue(e))},_emval_is_string:function(e){return"string"==typeof(e=Qe.toValue(e))},_emval_new:function(e,t,n,i){e=Qe.toValue(e);var r=Tt[t];return r||(r=function(e){var t=new Array(e+1);return function(n,i,r){t[0]=n;for(var o=0;o<e;++o){var a=vt(y[i+4*o>>2],"parameter "+o);t[o+1]=a.readValueFromPointer(r),r+=a.argPackAdvance}var s=new(n.bind.apply(n,t));return Qe.toHandle(s)}}(t),Tt[t]=r),r(e,n,i)},_emval_new_cstring:function(e){return Qe.toHandle(mt(e))},_emval_run_destructors:function(e){je(Qe.toValue(e)),Ke(e)},_emval_take_value:function(e,t){var n=(e=vt(e,"_emval_take_value")).readValueFromPointer(t);return Qe.toHandle(n)},abort:function(){M("")},emscripten_get_now:_t,emscripten_memcpy_big:function(e,t,n){h.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){h.length,M("OOM")},environ_get:function(e,t){var n=0;return bt().forEach(function(i,r){var o=t+n;y[e+4*r>>2]=o,function(e,t,n){for(var i=0;i<e.length;++i)v[0|t++]=e.charCodeAt(i);n||(v[0|t]=0)}(i,o),n+=i.length+1}),0},environ_sizes_get:function(e,t){var n=bt();y[e>>2]=n.length;var i=0;return n.forEach(function(e){i+=e.length+1}),y[t>>2]=i,0},fd_close:function(e){return 52},fd_seek:function(e,t,n,i,r){return 70},fd_write:function(e,t,n,i){for(var r=0,o=0;o<n;o++){var a=y[t>>2],s=y[t+4>>2];t+=8;for(var l=0;l<s;l++)St(e,h[a+l]);r+=s}return y[i>>2]=r,0},setTempRet0:function(e){},strftime_l:function(e,t,n,i){return Ot(e,t,n,i)}};!function(){var t,i={env:Dt,wasi_snapshot_preview1:Dt};function r(t,n){var i,r,o=t.exports;e.asm=o,u=e.asm.memory,i=u.buffer,f=i,e.HEAP8=v=new Int8Array(i),e.HEAP16=p=new Int16Array(i),e.HEAP32=g=new Int32Array(i),e.HEAPU8=h=new Uint8Array(i),e.HEAPU16=m=new Uint16Array(i),e.HEAPU32=y=new Uint32Array(i),e.HEAPF32=_=new Float32Array(i),e.HEAPF64=C=new Float64Array(i),T=e.asm.__indirect_function_table,r=e.asm.__wasm_call_ctors,O.unshift(r),function(){if(V--,e.monitorRunDependencies&&e.monitorRunDependencies(V),0==V&&$){var t=$;$=null,t()}}()}function o(e){r(e.instance)}if(V++,e.monitorRunDependencies&&e.monitorRunDependencies(V),e.instantiateWasm)try{return e.instantiateWasm(i,r)}catch(a){return d("Module.instantiateWasm callback failed with error: "+a),!1}(t=o,WXWebAssembly.instantiate("/static/RTCCallEngine.wasm.br",i).then(function(e){return e}).then(t,function(e){d("failed to asynchronously prepare wasm: "+e),M(e)})).catch(n)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.__wasm_call_ctors).apply(null,arguments)};var Nt,Pt=e._free=function(){return(Pt=e._free=e.asm.free).apply(null,arguments)},Lt=e._malloc=function(){return(Lt=e._malloc=e.asm.malloc).apply(null,arguments)},kt=e.___getTypeName=function(){return(kt=e.___getTypeName=e.asm.__getTypeName).apply(null,arguments)};function Vt(n){function i(){Nt||(Nt=!0,e.calledRun=!0,E||(U(O),t(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)P(e.postRun.shift());U(D)}()))}V>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)N(e.preRun.shift());U(A)}(),V>0||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),i()},1)):i()))}if(e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.__embind_register_native_and_builtin_types).apply(null,arguments)},e.___errno_location=function(){return(e.___errno_location=e.asm.__errno_location).apply(null,arguments)},e.stackSave=function(){return(e.stackSave=e.asm.stackSave).apply(null,arguments)},e.stackRestore=function(){return(e.stackRestore=e.asm.stackRestore).apply(null,arguments)},e.stackAlloc=function(){return(e.stackAlloc=e.asm.stackAlloc).apply(null,arguments)},e.dynCall_vijii=function(){return(e.dynCall_vijii=e.asm.dynCall_vijii).apply(null,arguments)},e.dynCall_viji=function(){return(e.dynCall_viji=e.asm.dynCall_viji).apply(null,arguments)},e.dynCall_vijiiii=function(){return(e.dynCall_vijiiii=e.asm.dynCall_vijiiii).apply(null,arguments)},e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.dynCall_jiji).apply(null,arguments)},e.dynCall_viijii=function(){return(e.dynCall_viijii=e.asm.dynCall_viijii).apply(null,arguments)},e.dynCall_iiiiij=function(){return(e.dynCall_iiiiij=e.asm.dynCall_iiiiij).apply(null,arguments)},e.dynCall_iiiiijj=function(){return(e.dynCall_iiiiijj=e.asm.dynCall_iiiiijj).apply(null,arguments)},e.dynCall_iiiiiijj=function(){return(e.dynCall_iiiiiijj=e.asm.dynCall_iiiiiijj).apply(null,arguments)},$=function e(){Nt||Vt(),Nt||($=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();Vt();var $t,Mt=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(t){o(t)}}function s(e){try{l(i.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})};function Ut(e){if("string"!=typeof e)return e;var t;try{var n=JSON.parse(e);t="object"===ct(n)&&n?n:e}catch(i){t=e}return t}function Ft(e){return"function"==typeof(null==e?void 0:e.use)||"function"==typeof(null==e?void 0:e.addSignalingListener)}!function(e){e[e.APNs=0]="APNs",e[e.VoIP=1]="VoIP"}($t||($t={}));var xt=function(){return rt(function e(){nt(this,e)},null,[{key:"getDeviceInfo",value:function(){var t={osName:"",osVersion:"",deviceName:"",framework:""};if(e.isWXMiniProgram){var n=wx.getSystemInfoSync(),i=st(n.system.split(" "),2),r=i[0],o=i[1];return t.osName=r,t.osVersion=o,t.deviceName=n.model,t.framework="wxMiniProgram",t}var a=e.rtcDetect.getSystem().browser,s=e.rtcDetect.getSystem().OS,l=e.isElectron?"electron":"web";return t.osName=a.name,t.osVersion=a.version,t.deviceName=s,t.framework=l,t}}])}(),jt=function(){function e(){nt(this,e)}return rt(e,null,[{key:"startInterval",value:function(t,n,i){var r=setInterval(function(){var n;(null===(n=null==e?void 0:e.timerMap)||void 0===n?void 0:n.has(t))&&e.timerMap.get(t).callback.onInterval(t)},n);e.timerMap.set(t,{timer:r,callback:i})}},{key:"stopInterval",value:function(t){var n;if(null===(n=null==e?void 0:e.timerMap)||void 0===n?void 0:n.has(t)){var i=e.timerMap.get(t);i&&i.timer&&(clearInterval(i.timer),i.callback.delete(),e.timerMap.delete(t))}}},{key:"startTimeout",value:function(e,t){return Mt(this,void 0,void 0,ot().m(function n(){return ot().w(function(n){for(;;)switch(n.n){case 0:setTimeout(function(){t.onTimeout(),t.delete()},e);case 1:return n.a(2)}},n)}))}}])}();jt.timerMap=new Map,e.JSTimer=jt,e.JSSystemInfo=xt,Mt=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(t){o(t)}}function s(e){try{l(i.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})};var Jt=e.TIM,Wt=function(){function e(t){return nt(this,e),this.waitingReadyQueue=[],this.logger=t&&t.logger||console,this.onTIMReadyStateUpdate=this.onTIMReadyStateUpdate.bind(this),e.chatLoginManager||(e.chatLoginManager=this),e.chatLoginManager}return rt(e,[{key:"login",value:function(t){return Mt(this,void 0,void 0,ot().m(function n(){var i,r,o,a,s,l=this;return ot().w(function(n){for(;;)switch(n.n){case 0:if(i=Object.assign({},t),r=i.userId,o=i.userSig,Ft(a=i.chat)){n.n=1;break}throw new Error("Current chat version is not supported, please use v3.");case 1:if(e.chat=a,this.bindTIMEvent(),!(s=e.chat.getLoginUser())){n.n=7;break}if(s!==r){n.n=4;break}if(!e.chat.isReady()){n.n=2;break}return n.a(2);case 2:return n.a(2,new Promise(function(e,t){l.addLoginHandler({userId:r,resolve:e,reject:t})}));case 3:n.n=6;break;case 4:return n.n=5,this.doLogout();case 5:return n.n=6,this.doLogin({userId:r,userSig:o});case 6:n.n=8;break;case 7:return n.n=8,this.doLogin({userId:r,userSig:o});case 8:return n.a(2)}},n,this)}))}},{key:"doLogin",value:function(t){return Mt(this,void 0,void 0,ot().m(function n(){var i,r,o,a=this;return ot().w(function(n){for(;;)if(0===n.n)return i=Object.assign({},t),r=i.userId,o=i.userSig,n.a(2,new Promise(function(t,n){return Mt(a,void 0,void 0,ot().m(function i(){var a,s;return ot().w(function(i){for(;;)switch(i.p=i.n){case 0:return i.p=0,this.logger.debug("[tim] chat.login with userId: ",r),i.n=1,e.chat.login({userID:r,userSig:o});case 1:if(a=i.v,this.logger.info("[tim] chat.login success:",a),!a.data.repeatLogin||!e.chat.isReady()){i.n=2;break}return t(!0),i.a(2);case 2:this.addLoginHandler({userId:r,resolve:t,reject:n}),i.n=4;break;case 3:i.p=3,s=i.v,this.logger.debug("[tim] chat.login error: ",s,s.code),2025===s.code?this.addLoginHandler({userId:r,resolve:t,reject:n}):n(s);case 4:return i.a(2)}},i,this,[[0,3]])}))}))},n)}))}},{key:"logout",value:function(){return Mt(this,void 0,void 0,ot().m(function t(){return ot().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.doLogout();case 1:e.chat=null;case 2:return t.a(2)}},t,this)}))}},{key:"doLogout",value:function(){return Mt(this,void 0,void 0,ot().m(function t(){return ot().w(function(t){for(;;)switch(t.n){case 0:if(e.chat){t.n=1;break}return t.a(2);case 1:return this.logger.debug("[tim] chat.logout."),t.n=2,e.chat.logout();case 2:this.logger.info("[tim] chat.logout success.");case 3:return t.a(2)}},t,this)}))}},{key:"addLoginHandler",value:function(e){var t=this;this.waitingReadyQueue.push(e),setTimeout(function(){var n=t.waitingReadyQueue.findIndex(function(t){return t===e});n<0||(t.waitingReadyQueue.splice(n,1),e.reject(new Error("login timeout")))},2e3)}},{key:"onTIMReadyStateUpdate",value:function(t){if(this.logger.debug("onTIMReadyStateUpdate event:",t.name),t.name===Jt.EVENT.SDK_READY){var n=e.chat.getLoginUser();this.waitingReadyQueue.forEach(function(e){e.userId===n?e.resolve():e.reject(new Error("user ".concat(n," has Logged")))})}else this.waitingReadyQueue.forEach(function(e){return e.reject(new Error("sdk not ready"))});this.waitingReadyQueue=[]}},{key:"bindTIMEvent",value:function(){var t,n,i,r;null===(t=e.chat)||void 0===t||t.off(Jt.EVENT.SDK_READY,this.onTIMReadyStateUpdate),null===(n=e.chat)||void 0===n||n.off(Jt.EVENT.SDK_NOT_READY,this.onTIMReadyStateUpdate),null===(i=e.chat)||void 0===i||i.on(Jt.EVENT.SDK_READY,this.onTIMReadyStateUpdate),null===(r=e.chat)||void 0===r||r.on(Jt.EVENT.SDK_NOT_READY,this.onTIMReadyStateUpdate)}}])}(),Bt=(Mt=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(t){o(t)}}function s(e){try{l(i.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})},e.TIM),Gt=Bt.TSignaling,Kt=["callExperimentalAPI","invite","inviteInGroup","accept","reject","cancel","modifyInvitation","getUserStatus"],Ht=function(){return rt(function t(){nt(this,t),this.chatLoginManager=new Wt({logger:e.logger}),this.isExternalIncomingTim=!1,this.onError=this.onError.bind(this),this.onRoomCustomDataReceived=this.onRoomCustomDataReceived.bind(this),this.onKickedOut=this.onKickedOut.bind(this),this.onNetStateChange=this.onNetStateChange.bind(this),this.onServerConfigUpdated=this.onServerConfigUpdated.bind(this),this.onNewMessageReceived=this.onNewMessageReceived.bind(this),this.onNewInvitationReceived=this.onNewInvitationReceived.bind(this),this.onInviteeAccepted=this.onInviteeAccepted.bind(this),this.onInviteeRejected=this.onInviteeRejected.bind(this),this.onInvitationCancelled=this.onInvitationCancelled.bind(this),this.onInvitationTimeout=this.onInvitationTimeout.bind(this)},[{key:"bindObserver",value:function(e){this.nativeObserver=e}},{key:"unBindObserver",value:function(){this.nativeObserver&&this.nativeObserver.delete(),this.nativeObserver=null}},{key:"getLoginUser",value:function(){var e,t=null===(e=this.tim)||void 0===e?void 0:e.getLoginUser();return null!=t?t:""}},{key:"callJS",value:function(t,n,i){return Mt(this,void 0,void 0,ot().m(function r(){var o,a;return ot().w(function(r){for(;;)switch(r.p=r.n){case 0:if(r.p=0,!e.tim||Ft(e.tim)){r.n=1;break}return i.onError(-1,"The current npm package you are using, tim-js-sdk, does not match the current dependency version of TUIRoom. We recommend upgrading to the new npm package @tencentCloud/chat for continued support and updates."),r.a(2);case 1:if(e.tim||"login"===t){r.n=2;break}return i.onError(2024,"please login firstly"),r.a(2);case 2:o=Ut(n),"invite"!==t&&"inviteInGroup"!==t||(o.offlinePushInfo=Ut(o.offlinePushInfo)||{}),"callExperimentalAPI"!==t&&e.logger.debug("[tim] ".concat(t," with params"),o),"getUserStatus"==t&&(o.userIDList=Ut(o.userIDList)),a=t,r.n="logout"===a?3:"login"===a||"updateMyProfile"===a?5:7;break;case 3:return r.n=4,this.logout(i);case 4:case 6:return r.a(3,8);case 5:return r.n=6,this[t](o,i);case 7:return r.n=8,this.timFunction(t,o,i);case 8:return r.p=8,i.delete(),r.f(8);case 9:return r.a(2)}},r,this,[[0,,8,9]])}))}},{key:"login",value:function(t,n){return Mt(this,void 0,void 0,ot().m(function i(){var r,o,a,s,l,u;return ot().w(function(i){for(;;)switch(i.p=i.n){case 0:return r=Object.assign({},t),o=r.sdkAppId,a=r.userId,s=r.userSig,l=r.testEnv,e.logger.debug("[tim] login with params",o,a),this.tim||(e.tim?(this.tim=e.tim,this.isExternalIncomingTim=!0):(this.tim=Bt.create({SDKAppID:o,testEnv:l}),e.tim=this.tim,this.isExternalIncomingTim=!1),this.bindTIMEvent()),i.p=1,i.n=2,this.chatLoginManager.login({sdkAppId:o,userId:a,userSig:s,testEnv:l,chat:this.tim});case 2:n.onSuccess(null),i.n=4;break;case 3:i.p=3,u=i.v,n.onError(u.code||-1,u.message);case 4:return i.a(2)}},i,this,[[1,3]])}))}},{key:"logout",value:function(t){return Mt(this,void 0,void 0,ot().m(function n(){var i;return ot().w(function(n){for(;;)switch(n.p=n.n){case 0:if(e.logger.debug("[tim] logout. isExternalIncomingTim: ",this.isExternalIncomingTim),this.unbindTIMEvent(),!this.isExternalIncomingTim){n.n=1;break}e.tim=this.tim=null,t.onSuccess(null),n.n=4;break;case 1:return n.p=1,n.n=2,this.chatLoginManager.logout();case 2:e.tim=this.tim=null,t.onSuccess(null),n.n=4;break;case 3:n.p=3,i=n.v,t.onError(i.code||-1,i.message);case 4:return n.a(2)}},n,this,[[1,3]])}))}},{key:"updateMyProfile",value:function(e,t){return Mt(this,void 0,void 0,ot().m(function n(){var i,r,o,a;return ot().w(function(n){for(;;)switch(n.p=n.n){case 0:return i=Object.assign({},e),r=i.nick,o=i.avatar,n.p=1,n.n=2,this.tim.updateMyProfile({nick:r,avatar:o,gender:Bt.TYPES.GENDER_UNKNOWN,allowType:Bt.TYPES.ALLOW_TYPE_ALLOW_ANY});case 2:t.onSuccess(null),n.n=4;break;case 3:n.p=3,a=n.v,t.onError(a.code||-1,a.message);case 4:return n.a(2)}},n,this,[[1,3]])}))}},{key:"timFunction",value:function(t,n,i){return Mt(this,void 0,void 0,ot().m(function r(){var o,a,s,l,u;return ot().w(function(r){for(;;)switch(r.p=r.n){case 0:if(r.p=0,s=null,!(n instanceof Array)){r.n=2;break}return r.n=1,(l=this.tim)[t].apply(l,lt(n));case 1:s=r.v,r.n=4;break;case 2:return r.n=3,this.tim[t](n);case 3:s=r.v;case 4:"callExperimentalAPI"!==t&&e.logger.info("[tim] call ".concat(t," success")),"invite"!==t&&"inviteInGroup"!==t&&"modifyInvitation"!==t||(s=(null===(a=null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.message)||void 0===a?void 0:a.payload)||{data:""}),this.handleTimFunctionResponse(t,s.data,i),r.n=6;break;case 5:r.p=5,u=r.v,e.logger.warn("[tim] ".concat(t," error:"),u),i.onError(u.code||-1,u.message);case 6:return r.a(2)}},r,this,[[0,5]])}))}},{key:"handleTimFunctionResponse",value:function(e,t,n){Kt.includes(e)&&t?"string"==typeof t?n.onSuccess({response:t}):n.onSuccess({response:JSON.stringify(t)}):n.onSuccess(t)}},{key:"onKickedOut",value:function(e){var t,n;switch(e.data.type){case Bt.TYPES.KICKED_OUT_MULT_ACCOUNT:case Bt.TYPES.KICKED_OUT_MULT_DEVICE:case Bt.TYPES.KICKED_OUT_REST_API:null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onKickedOffline",{});break;case Bt.TYPES.KICKED_OUT_USERSIG_EXPIRED:null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onUserSigExpired",{})}}},{key:"onNetStateChange",value:function(e){var t,n;switch(e.data.state){case Bt.TYPES.NET_STATE_CONNECTED:null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onConnectSuccess",{});break;case Bt.TYPES.NET_STATE_DISCONNECTED:null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onConnectFailed",{})}}},{key:"onRoomCustomDataReceived",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onRoomCustomDataReceived",e)}},{key:"onError",value:function(e){console.error("".concat(TIMService.logPrefix," onError error:"),e)}},{key:"onServerConfigUpdated",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onServerConfigUpdated",JSON.stringify(null==e?void 0:e.data)||"")}},{key:"onNewMessageReceived",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onNewMessageReceived",JSON.stringify(null==e?void 0:e.data)||"")}},{key:"onNewInvitationReceived",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onNewInvitationReceived",(null==e?void 0:e.data)||{})}},{key:"onInviteeAccepted",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onInviteeAccepted",(null==e?void 0:e.data)||{})}},{key:"onInviteeRejected",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onInviteeRejected",(null==e?void 0:e.data)||{})}},{key:"onInvitationCancelled",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onInvitationCancelled",(null==e?void 0:e.data)||{})}},{key:"onInvitationTimeout",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onInvitationTimeout",(null==e?void 0:e.data)||{})}},{key:"bindTIMEvent",value:function(){var e,t,n,i,r,o,a,s,l,u,c,d,f,v,h,p;null===(e=this.tim)||void 0===e||e.on(Bt.EVENT.ERROR,this.onError),null===(t=this.tim)||void 0===t||t.on(Bt.EVENT.KICKED_OUT,this.onKickedOut),null===(n=this.tim)||void 0===n||n.on(Bt.EVENT.NET_STATE_CHANGE,this.onNetStateChange),null===(i=this.tim)||void 0===i||i.on(Bt.EVENT.ROOM_CUSTOM_DATA_RECEIVED,this.onRoomCustomDataReceived),null===(r=this.tim)||void 0===r||r.on(Bt.EVENT.SERVER_CONFIG_UPDATED,this.onServerConfigUpdated),null===(o=this.tim)||void 0===o||o.on(Bt.EVENT.MESSAGE_RECEIVED,this.onNewMessageReceived),null===(s=null===(a=this.tim)||void 0===a?void 0:a.addSignalingListener)||void 0===s||s.call(a,Gt.NEW_INVITATION_RECEIVED,this.onNewInvitationReceived),null===(u=null===(l=this.tim)||void 0===l?void 0:l.addSignalingListener)||void 0===u||u.call(l,Gt.INVITEE_ACCEPTED,this.onInviteeAccepted),null===(d=null===(c=this.tim)||void 0===c?void 0:c.addSignalingListener)||void 0===d||d.call(c,Gt.INVITEE_REJECTED,this.onInviteeRejected),null===(v=null===(f=this.tim)||void 0===f?void 0:f.addSignalingListener)||void 0===v||v.call(f,Gt.INVITATION_CANCELLED,this.onInvitationCancelled),null===(p=null===(h=this.tim)||void 0===h?void 0:h.addSignalingListener)||void 0===p||p.call(h,Gt.INVITATION_TIMEOUT,this.onInvitationTimeout)}},{key:"unbindTIMEvent",value:function(){var e,t,n,i,r,o,a,s,l,u,c,d,f,v,h,p;null===(e=this.tim)||void 0===e||e.off(Bt.EVENT.ERROR,this.onError),null===(t=this.tim)||void 0===t||t.off(Bt.EVENT.KICKED_OUT,this.onKickedOut),null===(n=this.tim)||void 0===n||n.off(Bt.EVENT.NET_STATE_CHANGE,this.onNetStateChange),null===(i=this.tim)||void 0===i||i.off(Bt.EVENT.ROOM_CUSTOM_DATA_RECEIVED,this.onRoomCustomDataReceived),null===(r=this.tim)||void 0===r||r.off(Bt.EVENT.SERVER_CONFIG_UPDATED,this.onServerConfigUpdated),null===(o=this.tim)||void 0===o||o.off(Bt.EVENT.MESSAGE_RECEIVED,this.onNewMessageReceived),null===(s=null===(a=this.tim)||void 0===a?void 0:a.removeSignalingListener)||void 0===s||s.call(a,Gt.NEW_INVITATION_RECEIVED,this.onNewInvitationReceived),null===(u=null===(l=this.tim)||void 0===l?void 0:l.removeSignalingListener)||void 0===u||u.call(l,Gt.INVITEE_ACCEPTED,this.onInviteeAccepted),null===(d=null===(c=this.tim)||void 0===c?void 0:c.removeSignalingListener)||void 0===d||d.call(c,Gt.INVITEE_REJECTED,this.onInviteeRejected),null===(v=null===(f=this.tim)||void 0===f?void 0:f.removeSignalingListener)||void 0===v||v.call(f,Gt.INVITATION_CANCELLED,this.onInvitationCancelled),null===(p=null===(h=this.tim)||void 0===h?void 0:h.removeSignalingListener)||void 0===p||p.call(h,Gt.INVITATION_TIMEOUT,this.onInvitationTimeout)}}],[{key:"getSDKVersion",value:function(){return Bt.VERSION}}])}();Ht.logPrefix="[JSTim]",e.JSTim=Ht;var Yt=e.TRTCDefine.TRTCVideoResolutionMode;function Qt(e){return"string"==typeof e?e.split(",").length>1?e.split(",").map(function(e){return document.getElementById(e)}).filter(function(e){return Boolean(e)}):en?document.getElementById(e):e:e}function zt(e,t){var n=t;return"startLocalPreview"===e&&(1===n.length&&(n[0]=Qt(n[0])),2===n.length&&(n[1]=Qt(n[1]))),"updateLocalView"!==e&&"startScreenCapture"!==e||(n[0]=Qt(n[0])),"startRemoteView"!==e&&"updateRemoteView"!==e||(n[1]=Qt(n[1])),n}function qt(t,n){var i=n;if("enterRoom"===t&&e.TRTCDefine.TRTCParams&&n instanceof Array&&n.length>0&&(i[0]=new e.TRTCDefine.TRTCParams(n[0].sdkAppId,n[0].userId,n[0].userSig,n[0].roomId,n[0].strRoomId,n[0].role)),"setVideoEncoderParam"===t&&e.TRTCDefine.TRTCVideoEncParam&&n instanceof Array&&n.length>0&&(i[0]=new e.TRTCDefine.TRTCVideoEncParam(n[0].videoResolution,Yt.TRTCVideoResolutionModeLandscape,n[0].videoFps,n[0].videoBitrate,n[0].minVideoBitrate)),"selectScreenCaptureTarget"===t&&e.TRTCDefine.TRTCScreenCaptureSourceInfo&&e.TRTCDefine.TRTCScreenCaptureProperty&&n instanceof Array&&3===n.length&&e.tempResult.screenSharingTargetList&&e.tempResult.screenSharingTargetList.length>0){var r=e.tempResult.screenSharingTargetList.filter(function(e){return e.sourceId===n[0].sourceId});r.length>0&&(i[0]=r[0],i[1]=new e.TRTCDefine.Rect(n[1].left,n[1].top,n[1].right,n[1].bottom),i[2]=new e.TRTCDefine.TRTCScreenCaptureProperty(n[2].enableCaptureMouse,n[2].enableHighLight,n[2].enableHighPerformance,n[2].highLightColor,n[2].highLightWidth,n[2].enableCaptureChildWindow))}return"startScreenCapture"===t&&e.TRTCDefine.TRTCVideoEncParam&&n instanceof Array&&3===n.length&&(i[2]=new e.TRTCDefine.TRTCVideoEncParam(n[2].videoResolution,n[2].resMode,n[2].videoFps,n[2].videoBitrate,n[2].minVideoBitrate,n[2].enableAdjustRes)),"enableSmallVideoStream"===t&&e.TRTCDefine.TRTCVideoEncParam&&n instanceof Array&&2===n.length&&(i[1]=new e.TRTCDefine.TRTCVideoEncParam(n[1].videoResolution,n[1].resMode,n[1].videoFps,n[1].videoBitrate,n[1].minVideoBitrate,!1)),i}function Xt(t,n){"getScreenCaptureSources"===t&&(e.tempResult.screenSharingTargetList=n)}Mt=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(t){o(t)}}function s(e){try{l(i.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})};var Zt=e.TRTCCloud,en=e.currentFrameWork===e.FRAMEWORK.ELECTRON,tn=function(){function t(e){nt(this,t),this.trtcCloud=e?Zt.getTRTCShareInstance():Zt.getTRTCShareInstance().createSubCloud(),this.isMainTRTCCloud=e,this.nativeObserver=null,this.onError=this.onError.bind(this),this.onWarning=this.onWarning.bind(this),this.onEnterRoom=this.onEnterRoom.bind(this),this.onExitRoom=this.onExitRoom.bind(this),this.onSwitchRole=this.onSwitchRole.bind(this),this.onUserVideoAvailable=this.onUserVideoAvailable.bind(this),this.onUserSubStreamAvailable=this.onUserSubStreamAvailable.bind(this),this.onUserAudioAvailable=this.onUserAudioAvailable.bind(this),this.onScreenCapturePaused=this.onScreenCapturePaused.bind(this),this.onScreenCaptureResumed=this.onScreenCaptureResumed.bind(this),this.onScreenCaptureStopped=this.onScreenCaptureStopped.bind(this),this.onFirstVideoFrame=this.onFirstVideoFrame.bind(this),this.onRemoteUserEnterRoom=this.onRemoteUserEnterRoom.bind(this),this.onRemoteUserLeaveRoom=this.onRemoteUserLeaveRoom.bind(this),this.onUserVoiceVolume=this.onUserVoiceVolume.bind(this),this.onNetworkQuality=this.onNetworkQuality.bind(this),this.onStatistics=this.onStatistics.bind(this),this.onMicDidReady=this.onMicDidReady.bind(this),this.onCameraDidReady=this.onCameraDidReady.bind(this),this.onSendFirstLocalAudioFrame=this.onSendFirstLocalAudioFrame.bind(this),this.onSendFirstLocalVideoFrame=this.onSendFirstLocalVideoFrame.bind(this),this.onReceiveSEIMessage=this.onReceiveSEIMessage.bind(this),this.onConnectionLost=this.onConnectionLost.bind(this),this.onConnectionRecovery=this.onConnectionRecovery.bind(this),this.bindTRTCEvent()}return rt(t,[{key:"destroyTRTC",value:function(){this.unbindTRTCEvent(),this.isMainTRTCCloud||this.trtcCloud.destroy()}},{key:"getTRTCCloud",value:function(){return this.trtcCloud}},{key:"bindObserver",value:function(e){this.nativeObserver=e}},{key:"unBindObserver",value:function(){this.nativeObserver&&this.nativeObserver.delete(),this.nativeObserver=null}},{key:"callJS",value:function(t,n,i){return Mt(this,void 0,void 0,ot().m(function r(){var o,a,s,l,u,c,d;return ot().w(function(r){for(;;)switch(r.p=r.n){case 0:if(r.p=0,o=Ut(n),a=zt(t,o),a=en?qt(t,a):a,e.logger.debug("[trtcCloud] ".concat(t," params"),a,ct(a)),s=null,!(a instanceof Array)){r.n=2;break}return r.n=1,(l=this.trtcCloud)[t].apply(l,lt(a));case 1:s=r.v,r.n=4;break;case 2:return r.n=3,this.trtcCloud[t](a);case 3:s=r.v;case 4:e.logger.info("[trtcCloud] ".concat(t," success")),en&&Xt(t,s),i&&i.onSuccess(s),r.n=6;break;case 5:r.p=5,d=r.v,e.logger&&e.logger.warn("[trtcCloud] ".concat(t," error"),d),u=d&&d.code,c=d&&d.message,"startScreenShare"===t&&(u=d&&d.extraCode,c=JSON.stringify({name:d.originError.name,message:c})),i&&i.onError(u,c);case 6:i.delete();case 7:return r.a(2)}},r,this,[[0,5]])}))}},{key:"onError",value:function(t,n){var i;e.logger.warn("[trtcCloud] onError",t,n),null===(i=this.nativeObserver)||void 0===i||i.onJSEvent("onError",{errCode:t,errMsg:n})}},{key:"onWarning",value:function(e,t,n){var i;null===(i=this.nativeObserver)||void 0===i||i.onJSEvent("onWarning",{warningCode:e,warningMsg:t,extraInfo:JSON.stringify({extraInfo:n})})}},{key:"onEnterRoom",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onEnterRoom",{result:e})}},{key:"onExitRoom",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onExitRoom",{reason:e})}},{key:"onSwitchRole",value:function(e,t){var n;null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onSwitchRole",{errorCode:e,errorMessage:t})}},{key:"onUserVideoAvailable",value:function(e,t){var n;null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onUserVideoAvailable",{userId:e,available:Boolean(t)})}},{key:"onUserSubStreamAvailable",value:function(e,t){var n;null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onUserSubStreamAvailable",{userId:e,available:Boolean(t)})}},{key:"onUserAudioAvailable",value:function(e,t){var n;null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onUserAudioAvailable",{userId:e,available:Boolean(t)})}},{key:"onFirstVideoFrame",value:function(e,t,n,i){var r;null===(r=this.nativeObserver)||void 0===r||r.onJSEvent("onFirstVideoFrame",{userId:e,streamType:t,width:n,height:i})}},{key:"onRemoteUserEnterRoom",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onRemoteUserEnterRoom",{userId:e})}},{key:"onRemoteUserLeaveRoom",value:function(e,t){var n;null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onRemoteUserLeaveRoom",{userId:e,reason:t})}},{key:"onUserVoiceVolume",value:function(e,t,n){var i;null===(i=this.nativeObserver)||void 0===i||i.onJSEvent("onUserVoiceVolume",{userVolumes:e,userVolumesCount:t,totalVolume:n})}},{key:"onNetworkQuality",value:function(e,t){var n;null===(n=this.nativeObserver)||void 0===n||n.onJSEvent("onNetworkQuality",{localQuality:e,remoteQuality:t,remoteQualityCount:t.length})}},{key:"onStatistics",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onStatistics",{statistics:e})}},{key:"onMicDidReady",value:function(){var e;null===(e=this.nativeObserver)||void 0===e||e.onJSEvent("onMicDidReady",{})}},{key:"onCameraDidReady",value:function(){var e;null===(e=this.nativeObserver)||void 0===e||e.onJSEvent("onCameraDidReady",{})}},{key:"onScreenCapturePaused",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onScreenCapturePaused",{reason:e})}},{key:"onScreenCaptureResumed",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onScreenCaptureResumed",{reason:e})}},{key:"onScreenCaptureStopped",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onScreenCaptureStopped",{reason:e})}},{key:"onSendFirstLocalAudioFrame",value:function(){var e;null===(e=this.nativeObserver)||void 0===e||e.onJSEvent("onSendFirstLocalAudioFrame",{})}},{key:"onSendFirstLocalVideoFrame",value:function(e){var t;null===(t=this.nativeObserver)||void 0===t||t.onJSEvent("onSendFirstLocalVideoFrame",{streamType:e})}},{key:"onReceiveSEIMessage",value:function(t,n){var i;try{var r=JSON.parse(n);null===(i=this.nativeObserver)||void 0===i||i.onJSEvent("onReceiveSEIMessage",{message:JSON.stringify(Object.assign(Object.assign({},r),{userId:t,data:r.stringData}))})}catch(o){e.logger&&e.logger.warn("[trtcCloud] onReceiveSEIMessage error",o)}}},{key:"onConnectionLost",value:function(){var e;null===(e=this.nativeObserver)||void 0===e||e.onJSEvent("onConnectionLost",{})}},{key:"onConnectionRecovery",value:function(){var e;null===(e=this.nativeObserver)||void 0===e||e.onJSEvent("onConnectionRecovery",{})}},{key:"bindTRTCEvent",value:function(){this.trtcCloud.on("onError",this.onError),this.trtcCloud.on("onWarning",this.onWarning),this.trtcCloud.on("onEnterRoom",this.onEnterRoom),this.trtcCloud.on("onExitRoom",this.onExitRoom),this.trtcCloud.on("onSwitchRole",this.onSwitchRole),this.trtcCloud.on("onUserVideoAvailable",this.onUserVideoAvailable),this.trtcCloud.on("onUserSubStreamAvailable",this.onUserSubStreamAvailable),this.trtcCloud.on("onUserAudioAvailable",this.onUserAudioAvailable),this.trtcCloud.on("onScreenCapturePaused",this.onScreenCapturePaused),this.trtcCloud.on("onScreenCaptureResumed",this.onScreenCaptureResumed),this.trtcCloud.on("onScreenCaptureStopped",this.onScreenCaptureStopped),this.trtcCloud.on("onFirstVideoFrame",this.onFirstVideoFrame),this.trtcCloud.on("onRemoteUserEnterRoom",this.onRemoteUserEnterRoom),this.trtcCloud.on("onRemoteUserLeaveRoom",this.onRemoteUserLeaveRoom),this.trtcCloud.on("onUserVoiceVolume",this.onUserVoiceVolume),this.trtcCloud.on("onNetworkQuality",this.onNetworkQuality),this.trtcCloud.on("onStatistics",this.onStatistics),this.trtcCloud.on("onMicDidReady",this.onMicDidReady),this.trtcCloud.on("onCameraDidReady",this.onCameraDidReady),this.trtcCloud.on("onSendFirstLocalAudioFrame",this.onSendFirstLocalAudioFrame),this.trtcCloud.on("onSendFirstLocalVideoFrame",this.onSendFirstLocalVideoFrame),this.trtcCloud.on("onRecvSEIMsg",this.onReceiveSEIMessage),this.trtcCloud.on("onConnectionLost",this.onConnectionLost),this.trtcCloud.on("onConnectionRecovery",this.onConnectionRecovery)}},{key:"unbindTRTCEvent",value:function(){this.trtcCloud.off("onError",this.onError),this.trtcCloud.off("onWarning",this.onWarning),this.trtcCloud.off("onEnterRoom",this.onEnterRoom),this.trtcCloud.off("onExitRoom",this.onExitRoom),this.trtcCloud.off("onSwitchRole",this.onSwitchRole),this.trtcCloud.off("onUserVideoAvailable",this.onUserVideoAvailable),this.trtcCloud.off("onUserSubStreamAvailable",this.onUserSubStreamAvailable),this.trtcCloud.off("onUserAudioAvailable",this.onUserAudioAvailable),this.trtcCloud.off("onScreenCapturePaused",this.onScreenCapturePaused),this.trtcCloud.off("onScreenCaptureResumed",this.onScreenCaptureResumed),this.trtcCloud.off("onScreenCaptureStopped",this.onScreenCaptureStopped),this.trtcCloud.off("onFirstVideoFrame",this.onFirstVideoFrame),this.trtcCloud.off("onRemoteUserEnterRoom",this.onRemoteUserEnterRoom),this.trtcCloud.off("onRemoteUserLeaveRoom",this.onRemoteUserLeaveRoom),this.trtcCloud.off("onUserVoiceVolume",this.onUserVoiceVolume),this.trtcCloud.off("onNetworkQuality",this.onNetworkQuality),this.trtcCloud.off("onStatistics",this.onStatistics),this.trtcCloud.off("onMicDidReady",this.onMicDidReady),this.trtcCloud.off("onCameraDidReady",this.onCameraDidReady),this.trtcCloud.off("onSendFirstLocalAudioFrame",this.onSendFirstLocalAudioFrame),this.trtcCloud.off("onSendFirstLocalVideoFrame",this.onSendFirstLocalVideoFrame),this.trtcCloud.off("onRecvSEIMsg",this.onReceiveSEIMessage),this.trtcCloud.off("onConnectionLost",this.onConnectionLost),this.trtcCloud.off("onConnectionRecovery",this.onConnectionRecovery)}}],[{key:"createTRTC",value:function(e){return new t(e)}},{key:"getSDKVersion",value:function(){return Zt.getTRTCShareInstance().getSDKVersion()}},{key:"log",value:function(n){return Mt(this,void 0,void 0,ot().m(function i(){var r,o,a;return ot().w(function(i){for(;;)switch(i.n){case 0:if("object"===ct(r=Ut(n))){i.n=1;break}return i.a(2);case 1:if(o="[".concat(r.file,": ").concat(r.line,"] ").concat(r.message),!e.isElectron){i.n=3;break}return a={api:"TuikitLog",params:r},e.logger.info(o),i.n=2,t.callExperimentalAPI(JSON.stringify(a));case 2:i.n=4;break;case 3:2===r.level?e.logger.error(o):console.log("[tuikit engine wasm] ["+r.file+":"+r.line+"] "+r.message);case 4:return i.a(2)}},i)}))}},{key:"callExperimentalAPI",value:function(e){return Mt(this,void 0,void 0,ot().m(function t(){var n;return ot().w(function(t){for(;;)switch(t.n){case 0:return n=Zt.getTRTCShareInstance(),t.n=1,n.callExperimentalAPI(e);case 1:return t.a(2)}},t)}))}}])}();return e.JSTRTC=tn,e.ready});const ht={TRTCDeviceInfo:C,TRTCVideoEncParam:T,TRTCQuality:g,TRTCVideoResolution:f,TRTCBeautyStyle:p,TRTCVideoFillMode:v},pt=Ce?O.MINI_PROGRAM:O.WEB,mt={};mt.TIM=e,mt.TRTCCloud=t,mt.currentFrameWork=pt,mt.TRTCDefine=ht,mt.TIMDefine=e.TYPES,mt.FRAMEWORK=O;const gt=(yt={},et||(et=new Ze(yt)),et);var yt;mt.loggerManager=gt,mt.logger=gt,mt.isWXMiniProgram=!0,ke.info(`SDK Version:${_}.`),function(){n(this,void 0,void 0,function*(){yield vt(mt),Ct.setModule(mt)})}();const _t=new d;class Ct{constructor(e){var t,n;if(this._logger=gt,this._uniqueLoginId="",this._isExternalTim=!1,this._localRenderFillMode=v.TRTCVideoFillMode_Fill,this._remoteRenderFillMode=v.TRTCVideoFillMode_Fill,this._callMediaType=a.UNKNOWN,this.tim=null,this.trtcCloud=null,this._permission={audio:!1,video:!1},!Ct.isWasmReady)throw new ce({code:r.ERR_FAILED,message:"Please listen to the ready event and then execute the constructor method."});const{isSharedInstance:i=!0,framework:o=30,component:s=17,language:l=0}=e;this._callEngineWASM=new Ct.Module.TUICallEngineWASM(i),Ct.sdkAppId=e.SDKAppID||e.sdkAppID||0,this.trtcCloud=this._callEngineWASM.getTRTCCloud();const u={api:"setFramework",params:{framework:o,component:s,language:l}};null===(t=null==this?void 0:this.callExperimentalAPI)||void 0===t||t.call(this,JSON.stringify(u)),e.tim&&(this._isExternalTim=!0,mt.tim=e.tim,this.tim=e.tim,X(null===(n=e.tim)||void 0===n?void 0:n.addSignalingListener)||(mt.tim.addSignalingListener=()=>{},this.tim.addSignalingListener=()=>{})),this._initLogger(e),this._logger.info("constructor.start",{text:{data:e},type:"api"}),this._observerFunction=this._observerFunction.bind(this),this._callEngineWASM.setObserver(this._observerFunction)}static setModule(e){ke.info("TUICallEngineWASM ready!"),this.Module=e,this.isWasmReady=!0,_t.emit("ready")}JSCallNativeFunctionPromise(e,...t){return new Promise((n,i)=>{const o=e=>{n({code:0,message:"success",data:ie(e)})},a=(t,n)=>{this._logger.info(`callEngine.${e} fail.`,{text:{data:{code:t,message:n}},type:"api"}),i(new ce({code:t,message:n}))};try{if(t.length>0)if("startRemoteView"===e){const i=e=>{ke.info("callEngine startRemoteView playingCallback ",ie(e)),n(ie(e))},r=e=>{ke.info("callEngine startRemoteView loadingCallback ",ie(e)),n(ie(e))};this._callEngineWASM[e](...t,i,r,a)}else this._callEngineWASM.callAPI(e,...t,o,a);else this._callEngineWASM.callAPI(e,"{}",o,a)}catch(s){this._logger.info(`callEngine.${e} fail.`,{text:{error:s},type:"api"}),ke.error(`callEngine.${e} fail.`,s.code,s.message),i(new ce({code:s.code||r.ERR_FAILED,message:s.message}))}})}static createInstance(e){return Ct.sdkAppId=e.SDKAppID||e.sdkAppID||0,gt.updateEsConfig({url:`https://webim.tim.qq.com/v4/imopenstat/tweb_trtccalling_report?sdkappid=${Ct.sdkAppId}`,table:"timweb-trtccalling"}),Ct.instance||(Ct.instance=new Ct(e)),Ct.instance}static once(e,t){_t.once(e,t),"ready"===e&&Ct.isWasmReady&&_t.emit("ready")}destroyInstance(){return n(this,void 0,void 0,function*(){Ct.instance=null,yield this.logout(),this._callEngineWASM&&(this._callEngineWASM=null)})}login(e){return n(this,void 0,void 0,function*(){this._uniqueLoginId=re(6),this._logger.updateGetReportData(()=>({userid:e.userID,uniqueloginid:this._uniqueLoginId})),this._logger.info("login.start",{text:{data:Object.assign(Object.assign({},e),{userSig:""})},type:"api"}),Ct.isWasmReady||(yield mt.ready);const{userID:t,userSig:n,assetsPath:i}=e;Ct.userId=t;const r=[Ct.sdkAppId,t,n];yield this.JSCallNativeFunctionPromise("login",JSON.stringify(r)),_t.emit(o.SDK_READY,{name:"ts_im_ready"})})}logout(){return n(this,void 0,void 0,function*(){const e={userID:Ct.userId,timExternal:this._isExternalTim};this._logger.info("logout.start",{text:{data:e},type:"api"}),yield this.JSCallNativeFunctionPromise("logout")})}call(e){return n(this,void 0,void 0,function*(){this._logger.info("call.start",{text:{data:e},type:"api"}),ke.info("call - params:",e),this._callMediaType=e.type,yield null==this?void 0:this._checkDevicePermission({audio:!0,callMediaType:e.type});const t={room_id:{int_room_id:(null==e?void 0:e.roomID)||0,str_room_id:(null==e?void 0:e.strRoomID)||""},timeout:(null==e?void 0:e.timeout)||30,offline_push_info:se(null==e?void 0:e.offlinePushInfo),user_data:(null==e?void 0:e.userData)||""},n=[e.userID,e.type,t];return yield this.JSCallNativeFunctionPromise("call",JSON.stringify(n))})}groupCall(e){return n(this,void 0,void 0,function*(){this._logger.info("groupCall.start",{text:{data:e},type:"api"}),ke.info("groupCall - params:",e),this._callMediaType=e.type,yield null==this?void 0:this._checkDevicePermission({audio:!0,callMediaType:e.type});const t={room_id:{int_room_id:(null==e?void 0:e.roomID)||0,str_room_id:(null==e?void 0:e.strRoomID)||""},timeout:(null==e?void 0:e.timeout)||30,offline_push_info:se(null==e?void 0:e.offlinePushInfo),user_data:(null==e?void 0:e.userData)||""},n=[e.groupID,e.userIDList,e.type,t];return yield this.JSCallNativeFunctionPromise("groupCall",JSON.stringify(n))})}calls(e){return n(this,void 0,void 0,function*(){this._logger.info("calls.start",{text:{data:e},type:"api"}),ke.info("calls - params:",e),this._callMediaType=e.type,yield null==this?void 0:this._checkDevicePermission({audio:!0,callMediaType:e.type});const t={room_id:{int_room_id:(null==e?void 0:e.roomID)||0,str_room_id:(null==e?void 0:e.strRoomID)||""},timeout:(null==e?void 0:e.timeout)||30,offline_push_info:se(null==e?void 0:e.offlinePushInfo),user_data:(null==e?void 0:e.userData)||""},n=[e.chatGroupID||"",e.userIDList,e.type,t];return yield this.JSCallNativeFunctionPromise("calls",JSON.stringify(n))})}accept(){return n(this,void 0,void 0,function*(){return this._logger.info("accept.start",{text:{data:{callMediaType:this._callMediaType}},type:"api"}),ke.info("accept.start"),yield null==this?void 0:this._checkDevicePermission({audio:!0,callMediaType:this._callMediaType}),yield this.JSCallNativeFunctionPromise("accept")})}reject(){return n(this,void 0,void 0,function*(){return this._logger.info("reject.start",{text:{},type:"api"}),ke.info("reject.start"),yield this.JSCallNativeFunctionPromise("reject")})}hangup(){return n(this,void 0,void 0,function*(){return this._logger.info("hangup.start",{text:{},type:"api"}),ke.info("hangup.start"),yield this.closeCamera(),yield this.closeMicrophone(),yield this.JSCallNativeFunctionPromise("hangup")})}inviteUser(e){return n(this,void 0,void 0,function*(){this._logger.info("inviteUser.start",{text:{data:e},type:"api"}),ke.info(`inviteUser, params:${JSON.stringify(e)}`);const{userIDList:t,offlinePushInfo:n={}}=e,i=[t,{timeout:(null==e?void 0:e.timeout)||30,offline_push_info:se(null==e?void 0:e.offlinePushInfo),user_data:(null==e?void 0:e.userData)||""}];yield this.JSCallNativeFunctionPromise("inviteUser",JSON.stringify(i))})}joinInGroupCall(e){return n(this,void 0,void 0,function*(){this._logger.info("joinInGroupCall.start",{text:{data:e},type:"api"}),ke.info(`joinInGroupCall, params:${e}`),this._callMediaType=e.type,yield null==this?void 0:this._checkDevicePermission({audio:!0,callMediaType:e.type});const t=[{int_room_id:(null==e?void 0:e.roomID)||0,str_room_id:(null==e?void 0:e.strRoomID)||""},e.groupID,e.type];yield this.JSCallNativeFunctionPromise("joinInGroupCall",JSON.stringify(t))})}join(e){return n(this,void 0,void 0,function*(){this._logger.info("join.start",{text:{data:e},type:"api"}),ke.info(`join, params:${e}`),yield null==this?void 0:this._checkDevicePermission({audio:!0});const t=[e.callId];yield this.JSCallNativeFunctionPromise("join",JSON.stringify(t))})}openCamera(e,t){return n(this,void 0,void 0,function*(){let n;this._logger.info("openCamera.start",{type:"api",text:{data:e,isFrontCamera:t}}),ke.info(`openCamera.start, videoViewDomID:${e}, isFrontCamera:${t}}`),yield null==this?void 0:this._checkDevicePermission({video:!0}),n=z(t)?-1:t?1:0;const i=[n,e];yield this.JSCallNativeFunctionPromise("openCamera",JSON.stringify(i))})}closeCamera(){return n(this,void 0,void 0,function*(){this._logger.info("closeCamera.start",{type:"api"}),ke.info("closeCamera.start"),yield this.JSCallNativeFunctionPromise("closeCamera")})}switchCamera(e){return n(this,void 0,void 0,function*(){this._logger.info("switchCamera.start",{type:"api",text:{data:e}}),ke.info(`switchCamera.start, cameraPosition: ${e}`);const t=[e===l.FRONT?1:0];yield this.JSCallNativeFunctionPromise("switchCamera",JSON.stringify(t))})}openMicrophone(){return n(this,void 0,void 0,function*(){this._logger.info("openMicrophone.start",{type:"api"}),ke.info("openMicrophone.start"),yield this.JSCallNativeFunctionPromise("openMicrophone")})}closeMicrophone(){return n(this,void 0,void 0,function*(){this._logger.info("closeMicrophone.start",{type:"api"}),ke.info("closeMicrophone.start"),yield this.JSCallNativeFunctionPromise("closeMicrophone")})}startRemoteView(e){var t,i;return n(this,void 0,void 0,function*(){this._logger.info("startRemoteView.start",{type:"api",text:{data:e}}),ke.info(`startRemoteView.start params: ${JSON.stringify(e)}`);let n=[e.userID,e.videoViewDomID];yield this.JSCallNativeFunctionPromise("startRemoteView",JSON.stringify(n)),this._remoteRenderFillMode=(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.fillMode)&&b[null===(i=e.options)||void 0===i?void 0:i.fillMode]||this._remoteRenderFillMode,n=[e.userID,this._remoteRenderFillMode,0],yield this.JSCallNativeFunctionPromise("setVideoRenderParams",JSON.stringify(n))})}stopRemoteView(e){return n(this,void 0,void 0,function*(){this._logger.info("stopRemoteView.start",{text:{data:e},type:"api"});const t=[e.userID];yield this.JSCallNativeFunctionPromise("startRemoteView",JSON.stringify(t))})}enableMultiDeviceAbility(e){this._logger.info("enableMultiDeviceAbility.start",{text:{data:{enable:e}},type:"api"});const t=[e];this.JSCallNativeFunctionPromise("enableMultiDeviceAbility",JSON.stringify(t))}setSelfInfo(e,t){return n(this,void 0,void 0,function*(){this._logger.info("setSelfInfo.start",{type:"api",text:{data:{nickName:e,avatar:t}}});const n=[e,t];yield this.JSCallNativeFunctionPromise("setSelfInfo",JSON.stringify(n))})}setBeautyLevel(e){var t;return n(this,void 0,void 0,function*(){try{this._logger.info("setBeautyLevel.start",{type:"api",text:{data:e}});const{style:n,beautyLevel:i,whitenessLevel:r}=e||{};if(!e||n!==p.TRTCBeautyStyleSmooth&&n!==p.TRTCBeautyStyleNature)return void ke.error("setBeautyLevel.fail style valid, ",n);yield null===(t=this.trtcCloud)||void 0===t?void 0:t.setBeautyStyle(n,i,r)}catch(n){this._logger.info("setBeautyLevel.fail",{type:"api",text:{data:n}}),ke.error("setBeautyLevel.fail",n)}})}setLogLevel(e){var n,i,r;ke.info(`setLogLevel level: ${e}`),ke.setLevel(e),null===(i=null===(n=null==this?void 0:this.tim)||void 0===n?void 0:n.setLogLevel)||void 0===i||i.call(n,e),null===(r=null==t?void 0:t.setLogLevel)||void 0===r||r.call(t,e)}init(e){return n(this,void 0,void 0,function*(){return this.login(e)})}on(e,t,n){if(_t.on(e,t,n||this),e===o.onDeviceChange||e===o.DEVICED_UPDATED){const e=o.onDeviceChange;return void this._handleTrtcCloudBindEvent(e)}}off(e,t,n){_t.off(e,t)}getTRTCCloudInstance(){return this.trtcCloud}getTim(){return mt.tim}callExperimentalAPI(e){return n(this,void 0,void 0,function*(){this._logger.info("callExperimentalAPI",{text:{data:e},type:"api"});const t=ie(e);if(t===e)return;const{api:n,params:i={}}=t;if(n&&i)try{const t=[e];return yield this.JSCallNativeFunctionPromise("callExperimentalAPI",JSON.stringify(t))}catch(r){throw r}})}reportLog(e){var t,n;try{if(Y(e)){const{name:i="",data:r,error:o,type:a="api",level:s="info"}=e||{},l="error"===s?{error:o,data:r}:{data:r};null===(n=null===(t=this._logger)||void 0===t?void 0:t[s])||void 0===n||n.call(t,i,{text:l,type:a})}}catch(i){console.debug("reportLog fail: ",i)}}selectAudioPlaybackDevice(e){var t;return n(this,void 0,void 0,function*(){this._logger.info("selectAudioPlaybackDevice.start",{text:{data:{type:e}},type:"api"});const n=e===s.SPEAKER?0:1;yield null===(t=this.trtcCloud)||void 0===t?void 0:t.setAudioRoute(n)})}deviceCheck(e){return n(this,void 0,void 0,function*(){return this._logger.info("deviceCheck.start",{text:{data:{params:e}},type:"api"}),(yield oe(e))&&ae(e)})}switchCallMediaType(e){return n(this,void 0,void 0,function*(){this._logger.info("switchCallMediaType.start",{text:{data:{newMediaType:e}},type:"api"});const t=[e];yield this.JSCallNativeFunctionPromise("switchCallMediaType",JSON.stringify(t))})}_checkDevicePermission(e={}){return n(this,void 0,void 0,function*(){if(e.callMediaType)return yield Ve(e.callMediaType)})}_handleTrtcCloudBindEvent(e){var t,i;return n(this,void 0,void 0,function*(){null===(t=this.trtcCloud)||void 0===t||t.removeAllListeners(e),null===(i=this.trtcCloud)||void 0===i||i.on(e,(...t)=>n(this,void 0,void 0,function*(){let n=fe(e,t);"{}"===JSON.stringify(n)?_t.emit(e):e===o.onDeviceChange?_t.emit(o.DEVICED_UPDATED,n):_t.emit(e,n)}))})}_observerFunction(e,t){const n=fe(e,t);if("{}"===JSON.stringify(n))_t.emit(e);else switch(_t.emit(e,n),e!==o.ON_USER_NETWORK_QUALITY_CHANGED&&e!==o.USER_VOICE_VOLUME&&this._logger.info(`${e}`,{text:{data:{emitterData:n}},type:"api"}),e){case o.ON_CALL_RECEIVED:_t.emit(o.INVITED,n),this._callMediaType=n.callMediaType;break;case o.ON_CALL_NOT_CONNECTED:_t.emit(o.ON_CALL_CANCELED,n),_t.emit(o.CALLING_CANCEL,n)}[o.USER_VOICE_VOLUME,o.ON_USER_NETWORK_QUALITY_CHANGED].includes(e)||ke.info(`callEngine received event: [${e}] ${JSON.stringify(n)}`)}_initLogger(e){null===wx||void 0===wx||wx.getSystemInfo({success:e=>{}}),this._logger.updateGetReportData(()=>({app:"TUICallEngine-mini",version:_,platform:e.scene||"miniProgram",sdkappid:e.sdkAppID,time:+new Date,userid:Ct.userId,uniqueloginid:this._uniqueLoginId,roomid:"",callinfo:{inviteid:"",callrole:"",groupid:"",calltype:"",handledInviteeList:[],unHandledInviteeList:[]},callkitversion:e.callkitVersion||"unknown",framework:e.frameWork||"unknown",isfromchat:e.tim?"true":"false"}))}getDevicePermission(){return this._permission}}Ct.className="TUICallEngine",Ct.isWasmReady=!1,Ct.once("ready",()=>n(void 0,void 0,void 0,function*(){}));export{s as AudioPlayBackDevice,a as CallMediaType,l as CameraPosition,u as IOSOfflinePushType,c as LOG_LEVEL,p as TRTCBeautyStyle,C as TRTCDeviceInfo,y as TRTCLogLevel,g as TRTCQuality,E as TRTCRenderParams,T as TRTCVideoEncParam,v as TRTCVideoFillMode,h as TRTCVideoMirrorType,f as TRTCVideoResolution,m as TRTCVideoRotation,Ct as TUICallEngine,o as TUICallEvent,r as TUIErrorCode,ae as appDeviceCheck,se as convertOfflinePushInfoToCIdentifier,Ct as default,oe as deviceCheck,Ve as devicePermissions,re as generateRandomString,ee as getType,ne as getValueType,Q as isArray,q as isArrayOrObject,X as isFunction,Z as isInstanceOfError,Y as isObject,H as isString,z as isUndefined,ie as safelyParse,te as stringifyError};
//# sourceMappingURL=index.esm.js.map