openrtc 2.5.3 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export{b as WasmBridge,a as loadBrowserWasmRuntimeModule}from'./chunk-P5GCLQHS.js';import'./chunk-AYHD4X2R.js';import'./chunk-25CN4MLA.js';import'./chunk-XMYBBLYK.js';import'./chunk-OT7IPLZE.js';import'./chunk-OWKAJPOI.js';import'./chunk-CNAW5BZ3.js';import'./chunk-CCCYE3XN.js';import'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';
1
+ export{b as WasmBridge,a as loadBrowserWasmRuntimeModule}from'./chunk-2ESWBXLF.js';import'./chunk-AYHD4X2R.js';import'./chunk-25CN4MLA.js';import'./chunk-XMYBBLYK.js';import'./chunk-OT7IPLZE.js';import'./chunk-OWKAJPOI.js';import'./chunk-CNAW5BZ3.js';import'./chunk-CCCYE3XN.js';import'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-AYHD4X2R.js';import {o,b,a,t,m,g,x,y,h,z,B,C,F,G,H,d as d$1,e as e$1}from'./chunk-25CN4MLA.js';import {c,e,d,f,b as b$1}from'./chunk-XMYBBLYK.js';import {a as a$2}from'./chunk-OT7IPLZE.js';import {a as a$3}from'./chunk-CNAW5BZ3.js';import {c as c$1}from'./chunk-CCCYE3XN.js';import {a as a$4}from'./chunk-JPBW67B3.js';function M(u){if(!u)return null;let e=2166136261;for(let t=0;t<u.length;t+=1)e^=u.charCodeAt(t),e=Math.imul(e,16777619);return `fp-${(e>>>0).toString(16).padStart(8,"0")}`}var _=class _{constructor(e){this.deps=e;this.startedAutoConnectKey=null;this.browserAutoConnectUnsubscribe=null;this.desiredPeerRevision=0;this.desiredPeerSignature=null;this.desiredPeerSubmission=null;this.desiredPeerSubmissionQueue=Promise.resolve();this.queuedDesiredPeers=null;this.desiredPeersByDeviceId=new Map;this.wakeSubmission=null;this.presenceState=null;this.presenceStartGeneration=0;this.localExcludedPeers=new Set;this.localDesiredPeerDeviceId=null;for(let t of e.initialExcludedPeers??[]){let i=t.trim().toLowerCase();i&&this.localExcludedPeers.add(i);}}stop(){this.stopAutoConnect(),this.stopPresenceLoop();}get autoConnectKey(){return this.startedAutoConnectKey}set autoConnectKey(e){this.startedAutoConnectKey=e;}get presenceLoopState(){return this.presenceState}set presenceLoopState(e){this.presenceState=e;}stopPresence(){this.stopPresenceLoop();}updatePresenceLoopState(e){this.presenceState=e;}startAutoConnect(e,t){if(this.deps.isTicketOnlyMode())return;let i=t.trim()||this.deps.resolveWebLogicalDeviceId(),n=`${e}::${i}`;this.startedAutoConnectKey===n&&this.browserAutoConnectUnsubscribe||(this.stopAutoConnect(),this.localDesiredPeerDeviceId=i,this.startedAutoConnectKey=n,this.browserAutoConnectUnsubscribe=this.deps.getCoordinationSignaling().onDevicesChange(o=>this.submitDesiredPeers(o),this.currentLocalNodeId()??void 0));}wakeRustAutoConnectOwner(){return this.deps.isTicketOnlyMode()||!this.startedAutoConnectKey||this.wakeSubmission?false:(this.wakeSubmission=this.deps.waitForWasmClient(500).then(async e=>{e&&typeof e.wake_browser_auto_connect=="function"&&await e.wake_browser_auto_connect();}).finally(()=>{this.wakeSubmission=null;}),true)}submitDesiredPeers(e){if(!this.startedAutoConnectKey)return;let i=this.normalizeDesiredPeers(e);this.rememberDesiredPeers(i)&&(this.queuedDesiredPeers=i,this.flushDesiredPeerSubmission());}observeDesiredPeerProjection(e){this.rememberDesiredPeers(this.normalizeDesiredPeers(e));}async submitDesiredPeerProjection(e,t){if(!Number.isSafeInteger(e)||e<=0)throw new Error("Desired-peer projection revision must be a positive safe integer.");let i=this.startedAutoConnectKey;if(!i)throw new Error("Cannot submit a desired-peer projection before managed auto-connect starts.");let n=this.normalizeDesiredPeers(t);this.rememberDesiredPeers(n),this.queuedDesiredPeers=null,this.desiredPeerRevision=Math.max(this.desiredPeerRevision,e),await this.enqueueDesiredPeerSubmission(i,e,n);}async handleRoomArchitectureChange(){let e=this.startedAutoConnectKey;if(this.deps.isTicketOnlyMode()||!e)return false;let t=Array.from(this.desiredPeersByDeviceId.values());this.queuedDesiredPeers=null;let i=++this.desiredPeerRevision;return await this.enqueueDesiredPeerSubmission(e,i,t),true}rememberDesiredPeers(e){this.desiredPeersByDeviceId=new Map(e.map(i=>[i.deviceId,i]));let t=JSON.stringify(e);return t===this.desiredPeerSignature?false:(this.desiredPeerSignature=t,this.deps.onDesiredPeersChanged?.(),true)}resolveDesiredPeer(e,t){let i=typeof e=="string"?e.trim():"",n=typeof t=="string"?t.trim():"";if(i){let o=this.desiredPeersByDeviceId.get(i);if(o&&(!n||!o.nodeId||o.nodeId===n))return o}return n?Array.from(this.desiredPeersByDeviceId.values()).find(o=>o.nodeId===n)??null:null}flushDesiredPeerSubmission(){if(this.desiredPeerSubmission||!this.queuedDesiredPeers||!this.startedAutoConnectKey)return;let e=this.startedAutoConnectKey,t=this.queuedDesiredPeers,i=++this.desiredPeerRevision;this.queuedDesiredPeers=null,this.desiredPeerSubmission=this.enqueueDesiredPeerSubmission(e,i,t).catch(()=>{}).finally(()=>{this.desiredPeerSubmission=null,this.flushDesiredPeerSubmission();});}normalizeDesiredPeers(e){return (Array.isArray(e)?e:[]).map(t=>({deviceId:String(t?.deviceId??"").trim(),nodeId:typeof t?.nodeId=="string"&&t.nodeId.trim()||null,ticket:typeof t?.ticket=="string"&&t.ticket.trim()||null,online:t?.online===true,sessionId:typeof t?.sessionId=="string"&&t.sessionId.trim()||null,excludedPeers:Array.isArray(t?.excludedPeers)?[...new Set(t.excludedPeers.map(i=>String(i??"").trim().toLowerCase()).filter(Boolean))].sort():[],devicePublicKeyJwk:t?.devicePublicKeyJwk,topologyRole:t?.topologyRole,topologyRevision:t?.topologyRevision})).filter(t=>t.deviceId.length>0).sort((t,i)=>t.deviceId.localeCompare(i.deviceId))}enqueueDesiredPeerSubmission(e,t,i,n=this.roomGossipFanoutEnabled()){let o=this.desiredPeerSubmissionQueue.then(async()=>{if(this.startedAutoConnectKey!==e)return;let r=await this.deps.waitForWasmClient();if(this.startedAutoConnectKey===e){if(!r||typeof r.submit_browser_desired_peers!="function"){this.deps.warnMissingWasmOnce("submitBrowserDesiredPeers");return}if(await Promise.all(i.map(async s=>{if(s.ticket)try{await this.deps.rememberRouteRepairTokenFromTicket(s.ticket);}catch(c){console.warn("[WasmSignaling] failed to retain desired-peer admission token",{deviceId:s.deviceId,nodeId:s.nodeId,error:c});}})),n){if(typeof r.submit_browser_desired_peers_with_sparse_fanout!="function"){await r.submit_browser_desired_peers(t,JSON.stringify([])),this.deps.warnMissingWasmOnce("submitBrowserDesiredPeersWithSparseFanout");return}if(!this.deps.capabilityKey)throw new Error("Sparse fanout requires an explicit capability avenue.");await r.submit_browser_desired_peers_with_sparse_fanout(t,JSON.stringify(i),this.deps.capabilityKey,this.localDesiredPeerDeviceId,this.deps.localDeviceKeyX,true);}else await r.submit_browser_desired_peers(t,JSON.stringify(i));}});return this.desiredPeerSubmissionQueue=o.catch(r=>{console.warn("[WasmSignaling] failed to submit browser desired peers to Rust",{revision:t,error:r});}),o}roomGossipFanoutEnabled(){return typeof this.deps.roomGossipFanout=="function"?this.deps.roomGossipFanout():this.deps.roomGossipFanout===true}async excludeAutoConnect(e,t){let i=await this.deps.waitForWasmClient();i&&typeof i.set_auto_connect_excluded=="function"&&await i.set_auto_connect_excluded(e,t),await this.recordAutoConnectExcludedForPresence(e,t);}async installInitialAutoConnectExclusions(e){if(typeof e?.set_auto_connect_excluded=="function")for(let t of this.currentExcludedPeersSnapshot())await e.set_auto_connect_excluded(t,true);}async recordAutoConnectExcludedForPresence(e,t){let i=e.trim().toLowerCase();if(!i)return;t?this.localExcludedPeers.add(i):this.localExcludedPeers.delete(i);let n=this.deps.resolveWebLogicalDeviceId();n&&await this.deps.updateExcludedPeers(n,this.currentExcludedPeersSnapshot());}async startPresenceLoop(e,t,i,n,o){if(this.deps.isTicketOnlyMode())return;this.stopPresenceLoop();let r=this.presenceStartGeneration;this.presenceState={userId:e,localNodeId:t,ticket:n,metadata:o,deviceName:i};let s=this.deps.resolveWebLogicalDeviceId(),c=await this.deps.withWebPresenceMetadata(o,s);r!==this.presenceStartGeneration||this.presenceState===null||await this.deps.updatePresence(t,n,true,_.PRESENCE_LEASE_MS,c,i);}stopAutoConnect(){this.browserAutoConnectUnsubscribe?.(),this.browserAutoConnectUnsubscribe=null,this.startedAutoConnectKey=null,this.localDesiredPeerDeviceId=null,this.desiredPeerSignature=null,this.queuedDesiredPeers=null,this.desiredPeersByDeviceId.clear(),this.wakeSubmission=null;}currentExcludedPeersSnapshot(){return Array.from(this.localExcludedPeers).sort()}currentLocalNodeId(){let e=this.presenceState?.localNodeId;return typeof e=="string"&&e.trim()||null}stopPresenceLoop(){this.presenceStartGeneration+=1,this.presenceState=null;}};_.PRESENCE_LEASE_MS=15*6e4;var R=_;function ne(){if(!(typeof window>"u"))try{if(new URL(import.meta.url).pathname.includes("/node_modules/.vite/deps/"))return new URL("/node_modules/openrtc/dist/openrtc_bg.wasm",window.location.origin)}catch{}}async function oe(){let u=await import('./openrtc-KERRTMSG.js');return {initWasm:e=>u.default(e??ne()),WasmClient:u.WasmClient,start:u.start}}function re(u){try{let e=u.replace(/-/g,"+").replace(/_/g,"/"),t=(4-e.length%4)%4,i=e+"=".repeat(t);if(typeof atob=="function")return JSON.parse(atob(i));let n=globalThis.Buffer;if(n)return JSON.parse(n.from(i,"base64").toString("utf8"))}catch{return null}return null}function se(u){let e=typeof u=="string"?u.trim():"";if(!e)return {present:false};let t=e.lastIndexOf("."),i=t>=0?e.slice(0,t):e,n=t>=0?e.slice(t+1):null,o=n?re(n):null,r=o&&typeof o.t=="string"&&o.t.trim().length>0?o.t.trim():null,s=o&&typeof o.s=="string"&&o.s.trim().length>0?o.s.trim():null,c=o&&typeof o.m=="number"&&Number.isFinite(o.m)?o.m:null;return {present:true,irohFingerprint:M(i),tokenFingerprint:M(r),tokenSuffixFingerprint:M(n),scope:s,maxConnections:c}}function E(u,e,t={}){let i=typeof u.finishSend=="function"?u.finishSend.bind(u):typeof u.finish_send=="function"?u.finish_send.bind(u):null,n=typeof u.cancelSend=="function"?u.cancelSend.bind(u):typeof u.cancel_send=="function"?u.cancel_send.bind(u):null;if(!i){if(t.requireFinish===true)throw new Error("WASM peer stream is missing finishSend(); rebuild the current OpenRTC WASM before sending application data");return e}let o=e.getWriter(),r=new WritableStream({write:s=>o.write(s),async close(){await o.close(),await i();},async abort(s){await n?.(),await o.abort(s);}});return a$4(r,n)}var p=class p{constructor(e$1){this.spaceNamespaceIdPromise=null;this.cachedSpaceNamespaceId=null;this.authListeners=[];this.wasmClient=null;this.createdAtMs=Date.now();this.missingWasmWarnings=new Set;this.wasmReadyWarningDelayMs=15e3;this.browserCoordinationSignaling=null;this.effectiveRoomArchitecture="mesh";this.lastObservedFirebaseUserId=null;this.sessionReaders=new Set;this.authContext=null;this.injectedBrowserAuthSessionActive=false;this.hasSyncedAuthToWasmClient=false;this.lastWasmAuthUserId=null;this.lastWasmAuthToken=null;this.lastDeliveredConnectionStates=new Map;this.authScopedRuntimeGeneration=0;this.coreClient=null;this.applicationRouteEscalations=new Map;this.applicationRouteEscalationAttemptKeys=new Map;this.applicationRouteEscalationUnsubscribe=null;this.routeSubscriptionGeneration=-1;this.applicationRouteEscalationSubscriptionEpoch=0;this.appTag=c(e$1),this.options={...e$1,appTag:this.appTag,authMode:d(e$1),projectId:e(e$1)},this.effectiveRoomArchitecture=e$1.coordinationRoomArchitecture==="sparse"||e$1.coordinationRoomGossipFanout===true?"sparse":"mesh",this.coordinationHost=new b({appTag:this.appTag,projectId:this.options.projectId,discoveryMode:this.options.discoveryMode,signalingMode:this.options.signalingMode,gateway:this.options.coordinationGateway,avenueOverride:this.options.coordinationAvenueOverride,roomArchitecture:this.options.coordinationRoomArchitecture,initialExcludedPeers:this.options.initialAutoConnectExcludedDeviceIds,resolveSpaceNamespaceId:()=>this.ensureSpaceNamespaceIdPromise(),getCurrentUserId:()=>this.getCurrentUserId(),getAuthToken:async(r=false)=>this.currentUser?.getToken?.(r)??null,getAppCheckToken:async(r=false)=>{let s=this.authContext?.appCheckTokenProvider??this.options.attestationTokenProvider;return s?s(r):a().getAppCheckToken(r)},getLocalDeviceId:()=>this.resolveWebLogicalDeviceId(),getDefaultDeviceName:()=>this.getDefaultBrowserDeviceName(),getPlatformType:()=>this.options.coordinationPlatformType??"web",normalizeDevice:(r,s)=>this.normalizeDevice(r,s)});let n=this.options.coordinationRoomGossipFanout===true||this.options.coordinationRoomArchitecture==="auto"||this.options.coordinationRoomArchitecture==="sparse"?c$1(this.options.coordinationAvenueOverride).key:void 0;if(this.presenceManager=new R({isTicketOnlyMode:()=>this.isTicketOnlyMode(),waitForWasmClient:(r,s)=>this.waitForWasmClient(r,s),warnMissingWasmOnce:r=>this.warnMissingWasmOnce(r),resolveWebLogicalDeviceId:()=>this.resolveWebLogicalDeviceId(),withWebPresenceMetadata:(r,s)=>this.withWebPresenceMetadata(r,s),updatePresence:(r,s,c,a,d,h)=>this.updatePresence(r,s,c,a,d,h),updateExcludedPeers:(r,s)=>this.getCoordinationSignaling().updateDevice(r,{excludedPeers:s}),getCoordinationSignaling:()=>this.getCoordinationSignaling(),rememberRouteRepairTokenFromTicket:r=>this.coreClient?.rememberRouteRepairTokenFromTicket?.(r)??Promise.resolve(false),onDesiredPeersChanged:()=>this.retryManagedApplicationRouteEscalations(),roomGossipFanout:()=>this.effectiveRoomArchitecture==="sparse",capabilityKey:n,localDeviceKeyX:this.options.coordinationDevicePublicKeyX,initialExcludedPeers:this.options.initialAutoConnectExcludedDeviceIds}),this.persistenceReady=Promise.resolve(),this.isTicketOnlyMode()||this.usesProviderNeutralGrant()){this.app=null,this.auth=null;return}let o=a();this.app=o.getApp(),this.auth=o.getAuth(),o.onAuthStateChanged(r=>{if(this.authContext)return;if(this.isSpaceMode()){this.authListeners.forEach(a=>a(this.toRuntimeIdentity(r)));return}let s=r?.uid??null,c=this.lastObservedFirebaseUserId;this.lastObservedFirebaseUserId=s,c&&c!==s&&this.stopAuthActivity({userId:c}),this.browserCoordinationSignaling?.handleScopeChange()??this.coordinationHost.handleScopeChange(),this.authListeners.forEach(a=>a(this.toRuntimeIdentity(r)));});}async loadBrowserWasmRuntime(){return oe()}get tag(){return this.appTag}capabilities(){return t()}getDeviceIdentityStorageKey(){let e=f(this.options);return `${p.WEB_DEVICE_ID_STORAGE_PREFIX}_${e}`}getDeviceIdPersistenceMode(){return this.options.deviceIdPersistence??this.options.nodeIdPersistence??"persistent"}isTicketOnlyMode(){return this.options.signalingMode==="ticket-only"}usesProviderNeutralGrant(){return typeof this.options.coordinationGateway?.grantProvider=="function"}createRandomDeviceId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`web-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}resolveWebLogicalDeviceId(){let e=this.options.localDeviceId?.trim();if(e)return e;let t=this.getDeviceIdPersistenceMode();if(typeof localStorage>"u")return this.createRandomDeviceId();let i=this.getDeviceIdentityStorageKey(),n=Date.now(),o=null;try{let d=localStorage.getItem(i);o=d?JSON.parse(d):null;}catch{o=null;}let r=typeof o?.deviceId=="string"?o.deviceId.trim():"",s=typeof o?.expiresAt=="number"?o.expiresAt:void 0;if(t==="persistent"){let d=r||this.createRandomDeviceId();return localStorage.setItem(i,JSON.stringify({deviceId:d})),d}if(r&&typeof s=="number"&&s>n){let d=n+p.EPHEMERAL_DEVICE_ID_TTL_MS;return localStorage.setItem(i,JSON.stringify({deviceId:r,expiresAt:d})),r}let c=this.createRandomDeviceId(),a=n+p.EPHEMERAL_DEVICE_ID_TTL_MS;return localStorage.setItem(i,JSON.stringify({deviceId:c,expiresAt:a})),c}getDefaultBrowserDeviceName(){return this.options.deviceName?.trim()||(this.options.storagePrefix?`Web (${this.options.storagePrefix.replace(/_$/,"")})`:"Web Browser")}async getLocalDeviceInfo(){return {deviceId:this.resolveWebLogicalDeviceId(),deviceName:this.getDefaultBrowserDeviceName(),platformType:this.options.coordinationPlatformType??"web"}}getCoordinationSignaling(){return this.browserCoordinationSignaling??this.coordinationHost.getSignaling()}usesCoordinationGateway(){return this.coordinationHost.usesGateway()}setCoordinationHostAvailability(e){this.coordinationHost.setHostAvailability(e),this.browserCoordinationSignaling?.setHostAvailability?.(e);}async reconnectCoordinationAfterHostResume(){let e=this.browserCoordinationSignaling;if(e?.reconnectAfterHostResume){await e.reconnectAfterHostResume();return}await this.coordinationHost?.reconnectAfterHostResume();}async getCoordinationNativeTrustToken(e=false){return this.coordinationHost.getNativeTrustToken(e)}invalidateCoordinationNativeTrustToken(){this.coordinationHost.invalidateNativeTrustToken();}subscribeCoordinationNativeTrustToken(e,t){return this.coordinationHost.subscribeNativeTrustToken(e,t)}setCoordinationLocalDeviceId(e){if(!this.options.coordinationGateway)return;let t=e.trim();t&&(this.options.localDeviceId=t);}setCoordinationPlatformType(e){this.options.coordinationGateway&&(this.options.coordinationPlatformType=e);}async setCoordinationExcludedPeers(e){let t=this.resolveWebLogicalDeviceId();if(!t)throw new Error("The local device must be known before publishing peer exclusions.");await this.getCoordinationSignaling().updateDevice(t,{excludedPeers:e});}async joinCoordinationRoom(e,t,i){let n=this.getCoordinationSignaling();if(!n.joinCoordinationRoom)throw new Error("The active coordination provider does not support rooms.");await n.joinCoordinationRoom(e,t,i);}async leaveCoordinationRoom(e){await this.getCoordinationSignaling().leaveCoordinationRoom?.(e);}async getCoordinationRoomMembers(e){let t=this.getCoordinationSignaling();if(!t.getCoordinationRoomMembers)throw new Error("The active coordination provider does not support rooms.");return t.getCoordinationRoomMembers(e)}watchCoordinationRoomMembers(e,t){let i=this.getCoordinationSignaling();if(!i.watchCoordinationRoomMembers)throw new Error("The active coordination provider does not support rooms.");return i.watchCoordinationRoomMembers(e,t)}async withWebPresenceMetadata(e,t){let i;if(!e||!e.trim())i=JSON.stringify({deviceId:t});else {try{let n=JSON.parse(e);if(n&&typeof n=="object"&&!Array.isArray(n))return i=JSON.stringify({...n,deviceId:t}),await m(i)??i}catch{}i=JSON.stringify({deviceId:t,metadata:e});}return await m(i)??i}async setAuthContext(e){let t=this.injectedBrowserAuthSessionActive,i=this.authContext?.userId??null,n=e?.userId??null;if(this.authContext=e,!this.isTicketOnlyMode()&&!this.usesProviderNeutralGrant()&&e?.customToken?.trim()&&!(g()&&this.options.authMode==="external"&&typeof e.tokenProvider=="function"))try{await this.ensureBrowserPlatformAuth(e.userId,e.customToken.trim());}catch(o){console.warn("[WasmBridge] ensureBrowserPlatformAuth failed (non-fatal):",o);}else if(!this.isTicketOnlyMode()&&!this.usesProviderNeutralGrant()&&!e&&t)try{await this.auth?.signOut();}catch(o){console.warn("[WasmBridge] Failed to clear injected browser auth session:",o);}finally{this.injectedBrowserAuthSessionActive=false;}this.syncWasmAuthToken(),!this.isTicketOnlyMode()&&i!==n&&await(this.browserCoordinationSignaling?.handleScopeChange()??this.coordinationHost.handleScopeChange()),this.authListeners.forEach(o=>o(this.currentUser));}async ensureBrowserPlatformAuth(e,t){if((this.auth?.currentUser?.uid??null)===e){this.injectedBrowserAuthSessionActive=true;return}await a().signInWithCustomTokenValue(t),this.injectedBrowserAuthSessionActive=true;}syncWasmAuthToken(){let e=this.wasmClient?.setIdentityCredential??this.wasmClient?.set_auth_token;if(!this.wasmClient||typeof e!="function"||!this.authContext&&this.isSpaceMode())return;let t=this.authContext?.userId??null,i=this.authContext?.token,n=typeof i=="string"&&i.trim().length>0?i:null;if(!(this.hasSyncedAuthToWasmClient&&this.lastWasmAuthUserId===t&&this.lastWasmAuthToken===n)){if(this.lastWasmAuthUserId=t,this.lastWasmAuthToken=n,this.hasSyncedAuthToWasmClient=true,n===null&&typeof this.wasmClient.clearIdentityCredential=="function"){this.wasmClient.clearIdentityCredential();return}e.call(this.wasmClient,n);}}toRuntimeIdentity(e){return e?{id:e.uid,email:e.email,displayName:e.displayName,isAnonymous:e.isAnonymous,getToken:async(t=false)=>{try{return await e.getIdToken(t)}catch{return null}}}:null}getCurrentUserId(){return this.authContext?.userId?this.authContext.userId:this.isTicketOnlyMode()?null:this.auth?.currentUser?.uid??null}getCurrentUserIdForScope(){return this.getCurrentUserId()}getAuthContext(){return this.authContext}isSpaceMode(){return x(this.options)}getResolvedOptions(){return this.options}getDiscoveryScopeId(){if(this.isTicketOnlyMode())return null;let e=this.getCurrentUserId();return e||(this.isSpaceMode()?this.resolveWebLogicalDeviceId():null)}matchesTag(e){return y(e,this.appTag,this.isSpaceMode())}matchesLegacyOrCurrentTag(e){return this.matchesTag(e)}async stopSessionSubscriptions(){let e=Array.from(this.sessionReaders);this.sessionReaders.clear(),await Promise.allSettled(e.map(async t=>{try{await t.cancel();}catch{}}));}async stopRuntimeAuthScopedLoops(){let e=await this.waitForWasmClient(250);if(e)try{typeof e.stop_auth_scoped_activity=="function"?await e.stop_auth_scoped_activity():(typeof e.stop_presence_loop=="function"&&await e.stop_presence_loop(),typeof e.stop_auto_connect=="function"&&await e.stop_auto_connect());}catch(t){console.warn("[WasmSignaling] Failed to stop auth-scoped runtime loops:",t);}}async stopAuthActivity(e){h("WasmBridge.stopAuthActivity",{userId:e?.userId??null}),this.authScopedRuntimeGeneration+=1,this.stopApplicationRouteEscalationSubscription();let t=await this.waitForWasmClient(500);if(t&&typeof t.revoke_tokens_by_scope=="function")try{await t.revoke_tokens_by_scope("user-device");}catch(i){console.warn("[WasmBridge] user-device revoke during auth-scoped shutdown failed:",i);}this.presenceManager.stop(),this.browserCoordinationSignaling?.stopAuthActivity(),this.coordinationHost?.stopAuthActivity(),await this.stopSessionSubscriptions(),this.lastDeliveredConnectionStates.clear(),this.applicationRouteEscalations?.clear(),this.applicationRouteEscalationAttemptKeys?.clear(),await this.stopRuntimeAuthScopedLoops();}setWasmClient(e){this.wasmClient=e,this.coordinationHost.setWasmClient(e),this.lastWasmAuthUserId=null,this.lastWasmAuthToken=null,this.hasSyncedAuthToWasmClient=this.authContext===null,this.lastDeliveredConnectionStates.clear(),this.applicationRouteEscalations?.clear(),this.applicationRouteEscalationAttemptKeys?.clear(),this.syncWasmAuthToken();}async createBroadcastPublisher(){let e=await this.waitForWasmClient();if(!e)throw new Error("WASM broadcast publisher runtime is unavailable");return a$1.create(e)}async initializePersistentIrohProtocols(e){let t=await this.waitForWasmClient(),i=t?.__initPersistentIrohProtocols;if(typeof i!="function")throw new Error("This OpenRTC WASM host was built without persistent Iroh protocols");await i.call(t,e);}async createPersistentIrohNamespace(e,t){return (await this.requirePersistentProtocolHost()).__createPersistentIrohNamespace(BigInt(e),BigInt(t))}async importPersistentIrohTicket(e,t,i){return (await this.requirePersistentProtocolHost()).__importPersistentIrohTicket(e,BigInt(t),BigInt(i))}async sharePersistentIrohNamespace(e,t){return (await this.requirePersistentProtocolHost()).__sharePersistentIrohNamespace(e,t)}async removePersistentIrohNamespace(e,t,i){await(await this.requirePersistentProtocolHost()).__removePersistentIrohNamespace(e,BigInt(t),BigInt(i));}async putPersistentIrohBytes(e,t,i){return (await this.requirePersistentProtocolHost()).__putPersistentIrohBytes(e,t,i)}async setPersistentIrohHash(e,t,i,n){return (await this.requirePersistentProtocolHost()).__setPersistentIrohHash(e,t,i,BigInt(n))}async deletePersistentIrohPrefix(e,t){return (await this.requirePersistentProtocolHost()).__deletePersistentIrohPrefix(e,t)}async queryPersistentIrohNamespace(e,t){return (await this.requirePersistentProtocolHost()).__queryPersistentIrohNamespace(e,t)}async hydratePersistentIrohBlob(e){await(await this.requirePersistentProtocolHost()).__hydratePersistentIrohBlob(e);}async acknowledgePersistentIrohOutbox(e){await(await this.requirePersistentProtocolHost()).__acknowledgePersistentIrohOutbox(e);}async flushPersistentIrohProtocols(){await(await this.waitForWasmClient(500))?.__flushPersistentIrohProtocols?.();}async shutdownPersistentIrohProtocols(){await(await this.waitForWasmClient(500))?.__shutdownPersistentIrohProtocols?.();}async requirePersistentProtocolHost(){let e=await this.waitForWasmClient();if(!e||typeof e.__queryPersistentIrohNamespace!="function")throw new Error("This OpenRTC WASM host was built without persistent Iroh protocols");return e}warnMissingWasmOnce(e){!this.wasmClient&&Date.now()-this.createdAtMs<this.wasmReadyWarningDelayMs||this.missingWasmWarnings.has(e)||(this.missingWasmWarnings.add(e),console.warn(`[WasmSignaling] ${e} skipped: wasm client is not ready.`));}async waitForWasmClient(e=4e3,t=50){if(this.wasmClient)return this.wasmClient;let i=Date.now();for(;!this.wasmClient&&Date.now()-i<e;)await a$2(t);return this.wasmClient??null}normalizeDevice(e,t){return z(e,t)}normalizeDeviceRecord(e,t){return this.normalizeDevice(e,t)}getResolvedWebLogicalDeviceId(){return this.resolveWebLogicalDeviceId()}async encodeSparseFanoutMessage(e,t){let i=await this.waitForWasmClient(),n=this.options.coordinationDeviceSign;if(!i?.prepareSparseFanoutMessage||!i?.finalizeSparseFanoutMessage||!n)throw new Error("[OpenRTC] Browser sparse fanout signer is unavailable.");let o=await i.prepareSparseFanoutMessage(e,t),r=new Uint8Array(o.signingInput??o.signing_input??[]),s=await n(r);return new Uint8Array(await i.finalizeSparseFanoutMessage(String(o.requestId??o.request_id??""),s))}async acceptSparseFanoutMessage(e,t,i){let n=await this.waitForWasmClient();if(!n?.acceptSparseFanoutMessage)throw new Error("[OpenRTC] Browser sparse fanout verifier is unavailable.");let o=await n.acceptSparseFanoutMessage(e,t,i);return {payload:new Uint8Array(o.payload??[]),authorDeviceId:String(o.authorDeviceId??o.author_device_id??""),authorPeerId:String(o.authorPeerId??o.author_peer_id??""),topologyRevision:Number(o.topologyRevision??o.topology_revision),hop:Number(o.hop),forwardPeerIds:Array.isArray(o.forwardPeerIds??o.forward_peer_ids)?(o.forwardPeerIds??o.forward_peer_ids).map(String):[],forwardPeerLimit:Number(o.forwardPeerLimit??o.forward_peer_limit),forwardQueueCapacity:Number(o.forwardQueueCapacity??o.forward_queue_capacity),...o.forward==null?{}:{forward:new Uint8Array(o.forward)}}}async recordSparseFanoutForwardQueueDrop(e,t){let i=await this.waitForWasmClient();i?.recordSparseFanoutForwardQueueDrop&&await i.recordSparseFanoutForwardQueueDrop(e,t);}normalizeDeviceStatusSnapshot(e){return B(e)}normalizePeerSessionSnapshot(e){return C(e)}toBackendConnectionStateFromPeerSession(e){return F(e)}normalizeStateSnapshot(e){return G(e)}stabilizeConnectionState(e){let t=this.lastDeliveredConnectionStates.get(e.connectionId);return {...e,deviceId:e.deviceId??t?.deviceId??null,deviceIdHint:e.deviceIdHint??t?.deviceIdHint??null,remoteNodeId:e.remoteNodeId??t?.remoteNodeId??null,createdAt:e.createdAt??t?.createdAt,updatedAt:e.updatedAt??t?.updatedAt}}sameConnectionState(e,t){return H(e,t)}deliverConnectionState(e,t,i,n){let o=this.stabilizeConnectionState(e);this.lastDeliveredConnectionStates.set(o.connectionId,o);let s=(n??this.lastDeliveredConnectionStates).get(o.connectionId);this.sameConnectionState(s,o)||(n&&n.set(o.connectionId,o),t(o));}get browserPresenceLoopState(){return this.presenceManager.presenceLoopState}set browserPresenceLoopState(e){this.presenceManager.presenceLoopState=e;}get currentUser(){if(this.authContext?.userId){let e=this.authContext.token??null,t=this.authContext.tokenProvider;return {id:this.authContext.userId,getToken:async(i=false)=>{if(e&&(!i||!t))return e;if(t)try{let o=await t(i);if(o)return o}catch{}let n=this.isTicketOnlyMode()?null:this.auth?.currentUser??null;if(n&&n.uid===this.authContext?.userId)try{return await n.getIdToken(i)}catch{return null}return null}}}return this.isTicketOnlyMode()?null:this.toRuntimeIdentity(this.auth?.currentUser??null)}onAuthChange(e){return this.authListeners.push(e),e(this.currentUser),()=>{this.authListeners=this.authListeners.filter(t=>t!==e);}}async checkForSSOToken(){this.isTicketOnlyMode()||this.usesProviderNeutralGrant()||await a().checkForSSOToken();}async waitForAuth(){this.isTicketOnlyMode()||this.usesProviderNeutralGrant()||this.isSpaceMode()||this.authContext?.userId||this.auth?.currentUser||await a().waitForAuth();}async signInAnonymously(){if(!this.isTicketOnlyMode()){if(this.options.authMode!=="anonymous")throw new Error(`[pluto-rtc] Anonymous sign-in is disabled when authMode=${this.options.authMode}.`);await a().signInAnonymously();}}async signInWithPluto(){if(this.isTicketOnlyMode())throw new Error('[openrtc] Pluto sign-in is unavailable when signalingMode="ticket-only".');await a().signInWithPluto();}async signOut(){let e=this.getCurrentUserId();await this.stopAuthActivity({userId:e}),this.authContext=null,this.syncWasmAuthToken(),this.isTicketOnlyMode()||await this.auth?.signOut(),this.authListeners.forEach(t=>t(this.currentUser));}async getTurnCredentials(){return this.isTicketOnlyMode()||!this.auth?.currentUser?null:typeof this.options.turnCredentialsProvider=="function"?await this.options.turnCredentialsProvider()??null:null}async updatePresence(e,t,i=true,n=3e5,o,r){if(this.isTicketOnlyMode())return;let s=this.resolveWebLogicalDeviceId(),c=this.getDeviceIdPersistenceMode()==="ephemeral"?p.EPHEMERAL_DEVICE_ID_TTL_MS:n,a=await this.withWebPresenceMetadata(o,s);this.presenceManager.updatePresenceLoopState({userId:this.getCurrentUserId()??"",localNodeId:e,ticket:t,metadata:a,deviceName:r?.trim()||this.getDefaultBrowserDeviceName()}),await this.getCoordinationSignaling().updatePresence(e,t,i,c,a,r);}async refreshLivePresence(e,t,i,n){if(this.isTicketOnlyMode())return;let o=this.resolveWebLogicalDeviceId(),r=await this.withWebPresenceMetadata(i,o);this.presenceManager.updatePresenceLoopState({userId:this.getCurrentUserId()??"",localNodeId:e,ticket:t,metadata:r,deviceName:n?.trim()||this.getDefaultBrowserDeviceName()}),await this.getCoordinationSignaling().updatePresence(e,t,true,15*6e4,r,n);}async setOffline(e){this.presenceManager.stopPresence(),!this.isTicketOnlyMode()&&await this.getCoordinationSignaling().setOffline(e);}async updateDevice(e,t){if(!e?.trim())throw new Error("updateDevice requires a deviceId");this.isTicketOnlyMode()||await this.getCoordinationSignaling().updateDevice(e,t);}async deleteDevice(e){if(!e?.trim())throw new Error("deleteDevice requires a deviceId");this.isTicketOnlyMode()||await this.getCoordinationSignaling().deleteDevice(e);}async cleanupStaleDevices(){this.isTicketOnlyMode()||await this.getCoordinationSignaling().cleanupStaleDevices();}async sendMessage(e,t,i,n){if(this.isTicketOnlyMode())throw new Error('[openrtc] sendMessage() is unavailable when signalingMode="ticket-only".');return this.getCoordinationSignaling().sendMessage(e,t,i,n)}async pollMessages(e){return this.isTicketOnlyMode()?[]:this.getCoordinationSignaling().pollMessages(e)}async searchDevices(e){return this.isTicketOnlyMode()?[]:this.getCoordinationSignaling().searchDevices(e)}async listDeviceStatus(){if(this.isTicketOnlyMode())return [];if(!this.getDiscoveryScopeId())return [];let t=await this.getCoordinationSignaling().listDevices(),i=this.wasmClient;return Promise.all(t.map(async n=>{let o=this.normalizeDeviceStatusSnapshot({...n,connectionStatus:n.online?"online":"disconnected"}),r=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!r||typeof i?.iroh_path_kind!="function"||typeof i?.iroh_transport_rtt_ms!="function")return o;try{let[s,c]=await Promise.all([i.iroh_path_kind(r),i.iroh_transport_rtt_ms(r)]);if(typeof c!="number"||!Number.isFinite(c))return o;let a=Math.max(0,Math.round(c)),d={};if(s==="direct-lan")d.irohLan=a;else if(s==="direct-quic")d.iroh=a;else if(s==="ble")d.ble=a;else if(s==="relay")d.irohRelay=a;else if(s==="webrtc")d.webrtc=a;else if(s==="moq")d.moq=a;else return o;return {...o,latencyMs:a,latencyByTransport:d}}catch(s){return d$1("[WasmBridge] iroh transport latency unavailable",{deviceId:n.deviceId,error:s instanceof Error?s.message:String(s)}),o}}))}async getPeerSession(e){let t=await this.waitForWasmClient(500);if(t&&typeof t.peer_session=="function"){let i=await t.peer_session(e);return !i||typeof i!="object"?null:this.normalizePeerSessionSnapshot(i)}return this.warnMissingWasmOnce("getPeerSession"),null}async listPeerSessions(){let e=await this.waitForWasmClient(500);if(e&&typeof e.peer_sessions=="function"){let t=await e.peer_sessions();return (Array.isArray(t)?t:[]).map(n=>this.normalizePeerSessionSnapshot(n)).filter(n=>!!(n.peerId||n.deviceId||n.deviceIdHint||n.nodeId||n.activeConnectionId))}return this.warnMissingWasmOnce("listPeerSessions"),[]}async waitForSettledPeer(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.wait_for_peer=="function"){let n=await i.wait_for_peer(e,t);return !n||typeof n!="object"?null:this.normalizePeerSessionSnapshot(n)}return this.warnMissingWasmOnce("waitForSettledPeer"),null}async waitForSettledScope(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.wait_for_settled_scope=="function"){let n=await i.wait_for_settled_scope(e,t);return !n||typeof n!="object"?null:this.normalizePeerSessionSnapshot(n)}return this.warnMissingWasmOnce("waitForSettledScope"),null}async openPeerBi(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.open_peer_bi=="function"){let n=await i.open_peer_bi(e,t);if(!n?.recv||!n?.send)throw new Error("WASM open_peer_bi returned an invalid bidirectional stream");return {readable:n.recv,writable:E(n,n.send)}}throw this.warnMissingWasmOnce("openPeerBi"),new Error("WASM runtime does not support open_peer_bi()")}async openPeerBiRaw(e,t){if(this.options.applicationCrypto?.requireEncrypted)throw new Error("[WasmBridge] openPeerBiRaw is debug-only and cannot be used when application crypto is required");let i=await this.waitForWasmClient(500),n=i&&typeof i.open_peer_bi_transport_only=="function";if(console.debug("[WasmBridge] openPeerBiRaw",{peerId:e,hasWasmClient:!!i,hasTransportOnly:n,timeoutMs:t}),n){let o=await i.open_peer_bi_transport_only(e,t);if(!o?.recv||!o?.send)throw new Error("WASM open_peer_bi_transport_only returned an invalid bidirectional stream");return {readable:o.recv,writable:E(o,o.send)}}throw new Error("WASM runtime does not support the restricted transport-only diagnostic stream")}async openPeerUni(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.open_peer_uni=="function"){let n=await i.open_peer_uni(e,t),o=n?.writable??n;if(!o)throw new Error("WASM open_peer_uni returned an invalid writable stream");return {writable:E(n,o)}}throw this.warnMissingWasmOnce("openPeerUni"),new Error("WASM runtime does not support open_peer_uni()")}beginOpenRtcMediaPublication(e){let t=this.wasmClient?.__beginOpenRtcMediaPublication;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");let i=t.call(this.wasmClient,e.publicationId||void 0,e.kind,e.codec,e.clockRate,e.codedWidth,e.codedHeight,e.channels);return {...i,control:new Uint8Array(i.control)}}encodeOpenRtcMediaSample(e){let t=this.wasmClient?.__encodeOpenRtcMediaSample;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");return new Uint8Array(t.call(this.wasmClient,e.publicationId,e.timestampUs,e.durationUs,e.keyframe,e.discardable,e.payload))}pauseOpenRtcMediaPublication(e){let t=this.wasmClient?.__pauseOpenRtcMediaPublication;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");t.call(this.wasmClient,e);}retireOpenRtcMediaPublication(e){let t=this.wasmClient?.__retireOpenRtcMediaPublication;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");t.call(this.wasmClient,e);}retireOpenRtcMediaReceiver(e,t){let i=this.wasmClient?.__retireOpenRtcMediaReceiver;if(typeof i!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");i.call(this.wasmClient,e,t);}decodeOpenRtcMediaChunk(e){let t=this.wasmClient?.__decodeOpenRtcMediaChunk;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include the shared media protocol.");let i=t.call(this.wasmClient,e);return {...i,payload:new Uint8Array(i.payload)}}decodeOpenRtcMediaControl(e){let t=this.wasmClient?.__decodeOpenRtcMediaControl;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include the shared media protocol.");return t.call(this.wasmClient,e)}async sendPeerDatagram(e,t,i){let n=await this.waitForWasmClient(500),o=n?.sendPeerDatagram;if(typeof o!="function")throw new Error("[OpenRTC] This WASM build does not include protected peer datagrams.");return await o.call(n,e,t,i)!==false}async receivePeerDatagram(e){let t=await this.waitForWasmClient(500),i=t?.receivePeerDatagram;if(typeof i!="function")throw new Error("[OpenRTC] This WASM build does not include protected peer datagrams.");return new Uint8Array(await i.call(t,e))}peerDatagramMaxSize(){let e=this.wasmClient?.peerDatagramMaxSize?.();return Number.isSafeInteger(e)&&e>0?e:1024}createPeerDatagramPolicy(){let e=this.wasmClient?.createPeerDatagramPolicy;if(typeof e!="function")throw new Error("[OpenRTC] This WASM build does not include shared datagram policy.");return e.call(this.wasmClient)}async resolvePeerRecords(e){let t=await this.waitForWasmClient(500);if(t&&typeof t.resolve_peer_connection_records=="function"){let i=await t.resolve_peer_connection_records(e);return (Array.isArray(i)?i:[]).map(n=>({connectionId:typeof n.connectionId=="string"?n.connectionId:"",nodeId:typeof n.nodeId=="string"?n.nodeId:null,deviceId:typeof n.deviceId=="string"?n.deviceId:null,deviceIdHint:typeof n.deviceIdHint=="string"?n.deviceIdHint:null,endpointId:typeof n.endpointId=="string"?n.endpointId:null,transportGeneration:typeof n.transportGeneration=="number"?n.transportGeneration:0,routeGeneration:typeof n.routeGeneration=="number"?n.routeGeneration:void 0,transportStableId:typeof n.transportStableId=="number"?n.transportStableId:null,transportSource:typeof n.transportSource=="string"?n.transportSource:null,lastTransportChangeAtMs:typeof n.lastTransportChangeAtMs=="number"?n.lastTransportChangeAtMs:0,lastRouteChangeAtMs:typeof n.lastRouteChangeAtMs=="number"?n.lastRouteChangeAtMs:void 0,state:typeof n.state=="string"?n.state:"pending",statusReason:typeof n.statusReason=="string"?n.statusReason:null,createdAtMs:typeof n.createdAtMs=="number"?n.createdAtMs:0,updatedAtMs:typeof n.updatedAtMs=="number"?n.updatedAtMs:0}))}return this.warnMissingWasmOnce("resolvePeerRecords"),[]}async resolvePeerIdentity(e){let t=await this.waitForWasmClient(500);if(t){let i=n=>{if(!n||typeof n!="object")return {peerId:null,deviceId:null,deviceIdHint:null,nodeId:null};let o=n;return {peerId:typeof o.peerId=="string"?o.peerId:null,deviceId:typeof o.deviceId=="string"?o.deviceId:null,deviceIdHint:typeof o.deviceIdHint=="string"?o.deviceIdHint:null,nodeId:typeof o.nodeId=="string"?o.nodeId:null}};if(typeof t.peer_session=="function")try{let n=await t.peer_session(e),o=i(n);if(o.peerId||o.deviceId||o.deviceIdHint||o.nodeId)return o}catch{}if(typeof t.peer_snapshot=="function")try{return i(await t.peer_snapshot(e))}catch{}}return this.warnMissingWasmOnce("resolvePeerIdentity"),{peerId:null,deviceId:null,deviceIdHint:null,nodeId:null}}onDevicesChange(e,t){return this.isTicketOnlyMode()?(e([]),()=>{}):this.getCoordinationSignaling().onDevicesChange(e,t)}onRoomArchitectureChange(e){return this.getCoordinationSignaling().onRoomArchitectureChange?.(t=>{let i=this.effectiveRoomArchitecture!==t.effective;this.effectiveRoomArchitecture=t.effective,i&&this.presenceManager.handleRoomArchitectureChange().catch(n=>{console.warn("[WasmSignaling] failed to replay desired peers after room architecture change",{effectiveArchitecture:t.effective,epoch:t.epoch,error:n});}),e(t);})??(()=>{})}onRoomAuthorityAssignmentChange(e){return this.getCoordinationSignaling().onRoomAuthorityAssignmentChange?.(e)??(()=>{})}async publishAuthorityAssignment(e){let t=this.getCoordinationSignaling();if(!t.publishAuthorityAssignment)throw new Error("[OpenRTC] Authority assignment publication is unavailable.");await t.publishAuthorityAssignment(e);}async publishManagedRoomMessage(e){let t=this.getCoordinationSignaling().publishManagedRoomMessage;if(!t)throw new Error("[OpenRTC] Managed room fanout is unavailable.");await t.call(this.getCoordinationSignaling(),e);}onManagedRoomMessage(e){return this.getCoordinationSignaling().onManagedRoomMessage?.(e)??(()=>{})}async subscribeDevices(e){return this.isTicketOnlyMode()?new ReadableStream({start(t){t.close();}}):this.getCoordinationSignaling().subscribeDevices()}async startAutoConnect(e,t){if(this.isTicketOnlyMode())return;this.startApplicationRouteEscalationSubscription();let i=this.authScopedRuntimeGeneration;try{let n=await this.waitForWasmClient();if(i!==this.authScopedRuntimeGeneration||!n||typeof n.start_auto_connect!="function")return;await this.presenceManager.installInitialAutoConnectExclusions(n),await n.start_auto_connect(e,t),i===this.authScopedRuntimeGeneration&&this.presenceManager.startAutoConnect(e,t);}catch(n){console.warn("[WasmBridge] failed to initialize WASM auto-connect context",{userId:e,localDeviceId:t,error:n});}}async startAutoConnectOnce(e,t){await this.startAutoConnect(e,t),this.forceReconnect();}notifyDisconnectRequested(e){this.presenceManager.wakeRustAutoConnectOwner();}async excludeAutoConnect(e,t){await this.presenceManager.excludeAutoConnect(e,t);}async disconnectDevice(e){let t=await this.waitForWasmClient();if(!t||typeof t.disconnect_device!="function"){this.warnMissingWasmOnce("disconnectDevice"),await this.presenceManager.excludeAutoConnect(e,true).catch(()=>{});return}try{await t.disconnect_device(e,null),await this.presenceManager.recordAutoConnectExcludedForPresence(e,!0).catch(()=>{});}catch(i){throw console.warn("[WasmBridge] disconnect_device failed",{deviceId:e,error:i?.message??String(i)}),i}}async submitDesiredPeerProjection(e,t){return this.presenceManager.submitDesiredPeerProjection(e,t)}observeManagedDesiredPeers(e){this.presenceManager.observeDesiredPeerProjection(e),e$1("[OpenRTC][route-escalation] observed managed desired peers",{peerCount:e.length,peersWithTickets:e.filter(t=>typeof t.ticket=="string"&&t.ticket.trim()).length,deviceIds:e.map(t=>t.deviceId)});}setCoreClient(e){e&&typeof e.ensureManagedApplicationRoute=="function"?(this.coreClient=e,e$1("[OpenRTC][route-escalation] attached shared core client"),this.startApplicationRouteEscalationSubscription(),this.retryManagedApplicationRouteEscalations()):(this.coreClient=null,e$1("[OpenRTC][route-escalation] detached shared core client"),this.stopApplicationRouteEscalationSubscription());}startApplicationRouteEscalationSubscription(){if(this.applicationRouteEscalationUnsubscribe&&this.routeSubscriptionGeneration===this.authScopedRuntimeGeneration)return;this.stopApplicationRouteEscalationSubscription();let e=this.authScopedRuntimeGeneration,t=this.applicationRouteEscalationSubscriptionEpoch,i=this.onStateChange(n=>{let o=this.stabilizeConnectionState(n);this.lastDeliveredConnectionStates.set(o.connectionId,o),e$1("[OpenRTC][route-escalation] observed Rust connection state",{connectionId:o.connectionId,deviceId:o.deviceId??o.deviceIdHint??null,remoteNodeId:o.remoteNodeId??null,state:o.state,transportGeneration:o.transportGeneration??null,routeGeneration:o.routeGeneration??null}),this.escalateManagedApplicationRoute(o);});this.applicationRouteEscalationUnsubscribe=()=>{},this.routeSubscriptionGeneration=e,Promise.resolve(i).then(n=>{if(!this.coreClient||e!==this.authScopedRuntimeGeneration||t!==this.applicationRouteEscalationSubscriptionEpoch){n();return}this.applicationRouteEscalationUnsubscribe=n,this.routeSubscriptionGeneration=e;});}stopApplicationRouteEscalationSubscription(){this.applicationRouteEscalationSubscriptionEpoch+=1,this.applicationRouteEscalationUnsubscribe?.(),this.applicationRouteEscalationUnsubscribe=null,this.routeSubscriptionGeneration=-1;}retryManagedApplicationRouteEscalations(){for(let e of this.lastDeliveredConnectionStates.values())this.escalateManagedApplicationRoute(e);}escalateManagedApplicationRoute(e){if(!this.coreClient||!["connected","connecting"].includes(e.state))return;let t=[e.transportGeneration??0,e.routeGeneration??0].join(":"),i=this.applicationRouteEscalationAttemptKeys??(this.applicationRouteEscalationAttemptKeys=new Map);if(i.get(e.connectionId)===t||this.applicationRouteEscalations.has(e.connectionId))return;let n=this.presenceManager.resolveDesiredPeer(e.deviceId??e.deviceIdHint,e.remoteNodeId);if(!n?.ticket){e$1("[OpenRTC][route-escalation] awaiting matching desired-peer ticket",{connectionId:e.connectionId,deviceId:e.deviceId??e.deviceIdHint??null,remoteNodeId:e.remoteNodeId??null});return}let o=this.authScopedRuntimeGeneration,r=this.coreClient;i.set(e.connectionId,t),e$1("[OpenRTC][route-escalation] adopting Rust-managed generation",{connectionId:e.connectionId,deviceId:n.deviceId,remoteNodeId:e.remoteNodeId??n.nodeId??null,transportGeneration:e.transportGeneration??null,routeGeneration:e.routeGeneration??null});let s;s=(async()=>{let c=await r.ensureManagedApplicationRoute({ticket:n.ticket,connectionId:e.connectionId,remoteNodeId:e.remoteNodeId??n.nodeId,expectedDeviceId:n.deviceId,timeoutMs:2e4});if(o!==this.authScopedRuntimeGeneration)return;let a=c,d=a.id?.trim()||e.connectionId,h=a.remoteNodeId?.trim()||e.remoteNodeId?.trim()||a.deviceId?.trim()||n.deviceId;if(r.hasApplicationRouteForPeer?.(d,h)!==true&&r.hasApplicationRouteForPeer?.(d,h)!==true)throw new Error(`application crypto was not ready for ${h}`)})().catch(c=>{o===this.authScopedRuntimeGeneration&&console.warn("[OpenRTC][route-escalation] Rust-managed route remains pending",{connectionId:e.connectionId,deviceId:n.deviceId,remoteNodeId:e.remoteNodeId??n.nodeId,error:c?.message??String(c)});}).finally(()=>{if(this.applicationRouteEscalations.get(e.connectionId)===s){this.applicationRouteEscalations.delete(e.connectionId);let c=this.lastDeliveredConnectionStates?.get(e.connectionId),a=c?[c.transportGeneration??0,c.routeGeneration??0].join(":"):null;c&&a!==t&&o===this.authScopedRuntimeGeneration&&queueMicrotask(()=>this.escalateManagedApplicationRoute(c));}}),this.applicationRouteEscalations.set(e.connectionId,s);}async connectToDevice(e){let t=await this.waitForWasmClient();if(!t||typeof t.connect_device!="function")throw this.warnMissingWasmOnce("connectToDevice"),new Error("WASM runtime does not support connect_device()");let i=e.endpointTicket?.trim()??"",n=e.admissionToken?.trim()??"",o=e.admissionScope?.trim()??"",r=!i,s=i;if(r&&(!e.deviceId||!n||!o||typeof t.connect_known_device_with_token!="function"))throw new Error("WASM connectToDevice requires an endpoint ticket or supported known-device admission intent.");let c=Date.now();e$1("[WasmBridge][ROUTE-ESCALATION] starting managed transport dial",{deviceId:e.deviceId??null,ticket:se(i),knownDeviceAdmission:r,hasCoreClient:!!this.coreClient});let a=r?await(async()=>{let h=Date.now(),l=Math.max(1,e.timeoutMs??3e4),m=()=>Math.max(1,l-(Date.now()-h)),y=e.admissionPeerUserId?.trim()??"";if(y){let v=(await this.getCoordinationSignaling().waitForFriendDevice(y,e.deviceId,Math.min(1e4,m()))).ticket?.trim()??"";if(!v)throw new Error(`[pluto-rtc] authorized device ${e.deviceId} did not publish an endpoint ticket.`);if(typeof t.observe_known_device_endpoint!="function")throw new Error("WASM runtime does not support provider-authorized endpoint observations.");await t.observe_known_device_endpoint(e.deviceId,v),s=a$3(v).irohTicket;}return t.connect_known_device_with_token(e.deviceId,n,o,e.admissionMaxConnections??0,e.admissionExpiresAtMs==null?null:BigInt(Math.floor(e.admissionExpiresAtMs)),Math.min(1e4,m()))})():await t.connect_device(e.deviceId??null,i);e$1("[WasmBridge][ROUTE-ESCALATION] managed transport dial completed",{deviceId:e.deviceId??null,remoteNodeId:a?.remoteNodeId??null,connectionId:a?.connectionId??null,elapsedMs:Date.now()-c});let d=s;if(d&&this.coreClient){let h=this.coreClient;try{e$1("[WasmBridge][ROUTE-ESCALATION] starting typed application connection",{deviceId:e.deviceId??null,remoteNodeId:a?.remoteNodeId??null,connectionId:a?.connectionId??null});let l=await h.ensureManagedApplicationRoute({ticket:d,connectionId:a?.connectionId??null,remoteNodeId:a?.remoteNodeId??null,expectedDeviceId:e.deviceId??null,approvedScope:a?.approvedScope??null,timeoutMs:2e4}),m=typeof l?.remoteNodeId=="string"?l.remoteNodeId.trim():"",y=typeof l?.deviceId=="string"?l.deviceId.trim():"",g=m||a?.remoteNodeId?.trim?.()||y||e.deviceId?.trim?.()||"",v=typeof h.hasApplicationRouteForPeer=="function"?h.hasApplicationRouteForPeer.bind(h):null;if(!(!!g&&v?.(l?.id??void 0,g)===!0)&&g&&typeof h.waitForApplicationCryptoForPeer=="function"&&!(!!await h.waitForApplicationCryptoForPeer(g,2e4)&&(!v||v(l?.id??void 0,g)===!0)))throw console.warn("[WasmBridge][ROUTE-ESCALATION] application route still pending after managed dial",{deviceId:e.deviceId??null,remoteNodeId:m||(a?.remoteNodeId??null),connectionId:a?.connectionId??null,peerForCrypto:g,elapsedMs:Date.now()-c}),Object.assign(new Error(`application crypto was not ready for ${g}`),{applicationCryptoNotReady:!0});e$1("[WasmBridge][ROUTE-ESCALATION] application route ready",{deviceId:e.deviceId??null,remoteNodeId:m||(a?.remoteNodeId??null),connectionId:a?.connectionId??null,elapsedMs:Date.now()-c});}catch(l){if(l?.applicationCryptoNotReady)throw l;return console.warn("[WasmBridge] Managed transport connected; TS application route escalation is still pending",{deviceId:e.deviceId??null,remoteNodeId:a?.remoteNodeId??null,connectionId:a?.connectionId??null,error:l?.message??String(l)}),a}}return a}forceReconnect(){this.isTicketOnlyMode()||!this.app||!this.auth||this.presenceManager.wakeRustAutoConnectOwner();}startPresenceLoop(e,t,i,n,o){return this.presenceManager.startPresenceLoop(e,t,i,n,o)}ensureSpaceNamespaceIdPromise(){if(this.cachedSpaceNamespaceId)return Promise.resolve(this.cachedSpaceNamespaceId);if(!this.spaceNamespaceIdPromise){let e=this.options.apiKey?.trim()??"",t=this.options.spaceKey?.trim()??"";if(!e||!t)return Promise.resolve(null);this.spaceNamespaceIdPromise=b$1(e,t).then(i=>(this.cachedSpaceNamespaceId=i,i)).catch(()=>null);}return this.spaceNamespaceIdPromise}async createSession(e){if(this.isTicketOnlyMode())throw new Error('[openrtc] createSession() is unavailable when signalingMode="ticket-only".');let t=this.getCurrentUserId();if(!t&&!e.initiator&&!e.target&&!this.isSpaceMode())throw new Error("createSession requires user scope");let i={...e,appTag:e.appTag??this.appTag,initiator:e.initiator??t??void 0,target:e.target??t??void 0};await this.getCoordinationSignaling().createSession(i);}async updateSession(e,t){if(this.isTicketOnlyMode())throw new Error('[openrtc] updateSession() is unavailable when signalingMode="ticket-only".');await this.getCoordinationSignaling().updateSession(e,t);}async subscribeSessions(e){return this.isTicketOnlyMode()?new ReadableStream({start(t){t.close();}}):this.getCoordinationSignaling().subscribeSessions(e)}async getLocalDeviceId(){return this.resolveWebLogicalDeviceId()}async isConnected(e){let t=await this.waitForWasmClient();return t&&typeof t.is_connected=="function"?t.is_connected(e):false}async getConnectionStates(){let e=await this.waitForWasmClient(500);if(e&&typeof e.connection_states=="function"){let n=await e.connection_states(),o=(Array.isArray(n)?n:[]).map(r=>this.normalizeStateSnapshot(r)).filter(r=>!!r);return o.length>0&&d$1("[WasmBridge] replaying current wasm connection states",o.map(r=>({connectionId:r.connectionId,deviceId:r.deviceId??null,deviceIdHint:r.deviceIdHint??null,remoteNodeId:r.remoteNodeId??null,state:r.state,transportState:r.transportState??null,protocolState:r.protocolState??null,routable:r.routable??null}))),o}let i=(await this.listPeerSessions().catch(()=>[])).map(n=>this.toBackendConnectionStateFromPeerSession(n)).filter(n=>!!n);return i.length>0&&d$1("[WasmBridge] replaying current wasm connection states",i.map(n=>({connectionId:n.connectionId,deviceId:n.deviceId??null,deviceIdHint:n.deviceIdHint??null,remoteNodeId:n.remoteNodeId??null,state:n.state,transportState:n.transportState??null,protocolState:n.protocolState??null,routable:n.routable??null}))),i}onStateChange(e){let t=new Map,i=new Map,n=this.authScopedRuntimeGeneration,o=false,r=a=>{let d=a.detail,h=this.normalizeStateSnapshot(d),l=typeof d?.connectionId=="string"?d.connectionId.trim():"";if(!l||o)return;if(h&&(h.state==="closed"||h.state==="failed"||h.state==="disconnected")){this.deliverConnectionState(h,e,"rust-event-detail",t);return}let m=(i.get(l)??0)+1;i.set(l,m);let y=this.authScopedRuntimeGeneration;(async()=>{let g=await this.waitForWasmClient(500);if(!(o||y!==this.authScopedRuntimeGeneration||i.get(l)!==m)){if(g&&typeof g.connection_state=="function"){let v=await g.connection_state(l),w=this.normalizeStateSnapshot(v);if(!o&&y===this.authScopedRuntimeGeneration&&i.get(l)===m&&w){this.deliverConnectionState(w,e,"rust-event",t);return}}!o&&y===this.authScopedRuntimeGeneration&&i.get(l)===m&&h&&this.deliverConnectionState(h,e,"rust-event-detail",t);}})().catch(g=>{o||console.warn("[WasmBridge] Failed to read Rust connection state after lifecycle event",{connectionId:l,error:g});});},s=typeof window<"u"?window:null,c=typeof s?.addEventListener=="function"&&typeof s?.removeEventListener=="function";return c&&s.addEventListener("connection-state-changed",r),this.getConnectionStates().then(a=>{!o&&n===this.authScopedRuntimeGeneration&&a.forEach(d=>{i.has(d.connectionId)||this.deliverConnectionState(d,e,"replay",t);});}).catch(a=>{console.warn("[WasmBridge] Failed to replay wasm connection states after subscription:",a);}),()=>{o=true,i.clear(),c&&s.removeEventListener("connection-state-changed",r);}}async sendExplicitFilePath(e,t,i=""){throw new Error("sendExplicitFilePath is native-only. Use sendExplicitFileData in web/wasm runtime.")}sanitizeExplicitFileName(e){let i=(typeof e=="string"?e.replace(/\\/g,"/"):"").split("/").reverse().find(r=>r.trim().length>0)?.trim()??"";if(!i||i==="."||i==="..")return p.FALLBACK_EXPLICIT_FILE_NAME;let n="";for(let r of i){if([...n].length>=p.MAX_EXPLICIT_FILE_NAME_CHARS)break;let s=r.charCodeAt(0);r==="/"||r==="\\"||r==="\0"||s<32||s===127?n+="_":n+=r;}let o=n.trim();return !o||o==="."||o===".."?p.FALLBACK_EXPLICIT_FILE_NAME:o}sanitizeExplicitMimeType(e){let t=typeof e=="string"?e.trim():"";if(!t)return p.FALLBACK_EXPLICIT_MIME_TYPE;let i="";for(let n of t){if(i.length>=p.MAX_EXPLICIT_MIME_TYPE_CHARS)break;let o=n.charCodeAt(0);o<33||o>126||n==='"'||n==="\\"?i+="_":i+=n;}return i.length>0?i:p.FALLBACK_EXPLICIT_MIME_TYPE}assertExplicitTransferHeaderSize(e){if(e.byteLength===0||e.byteLength>p.MAX_EXPLICIT_TRANSFER_HEADER_BYTES)throw new Error(`Explicit transfer header is too large: ${e.byteLength} bytes`)}createWebRTCExplicitTransferId(){let e=new Uint8Array(16),t=globalThis.crypto;if(t&&typeof t.getRandomValues=="function")return t.getRandomValues(e),e;for(let i=0;i<e.byteLength;i+=1)e[i]=Math.floor(Math.random()*256);return e}createWebRTCExplicitTransferFrame(e,t,i,n,o){let r=o?.headerFrame===true?4:0,s=new Uint8Array(25+r+n.byteLength);s[0]=p.EXPLICIT_FILE_PROTOCOL_TYPE,s.set(e,1);let c=new DataView(s.buffer);c.setUint32(17,t,false),c.setUint32(21,i,false);let a=o?.headerFrame===true?29:25;return o?.headerFrame===true&&c.setUint32(25,n.byteLength,false),s.set(n,a),s}async sendExplicitFileData(e){let t=e.connection,i=e.file,n=e.applicationCrypto??this.options.applicationCrypto;if((e.requireApplicationCrypto===true||t?.requireApplicationCrypto===true)&&!n)throw new Error("[WasmBridge] Explicit transfer requires application crypto but none is available for this connection");let r=e.transferId&&e.transferId.trim().length>0?e.transferId:`transfer-${Date.now()}`;typeof e.receiverPlatformType=="string"?e.receiverPlatformType.trim().toLowerCase():null;let c=e.remoteNodeId?.trim()||t?.remoteNodeId?.trim()||t?.deviceId?.trim();if(e$1("[WasmBridge] sendExplicitFileData start",{connectionId:e.connectionId??null,connectionRemoteNodeId:t?.remoteNodeId??null,remoteNodeId:c??null,fileName:i.name,fileSize:i.size,transferId:r}),!c)throw new Error("Web explicit transfer requires an active connection with a resolved remote node ID");let a=await this.waitForWasmClient();if(!a)throw new Error("WASM explicit transfer requires an initialized WASM client");let d=new TextEncoder,h={transfer_id:r,filename:this.sanitizeExplicitFileName(i.name),size:i.size,mime_type:this.sanitizeExplicitMimeType(i.type)},l=d.encode(JSON.stringify(h));this.assertExplicitTransferHeaderSize(l);let m=new Uint8Array(4);new DataView(m.buffer).setUint32(0,l.byteLength,false);let y=new Uint8Array(m.byteLength+l.byteLength);y.set(m,0),y.set(l,m.byteLength);let g=async()=>{let v=a.open_peer_bi_explicit_file_sender;if(typeof v!="function")return false;let w=await v.call(a,c,5e3),S=w?.writable??w?.send;if(!S||typeof S.getWriter!="function")throw new Error("WASM explicit peer stream returned an invalid writable stream");e$1("[WasmBridge] sendExplicitFileData open_peer_bi_explicit_file_sender resolved",{remoteNodeId:c,transferId:e.transferId??null,applicationCryptoWrapped:w.applicationCryptoWrapped===true});let C=E(w,S,{requireFinish:true}).getWriter(),T=false;try{await C.write(y);let P=new Uint8Array(await i.arrayBuffer());for(let b=0;b<P.byteLength;b+=p.EXPLICIT_FILE_CHUNK_SIZE_BYTES){let ie=P.slice(b,Math.min(b+p.EXPLICIT_FILE_CHUNK_SIZE_BYTES,P.byteLength));await C.write(ie);}}catch(P){throw T=true,P}finally{try{await C.close();}catch(P){if(!T)throw P}finally{C.releaseLock();}}return true};try{if(await g())return;throw new Error("[WasmBridge] Explicit transfer requires the generation-fenced open_peer_bi_explicit_file_sender path, but it is unavailable on this WASM build. Rebuild the current OpenRTC WASM; raw open_bi fallback is intentionally unsupported for application data.")}finally{e$1("[WasmBridge] sendExplicitFileData completed",{remoteNodeId:c,transferId:r,fileName:i.name,fileSize:i.size});}}async getTransferHistory(e=50){return []}async deleteTransferJob(e){}watchFriendDevices(e,t){return this.isTicketOnlyMode()?()=>{}:this.getCoordinationSignaling().watchFriendDevices(e,t)}async updateFriendTicket(e){this.isTicketOnlyMode()||await this.getCoordinationSignaling().updateFriendTicket(e);}};p.EXPLICIT_FILE_PROTOCOL_TYPE=2,p.EXPLICIT_FILE_CHUNK_SIZE_BYTES=64*1024,p.MAX_EXPLICIT_TRANSFER_HEADER_BYTES=64*1024,p.FALLBACK_EXPLICIT_FILE_NAME="openrtc-transfer.bin",p.MAX_EXPLICIT_FILE_NAME_CHARS=180,p.FALLBACK_EXPLICIT_MIME_TYPE="application/octet-stream",p.MAX_EXPLICIT_MIME_TYPE_CHARS=255,p.WEB_DEVICE_ID_STORAGE_PREFIX="pluto_rtc_web_device_identity",p.EPHEMERAL_DEVICE_ID_TTL_MS=o.browserIdentity.ephemeralDeviceIdTtlMs;var te=p;export{oe as a,te as b};
1
+ import {a as a$1}from'./chunk-AYHD4X2R.js';import {o,b,a,t,m,g,x,y,h,z,B,C,F,G,H,d as d$1,e as e$1}from'./chunk-25CN4MLA.js';import {c,e,d,f,b as b$1}from'./chunk-XMYBBLYK.js';import {a as a$2}from'./chunk-OT7IPLZE.js';import {a as a$3}from'./chunk-CNAW5BZ3.js';import {c as c$1}from'./chunk-CCCYE3XN.js';import {a as a$4}from'./chunk-JPBW67B3.js';function M(u){if(!u)return null;let e=2166136261;for(let t=0;t<u.length;t+=1)e^=u.charCodeAt(t),e=Math.imul(e,16777619);return `fp-${(e>>>0).toString(16).padStart(8,"0")}`}var _=class _{constructor(e){this.deps=e;this.startedAutoConnectKey=null;this.browserAutoConnectUnsubscribe=null;this.desiredPeerRevision=0;this.desiredPeerSignature=null;this.desiredPeerSubmission=null;this.desiredPeerSubmissionQueue=Promise.resolve();this.queuedDesiredPeers=null;this.desiredPeersByDeviceId=new Map;this.wakeSubmission=null;this.presenceState=null;this.presenceStartGeneration=0;this.localExcludedPeers=new Set;this.localDesiredPeerDeviceId=null;for(let t of e.initialExcludedPeers??[]){let i=t.trim().toLowerCase();i&&this.localExcludedPeers.add(i);}}stop(){this.stopAutoConnect(),this.stopPresenceLoop();}get autoConnectKey(){return this.startedAutoConnectKey}set autoConnectKey(e){this.startedAutoConnectKey=e;}get presenceLoopState(){return this.presenceState}set presenceLoopState(e){this.presenceState=e;}stopPresence(){this.stopPresenceLoop();}updatePresenceLoopState(e){this.presenceState=e;}startAutoConnect(e,t){if(this.deps.isTicketOnlyMode())return;let i=t.trim()||this.deps.resolveWebLogicalDeviceId(),n=`${e}::${i}`;this.startedAutoConnectKey===n&&this.browserAutoConnectUnsubscribe||(this.stopAutoConnect(),this.localDesiredPeerDeviceId=i,this.startedAutoConnectKey=n,this.browserAutoConnectUnsubscribe=this.deps.getCoordinationSignaling().onDevicesChange(o=>this.submitDesiredPeers(o),this.currentLocalNodeId()??void 0));}wakeRustAutoConnectOwner(){return this.deps.isTicketOnlyMode()||!this.startedAutoConnectKey||this.wakeSubmission?false:(this.wakeSubmission=this.deps.waitForWasmClient(500).then(async e=>{e&&typeof e.wake_browser_auto_connect=="function"&&await e.wake_browser_auto_connect();}).finally(()=>{this.wakeSubmission=null;}),true)}submitDesiredPeers(e){if(!this.startedAutoConnectKey)return;let i=this.normalizeDesiredPeers(e);this.rememberDesiredPeers(i)&&(this.queuedDesiredPeers=i,this.flushDesiredPeerSubmission());}observeDesiredPeerProjection(e){this.rememberDesiredPeers(this.normalizeDesiredPeers(e));}async submitDesiredPeerProjection(e,t){if(!Number.isSafeInteger(e)||e<=0)throw new Error("Desired-peer projection revision must be a positive safe integer.");let i=this.startedAutoConnectKey;if(!i)throw new Error("Cannot submit a desired-peer projection before managed auto-connect starts.");let n=this.normalizeDesiredPeers(t);this.rememberDesiredPeers(n),this.queuedDesiredPeers=null,this.desiredPeerRevision=Math.max(this.desiredPeerRevision,e),await this.enqueueDesiredPeerSubmission(i,e,n);}async handleRoomArchitectureChange(){let e=this.startedAutoConnectKey;if(this.deps.isTicketOnlyMode()||!e)return false;let t=Array.from(this.desiredPeersByDeviceId.values());this.queuedDesiredPeers=null;let i=++this.desiredPeerRevision;return await this.enqueueDesiredPeerSubmission(e,i,t),true}rememberDesiredPeers(e){this.desiredPeersByDeviceId=new Map(e.map(i=>[i.deviceId,i]));let t=JSON.stringify(e);return t===this.desiredPeerSignature?false:(this.desiredPeerSignature=t,this.deps.onDesiredPeersChanged?.(),true)}resolveDesiredPeer(e,t){let i=typeof e=="string"?e.trim():"",n=typeof t=="string"?t.trim():"";if(i){let o=this.desiredPeersByDeviceId.get(i);if(o&&(!n||!o.nodeId||o.nodeId===n))return o}return n?Array.from(this.desiredPeersByDeviceId.values()).find(o=>o.nodeId===n)??null:null}flushDesiredPeerSubmission(){if(this.desiredPeerSubmission||!this.queuedDesiredPeers||!this.startedAutoConnectKey)return;let e=this.startedAutoConnectKey,t=this.queuedDesiredPeers,i=++this.desiredPeerRevision;this.queuedDesiredPeers=null,this.desiredPeerSubmission=this.enqueueDesiredPeerSubmission(e,i,t).catch(()=>{}).finally(()=>{this.desiredPeerSubmission=null,this.flushDesiredPeerSubmission();});}normalizeDesiredPeers(e){return (Array.isArray(e)?e:[]).map(t=>({deviceId:String(t?.deviceId??"").trim(),nodeId:typeof t?.nodeId=="string"&&t.nodeId.trim()||null,ticket:typeof t?.ticket=="string"&&t.ticket.trim()||null,online:t?.online===true,sessionId:typeof t?.sessionId=="string"&&t.sessionId.trim()||null,excludedPeers:Array.isArray(t?.excludedPeers)?[...new Set(t.excludedPeers.map(i=>String(i??"").trim().toLowerCase()).filter(Boolean))].sort():[],devicePublicKeyJwk:t?.devicePublicKeyJwk,topologyRole:t?.topologyRole,topologyRevision:t?.topologyRevision})).filter(t=>t.deviceId.length>0).sort((t,i)=>t.deviceId.localeCompare(i.deviceId))}enqueueDesiredPeerSubmission(e,t,i,n=this.roomGossipFanoutEnabled()){let o=this.desiredPeerSubmissionQueue.then(async()=>{if(this.startedAutoConnectKey!==e)return;let r=await this.deps.waitForWasmClient();if(this.startedAutoConnectKey===e){if(!r||typeof r.submit_browser_desired_peers!="function"){this.deps.warnMissingWasmOnce("submitBrowserDesiredPeers");return}if(await Promise.all(i.map(async s=>{if(s.ticket)try{await this.deps.rememberRouteRepairTokenFromTicket(s.ticket);}catch(c){console.warn("[WasmSignaling] failed to retain desired-peer admission token",{deviceId:s.deviceId,nodeId:s.nodeId,error:c});}})),n){if(typeof r.submit_browser_desired_peers_with_sparse_fanout!="function"){await r.submit_browser_desired_peers(t,JSON.stringify([])),this.deps.warnMissingWasmOnce("submitBrowserDesiredPeersWithSparseFanout");return}if(!this.deps.capabilityKey)throw new Error("Sparse fanout requires an explicit capability avenue.");await r.submit_browser_desired_peers_with_sparse_fanout(t,JSON.stringify(i),this.deps.capabilityKey,this.localDesiredPeerDeviceId,this.deps.localDeviceKeyX,true);}else await r.submit_browser_desired_peers(t,JSON.stringify(i));}});return this.desiredPeerSubmissionQueue=o.catch(r=>{console.warn("[WasmSignaling] failed to submit browser desired peers to Rust",{revision:t,error:r});}),o}roomGossipFanoutEnabled(){return typeof this.deps.roomGossipFanout=="function"?this.deps.roomGossipFanout():this.deps.roomGossipFanout===true}async excludeAutoConnect(e,t){let i=await this.deps.waitForWasmClient();i&&typeof i.set_auto_connect_excluded=="function"&&await i.set_auto_connect_excluded(e,t),await this.recordAutoConnectExcludedForPresence(e,t);}async installInitialAutoConnectExclusions(e){if(typeof e?.set_auto_connect_excluded=="function")for(let t of this.currentExcludedPeersSnapshot())await e.set_auto_connect_excluded(t,true);}async recordAutoConnectExcludedForPresence(e,t){let i=e.trim().toLowerCase();if(!i)return;t?this.localExcludedPeers.add(i):this.localExcludedPeers.delete(i);let n=this.deps.resolveWebLogicalDeviceId();n&&await this.deps.updateExcludedPeers(n,this.currentExcludedPeersSnapshot());}async startPresenceLoop(e,t,i,n,o){if(this.deps.isTicketOnlyMode())return;this.stopPresenceLoop();let r=this.presenceStartGeneration;this.presenceState={userId:e,localNodeId:t,ticket:n,metadata:o,deviceName:i};let s=this.deps.resolveWebLogicalDeviceId(),c=await this.deps.withWebPresenceMetadata(o,s);r!==this.presenceStartGeneration||this.presenceState===null||await this.deps.updatePresence(t,n,true,_.PRESENCE_LEASE_MS,c,i);}stopAutoConnect(){this.browserAutoConnectUnsubscribe?.(),this.browserAutoConnectUnsubscribe=null,this.startedAutoConnectKey=null,this.localDesiredPeerDeviceId=null,this.desiredPeerSignature=null,this.queuedDesiredPeers=null,this.desiredPeersByDeviceId.clear(),this.wakeSubmission=null;}currentExcludedPeersSnapshot(){return Array.from(this.localExcludedPeers).sort()}currentLocalNodeId(){let e=this.presenceState?.localNodeId;return typeof e=="string"&&e.trim()||null}stopPresenceLoop(){this.presenceStartGeneration+=1,this.presenceState=null;}};_.PRESENCE_LEASE_MS=15*6e4;var R=_;function ne(){if(!(typeof window>"u"))try{if(new URL(import.meta.url).pathname.includes("/node_modules/.vite/deps/"))return new URL("/node_modules/openrtc/dist/openrtc_bg.wasm",window.location.origin)}catch{}}async function oe(){let u=await import('./openrtc-UBIKDAZ5.js');return {initWasm:e=>u.default(e??ne()),WasmClient:u.WasmClient,start:u.start}}function re(u){try{let e=u.replace(/-/g,"+").replace(/_/g,"/"),t=(4-e.length%4)%4,i=e+"=".repeat(t);if(typeof atob=="function")return JSON.parse(atob(i));let n=globalThis.Buffer;if(n)return JSON.parse(n.from(i,"base64").toString("utf8"))}catch{return null}return null}function se(u){let e=typeof u=="string"?u.trim():"";if(!e)return {present:false};let t=e.lastIndexOf("."),i=t>=0?e.slice(0,t):e,n=t>=0?e.slice(t+1):null,o=n?re(n):null,r=o&&typeof o.t=="string"&&o.t.trim().length>0?o.t.trim():null,s=o&&typeof o.s=="string"&&o.s.trim().length>0?o.s.trim():null,c=o&&typeof o.m=="number"&&Number.isFinite(o.m)?o.m:null;return {present:true,irohFingerprint:M(i),tokenFingerprint:M(r),tokenSuffixFingerprint:M(n),scope:s,maxConnections:c}}function E(u,e,t={}){let i=typeof u.finishSend=="function"?u.finishSend.bind(u):typeof u.finish_send=="function"?u.finish_send.bind(u):null,n=typeof u.cancelSend=="function"?u.cancelSend.bind(u):typeof u.cancel_send=="function"?u.cancel_send.bind(u):null;if(!i){if(t.requireFinish===true)throw new Error("WASM peer stream is missing finishSend(); rebuild the current OpenRTC WASM before sending application data");return e}let o=e.getWriter(),r=new WritableStream({write:s=>o.write(s),async close(){await o.close(),await i();},async abort(s){await n?.(),await o.abort(s);}});return a$4(r,n)}var p=class p{constructor(e$1){this.spaceNamespaceIdPromise=null;this.cachedSpaceNamespaceId=null;this.authListeners=[];this.wasmClient=null;this.createdAtMs=Date.now();this.missingWasmWarnings=new Set;this.wasmReadyWarningDelayMs=15e3;this.browserCoordinationSignaling=null;this.effectiveRoomArchitecture="mesh";this.lastObservedFirebaseUserId=null;this.sessionReaders=new Set;this.authContext=null;this.injectedBrowserAuthSessionActive=false;this.hasSyncedAuthToWasmClient=false;this.lastWasmAuthUserId=null;this.lastWasmAuthToken=null;this.lastDeliveredConnectionStates=new Map;this.authScopedRuntimeGeneration=0;this.coreClient=null;this.applicationRouteEscalations=new Map;this.applicationRouteEscalationAttemptKeys=new Map;this.applicationRouteEscalationUnsubscribe=null;this.routeSubscriptionGeneration=-1;this.applicationRouteEscalationSubscriptionEpoch=0;this.appTag=c(e$1),this.options={...e$1,appTag:this.appTag,authMode:d(e$1),projectId:e(e$1)},this.effectiveRoomArchitecture=e$1.coordinationRoomArchitecture==="sparse"||e$1.coordinationRoomGossipFanout===true?"sparse":"mesh",this.coordinationHost=new b({appTag:this.appTag,projectId:this.options.projectId,discoveryMode:this.options.discoveryMode,signalingMode:this.options.signalingMode,gateway:this.options.coordinationGateway,avenueOverride:this.options.coordinationAvenueOverride,roomArchitecture:this.options.coordinationRoomArchitecture,initialExcludedPeers:this.options.initialAutoConnectExcludedDeviceIds,resolveSpaceNamespaceId:()=>this.ensureSpaceNamespaceIdPromise(),getCurrentUserId:()=>this.getCurrentUserId(),getAuthToken:async(r=false)=>this.currentUser?.getToken?.(r)??null,getAppCheckToken:async(r=false)=>{let s=this.authContext?.appCheckTokenProvider??this.options.attestationTokenProvider;return s?s(r):a().getAppCheckToken(r)},getLocalDeviceId:()=>this.resolveWebLogicalDeviceId(),getDefaultDeviceName:()=>this.getDefaultBrowserDeviceName(),getPlatformType:()=>this.options.coordinationPlatformType??"web",normalizeDevice:(r,s)=>this.normalizeDevice(r,s)});let n=this.options.coordinationRoomGossipFanout===true||this.options.coordinationRoomArchitecture==="auto"||this.options.coordinationRoomArchitecture==="sparse"?c$1(this.options.coordinationAvenueOverride).key:void 0;if(this.presenceManager=new R({isTicketOnlyMode:()=>this.isTicketOnlyMode(),waitForWasmClient:(r,s)=>this.waitForWasmClient(r,s),warnMissingWasmOnce:r=>this.warnMissingWasmOnce(r),resolveWebLogicalDeviceId:()=>this.resolveWebLogicalDeviceId(),withWebPresenceMetadata:(r,s)=>this.withWebPresenceMetadata(r,s),updatePresence:(r,s,c,a,d,h)=>this.updatePresence(r,s,c,a,d,h),updateExcludedPeers:(r,s)=>this.getCoordinationSignaling().updateDevice(r,{excludedPeers:s}),getCoordinationSignaling:()=>this.getCoordinationSignaling(),rememberRouteRepairTokenFromTicket:r=>this.coreClient?.rememberRouteRepairTokenFromTicket?.(r)??Promise.resolve(false),onDesiredPeersChanged:()=>this.retryManagedApplicationRouteEscalations(),roomGossipFanout:()=>this.effectiveRoomArchitecture==="sparse",capabilityKey:n,localDeviceKeyX:this.options.coordinationDevicePublicKeyX,initialExcludedPeers:this.options.initialAutoConnectExcludedDeviceIds}),this.persistenceReady=Promise.resolve(),this.isTicketOnlyMode()||this.usesProviderNeutralGrant()){this.app=null,this.auth=null;return}let o=a();this.app=o.getApp(),this.auth=o.getAuth(),o.onAuthStateChanged(r=>{if(this.authContext)return;if(this.isSpaceMode()){this.authListeners.forEach(a=>a(this.toRuntimeIdentity(r)));return}let s=r?.uid??null,c=this.lastObservedFirebaseUserId;this.lastObservedFirebaseUserId=s,c&&c!==s&&this.stopAuthActivity({userId:c}),this.browserCoordinationSignaling?.handleScopeChange()??this.coordinationHost.handleScopeChange(),this.authListeners.forEach(a=>a(this.toRuntimeIdentity(r)));});}async loadBrowserWasmRuntime(){return oe()}get tag(){return this.appTag}capabilities(){return t()}getDeviceIdentityStorageKey(){let e=f(this.options);return `${p.WEB_DEVICE_ID_STORAGE_PREFIX}_${e}`}getDeviceIdPersistenceMode(){return this.options.deviceIdPersistence??this.options.nodeIdPersistence??"persistent"}isTicketOnlyMode(){return this.options.signalingMode==="ticket-only"}usesProviderNeutralGrant(){return typeof this.options.coordinationGateway?.grantProvider=="function"}createRandomDeviceId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`web-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}resolveWebLogicalDeviceId(){let e=this.options.localDeviceId?.trim();if(e)return e;let t=this.getDeviceIdPersistenceMode();if(typeof localStorage>"u")return this.createRandomDeviceId();let i=this.getDeviceIdentityStorageKey(),n=Date.now(),o=null;try{let d=localStorage.getItem(i);o=d?JSON.parse(d):null;}catch{o=null;}let r=typeof o?.deviceId=="string"?o.deviceId.trim():"",s=typeof o?.expiresAt=="number"?o.expiresAt:void 0;if(t==="persistent"){let d=r||this.createRandomDeviceId();return localStorage.setItem(i,JSON.stringify({deviceId:d})),d}if(r&&typeof s=="number"&&s>n){let d=n+p.EPHEMERAL_DEVICE_ID_TTL_MS;return localStorage.setItem(i,JSON.stringify({deviceId:r,expiresAt:d})),r}let c=this.createRandomDeviceId(),a=n+p.EPHEMERAL_DEVICE_ID_TTL_MS;return localStorage.setItem(i,JSON.stringify({deviceId:c,expiresAt:a})),c}getDefaultBrowserDeviceName(){return this.options.deviceName?.trim()||(this.options.storagePrefix?`Web (${this.options.storagePrefix.replace(/_$/,"")})`:"Web Browser")}async getLocalDeviceInfo(){return {deviceId:this.resolveWebLogicalDeviceId(),deviceName:this.getDefaultBrowserDeviceName(),platformType:this.options.coordinationPlatformType??"web"}}getCoordinationSignaling(){return this.browserCoordinationSignaling??this.coordinationHost.getSignaling()}usesCoordinationGateway(){return this.coordinationHost.usesGateway()}setCoordinationHostAvailability(e){this.coordinationHost.setHostAvailability(e),this.browserCoordinationSignaling?.setHostAvailability?.(e);}async reconnectCoordinationAfterHostResume(){let e=this.browserCoordinationSignaling;if(e?.reconnectAfterHostResume){await e.reconnectAfterHostResume();return}await this.coordinationHost?.reconnectAfterHostResume();}async getCoordinationNativeTrustToken(e=false){return this.coordinationHost.getNativeTrustToken(e)}invalidateCoordinationNativeTrustToken(){this.coordinationHost.invalidateNativeTrustToken();}subscribeCoordinationNativeTrustToken(e,t){return this.coordinationHost.subscribeNativeTrustToken(e,t)}setCoordinationLocalDeviceId(e){if(!this.options.coordinationGateway)return;let t=e.trim();t&&(this.options.localDeviceId=t);}setCoordinationPlatformType(e){this.options.coordinationGateway&&(this.options.coordinationPlatformType=e);}async setCoordinationExcludedPeers(e){let t=this.resolveWebLogicalDeviceId();if(!t)throw new Error("The local device must be known before publishing peer exclusions.");await this.getCoordinationSignaling().updateDevice(t,{excludedPeers:e});}async joinCoordinationRoom(e,t,i){let n=this.getCoordinationSignaling();if(!n.joinCoordinationRoom)throw new Error("The active coordination provider does not support rooms.");await n.joinCoordinationRoom(e,t,i);}async leaveCoordinationRoom(e){await this.getCoordinationSignaling().leaveCoordinationRoom?.(e);}async getCoordinationRoomMembers(e){let t=this.getCoordinationSignaling();if(!t.getCoordinationRoomMembers)throw new Error("The active coordination provider does not support rooms.");return t.getCoordinationRoomMembers(e)}watchCoordinationRoomMembers(e,t){let i=this.getCoordinationSignaling();if(!i.watchCoordinationRoomMembers)throw new Error("The active coordination provider does not support rooms.");return i.watchCoordinationRoomMembers(e,t)}async withWebPresenceMetadata(e,t){let i;if(!e||!e.trim())i=JSON.stringify({deviceId:t});else {try{let n=JSON.parse(e);if(n&&typeof n=="object"&&!Array.isArray(n))return i=JSON.stringify({...n,deviceId:t}),await m(i)??i}catch{}i=JSON.stringify({deviceId:t,metadata:e});}return await m(i)??i}async setAuthContext(e){let t=this.injectedBrowserAuthSessionActive,i=this.authContext?.userId??null,n=e?.userId??null;if(this.authContext=e,!this.isTicketOnlyMode()&&!this.usesProviderNeutralGrant()&&e?.customToken?.trim()&&!(g()&&this.options.authMode==="external"&&typeof e.tokenProvider=="function"))try{await this.ensureBrowserPlatformAuth(e.userId,e.customToken.trim());}catch(o){console.warn("[WasmBridge] ensureBrowserPlatformAuth failed (non-fatal):",o);}else if(!this.isTicketOnlyMode()&&!this.usesProviderNeutralGrant()&&!e&&t)try{await this.auth?.signOut();}catch(o){console.warn("[WasmBridge] Failed to clear injected browser auth session:",o);}finally{this.injectedBrowserAuthSessionActive=false;}this.syncWasmAuthToken(),!this.isTicketOnlyMode()&&i!==n&&await(this.browserCoordinationSignaling?.handleScopeChange()??this.coordinationHost.handleScopeChange()),this.authListeners.forEach(o=>o(this.currentUser));}async ensureBrowserPlatformAuth(e,t){if((this.auth?.currentUser?.uid??null)===e){this.injectedBrowserAuthSessionActive=true;return}await a().signInWithCustomTokenValue(t),this.injectedBrowserAuthSessionActive=true;}syncWasmAuthToken(){let e=this.wasmClient?.setIdentityCredential??this.wasmClient?.set_auth_token;if(!this.wasmClient||typeof e!="function"||!this.authContext&&this.isSpaceMode())return;let t=this.authContext?.userId??null,i=this.authContext?.token,n=typeof i=="string"&&i.trim().length>0?i:null;if(!(this.hasSyncedAuthToWasmClient&&this.lastWasmAuthUserId===t&&this.lastWasmAuthToken===n)){if(this.lastWasmAuthUserId=t,this.lastWasmAuthToken=n,this.hasSyncedAuthToWasmClient=true,n===null&&typeof this.wasmClient.clearIdentityCredential=="function"){this.wasmClient.clearIdentityCredential();return}e.call(this.wasmClient,n);}}toRuntimeIdentity(e){return e?{id:e.uid,email:e.email,displayName:e.displayName,isAnonymous:e.isAnonymous,getToken:async(t=false)=>{try{return await e.getIdToken(t)}catch{return null}}}:null}getCurrentUserId(){return this.authContext?.userId?this.authContext.userId:this.isTicketOnlyMode()?null:this.auth?.currentUser?.uid??null}getCurrentUserIdForScope(){return this.getCurrentUserId()}getAuthContext(){return this.authContext}isSpaceMode(){return x(this.options)}getResolvedOptions(){return this.options}getDiscoveryScopeId(){if(this.isTicketOnlyMode())return null;let e=this.getCurrentUserId();return e||(this.isSpaceMode()?this.resolveWebLogicalDeviceId():null)}matchesTag(e){return y(e,this.appTag,this.isSpaceMode())}matchesLegacyOrCurrentTag(e){return this.matchesTag(e)}async stopSessionSubscriptions(){let e=Array.from(this.sessionReaders);this.sessionReaders.clear(),await Promise.allSettled(e.map(async t=>{try{await t.cancel();}catch{}}));}async stopRuntimeAuthScopedLoops(){let e=await this.waitForWasmClient(250);if(e)try{typeof e.stop_auth_scoped_activity=="function"?await e.stop_auth_scoped_activity():(typeof e.stop_presence_loop=="function"&&await e.stop_presence_loop(),typeof e.stop_auto_connect=="function"&&await e.stop_auto_connect());}catch(t){console.warn("[WasmSignaling] Failed to stop auth-scoped runtime loops:",t);}}async stopAuthActivity(e){h("WasmBridge.stopAuthActivity",{userId:e?.userId??null}),this.authScopedRuntimeGeneration+=1,this.stopApplicationRouteEscalationSubscription();let t=await this.waitForWasmClient(500);if(t&&typeof t.revoke_tokens_by_scope=="function")try{await t.revoke_tokens_by_scope("user-device");}catch(i){console.warn("[WasmBridge] user-device revoke during auth-scoped shutdown failed:",i);}this.presenceManager.stop(),this.browserCoordinationSignaling?.stopAuthActivity(),this.coordinationHost?.stopAuthActivity(),await this.stopSessionSubscriptions(),this.lastDeliveredConnectionStates.clear(),this.applicationRouteEscalations?.clear(),this.applicationRouteEscalationAttemptKeys?.clear(),await this.stopRuntimeAuthScopedLoops();}setWasmClient(e){this.wasmClient=e,this.coordinationHost.setWasmClient(e),this.lastWasmAuthUserId=null,this.lastWasmAuthToken=null,this.hasSyncedAuthToWasmClient=this.authContext===null,this.lastDeliveredConnectionStates.clear(),this.applicationRouteEscalations?.clear(),this.applicationRouteEscalationAttemptKeys?.clear(),this.syncWasmAuthToken();}async createBroadcastPublisher(){let e=await this.waitForWasmClient();if(!e)throw new Error("WASM broadcast publisher runtime is unavailable");return a$1.create(e)}async initializePersistentIrohProtocols(e){let t=await this.waitForWasmClient(),i=t?.__initPersistentIrohProtocols;if(typeof i!="function")throw new Error("This OpenRTC WASM host was built without persistent Iroh protocols");await i.call(t,e);}async createPersistentIrohNamespace(e,t){return (await this.requirePersistentProtocolHost()).__createPersistentIrohNamespace(BigInt(e),BigInt(t))}async importPersistentIrohTicket(e,t,i){return (await this.requirePersistentProtocolHost()).__importPersistentIrohTicket(e,BigInt(t),BigInt(i))}async sharePersistentIrohNamespace(e,t){return (await this.requirePersistentProtocolHost()).__sharePersistentIrohNamespace(e,t)}async removePersistentIrohNamespace(e,t,i){await(await this.requirePersistentProtocolHost()).__removePersistentIrohNamespace(e,BigInt(t),BigInt(i));}async putPersistentIrohBytes(e,t,i){return (await this.requirePersistentProtocolHost()).__putPersistentIrohBytes(e,t,i)}async setPersistentIrohHash(e,t,i,n){return (await this.requirePersistentProtocolHost()).__setPersistentIrohHash(e,t,i,BigInt(n))}async deletePersistentIrohPrefix(e,t){return (await this.requirePersistentProtocolHost()).__deletePersistentIrohPrefix(e,t)}async queryPersistentIrohNamespace(e,t){return (await this.requirePersistentProtocolHost()).__queryPersistentIrohNamespace(e,t)}async hydratePersistentIrohBlob(e){await(await this.requirePersistentProtocolHost()).__hydratePersistentIrohBlob(e);}async acknowledgePersistentIrohOutbox(e){await(await this.requirePersistentProtocolHost()).__acknowledgePersistentIrohOutbox(e);}async flushPersistentIrohProtocols(){await(await this.waitForWasmClient(500))?.__flushPersistentIrohProtocols?.();}async shutdownPersistentIrohProtocols(){await(await this.waitForWasmClient(500))?.__shutdownPersistentIrohProtocols?.();}async requirePersistentProtocolHost(){let e=await this.waitForWasmClient();if(!e||typeof e.__queryPersistentIrohNamespace!="function")throw new Error("This OpenRTC WASM host was built without persistent Iroh protocols");return e}warnMissingWasmOnce(e){!this.wasmClient&&Date.now()-this.createdAtMs<this.wasmReadyWarningDelayMs||this.missingWasmWarnings.has(e)||(this.missingWasmWarnings.add(e),console.warn(`[WasmSignaling] ${e} skipped: wasm client is not ready.`));}async waitForWasmClient(e=4e3,t=50){if(this.wasmClient)return this.wasmClient;let i=Date.now();for(;!this.wasmClient&&Date.now()-i<e;)await a$2(t);return this.wasmClient??null}normalizeDevice(e,t){return z(e,t)}normalizeDeviceRecord(e,t){return this.normalizeDevice(e,t)}getResolvedWebLogicalDeviceId(){return this.resolveWebLogicalDeviceId()}async encodeSparseFanoutMessage(e,t){let i=await this.waitForWasmClient(),n=this.options.coordinationDeviceSign;if(!i?.prepareSparseFanoutMessage||!i?.finalizeSparseFanoutMessage||!n)throw new Error("[OpenRTC] Browser sparse fanout signer is unavailable.");let o=await i.prepareSparseFanoutMessage(e,t),r=new Uint8Array(o.signingInput??o.signing_input??[]),s=await n(r);return new Uint8Array(await i.finalizeSparseFanoutMessage(String(o.requestId??o.request_id??""),s))}async acceptSparseFanoutMessage(e,t,i){let n=await this.waitForWasmClient();if(!n?.acceptSparseFanoutMessage)throw new Error("[OpenRTC] Browser sparse fanout verifier is unavailable.");let o=await n.acceptSparseFanoutMessage(e,t,i);return {payload:new Uint8Array(o.payload??[]),authorDeviceId:String(o.authorDeviceId??o.author_device_id??""),authorPeerId:String(o.authorPeerId??o.author_peer_id??""),topologyRevision:Number(o.topologyRevision??o.topology_revision),hop:Number(o.hop),forwardPeerIds:Array.isArray(o.forwardPeerIds??o.forward_peer_ids)?(o.forwardPeerIds??o.forward_peer_ids).map(String):[],forwardPeerLimit:Number(o.forwardPeerLimit??o.forward_peer_limit),forwardQueueCapacity:Number(o.forwardQueueCapacity??o.forward_queue_capacity),...o.forward==null?{}:{forward:new Uint8Array(o.forward)}}}async recordSparseFanoutForwardQueueDrop(e,t){let i=await this.waitForWasmClient();i?.recordSparseFanoutForwardQueueDrop&&await i.recordSparseFanoutForwardQueueDrop(e,t);}normalizeDeviceStatusSnapshot(e){return B(e)}normalizePeerSessionSnapshot(e){return C(e)}toBackendConnectionStateFromPeerSession(e){return F(e)}normalizeStateSnapshot(e){return G(e)}stabilizeConnectionState(e){let t=this.lastDeliveredConnectionStates.get(e.connectionId);return {...e,deviceId:e.deviceId??t?.deviceId??null,deviceIdHint:e.deviceIdHint??t?.deviceIdHint??null,remoteNodeId:e.remoteNodeId??t?.remoteNodeId??null,createdAt:e.createdAt??t?.createdAt,updatedAt:e.updatedAt??t?.updatedAt}}sameConnectionState(e,t){return H(e,t)}deliverConnectionState(e,t,i,n){let o=this.stabilizeConnectionState(e);this.lastDeliveredConnectionStates.set(o.connectionId,o);let s=(n??this.lastDeliveredConnectionStates).get(o.connectionId);this.sameConnectionState(s,o)||(n&&n.set(o.connectionId,o),t(o));}get browserPresenceLoopState(){return this.presenceManager.presenceLoopState}set browserPresenceLoopState(e){this.presenceManager.presenceLoopState=e;}get currentUser(){if(this.authContext?.userId){let e=this.authContext.token??null,t=this.authContext.tokenProvider;return {id:this.authContext.userId,getToken:async(i=false)=>{if(e&&(!i||!t))return e;if(t)try{let o=await t(i);if(o)return o}catch{}let n=this.isTicketOnlyMode()?null:this.auth?.currentUser??null;if(n&&n.uid===this.authContext?.userId)try{return await n.getIdToken(i)}catch{return null}return null}}}return this.isTicketOnlyMode()?null:this.toRuntimeIdentity(this.auth?.currentUser??null)}onAuthChange(e){return this.authListeners.push(e),e(this.currentUser),()=>{this.authListeners=this.authListeners.filter(t=>t!==e);}}async checkForSSOToken(){this.isTicketOnlyMode()||this.usesProviderNeutralGrant()||await a().checkForSSOToken();}async waitForAuth(){this.isTicketOnlyMode()||this.usesProviderNeutralGrant()||this.isSpaceMode()||this.authContext?.userId||this.auth?.currentUser||await a().waitForAuth();}async signInAnonymously(){if(!this.isTicketOnlyMode()){if(this.options.authMode!=="anonymous")throw new Error(`[pluto-rtc] Anonymous sign-in is disabled when authMode=${this.options.authMode}.`);await a().signInAnonymously();}}async signInWithPluto(){if(this.isTicketOnlyMode())throw new Error('[openrtc] Pluto sign-in is unavailable when signalingMode="ticket-only".');await a().signInWithPluto();}async signOut(){let e=this.getCurrentUserId();await this.stopAuthActivity({userId:e}),this.authContext=null,this.syncWasmAuthToken(),this.isTicketOnlyMode()||await this.auth?.signOut(),this.authListeners.forEach(t=>t(this.currentUser));}async getTurnCredentials(){return this.isTicketOnlyMode()||!this.auth?.currentUser?null:typeof this.options.turnCredentialsProvider=="function"?await this.options.turnCredentialsProvider()??null:null}async updatePresence(e,t,i=true,n=3e5,o,r){if(this.isTicketOnlyMode())return;let s=this.resolveWebLogicalDeviceId(),c=this.getDeviceIdPersistenceMode()==="ephemeral"?p.EPHEMERAL_DEVICE_ID_TTL_MS:n,a=await this.withWebPresenceMetadata(o,s);this.presenceManager.updatePresenceLoopState({userId:this.getCurrentUserId()??"",localNodeId:e,ticket:t,metadata:a,deviceName:r?.trim()||this.getDefaultBrowserDeviceName()}),await this.getCoordinationSignaling().updatePresence(e,t,i,c,a,r);}async refreshLivePresence(e,t,i,n){if(this.isTicketOnlyMode())return;let o=this.resolveWebLogicalDeviceId(),r=await this.withWebPresenceMetadata(i,o);this.presenceManager.updatePresenceLoopState({userId:this.getCurrentUserId()??"",localNodeId:e,ticket:t,metadata:r,deviceName:n?.trim()||this.getDefaultBrowserDeviceName()}),await this.getCoordinationSignaling().updatePresence(e,t,true,15*6e4,r,n);}async setOffline(e){this.presenceManager.stopPresence(),!this.isTicketOnlyMode()&&await this.getCoordinationSignaling().setOffline(e);}async updateDevice(e,t){if(!e?.trim())throw new Error("updateDevice requires a deviceId");this.isTicketOnlyMode()||await this.getCoordinationSignaling().updateDevice(e,t);}async deleteDevice(e){if(!e?.trim())throw new Error("deleteDevice requires a deviceId");this.isTicketOnlyMode()||await this.getCoordinationSignaling().deleteDevice(e);}async cleanupStaleDevices(){this.isTicketOnlyMode()||await this.getCoordinationSignaling().cleanupStaleDevices();}async sendMessage(e,t,i,n){if(this.isTicketOnlyMode())throw new Error('[openrtc] sendMessage() is unavailable when signalingMode="ticket-only".');return this.getCoordinationSignaling().sendMessage(e,t,i,n)}async pollMessages(e){return this.isTicketOnlyMode()?[]:this.getCoordinationSignaling().pollMessages(e)}async searchDevices(e){return this.isTicketOnlyMode()?[]:this.getCoordinationSignaling().searchDevices(e)}async listDeviceStatus(){if(this.isTicketOnlyMode())return [];if(!this.getDiscoveryScopeId())return [];let t=await this.getCoordinationSignaling().listDevices(),i=this.wasmClient;return Promise.all(t.map(async n=>{let o=this.normalizeDeviceStatusSnapshot({...n,connectionStatus:n.online?"online":"disconnected"}),r=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!r||typeof i?.iroh_path_kind!="function"||typeof i?.iroh_transport_rtt_ms!="function")return o;try{let[s,c]=await Promise.all([i.iroh_path_kind(r),i.iroh_transport_rtt_ms(r)]);if(typeof c!="number"||!Number.isFinite(c))return o;let a=Math.max(0,Math.round(c)),d={};if(s==="direct-lan")d.irohLan=a;else if(s==="direct-quic")d.iroh=a;else if(s==="ble")d.ble=a;else if(s==="relay")d.irohRelay=a;else if(s==="webrtc")d.webrtc=a;else if(s==="moq")d.moq=a;else return o;return {...o,latencyMs:a,latencyByTransport:d}}catch(s){return d$1("[WasmBridge] iroh transport latency unavailable",{deviceId:n.deviceId,error:s instanceof Error?s.message:String(s)}),o}}))}async getPeerSession(e){let t=await this.waitForWasmClient(500);if(t&&typeof t.peer_session=="function"){let i=await t.peer_session(e);return !i||typeof i!="object"?null:this.normalizePeerSessionSnapshot(i)}return this.warnMissingWasmOnce("getPeerSession"),null}async listPeerSessions(){let e=await this.waitForWasmClient(500);if(e&&typeof e.peer_sessions=="function"){let t=await e.peer_sessions();return (Array.isArray(t)?t:[]).map(n=>this.normalizePeerSessionSnapshot(n)).filter(n=>!!(n.peerId||n.deviceId||n.deviceIdHint||n.nodeId||n.activeConnectionId))}return this.warnMissingWasmOnce("listPeerSessions"),[]}async waitForSettledPeer(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.wait_for_peer=="function"){let n=await i.wait_for_peer(e,t);return !n||typeof n!="object"?null:this.normalizePeerSessionSnapshot(n)}return this.warnMissingWasmOnce("waitForSettledPeer"),null}async waitForSettledScope(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.wait_for_settled_scope=="function"){let n=await i.wait_for_settled_scope(e,t);return !n||typeof n!="object"?null:this.normalizePeerSessionSnapshot(n)}return this.warnMissingWasmOnce("waitForSettledScope"),null}async openPeerBi(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.open_peer_bi=="function"){let n=await i.open_peer_bi(e,t);if(!n?.recv||!n?.send)throw new Error("WASM open_peer_bi returned an invalid bidirectional stream");return {readable:n.recv,writable:E(n,n.send)}}throw this.warnMissingWasmOnce("openPeerBi"),new Error("WASM runtime does not support open_peer_bi()")}async openPeerBiRaw(e,t){if(this.options.applicationCrypto?.requireEncrypted)throw new Error("[WasmBridge] openPeerBiRaw is debug-only and cannot be used when application crypto is required");let i=await this.waitForWasmClient(500),n=i&&typeof i.open_peer_bi_transport_only=="function";if(console.debug("[WasmBridge] openPeerBiRaw",{peerId:e,hasWasmClient:!!i,hasTransportOnly:n,timeoutMs:t}),n){let o=await i.open_peer_bi_transport_only(e,t);if(!o?.recv||!o?.send)throw new Error("WASM open_peer_bi_transport_only returned an invalid bidirectional stream");return {readable:o.recv,writable:E(o,o.send)}}throw new Error("WASM runtime does not support the restricted transport-only diagnostic stream")}async openPeerUni(e,t){let i=await this.waitForWasmClient(500);if(i&&typeof i.open_peer_uni=="function"){let n=await i.open_peer_uni(e,t),o=n?.writable??n;if(!o)throw new Error("WASM open_peer_uni returned an invalid writable stream");return {writable:E(n,o)}}throw this.warnMissingWasmOnce("openPeerUni"),new Error("WASM runtime does not support open_peer_uni()")}beginOpenRtcMediaPublication(e){let t=this.wasmClient?.__beginOpenRtcMediaPublication;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");let i=t.call(this.wasmClient,e.publicationId||void 0,e.kind,e.codec,e.clockRate,e.codedWidth,e.codedHeight,e.channels);return {...i,control:new Uint8Array(i.control)}}encodeOpenRtcMediaSample(e){let t=this.wasmClient?.__encodeOpenRtcMediaSample;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");return new Uint8Array(t.call(this.wasmClient,e.publicationId,e.timestampUs,e.durationUs,e.keyframe,e.discardable,e.payload))}pauseOpenRtcMediaPublication(e){let t=this.wasmClient?.__pauseOpenRtcMediaPublication;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");t.call(this.wasmClient,e);}retireOpenRtcMediaPublication(e){let t=this.wasmClient?.__retireOpenRtcMediaPublication;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");t.call(this.wasmClient,e);}retireOpenRtcMediaReceiver(e,t){let i=this.wasmClient?.__retireOpenRtcMediaReceiver;if(typeof i!="function")throw new Error("[OpenRTC] This WASM build does not include Rust-owned media sessions.");i.call(this.wasmClient,e,t);}decodeOpenRtcMediaChunk(e){let t=this.wasmClient?.__decodeOpenRtcMediaChunk;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include the shared media protocol.");let i=t.call(this.wasmClient,e);return {...i,payload:new Uint8Array(i.payload)}}decodeOpenRtcMediaControl(e){let t=this.wasmClient?.__decodeOpenRtcMediaControl;if(typeof t!="function")throw new Error("[OpenRTC] This WASM build does not include the shared media protocol.");return t.call(this.wasmClient,e)}async sendPeerDatagram(e,t,i){let n=await this.waitForWasmClient(500),o=n?.sendPeerDatagram;if(typeof o!="function")throw new Error("[OpenRTC] This WASM build does not include protected peer datagrams.");return await o.call(n,e,t,i)!==false}async receivePeerDatagram(e){let t=await this.waitForWasmClient(500),i=t?.receivePeerDatagram;if(typeof i!="function")throw new Error("[OpenRTC] This WASM build does not include protected peer datagrams.");return new Uint8Array(await i.call(t,e))}peerDatagramMaxSize(){let e=this.wasmClient?.peerDatagramMaxSize?.();return Number.isSafeInteger(e)&&e>0?e:1024}createPeerDatagramPolicy(){let e=this.wasmClient?.createPeerDatagramPolicy;if(typeof e!="function")throw new Error("[OpenRTC] This WASM build does not include shared datagram policy.");return e.call(this.wasmClient)}async resolvePeerRecords(e){let t=await this.waitForWasmClient(500);if(t&&typeof t.resolve_peer_connection_records=="function"){let i=await t.resolve_peer_connection_records(e);return (Array.isArray(i)?i:[]).map(n=>({connectionId:typeof n.connectionId=="string"?n.connectionId:"",nodeId:typeof n.nodeId=="string"?n.nodeId:null,deviceId:typeof n.deviceId=="string"?n.deviceId:null,deviceIdHint:typeof n.deviceIdHint=="string"?n.deviceIdHint:null,endpointId:typeof n.endpointId=="string"?n.endpointId:null,transportGeneration:typeof n.transportGeneration=="number"?n.transportGeneration:0,routeGeneration:typeof n.routeGeneration=="number"?n.routeGeneration:void 0,transportStableId:typeof n.transportStableId=="number"?n.transportStableId:null,transportSource:typeof n.transportSource=="string"?n.transportSource:null,lastTransportChangeAtMs:typeof n.lastTransportChangeAtMs=="number"?n.lastTransportChangeAtMs:0,lastRouteChangeAtMs:typeof n.lastRouteChangeAtMs=="number"?n.lastRouteChangeAtMs:void 0,state:typeof n.state=="string"?n.state:"pending",statusReason:typeof n.statusReason=="string"?n.statusReason:null,createdAtMs:typeof n.createdAtMs=="number"?n.createdAtMs:0,updatedAtMs:typeof n.updatedAtMs=="number"?n.updatedAtMs:0}))}return this.warnMissingWasmOnce("resolvePeerRecords"),[]}async resolvePeerIdentity(e){let t=await this.waitForWasmClient(500);if(t){let i=n=>{if(!n||typeof n!="object")return {peerId:null,deviceId:null,deviceIdHint:null,nodeId:null};let o=n;return {peerId:typeof o.peerId=="string"?o.peerId:null,deviceId:typeof o.deviceId=="string"?o.deviceId:null,deviceIdHint:typeof o.deviceIdHint=="string"?o.deviceIdHint:null,nodeId:typeof o.nodeId=="string"?o.nodeId:null}};if(typeof t.peer_session=="function")try{let n=await t.peer_session(e),o=i(n);if(o.peerId||o.deviceId||o.deviceIdHint||o.nodeId)return o}catch{}if(typeof t.peer_snapshot=="function")try{return i(await t.peer_snapshot(e))}catch{}}return this.warnMissingWasmOnce("resolvePeerIdentity"),{peerId:null,deviceId:null,deviceIdHint:null,nodeId:null}}onDevicesChange(e,t){return this.isTicketOnlyMode()?(e([]),()=>{}):this.getCoordinationSignaling().onDevicesChange(e,t)}onRoomArchitectureChange(e){return this.getCoordinationSignaling().onRoomArchitectureChange?.(t=>{let i=this.effectiveRoomArchitecture!==t.effective;this.effectiveRoomArchitecture=t.effective,i&&this.presenceManager.handleRoomArchitectureChange().catch(n=>{console.warn("[WasmSignaling] failed to replay desired peers after room architecture change",{effectiveArchitecture:t.effective,epoch:t.epoch,error:n});}),e(t);})??(()=>{})}onRoomAuthorityAssignmentChange(e){return this.getCoordinationSignaling().onRoomAuthorityAssignmentChange?.(e)??(()=>{})}async publishAuthorityAssignment(e){let t=this.getCoordinationSignaling();if(!t.publishAuthorityAssignment)throw new Error("[OpenRTC] Authority assignment publication is unavailable.");await t.publishAuthorityAssignment(e);}async publishManagedRoomMessage(e){let t=this.getCoordinationSignaling().publishManagedRoomMessage;if(!t)throw new Error("[OpenRTC] Managed room fanout is unavailable.");await t.call(this.getCoordinationSignaling(),e);}onManagedRoomMessage(e){return this.getCoordinationSignaling().onManagedRoomMessage?.(e)??(()=>{})}async subscribeDevices(e){return this.isTicketOnlyMode()?new ReadableStream({start(t){t.close();}}):this.getCoordinationSignaling().subscribeDevices()}async startAutoConnect(e,t){if(this.isTicketOnlyMode())return;this.startApplicationRouteEscalationSubscription();let i=this.authScopedRuntimeGeneration;try{let n=await this.waitForWasmClient();if(i!==this.authScopedRuntimeGeneration||!n||typeof n.start_auto_connect!="function")return;await this.presenceManager.installInitialAutoConnectExclusions(n),await n.start_auto_connect(e,t),i===this.authScopedRuntimeGeneration&&this.presenceManager.startAutoConnect(e,t);}catch(n){console.warn("[WasmBridge] failed to initialize WASM auto-connect context",{userId:e,localDeviceId:t,error:n});}}async startAutoConnectOnce(e,t){await this.startAutoConnect(e,t),this.forceReconnect();}notifyDisconnectRequested(e){this.presenceManager.wakeRustAutoConnectOwner();}async excludeAutoConnect(e,t){await this.presenceManager.excludeAutoConnect(e,t);}async disconnectDevice(e){let t=await this.waitForWasmClient();if(!t||typeof t.disconnect_device!="function"){this.warnMissingWasmOnce("disconnectDevice"),await this.presenceManager.excludeAutoConnect(e,true).catch(()=>{});return}try{await t.disconnect_device(e,null),await this.presenceManager.recordAutoConnectExcludedForPresence(e,!0).catch(()=>{});}catch(i){throw console.warn("[WasmBridge] disconnect_device failed",{deviceId:e,error:i?.message??String(i)}),i}}async submitDesiredPeerProjection(e,t){return this.presenceManager.submitDesiredPeerProjection(e,t)}observeManagedDesiredPeers(e){this.presenceManager.observeDesiredPeerProjection(e),e$1("[OpenRTC][route-escalation] observed managed desired peers",{peerCount:e.length,peersWithTickets:e.filter(t=>typeof t.ticket=="string"&&t.ticket.trim()).length,deviceIds:e.map(t=>t.deviceId)});}setCoreClient(e){e&&typeof e.ensureManagedApplicationRoute=="function"?(this.coreClient=e,e$1("[OpenRTC][route-escalation] attached shared core client"),this.startApplicationRouteEscalationSubscription(),this.retryManagedApplicationRouteEscalations()):(this.coreClient=null,e$1("[OpenRTC][route-escalation] detached shared core client"),this.stopApplicationRouteEscalationSubscription());}startApplicationRouteEscalationSubscription(){if(this.applicationRouteEscalationUnsubscribe&&this.routeSubscriptionGeneration===this.authScopedRuntimeGeneration)return;this.stopApplicationRouteEscalationSubscription();let e=this.authScopedRuntimeGeneration,t=this.applicationRouteEscalationSubscriptionEpoch,i=this.onStateChange(n=>{let o=this.stabilizeConnectionState(n);this.lastDeliveredConnectionStates.set(o.connectionId,o),e$1("[OpenRTC][route-escalation] observed Rust connection state",{connectionId:o.connectionId,deviceId:o.deviceId??o.deviceIdHint??null,remoteNodeId:o.remoteNodeId??null,state:o.state,transportGeneration:o.transportGeneration??null,routeGeneration:o.routeGeneration??null}),this.escalateManagedApplicationRoute(o);});this.applicationRouteEscalationUnsubscribe=()=>{},this.routeSubscriptionGeneration=e,Promise.resolve(i).then(n=>{if(!this.coreClient||e!==this.authScopedRuntimeGeneration||t!==this.applicationRouteEscalationSubscriptionEpoch){n();return}this.applicationRouteEscalationUnsubscribe=n,this.routeSubscriptionGeneration=e;});}stopApplicationRouteEscalationSubscription(){this.applicationRouteEscalationSubscriptionEpoch+=1,this.applicationRouteEscalationUnsubscribe?.(),this.applicationRouteEscalationUnsubscribe=null,this.routeSubscriptionGeneration=-1;}retryManagedApplicationRouteEscalations(){for(let e of this.lastDeliveredConnectionStates.values())this.escalateManagedApplicationRoute(e);}escalateManagedApplicationRoute(e){if(!this.coreClient||!["connected","connecting"].includes(e.state))return;let t=[e.transportGeneration??0,e.routeGeneration??0].join(":"),i=this.applicationRouteEscalationAttemptKeys??(this.applicationRouteEscalationAttemptKeys=new Map);if(i.get(e.connectionId)===t||this.applicationRouteEscalations.has(e.connectionId))return;let n=this.presenceManager.resolveDesiredPeer(e.deviceId??e.deviceIdHint,e.remoteNodeId);if(!n?.ticket){e$1("[OpenRTC][route-escalation] awaiting matching desired-peer ticket",{connectionId:e.connectionId,deviceId:e.deviceId??e.deviceIdHint??null,remoteNodeId:e.remoteNodeId??null});return}let o=this.authScopedRuntimeGeneration,r=this.coreClient;i.set(e.connectionId,t),e$1("[OpenRTC][route-escalation] adopting Rust-managed generation",{connectionId:e.connectionId,deviceId:n.deviceId,remoteNodeId:e.remoteNodeId??n.nodeId??null,transportGeneration:e.transportGeneration??null,routeGeneration:e.routeGeneration??null});let s;s=(async()=>{let c=await r.ensureManagedApplicationRoute({ticket:n.ticket,connectionId:e.connectionId,remoteNodeId:e.remoteNodeId??n.nodeId,expectedDeviceId:n.deviceId,timeoutMs:2e4});if(o!==this.authScopedRuntimeGeneration)return;let a=c,d=a.id?.trim()||e.connectionId,h=a.remoteNodeId?.trim()||e.remoteNodeId?.trim()||a.deviceId?.trim()||n.deviceId;if(r.hasApplicationRouteForPeer?.(d,h)!==true&&r.hasApplicationRouteForPeer?.(d,h)!==true)throw new Error(`application crypto was not ready for ${h}`)})().catch(c=>{o===this.authScopedRuntimeGeneration&&console.warn("[OpenRTC][route-escalation] Rust-managed route remains pending",{connectionId:e.connectionId,deviceId:n.deviceId,remoteNodeId:e.remoteNodeId??n.nodeId,error:c?.message??String(c)});}).finally(()=>{if(this.applicationRouteEscalations.get(e.connectionId)===s){this.applicationRouteEscalations.delete(e.connectionId);let c=this.lastDeliveredConnectionStates?.get(e.connectionId),a=c?[c.transportGeneration??0,c.routeGeneration??0].join(":"):null;c&&a!==t&&o===this.authScopedRuntimeGeneration&&queueMicrotask(()=>this.escalateManagedApplicationRoute(c));}}),this.applicationRouteEscalations.set(e.connectionId,s);}async connectToDevice(e){let t=await this.waitForWasmClient();if(!t||typeof t.connect_device!="function")throw this.warnMissingWasmOnce("connectToDevice"),new Error("WASM runtime does not support connect_device()");let i=e.endpointTicket?.trim()??"",n=e.admissionToken?.trim()??"",o=e.admissionScope?.trim()??"",r=!i,s=i;if(r&&(!e.deviceId||!n||!o||typeof t.connect_known_device_with_token!="function"))throw new Error("WASM connectToDevice requires an endpoint ticket or supported known-device admission intent.");let c=Date.now();e$1("[WasmBridge][ROUTE-ESCALATION] starting managed transport dial",{deviceId:e.deviceId??null,ticket:se(i),knownDeviceAdmission:r,hasCoreClient:!!this.coreClient});let a=r?await(async()=>{let h=Date.now(),l=Math.max(1,e.timeoutMs??3e4),m=()=>Math.max(1,l-(Date.now()-h)),y=e.admissionPeerUserId?.trim()??"";if(y){let v=(await this.getCoordinationSignaling().waitForFriendDevice(y,e.deviceId,Math.min(1e4,m()))).ticket?.trim()??"";if(!v)throw new Error(`[pluto-rtc] authorized device ${e.deviceId} did not publish an endpoint ticket.`);if(typeof t.observe_known_device_endpoint!="function")throw new Error("WASM runtime does not support provider-authorized endpoint observations.");await t.observe_known_device_endpoint(e.deviceId,v),s=a$3(v).irohTicket;}return t.connect_known_device_with_token(e.deviceId,n,o,e.admissionMaxConnections??0,e.admissionExpiresAtMs==null?null:BigInt(Math.floor(e.admissionExpiresAtMs)),Math.min(1e4,m()))})():await t.connect_device(e.deviceId??null,i);e$1("[WasmBridge][ROUTE-ESCALATION] managed transport dial completed",{deviceId:e.deviceId??null,remoteNodeId:a?.remoteNodeId??null,connectionId:a?.connectionId??null,elapsedMs:Date.now()-c});let d=s;if(d&&this.coreClient){let h=this.coreClient;try{e$1("[WasmBridge][ROUTE-ESCALATION] starting typed application connection",{deviceId:e.deviceId??null,remoteNodeId:a?.remoteNodeId??null,connectionId:a?.connectionId??null});let l=await h.ensureManagedApplicationRoute({ticket:d,connectionId:a?.connectionId??null,remoteNodeId:a?.remoteNodeId??null,expectedDeviceId:e.deviceId??null,approvedScope:a?.approvedScope??null,timeoutMs:2e4}),m=typeof l?.remoteNodeId=="string"?l.remoteNodeId.trim():"",y=typeof l?.deviceId=="string"?l.deviceId.trim():"",g=m||a?.remoteNodeId?.trim?.()||y||e.deviceId?.trim?.()||"",v=typeof h.hasApplicationRouteForPeer=="function"?h.hasApplicationRouteForPeer.bind(h):null;if(!(!!g&&v?.(l?.id??void 0,g)===!0)&&g&&typeof h.waitForApplicationCryptoForPeer=="function"&&!(!!await h.waitForApplicationCryptoForPeer(g,2e4)&&(!v||v(l?.id??void 0,g)===!0)))throw console.warn("[WasmBridge][ROUTE-ESCALATION] application route still pending after managed dial",{deviceId:e.deviceId??null,remoteNodeId:m||(a?.remoteNodeId??null),connectionId:a?.connectionId??null,peerForCrypto:g,elapsedMs:Date.now()-c}),Object.assign(new Error(`application crypto was not ready for ${g}`),{applicationCryptoNotReady:!0});e$1("[WasmBridge][ROUTE-ESCALATION] application route ready",{deviceId:e.deviceId??null,remoteNodeId:m||(a?.remoteNodeId??null),connectionId:a?.connectionId??null,elapsedMs:Date.now()-c});}catch(l){if(l?.applicationCryptoNotReady)throw l;return console.warn("[WasmBridge] Managed transport connected; TS application route escalation is still pending",{deviceId:e.deviceId??null,remoteNodeId:a?.remoteNodeId??null,connectionId:a?.connectionId??null,error:l?.message??String(l)}),a}}return a}forceReconnect(){this.isTicketOnlyMode()||!this.app||!this.auth||this.presenceManager.wakeRustAutoConnectOwner();}startPresenceLoop(e,t,i,n,o){return this.presenceManager.startPresenceLoop(e,t,i,n,o)}ensureSpaceNamespaceIdPromise(){if(this.cachedSpaceNamespaceId)return Promise.resolve(this.cachedSpaceNamespaceId);if(!this.spaceNamespaceIdPromise){let e=this.options.apiKey?.trim()??"",t=this.options.spaceKey?.trim()??"";if(!e||!t)return Promise.resolve(null);this.spaceNamespaceIdPromise=b$1(e,t).then(i=>(this.cachedSpaceNamespaceId=i,i)).catch(()=>null);}return this.spaceNamespaceIdPromise}async createSession(e){if(this.isTicketOnlyMode())throw new Error('[openrtc] createSession() is unavailable when signalingMode="ticket-only".');let t=this.getCurrentUserId();if(!t&&!e.initiator&&!e.target&&!this.isSpaceMode())throw new Error("createSession requires user scope");let i={...e,appTag:e.appTag??this.appTag,initiator:e.initiator??t??void 0,target:e.target??t??void 0};await this.getCoordinationSignaling().createSession(i);}async updateSession(e,t){if(this.isTicketOnlyMode())throw new Error('[openrtc] updateSession() is unavailable when signalingMode="ticket-only".');await this.getCoordinationSignaling().updateSession(e,t);}async subscribeSessions(e){return this.isTicketOnlyMode()?new ReadableStream({start(t){t.close();}}):this.getCoordinationSignaling().subscribeSessions(e)}async getLocalDeviceId(){return this.resolveWebLogicalDeviceId()}async isConnected(e){let t=await this.waitForWasmClient();return t&&typeof t.is_connected=="function"?t.is_connected(e):false}async getConnectionStates(){let e=await this.waitForWasmClient(500);if(e&&typeof e.connection_states=="function"){let n=await e.connection_states(),o=(Array.isArray(n)?n:[]).map(r=>this.normalizeStateSnapshot(r)).filter(r=>!!r);return o.length>0&&d$1("[WasmBridge] replaying current wasm connection states",o.map(r=>({connectionId:r.connectionId,deviceId:r.deviceId??null,deviceIdHint:r.deviceIdHint??null,remoteNodeId:r.remoteNodeId??null,state:r.state,transportState:r.transportState??null,protocolState:r.protocolState??null,routable:r.routable??null}))),o}let i=(await this.listPeerSessions().catch(()=>[])).map(n=>this.toBackendConnectionStateFromPeerSession(n)).filter(n=>!!n);return i.length>0&&d$1("[WasmBridge] replaying current wasm connection states",i.map(n=>({connectionId:n.connectionId,deviceId:n.deviceId??null,deviceIdHint:n.deviceIdHint??null,remoteNodeId:n.remoteNodeId??null,state:n.state,transportState:n.transportState??null,protocolState:n.protocolState??null,routable:n.routable??null}))),i}onStateChange(e){let t=new Map,i=new Map,n=this.authScopedRuntimeGeneration,o=false,r=a=>{let d=a.detail,h=this.normalizeStateSnapshot(d),l=typeof d?.connectionId=="string"?d.connectionId.trim():"";if(!l||o)return;if(h&&(h.state==="closed"||h.state==="failed"||h.state==="disconnected")){this.deliverConnectionState(h,e,"rust-event-detail",t);return}let m=(i.get(l)??0)+1;i.set(l,m);let y=this.authScopedRuntimeGeneration;(async()=>{let g=await this.waitForWasmClient(500);if(!(o||y!==this.authScopedRuntimeGeneration||i.get(l)!==m)){if(g&&typeof g.connection_state=="function"){let v=await g.connection_state(l),w=this.normalizeStateSnapshot(v);if(!o&&y===this.authScopedRuntimeGeneration&&i.get(l)===m&&w){this.deliverConnectionState(w,e,"rust-event",t);return}}!o&&y===this.authScopedRuntimeGeneration&&i.get(l)===m&&h&&this.deliverConnectionState(h,e,"rust-event-detail",t);}})().catch(g=>{o||console.warn("[WasmBridge] Failed to read Rust connection state after lifecycle event",{connectionId:l,error:g});});},s=typeof window<"u"?window:null,c=typeof s?.addEventListener=="function"&&typeof s?.removeEventListener=="function";return c&&s.addEventListener("connection-state-changed",r),this.getConnectionStates().then(a=>{!o&&n===this.authScopedRuntimeGeneration&&a.forEach(d=>{i.has(d.connectionId)||this.deliverConnectionState(d,e,"replay",t);});}).catch(a=>{console.warn("[WasmBridge] Failed to replay wasm connection states after subscription:",a);}),()=>{o=true,i.clear(),c&&s.removeEventListener("connection-state-changed",r);}}async sendExplicitFilePath(e,t,i=""){throw new Error("sendExplicitFilePath is native-only. Use sendExplicitFileData in web/wasm runtime.")}sanitizeExplicitFileName(e){let i=(typeof e=="string"?e.replace(/\\/g,"/"):"").split("/").reverse().find(r=>r.trim().length>0)?.trim()??"";if(!i||i==="."||i==="..")return p.FALLBACK_EXPLICIT_FILE_NAME;let n="";for(let r of i){if([...n].length>=p.MAX_EXPLICIT_FILE_NAME_CHARS)break;let s=r.charCodeAt(0);r==="/"||r==="\\"||r==="\0"||s<32||s===127?n+="_":n+=r;}let o=n.trim();return !o||o==="."||o===".."?p.FALLBACK_EXPLICIT_FILE_NAME:o}sanitizeExplicitMimeType(e){let t=typeof e=="string"?e.trim():"";if(!t)return p.FALLBACK_EXPLICIT_MIME_TYPE;let i="";for(let n of t){if(i.length>=p.MAX_EXPLICIT_MIME_TYPE_CHARS)break;let o=n.charCodeAt(0);o<33||o>126||n==='"'||n==="\\"?i+="_":i+=n;}return i.length>0?i:p.FALLBACK_EXPLICIT_MIME_TYPE}assertExplicitTransferHeaderSize(e){if(e.byteLength===0||e.byteLength>p.MAX_EXPLICIT_TRANSFER_HEADER_BYTES)throw new Error(`Explicit transfer header is too large: ${e.byteLength} bytes`)}createWebRTCExplicitTransferId(){let e=new Uint8Array(16),t=globalThis.crypto;if(t&&typeof t.getRandomValues=="function")return t.getRandomValues(e),e;for(let i=0;i<e.byteLength;i+=1)e[i]=Math.floor(Math.random()*256);return e}createWebRTCExplicitTransferFrame(e,t,i,n,o){let r=o?.headerFrame===true?4:0,s=new Uint8Array(25+r+n.byteLength);s[0]=p.EXPLICIT_FILE_PROTOCOL_TYPE,s.set(e,1);let c=new DataView(s.buffer);c.setUint32(17,t,false),c.setUint32(21,i,false);let a=o?.headerFrame===true?29:25;return o?.headerFrame===true&&c.setUint32(25,n.byteLength,false),s.set(n,a),s}async sendExplicitFileData(e){let t=e.connection,i=e.file,n=e.applicationCrypto??this.options.applicationCrypto;if((e.requireApplicationCrypto===true||t?.requireApplicationCrypto===true)&&!n)throw new Error("[WasmBridge] Explicit transfer requires application crypto but none is available for this connection");let r=e.transferId&&e.transferId.trim().length>0?e.transferId:`transfer-${Date.now()}`;typeof e.receiverPlatformType=="string"?e.receiverPlatformType.trim().toLowerCase():null;let c=e.remoteNodeId?.trim()||t?.remoteNodeId?.trim()||t?.deviceId?.trim();if(e$1("[WasmBridge] sendExplicitFileData start",{connectionId:e.connectionId??null,connectionRemoteNodeId:t?.remoteNodeId??null,remoteNodeId:c??null,fileName:i.name,fileSize:i.size,transferId:r}),!c)throw new Error("Web explicit transfer requires an active connection with a resolved remote node ID");let a=await this.waitForWasmClient();if(!a)throw new Error("WASM explicit transfer requires an initialized WASM client");let d=new TextEncoder,h={transfer_id:r,filename:this.sanitizeExplicitFileName(i.name),size:i.size,mime_type:this.sanitizeExplicitMimeType(i.type)},l=d.encode(JSON.stringify(h));this.assertExplicitTransferHeaderSize(l);let m=new Uint8Array(4);new DataView(m.buffer).setUint32(0,l.byteLength,false);let y=new Uint8Array(m.byteLength+l.byteLength);y.set(m,0),y.set(l,m.byteLength);let g=async()=>{let v=a.open_peer_bi_explicit_file_sender;if(typeof v!="function")return false;let w=await v.call(a,c,5e3),S=w?.writable??w?.send;if(!S||typeof S.getWriter!="function")throw new Error("WASM explicit peer stream returned an invalid writable stream");e$1("[WasmBridge] sendExplicitFileData open_peer_bi_explicit_file_sender resolved",{remoteNodeId:c,transferId:e.transferId??null,applicationCryptoWrapped:w.applicationCryptoWrapped===true});let C=E(w,S,{requireFinish:true}).getWriter(),T=false;try{await C.write(y);let P=new Uint8Array(await i.arrayBuffer());for(let b=0;b<P.byteLength;b+=p.EXPLICIT_FILE_CHUNK_SIZE_BYTES){let ie=P.slice(b,Math.min(b+p.EXPLICIT_FILE_CHUNK_SIZE_BYTES,P.byteLength));await C.write(ie);}}catch(P){throw T=true,P}finally{try{await C.close();}catch(P){if(!T)throw P}finally{C.releaseLock();}}return true};try{if(await g())return;throw new Error("[WasmBridge] Explicit transfer requires the generation-fenced open_peer_bi_explicit_file_sender path, but it is unavailable on this WASM build. Rebuild the current OpenRTC WASM; raw open_bi fallback is intentionally unsupported for application data.")}finally{e$1("[WasmBridge] sendExplicitFileData completed",{remoteNodeId:c,transferId:r,fileName:i.name,fileSize:i.size});}}async getTransferHistory(e=50){return []}async deleteTransferJob(e){}watchFriendDevices(e,t){return this.isTicketOnlyMode()?()=>{}:this.getCoordinationSignaling().watchFriendDevices(e,t)}async updateFriendTicket(e){this.isTicketOnlyMode()||await this.getCoordinationSignaling().updateFriendTicket(e);}};p.EXPLICIT_FILE_PROTOCOL_TYPE=2,p.EXPLICIT_FILE_CHUNK_SIZE_BYTES=64*1024,p.MAX_EXPLICIT_TRANSFER_HEADER_BYTES=64*1024,p.FALLBACK_EXPLICIT_FILE_NAME="openrtc-transfer.bin",p.MAX_EXPLICIT_FILE_NAME_CHARS=180,p.FALLBACK_EXPLICIT_MIME_TYPE="application/octet-stream",p.MAX_EXPLICIT_MIME_TYPE_CHARS=255,p.WEB_DEVICE_ID_STORAGE_PREFIX="pluto_rtc_web_device_identity",p.EPHEMERAL_DEVICE_ID_TTL_MS=o.browserIdentity.ephemeralDeviceIdTtlMs;var te=p;export{oe as a,te as b};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-VFDCIEP6.js';import {a}from'./chunk-4J4F32QT.js';import {d}from'./chunk-72NEEJQG.js';import'./chunk-NDR2ANQB.js';import {i}from'./chunk-42TNJH5S.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-DUY34MGT.js';import'./chunk-CCCYE3XN.js';export{a as ERROR_CODES,b as RTCError,e as classifyError,d as createError,c as projectError}from'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function y(a){return i(a,{platform:"web",broadcastHostFactory:async e=>{let[{BrowserManagedBroadcastHost:o},{loadBrowserWasmRuntimeModule:t}]=await Promise.all([import('./BrowserManagedBroadcastHost-ARCP5MGJ.js'),import('./WasmBridge-LP7FHTHZ.js')]),r=t().then(async n=>(await n.initWasm(),n.start(),new n.WasmClient(e.apiKey)));return new o({resolve:e.resolve,manage:e.manage,deviceId:e.deviceId,defaultAuth:e.defaultAuth,loadWasm:()=>r})},runtimeFactory:async e=>{let{createWasmClient:o}=await import('./runtime/factories.js');return o(e)}})}y.native=function(a$2,e=d()){let o=new a;return i(a$2,{platform:"native",broadcastHostFactory:async t=>{let{NativeManagedBroadcastHost:r}=await import('./NativeManagedBroadcastHost-WCQ6TPUU.js');return new r(e,t)},offlineSupport:()=>e.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async t=>{let r=await e.invoke("start_iroh_node");return e.invoke("openrtc_create_offline_enrollment_request",{trustDomain:t.trustDomain,deviceId:t.deviceId,endpointId:r,enrollmentNonce:crypto.randomUUID(),requestedRoles:t.requestedRoles})},close:()=>o.close(),deviceKeyProvider:a$1(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:r}=await import('./ipcFactory-2WMR4PH6.js');return r(t,e,o)}})};export{y as OpenRTC};
1
+ import {a as a$1}from'./chunk-VFDCIEP6.js';import {a}from'./chunk-4J4F32QT.js';import {d}from'./chunk-72NEEJQG.js';import'./chunk-NDR2ANQB.js';import {i}from'./chunk-42TNJH5S.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-DUY34MGT.js';import'./chunk-CCCYE3XN.js';export{a as ERROR_CODES,b as RTCError,e as classifyError,d as createError,c as projectError}from'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function y(a){return i(a,{platform:"web",broadcastHostFactory:async e=>{let[{BrowserManagedBroadcastHost:o},{loadBrowserWasmRuntimeModule:t}]=await Promise.all([import('./BrowserManagedBroadcastHost-ARCP5MGJ.js'),import('./WasmBridge-UZC7G4NP.js')]),r=t().then(async n=>(await n.initWasm(),n.start(),new n.WasmClient(e.apiKey)));return new o({resolve:e.resolve,manage:e.manage,deviceId:e.deviceId,defaultAuth:e.defaultAuth,loadWasm:()=>r})},runtimeFactory:async e=>{let{createWasmClient:o}=await import('./runtime/factories.js');return o(e)}})}y.native=function(a$2,e=d()){let o=new a;return i(a$2,{platform:"native",broadcastHostFactory:async t=>{let{NativeManagedBroadcastHost:r}=await import('./NativeManagedBroadcastHost-WCQ6TPUU.js');return new r(e,t)},offlineSupport:()=>e.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async t=>{let r=await e.invoke("start_iroh_node");return e.invoke("openrtc_create_offline_enrollment_request",{trustDomain:t.trustDomain,deviceId:t.deviceId,endpointId:r,enrollmentNonce:crypto.randomUUID(),requestedRoles:t.requestedRoles})},close:()=>o.close(),deviceKeyProvider:a$1(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:r}=await import('./ipcFactory-2WMR4PH6.js');return r(t,e,o)}})};export{y as OpenRTC};
@@ -1,2 +1,2 @@
1
- var G=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,tt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_bistream_free(t,0);}get applicationCryptoWrapped(){return e.bistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let t=e.bistream_cancelSend(this.__wbg_ptr);return p(t)}get endpoint_id(){let t,n;try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.bistream_endpoint_id(o,this.__wbg_ptr);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);return t=_,n=r,C(_,r)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_export4(t,n,1);}}finishSend(){let t=e.bistream_finishSend(this.__wbg_ptr);return p(t)}get recv(){let t=e.bistream_recv(this.__wbg_ptr);return p(t)}get send(){let t=e.bistream_send(this.__wbg_ptr);return p(t)}get transport_stable_id(){try{let _=e.__wbindgen_add_to_stack_pointer(-16);e.bistream_transport_stable_id(_,this.__wbg_ptr);var t=d().getInt32(_+0,!0),n=d().getFloat64(_+8,!0);return t===0?void 0:n}finally{e.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);var $=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Rt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_intounderlyingbytesource_free(t,0);}get autoAllocateChunkSize(){return e.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}cancel(){let t=this.__destroy_into_raw();e.intounderlyingbytesource_cancel(t);}pull(t){let n=e.intounderlyingbytesource_pull(this.__wbg_ptr,u(t));return p(n)}start(t){e.intounderlyingbytesource_start(this.__wbg_ptr,u(t));}get type(){let t=e.intounderlyingbytesource_type(this.__wbg_ptr);return ht[t]}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var L=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,et.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_intounderlyingsink_free(t,0);}abort(t){let n=this.__destroy_into_raw(),_=e.intounderlyingsink_abort(n,u(t));return p(_)}close(){let t=this.__destroy_into_raw(),n=e.intounderlyingsink_close(t);return p(n)}write(t){let n=e.intounderlyingsink_write(this.__wbg_ptr,u(t));return p(n)}};Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);var U=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,nt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,nt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_intounderlyingsource_free(t,0);}cancel(){let t=this.__destroy_into_raw();e.intounderlyingsource_cancel(t);}pull(t){let n=e.intounderlyingsource_pull(this.__wbg_ptr,u(t));return p(n)}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var X=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,_t.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,_t.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_peerunistream_free(t,0);}get applicationCryptoWrapped(){return e.peerunistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let t=e.peerunistream_cancelSend(this.__wbg_ptr);return p(t)}finishSend(){let t=e.peerunistream_finishSend(this.__wbg_ptr);return p(t)}get writable(){let t=e.peerunistream_writable(this.__wbg_ptr);return p(t)}};Symbol.dispose&&(X.prototype[Symbol.dispose]=X.prototype.free);var K=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,rt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_wasmclient_free(t,0);}__acceptOpenRtcBroadcastObject(t,n,_){try{let a=e.__wbindgen_add_to_stack_pointer(-16),w=c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(n,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=k(_,e.__wbindgen_export),y=i;e.wasmclient___acceptOpenRtcBroadcastObject(a,this.__wbg_ptr,w,l,f,m,h,y);var r=d().getInt32(a+0,!0),o=d().getInt32(a+4,!0),s=d().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__acknowledgePersistentIrohOutbox(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient___acknowledgePersistentIrohOutbox(this.__wbg_ptr,n,_);return p(r)}__advancePreferredIrohCarrier(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient___advancePreferredIrohCarrier(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__applyIrohCarrierPolicy(){let t=e.wasmclient___applyIrohCarrierPolicy(this.__wbg_ptr);return p(t)}__attachMoqCarrier(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(r,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=e.wasmclient___attachMoqCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__attachWebRtcCarrier(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(r,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=e.wasmclient___attachWebRtcCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__beginMoqCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___beginMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__beginOpenRtcBroadcastPublication(t,n,_,r,o,s,a,w,l){try{let R=e.__wbindgen_add_to_stack_pointer(-16),A=c(t,e.__wbindgen_export,e.__wbindgen_export2),F=i,S=c(n,e.__wbindgen_export,e.__wbindgen_export2),M=i;var f=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i;let O=c(r,e.__wbindgen_export,e.__wbindgen_export2),T=i,N=c(o,e.__wbindgen_export,e.__wbindgen_export2),Q=i;e.wasmclient___beginOpenRtcBroadcastPublication(R,this.__wbg_ptr,A,F,S,M,f,m,O,T,N,Q,s,x(a)?Number.MAX_SAFE_INTEGER:a>>>0,x(w)?Number.MAX_SAFE_INTEGER:w>>>0,x(l)?16777215:l);var h=d().getInt32(R+0,!0),y=d().getInt32(R+4,!0),v=d().getInt32(R+8,!0);if(v)throw p(y);return p(h)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__beginOpenRtcMediaPublication(t,n,_,r,o,s,a){try{let y=e.__wbindgen_add_to_stack_pointer(-16);var w=x(t)?0:c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i;let v=c(n,e.__wbindgen_export,e.__wbindgen_export2),R=i,A=c(_,e.__wbindgen_export,e.__wbindgen_export2),F=i;e.wasmclient___beginOpenRtcMediaPublication(y,this.__wbg_ptr,w,l,v,R,A,F,r,x(o)?Number.MAX_SAFE_INTEGER:o>>>0,x(s)?Number.MAX_SAFE_INTEGER:s>>>0,x(a)?16777215:a);var f=d().getInt32(y+0,!0),m=d().getInt32(y+4,!0),h=d().getInt32(y+8,!0);if(h)throw p(m);return p(f)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__beginPreferredIrohCarrier(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=e.wasmclient___beginPreferredIrohCarrier(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__beginWebRtcCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___beginWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__closeOpenRtcBroadcast(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___closeOpenRtcBroadcast(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__configureIrohRoutePolicy(t,n,_){var r=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),o=i;let s=e.wasmclient___configureIrohRoutePolicy(this.__wbg_ptr,t,r,o,u(_));return p(s)}__configureMoqCarrier(t,n){var _=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),r=i;let o=e.wasmclient___configureMoqCarrier(this.__wbg_ptr,t,_,r);return p(o)}__configureWebRtcCarrier(t,n){let _=e.wasmclient___configureWebRtcCarrier(this.__wbg_ptr,t,n);return p(_)}__createOpenRtcBroadcastPublisherSigner(){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmclient___createOpenRtcBroadcastPublisherSigner(r,this.__wbg_ptr);var t=d().getInt32(r+0,!0),n=d().getInt32(r+4,!0),_=d().getInt32(r+8,!0);if(_)throw p(n);return p(t)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__createPersistentIrohNamespace(t,n){let _=e.wasmclient___createPersistentIrohNamespace(this.__wbg_ptr,t,n);return p(_)}__decodeOpenRtcMediaChunk(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmclient___decodeOpenRtcMediaChunk(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__decodeOpenRtcMediaControl(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmclient___decodeOpenRtcMediaControl(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__deletePersistentIrohPrefix(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient___deletePersistentIrohPrefix(this.__wbg_ptr,_,r,o,s);return p(a)}__encodeOpenRtcMediaSample(t,n,_,r,o,s){try{let h=e.__wbindgen_add_to_stack_pointer(-16),y=c(t,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(s,e.__wbindgen_export),A=i;e.wasmclient___encodeOpenRtcMediaSample(h,this.__wbg_ptr,y,v,n,_,r,o,R,A);var a=d().getInt32(h+0,!0),w=d().getInt32(h+4,!0),l=d().getInt32(h+8,!0),f=d().getInt32(h+12,!0);if(f)throw p(l);var m=P(a,w).slice();return e.__wbindgen_export4(a,w*1,1),m}finally{e.__wbindgen_add_to_stack_pointer(16);}}__flushPersistentIrohProtocols(){let t=e.wasmclient___flushPersistentIrohProtocols(this.__wbg_ptr);return p(t)}__forgetIrohCarrierPeer(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient___forgetIrohCarrierPeer(this.__wbg_ptr,n,_);return p(r)}__forgetManagedRoomGroup(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;e.wasmclient___forgetManagedRoomGroup(this.__wbg_ptr,n,_);}__getIrohCarrierReadiness(){let t=e.wasmclient___getIrohCarrierReadiness(this.__wbg_ptr);return p(t)}__getOpenRtcBroadcastStats(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient___getOpenRtcBroadcastStats(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__handleIrohCarrierControl(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=e.wasmclient___handleIrohCarrierControl(this.__wbg_ptr,r,o,s,a,u(_));return p(w)}__handleManagedRoomArtifactChunk(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___handleManagedRoomArtifactChunk(s,this.__wbg_ptr,a,w,u(n));var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__handleManagedRoomPreparePage(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___handleManagedRoomPreparePage(s,this.__wbg_ptr,a,w,u(n));var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__hydratePersistentIrohBlob(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient___hydratePersistentIrohBlob(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohAuthor(t){let n=k(t,e.__wbindgen_export),_=i,r=e.wasmclient___importPersistentIrohAuthor(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohNamespace(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=k(n,e.__wbindgen_export),w=i,l=e.wasmclient___importPersistentIrohNamespace(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__importPersistentIrohTicket(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=e.wasmclient___importPersistentIrohTicket(this.__wbg_ptr,r,o,n,_);return p(s)}__initManagedRoomGroup(t,n,_,r){try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(n,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(_,e.__wbindgen_export),A=i;var o=x(r)?0:k(r,e.__wbindgen_export),s=i;e.wasmclient___initManagedRoomGroup(f,this.__wbg_ptr,m,h,y,v,R,A,o,s);var a=d().getInt32(f+0,!0),w=d().getInt32(f+4,!0),l=d().getInt32(f+8,!0);if(l)throw p(w);return p(a)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__initPersistentIrohProtocols(t){let n=e.wasmclient___initPersistentIrohProtocols(this.__wbg_ptr,u(t));return p(n)}__moqCarrierFailed(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient___moqCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__moqCarrierPrepared(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___moqCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}__observeOpenRtcBroadcastAdapter(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient___observeOpenRtcBroadcastAdapter(o,this.__wbg_ptr,s,a,u(n));var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__openManagedRoomPayload(t,n,_,r,o,s,a,w){try{let v=e.__wbindgen_add_to_stack_pointer(-16),R=c(t,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=c(r,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=c(o,e.__wbindgen_export,e.__wbindgen_export2),O=i;var l=x(a)?0:c(a,e.__wbindgen_export,e.__wbindgen_export2),f=i;let T=k(w,e.__wbindgen_export),N=i;e.wasmclient___openManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,F,S,M,O,s,l,f,T,N);var m=d().getInt32(v+0,!0),h=d().getInt32(v+4,!0),y=d().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__openOpenRtcBroadcast(t,n,_,r,o,s){try{let h=e.__wbindgen_add_to_stack_pointer(-16),y=c(t,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(n,e.__wbindgen_export),A=i,F=c(_,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=k(r,e.__wbindgen_export),O=i;var a=x(o)?0:c(o,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___openOpenRtcBroadcast(h,this.__wbg_ptr,y,v,R,A,F,S,M,O,a,w,s);var l=d().getInt32(h+0,!0),f=d().getInt32(h+4,!0),m=d().getInt32(h+8,!0);if(m)throw p(f);return p(l)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcBroadcastPublication(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;e.wasmclient___pauseOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcMediaPublication(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___pauseOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__prepareOpenRtcBroadcastGrant(t,n,_){try{let a=e.__wbindgen_add_to_stack_pointer(-16),w=c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=k(n,e.__wbindgen_export),m=i;e.wasmclient___prepareOpenRtcBroadcastGrant(a,this.__wbg_ptr,w,l,f,m,_);var r=d().getInt32(a+0,!0),o=d().getInt32(a+4,!0),s=d().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__publishOpenRtcBroadcastSample(t,n,_,r,o,s,a){try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(n,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(a,e.__wbindgen_export),A=i;e.wasmclient___publishOpenRtcBroadcastSample(f,this.__wbg_ptr,m,h,y,v,_,r,o,s,R,A);var w=d().getInt32(f+0,!0),l=d().getInt32(f+4,!0);if(l)throw p(w)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__putPersistentIrohBytes(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=k(n,e.__wbindgen_export),a=i,w=k(_,e.__wbindgen_export),l=i,f=e.wasmclient___putPersistentIrohBytes(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__queryPersistentIrohNamespace(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient___queryPersistentIrohNamespace(this.__wbg_ptr,_,r,o,s);return p(a)}__reconcileIrohCarriersAfterNetworkChange(){let t=e.wasmclient___reconcileIrohCarriersAfterNetworkChange(this.__wbg_ptr);return p(t)}__reconcilePersistentIrohProtocols(){let t=e.wasmclient___reconcilePersistentIrohProtocols(this.__wbg_ptr);return p(t)}__releaseOpenRtcBroadcastPublisherSigner(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;return e.wasmclient___releaseOpenRtcBroadcastPublisherSigner(this.__wbg_ptr,n,_)!==0}__removePersistentIrohNamespace(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=e.wasmclient___removePersistentIrohNamespace(this.__wbg_ptr,r,o,n,_);return p(s)}__requireScopePeerAdmission(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___requireScopePeerAdmission(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireIrohCarrierPeer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient___retireIrohCarrierPeer(this.__wbg_ptr,_,r,o,s);return p(a)}__retireMoqCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient___retireMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__retireOpenRtcBroadcastPublication(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;e.wasmclient___retireOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaPublication(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___retireOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaReceiver(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient___retireOpenRtcMediaReceiver(o,this.__wbg_ptr,s,a,n);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireWebRtcCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient___retireWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__sealManagedRoomPayload(t,n,_,r,o,s,a,w){try{let v=e.__wbindgen_add_to_stack_pointer(-16),R=c(t,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=c(r,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=c(o,e.__wbindgen_export,e.__wbindgen_export2),O=i;var l=x(a)?0:c(a,e.__wbindgen_export,e.__wbindgen_export2),f=i;let T=k(w,e.__wbindgen_export),N=i;e.wasmclient___sealManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,F,S,M,O,s,l,f,T,N);var m=d().getInt32(v+0,!0),h=d().getInt32(v+4,!0),y=d().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__setIrohCarrierActionHandler(t){e.wasmclient___setIrohCarrierActionHandler(this.__wbg_ptr,x(t)?0:u(t));}__setPersistentIrohHash(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=k(n,e.__wbindgen_export),w=i,l=c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=e.wasmclient___setPersistentIrohHash(this.__wbg_ptr,o,s,a,w,l,f,r);return p(m)}__sharePersistentIrohNamespace(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient___sharePersistentIrohNamespace(this.__wbg_ptr,_,r,n);return p(o)}__shutdownPersistentIrohProtocols(){let t=e.wasmclient___shutdownPersistentIrohProtocols(this.__wbg_ptr);return p(t)}__takeOpenRtcBroadcastActions(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___takeOpenRtcBroadcastActions(s,this.__wbg_ptr,a,w,n);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__updateScopePeerAdmission(t,n,_,r){try{let a=e.__wbindgen_add_to_stack_pointer(-16),w=c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(r,e.__wbindgen_export,e.__wbindgen_export2),m=i;e.wasmclient___updateScopePeerAdmission(a,this.__wbg_ptr,w,l,n,_,f,m);var o=d().getInt32(a+0,!0),s=d().getInt32(a+4,!0);if(s)throw p(o)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__webRtcCarrierFailed(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient___webRtcCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__webRtcCarrierPrepared(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___webRtcCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}acceptSparseFanoutMessage(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=k(_,e.__wbindgen_export),l=i,f=e.wasmclient_acceptSparseFanoutMessage(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}acknowledge_session_token_response(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),f=i;let m=e.wasmclient_acknowledge_session_token_response(this.__wbg_ptr,o,s,a,w,_,l,f);return p(m)}add_peer_scope(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_add_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}bind_connection_device_id(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_bind_connection_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}bind_node_device_id(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_bind_node_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}clearConnectionApplicationCryptoKey(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;e.wasmclient_clearConnectionApplicationCryptoKey(this.__wbg_ptr,n,_);}clearIdentityCredential(){e.wasmclient_clearIdentityCredential(this.__wbg_ptr);}clear_session_tokens(){e.wasmclient_clear_session_tokens(this.__wbg_ptr);}confirm_reciprocal_admission(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;var y=x(s)?0:c(s,e.__wbindgen_export,e.__wbindgen_export2),v=i;let R=e.wasmclient_confirm_reciprocal_admission(this.__wbg_ptr,a,w,n,l,f,m,h,o,y,v);return p(R)}connect_device(t,n){var _=x(t)?0:c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;let o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_connect_device(this.__wbg_ptr,_,r,o,s);return p(a)}connect_known_device_with_token(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(n,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=e.wasmclient_connect_known_device_with_token(this.__wbg_ptr,a,w,l,f,m,h,r,!x(o),x(o)?BigInt(0):o,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(y)}connectionApplicationCryptoReady(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;return e.wasmclient_connectionApplicationCryptoReady(this.__wbg_ptr,_,r,n)!==0}connection_state(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_connection_state(this.__wbg_ptr,n,_);return p(r)}connection_states(){let t=e.wasmclient_connection_states(this.__wbg_ptr);return p(t)}createPeerDatagramPolicy(){let t=e.wasmclient_createPeerDatagramPolicy(this.__wbg_ptr);return V.__wrap(t)}create_room(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(n,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(r,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=c(o,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=e.wasmclient_create_room(this.__wbg_ptr,a,w,l,f,m,h,y,v,R,A,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(F)}create_session(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_create_session(this.__wbg_ptr,n,_);return p(r)}decodeIncomingChannelEnvelope(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmclient_decodeIncomingChannelEnvelope(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}delete_device(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_delete_device(this.__wbg_ptr,_,r,o,s);return p(a)}devices_with_status(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_devices_with_status(this.__wbg_ptr,n,_);return p(r)}disconnect(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_disconnect(this.__wbg_ptr,n,_);return p(r)}disconnect_device(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient_disconnect_device(this.__wbg_ptr,_,r,o,s);return p(a)}disconnect_transient(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_disconnect_transient(this.__wbg_ptr,n,_);return p(r)}endpoint_id_from_ticket(t){let n,_;try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i;e.wasmclient_endpoint_id_from_ticket(f,this.__wbg_ptr,m,h);var r=d().getInt32(f+0,!0),o=d().getInt32(f+4,!0),s=d().getInt32(f+8,!0),a=d().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,C(w,l)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_export4(n,_,1);}}endpoint_ticket(){let t=e.wasmclient_endpoint_ticket(this.__wbg_ptr);return p(t)}endpoint_ticket_with_token(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_endpoint_ticket_with_token(this.__wbg_ptr,_,r,n);return p(o)}ensureConnectionApplicationCrypto(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=e.wasmclient_ensureConnectionApplicationCrypto(this.__wbg_ptr,o,s,a,w,_,u(r));return p(l)}finalizeSparseFanoutMessage(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_finalizeSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}force_reconnect_snapshot(){e.wasmclient_force_reconnect_snapshot(this.__wbg_ptr);}get_members(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient_get_members(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}handleConnectionApplicationCryptoHandshake(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;var f=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),m=i;let h=k(o,e.__wbindgen_export),y=i,v=e.wasmclient_handleConnectionApplicationCryptoHandshake(this.__wbg_ptr,s,a,w,l,!x(_),x(_)?BigInt(0):_,f,m,h,y);return p(v)}incoming_streams(){let t=e.wasmclient_incoming_streams(this.__wbg_ptr);return p(t)}initIrohWithTestRelay(t,n){var _=x(t)?0:k(t,e.__wbindgen_export),r=i,o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient_initIrohWithTestRelay(this.__wbg_ptr,_,r,o,s);return p(a)}init_iroh(t){var n=x(t)?0:k(t,e.__wbindgen_export),_=i;let r=e.wasmclient_init_iroh(this.__wbg_ptr,n,_);return p(r)}inspectIncomingStreamPrefix(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=k(t,e.__wbindgen_export),w=i;e.wasmclient_inspectIncomingStreamPrefix(s,this.__wbg_ptr,a,w,n);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}iroh_path_kind(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_iroh_path_kind(this.__wbg_ptr,n,_);return p(r)}iroh_secret_key(){let t=e.wasmclient_iroh_secret_key(this.__wbg_ptr);return p(t)}iroh_transport_rtt_ms(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_iroh_transport_rtt_ms(this.__wbg_ptr,n,_);return p(r)}is_auto_connect_excluded(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;return e.wasmclient_is_auto_connect_excluded(this.__wbg_ptr,n,_)!==0}is_connected(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_is_connected(this.__wbg_ptr,n,_);return p(r)}is_current_transport_stable_id(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_is_current_transport_stable_id(this.__wbg_ptr,_,r,n);return p(o)}is_remote_admitted(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_is_remote_admitted(this.__wbg_ptr,n,_);return p(r)}join_room(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=c(r,e.__wbindgen_export,e.__wbindgen_export2),y=i,v=c(o,e.__wbindgen_export,e.__wbindgen_export2),R=i,A=e.wasmclient_join_room(this.__wbg_ptr,s,a,w,l,f,m,h,y,v,R);return p(A)}leave_room(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient_leave_room(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}list_managed_connections(){let t=e.wasmclient_list_managed_connections(this.__wbg_ptr);return p(t)}constructor(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient_new(o,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return this.__wbg_ptr=n,rt.register(this,this.__wbg_ptr,this),this}finally{e.__wbindgen_add_to_stack_pointer(16);}}node_addr(){let t=e.wasmclient_node_addr(this.__wbg_ptr);return p(t)}observe_known_device_endpoint(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_observe_known_device_endpoint(this.__wbg_ptr,_,r,o,s);return p(a)}openConnectionApplicationPayload(t,n,_){try{let l=e.__wbindgen_add_to_stack_pointer(-16),f=c(t,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=k(_,e.__wbindgen_export),y=i;e.wasmclient_openConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=d().getInt32(l+0,!0),o=d().getInt32(l+4,!0),s=d().getInt32(l+8,!0),a=d().getInt32(l+12,!0);if(a)throw p(s);var w=P(r,o).slice();return e.__wbindgen_export4(r,o*1,1),w}finally{e.__wbindgen_add_to_stack_pointer(16);}}open_bi(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_open_bi(this.__wbg_ptr,n,_);return p(r)}open_native_main_control_bi(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_open_native_main_control_bi(this.__wbg_ptr,n,_);return p(r)}open_peer_bi(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_bi(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_explicit_file_sender(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_bi_explicit_file_sender(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_transport_only(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_bi_transport_only(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_uni(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_uni(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_uni(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_open_uni(this.__wbg_ptr,n,_);return p(r)}peerDatagramMaxSize(){return e.wasmclient_peerDatagramMaxSize(this.__wbg_ptr)>>>0}peer_scopes(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_peer_scopes(this.__wbg_ptr,n,_);return p(r)}peer_session(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_peer_session(this.__wbg_ptr,n,_);return p(r)}peer_sessions(){let t=e.wasmclient_peer_sessions(this.__wbg_ptr);return p(t)}peer_snapshot(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_peer_snapshot(this.__wbg_ptr,n,_);return p(r)}prepareSparseFanoutMessage(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_prepareSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}prepare_reciprocal_admission(t,n,_,r,o,s,a,w){let l=c(t,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(r,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=c(o,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=c(s,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=c(a,e.__wbindgen_export,e.__wbindgen_export2),O=i,T=c(w,e.__wbindgen_export,e.__wbindgen_export2),N=i,Q=e.wasmclient_prepare_reciprocal_admission(this.__wbg_ptr,l,f,n,m,h,y,v,R,A,F,S,M,O,T,N);return p(Q)}present_session_token(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;let y=e.wasmclient_present_session_token(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}protectConnectionApplicationPayload(t,n,_){try{let l=e.__wbindgen_add_to_stack_pointer(-16),f=c(t,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=k(_,e.__wbindgen_export),y=i;e.wasmclient_protectConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=d().getInt32(l+0,!0),o=d().getInt32(l+4,!0),s=d().getInt32(l+8,!0),a=d().getInt32(l+12,!0);if(a)throw p(s);var w=P(r,o).slice();return e.__wbindgen_export4(r,o*1,1),w}finally{e.__wbindgen_add_to_stack_pointer(16);}}rankRoutes(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=it(t,e.__wbindgen_export),w=i,l=it(n,e.__wbindgen_export),f=i;e.wasmclient_rankRoutes(s,this.__wbg_ptr,a,w,l,f);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=Ct(_,r).slice();return e.__wbindgen_export4(_,r*4,4),o}finally{e.__wbindgen_add_to_stack_pointer(16);}}receivePeerDatagram(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_receivePeerDatagram(this.__wbg_ptr,n,_);return p(r)}recordSparseFanoutForwardQueueDrop(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_recordSparseFanoutForwardQueueDrop(this.__wbg_ptr,_,r,n);return p(o)}register_session_token(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient_register_session_token(this.__wbg_ptr,r,o,s,a,_);}register_token_until(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient_register_token_until(this.__wbg_ptr,o,s,a,w,_,r);}reject_connection_admission(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_reject_connection_admission(this.__wbg_ptr,_,r,o,s);return p(a)}release_peer_scope(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient_release_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}report_managed_connection_settled(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i;let m=e.wasmclient_report_managed_connection_settled(this.__wbg_ptr,a,w,n,l,f,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(m)}report_transport_status(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(n,e.__wbindgen_export,e.__wbindgen_export2),f=i;var m=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i;let y=e.wasmclient_report_transport_status(this.__wbg_ptr,a,w,l,f,m,h,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(y)}resolve_peer_connection_records(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_resolve_peer_connection_records(this.__wbg_ptr,n,_);return p(r)}revoke_session_token(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient_revoke_session_token(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}revoke_tokens_by_scope(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_revoke_tokens_by_scope(this.__wbg_ptr,n,_);return p(r)}runtime_policy(){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmclient_runtime_policy(r,this.__wbg_ptr);var t=d().getInt32(r+0,!0),n=d().getInt32(r+4,!0),_=d().getInt32(r+8,!0);if(_)throw p(n);return p(t)}finally{e.__wbindgen_add_to_stack_pointer(16);}}same_peer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_same_peer(this.__wbg_ptr,_,r,o,s);return p(a)}search_devices(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_search_devices(this.__wbg_ptr,n,_);return p(r)}sendPeerDatagram(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=k(n,e.__wbindgen_export),a=i,w=e.wasmclient_sendPeerDatagram(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}send_message(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;let y=e.wasmclient_send_message(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}send_native_main_control_frame(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_send_native_main_control_frame(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_send_peer(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer_application_frame(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=k(n,e.__wbindgen_export),a=i,w=e.wasmclient_send_peer_application_frame(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}setConnectionApplicationCryptoKey(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_setConnectionApplicationCryptoKey(this.__wbg_ptr,_,r,o,s);return p(a)}setConnectionApplicationCryptoRequired(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient_setConnectionApplicationCryptoRequired(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}setIdentityCredential(t){var n=x(t)?0:c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;e.wasmclient_setIdentityCredential(this.__wbg_ptr,n,_);}setRelay(t){let n=e.wasmclient_setRelay(this.__wbg_ptr,t);return p(n)}set_auto_connect_excluded(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_set_auto_connect_excluded(this.__wbg_ptr,_,r,n);return p(o)}set_offline(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_set_offline(this.__wbg_ptr,n,_);return p(r)}sparseFanoutDiagnostics(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_sparseFanoutDiagnostics(this.__wbg_ptr,n,_);return p(r)}start_auto_connect(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;e.wasmclient_start_auto_connect(o,this.__wbg_ptr,s,a,w,l);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}start_presence_loop(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i;var m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;e.wasmclient_start_presence_loop(this.__wbg_ptr,o,s,a,w,l,f,m,h);}stop_auth_scoped_activity(){e.wasmclient_stop_auth_scoped_activity(this.__wbg_ptr);}stop_auto_connect(){e.wasmclient_stop_auto_connect(this.__wbg_ptr);}stop_presence_loop(){e.wasmclient_stop_presence_loop(this.__wbg_ptr);}submit_browser_desired_peers(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient_submit_browser_desired_peers(s,this.__wbg_ptr,t,a,w);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{e.__wbindgen_add_to_stack_pointer(16);}}submit_browser_desired_peers_with_sparse_fanout(t,n,_,r,o,s){let a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=x(o)?0:c(o,e.__wbindgen_export,e.__wbindgen_export2),v=i;let R=e.wasmclient_submit_browser_desired_peers_with_sparse_fanout(this.__wbg_ptr,t,a,w,l,f,m,h,y,v,x(s)?16777215:s?1:0);return p(R)}update_device(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;var f=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=x(o)?0:c(o,e.__wbindgen_export,e.__wbindgen_export2),y=i;let v=e.wasmclient_update_device(this.__wbg_ptr,s,a,w,l,f,m,x(r)?0:u(r),h,y);return p(v)}update_presence(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i;var h=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),y=i;let v=e.wasmclient_update_presence(this.__wbg_ptr,s,a,w,l,f,m,h,y,!x(o),x(o)?BigInt(0):o);return p(v)}update_session(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_update_session(this.__wbg_ptr,_,r,o,s);return p(a)}validate_connection_token(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i;var w=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i;let f=e.wasmclient_validate_connection_token(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}validate_session_token(t){let n,_;try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i;e.wasmclient_validate_session_token(f,this.__wbg_ptr,m,h);var r=d().getInt32(f+0,!0),o=d().getInt32(f+4,!0),s=d().getInt32(f+8,!0),a=d().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,C(w,l)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_export4(n,_,1);}}wait_for_peer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_wait_for_peer(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wait_for_settled_scope(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_wait_for_settled_scope(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wake_browser_auto_connect(){return e.wasmclient_wake_browser_auto_connect(this.__wbg_ptr)!==0}};Symbol.dispose&&(K.prototype[Symbol.dispose]=K.prototype.free);var V=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,ot.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ot.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_wasmpeerdatagrampolicy_free(t,0);}close(){e.wasmpeerdatagrampolicy_close(this.__wbg_ptr);}closeIncoming(){e.wasmpeerdatagrampolicy_closeIncoming(this.__wbg_ptr);}closeOutgoing(){e.wasmpeerdatagrampolicy_closeOutgoing(this.__wbg_ptr);}getStats(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_getStats(o,this.__wbg_ptr,t);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}popIncoming(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_popIncoming(r,this.__wbg_ptr,t);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);let o;return n!==0&&(o=P(n,_).slice(),e.__wbindgen_export4(n,_*1,1)),o}finally{e.__wbindgen_add_to_stack_pointer(16);}}popOutgoing(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_popOutgoing(o,this.__wbg_ptr,t);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}pushIncoming(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmpeerdatagrampolicy_pushIncoming(o,this.__wbg_ptr,s,a,n);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}pushOutgoing(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=k(t,e.__wbindgen_export),w=i;e.wasmpeerdatagrampolicy_pushOutgoing(s,this.__wbg_ptr,a,w,n);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{e.__wbindgen_add_to_stack_pointer(16);}}recordExpiredOutgoing(){e.wasmpeerdatagrampolicy_recordExpiredOutgoing(this.__wbg_ptr);}recordSendFailure(){e.wasmpeerdatagrampolicy_recordSendFailure(this.__wbg_ptr);}recordSent(t){e.wasmpeerdatagrampolicy_recordSent(this.__wbg_ptr,t);}setIncomingMaxAge(t,n){e.wasmpeerdatagrampolicy_setIncomingMaxAge(this.__wbg_ptr,x(t)?Number.MAX_SAFE_INTEGER:t>>>0,n);}setIncomingMaxBufferedDatagrams(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_setIncomingMaxBufferedDatagrams(r,this.__wbg_ptr,t);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}setOutgoingMaxAge(t){e.wasmpeerdatagrampolicy_setOutgoingMaxAge(this.__wbg_ptr,x(t)?Number.MAX_SAFE_INTEGER:t>>>0);}setOutgoingMaxBufferedDatagrams(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_setOutgoingMaxBufferedDatagrams(r,this.__wbg_ptr,t);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);function Bt(){e.start();}function st(){return {__proto__:null,"./openrtc_bg.js":{__proto__:null,__wbg_Error_9dc85fe1bc224456:function(t,n){let _=Error(C(t,n));return u(_)},__wbg_Number_4779d427bae39753:function(t){return Number(g(t))},__wbg_String_8564e559799eccda:function(t,n){let _=String(g(n)),r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg___wbindgen_bigint_get_as_i64_8ea6736501f396b6:function(t,n){let _=g(n),r=typeof _=="bigint"?_:void 0;d().setBigInt64(t+8,x(r)?BigInt(0):r,true),d().setInt32(t+0,!x(r),true);},__wbg___wbindgen_boolean_get_b131b2f36d6b2f55:function(t){let n=g(t),_=typeof n=="boolean"?n:void 0;return x(_)?16777215:_?1:0},__wbg___wbindgen_debug_string_56c147eb1a51f0c4:function(t,n){let _=Z(g(n)),r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg___wbindgen_in_ce8569b2fc6f5088:function(t,n){return g(t)in g(n)},__wbg___wbindgen_is_bigint_df272c65456269c2:function(t){return typeof g(t)=="bigint"},__wbg___wbindgen_is_function_147961669f068cd4:function(t){return typeof g(t)=="function"},__wbg___wbindgen_is_null_ced4761460071341:function(t){return g(t)===null},__wbg___wbindgen_is_object_3a2c414391dbf751:function(t){let n=g(t);return typeof n=="object"&&n!==null},__wbg___wbindgen_is_string_6541b0f6ecd4e8e5:function(t){return typeof g(t)=="string"},__wbg___wbindgen_is_undefined_4410e3c20a99fa97:function(t){return g(t)===void 0},__wbg___wbindgen_jsval_eq_174c93ec61bab0c5:function(t,n){return g(t)===g(n)},__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c:function(t,n){return g(t)==g(n)},__wbg___wbindgen_number_get_588ed6b97f0d7e14:function(t,n){let _=g(n),r=typeof _=="number"?_:void 0;d().setFloat64(t+8,x(r)?0:r,true),d().setInt32(t+0,!x(r),true);},__wbg___wbindgen_string_get_fa2687d531ed17a5:function(t,n){let _=g(n),r=typeof _=="string"?_:void 0;var o=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),s=i;d().setInt32(t+4,s,true),d().setInt32(t+0,o,true);},__wbg___wbindgen_throw_bbadd78c1bac3a77:function(t,n){throw new Error(C(t,n))},__wbg__wbg_cb_unref_c2301a3c9b78104b:function(t){g(t)._wbg_cb_unref();},__wbg_abort_56c00f462c9261d9:function(t,n){g(t).abort(g(n));},__wbg_abort_f2416f4a9852003e:function(t){g(t).abort();},__wbg_addEventListener_b635263c509aa7de:function(){return I(function(t,n,_,r){g(t).addEventListener(C(n,_),g(r));},arguments)},__wbg_append_c5a0c94a6a73b22e:function(){return I(function(t,n,_,r,o){g(t).append(C(n,_),C(r,o));},arguments)},__wbg_apply_5d99f956e2dda74d:function(){return I(function(t,n,_){let r=g(t).apply(g(n),g(_));return u(r)},arguments)},__wbg_arrayBuffer_cc7704fa158b907a:function(){return I(function(t){let n=g(t).arrayBuffer();return u(n)},arguments)},__wbg_bistream_new:function(t){let n=G.__wrap(t);return u(n)},__wbg_body_442a47f02322d7b0:function(t){let n=g(t).body;return x(n)?0:u(n)},__wbg_buffer_8524b3453cde4918:function(t){let n=g(t).buffer;return u(n)},__wbg_bufferedAmount_c1581bbb06f4f36c:function(t){return g(t).bufferedAmount},__wbg_byobRequest_cc72d210de793e64:function(t){let n=g(t).byobRequest;return x(n)?0:u(n)},__wbg_byteLength_96807b1d9ab24a4c:function(t){return g(t).byteLength},__wbg_byteOffset_a9c7002428843c41:function(t){return g(t).byteOffset},__wbg_call_91f00ddc43e01490:function(){return I(function(t,n){let _=g(t).call(g(n));return u(_)},arguments)},__wbg_call_ec09a4cf93377d3a:function(){return I(function(t,n,_){let r=g(t).call(g(n),g(_));return u(r)},arguments)},__wbg_cancel_f3a197b26dc88b39:function(t){let n=g(t).cancel();return u(n)},__wbg_catch_66060324c27be6f7:function(t,n){let _=g(t).catch(g(n));return u(_)},__wbg_clearTimeout_113b1cde814ec762:function(t){let n=clearTimeout(p(t));return u(n)},__wbg_clearTimeout_333bba87532ab9d3:function(t){let n=clearTimeout(p(t));return u(n)},__wbg_clearTimeout_47a40e3be01ed7a3:function(){return I(function(t,n){g(t).clearTimeout(p(n));},arguments)},__wbg_close_296263cfe1bb2999:function(){return I(function(t){g(t).close();},arguments)},__wbg_close_388d99468213b286:function(){return I(function(t){g(t).close();},arguments)},__wbg_close_4857e22d08b71356:function(){return I(function(t){g(t).close();},arguments)},__wbg_close_f3365df7ba1b74d3:function(t){g(t).close();},__wbg_code_1cda2855fcd9b009:function(t){return g(t).code},__wbg_code_70beb7b22374d55e:function(t){return g(t).code},__wbg_crypto_38df2bab126b63dc:function(t){let n=g(t).crypto;return u(n)},__wbg_data_8a04443c1e5a8cd3:function(t){let n=g(t).data;return u(n)},__wbg_debug_de823612d4d12f74:function(t){console.debug(g(t));},__wbg_dispatchEvent_cc62a6a43d28b01c:function(){return I(function(t,n){return g(t).dispatchEvent(g(n))},arguments)},__wbg_done_6a8439e544ec6206:function(t){return g(t).done},__wbg_enqueue_bbeb09ba0b140f76:function(){return I(function(t,n){g(t).enqueue(g(n));},arguments)},__wbg_entries_4e00eefd3fd54cf1:function(t){let n=g(t).entries();return u(n)},__wbg_entries_5a6a7e7e0df09fe5:function(t){let n=Object.entries(g(t));return u(n)},__wbg_error_6651fee1c71e5da9:function(t){console.error(g(t));},__wbg_error_9a99766f65a03031:function(t,n){console.error(g(t),g(n));},__wbg_error_a6fa202b58aa1cd3:function(t,n){let _,r;try{_=t,r=n,console.error(C(t,n));}finally{e.__wbindgen_export4(_,r,1);}},__wbg_fetch_074561c3e313c86f:function(t){let n=fetch(g(t));return u(n)},__wbg_fetch_22858a12fcf93152:function(t,n){let _=g(t).fetch(g(n));return u(_)},__wbg_from_8a57180716c586ee:function(t){let n=Array.from(g(t));return u(n)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return I(function(t,n){g(t).getRandomValues(g(n));},arguments)},__wbg_getRandomValues_cc7f052a444bb2ce:function(){return I(function(t,n){globalThis.crypto.getRandomValues(P(t,n));},arguments)},__wbg_getReader_9facd4f899beac89:function(){return I(function(t){let n=g(t).getReader();return u(n)},arguments)},__wbg_get_44e98e27bda25b5b:function(){return I(function(t,n){let _=Reflect.get(g(t),g(n));return u(_)},arguments)},__wbg_get_4b90d6d8c5deb5d5:function(t,n){let _=g(t)[n>>>0];return u(_)},__wbg_get_52a8a619f7b88df6:function(){return I(function(t,n){let _=Reflect.get(g(t),g(n));return u(_)},arguments)},__wbg_get_done_c21b9933fc9a9e9c:function(t){let n=g(t).done;return x(n)?16777215:n?1:0},__wbg_get_unchecked_46e778e3cec74b5e:function(t,n){let _=g(t)[n>>>0];return u(_)},__wbg_get_value_ad568c7d3db9073f:function(t){let n=g(t).value;return u(n)},__wbg_get_with_ref_key_6412cf3094599694:function(t,n){let _=g(t)[g(n)];return u(_)},__wbg_has_14676d88c1340d2c:function(){return I(function(t,n){return Reflect.has(g(t),g(n))},arguments)},__wbg_headers_5b19cf40627ae54d:function(t){let n=g(t).headers;return u(n)},__wbg_info_a2b5f8a5dae8b26c:function(t){console.info(g(t));},__wbg_instanceof_ArrayBuffer_a581da923203f29f:function(t){let n;try{n=g(t)instanceof ArrayBuffer;}catch{n=false;}return n},__wbg_instanceof_Blob_5c4e145be35f9b1e:function(t){let n;try{n=g(t)instanceof Blob;}catch{n=false;}return n},__wbg_instanceof_Map_7f94c740225003e2:function(t){let n;try{n=g(t)instanceof Map;}catch{n=false;}return n},__wbg_instanceof_Promise_aa24ea31000d4ee6:function(t){let n;try{n=g(t)instanceof Promise;}catch{n=false;}return n},__wbg_instanceof_Response_36a65a969abaa7c6:function(t){let n;try{n=g(t)instanceof Response;}catch{n=false;}return n},__wbg_instanceof_Uint8Array_b6fe1ac89eba107e:function(t){let n;try{n=g(t)instanceof Uint8Array;}catch{n=false;}return n},__wbg_instanceof_Window_9e0fe7d3d1ff4342:function(t){let n;try{n=g(t)instanceof Window;}catch{n=false;}return n},__wbg_isArray_139f48e3c057ede8:function(t){return Array.isArray(g(t))},__wbg_isSafeInteger_c22ccb4af2201fe9:function(t){return Number.isSafeInteger(g(t))},__wbg_iterator_9b36cebf3be7b7cd:function(){return u(Symbol.iterator)},__wbg_length_68a9d5278d084f4f:function(t){return g(t).length},__wbg_length_fb04d16d7bdf6d4c:function(t){return g(t).length},__wbg_log_6614a4effdb4e983:function(t){console.log(g(t));},__wbg_maxRetransmits_dfa0382c31f8e2ca:function(t){let n=g(t).maxRetransmits;return x(n)?16777215:n},__wbg_message_12958526424a887b:function(t,n){let _=g(n).message,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_msCrypto_bd5a034af96bcba6:function(t){let n=g(t).msCrypto;return u(n)},__wbg_new_0b303268aa395a38:function(){let t=new Array;return u(t)},__wbg_new_189262ff31890c23:function(){return I(function(){let t=new Headers;return u(t)},arguments)},__wbg_new_20b778a4c5c691c3:function(){let t=new Object;return u(t)},__wbg_new_227d7c05414eb861:function(){let t=new Error;return u(t)},__wbg_new_24739629d416f982:function(){return I(function(){let t=new AbortController;return u(t)},arguments)},__wbg_new_5fae30e6b23db8df:function(t,n){let _=new Error(C(t,n));return u(_)},__wbg_new_883c0db065f06efd:function(){return u(new Map)},__wbg_new_a3e5112401a82338:function(){return I(function(t,n){let _=new WebSocket(C(t,n));return u(_)},arguments)},__wbg_new_b06772b280cc6e52:function(t){let n=new Uint8Array(g(t));return u(n)},__wbg_new_from_slice_bb2d1778c0b87eb1:function(t,n){let _=new Uint8Array(P(t,n));return u(_)},__wbg_new_typed_90c3f6c29ba36d19:function(t,n){try{var _={a:t,b:n},r=(s,a)=>{let w=_.a;_.a=0;try{return xt(w,_.b,s,a)}finally{_.a=w;}};let o=new Promise(r);return u(o)}finally{_.a=0;}},__wbg_new_with_byte_offset_and_length_9e1e664fe1a5d385:function(t,n,_){let r=new Uint8Array(g(t),n>>>0,_>>>0);return u(r)},__wbg_new_with_event_init_dict_bd850674488710b1:function(){return I(function(t,n,_){let r=new CustomEvent(C(t,n),g(_));return u(r)},arguments)},__wbg_new_with_into_underlying_sink_2596343f9b6c8e58:function(t){let n=new WritableStream(L.__wrap(t));return u(n)},__wbg_new_with_into_underlying_source_fd904252f385f59c:function(t,n){let _=new ReadableStream(U.__wrap(t),p(n));return u(_)},__wbg_new_with_length_4b57a7a5dc67221c:function(t){let n=new Uint8Array(t>>>0);return u(n)},__wbg_new_with_str_and_init_df876572184fe639:function(){return I(function(t,n,_){let r=new Request(C(t,n),g(_));return u(r)},arguments)},__wbg_new_with_str_sequence_505a4829cc247e79:function(){return I(function(t,n,_){let r=new WebSocket(C(t,n),g(_));return u(r)},arguments)},__wbg_next_8cb028b6ba50743f:function(){return I(function(t){let n=g(t).next();return u(n)},arguments)},__wbg_next_cfd0b146c9538df8:function(t){let n=g(t).next;return u(n)},__wbg_node_84ea875411254db1:function(t){let n=g(t).node;return u(n)},__wbg_now_bce4dc999095ea77:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(t){return g(t).now()},__wbg_parse_a5c06e19bc1187fd:function(t,n){return Date.parse(C(t,n))},__wbg_peerunistream_new:function(t){let n=X.__wrap(t);return u(n)},__wbg_performance_3fcf6e32a7e1ed0a:function(t){let n=g(t).performance;return u(n)},__wbg_process_44c7a14e11e9f69e:function(t){let n=g(t).process;return u(n)},__wbg_protocol_28aaef5ea42981d6:function(t,n){let _=g(n).protocol,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_prototypesetcall_956c7493c68e29b4:function(t,n,_){Uint8Array.prototype.set.call(P(t,n),g(_));},__wbg_push_ceb8ef046afb2041:function(t,n){return g(t).push(g(n))},__wbg_queueMicrotask_4698f900840e3286:function(t){queueMicrotask(g(t));},__wbg_queueMicrotask_477a5533c7100338:function(t){let n=g(t).queueMicrotask;return u(n)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return I(function(t,n){g(t).randomFillSync(p(n));},arguments)},__wbg_read_8426c146431f2905:function(t){let n=g(t).read();return u(n)},__wbg_readyState_25243ad6ce649774:function(t){return g(t).readyState},__wbg_reason_4ec455bac79b33ce:function(t,n){let _=g(n).reason,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_releaseLock_188846ef719acb10:function(t){g(t).releaseLock();},__wbg_removeEventListener_016c1d24523b4730:function(){return I(function(t,n,_,r){g(t).removeEventListener(C(n,_),g(r));},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return I(function(){let t=module.require;return u(t)},arguments)},__wbg_resolve_0183de2e8c6b1d54:function(t){let n=Promise.resolve(g(t));return u(n)},__wbg_respond_3cdb4cf32683fd79:function(){return I(function(t,n){g(t).respond(n>>>0);},arguments)},__wbg_send_77521d09456dd693:function(){return I(function(t,n,_){g(t).send(P(n,_));},arguments)},__wbg_send_99d049cae69c53cc:function(){return I(function(t,n,_){g(t).send(P(n,_));},arguments)},__wbg_send_bac9d3dc4f21ef28:function(){return I(function(t,n,_){g(t).send(C(n,_));},arguments)},__wbg_setTimeout_3a808dd861dd3c12:function(t,n){let _=setTimeout(g(t),n);return u(_)},__wbg_setTimeout_6613a51400c1bf9f:function(){return I(function(t,n,_){let r=g(t).setTimeout(p(n),_);return u(r)},arguments)},__wbg_setTimeout_ef24d2fc3ad97385:function(){return I(function(t,n){let _=setTimeout(g(t),n);return u(_)},arguments)},__wbg_set_5f806304fb633ab3:function(t,n,_){let r=g(t).set(g(n),g(_));return u(r)},__wbg_set_6be42768c690e380:function(t,n,_){g(t)[p(n)]=p(_);},__wbg_set_86698c227e5b9dad:function(t,n,_){g(t).set(P(n,_));},__wbg_set_a6ba3ac0e634b822:function(){return I(function(t,n,_){return Reflect.set(g(t),g(n),g(_))},arguments)},__wbg_set_binaryType_07905e4563fcd9b2:function(t,n){g(t).binaryType=kt[n];},__wbg_set_binaryType_8c2dd2cf1cfc2e28:function(t,n){g(t).binaryType=mt[n];},__wbg_set_body_d1153b16a2b95ca1:function(t,n){g(t).body=g(n);},__wbg_set_bufferedAmountLowThreshold_8969a2db2c745257:function(t,n){g(t).bufferedAmountLowThreshold=n>>>0;},__wbg_set_cache_5a01a8b5e6ca6cf2:function(t,n){g(t).cache=yt[n];},__wbg_set_credentials_e9120ed88b1fc0b8:function(t,n){g(t).credentials=vt[n];},__wbg_set_da33c120a6584674:function(t,n,_){g(t)[n>>>0]=p(_);},__wbg_set_detail_c7af5edea934390b:function(t,n){g(t).detail=g(n);},__wbg_set_handle_event_6147c38b782c7b42:function(t,n){g(t).handleEvent=g(n);},__wbg_set_headers_877ed41890d28af2:function(t,n){g(t).headers=g(n);},__wbg_set_high_water_mark_77da20c49668427d:function(t,n){g(t).highWaterMark=n;},__wbg_set_method_b4ede299b2064f37:function(t,n,_){g(t).method=C(n,_);},__wbg_set_mode_d6c2e1991aa963c6:function(t,n){g(t).mode=It[n];},__wbg_set_onbufferedamountlow_b695487bdd219f98:function(t,n){g(t).onbufferedamountlow=g(n);},__wbg_set_onclose_9cb5c3372e16c192:function(t,n){g(t).onclose=g(n);},__wbg_set_onclose_f8bec1cbeb64aa93:function(t,n){g(t).onclose=g(n);},__wbg_set_onerror_190fe67e911ebf28:function(t,n){g(t).onerror=g(n);},__wbg_set_onmessage_4d57c4ddab951294:function(t,n){g(t).onmessage=g(n);},__wbg_set_onmessage_96337495f0bfb796:function(t,n){g(t).onmessage=g(n);},__wbg_set_onopen_3e2bf6b11d434c2d:function(t,n){g(t).onopen=g(n);},__wbg_set_signal_9022b5aa06a6ce5b:function(t,n){g(t).signal=g(n);},__wbg_signal_41dd1a8913cd0b7d:function(t){let n=g(t).signal;return u(n)},__wbg_stack_3b0d974bbf31e44f:function(t,n){let _=g(n).stack,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_static_accessor_GLOBAL_60a4124bab7dcc9a:function(){let t=typeof global>"u"?null:global;return x(t)?0:u(t)},__wbg_static_accessor_GLOBAL_THIS_95ca6460658b5d13:function(){let t=typeof globalThis>"u"?null:globalThis;return x(t)?0:u(t)},__wbg_static_accessor_SELF_4c95f759a91e9aae:function(){let t=typeof self>"u"?null:self;return x(t)?0:u(t)},__wbg_static_accessor_WINDOW_44b435597f9e9ee7:function(){let t=typeof window>"u"?null:window;return x(t)?0:u(t)},__wbg_status_9e6505cfa3e73a7c:function(t){return g(t).status},__wbg_subarray_42216645a367cd7a:function(t,n,_){let r=g(t).subarray(n>>>0,_>>>0);return u(r)},__wbg_then_254bab9b266a77a5:function(t,n,_){let r=g(t).then(g(n),g(_));return u(r)},__wbg_then_3ea18602c6a5123b:function(t,n){let _=g(t).then(g(n));return u(_)},__wbg_url_72c67c175685a054:function(t,n){let _=g(n).url,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_url_d0b8042af0d1bbba:function(t,n){let _=g(n).url,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_value_3d3defe09fb1ffca:function(t){let n=g(t).value;return u(n)},__wbg_versions_276b2795b1c6a219:function(t){let n=g(t).versions;return u(n)},__wbg_view_15fa5865c6b336e3:function(t){let n=g(t).view;return x(n)?0:u(n)},__wbg_warn_633bacc13ba7e6c3:function(t){console.warn(g(t));},__wbg_wasClean_f17429d064911939:function(t){return g(t).wasClean},__wbindgen_cast_0000000000000001:function(t,n){let _=B(t,n,dt);return u(_)},__wbindgen_cast_0000000000000002:function(t,n){let _=B(t,n,ft);return u(_)},__wbindgen_cast_0000000000000003:function(t,n){let _=B(t,n,wt);return u(_)},__wbindgen_cast_0000000000000004:function(t,n){let _=B(t,n,ut);return u(_)},__wbindgen_cast_0000000000000005:function(t,n){let _=B(t,n,lt);return u(_)},__wbindgen_cast_0000000000000006:function(t,n){let _=B(t,n,at);return u(_)},__wbindgen_cast_0000000000000007:function(t,n){let _=B(t,n,pt);return u(_)},__wbindgen_cast_0000000000000008:function(t,n){let _=Ft(t,n,gt);return u(_)},__wbindgen_cast_0000000000000009:function(t,n){let _=B(t,n,bt);return u(_)},__wbindgen_cast_000000000000000a:function(t){return u(t)},__wbindgen_cast_000000000000000b:function(t){return u(t)},__wbindgen_cast_000000000000000c:function(t,n){let _=P(t,n);return u(_)},__wbindgen_cast_000000000000000d:function(t,n){let _=C(t,n);return u(_)},__wbindgen_cast_000000000000000e:function(t){let n=BigInt.asUintN(64,t);return u(n)},__wbindgen_cast_000000000000000f:function(t,n){var _=P(t,n).slice();return e.__wbindgen_export4(t,n*1,1),u(_)},__wbindgen_object_clone_ref:function(t){let n=g(t);return u(n)},__wbindgen_object_drop_ref:function(t){p(t);}}}}function at(b,t){e.__wasm_bindgen_func_elem_29035(b,t);}function pt(b,t){e.__wasm_bindgen_func_elem_30168(b,t);}function gt(b,t){e.__wasm_bindgen_func_elem_30235(b,t);}function bt(b,t){e.__wasm_bindgen_func_elem_38193(b,t);}function dt(b,t,n){e.__wasm_bindgen_func_elem_29235(b,t,u(n));}function wt(b,t,n){e.__wasm_bindgen_func_elem_26606(b,t,u(n));}function ut(b,t,n){e.__wasm_bindgen_func_elem_5971(b,t,u(n));}function lt(b,t,n){e.__wasm_bindgen_func_elem_30904(b,t,u(n));}function ft(b,t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.__wasm_bindgen_func_elem_39696(o,b,t,u(n));var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}function xt(b,t,n,_){e.__wasm_bindgen_func_elem_39698(b,t,u(n),u(_));}var mt=["blob","arraybuffer"],ht=["bytes"],yt=["default","no-store","reload","no-cache","force-cache","only-if-cached"],vt=["omit","same-origin","include"],It=["same-origin","no-cors","cors","navigate"],kt=["arraybuffer","blob"],tt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_bistream_free(b,1)),Rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_intounderlyingbytesource_free(b,1)),et=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_intounderlyingsink_free(b,1)),nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_intounderlyingsource_free(b,1)),_t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_peerunistream_free(b,1)),rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_wasmclient_free(b,1)),ot=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_wasmpeerdatagrampolicy_free(b,1));function u(b){D===E.length&&E.push(E.length+1);let t=D;return D=E[t],E[t]=b,t}var J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbindgen_export5(b.a,b.b));function Z(b){let t=typeof b;if(t=="number"||t=="boolean"||b==null)return `${b}`;if(t=="string")return `"${b}"`;if(t=="symbol"){let r=b.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){let r=b.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(b)){let r=b.length,o="[";r>0&&(o+=Z(b[0]));for(let s=1;s<r;s++)o+=", "+Z(b[s]);return o+="]",o}let n=/\[object ([^\]]+)\]/.exec(toString.call(b)),_;if(n&&n.length>1)_=n[1];else return toString.call(b);if(_=="Object")try{return "Object("+JSON.stringify(b)+")"}catch{return "Object"}return b instanceof Error?`${b.name}: ${b.message}
1
+ var G=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,tt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_bistream_free(t,0);}get applicationCryptoWrapped(){return e.bistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let t=e.bistream_cancelSend(this.__wbg_ptr);return p(t)}get endpoint_id(){let t,n;try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.bistream_endpoint_id(o,this.__wbg_ptr);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);return t=_,n=r,C(_,r)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_export4(t,n,1);}}finishSend(){let t=e.bistream_finishSend(this.__wbg_ptr);return p(t)}get recv(){let t=e.bistream_recv(this.__wbg_ptr);return p(t)}get send(){let t=e.bistream_send(this.__wbg_ptr);return p(t)}get transport_stable_id(){try{let _=e.__wbindgen_add_to_stack_pointer(-16);e.bistream_transport_stable_id(_,this.__wbg_ptr);var t=d().getInt32(_+0,!0),n=d().getFloat64(_+8,!0);return t===0?void 0:n}finally{e.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);var $=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Rt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_intounderlyingbytesource_free(t,0);}get autoAllocateChunkSize(){return e.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}cancel(){let t=this.__destroy_into_raw();e.intounderlyingbytesource_cancel(t);}pull(t){let n=e.intounderlyingbytesource_pull(this.__wbg_ptr,u(t));return p(n)}start(t){e.intounderlyingbytesource_start(this.__wbg_ptr,u(t));}get type(){let t=e.intounderlyingbytesource_type(this.__wbg_ptr);return ht[t]}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var L=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,et.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_intounderlyingsink_free(t,0);}abort(t){let n=this.__destroy_into_raw(),_=e.intounderlyingsink_abort(n,u(t));return p(_)}close(){let t=this.__destroy_into_raw(),n=e.intounderlyingsink_close(t);return p(n)}write(t){let n=e.intounderlyingsink_write(this.__wbg_ptr,u(t));return p(n)}};Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);var U=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,nt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,nt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_intounderlyingsource_free(t,0);}cancel(){let t=this.__destroy_into_raw();e.intounderlyingsource_cancel(t);}pull(t){let n=e.intounderlyingsource_pull(this.__wbg_ptr,u(t));return p(n)}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var X=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,_t.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,_t.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_peerunistream_free(t,0);}get applicationCryptoWrapped(){return e.peerunistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let t=e.peerunistream_cancelSend(this.__wbg_ptr);return p(t)}finishSend(){let t=e.peerunistream_finishSend(this.__wbg_ptr);return p(t)}get writable(){let t=e.peerunistream_writable(this.__wbg_ptr);return p(t)}};Symbol.dispose&&(X.prototype[Symbol.dispose]=X.prototype.free);var K=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,rt.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_wasmclient_free(t,0);}__acceptOpenRtcBroadcastObject(t,n,_){try{let a=e.__wbindgen_add_to_stack_pointer(-16),w=c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(n,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=k(_,e.__wbindgen_export),y=i;e.wasmclient___acceptOpenRtcBroadcastObject(a,this.__wbg_ptr,w,l,f,m,h,y);var r=d().getInt32(a+0,!0),o=d().getInt32(a+4,!0),s=d().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__acknowledgePersistentIrohOutbox(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient___acknowledgePersistentIrohOutbox(this.__wbg_ptr,n,_);return p(r)}__advancePreferredIrohCarrier(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient___advancePreferredIrohCarrier(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__applyIrohCarrierPolicy(){let t=e.wasmclient___applyIrohCarrierPolicy(this.__wbg_ptr);return p(t)}__attachMoqCarrier(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(r,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=e.wasmclient___attachMoqCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__attachWebRtcCarrier(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(r,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=e.wasmclient___attachWebRtcCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__beginMoqCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___beginMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__beginOpenRtcBroadcastPublication(t,n,_,r,o,s,a,w,l){try{let R=e.__wbindgen_add_to_stack_pointer(-16),A=c(t,e.__wbindgen_export,e.__wbindgen_export2),F=i,S=c(n,e.__wbindgen_export,e.__wbindgen_export2),M=i;var f=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i;let O=c(r,e.__wbindgen_export,e.__wbindgen_export2),T=i,N=c(o,e.__wbindgen_export,e.__wbindgen_export2),Q=i;e.wasmclient___beginOpenRtcBroadcastPublication(R,this.__wbg_ptr,A,F,S,M,f,m,O,T,N,Q,s,x(a)?Number.MAX_SAFE_INTEGER:a>>>0,x(w)?Number.MAX_SAFE_INTEGER:w>>>0,x(l)?16777215:l);var h=d().getInt32(R+0,!0),y=d().getInt32(R+4,!0),v=d().getInt32(R+8,!0);if(v)throw p(y);return p(h)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__beginOpenRtcMediaPublication(t,n,_,r,o,s,a){try{let y=e.__wbindgen_add_to_stack_pointer(-16);var w=x(t)?0:c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i;let v=c(n,e.__wbindgen_export,e.__wbindgen_export2),R=i,A=c(_,e.__wbindgen_export,e.__wbindgen_export2),F=i;e.wasmclient___beginOpenRtcMediaPublication(y,this.__wbg_ptr,w,l,v,R,A,F,r,x(o)?Number.MAX_SAFE_INTEGER:o>>>0,x(s)?Number.MAX_SAFE_INTEGER:s>>>0,x(a)?16777215:a);var f=d().getInt32(y+0,!0),m=d().getInt32(y+4,!0),h=d().getInt32(y+8,!0);if(h)throw p(m);return p(f)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__beginPreferredIrohCarrier(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=e.wasmclient___beginPreferredIrohCarrier(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__beginWebRtcCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___beginWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__closeOpenRtcBroadcast(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___closeOpenRtcBroadcast(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__configureIrohRoutePolicy(t,n,_){var r=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),o=i;let s=e.wasmclient___configureIrohRoutePolicy(this.__wbg_ptr,t,r,o,u(_));return p(s)}__configureMoqCarrier(t,n){var _=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),r=i;let o=e.wasmclient___configureMoqCarrier(this.__wbg_ptr,t,_,r);return p(o)}__configureWebRtcCarrier(t,n){let _=e.wasmclient___configureWebRtcCarrier(this.__wbg_ptr,t,n);return p(_)}__createOpenRtcBroadcastPublisherSigner(){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmclient___createOpenRtcBroadcastPublisherSigner(r,this.__wbg_ptr);var t=d().getInt32(r+0,!0),n=d().getInt32(r+4,!0),_=d().getInt32(r+8,!0);if(_)throw p(n);return p(t)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__createPersistentIrohNamespace(t,n){let _=e.wasmclient___createPersistentIrohNamespace(this.__wbg_ptr,t,n);return p(_)}__decodeOpenRtcMediaChunk(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmclient___decodeOpenRtcMediaChunk(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__decodeOpenRtcMediaControl(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmclient___decodeOpenRtcMediaControl(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__deletePersistentIrohPrefix(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient___deletePersistentIrohPrefix(this.__wbg_ptr,_,r,o,s);return p(a)}__encodeOpenRtcMediaSample(t,n,_,r,o,s){try{let h=e.__wbindgen_add_to_stack_pointer(-16),y=c(t,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(s,e.__wbindgen_export),A=i;e.wasmclient___encodeOpenRtcMediaSample(h,this.__wbg_ptr,y,v,n,_,r,o,R,A);var a=d().getInt32(h+0,!0),w=d().getInt32(h+4,!0),l=d().getInt32(h+8,!0),f=d().getInt32(h+12,!0);if(f)throw p(l);var m=P(a,w).slice();return e.__wbindgen_export4(a,w*1,1),m}finally{e.__wbindgen_add_to_stack_pointer(16);}}__flushPersistentIrohProtocols(){let t=e.wasmclient___flushPersistentIrohProtocols(this.__wbg_ptr);return p(t)}__forgetIrohCarrierPeer(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient___forgetIrohCarrierPeer(this.__wbg_ptr,n,_);return p(r)}__forgetManagedRoomGroup(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;e.wasmclient___forgetManagedRoomGroup(this.__wbg_ptr,n,_);}__getIrohCarrierReadiness(){let t=e.wasmclient___getIrohCarrierReadiness(this.__wbg_ptr);return p(t)}__getOpenRtcBroadcastStats(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient___getOpenRtcBroadcastStats(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__handleIrohCarrierControl(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=e.wasmclient___handleIrohCarrierControl(this.__wbg_ptr,r,o,s,a,u(_));return p(w)}__handleManagedRoomArtifactChunk(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___handleManagedRoomArtifactChunk(s,this.__wbg_ptr,a,w,u(n));var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__handleManagedRoomPreparePage(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___handleManagedRoomPreparePage(s,this.__wbg_ptr,a,w,u(n));var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__hydratePersistentIrohBlob(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient___hydratePersistentIrohBlob(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohAuthor(t){let n=k(t,e.__wbindgen_export),_=i,r=e.wasmclient___importPersistentIrohAuthor(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohNamespace(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=k(n,e.__wbindgen_export),w=i,l=e.wasmclient___importPersistentIrohNamespace(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__importPersistentIrohTicket(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=e.wasmclient___importPersistentIrohTicket(this.__wbg_ptr,r,o,n,_);return p(s)}__initManagedRoomGroup(t,n,_,r){try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(n,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(_,e.__wbindgen_export),A=i;var o=x(r)?0:k(r,e.__wbindgen_export),s=i;e.wasmclient___initManagedRoomGroup(f,this.__wbg_ptr,m,h,y,v,R,A,o,s);var a=d().getInt32(f+0,!0),w=d().getInt32(f+4,!0),l=d().getInt32(f+8,!0);if(l)throw p(w);return p(a)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__initPersistentIrohProtocols(t){let n=e.wasmclient___initPersistentIrohProtocols(this.__wbg_ptr,u(t));return p(n)}__moqCarrierFailed(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient___moqCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__moqCarrierPrepared(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___moqCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}__observeOpenRtcBroadcastAdapter(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient___observeOpenRtcBroadcastAdapter(o,this.__wbg_ptr,s,a,u(n));var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__openManagedRoomPayload(t,n,_,r,o,s,a,w){try{let v=e.__wbindgen_add_to_stack_pointer(-16),R=c(t,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=c(r,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=c(o,e.__wbindgen_export,e.__wbindgen_export2),O=i;var l=x(a)?0:c(a,e.__wbindgen_export,e.__wbindgen_export2),f=i;let T=k(w,e.__wbindgen_export),N=i;e.wasmclient___openManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,F,S,M,O,s,l,f,T,N);var m=d().getInt32(v+0,!0),h=d().getInt32(v+4,!0),y=d().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__openOpenRtcBroadcast(t,n,_,r,o,s){try{let h=e.__wbindgen_add_to_stack_pointer(-16),y=c(t,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(n,e.__wbindgen_export),A=i,F=c(_,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=k(r,e.__wbindgen_export),O=i;var a=x(o)?0:c(o,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___openOpenRtcBroadcast(h,this.__wbg_ptr,y,v,R,A,F,S,M,O,a,w,s);var l=d().getInt32(h+0,!0),f=d().getInt32(h+4,!0),m=d().getInt32(h+8,!0);if(m)throw p(f);return p(l)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcBroadcastPublication(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;e.wasmclient___pauseOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcMediaPublication(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___pauseOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__prepareOpenRtcBroadcastGrant(t,n,_){try{let a=e.__wbindgen_add_to_stack_pointer(-16),w=c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=k(n,e.__wbindgen_export),m=i;e.wasmclient___prepareOpenRtcBroadcastGrant(a,this.__wbg_ptr,w,l,f,m,_);var r=d().getInt32(a+0,!0),o=d().getInt32(a+4,!0),s=d().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__publishOpenRtcBroadcastSample(t,n,_,r,o,s,a){try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(n,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=k(a,e.__wbindgen_export),A=i;e.wasmclient___publishOpenRtcBroadcastSample(f,this.__wbg_ptr,m,h,y,v,_,r,o,s,R,A);var w=d().getInt32(f+0,!0),l=d().getInt32(f+4,!0);if(l)throw p(w)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__putPersistentIrohBytes(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=k(n,e.__wbindgen_export),a=i,w=k(_,e.__wbindgen_export),l=i,f=e.wasmclient___putPersistentIrohBytes(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__queryPersistentIrohNamespace(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient___queryPersistentIrohNamespace(this.__wbg_ptr,_,r,o,s);return p(a)}__reconcileIrohCarriersAfterNetworkChange(){let t=e.wasmclient___reconcileIrohCarriersAfterNetworkChange(this.__wbg_ptr);return p(t)}__reconcilePersistentIrohProtocols(){let t=e.wasmclient___reconcilePersistentIrohProtocols(this.__wbg_ptr);return p(t)}__releaseOpenRtcBroadcastPublisherSigner(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;return e.wasmclient___releaseOpenRtcBroadcastPublisherSigner(this.__wbg_ptr,n,_)!==0}__removePersistentIrohNamespace(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=e.wasmclient___removePersistentIrohNamespace(this.__wbg_ptr,r,o,n,_);return p(s)}__requireScopePeerAdmission(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___requireScopePeerAdmission(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireIrohCarrierPeer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient___retireIrohCarrierPeer(this.__wbg_ptr,_,r,o,s);return p(a)}__retireMoqCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient___retireMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__retireOpenRtcBroadcastPublication(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;e.wasmclient___retireOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaPublication(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient___retireOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaReceiver(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient___retireOpenRtcMediaReceiver(o,this.__wbg_ptr,s,a,n);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__retireWebRtcCarrier(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient___retireWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__sealManagedRoomPayload(t,n,_,r,o,s,a,w){try{let v=e.__wbindgen_add_to_stack_pointer(-16),R=c(t,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=c(r,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=c(o,e.__wbindgen_export,e.__wbindgen_export2),O=i;var l=x(a)?0:c(a,e.__wbindgen_export,e.__wbindgen_export2),f=i;let T=k(w,e.__wbindgen_export),N=i;e.wasmclient___sealManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,F,S,M,O,s,l,f,T,N);var m=d().getInt32(v+0,!0),h=d().getInt32(v+4,!0),y=d().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__setIrohCarrierActionHandler(t){e.wasmclient___setIrohCarrierActionHandler(this.__wbg_ptr,x(t)?0:u(t));}__setPersistentIrohHash(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=k(n,e.__wbindgen_export),w=i,l=c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=e.wasmclient___setPersistentIrohHash(this.__wbg_ptr,o,s,a,w,l,f,r);return p(m)}__sharePersistentIrohNamespace(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient___sharePersistentIrohNamespace(this.__wbg_ptr,_,r,n);return p(o)}__shutdownPersistentIrohProtocols(){let t=e.wasmclient___shutdownPersistentIrohProtocols(this.__wbg_ptr);return p(t)}__takeOpenRtcBroadcastActions(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient___takeOpenRtcBroadcastActions(s,this.__wbg_ptr,a,w,n);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__updateScopePeerAdmission(t,n,_,r){try{let a=e.__wbindgen_add_to_stack_pointer(-16),w=c(t,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(r,e.__wbindgen_export,e.__wbindgen_export2),m=i;e.wasmclient___updateScopePeerAdmission(a,this.__wbg_ptr,w,l,n,_,f,m);var o=d().getInt32(a+0,!0),s=d().getInt32(a+4,!0);if(s)throw p(o)}finally{e.__wbindgen_add_to_stack_pointer(16);}}__webRtcCarrierFailed(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient___webRtcCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__webRtcCarrierPrepared(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient___webRtcCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}acceptSparseFanoutMessage(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=k(_,e.__wbindgen_export),l=i,f=e.wasmclient_acceptSparseFanoutMessage(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}acknowledge_session_token_response(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),f=i;let m=e.wasmclient_acknowledge_session_token_response(this.__wbg_ptr,o,s,a,w,_,l,f);return p(m)}add_peer_scope(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_add_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}bind_connection_device_id(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_bind_connection_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}bind_node_device_id(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_bind_node_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}clearConnectionApplicationCryptoKey(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;e.wasmclient_clearConnectionApplicationCryptoKey(this.__wbg_ptr,n,_);}clearIdentityCredential(){e.wasmclient_clearIdentityCredential(this.__wbg_ptr);}clear_session_tokens(){e.wasmclient_clear_session_tokens(this.__wbg_ptr);}confirm_reciprocal_admission(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;var y=x(s)?0:c(s,e.__wbindgen_export,e.__wbindgen_export2),v=i;let R=e.wasmclient_confirm_reciprocal_admission(this.__wbg_ptr,a,w,n,l,f,m,h,o,y,v);return p(R)}connect_device(t,n){var _=x(t)?0:c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;let o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_connect_device(this.__wbg_ptr,_,r,o,s);return p(a)}connect_known_device_with_token(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(n,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=e.wasmclient_connect_known_device_with_token(this.__wbg_ptr,a,w,l,f,m,h,r,!x(o),x(o)?BigInt(0):o,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(y)}connectionApplicationCryptoReady(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;return e.wasmclient_connectionApplicationCryptoReady(this.__wbg_ptr,_,r,n)!==0}connection_state(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_connection_state(this.__wbg_ptr,n,_);return p(r)}connection_states(){let t=e.wasmclient_connection_states(this.__wbg_ptr);return p(t)}createPeerDatagramPolicy(){let t=e.wasmclient_createPeerDatagramPolicy(this.__wbg_ptr);return V.__wrap(t)}create_room(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(n,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(r,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=c(o,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=e.wasmclient_create_room(this.__wbg_ptr,a,w,l,f,m,h,y,v,R,A,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(F)}create_session(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_create_session(this.__wbg_ptr,n,_);return p(r)}decodeIncomingChannelEnvelope(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmclient_decodeIncomingChannelEnvelope(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}delete_device(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_delete_device(this.__wbg_ptr,_,r,o,s);return p(a)}devices_with_status(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_devices_with_status(this.__wbg_ptr,n,_);return p(r)}disconnect(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_disconnect(this.__wbg_ptr,n,_);return p(r)}disconnect_device(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient_disconnect_device(this.__wbg_ptr,_,r,o,s);return p(a)}disconnect_transient(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_disconnect_transient(this.__wbg_ptr,n,_);return p(r)}endpoint_id_from_ticket(t){let n,_;try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i;e.wasmclient_endpoint_id_from_ticket(f,this.__wbg_ptr,m,h);var r=d().getInt32(f+0,!0),o=d().getInt32(f+4,!0),s=d().getInt32(f+8,!0),a=d().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,C(w,l)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_export4(n,_,1);}}endpoint_ticket(){let t=e.wasmclient_endpoint_ticket(this.__wbg_ptr);return p(t)}endpoint_ticket_with_token(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_endpoint_ticket_with_token(this.__wbg_ptr,_,r,n);return p(o)}ensureConnectionApplicationCrypto(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=e.wasmclient_ensureConnectionApplicationCrypto(this.__wbg_ptr,o,s,a,w,_,u(r));return p(l)}finalizeSparseFanoutMessage(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_finalizeSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}force_reconnect_snapshot(){e.wasmclient_force_reconnect_snapshot(this.__wbg_ptr);}get_members(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient_get_members(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}handleConnectionApplicationCryptoHandshake(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;var f=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),m=i;let h=k(o,e.__wbindgen_export),y=i,v=e.wasmclient_handleConnectionApplicationCryptoHandshake(this.__wbg_ptr,s,a,w,l,!x(_),x(_)?BigInt(0):_,f,m,h,y);return p(v)}incoming_streams(){let t=e.wasmclient_incoming_streams(this.__wbg_ptr);return p(t)}initIrohWithTestRelay(t,n){var _=x(t)?0:k(t,e.__wbindgen_export),r=i,o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient_initIrohWithTestRelay(this.__wbg_ptr,_,r,o,s);return p(a)}init_iroh(t){var n=x(t)?0:k(t,e.__wbindgen_export),_=i;let r=e.wasmclient_init_iroh(this.__wbg_ptr,n,_);return p(r)}inspectIncomingStreamPrefix(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=k(t,e.__wbindgen_export),w=i;e.wasmclient_inspectIncomingStreamPrefix(s,this.__wbg_ptr,a,w,n);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}iroh_path_kind(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_iroh_path_kind(this.__wbg_ptr,n,_);return p(r)}iroh_secret_key(){let t=e.wasmclient_iroh_secret_key(this.__wbg_ptr);return p(t)}iroh_transport_rtt_ms(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_iroh_transport_rtt_ms(this.__wbg_ptr,n,_);return p(r)}is_auto_connect_excluded(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;return e.wasmclient_is_auto_connect_excluded(this.__wbg_ptr,n,_)!==0}is_connected(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_is_connected(this.__wbg_ptr,n,_);return p(r)}is_current_transport_stable_id(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_is_current_transport_stable_id(this.__wbg_ptr,_,r,n);return p(o)}is_remote_admitted(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_is_remote_admitted(this.__wbg_ptr,n,_);return p(r)}join_room(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=c(r,e.__wbindgen_export,e.__wbindgen_export2),y=i,v=c(o,e.__wbindgen_export,e.__wbindgen_export2),R=i,A=e.wasmclient_join_room(this.__wbg_ptr,s,a,w,l,f,m,h,y,v,R);return p(A)}leave_room(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=e.wasmclient_leave_room(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}list_managed_connections(){let t=e.wasmclient_list_managed_connections(this.__wbg_ptr);return p(t)}constructor(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient_new(o,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return this.__wbg_ptr=n,rt.register(this,this.__wbg_ptr,this),this}finally{e.__wbindgen_add_to_stack_pointer(16);}}node_addr(){let t=e.wasmclient_node_addr(this.__wbg_ptr);return p(t)}observe_known_device_endpoint(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_observe_known_device_endpoint(this.__wbg_ptr,_,r,o,s);return p(a)}openConnectionApplicationPayload(t,n,_){try{let l=e.__wbindgen_add_to_stack_pointer(-16),f=c(t,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=k(_,e.__wbindgen_export),y=i;e.wasmclient_openConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=d().getInt32(l+0,!0),o=d().getInt32(l+4,!0),s=d().getInt32(l+8,!0),a=d().getInt32(l+12,!0);if(a)throw p(s);var w=P(r,o).slice();return e.__wbindgen_export4(r,o*1,1),w}finally{e.__wbindgen_add_to_stack_pointer(16);}}open_bi(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_open_bi(this.__wbg_ptr,n,_);return p(r)}open_native_main_control_bi(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_open_native_main_control_bi(this.__wbg_ptr,n,_);return p(r)}open_peer_bi(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_bi(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_explicit_file_sender(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_bi_explicit_file_sender(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_transport_only(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_bi_transport_only(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_uni(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_open_peer_uni(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_uni(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_open_uni(this.__wbg_ptr,n,_);return p(r)}peerDatagramMaxSize(){return e.wasmclient_peerDatagramMaxSize(this.__wbg_ptr)>>>0}peer_scopes(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_peer_scopes(this.__wbg_ptr,n,_);return p(r)}peer_session(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_peer_session(this.__wbg_ptr,n,_);return p(r)}peer_sessions(){let t=e.wasmclient_peer_sessions(this.__wbg_ptr);return p(t)}peer_snapshot(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_peer_snapshot(this.__wbg_ptr,n,_);return p(r)}prepareSparseFanoutMessage(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_prepareSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}prepare_reciprocal_admission(t,n,_,r,o,s,a,w){let l=c(t,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=c(r,e.__wbindgen_export,e.__wbindgen_export2),v=i,R=c(o,e.__wbindgen_export,e.__wbindgen_export2),A=i,F=c(s,e.__wbindgen_export,e.__wbindgen_export2),S=i,M=c(a,e.__wbindgen_export,e.__wbindgen_export2),O=i,T=c(w,e.__wbindgen_export,e.__wbindgen_export2),N=i,Q=e.wasmclient_prepare_reciprocal_admission(this.__wbg_ptr,l,f,n,m,h,y,v,R,A,F,S,M,O,T,N);return p(Q)}present_session_token(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;let y=e.wasmclient_present_session_token(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}protectConnectionApplicationPayload(t,n,_){try{let l=e.__wbindgen_add_to_stack_pointer(-16),f=c(t,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=k(_,e.__wbindgen_export),y=i;e.wasmclient_protectConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=d().getInt32(l+0,!0),o=d().getInt32(l+4,!0),s=d().getInt32(l+8,!0),a=d().getInt32(l+12,!0);if(a)throw p(s);var w=P(r,o).slice();return e.__wbindgen_export4(r,o*1,1),w}finally{e.__wbindgen_add_to_stack_pointer(16);}}rankRoutes(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=it(t,e.__wbindgen_export),w=i,l=it(n,e.__wbindgen_export),f=i;e.wasmclient_rankRoutes(s,this.__wbg_ptr,a,w,l,f);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=Ct(_,r).slice();return e.__wbindgen_export4(_,r*4,4),o}finally{e.__wbindgen_add_to_stack_pointer(16);}}receivePeerDatagram(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_receivePeerDatagram(this.__wbg_ptr,n,_);return p(r)}recordSparseFanoutForwardQueueDrop(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_recordSparseFanoutForwardQueueDrop(this.__wbg_ptr,_,r,n);return p(o)}register_session_token(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient_register_session_token(this.__wbg_ptr,r,o,s,a,_);}register_token_until(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient_register_token_until(this.__wbg_ptr,o,s,a,w,_,r);}reject_connection_admission(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_reject_connection_admission(this.__wbg_ptr,_,r,o,s);return p(a)}release_peer_scope(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i;var o=x(n)?0:c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i;let a=e.wasmclient_release_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}report_managed_connection_settled(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i;let m=e.wasmclient_report_managed_connection_settled(this.__wbg_ptr,a,w,n,l,f,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(m)}report_transport_status(t,n,_,r,o,s){let a=c(t,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(n,e.__wbindgen_export,e.__wbindgen_export2),f=i;var m=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),h=i;let y=e.wasmclient_report_transport_status(this.__wbg_ptr,a,w,l,f,m,h,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(y)}resolve_peer_connection_records(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_resolve_peer_connection_records(this.__wbg_ptr,n,_);return p(r)}revoke_session_token(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i;e.wasmclient_revoke_session_token(o,this.__wbg_ptr,s,a);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}revoke_tokens_by_scope(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_revoke_tokens_by_scope(this.__wbg_ptr,n,_);return p(r)}runtime_policy(){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmclient_runtime_policy(r,this.__wbg_ptr);var t=d().getInt32(r+0,!0),n=d().getInt32(r+4,!0),_=d().getInt32(r+8,!0);if(_)throw p(n);return p(t)}finally{e.__wbindgen_add_to_stack_pointer(16);}}same_peer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_same_peer(this.__wbg_ptr,_,r,o,s);return p(a)}search_devices(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_search_devices(this.__wbg_ptr,n,_);return p(r)}sendPeerDatagram(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=k(n,e.__wbindgen_export),a=i,w=e.wasmclient_sendPeerDatagram(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}send_message(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;let y=e.wasmclient_send_message(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}send_native_main_control_frame(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_send_native_main_control_frame(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_send_peer(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer_application_frame(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=k(n,e.__wbindgen_export),a=i,w=e.wasmclient_send_peer_application_frame(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}setConnectionApplicationCryptoKey(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=k(n,e.__wbindgen_export),s=i,a=e.wasmclient_setConnectionApplicationCryptoKey(this.__wbg_ptr,_,r,o,s);return p(a)}setConnectionApplicationCryptoRequired(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16),o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i;e.wasmclient_setConnectionApplicationCryptoRequired(r,this.__wbg_ptr,o,s);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}setIdentityCredential(t){var n=x(t)?0:c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i;e.wasmclient_setIdentityCredential(this.__wbg_ptr,n,_);}setRelay(t){let n=e.wasmclient_setRelay(this.__wbg_ptr,t);return p(n)}set_auto_connect_excluded(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_set_auto_connect_excluded(this.__wbg_ptr,_,r,n);return p(o)}set_offline(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_set_offline(this.__wbg_ptr,n,_);return p(r)}sparseFanoutDiagnostics(t){let n=c(t,e.__wbindgen_export,e.__wbindgen_export2),_=i,r=e.wasmclient_sparseFanoutDiagnostics(this.__wbg_ptr,n,_);return p(r)}start_auto_connect(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;e.wasmclient_start_auto_connect(o,this.__wbg_ptr,s,a,w,l);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}start_presence_loop(t,n,_,r){let o=c(t,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i,l=c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i;var m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i;e.wasmclient_start_presence_loop(this.__wbg_ptr,o,s,a,w,l,f,m,h);}stop_auth_scoped_activity(){e.wasmclient_stop_auth_scoped_activity(this.__wbg_ptr);}stop_auto_connect(){e.wasmclient_stop_auto_connect(this.__wbg_ptr);}stop_presence_loop(){e.wasmclient_stop_presence_loop(this.__wbg_ptr);}submit_browser_desired_peers(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;e.wasmclient_submit_browser_desired_peers(s,this.__wbg_ptr,t,a,w);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{e.__wbindgen_add_to_stack_pointer(16);}}submit_browser_desired_peers_with_sparse_fanout(t,n,_,r,o,s){let a=c(n,e.__wbindgen_export,e.__wbindgen_export2),w=i;var l=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),f=i,m=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),h=i,y=x(o)?0:c(o,e.__wbindgen_export,e.__wbindgen_export2),v=i;let R=e.wasmclient_submit_browser_desired_peers_with_sparse_fanout(this.__wbg_ptr,t,a,w,l,f,m,h,y,v,x(s)?16777215:s?1:0);return p(R)}update_device(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i;var f=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i,h=x(o)?0:c(o,e.__wbindgen_export,e.__wbindgen_export2),y=i;let v=e.wasmclient_update_device(this.__wbg_ptr,s,a,w,l,f,m,x(r)?0:u(r),h,y);return p(v)}update_presence(t,n,_,r,o){let s=c(t,e.__wbindgen_export,e.__wbindgen_export2),a=i,w=c(n,e.__wbindgen_export,e.__wbindgen_export2),l=i,f=c(_,e.__wbindgen_export,e.__wbindgen_export2),m=i;var h=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),y=i;let v=e.wasmclient_update_presence(this.__wbg_ptr,s,a,w,l,f,m,h,y,!x(o),x(o)?BigInt(0):o);return p(v)}update_session(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=c(n,e.__wbindgen_export,e.__wbindgen_export2),s=i,a=e.wasmclient_update_session(this.__wbg_ptr,_,r,o,s);return p(a)}validate_connection_token(t,n,_){let r=c(t,e.__wbindgen_export,e.__wbindgen_export2),o=i,s=c(n,e.__wbindgen_export,e.__wbindgen_export2),a=i;var w=x(_)?0:c(_,e.__wbindgen_export,e.__wbindgen_export2),l=i;let f=e.wasmclient_validate_connection_token(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}validate_session_token(t){let n,_;try{let f=e.__wbindgen_add_to_stack_pointer(-16),m=c(t,e.__wbindgen_export,e.__wbindgen_export2),h=i;e.wasmclient_validate_session_token(f,this.__wbg_ptr,m,h);var r=d().getInt32(f+0,!0),o=d().getInt32(f+4,!0),s=d().getInt32(f+8,!0),a=d().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,C(w,l)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_export4(n,_,1);}}wait_for_peer(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_wait_for_peer(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wait_for_settled_scope(t,n){let _=c(t,e.__wbindgen_export,e.__wbindgen_export2),r=i,o=e.wasmclient_wait_for_settled_scope(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wake_browser_auto_connect(){return e.wasmclient_wake_browser_auto_connect(this.__wbg_ptr)!==0}};Symbol.dispose&&(K.prototype[Symbol.dispose]=K.prototype.free);var V=class b{static __wrap(t){let n=Object.create(b.prototype);return n.__wbg_ptr=t,ot.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ot.unregister(this),t}free(){let t=this.__destroy_into_raw();e.__wbg_wasmpeerdatagrampolicy_free(t,0);}close(){e.wasmpeerdatagrampolicy_close(this.__wbg_ptr);}closeIncoming(){e.wasmpeerdatagrampolicy_closeIncoming(this.__wbg_ptr);}closeOutgoing(){e.wasmpeerdatagrampolicy_closeOutgoing(this.__wbg_ptr);}getStats(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_getStats(o,this.__wbg_ptr,t);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}popIncoming(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_popIncoming(r,this.__wbg_ptr,t);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);let o;return n!==0&&(o=P(n,_).slice(),e.__wbindgen_export4(n,_*1,1)),o}finally{e.__wbindgen_add_to_stack_pointer(16);}}popOutgoing(t){try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_popOutgoing(o,this.__wbg_ptr,t);var n=d().getInt32(o+0,!0),_=d().getInt32(o+4,!0),r=d().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}pushIncoming(t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16),s=k(t,e.__wbindgen_export),a=i;e.wasmpeerdatagrampolicy_pushIncoming(o,this.__wbg_ptr,s,a,n);var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}pushOutgoing(t,n){try{let s=e.__wbindgen_add_to_stack_pointer(-16),a=k(t,e.__wbindgen_export),w=i;e.wasmpeerdatagrampolicy_pushOutgoing(s,this.__wbg_ptr,a,w,n);var _=d().getInt32(s+0,!0),r=d().getInt32(s+4,!0),o=d().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{e.__wbindgen_add_to_stack_pointer(16);}}recordExpiredOutgoing(){e.wasmpeerdatagrampolicy_recordExpiredOutgoing(this.__wbg_ptr);}recordSendFailure(){e.wasmpeerdatagrampolicy_recordSendFailure(this.__wbg_ptr);}recordSent(t){e.wasmpeerdatagrampolicy_recordSent(this.__wbg_ptr,t);}setIncomingMaxAge(t,n){e.wasmpeerdatagrampolicy_setIncomingMaxAge(this.__wbg_ptr,x(t)?Number.MAX_SAFE_INTEGER:t>>>0,n);}setIncomingMaxBufferedDatagrams(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_setIncomingMaxBufferedDatagrams(r,this.__wbg_ptr,t);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}setOutgoingMaxAge(t){e.wasmpeerdatagrampolicy_setOutgoingMaxAge(this.__wbg_ptr,x(t)?Number.MAX_SAFE_INTEGER:t>>>0);}setOutgoingMaxBufferedDatagrams(t){try{let r=e.__wbindgen_add_to_stack_pointer(-16);e.wasmpeerdatagrampolicy_setOutgoingMaxBufferedDatagrams(r,this.__wbg_ptr,t);var n=d().getInt32(r+0,!0),_=d().getInt32(r+4,!0);if(_)throw p(n)}finally{e.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);function Bt(){e.start();}function st(){return {__proto__:null,"./openrtc_bg.js":{__proto__:null,__wbg_Error_9dc85fe1bc224456:function(t,n){let _=Error(C(t,n));return u(_)},__wbg_Number_4779d427bae39753:function(t){return Number(g(t))},__wbg_String_8564e559799eccda:function(t,n){let _=String(g(n)),r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg___wbindgen_bigint_get_as_i64_8ea6736501f396b6:function(t,n){let _=g(n),r=typeof _=="bigint"?_:void 0;d().setBigInt64(t+8,x(r)?BigInt(0):r,true),d().setInt32(t+0,!x(r),true);},__wbg___wbindgen_boolean_get_b131b2f36d6b2f55:function(t){let n=g(t),_=typeof n=="boolean"?n:void 0;return x(_)?16777215:_?1:0},__wbg___wbindgen_debug_string_56c147eb1a51f0c4:function(t,n){let _=Z(g(n)),r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg___wbindgen_in_ce8569b2fc6f5088:function(t,n){return g(t)in g(n)},__wbg___wbindgen_is_bigint_df272c65456269c2:function(t){return typeof g(t)=="bigint"},__wbg___wbindgen_is_function_147961669f068cd4:function(t){return typeof g(t)=="function"},__wbg___wbindgen_is_null_ced4761460071341:function(t){return g(t)===null},__wbg___wbindgen_is_object_3a2c414391dbf751:function(t){let n=g(t);return typeof n=="object"&&n!==null},__wbg___wbindgen_is_string_6541b0f6ecd4e8e5:function(t){return typeof g(t)=="string"},__wbg___wbindgen_is_undefined_4410e3c20a99fa97:function(t){return g(t)===void 0},__wbg___wbindgen_jsval_eq_174c93ec61bab0c5:function(t,n){return g(t)===g(n)},__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c:function(t,n){return g(t)==g(n)},__wbg___wbindgen_number_get_588ed6b97f0d7e14:function(t,n){let _=g(n),r=typeof _=="number"?_:void 0;d().setFloat64(t+8,x(r)?0:r,true),d().setInt32(t+0,!x(r),true);},__wbg___wbindgen_string_get_fa2687d531ed17a5:function(t,n){let _=g(n),r=typeof _=="string"?_:void 0;var o=x(r)?0:c(r,e.__wbindgen_export,e.__wbindgen_export2),s=i;d().setInt32(t+4,s,true),d().setInt32(t+0,o,true);},__wbg___wbindgen_throw_bbadd78c1bac3a77:function(t,n){throw new Error(C(t,n))},__wbg__wbg_cb_unref_c2301a3c9b78104b:function(t){g(t)._wbg_cb_unref();},__wbg_abort_56c00f462c9261d9:function(t,n){g(t).abort(g(n));},__wbg_abort_f2416f4a9852003e:function(t){g(t).abort();},__wbg_addEventListener_b635263c509aa7de:function(){return I(function(t,n,_,r){g(t).addEventListener(C(n,_),g(r));},arguments)},__wbg_append_c5a0c94a6a73b22e:function(){return I(function(t,n,_,r,o){g(t).append(C(n,_),C(r,o));},arguments)},__wbg_apply_5d99f956e2dda74d:function(){return I(function(t,n,_){let r=g(t).apply(g(n),g(_));return u(r)},arguments)},__wbg_arrayBuffer_cc7704fa158b907a:function(){return I(function(t){let n=g(t).arrayBuffer();return u(n)},arguments)},__wbg_bistream_new:function(t){let n=G.__wrap(t);return u(n)},__wbg_body_442a47f02322d7b0:function(t){let n=g(t).body;return x(n)?0:u(n)},__wbg_buffer_8524b3453cde4918:function(t){let n=g(t).buffer;return u(n)},__wbg_bufferedAmount_c1581bbb06f4f36c:function(t){return g(t).bufferedAmount},__wbg_byobRequest_cc72d210de793e64:function(t){let n=g(t).byobRequest;return x(n)?0:u(n)},__wbg_byteLength_96807b1d9ab24a4c:function(t){return g(t).byteLength},__wbg_byteOffset_a9c7002428843c41:function(t){return g(t).byteOffset},__wbg_call_91f00ddc43e01490:function(){return I(function(t,n){let _=g(t).call(g(n));return u(_)},arguments)},__wbg_call_ec09a4cf93377d3a:function(){return I(function(t,n,_){let r=g(t).call(g(n),g(_));return u(r)},arguments)},__wbg_cancel_f3a197b26dc88b39:function(t){let n=g(t).cancel();return u(n)},__wbg_catch_66060324c27be6f7:function(t,n){let _=g(t).catch(g(n));return u(_)},__wbg_clearTimeout_113b1cde814ec762:function(t){let n=clearTimeout(p(t));return u(n)},__wbg_clearTimeout_333bba87532ab9d3:function(t){let n=clearTimeout(p(t));return u(n)},__wbg_clearTimeout_47a40e3be01ed7a3:function(){return I(function(t,n){g(t).clearTimeout(p(n));},arguments)},__wbg_close_296263cfe1bb2999:function(){return I(function(t){g(t).close();},arguments)},__wbg_close_388d99468213b286:function(){return I(function(t){g(t).close();},arguments)},__wbg_close_4857e22d08b71356:function(){return I(function(t){g(t).close();},arguments)},__wbg_close_f3365df7ba1b74d3:function(t){g(t).close();},__wbg_code_1cda2855fcd9b009:function(t){return g(t).code},__wbg_code_70beb7b22374d55e:function(t){return g(t).code},__wbg_crypto_38df2bab126b63dc:function(t){let n=g(t).crypto;return u(n)},__wbg_data_8a04443c1e5a8cd3:function(t){let n=g(t).data;return u(n)},__wbg_debug_de823612d4d12f74:function(t){console.debug(g(t));},__wbg_dispatchEvent_cc62a6a43d28b01c:function(){return I(function(t,n){return g(t).dispatchEvent(g(n))},arguments)},__wbg_done_6a8439e544ec6206:function(t){return g(t).done},__wbg_enqueue_bbeb09ba0b140f76:function(){return I(function(t,n){g(t).enqueue(g(n));},arguments)},__wbg_entries_4e00eefd3fd54cf1:function(t){let n=g(t).entries();return u(n)},__wbg_entries_5a6a7e7e0df09fe5:function(t){let n=Object.entries(g(t));return u(n)},__wbg_error_6651fee1c71e5da9:function(t){console.error(g(t));},__wbg_error_9a99766f65a03031:function(t,n){console.error(g(t),g(n));},__wbg_error_a6fa202b58aa1cd3:function(t,n){let _,r;try{_=t,r=n,console.error(C(t,n));}finally{e.__wbindgen_export4(_,r,1);}},__wbg_fetch_074561c3e313c86f:function(t){let n=fetch(g(t));return u(n)},__wbg_fetch_22858a12fcf93152:function(t,n){let _=g(t).fetch(g(n));return u(_)},__wbg_from_8a57180716c586ee:function(t){let n=Array.from(g(t));return u(n)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return I(function(t,n){g(t).getRandomValues(g(n));},arguments)},__wbg_getRandomValues_cc7f052a444bb2ce:function(){return I(function(t,n){globalThis.crypto.getRandomValues(P(t,n));},arguments)},__wbg_getReader_9facd4f899beac89:function(){return I(function(t){let n=g(t).getReader();return u(n)},arguments)},__wbg_get_44e98e27bda25b5b:function(){return I(function(t,n){let _=Reflect.get(g(t),g(n));return u(_)},arguments)},__wbg_get_4b90d6d8c5deb5d5:function(t,n){let _=g(t)[n>>>0];return u(_)},__wbg_get_52a8a619f7b88df6:function(){return I(function(t,n){let _=Reflect.get(g(t),g(n));return u(_)},arguments)},__wbg_get_done_c21b9933fc9a9e9c:function(t){let n=g(t).done;return x(n)?16777215:n?1:0},__wbg_get_unchecked_46e778e3cec74b5e:function(t,n){let _=g(t)[n>>>0];return u(_)},__wbg_get_value_ad568c7d3db9073f:function(t){let n=g(t).value;return u(n)},__wbg_get_with_ref_key_6412cf3094599694:function(t,n){let _=g(t)[g(n)];return u(_)},__wbg_has_14676d88c1340d2c:function(){return I(function(t,n){return Reflect.has(g(t),g(n))},arguments)},__wbg_headers_5b19cf40627ae54d:function(t){let n=g(t).headers;return u(n)},__wbg_info_a2b5f8a5dae8b26c:function(t){console.info(g(t));},__wbg_instanceof_ArrayBuffer_a581da923203f29f:function(t){let n;try{n=g(t)instanceof ArrayBuffer;}catch{n=false;}return n},__wbg_instanceof_Blob_5c4e145be35f9b1e:function(t){let n;try{n=g(t)instanceof Blob;}catch{n=false;}return n},__wbg_instanceof_Map_7f94c740225003e2:function(t){let n;try{n=g(t)instanceof Map;}catch{n=false;}return n},__wbg_instanceof_Promise_aa24ea31000d4ee6:function(t){let n;try{n=g(t)instanceof Promise;}catch{n=false;}return n},__wbg_instanceof_Response_36a65a969abaa7c6:function(t){let n;try{n=g(t)instanceof Response;}catch{n=false;}return n},__wbg_instanceof_Uint8Array_b6fe1ac89eba107e:function(t){let n;try{n=g(t)instanceof Uint8Array;}catch{n=false;}return n},__wbg_instanceof_Window_9e0fe7d3d1ff4342:function(t){let n;try{n=g(t)instanceof Window;}catch{n=false;}return n},__wbg_isArray_139f48e3c057ede8:function(t){return Array.isArray(g(t))},__wbg_isSafeInteger_c22ccb4af2201fe9:function(t){return Number.isSafeInteger(g(t))},__wbg_iterator_9b36cebf3be7b7cd:function(){return u(Symbol.iterator)},__wbg_length_68a9d5278d084f4f:function(t){return g(t).length},__wbg_length_fb04d16d7bdf6d4c:function(t){return g(t).length},__wbg_log_6614a4effdb4e983:function(t){console.log(g(t));},__wbg_maxRetransmits_dfa0382c31f8e2ca:function(t){let n=g(t).maxRetransmits;return x(n)?16777215:n},__wbg_message_12958526424a887b:function(t,n){let _=g(n).message,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_msCrypto_bd5a034af96bcba6:function(t){let n=g(t).msCrypto;return u(n)},__wbg_new_0b303268aa395a38:function(){let t=new Array;return u(t)},__wbg_new_189262ff31890c23:function(){return I(function(){let t=new Headers;return u(t)},arguments)},__wbg_new_20b778a4c5c691c3:function(){let t=new Object;return u(t)},__wbg_new_227d7c05414eb861:function(){let t=new Error;return u(t)},__wbg_new_24739629d416f982:function(){return I(function(){let t=new AbortController;return u(t)},arguments)},__wbg_new_5fae30e6b23db8df:function(t,n){let _=new Error(C(t,n));return u(_)},__wbg_new_883c0db065f06efd:function(){return u(new Map)},__wbg_new_a3e5112401a82338:function(){return I(function(t,n){let _=new WebSocket(C(t,n));return u(_)},arguments)},__wbg_new_b06772b280cc6e52:function(t){let n=new Uint8Array(g(t));return u(n)},__wbg_new_from_slice_bb2d1778c0b87eb1:function(t,n){let _=new Uint8Array(P(t,n));return u(_)},__wbg_new_typed_90c3f6c29ba36d19:function(t,n){try{var _={a:t,b:n},r=(s,a)=>{let w=_.a;_.a=0;try{return xt(w,_.b,s,a)}finally{_.a=w;}};let o=new Promise(r);return u(o)}finally{_.a=0;}},__wbg_new_with_byte_offset_and_length_9e1e664fe1a5d385:function(t,n,_){let r=new Uint8Array(g(t),n>>>0,_>>>0);return u(r)},__wbg_new_with_event_init_dict_bd850674488710b1:function(){return I(function(t,n,_){let r=new CustomEvent(C(t,n),g(_));return u(r)},arguments)},__wbg_new_with_into_underlying_sink_2596343f9b6c8e58:function(t){let n=new WritableStream(L.__wrap(t));return u(n)},__wbg_new_with_into_underlying_source_fd904252f385f59c:function(t,n){let _=new ReadableStream(U.__wrap(t),p(n));return u(_)},__wbg_new_with_length_4b57a7a5dc67221c:function(t){let n=new Uint8Array(t>>>0);return u(n)},__wbg_new_with_str_and_init_df876572184fe639:function(){return I(function(t,n,_){let r=new Request(C(t,n),g(_));return u(r)},arguments)},__wbg_new_with_str_sequence_505a4829cc247e79:function(){return I(function(t,n,_){let r=new WebSocket(C(t,n),g(_));return u(r)},arguments)},__wbg_next_8cb028b6ba50743f:function(){return I(function(t){let n=g(t).next();return u(n)},arguments)},__wbg_next_cfd0b146c9538df8:function(t){let n=g(t).next;return u(n)},__wbg_node_84ea875411254db1:function(t){let n=g(t).node;return u(n)},__wbg_now_bce4dc999095ea77:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(t){return g(t).now()},__wbg_parse_a5c06e19bc1187fd:function(t,n){return Date.parse(C(t,n))},__wbg_peerunistream_new:function(t){let n=X.__wrap(t);return u(n)},__wbg_performance_3fcf6e32a7e1ed0a:function(t){let n=g(t).performance;return u(n)},__wbg_process_44c7a14e11e9f69e:function(t){let n=g(t).process;return u(n)},__wbg_protocol_28aaef5ea42981d6:function(t,n){let _=g(n).protocol,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_prototypesetcall_956c7493c68e29b4:function(t,n,_){Uint8Array.prototype.set.call(P(t,n),g(_));},__wbg_push_ceb8ef046afb2041:function(t,n){return g(t).push(g(n))},__wbg_queueMicrotask_4698f900840e3286:function(t){queueMicrotask(g(t));},__wbg_queueMicrotask_477a5533c7100338:function(t){let n=g(t).queueMicrotask;return u(n)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return I(function(t,n){g(t).randomFillSync(p(n));},arguments)},__wbg_read_8426c146431f2905:function(t){let n=g(t).read();return u(n)},__wbg_readyState_25243ad6ce649774:function(t){return g(t).readyState},__wbg_reason_4ec455bac79b33ce:function(t,n){let _=g(n).reason,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_releaseLock_188846ef719acb10:function(t){g(t).releaseLock();},__wbg_removeEventListener_016c1d24523b4730:function(){return I(function(t,n,_,r){g(t).removeEventListener(C(n,_),g(r));},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return I(function(){let t=module.require;return u(t)},arguments)},__wbg_resolve_0183de2e8c6b1d54:function(t){let n=Promise.resolve(g(t));return u(n)},__wbg_respond_3cdb4cf32683fd79:function(){return I(function(t,n){g(t).respond(n>>>0);},arguments)},__wbg_send_77521d09456dd693:function(){return I(function(t,n,_){g(t).send(P(n,_));},arguments)},__wbg_send_99d049cae69c53cc:function(){return I(function(t,n,_){g(t).send(P(n,_));},arguments)},__wbg_send_bac9d3dc4f21ef28:function(){return I(function(t,n,_){g(t).send(C(n,_));},arguments)},__wbg_setTimeout_3a808dd861dd3c12:function(t,n){let _=setTimeout(g(t),n);return u(_)},__wbg_setTimeout_6613a51400c1bf9f:function(){return I(function(t,n,_){let r=g(t).setTimeout(p(n),_);return u(r)},arguments)},__wbg_setTimeout_ef24d2fc3ad97385:function(){return I(function(t,n){let _=setTimeout(g(t),n);return u(_)},arguments)},__wbg_set_5f806304fb633ab3:function(t,n,_){let r=g(t).set(g(n),g(_));return u(r)},__wbg_set_6be42768c690e380:function(t,n,_){g(t)[p(n)]=p(_);},__wbg_set_86698c227e5b9dad:function(t,n,_){g(t).set(P(n,_));},__wbg_set_a6ba3ac0e634b822:function(){return I(function(t,n,_){return Reflect.set(g(t),g(n),g(_))},arguments)},__wbg_set_binaryType_07905e4563fcd9b2:function(t,n){g(t).binaryType=kt[n];},__wbg_set_binaryType_8c2dd2cf1cfc2e28:function(t,n){g(t).binaryType=mt[n];},__wbg_set_body_d1153b16a2b95ca1:function(t,n){g(t).body=g(n);},__wbg_set_bufferedAmountLowThreshold_8969a2db2c745257:function(t,n){g(t).bufferedAmountLowThreshold=n>>>0;},__wbg_set_cache_5a01a8b5e6ca6cf2:function(t,n){g(t).cache=yt[n];},__wbg_set_credentials_e9120ed88b1fc0b8:function(t,n){g(t).credentials=vt[n];},__wbg_set_da33c120a6584674:function(t,n,_){g(t)[n>>>0]=p(_);},__wbg_set_detail_c7af5edea934390b:function(t,n){g(t).detail=g(n);},__wbg_set_handle_event_6147c38b782c7b42:function(t,n){g(t).handleEvent=g(n);},__wbg_set_headers_877ed41890d28af2:function(t,n){g(t).headers=g(n);},__wbg_set_high_water_mark_77da20c49668427d:function(t,n){g(t).highWaterMark=n;},__wbg_set_method_b4ede299b2064f37:function(t,n,_){g(t).method=C(n,_);},__wbg_set_mode_d6c2e1991aa963c6:function(t,n){g(t).mode=It[n];},__wbg_set_onbufferedamountlow_b695487bdd219f98:function(t,n){g(t).onbufferedamountlow=g(n);},__wbg_set_onclose_9cb5c3372e16c192:function(t,n){g(t).onclose=g(n);},__wbg_set_onclose_f8bec1cbeb64aa93:function(t,n){g(t).onclose=g(n);},__wbg_set_onerror_190fe67e911ebf28:function(t,n){g(t).onerror=g(n);},__wbg_set_onmessage_4d57c4ddab951294:function(t,n){g(t).onmessage=g(n);},__wbg_set_onmessage_96337495f0bfb796:function(t,n){g(t).onmessage=g(n);},__wbg_set_onopen_3e2bf6b11d434c2d:function(t,n){g(t).onopen=g(n);},__wbg_set_signal_9022b5aa06a6ce5b:function(t,n){g(t).signal=g(n);},__wbg_signal_41dd1a8913cd0b7d:function(t){let n=g(t).signal;return u(n)},__wbg_stack_3b0d974bbf31e44f:function(t,n){let _=g(n).stack,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_static_accessor_GLOBAL_60a4124bab7dcc9a:function(){let t=typeof global>"u"?null:global;return x(t)?0:u(t)},__wbg_static_accessor_GLOBAL_THIS_95ca6460658b5d13:function(){let t=typeof globalThis>"u"?null:globalThis;return x(t)?0:u(t)},__wbg_static_accessor_SELF_4c95f759a91e9aae:function(){let t=typeof self>"u"?null:self;return x(t)?0:u(t)},__wbg_static_accessor_WINDOW_44b435597f9e9ee7:function(){let t=typeof window>"u"?null:window;return x(t)?0:u(t)},__wbg_status_9e6505cfa3e73a7c:function(t){return g(t).status},__wbg_subarray_42216645a367cd7a:function(t,n,_){let r=g(t).subarray(n>>>0,_>>>0);return u(r)},__wbg_then_254bab9b266a77a5:function(t,n,_){let r=g(t).then(g(n),g(_));return u(r)},__wbg_then_3ea18602c6a5123b:function(t,n){let _=g(t).then(g(n));return u(_)},__wbg_url_72c67c175685a054:function(t,n){let _=g(n).url,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_url_d0b8042af0d1bbba:function(t,n){let _=g(n).url,r=c(_,e.__wbindgen_export,e.__wbindgen_export2),o=i;d().setInt32(t+4,o,true),d().setInt32(t+0,r,true);},__wbg_value_3d3defe09fb1ffca:function(t){let n=g(t).value;return u(n)},__wbg_versions_276b2795b1c6a219:function(t){let n=g(t).versions;return u(n)},__wbg_view_15fa5865c6b336e3:function(t){let n=g(t).view;return x(n)?0:u(n)},__wbg_warn_633bacc13ba7e6c3:function(t){console.warn(g(t));},__wbg_wasClean_f17429d064911939:function(t){return g(t).wasClean},__wbindgen_cast_0000000000000001:function(t,n){let _=B(t,n,dt);return u(_)},__wbindgen_cast_0000000000000002:function(t,n){let _=B(t,n,ft);return u(_)},__wbindgen_cast_0000000000000003:function(t,n){let _=B(t,n,wt);return u(_)},__wbindgen_cast_0000000000000004:function(t,n){let _=B(t,n,ut);return u(_)},__wbindgen_cast_0000000000000005:function(t,n){let _=B(t,n,lt);return u(_)},__wbindgen_cast_0000000000000006:function(t,n){let _=B(t,n,at);return u(_)},__wbindgen_cast_0000000000000007:function(t,n){let _=B(t,n,pt);return u(_)},__wbindgen_cast_0000000000000008:function(t,n){let _=Ft(t,n,gt);return u(_)},__wbindgen_cast_0000000000000009:function(t,n){let _=B(t,n,bt);return u(_)},__wbindgen_cast_000000000000000a:function(t){return u(t)},__wbindgen_cast_000000000000000b:function(t){return u(t)},__wbindgen_cast_000000000000000c:function(t,n){let _=P(t,n);return u(_)},__wbindgen_cast_000000000000000d:function(t,n){let _=C(t,n);return u(_)},__wbindgen_cast_000000000000000e:function(t){let n=BigInt.asUintN(64,t);return u(n)},__wbindgen_cast_000000000000000f:function(t,n){var _=P(t,n).slice();return e.__wbindgen_export4(t,n*1,1),u(_)},__wbindgen_object_clone_ref:function(t){let n=g(t);return u(n)},__wbindgen_object_drop_ref:function(t){p(t);}}}}function at(b,t){e.__wasm_bindgen_func_elem_29038(b,t);}function pt(b,t){e.__wasm_bindgen_func_elem_30170(b,t);}function gt(b,t){e.__wasm_bindgen_func_elem_30230(b,t);}function bt(b,t){e.__wasm_bindgen_func_elem_38190(b,t);}function dt(b,t,n){e.__wasm_bindgen_func_elem_29240(b,t,u(n));}function wt(b,t,n){e.__wasm_bindgen_func_elem_26609(b,t,u(n));}function ut(b,t,n){e.__wasm_bindgen_func_elem_5969(b,t,u(n));}function lt(b,t,n){e.__wasm_bindgen_func_elem_30904(b,t,u(n));}function ft(b,t,n){try{let o=e.__wbindgen_add_to_stack_pointer(-16);e.__wasm_bindgen_func_elem_39697(o,b,t,u(n));var _=d().getInt32(o+0,!0),r=d().getInt32(o+4,!0);if(r)throw p(_)}finally{e.__wbindgen_add_to_stack_pointer(16);}}function xt(b,t,n,_){e.__wasm_bindgen_func_elem_39699(b,t,u(n),u(_));}var mt=["blob","arraybuffer"],ht=["bytes"],yt=["default","no-store","reload","no-cache","force-cache","only-if-cached"],vt=["omit","same-origin","include"],It=["same-origin","no-cors","cors","navigate"],kt=["arraybuffer","blob"],tt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_bistream_free(b,1)),Rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_intounderlyingbytesource_free(b,1)),et=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_intounderlyingsink_free(b,1)),nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_intounderlyingsource_free(b,1)),_t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_peerunistream_free(b,1)),rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_wasmclient_free(b,1)),ot=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbg_wasmpeerdatagrampolicy_free(b,1));function u(b){D===E.length&&E.push(E.length+1);let t=D;return D=E[t],E[t]=b,t}var J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>e.__wbindgen_export5(b.a,b.b));function Z(b){let t=typeof b;if(t=="number"||t=="boolean"||b==null)return `${b}`;if(t=="string")return `"${b}"`;if(t=="symbol"){let r=b.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){let r=b.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(b)){let r=b.length,o="[";r>0&&(o+=Z(b[0]));for(let s=1;s<r;s++)o+=", "+Z(b[s]);return o+="]",o}let n=/\[object ([^\]]+)\]/.exec(toString.call(b)),_;if(n&&n.length>1)_=n[1];else return toString.call(b);if(_=="Object")try{return "Object("+JSON.stringify(b)+")"}catch{return "Object"}return b instanceof Error?`${b.name}: ${b.message}
2
2
  ${b.stack}`:_}function At(b){b<1028||(E[b]=D,D=b);}function Ct(b,t){b=b>>>0;let n=d(),_=[];for(let r=b;r<b+4*t;r+=4)_.push(p(n.getUint32(r,true)));return _}function P(b,t){return b=b>>>0,W().subarray(b/1,b/1+t)}var j=null;function d(){return (j===null||j.buffer.detached===true||j.buffer.detached===void 0&&j.buffer!==e.memory.buffer)&&(j=new DataView(e.memory.buffer)),j}function C(b,t){return St(b>>>0,t)}var q=null;function W(){return (q===null||q.byteLength===0)&&(q=new Uint8Array(e.memory.buffer)),q}function g(b){return E[b]}function I(b,t){try{return b.apply(this,t)}catch(n){e.__wbindgen_export3(u(n));}}var E=new Array(1024).fill(void 0);E.push(void 0,null,true,false);var D=E.length;function x(b){return b==null}function Ft(b,t,n){let _={a:b,b:t,cnt:1},r=(...o)=>{_.cnt++;try{return n(_.a,_.b,...o)}finally{r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(e.__wbindgen_export5(_.a,_.b),_.a=0,J.unregister(_));},J.register(r,_,_),r}function B(b,t,n){let _={a:b,b:t,cnt:1},r=(...o)=>{_.cnt++;let s=_.a;_.a=0;try{return n(s,_.b,...o)}finally{_.a=s,r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(e.__wbindgen_export5(_.a,_.b),_.a=0,J.unregister(_));},J.register(r,_,_),r}function k(b,t){let n=t(b.length*1,1)>>>0;return W().set(b,n/1),i=b.length,n}function it(b,t){let n=t(b.length*4,4)>>>0,_=d();for(let r=0;r<b.length;r++)_.setUint32(n+4*r,u(b[r]),true);return i=b.length,n}function c(b,t,n){if(n===void 0){let a=z.encode(b),w=t(a.length,1)>>>0;return W().subarray(w,w+a.length).set(a),i=a.length,w}let _=b.length,r=t(_,1)>>>0,o=W(),s=0;for(;s<_;s++){let a=b.charCodeAt(s);if(a>127)break;o[r+s]=a;}if(s!==_){s!==0&&(b=b.slice(s)),r=n(r,_,_=s+b.length*3,1)>>>0;let a=W().subarray(r+s,r+_),w=z.encodeInto(b,a);s+=w.written,r=n(r,_,s,1)>>>0;}return i=s,r}function p(b){let t=g(b);return At(b),t}var H=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});H.decode();var Pt=2146435072,Y=0;function St(b,t){return Y+=t,Y>=Pt&&(H=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),H.decode(),Y=t),H.decode(W().subarray(b,b+t))}var z=new TextEncoder;"encodeInto"in z||(z.encodeInto=function(b,t){let n=z.encode(b);return t.set(n),{read:b.length,written:n.length}});var i=0,e;function ct(b,t){return e=b.exports,j=null,q=null,e.__wbindgen_start(),e}async function Et(b,t){if(typeof Response=="function"&&b instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(b,t)}catch(r){if(b.ok&&n(b.type)&&b.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let _=await b.arrayBuffer();return await WebAssembly.instantiate(_,t)}else {let _=await WebAssembly.instantiate(b,t);return _ instanceof WebAssembly.Instance?{instance:_,module:b}:_}function n(_){switch(_){case "basic":case "cors":case "default":return true}return false}}function Tt(b){if(e!==void 0)return e;b!==void 0&&(Object.getPrototypeOf(b)===Object.prototype?{module:b}=b:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=st();b instanceof WebAssembly.Module||(b=new WebAssembly.Module(b));let n=new WebAssembly.Instance(b,t);return ct(n)}async function Nt(b){if(e!==void 0)return e;b!==void 0&&(Object.getPrototypeOf(b)===Object.prototype?{module_or_path:b}=b:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),b===void 0&&(b=new URL("openrtc_bg.wasm",import.meta.url));let t=st();(typeof b=="string"||typeof Request=="function"&&b instanceof Request||typeof URL=="function"&&b instanceof URL)&&(b=fetch(b));let{instance:n,module:_}=await Et(await b,t);return ct(n)}export{G as BiStream,$ as IntoUnderlyingByteSource,L as IntoUnderlyingSink,U as IntoUnderlyingSource,X as PeerUniStream,K as WasmClient,V as WasmPeerDatagramPolicy,Nt as default,Tt as initSync,Bt as start};
Binary file
@@ -1 +1 @@
1
- import {b}from'../chunk-P5GCLQHS.js';import'../chunk-AYHD4X2R.js';import {a}from'../chunk-4CC6YIGG.js';import'../chunk-25CN4MLA.js';import'../chunk-XMYBBLYK.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import'../chunk-CNAW5BZ3.js';import'../chunk-CCCYE3XN.js';import'../chunk-N6LGTNUI.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';var n=class extends a{constructor(e){super(new b(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
1
+ import {b}from'../chunk-2ESWBXLF.js';import'../chunk-AYHD4X2R.js';import {a}from'../chunk-4CC6YIGG.js';import'../chunk-25CN4MLA.js';import'../chunk-XMYBBLYK.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import'../chunk-CNAW5BZ3.js';import'../chunk-CCCYE3XN.js';import'../chunk-N6LGTNUI.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';var n=class extends a{constructor(e){super(new b(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
@@ -1 +1 @@
1
- import {a as a$2}from'../chunk-WMA4OMJL.js';import {s}from'../chunk-VC7TGJFS.js';import'../chunk-BGWJHPBC.js';import'../chunk-4CC6YIGG.js';import'../chunk-25CN4MLA.js';import {a as a$1}from'../chunk-XMYBBLYK.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import {a}from'../chunk-4J4F32QT.js';import'../chunk-72NEEJQG.js';import'../chunk-CNAW5BZ3.js';import'../chunk-DUY34MGT.js';import'../chunk-CCCYE3XN.js';import'../chunk-N6LGTNUI.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';async function l(e){let t=a$1(e),{WasmBridge:o}=await import('../WasmBridge-LP7FHTHZ.js');return a$2(t,new o(t))}function y(e,t,o=new a){let m=a$1(e);return a$2(m,new s({...m,bridge:t,projectionBroker:o}))}export{y as createIpcClient,l as createWasmClient};
1
+ import {a as a$2}from'../chunk-WMA4OMJL.js';import {s}from'../chunk-VC7TGJFS.js';import'../chunk-BGWJHPBC.js';import'../chunk-4CC6YIGG.js';import'../chunk-25CN4MLA.js';import {a as a$1}from'../chunk-XMYBBLYK.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import {a}from'../chunk-4J4F32QT.js';import'../chunk-72NEEJQG.js';import'../chunk-CNAW5BZ3.js';import'../chunk-DUY34MGT.js';import'../chunk-CCCYE3XN.js';import'../chunk-N6LGTNUI.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';async function l(e){let t=a$1(e),{WasmBridge:o}=await import('../WasmBridge-UZC7G4NP.js');return a$2(t,new o(t))}function y(e,t,o=new a){let m=a$1(e);return a$2(m,new s({...m,bridge:t,projectionBroker:o}))}export{y as createIpcClient,l as createWasmClient};
@@ -4,9 +4,9 @@
4
4
  "platform": "darwin",
5
5
  "arch": "arm64",
6
6
  "rustTarget": "aarch64-apple-darwin",
7
- "sourceCommit": "bbb8b0c835f12bce6a08832e20fa9c9930b2fd31",
8
- "sourceDigest": "5717986eef3929635f8f0a02ab290a854123c21bbc812e7ebcad8fa919b6366d",
9
- "binarySha256": "ed49c1443148b84ea4400698cfce6fd452f37af46608070b8d1f4f74795d8f6a",
7
+ "sourceCommit": "c0c690691cf1f2359c73c9def04c95207418ca10",
8
+ "sourceDigest": "37c61e1950f45b9a9e7f3eb262a6c46ebaa8e322b8f9af3a3b2d0e74ac9377ad",
9
+ "binarySha256": "95ec0d4f25aeffaa1e3c2c1d7cd47e26a9667414b469ca30c8d5b526d3f356b8",
10
10
  "protocol": {
11
11
  "lifecycleOwner": "rust-peer-session",
12
12
  "maxApplicationPayloadBytes": 65536,
@@ -16,5 +16,5 @@
16
16
  },
17
17
  "signingKeySha256": "0391c617f3df12611b419e129cace36fa792e73da03271649cbed9e9f9f155ef",
18
18
  "signatureAlgorithm": "ed25519",
19
- "signature": "khPLkFvXI22S/DJuWT8/bVIouwhcYr1ltzRRTYyyu5PXebnXxY/RgDlzJjrHTxsx4Cnmr/Lbdu3daw2oCcYDBw=="
19
+ "signature": "CEmQNA4fBSES0lQ6RD1TLNyfKtg5IjrFkHZWlzZWL01kbqmsE85lBBP8xtQj/teYbNvQRUO688YYKA4sYjSgAg=="
20
20
  }
Binary file
@@ -4,9 +4,9 @@
4
4
  "platform": "darwin",
5
5
  "arch": "x64",
6
6
  "rustTarget": "x86_64-apple-darwin",
7
- "sourceCommit": "bbb8b0c835f12bce6a08832e20fa9c9930b2fd31",
8
- "sourceDigest": "5717986eef3929635f8f0a02ab290a854123c21bbc812e7ebcad8fa919b6366d",
9
- "binarySha256": "e8cb07592b79be8d20f4e865c6563788b4485374988c41cb3cd20de20d8cea74",
7
+ "sourceCommit": "c0c690691cf1f2359c73c9def04c95207418ca10",
8
+ "sourceDigest": "37c61e1950f45b9a9e7f3eb262a6c46ebaa8e322b8f9af3a3b2d0e74ac9377ad",
9
+ "binarySha256": "0ae081f33d185115f84129e7d84e48ea51b3bf468a590d61d674a888296c0e96",
10
10
  "protocol": {
11
11
  "lifecycleOwner": "rust-peer-session",
12
12
  "maxApplicationPayloadBytes": 65536,
@@ -16,5 +16,5 @@
16
16
  },
17
17
  "signingKeySha256": "0391c617f3df12611b419e129cace36fa792e73da03271649cbed9e9f9f155ef",
18
18
  "signatureAlgorithm": "ed25519",
19
- "signature": "k5c9hkYvu4vQOJfOhTq7omfVfcyfBmc1AN9xyJLzm+H39L7Sq/Xf0WK+a5U8iyxNYvAxf5mroINFlllDejOeBg=="
19
+ "signature": "b6A0CiOEM7PTO1N13CSTCUWJBXTWXIfRYafWSU2fo48FswevW4O06sLDumnQpTRW3wfMD1e6Jux0RHzcdxnIDg=="
20
20
  }
Binary file
@@ -4,9 +4,9 @@
4
4
  "platform": "linux",
5
5
  "arch": "x64",
6
6
  "rustTarget": "x86_64-unknown-linux-gnu",
7
- "sourceCommit": "6d4cb41a457398066aced95b62594ce87c29f775",
8
- "sourceDigest": "5717986eef3929635f8f0a02ab290a854123c21bbc812e7ebcad8fa919b6366d",
9
- "binarySha256": "319f5fb6fa066d31fb44bda1da1960f6577af7512d1bdbc9e63f2c5e15479111",
7
+ "sourceCommit": "6fc33a8944fade0dcc0ec2a7f0a47c66f8febf51",
8
+ "sourceDigest": "37c61e1950f45b9a9e7f3eb262a6c46ebaa8e322b8f9af3a3b2d0e74ac9377ad",
9
+ "binarySha256": "a545977f2795dbe247371d62505183124d2febe44a56b027e2aa0d30a80da87d",
10
10
  "protocol": {
11
11
  "lifecycleOwner": "rust-peer-session",
12
12
  "maxApplicationPayloadBytes": 65536,
@@ -16,5 +16,5 @@
16
16
  },
17
17
  "signingKeySha256": "0391c617f3df12611b419e129cace36fa792e73da03271649cbed9e9f9f155ef",
18
18
  "signatureAlgorithm": "ed25519",
19
- "signature": "sCUhzcPPBSKeVp3Cabutg0NR1vbDYOS2ug8QTr8GUMyg5rzuVKJ1t+7Du9PyPu9DnDLaZ5PXVpEdn9PugxmFCA=="
19
+ "signature": "9nAyDYt1wTNrYZ1cSDV+mv4g8LCH2t1DDxCM+ZB6tfjuqIubxEylgrOA+M5OqevYj6LIbxcN/W+UhcquNEj5DA=="
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openrtc",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,