import{r as U}from"./tim-js-sdk-D6E6n_Uo.js";var V={exports:{}},G;function H(){return G||(G=1,function(F,K){(function(k,C){F.exports=C(U())})(window,function(k){return function(C){var b={};function E(I){if(b[I])return b[I].exports;var m=b[I]={i:I,l:!1,exports:{}};return C[I].call(m.exports,m,m.exports,E),m.l=!0,m.exports}return E.m=C,E.c=b,E.d=function(I,m,_){E.o(I,m)||Object.defineProperty(I,m,{enumerable:!0,get:_})},E.r=function(I){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})},E.t=function(I,m){if(1&m&&(I=E(I)),8&m||4&m&&typeof I=="object"&&I&&I.__esModule)return I;var _=Object.create(null);if(E.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:I}),2&m&&typeof I!="string")for(var a in I)E.d(_,a,(function(o){return I[o]}).bind(null,a));return _},E.n=function(I){var m=I&&I.__esModule?function(){return I.default}:function(){return I};return E.d(m,"a",m),m},E.o=function(I,m){return Object.prototype.hasOwnProperty.call(I,m)},E.p="",E(E.s=7)}([function(C,b,E){E.d(b,"e",function(){return a}),E.d(b,"g",function(){return o}),E.d(b,"c",function(){return s}),E.d(b,"f",function(){return u}),E.d(b,"b",function(){return l}),E.d(b,"d",function(){return D}),E.d(b,"a",function(){return x}),E.d(b,"h",function(){return S});const I=typeof window<"u",m=(typeof wx<"u"&&wx.getSystemInfoSync,I&&window.navigator&&window.navigator.userAgent||""),_=/AppleWebKit\/([\d.]+)/i.exec(m);_&&parseFloat(_.pop()),/iPad/i.test(m),function(){const f=m.match(/OS (\d+)_/i);f&&f[1]&&f[1]}(),/Android/i.test(m),function(){const f=m.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!f)return null;const N=f[1]&&parseFloat(f[1]),T=f[2]&&parseFloat(f[2]);return N&&T?parseFloat(f[1]+"."+f[2]):N||null}(),function(){const f=m.match(/Chrome\/(\d+)/);f&&f[1]&&parseFloat(f[1])}(),function(){const f=/MSIE\s(\d+)\.\d/.exec(m);f&&parseFloat(f[1])}(),/TBS\/\d+/i.test(m),function(){const f=m.match(/TBS\/(\d+)/i);f&&f[1]&&f[1]}(),E(2),E(1);const a=function(f){return A(f)==="map"},o=function(f){return A(f)==="set"},s=function(f){return A(f)==="file"},u=function(f){if(typeof f!="object"||f===null)return!1;const N=Object.getPrototypeOf(f);if(N===null)return!0;let T=N;for(;Object.getPrototypeOf(T)!==null;)T=Object.getPrototypeOf(T);return N===T},g=function(f){return typeof Array.isArray=="function"?Array.isArray(f):A(f)==="array"},l=function(f){return g(f)||function(N){return N!==null&&typeof N=="object"}(f)},D=function(f){return f instanceof Error},A=function(f){return Object.prototype.toString.call(f).match(/^\[object (.*)\]$/)[1].toLowerCase()};let L=0;Date.now||(Date.now=function(){return new Date().getTime()});const x={now:function(){L===0&&(L=Date.now()-1);const f=Date.now()-L;return f>4294967295?(L+=4294967295,Date.now()-L):f},utc:function(){return Math.round(Date.now()/1e3)}},S=function(f){return JSON.stringify(f,["message","code"])}},function(C,b,E){E.r(b);var I=E(3),m=E(0);let _=0;const a=new Map;function o(){const u=new Date;return"TSignaling "+u.toLocaleTimeString("en-US",{hour12:!1})+"."+function(g){let l;switch(g.toString().length){case 1:l="00"+g;break;case 2:l="0"+g;break;default:l=g}return l}(u.getMilliseconds())+":"}const s={_data:[],_length:0,_visible:!1,arguments2String(u){let g;if(u.length===1)g=o()+u[0];else{g=o();for(let l=0,D=u.length;l0&&n[n.length-1])||p[0]!==6&&p[0]!==2)){r=0;continue}if(p[0]===3&&(!n||p[1]>n[0]&&p[1]D.weight>A.weight),this}_getCallbacks(s){return _(this)._callbacks[s]}_getCallbackIndex(s,u){return this._has(s)?this._getCallbacks(s).findIndex(g=>g.callback===u):null}_achieveMaxListener(s){return _(this)._maxListeners!==null&&_(this)._maxListeners<=this.listenersNumber(s)}_callbackIsExists(s,u,g){const l=this._getCallbackIndex(s,u),D=l!==-1?this._getCallbacks(s)[l]:void 0;return l!==-1&&D&&D.context===g}_has(s){return _(this)._events.has(s)}on(s,u,g=null,l=1){const D=_(this);if(typeof u!="function")throw new TypeError(u+" is not a function");return this._has(s)?(this._achieveMaxListener(s)&&D._console.warn(`Max listeners (${D._maxListeners}) for event "${s}" is reached!`),this._callbackIsExists(...arguments)&&D._console.warn(`Event "${s}" already has the callback ${u}.`)):(D._events.add(s),D._callbacks[s]=[]),this._addCallback(...arguments),this}once(s,u,g=null,l=1){const D=(...A)=>(this.off(s,D),I.call(u,g,A));return this.on(s,D,g,l)}off(s,u=null){const g=_(this);let l;return this._has(s)&&(u===null?(g._events.delete(s),g._callbacks[s]=null):(l=this._getCallbackIndex(s,u),l!==-1&&(g._callbacks[s].splice(l,1),this.off(...arguments)))),this}emit(s,...u){return this._has(s)&&this._getCallbacks(s).forEach(g=>I.call(g.callback,g.context,u)),this}clear(){const s=_(this);return s._events.clear(),s._callbacks={},this}listenersNumber(s){return this._has(s)?this._getCallbacks(s).length:null}}},function(C,b){var E;E=function(){return this}();try{E=E||new Function("return this")()}catch{typeof window=="object"&&(E=window)}C.exports=E},function(C,b,E){E.r(b);var I=E(0);const m=Object.prototype.hasOwnProperty;b.default=function(_){if(_==null)return!0;if(typeof _=="boolean")return!1;if(typeof _=="number")return _===0;if(typeof _=="string"||typeof _=="function"||Array.isArray(_))return _.length===0;if(_ instanceof Error)return _.message==="";if(Object(I.f)(_)){for(const a in _)if(m.call(_,a))return!1;return!0}return!!(Object(I.e)(_)||Object(I.g)(_)||Object(I.c)(_))&&_.size===0}},function(C,b,E){E.r(b);class I extends Error{constructor(_){super(),this.code=_.code,this.message=_.message,this.data=_.data||{}}}b.default=I},function(C,b,E){E.r(b);var I=E(1),m=E(4),_=E.n(m);b.default=class{constructor(){this._funcMap=new Map}defense(a,o,s){if(typeof a!="string"||a.length===0||typeof o!="function")return null;if(this._funcMap.has(a)&&this._funcMap.get(a).has(o))return this._funcMap.get(a).get(o);this._funcMap.has(a)||this._funcMap.set(a,new Map);let u=null;return this._funcMap.get(a).has(o)?u=this._funcMap.get(a).get(o):(u=this._pack(a,o,s),this._funcMap.get(a).set(o,u)),u}defenseOnce(a,o,s){return typeof o!="function"?null:this._pack(a,o,s)}find(a,o){return typeof a!="string"||a.length===0||typeof o!="function"?null:this._funcMap.has(a)?this._funcMap.get(a).has(o)?this._funcMap.get(a).get(o):(I.default.log(`SafetyCallback.find: 找不到 func —— ${a}/${o.name!==""?o.name:"[anonymous]"}`),null):(I.default.log(`SafetyCallback.find: 找不到 eventName-${a} 对应的 func`),null)}delete(a,o){return typeof o=="function"&&!!this._funcMap.has(a)&&!!this._funcMap.get(a).has(o)&&(this._funcMap.get(a).delete(o),this._funcMap.get(a).size===0&&this._funcMap.delete(a),!0)}_pack(a,o,s){return function(){try{o.apply(s,Array.from(arguments))}catch(u){const g=Object.values(_.a).indexOf(a),l=Object.keys(_.a)[g];I.default.error(`接入侧事件 EVENT.${l} 对应的回调函数逻辑存在问题,请检查!`,u)}}}}},function(C,b,E){/** * UUID.js - RFC-compliant UUID Generator for JavaScript * * @file * @author LiosK * @version v4.2.12 * @license Apache License 2.0: Copyright (c) 2010-2022 LiosK */var I;I=function(m){function _(){var o=a._getRandomInt;this.timestamp=0,this.tick=0,this.sequence=o(14),this.node=1099511627776*(1|o(8))+o(40)}function a(){}return a.generate=function(){var o=a._getRandomInt,s=a._hexAligner;return s(o(32),8)+"-"+s(o(16),4)+"-"+s(16384|o(12),4)+"-"+s(32768|o(14),4)+"-"+s(o(48),12)},a._getRandomInt=function(o){if(o<0||o>53)return NaN;var s=0|1073741824*Math.random();return o>30?s+1073741824*(0|Math.random()*(1<>>30-o},a._hexAligner=function(o,s){for(var u=o.toString(16),g=s-u.length,l="0";g>0;g>>>=1,l+=l)1&g&&(u=l+u);return u},a.overwrittenUUID=m,function(){var o=a._getRandomInt;a.useMathRandom=function(){a._getRandomInt=o};var s=null,u=o;typeof window<"u"&&(s=window.crypto||window.msCrypto)?s.getRandomValues&&typeof Uint32Array<"u"&&(u=function(g){if(g<0||g>53)return NaN;var l=new Uint32Array(g>32?2:1);return l=s.getRandomValues(l)||l,g>32?l[0]+4294967296*(l[1]>>>64-g):l[0]>>>32-g}):(s=E(14))&&s.randomBytes&&(u=function(g){if(g<0||g>53)return NaN;var l=s.randomBytes(g>32?8:4),D=l.readUInt32BE(0);return g>32?D+4294967296*(l.readUInt32BE(4)>>>64-g):D>>>32-g}),a._getRandomInt=u}(),a.FIELD_NAMES=["timeLow","timeMid","timeHiAndVersion","clockSeqHiAndReserved","clockSeqLow","node"],a.FIELD_SIZES=[32,16,16,8,8,48],a.genV4=function(){var o=a._getRandomInt;return new a()._init(o(32),o(16),16384|o(12),128|o(6),o(8),o(48))},a.parse=function(o){var s;if(s=/^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(o)){var u=s[1]||"",g=s[8]||"";if(u+g===""||u==="{"&&g==="}"||u.toLowerCase()==="urn:uuid:"&&g==="")return new a()._init(parseInt(s[2],16),parseInt(s[3],16),parseInt(s[4],16),parseInt(s[5],16),parseInt(s[6],16),parseInt(s[7],16))}return null},a.prototype._init=function(){var o=a.FIELD_NAMES,s=a.FIELD_SIZES,u=a._binAligner,g=a._hexAligner;this.intFields=new Array(6),this.bitFields=new Array(6),this.hexFields=new Array(6);for(var l=0;l<6;l++){var D=parseInt(arguments[l]||0);this.intFields[l]=this.intFields[o[l]]=D,this.bitFields[l]=this.bitFields[o[l]]=u(D,s[l]),this.hexFields[l]=this.hexFields[o[l]]=g(D,s[l]>>>2)}return this.version=this.intFields.timeHiAndVersion>>>12&15,this.bitString=this.bitFields.join(""),this.hexNoDelim=this.hexFields.join(""),this.hexString=this.hexFields[0]+"-"+this.hexFields[1]+"-"+this.hexFields[2]+"-"+this.hexFields[3]+this.hexFields[4]+"-"+this.hexFields[5],this.urn="urn:uuid:"+this.hexString,this},a._binAligner=function(o,s){for(var u=o.toString(2),g=s-u.length,l="0";g>0;g>>>=1,l+=l)1&g&&(u=l+u);return u},a.prototype.toString=function(){return this.hexString},a.prototype.equals=function(o){if(!(o instanceof a))return!1;for(var s=0;s<6;s++)if(this.intFields[s]!==o.intFields[s])return!1;return!0},a.NIL=new a()._init(0,0,0,0,0,0),a.genV1=function(){a._state==null&&a.resetState();var o=new Date().getTime(),s=a._state;o!=s.timestamp?(o>>8|128,A=255&s.sequence;return new a()._init(g,u.mid,l,D,A,s.node)},a.resetState=function(){a._state=new _},a._tsRatio=1/4,a._state=null,a._getTimeFieldValues=function(o){var s=o-Date.UTC(1582,9,15),u=s/4294967296*1e4&268435455;return{low:1e4*(268435455&s)%4294967296,mid:65535&u,hi:u>>>16,timestamp:s}},typeof C.exports=="object"&&(C.exports=a),a}(I)},function(C,b){},function(C){C.exports=JSON.parse('{"name":"tsignaling","version":"1.0.8","description":"腾讯云 Web 信令 SDK","main":"./src/index.ts","scripts":{"lint":"./node_modules/.bin/eslint ./src","fix":"./node_modules/.bin/eslint --fix ./src","ts2js":"tsc src/index.ts --outDir build/ts2js","doc":"npm run ts2js && npm run doc:clean && npm run doc:build","doc:build":"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js","build:wx":"cross-env NODE_ENV=wx webpack --config webpack.prod.config.js","build:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack/bin/webpack.js --config webpack.prod.config.js","build:package":"node build/package-bundle.js","prerelease":"npm run changelog && npm run build:web && npm run build:wx && npm run build:package && node ./build/copy.js","start:wx":"cross-env NODE_ENV=wx webpack-dev-server --config webpack.config.js","start:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js","build_withcopy":"npm run build:web && cp dist/npm/tsignaling-js.js ../TIM-demo-web/node_modules/tsignaling/tsignaling-js.js","build_withcopy:mp":"npm run build:wx && cp dist/npm/tsignaling-wx.js ../TIM-demo-mini/static/component/TRTCCalling/utils/tsignaling-wx.js","changelog":"cp CHANGELOG.md build/jsdoc/tutorials/CHANGELOG.md"},"husky":{"hooks":{"pre-commit":"npm run lint"}},"lint-staged":{"*.{.ts,.tsx}":["eslint","git add"]},"keywords":["腾讯云","即时通信","信令"],"author":"","license":"ISC","devDependencies":{"conventional-changelog-cli":"^2.1.1","cross-env":"^7.0.2","fs-extra":"^9.0.1","html-webpack-plugin":"^4.3.0","ts-loader":"^7.0.5","typescript":"^3.9.9","webpack":"^4.43.0","@types/node":"18.11.9","webpack-cli":"^3.3.11","webpack-dev-server":"^3.11.0"},"dependencies":{"@typescript-eslint/eslint-plugin":"^4.22.1","@typescript-eslint/parser":"^4.22.1","EventEmitter":"^1.0.0","docdash-blue":"1.1.9","eslint":"^5.16.0","eslint-config-google":"^0.13.0","eslint-plugin-classes":"^0.1.1","jsdoc":"^3.6.4","jsdoc-plugin-typescript":"^2.0.5","pretty":"^2.0.0","replace":"^1.2.0","uuidjs":"^4.2.5"}}')},function(C,b,E){var I,m=this&&this.__extends||(I=function(S,f){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(N,T){N.__proto__=T}||function(N,T){for(var c in T)T.hasOwnProperty(c)&&(N[c]=T[c])})(S,f)},function(S,f){function N(){this.constructor=S}I(S,f),S.prototype=f===null?Object.create(f):(N.prototype=f.prototype,new N)}),_=this&&this.__awaiter||function(S,f,N,T){return new(N||(N=Promise))(function(c,e){function t(d){try{n(T.next(d))}catch(r){e(r)}}function i(d){try{n(T.throw(d))}catch(r){e(r)}}function n(d){var r;d.done?c(d.value):(r=d.value,r instanceof N?r:new N(function(h){h(r)})).then(t,i)}n((T=T.apply(S,f||[])).next())})},a=this&&this.__generator||function(S,f){var N,T,c,e,t={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return e={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function i(n){return function(d){return function(r){if(N)throw new TypeError("Generator is already executing.");for(;t;)try{if(N=1,T&&(c=2&r[0]?T.return:r[0]?T.throw||((c=T.return)&&c.call(T),0):T.next)&&!(c=c.call(T,r[1])).done)return c;switch(T=0,c&&(r=[2&r[0],c.value]),r[0]){case 0:case 1:c=r;break;case 4:return t.label++,{value:r[1],done:!1};case 5:t.label++,T=r[1],r=[0];continue;case 7:r=t.ops.pop(),t.trys.pop();continue;default:if(c=t.trys,!((c=c.length>0&&c[c.length-1])||r[0]!==6&&r[0]!==2)){t=0;continue}if(r[0]===3&&(!c||r[1]>c[0]&&r[1]0&&r.lastMessage.lastTime&&1e3*r.lastMessage.lastTime>this.currentTime-this.expiredTime&&T.push(r);return[2,T]}})})},f}(u),D=function(S){function f(N){var T=S.call(this)||this;return T.tim=null,T.expiredTime=3e4,T.tim=N.tim,T}return m(f,S),f.prototype.doFilter=function(N){return _(this,void 0,void 0,function(){var T,c,e,t,i,n,d,r,h=this;return a(this,function(y){switch(y.label){case 0:T=[],c=0,y.label=1;case 1:return ch.currentTime-h.expiredTime})),y.label=3;case 3:return c++,[3,1];case 4:return[2,T.flat().sort(function(v,p){return v.time-p.time})]}})})},f}(u),A=function(S){function f(){return S.call(this)||this}return m(f,S),f.prototype.doFilter=function(N){return _(this,void 0,void 0,function(){return a(this,function(T){return[2,N.filter(function(c){var e=!1;try{e=JSON.parse(c.payload.data).businessID===o.BusinessID.SIGNAL}catch{}return e})]})})},f}(u),L=function(S){function f(){return S.call(this)||this}return m(f,S),f.prototype.doFilter=function(N){return _(this,void 0,void 0,function(){var T,c,e;return a(this,function(t){return Array.isArray(N)?N.length===0?[2,[]]:(T=new Map,N.forEach(function(i,n){var d=JSON.parse(i.payload.data),r=d.inviteID,h=d.actionType;!T.has(r)||T.get(r).actionType!==o.ActionType.INVITE||h!==o.ActionType.CANCEL_INVITE&&h!==o.ActionType.ACCEPT_INVITE&&h!==o.ActionType.REJECT_INVITE&&h!==o.ActionType.INVITE_TIMEOUT?T.set(r,{index:n,actionType:h}):T.delete(r)}),c=[],T.forEach(function(i){i.actionType===o.ActionType.INVITE&&c.push(i.index)}),c.length===0?[2,[]]:(e=[],c.sort(function(i,n){return i-n}).forEach(function(i){e.push(N[i])}),[2,e])):[2,[]]})})},f}(u),x=function(){function S(f){this.tim=null;var N=f.tim;this.tim=N}return S.prototype.getHistoricalSignaling=function(){return _(this,void 0,void 0,function(){var f;return a(this,function(N){return(f=new g).register(new l({tim:this.tim})),f.register(new D({tim:this.tim})),f.register(new A),f.register(new L),[2,f.run()]})})},S}();b.default=x}]).default})}(V)),V.exports}export{H as r};