@easemob-community/callkit-vue3 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/dist/callkit-vue3.css +1 -0
  4. package/dist/components/EasemobChatCallKitProvider.vue.d.ts +18 -0
  5. package/dist/components/EasemobChatMiniWindow.vue.d.ts +11 -0
  6. package/dist/components/InvitationNotification.vue.d.ts +2 -0
  7. package/dist/components/multiCall/EasemobChatGroupMemberList.vue.d.ts +19 -0
  8. package/dist/components/multiCall/EasemobChatMultiCall.vue.d.ts +69 -0
  9. package/dist/components/singleCall/CallControls.vue.d.ts +18 -0
  10. package/dist/components/singleCall/CallInfoBar.vue.d.ts +5 -0
  11. package/dist/components/singleCall/EasemobChatCallStream.vue.d.ts +12 -0
  12. package/dist/components/singleCall/EasemobChatCallWaiting.vue.d.ts +10 -0
  13. package/dist/components/singleCall/EasemobChatSingleCall.vue.d.ts +28 -0
  14. package/dist/composables/useAnswerCall.d.ts +10 -0
  15. package/dist/composables/useCallKit.d.ts +2 -0
  16. package/dist/composables/useCallKitCore.d.ts +998 -0
  17. package/dist/composables/useCallKitEvents.d.ts +42 -0
  18. package/dist/composables/useDraggable.d.ts +90 -0
  19. package/dist/composables/useEndCall.d.ts +15 -0
  20. package/dist/composables/useParticipants.d.ts +15 -0
  21. package/dist/composables/useRtcService.d.ts +80 -0
  22. package/dist/config/assets.d.ts +43 -0
  23. package/dist/core/events/CallKitEventBus.d.ts +40 -0
  24. package/dist/core/events/helpers.d.ts +59 -0
  25. package/dist/core/events/types.d.ts +264 -0
  26. package/dist/core/sdk/imSDK/index.d.ts +4 -0
  27. package/dist/index.d.ts +33 -0
  28. package/dist/index.js +7806 -0
  29. package/dist/index.umd.js +72 -0
  30. package/dist/modules/groupCall/components/CallKitIcon.vue.d.ts +12 -0
  31. package/dist/modules/groupCall/components/GroupCallShell.vue.d.ts +34 -0
  32. package/dist/modules/groupCall/components/MainVideoLayout.vue.d.ts +32 -0
  33. package/dist/modules/groupCall/components/ParticipantTile.vue.d.ts +12 -0
  34. package/dist/modules/groupCall/components/VideoGrid.vue.d.ts +29 -0
  35. package/dist/modules/groupCall/components/iconRegistry.d.ts +2 -0
  36. package/dist/modules/groupCall/index.d.ts +7 -0
  37. package/dist/modules/groupCall/media/RtcMediaBridge.d.ts +26 -0
  38. package/dist/modules/groupCall/signaling/GroupCallSignalingAdapter.d.ts +29 -0
  39. package/dist/modules/groupCall/types.d.ts +37 -0
  40. package/dist/modules/groupCall/viewModel/GroupCallStore.d.ts +345 -0
  41. package/dist/modules/groupCall/viewModel/useGroupCallViewModel.d.ts +35 -0
  42. package/dist/services/CallService.d.ts +15 -0
  43. package/dist/services/RtcAdapter.d.ts +11 -0
  44. package/dist/services/RtcService.d.ts +187 -0
  45. package/dist/services/UserProfileService.d.ts +38 -0
  46. package/dist/store/callTimer.d.ts +33 -0
  47. package/dist/store/chatClient.d.ts +5335 -0
  48. package/dist/store/globalCall.d.ts +34 -0
  49. package/dist/store/index.d.ts +1 -0
  50. package/dist/store/rtcChannel.d.ts +42 -0
  51. package/dist/store/types.d.ts +50 -0
  52. package/dist/types/callstate.types.d.ts +61 -0
  53. package/dist/types/signal.types.d.ts +187 -0
  54. package/dist/types.d.ts +103 -0
  55. package/dist/utils/callUtils.d.ts +15 -0
  56. package/dist/utils/imSdkAdapter.d.ts +29 -0
  57. package/dist/utils/index.d.ts +2 -0
  58. package/dist/utils/logger.d.ts +122 -0
  59. package/dist/utils/loggerDb.d.ts +41 -0
  60. package/dist/utils/ringtone.d.ts +20 -0
  61. package/dist/vite-env.d.ts +12 -0
  62. package/package.json +60 -0
@@ -0,0 +1,72 @@
1
+ (function(be,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("pinia"),require("@easemob-community/callkit-core"),require("easemob-websdk"),require("agora-rtc-sdk-ng")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@easemob-community/callkit-core","easemob-websdk","agora-rtc-sdk-ng"],i):(be=typeof globalThis<"u"?globalThis:be||self,i(be.EasemobCallKitVue3={},be.Vue,be.Pinia,be.EasemobCallKitCore,be.WebSDK,be.AgoraRTC))})(this,(function(be,i,Rt,je,Oi,sn){"use strict";const Pi=Oi;var Di=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ki(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var ln={exports:{}},$i=ln.exports,Or;function ji(){return Or||(Or=1,(function(h,a){((s,c)=>{h.exports=c()})($i,function(){var s=function(e,t){return(s=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(n,r){n.__proto__=r}:function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}))(e,t)},c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function p(e,t,n){for(var r,o=0,l=t.length;o<l;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var m=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Di,R=Object.keys,T=Array.isArray;function V(e,t){return typeof t=="object"&&R(t).forEach(function(n){e[n]=t[n]}),e}typeof Promise>"u"||m.Promise||(m.Promise=Promise);var B=Object.getPrototypeOf,F={}.hasOwnProperty;function U(e,t){return F.call(e,t)}function H(e,t){typeof t=="function"&&(t=t(B(e))),(typeof Reflect>"u"?R:Reflect.ownKeys)(t).forEach(function(n){N(e,n,t[n])})}var K=Object.defineProperty;function N(e,t,n,r){K(e,t,V(n&&U(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function G(e){return{from:function(t){return e.prototype=Object.create(t.prototype),N(e.prototype,"constructor",e),{extend:H.bind(null,e.prototype)}}}}var Z=Object.getOwnPropertyDescriptor,A=[].slice;function re(e,t,n){return A.call(e,t,n)}function ce(e,t){return t(e)}function ve(e){if(!e)throw new Error("Assertion Failed")}function de(e){m.setImmediate?setImmediate(e):setTimeout(e,0)}function oe(e,t){if(typeof t=="string"&&U(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,o=t.length;r<o;++r){var l=oe(e,t[r]);n.push(l)}return n}var u,f=t.indexOf(".");return f===-1||(u=e[t.substr(0,f)])==null?void 0:oe(u,t.substr(f+1))}function M(e,t,n){if(e&&t!==void 0&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){ve(typeof n!="string"&&"length"in n);for(var r=0,o=t.length;r<o;++r)M(e,t[r],n[r])}else{var l=t.indexOf(".");if(l!==-1){var u=t.substr(0,l),l=t.substr(l+1);if(l==="")n===void 0?T(e)&&!isNaN(parseInt(u))?e.splice(u,1):delete e[u]:e[u]=n;else{var f=e[u];if(!f||!U(e,u)){if(n===void 0)return;f=e[u]={}}M(f,l,n)}}else n===void 0?T(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function $(e){var t,n={};for(t in e)U(e,t)&&(n[t]=e[t]);return n}var x=[].concat;function ae(e){return x.apply([],e)}var rt="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(ae([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return m[e]}),J=new Set(rt.map(function(e){return m[e]})),W=null;function ee(e){return W=new WeakMap,e=(function t(n){if(!n||typeof n!="object")return n;var r=W.get(n);if(r)return r;if(T(n)){r=[],W.set(n,r);for(var o=0,l=n.length;o<l;++o)r.push(t(n[o]))}else if(J.has(n.constructor))r=n;else{var u,f=B(n);for(u in r=f===Object.prototype?{}:Object.create(f),W.set(n,r),n)U(n,u)&&(r[u]=t(n[u]))}return r})(e),W=null,e}var ye={}.toString;function ue(e){return ye.call(e).slice(8,-1)}var Q=typeof Symbol<"u"?Symbol.iterator:"@@iterator",fe=typeof Q=="symbol"?function(e){var t;return e!=null&&(t=e[Q])&&t.apply(e)}:function(){return null};function ke(e,t){t=e.indexOf(t),0<=t&&e.splice(t,1)}var st={};function nt(e){var t,n,r,o;if(arguments.length===1){if(T(e))return e.slice();if(this===st&&typeof e=="string")return[e];if(o=fe(e))for(n=[];!(r=o.next()).done;)n.push(r.value);else{if(e==null)return[e];if(typeof(t=e.length)!="number")return[e];for(n=new Array(t);t--;)n[t]=e[t]}}else for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var pn=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},rt=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Ze=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(rt),Y={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function ze(e,t){this.name=e,this.message=t}function ei(e,t){return e+". Errors: "+Object.keys(t).map(function(n){return t[n].toString()}).filter(function(n,r,o){return o.indexOf(n)===r}).join(`
2
+ `)}function mn(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=ei(e,t)}function Nt(e,t){this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=ei(e,this.failures)}G(ze).from(Error).extend({toString:function(){return this.name+": "+this.message}}),G(mn).from(ze),G(Nt).from(ze);var tr=Ze.reduce(function(e,t){return e[t]=t+"Error",e},{}),Ks=ze,se=Ze.reduce(function(e,t){var n=t+"Error";function r(o,l){this.name=n,o?typeof o=="string"?(this.message="".concat(o).concat(l?`
3
+ `+l:""),this.inner=l||null):typeof o=="object"&&(this.message="".concat(o.name," ").concat(o.message),this.inner=o):(this.message=Y[t]||n,this.inner=null)}return G(r).from(Ks),e[t]=r,e},{}),ti=(se.Syntax=SyntaxError,se.Type=TypeError,se.Range=RangeError,rt.reduce(function(e,t){return e[t+"Error"]=se[t],e},{}));rt=Ze.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=se[t]),e},{});function Te(){}function Ht(e){return e}function $s(e,t){return e==null||e===Ht?t:function(n){return t(e(n))}}function bt(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function js(e,t){return e===Te?t:function(){var n=e.apply(this,arguments),r=(n!==void 0&&(arguments[0]=n),this.onsuccess),o=this.onerror,l=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return r&&(this.onsuccess=this.onsuccess?bt(r,this.onsuccess):r),o&&(this.onerror=this.onerror?bt(o,this.onerror):o),l!==void 0?l:n}}function Fs(e,t){return e===Te?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?bt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?bt(r,this.onerror):r)}}function Gs(e,t){return e===Te?t:function(o){var r=e.apply(this,arguments),o=(V(o,r),this.onsuccess),l=this.onerror,u=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return o&&(this.onsuccess=this.onsuccess?bt(o,this.onsuccess):o),l&&(this.onerror=this.onerror?bt(l,this.onerror):l),r===void 0?u===void 0?void 0:u:V(r,u)}}function qs(e,t){return e===Te?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function nr(e,t){return e===Te?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,o=arguments.length,l=new Array(o);o--;)l[o]=arguments[o];return n.then(function(){return t.apply(r,l)})}return t.apply(this,arguments)}}rt.ModifyError=mn,rt.DexieError=ze,rt.BulkError=Nt;var it=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function ni(e){it=e}var zt={},ri=100,Zt=typeof Promise>"u"?[]:(Ze=Promise.resolve(),typeof crypto<"u"&&crypto.subtle?[Zt=crypto.subtle.digest("SHA-512",new Uint8Array([0])),B(Zt),Ze]:[Ze,B(Ze),Ze]),Ze=Zt[0],Ft=Zt[1],Ft=Ft&&Ft.then,wt=Ze&&Ze.constructor,rr=!!Zt[2],Wt=function(e,t){Yt.push([e,t]),gn&&(queueMicrotask(zs),gn=!1)},ir=!0,gn=!0,kt=[],Cn=[],ar=Ht,lt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Te,pgp:!1,env:{},finalize:Te},ie=lt,Yt=[],St=0,vn=[];function X(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ie;if(typeof e!="function"){if(e!==zt)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&sr(this,this._value)}else this._state=null,this._value=null,++t.ref,(function n(r,o){try{o(function(l){if(r._state===null){if(l===r)throw new TypeError("A promise cannot be resolved with itself.");var u=r._lib&&Ot();l&&typeof l.then=="function"?n(r,function(f,C){l instanceof X?l._then(f,C):l.then(f,C)}):(r._state=!0,r._value=l,ai(r)),u&&Pt()}},sr.bind(null,r))}catch(l){sr(r,l)}})(this,e)}var or={get:function(){var e=ie,t=kn;function n(r,o){var l=this,u=!e.global&&(e!==ie||t!==kn),f=u&&!ht(),C=new X(function(E,y){lr(l,new ii(si(r,e,u,f),si(o,e,u,f),E,y,e))});return this._consoleTask&&(C._consoleTask=this._consoleTask),C}return n.prototype=zt,n},set:function(e){N(this,"then",e&&e.prototype===zt?or:{get:function(){return e},set:or.set})}};function ii(e,t,n,r,o){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=o}function sr(e,t){var n,r;Cn.push(t),e._state===null&&(n=e._lib&&Ot(),t=ar(t),e._state=!1,e._value=t,r=e,kt.some(function(o){return o._value===r._value})||kt.push(r),ai(e),n)&&Pt()}function ai(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)lr(e,t[n]);var o=e._PSD;--o.ref||o.finalize(),St===0&&(++St,Wt(function(){--St==0&&cr()},[]))}function lr(e,t){if(e._state===null)e._listeners.push(t);else{var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++St,Wt(Hs,[n,e,t])}}function Hs(e,t,n){try{var r,o=t._value;!t._state&&Cn.length&&(Cn=[]),r=it&&t._consoleTask?t._consoleTask.run(function(){return e(o)}):e(o),t._state||Cn.indexOf(o)!==-1||(l=>{for(var u=kt.length;u;)if(kt[--u]._value===l._value)return kt.splice(u,1)})(t),n.resolve(r)}catch(l){n.reject(l)}finally{--St==0&&cr(),--n.psd.ref||n.psd.finalize()}}function zs(){Et(lt,function(){Ot()&&Pt()})}function Ot(){var e=ir;return gn=ir=!1,e}function Pt(){var e,t,n;do for(;0<Yt.length;)for(e=Yt,Yt=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(0<Yt.length);gn=ir=!0}function cr(){for(var e=kt,t=(kt=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)}),vn.slice(0)),n=t.length;n;)t[--n]()}function yn(e){return new X(zt,!1,e)}function Re(e,t){var n=ie;return function(){var r=Ot(),o=ie;try{return pt(n,!0),e.apply(this,arguments)}catch(l){t&&t(l)}finally{pt(o,!1),r&&Pt()}}}H(X.prototype,{then:or,_then:function(e,t){lr(this,new ii(null,null,e,t,ie))},catch:function(e){var t,n;return arguments.length===1?this.then(null,e):(t=e,n=arguments[1],typeof t=="function"?this.then(null,function(r){return(r instanceof t?n:yn)(r)}):this.then(null,function(r){return(r&&r.name===t?n:yn)(r)}))},finally:function(e){return this.then(function(t){return X.resolve(e()).then(function(){return t})},function(t){return X.resolve(e()).then(function(){return yn(t)})})},timeout:function(e,t){var n=this;return e<1/0?new X(function(r,o){var l=setTimeout(function(){return o(new se.Timeout(t))},e);n.then(r,o).finally(clearTimeout.bind(null,l))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&N(X.prototype,Symbol.toStringTag,"Dexie.Promise"),lt.env=oi(),H(X,{all:function(){var e=nt.apply(null,arguments).map(Sn);return new X(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(o,l){return X.resolve(o).then(function(u){e[l]=u,--r||t(e)},n)})})},resolve:function(e){return e instanceof X?e:e&&typeof e.then=="function"?new X(function(t,n){e.then(t,n)}):new X(zt,!0,e)},reject:yn,race:function(){var e=nt.apply(null,arguments).map(Sn);return new X(function(t,n){e.map(function(r){return X.resolve(r).then(t,n)})})},PSD:{get:function(){return ie},set:function(e){return ie=e}},totalEchoes:{get:function(){return kn}},newPSD:ft,usePSD:Et,scheduler:{get:function(){return Wt},set:function(e){Wt=e}},rejectionMapper:{get:function(){return ar},set:function(e){ar=e}},follow:function(e,t){return new X(function(n,r){return ft(function(o,l){var u=ie;u.unhandleds=[],u.onunhandled=l,u.finalize=bt(function(){var f,C=this;f=function(){C.unhandleds.length===0?o():l(C.unhandleds[0])},vn.push(function E(){f(),vn.splice(vn.indexOf(E),1)}),++St,Wt(function(){--St==0&&cr()},[])},u.finalize),e()},t,n,r)})}}),wt&&(wt.allSettled&&N(X,"allSettled",function(){var e=nt.apply(null,arguments).map(Sn);return new X(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(o,l){return X.resolve(o).then(function(u){return r[l]={status:"fulfilled",value:u}},function(u){return r[l]={status:"rejected",reason:u}}).then(function(){return--n||t(r)})})})}),wt.any&&typeof AggregateError<"u"&&N(X,"any",function(){var e=nt.apply(null,arguments).map(Sn);return new X(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,o=new Array(r);e.forEach(function(l,u){return X.resolve(l).then(function(f){return t(f)},function(f){o[u]=f,--r||n(new AggregateError(o))})})})}),wt.withResolvers)&&(X.withResolvers=wt.withResolvers);var Oe={awaits:0,echoes:0,id:0},Zs=0,bn=[],wn=0,kn=0,Ws=0;function ft(e,u,n,r){var o=ie,l=Object.create(o),u=(l.parent=o,l.ref=0,l.global=!1,l.id=++Ws,lt.env,l.env=rr?{Promise:X,PromiseProp:{value:X,configurable:!0,writable:!0},all:X.all,race:X.race,allSettled:X.allSettled,any:X.any,resolve:X.resolve,reject:X.reject}:{},u&&V(l,u),++o.ref,l.finalize=function(){--this.parent.ref||this.parent.finalize()},Et(l,e,n,r));return l.ref===0&&l.finalize(),u}function Dt(){return Oe.id||(Oe.id=++Zs),++Oe.awaits,Oe.echoes+=ri,Oe.id}function ht(){return!!Oe.awaits&&(--Oe.awaits==0&&(Oe.id=0),Oe.echoes=Oe.awaits*ri,!0)}function Sn(e){return Oe.echoes&&e&&e.constructor===wt?(Dt(),e.then(function(t){return ht(),t},function(t){return ht(),Ue(t)})):e}function Ys(){var e=bn[bn.length-1];bn.pop(),pt(e,!1)}function pt(e,t){var n,r,o=ie;(t?!Oe.echoes||wn++&&e===ie:!wn||--wn&&e===ie)||queueMicrotask(t?(function(l){++kn,Oe.echoes&&--Oe.echoes!=0||(Oe.echoes=Oe.awaits=Oe.id=0),bn.push(ie),pt(l,!0)}).bind(null,e):Ys),e!==ie&&(ie=e,o===lt&&(lt.env=oi()),rr)&&(n=lt.env.Promise,r=e.env,o.global||e.global)&&(Object.defineProperty(m,"Promise",r.PromiseProp),n.all=r.all,n.race=r.race,n.resolve=r.resolve,n.reject=r.reject,r.allSettled&&(n.allSettled=r.allSettled),r.any)&&(n.any=r.any)}function oi(){var e=m.Promise;return rr?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(m,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Et(e,t,n,r,o){var l=ie;try{return pt(e,!0),t(n,r,o)}finally{pt(l,!1)}}function si(e,t,n,r){return typeof e!="function"?e:function(){var o=ie;n&&Dt(),pt(t,!0);try{return e.apply(this,arguments)}finally{pt(o,!1),r&&queueMicrotask(ht)}}}function ur(e){Promise===wt&&Oe.echoes===0?wn===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}(""+Ft).indexOf("[native code]")===-1&&(Dt=ht=Te);var Ue=X.reject,It="￿",ct="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",li="String expected.",En="__dbnames",dr="readonly",fr="readwrite";function _t(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var ci={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function In(e){return typeof e!="string"||/\./.test(e)?function(t){return t}:function(t){return t[e]===void 0&&e in t&&delete(t=ee(t))[e],t}}function ui(){throw se.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function Se(e,t){try{var n=di(e),r=di(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":for(var o=fi(e),l=fi(t),u=o.length,f=l.length,C=u<f?u:f,E=0;E<C;++E)if(o[E]!==l[E])return o[E]<l[E]?-1:1;return u===f?0:u<f?-1:1;case"Array":for(var y=e,g=t,v=y.length,S=g.length,w=v<S?v:S,b=0;b<w;++b){var k=Se(y[b],g[b]);if(k!==0)return k}return v===S?0:v<S?-1:1}}catch{}return NaN}function di(e){var t=typeof e;return t=="object"&&(ArrayBuffer.isView(e)||(t=ue(e))==="ArrayBuffer")?"binary":t}function fi(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function _n(e,t,n){var r=e.schema.yProps;return r?(t&&0<n.numFailures&&(t=t.filter(function(o,l){return!n.failures[l]})),Promise.all(r.map(function(o){return o=o.updatesTable,t?e.db.table(o).where("k").anyOf(t).delete():e.db.table(o).clear()})).then(function(){return n})):n}hi.prototype.execute=function(e){var t=this["@@propmod"];if(t.add!==void 0){var n=t.add;if(T(n))return p(p([],T(e)?e:[],!0),n).sort();if(typeof n=="number")return(Number(e)||0)+n;if(typeof n=="bigint")try{return BigInt(e)+n}catch{return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(t.remove!==void 0){var r=t.remove;if(T(r))return T(e)?e.filter(function(o){return!r.includes(o)}).sort():[];if(typeof r=="number")return Number(e)-r;if(typeof r=="bigint")try{return BigInt(e)-r}catch{return BigInt(0)-r}throw new TypeError("Invalid subtrahend ".concat(r))}return n=(n=t.replacePrefix)==null?void 0:n[0],n&&typeof e=="string"&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e};var Jt=hi;function hi(e){this["@@propmod"]=e}function pi(e,t){for(var n=R(t),r=n.length,o=!1,l=0;l<r;++l){var u=n[l],f=t[u],C=oe(e,u);f instanceof Jt?(M(e,u,f.execute(C)),o=!0):C!==f&&(M(e,u,f),o=!0)}return o}Ve.prototype._trans=function(e,t,n){var r=this._tx||ie.trans,o=this.name,l=it&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(e==="readonly"?"read":"write"," ").concat(this.name));function u(E,y,g){if(g.schema[o])return t(g.idbtrans,g);throw new se.NotFound("Table "+o+" not part of transaction")}var f=Ot();try{var C=r&&r.db._novip===this.db._novip?r===ie.trans?r._promise(e,u,n):ft(function(){return r._promise(e,u,n)},{trans:r,transless:ie.transless||ie}):(function E(y,g,v,S){if(y.idbdb&&(y._state.openComplete||ie.letThrough||y._vip)){var w=y._createTransaction(g,v,y._dbSchema);try{w.create(),y._state.PR1398_maxLoop=3}catch(b){return b.name===tr.InvalidState&&y.isOpen()&&0<--y._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),y.close({disableAutoOpen:!1}),y.open().then(function(){return E(y,g,v,S)})):Ue(b)}return w._promise(g,function(b,k){return ft(function(){return ie.trans=w,S(b,k,w)})}).then(function(b){if(g==="readwrite")try{w.idbtrans.commit()}catch{}return g==="readonly"?b:w._completion.then(function(){return b})})}if(y._state.openComplete)return Ue(new se.DatabaseClosed(y._state.dbOpenError));if(!y._state.isBeingOpened){if(!y._state.autoOpen)return Ue(new se.DatabaseClosed);y.open().catch(Te)}return y._state.dbReadyPromise.then(function(){return E(y,g,v,S)})})(this.db,e,[this.name],u);return l&&(C._consoleTask=l,C=C.catch(function(E){return console.trace(E),Ue(E)})),C}finally{f&&Pt()}},Ve.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):e==null?Ue(new se.Type("Invalid argument to Table.get()")):this._trans("readonly",function(r){return n.core.get({trans:r,key:e}).then(function(o){return n.hook.reading.fire(o)})}).then(t)},Ve.prototype.where=function(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(T(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=R(e);if(t.length===1)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(f){if(f.compound&&t.every(function(E){return 0<=f.keyPath.indexOf(E)})){for(var C=0;C<t.length;++C)if(t.indexOf(f.keyPath[C])===-1)return!1;return!0}return!1}).sort(function(f,C){return f.keyPath.length-C.keyPath.length})[0];if(n&&this.db._maxKey!==It)return u=n.keyPath.slice(0,t.length),this.where(u).equals(u.map(function(f){return e[f]}));!n&&it&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var r=this.schema.idxByName;function o(f,C){return Se(f,C)===0}var u=t.reduce(function(y,C){var E=y[0],y=y[1],g=r[C],v=e[C];return[E||g,E||!g?_t(y,g&&g.multi?function(S){return S=oe(S,C),T(S)&&S.some(function(w){return o(v,w)})}:function(S){return o(v,oe(S,C))}):y]},[null,null]),l=u[0],u=u[1];return l?this.where(l.name).equals(e[l.keyPath]).filter(u):n?this.filter(u):this.where(t).equals("")},Ve.prototype.filter=function(e){return this.toCollection().and(e)},Ve.prototype.count=function(e){return this.toCollection().count(e)},Ve.prototype.offset=function(e){return this.toCollection().offset(e)},Ve.prototype.limit=function(e){return this.toCollection().limit(e)},Ve.prototype.each=function(e){return this.toCollection().each(e)},Ve.prototype.toArray=function(e){return this.toCollection().toArray(e)},Ve.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Ve.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,T(e)?"[".concat(e.join("+"),"]"):e))},Ve.prototype.reverse=function(){return this.toCollection().reverse()},Ve.prototype.mapToClass=function(e){for(var t=this.db,n=this.name,r=((this.schema.mappedClass=e).prototype instanceof ui&&(e=(u=>{var f=y,C=u;if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");function E(){this.constructor=f}function y(){return u!==null&&u.apply(this,arguments)||this}return s(f,C),f.prototype=C===null?Object.create(C):(E.prototype=C.prototype,new E),Object.defineProperty(y.prototype,"db",{get:function(){return t},enumerable:!1,configurable:!0}),y.prototype.table=function(){return n},y})(e)),new Set),o=e.prototype;o;o=B(o))Object.getOwnPropertyNames(o).forEach(function(u){return r.add(u)});function l(u){if(!u)return u;var f,C=Object.create(e.prototype);for(f in u)if(!r.has(f))try{C[f]=u[f]}catch{}return C}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=l,this.hook("reading",l),e},Ve.prototype.defineClass=function(){return this.mapToClass(function(e){V(this,e)})},Ve.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,l=r.keyPath,u=e;return l&&o&&(u=In(l)(e)),this._trans("readwrite",function(f){return n.core.mutate({trans:f,type:"add",keys:t!=null?[t]:null,values:[u]})}).then(function(f){return f.numFailures?X.reject(f.failures[0]):f.lastResult}).then(function(f){if(l)try{M(e,l,f)}catch{}return f})},Ve.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans("readwrite",function(o){return n.core.get({trans:o,key:e}).then(function(l){var u=l??{};return pi(u,t),r&&M(u,r,e),n.core.mutate({trans:o,type:"put",values:[u],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then(function(f){return f.numFailures?X.reject(f.failures[0]):!!l})})})},Ve.prototype.update=function(e,t){return typeof e!="object"||T(e)?this.where(":id").equals(e).modify(t):(e=oe(e,this.schema.primKey.keyPath))===void 0?Ue(new se.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},Ve.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,l=r.keyPath,u=e;return l&&o&&(u=In(l)(e)),this._trans("readwrite",function(f){return n.core.mutate({trans:f,type:"put",values:[u],keys:t!=null?[t]:null})}).then(function(f){return f.numFailures?X.reject(f.failures[0]):f.lastResult}).then(function(f){if(l)try{M(e,l,f)}catch{}return f})},Ve.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]}).then(function(r){return _n(t,[e],r)}).then(function(r){return r.numFailures?X.reject(r.failures[0]):void 0})})},Ve.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:ci}).then(function(n){return _n(e,null,n)})}).then(function(t){return t.numFailures?X.reject(t.failures[0]):void 0})},Ve.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n}).then(function(r){return r.map(function(o){return t.hook.reading.fire(o)})})})},Ve.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,l=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(u){var f=r.schema.primKey,E=f.auto,f=f.keyPath;if(f&&o)throw new se.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new se.InvalidArgument("Arguments objects and keys must have the same length");var C=e.length,E=f&&E?e.map(In(f)):e;return r.core.mutate({trans:u,type:"add",keys:o,values:E,wantResults:l}).then(function(y){var g=y.numFailures,v=y.failures;if(g===0)return l?y.results:y.lastResult;throw new Nt("".concat(r.name,".bulkAdd(): ").concat(g," of ").concat(C," operations failed"),v)})})},Ve.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,l=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(u){var f=r.schema.primKey,E=f.auto,f=f.keyPath;if(f&&o)throw new se.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new se.InvalidArgument("Arguments objects and keys must have the same length");var C=e.length,E=f&&E?e.map(In(f)):e;return r.core.mutate({trans:u,type:"put",keys:o,values:E,wantResults:l}).then(function(y){var g=y.numFailures,v=y.failures;if(g===0)return l?y.results:y.lastResult;throw new Nt("".concat(r.name,".bulkPut(): ").concat(g," of ").concat(C," operations failed"),v)})})},Ve.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map(function(u){return u.key}),o=e.map(function(u){return u.changes}),l=[];return this._trans("readwrite",function(u){return n.getMany({trans:u,keys:r,cache:"clone"}).then(function(f){var C=[],E=[],y=(e.forEach(function(g,v){var S=g.key,w=g.changes,b=f[v];if(b){for(var k=0,_=Object.keys(w);k<_.length;k++){var I=_[k],L=w[I];if(I===t.schema.primKey.keyPath){if(Se(L,S)!==0)throw new se.Constraint("Cannot update primary key in bulkUpdate()")}else M(b,I,L)}l.push(v),C.push(S),E.push(b)}}),C.length);return n.mutate({trans:u,type:"put",keys:C,values:E,updates:{keys:r,changeSpecs:o}}).then(function(g){var v=g.numFailures,S=g.failures;if(v===0)return y;for(var w=0,b=Object.keys(S);w<b.length;w++){var k,_=b[w],I=l[Number(_)];I!=null&&(k=S[_],delete S[_],S[I]=k)}throw new Nt("".concat(t.name,".bulkUpdate(): ").concat(v," of ").concat(y," operations failed"),S)})})})},Ve.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",function(r){return t.core.mutate({trans:r,type:"delete",keys:e}).then(function(o){return _n(t,e,o)})}).then(function(r){var o=r.numFailures,l=r.failures;if(o===0)return r.lastResult;throw new Nt("".concat(t.name,".bulkDelete(): ").concat(o," of ").concat(n," operations failed"),l)})};var mi=Ve;function Ve(){}function Xt(e){function t(u,f){if(f){for(var C=arguments.length,E=new Array(C-1);--C;)E[C-1]=arguments[C];return n[u].subscribe.apply(null,E),e}if(typeof u=="string")return n[u]}var n={};t.addEventType=l;for(var r=1,o=arguments.length;r<o;++r)l(arguments[r]);return t;function l(u,f,C){var E,y;if(typeof u!="object")return f=f||qs,y={subscribers:[],fire:C=C||Te,subscribe:function(g){y.subscribers.indexOf(g)===-1&&(y.subscribers.push(g),y.fire=f(y.fire,g))},unsubscribe:function(g){y.subscribers=y.subscribers.filter(function(v){return v!==g}),y.fire=y.subscribers.reduce(f,C)}},n[u]=t[u]=y;R(E=u).forEach(function(g){var v=E[g];if(T(v))l(g,E[g][0],E[g][1]);else{if(v!=="asap")throw new se.InvalidArgument("Invalid event config");var S=l(g,Ht,function(){for(var w=arguments.length,b=new Array(w);w--;)b[w]=arguments[w];S.subscribers.forEach(function(k){de(function(){k.apply(null,b)})})})}})}}function Qt(e,t){return G(t).from({prototype:e}),t}function Kt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function hr(e,t){e.filter=_t(e.filter,t)}function pr(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return _t(r(),t())}:t,e.justLimit=n&&!r}function Tn(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(n)return n;throw new se.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed")}function gi(e,t,n){var r=Tn(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function Vn(e,t,n,r){var o,l,u=e.replayFilter?_t(e.filter,e.replayFilter()):e.filter;return e.or?(o={},l=function(f,C,E){var y,g;u&&!u(C,E,function(v){return C.stop(v)},function(v){return C.fail(v)})||((g=""+(y=C.primaryKey))=="[object ArrayBuffer]"&&(g=""+new Uint8Array(y)),U(o,g))||(o[g]=!0,t(f,C,E))},Promise.all([e.or._iterate(l,n),Ci(gi(e,r,n),e.algorithm,l,!e.keysOnly&&e.valueMapper)])):Ci(gi(e,r,n),_t(e.algorithm,u),t,!e.keysOnly&&e.valueMapper)}function Ci(e,t,n,r){var o=Re(r?function(l,u,f){return n(r(l),u,f)}:n);return e.then(function(l){if(l)return l.start(function(){var u=function(){return l.continue()};t&&!t(l,function(f){return u=f},function(f){l.stop(f),u=Te},function(f){l.fail(f),u=Te})||o(l.value,l,function(f){return u=f}),u()})})}Ie.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Ue.bind(null,n.error)):n.table._trans("readonly",e).then(t)},Ie.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Ue.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},Ie.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=_t(t.algorithm,e)},Ie.prototype._iterate=function(e,t){return Vn(this._ctx,e,t,this._ctx.table.core)},Ie.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&V(n,e),t._ctx=n,t},Ie.prototype.raw=function(){return this._ctx.valueMapper=null,this},Ie.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return Vn(t,e,n,t.table.core)})},Ie.prototype.count=function(e){var t=this;return this._read(function(n){var r,o=t._ctx,l=o.table.core;return Kt(o,!0)?l.count({trans:n,query:{index:Tn(o,l.schema),range:o.range}}).then(function(u){return Math.min(u,o.limit)}):(r=0,Vn(o,function(){return++r,!1},n,l).then(function(){return r}))}).then(e)},Ie.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],o=n.length-1;function l(C,E){return E?l(C[n[E]],E-1):C[r]}var u=this._ctx.dir==="next"?1:-1;function f(C,E){return Se(l(C,o),l(E,o))*u}return this.toArray(function(C){return C.slice().sort(f)}).then(t)},Ie.prototype.toArray=function(e){var t=this;return this._read(function(n){var r,o,l,u=t._ctx;return Kt(u,!0)&&0<u.limit?(r=u.valueMapper,o=Tn(u,u.table.core.schema),u.table.core.query({trans:n,limit:u.limit,values:!0,direction:u.dir==="prev"?"prev":void 0,query:{index:o,range:u.range}}).then(function(f){return f=f.result,r?f.map(r):f})):(l=[],Vn(u,function(f){return l.push(f)},n,u.table.core).then(function(){return l}))},e)},Ie.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,Kt(t)?pr(t,function(){var n=e;return function(r,o){return n===0||(n===1?--n:o(function(){r.advance(n),n=0}),!1)}}):pr(t,function(){var n=e;return function(){return--n<0}})),this},Ie.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),pr(this._ctx,function(){var t=e;return function(n,r,o){return--t<=0&&r(o),0<=t}},!0),this},Ie.prototype.until=function(e,t){return hr(this._ctx,function(n,r,o){return!e(n.value)||(r(o),t)}),this},Ie.prototype.first=function(e){return this.limit(1).toArray(function(t){return t[0]}).then(e)},Ie.prototype.last=function(e){return this.reverse().first(e)},Ie.prototype.filter=function(e){var t;return hr(this._ctx,function(n){return e(n.value)}),(t=this._ctx).isMatch=_t(t.isMatch,e),this},Ie.prototype.and=function(e){return this.filter(e)},Ie.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Ie.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Ie.prototype.desc=function(){return this.reverse()},Ie.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(n,r){e(r.key,r)})},Ie.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Ie.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(n,r){e(r.primaryKey,r)})},Ie.prototype.keys=function(e){var t=this._ctx,n=(t.keysOnly=!t.isMatch,[]);return this.each(function(r,o){n.push(o.key)}).then(function(){return n}).then(e)},Ie.prototype.primaryKeys=function(e){var t=this._ctx;if(Kt(t,!0)&&0<t.limit)return this._read(function(r){var o=Tn(t,t.table.core.schema);return t.table.core.query({trans:r,values:!1,limit:t.limit,direction:t.dir==="prev"?"prev":void 0,query:{index:o,range:t.range}})}).then(function(r){return r.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(r,o){n.push(o.primaryKey)}).then(function(){return n}).then(e)},Ie.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Ie.prototype.firstKey=function(e){return this.limit(1).keys(function(t){return t[0]}).then(e)},Ie.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Ie.prototype.distinct=function(){var e,t=this._ctx,t=t.index&&t.table.schema.idxByName[t.index];return t&&t.multi&&(e={},hr(this._ctx,function(r){var r=r.primaryKey.toString(),o=U(e,r);return e[r]=!0,!o})),this},Ie.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(r){function o(b,k){var _=k.failures;v+=b-k.numFailures;for(var I=0,L=R(_);I<L.length;I++){var O=L[I];g.push(_[O])}}var l=typeof e=="function"?e:function(b){return pi(b,e)},u=n.table.core,y=u.schema.primaryKey,f=y.outbound,C=y.extractKey,E=200,y=t.db._options.modifyChunkSize,g=(y&&(E=typeof y=="object"?y[u.name]||y["*"]||200:y),[]),v=0,S=[],w=e===vi;return t.clone().primaryKeys().then(function(b){function k(I){var L=Math.min(E,b.length-I),O=b.slice(I,I+L);return(w?Promise.resolve([]):u.getMany({trans:r,keys:O,cache:"immutable"})).then(function(D){var z=[],j=[],te=f?[]:null,q=w?O:[];if(!w)for(var ne=0;ne<L;++ne){var P=D[ne],he={value:ee(P),primKey:b[I+ne]};l.call(he,he.value,he)!==!1&&(he.value==null?q.push(b[I+ne]):f||Se(C(P),C(he.value))===0?(j.push(he.value),f&&te.push(b[I+ne])):(q.push(b[I+ne]),z.push(he.value)))}return Promise.resolve(0<z.length&&u.mutate({trans:r,type:"add",values:z}).then(function(pe){for(var Ce in pe.failures)q.splice(parseInt(Ce),1);o(z.length,pe)})).then(function(){return(0<j.length||_&&typeof e=="object")&&u.mutate({trans:r,type:"put",keys:te,values:j,criteria:_,changeSpec:typeof e!="function"&&e,isAdditionalChunk:0<I}).then(function(pe){return o(j.length,pe)})}).then(function(){return(0<q.length||_&&w)&&u.mutate({trans:r,type:"delete",keys:q,criteria:_,isAdditionalChunk:0<I}).then(function(pe){return _n(n.table,q,pe)}).then(function(pe){return o(q.length,pe)})}).then(function(){return b.length>I+L&&k(I+E)})})}var _=Kt(n)&&n.limit===1/0&&(typeof e!="function"||w)&&{index:n.index,range:n.range};return k(0).then(function(){if(0<g.length)throw new mn("Error modifying one or more objects",g,v,S);return b.length})})})},Ie.prototype.delete=function(){var e=this._ctx,t=e.range;return!Kt(e)||e.table.schema.yProps||!e.isPrimKey&&t.type!==3?this.modify(vi):this._write(function(n){var r=e.table.core.schema.primaryKey,o=t;return e.table.core.count({trans:n,query:{index:r,range:o}}).then(function(l){return e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(function(C){var f=C.failures,C=C.numFailures;if(C)throw new mn("Could not delete some values",Object.keys(f).map(function(E){return f[E]}),l-C);return l-C})})})};var Js=Ie;function Ie(){}var vi=function(e,t){return t.value=null};function Xs(e,t){return e<t?-1:e===t?0:1}function Qs(e,t){return t<e?-1:e===t?0:1}function We(e,t,n){return e=e instanceof bi?new e.Collection(e):e,e._ctx.error=new(n||TypeError)(t),e}function $t(e){return new e.Collection(e,function(){return yi("")}).limit(0)}function Mn(S,t,n,r){var o,l,u,f,C,E,y,g=n.length;if(!n.every(function(b){return typeof b=="string"}))return We(S,li);function v(b){o=b==="next"?function(_){return _.toUpperCase()}:function(_){return _.toLowerCase()},l=b==="next"?function(_){return _.toLowerCase()}:function(_){return _.toUpperCase()},u=b==="next"?Xs:Qs;var k=n.map(function(_){return{lower:l(_),upper:o(_)}}).sort(function(_,I){return u(_.lower,I.lower)});f=k.map(function(_){return _.upper}),C=k.map(function(_){return _.lower}),y=(E=b)==="next"?"":r}v("next");var S=new S.Collection(S,function(){return mt(f[0],C[g-1]+r)}),w=(S._ondirectionchange=function(b){v(b)},0);return S._addAlgorithm(function(b,k,_){var I=b.key;if(typeof I=="string"){var L=l(I);if(t(L,C,w))return!0;for(var O=null,D=w;D<g;++D){var z=((j,te,q,ne,P,he)=>{for(var pe=Math.min(j.length,ne.length),Ce=-1,we=0;we<pe;++we){var Ye=te[we];if(Ye!==ne[we])return P(j[we],q[we])<0?j.substr(0,we)+q[we]+q.substr(we+1):P(j[we],ne[we])<0?j.substr(0,we)+ne[we]+q.substr(we+1):0<=Ce?j.substr(0,Ce)+te[Ce]+q.substr(Ce+1):null;P(j[we],Ye)<0&&(Ce=we)}return pe<ne.length&&he==="next"?j+q.substr(j.length):pe<j.length&&he==="prev"?j.substr(0,q.length):Ce<0?null:j.substr(0,Ce)+ne[Ce]+q.substr(Ce+1)})(I,L,f[D],C[D],u,E);z===null&&O===null?w=D+1:(O===null||0<u(O,z))&&(O=z)}k(O!==null?function(){b.continue(O+y)}:_)}return!1}),S}function mt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function yi(e){return{type:1,lower:e,upper:e}}Object.defineProperty(Pe.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Pe.prototype.between=function(e,t,n,r){n=n!==!1,r=r===!0;try{return 0<this._cmp(e,t)||this._cmp(e,t)===0&&(n||r)&&(!n||!r)?$t(this):new this.Collection(this,function(){return mt(e,t,!n,!r)})}catch{return We(this,ct)}},Pe.prototype.equals=function(e){return e==null?We(this,ct):new this.Collection(this,function(){return yi(e)})},Pe.prototype.above=function(e){return e==null?We(this,ct):new this.Collection(this,function(){return mt(e,void 0,!0)})},Pe.prototype.aboveOrEqual=function(e){return e==null?We(this,ct):new this.Collection(this,function(){return mt(e,void 0,!1)})},Pe.prototype.below=function(e){return e==null?We(this,ct):new this.Collection(this,function(){return mt(void 0,e,!1,!0)})},Pe.prototype.belowOrEqual=function(e){return e==null?We(this,ct):new this.Collection(this,function(){return mt(void 0,e)})},Pe.prototype.startsWith=function(e){return typeof e!="string"?We(this,li):this.between(e,e+It,!0,!0)},Pe.prototype.startsWithIgnoreCase=function(e){return e===""?this.startsWith(e):Mn(this,function(t,n){return t.indexOf(n[0])===0},[e],It)},Pe.prototype.equalsIgnoreCase=function(e){return Mn(this,function(t,n){return t===n[0]},[e],"")},Pe.prototype.anyOfIgnoreCase=function(){var e=nt.apply(st,arguments);return e.length===0?$t(this):Mn(this,function(t,n){return n.indexOf(t)!==-1},e,"")},Pe.prototype.startsWithAnyOfIgnoreCase=function(){var e=nt.apply(st,arguments);return e.length===0?$t(this):Mn(this,function(t,n){return n.some(function(r){return t.indexOf(r)===0})},e,It)},Pe.prototype.anyOf=function(){var e,t,n=this,r=nt.apply(st,arguments),o=this._cmp;try{r.sort(o)}catch{return We(this,ct)}return r.length===0?$t(this):((e=new this.Collection(this,function(){return mt(r[0],r[r.length-1])}))._ondirectionchange=function(l){o=l==="next"?n._ascending:n._descending,r.sort(o)},t=0,e._addAlgorithm(function(l,u,f){for(var C=l.key;0<o(C,r[t]);)if(++t===r.length)return u(f),!1;return o(C,r[t])===0||(u(function(){l.continue(r[t])}),!1)}),e)},Pe.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Pe.prototype.noneOf=function(){var e=nt.apply(st,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return We(this,ct)}var t=e.reduce(function(n,r){return n?n.concat([[n[n.length-1][1],r]]):[[-1/0,r]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},Pe.prototype.inAnyRange=function(e,_){var n=this,r=this._cmp,o=this._ascending,l=this._descending,u=this._min,f=this._max;if(e.length===0)return $t(this);if(!e.every(function(I){return I[0]!==void 0&&I[1]!==void 0&&o(I[0],I[1])<=0}))return We(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",se.InvalidArgument);var C=!_||_.includeLowers!==!1,E=_&&_.includeUppers===!0,y,g=o;function v(I,L){return g(I[0],L[0])}try{(y=e.reduce(function(I,L){for(var O=0,D=I.length;O<D;++O){var z=I[O];if(r(L[0],z[1])<0&&0<r(L[1],z[0])){z[0]=u(z[0],L[0]),z[1]=f(z[1],L[1]);break}}return O===D&&I.push(L),I},[])).sort(v)}catch{return We(this,ct)}var S=0,w=E?function(I){return 0<o(I,y[S][1])}:function(I){return 0<=o(I,y[S][1])},b=C?function(I){return 0<l(I,y[S][0])}:function(I){return 0<=l(I,y[S][0])},k=w,_=new this.Collection(this,function(){return mt(y[0][0],y[y.length-1][1],!C,!E)});return _._ondirectionchange=function(I){g=I==="next"?(k=w,o):(k=b,l),y.sort(v)},_._addAlgorithm(function(I,L,O){for(var D,z=I.key;k(z);)if(++S===y.length)return L(O),!1;return!w(D=z)&&!b(D)||(n._cmp(z,y[S][1])===0||n._cmp(z,y[S][0])===0||L(function(){g===o?I.continue(y[S][0]):I.continue(y[S][1])}),!1)}),_},Pe.prototype.startsWithAnyOf=function(){var e=nt.apply(st,arguments);return e.every(function(t){return typeof t=="string"})?e.length===0?$t(this):this.inAnyRange(e.map(function(t){return[t,t+It]})):We(this,"startsWithAnyOf() only works with strings")};var bi=Pe;function Pe(){}function Je(e){return Re(function(t){return en(t),e(t.target.error),!1})}function en(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Rn="storagemutated",mr="x-storagemutated-1",gt=Xt(null,Rn),el=(at.prototype._lock=function(){return ve(!ie.global),++this._reculock,this._reculock!==1||ie.global||(ie.lockOwnerFor=this),this},at.prototype._unlock=function(){if(ve(!ie.global),--this._reculock==0)for(ie.global||(ie.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Et(e[1],e[0])}catch{}}return this},at.prototype._locked=function(){return this._reculock&&ie.lockOwnerFor!==this},at.prototype.create=function(e){var t=this;if(this.mode){var n=this.db.idbdb,r=this.db._state.dbOpenError;if(ve(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new se.DatabaseClosed(r);case"MissingAPIError":throw new se.MissingAPI(r.message,r);default:throw new se.OpenFailed(r)}if(!this.active)throw new se.TransactionInactive;ve(this._completion._state===null),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Re(function(o){en(o),t._reject(e.error)}),e.onabort=Re(function(o){en(o),t.active&&t._reject(new se.Abort(e.error)),t.active=!1,t.on("abort").fire(o)}),e.oncomplete=Re(function(){t.active=!1,t._resolve(),"mutatedParts"in e&&gt.storagemutated.fire(e.mutatedParts)})}return this},at.prototype._promise=function(e,t,n){var r,o=this;return e==="readwrite"&&this.mode!=="readwrite"?Ue(new se.ReadOnly("Transaction is readonly")):this.active?this._locked()?new X(function(l,u){o._blockedFuncs.push([function(){o._promise(e,t,n).then(l,u)},ie])}):n?ft(function(){var l=new X(function(u,f){o._lock();var C=t(u,f,o);C&&C.then&&C.then(u,f)});return l.finally(function(){return o._unlock()}),l._lib=!0,l}):((r=new X(function(l,u){var f=t(l,u,o);f&&f.then&&f.then(l,u)}))._lib=!0,r):Ue(new se.TransactionInactive)},at.prototype._root=function(){return this.parent?this.parent._root():this},at.prototype.waitFor=function(e){var t,n=this._root(),r=X.resolve(e),o=(n._waitingFor?n._waitingFor=n._waitingFor.then(function(){return r}):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),(function l(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=l)})()),n._waitingFor);return new X(function(l,u){r.then(function(f){return n._waitingQueue.push(Re(l.bind(null,f)))},function(f){return n._waitingQueue.push(Re(u.bind(null,f)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},at.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new se.Abort))},at.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(U(t,e))return t[e];var n=this.schema[e];if(n)return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n;throw new se.NotFound("Table "+e+" not part of transaction")},at);function at(){}function gr(e,t,n,r,o,l,u,f){return{name:e,keyPath:t,unique:n,multi:r,auto:o,compound:l,src:(n&&!u?"&":"")+(r?"*":"")+(o?"++":"")+wi(t),type:f}}function wi(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Cr(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(o){return[o.name,o]},n.reduce(function(o,l,u){return l=r(l,u),l&&(o[l[0]]=l[1]),o},{}))};var r}var tn=function(e){try{return e.only([[]]),tn=function(){return[[]]},[[]]}catch{return tn=function(){return It},It}};function vr(e){return e==null?function(){}:typeof e=="string"?(t=e).split(".").length===1?function(n){return n[t]}:function(n){return oe(n,t)}:function(n){return oe(n,e)};var t}function ki(e){return[].slice.call(e)}var tl=0;function nn(e){return e==null?":id":typeof e=="string"?e:"[".concat(e.join("+"),"]")}function nl(e,t,u){function r(k){if(k.type===3)return null;if(k.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var S=k.lower,w=k.upper,b=k.lowerOpen,k=k.upperOpen;return S===void 0?w===void 0?null:t.upperBound(w,!!k):w===void 0?t.lowerBound(S,!!b):t.bound(S,w,!!b,!!k)}function o(v){var S,w,b=v.name;return{name:b,schema:v,mutate:function(k){var _=k.trans,I=k.type,L=k.keys,O=k.values,D=k.range;return new Promise(function(z,j){z=Re(z);var te=_.objectStore(b),q=te.keyPath==null,ne=I==="put"||I==="add";if(!ne&&I!=="delete"&&I!=="deleteRange")throw new Error("Invalid operation type: "+I);var P,he=(L||O||{length:1}).length;if(L&&O&&L.length!==O.length)throw new Error("Given keys array must have same length as given values array.");if(he===0)return z({numFailures:0,failures:{},results:[],lastResult:void 0});function pe(Ge){++Ye,en(Ge)}var Ce=[],we=[],Ye=0;if(I==="deleteRange"){if(D.type===4)return z({numFailures:Ye,failures:we,results:[],lastResult:void 0});D.type===3?Ce.push(P=te.clear()):Ce.push(P=te.delete(r(D)))}else{var q=ne?q?[O,L]:[O,null]:[L,null],me=q[0],Ke=q[1];if(ne)for(var $e=0;$e<he;++$e)Ce.push(P=Ke&&Ke[$e]!==void 0?te[I](me[$e],Ke[$e]):te[I](me[$e])),P.onerror=pe;else for($e=0;$e<he;++$e)Ce.push(P=te[I](me[$e])),P.onerror=pe}function jn(Ge){Ge=Ge.target.result,Ce.forEach(function(Mt,Nr){return Mt.error!=null&&(we[Nr]=Mt.error)}),z({numFailures:Ye,failures:we,results:I==="delete"?L:Ce.map(function(Mt){return Mt.result}),lastResult:Ge})}P.onerror=function(Ge){pe(Ge),jn(Ge)},P.onsuccess=jn})},getMany:function(k){var _=k.trans,I=k.keys;return new Promise(function(L,O){L=Re(L);for(var D,z=_.objectStore(b),j=I.length,te=new Array(j),q=0,ne=0,P=function(Ce){Ce=Ce.target,te[Ce._pos]=Ce.result,++ne===q&&L(te)},he=Je(O),pe=0;pe<j;++pe)I[pe]!=null&&((D=z.get(I[pe]))._pos=pe,D.onsuccess=P,D.onerror=he,++q);q===0&&L(te)})},get:function(k){var _=k.trans,I=k.key;return new Promise(function(L,O){L=Re(L);var D=_.objectStore(b).get(I);D.onsuccess=function(z){return L(z.target.result)},D.onerror=Je(O)})},query:(S=C,w=E,function(k){return new Promise(function(_,I){_=Re(_);var L,O,D,z,he=k.trans,j=k.values,te=k.limit,P=k.query,q=(q=k.direction)!=null?q:"next",ne=te===1/0?void 0:te,pe=P.index,P=P.range,he=he.objectStore(b),he=pe.isPrimaryKey?he:he.index(pe.name),pe=r(P);if(te===0)return _({result:[]});w?(P={query:pe,count:ne,direction:q},(L=j?he.getAll(P):he.getAllKeys(P)).onsuccess=function(Ce){return _({result:Ce.target.result})},L.onerror=Je(I)):S&&q==="next"?((L=j?he.getAll(pe,ne):he.getAllKeys(pe,ne)).onsuccess=function(Ce){return _({result:Ce.target.result})},L.onerror=Je(I)):(O=0,D=!j&&"openKeyCursor"in he?he.openKeyCursor(pe,q):he.openCursor(pe,q),z=[],D.onsuccess=function(){var Ce=D.result;return!Ce||(z.push(j?Ce.value:Ce.primaryKey),++O===te)?_({result:z}):void Ce.continue()},D.onerror=Je(I))})}),openCursor:function(k){var _=k.trans,I=k.values,L=k.query,O=k.reverse,D=k.unique;return new Promise(function(z,j){z=Re(z);var ne=L.index,te=L.range,q=_.objectStore(b),q=ne.isPrimaryKey?q:q.index(ne.name),ne=O?D?"prevunique":"prev":D?"nextunique":"next",P=!I&&"openKeyCursor"in q?q.openKeyCursor(r(te),ne):q.openCursor(r(te),ne);P.onerror=Je(j),P.onsuccess=Re(function(he){var pe,Ce,we,Ye,me=P.result;me?(me.___id=++tl,me.done=!1,pe=me.continue.bind(me),Ce=(Ce=me.continuePrimaryKey)&&Ce.bind(me),we=me.advance.bind(me),Ye=function(){throw new Error("Cursor not stopped")},me.trans=_,me.stop=me.continue=me.continuePrimaryKey=me.advance=function(){throw new Error("Cursor not started")},me.fail=Re(j),me.next=function(){var Ke=this,$e=1;return this.start(function(){return $e--?Ke.continue():Ke.stop()}).then(function(){return Ke})},me.start=function(Ke){function $e(){if(P.result)try{Ke()}catch(Ge){me.fail(Ge)}else me.done=!0,me.start=function(){throw new Error("Cursor behind last entry")},me.stop()}var jn=new Promise(function(Ge,Mt){Ge=Re(Ge),P.onerror=Je(Mt),me.fail=Mt,me.stop=function(Nr){me.stop=me.continue=me.continuePrimaryKey=me.advance=Ye,Ge(Nr)}});return P.onsuccess=Re(function(Ge){P.onsuccess=$e,$e()}),me.continue=pe,me.continuePrimaryKey=Ce,me.advance=we,$e(),jn},z(me)):z(null)},j)})},count:function(k){var _=k.query,I=k.trans,L=_.index,O=_.range;return new Promise(function(D,z){var j=I.objectStore(b),j=L.isPrimaryKey?j:j.index(L.name),te=r(O),te=te?j.count(te):j.count();te.onsuccess=Re(function(q){return D(q.target.result)}),te.onerror=Je(z)})}}}l=u,f=ki((u=e).objectStoreNames),y=0<f.length?l.objectStore(f[0]):{};var l,u={schema:{name:u.name,tables:f.map(function(v){return l.objectStore(v)}).map(function(v){var S=v.keyPath,w=v.autoIncrement,k=T(S),b={},k={name:v.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:S==null,compound:k,keyPath:S,autoIncrement:w,unique:!0,extractKey:vr(S)},indexes:ki(v.indexNames).map(function(_){return v.index(_)}).map(function(O){var D=O.name,I=O.unique,L=O.multiEntry,O=O.keyPath,D={name:D,compound:T(O),keyPath:O,unique:I,multiEntry:L,extractKey:vr(O)};return b[nn(O)]=D}),getIndexByKeyPath:function(_){return b[nn(_)]}};return b[":id"]=k.primaryKey,S!=null&&(b[nn(S)]=k.primaryKey),k})},hasGetAll:0<f.length&&"getAll"in y&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604),hasIdb3Features:"getAllRecords"in y},f=u.schema,C=u.hasGetAll,E=u.hasIdb3Features,y=f.tables.map(o),g={};return y.forEach(function(v){return g[v.name]=v}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(v){if(g[v])return g[v];throw new Error("Table '".concat(v,"' not found"))},MIN_KEY:-1/0,MAX_KEY:tn(t),schema:f}}function rl(e,t,n,r){return n=n.IDBKeyRange,t=nl(t,n,r),{dbcore:e.dbcore.reduce(function(o,l){return l=l.create,c(c({},o),l(o))},t)}}function Ln(e,t){var n=t.db,n=rl(e._middlewares,n,e._deps,t);e.core=n.dbcore,e.tables.forEach(function(r){var o=r.name;e.core.schema.tables.some(function(l){return l.name===o})&&(r.core=e.core.table(o),e[o]instanceof e.Table)&&(e[o].core=r.core)})}function Un(e,t,n,r){n.forEach(function(o){var l=r[o];t.forEach(function(u){var f=(function C(E,y){return Z(E,y)||(E=B(E))&&C(E,y)})(u,o);(!f||"value"in f&&f.value===void 0)&&(u===e.Transaction.prototype||u instanceof e.Transaction?N(u,o,{get:function(){return this.table(o)},set:function(C){K(this,o,{value:C,writable:!0,configurable:!0,enumerable:!0})}}):u[o]=new e.Table(o,l))})})}function yr(e,t){t.forEach(function(n){for(var r in n)n[r]instanceof e.Table&&delete n[r]})}function il(e,t){return e._cfg.version-t._cfg.version}function al(e,t,n,r){var o=e._dbSchema,l=(n.objectStoreNames.contains("$meta")&&!o.$meta&&(o.$meta=Cr("$meta",Ei("")[0],[]),e._storeNames.push("$meta")),e._createTransaction("readwrite",e._storeNames,o)),u=(l.create(n),l._completion.catch(r),l._reject.bind(l)),f=ie.transless||ie;ft(function(){if(ie.trans=l,ie.transless=f,t!==0)return Ln(e,n),E=t,((C=l).storeNames.includes("$meta")?C.table("$meta").get("version").then(function(y){return y??E}):X.resolve(E)).then(function(k){var g=e,v=k,S=l,w=n,b=[],k=g._versions,_=g._dbSchema=Bn(0,g.idbdb,w);return(k=k.filter(function(I){return I._cfg.version>=v})).length===0?X.resolve():(k.forEach(function(I){b.push(function(){var L,O,D,z=_,j=I._cfg.dbschema,te=(xn(g,z,w),xn(g,j,w),_=g._dbSchema=j,br(z,j)),q=(te.add.forEach(function(ne){wr(w,ne[0],ne[1].primKey,ne[1].indexes)}),te.change.forEach(function(ne){if(ne.recreate)throw new se.Upgrade("Not yet support for changing primary key");var P=w.objectStore(ne.name);ne.add.forEach(function(he){return An(P,he)}),ne.change.forEach(function(he){P.deleteIndex(he.name),An(P,he)}),ne.del.forEach(function(he){return P.deleteIndex(he)})}),I._cfg.contentUpgrade);if(q&&I._cfg.version>v)return Ln(g,w),S._memoizedTables={},L=$(j),te.del.forEach(function(ne){L[ne]=z[ne]}),yr(g,[g.Transaction.prototype]),Un(g,[g.Transaction.prototype],R(L),L),S.schema=L,(O=pn(q))&&Dt(),j=X.follow(function(){var ne;(D=q(S))&&O&&(ne=ht.bind(null,null),D.then(ne,ne))}),D&&typeof D.then=="function"?X.resolve(D):j.then(function(){return D})}),b.push(function(L){var O,D,z=I._cfg.dbschema;O=z,D=L,[].slice.call(D.db.objectStoreNames).forEach(function(j){return O[j]==null&&D.db.deleteObjectStore(j)}),yr(g,[g.Transaction.prototype]),Un(g,[g.Transaction.prototype],g._storeNames,g._dbSchema),S.schema=g._dbSchema}),b.push(function(L){g.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(g.idbdb.version/10)===I._cfg.version?(g.idbdb.deleteObjectStore("$meta"),delete g._dbSchema.$meta,g._storeNames=g._storeNames.filter(function(O){return O!=="$meta"})):L.objectStore("$meta").put(I._cfg.version,"version"))})}),(function I(){return b.length?X.resolve(b.shift()(S.idbtrans)).then(I):X.resolve()})().then(function(){Si(_,w)}))}).catch(u);var C,E;R(o).forEach(function(y){wr(n,y,o[y].primKey,o[y].indexes)}),Ln(e,n),X.follow(function(){return e.on.populate.fire(l)}).catch(u)})}function ol(e,t){Si(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=Bn(0,e.idbdb,t);xn(e,e._dbSchema,t);for(var r=0,o=br(n,e._dbSchema).change;r<o.length;r++){var l=(u=>{if(u.change.length||u.recreate)return console.warn("Unable to patch indexes of table ".concat(u.name," because it has changes on the type of index or primary key.")),{value:void 0};var f=t.objectStore(u.name);u.add.forEach(function(C){it&&console.debug("Dexie upgrade patch: Creating missing index ".concat(u.name,".").concat(C.src)),An(f,C)})})(o[r]);if(typeof l=="object")return l.value}}function br(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],l=t[n];if(o){var u={name:n,def:l,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(l.primKey.keyPath||"")||o.primKey.auto!==l.primKey.auto)u.recreate=!0,r.change.push(u);else{var f=o.idxByName,C=l.idxByName,E=void 0;for(E in f)C[E]||u.del.push(E);for(E in C){var y=f[E],g=C[E];y?y.src!==g.src&&u.change.push(g):u.add.push(g)}(0<u.del.length||0<u.add.length||0<u.change.length)&&r.change.push(u)}}else r.add.push([n,l])}return r}function wr(e,t,n,r){var o=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});r.forEach(function(l){return An(o,l)})}function Si(e,t){R(e).forEach(function(n){t.db.objectStoreNames.contains(n)||(it&&console.debug("Dexie: Creating missing table",n),wr(t,n,e[n].primKey,e[n].indexes))})}function An(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Bn(e,t,n){var r={};return re(t.objectStoreNames,0).forEach(function(o){for(var l=n.objectStore(o),u=gr(wi(E=l.keyPath),E||"",!0,!1,!!l.autoIncrement,E&&typeof E!="string",!0),f=[],C=0;C<l.indexNames.length;++C){var y=l.index(l.indexNames[C]),E=y.keyPath,y=gr(y.name,E,!!y.unique,!!y.multiEntry,!1,E&&typeof E!="string",!1);f.push(y)}r[o]=Cr(o,u,f)}),r}function xn(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var l=r[o],u=n.objectStore(l);e._hasGetAll="getAll"in u;for(var f=0;f<u.indexNames.length;++f){var C,E=u.indexNames[f],y=u.index(E).keyPath,y=typeof y=="string"?y:"["+re(y).join("+")+"]";t[l]&&(C=t[l].idxByName[y])&&(C.name=E,delete t[l].idxByName[y],t[l].idxByName[E]=C)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&m.WorkerGlobalScope&&m instanceof m.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function Ei(e){return e.split(",").map(function(t,n){var o=t.split(":"),r=(r=o[1])==null?void 0:r.trim(),o=(t=o[0].trim()).replace(/([&*]|\+\+)/g,""),l=/^\[/.test(o)?o.match(/^\[(.*)\]$/)[1].split("+"):o;return gr(o,l||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),T(l),n===0,r)})}jt.prototype._createTableSchema=Cr,jt.prototype._parseIndexSyntax=Ei,jt.prototype._parseStoresSpec=function(e,t){var n=this;R(e).forEach(function(r){if(e[r]!==null){var o=n._parseIndexSyntax(e[r]),l=o.shift();if(!l)throw new se.Schema("Invalid schema for table "+r+": "+e[r]);if(l.unique=!0,l.multi)throw new se.Schema("Primary key cannot be multiEntry*");o.forEach(function(u){if(u.auto)throw new se.Schema("Only primary key can be marked as autoIncrement (++)");if(!u.keyPath)throw new se.Schema("Index must have a name and cannot be an empty string")}),l=n._createTableSchema(r,l,o),t[r]=l}})},jt.prototype.stores=function(n){var t=this.db,n=(this._cfg.storesSource=this._cfg.storesSource?V(this._cfg.storesSource,n):n,t._versions),r={},o={};return n.forEach(function(l){V(r,l._cfg.storesSource),o=l._cfg.dbschema={},l._parseStoresSpec(r,o)}),t._dbSchema=o,yr(t,[t._allTables,t,t.Transaction.prototype]),Un(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],R(o),o),t._storeNames=R(o),this},jt.prototype.upgrade=function(e){return this._cfg.contentUpgrade=nr(this._cfg.contentUpgrade||Te,e),this};var sl=jt;function jt(){}var rn=(()=>{var e,t,n;return typeof FinalizationRegistry<"u"&&typeof WeakRef<"u"?(e=new Set,t=new FinalizationRegistry(function(r){e.delete(r)}),{toArray:function(){return Array.from(e).map(function(r){return r.deref()}).filter(function(r){return r!==void 0})},add:function(r){var o=new WeakRef(r._novip);e.add(o),t.register(r._novip,o,o),e.size>r._options.maxConnections&&(o=e.values().next().value,e.delete(o),t.unregister(o))},remove:function(r){if(r)for(var o=e.values(),l=o.next();!l.done;){var u=l.value;if(u.deref()===r._novip)return e.delete(u),void t.unregister(u);l=o.next()}}}):(n=[],{toArray:function(){return n},add:function(r){n.push(r._novip)},remove:function(r){r&&(r=n.indexOf(r._novip))!==-1&&n.splice(r,1)}})})();function kr(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ut(En,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function Sr(e){return e&&typeof e.databases=="function"}function Er(e){return ft(function(){return ie.letThrough=!0,e()})}function Ir(e){return!("from"in e)}var De=function(e,t){var n;if(!this)return n=new De,e&&"d"in e&&V(n,e),n;V(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function an(e,t,n){var r=Se(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(Ir(e))return V(e,{from:t,to:n,d:1});var r=e.l,o=e.r;if(Se(n,e.from)<0)return r?an(r,t,n):e.l={from:t,to:n,d:1,l:null,r:null},_i(e);if(0<Se(t,e.to))return o?an(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},_i(e);Se(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),0<Se(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),t=!e.r,r&&!e.l&&on(e,r),o&&t&&on(e,o)}}function on(e,t){Ir(t)||(function n(r,o){var l=o.from,u=o.l,f=o.r;an(r,l,o.to),u&&n(r,u),f&&n(r,f)})(e,t)}function Ii(e,t){var n=Nn(t),r=n.next();if(!r.done)for(var o=r.value,l=Nn(e),u=l.next(o.from),f=u.value;!r.done&&!u.done;){if(Se(f.from,o.to)<=0&&0<=Se(f.to,o.from))return!0;Se(o.from,f.from)<0?o=(r=n.next(f.from)).value:f=(u=l.next(o.from)).value}return!1}function Nn(e){var t=Ir(e)?null:{s:0,n:e};return{next:function(n){for(var r=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&Se(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||Se(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function _i(e){var t,n,r,o=(((o=e.r)==null?void 0:o.d)||0)-(((o=e.l)==null?void 0:o.d)||0),o=1<o?"r":o<-1?"l":"";o&&(t=o=="r"?"l":"r",n=c({},e),r=e[o],e.from=r.from,e.to=r.to,e[o]=r[o],n[o]=r[t],(e[t]=n).d=Ti(n)),e.d=Ti(e)}function Ti(n){var t=n.r,n=n.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}function On(e,t){return R(t).forEach(function(n){e[n]?on(e[n],t[n]):e[n]=(function r(o){var l,u,f={};for(l in o)U(o,l)&&(u=o[l],f[l]=!u||typeof u!="object"||J.has(u.constructor)?u:r(u));return f})(t[n])}),e}function _r(e,t){return e.all||t.all||Object.keys(e).some(function(n){return t[n]&&Ii(t[n],e[n])})}H(De.prototype,((Ze={add:function(e){return on(this,e),this},addKey:function(e){return an(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return an(t,n,n)}),this},hasKey:function(e){var t=Nn(this).next(e).value;return t&&Se(t.from,e)<=0&&0<=Se(t.to,e)}})[Q]=function(){return Nn(this)},Ze));var Tt={},Tr={},Vr=!1;function Pn(e){On(Tr,e),Vr||(Vr=!0,setTimeout(function(){Vr=!1,Mr(Tr,!(Tr={}))},0))}function Mr(e,t){t===void 0&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(Tt);r<o.length;r++)Vi(f=o[r],e,n,t);else for(var l in e){var u,f,l=/^idb\:\/\/(.*)\/(.*)\//.exec(l);l&&(u=l[1],l=l[2],f=Tt["idb://".concat(u,"/").concat(l)])&&Vi(f,e,n,t)}n.forEach(function(C){return C()})}function Vi(e,t,n,r){for(var o=[],l=0,u=Object.entries(e.queries.query);l<u.length;l++){for(var f=u[l],C=f[0],E=[],y=0,g=f[1];y<g.length;y++){var v=g[y];_r(t,v.obsSet)?v.subscribers.forEach(function(k){return n.add(k)}):r&&E.push(v)}r&&o.push([C,E])}if(r)for(var S=0,w=o;S<w.length;S++){var b=w[S],C=b[0],E=b[1];e.queries.query[C]=E}}function ll(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?Ue(t.dbOpenError):e});t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,o=Math.round(10*e.verno),l=!1;function u(){if(t.openCanceller!==r)throw new se.DatabaseClosed("db.open() was cancelled")}function f(){return new X(function(v,S){if(u(),!n)throw new se.MissingAPI;var w=e.name,b=t.autoSchema||!o?n.open(w):n.open(w,o);if(!b)throw new se.MissingAPI;b.onerror=Je(S),b.onblocked=Re(e._fireOnBlocked),b.onupgradeneeded=Re(function(k){var _;y=b.transaction,t.autoSchema&&!e._options.allowEmptyDB?(b.onerror=en,y.abort(),b.result.close(),(_=n.deleteDatabase(w)).onsuccess=_.onerror=Re(function(){S(new se.NoSuchDatabase("Database ".concat(w," doesnt exist")))})):(y.onerror=Je(S),_=k.oldVersion>Math.pow(2,62)?0:k.oldVersion,g=_<1,e.idbdb=b.result,l&&ol(e,y),al(e,_/10,y,S))},S),b.onsuccess=Re(function(){y=null;var k,_,I,L,O,D,z=e.idbdb=b.result,j=re(z.objectStoreNames);if(0<j.length)try{var te=z.transaction((O=j).length===1?O[0]:O,"readonly");if(t.autoSchema)D=z,L=te,(I=e).verno=D.version/10,L=I._dbSchema=Bn(0,D,L),I._storeNames=re(D.objectStoreNames,0),Un(I,[I._allTables],R(L),L);else if(xn(e,e._dbSchema,te),_=te,((_=br(Bn(0,(k=e).idbdb,_),k._dbSchema)).add.length||_.change.some(function(q){return q.add.length||q.change.length}))&&!l)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),z.close(),o=z.version+1,l=!0,v(f());Ln(e,te)}catch{}rn.add(e),z.onversionchange=Re(function(q){t.vcFired=!0,e.on("versionchange").fire(q)}),z.onclose=Re(function(){e.close({disableAutoOpen:!1})}),g&&(j=e._deps,O=w,Sr(D=j.indexedDB)||O===En||kr(D,j.IDBKeyRange).put({name:O}).catch(Te)),v()},S)}).catch(function(v){switch(v?.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),f();break;case"VersionError":if(0<o)return o=0,f()}return X.reject(v)})}var C,E=t.dbReadyResolve,y=null,g=!1;return X.race([r,(typeof navigator>"u"?X.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(v){function S(){return indexedDB.databases().finally(v)}C=setInterval(S,100),S()}).finally(function(){return clearInterval(C)}):Promise.resolve()).then(f)]).then(function(){return u(),t.onReadyBeingFired=[],X.resolve(Er(function(){return e.on.ready.fire(e.vip)})).then(function v(){var S;if(0<t.onReadyBeingFired.length)return S=t.onReadyBeingFired.reduce(nr,Te),t.onReadyBeingFired=[],X.resolve(Er(function(){return S(e.vip)})).then(v)})}).finally(function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(function(v){t.dbOpenError=v;try{y&&y.abort()}catch{}return r===t.openCanceller&&e._close(),Ue(v)}).finally(function(){t.openComplete=!0,E()}).then(function(){var v;return g&&(v={},e.tables.forEach(function(S){S.schema.indexes.forEach(function(w){w.name&&(v["idb://".concat(e.name,"/").concat(S.name,"/").concat(w.name)]=new De(-1/0,[[[]]]))}),v["idb://".concat(e.name,"/").concat(S.name,"/")]=v["idb://".concat(e.name,"/").concat(S.name,"/:dels")]=new De(-1/0,[[[]]])}),gt(Rn).fire(v),Mr(v,!0)),e})}function Rr(e){function t(l){return e.next(l)}var n=o(t),r=o(function(l){return e.throw(l)});function o(l){return function(f){var f=l(f),C=f.value;return f.done?C:C&&typeof C.then=="function"?C.then(n,r):T(C)?Promise.all(C).then(n,r):n(C)}}return o(t)()}function Dn(e,t,n){for(var r=T(e)?e.slice():[e],o=0;o<n;++o)r.push(t);return r}var cl={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return c(c({},e),{table:function(r){var n=e.table(r),r=n.schema,o={},l=[];function u(v,S,w){var I=nn(v),b=o[I]=o[I]||[],k=v==null?0:typeof v=="string"?1:v.length,_=0<S,I=c(c({},w),{name:_?"".concat(I,"(virtual-from:").concat(w.name,")"):w.name,lowLevelIndex:w,isVirtual:_,keyTail:S,keyLength:k,extractKey:vr(v),unique:!_&&w.unique});return b.push(I),I.isPrimaryKey||l.push(I),1<k&&u(k===2?v[0]:v.slice(0,k-1),S+1,w),b.sort(function(L,O){return L.keyTail-O.keyTail}),I}var f=u(r.primaryKey.keyPath,0,r.primaryKey);o[":id"]=[f];for(var C=0,E=r.indexes;C<E.length;C++){var y=E[C];u(y.keyPath,0,y)}function g(v){var S,w=v.query.index;return w.isVirtual?c(c({},v),{query:{index:w.lowLevelIndex,range:(S=v.query.range,w=w.keyTail,{type:S.type===1?2:S.type,lower:Dn(S.lower,S.lowerOpen?e.MAX_KEY:e.MIN_KEY,w),lowerOpen:!0,upper:Dn(S.upper,S.upperOpen?e.MIN_KEY:e.MAX_KEY,w),upperOpen:!0})}}):v}return c(c({},n),{schema:c(c({},r),{primaryKey:f,indexes:l,getIndexByKeyPath:function(v){return(v=o[nn(v)])&&v[0]}}),count:function(v){return n.count(g(v))},query:function(v){return n.query(g(v))},openCursor:function(v){var S=v.query.index,w=S.keyTail,b=S.keyLength;return S.isVirtual?n.openCursor(g(v)).then(function(_){return _&&k(_)}):n.openCursor(v);function k(_){return Object.create(_,{continue:{value:function(I){I!=null?_.continue(Dn(I,v.reverse?e.MAX_KEY:e.MIN_KEY,w)):v.unique?_.continue(_.key.slice(0,b).concat(v.reverse?e.MIN_KEY:e.MAX_KEY,w)):_.continue()}},continuePrimaryKey:{value:function(I,L){_.continuePrimaryKey(Dn(I,e.MAX_KEY,w),L)}},primaryKey:{get:function(){return _.primaryKey}},key:{get:function(){var I=_.key;return b===1?I[0]:I.slice(0,b)}},value:{get:function(){return _.value}}})}}})}})}};function Lr(e,t,n,r){return n=n||{},r=r||"",R(e).forEach(function(o){var l,u,f;U(t,o)?(l=e[o],u=t[o],typeof l=="object"&&typeof u=="object"&&l&&u?(f=ue(l))!==ue(u)?n[r+o]=t[o]:f==="Object"?Lr(l,u,n,r+o+"."):l!==u&&(n[r+o]=t[o]):l!==u&&(n[r+o]=t[o])):n[r+o]=void 0}),R(t).forEach(function(o){U(e,o)||(n[r+o]=t[o])}),n}function Ur(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var ul={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return c(c({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey;return c(c({},n),{mutate:function(o){var l=ie.trans,u=l.table(t).hook,f=u.deleting,C=u.creating,E=u.updating;switch(o.type){case"add":if(C.fire===Te)break;return l._promise("readwrite",function(){return y(o)},!0);case"put":if(C.fire===Te&&E.fire===Te)break;return l._promise("readwrite",function(){return y(o)},!0);case"delete":if(f.fire===Te)break;return l._promise("readwrite",function(){return y(o)},!0);case"deleteRange":if(f.fire===Te)break;return l._promise("readwrite",function(){return(function g(v,S,w){return n.query({trans:v,values:!1,query:{index:r,range:S},limit:w}).then(function(b){var k=b.result;return y({type:"delete",keys:k,trans:v}).then(function(_){return 0<_.numFailures?Promise.reject(_.failures[0]):k.length<w?{failures:[],numFailures:0,lastResult:void 0}:g(v,c(c({},S),{lower:k[k.length-1],lowerOpen:!0}),w)})})})(o.trans,o.range,1e4)},!0)}return n.mutate(o);function y(g){var v,S,w,b=ie.trans,k=g.keys||Ur(r,g);if(k)return(g=g.type==="add"||g.type==="put"?c(c({},g),{keys:k}):c({},g)).type!=="delete"&&(g.values=p([],g.values)),g.keys&&(g.keys=p([],g.keys)),v=n,w=k,((S=g).type==="add"?Promise.resolve([]):v.getMany({trans:S.trans,keys:w,cache:"immutable"})).then(function(_){var I=k.map(function(L,O){var D,z,j,te=_[O],q={onerror:null,onsuccess:null};return g.type==="delete"?f.fire.call(q,L,te,b):g.type==="add"||te===void 0?(D=C.fire.call(q,L,g.values[O],b),L==null&&D!=null&&(g.keys[O]=L=D,r.outbound||M(g.values[O],r.keyPath,L))):(D=Lr(te,g.values[O]),(z=E.fire.call(q,D,L,te,b))&&(j=g.values[O],Object.keys(z).forEach(function(ne){U(j,ne)?j[ne]=z[ne]:M(j,ne,z[ne])}))),q});return n.mutate(g).then(function(L){for(var O=L.failures,D=L.results,z=L.numFailures,L=L.lastResult,j=0;j<k.length;++j){var te=(D||k)[j],q=I[j];te==null?q.onerror&&q.onerror(O[j]):q.onsuccess&&q.onsuccess(g.type==="put"&&_[j]?g.values[j]:te)}return{failures:O,results:D,numFailures:z,lastResult:L}}).catch(function(L){return I.forEach(function(O){return O.onerror&&O.onerror(L)}),Promise.reject(L)})});throw new Error("Keys missing")}}})}})}};function Mi(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],o=0,l=0;o<t.keys.length&&l<e.length;++o)Se(t.keys[o],e[l])===0&&(r.push(n?ee(t.values[o]):t.values[o]),++l);return r.length===e.length?r:null}catch{return null}}var dl={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return c(c({},n),{getMany:function(r){var o;return r.cache?(o=Mi(r.keys,r.trans._cache,r.cache==="clone"))?X.resolve(o):n.getMany(r).then(function(l){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?ee(l):l},l}):n.getMany(r)},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}};function Ri(e,t){return e.trans.mode==="readonly"&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!=="disabled"&&!t.schema.primaryKey.outbound}function Li(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var fl={stack:"dbcore",level:0,name:"Observability",create:function(e){var t=e.schema.name,n=new De(e.MIN_KEY,e.MAX_KEY);return c(c({},e),{transaction:function(r,o,l){if(ie.subscr&&o!=="readonly")throw new se.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(ie.querier));return e.transaction(r,o,l)},table:function(r){function o(k){var b,k=k.query;return[b=k.index,new De((b=(k=k.range).lower)!=null?b:e.MIN_KEY,(b=k.upper)!=null?b:e.MAX_KEY)]}var l=e.table(r),u=l.schema,f=u.primaryKey,C=u.indexes,E=f.extractKey,y=f.outbound,g=f.autoIncrement&&C.filter(function(w){return w.compound&&w.keyPath.includes(f.keyPath)}),v=c(c({},l),{mutate:function(w){function b(P){return P="idb://".concat(t,"/").concat(r,"/").concat(P),O[P]||(O[P]=new De)}var k,_,I,L=w.trans,O=w.mutatedParts||(w.mutatedParts={}),D=b(""),z=b(":dels"),j=w.type,q=w.type==="deleteRange"?[w.range]:w.type==="delete"?[w.keys]:w.values.length<50?[Ur(f,w).filter(function(P){return P}),w.values]:[],te=q[0],q=q[1],ne=w.trans._cache;return T(te)?(D.addKeys(te),(j=j==="delete"||te.length===q.length?Mi(te,ne):null)||z.addKeys(te),(j||q)&&(k=b,_=j,I=q,u.indexes.forEach(function(P){var he=k(P.name||"");function pe(we){return we!=null?P.extractKey(we):null}function Ce(we){P.multiEntry&&T(we)?we.forEach(function(Ye){return he.addKey(Ye)}):he.addKey(we)}(_||I).forEach(function(we,Ke){var me=_&&pe(_[Ke]),Ke=I&&pe(I[Ke]);Se(me,Ke)!==0&&(me!=null&&Ce(me),Ke!=null)&&Ce(Ke)})}))):te?(q={from:(ne=te.lower)!=null?ne:e.MIN_KEY,to:(j=te.upper)!=null?j:e.MAX_KEY},z.add(q),D.add(q)):(D.add(n),z.add(n),u.indexes.forEach(function(P){return b(P.name).add(n)})),l.mutate(w).then(function(P){return!te||w.type!=="add"&&w.type!=="put"||(D.addKeys(P.results),g&&g.forEach(function(he){for(var pe=w.values.map(function(me){return he.extractKey(me)}),Ce=he.keyPath.findIndex(function(me){return me===f.keyPath}),we=0,Ye=P.results.length;we<Ye;++we)pe[we][Ce]=P.results[we];b(he.name).addKeys(pe)})),L.mutatedParts=On(L.mutatedParts||{},O),P})}}),S={get:function(w){return[f,new De(w.key)]},getMany:function(w){return[f,new De().addKeys(w.keys)]},count:o,query:o,openCursor:o};return R(S).forEach(function(w){v[w]=function(b){var k=ie.subscr,_=!!k,I=Ri(ie,l)&&Li(w,b)?b.obsSet={}:k;if(_){var L,k=function(q){return q="idb://".concat(t,"/").concat(r,"/").concat(q),I[q]||(I[q]=new De)},O=k(""),D=k(":dels"),_=S[w](b),z=_[0],_=_[1];if((w==="query"&&z.isPrimaryKey&&!b.values?D:k(z.name||"")).add(_),!z.isPrimaryKey){if(w!=="count")return L=w==="query"&&y&&b.values&&l.query(c(c({},b),{values:!1})),l[w].apply(this,arguments).then(function(q){if(w==="query"){if(y&&b.values)return L.then(function(pe){return pe=pe.result,O.addKeys(pe),q});var ne=b.values?q.result.map(E):q.result;(b.values?O:D).addKeys(ne)}else{var P,he;if(w==="openCursor")return he=b.values,(P=q)&&Object.create(P,{key:{get:function(){return D.addKey(P.primaryKey),P.key}},primaryKey:{get:function(){var pe=P.primaryKey;return D.addKey(pe),pe}},value:{get:function(){return he&&O.addKey(P.primaryKey),P.value}}})}return q});D.add(n)}}return l[w].apply(this,arguments)}}),v}})}};function Ui(e,t,n){var r;return n.numFailures===0?t:t.type==="deleteRange"||(r=t.keys?t.keys.length:"values"in t&&t.values?t.values.length:1,n.numFailures===r)?null:(r=c({},t),T(r.keys)&&(r.keys=r.keys.filter(function(o,l){return!(l in n.failures)})),"values"in r&&T(r.values)&&(r.values=r.values.filter(function(o,l){return!(l in n.failures)})),r)}function Ar(e,t){return n=e,((r=t).lower===void 0||(r.lowerOpen?0<Se(n,r.lower):0<=Se(n,r.lower)))&&(n=e,(r=t).upper===void 0||(r.upperOpen?Se(n,r.upper)<0:Se(n,r.upper)<=0));var n,r}function Ai(e,t,n,r,o,l){var u,f,C,E,y,g,v;return!n||n.length===0||(u=t.query.index,f=u.multiEntry,C=t.query.range,E=r.schema.primaryKey.extractKey,y=u.extractKey,g=(u.lowLevelIndex||u).extractKey,(r=n.reduce(function(S,w){var b=S,k=[];if(w.type==="add"||w.type==="put")for(var _=new De,I=w.values.length-1;0<=I;--I){var L,O=w.values[I],D=E(O);!_.hasKey(D)&&(L=y(O),f&&T(L)?L.some(function(ne){return Ar(ne,C)}):Ar(L,C))&&(_.addKey(D),k.push(O))}switch(w.type){case"add":var z=new De().addKeys(t.values?S.map(function(P){return E(P)}):S),b=S.concat(t.values?k.filter(function(P){return P=E(P),!z.hasKey(P)&&(z.addKey(P),!0)}):k.map(function(P){return E(P)}).filter(function(P){return!z.hasKey(P)&&(z.addKey(P),!0)}));break;case"put":var j=new De().addKeys(w.values.map(function(P){return E(P)}));b=S.filter(function(P){return!j.hasKey(t.values?E(P):P)}).concat(t.values?k:k.map(function(P){return E(P)}));break;case"delete":var te=new De().addKeys(w.keys);b=S.filter(function(P){return!te.hasKey(t.values?E(P):P)});break;case"deleteRange":var q=w.range;b=S.filter(function(P){return!Ar(E(P),q)})}return b},e))===e)?e:(v=function(S,w){return Se(g(S),g(w))||Se(E(S),E(w))},r.sort(t.direction==="prev"||t.direction==="prevunique"?function(S,w){return v(w,S)}:v),t.limit&&t.limit<1/0&&(r.length>t.limit?r.length=t.limit:e.length===t.limit&&r.length<t.limit&&(o.dirty=!0)),l?Object.freeze(r):r)}function Bi(e,t){return Se(e.lower,t.lower)===0&&Se(e.upper,t.upper)===0&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function hl(e,t){return((n,r,o,l)=>{if(n===void 0)return r!==void 0?-1:0;if(r===void 0)return 1;if((n=Se(n,r))===0){if(o&&l)return 0;if(o)return 1;if(l)return-1}return n})(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=((n,r,o,l)=>{if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;if((n=Se(n,r))===0){if(o&&l)return 0;if(o)return-1;if(l)return 1}return n})(e.upper,t.upper,e.upperOpen,t.upperOpen)}function pl(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",function(){var o,l;e.subscribers.delete(n),e.subscribers.size===0&&(o=e,l=t,setTimeout(function(){o.subscribers.size===0&&ke(l,o)},3e3))})}var ml={stack:"dbcore",level:0,name:"Cache",create:function(e){var t=e.schema.name;return c(c({},e),{transaction:function(n,r,o){var l,u,f=e.transaction(n,r,o);return r==="readwrite"&&(o=(l=new AbortController).signal,f.addEventListener("abort",(u=function(C){return function(){if(l.abort(),r==="readwrite"){for(var E=new Set,y=0,g=n;y<g.length;y++){var v=g[y],S=Tt["idb://".concat(t,"/").concat(v)];if(S){var w=e.table(v),b=S.optimisticOps.filter(function(P){return P.trans===f});if(f._explicit&&C&&f.mutatedParts)for(var k=0,_=Object.values(S.queries.query);k<_.length;k++)for(var I=0,L=(z=_[k]).slice();I<L.length;I++)_r((j=L[I]).obsSet,f.mutatedParts)&&(ke(z,j),j.subscribers.forEach(function(P){return E.add(P)}));else if(0<b.length){S.optimisticOps=S.optimisticOps.filter(function(P){return P.trans!==f});for(var O=0,D=Object.values(S.queries.query);O<D.length;O++)for(var z,j,te,q=0,ne=(z=D[O]).slice();q<ne.length;q++)(j=ne[q]).res!=null&&f.mutatedParts&&(C&&!j.dirty?(te=Object.isFrozen(j.res),te=Ai(j.res,j.req,b,w,j,te),j.dirty?(ke(z,j),j.subscribers.forEach(function(P){return E.add(P)})):te!==j.res&&(j.res=te,j.promise=X.resolve({result:te}))):(j.dirty&&ke(z,j),j.subscribers.forEach(function(P){return E.add(P)})))}}}E.forEach(function(P){return P()})}}})(!1),{signal:o}),f.addEventListener("error",u(!1),{signal:o}),f.addEventListener("complete",u(!0),{signal:o})),f},table:function(n){var r=e.table(n),o=r.schema.primaryKey;return c(c({},r),{mutate:function(l){var u,f=ie.trans;return!o.outbound&&f.db._options.cache!=="disabled"&&!f.explicit&&f.idbtrans.mode==="readwrite"&&(u=Tt["idb://".concat(t,"/").concat(n)])?(f=r.mutate(l),l.type!=="add"&&l.type!=="put"||!(50<=l.values.length||Ur(o,l).some(function(C){return C==null}))?(u.optimisticOps.push(l),l.mutatedParts&&Pn(l.mutatedParts),f.then(function(C){0<C.numFailures&&(ke(u.optimisticOps,l),(C=Ui(0,l,C))&&u.optimisticOps.push(C),l.mutatedParts)&&Pn(l.mutatedParts)}),f.catch(function(){ke(u.optimisticOps,l),l.mutatedParts&&Pn(l.mutatedParts)})):f.then(function(C){var E=Ui(0,c(c({},l),{values:l.values.map(function(y,g){var v;return C.failures[g]?y:(M(v=(v=o.keyPath)!=null&&v.includes(".")?ee(y):c({},y),o.keyPath,C.results[g]),v)})}),C);u.optimisticOps.push(E),queueMicrotask(function(){return l.mutatedParts&&Pn(l.mutatedParts)})}),f):r.mutate(l)},query:function(l){var u,f,C,E,y,g,v;return Ri(ie,r)&&Li("query",l)?(u=((C=ie.trans)==null?void 0:C.db._options.cache)==="immutable",f=(C=ie).requery,C=C.signal,g=((S,w,b,k)=>{var _=Tt["idb://".concat(S,"/").concat(w)];if(!_)return[];if(!(S=_.queries[b]))return[null,!1,_,null];var I=S[(k.query?k.query.index.name:null)||""];if(!I)return[null,!1,_,null];switch(b){case"query":var L=(O=k.direction)!=null?O:"next",O=I.find(function(D){var z;return D.req.limit===k.limit&&D.req.values===k.values&&((z=D.req.direction)!=null?z:"next")===L&&Bi(D.req.query.range,k.query.range)});return O?[O,!0,_,I]:[I.find(function(D){var z;return("limit"in D.req?D.req.limit:1/0)>=k.limit&&((z=D.req.direction)!=null?z:"next")===L&&(!k.values||D.req.values)&&hl(D.req.query.range,k.query.range)}),!1,_,I];case"count":return O=I.find(function(D){return Bi(D.req.query.range,k.query.range)}),[O,!!O,_,I]}})(t,n,"query",l),v=g[0],E=g[2],y=g[3],v&&g[1]?v.obsSet=l.obsSet:(g=r.query(l).then(function(S){var w=S.result;if(v&&(v.res=w),u){for(var b=0,k=w.length;b<k;++b)Object.freeze(w[b]);Object.freeze(w)}return S}).catch(function(S){return y&&v&&ke(y,v),Promise.reject(S)}),v={obsSet:l.obsSet,promise:g,subscribers:new Set,type:"query",req:l,dirty:!1},y?y.push(v):(y=[v],(E=E||(Tt["idb://".concat(t,"/").concat(n)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[l.query.index.name||""]=y)),pl(v,y,f,C),v.promise.then(function(S){return S=Ai(S.result,l,E?.optimisticOps,r,v,u),{result:u?S:ee(S)}})):r.query(l)}})}})}};function Kn(e,t){return new Proxy(e,{get:function(n,r,o){return r==="db"?t:Reflect.get(n,r,o)}})}Ae.prototype.version=function(e){if(isNaN(e)||e<.1)throw new se.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new se.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter(function(r){return r._cfg.version===e})[0];return n||(n=new this.Version(e),t.push(n),t.sort(il),n.stores({}),this._state.autoSchema=!1),n},Ae.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||ie.letThrough||this._vip)?e():new X(function(n,r){if(t._state.openComplete)return r(new se.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void r(new se.DatabaseClosed);t.open().catch(Te)}t._state.dbReadyPromise.then(n,r)}).then(e)},Ae.prototype.use=function(o){var t=o.stack,n=o.create,r=o.level,o=o.name,l=(o&&this.unuse({stack:t,name:o}),this._middlewares[t]||(this._middlewares[t]=[]));return l.push({stack:t,create:n,level:r??10,name:o}),l.sort(function(u,f){return u.level-f.level}),this},Ae.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(o){return r?o.create!==r:!!n&&o.name!==n})),this},Ae.prototype.open=function(){var e=this;return Et(lt,function(){return ll(e)})},Ae.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var e=this._state;if(rn.remove(this),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new X(function(t){e.dbReadyResolve=t}),e.openCanceller=new X(function(t,n){e.cancelOpen=n}))},Ae.prototype.close=function(t){var t=(t===void 0?{disableAutoOpen:!0}:t).disableAutoOpen,n=this._state;t?(n.isBeingOpened&&n.cancelOpen(new se.DatabaseClosed),this._close(),n.autoOpen=!1,n.dbOpenError=new se.DatabaseClosed):(this._close(),n.autoOpen=this._options.autoOpen||n.isBeingOpened,n.openComplete=!1,n.dbOpenError=null)},Ae.prototype.delete=function(e){var t=this,n=(e===void 0&&(e={disableAutoOpen:!0}),0<arguments.length&&typeof arguments[0]!="object"),r=this._state;return new X(function(o,l){function u(){t.close(e);var f=t._deps.indexedDB.deleteDatabase(t.name);f.onsuccess=Re(function(){var C,E,y;C=t._deps,E=t.name,Sr(y=C.indexedDB)||E===En||kr(y,C.IDBKeyRange).delete(E).catch(Te),o()}),f.onerror=Je(l),f.onblocked=t._fireOnBlocked}if(n)throw new se.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(u):u()})},Ae.prototype.backendDB=function(){return this.idbdb},Ae.prototype.isOpen=function(){return this.idbdb!==null},Ae.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"},Ae.prototype.hasFailed=function(){return this._state.dbOpenError!==null},Ae.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Ae.prototype,"tables",{get:function(){var e=this;return R(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!1,configurable:!0}),Ae.prototype.transaction=function(){var e=(function(t,n,r){var o=arguments.length;if(o<2)throw new se.InvalidArgument("Too few arguments");for(var l=new Array(o-1);--o;)l[o-1]=arguments[o];return r=l.pop(),[t,ae(l),r]}).apply(this,arguments);return this._transaction.apply(this,e)},Ae.prototype._transaction=function(e,t,n){var r,o,l=this,u=ie.trans,f=(u&&u.db===this&&e.indexOf("!")===-1||(u=null),e.indexOf("?")!==-1);e=e.replace("!","").replace("?","");try{if(o=t.map(function(E){if(E=E instanceof l.Table?E.name:E,typeof E!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return E}),e=="r"||e===dr)r=dr;else{if(e!="rw"&&e!=fr)throw new se.InvalidArgument("Invalid transaction mode: "+e);r=fr}if(u){if(u.mode===dr&&r===fr){if(!f)throw new se.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");u=null}u&&o.forEach(function(E){if(u&&u.storeNames.indexOf(E)===-1){if(!f)throw new se.SubTransaction("Table "+E+" not included in parent transaction.");u=null}}),f&&u&&!u.active&&(u=null)}}catch(E){return u?u._promise(null,function(y,g){g(E)}):Ue(E)}var C=(function E(y,g,v,S,w){return X.resolve().then(function(){var I=ie.transless||ie,b=y._createTransaction(g,v,y._dbSchema,S),I=(b.explicit=!0,{trans:b,transless:I});if(S)b.idbtrans=S.idbtrans;else try{b.create(),b.idbtrans._explicit=!0,y._state.PR1398_maxLoop=3}catch(L){return L.name===tr.InvalidState&&y.isOpen()&&0<--y._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),y.close({disableAutoOpen:!1}),y.open().then(function(){return E(y,g,v,null,w)})):Ue(L)}var k,_=pn(w),I=(_&&Dt(),X.follow(function(){var L;(k=w.call(b,b))&&(_?(L=ht.bind(null,null),k.then(L,L)):typeof k.next=="function"&&typeof k.throw=="function"&&(k=Rr(k)))},I));return(k&&typeof k.then=="function"?X.resolve(k).then(function(L){return b.active?L:Ue(new se.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):I.then(function(){return k})).then(function(L){return S&&b._resolve(),b._completion.then(function(){return L})}).catch(function(L){return b._reject(L),Ue(L)})})}).bind(null,this,r,o,u,n);return u?u._promise(r,C,"lock"):ie.trans?Et(ie.transless,function(){return l._whenReady(C)}):this._whenReady(C)},Ae.prototype.table=function(e){if(U(this._allTables,e))return this._allTables[e];throw new se.InvalidTable("Table ".concat(e," does not exist"))};var ut=Ae;function Ae(e,t){var n,r,o,l,u,f=this,C=(this._middlewares={},this.verno=0,Ae.dependencies),C=(this._options=t=c({addons:Ae.addons,autoOpen:!0,indexedDB:C.indexedDB,IDBKeyRange:C.IDBKeyRange,cache:"cloned",maxConnections:1e3},t),this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange},t.addons),E=(this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this,{dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Te,dbReadyPromise:null,cancelOpen:Te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:t.autoOpen}),y=(E.dbReadyPromise=new X(function(g){E.dbReadyResolve=g}),E.openCanceller=new X(function(g,v){E.cancelOpen=v}),this._state=E,this.name=e,this.on=Xt(this,"populate","blocked","versionchange","close",{ready:[nr,Te]}),this.once=function(g,v){var S=function(){for(var w=[],b=0;b<arguments.length;b++)w[b]=arguments[b];f.on(g).unsubscribe(S),v.apply(f,w)};return f.on(g,S)},this.on.ready.subscribe=ce(this.on.ready.subscribe,function(g){return function(v,S){Ae.vip(function(){var w,b=f._state;b.openComplete?(b.dbOpenError||X.resolve().then(v),S&&g(v)):b.onReadyBeingFired?(b.onReadyBeingFired.push(v),S&&g(v)):(g(v),w=f,S||g(function k(){w.on.ready.unsubscribe(v),w.on.ready.unsubscribe(k)}))})}}),this.Collection=(n=this,Qt(Js.prototype,function(k,b){this.db=n;var S=ci,w=null;if(b)try{S=b()}catch(I){w=I}var b=k._ctx,k=b.table,_=k.hook.reading.fire;this._ctx={table:k,index:b.index,isPrimKey:!b.index||k.schema.primKey.keyPath&&b.index===k.schema.primKey.name,range:S,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:w,or:b.or,valueMapper:_!==Ht?_:null}})),this.Table=(r=this,Qt(mi.prototype,function(g,v,S){this.db=r,this._tx=S,this.name=g,this.schema=v,this.hook=r._allTables[g]?r._allTables[g].hook:Xt(null,{creating:[js,Te],reading:[$s,Ht],updating:[Gs,Te],deleting:[Fs,Te]})})),this.Transaction=(o=this,Qt(el.prototype,function(g,v,S,w,b){var k=this;g!=="readonly"&&v.forEach(function(_){_=(_=S[_])==null?void 0:_.yProps,_&&(v=v.concat(_.map(function(I){return I.updatesTable})))}),this.db=o,this.mode=g,this.storeNames=v,this.schema=S,this.chromeTransactionDurability=w,this.idbtrans=null,this.on=Xt(this,"complete","error","abort"),this.parent=b||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new X(function(_,I){k._resolve=_,k._reject=I}),this._completion.then(function(){k.active=!1,k.on.complete.fire()},function(_){var I=k.active;return k.active=!1,k.on.error.fire(_),k.parent?k.parent._reject(_):I&&k.idbtrans&&k.idbtrans.abort(),Ue(_)})})),this.Version=(l=this,Qt(sl.prototype,function(g){this.db=l,this._cfg={version:g,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(u=this,Qt(bi.prototype,function(g,v,S){if(this.db=u,this._ctx={table:g,index:v===":id"?null:v,or:S},this._cmp=this._ascending=Se,this._descending=function(w,b){return Se(b,w)},this._max=function(w,b){return 0<Se(w,b)?w:b},this._min=function(w,b){return Se(w,b)<0?w:b},this._IDBKeyRange=u._deps.IDBKeyRange,!this._IDBKeyRange)throw new se.MissingAPI})),this.on("versionchange",function(g){0<g.newVersion?console.warn("Another connection wants to upgrade database '".concat(f.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(f.name,"'. Closing db now to resume the delete request.")),f.close({disableAutoOpen:!1})}),this.on("blocked",function(g){!g.newVersion||g.newVersion<g.oldVersion?console.warn("Dexie.delete('".concat(f.name,"') was blocked")):console.warn("Upgrade '".concat(f.name,"' blocked by other connection holding version ").concat(g.oldVersion/10))}),this._maxKey=tn(t.IDBKeyRange),this._createTransaction=function(g,v,S,w){return new f.Transaction(g,v,S,f._options.chromeTransactionDurability,w)},this._fireOnBlocked=function(g){f.on("blocked").fire(g),rn.toArray().filter(function(v){return v.name===f.name&&v!==f&&!v._state.vcFired}).map(function(v){return v.on("versionchange").fire(g)})},this.use(dl),this.use(ml),this.use(fl),this.use(cl),this.use(ul),new Proxy(this,{get:function(g,v,S){var w;return v==="_vip"||(v==="table"?function(b){return Kn(f.table(b),y)}:(w=Reflect.get(g,v,S))instanceof mi?Kn(w,y):v==="tables"?w.map(function(b){return Kn(b,y)}):v==="_createTransaction"?function(){return Kn(w.apply(this,arguments),y)}:w)}}));this.vip=y,C.forEach(function(g){return g(f)})}var $n,Ft=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",gl=(Br.prototype.subscribe=function(e,t,n){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:t,complete:n})},Br.prototype[Ft]=function(){return this},Br);function Br(e){this._subscribe=e}try{$n={indexedDB:m.indexedDB||m.mozIndexedDB||m.webkitIndexedDB||m.msIndexedDB,IDBKeyRange:m.IDBKeyRange||m.webkitIDBKeyRange}}catch{$n={indexedDB:null,IDBKeyRange:null}}function xi(e){var t,n=!1,r=new gl(function(o){var l=pn(e),u,f=!1,C={},E={},y={get closed(){return f},unsubscribe:function(){f||(f=!0,u&&u.abort(),g&&gt.storagemutated.unsubscribe(w))}},g=(o.start&&o.start(y),!1),v=function(){return ur(b)};function S(){return _r(E,C)}var w=function(k){On(C,k),S()&&v()},b=function(){var k,_,I;!f&&$n.indexedDB&&(C={},k={},u&&u.abort(),u=new AbortController,I=(L=>{var O=Ot();try{l&&Dt();var D=ft(e,L);return D=l?D.finally(ht):D}finally{O&&Pt()}})(_={subscr:k,signal:u.signal,requery:v,querier:e,trans:null}),g||(gt.storagemutated.subscribe(w),g=!0),Promise.resolve(I).then(function(L){n=!0,t=L,f||_.signal.aborted||(S()||(E=k,S())?v():(C={},ur(function(){return!f&&o.next&&o.next(L)})))},function(L){n=!1,["DatabaseClosedError","AbortError"].includes(L?.name)||f||ur(function(){f||o.error&&o.error(L)})}))};return setTimeout(v,0),y});return r.hasValue=function(){return n},r.getValue=function(){return t},r}var Vt=ut;function xr(e){var t=Ct;try{Ct=!0,gt.storagemutated.fire(e),Mr(e,!0)}finally{Ct=t}}H(Vt,c(c({},rt),{delete:function(e){return new Vt(e,{addons:[]}).delete()},exists:function(e){return new Vt(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return t=Vt.dependencies,n=t.indexedDB,t=t.IDBKeyRange,(Sr(n)?Promise.resolve(n.databases()).then(function(r){return r.map(function(o){return o.name}).filter(function(o){return o!==En})}):kr(n,t).toCollection().primaryKeys()).then(e)}catch{return Ue(new se.MissingAPI)}var t,n},defineClass:function(){return function(e){V(this,e)}},ignoreTransaction:function(e){return ie.trans?Et(ie.transless||lt,e):e()},vip:Er,async:function(e){return function(){try{var t=Rr(e.apply(this,arguments));return t&&typeof t.then=="function"?t:X.resolve(t)}catch(n){return Ue(n)}}},spawn:function(e,t,n){try{var r=Rr(e.apply(n,t||[]));return r&&typeof r.then=="function"?r:X.resolve(r)}catch(o){return Ue(o)}},currentTransaction:{get:function(){return ie.trans||null}},waitFor:function(e,t){return e=X.resolve(typeof e=="function"?Vt.ignoreTransaction(e):e).timeout(t||6e4),ie.trans?ie.trans.waitFor(e):e},Promise:X,debug:{get:function(){return it},set:function(e){ni(e)}},derive:G,extend:V,props:H,override:ce,Events:Xt,on:gt,liveQuery:xi,extendObservabilitySet:On,getByKeyPath:oe,setByKeyPath:M,delByKeyPath:function(e,t){typeof t=="string"?M(e,t,void 0):"length"in t&&[].map.call(t,function(n){M(e,n,void 0)})},shallowClone:$,deepClone:ee,getObjectDiff:Lr,cmp:Se,asap:de,minKey:-1/0,addons:[],connections:{get:rn.toArray},errnames:tr,dependencies:$n,cache:Tt,semVer:"4.4.4",version:"4.4.4".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),Vt.maxKey=tn(Vt.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(gt(Rn,function(e){Ct||(e=new CustomEvent(mr,{detail:e}),Ct=!0,dispatchEvent(e),Ct=!1)}),addEventListener(mr,function(e){e=e.detail,Ct||xr(e)}));var Gt,Ct=!1,Ni=function(){};return typeof BroadcastChannel<"u"&&((Ni=function(){(Gt=new BroadcastChannel(mr)).onmessage=function(e){return e.data&&xr(e.data)}})(),typeof Gt.unref=="function"&&Gt.unref(),gt(Rn,function(e){Ct||Gt.postMessage(e)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(e){if(!ut.disableBfCache&&e.persisted){it&&console.debug("Dexie: handling persisted pagehide"),Gt?.close();for(var t=0,n=rn.toArray();t<n.length;t++)n[t].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!ut.disableBfCache&&e.persisted&&(it&&console.debug("Dexie: handling persisted pageshow"),Ni(),xr({all:new De(-1/0,[[]])}))})),X.rejectionMapper=function(e,t){return!e||e instanceof ze||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ti[e.name]?e:(t=new ti[e.name](t||e.message,e),"stack"in e&&N(t,"stack",{get:function(){return this.inner.stack}}),t)},ni(it),c(ut,Object.freeze({__proto__:null,DEFAULT_MAX_CONNECTIONS:1e3,Dexie:ut,Entity:ui,PropModification:Jt,RangeSet:De,add:function(e){return new Jt({add:e})},cmp:Se,default:ut,liveQuery:xi,mergeRanges:on,rangesOverlap:Ii,remove:function(e){return new Jt({remove:e})},replacePrefix:function(e,t){return new Jt({replacePrefix:[e,t]})}}),{default:ut}),ut})})(ln)),ln.exports}var Fi=ji();const Fn=Ki(Fi),Pr=Symbol.for("Dexie"),cn=globalThis[Pr]||(globalThis[Pr]=Fn);if(Fn.semVer!==cn.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${Fn.semVer} and ${cn.semVer}`);const{liveQuery:Cl,mergeRanges:vl,rangesOverlap:yl,RangeSet:bl,cmp:wl,Entity:kl,PropModification:Sl,replacePrefix:El,add:Il,remove:_l,DexieYProvider:Tl}=cn,Gi=400;class qi extends cn{logs;constructor(){super("CallKitLogDB"),this.version(1).stores({logs:"++id, timestamp, sessionId, category, [sessionId+timestamp]"})}async write(a,s=20){try{await this.logs.add(a),this.enforceSizeLimit(s).catch(()=>{})}catch{}}async enforceSizeLimit(a){if(a<=0)return;const s=Math.floor(a*1024*1024/Gi),c=await this.logs.count();if(c>s){const p=c-s,m=await this.logs.orderBy("timestamp").limit(p).primaryKeys();await this.logs.bulkDelete(m)}}async exportBySession(a,s=2e3){return this.logs.where("sessionId").equals(a).limit(s).sortBy("timestamp")}async exportByTimeRange(a,s,c=5e3){return this.logs.where("timestamp").between(a,s).limit(c).sortBy("timestamp")}async exportAll(a=5e3){return this.logs.orderBy("timestamp").reverse().limit(a).toArray()}async clearBefore(a=7){const s=Date.now()-a*864e5;return this.logs.where("timestamp").below(s).delete()}async clearBySession(a){return this.logs.where("sessionId").equals(a).delete()}async getSessions(a=50){const s=await this.logs.where("sessionId").notEqual("").reverse().limit(a*10).toArray(),c=new Set;return s.forEach(p=>p.sessionId&&c.add(p.sessionId)),Array.from(c).slice(0,a)}}const le={ERROR:0,WARN:1,INFO:2,DEBUG:3,VERBOSE:4},Lt={RESET:"\x1B[0m",RED:"\x1B[31m",YELLOW:"\x1B[33m",GREEN:"\x1B[32m",BLUE:"\x1B[34m",GRAY:"\x1B[90m"},Gn={[le.ERROR]:"ERROR",[le.WARN]:"WARN",[le.INFO]:"INFO",[le.DEBUG]:"DEBUG",[le.VERBOSE]:"VERBOSE"},Hi={[le.ERROR]:Lt.RED,[le.WARN]:Lt.YELLOW,[le.INFO]:Lt.GREEN,[le.DEBUG]:Lt.BLUE,[le.VERBOSE]:Lt.GRAY};class ot{static instance;config;db=null;sessionId;constructor(a={}){this.config={level:le.ERROR,enableConsole:!0,enablePrefix:!0,prefix:"[Vue3 CallKit]",enableIDB:!1,idbLevel:le.VERBOSE,idbRetentionDays:7,idbMaxSizeMB:20,...a},this.config.debug!==void 0&&this.setDebug(this.config.debug),this.config.enableIDB&&this.initDB()}static getInstance(a){return ot.instance?a&&ot.instance.updateConfig(a):ot.instance=new ot(a),ot.instance}updateConfig(a){const s=this.config.enableIDB;this.config={...this.config,...a},a.debug!==void 0&&this.setDebug(a.debug),a.enableIDB!==void 0&&a.enableIDB!==s&&(a.enableIDB?this.initDB():this.db=null)}setDebug(a){this.config.debug=a,this.config.level=a?le.VERBOSE:le.ERROR}getConfig(){return{...this.config}}setLevel(a){this.config.level=a}setConsoleEnabled(a){this.config.enableConsole=a}setPrefixEnabled(a){this.config.enablePrefix=a}setPrefix(a){this.config.prefix=a}setIDBEnabled(a){this.updateConfig({enableIDB:a})}setIDBLevel(a){this.config.idbLevel=a}setSessionId(a){this.sessionId=a}getSessionId(){return this.sessionId}shouldLog(a){return a<=this.config.level}shouldWriteToIDB(a){return!!(this.config.enableIDB&&a<=(this.config.idbLevel??le.VERBOSE))}formatMessage(a,s,...c){const p=new Date().toISOString(),m=Gn[a],R=Hi[a];let T="";return this.config.enablePrefix&&(T+=`${this.config.prefix} `),T+=`[${p}] ${R}[${m}]${Lt.RESET} ${s}`,T}initDB(){if(!this.db)try{this.db=new qi,this.db.clearBefore(this.config.idbRetentionDays??7).catch(()=>{})}catch{this.db=null}}extractMeta(a){if(a.length!==0)return a.length===1&&a[0]!==null&&typeof a[0]=="object"&&!(a[0]instanceof Error)?a[0]:{args:a}}writeToIDB(a,s,c,p,m){!this.db||!this.shouldWriteToIDB(a)||this.db.write({timestamp:Date.now(),level:a,category:s,tag:c,message:p,sessionId:this.sessionId,meta:m},this.config.idbMaxSizeMB).catch(()=>{})}error(a,...s){if(this.shouldLog(le.ERROR)){const c=this.formatMessage(le.ERROR,a);this.config.enableConsole&&console.error(c,...s)}this.writeToIDB(le.ERROR,"error","[ERROR]",a,this.extractMeta(s))}warn(a,...s){if(this.shouldLog(le.WARN)){const c=this.formatMessage(le.WARN,a);this.config.enableConsole&&console.warn(c,...s)}this.writeToIDB(le.WARN,"general","[WARN]",a,this.extractMeta(s))}info(a,...s){if(this.shouldLog(le.INFO)){const c=this.formatMessage(le.INFO,a);this.config.enableConsole&&console.info(c,...s)}this.writeToIDB(le.INFO,"general","[INFO]",a,this.extractMeta(s))}debug(a,...s){if(this.shouldLog(le.DEBUG)){const c=this.formatMessage(le.DEBUG,a);this.config.enableConsole&&console.log(c,...s)}this.writeToIDB(le.DEBUG,"general","[DEBUG]",a,this.extractMeta(s))}verbose(a,...s){if(this.shouldLog(le.VERBOSE)){const c=this.formatMessage(le.VERBOSE,a);this.config.enableConsole&&console.log(c,...s)}this.writeToIDB(le.VERBOSE,"general","[VERBOSE]",a,this.extractMeta(s))}log(a,...s){if(this.config.enableConsole){const c=this.formatMessage(le.INFO,a);console.log(c,...s)}this.writeToIDB(le.INFO,"general","[LOG]",a,this.extractMeta(s))}console(a,...s){if(this.config.enableConsole){const c=this.formatMessage(le.INFO,a);console.log(c,...s)}this.writeToIDB(le.INFO,"general","[CONSOLE]",a,this.extractMeta(s))}getCurrentLevelName(){return Gn[this.config.level]}isLevelEnabled(a){return this.shouldLog(a)}signal(a,s,c){const p=`[SIG:${a}] ${s}`;this.shouldLog(le.INFO)&&this.config.enableConsole&&console.info(this.formatMessage(le.INFO,p),c),this.writeToIDB(le.INFO,"signal",`[SIG:${a}]`,s,c)}stateChange(a,s,c){const p=`[STATE] ${a} -> ${s}`;this.shouldLog(le.INFO)&&this.config.enableConsole&&console.info(this.formatMessage(le.INFO,p),c),this.writeToIDB(le.INFO,"state","[STATE]",`${a} -> ${s}`,c)}rtc(a,s){const c=`[RTC] ${a}`;this.shouldLog(le.INFO)&&this.config.enableConsole&&console.info(this.formatMessage(le.INFO,c),s),this.writeToIDB(le.INFO,"rtc","[RTC]",a,s)}event(a,s){const c=`[EVENT] ${a}`;this.shouldLog(le.INFO)&&this.config.enableConsole&&console.info(this.formatMessage(le.INFO,c),s),this.writeToIDB(le.INFO,"event","[EVENT]",a,s)}exportLogsBySession(a){return this.db?a?this.db.exportBySession(a):this.db.exportAll():Promise.resolve([])}exportLogsByTimeRange(a,s){return this.db?this.db.exportByTimeRange(a,s):Promise.resolve([])}getSessions(){return this.db?.getSessions()??Promise.resolve([])}clearLogs(a){return this.db?this.db.clearBefore(a??this.config.idbRetentionDays??7):Promise.resolve(0)}async exportLogsAsJSON(a){const s=await this.exportLogsBySession(a);return JSON.stringify({exportTime:new Date().toISOString(),sessionId:a,userAgent:typeof navigator<"u"?navigator.userAgent:void 0,logs:s},null,2)}async exportLogsAsText(a){const s=await this.exportLogsBySession(a),c=[];c.push("# CallKit Log Export"),c.push(`# Time: ${this.formatReadableTime(Date.now())}`),c.push(`# Session: ${a||"ALL"}`),c.push(`# UserAgent: ${typeof navigator<"u"?navigator.userAgent:"unknown"}`),c.push(`# Total: ${s.length} entries`),c.push("");for(const p of s){const m=this.formatReadableTime(p.timestamp),R=Gn[p.level]??"UNKNOWN",T=p.tag||"",V=p.message||"";let B=`[${m}] [${R}] ${T} ${V}`;if(p.sessionId&&(B+=` | session=${p.sessionId}`),p.meta&&Object.keys(p.meta).length>0){const F=Object.entries(p.meta).map(([U,H])=>typeof H=="object"?`${U}=${JSON.stringify(H)}`:`${U}=${H}`).join(", ");B+=` | ${F}`}c.push(B)}return c.join(`
4
+ `)}formatReadableTime(a){const s=new Date(a),c=s.getFullYear(),p=String(s.getMonth()+1).padStart(2,"0"),m=String(s.getDate()).padStart(2,"0"),R=String(s.getHours()).padStart(2,"0"),T=String(s.getMinutes()).padStart(2,"0"),V=String(s.getSeconds()).padStart(2,"0"),B=String(s.getMilliseconds()).padStart(3,"0");return`${c}-${p}-${m} ${R}:${T}:${V}.${B}`}}const d=ot.getInstance();class Dr{client=null;appId="";agoraUid=0;localVideoTrack=null;localAudioTrack=null;remoteVideoTracks=new Map;remoteAudioTracks=new Map;localVideoStream=null;currentCameraDeviceId=null;encoderConfig="720p";isAudioEnabled=!0;isVideoEnabled=!0;chatClient=null;autoSubscribe=!0;isActive=!1;uidToUserIdMap=new Map;joinedRtcUsers=new Set;leftUsers=new Set;pendingUserIds=new Set;onNetworkQualityChange;onUserJoined;onUserLeft;onUserPublished;onUserUnpublished;onVolumeIndicator;onAudioEnabledChange;onVideoEnabledChange;onLocalStreamChange;constructor(a){this.appId=a.appId,this.client=a.client||null,this.encoderConfig=a.encoderConfig||"720p",this.chatClient=a.chatClient,this.onNetworkQualityChange=a.onNetworkQualityChange,this.onUserJoined=a.onUserJoined,this.onUserLeft=a.onUserLeft,this.onUserPublished=a.onUserPublished,this.onUserUnpublished=a.onUserUnpublished,this.onVolumeIndicator=a.onVolumeIndicator,this.onAudioEnabledChange=a.onAudioEnabledChange,this.onVideoEnabledChange=a.onVideoEnabledChange,this.onLocalStreamChange=a.onLocalStreamChange}async initialize(){try{sn.setLogLevel(4),this.client?(this.client.setClientRole("host"),this.addEventListeners(),d.info("RtcService initialized with external client")):(this.client=sn.createClient({mode:"live",codec:"h264"}),this.client.setClientRole("host"),this.addEventListeners(),d.info("RtcService initialized with new client"))}catch(a){throw d.error("RtcService initialization failed:",a),a}}setAppId(a){this.appId=a,d.debug("RtcService: appId 已更新为",a)}setAutoSubscribe(a){this.autoSubscribe=a,d.debug("RtcService: 自动订阅已",a?"开启":"关闭")}async joinChannel(a,s,c,p){if(!this.client)throw new Error("RTC client not initialized");p&&this.setAppId(p);try{this.isActive=!0;const m=typeof c=="string"?Number(c):c;return this.agoraUid=await this.client.join(this.appId,a,s,m),d.rtc("joinChannel",{channelName:a,uid:this.agoraUid,appId:this.appId}),this.agoraUid}catch(m){throw this.isActive=!1,d.error("Failed to join channel:",m),m}}async leaveChannel(){if(this.client){this.isActive=!1;try{if(this.localAudioTrack||this.localVideoTrack){const a=[];this.localAudioTrack&&a.push(this.localAudioTrack),this.localVideoTrack&&a.push(this.localVideoTrack),a.length>0&&this.client.connectionState==="CONNECTED"&&await this.client.unpublish(a)}await this.closeLocalTracks(),this.client.connectionState==="CONNECTED"&&await this.client.leave(),d.rtc("leaveChannel",{})}catch(a){throw d.error("Failed to leave channel:",a),a}finally{this.autoSubscribe=!0,d.debug("RtcService: 自动订阅已重置为开启")}}}async createAudioTrack(){try{if(this.localAudioTrack)return this.localAudioTrack;const a=await sn.createMicrophoneAudioTrack();if(!this.isActive)throw a.close(),new Error("RtcService became inactive during audio track creation");return this.localAudioTrack=a,this.onAudioEnabledChange?.(!0),d.rtc("createAudioTrack",{}),this.localAudioTrack}catch(a){throw d.error("Failed to create audio track:",a),a}}async createVideoTrack(){try{if(this.localVideoTrack)return this.localVideoTrack;const a=this.encoderConfig?{encoderConfig:this.encoderConfig}:void 0,s=await sn.createCameraVideoTrack(a);if(!this.isActive)throw s.close(),new Error("RtcService became inactive during video track creation");return this.localVideoTrack=s,this.onVideoEnabledChange?.(!0),this.localVideoStream=new MediaStream([this.localVideoTrack.getMediaStreamTrack()]),this.onLocalStreamChange?.(this.localVideoStream),d.rtc("createVideoTrack",{}),this.localVideoTrack}catch(a){throw d.error("Failed to create video track:",a),a}}async publishTracks(a){if(!this.client)throw new Error("RTC client not initialized");if(!this.isActive)throw new Error("RtcService is not active, cannot publish tracks");if(this.client.connectionState!=="CONNECTED")throw new Error(`RTC client not connected (state: ${this.client.connectionState}), cannot publish tracks`);try{await this.client.publish(a),d.rtc("publishTracks",{})}catch(s){throw d.error("Failed to publish tracks:",s),s}}async toggleAudio(a){try{return this.localAudioTrack?(await this.localAudioTrack.setEnabled(a),this.isAudioEnabled=a,this.onAudioEnabledChange?.(a),d.rtc("toggleAudio",{enabled:a}),a):(a&&(await this.createAudioTrack(),this.client&&this.client.connectionState==="CONNECTED"&&await this.client.publish([this.localAudioTrack])),this.isAudioEnabled=a,this.onAudioEnabledChange?.(a),a)}catch(s){return d.error("Failed to toggle audio:",s),this.isAudioEnabled}}async toggleVideo(a){try{if(!this.localVideoTrack)return a&&(await this.createVideoTrack(),this.client&&this.client.connectionState==="CONNECTED"&&!this.client.localTracks.some(p=>p.trackMediaType==="video")&&this.localVideoTrack&&(await this.client.publish([this.localVideoTrack]),d.info("Video track published"))),this.isVideoEnabled=a,this.onVideoEnabledChange?.(a),a;if(a)!this.localVideoTrack||this.localVideoTrack.getMediaStreamTrack()?.readyState!=="live"?(await this.createVideoTrack(),this.client&&this.client.connectionState==="CONNECTED"&&!this.client.localTracks.some(p=>p.trackMediaType==="video")&&this.localVideoTrack&&(await this.client.publish([this.localVideoTrack]),d.info("Video track re-published")),this.localVideoTrack&&(this.localVideoStream=new MediaStream([this.localVideoTrack.getMediaStreamTrack()]),this.onLocalStreamChange?.(this.localVideoStream),d.info("Local video stream updated after recreating track"))):await this.localVideoTrack.setEnabled(!0),this.isVideoEnabled=!0,this.onVideoEnabledChange?.(!0);else{if(this.client&&this.client.connectionState==="CONNECTED"&&this.localVideoTrack)try{await this.client.unpublish([this.localVideoTrack]),d.info("Video track unpublished")}catch(c){d.warn("Failed to unpublish video track:",c)}const s=this.localVideoTrack.getMediaStreamTrack();s&&s.stop(),this.localVideoTrack.close(),this.localVideoTrack=null,this.localVideoStream=null,this.onLocalStreamChange?.(null),this.isVideoEnabled=!1,this.onVideoEnabledChange?.(!1)}return d.rtc("toggleVideo",{enabled:a}),this.isVideoEnabled}catch(s){return d.error("Failed to toggle video:",s),this.isVideoEnabled}}async switchCamera(a){if(!this.localVideoTrack||!this.localVideoTrack.enabled)return d.warn("Cannot switch camera: video track not available or disabled"),!1;try{return await this.localVideoTrack.setDevice(a),this.currentCameraDeviceId=a,d.info("Camera switched to:",a),!0}catch(s){return d.error("Failed to switch camera:",s),!1}}async switchMicrophone(a){if(!this.localAudioTrack||!this.localAudioTrack.enabled)return d.warn("Cannot switch microphone: audio track not available or disabled"),!1;try{return await this.localAudioTrack.setDevice(a),d.info("Microphone switched to:",a),!0}catch(s){return d.error("Failed to switch microphone:",s),!1}}async subscribeRemoteUser(a,s){if(!this.client)throw new Error("RTC client not initialized");try{await this.client.subscribe(a,s);const c=typeof a=="object"?a.uid:a,p=this.client.remoteUsers.find(m=>m.uid===c||m.uid.toString()===c.toString());s==="video"&&p?.videoTrack?this.remoteVideoTracks.set(p.uid.toString(),p.videoTrack):s==="audio"&&p?.audioTrack&&(this.remoteAudioTracks.set(p.uid.toString(),p.audioTrack),p.audioTrack.play()),d.info("Subscribed to remote user:",{uid:c,mediaType:s})}catch(c){throw d.error("Failed to subscribe remote user:",c),c}}getLocalVideoStream(){return this.localVideoStream?this.localVideoStream:this.localVideoTrack?(this.localVideoStream=new MediaStream([this.localVideoTrack.getMediaStreamTrack()]),this.localVideoStream):null}getRemoteVideoTrack(a){if(this.remoteVideoTracks.has(a))return this.remoteVideoTracks.get(a)||null;for(const[s,c]of this.uidToUserIdMap.entries())if(c===a){const p=this.remoteVideoTracks.get(s);if(p)return p}return null}getRemoteAudioTrack(a){if(this.remoteAudioTracks.has(a))return this.remoteAudioTracks.get(a)||null;for(const[s,c]of this.uidToUserIdMap.entries())if(c===a){const p=this.remoteAudioTracks.get(s);if(p)return p}return null}getLocalVideoTrack(){return this.localVideoTrack}getLocalAudioTrack(){return this.localAudioTrack}isMuted(){return!this.isAudioEnabled}isCameraEnabled(){return this.isVideoEnabled}getClient(){return this.client}async closeLocalTracks(){if(this.localAudioTrack){const a=this.localAudioTrack.getMediaStreamTrack();a&&a.readyState==="live"&&a.stop(),this.localAudioTrack.close(),this.localAudioTrack=null}if(this.localVideoTrack){const a=this.localVideoTrack.getMediaStreamTrack();a&&a.stop(),this.localVideoTrack.close(),this.localVideoTrack=null}this.localVideoStream&&(this.localVideoStream.getTracks().forEach(a=>a.stop()),this.localVideoStream=null),this.onLocalStreamChange?.(null)}addEventListeners(){this.client&&(this.client.on("user-joined",async a=>{let s=this.uidToUserIdMap.get(a.uid.toString());if(!s){const c=this.popPendingUserId();c&&(s=c,this.uidToUserIdMap.set(a.uid.toString(),s),d.info("User-joined: 使用待加入列表匹配 userId:",{uid:a.uid,userId:s}))}if(!s&&this.chatClient)try{s=(await this.chatClient.getUserIdByRTCUIds([a.uid])).data[a.uid],s?(this.uidToUserIdMap.set(a.uid.toString(),s),d.info("User-joined: 通过API获取userId映射:",{uid:a.uid,userId:s})):d.warn("User-joined: API返回的userId为空:",a.uid)}catch(c){d.error("获取userId映射失败:",c)}s?(this.markUserJoinedRtc(s),d.info("[RTC DEBUG] 用户已标记为加入RTC:",{uid:a.uid,userId:s})):d.warn("User-joined: 未能获取userId映射,使用uid作为默认值:",a.uid),d.rtc("userJoined",{uid:a.uid,userId:s}),this.onUserJoined?.(s||a.uid.toString())}),this.client.on("user-left",(a,s)=>{const c=this.uidToUserIdMap.get(a.uid.toString());d.rtc("userLeft",{uid:a.uid,userId:c,reason:s}),this.remoteVideoTracks.delete(a.uid.toString()),this.remoteAudioTracks.delete(a.uid.toString()),c&&this.markUserLeftRtc(c),this.onUserLeft?.(c||a.uid.toString())}),this.client.on("user-published",async(a,s)=>{let c=this.uidToUserIdMap.get(a.uid.toString());if(!c&&this.chatClient)try{c=(await this.chatClient.getUserIdByRTCUIds([a.uid])).data[a.uid],c&&(this.uidToUserIdMap.set(a.uid.toString(),c),this.markUserJoinedRtc(c),d.info("[RTC DEBUG] user-published 时标记用户加入:",{uid:a.uid,userId:c,mediaType:s}))}catch(p){d.error("获取userId映射失败:",p)}if(d.rtc("userPublished",{uid:a.uid,userId:c,mediaType:s}),this.autoSubscribe)try{await this.subscribeRemoteUser(a.uid,s),d.info("自动订阅远程用户成功:",{uid:a.uid,userId:c,mediaType:s})}catch(p){d.error("自动订阅远程用户失败:",p)}this.onUserPublished?.(a,s)}),this.client.on("user-unpublished",(a,s)=>{const c=this.uidToUserIdMap.get(a.uid.toString());d.rtc("userUnpublished",{uid:a.uid,userId:c,mediaType:s}),s==="video"?this.remoteVideoTracks.delete(a.uid.toString()):s==="audio"&&this.remoteAudioTracks.delete(a.uid.toString()),this.onUserUnpublished?.(a,s)}),this.client.on("network-quality",a=>{this.onNetworkQualityChange?.(a)}),this.client.on("volume-indicator",a=>{this.onVolumeIndicator?.(a)}))}async unpublishTracks(a){if(!this.client)throw new Error("RTC client not initialized");try{await this.client.unpublish(a),d.rtc("unpublishTracks",{})}catch(s){throw d.error("Failed to unpublish tracks:",s),s}}async unsubscribeRemoteUser(a,s){if(!this.client)throw new Error("RTC client not initialized");try{await this.client.unsubscribe(a,s);const c=typeof a=="object"?a.uid:a;s==="video"?this.remoteVideoTracks.delete(c.toString()):this.remoteAudioTracks.delete(c.toString()),d.info("Unsubscribed remote user:",{uid:c,mediaType:s})}catch(c){throw d.error("Failed to unsubscribe remote user:",c),c}}setUidToUserIdMapping(a,s){this.uidToUserIdMap.set(a,s),d.debug("RTC UID映射已更新:",{uid:a,userId:s})}getUserIdByUid(a){return this.uidToUserIdMap.get(a)||null}markUserJoinedRtc(a){this.joinedRtcUsers.add(a),this.leftUsers.has(a)&&(this.leftUsers.delete(a),d.debug("用户重新加入RTC,从leftUsers中移除:",a)),d.debug("用户已加入RTC频道:",a)}markUserLeftRtc(a){this.joinedRtcUsers.delete(a),this.leftUsers.add(a),d.debug("用户已离开RTC频道并标记为leftUser:",a)}isUserInRtc(a){return this.joinedRtcUsers.has(a)}hasUserLeft(a){return this.leftUsers.has(a)}addPendingUserId(a){this.pendingUserIds.add(a),d.debug("用户已标记为待加入RTC:",a)}popPendingUserId(){const s=this.pendingUserIds.values().next();if(!s.done){const c=s.value;return this.pendingUserIds.delete(c),d.debug("从待加入列表中取出userId:",c),c}return null}resetUserState(){this.uidToUserIdMap.clear(),this.joinedRtcUsers.clear(),this.pendingUserIds.clear(),this.leftUsers.clear(),d.debug("RtcService 用户状态已重置")}async destroy(){try{await this.leaveChannel(),this.remoteVideoTracks.forEach((a,s)=>{try{a.stop(),d.debug("远程视频轨道已停止:",s)}catch(c){d.warn("停止远程视频轨道失败:",c)}}),this.remoteVideoTracks.clear(),this.remoteAudioTracks.forEach((a,s)=>{try{a.stop(),d.debug("远程音频轨道已停止:",s)}catch(c){d.warn("停止远程音频轨道失败:",c)}}),this.remoteAudioTracks.clear(),this.client&&(this.client.removeAllListeners(),this.client=null),this.isAudioEnabled=!0,this.isVideoEnabled=!0,this.agoraUid=0,this.currentCameraDeviceId=null,this.resetUserState(),d.rtc("destroy",{})}catch(a){d.error("Failed to destroy RtcService:",a)}}}const Xe=Rt.defineStore("chatClient",{state:()=>({client:null,isMiniCore:!1}),actions:{setClient(h){this.client=h},setIsMiniCore(h){this.isMiniCore=h}},getters:{getChatClient:h=>h.client,getClientDeviceId:h=>h.client?.context.jid.clientResource,getIsMiniCore:h=>h.isMiniCore}});let Ut=null;const Be=Rt.defineStore("rtcChannel",{state:()=>({isConnected:!1,localStream:null,audioEnabled:!0,videoEnabled:!0,agoraAppId:null}),actions:{getRtcService(){return Ut},async initializeRtcService(h,a){if(Ut){d.warn("RTC服务已经初始化,无需重复初始化");return}try{d.info("初始化RTC服务..."),this.agoraAppId=h;const c=Xe().getChatClient,p=new Dr({appId:h,client:a,chatClient:c,onAudioEnabledChange:m=>this.setAudioEnabled(m),onVideoEnabledChange:m=>this.setVideoEnabled(m),onLocalStreamChange:m=>this.setLocalStream(m)});await p.initialize(),Ut=p,d.info("RTC服务初始化成功")}catch(s){throw d.error("RTC服务初始化失败:",s),s}},async destroyRtcService(){Ut&&(d.info("销毁RTC服务..."),await Ut.destroy(),Ut=null,this.agoraAppId=null)},setConnected(h){this.isConnected=h},setLocalStream(h){this.localStream=h},setAudioEnabled(h){this.audioEnabled=h},setVideoEnabled(h){this.videoEnabled=h},reset(){this.localStream&&this.localStream.getTracks().forEach(h=>{h.stop(),d.debug("本地轨道已停止:",h.kind)}),this.isConnected=!1,this.localStream=null,this.audioEnabled=!0,this.videoEnabled=!0}}}),At=Rt.defineStore("callTimer",{state:()=>({callDuration:0,callStartTime:0,_timer:null}),getters:{formattedCallDuration(){const h=Math.floor(this.callDuration/3600),a=Math.floor(this.callDuration%3600/60),s=this.callDuration%60;return h>0?`${String(h).padStart(2,"0")}:${String(a).padStart(2,"0")}:${String(s).padStart(2,"0")}`:`${String(a).padStart(2,"0")}:${String(s).padStart(2,"0")}`}},actions:{startCallTimer(){this._timer&&clearInterval(this._timer),this.callStartTime=Date.now(),this.callDuration=0,this._timer=setInterval(()=>{this.updateCallDuration()},1e3),d.debug("通话计时器已启动")},updateCallDuration(){this.callStartTime!==0&&(this.callDuration=Math.floor((Date.now()-this.callStartTime)/1e3))},stopCallTimer(){this._timer&&(clearInterval(this._timer),this._timer=null),this.callStartTime=0,this.callDuration=0,d.debug("通话计时器已停止")},reset(){this.stopCallTimer()}}}),qe=Rt.defineStore("globalCall",{state:()=>({userInfoMap:new Map,isMinimized:!1}),actions:{setUserInfo(h,a){this.userInfoMap.set(h,a)},batchSetUserInfo(h){for(const{userId:a,userInfo:s}of h)this.userInfoMap.set(a,s)},setMinimized(h){this.isMinimized=h}},getters:{getUserInfo(){return h=>this.userInfoMap.get(h)||{}},getIsMinimized(){return this.isMinimized||!1}}}),zi=Object.freeze(Object.defineProperty({__proto__:null,useGlobalCallStore:qe},Symbol.toStringTag,{value:"Module"}));function Zi(h){return{joinChannel:async({channel:a,token:s,uid:c,appId:p})=>{const m=Be(),R=At(),T=m.getRtcService();if(!T)throw d.error("[RtcAdapter] RtcService 未初始化"),new Error("RtcService 未初始化");await T.joinChannel(a,s,c,p),d.info("[RtcAdapter] joinChannel 成功",{channel:a,uid:c});const V=h.getCoreCallState(),B=[],F=await T.createAudioTrack();if(B.push(F),d.rtc("createAudioTrackSuccess",{}),V.type===je.CALL_TYPE.VIDEO_1V1||V.type===je.CALL_TYPE.VIDEO_MULTI){const H=await T.createVideoTrack();B.push(H),d.rtc("createVideoTrackSuccess",{})}B.length>0&&(await T.publishTracks(B),d.rtc("publishTracksSuccess",{})),m.setConnected(!0);const U=h.getCurrentUserId();U&&T.markUserJoinedRtc(U),V.callerUserId&&V.callerUserId!==U&&(T.addPendingUserId(V.callerUserId),d.info("[RtcAdapter] 已将主叫方加入 pending 列表:",V.callerUserId)),R.startCallTimer(),d.rtc("callTimerStarted",{})},leaveChannel:async()=>{const s=Be().getRtcService();s&&await s.leaveChannel()},publishLocalTracks:async a=>{const c=Be().getRtcService();if(!c)return;const p=[];a.includes("audio")&&p.push(await c.createAudioTrack()),a.includes("video")&&p.push(await c.createVideoTrack()),p.length>0&&await c.publishTracks(p)},unpublishLocalTracks:async a=>{const c=Be().getRtcService();if(!c)return;const p=[];if(a.includes("audio")){const m=c.getLocalAudioTrack();m&&p.push(m)}if(a.includes("video")){const m=c.getLocalVideoTrack();m&&p.push(m)}p.length>0&&await c.unpublishTracks(p)},subscribeRemoteUser:async(a,s)=>{const p=Be().getRtcService();p&&await p.subscribeRemoteUser(a,s)},unsubscribeRemoteUser:async(a,s)=>{const p=Be().getRtcService();p&&await p.unsubscribeRemoteUser(a,s)},setAudioEnabled:async a=>{const c=Be().getRtcService();c&&await c.toggleAudio(a)},setVideoEnabled:async a=>{const c=Be().getRtcService();c&&await c.toggleVideo(a)}}}const Qe=Rt.defineStore("groupCall",()=>{const h=i.ref(null),a=i.ref(new Map),s=i.ref(new Map),c=i.ref(new Set),p=i.computed(()=>Array.from(a.value.values()).sort((M,$)=>{if(M.isLocal!==$.isLocal)return M.isLocal?-1:1;const x=M.joinedAt||M.invitedAt,ae=$.joinedAt||$.invitedAt;return x-ae})),m=i.computed(()=>p.value.find(M=>M.isLocal)),R=i.computed(()=>p.value.filter(M=>M.state!=="left")),T=i.computed(()=>R.value.filter(M=>M.state==="publishing"));function V(M){h.value=M,a.value=new Map,s.value=new Map,c.value=new Set,d.info("[GroupCallStore] 会话初始化",M)}function B(){h.value=null,a.value=new Map,s.value=new Map,c.value=new Set,d.info("[GroupCallStore] 会话销毁")}function F(M){if(a.value.has(M.userId)){d.warn("[GroupCallStore] 参与者已存在,忽略重复添加",M.userId);return}a.value.set(M.userId,{...M,invitedAt:Date.now()}),d.info("[GroupCallStore] 添加参与者",M.userId,M.state)}function U(M){a.value.delete(M)&&d.info("[GroupCallStore] 移除参与者",M)}function H(M,$){const x=a.value.get(M);if(!x){d.warn("[GroupCallStore] 尝试更新不存在参与者的状态",M,$);return}const ae=x.state;x.state=$,($==="joinedRtc"||$==="publishing")&&!x.joinedAt&&(x.joinedAt=Date.now()),d.info("[GroupCallStore] 状态变更",{userId:M,oldState:ae,newState:$}),a.value=new Map(a.value)}function K(M){c.value.add(M);const $=a.value.get(M);$&&$.state==="invited"&&($.state="accepted",a.value=new Map(a.value)),d.info("[GroupCallStore] 标记已接受",M)}function N(M,$){s.value.set(M,$),d.info("[GroupCallStore] uid 映射建立",{uid:M,userId:$})}function G(M){const $=s.value.get(M);if($)return{userId:$,confidence:"certain"};const x=Array.from(c.value).filter(ae=>!Array.from(s.value.values()).includes(ae));if(x.length===1){const ae=x[0];return N(M,ae),{userId:ae,confidence:"inferred"}}return{userId:null,confidence:"unknown"}}function Z(M,$){const x=a.value.get(M);x&&(x.videoTrack=$,$&&x.state!=="publishing"&&x.state!=="left"&&(x.state="publishing"),!$&&x.state==="publishing"&&(x.state="joinedRtc"),a.value=new Map(a.value))}function A(M,$){const x=a.value.get(M);x&&(x.audioTrack=$,$&&x.state!=="publishing"&&x.state!=="left"&&x.videoTrack&&(x.state="publishing"),a.value=new Map(a.value))}function re(M,$){const x=a.value.get(M);x&&(x.localStream=$,a.value=new Map(a.value))}function ce(M,$){const x=a.value.get(M);x&&(x.isMuted=$,a.value=new Map(a.value))}function ve(M,$){const x=a.value.get(M);x&&(x.isCameraOn=$,a.value=new Map(a.value))}function de(M,$){const x=a.value.get(M);x&&(x.isSpeaking=$,a.value=new Map(a.value))}function oe(M,$){const x=a.value.get(M);if(!x){d.warn("[GroupCallStore] 尝试更新不存在参与者的资料",M);return}let ae=!1;$.nickname!==void 0&&x.nickname!==$.nickname&&(x.nickname=$.nickname,ae=!0),$.avatarUrl!==void 0&&x.avatarUrl!==$.avatarUrl&&(x.avatarUrl=$.avatarUrl,ae=!0),ae&&(a.value=new Map(a.value),d.info("[GroupCallStore] 更新参与者资料",{userId:M,...$}))}return{session:h,participants:a,uidToUserIdMap:s,acceptedMembers:c,participantList:p,localParticipant:m,activeParticipants:R,publishingParticipants:T,initSession:V,destroySession:B,addParticipant:F,removeParticipant:U,setParticipantState:H,markAccepted:K,setUidMapping:N,resolveUid:G,setVideoTrack:Z,setAudioTrack:A,setLocalStream:re,setMuteState:ce,setCameraState:ve,setSpeakingState:de,updateParticipantProfile:oe}});class Wi{rtcService;store;client;constructor(a){this.rtcService=a,this.store=Qe(),this.client=a.getClient(),this.rtcService.setAutoSubscribe(!1),this.bindEvents()}destroy(){this.unbindEvents(),this.rtcService.setAutoSubscribe(!0)}bindEvents(){if(!this.client){d.error("[RtcMediaBridge] RTC client 为空,无法绑定事件");return}this.client.on("user-joined",this.handleUserJoined),this.client.on("user-left",this.handleUserLeft),this.client.on("user-published",this.handleUserPublished),this.client.on("user-unpublished",this.handleUserUnpublished),this.client.on("volume-indicator",this.handleVolumeIndicator);try{typeof this.client.enableAudioVolumeIndicator=="function"&&(this.client.enableAudioVolumeIndicator(),d.info("[RtcMediaBridge] 已启用音量检测"))}catch(a){d.warn("[RtcMediaBridge] 启用音量检测失败",a)}}unbindEvents(){this.client&&(this.client.off("user-joined",this.handleUserJoined),this.client.off("user-left",this.handleUserLeft),this.client.off("user-published",this.handleUserPublished),this.client.off("user-unpublished",this.handleUserUnpublished),this.client.off("volume-indicator",this.handleVolumeIndicator))}handleUserJoined=async a=>{const s=a.uid.toString();d.info("[RtcMediaBridge] user-joined",s);let c=this.store.uidToUserIdMap.get(s);if(!c){const p=await this.fetchUserIdByUid(s);p&&(c=p,this.store.setUidMapping(s,c))}if(c){const p=`__pending_${s}`;this.store.participants.get(p)?this.migrateTempParticipant(p,c):this.store.setParticipantState(c,"joinedRtc"),this.enrichParticipantProfile(c)}else{d.warn("[RtcMediaBridge] 无法解析 uid,创建临时占位",s);const p=`__pending_${s}`;this.store.setUidMapping(s,p),this.store.addParticipant({userId:p,nickname:"未知用户",state:"joinedRtc",isLocal:!1,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:!1,isSpeaking:!1})}};handleUserLeft=a=>{const s=a.uid.toString();let c=this.store.uidToUserIdMap.get(s);d.info("[RtcMediaBridge] user-left",{uid:s,userId:c}),c&&(this.store.setParticipantState(c,"left"),setTimeout(()=>this.store.removeParticipant(c),2e3))};handleUserPublished=async(a,s)=>{const c=a.uid,p=c.toString();d.info("[RtcMediaBridge] user-published",{uid:c,mediaType:s});try{await this.rtcService.subscribeRemoteUser(c,s),d.info("[RtcMediaBridge] 订阅成功",{uid:c,mediaType:s})}catch(T){if(T?.message?.includes("INVALID_REMOTE_USER"))d.debug(`[RtcMediaBridge] 订阅${s}被跳过,用户可能已不在频道或已被订阅`,{uid:c});else{d.error("[RtcMediaBridge] 订阅失败",{uid:c,mediaType:s,error:T});return}}let m=this.store.uidToUserIdMap.get(p);if(!m){const T=await this.fetchUserIdByUid(p);T&&(m=T,this.store.setUidMapping(p,m))}if(!m){d.warn("[RtcMediaBridge] publish 后仍无法解析 uid",c);return}if(m.startsWith("__pending_")){const T=await this.fetchUserIdByUid(p);T&&(this.migrateTempParticipant(m,T),m=T)}const R=this.client.remoteUsers?.find(T=>T.uid.toString()===p);if(s==="video"){const T=R?.videoTrack||this.rtcService.getRemoteVideoTrack(m)||null;this.store.setVideoTrack(m,T)}else{const T=R?.audioTrack||this.rtcService.getRemoteAudioTrack(m)||null;this.store.setAudioTrack(m,T)}};handleUserUnpublished=(a,s)=>{const c=a.uid.toString();let p=this.store.uidToUserIdMap.get(c);d.info("[RtcMediaBridge] user-unpublished",{uid:c,userId:p,mediaType:s}),p&&(s==="video"?this.store.setVideoTrack(p,null):this.store.setAudioTrack(p,null))};handleVolumeIndicator=a=>{const s=a.filter(c=>c.level>0).map(c=>{const p=c.uid.toString();return this.store.uidToUserIdMap.get(p)}).filter(Boolean);this.store.activeParticipants.forEach(c=>{const p=s.includes(c.userId);c.isSpeaking!==p&&this.store.setSpeakingState(c.userId,p)})};migrateTempParticipant(a,s){const c=this.store.participants.get(a);if(!c)return;d.info("[RtcMediaBridge] 迁移临时参与者到真实 userId",{tempUserId:a,realUserId:s});const m=qe().getUserInfo(s),R=m.nickname||(c.nickname==="未知用户"?s:c.nickname),T=m.avatarURL||c.avatarUrl;this.store.addParticipant({userId:s,nickname:R,avatarUrl:T,state:c.state,isLocal:c.isLocal,videoTrack:c.videoTrack,audioTrack:c.audioTrack,localStream:c.localStream,uid:c.uid,isMuted:c.isMuted,isCameraOn:c.isCameraOn,isSpeaking:c.isSpeaking,joinedAt:c.joinedAt}),this.store.removeParticipant(a)}enrichParticipantProfile(a){const c=qe().getUserInfo(a);(c.nickname||c.avatarURL)&&this.store.updateParticipantProfile(a,{nickname:c.nickname,avatarUrl:c.avatarURL})}async fetchUserIdByUid(a){try{const s=Xe().getChatClient;if(!s||typeof s.getUserIdByRTCUIds!="function")return null;const p=(await s.getUserIdByRTCUIds([a]))?.data?.[a];return p&&d.info("[RtcMediaBridge] 通过 API 获取 userId 映射成功",{uid:a,userId:p}),p||null}catch(s){return d.warn("[RtcMediaBridge] 通过 API 获取 userId 映射失败",{uid:a,error:s}),null}}}const vt={IDLE:0,INVITING:1,ALERTING:2,CONFIRM_RING:3,RECEIVED_CONFIRM_RING:4,ANSWER_CALL:5,CONFIRM_CALLEE:6,IN_CALL:7},Ee={AUDIO_1V1:0,VIDEO_1V1:1,VIDEO_MULTI:2,AUDIO_MULTI:3},_e={HANGUP:"hangup",CANCEL:"cancel",REMOTE_CANCEL:"remoteCancel",REFUSE:"refuse",REMOTE_REFUSE:"remoteRefuse",BUSY:"busy",NO_RESPONSE:"noResponse",REMOTE_NO_RESPONSE:"remoteNoResponse",HANDLE_ON_OTHER_DEVICE:"handleOnOtherDevice",ABNORMAL_END:"abnormalEnd"};class Yi{core=tt();async sendInvite(a,s,c,p=Ee.VIDEO_MULTI){const R=Qe().session?.callType==="audio"?Ee.AUDIO_MULTI:p;await this.core.inviteMoreParticipants(a),d.info("[GroupCallSignalingAdapter] 发送邀请",{userIds:a,groupId:s,callType:R})}async sendAnswer(a,s){const c=this.core.callState;await this.core.answerCall({callId:c.callId||"",result:"accept"}),d.info("[GroupCallSignalingAdapter] 发送接听信令",{userId:a,groupId:s})}async hangup(){Qe().participantList.some(c=>!c.isLocal&&c.state!=="invited"&&c.state!=="left")?(await this.core.hangup({reason:"normal"}),d.info("[GroupCallSignalingAdapter] 挂断完成(leaveCall)")):(await this.core.hangup({reason:"cancel"}),d.info("[GroupCallSignalingAdapter] 取消完成(cancelCall)"))}async cancelInvitation(a,s){try{Qe().removeParticipant(a),d.info("[GroupCallSignalingAdapter] 取消邀请(本地移除参与者)",{userId:a,groupId:s})}catch(c){d.error("[GroupCallSignalingAdapter] 取消邀请失败",c)}}}function Ji(){const h=Qe(),a=new Yi;let s=null;const c=new Map,p=3e4;function m(J){const W=c.get(J);W&&(clearTimeout(W),c.delete(J))}function R(){c.forEach(J=>clearTimeout(J)),c.clear()}i.watch(()=>h.participantList.map(J=>({userId:J.userId,state:J.state})),(J,W)=>{const ee=new Map((W||[]).map(ue=>[ue.userId,ue.state])),ye=new Set(J.map(ue=>ue.userId));J.forEach(ue=>{if(ue.state==="invited"&&ee.get(ue.userId)!=="invited"&&!c.has(ue.userId)){const Q=setTimeout(()=>{d.info("[useGroupCallViewModel] 邀请超时,移除参与者",ue.userId),a.cancelInvitation(ue.userId,h.session?.groupId||""),h.removeParticipant(ue.userId),c.delete(ue.userId)},p);c.set(ue.userId,Q)}ue.state!=="invited"&&c.has(ue.userId)&&m(ue.userId)}),W?.forEach(ue=>{!ye.has(ue.userId)&&c.has(ue.userId)&&m(ue.userId)})},{deep:!0,immediate:!0});const T=i.computed(()=>h.session?.isActive??!1),V=i.computed(()=>h.participantList),B=i.computed(()=>h.localParticipant),F=i.ref(0);let U=null;function H(){U&&clearInterval(U),U=setInterval(()=>{h.session?.startTime&&(F.value=Math.floor((Date.now()-h.session.startTime)/1e3))},1e3)}function K(){U&&(clearInterval(U),U=null),F.value=0}const N=i.ref(null);function G(J){N.value=J}i.onUnmounted(()=>{K(),R()});function Z(J){const W=h.session;!W||W.sessionId!==J.sessionId?h.initSession({sessionId:J.sessionId,groupId:J.groupId,callType:J.callType,isActive:!0,startTime:Date.now()}):h.session={...W,isActive:!0,startTime:Date.now()},h.participants.has(J.localUserId)||h.addParticipant({userId:J.localUserId,nickname:J.localNickname,avatarUrl:J.localAvatarUrl,state:"joinedRtc",isLocal:!0,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:J.callType==="video",isSpeaking:!1}),H(),d.info("[useGroupCallViewModel] 会话启动",J.sessionId)}function A(J,W,ee){h.addParticipant({userId:J,nickname:W,avatarUrl:ee,state:"invited",isLocal:!1,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:!1,isSpeaking:!1})}function re(J){h.markAccepted(J)}function ce(J){s&&(d.warn("[useGroupCallViewModel] RtcMediaBridge 已存在,先销毁旧实例"),s.destroy()),s=new Wi(J),d.info("[useGroupCallViewModel] 已绑定 RtcService");const W=h.localParticipant;W&&W.state!=="joinedRtc"&&(h.setParticipantState(W.userId,"joinedRtc"),d.info("[useGroupCallViewModel] 本地用户已标记为 joinedRtc"));const{localStream:ee}=Be();ee&&W&&h.setLocalStream(W.userId,ee)}function ve(){s&&(s.destroy(),s=null,d.info("[useGroupCallViewModel] 已解绑 RtcService"))}async function de(J,W,ee){await a.sendInvite(J,W,ee);const ye=qe();J.forEach(ue=>{const Q=ye.getUserInfo(ue);A(ue,Q.nickname||ue,Q.avatarURL)})}async function oe(){R(),await a.hangup(),ve(),h.destroySession(),K()}function M(J){const W=h.localParticipant;W&&h.setLocalStream(W.userId,J)}function $(J){const W=h.localParticipant;W&&h.setMuteState(W.userId,J)}function x(J){const W=h.localParticipant;W&&h.setCameraState(W.userId,J)}function ae(J){const W=h.localParticipant;W&&h.setVideoTrack(W.userId,J)}return{isActive:T,participants:V,localParticipant:B,callDuration:F,selectedParticipantId:N,startSession:Z,addRemoteParticipant:A,markRemoteAccepted:re,bindRtcService:ce,unbindRtcService:ve,sendInvite:de,clearInvitationTimer:m,hangup:oe,setLocalStream:M,setLocalMute:$,setLocalCamera:x,setLocalVideoTrack:ae,selectParticipant:G}}const Xi=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4 7C4 5.34315 5.34315 4 7 4H17C18.6569 4 20 5.34315 20 7V17C20 18.6569 18.6569 20 17 20H7C5.34315 20 4 18.6569 4 17V7ZM11.6258 6.96235C11.9187 6.66945 12.3936 6.66945 12.6865 6.96235L16.4867 10.7626C17.1701 11.446 17.1701 12.554 16.4867 13.2374L12.6865 17.0377C12.3936 17.3305 11.9187 17.3305 11.6258 17.0377C11.3329 16.7448 11.3329 16.2699 11.6258 15.977L14.8528 12.75L7.40979 12.75C6.99558 12.75 6.65979 12.4142 6.65979 12C6.65979 11.5858 6.99558 11.25 7.40979 11.25L14.8528 11.25L11.6258 8.02301C11.3329 7.73011 11.3329 7.25524 11.6258 6.96235Z" />
6
+ </svg>
7
+ `,Qi=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
8
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.25 2.5C3.73122 2.5 2.5 3.73122 2.5 5.25V15.4995C2.5 17.0183 3.73122 18.2495 5.25 18.2495H9.50539C9.91961 18.2495 10.2554 17.9137 10.2554 17.4995C10.2554 17.0853 9.91961 16.7495 9.50539 16.7495H5.25C4.55964 16.7495 4 16.1899 4 15.4995V5.25C4 4.55964 4.55964 4 5.25 4H15.4995C16.1899 4 16.7495 4.55964 16.7495 5.25V9.50993C16.7495 9.92414 17.0853 10.2599 17.4995 10.2599C17.9137 10.2599 18.2495 9.92414 18.2495 9.50993V5.25C18.2495 3.73122 17.0183 2.5 15.4995 2.5H5.25ZM13.4995 12.9995H19.4995C19.7757 12.9995 19.9995 13.2234 19.9995 13.4995V19.4995C19.9995 19.7757 19.7757 19.9995 19.4995 19.9995H13.4995C13.2234 19.9995 12.9995 19.7757 12.9995 19.4995V13.4995C12.9995 13.2234 13.2234 12.9995 13.4995 12.9995ZM11.4995 13.4995C11.4995 12.3949 12.3949 11.4995 13.4995 11.4995H19.4995C20.6041 11.4995 21.4995 12.3949 21.4995 13.4995V19.4995C21.4995 20.6041 20.6041 21.4995 19.4995 21.4995H13.4995C12.3949 21.4995 11.4995 20.6041 11.4995 19.4995V13.4995Z" />
9
+ </svg>`,ea=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" >
10
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M2.66675 12.0205C2.66675 10.6474 3.70938 9.49882 5.07604 9.36629L9.17234 8.96907C9.67893 8.91995 10.1134 8.5867 10.2921 8.11013L10.6845 7.06359C11.0748 6.02278 12.0698 5.33325 13.1814 5.33325H18.8187C19.9303 5.33325 20.9253 6.02278 21.3156 7.06359L21.7081 8.11013C21.8868 8.5867 22.3212 8.91995 22.8278 8.96907L26.9241 9.36629C28.2908 9.49882 29.3334 10.6474 29.3334 12.0205V23.9999C29.3334 25.4727 28.1395 26.6666 26.6667 26.6666H5.33342C3.86066 26.6666 2.66675 25.4727 2.66675 23.9999V12.0205ZM17.7155 13.0275C15.3404 12.0801 12.6471 13.2374 11.6997 15.6124C11.5224 16.057 11.0182 16.2736 10.5736 16.0963C10.129 15.919 9.9124 15.4148 10.0897 14.9702C11.3918 11.706 15.0935 10.1154 18.3577 11.4175C20.4674 12.259 21.877 14.1033 22.2596 16.1799C22.3113 16.4606 22.2215 16.7488 22.0195 16.9504C21.8175 17.152 21.5291 17.2412 21.2486 17.189L17.9098 16.5669C17.4393 16.4792 17.1289 16.0267 17.2166 15.5561C17.3042 15.0856 17.7568 14.7752 18.2273 14.8629L20.1203 15.2156C19.6274 14.2531 18.7976 13.4591 17.7155 13.0275ZM21.4265 18.5593C21.8711 18.7367 22.0878 19.2408 21.9104 19.6854C20.6084 22.9496 16.9067 24.5402 13.6425 23.2382C11.66 22.4474 10.2954 20.7708 9.82084 18.8486C9.75031 18.5629 9.82956 18.261 10.0313 18.0467C10.2331 17.8325 10.5297 17.7353 10.8191 17.7885L14.1971 18.4103C14.6678 18.4969 14.9792 18.9488 14.8925 19.4195C14.8059 19.8903 14.354 20.2016 13.8833 20.115L12.0736 19.7819C12.5774 20.5896 13.3335 21.2487 14.2847 21.6282C16.6597 22.5756 19.3531 21.4182 20.3004 19.0432C20.4778 18.5986 20.982 18.382 21.4265 18.5593ZM7.3468 5.67455C7.89468 5.60493 8.39527 5.99263 8.46489 6.54051C8.53451 7.08838 8.14681 7.58897 7.59893 7.65859L5.77227 7.89072C5.22439 7.96035 4.7238 7.57265 4.65418 7.02477C4.58455 6.47689 4.97226 5.9763 5.52013 5.90668L7.3468 5.67455Z" />
11
+ </svg>`,ta=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
12
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.75C3 3.7835 3.7835 3 4.75 3L8.24978 3.00369C8.664 3.00369 8.99978 3.33948 8.99978 3.75369C8.99978 4.1679 8.664 4.50369 8.24978 4.50369L4.75 4.5C4.61193 4.5 4.5 4.61193 4.5 4.75V8.25C4.5 8.66421 4.16421 9 3.75 9C3.33579 9 3 8.66421 3 8.25V4.75Z" />
13
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.25 3C20.2165 3 21 3.7835 21 4.75L20.9963 8.24978C20.9963 8.664 20.6605 8.99978 20.2463 8.99978C19.8321 8.99978 19.4963 8.664 19.4963 8.24978L19.5 4.75C19.5 4.61193 19.3881 4.5 19.25 4.5H15.75C15.3358 4.5 15 4.16421 15 3.75C15 3.33579 15.3358 3 15.75 3L19.25 3Z" />
14
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4.75 21C3.7835 21 3 20.2165 3 19.25L3.00369 15.7502C3.00369 15.336 3.33948 15.0002 3.75369 15.0002C4.1679 15.0002 4.50369 15.336 4.50369 15.7502L4.5 19.25C4.5 19.3881 4.61193 19.5 4.75 19.5H8.25C8.66421 19.5 9 19.8358 9 20.25C9 20.6642 8.66421 21 8.25 21H4.75Z" />
15
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M21 19.25C21 20.2165 20.2165 21 19.25 21L15.7502 20.9963C15.336 20.9963 15.0002 20.6605 15.0002 20.2463C15.0002 19.8321 15.336 19.4963 15.7502 19.4963L19.25 19.5C19.3881 19.5 19.5 19.3881 19.5 19.25V15.75C19.5 15.3358 19.8358 15 20.25 15C20.6642 15 21 15.3358 21 15.75V19.25Z" />
16
+ </svg>`,na=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
17
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9 7.25C9 8.2165 8.2165 9 7.25 9L3.75022 8.99631C3.336 8.99631 3.00022 8.66052 3.00022 8.24631C3.00022 7.8321 3.336 7.49631 3.75022 7.49631L7.25 7.5C7.38807 7.5 7.5 7.38807 7.5 7.25L7.5 3.75C7.5 3.33579 7.83579 3 8.25 3C8.66421 3 9 3.33579 9 3.75L9 7.25Z" />
18
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M16.75 9C15.7835 9 15 8.2165 15 7.25L15.0037 3.75022C15.0037 3.336 15.3395 3.00022 15.7537 3.00022C16.1679 3.00022 16.5037 3.336 16.5037 3.75022L16.5 7.25C16.5 7.38807 16.6119 7.5 16.75 7.5L20.25 7.5C20.6642 7.5 21 7.83579 21 8.25C21 8.66421 20.6642 9 20.25 9L16.75 9Z" />
19
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.25 15C8.2165 15 9 15.7835 9 16.75L8.99631 20.2498C8.99631 20.664 8.66052 20.9998 8.24631 20.9998C7.8321 20.9998 7.49631 20.664 7.49631 20.2498L7.5 16.75C7.5 16.6119 7.38807 16.5 7.25 16.5L3.75 16.5C3.33579 16.5 3 16.1642 3 15.75C3 15.3358 3.33579 15 3.75 15L7.25 15Z" />
20
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15 16.75C15 15.7835 15.7835 15 16.75 15L20.2498 15.0037C20.664 15.0037 20.9998 15.3395 20.9998 15.7537C20.9998 16.1679 20.664 16.5037 20.2498 16.5037L16.75 16.5C16.6119 16.5 16.5 16.6119 16.5 16.75V20.25C16.5 20.6642 16.1642 21 15.75 21C15.3358 21 15 20.6642 15 20.25V16.75Z" />
21
+ </svg>
22
+ `,ra=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
23
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 4C9.51472 4 7.5 6.01472 7.5 8.5V11.5C7.5 13.9853 9.51472 16 12 16C14.4853 16 16.5 13.9853 16.5 11.5V8.5C16.5 6.01472 14.4853 4 12 4ZM12 10.0199C12.6904 10.0199 13.25 9.46025 13.25 8.7699C13.25 8.07954 12.6904 7.5199 12 7.5199C11.3096 7.5199 10.75 8.07954 10.75 8.7699C10.75 9.46025 11.3096 10.0199 12 10.0199Z" />
24
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.2565 11.4532C19.2565 11.0114 18.8984 10.6532 18.4565 10.6532C18.0147 10.6532 17.6565 11.0114 17.6565 11.4532C17.6565 14.4705 15.2105 16.9166 12.1931 16.9166H11.7963C8.78476 16.9166 6.34341 14.4752 6.34341 11.4637C6.34341 11.0218 5.98524 10.6637 5.54341 10.6637C5.10158 10.6637 4.74341 11.0218 4.74341 11.4637C4.74341 15.158 7.58384 18.189 11.2 18.4917V19.4503C11.2 19.8921 11.5581 20.2503 12 20.2503C12.4418 20.2503 12.8 19.8921 12.8 19.4503V18.4909C16.4169 18.1831 19.2565 15.1498 19.2565 11.4532Z" />
25
+ </svg>
26
+ `,ia=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
27
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.80694 20.1909C3.51405 19.8981 3.51405 19.4232 3.80694 19.1303L19.1323 3.80906C19.4252 3.51616 19.9001 3.51616 20.1929 3.80906C20.4858 4.10195 20.4858 4.57682 20.1929 4.86972L4.8676 20.1909C4.57471 20.4838 4.09983 20.4838 3.80694 20.1909Z" />
28
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M8.48343 17.7627C9.30606 18.2658 10.2448 18.5977 11.25 18.7088V20.25C11.25 20.6642 11.5858 21 12 21C12.4142 21 12.75 20.6642 12.75 20.25V18.7088C16.125 18.3357 18.75 15.4744 18.75 12V11C18.75 10.5858 18.4142 10.25 18 10.25C17.5858 10.25 17.25 10.5858 17.25 11V12C17.25 14.8995 14.8995 17.25 12 17.25C11.1288 17.25 10.3071 17.0378 9.58393 16.6622L8.48343 17.7627ZM10.5264 15.7198C10.9824 15.9006 11.4796 16 12 16C14.2091 16 16 14.2091 16 12V10.2462L10.5264 15.7198ZM15.8484 5.90554L8.28023 13.4737C8.09939 13.0177 8 12.5204 8 12V7C8 4.79086 9.79086 3 12 3C13.8297 3 15.3724 4.22845 15.8484 5.90554ZM7.3378 14.4162L6.2373 15.5167C5.61097 14.4925 5.25 13.2884 5.25 12V11C5.25 10.5858 5.58579 10.25 6 10.25C6.41421 10.25 6.75 10.5858 6.75 11V12C6.75 12.8712 6.96223 13.6929 7.3378 14.4162Z" />
29
+ </svg>
30
+ `,aa=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
31
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M18.22 10.22C18.22 10.6508 18.5692 11 19 11C19.4308 11 19.78 10.6508 19.78 10.22L19.78 8.78003L21.22 8.78002C21.6508 8.78002 22 8.43079 22 7.99999C22 7.5692 21.6508 7.21997 21.22 7.21997L19.78 7.21998L19.78 5.78002C19.78 5.34923 19.4308 5 19 5C18.5692 5 18.22 5.34923 18.22 5.78002L18.22 7.21999L16.78 7.22C16.3492 7.22 16 7.56922 16 8.00002C16 8.43081 16.3492 8.78004 16.78 8.78004L18.22 8.78003L18.22 10.22Z" />
32
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.4818 12.5687C12.5541 12.5288 12.6256 12.4862 12.6962 12.4409C13.2768 12.0681 13.7319 11.5683 14.0615 10.9414C14.4067 10.3145 14.5793 9.63672 14.5793 8.90816V7.09184C14.5793 6.34633 14.4067 5.66012 14.0615 5.03321C13.7319 4.40631 13.2768 3.91495 12.6962 3.55913C12.1156 3.18638 11.4801 3 10.7896 3C10.0992 3 9.46366 3.18638 8.88305 3.55913C8.30245 3.91495 7.83953 4.40631 7.4943 5.03321C7.16477 5.66012 7 6.34633 7 7.09184V8.90816C7 9.63672 7.16477 10.3145 7.4943 10.9414C7.83953 11.5683 8.30245 12.0681 8.88305 12.4409C8.97661 12.5009 9.0716 12.5562 9.16802 12.6065C9.66991 12.8688 10.2105 13 10.7896 13C10.8603 13 10.9305 12.998 11 12.9941C11.527 12.9645 12.0209 12.8227 12.4818 12.5687ZM12.744 14.1072C12.1884 14.0357 11.6071 14 11 14C10.9295 14 10.8594 14.0005 10.7896 14.0014C10.1446 14.0103 9.52913 14.0604 8.94335 14.1516C8.30561 14.2509 7.70303 14.3989 7.13559 14.5957C6.17137 14.9267 5.33522 15.3901 4.62712 15.9858C4.03955 16.4657 3.58757 16.987 3.27119 17.5496C3.0904 17.8972 3 18.3522 3 18.9149C3 19.4775 3.18079 19.9657 3.54237 20.3794C3.91902 20.7931 4.371 21 4.89831 21H17.1017C17.629 21 18.0734 20.7931 18.435 20.3794C18.8117 19.9657 19 19.4775 19 18.9149C19 18.3522 18.9096 17.8972 18.7288 17.5496C18.4124 16.987 17.9605 16.4657 17.3729 15.9858C16.6648 15.3901 15.8286 14.9267 14.8644 14.5957C14.2051 14.367 13.4983 14.2042 12.744 14.1072ZM17.4053 18.2566C17.1952 17.8922 16.8797 17.5197 16.424 17.1476L16.4156 17.1407L16.4072 17.1336C15.8543 16.6685 15.1845 16.2915 14.3774 16.0145L14.3728 16.0129C13.4116 15.6795 12.2935 15.5 11 15.5C9.70653 15.5 8.5884 15.6795 7.62716 16.0129L7.62258 16.0145L7.62258 16.0145C6.81549 16.2915 6.1457 16.6685 5.5928 17.1336L5.58444 17.1407L5.57599 17.1476C5.12032 17.5197 4.8048 17.8922 4.59471 18.2567C4.56071 18.3309 4.5 18.5244 4.5 18.9149C4.5 19.1181 4.55224 19.2513 4.66199 19.3809C4.76716 19.493 4.82385 19.5 4.89831 19.5H17.1017C17.1635 19.5 17.1883 19.4893 17.1976 19.4849C17.2084 19.4799 17.2458 19.4607 17.3056 19.3923L17.3156 19.3809L17.3258 19.3696C17.4495 19.2338 17.5 19.1064 17.5 18.9149C17.5 18.5244 17.4393 18.3308 17.4053 18.2566ZM8.81534 10.2306C9.04375 10.6409 9.3346 10.9482 9.69343 11.1786L8.88305 12.4409L9.69343 11.1786C10.0321 11.396 10.3863 11.5 10.7896 11.5C11.193 11.5 11.5472 11.396 11.8859 11.1786C12.2421 10.9499 12.5216 10.647 12.7337 10.2434L12.7405 10.2306L12.7475 10.2178C12.9684 9.81667 13.0793 9.38847 13.0793 8.90816V7.09184C13.0793 6.5884 12.9655 6.15265 12.7475 5.75678L12.7405 5.74403L12.7337 5.73114C12.5246 5.33334 12.2533 5.04694 11.9125 4.83808L11.8991 4.82987L11.8859 4.82139C11.5472 4.60397 11.193 4.5 10.7896 4.5C10.3863 4.5 10.0321 4.60397 9.69343 4.82139L9.68022 4.82987L9.66683 4.83808C9.32322 5.04865 9.04053 5.33964 8.81535 5.74396C8.60927 6.14091 8.5 6.58179 8.5 7.09184V8.90816C8.5 9.39561 8.60669 9.82887 8.81534 10.2306Z" />
33
+ </svg>`,oa=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
34
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.4943 10.9414C7.16477 10.3145 7 9.63672 7 8.90816V7.09184C7 6.34633 7.16477 5.66012 7.4943 5.03321C7.83953 4.40631 8.30245 3.91495 8.88305 3.55913C9.46366 3.18638 10.0992 3 10.7896 3C11.4801 3 12.1156 3.18638 12.6962 3.55913C13.2768 3.91495 13.7319 4.40631 14.0615 5.03321C14.4067 5.66012 14.5793 6.34633 14.5793 7.09184V8.90816C14.5793 9.63672 14.4067 10.3145 14.0615 10.9414C13.7319 11.5683 13.2768 12.0681 12.6962 12.4409C12.1156 12.8136 11.4801 13 10.7896 13C10.0992 13 9.46366 12.8136 8.88305 12.4409C8.30245 12.0681 7.83953 11.5683 7.4943 10.9414ZM14.8644 14.5957C13.7194 14.1986 12.4313 14 11 14C9.56874 14 8.2806 14.1986 7.13559 14.5957C6.17137 14.9267 5.33522 15.3901 4.62712 15.9858C4.03955 16.4657 3.58757 16.987 3.27119 17.5496C3.0904 17.8972 3 18.3522 3 18.9149C3 19.4775 3.18079 19.9657 3.54237 20.3794C3.91902 20.7931 4.371 21 4.89831 21H17.1017C17.629 21 18.0734 20.7931 18.435 20.3794C18.8117 19.9657 19 19.4775 19 18.9149C19 18.3522 18.9096 17.8972 18.7288 17.5496C18.4124 16.987 17.9605 16.4657 17.3729 15.9858C16.6648 15.3901 15.8286 14.9267 14.8644 14.5957ZM18.9833 11.2402C18.5525 11.2402 18.2032 10.891 18.2032 10.4602V8.90011H16.6432C16.2124 8.90011 15.8632 8.55088 15.8632 8.12009C15.8632 7.68929 16.2124 7.34006 16.6432 7.34006H18.2032V5.78003C18.2032 5.34923 18.5525 5.00001 18.9833 5.00001C19.4141 5.00001 19.7633 5.34923 19.7633 5.78003V7.34006L21.3234 7.34006C21.7542 7.34006 22.1034 7.68929 22.1034 8.12009C22.1034 8.55088 21.7542 8.90011 21.3234 8.90011H19.7633V10.4602C19.7633 10.891 19.4141 11.2402 18.9833 11.2402Z" />
35
+ </svg>
36
+ `,sa=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
37
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M20.2203 19H18.0976C18.0361 18.7179 17.9436 18.4457 17.812 18.1907L17.803 18.1734L17.7936 18.1564C17.4139 17.4763 16.8876 16.8742 16.2438 16.3433C15.4579 15.6787 14.5436 15.1733 13.5169 14.8181C13.1322 14.6837 12.7352 14.5716 12.3265 14.4809C12.7747 14.0846 13.1429 13.6102 13.4286 13.0655C13.5447 12.8521 13.6446 12.6336 13.7284 12.4104C13.9805 12.3961 14.2376 12.3889 14.4999 12.3889C15.8417 12.3889 17.0494 12.5764 18.1228 12.9515C19.0268 13.2641 19.8107 13.7017 20.4745 14.2644C21.0253 14.7176 21.4491 15.2099 21.7457 15.7413C21.9152 16.0695 21.9999 16.4993 21.9999 17.0307C21.9999 17.5621 21.8234 18.0232 21.4703 18.4139C21.1313 18.8046 20.7146 19 20.2203 19ZM14.3027 11.4444C14.1966 11.4444 14.0918 11.4397 13.9884 11.4302C14.0332 11.1522 14.0556 10.8685 14.0556 10.5799V8.86451C14.0556 7.97224 13.8492 7.12843 13.4286 6.35483C13.0266 5.58852 12.4593 4.96568 11.7313 4.51361C11.525 4.38094 11.3121 4.26655 11.0934 4.17062C11.1304 4.08608 11.1704 4.00263 11.2133 3.92026C11.537 3.32818 11.971 2.86412 12.5153 2.52807C13.0596 2.17602 13.6554 2 14.3027 2C14.95 2 15.5458 2.17602 16.0901 2.52807C16.6345 2.86412 17.0611 3.32818 17.37 3.92026C17.6937 4.51234 17.8555 5.16042 17.8555 5.86452V7.57993C17.8555 8.26802 17.6937 8.9081 17.37 9.50018C17.0611 10.0923 16.6345 10.5643 16.0901 10.9164C15.5458 11.2684 14.95 11.4444 14.3027 11.4444ZM6.21341 12.5002C5.90447 11.9081 5.75 11.268 5.75 10.5799V8.86452C5.75 8.16042 5.90447 7.51234 6.21341 6.92026C6.53706 6.32818 6.97104 5.86412 7.51536 5.52807C8.05968 5.17602 8.65549 5 9.30279 5C9.95009 5 10.5459 5.17602 11.0902 5.52807C11.6345 5.86412 12.0612 6.32818 12.3701 6.92026C12.6938 7.51234 12.8556 8.16042 12.8556 8.86452V10.5799C12.8556 11.268 12.6938 11.9081 12.3701 12.5002C12.0612 13.0923 11.6345 13.5643 11.0902 13.9164C10.5459 14.2684 9.95009 14.4444 9.30279 14.4444C8.65549 14.4444 8.05968 14.2684 7.51536 13.9164C6.97104 13.5643 6.53706 13.0923 6.21341 12.5002ZM13.1229 15.9515C12.0494 15.5764 10.8418 15.3889 9.5 15.3889C8.15819 15.3889 6.95057 15.5764 5.87712 15.9515C4.97316 16.2641 4.18927 16.7017 3.52542 17.2644C2.97458 17.7176 2.55085 18.2099 2.25424 18.7413C2.08475 19.0695 2 19.4993 2 20.0307C2 20.5621 2.16949 21.0232 2.50847 21.4139C2.86158 21.8046 3.28531 22 3.77966 22H15.2203C15.7147 22 16.1314 21.8046 16.4703 21.4139C16.8234 21.0232 17 20.5621 17 20.0307C17 19.4993 16.9153 19.0695 16.7458 18.7413C16.4492 18.2099 16.0254 17.7176 15.4746 17.2644C14.8107 16.7017 14.0268 16.2641 13.1229 15.9515Z" />
38
+ </svg>`,la=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
39
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M11.4804 12.5687C11.5526 12.5288 11.6241 12.4862 11.6948 12.4409C12.2754 12.0681 12.7305 11.5683 13.06 10.9414C13.4052 10.3145 13.5778 9.63672 13.5778 8.90816V7.09184C13.5778 6.34633 13.4052 5.66012 13.06 5.03321C12.7305 4.40631 12.2754 3.91495 11.6948 3.55913C11.1142 3.18638 10.4786 3 9.78818 3C9.09773 3 8.4622 3.18638 7.88159 3.55913C7.30098 3.91495 6.83806 4.40631 6.49284 5.03321C6.1633 5.66012 5.99854 6.34633 5.99854 7.09184V8.90816C5.99854 9.63672 6.1633 10.3145 6.49284 10.9414C6.83806 11.5683 7.30098 12.0681 7.88159 12.4409C7.97515 12.5009 8.07014 12.5562 8.16655 12.6065C8.66845 12.8688 9.20899 13 9.78818 13C9.85888 13 9.92899 12.998 9.99854 12.9941C10.5255 12.9645 11.0195 12.8227 11.4804 12.5687ZM11.7425 14.1072C11.187 14.0357 10.6056 14 9.99854 14C9.92807 14 9.85795 14.0005 9.78818 14.0014C9.14309 14.0103 8.52766 14.0604 7.94188 14.1516C7.30415 14.2509 6.70156 14.3989 6.13413 14.5957C5.16991 14.9267 4.33375 15.3901 3.62565 15.9858C3.03808 16.4657 2.58611 16.987 2.26972 17.5496C2.08893 17.8972 1.99854 18.3522 1.99854 18.9149C1.99854 19.4775 2.17933 19.9657 2.54091 20.3794C2.91756 20.7931 3.36953 21 3.89684 21H16.1002C16.6275 21 17.072 20.7931 17.4336 20.3794C17.8102 19.9657 17.9985 19.4775 17.9985 18.9149C17.9985 18.3522 17.9081 17.8972 17.7273 17.5496C17.411 16.987 16.959 16.4657 16.3714 15.9858C15.6633 15.3901 14.8272 14.9267 13.8629 14.5957C13.2036 14.367 12.4968 14.2042 11.7425 14.1072ZM16.4038 18.2566C16.1937 17.8922 15.8782 17.5197 15.4226 17.1476L15.4141 17.1407L15.4057 17.1336C14.8528 16.6685 14.1831 16.2915 13.376 16.0145L13.3714 16.0129C12.4101 15.6795 11.292 15.5 9.99854 15.5C8.70507 15.5 7.58694 15.6795 6.62569 16.0129L6.62112 16.0145L6.62111 16.0145C5.81402 16.2915 5.14423 16.6685 4.59134 17.1336L4.58298 17.1407L4.57452 17.1476C4.11886 17.5197 3.80334 17.8922 3.59324 18.2567C3.55924 18.3309 3.49854 18.5244 3.49854 18.9149C3.49854 19.1181 3.55078 19.2513 3.66052 19.3809C3.7657 19.493 3.82238 19.5 3.89684 19.5H16.1002C16.162 19.5 16.1868 19.4893 16.1961 19.4849C16.2069 19.4799 16.2444 19.4607 16.3041 19.3923L16.3141 19.3809L16.3244 19.3696C16.448 19.2338 16.4985 19.1064 16.4985 18.9149C16.4985 18.5244 16.4378 18.3308 16.4038 18.2566ZM7.81388 10.2306C8.04228 10.6409 8.33313 10.9482 8.69197 11.1786L7.88159 12.4409L8.69197 11.1786C9.03061 11.396 9.38484 11.5 9.78818 11.5C10.1915 11.5 10.5457 11.396 10.8844 11.1786C11.2407 10.9499 11.5201 10.647 11.7323 10.2434L11.739 10.2306L11.746 10.2178C11.9669 9.81667 12.0778 9.38847 12.0778 8.90816V7.09184C12.0778 6.5884 11.964 6.15265 11.746 5.75678L11.739 5.74403L11.7323 5.73114C11.5231 5.33334 11.2518 5.04694 10.911 4.83808L10.8976 4.82987L10.8844 4.82139C10.5458 4.60397 10.1915 4.5 9.78818 4.5C9.38483 4.5 9.03061 4.60397 8.69197 4.82139L8.67875 4.82987L8.66536 4.83808C8.32175 5.04865 8.03906 5.33964 7.81388 5.74396C7.6078 6.14091 7.49854 6.58179 7.49854 7.09184V8.90816C7.49854 9.39561 7.60522 9.82887 7.81388 10.2306Z" />
40
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.9985 8.00002C15.9985 7.56922 16.3478 7.22 16.7786 7.22L21.2185 7.21997C21.6493 7.21997 21.9985 7.5692 21.9985 7.99999C21.9985 8.43079 21.6493 8.78002 21.2185 8.78002L16.7786 8.78004C16.3478 8.78004 15.9985 8.43081 15.9985 8.00002Z" />
41
+ </svg>`,ca=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
42
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6.4943 10.9414C6.16477 10.3145 6 9.63672 6 8.90816V7.09184C6 6.34633 6.16477 5.66012 6.4943 5.03321C6.83953 4.40631 7.30245 3.91495 7.88305 3.55913C8.46366 3.18638 9.09919 3 9.78965 3C10.4801 3 11.1156 3.18638 11.6962 3.55913C12.2768 3.91495 12.7319 4.40631 13.0615 5.03321C13.4067 5.66012 13.5793 6.34633 13.5793 7.09184V8.90816C13.5793 9.63672 13.4067 10.3145 13.0615 10.9414C12.7319 11.5683 12.2768 12.0681 11.6962 12.4409C11.1156 12.8136 10.4801 13 9.78965 13C9.09919 13 8.46366 12.8136 7.88305 12.4409C7.30245 12.0681 6.83953 11.5683 6.4943 10.9414ZM13.8644 14.5957C12.7194 14.1986 11.4313 14 10 14C8.56874 14 7.2806 14.1986 6.13559 14.5957C5.17137 14.9267 4.33522 15.3901 3.62712 15.9858C3.03955 16.4657 2.58757 16.987 2.27119 17.5496C2.0904 17.8972 2 18.3522 2 18.9149C2 19.4775 2.18079 19.9657 2.54237 20.3794C2.91902 20.7931 3.371 21 3.89831 21H16.1017C16.629 21 17.0734 20.7931 17.435 20.3794C17.8117 19.9657 18 19.4775 18 18.9149C18 18.3522 17.9096 17.8972 17.7288 17.5496C17.4124 16.987 16.9605 16.4657 16.3729 15.9858C15.6648 15.3901 14.8286 14.9267 13.8644 14.5957ZM16.6432 7.65462C16.2124 7.65462 15.8632 8.00384 15.8632 8.43464C15.8632 8.86543 16.2124 9.21466 16.6432 9.21466L21.2238 9.21466C21.6546 9.21466 22.0038 8.86543 22.0038 8.43464C22.0038 8.00384 21.6546 7.65462 21.2238 7.65462L16.6432 7.65462Z" />
43
+ </svg>`,ua=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
44
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.90816C8 9.63672 8.16477 10.3145 8.4943 10.9414C8.83953 11.5683 9.30245 12.0681 9.88305 12.4409C10.4637 12.8136 11.0992 13 11.7896 13C12.4801 13 13.1156 12.8136 13.6962 12.4409C14.2768 12.0681 14.7319 11.5683 15.0615 10.9414C15.4067 10.3145 15.5793 9.63672 15.5793 8.90816V7.09184C15.5793 6.34633 15.4067 5.66012 15.0615 5.03321C14.7319 4.40631 14.2768 3.91495 13.6962 3.55913C13.1156 3.18638 12.4801 3 11.7896 3C11.0992 3 10.4637 3.18638 9.88305 3.55913C9.30245 3.91495 8.83953 4.40631 8.4943 5.03321C8.16477 5.66012 8 6.34633 8 7.09184V8.90816ZM12 14C13.4313 14 14.7194 14.1986 15.8644 14.5957C16.8286 14.9267 17.6648 15.3901 18.3729 15.9858C18.9605 16.4657 19.4124 16.987 19.7288 17.5496C19.9096 17.8972 20 18.3522 20 18.9149C20 19.4775 19.8117 19.9657 19.435 20.3794C19.0734 20.7931 18.629 21 18.1017 21H5.89831C5.371 21 4.91902 20.7931 4.54237 20.3794C4.18079 19.9657 4 19.4775 4 18.9149C4 18.3522 4.0904 17.8972 4.27119 17.5496C4.58757 16.987 5.03955 16.4657 5.62712 15.9858C6.33522 15.3901 7.17137 14.9267 8.13559 14.5957C9.2806 14.1986 10.5687 14 12 14Z" />
45
+ </svg>
46
+ `,da=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
47
+ <path d="M8.43445 12.6265C8.40888 12.6658 8.46336 13.037 8.45381 13.1428C8.43469 13.3543 8.44114 13.5264 8.40602 13.6715C8.24328 14.7412 7.53366 15.2879 5.71437 15.4497C4.58252 15.5543 3.85663 15.3068 3.4024 14.7319C3.08891 14.3045 2.98642 13.7342 3.01174 12.967C2.99573 12.9006 2.99239 12.4507 3.02751 12.3056C3.02369 10.4 7.03906 8.58585 11.9887 8.60976C16.8967 8.60665 20.9804 10.4191 21.0002 12.3909L20.9971 12.6688L20.994 12.9466C20.9911 13.9523 20.9178 14.5203 20.5023 14.9781C20.0867 15.4359 19.3642 15.6384 18.3857 15.5067C16.2946 15.2681 15.6485 14.6246 15.6064 13.1421C15.616 13.0363 15.6286 12.6527 15.5871 12.6257C15.5742 12.2815 14.196 11.9462 12.0345 11.9979C9.81551 11.9561 8.40554 12.2159 8.43445 12.6265Z" fill="#464E53"/>
48
+ </svg>
49
+ `,fa=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
50
+ <path d="M13.8237 15.5557C13.8754 15.5557 14.1849 15.2833 14.2881 15.2288C14.4945 15.1198 14.6493 15.0109 14.8041 14.9564C15.8876 14.466 16.8163 14.7929 18.0547 16.3731C18.8286 17.3538 19.035 18.1712 18.777 18.934C18.5706 19.4789 18.1063 19.9148 17.3839 20.3507C17.3323 20.4052 16.9195 20.6776 16.7647 20.7321C15.0105 21.8764 10.9343 19.2609 7.99333 14.6839C5.05231 10.1614 4.27837 5.31201 6.08425 4.11328L6.34223 3.94982L6.60022 3.78635C7.52896 3.18698 8.09651 2.91454 8.76727 3.02351C9.43803 3.13249 10.0572 3.67737 10.5216 4.65816C11.5535 6.72869 11.3471 7.70948 10.0056 8.63578C9.9024 8.69027 9.54123 8.90822 9.54123 8.96271C9.23164 9.18066 9.74761 10.6518 11.0891 12.6134C12.379 14.6839 13.4626 15.8282 13.8237 15.5557Z" />
51
+ </svg>`,ha=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
52
+ <path d="M4 9C4 8.44772 4.44772 8 5 8H7.61626C7.86331 8 8.1016 7.90856 8.28523 7.74329L11.6648 4.70166C12.1796 4.23832 13 4.60367 13 5.29629V18.7037C13 19.3963 12.1796 19.7617 11.6648 19.2983L8.28523 16.2567C8.1016 16.0914 7.86331 16 7.61626 16H5C4.44772 16 4 15.5523 4 15V9Z" fill="#464E53"/>
53
+ <path d="M17.8604 16.6397C20.6988 13.8371 20.6988 9.2931 17.8604 6.49048" stroke="#464E53" stroke-width="1.5" stroke-linecap="round"/>
54
+ <path d="M15.8032 14.3331C17.3515 12.8044 17.3515 10.3258 15.8032 8.79715" stroke="#464E53" stroke-width="1.5" stroke-linecap="round"/>
55
+ </svg>
56
+ `,pa=`<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
57
+ <path d="M4 9C4 8.44772 4.44772 8 5 8H7.61626C7.86331 8 8.1016 7.90856 8.28523 7.74329L11.6648 4.70166C12.1796 4.23832 13 4.60367 13 5.29629V18.7037C13 19.3963 12.1796 19.7617 11.6648 19.2983L8.28523 16.2567C8.1016 16.0914 7.86331 16 7.61626 16H5C4.44772 16 4 15.5523 4 15V9Z" />
58
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.0251 13.7678C14.7322 14.0606 14.7322 14.5355 15.0251 14.8284C15.318 15.1213 15.7928 15.1213 16.0857 14.8284L17.8535 13.0607L19.6213 14.8284C19.9142 15.1213 20.389 15.1213 20.6819 14.8284C20.9748 14.5355 20.9748 14.0607 20.6819 13.7678L18.9142 12L20.6819 10.2322C20.9748 9.93933 20.9748 9.46445 20.6819 9.17156C20.389 8.87867 19.9142 8.87867 19.6213 9.17156L17.8535 10.9393L16.0857 9.17157C15.7928 8.87868 15.318 8.87868 15.0251 9.17157C14.7322 9.46447 14.7322 9.93934 15.0251 10.2322L16.7928 12L15.0251 13.7678Z" />
59
+ </svg>
60
+ `,ma=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
61
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.88889 5C2.84568 5 2 5.84568 2 6.88889V17.1111C2 18.1543 2.84568 19 3.88889 19H15.8611C16.9043 19 17.75 18.1543 17.75 17.1111V15.3089L21.0178 17.1244C21.4585 17.3692 22 17.0505 22 16.5464V7.46025C22 6.95616 21.4585 6.63753 21.0178 6.88233L17.75 8.69779V6.88889C17.75 5.84568 16.9043 5 15.8611 5H3.88889ZM5.5 10C6.32843 10 7 9.32843 7 8.5C7 7.67157 6.32843 7 5.5 7C4.67157 7 4 7.67157 4 8.5C4 9.32843 4.67157 10 5.5 10Z" />
62
+ </svg>
63
+ `,ga=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
64
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.24619 19H14.3611C15.4043 19 16.25 18.1543 16.25 17.1111V15.3089L19.5178 17.1244C19.9585 17.3692 20.5 17.0505 20.5 16.5464V7.46025C20.5 6.95616 19.9585 6.63753 19.5178 6.88233L19.1714 7.0748L7.24619 19ZM15.9249 5.82909C15.5851 5.32872 15.0115 5 14.3611 5H5.38889C4.34568 5 3.5 5.84568 3.5 6.88889V17.1111C3.5 17.4409 3.58453 17.751 3.73312 18.0209L15.9249 5.82909Z" fill="#464E53"/>
65
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.80694 20.1909C3.51405 19.8981 3.51405 19.4232 3.80694 19.1303L19.1323 3.80906C19.4252 3.51616 19.9001 3.51616 20.1929 3.80906C20.4858 4.10195 20.4858 4.57682 20.1929 4.86972L4.8676 20.1909C4.57471 20.4838 4.09983 20.4838 3.80694 20.1909Z" fill="#464E53"/>
66
+ </svg>
67
+ `,Ca=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" >
68
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M2 6.88892C2 5.84571 2.84568 5.00003 3.88889 5.00003H15.8611C16.9043 5.00003 17.75 5.84571 17.75 6.88892V8.69782L21.0178 6.88236C21.4585 6.63756 22 6.95619 22 7.46028V16.5465C22 17.0506 21.4585 17.3692 21.0178 17.1244L17.75 15.3089V17.1111C17.75 18.1543 16.9043 19 15.8611 19H3.88889C2.84568 19 2 18.1543 2 17.1111V6.88892ZM10.0103 7.96206C10.4244 7.96196 10.76 8.29759 10.7599 8.7117L10.7593 11.4966L13.5442 11.4959C13.9583 11.4958 14.2939 11.8315 14.2938 12.2456C14.2937 12.6597 13.9579 12.9955 13.5438 12.9956L10.7589 12.9962L10.7583 15.7811C10.7582 16.1952 10.4224 16.531 10.0083 16.5311C9.59416 16.5312 9.25853 16.1956 9.25862 15.7815L9.25928 12.9966L6.47441 12.9972C6.06029 12.9973 5.72466 12.6617 5.72476 12.2476C5.72485 11.8335 6.06064 11.4977 6.47476 11.4976L9.25963 11.4969L9.26028 8.71206C9.26038 8.29794 9.59616 7.96215 10.0103 7.96206Z" />
69
+ </svg>`,va=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
70
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 6.88144C3.5 5.83873 4.34568 4.99344 5.38889 4.99344H14.3611C15.4043 4.99344 16.25 5.83873 16.25 6.88144V8.69605L19.5178 6.88144C19.9585 6.63675 20.5 6.95524 20.5 7.45909V16.541C20.5 17.0449 19.9585 17.3634 19.5178 17.1187L16.25 15.3041V17.1054C16.25 18.1482 15.4043 18.9934 14.3611 18.9934H5.38889C4.34568 18.9934 3.5 18.1482 3.5 17.1054V6.88144ZM13.0396 9.21769C13.3325 9.51045 13.3325 9.9851 13.0396 10.2779L11.0699 12.2466L13.0396 14.2154C13.3325 14.5081 13.3325 14.9828 13.0396 15.2755C12.7467 15.5683 12.2718 15.5683 11.9789 15.2755L10.0093 13.3068L8.03961 15.2755C7.74671 15.5683 7.27184 15.5683 6.97895 15.2755C6.68605 14.9828 6.68605 14.5081 6.97895 14.2153L8.94861 12.2466L6.97895 10.2779C6.68605 9.98511 6.68605 9.51046 6.97895 9.21771C7.27184 8.92495 7.74671 8.92495 8.03961 9.21771L10.0093 11.1864L11.9789 9.21769C12.2718 8.92493 12.7467 8.92493 13.0396 9.21769Z" fill="#464E53"/>
71
+ </svg>
72
+ `;function Le(h){return h=h.replace(/fill="#[0-9A-Fa-f]{3,6}"/g,'fill="currentColor"'),h=h.replace(/stroke="#[0-9A-Fa-f]{3,6}"/g,'stroke="currentColor"'),h=h.replace(/<path(?![^>]*fill=)([^>]*)>/g,'<path fill="currentColor"$1>'),h}const ya={"arrow-right-square-fill":Le(Xi),boxes:Le(Qi),"camera-fill-arrows":Le(ea),"chevron-4-all-around":Le(ta),"chevron-4-cluster":Le(na),"mic-on":Le(ra),"mic-slash":Le(ia),"person-add":Le(aa),"person-add-fill":Le(oa),"person-double-fill":Le(sa),"person-minus":Le(la),"person-minus-fill":Le(ca),"person-single-fill":Le(ua),"phone-hang":Le(da),"phone-pick":Le(fa),"speaker-wave-2":Le(ha),"speaker-xmark":Le(pa),"video-camera":Le(ma),"video-camera-slash":Le(ga),"video-camera-splus":Le(Ca),"video-camera-xmark":Le(va)},ba=["innerHTML"],wa=i.defineComponent({__name:"CallKitIcon",props:{name:{},width:{default:24},height:{default:24},color:{default:"currentColor"}},setup(h){const a=h,s=i.computed(()=>{const p=ya[a.name];return p?p.replace(/width="\d+"/,`width="${a.width}"`).replace(/height="\d+"/,`height="${a.height}"`):(d.warn(`[CallKitIcon] unknown icon: ${a.name}`),"")}),c=i.computed(()=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:typeof a.width=="number"?`${a.width}px`:a.width,height:typeof a.height=="number"?`${a.height}px`:a.height,color:a.color}));return(p,m)=>(i.openBlock(),i.createElementBlock("span",{class:"callkit-icon",style:i.normalizeStyle(c.value),innerHTML:s.value},null,12,ba))}}),He=(h,a)=>{const s=h.__vccOpts||h;for(const[c,p]of a)s[c]=p;return s},dt=He(wa,[["__scopeId","data-v-9e658d5b"]]),ka=["muted"],Sa={key:1,class:"gcall-tile-placeholder"},Ea=["src"],Ia={key:2,class:"gcall-tile-loading"},_a={key:3,class:"gcall-tile-hint"},Ta={class:"gcall-tile-hover-icon"},Va={class:"gcall-tile-info"},Ma={class:"gcall-tile-name"},Ra={key:0,class:"gcall-tile-mic"},La={key:1,class:"gcall-tile-speaking"},qn=He(i.defineComponent({__name:"ParticipantTile",props:{participant:{}},emits:["click"],setup(h,{emit:a}){const s=h,c=a,p=i.ref(null),m=i.computed(()=>s.participant.isCameraOn?s.participant.isLocal?!!s.participant.localStream:s.participant.state==="publishing"&&!!s.participant.videoTrack:!1),R=i.computed(()=>s.participant.nickname?.charAt(0)?.toUpperCase()||"?"),T=i.computed(()=>{const U=s.participant.userId.split("").reduce((N,G)=>G.charCodeAt(0)+((N<<5)-N),0),H=Math.abs(U%360),K=(H+40)%360;return`linear-gradient(135deg, hsl(${H}, 60%, 45%) 0%, hsl(${K}, 60%, 35%) 100%)`});function V(U){U.style.width="100%",U.style.height="100%",U.style.objectFit="cover",U.style.maxWidth="100%",U.style.maxHeight="100%"}function B(U,H){if(!(!U||!H)){try{U.stop()}catch{}i.nextTick(()=>{requestAnimationFrame(()=>{try{U.play(H)}catch(K){d.warn("[ParticipantTile] track.play 失败",K)}})})}}i.watch([()=>s.participant.videoTrack,()=>s.participant.localStream,p],(U,H)=>{const K=p.value;if(!K)return;const[,,N]=H||[void 0,void 0,void 0],G=N!==K;if(s.participant.isLocal){const A=s.participant.videoTrack;if(A){if(G)B(A,K);else try{A.play(K)}catch{}V(K);return}if(s.participant.localStream){K.srcObject!==s.participant.localStream&&(K.srcObject=s.participant.localStream,K.play().catch(re=>d.warn("本地视频播放失败",re))),V(K);return}}const Z=s.participant.videoTrack;if(Z){if(G)B(Z,K);else try{Z.play(K)}catch{}V(K),requestAnimationFrame(()=>V(K)),setTimeout(()=>V(K),50),setTimeout(()=>V(K),300)}else K.srcObject=null},{immediate:!0});function F(){c("click",s.participant.userId)}return i.onUnmounted(()=>{const U=p.value;U&&(U.srcObject=null);const H=s.participant.videoTrack;if(H)try{H.stop()}catch{}}),(U,H)=>(i.openBlock(),i.createElementBlock("div",{class:"gcall-tile",onClick:F},[m.value?(i.openBlock(),i.createElementBlock("video",{key:0,ref_key:"videoEl",ref:p,class:i.normalizeClass(["gcall-tile-video",{mirror:U.participant.isLocal}]),autoplay:"",playsinline:"",muted:U.participant.isLocal},null,10,ka)):(i.openBlock(),i.createElementBlock("div",Sa,[U.participant.avatarUrl?(i.openBlock(),i.createElementBlock("img",{key:0,src:U.participant.avatarUrl,class:"gcall-tile-avatar",alt:"avatar"},null,8,Ea)):(i.openBlock(),i.createElementBlock("div",{key:1,class:"gcall-tile-avatar-fallback",style:i.normalizeStyle({background:T.value})},i.toDisplayString(R.value),5)),U.participant.state==="invited"?(i.openBlock(),i.createElementBlock("div",Ia,[...H[0]||(H[0]=[i.createElementVNode("div",{class:"gcall-spinner"},null,-1),i.createElementVNode("span",null,"邀请中...",-1)])])):U.participant.state==="joinedRtc"?(i.openBlock(),i.createElementBlock("div",_a," 已接通,等待画面... ")):i.createCommentVNode("",!0)])),i.createElementVNode("div",Ta,[i.createVNode(dt,{name:"chevron-4-all-around",width:14,height:14,color:"#fff"})]),i.createElementVNode("div",Va,[i.createElementVNode("span",Ma,i.toDisplayString(U.participant.nickname),1),U.participant.isMuted?(i.openBlock(),i.createElementBlock("span",Ra,[i.createVNode(dt,{name:"mic-slash",width:14,height:14})])):U.participant.isSpeaking?(i.openBlock(),i.createElementBlock("span",La,[i.createVNode(dt,{name:"speaker-wave-2",width:14,height:14})])):i.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-db8105bf"]]),Ua={class:"gcall-main-layout"},Aa={class:"gcall-main-video-inner"},Ba={key:0,class:"gcall-thumbnails"},xa=["onClick"],Na=He(i.defineComponent({__name:"MainVideoLayout",props:{participants:{type:Array,default:()=>[]},selectedId:{type:String,required:!0}},emits:["select","exit"],setup(h,{emit:a}){const s=h,c=a,p=i.ref(null),m=i.ref(!1),R=i.ref(!1),T=i.computed(()=>s.participants.find(N=>N.userId===s.selectedId)||s.participants[0]),V=i.computed(()=>s.participants.filter(N=>N.userId!==s.selectedId));function B(){const N=p.value;N&&(m.value=N.scrollLeft>0,R.value=N.scrollLeft<N.scrollWidth-N.clientWidth-2)}function F(N){const G=p.value;if(!G)return;const Z=80;G.scrollBy({left:N==="left"?-Z:Z,behavior:"smooth"})}function U(N){c("select",N)}function H(){const N=s.participants.findIndex(Z=>Z.userId===s.selectedId),G=s.participants[(N+1)%s.participants.length];G&&c("select",G.userId)}function K(){c("exit")}return i.watch(()=>s.participants.length,()=>{i.nextTick(B)}),i.nextTick(B),(N,G)=>(i.openBlock(),i.createElementBlock("div",Ua,[i.createElementVNode("div",{class:"gcall-main-video",onClick:H},[i.createElementVNode("div",Aa,[(i.openBlock(),i.createBlock(qn,{key:T.value.userId,participant:T.value},null,8,["participant"]))]),i.createElementVNode("button",{class:"gcall-main-video-exit",title:"返回九宫格",onClick:i.withModifiers(K,["stop"])},[i.createVNode(dt,{name:"chevron-4-cluster",width:16,height:16,color:"#fff"})])]),V.value.length>0?(i.openBlock(),i.createElementBlock("div",Ba,[m.value?(i.openBlock(),i.createElementBlock("button",{key:0,class:"gcall-scroll-btn",onClick:G[0]||(G[0]=Z=>F("left"))},[...G[2]||(G[2]=[i.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[i.createElementVNode("path",{d:"M8 2L4 6L8 10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):i.createCommentVNode("",!0),i.createElementVNode("div",{ref_key:"scrollRef",ref:p,class:"gcall-thumbnails-scroll",onScroll:B},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(V.value,Z=>(i.openBlock(),i.createElementBlock("div",{key:Z.userId,class:i.normalizeClass(["gcall-thumbnail",{active:Z.userId===h.selectedId}]),onClick:A=>U(Z.userId)},[i.createVNode(qn,{participant:Z},null,8,["participant"])],10,xa))),128))],544),R.value?(i.openBlock(),i.createElementBlock("button",{key:1,class:"gcall-scroll-btn",onClick:G[1]||(G[1]=Z=>F("right"))},[...G[3]||(G[3]=[i.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[i.createElementVNode("path",{d:"M4 2L8 6L4 10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0b9e98dc"]]),Oa=He(i.defineComponent({__name:"VideoGrid",props:{participants:{type:Array,default:()=>[]},selectedId:{type:String,default:null}},emits:["select"],setup(h,{emit:a}){const s=h,c=a,p=i.computed(()=>{const V=s.participants.length;if(V<=1)return{gridTemplateColumns:"1fr",gridTemplateRows:"1fr"};if(V===2)return{gridTemplateColumns:"1fr 1fr",gridTemplateRows:"1fr"};if(V<=4)return{gridTemplateColumns:"1fr 1fr",gridTemplateRows:"1fr 1fr"};if(V<=6)return{gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr"};if(V<=9)return{gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"};const B=Math.ceil(Math.sqrt(V)),F=Math.ceil(V/B);return{gridTemplateColumns:`repeat(${B}, 1fr)`,gridTemplateRows:`repeat(${F}, 1fr)`}});function m(V){s.participants.length>1&&c("select",V)}function R(V){c("select",V)}function T(){c("select",null)}return(V,B)=>h.selectedId&&h.participants.length>1?(i.openBlock(),i.createBlock(Na,{key:0,participants:h.participants,"selected-id":h.selectedId,onSelect:R,onExit:T},null,8,["participants","selected-id"])):(i.openBlock(),i.createElementBlock("div",{key:1,class:"gcall-grid",style:i.normalizeStyle(p.value)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.participants,F=>(i.openBlock(),i.createElementBlock("div",{key:F.userId,class:"gcall-grid-cell"},[i.createVNode(qn,{participant:F,onClick:m},null,8,["participant"])]))),128))],4))}}),[["__scopeId","data-v-ed398bd6"]]);let un;function Kr(h){un=h}function Ll(h){}async function Hn(h){if(!h.length)return[];const{useGlobalCallStore:a}=await Promise.resolve().then(()=>zi),s=a(),c=new Map,p=[];for(const m of h){const R=s.getUserInfo(m);R.nickname||R.avatarURL?c.set(m,{userId:m,nickname:R.nickname,avatarUrl:R.avatarURL}):p.push(m)}if(!p.length)return h.map(m=>c.get(m)||{userId:m});if(!un)return h.map(m=>c.get(m)||{userId:m});try{const m=await un(p),R=new Map(m.map(T=>[T.userId,T]));for(const T of p){const V=R.get(T);(V?.nickname||V?.avatarUrl)&&(s.setUserInfo(T,{nickname:V.nickname,avatarURL:V.avatarUrl}),c.set(T,V))}return d.debug("[UserProfileService] 批量解析用户资料完成",{total:h.length,cached:h.length-p.length,fetched:p.length}),h.map(T=>c.get(T)||{userId:T})}catch(m){return d.warn("[UserProfileService] 获取用户信息失败",m),h.map(R=>c.get(R)||{userId:R})}}function Pa(){un=void 0}async function Da(h,a,s,c){if(c){if(typeof h.contact?.fetchUserInfoById=="function")return d.debug("[IMSdkAdapter] miniCore: contact.fetchUserInfoById"),h.contact.fetchUserInfoById(a,s);throw new Error("[IMSdkAdapter] miniCore 模式下无法获取用户资料:client.contact.fetchUserInfoById 不存在,请确认 miniCore 已正确注册用户资料插件")}if(typeof h.fetchUserInfoById=="function")return d.debug("[IMSdkAdapter] full: fetchUserInfoById"),h.fetchUserInfoById(a,s);throw new Error("[IMSdkAdapter] full 模式下无法获取用户资料:client.fetchUserInfoById 不存在,请确认 easemob-websdk 已正确安装")}async function Ka(h,a,s){if(s){if(typeof h.group?.getGroupMembers=="function")return d.debug("[IMSdkAdapter] miniCore: group.getGroupMembers"),h.group.getGroupMembers(a);throw new Error("[IMSdkAdapter] miniCore 模式下无法获取群成员列表:client.group.getGroupMembers 不存在,请确认 miniCore 已正确注册群组插件")}if(typeof h.getGroupMembers=="function")return d.debug("[IMSdkAdapter] full: getGroupMembers"),h.getGroupMembers(a);throw new Error("[IMSdkAdapter] full 模式下无法获取群成员列表:client.getGroupMembers 不存在,请确认 easemob-websdk 已正确安装")}const $a={class:"member-list-container"},ja={class:"member-list-content"},Fa={key:0,class:"loading-state"},Ga={key:1,class:"empty-state"},qa={key:2,class:"list"},Ha=["onClick"],za={class:"member-avatar-wrap"},Za=["src"],Wa={class:"name"},Ya={class:"status"},Ja={key:0,class:"status-text"},Xa={key:1,class:"status-text inviting"},Qa={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},eo={class:"member-list-footer"},to=["disabled"],zn=He(i.defineComponent({__name:"EasemobChatGroupMemberList",props:{groupId:{},members:{},existingUserIds:{},invitingUserIds:{}},emits:["close","invite"],setup(h,{emit:a}){function s(Z){return Z?.charAt(0)?.toUpperCase()||"?"}function c(Z){const A=Z.split("").reduce((ve,de)=>de.charCodeAt(0)+((ve<<5)-ve),0),re=Math.abs(A%360),ce=(re+40)%360;return`linear-gradient(135deg, hsl(${re}, 60%, 45%) 0%, hsl(${ce}, 60%, 35%) 100%)`}const p=h,m=a,R=Xe(),T=i.ref([]),V=i.ref([]),B=i.ref(!1),F=i.computed(()=>p.members&&p.members.length>0?p.members:T.value),U=async()=>{const Z=R.getChatClient;if(!Z||!p.groupId){d.warn("EasemobChatGroupMemberList: 无法获取群成员,client或groupId未提供",{hasClient:!!Z,groupId:p.groupId});return}B.value=!0;try{const A=Z.user,re=R.getIsMiniCore,ce=[];let ve=null;const de=100;do{const oe=await Ka(Z,{groupId:p.groupId,pageSize:de,cursor:ve},re);(Array.isArray(oe.data?.members)?oe.data.members:Array.isArray(oe.data)?oe.data:[]).forEach($=>{const x=$.userId||$.member||$.owner;x&&x!==A&&ce.push({userId:x})}),ve=oe.data?.cursor||null}while(ve);if(ce.length>0){const oe=await Hn(ce.map($=>$.userId)),M=new Map(oe.map($=>[$.userId,$]));T.value=ce.map($=>{const x=M.get($.userId);return{userId:$.userId,userName:x?.nickname||$.userId,avatar:x?.avatarUrl}}),d.info("EasemobChatGroupMemberList: 获取并 enrich 群成员成功",{groupId:p.groupId,count:ce.length})}else T.value=[]}catch(A){d.error("EasemobChatGroupMemberList: 获取群成员失败",A)}finally{B.value=!1}},H=Z=>{if(p.existingUserIds.includes(Z))return;const A=V.value.indexOf(Z);A>-1?V.value.splice(A,1):V.value.push(Z)},K=()=>{V.value=[]},N=()=>{K(),m("close")},G=()=>{m("invite",[...V.value]),N()};return i.onMounted(()=>{if(p.members&&p.members.length>0){d.info("EasemobChatGroupMemberList: 使用外部传入的成员列表",{count:p.members.length});return}U()}),(Z,A)=>(i.openBlock(),i.createElementBlock("div",{class:"easemob-chat-member-list-modal",onClick:i.withModifiers(N,["self"])},[i.createElementVNode("div",$a,[i.createElementVNode("div",{class:"member-list-header"},[A[1]||(A[1]=i.createElementVNode("h3",null,"邀请成员",-1)),i.createElementVNode("button",{class:"close-btn",onClick:N},[...A[0]||(A[0]=[i.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),i.createElementVNode("div",ja,[B.value?(i.openBlock(),i.createElementBlock("div",Fa,[...A[2]||(A[2]=[i.createElementVNode("div",{class:"spinner"},null,-1),i.createElementVNode("span",null,"加载中...",-1)])])):F.value.length===0?(i.openBlock(),i.createElementBlock("div",Ga,[...A[3]||(A[3]=[i.createStaticVNode('<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-5f8a1ac8><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" data-v-5f8a1ac8></path><circle cx="9" cy="7" r="4" data-v-5f8a1ac8></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87" data-v-5f8a1ac8></path><path d="M16 3.13a4 4 0 0 1 0 7.75" data-v-5f8a1ac8></path></svg><span data-v-5f8a1ac8>暂无可选成员</span>',2)])])):(i.openBlock(),i.createElementBlock("div",qa,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(F.value,re=>(i.openBlock(),i.createElementBlock("div",{key:re.userId,class:i.normalizeClass(["member-item",{selected:V.value.includes(re.userId),disabled:Z.existingUserIds.includes(re.userId),inviting:Z.invitingUserIds?.includes(re.userId)}]),onClick:ce=>H(re.userId)},[i.createElementVNode("div",za,[re.avatar?(i.openBlock(),i.createElementBlock("img",{key:0,src:re.avatar,class:"member-avatar"},null,8,Za)):(i.openBlock(),i.createElementBlock("div",{key:1,class:"member-avatar-fallback",style:i.normalizeStyle({background:c(re.userId)})},i.toDisplayString(s(re.userName)),5))]),i.createElementVNode("span",Wa,i.toDisplayString(re.userName),1),i.createElementVNode("div",Ya,[Z.existingUserIds.includes(re.userId)?(i.openBlock(),i.createElementBlock("span",Ja,"已在通话中")):Z.invitingUserIds?.includes(re.userId)?(i.openBlock(),i.createElementBlock("span",Xa,[...A[4]||(A[4]=[i.createElementVNode("span",{class:"mini-spinner"},null,-1),i.createTextVNode(" 邀请中 ",-1)])])):(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["custom-checkbox",{checked:V.value.includes(re.userId)}])},[V.value.includes(re.userId)?(i.openBlock(),i.createElementBlock("svg",Qa,[...A[5]||(A[5]=[i.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):i.createCommentVNode("",!0)],2))])],10,Ha))),128))]))]),i.createElementVNode("div",eo,[i.createElementVNode("button",{class:"cancel-btn",onClick:N},"取消"),i.createElementVNode("button",{class:"invite-btn",disabled:V.value.length===0,onClick:G}," 确定"+i.toDisplayString(V.value.length>0?` (${V.value.length})`:""),9,to)])])]))}}),[["__scopeId","data-v-5f8a1ac8"]]);function qt(h={}){const{initialX:a=0,initialY:s=0,centered:c=!1,width:p=0,height:m=0,boundary:R=!1,boundaryPadding:T=0,onDragStart:V,onDragEnd:B}=h,F=i.ref(null),U=i.ref(!1),H=i.ref(!1),K=i.ref({x:a,y:s}),N=i.ref({x:0,y:0}),G=i.ref(!1),Z=()=>!p||!m?{x:a,y:s}:{x:(window.innerWidth-p)/2,y:(window.innerHeight-m)/2},A=(x,ae)=>{if(!R)return{x,y:ae};const J=p||F.value?.offsetWidth||0,W=m||F.value?.offsetHeight||0;if(!J||!W)return{x,y:ae};const ee=window.innerWidth,ye=window.innerHeight,ue=T,Q=ee-J-T,fe=T,ke=ye-W-T;return{x:Math.max(ue,Math.min(Q,x)),y:Math.max(fe,Math.min(ke,ae))}},re=()=>{if(!G.value){if(c&&p&&m){const x=Z();K.value=A(x.x,x.y)}else K.value=A(a,s);G.value=!0}};re();const ce=i.computed(()=>({position:"fixed",left:`${K.value.x}px`,top:`${K.value.y}px`,cursor:U.value?"grabbing":"grab",userSelect:"none",transition:U.value?"none":void 0})),ve=x=>"touches"in x?{clientX:x.touches[0].clientX,clientY:x.touches[0].clientY}:{clientX:x.clientX,clientY:x.clientY},de=x=>{if(!U.value)return;const{clientX:ae,clientY:J}=ve(x);let W=ae-N.value.x,ee=J-N.value.y;const ye=A(W,ee);K.value=ye,H.value||(H.value=!0)},oe=x=>{if("button"in x&&x.button!==0)return;H.value=!1,U.value=!0;const{clientX:ae,clientY:J}=ve(x);N.value={x:ae-K.value.x,y:J-K.value.y},V?.(),document.addEventListener("mousemove",de),document.addEventListener("mouseup",M),document.addEventListener("touchmove",de,{passive:!1}),document.addEventListener("touchend",M)},M=()=>{U.value&&(U.value=!1,document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",de),document.removeEventListener("touchend",M),B?.())},$=()=>{if(G.value)if(c&&!H.value&&p&&m){const x=Z();K.value=A(x.x,x.y)}else R&&(K.value=A(K.value.x,K.value.y))};return i.onMounted(()=>{re(),window.addEventListener("resize",$)}),i.onUnmounted(()=>{window.removeEventListener("resize",$),M()}),{elementRef:F,isDragging:U,hasDragged:H,position:K,style:ce,startDrag:oe,stopDrag:M}}function no(h,a,s={}){return qt({centered:!0,width:h,height:a,...s})}function $r(h,a,s,c=20,p={}){const R=(()=>{const T=window.innerWidth,V=window.innerHeight;switch(h){case"top-right":return{x:T-a-c,y:c};case"bottom-left":return{x:c,y:V-s-c};case"bottom-right":return{x:T-a-c,y:V-s-c};case"top-left":default:return{x:c,y:c}}})();return qt({initialX:R.x,initialY:R.y,width:a,height:s,...p})}const ro={class:"gcall-header-left"},io={class:"gcall-title"},ao={class:"gcall-duration"},oo={class:"gcall-header-right"},so={class:"gcall-control-group"},lo={class:"gcall-control-label"},co={class:"gcall-control-group"},uo={class:"gcall-control-label"},fo={class:"gcall-control-group"},jr=800,Fr=600,Zn=He(i.defineComponent({__name:"GroupCallShell",props:{groupId:{},groupName:{},currentUserId:{},currentNickname:{},currentAvatarUrl:{},rtcService:{},groupMembers:{}},emits:["hangup","addParticipant"],setup(h,{expose:a,emit:s}){const c=h,p=s,m=Ji(),R=Be(),T=i.ref(!1),V=i.ref(!1),{elementRef:B,isDragging:F,hasDragged:U,style:H,startDrag:K}=qt({centered:!0,width:jr,height:Fr,boundary:!0,boundaryPadding:10}),N=i.computed(()=>({...H.value,width:`${jr}px`,height:`${Fr}px`,maxWidth:"90vw",maxHeight:"90vh",zIndex:1e3})),G=i.computed(()=>{const Q=m.participants.value;return Array.isArray(Q)?Q:[]}),Z=i.computed(()=>m.localParticipant.value),A=i.computed(()=>m.selectedParticipantId.value),re=i.computed(()=>G.value.map(Q=>Q.userId)),ce=i.computed(()=>G.value.filter(Q=>Q.state==="invited").map(Q=>Q.userId)),ve=i.ref(0),de=i.ref(0);let oe=null;function M(){oe&&clearInterval(oe),ve.value=Date.now(),de.value=0,oe=setInterval(()=>{de.value++},1e3)}function $(){oe&&(clearInterval(oe),oe=null),ve.value=0,de.value=0}const x=i.computed(()=>{if(de.value,!ve.value)return"00:00";const Q=Math.floor((Date.now()-ve.value)/1e3),fe=Math.floor(Q/60).toString().padStart(2,"0"),ke=(Q%60).toString().padStart(2,"0");return`${fe}:${ke}`});function ae(){V.value=!V.value}function J(Q){m.selectParticipant(Q)}a({startSession:Q=>{m.startSession({sessionId:Q.sessionId,groupId:c.groupId,callType:Q.callType,localUserId:c.currentUserId,localNickname:c.currentNickname||c.currentUserId,localAvatarUrl:c.currentAvatarUrl}),M()},addRemoteParticipant:m.addRemoteParticipant,markRemoteAccepted:m.markRemoteAccepted,bindRtcService:m.bindRtcService,unbindRtcService:m.unbindRtcService,sendInvite:m.sendInvite}),i.watch(()=>c.rtcService,Q=>{if(Q){m.bindRtcService(Q);const fe=Q.getLocalVideoTrack?.();fe&&R.localStream&&m.setLocalVideoTrack(fe)}else m.unbindRtcService()},{immediate:!0}),i.watch(()=>R.localStream,Q=>{if(Q){d.info("[GroupCallShell] 检测到本地视频流更新"),m.setLocalStream(Q);const fe=c.rtcService?.getLocalVideoTrack?.();fe&&m.setLocalVideoTrack(fe)}},{immediate:!0});async function W(){if(!c.rtcService)return;const Q=!Z.value?.isMuted;try{const fe=await c.rtcService.toggleAudio(!Q);m.setLocalMute(!fe)}catch(fe){d.error("[GroupCallShell] 切换静音失败",fe)}}async function ee(){if(!c.rtcService)return;const Q=!Z.value?.isCameraOn;try{const fe=await c.rtcService.toggleVideo(Q);m.setLocalCamera(fe)}catch(fe){d.error("[GroupCallShell] 切换摄像头失败",fe)}}async function ye(){await m.hangup(),$(),p("hangup")}i.onUnmounted(()=>{$(),m.unbindRtcService()});async function ue(Q){try{await m.sendInvite(Q,c.groupId,"邀请你加入音视频通话"),T.value=!1}catch(fe){d.error("[GroupCallShell] 邀请成员失败",fe)}}return(Q,fe)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"shellRef",ref:B,class:i.normalizeClass(["gcall-shell",{"is-dragging":i.unref(F)}]),style:i.normalizeStyle(N.value)},[i.createElementVNode("div",{class:i.normalizeClass(["gcall-header",{hidden:V.value}]),onMousedown:fe[1]||(fe[1]=(...ke)=>i.unref(K)&&i.unref(K)(...ke))},[i.createElementVNode("div",ro,[i.createElementVNode("span",io,i.toDisplayString(Q.groupName||"群组通话"),1),i.createElementVNode("span",ao,i.toDisplayString(x.value),1)]),i.createElementVNode("div",oo,[i.createElementVNode("button",{class:"gcall-header-btn",title:"添加成员",onClick:fe[0]||(fe[0]=ke=>T.value=!0)},[i.createVNode(dt,{name:"person-add-fill",width:20,height:20})])])],34),i.createElementVNode("div",{class:"gcall-content",onClick:ae},[i.createVNode(Oa,{participants:G.value,"selected-id":A.value,onSelect:J},null,8,["participants","selected-id"]),i.createElementVNode("div",{class:i.normalizeClass(["gcall-clear-hint",{show:V.value}])}," 点击画面恢复 controls ",2)]),i.createElementVNode("div",{class:i.normalizeClass(["gcall-controls",{hidden:V.value}])},[i.createElementVNode("div",so,[i.createElementVNode("button",{class:i.normalizeClass(["gcall-control-btn",{active:Z.value?.isMuted}]),onClick:W},[i.createVNode(dt,{name:Z.value?.isMuted?"mic-slash":"mic-on",width:20,height:20},null,8,["name"])],2),i.createElementVNode("span",lo,i.toDisplayString(Z.value?.isMuted?"取消静音":"静音"),1)]),i.createElementVNode("div",co,[i.createElementVNode("button",{class:i.normalizeClass(["gcall-control-btn",{"disabled-state":!Z.value?.isCameraOn}]),onClick:ee},[i.createVNode(dt,{name:Z.value?.isCameraOn?"video-camera":"video-camera-xmark",width:20,height:20},null,8,["name"])],2),i.createElementVNode("span",uo,i.toDisplayString(Z.value?.isCameraOn?"关闭摄像头":"开启摄像头"),1)]),i.createElementVNode("div",fo,[i.createElementVNode("button",{class:"gcall-control-btn hangup",onClick:ye},[i.createVNode(dt,{name:"phone-hang",width:20,height:20})]),fe[3]||(fe[3]=i.createElementVNode("span",{class:"gcall-control-label"},"挂断",-1))])],2),T.value?(i.openBlock(),i.createBlock(zn,{key:0,"group-id":Q.groupId,members:Q.groupMembers,"existing-user-ids":re.value,"inviting-user-ids":ce.value,onClose:fe[2]||(fe[2]=ke=>T.value=!1),onInvite:ue},null,8,["group-id","members","existing-user-ids","inviting-user-ids"])):i.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-aae8b065"]]);class ho{listeners=new Map;on(a,s){return this.listeners.has(a)||this.listeners.set(a,new Set),this.listeners.get(a).add(s),d.verbose(`[CallKitEventBus] 订阅事件: ${a}`),()=>this.off(a,s)}once(a,s){const c=p=>{this.off(a,c),s(p)};return this.on(a,c)}off(a,s){this.listeners.get(a)?.delete(s)}emit(a,s){const c=this.listeners.get(a);if(!c||c.size===0){d.verbose(`[CallKitEventBus] 事件 ${a} 无订阅者,跳过`);return}d.debug(`[CallKitEventBus] 触发事件: ${a}`,s),c.forEach(p=>{try{p(s)}catch(m){d.error(`[CallKitEventBus] 事件 ${a} 的 handler 执行失败:`,m)}})}clear(a){a?(this.listeners.delete(a),d.debug(`[CallKitEventBus] 清空事件 ${a} 的所有订阅`)):(this.listeners.clear(),d.debug("[CallKitEventBus] 清空所有事件订阅"))}listenerCount(a){return this.listeners.get(a)?.size??0}}const Me=new ho;function Gr(){const h=Xe();return h.getChatClient?.context?.userId||h.getChatClient?.user||""}function po(h){return h===Ee.VIDEO_MULTI||h===Ee.AUDIO_MULTI}function mo(h,a){const s=h.groupId,c=s||po(h.type),p=c?s||"":h.callerUserId===Gr()?h.calleeUserId||"":h.callerUserId,m=c?"participant":h.callerUserId===Gr()?"caller":"callee";return{callId:h.callId,channel:h.channel,type:h.type,callerUserId:h.callerUserId,calleeUserId:h.calleeUserId,groupId:s,conversationId:p,isLocal:a,localUserRole:m}}const xe=i.reactive({status:je.CALL_STATUS.IDLE,callId:"",channel:"",token:"",type:je.CALL_TYPE.AUDIO_1V1,callerDevId:"",calleeDevId:"",callerUserId:"",calleeUserId:"",audioEnabled:!0,videoEnabled:!0,startTime:null}),Wn=i.shallowRef(null),qr=i.ref([]),Yn=i.shallowRef(null),Bt=i.ref([]),yt=i.ref(null),Jn=i.ref(!1),Xn=i.ref(new Set);let ge=null;function go(h){return h===je.CALL_TYPE.VIDEO_MULTI||h===je.CALL_TYPE.AUDIO_MULTI}function Co(h){switch(h){case"hangup":return _e.HANGUP;case"cancel":return _e.CANCEL;case"refuse":return _e.REMOTE_REFUSE;case"busy":return _e.BUSY;case"timeout":return _e.NO_RESPONSE;case"remoteCancel":return _e.REMOTE_CANCEL;case"remoteHangup":return _e.HANGUP;case"normal":return _e.HANGUP;default:return _e.HANGUP}}function vo(h){const a=h.payload;return typeof a.isRemote=="boolean"?!a.isRemote:!new Set(["callRefused","callBusy","callCanceled","callTimeout","singleCallRefused","singleCallBusy","singleCallCanceled","singleCallTimeout","groupCallRefused","groupCallBusy","groupCallCanceled","groupCallTimeout"]).has(h.type)}function dn(){return{rtcChannelStore:Be(),callTimerStore:At(),globalCallStore:qe(),groupCallStore:Qe(),chatClientStore:Xe()}}function et(h){xe.status=h.status,xe.callId=h.callId,xe.channel=h.channel,xe.token=h.token,xe.type=h.type,xe.callerDevId=h.callerDevId,xe.calleeDevId=h.calleeDevId,xe.callerUserId=h.callerUserId,xe.calleeUserId=h.calleeUserId,xe.audioEnabled=h.audioEnabled,xe.videoEnabled=h.videoEnabled,xe.startTime=h.startTime}function fn(){ge&&(Wn.value=ge.getGroupCallSession(),qr.value=ge.getGroupCallParticipants())}function yo(h){const a={type:h.type,payload:h.payload,timestamp:Date.now()};Bt.value.push(a),Bt.value.length>100&&(Bt.value=Bt.value.slice(-100)),Yn.value=h}function Ne(h){const a=h.payload,s=vo(h);return{...mo({callId:a.callId||"",channel:a.channel||"",type:a.callType||je.CALL_TYPE.AUDIO_1V1,callerUserId:a.callerUserId||"",calleeUserId:a.calleeUserId,groupId:a.groupId},s),...a,isLocal:s}}async function bo(){const h=dn(),a=h.rtcChannelStore.getRtcService();if(a){try{const s=a.getClient();if(s&&s.connectionState==="CONNECTED"){const c=s.localTracks;c&&c.length>0&&await s.unpublish(c)}}catch(s){d.debug("[useCallKitCore] unpublish 失败:",s)}try{await a.leaveChannel()}catch(s){d.debug("[useCallKitCore] leaveChannel 失败:",s)}}h.rtcChannelStore.reset()}function wo(h){const a=dn();let s=0;try{const p=a.callTimerStore;p.callStartTime>0&&(s=Date.now()-p.callStartTime,p.reset());const m=a.groupCallStore;m.session?.startTime&&m.session.startTime>0&&(s=Date.now()-m.session.startTime,m.destroySession())}catch{}const c=a.globalCallStore;return c.isMinimized&&(c.isMinimized=!1),s}async function ko(h){yo(h),Xn.value.forEach(R=>{try{R(h)}catch(T){d.error("[useCallKitCore] 事件 handler 执行失败:",T)}});const a=dn(),{rtcChannelStore:s,callTimerStore:c,groupCallStore:p,chatClientStore:m}=a;switch(ge&&et(ge.getSingleCallState()),fn(),h.type){case"statusChanged":{Me.emit("statusChanged",Ne(h));break}case"incomingCall":{Me.emit("incomingCall",Ne(h));break}case"callInvited":{const R=Ne(h);Me.emit("callInvited",R),Me.emit(go(h.payload.callType)?"groupCallInvited":"singleCallInvited",R);break}case"callConnected":{Me.emit("callConnected",Ne(h));break}case"callStarted":{c.startCallTimer(),Me.emit("callStarted",Ne(h));break}case"callEnded":{const R=h.payload,T=Co(R.reason),V=T===_e.REMOTE_CANCEL,B=T===_e.REMOTE_REFUSE,F=m.getChatClient?.user||"",U=V||B?xe.callerUserId===F?xe.calleeUserId:xe.callerUserId:F;try{await bo()}catch(K){d.error("[useCallKitCore] 资源清理失败:",K)}const H=wo();et({status:je.CALL_STATUS.IDLE,callId:"",channel:"",token:"",type:je.CALL_TYPE.AUDIO_1V1,callerDevId:"",calleeDevId:"",callerUserId:"",calleeUserId:"",audioEnabled:!0,videoEnabled:!0,startTime:null}),Me.emit("callEnded",{...Ne(h),reason:T,duration:R.duration||H||0,endedBy:U});break}case"callTimeout":{Me.emit("callTimeout",Ne(h));break}case"callRefused":{Me.emit("callRefused",Ne(h));break}case"callBusy":{Me.emit("callBusy",Ne(h));break}case"callCanceled":{Me.emit("callCanceled",Ne(h));break}case"singleCallInvited":case"singleCallStarted":case"singleCallConnected":case"singleCallEnded":case"singleCallTimeout":case"singleCallRefused":case"singleCallBusy":case"singleCallCanceled":case"groupCallInvited":case"groupCallStarted":case"groupCallConnected":case"groupCallEnded":case"groupCallTimeout":case"groupCallRefused":case"groupCallBusy":case"groupCallCanceled":{Me.emit(h.type,Ne(h));break}case"shouldJoinRtc":{const R=h.payload;d.info("[useCallKitCore] shouldJoinRtc(RtcAdapter 处理)",{channel:R.channel,role:R.role});break}case"shouldLeaveRtc":{d.info("[useCallKitCore] shouldLeaveRtc");const R=s.getRtcService();R&&R.leaveChannel().catch(()=>{});break}case"localAudioChanged":{const R=h.payload;s.setAudioEnabled(R.enabled);break}case"localVideoChanged":{const R=h.payload;s.setVideoEnabled(R.enabled);break}case"groupCallInit":{const R=h.payload;p.initSession({sessionId:R.channel,groupId:R.groupId,groupName:R.groupName,callType:R.callType,isActive:!0,startTime:Date.now()});const T=m.getChatClient?.user||"",V=a.globalCallStore;if(T){const F=V.getUserInfo(T);p.addParticipant({userId:T,nickname:F.nickname||T,avatarUrl:F.avatarURL,state:"invited",isLocal:!0,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:R.callType==="video",isSpeaking:!1})}const B=R.callerUserId;if(B&&B!==T){const F=V.getUserInfo(B);p.addParticipant({userId:B,nickname:F.nickname||B,avatarUrl:F.avatarURL,state:"joinedRtc",isLocal:!1,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:!1,isSpeaking:!1})}(R.invitedMembers||[]).forEach(F=>{if(F===T||F===B)return;const U=V.getUserInfo(F);p.addParticipant({userId:F,nickname:U.nickname||F,avatarUrl:U.avatarURL,state:"invited",isLocal:!1,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:R.callType==="video",isSpeaking:!1})}),Me.emit("groupCallInit",Ne(h));break}case"participantStateChanged":{const R=h.payload;p.setParticipantState(R.userId,R.state),Me.emit("participantStateChanged",Ne(h));break}case"participantJoined":{const R=h.payload,V=a.globalCallStore.getUserInfo(R.userId);if(!p.participants.has(R.userId))p.addParticipant({userId:R.userId,nickname:V.nickname||R.userId,avatarUrl:V.avatarURL,state:"joinedRtc",isLocal:!1,videoTrack:null,audioTrack:null,localStream:null,isMuted:!1,isCameraOn:!1,isSpeaking:!1});else{const B=p.participants.get(R.userId);B&&B.state!=="joinedRtc"&&B.state!=="publishing"&&p.markAccepted(R.userId)}Me.emit("participantJoined",Ne(h));break}case"participantLeft":{const R=h.payload;p.setParticipantState(R.userId,"left"),setTimeout(()=>p.removeParticipant(R.userId),2e3),Me.emit("participantLeft",Ne(h));break}case"rtcReport":{Me.emit("rtcReport",Ne(h));break}case"callDurationUpdated":{const R=h.payload;c.callDuration=Math.floor(R.duration/1e3),Me.emit("callDurationUpdated",Ne(h));break}case"callError":{d.error("[useCallKitCore] callError:",h.payload),Me.emit("callError",Ne(h));break}}}function tt(){async function h(U){ge&&(d.warn("[useCallKitCore] 已初始化,先销毁旧实例"),await ge.destroy(),ge=null);const H=new je.CallKitCore({imClient:U.imClient,userProfile:U.userProfile,inviteTimeout:U.inviteTimeout,logger:d,rtcAdapter:Zi({getCoreCallState:()=>({type:xe.type,callerUserId:xe.callerUserId,calleeUserId:xe.calleeUserId}),getCurrentUserId:()=>dn().chatClientStore.getChatClient?.user||""}),onEvent:ko,createMessage:K=>{const N=Pi;if(N?.message?.create)return N.message.create(K);const G=U.imClient;if(G?.Message?.create)return G.Message.create(K);throw new Error("[useCallKitCore] 无法创建消息:未检测到 message.create API(请确认 easemob-websdk full 版已安装,或 miniCore 已注册消息插件)")}});ge=H,Jn.value=!0,yt.value=null,et(H.getSingleCallState()),d.info("[useCallKitCore] 初始化完成")}async function a(U){if(!ge)throw new Error("CallKitCore 未初始化");try{await ge.inviteCall(U),et(ge.getSingleCallState())}catch(H){throw yt.value=H.message,H}}async function s(U){if(!ge)throw new Error("CallKitCore 未初始化");try{await ge.answerCall(U),et(ge.getSingleCallState())}catch(H){throw yt.value=H.message,H}}async function c(U){if(!ge)throw new Error("CallKitCore 未初始化");try{await ge.hangup(U),et(ge.getSingleCallState())}catch(H){throw yt.value=H.message,H}}async function p(U){if(!ge)throw new Error("CallKitCore 未初始化");try{await ge.inviteGroupCall(U),et(ge.getSingleCallState()),fn()}catch(H){throw yt.value=H.message,H}}async function m(U){if(!ge)throw new Error("CallKitCore 未初始化");try{await ge.inviteMoreParticipants(U),fn()}catch(H){throw yt.value=H.message,H}}function R(){ge&&(ge.toggleAudio(),et(ge.getSingleCallState()))}function T(){ge&&(ge.toggleVideo(),et(ge.getSingleCallState()))}function V(U){ge&&(ge.reportRtcEvent(U),fn())}async function B(){ge&&(await ge.destroy(),ge=null,Jn.value=!1,et({status:je.CALL_STATUS.IDLE,callId:"",channel:"",token:"",type:je.CALL_TYPE.AUDIO_1V1,callerDevId:"",calleeDevId:"",callerUserId:"",calleeUserId:"",audioEnabled:!0,videoEnabled:!0,startTime:null}),Wn.value=null,Bt.value=[],Yn.value=null)}function F(U){return Xn.value.add(U),()=>{Xn.value.delete(U)}}return{callState:i.readonly(xe),groupSession:i.readonly(Wn),groupParticipants:i.readonly(qr),lastEvent:i.readonly(Yn),eventLog:i.readonly(Bt),error:i.readonly(yt),isInitialized:i.readonly(Jn),init:h,inviteCall:a,answerCall:s,hangup:c,inviteGroupCall:p,inviteMoreParticipants:m,toggleAudio:R,toggleVideo:T,reportRtcEvent:V,destroy:B,onCallEvent:F,canAccept:()=>ge?.canAccept()??!1,canReject:()=>ge?.canReject()??!1,canHangup:()=>ge?.canHangup()??!1,isWaitingCalleeAction:()=>ge?.isWaitingCalleeAction()??!1,isInActiveCall:()=>ge?.isInActiveCall()??!1,isInCall:()=>ge?.isInCall()??!1,isCalling:()=>ge?.isCalling()??!1,isIdle:()=>ge?.isIdle()??!0,CALL_STATUS:je.CALL_STATUS,CALL_TYPE:je.CALL_TYPE}}class xt{static instance;enabled=!1;static getInstance(){return xt.instance||(xt.instance=new xt),xt.instance}setEnabled(a){this.enabled=a}isEnabled(){return this.enabled}async playIncomingRingtone(){this.enabled&&console.debug("[RingtoneService] 播放来电铃声(桩函数)")}async playOutgoingRingtone(){this.enabled&&console.debug("[RingtoneService] 播放去电铃声(桩函数)")}stopRingtone(){console.debug("[RingtoneService] 停止铃声(桩函数)")}}const So={class:"easemob-callkit-provider"},Hr=i.defineComponent({__name:"EasemobChatCallKitProvider",props:{chatClient:{},agoraClient:{},agoraAppId:{},isMiniCore:{type:Boolean},initConfig:{},getUserInfo:{type:Function},getGroupInfo:{type:Function}},setup(h){const a=i.ref(!1),s={debug:!1,enableRingtone:!0,resizable:!0,draggable:!0,inviteTimeout:3e4},c=h,p=Xe();i.watch(()=>c.chatClient,A=>{A?(d.info("CallKit Provider 接收到环信客户端实例"),p.setClient(A)):d.warn("CallKit Provider 未接收到环信客户端实例")},{immediate:!0});const m=i.computed(()=>({...s,...c.initConfig})),R=Be(),{init:T,destroy:V}=tt();let B=!1,F=!1,U=!1,H=!1;function K(){const A=m.value;if(A.logLevel!==void 0?d.setLevel(A.logLevel):d.setDebug(A.debug),A.enableIDBLog!==!1)try{ot.getInstance({enableIDB:!0,idbLevel:le.VERBOSE,idbMaxSizeMB:20}),d.info("[EasemobChatCallKit] IndexedDB 日志存储已启用(上限 20MB,callId 维度,VERBOSE 级别)")}catch(re){d.warn("[EasemobChatCallKit] IndexedDB 日志存储初始化失败",re)}else d.info("[EasemobChatCallKit] IndexedDB 日志存储已禁用(enableIDBLog=false)");xt.getInstance().setEnabled(A.enableRingtone??!0),d.debug(`铃声服务已初始化: enabled=${A.enableRingtone??!0}(桩函数占位)`),d.info(`CallKit Provider 初始化完成,配置: debug=${A.debug}, logLevel=${A.logLevel??"auto"}, enableRingtone=${A.enableRingtone}`),d.debug(`CallKit Provider 详细配置: inviteTimeout=${A.inviteTimeout}, resizable=${A.resizable}, draggable=${A.draggable}`),d.verbose(`CallKit 当前日志级别: ${d.getCurrentLevelName()}`)}async function N(){if(!(B||U||R.getRtcService())){B=!0;try{const A=c.agoraAppId||"placeholder";await R.initializeRtcService(A,c.agoraClient),c.agoraClient?d.info("RTC服务已初始化(使用外部传入的 Agora 客户端实例)"):d.info("RTC服务已初始化,appId 将在加入频道时从环信服务器动态获取"),U=!0}catch(A){d.error("RTC服务初始化失败:",A)}finally{B=!1}}}async function G(){const A=p.getChatClient;if(!(!A||F||H)){F=!0;try{d.info("CallKit Provider 已就绪,初始化 callkit-core"),await T({imClient:A,userProfile:{userId:A.user||""},inviteTimeout:m.value.inviteTimeout}),H=!0,d.info("[useCallKitCore] 初始化完成")}catch(re){d.error("CallKit Provider 初始化 callkit-core 失败:",re)}finally{F=!1}}}function Z(A,re){return async ce=>{const de=(await Da(A,ce,["nickname","avatarurl"],re)).data||{};return Object.entries(de).map(([oe,M])=>({userId:oe,nickname:M?.nickname,avatarUrl:M?.avatarurl}))}}return i.watch([()=>c.getUserInfo,()=>p.getChatClient,()=>c.isMiniCore],()=>{if(c.getUserInfo)Kr(c.getUserInfo),d.debug("CallKit Provider 已注册用户资料 Provider");else if(p.getChatClient){const A=Z(p.getChatClient,!!c.isMiniCore);Kr(A),d.debug("CallKit Provider 已注册默认用户资料 Provider(基于环信 SDK)")}c.getGroupInfo&&(c.getGroupInfo,d.debug("CallKit Provider 已注册群组资料 Provider"))},{immediate:!0}),i.watch(()=>c.isMiniCore,A=>{p.setIsMiniCore(!!A),A&&d.info("CallKit Provider: 已启用 miniCore 兼容模式")},{immediate:!0}),i.onMounted(async()=>{a.value=!0,K(),d.warn(`[EasemobChatCallKit] callkit-core v${je.VERSION}`),await N(),await G()}),i.watch(()=>p.getChatClient,async(A,re)=>{A&&A!==re&&!H&&(await N(),await G())}),i.onUnmounted(async()=>{await V(),await R.destroyRtcService(),Pa(),U=!1,H=!1}),(A,re)=>(i.openBlock(),i.createElementBlock("div",So,[a.value?i.renderSlot(A.$slots,"default",{key:0}):i.createCommentVNode("",!0)]))}}),Eo="/callkit-static-assets";function Fe(){return Eo}const zr=`${Fe()}/images/callkit_bg.png`,Io={MIC_ON:`${Fe()}/icons/mic_on.svg`,MIC_OFF:`${Fe()}/icons/mic_slash.svg`,CAMERA_ON:`${Fe()}/icons/video_camera.svg`,CAMERA_OFF:`${Fe()}/icons/video_camera_slash.svg`,SPEAKER_ON:`${Fe()}/icons/speaker_wave_2.svg`,SPEAKER_OFF:`${Fe()}/icons/speaker_xmark.svg`,PHONE_HANG:`${Fe()}/icons/phone_hang.svg`,PHONE_PICK:`${Fe()}/icons/phone_pick.svg`,MAXIMIZE:`${Fe()}/icons/chevron_4_all_around.svg`,MINIMIZE:`${Fe()}/icons/chevron_4_cluster.svg`,GRID:`${Fe()}/icons/boxes.svg`,SHARE_SCREEN:`${Fe()}/icons/arrow_right_square_fill.svg`,PERSON_ADD:`${Fe()}/icons/person_add_fill.svg`,DEFAULT_AVATAR:`${Fe()}/images/default_avatar.png`};function Zr(h,a){return h||a}class _o{get rtcChannelStore(){return Be()}async cleanup(){d.info("[CallService] 开始清理通话资源");try{const a=this.rtcChannelStore.getRtcService();if(a)try{await a.leaveChannel(),d.info("[CallService] 已离开 RTC 频道")}catch(s){d.warn("[CallService] 离开 RTC 频道失败:",s)}try{this.rtcChannelStore.reset(),d.info("[CallService] RTC Channel Store 已重置")}catch(s){d.warn("[CallService] 重置 RTC Channel Store 失败:",s)}try{At().reset()}catch{}try{const s=Qe();s.session&&s.destroySession()}catch{}try{const s=qe();s.isMinimized&&(s.isMinimized=!1)}catch{}d.info("[CallService] 通话资源清理完成")}catch(a){d.error("[CallService] 清理过程中发生错误:",a)}}}const Wr=new _o;function hn(){const h=Xe(),{callState:a,inviteCall:s,answerCall:c,hangup:p,inviteGroupCall:m,canAccept:R}=tt();return{call:async({targetId:N,type:G,msg:Z=G==="audio"?"邀请您进行语音通话":"邀请您进行视频通话",userInfo:A})=>{if(d.debug(`call: 发起单人${G}通话,目标: ${N}`),!h.getChatClient){d.warn("ChatClient 未初始化");return}const re=G==="audio"?Ee.AUDIO_1V1:Ee.VIDEO_1V1;try{await s({calleeUserId:N,callType:re,ext:{message:Z},callerInfo:A}),d.info("call: 邀请发送成功");try{await Hn([N]),d.info("call: 已 enrich 被叫方资料")}catch(ce){d.warn("call: 获取被叫方资料失败,回退到 userId",ce)}}catch(ce){d.error("call: 邀请发送失败",ce)}},groupCall:async({groupId:N,members:G,type:Z,msg:A=Z==="audio"?"邀请您加入群组语音通话":"邀请您加入群组视频通话",groupName:re,groupAvatar:ce,userInfo:ve})=>{if(d.debug(`groupCall: 发起群组${Z}通话,groupId: ${N}`),!h.getChatClient){d.warn("ChatClient 未初始化");return}if(!G||G.length===0){d.warn("群组通话必须指定邀请成员列表");return}const de=Z==="audio"?Ee.AUDIO_MULTI:Ee.VIDEO_MULTI;try{await m({groupId:N,participantIds:G,callType:de,ext:{message:A,groupName:re,groupAvatar:ce},callerInfo:ve}),d.info("groupCall: 邀请发送成功");try{await Hn(G),d.info("groupCall: 已 enrich 被邀请成员资料")}catch(oe){d.warn("groupCall: 获取被邀请成员资料失败,回退到 userId",oe)}d.info("groupCall: 主叫方 RTC 加入由 RtcAdapter 自动处理")}catch(oe){d.error("groupCall: 发起失败",oe);try{Qe().destroySession(),d.info("groupCall: 已回滚群聊 session")}catch(M){d.error("groupCall: 回滚失败",M)}throw oe}},hangup:async(N=_e.HANGUP)=>{d.info("useCallKit.hangup",{reason:N});try{const G={[_e.HANGUP]:"normal",[_e.CANCEL]:"cancel",[_e.REMOTE_CANCEL]:"normal",[_e.REMOTE_REFUSE]:"normal",[_e.BUSY]:"normal",[_e.NO_RESPONSE]:"normal"};await p({reason:G[N]||"normal"})}catch(G){d.warn("useCallKit: core hangup 失败,执行资源清理",G)}await Wr.cleanup()},cancel:async()=>{d.info("useCallKit.cancel");try{await p({reason:"cancel"})}catch(N){d.warn("useCallKit: core cancel 失败",N)}await Wr.cleanup()},accept:async()=>{if(d.info("useCallKit.accept"),!a.callerUserId)throw d.error("accept: 无法获取主叫方 ID"),new Error("无法获取主叫方 ID");if(!R()){d.warn("accept: 当前状态不可接听,无法接听");return}try{await c({callId:a.callId,result:"accept"}),d.info("useCallKit.accept: 已发送接听信令")}catch(N){throw d.error("useCallKit.accept: core answerCall 失败",N),N}},reject:async()=>{if(d.info("useCallKit.reject"),!a.callerUserId)throw d.error("reject: 无法获取主叫方 ID"),new Error("无法获取主叫方 ID");try{await c({callId:a.callId,result:"refuse"}),d.info("useCallKit.reject: 已发送拒绝信令")}catch(N){throw d.error("useCallKit.reject: core answerCall 失败",N),N}},rejectBusy:async()=>{if(d.info("useCallKit.rejectBusy"),!a.callerUserId)throw d.error("rejectBusy: 无法获取主叫方 ID"),new Error("无法获取主叫方 ID");try{await c({callId:a.callId,result:"busy"}),d.info("useCallKit.rejectBusy: 已发送忙碌拒绝信令")}catch(N){throw d.error("useCallKit.rejectBusy: core answerCall 失败",N),N}}}}const To={class:"call-waiting"},Vo={class:"caller-info"},Mo={class:"caller-avatar"},Ro=["src","alt"],Lo={key:1,class:"avatar-fallback"},Uo={class:"caller-details"},Ao={class:"call-type-indicator"},Bo={class:"waiting-timer"},xo=He(i.defineComponent({__name:"EasemobChatCallWaiting",props:{targetUser:{},type:{}},emits:["cancel"],setup(h,{emit:a}){const s=h,c=qe(),p=i.computed(()=>c.getUserInfo(s.targetUser)),m=i.computed(()=>p.value.nickname||s.targetUser),{cancel:R}=hn(),T=a,V=i.ref(0);let B=null;const F=()=>{V.value=0,B=window.setInterval(()=>{V.value++},1e3)},U=()=>{B&&(clearInterval(B),B=null)},H=()=>{U(),R(),T("cancel")},K=i.toRef(s,"type");return i.onMounted(()=>{F()}),i.onUnmounted(()=>{U()}),(N,G)=>(i.openBlock(),i.createElementBlock("div",To,[i.createElementVNode("div",Vo,[i.createElementVNode("div",Mo,[p.value.avatarURL?(i.openBlock(),i.createElementBlock("img",{key:0,src:p.value.avatarURL,alt:m.value},null,8,Ro)):(i.openBlock(),i.createElementBlock("div",Lo,i.toDisplayString(m.value?.[0]?.toUpperCase()||"?"),1))]),i.createElementVNode("div",Uo,[G[0]||(G[0]=i.createElementVNode("h3",null,"正在呼叫",-1)),i.createElementVNode("p",null,i.toDisplayString(m.value),1),i.createElementVNode("div",Ao,i.toDisplayString(K.value==="audio"?"语音通话":"视频通话"),1)])]),i.createElementVNode("div",{class:"waiting-controls"},[i.createElementVNode("button",{onClick:H,class:"cancel-btn"},[...G[1]||(G[1]=[i.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("path",{d:"M8.43445 12.6265C8.40888 12.6658 8.46336 13.037 8.45381 13.1428C8.43469 13.3543 8.44114 13.5264 8.40602 13.6715C8.24328 14.7412 7.53366 15.2879 5.71437 15.4497C4.58252 15.5543 3.85663 15.3068 3.4024 14.7319C3.08891 14.3045 2.98642 13.7342 3.01174 12.967C2.99573 12.9006 2.99239 12.4507 3.02751 12.3056C3.02369 10.4 7.03906 8.58585 11.9887 8.60976C16.8967 8.60665 20.9804 10.4191 21.0002 12.3909L20.9971 12.6688L20.994 12.9466C20.9911 13.9523 20.9178 14.5203 20.5023 14.9781C20.0867 15.4359 19.3642 15.6384 18.3857 15.5067C16.2946 15.2681 15.6485 14.6246 15.6064 13.1421C15.616 13.0363 15.6286 12.6527 15.5871 12.6257C15.5742 12.2815 14.196 11.9462 12.0345 11.9979C9.81551 11.9561 8.40554 12.2159 8.43445 12.6265Z"})],-1)])])]),i.createElementVNode("div",Bo,i.toDisplayString(V.value)+"s",1)]))}}),[["__scopeId","data-v-e9008329"]]),No={class:"call-info-bar"},Oo={class:"call-status"},Po={class:"call-duration"},Do=He(i.defineComponent({__name:"CallInfoBar",props:{duration:{}},setup(h){return(a,s)=>(i.openBlock(),i.createElementBlock("div",No,[i.createElementVNode("div",Oo,[s[0]||(s[0]=i.createElementVNode("div",{class:"status-dot"},null,-1)),i.createElementVNode("span",Po,i.toDisplayString(a.duration),1)])]))}}),[["__scopeId","data-v-63fcbc95"]]),Ko={class:"call-controls"},$o={key:0,class:"btn-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},jo={key:1,class:"btn-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},Fo={class:"btn-label"},Go={key:0,class:"btn-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},qo={key:1,class:"btn-icon",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},Ho={class:"btn-label"},zo=He(i.defineComponent({__name:"CallControls",props:{isMuted:{type:Boolean},isVideoEnabled:{type:Boolean,default:!0},showVideo:{type:Boolean,default:!0}},emits:["toggleMute","toggleVideo","endCall"],setup(h){return(a,s)=>(i.openBlock(),i.createElementBlock("div",Ko,[i.createElementVNode("button",{class:i.normalizeClass(["control-btn",{active:a.isMuted}]),onClick:s[0]||(s[0]=c=>a.$emit("toggleMute"))},[a.isMuted?(i.openBlock(),i.createElementBlock("svg",jo,[...s[4]||(s[4]=[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.80694 20.1909C3.51405 19.8981 3.51405 19.4232 3.80694 19.1303L19.1323 3.80906C19.4252 3.51616 19.9001 3.51616 20.1929 3.80906C20.4858 4.10195 20.4858 4.57682 20.1929 4.86972L4.8676 20.1909C4.57471 20.4838 4.09983 20.4838 3.80694 20.1909Z"},null,-1),i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.48343 17.7627C9.30606 18.2658 10.2448 18.5977 11.25 18.7088V20.25C11.25 20.6642 11.5858 21 12 21C12.4142 21 12.75 20.6642 12.75 20.25V18.7088C16.125 18.3357 18.75 15.4744 18.75 12V11C18.75 10.5858 18.4142 10.25 18 10.25C17.5858 10.25 17.25 10.5858 17.25 11V12C17.25 14.8995 14.8995 17.25 12 17.25C11.1288 17.25 10.3071 17.0378 9.58393 16.6622L8.48343 17.7627ZM10.5264 15.7198C10.9824 15.9006 11.4796 16 12 16C14.2091 16 16 14.2091 16 12V10.2462L10.5264 15.7198ZM15.8484 5.90554L8.28023 13.4737C8.09939 13.0177 8 12.5204 8 12V7C8 4.79086 9.79086 3 12 3C13.8297 3 15.3724 4.22845 15.8484 5.90554ZM7.3378 14.4162L6.2373 15.5167C5.61097 14.4925 5.25 13.2884 5.25 12V11C5.25 10.5858 5.58579 10.25 6 10.25C6.41421 10.25 6.75 10.5858 6.75 11V12C6.75 12.8712 6.96223 13.6929 7.3378 14.4162Z"},null,-1)])])):(i.openBlock(),i.createElementBlock("svg",$o,[...s[3]||(s[3]=[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 4C9.51472 4 7.5 6.01472 7.5 8.5V11.5C7.5 13.9853 9.51472 16 12 16C14.4853 16 16.5 13.9853 16.5 11.5V8.5C16.5 6.01472 14.4853 4 12 4ZM12 10.0199C12.6904 10.0199 13.25 9.46025 13.25 8.7699C13.25 8.07954 12.6904 7.5199 12 7.5199C11.3096 7.5199 10.75 8.07954 10.75 8.7699C10.75 9.46025 11.3096 10.0199 12 10.0199Z"},null,-1),i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.2565 11.4532C19.2565 11.0114 18.8984 10.6532 18.4565 10.6532C18.0147 10.6532 17.6565 11.0114 17.6565 11.4532C17.6565 14.4705 15.2105 16.9166 12.1931 16.9166H11.7963C8.78476 16.9166 6.34341 14.4752 6.34341 11.4637C6.34341 11.0218 5.98524 10.6637 5.54341 10.6637C5.10158 10.6637 4.74341 11.0218 4.74341 11.4637C4.74341 15.158 7.58384 18.189 11.2 18.4917V19.4503C11.2 19.8921 11.5581 20.2503 12 20.2503C12.4418 20.2503 12.8 19.8921 12.8 19.4503V18.4909C16.4169 18.1831 19.2565 15.1498 19.2565 11.4532Z"},null,-1)])])),i.createElementVNode("span",Fo,i.toDisplayString(a.isMuted?"取消静音":"静音"),1)],2),a.showVideo?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["control-btn",{active:!a.isVideoEnabled}]),onClick:s[1]||(s[1]=c=>a.$emit("toggleVideo"))},[a.isVideoEnabled?(i.openBlock(),i.createElementBlock("svg",Go,[...s[5]||(s[5]=[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.88889 5C2.84568 5 2 5.84568 2 6.88889V17.1111C2 18.1543 2.84568 19 3.88889 19H15.8611C16.9043 19 17.75 18.1543 17.75 17.1111V15.3089L21.0178 17.1244C21.4585 17.3692 22 17.0505 22 16.5464V7.46025C22 6.95616 21.4585 6.63753 21.0178 6.88233L17.75 8.69779V6.88889C17.75 5.84568 16.9043 5 15.8611 5H3.88889ZM5.5 10C6.32843 10 7 9.32843 7 8.5C7 7.67157 6.32843 7 5.5 7C4.67157 7 4 7.67157 4 8.5C4 9.32843 4.67157 10 5.5 10Z"},null,-1)])])):(i.openBlock(),i.createElementBlock("svg",qo,[...s[6]||(s[6]=[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.24619 19H14.3611C15.4043 19 16.25 18.1543 16.25 17.1111V15.3089L19.5178 17.1244C19.9585 17.3692 20.5 17.0505 20.5 16.5464V7.46025C20.5 6.95616 19.9585 6.63753 19.5178 6.88233L19.1714 7.0748L7.24619 19ZM15.9249 5.82909C15.5851 5.32872 15.0115 5 14.3611 5H5.38889C4.34568 5 3.5 5.84568 3.5 6.88889V17.1111C3.5 17.4409 3.58453 17.751 3.73312 18.0209L15.9249 5.82909Z"},null,-1),i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.80694 20.1909C3.51405 19.8981 3.51405 19.4232 3.80694 19.1303L19.1323 3.80906C19.4252 3.51616 19.9001 3.51616 20.1929 3.80906C20.4858 4.10195 20.4858 4.57682 20.1929 4.86972L4.8676 20.1909C4.57471 20.4838 4.09983 20.4838 3.80694 20.1909Z"},null,-1)])])),i.createElementVNode("span",Ho,i.toDisplayString(a.isVideoEnabled?"关闭摄像头":"开启摄像头"),1)],2)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"control-btn hangup-btn",onClick:s[2]||(s[2]=c=>a.$emit("endCall"))},[...s[7]||(s[7]=[i.createElementVNode("svg",{class:"btn-icon",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("path",{d:"M8.43445 12.6265C8.40888 12.6658 8.46336 13.037 8.45381 13.1428C8.43469 13.3543 8.44114 13.5264 8.40602 13.6715C8.24328 14.7412 7.53366 15.2879 5.71437 15.4497C4.58252 15.5543 3.85663 15.3068 3.4024 14.7319C3.08891 14.3045 2.98642 13.7342 3.01174 12.967C2.99573 12.9006 2.99239 12.4507 3.02751 12.3056C3.02369 10.4 7.03906 8.58585 11.9887 8.60976C16.8967 8.60665 20.9804 10.4191 21.0002 12.3909L20.9971 12.6688L20.994 12.9466C20.9911 13.9523 20.9178 14.5203 20.5023 14.9781C20.0867 15.4359 19.3642 15.6384 18.3857 15.5067C16.2946 15.2681 15.6485 14.6246 15.6064 13.1421C15.616 13.0363 15.6286 12.6527 15.5871 12.6257C15.5742 12.2815 14.196 11.9462 12.0345 11.9979C9.81551 11.9561 8.40554 12.2159 8.43445 12.6265Z"})],-1),i.createElementVNode("span",{class:"btn-label"},"挂断",-1)])])]))}}),[["__scopeId","data-v-65c7eb86"]]),Zo={class:"remote-video-container"},Wo={key:1,class:"remote-placeholder"},Yo={class:"remote-name"},Jo={class:"remote-name"},Xo={key:0,class:"connecting-text"},Qo={key:1,class:"call-status-text"},es={key:0,class:"local-video-container"},ts={key:0,class:"local-video-disabled"},Qn=5,ns=He(i.defineComponent({__name:"EasemobChatCallStream",props:{type:{}},emits:["ended"],setup(h,{emit:a}){const s=h,c=a,{callState:p}=tt(),m=Be(),R=At(),T=qe(),V=i.computed(()=>m.getRtcService()),B=i.ref(),F=i.ref(),U=i.computed(()=>!m.audioEnabled),H=i.computed(()=>m.videoEnabled),K=i.computed(()=>R.formattedCallDuration),N=i.computed(()=>{const ee=p.calleeUserId||p.callerUserId;return ee?T.getUserInfo(ee).nickname||ee:""}),G=i.ref(!1),Z=i.ref(!1);let A=null,re=!1;const ce=i.ref(0),ve=i.computed(()=>s.type==="video"&&m.isConnected&&!Z.value&&!G.value),de=async()=>{if(!V.value){d.warn("切换静音失败: RtcService未初始化");return}try{const ee=!m.audioEnabled;await V.value.toggleAudio(ee),d.info(`切换静音状态成功: ${ee?"取消静音":"静音"}`)}catch(ee){d.error("切换静音失败:",ee)}},oe=async()=>{if(!V.value){d.warn("切换视频失败: RtcService未初始化");return}try{const ee=!m.videoEnabled;await V.value.toggleVideo(ee),d.info("切换视频状态成功:",ee)}catch(ee){d.error("切换视频失败:",ee)}},M=async()=>{try{d.info("用户点击挂断按钮,开始挂断流程");const{hangup:ee}=hn();await ee(),d.info("挂断流程完成")}catch(ee){d.error("挂断失败:",ee)}finally{c("ended")}},$=ee=>{const ye=ee?.message||ee?.code||String(ee);return ye.includes("REMOTE_USER_IS_NOT_PUBLISHED")||ye.includes("not published")},x=async ee=>{if(!V.value||!F.value){d.warn("播放远程视频失败:rtcService或remoteVideo元素不存在");return}if(re){d.debug("远程视频播放已在进行中,跳过本次调用",{userId:ee});return}re=!0;try{const ye=V.value.getClient();if(!ye||!ye.remoteUsers||ye.remoteUsers.length===0){d.warn("播放远程视频失败:未找到远程用户",{userId:ee});return}const ue=ye.remoteUsers.find(ke=>ke.uid.toString()===ee||ke.uid===Number(ee))||ye.remoteUsers[0];if(!ue){d.warn("播放远程视频失败:远程用户列表为空");return}const Q=ue.uid.toString();let fe=V.value.getRemoteVideoTrack(Q);if(!fe&&ce.value===0)try{await V.value.subscribeRemoteUser(ue.uid,"video"),d.info("CallStream 兜底订阅远程视频成功",{uid:ue.uid}),fe=V.value.getRemoteVideoTrack(Q)}catch(ke){if($(ke)){d.info("CallStream 兜底订阅时对方已取消发布,等待下次发布",{uid:ue.uid}),ce.value=0;return}d.warn("CallStream 兜底订阅远程视频失败",ke)}if(fe&&F.value)try{A&&(A.stop(),A=null),F.value.innerHTML="",fe.play(F.value),A=fe,G.value=!0,Z.value=!0,ce.value=0,d.info("远程视频开始播放",{userId:ee,uid:ue.uid})}catch(ke){d.error("播放远程视频失败",ke)}else ce.value<Qn?(ce.value++,d.warn(`播放远程视频失败:未找到远程视频轨道,重试 ${ce.value}/${Qn}`,{userId:ee,uid:ue.uid}),setTimeout(()=>{x(ee)},500)):d.error(`播放远程视频失败:重试${Qn}次后仍未找到远程视频轨道`,{userId:ee,uid:ue.uid})}finally{re=!1}},ae=()=>{if(!V.value||!B.value||s.type!=="video"||!V.value.getClient())return;const ye=V.value.getLocalVideoStream();if(ye){const ue=ye.getVideoTracks()[0];ue&&ue.readyState==="live"&&(B.value.srcObject=ye,d.info("本地视频开始播放"))}};let J=null,W=null;return i.onMounted(()=>{if(d.info("EasemobChatCallStream mounted, 等待RTC连接就绪"),m.isConnected&&(ae(),s.type==="video")){const Q=p.calleeUserId||p.callerUserId;Q&&setTimeout(()=>{ce.value=0,x(Q)},100)}const ee=m.$subscribe((Q,fe)=>{if(fe.isConnected&&(B.value?.srcObject||ae(),s.type==="video"&&!G.value)){const ke=p.calleeUserId||p.callerUserId;ke&&(ce.value=0,x(ke))}}),ye=i.watch(()=>m.localStream,Q=>{if(Q&&B.value&&s.type==="video"){const fe=Q.getVideoTracks()[0];if(fe&&fe.readyState==="live"){const ke=B.value.srcObject;(!ke||ke.id!==Q.id)&&(B.value.srcObject=Q,d.info("本地视频流更新,重新播放",{streamId:Q.id}))}}else!Q&&B.value&&(B.value.srcObject=null,d.info("本地视频流已清空"))},{immediate:!1});if(V.value){const Q=V.value.getClient();Q&&(J=async(fe,ke)=>{d.info("组件收到远程用户发布媒体:",{uid:fe.uid,mediaType:ke}),ke==="video"&&(Z.value=!0,setTimeout(()=>{x(fe.uid.toString())},100))},W=(fe,ke)=>{if(ke==="video"&&(G.value=!1,Z.value=!1,ce.value=0,A)){try{A.stop()}catch(st){d.warn("停止远程视频轨道失败",st)}A=null}},Q.on("user-published",J),Q.on("user-unpublished",W))}const ue=()=>{d.info("收到窗口展开事件,重新播放远程视频"),ce.value=0,setTimeout(()=>{if(s.type==="video"&&V.value){const Q=p.calleeUserId||p.callerUserId;Q&&x(Q)}},200)};window.addEventListener("callkit:window-expanded",ue),i.onUnmounted(()=>{if(ee&&ee(),ye(),window.removeEventListener("callkit:window-expanded",ue),V.value&&J&&W){const Q=V.value.getClient();Q&&(Q.off("user-published",J),Q.off("user-unpublished",W))}A&&(A.stop(),A=null)})}),i.onUnmounted(()=>{}),(ee,ye)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["call-stream-container",{"is-audio":s.type==="audio"}])},[i.createElementVNode("div",Zo,[s.type==="video"?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"remoteVideo",ref:F,class:"remote-video"},null,512)):i.createCommentVNode("",!0),s.type==="audio"||!G.value?(i.openBlock(),i.createElementBlock("div",Wo,[s.type==="video"&&ve.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[ye[0]||(ye[0]=i.createElementVNode("div",{class:"avatar-placeholder camera-off"},[i.createElementVNode("svg",{class:"camera-off-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("path",{d:"M3 3L21 21M16 16V19C16 19.5523 15.5523 20 15 20H5C4.44772 20 4 19.5523 4 19V9C4 8.44772 4.44772 8 5 8H8M21 15V9L17 13M17 13V7C17 6.44772 16.5523 6 16 6H10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),i.createElementVNode("p",Yo,i.toDisplayString(N.value||"对方"),1),ye[1]||(ye[1]=i.createElementVNode("p",{class:"call-status-text"},"摄像头已关闭",-1))],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[ye[2]||(ye[2]=i.createElementVNode("div",{class:"avatar-placeholder"},[i.createElementVNode("svg",{class:"user-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 8.90816C8 9.63672 8.16477 10.3145 8.4943 10.9414C8.83953 11.5683 9.30245 12.0681 9.88305 12.4409C10.4637 12.8136 11.0992 13 11.7896 13C12.4801 13 13.1156 12.8136 13.6962 12.4409C14.2768 12.0681 14.7319 11.5683 15.0615 10.9414C15.4067 10.3145 15.5793 9.63672 15.5793 8.90816V7.09184C15.5793 6.34633 15.4067 5.66012 15.0615 5.03321C14.7319 4.40631 14.2768 3.91495 13.6962 3.55913C13.1156 3.18638 12.4801 3 11.7896 3C11.0992 3 10.4637 3.18638 9.88305 3.55913C9.30245 3.91495 8.83953 4.40631 8.4943 5.03321C8.16477 5.66012 8 6.34633 8 7.09184V8.90816ZM12 14C13.4313 14 14.7194 14.1986 15.8644 14.5957C16.8286 14.9267 17.6648 15.3901 18.3729 15.9858C18.9605 16.4657 19.4124 16.987 19.7288 17.5496C19.9096 17.8972 20 18.3522 20 18.9149C20 19.4775 19.8117 19.9657 19.435 20.3794C19.0734 20.7931 18.629 21 18.1017 21H5.89831C5.371 21 4.91902 20.7931 4.54237 20.3794C4.18079 19.9657 4 19.4775 4 18.9149C4 18.3522 4.0904 17.8972 4.27119 17.5496C4.58757 16.987 5.03955 16.4657 5.62712 15.9858C6.33522 15.3901 7.17137 14.9267 8.13559 14.5957C9.2806 14.1986 10.5687 14 12 14Z"})])],-1)),i.createElementVNode("p",Jo,i.toDisplayString(N.value||"对方"),1),s.type==="video"?(i.openBlock(),i.createElementBlock("p",Xo,"连接中...")):(i.openBlock(),i.createElementBlock("p",Qo,"语音通话中"))],64))])):i.createCommentVNode("",!0)]),s.type==="video"?(i.openBlock(),i.createElementBlock("div",es,[i.createElementVNode("video",{ref_key:"localVideo",ref:B,class:"local-video",autoplay:"",muted:""},null,512),H.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",ts,[...ye[3]||(ye[3]=[i.createElementVNode("svg",{class:"camera-off-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("path",{d:"M3 3L21 21M16 16V19C16 19.5523 15.5523 20 15 20H5C4.44772 20 4 19.5523 4 19V9C4 8.44772 4.44772 8 5 8H8M21 15V9L17 13M17 13V7C17 6.44772 16.5523 6 16 6H10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]))])):i.createCommentVNode("",!0),i.createVNode(Do,{duration:K.value},null,8,["duration"]),i.createVNode(zo,{"is-muted":U.value,"is-video-enabled":H.value,"show-video":s.type==="video",onToggleMute:de,onToggleVideo:oe,onEndCall:M},null,8,["is-muted","is-video-enabled","show-video"])],2))}}),[["__scopeId","data-v-e5280444"]]),rs={key:0,class:"mini-window-audio"},is={class:"duration-info"},as={class:"duration-text"},os={class:"status-text"},ss={key:1,class:"mini-window-video"},ls={key:0,class:"video-placeholder"},cs={class:"mini-duration"},us=200,ds=80,fs=180,hs=240,Yr=5,er=He(i.defineComponent({__name:"EasemobChatMiniWindow",emits:["expand","close"],setup(h,{emit:a}){const s=a,{callState:c}=tt(),p=Be(),m=At(),R=qe(),T=i.ref(),V=i.computed(()=>R.isMinimized),B=i.computed(()=>c.type),F=i.computed(()=>B.value===Ee.AUDIO_1V1||B.value===Ee.AUDIO_MULTI||B.value===Ee.VIDEO_MULTI),U=i.computed(()=>F.value?us:fs),H=i.computed(()=>F.value?ds:hs),{elementRef:K,isDragging:N,hasDragged:G,style:Z,startDrag:A}=$r("top-right",U.value,H.value,20,{boundary:!0,boundaryPadding:10}),re=i.computed(()=>({...Z.value,width:`${U.value}px`,height:`${H.value}px`,zIndex:9999,borderRadius:"12px",overflow:"hidden",boxShadow:N.value?"0 12px 48px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.4)"})),ce=i.computed(()=>m.formattedCallDuration),ve=i.computed(()=>B.value===Ee.AUDIO_MULTI||B.value===Ee.VIDEO_MULTI?"群组通话中":"通话中"),de=i.ref(!1),oe=i.ref(0),M=()=>{G.value||s("expand")},$=()=>{const x=p.getRtcService();if(!x||!T.value){d.warn("小窗口播放远程视频失败:rtcService或video元素不存在");return}const ae=x.getClient();if(!ae||!ae.remoteUsers||ae.remoteUsers.length===0){d.warn("小窗口播放远程视频失败:未找到远程用户");return}const J=ae.remoteUsers[0];if(!J)return;const W=x.getRemoteVideoTrack(J.uid.toString());if(W)try{W.play(T.value),de.value=!0,oe.value=0,d.info("小窗口远程视频开始播放",{uid:J.uid})}catch(ee){d.error("小窗口播放远程视频异常",ee)}else oe.value<Yr?(oe.value++,d.warn(`小窗口未找到远程视频轨道,准备重试 ${oe.value}/${Yr}`),setTimeout(()=>{$()},1e3)):d.error("小窗口达到最大重试次数,仍未找到远程视频轨道")};return i.onMounted(()=>{if(!F.value){oe.value=0,setTimeout(()=>{$()},200);const x=p.getRtcService();if(x){const ae=x.getClient();ae&&(ae.on("user-published",async(J,W)=>{W==="video"&&(d.info("小窗口收到远程视频发布事件"),oe.value=0,setTimeout(()=>{$()},200))}),ae.on("user-unpublished",(J,W)=>{W==="video"&&(de.value=!1,d.info("小窗口远程视频取消发布"))}))}}}),i.watch(V,x=>{if(!x&&T.value){const ae=p.getRtcService();if(ae){const J=ae.getClient();J&&J.remoteUsers&&J.remoteUsers.forEach(W=>{const ee=ae.getRemoteVideoTrack(W.uid.toString());ee&&(ee.stop(),d.info("小窗隐藏,停止远程视频轨道播放",{uid:W.uid}))})}T.value.srcObject&&(T.value.srcObject=null),de.value=!1}}),i.onUnmounted(()=>{if(T.value){const x=p.getRtcService();if(x){const ae=x.getClient();ae&&ae.remoteUsers&&ae.remoteUsers.forEach(J=>{const W=x.getRemoteVideoTrack(J.uid.toString());W&&W.stop()})}}}),(x,ae)=>V.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"elementRef",ref:K,class:i.normalizeClass(["easemob-mini-window",{"is-dragging":i.unref(N)}]),style:i.normalizeStyle(re.value),onMousedown:ae[0]||(ae[0]=(...J)=>i.unref(A)&&i.unref(A)(...J)),onClick:M},[F.value?(i.openBlock(),i.createElementBlock("div",rs,[ae[1]||(ae[1]=i.createElementVNode("div",{class:"audio-icon"},[i.createElementVNode("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 8.90816C8 9.63672 8.16477 10.3145 8.4943 10.9414C8.83953 11.5683 9.30245 12.0681 9.88305 12.4409C10.4637 12.8136 11.0992 13 11.7896 13C12.4801 13 13.1156 12.8136 13.6962 12.4409C14.2768 12.0681 14.7319 11.5683 15.0615 10.9414C15.4067 10.3145 15.5793 9.63672 15.5793 8.90816V7.09184C15.5793 6.34633 15.4067 5.66012 15.0615 5.03321C14.7319 4.40631 14.2768 3.91495 13.6962 3.55913C13.1156 3.18638 12.4801 3 11.7896 3C11.0992 3 10.4637 3.18638 9.88305 3.55913C9.30245 3.91495 8.83953 4.40631 8.4943 5.03321C8.16477 5.66012 8 6.34633 8 7.09184V8.90816ZM12 14C13.4313 14 14.7194 14.1986 15.8644 14.5957C16.8286 14.9267 17.6648 15.3901 18.3729 15.9858C18.9605 16.4657 19.4124 16.987 19.7288 17.5496C19.9096 17.8972 20 18.3522 20 18.9149C20 19.4775 19.8117 19.9657 19.435 20.3794C19.0734 20.7931 18.629 21 18.1017 21H5.89831C5.371 21 4.91902 20.7931 4.54237 20.3794C4.18079 19.9657 4 19.4775 4 18.9149C4 18.3522 4.0904 17.8972 4.27119 17.5496C4.58757 16.987 5.03955 16.4657 5.62712 15.9858C6.33522 15.3901 7.17137 14.9267 8.13559 14.5957C9.2806 14.1986 10.5687 14 12 14Z"})])],-1)),i.createElementVNode("div",is,[i.createElementVNode("div",as,i.toDisplayString(ce.value),1),i.createElementVNode("div",os,i.toDisplayString(ve.value),1)])])):(i.openBlock(),i.createElementBlock("div",ss,[i.createElementVNode("div",{ref_key:"miniRemoteVideo",ref:T,class:"mini-video"},null,512),de.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",ls,[...ae[2]||(ae[2]=[i.createElementVNode("svg",{class:"user-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 8.90816C8 9.63672 8.16477 10.3145 8.4943 10.9414C8.83953 11.5683 9.30245 12.0681 9.88305 12.4409C10.4637 12.8136 11.0992 13 11.7896 13C12.4801 13 13.1156 12.8136 13.6962 12.4409C14.2768 12.0681 14.7319 11.5683 15.0615 10.9414C15.4067 10.3145 15.5793 9.63672 15.5793 8.90816V7.09184C15.5793 6.34633 15.4067 5.66012 15.0615 5.03321C14.7319 4.40631 14.2768 3.91495 13.6962 3.55913C13.1156 3.18638 12.4801 3 11.7896 3C11.0992 3 10.4637 3.18638 9.88305 3.55913C9.30245 3.91495 8.83953 4.40631 8.4943 5.03321C8.16477 5.66012 8 6.34633 8 7.09184V8.90816ZM12 14C13.4313 14 14.7194 14.1986 15.8644 14.5957C16.8286 14.9267 17.6648 15.3901 18.3729 15.9858C18.9605 16.4657 19.4124 16.987 19.7288 17.5496C19.9096 17.8972 20 18.3522 20 18.9149C20 19.4775 19.8117 19.9657 19.435 20.3794C19.0734 20.7931 18.629 21 18.1017 21H5.89831C5.371 21 4.91902 20.7931 4.54237 20.3794C4.18079 19.9657 4 19.4775 4 18.9149C4 18.3522 4.0904 17.8972 4.27119 17.5496C4.58757 16.987 5.03955 16.4657 5.62712 15.9858C6.33522 15.3901 7.17137 14.9267 8.13559 14.5957C9.2806 14.1986 10.5687 14 12 14Z"})],-1)])])),i.createElementVNode("div",cs,i.toDisplayString(ce.value),1)]))],38)):i.createCommentVNode("",!0)}}),[["__scopeId","data-v-dca616eb"]]),ps={key:0},ms={class:"call-content"},gs=360,Cs=640,Jr=He(i.defineComponent({__name:"EasemobChatSingleCall",props:{targetUser:{},type:{},enableRingtone:{type:Boolean,default:!0},backgroundImage:{}},emits:["callStarted","callEnded","callCanceled"],setup(h,{emit:a}){const s=h,c=a,{callState:p,onCallEvent:m,isIdle:R}=tt(),T=qe(),V=i.ref(!1);let B=null;const F=W=>W===Ee.VIDEO_MULTI||W===Ee.AUDIO_MULTI,U=i.computed(()=>V.value&&(p.status===vt.ANSWER_CALL||p.status===vt.CONFIRM_CALLEE||p.status===vt.IN_CALL)),H=i.computed(()=>V.value),K=i.computed(()=>{const W=p.type;return W===Ee.AUDIO_1V1||W===Ee.AUDIO_MULTI?"audio":W===Ee.VIDEO_1V1||W===Ee.VIDEO_MULTI?"video":s.type||"video"}),N=i.computed(()=>s.targetUser||p.calleeUserId||p.callerUserId||""),G=i.computed(()=>T.isMinimized),{elementRef:Z,isDragging:A,hasDragged:re,style:ce,startDrag:ve}=qt({centered:!0,width:gs,height:Cs,boundary:!0,boundaryPadding:20}),de=()=>{T.isMinimized=!0},oe=()=>{T.isMinimized=!1,setTimeout(()=>{window.dispatchEvent(new CustomEvent("callkit:window-expanded"))},100)},M=async()=>{try{V.value=!0,c("callStarted"),d.info(`[EasemobChatSingleCall] 显示单聊通话窗口: type=${K.value}, target=${N.value}`)}catch(W){d.error("[EasemobChatSingleCall] 启动通话窗口失败:",W),x()}},$=()=>{c("callCanceled")},x=()=>{V.value=!1,T.isMinimized=!1,c("callEnded")},ae=i.computed(()=>K.value==="audio"?{background:"#1a1a2e"}:{backgroundImage:`url(${Zr(s.backgroundImage,zr)})`});function J(){B=m(W=>{switch(W.type){case"singleCallInvited":W.payload?.isCaller&&!V.value&&M();break;case"singleCallAccepted":case"singleCallConnected":case"singleCallStarted":V.value||M();break;case"singleCallEnded":case"singleCallCanceled":case"singleCallRefused":case"singleCallTimeout":case"singleCallBusy":V.value&&x();break}})}return i.onMounted(()=>{J(),!R()&&!F(p.type)&&M()}),i.onUnmounted(()=>{B&&(B(),B=null),V.value=!1}),(W,ee)=>H.value?(i.openBlock(),i.createElementBlock("div",ps,[G.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"elementRef",ref:Z,class:i.normalizeClass(["easemob-chat-single-call",{"is-dragging":i.unref(A),"has-dragged":i.unref(re),"is-audio":K.value==="audio"}]),style:i.normalizeStyle([i.unref(ce),ae.value])},[i.createElementVNode("div",{class:"drag-handle",onMousedown:ee[0]||(ee[0]=(...ye)=>i.unref(ve)&&i.unref(ve)(...ye))},null,32),i.createElementVNode("div",ms,[U.value?(i.openBlock(),i.createBlock(ns,{key:1,type:K.value,onEnded:x},null,8,["type"])):(i.openBlock(),i.createBlock(xo,{key:0,targetUser:N.value,type:K.value,onCancel:$},null,8,["targetUser","type"]))]),U.value?(i.openBlock(),i.createElementBlock("button",{key:0,class:"minimize-btn",onClick:de,title:"最小化"},[...ee[1]||(ee[1]=[i.createElementVNode("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.25 2.5C3.73122 2.5 2.5 3.73122 2.5 5.25V15.4995C2.5 17.0183 3.73122 18.2495 5.25 18.2495H9.50539C9.91961 18.2495 10.2554 17.9137 10.2554 17.4995C10.2554 17.0853 9.91961 16.7495 9.50539 16.7495H5.25C4.55964 16.7495 4 16.1899 4 15.4995V5.25C4 4.55964 4.55964 4 5.25 4H15.4995C16.1899 4 16.7495 4.55964 16.7495 5.25V9.50993C16.7495 9.92414 17.0853 10.2599 17.4995 10.2599C17.9137 10.2599 18.2495 9.92414 18.2495 9.50993V5.25C18.2495 3.73122 17.0183 2.5 15.4995 2.5H5.25ZM13.4995 12.9995H19.4995C19.7757 12.9995 19.9995 13.2234 19.9995 13.4995V19.4995C19.9995 19.7757 19.7757 19.9995 19.4995 19.9995H13.4995C13.2234 19.9995 12.9995 19.7757 12.9995 19.4995V13.4995C12.9995 13.2234 13.2234 12.9995 13.4995 12.9995ZM11.4995 13.4995C11.4995 12.3949 12.3949 11.4995 13.4995 11.4995H19.4995C20.6041 11.4995 21.4995 12.3949 21.4995 13.4995V19.4995C21.4995 20.6041 20.6041 21.4995 19.4995 21.4995H13.4995C12.3949 21.4995 11.4995 20.6041 11.4995 19.4995V13.4995Z",fill:"currentColor"})],-1)])])):i.createCommentVNode("",!0)],6)),G.value?(i.openBlock(),i.createBlock(er,{key:1,onExpand:oe,onClose:x})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)}}),[["__scopeId","data-v-38e0ba9e"]]),Xr=He(i.defineComponent({__name:"EasemobChatMultiCall",props:{groupId:{},groupName:{},groupAvatar:{},type:{},currentUserId:{},autoShow:{type:Boolean,default:!0},groupMembers:{}},emits:["callStarted","callEnded","addParticipant","participantTimeout","error"],setup(h,{emit:a}){const s=h,c=a,{callState:p,onCallEvent:m}=tt(),R=Be(),T=Xe(),V=qe(),B=Qe(),F=i.ref(null);let U=null;const H=i.computed(()=>s.groupId||p.calleeUserId||B.session?.groupId||""),K=i.computed(()=>s.groupName?s.groupName:B.session?.groupName||""),N=i.computed(()=>s.groupAvatar||""),G=i.ref(!1);function Z(){s.autoShow!==!1&&(G.value||(G.value=!0,d.info("[EasemobChatMultiCall] 显示群聊通话页面")))}function A(){s.autoShow!==!1&&G.value&&(G.value=!1,d.info("[EasemobChatMultiCall] 隐藏群聊通话页面"))}const re=()=>{c("callEnded")},ce=()=>{c("addParticipant")};i.watch(F,(de,oe)=>{if(de&&!oe){const M=p.type;if(!(M===Ee.VIDEO_MULTI||M===Ee.AUDIO_MULTI)){d.info("[EasemobChatMultiCall] shell 渲染但不在群通话状态,跳过 startSession");return}const x=M===Ee.AUDIO_MULTI?"audio":"video";de.startSession({sessionId:p.channel||"",callType:x}),c("callStarted")}},{immediate:!1});function ve(){U=m(de=>{switch(de.type){case"groupCallInvited":de.payload?.isCaller&&Z();break;case"groupCallAccepted":case"groupCallConnected":case"groupCallStarted":Z();break;case"groupCallEnded":case"groupCallCanceled":case"groupCallRefused":case"groupCallTimeout":case"groupCallBusy":A(),c("callEnded");break}})}return i.onMounted(()=>{ve();const de=p.status,oe=p.type===Ee.VIDEO_MULTI||p.type===Ee.AUDIO_MULTI,M=de===vt.ANSWER_CALL||de===vt.CONFIRM_CALLEE||de===vt.IN_CALL;s.autoShow!==!1&&oe&&M&&(d.info("[EasemobChatMultiCall] 组件挂载时发现活跃群聊通话,立即显示"),G.value=!0)}),i.onUnmounted(()=>{U&&(U(),U=null)}),(de,oe)=>G.value?(i.openBlock(),i.createBlock(i.unref(Zn),{key:0,ref_key:"groupCallShellRef",ref:F,"group-id":H.value,"group-name":K.value,"group-avatar":N.value,"group-members":s.groupMembers,"current-user-id":s.currentUserId||i.unref(T).getChatClient?.user||"","current-nickname":i.unref(V).getUserInfo(i.unref(T).getChatClient?.user)?.nickname,"current-avatar-url":i.unref(V).getUserInfo(i.unref(T).getChatClient?.user)?.avatarURL,"rtc-service":i.unref(R).getRtcService(),onHangup:re,onAddParticipant:ce},null,8,["group-id","group-name","group-avatar","group-members","current-user-id","current-nickname","current-avatar-url","rtc-service"])):i.createCommentVNode("",!0)}}),[["__scopeId","data-v-ec9e71b1"]]),vs={key:0,class:"invitation-notification"},ys={class:"invitation-content"},bs={class:"invitation-avatar"},ws=["src","alt"],ks={key:1,class:"avatar-placeholder"},Ss={class:"call-type-badge"},Es={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"white",xmlns:"http://www.w3.org/2000/svg"},Is={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"white",xmlns:"http://www.w3.org/2000/svg"},_s={class:"invitation-info"},Ts={class:"caller-name"},Vs={class:"call-description"},Ms={class:"invitation-actions"},Rs=["disabled"],Ls=["disabled"],Us={key:0,width:"24",height:"24",viewBox:"0 0 24 24",fill:"white",xmlns:"http://www.w3.org/2000/svg"},As={key:1,width:"24",height:"24",viewBox:"0 0 24 24",fill:"white",xmlns:"http://www.w3.org/2000/svg"},Qr=He(i.defineComponent({__name:"InvitationNotification",setup(h){const{callState:a,onCallEvent:s,isWaitingCalleeAction:c}=tt(),p=Xe(),m=Qe(),R=qe(),{accept:T,reject:V}=hn(),B=i.ref(!1),F=i.ref(!1);let U=null;const H=i.computed(()=>{const M=a.callerUserId;return M?R.getUserInfo(M)?.nickname||M:"未知用户"}),K=i.computed(()=>{const M=a.callerUserId;return M&&R.getUserInfo(M)?.avatarURL||""}),N=i.computed(()=>{const M=a.type;return M===Ee.VIDEO_1V1||M===Ee.VIDEO_MULTI?"video":(M===Ee.AUDIO_1V1||M===Ee.AUDIO_MULTI,"audio")}),G=i.computed(()=>{const M=a.type;return M===Ee.VIDEO_MULTI||M===Ee.AUDIO_MULTI}),Z=i.computed(()=>{const M=N.value==="video"?"视频通话":"语音通话";if(G.value){const $=m.session?.groupName;return`邀请您加入${$?`「${$}」`:"群组"}${M}`}return`${M}邀请`}),A=i.computed(()=>p.getChatClient&&p.getClientDeviceId);function re(M){if(!A.value){d.warn("🔔 [InvitationNotification] ❌ ChatClient 未就绪,无法显示弹窗"),B.value=!1;return}B.value||(B.value=!0,d.info("🔔 [InvitationNotification] ✅ 显示通话邀请弹窗 (事件驱动)"))}function ce(M){B.value&&(B.value=!1,d.info(`🔔 [InvitationNotification] 隐藏弹窗 (事件: ${M})`))}function ve(){U=s(M=>{switch(M.type){case"incomingCall":re();break;case"callAccepted":case"callRefused":case"callCanceled":case"callEnded":case"callTimeout":case"callBusy":case"singleCallRefused":case"singleCallCanceled":case"singleCallEnded":case"singleCallTimeout":case"singleCallBusy":case"groupCallRefused":case"groupCallCanceled":case"groupCallEnded":case"groupCallTimeout":case"groupCallBusy":ce(M.type);break}})}const de=async()=>{if(d.info(">>> InvitationNotification.handleAccept 被调用"),!F.value){if(!A.value){d.error("InvitationNotification: ChatClient未登录或未初始化,无法接听通话"),d.error("接听失败: 请先登录环信账号"),B.value=!1;return}F.value=!0;try{d.info(">>> 开始调用 accept()"),await T(),B.value=!1}catch(M){d.error("InvitationNotification: 接听失败:",M),d.error("接听失败:",M),B.value=!1}finally{F.value=!1}}},oe=async()=>{if(d.info(">>> InvitationNotification.handleReject 被调用"),!F.value){if(!A.value){d.error("InvitationNotification: ChatClient未登录或未初始化,无法拒绝通话"),d.error("拒绝失败: 请先登录环信账号"),B.value=!1;return}F.value=!0;try{d.info(">>> 开始调用 reject()"),await V(),B.value=!1}catch(M){d.error("InvitationNotification: 拒绝失败:",M),d.error("拒绝失败:",M),B.value=!1}finally{F.value=!1}}};return i.onMounted(()=>{ve();const M=c();d.info(`🔔 [InvitationNotification] onMounted | isWaitingCalleeAction=${M} | isChatClientReady=${A.value}`),M&&A.value?(B.value=!0,d.info("🔔 [InvitationNotification] ✅ 组件挂载时发现待处理的通话邀请,立即显示弹窗")):M&&!A.value?d.warn("🔔 [InvitationNotification] ❌ 组件挂载时有通话邀请,但用户未登录"):d.info("🔔 [InvitationNotification] ℹ️ 组件挂载时无待处理邀请")}),i.onUnmounted(()=>{U&&(U(),U=null)}),(M,$)=>(i.openBlock(),i.createBlock(i.Transition,{name:"slide-down"},{default:i.withCtx(()=>[B.value?(i.openBlock(),i.createElementBlock("div",vs,[i.createElementVNode("div",ys,[i.createElementVNode("div",bs,[K.value?(i.openBlock(),i.createElementBlock("img",{key:0,src:K.value,alt:H.value},null,8,ws)):(i.openBlock(),i.createElementBlock("div",ks,i.toDisplayString(H.value?.[0]?.toUpperCase()||"?"),1)),i.createElementVNode("div",Ss,[N.value==="video"?(i.openBlock(),i.createElementBlock("svg",Es,[...$[0]||($[0]=[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.88889 5C2.84568 5 2 5.84568 2 6.88889V17.1111C2 18.1543 2.84568 19 3.88889 19H15.8611C16.9043 19 17.75 18.1543 17.75 17.1111V15.3089L21.0178 17.1244C21.4585 17.3692 22 17.0505 22 16.5464V7.46025C22 6.95616 21.4585 6.63753 21.0178 6.88233L17.75 8.69779V6.88889C17.75 5.84568 16.9043 5 15.8611 5H3.88889ZM5.5 10C6.32843 10 7 9.32843 7 8.5C7 7.67157 6.32843 7 5.5 7C4.67157 7 4 7.67157 4 8.5C4 9.32843 4.67157 10 5.5 10Z"},null,-1)])])):(i.openBlock(),i.createElementBlock("svg",Is,[...$[1]||($[1]=[i.createElementVNode("path",{d:"M13.8237 15.5557C13.8754 15.5557 14.1849 15.2833 14.2881 15.2288C14.4945 15.1198 14.6493 15.0109 14.8041 14.9564C15.8876 14.466 16.8163 14.7929 18.0547 16.3731C18.8286 17.3538 19.035 18.1712 18.777 18.934C18.5706 19.4789 18.1063 19.9148 17.3839 20.3507C17.3323 20.4052 16.9195 20.6776 16.7647 20.7321C15.0105 21.8764 10.9343 19.2609 7.99333 14.6839C5.05231 10.1614 4.27837 5.31201 6.08425 4.11328L6.34223 3.94982L6.60022 3.78635C7.52896 3.18698 8.09651 2.91454 8.76727 3.02351C9.43803 3.13249 10.0572 3.67737 10.5216 4.65816C11.5535 6.72869 11.3471 7.70948 10.0056 8.63578C9.9024 8.69027 9.54123 8.90822 9.54123 8.96271C9.23164 9.18066 9.74761 10.6518 11.0891 12.6134C12.379 14.6839 13.4626 15.8282 13.8237 15.5557Z"},null,-1)])]))])]),i.createElementVNode("div",_s,[i.createElementVNode("div",Ts,i.toDisplayString(H.value),1),i.createElementVNode("div",Vs,i.toDisplayString(Z.value),1)]),i.createElementVNode("div",Ms,[i.createElementVNode("button",{class:"reject-btn",onClick:oe,disabled:F.value},[...$[2]||($[2]=[i.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"white",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("path",{d:"M8.43445 12.6265C8.40888 12.6658 8.46336 13.037 8.45381 13.1428C8.43469 13.3543 8.44114 13.5264 8.40602 13.6715C8.24328 14.7412 7.53366 15.2879 5.71437 15.4497C4.58252 15.5543 3.85663 15.3068 3.4024 14.7319C3.08891 14.3045 2.98642 13.7342 3.01174 12.967C2.99573 12.9006 2.99239 12.4507 3.02751 12.3056C3.02369 10.4 7.03906 8.58585 11.9887 8.60976C16.8967 8.60665 20.9804 10.4191 21.0002 12.3909L20.9971 12.6688L20.994 12.9466C20.9911 13.9523 20.9178 14.5203 20.5023 14.9781C20.0867 15.4359 19.3642 15.6384 18.3857 15.5067C16.2946 15.2681 15.6485 14.6246 15.6064 13.1421C15.616 13.0363 15.6286 12.6527 15.5871 12.6257C15.5742 12.2815 14.196 11.9462 12.0345 11.9979C9.81551 11.9561 8.40554 12.2159 8.43445 12.6265Z"})],-1)])],8,Rs),i.createElementVNode("button",{class:"accept-btn",onClick:de,disabled:F.value},[N.value==="video"?(i.openBlock(),i.createElementBlock("svg",Us,[...$[3]||($[3]=[i.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.88889 5C2.84568 5 2 5.84568 2 6.88889V17.1111C2 18.1543 2.84568 19 3.88889 19H15.8611C16.9043 19 17.75 18.1543 17.75 17.1111V15.3089L21.0178 17.1244C21.4585 17.3692 22 17.0505 22 16.5464V7.46025C22 6.95616 21.4585 6.63753 21.0178 6.88233L17.75 8.69779V6.88889C17.75 5.84568 16.9043 5 15.8611 5H3.88889ZM5.5 10C6.32843 10 7 9.32843 7 8.5C7 7.67157 6.32843 7 5.5 7C4.67157 7 4 7.67157 4 8.5C4 9.32843 4.67157 10 5.5 10Z"},null,-1)])])):(i.openBlock(),i.createElementBlock("svg",As,[...$[4]||($[4]=[i.createElementVNode("path",{d:"M13.8237 15.5557C13.8754 15.5557 14.1849 15.2833 14.2881 15.2288C14.4945 15.1198 14.6493 15.0109 14.8041 14.9564C15.8876 14.466 16.8163 14.7929 18.0547 16.3731C18.8286 17.3538 19.035 18.1712 18.777 18.934C18.5706 19.4789 18.1063 19.9148 17.3839 20.3507C17.3323 20.4052 16.9195 20.6776 16.7647 20.7321C15.0105 21.8764 10.9343 19.2609 7.99333 14.6839C5.05231 10.1614 4.27837 5.31201 6.08425 4.11328L6.34223 3.94982L6.60022 3.78635C7.52896 3.18698 8.09651 2.91454 8.76727 3.02351C9.43803 3.13249 10.0572 3.67737 10.5216 4.65816C11.5535 6.72869 11.3471 7.70948 10.0056 8.63578C9.9024 8.69027 9.54123 8.90822 9.54123 8.96271C9.23164 9.18066 9.74761 10.6518 11.0891 12.6134C12.379 14.6839 13.4626 15.8282 13.8237 15.5557Z"},null,-1)])]))],8,Ls)])])])):i.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-dfb799c3"]]);function Bs(h){switch(h){case _e.HANGUP:case _e.ABNORMAL_END:case _e.HANDLE_ON_OTHER_DEVICE:return"ended";case _e.REFUSE:case _e.REMOTE_REFUSE:return"refused";case _e.BUSY:return"busy";case _e.CANCEL:case _e.REMOTE_CANCEL:return"canceled";case _e.NO_RESPONSE:case _e.REMOTE_NO_RESPONSE:return"noResponse";default:return"ended"}}function xs(){let h=null;const a=Y=>{const ze=Y.type===Ee.VIDEO_MULTI||Y.type===Ee.AUDIO_MULTI;h={callId:Y.callId,conversationId:Y.conversationId,chatType:ze?"groupChat":"singleChat",from:Y.callerUserId,to:Y.groupId||Y.calleeUserId||"",status:Bs(Y.reason),duration:Y.duration,timestamp:Date.now(),endedBy:Y.endedBy}},s=Me.on("callEnded",a),c=Me.on("singleCallEnded",a),p=Me.on("groupCallEnded",a),m=(Y,ze)=>Me.on(Y,ze);return{on:m,once:(Y,ze)=>Me.once(Y,ze),off:(Y,ze)=>{Me.off(Y,ze)},onStatusChanged:Y=>m("statusChanged",Y),onIncomingCall:Y=>m("incomingCall",Y),onCallInvited:Y=>m("callInvited",Y),onCallStarted:Y=>m("callStarted",Y),onCallEnded:Y=>m("callEnded",Y),onCallCanceled:Y=>m("callCanceled",Y),onCallRefused:Y=>m("callRefused",Y),onCallTimeout:Y=>m("callTimeout",Y),onCallBusy:Y=>m("callBusy",Y),onSingleCallInvited:Y=>m("singleCallInvited",Y),onSingleCallStarted:Y=>m("singleCallStarted",Y),onSingleCallConnected:Y=>m("singleCallConnected",Y),onSingleCallEnded:Y=>m("singleCallEnded",Y),onSingleCallCanceled:Y=>m("singleCallCanceled",Y),onSingleCallRefused:Y=>m("singleCallRefused",Y),onSingleCallTimeout:Y=>m("singleCallTimeout",Y),onSingleCallBusy:Y=>m("singleCallBusy",Y),onGroupCallInvited:Y=>m("groupCallInvited",Y),onGroupCallStarted:Y=>m("groupCallStarted",Y),onGroupCallConnected:Y=>m("groupCallConnected",Y),onGroupCallEnded:Y=>m("groupCallEnded",Y),onGroupCallCanceled:Y=>m("groupCallCanceled",Y),onGroupCallRefused:Y=>m("groupCallRefused",Y),onGroupCallTimeout:Y=>m("groupCallTimeout",Y),onGroupCallBusy:Y=>m("groupCallBusy",Y),onParticipantJoined:Y=>m("participantJoined",Y),onParticipantLeft:Y=>m("participantLeft",Y),onCallDurationUpdated:Y=>m("callDurationUpdated",Y),onCallError:Y=>m("callError",Y),getCallRecord:()=>h,clearCallRecord:()=>{h=null},_unsubscribeCallEnded:()=>{s(),c(),p()}}}function Ns(){const h=Be(),a=i.computed(()=>h.localStream),s=i.computed(()=>h.videoEnabled),c=i.computed(()=>h.audioEnabled),p=i.computed(()=>h.isConnected),m=()=>{const K=h.getRtcService();return K||d.warn("RtcService 未初始化,无法执行媒体控制"),K};return{localStream:a,isVideoEnabled:s,isAudioEnabled:c,isConnected:p,toggleVideo:async K=>{try{const N=m();if(!N){const A=K!==void 0?K:!s.value;return h.setVideoEnabled(A),A}const G=K!==void 0?K:!s.value,Z=await N.toggleVideo(G);return d.info("Video toggled via RtcService:",Z),Z}catch(N){return d.error("Failed to toggle video:",N),s.value}},toggleAudio:async K=>{try{const N=m();if(!N){const A=K!==void 0?K:!c.value;return h.setAudioEnabled(A),A}const G=K!==void 0?K:!c.value,Z=await N.toggleAudio(G);return d.info("Audio toggled via RtcService:",Z),Z}catch(N){return d.error("Failed to toggle audio:",N),c.value}},switchCamera:async K=>{try{return d.info("Switch camera:",K),!0}catch(N){return d.error("Failed to switch camera:",N),!1}},switchMicrophone:async K=>{try{return d.info("Switch microphone:",K),!0}catch(N){return d.error("Failed to switch microphone:",N),!1}},getLocalStream:()=>a.value,setLocalStream:K=>{h.setLocalStream(K)},reset:()=>{h.reset()}}}function Os(h){const{callState:a}=tt(),s=Be(),c=Xe(),p=qe();return{participants:i.computed(()=>{const R=[],T=h||c.getChatClient?.user||a.callerUserId,V=s.getRtcService();if(d.debug("[useParticipants] 计算参与者列表:",{currentUser:T,callerUserId:a.callerUserId}),T&&R.push({userId:T,userName:p.getUserInfo(T)?.nickname||T,avatar:p.getUserInfo(T)?.avatarURL,isMuted:!1,isInviting:!1,hasJoined:!0}),a.callerUserId&&a.callerUserId!==T){const F=V?.isUserInRtc(a.callerUserId)??!1;!(V?.hasUserLeft(a.callerUserId)??!1)&&(F||!V||V.isUserInRtc(a.callerUserId)===!1)&&R.push({userId:a.callerUserId,userName:p.getUserInfo(a.callerUserId)?.nickname||a.callerUserId,avatar:p.getUserInfo(a.callerUserId)?.avatarURL,isMuted:!1,isInviting:!F,hasJoined:F})}const B=R.filter(F=>F.hasJoined||F.isInviting);return d.debug("[useParticipants] 计算结果:",{totalCount:B.length,participants:B.map(F=>({userId:F.userId,isInviting:F.isInviting,hasJoined:F.hasJoined}))}),B})}}const Ps="2.0.0",Ds={install(h,...a){console.info(`%c[EasemobChatCallKit] v${Ps} initialized`,"color: #4ade80; font-weight: bold;"),h.config.globalProperties.$pinia||h.use(Rt.createPinia()),h.component("EasemobChatCallKitProvider",Hr),h.component("EasemobChatSingleCall",Jr),h.component("EasemobChatMultiCall",Xr),h.component("EasemobChatGroupMemberList",zn),h.component("InvitationNotification",Qr),h.component("EasemobChatMiniWindow",er),h.component("GroupCallShell",Zn)}};be.CALL_STATUS=vt,be.CALL_TYPE=Ee,be.DEFAULT_BACKGROUND_IMAGE=zr,be.EasemobChatCallKitProvider=Hr,be.EasemobChatGroupMemberList=zn,be.EasemobChatMiniWindow=er,be.EasemobChatMultiCall=Xr,be.EasemobChatSingleCall=Jr,be.GroupCallShell=Zn,be.HANGUP_REASON=_e,be.ICONS=Io,be.InvitationNotification=Qr,be.LogLevel=le,be.Logger=ot,be.RtcService=Dr,be.default=Ds,be.getAssetUrl=Zr,be.useCallKit=hn,be.useCallKitCore=tt,be.useCallKitEvents=xs,be.useCallTimerStore=At,be.useCenteredDraggable=no,be.useCornerDraggable=$r,be.useDraggable=qt,be.useGlobalCallStore=qe,be.useParticipants=Os,be.useRtcChannelStore=Be,be.useRtcService=Ns,Object.defineProperties(be,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));