openrtc 2.0.0-rc.12 → 2.0.0-rc.13
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.
- package/dist/{DelegatingRuntimeAdapter-BLNigcS4.d.ts → DelegatingRuntimeAdapter-Btvzi1s9.d.ts} +2 -2
- package/dist/OpenRTCShared-LDKG5RPN.js +1 -0
- package/dist/WasmBridge-7AS445EV.js +1 -0
- package/dist/chunk-GBIGWN5H.js +3 -0
- package/dist/{chunk-4UZFT2P6.js → chunk-MHQHFEYX.js} +1 -1
- package/dist/chunk-PQK5SJ47.js +1 -0
- package/dist/{chunk-23XC6TGK.js → chunk-QGGQ3SRF.js} +1 -1
- package/dist/{chunk-RD3JEGGF.js → chunk-QHSM5NFZ.js} +2 -2
- package/dist/{chunk-KWXAZUAZ.js → chunk-RLRBSNLB.js} +1 -1
- package/dist/{chunk-7Z6N46RB.js → chunk-RRMBD5OL.js} +1 -1
- package/dist/chunk-TAGQBG3A.js +2 -0
- package/dist/chunk-Z2WVSXPW.js +1 -0
- package/dist/chunk-ZI47WSO6.js +1 -0
- package/dist/dist-FIVA6EPA.js +277 -0
- package/dist/factories-CKVQIMP6.js +1 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.js +1 -1
- package/dist/ipcFactory-KNWHT65X.js +1 -0
- package/dist/native.d.ts +4 -7
- package/dist/native.js +1 -1
- package/dist/openrtc-CBUEX4W4.js +2 -0
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +2 -2
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +2 -2
- package/dist/runtime/index.d.ts +22 -59
- package/dist/runtime/index.js +1 -2
- package/dist/testing.d.ts +7 -17
- package/dist/testing.js +1 -1
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +1 -1
- package/dist/{OpenRTCShared-BswnbjpG.d.ts → types-1ivghCqV.d.ts} +257 -7
- package/dist/{types-D0pqNSOf.d.ts → types-Br65RHyy.d.ts} +2 -2
- package/dist/{types-BHePJWbM.d.ts → types-DHuvdODq.d.ts} +1 -1
- package/package.json +1 -25
- package/dist/OpenRTCShared-TKAQLONA.js +0 -1
- package/dist/WasmBridge-FBEUEAFX.js +0 -1
- package/dist/auth/index.d.ts +0 -78
- package/dist/auth/index.js +0 -1
- package/dist/auth/internal.d.ts +0 -4
- package/dist/auth/internal.js +0 -1
- package/dist/chunk-2QHDEGVX.js +0 -1
- package/dist/chunk-3HCG7RQF.js +0 -2
- package/dist/chunk-7LYYPXCV.js +0 -1
- package/dist/chunk-AHHBPPQW.js +0 -3
- package/dist/chunk-BXFXPIXO.js +0 -1
- package/dist/chunk-EXE6ZAE7.js +0 -1
- package/dist/chunk-I4TY5LGB.js +0 -1
- package/dist/chunk-K37WVIZL.js +0 -1
- package/dist/chunk-N26S7V4N.js +0 -1
- package/dist/chunk-N4SX7C3W.js +0 -2
- package/dist/chunk-NB4H5TP3.js +0 -1
- package/dist/chunk-PDXJVQ7Z.js +0 -2
- package/dist/chunk-Q4QVXWCW.js +0 -1
- package/dist/chunk-RKLFCEAL.js +0 -1
- package/dist/chunk-VK6KX433.js +0 -1
- package/dist/factories-OKSJ3MCY.js +0 -1
- package/dist/ipc-CflAVodw.d.ts +0 -11
- package/dist/ipcFactory-MDM3O5ZJ.js +0 -1
- package/dist/openrtc-C53CKZUM.js +0 -2
- package/dist/runtime/legacy.d.ts +0 -18
- package/dist/runtime/legacy.js +0 -1
- package/dist/runtime/tauri.d.ts +0 -6
- package/dist/runtime/tauri.js +0 -1
- package/dist/tauri-BgLgJoQA.d.ts +0 -33
- package/dist/types-byWIP-WI.d.ts +0 -234
package/dist/chunk-BXFXPIXO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function m(o,u,t){let e;return new Promise((f,n)=>{e=setTimeout(()=>{if(e=void 0,typeof t=="function"){n(t());return}let i=t?`${t} timed out`:"timeout";n(new Error(`${i} after ${u}ms`));},u),o.then(i=>{e!==void 0&&clearTimeout(e),f(i);},i=>{e!==void 0&&clearTimeout(e),n(i);});})}export{m as a};
|
package/dist/chunk-EXE6ZAE7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-7LYYPXCV.js';import {f}from'./chunk-PDXJVQ7Z.js';import {c}from'./chunk-RD3JEGGF.js';function s(i,r){let t=c(i);return a(t,new f({...t,bridge:r}))}export{s as a};
|
package/dist/chunk-I4TY5LGB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-7LYYPXCV.js';import {a as a$2}from'./chunk-AHHBPPQW.js';import {f}from'./chunk-PDXJVQ7Z.js';import {c}from'./chunk-RD3JEGGF.js';var s=false;function a(){s||(s=true,a$2(async()=>{let t=await import('./openrtc-C53CKZUM.js');return {initWasm:t.default,WasmClient:t.WasmClient,start:t.start}}));}async function d(t){a();let e=c(t),{WasmBridge:i}=await import('./WasmBridge-FBEUEAFX.js');return a$1(e,new i(e))}function y(t,e){let i=c(t);return a$1(i,new f({...i,bridge:e}))}export{d as a,y as b};
|
package/dist/chunk-K37WVIZL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function a(n){let e=String(n?.message??n??"").toLowerCase();return e?e.includes("__tauri_internals__")||e.includes("window is not defined")||e.includes("cannot read properties of undefined")?"runtime-unavailable":e.includes("timeout after")?"timeout":e.includes("not found")||e.includes("not allowed")||e.includes("unknown command")||e.includes("plugin not found")||e.includes("plugin:openrtc-tauri-plugin")||e.includes("plugin:openrtc")?"command-unavailable":"unknown":"unknown"}function s(n){return a(n)==="command-unavailable"}function u(n,e="native runtime"){if(!n||typeof n!="object")throw new Error(`[openrtc] ${e} requires a valid IPC bridge object.`);if(typeof n.invoke!="function")throw new Error(`[openrtc] ${e} IPC bridge is missing invoke(command, args).`);if(typeof n.listen!="function")throw new Error(`[openrtc] ${e} IPC bridge is missing listen(event, handler).`);return n}var t=null;async function l(){return t||(t=(async()=>{let n="openrtc-tauri",e="../../../tauri/src/runtime/ipc";try{return await import(n)}catch(r){try{return await import(e)}catch(i){let o=new Error("[openrtc] Native support now lives in the first-party `openrtc-tauri` package. Install `openrtc-tauri` (and `@tauri-apps/api`) or pass an explicit IPC bridge to OpenRTC.native(...).");throw o.cause={packageError:r,workspaceError:i},o}}})()),t}function c(){let n=null,e=async()=>(n||(n=l().then(r=>u(r.createTauriIpcBridge(),"openrtc-tauri"))),n);return {async invoke(r,i){return (await e()).invoke(r,i)},async listen(r,i){return (await e()).listen(r,i)},async isAvailable(){try{let r=await e();return typeof r.isAvailable=="function"?!!await r.isAvailable():!0}catch{return false}}}}export{a,s as b,u as c,c as d};
|
package/dist/chunk-N26S7V4N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=null;function o(t){n=t;}function e(){if(!n)throw new Error("[OpenRTC] The rollback-only Firebase auth host is not installed. OpenRTC 2.0 applications must supply an OpenRTCAuthProvider; legacy runtimes must import openrtc/auth explicitly.");return n()}function i(){return typeof window>"u"?false:!!(window.__TAURI_IPC__||window.__TAURI_INTERNALS__||window.__TAURI__||window.location.protocol==="tauri:"||window.location.hostname==="tauri.localhost")}export{o as a,e as b,i as c};
|
package/dist/chunk-N4SX7C3W.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$3}from'./chunk-BXFXPIXO.js';import {c,a as a$4}from'./chunk-N26S7V4N.js';import {a as a$2}from'./chunk-NB4H5TP3.js';import {b,a as a$1}from'./chunk-RD3JEGGF.js';import {getApps,initializeApp}from'firebase/app';import {getToken,initializeAppCheck,ReCaptchaEnterpriseProvider}from'firebase/app-check';import {getFunctions,connectFunctionsEmulator,httpsCallable}from'firebase/functions';import {browserLocalPersistence,inMemoryPersistence,browserPopupRedirectResolver,initializeAuth,getAuth,connectAuthEmulator,setPersistence,onIdTokenChanged,getIdToken,signInWithCustomToken,onAuthStateChanged,signInAnonymously,signInWithEmailAndPassword,createUserWithEmailAndPassword,signOut,deleteUser,updateProfile,GoogleAuthProvider,OAuthProvider,signInWithCredential,signInWithPopup,signInWithRedirect,getRedirectResult}from'firebase/auth';var I="pluto-rtc-auth";function le(o){return o?.DEV===true||String(o?.VITE_E2E??"").trim().toLowerCase()==="true"}function de(o=c){return o()}function he(o){if(de())return null;let e=typeof import.meta<"u"?import.meta.env:null,n=String(e?.VITE_OPENRTC_APP_CHECK_SITE_KEY??globalThis.__OPENRTC_APP_CHECK_SITE_KEY__??b.recaptchaSiteKey??"").trim(),r=String(e?.VITE_OPENRTC_APP_CHECK_MODE??globalThis.__OPENRTC_APP_CHECK_MODE__??"monitor").trim().toLowerCase();if(!n)return r==="enforce"&&console.error("[PLUTO-RTC][APP-CHECK] Enforcement requested without VITE_OPENRTC_APP_CHECK_SITE_KEY"),null;let t=String(e?.VITE_OPENRTC_APP_CHECK_DEBUG_TOKEN??"").trim();t&&!le(e)?console.error("[PLUTO-RTC][APP-CHECK] Debug tokens are allowed only in development or explicit E2E builds"):t&&typeof self<"u"&&(self.FIREBASE_APPCHECK_DEBUG_TOKEN=t==="true"?true:t);try{return initializeAppCheck(o,{provider:new ReCaptchaEnterpriseProvider(n),isTokenAutoRefreshEnabled:!0})}catch(s){let i=s instanceof Error?s.message:String(s);return i.toLowerCase().includes("already exists")||console.warn("[PLUTO-RTC][APP-CHECK] Initialization failed",{message:i}),null}}var k=null;function Te(){if(typeof globalThis<"u"&&globalThis.__OPENRTC_DEBUG__===true)return true;if(typeof localStorage<"u")try{return localStorage.getItem("openrtc:debug")==="1"}catch{return false}return false}function a(o,e){if(Te()){if(typeof e>"u"){console.log(o);return}console.log(o,e);}}function Ee(o){k=o;}function pe(){return c()}function L(){return typeof navigator>"u"?false:/iPhone|iPad|iPod|Android/i.test(navigator.userAgent||"")}function E(){return pe()&&L()}function u(o,e,n){return a$3(o,e,()=>new Error(`${n} timeout after ${e}ms`))}function H(o){let e="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._",n=new Uint8Array(o);window.crypto.getRandomValues(n);let r="";for(let t=0;t<o;t+=1)r+=e[n[t]%e.length];return r}async function _(o){let n=new TextEncoder().encode(o),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}var P=class{constructor(){this.redirectResultPromise=null;this.redirectResultConsumed=false;this.lastRelayedToken=null;this.lastRelayedRefreshToken=null;let e=getApps().find(t=>t.name===I);this.app=e||initializeApp(b,I),this.appCheck=he(this.app);let n=L(),r=E();if(n)try{let t=r?{persistence:[browserLocalPersistence,inMemoryPersistence]}:{persistence:[browserLocalPersistence,inMemoryPersistence],popupRedirectResolver:browserPopupRedirectResolver};this.auth=initializeAuth(this.app,t),a("[PLUTO-RTC][AUTH-HOST] Using mobile-safe Firebase auth initialization",{appName:this.app.name,persistence:"browserLocalPersistence->inMemoryPersistence",redirectResolver:r?"disabled-for-tauri-mobile":"browserPopupRedirectResolver",tauriMobile:r});}catch{this.auth=getAuth(this.app),console.warn("[PLUTO-RTC][AUTH-HOST] Mobile-safe auth initialization unavailable; falling back to default getAuth");}else this.auth=getAuth(this.app);this.functions=getFunctions(this.app,a$1);try{let t=typeof globalThis<"u"?String(globalThis.__OPENRTC_AUTH_EMULATOR_HOST__??"").trim():"",s=typeof globalThis<"u"?String(globalThis.__OPENRTC_FUNCTIONS_EMULATOR_HOST__??"").trim():"",i=typeof import.meta<"u"?import.meta.env:null;if(!!t||!!s||!!i&&String(i.VITE_USE_EMULATORS)==="true"&&(i.DEV||String(i.VITE_E2E)==="true")){let R=String(i?.VITE_OPENRTC_EMULATOR_HOST??"127.0.0.1").trim()||"127.0.0.1",[D,F]=t.split(":"),[W,K]=s.split(":"),M=(D??"").trim()||R,V=(W??"").trim()||R,x=Number(F??i?.VITE_OPENRTC_AUTH_EMULATOR_PORT??9100),z=Number(K??i?.VITE_OPENRTC_FUNCTIONS_EMULATOR_PORT??5002);try{connectAuthEmulator(this.auth,`http://${M}:${x}`,{disableWarnings:!0});}catch{}try{connectFunctionsEmulator(this.functions,V,z);}catch{}}}catch{}n?this.persistenceReady=Promise.resolve():this.persistenceReady=setPersistence(this.auth,browserLocalPersistence).catch(t=>{console.warn("[PLUTO-RTC][AUTH-HOST] Failed to set auth persistence",{message:t?.message});}),a("[PLUTO-RTC][AUTH-HOST] Initialized auth host",{appName:this.app.name,mobileSafeAuth:n}),onIdTokenChanged(this.auth,t=>{a("[PLUTO-RTC][AUTH-HOST] Firebase ID token changed",{hasUser:!!t,uid:t?.uid,providerDataCount:t?.providerData?.length||0}),this.syncDesktopAuthToken(t);});}async syncDesktopAuthToken(e,n=false){if(!k)return;let r=e?await getIdToken(e,n).catch(()=>null):null,t=e?e.refreshToken??null:null;if(r===this.lastRelayedToken&&t===this.lastRelayedRefreshToken)return;this.lastRelayedToken=r,this.lastRelayedRefreshToken=t;let s=await Promise.allSettled([Promise.resolve(k({authToken:r,refreshToken:t}))]);s[0]?.status==="rejected"&&console.warn("[PLUTO-RTC][AUTH-HOST] Failed to relay auth token to desktop backend",{message:s[0].reason?.message});}getApp(){return this.app}getFunctions(){return this.functions}async getAppCheckToken(e=false){if(!this.appCheck)return null;try{return (await getToken(this.appCheck,e)).token?.trim()||null}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn("[PLUTO-RTC][APP-CHECK] Token acquisition failed",{message:r}),null}}getCurrentUser(){return this.auth.currentUser}getAuth(){return this.auth}onAuthStateChanged(e){return a("[PLUTO-RTC][AUTH-HOST] onAuthStateChanged listener registered (via onIdTokenChanged)"),onIdTokenChanged(this.auth,e)}onIdTokenChanged(e){return a("[PLUTO-RTC][AUTH-HOST] onIdTokenChanged listener registered"),onIdTokenChanged(this.auth,e)}async getIdToken(e){return this.auth.currentUser?getIdToken(this.auth.currentUser,e?.forceRefresh??false):null}async checkForSSOToken(){if(typeof window>"u")return;let e=new URLSearchParams(window.location.search),n=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash),r=e.get("token")||n.get("token")||(e.get("custom_token")==="true"||n.get("custom_token")==="true"?e.get("id_token")||n.get("id_token"):null);if(r)try{await this.persistenceReady,await signInWithCustomToken(this.auth,r),window.history.replaceState({},document.title,window.location.pathname);}catch(t){console.error("[PLUTO-RTC][AUTH-HOST] SSO sign-in failed:",t);}}async signInWithCustomTokenValue(e){return await this.persistenceReady,(await signInWithCustomToken(this.auth,e)).user}async signInWithPluto(e){if(typeof window>"u")throw new Error("Pluto SSO requires a browser environment.");let n=e?.redirectUri||window.location.href,r=e?.authorizeBaseUrl||"https://pluto.openrtc.app/sso/authorize",t=new URL(r);t.searchParams.set("redirect_uri",n),window.location.assign(t.toString());}async waitForAuth(){if(await this.persistenceReady,!this.auth.currentUser)return new Promise(e=>{let n=onAuthStateChanged(this.auth,r=>{r&&(n(),e());});})}async signInAnonymously(){await signInAnonymously(this.auth);}async signIn(e,n){return (await signInWithEmailAndPassword(this.auth,e,n)).user}async signUp(e,n){return (await createUserWithEmailAndPassword(this.auth,e,n)).user}async signOut(){await signOut(this.auth);}async deleteAccount(){if(!this.auth.currentUser)throw new Error("No user signed in");await deleteUser(this.auth.currentUser);}async signInWithCredential(e){let n=Date.now();if(a("[PLUTO-RTC][AUTH-HOST] signInWithCredential start",{callbackId:e.callbackId,provider:e.provider,hasIdToken:!!e.idToken,hasAccessToken:!!e.accessToken,hasNonce:!!e.nonce}),e.isCustomToken){a("[PLUTO-RTC][AUTH-HOST] signInWithCredential: custom token detected, using signInWithCustomToken");try{if(E())a("[PLUTO-RTC][AUTH-HOST] Skipping authStateReady before custom token sign-in on Tauri mobile",{callbackId:e.callbackId});else {a("[PLUTO-RTC][AUTH-HOST] Awaiting authStateReady...");try{await u(this.auth.authStateReady(),5e3,"authStateReady"),a("[PLUTO-RTC][AUTH-HOST] Auth state ready, signing in with custom token...");}catch(i){console.warn("[PLUTO-RTC][AUTH-HOST] authStateReady did not resolve in time; continuing custom token sign-in",{callbackId:e.callbackId,message:i?.message});}}let s;try{s=await u(signInWithCustomToken(this.auth,e.idToken),25e3,"signInWithCustomToken (custom token path)");}catch(i){console.warn("[PLUTO-RTC][AUTH-HOST] First custom token sign-in attempt failed; retrying once",{callbackId:e.callbackId,message:i?.message,code:i?.code}),await a$2(250),s=await u(signInWithCustomToken(this.auth,e.idToken),25e3,"signInWithCustomToken (custom token path retry)");}if(a("[PLUTO-RTC][AUTH-HOST] signInWithCustomToken success",{callbackId:e.callbackId,provider:e.provider,uid:s.user?.uid,elapsedMs:Date.now()-n}),s.user&&(e.displayName||e.photoURL))try{await updateProfile(s.user,{displayName:e.displayName||s.user.displayName||void 0,photoURL:e.photoURL||s.user.photoURL||void 0});}catch(i){console.warn("[PLUTO-RTC][AUTH-HOST] Failed to update custom-token user profile",{callbackId:e.callbackId,message:i?.message});}return s.user}catch(t){throw console.error("[PLUTO-RTC][AUTH-HOST] signInWithCustomToken failed",{callbackId:e.callbackId,error:t?.message,code:t?.code,stack:t?.stack,elapsedMs:Date.now()-n}),t}}let r;e.provider==="google"?r=GoogleAuthProvider.credential(e.idToken,e.accessToken):r=new OAuthProvider("apple.com").credential({idToken:e.idToken,rawNonce:e.nonce,accessToken:e.accessToken});try{let t=await u(signInWithCredential(this.auth,r),1e4,"firebase signInWithCredential");return a("[PLUTO-RTC][AUTH-HOST] signInWithCredential success",{callbackId:e.callbackId,provider:e.provider,uid:t.user?.uid,elapsedMs:Date.now()-n}),t.user}catch(t){console.warn("[PLUTO-RTC][AUTH-HOST] signInWithCredential primary path failed; trying custom token fallback",{callbackId:e.callbackId,provider:e.provider,elapsedMs:Date.now()-n,code:t?.code,message:t?.message});let s=await u(this.mintSessionTokenFromProviderToken(e),15e3,"mintSessionTokenFromProviderToken"),i=await u(signInWithCustomToken(this.auth,s),15e3,"signInWithCustomToken");return a("[PLUTO-RTC][AUTH-HOST] signInWithCustomToken fallback success",{callbackId:e.callbackId,provider:e.provider,uid:i.user?.uid,elapsedMs:Date.now()-n}),i.user}}async mintSessionTokenFromProviderToken(e){let n=httpsCallable(this.functions,"mintSessionToken");a("[PLUTO-RTC][AUTH-HOST] mintSessionToken fallback request start",{provider:e.provider,hasIdToken:!!e.idToken,hasNonce:!!e.nonce});let t=(await n({provider:e.provider,idToken:e.idToken,nonce:e.nonce,idempotencyKey:`provider-token:${e.callbackId}`})).data?.token;if(!t)throw new Error("mintSessionToken did not return a token for provider exchange");return a("[PLUTO-RTC][AUTH-HOST] mintSessionToken fallback request success",{provider:e.provider}),t}async signInWithPopup(e){if(e==="google"){let s=new GoogleAuthProvider;s.addScope("email"),s.addScope("profile"),s.setCustomParameters({prompt:"select_account"});let i=await signInWithPopup(this.auth,s);return {idToken:await getIdToken(i.user,true),refreshToken:i.user.refreshToken}}let n=new OAuthProvider("apple.com");n.addScope("email"),n.addScope("name");let r=H(32);typeof sessionStorage<"u"&&sessionStorage.setItem("apple_auth_nonce",r),n.setCustomParameters({nonce:await _(r)});let t=await signInWithPopup(this.auth,n);return {idToken:await getIdToken(t.user,true),refreshToken:t.user.refreshToken}}async signInWithRedirect(e,n){if(e==="google"){let s=new GoogleAuthProvider;s.addScope("email"),s.addScope("profile"),s.setCustomParameters({prompt:"select_account"}),await signInWithRedirect(this.auth,s);return}let r=new OAuthProvider("apple.com");r.addScope("email"),r.addScope("name");let t=n?.nonce||H(32);typeof sessionStorage<"u"&&sessionStorage.setItem("apple_auth_nonce",t),r.setCustomParameters({nonce:await _(t)}),await signInWithRedirect(this.auth,r);}async consumeRedirectResult(){return this.redirectResultConsumed?(a("[PLUTO-RTC][AUTH-HOST] consumeRedirectResult skipped (already consumed)"),null):this.redirectResultPromise?this.redirectResultPromise:(this.redirectResultPromise=(async()=>{try{a("[PLUTO-RTC][AUTH-HOST] consumeRedirectResult start");let e=await getRedirectResult(this.auth);if(!e)return a("[PLUTO-RTC][AUTH-HOST] consumeRedirectResult: no redirect result"),{fromRedirect:!1,user:null};this.redirectResultConsumed=!0;let n=await getIdToken(e.user,!0).catch(()=>null),r=e.providerId||e.user.providerData?.[0]?.providerId||null;return a("[PLUTO-RTC][AUTH-HOST] consumeRedirectResult success",{uid:e.user.uid,providerId:r,hasIdToken:!!n}),{fromRedirect:!0,user:e.user,providerId:r,idToken:n}}finally{this.redirectResultPromise=null;}})(),this.redirectResultPromise)}async startGoogleSignIn(){await this.signInWithRedirect("google");}async startAppleSignIn(){await this.signInWithRedirect("apple");}async mintSessionToken(){let e=httpsCallable(this.functions,"mintSessionToken");if(typeof globalThis.crypto?.randomUUID!="function")throw new Error("Secure request identity is unavailable for token minting.");let r=(await e({idempotencyKey:`hosted-token:${globalThis.crypto.randomUUID()}`})).data;if(!r?.token)throw new Error("mintSessionToken did not return a token");return r.token}},f=null;function N(){return f||(f=new P),f}function He(){a$4(N);}var _e=new Proxy({},{get(o,e,n){let r=N(),t=r[e];return typeof t=="function"?t.bind(r):t}});
|
|
2
|
-
export{Ee as a,N as b,He as c,_e as d};
|
package/dist/chunk-NB4H5TP3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function b(e){return new Promise(t=>setTimeout(t,e))}function g(e){let t=new Uint8Array(e.byteLength);return t.set(e),t}function R(e){let t=e.reduce((i,o)=>i+o.byteLength,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.byteLength;return r}function S(e,t,r){let n=t*Math.pow(2,Math.max(0,e-1));return Math.min(r,n)}function A(e){try{let t=e;return !!t&&!!t.send&&typeof t.send.getWriter=="function"&&!!t.recv&&typeof t.recv.getReader=="function"}catch{return false}}function B(e,t,r){let n=e;if(!n)return null;try{let i=n.send,o=n.recv;if(!i||typeof i.getWriter!="function"||!o||typeof o.getReader!="function")return null;let s=typeof n.endpoint_id=="string"&&n.endpoint_id.trim().length>0?n.endpoint_id:t,d=Number.isSafeInteger(n.transport_stable_id)&&Number(n.transport_stable_id)>0?Number(n.transport_stable_id):void 0,u=Number.isSafeInteger(r)&&Number(r)>0?Number(r):void 0;if(d!==void 0&&u!==void 0&&d!==u)return null;let a=d??u;return {send:i,recv:o,endpoint_id:s,...a?{transport_stable_id:a}:{}}}catch{return null}}function h(e,t){let r={send:e.send,recv:t,endpoint_id:typeof e.endpoint_id=="string"?e.endpoint_id:"",...Number.isSafeInteger(e.transport_stable_id)&&Number(e.transport_stable_id)>0?{transport_stable_id:Number(e.transport_stable_id)}:{}};return e?.applicationCryptoWrapped===true&&(r.applicationCryptoWrapped=true),r}async function U(e,t){if(!e)return false;try{let r=e.send?.getWriter?.();if(r)try{await r.close();}catch{}finally{try{r.releaseLock();}catch{}}}catch{}try{let r=e.recv?.getReader?.();if(r)try{await r.cancel(t);}catch{}finally{try{r.releaseLock();}catch{}}}catch{}return true}function _(e,t,r={}){let n=r.context??"prependBytesToReader",i=r.traceId,o=t.byteLength===0,s=r.pendingRead??null,d=a=>r.release?.(a),u=(a,l)=>r.log?.(a,l);return new ReadableStream({async pull(a){if(!o){o=true,a.enqueue(t);return}if(s){let c=s;s=null;let y;try{y=await c;}catch(p){a.error(p),d("pending-read-error"),u("prepend-bytes:pending-read-error",{context:n,traceId:i||null,error:p?.message||String(p)});return}if(y.done){a.close(),d("pending-done");return}y.value&&a.enqueue(y.value);return}let l;try{l=await e.read();}catch(c){a.error(c),d("read-error"),u("prepend-bytes:read-error",{context:n,traceId:i||null,error:c?.message||String(c)});return}let{done:m,value:f}=l;if(m){a.close(),d("done");return}f&&a.enqueue(f);},async cancel(a){d("cancel");}})}async function w(e,t){let r=e.read(),n=t-Date.now();if(n<=0)return {status:"timeout",pendingRead:r};let i=Symbol("probe-timeout"),o,s=new Promise(d=>{o=setTimeout(()=>d(i),n);});try{let d=await Promise.race([r,s]);if(d===i)return {status:"timeout",pendingRead:r};let{done:u,value:a}=d;return u?{status:"done"}:{status:"data",value:a&&a.byteLength>0?new Uint8Array(a):new Uint8Array(0)}}finally{o&&clearTimeout(o);}}export{b as a,g as b,R as c,S as d,A as e,B as f,h as g,U as h,_ as i,w as j};
|
package/dist/chunk-PDXJVQ7Z.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-4UZFT2P6.js';import {o,u,w,s,h as h$1,g,j as j$2,k as k$1,l,m,n}from'./chunk-3HCG7RQF.js';import {c as c$1,b as b$1}from'./chunk-VK6KX433.js';import {c,d as d$1,b}from'./chunk-K37WVIZL.js';import {a as a$2}from'./chunk-BXFXPIXO.js';import {c as c$2,b as b$2}from'./chunk-N26S7V4N.js';import {d,a}from'./chunk-NB4H5TP3.js';import {d as d$2,j as j$1}from'./chunk-RD3JEGGF.js';var H="relay-only endpoint ticket unavailable",Q=12e3,X=250,Z=1500;function ee(g){return String(g?.message??g??"").toLowerCase().includes(H)}async function E(g,e={}){let t=e.windowMs??Q,i=e.minDelayMs??X,a$1=e.maxDelayMs??Z,n=Date.now(),s=0,o=null;for(;e.isActive?.()??true;){s+=1;try{return await g()}catch(c){if(o=c,!ee(c))throw c;let d$1=Date.now()-n;if(d$1>=t)throw c;let r=Math.min(d(s,i,a$1),Math.max(0,t-d$1));r>0&&await a(r);}}throw o||new Error("endpoint ticket minting stopped before a ticket was available")}function Y(g){let e=g?.split(".")[1];if(!e)return null;try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),i=(4-t.length%4)%4,a=atob(t+"=".repeat(i)),n=JSON.parse(a);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function k(g,e){let t=g?.[e];return typeof t=="string"&&t.trim()?t.trim():null}function j(g,e,t){let i=k(g,"namespaceId")===e||k(g,"appTag")===`space::${e}`,a=k(g,"developerAppTag");return i&&!!a&&(!t||a===t)}function ae(g){let e=k(g,"developerAppTag");if(e)return e;let t=k(g,"appTag");return t&&!t.startsWith("space::")?t:null}var h=class h{constructor(e){this.subscriptionNonce=0;this.lastSyncedAuthToken=null;this.cachedLocalDeviceId=null;this.cachedLocalDeviceName=null;this.tauriCoreAvailability=null;this.tauriCoreAvailabilityValue=null;this.tauriCoreAvailabilityCheckedAtMs=0;this.authSyncInFlight=null;this.nativeTrustTokenUnsubscribe=null;this.nativeTrustRelayQueue=Promise.resolve();this.nativeTrustRelayError=null;this.nativeRuntimeCapabilitiesSyncInFlight=null;this.gatewayDesiredPeersCleanup=null;this.gatewayDesiredPeerRelayKey=null;this.gatewayDesiredPeerRelayGeneration=0;this.gatewayDesiredPeerRevision=0;this.gatewayDesiredPeerSubmission=Promise.resolve();this.gatewayDesiredPeerLifecycle=Promise.resolve();this.gatewayExcludedPeers=new Set;this.lastNativeAuthSyncAtMs=0;this.runtimeCapabilities=u(null,false);this.fallback=new w({...e,coordinationPlatformType:"desktop"}),this.app=this.fallback.app,this.auth=this.fallback.auth,this.appTag=this.fallback.tag,this.options=this.fallback.getResolvedOptions(),this.transportOptions=e.transports,this.strictMode=e.strictMode===true,this.turnCredentialsProvider=e.turnCredentialsProvider,this.allowWasmFallback=e.allowWasmFallback??false,this.ipcBridge=c(e.ipcBridge??d$1(),"NativeIpcBridge"),this.runtimeCapabilities=u(null,this.allowWasmFallback),this.syncNativeRuntimeCapabilities("constructor");}get currentUser(){return this.fallback.currentUser}get tag(){return this.fallback.tag}getRuntimeCapabilities(){let e=s(this.runtimeCapabilities);return e.fallback.wasm=this.allowWasmFallback,e}usesCoordinationGateway(){return this.fallback.usesCoordinationGateway()}assertManagedCoordinationGateway(){if(!this.usesCoordinationGateway())throw new Error("[OpenRTC] Native managed coordination requires coordinationGateway; the legacy native Firebase data plane has been removed.")}async joinCoordinationRoom(e,t,i){await this.syncCoordinationDeviceIdentity(),await this.fallback.joinCoordinationRoom(e,t,i);}leaveCoordinationRoom(e){return this.fallback.leaveCoordinationRoom(e)}getCoordinationRoomMembers(e){return this.fallback.getCoordinationRoomMembers(e)}watchCoordinationRoomMembers(e,t){return this.fallback.watchCoordinationRoomMembers(e,t)}async syncCoordinationDeviceIdentity(){if(!this.usesCoordinationGateway())return;let e=await this.getLocalDeviceInfo().catch(()=>null),t=e?.deviceId||await this.resolveLocalDeviceId();this.fallback.setCoordinationLocalDeviceId(t),this.fallback.setCoordinationPlatformType(this.normalizeNativeCoordinationPlatform(e?.platformType));}setWasmClient(e){if(!this.allowWasmFallback){let t="[NativeIpcBridge][NATIVE-GUARD] Refusing WasmClient attachment because native IPC is authoritative and WASM fallback is disabled.";throw console.error(t,{capabilities:this.getRuntimeCapabilities()}),new Error(t)}this.fallback.setWasmClient(e);}onAuthChange(e){return this.fallback.onAuthChange(e)}checkForSSOToken(){return this.fallback.checkForSSOToken()}waitForAuth(){return this.fallback.waitForAuth()}signInAnonymously(){return this.fallback.signInAnonymously()}getTurnCredentials(){return this.fallback.getTurnCredentials()}cleanupStaleDevices(){return this.fallback.cleanupStaleDevices()}sendMessage(e,t,i,a){return this.fallback.sendMessage(e,t,i,a)}pollMessages(e){return this.fallback.pollMessages(e)}watchFriendDevices(e,t){return this.assertManagedCoordinationGateway(),this.fallback.watchFriendDevices(e,t)}async updateFriendTicket(e){this.assertManagedCoordinationGateway(),await this.syncCoordinationDeviceIdentity(),await this.fallback.updateFriendTicket(e);}createSession(e){return this.fallback.createSession(e)}updateSession(e,t){return this.fallback.updateSession(e,t)}async openPeerBi(e,t){return await this.canUseTauriIpc()?this.openPeerBiViaIpc("open_peer_bi_stream",{peerId:e,timeoutMs:t??null}):this.fallback.openPeerBi(e,t)}async openPeerBiTransportOnly(e,t){return await this.canUseTauriIpc()?this.openPeerBiViaIpc("open_peer_bi_transport_only_stream",{peerId:e,timeoutMs:t??null},{fallbackCommand:"open_peer_bi_stream"}):this.fallback.openPeerBiTransportOnly(e,t)}async openPeerNativeBi(e,t,i){return await this.canUseTauriIpc()?this.openPeerBiViaIpc("open_peer_native_bi_stream",{peerId:e,label:t,timeoutMs:i??null},{fallbackCommand:"open_peer_bi_stream",fallbackArgs:{peerId:e,timeoutMs:i??null}}):this.fallback.openPeerNativeBi(e,t,i)}async incoming_streams(){if(!await this.canUseTauriIpc()){let n=this.fallback;if(typeof n.incoming_streams=="function")return n.incoming_streams();throw new Error("Native incoming stream bridge is unavailable")}let e=`native-incoming-${Date.now()}-${++this.subscriptionNonce}`,t=null,i=false,a=async()=>{i=true;let n=t;t=null,await Promise.allSettled([n?Promise.resolve(n()):Promise.resolve(),this.invokeIpc("stop_rtc_subscription",{requestId:e},{timeoutMs:null}).catch(()=>{})]);};return new ReadableStream({start:async n=>{try{t=await this.listenIpc("openrtc://peer-bi-stream/incoming",s=>{if(i)return;let o=s.payload,c=typeof o?.requestId=="string"?o.requestId:typeof o?.request_id=="string"?o.request_id:"";if(c!==e){c$1("[NativeIpcBridge][incoming-application-stream] ignored request id",{expectedRequestId:e,eventRequestId:c});return}let d=typeof o?.streamId=="string"?o.streamId.trim():typeof o?.stream_id=="string"?o.stream_id.trim():"";if(!d)return;let r=typeof o?.remoteNodeId=="string"?o.remoteNodeId.trim():typeof o?.remote_node_id=="string"?o.remote_node_id.trim():"",l=Number.isSafeInteger(o?.transportStableId)?Number(o.transportStableId):Number.isSafeInteger(o?.transport_stable_id)?Number(o.transport_stable_id):0;if(!r||l<=0){c$1("[NativeIpcBridge][incoming-application-stream] ignored invalid generation",{requestId:e,remoteNodeId:r,transportStableId:l});return}c$1("[NativeIpcBridge][incoming-application-stream] accepted event",{requestId:e,remoteNodeId:r,transportStableId:l});let u=this.peerBiStreamFromId(d,{startReadAfterListeners:!0});n.enqueue({type:"bi",stream:{send:u.writable,recv:u.readable,endpoint_id:r},endpointId:r,transportStableId:l,protocolHint:"unknown",channel:null});}),await this.invokeIpc("start_incoming_peer_bi_streams",{requestId:e},{timeoutMs:null});}catch(s){i=true,n.error(s),await a();}},cancel:async()=>{await a();}})}async is_current_transport_stable_id(e,t){if(!await this.canUseTauriIpc()){let i=this.fallback;return typeof i.is_current_transport_stable_id=="function"?i.is_current_transport_stable_id(e,t):false}return !e.trim()||t<=0n||t>BigInt(Number.MAX_SAFE_INTEGER)?false:this.invokeIpc("is_current_transport_stable_id",{endpointId:e.trim(),transportStableId:Number(t)})}openPeerUni(e,t){return this.fallback.openPeerUni(e,t)}isConnected(e){return this.fallback.isConnected(e)}getAuthContext(){return this.fallback.getAuthContext()}resolveNativeAuthScopedUserId(e){return this.currentUser?.id??this.getAuthContext()?.userId??e??null}resolveConfiguredSpaceKey(){let e=this.options.spaceKey??this.options.space;return typeof e=="string"?e.trim():""}usesAnonymousSpaceMode(){return this.options.authMode==="anonymous"&&this.resolveConfiguredSpaceKey().length>0}requiresNativeAuthToken(){return !this.usesAnonymousSpaceMode()||typeof this.options.spaceTokenProvider=="function"}async nativeAuthTokenMatchesExpectedScope(e){if(!this.usesAnonymousSpaceMode())return true;let t=typeof this.options.apiKey=="string"?this.options.apiKey.trim():"",i=this.resolveConfiguredSpaceKey();if(!t||!i)return true;let a=await d$2(t,i).catch(()=>null);return a?j(Y(e),a):true}resolveNativeSignalingUserId(e){return this.usesAnonymousSpaceMode()?(typeof e=="string"?e.trim():"")||this.resolveConfiguredSpaceKey()||null:this.resolveNativeAuthScopedUserId(e)}getCurrentUserId(){return this.resolveNativeSignalingUserId(this.fallback.getCurrentUserIdForScope())}nativeAuthWaitMs(){return this.requiresNativeAuthToken()?h.AUTH_REQUIRED_WAIT_MS:0}resolveWebLogicalDeviceId(){return this.fallback.getResolvedWebLogicalDeviceId()}normalizeDevice(e,t){return this.fallback.normalizeDeviceRecord(e,t)}matchesTag(e){return this.fallback.matchesLegacyOrCurrentTag(e)}nativeRosterTagDisposition(e){let t=h$1(e);if(this.matchesTag(t))return {keep:true,classification:"match"};let i=typeof t.appTag=="string"&&t.appTag.trim().length>0?t.appTag.trim():typeof t.tag=="string"&&t.tag.trim().length>0?t.tag.trim():void 0;return i===void 0?{keep:true,classification:"untagged"}:{keep:false,classification:"foreign",foreignTag:i}}filterNativeRosterByTag(e,t){let i=new Set,a=e.filter(n=>{let s=this.nativeRosterTagDisposition(n);return !s.keep&&s.foreignTag&&i.add(s.foreignTag),s.keep});return e.length>0&&a.length===0&&i.size>0?console.warn(`[NativeIpcBridge] ${t}: dropped ALL ${e.length} native device(s) as foreign-app \u2014 this is the app-tag drift signature (empty native device list). The native Rust OpenRTC app tag does not match the SDK app tag; check that the desktop binary and the web bundle use the same VITE_PLUTO_OPENRTC_API_KEY / VITE_PLUTO_OPENRTC_APP_TAG for this environment lane.`,{sdkAppTag:this.appTag,foreignTags:Array.from(i),droppedCount:e.length}):i.size>0&&c$1(`[NativeIpcBridge] ${t}: filtered ${e.length-a.length} foreign-app device(s) from the native roster`,{sdkAppTag:this.appTag,foreignTags:Array.from(i)}),a}normalizeNativeIceServer(e){let t=e.urls,i=Array.isArray(t)?t.filter(a=>typeof a=="string"&&a.trim().length>0):typeof t=="string"&&t.trim().length>0?[t]:[];return i.length===0?null:{urls:i,username:typeof e.username=="string"&&e.username.trim().length>0?e.username:void 0,credential:typeof e.credential=="string"&&e.credential.trim().length>0?e.credential:void 0}}filterNativeStunServers(e){return e.map(t=>({...t,urls:t.urls.filter(i=>!i.startsWith("stun:"))})).filter(t=>t.urls.length>0)}nativeIceServerHasTurnUrl(e){return e.urls.some(t=>t.startsWith("turn:")||t.startsWith("turns:"))}async loadNativeTurnIceServers(){if(typeof this.turnCredentialsProvider!="function")return [];let e=await this.turnCredentialsProvider().catch(t=>(console.warn("[NativeIpcBridge] TURN credential provider failed:",t),null));return !e||!Array.isArray(e.iceServers)?[]:e.iceServers.map(t=>this.normalizeNativeIceServer(t)).filter(t=>!!t)}async buildNativeTransportConfigPayload(){let e=this.transportOptions;if(!e&&!this.strictMode)return null;let t;!this.strictMode&&e?.iroh&&(typeof e.iroh=="object"&&e.iroh.localDiscovery===false?t=null:t={enabled:true,advertise:typeof e.iroh!="object"||e.iroh.localDiscoveryMode!=="passive"});let i=null;if(e?.webrtc===true||e?.webrtc&&typeof e.webrtc=="object"){let d=e.webrtc===true?null:e.webrtc,r=d?.useDefaultIceServers!==false,l=Array.isArray(d?.iceServers)&&d.iceServers.length>0?d.iceServers.map(y=>this.normalizeNativeIceServer(y)).filter(y=>!!y):r?j$1.map(y=>this.normalizeNativeIceServer(y)).filter(y=>!!y):[],u=this.strictMode||d?.privacyMode===true;(this.strictMode||d?.privacyMode===true||d?.useTurn===true)&&(l=[...l,...await this.loadNativeTurnIceServers()]),u&&(l=this.filterNativeStunServers(l));let m=l.some(y=>this.nativeIceServerHasTurnUrl(y)),v=u&&m;u&&!m&&console.warn("[NativeIpcBridge] Relay-only WebRTC requested, but no TURN servers are configured; native WebRTC override disabled");let _=d?.lanMode===true;(l.length>0||v||_||!r)&&(i={iceServers:l.length>0||!r?l:void 0,privacyMode:v,lanMode:_||void 0});}let a=null;if(e?.moq&&typeof e.moq=="object"){let d=typeof e.moq.relayUrl=="string"&&e.moq.relayUrl.trim().length>0?e.moq.relayUrl:void 0;if(d){let r=typeof e.moq.accessToken=="string"&&e.moq.accessToken.trim().length>0?e.moq.accessToken.trim():void 0;a={relayUrl:d,accessToken:r};}}let n=null;if(!this.strictMode&&(e?.ble===true||e?.ble&&typeof e.ble=="object")){let d=e.ble===true?null:e.ble,r=Number(d?.connectTimeoutMs);n={enabled:d?.enabled!==false,connectTimeoutMs:Number.isFinite(r)&&r>0?Math.round(r):void 0};}let s=this.strictMode||e?.iroh&&typeof e.iroh=="object"&&e.iroh.relayOnly===true,o=e?.iroh&&typeof e.iroh=="object"?e.iroh.relayTransportPolicy:void 0,c=this.strictMode?o??"auto":o;return !s&&!c&&!i&&!a&&!t&&!n?null:{irohRelayOnly:s||void 0,irohRelayTransportPolicy:c,...t!==void 0?{irohLan:t}:{},webrtc:i,moq:a,ble:n}}isTauriEnv(){return c$2()}nextConnectionEventRetryDelayMs(e){return d(e,h.CONNECTION_EVENT_RETRY_MIN_DELAY_MS,h.CONNECTION_EVENT_RETRY_MAX_DELAY_MS)}async clearNativeAuthRelay(e){if(await this.canUseTauriIpc())try{typeof this.options.coordinationGateway?.grantProvider=="function"?await this.invokeIpc("openrtc_v2_set_identity_credential",{identityCredential:null}):await this.invokeIpc("desktop_set_pluto_auth_token",{authToken:null,refreshToken:null}),this.lastSyncedAuthToken=null,this.lastNativeAuthSyncAtMs=0,c$1(`[NativeIpcBridge] cleared native auth relay (${e})`);}catch(t){console.warn(`[NativeIpcBridge] failed clearing native auth relay (${e}):`,t);}}async clearNativeTrustRelay(e){if(this.nativeTrustTokenUnsubscribe?.(),this.nativeTrustTokenUnsubscribe=null,this.nativeTrustRelayError=null,this.fallback.invalidateCoordinationNativeTrustToken(),typeof this.options.coordinationGateway?.grantProvider!="function"&&await this.canUseTauriIpc())try{await this.invokeIpc("openrtc_set_native_trust_token",{trustToken:null,expiresAtMs:null}),c$1(`[NativeIpcBridge] cleared native trust relay (${e})`);}catch(t){b(t)||console.warn(`[NativeIpcBridge] failed clearing native trust relay (${e}):`,t);}}relayNativeTrustToken(e,t){let i=async()=>{await this.canUseTauriIpc()&&(await this.invokeIpc("openrtc_set_native_trust_token",{trustToken:e?.token??null,expiresAtMs:e?.expiresAtMs??null}),c$1(`[NativeIpcBridge] native trust token ${e?"relayed":"cleared"} (${t})`));},a=this.nativeTrustRelayQueue.then(i,i);return this.nativeTrustRelayQueue=a.catch(()=>{}),a}async ensureNativeTrustRelay(e=false){if(!this.usesCoordinationGateway()||typeof this.options.coordinationGateway?.grantProvider=="function")return true;if(typeof this.options.coordinationGateway?.nativeTrustTokenProvider!="function")return false;if(!await this.canUseTauriIpc())return true;try{let t=await this.fallback.getCoordinationNativeTrustToken(e);return await this.relayNativeTrustToken(t,"auth-ready"),this.nativeTrustRelayError=null,this.nativeTrustTokenUnsubscribe||(this.nativeTrustTokenUnsubscribe=this.fallback.subscribeCoordinationNativeTrustToken(i=>{this.relayNativeTrustToken(i,"provider-refresh").catch(a=>{console.warn("[NativeIpcBridge] native trust token refresh relay failed:",a);});},{emitCurrent:!1})),!0}catch(t){return this.nativeTrustRelayError=(t instanceof Error?t.message:String(t)).trim().slice(0,300)||"unknown provider failure",console.warn("[NativeIpcBridge] native trust token unavailable:",t),false}}async relayNativeAuthToken(e,t,i,a){if(!await this.canUseTauriIpc())return true;if(!await this.nativeAuthTokenMatchesExpectedScope(e))return c$1(`[NativeIpcBridge] auth sync deferred (${i}): token claims do not match configured space`),false;if(e===this.lastSyncedAuthToken)return true;try{typeof this.options.coordinationGateway?.grantProvider=="function"?await this.invokeIpc("openrtc_v2_set_identity_credential",{identityCredential:e}):await this.invokeIpc("desktop_set_pluto_auth_token",{authToken:e,refreshToken:t??null});}catch(n){return b(n)?console.warn(`[NativeIpcBridge] desktop auth relay unavailable (${i}); install/register openrtc-tauri-plugin and include its default permission set.`,n):console.warn(`[NativeIpcBridge] desktop auth relay failed (${i}):`,n),false}return this.lastSyncedAuthToken=e,this.lastNativeAuthSyncAtMs=Date.now(),c$1(`[NativeIpcBridge] auth token relayed to native runtime (${i}) user_id=${a??this.currentUser?.id??"unknown"}`),true}async relayExplicitNativeAuthContext(e){let t=this.authSyncInFlight,i=(async()=>(await t?.catch(()=>{}),this.relayNativeAuthToken(e.token,e.refreshToken,"setAuthContext",e.userId)))();this.authSyncInFlight=i;try{return await i}finally{this.authSyncInFlight===i&&(this.authSyncInFlight=null);}}applyNativeRuntimeStatus(e){this.runtimeCapabilities=u(e,this.allowWasmFallback);}syncNativeRuntimeCapabilities(e){return this.ipcBridge?this.nativeRuntimeCapabilitiesSyncInFlight?this.nativeRuntimeCapabilitiesSyncInFlight:(this.nativeRuntimeCapabilitiesSyncInFlight=(async()=>{try{let t=await this.invokeIpc("rtc_native_status",void 0,{timeoutMs:h.NATIVE_STATUS_IPC_TIMEOUT_MS});this.applyNativeRuntimeStatus(t),c$1(`[NativeIpcBridge] refreshed native runtime capabilities (${e})`);}catch(t){b$1("[NativeIpcBridge] native runtime capability refresh skipped",t);}})().finally(()=>{this.nativeRuntimeCapabilitiesSyncInFlight=null;}),this.nativeRuntimeCapabilitiesSyncInFlight):Promise.resolve()}async canUseTauriIpc(){if(this.ipcBridge){let e=typeof this.ipcBridge.isAvailable=="function"?!!await this.ipcBridge.isAvailable():true;return e&&this.syncNativeRuntimeCapabilities("ipc-available"),e}return typeof window>"u"?false:this.tauriCoreAvailabilityValue===true?true:this.tauriCoreAvailabilityValue===false&&Date.now()-this.tauriCoreAvailabilityCheckedAtMs<h.TAURI_IPC_NEGATIVE_CACHE_MS?false:(this.tauriCoreAvailability||(this.tauriCoreAvailability=(async()=>{try{if(this.isTauriEnv())return this.tauriCoreAvailabilityValue=!0,this.tauriCoreAvailabilityCheckedAtMs=Date.now(),this.syncNativeRuntimeCapabilities("tauri-env"),!0;try{let e=await this.invokeIpc("rtc_native_status");return this.applyNativeRuntimeStatus(e),c$1("[NativeIpcBridge] Resolved Tauri IPC via rtc_native_status probe"),this.tauriCoreAvailabilityValue=!0,this.tauriCoreAvailabilityCheckedAtMs=Date.now(),!0}catch(e){let t=String(e?.message??e??"");return t.includes("__TAURI_INTERNALS__")||t.includes("Cannot read properties of undefined")||t.includes("window is not defined")?(this.tauriCoreAvailabilityValue=!1,this.tauriCoreAvailabilityCheckedAtMs=Date.now(),!1):(c$1("[NativeIpcBridge] Tauri IPC probe reached native layer (command-level error acceptable)"),this.tauriCoreAvailabilityValue=!0,this.tauriCoreAvailabilityCheckedAtMs=Date.now(),!0)}}catch{return this.tauriCoreAvailabilityValue=false,this.tauriCoreAvailabilityCheckedAtMs=Date.now(),false}})().finally(()=>{this.tauriCoreAvailability=null;})),this.tauriCoreAvailability)}async invokeIpc(e,t,i){let a=this.ipcBridge.invoke(e,t),n=i&&Object.prototype.hasOwnProperty.call(i,"timeoutMs")?i.timeoutMs:h.DEFAULT_BOUNDED_IPC_TIMEOUT_MS;return n==null||n<=0?a:a$2(a,n,()=>new Error(`${e} timeout after ${n}ms`))}async listenIpc(e,t){return this.ipcBridge.listen(e,i=>{t({payload:i});})}async openPeerBiViaIpc(e,t,i){let a=await this.invokePeerBiOpen(e,t,i),n=typeof a?.streamId=="string"?a.streamId.trim():typeof a?.stream_id=="string"?a.stream_id.trim():"";if(!n)throw new Error(`${e} returned no streamId`);return this.peerBiStreamFromId(n)}peerBiStreamFromId(e,t={}){let i=this,a=null,n=null,s=false,o=null,c=null,d=async()=>{let m=[a,n];a=null,n=null,await Promise.allSettled(m.filter(v=>typeof v=="function").map(v=>Promise.resolve(v())));},r=(async()=>{a=await this.listenIpc("openrtc://peer-bi-stream/chunk",m=>{let v=m.payload;if((typeof v?.streamId=="string"?v.streamId:typeof v?.stream_id=="string"?v.stream_id:"")!==e||s||!o)return;let f=v?.bytes;f instanceof Uint8Array?o.enqueue(f):Array.isArray(f)&&o.enqueue(new Uint8Array(f));}),n=await this.listenIpc("openrtc://peer-bi-stream/closed",m=>{let v=m.payload;if((typeof v?.streamId=="string"?v.streamId:typeof v?.stream_id=="string"?v.stream_id:"")!==e||s||!o)return;s=true;let f=typeof v?.error=="string"?v.error.trim():"";f?o.error(new Error(f)):o.close(),d();}),t.startReadAfterListeners&&await this.invokeIpc("start_peer_bi_stream_read",{streamId:e},{timeoutMs:null});})().catch(m=>{c=m,o&&!s&&(s=true,o.error(m));}),l=async()=>{await this.invokeIpc("close_peer_bi_stream",{streamId:e},{timeoutMs:null}).catch(()=>{}),await d();},u=new ReadableStream({async start(m){o=m,await r,c&&!s&&(s=true,m.error(c));},async cancel(){s=true,await l();}}),I=new WritableStream({write:async m=>{await i.invokeIpc("write_peer_bi_stream",{streamId:e,bytes:Array.from(m)},{timeoutMs:null});},close:l,abort:l});return {readable:u,writable:I}}async invokePeerBiOpen(e,t,i){try{return await this.invokeIpc(e,t)}catch(a){if(!i?.fallbackCommand||!this.isMissingNativeCommandError(a))throw a;return this.invokeIpc(i.fallbackCommand,i.fallbackArgs??t)}}isMissingNativeCommandError(e){let t=e instanceof Error?e.message:String(e??"");return t.includes("Command")&&t.includes("not found")}async shouldUseTauriSignaling(){if(await this.canUseTauriIpc())return true;if(this.allowWasmFallback)return false;throw new Error("[pluto-rtc] Tauri runtime adapter requires native IPC, but it is unavailable.")}async signInWithPluto(){if(!await this.canUseTauriIpc()){await this.fallback.signInWithPluto();return}let e=await this.invokeIpc("rtc_sign_in_with_pluto"),t=typeof e?.customToken=="string"?e.customToken.trim():"";if(!t)throw new Error("[pluto-rtc] Native Pluto SSO did not return a custom token.");await b$2().signInWithCustomTokenValue(t),await this.ensureNativeAuth("pluto-sso",{requireToken:true,maxWaitMs:1e4});}async setAuthContext(e){let t=this.getAuthContext()?.userId??null,i=typeof e?.userId=="string"&&e.userId.trim()||null,a=this.fallback.setAuthContext(e);if(t&&i&&t!==i&&await this.stopNativeAuthScopedActivity(t),await a,!e?.token)await this.clearNativeAuthRelay("setAuthContext"),await this.clearNativeTrustRelay("setAuthContext");else {if(!await this.relayExplicitNativeAuthContext(e))throw new Error("Native auth token unavailable for setAuthContext");if(!await this.ensureNativeTrustRelay())throw new Error(`Native trust token unavailable for setAuthContext: ${this.nativeTrustRelayError??"unknown provider failure"}`)}}async signOut(){await this.fallback.signOut(),await Promise.all([this.clearNativeAuthRelay("signOut"),this.clearNativeTrustRelay("signOut")]);}async stopAuthScopedActivity(e){let t=this.resolveNativeSignalingUserId(e?.userId??null);await this.stopNativeAuthScopedActivity(t);}async stopNativeAuthScopedActivity(e){await this.stopGatewayDesiredPeerRelay(),this.gatewayExcludedPeers.clear();let t=await this.shouldUseTauriSignaling();if(g("NativeIpcBridge.stopAuthScopedActivity",{userId:e,useTauri:t}),t)try{await Promise.allSettled([this.revokeSessionTokensByScope("user-device"),this.invokeIpc("stop_rtc_presence_loop"),this.invokeIpc("stop_rtc_auto_connect")]);}catch(i){console.warn("[NativeIpcBridge] Failed to stop native auth-scoped RTC activity:",i);}await this.fallback.stopAuthScopedActivity({userId:e});}async ensureNativeAuthOnce(e,t){if(!await this.canUseTauriIpc())return true;if(this.authSyncInFlight)return this.authSyncInFlight;let i=(async()=>{try{if(!this.currentUser)return c$1(`[NativeIpcBridge] auth sync deferred (${e}): no current user`),!t;let a=Date.now()-this.lastNativeAuthSyncAtMs>=480*1e3,n=this.currentUser?.getToken?await this.currentUser.getToken(a):null,o=this.getAuthContext()?.refreshToken??this.auth?.currentUser?.refreshToken??null;return n?this.relayNativeAuthToken(n,o,e,this.currentUser?.id):(c$1(`[NativeIpcBridge] auth sync deferred (${e}): missing token for user ${this.currentUser?.id}`),!t)}catch(a){return console.error("[NativeIpcBridge] auth sync failed:",a),false}})();this.authSyncInFlight=i;try{return await i}finally{this.authSyncInFlight===i&&(this.authSyncInFlight=null);}}async ensureNativeAuth(e="runtime",t){if(!await this.canUseTauriIpc())return true;let i=t?.requireToken??false,a$1=t?.maxWaitMs??(i?h.AUTH_REQUIRED_WAIT_MS:0),n=t?.pollMs??250,s=Date.now()+Math.max(0,a$1);for(;;){if(await this.ensureNativeAuthOnce(e,i))return true;if(!i||Date.now()>=s)return false;await a(n);}}decodeNativeDeviceIdentity(e){let t=e?.systemInfo??e?.system_info??null,i=typeof e?.deviceId=="string"?e.deviceId.trim():typeof e?.device_id=="string"?e.device_id.trim():"",a=typeof e?.deviceName=="string"?e.deviceName.trim():typeof e?.device_name=="string"?e.device_name.trim():"",n=typeof e?.platformType=="string"?e.platformType.trim():typeof e?.platform_type=="string"?e.platform_type.trim():typeof t?.platformType=="string"?t.platformType.trim():typeof t?.platform_type=="string"?t.platform_type.trim():"";return {deviceId:i,deviceName:a,platformType:n}}async resolveLocalDeviceId(){if(this.cachedLocalDeviceId)return this.cachedLocalDeviceId;if(await this.canUseTauriIpc())try{let t=await this.invokeIpc("get_rtc_local_device_info"),{deviceId:i,deviceName:a}=this.decodeNativeDeviceIdentity(t);if(i)return this.cachedLocalDeviceId=i,a&&(this.cachedLocalDeviceName=a),i}catch(t){console.warn("[NativeIpcBridge] get_rtc_local_device_info failed:",t);}let e=this.resolveWebLogicalDeviceId();return this.cachedLocalDeviceId=e,e}async resolveLocalDeviceName(){if(this.cachedLocalDeviceName)return this.cachedLocalDeviceName;if(await this.canUseTauriIpc())try{let e=await this.invokeIpc("get_rtc_local_device_info"),{deviceName:t}=this.decodeNativeDeviceIdentity(e);if(t){let i=this.normalizeNativeDeviceName(t);return this.cachedLocalDeviceName=i,i}}catch(e){console.warn("[NativeIpcBridge] get_rtc_local_device_info failed:",e);}return this.defaultDeviceNameFallback()}normalizeNativeDeviceName(e){let t=e.trim();if(!t)return this.defaultDeviceNameFallback();if(t==="Desktop Device"){let i=this.defaultDeviceNameFallback();if(i!=="Desktop Device")return i}return t}defaultDeviceNameFallback(){if(typeof window>"u"||typeof navigator>"u")return "Desktop Device";let e=navigator.userAgent||"";return /iPhone|iPad|iPod/i.test(e)?"iPhone":/Android/i.test(e)?"Android":"Desktop Device"}inferNativePlatformTypeFallback(){if(typeof window>"u"||typeof navigator>"u")return "desktop";if(!this.isTauriEnv())return "web";let e=navigator.userAgent||"";return /iPhone|iPad|iPod|Android|Mobile/i.test(e)?"mobile":"desktop"}normalizeNativeCoordinationPlatform(e){let t=e?.trim().toLowerCase()??"";return t==="mobile"||t==="ios"||t==="android"||t.includes("iphone")||t.includes("ipad")||this.inferNativePlatformTypeFallback()==="mobile"?"mobile":"desktop"}withPresenceMetadata(e,t){try{let i=e?JSON.parse(e):{};return JSON.stringify({...i,deviceId:t,plutoVersion:"0.1.0-desktop"})}catch{return JSON.stringify({deviceId:t,plutoVersion:"0.1.0-desktop",rawMetadata:e})}}async searchDevices(e){return this.assertManagedCoordinationGateway(),this.fallback.searchDevices(e)}async listDevicesWithStatus(){return this.assertManagedCoordinationGateway(),(await this.fallback.searchDevices()).map(e=>j$2(e))}async getPeerSession(e){if(await this.shouldUseTauriSignaling()){let t=await this.invokeIpc("get_rtc_peer_session",{id:e});return !t||typeof t!="object"?null:k$1(t)}return this.fallback.getPeerSession(e)}async listPeerSessions(){if(await this.shouldUseTauriSignaling()){let e=await this.invokeIpc("list_rtc_peer_sessions");return (Array.isArray(e)?e:[]).map(t=>k$1(t))}return this.fallback.listPeerSessions()}async waitForSettledPeer(e,t){if(await this.shouldUseTauriSignaling()){let i=typeof t=="number"?Math.max(h.DEFAULT_BOUNDED_IPC_TIMEOUT_MS,t+1e3):h.DEFAULT_BOUNDED_IPC_TIMEOUT_MS,a=await this.invokeIpc("wait_for_rtc_settled_peer",{id:e,timeoutMs:t},{timeoutMs:i});return !a||typeof a!="object"?null:k$1(a)}return this.fallback.waitForSettledPeer(e,t)}async resolvePeerConnectionRecords(e){if(await this.shouldUseTauriSignaling()){let t=await this.invokeIpc("resolve_rtc_peer_connection_records",{id:e});return (Array.isArray(t)?t:[]).map(i=>l(i))}return this.fallback.resolvePeerConnectionRecords(e)}async resolvePeerIdentity(e){if(await this.shouldUseTauriSignaling()){let t=await this.invokeIpc("resolve_rtc_peer_identity",{id:e});return m(t)}return this.fallback.resolvePeerIdentity(e)}async setOffline(e){return this.assertManagedCoordinationGateway(),this.fallback.setOffline(e)}async updateDevice(e,t){return this.assertManagedCoordinationGateway(),await this.syncCoordinationDeviceIdentity(),this.fallback.updateDevice(e,t)}async deleteDevice(e){return this.assertManagedCoordinationGateway(),await this.syncCoordinationDeviceIdentity(),this.fallback.deleteDevice(e)}async getLocalDeviceInfo(){if(!await this.canUseTauriIpc()){let e=await this.getLocalDeviceId?.();return e?{deviceId:e,deviceName:this.defaultDeviceNameFallback(),platformType:this.inferNativePlatformTypeFallback()}:null}try{let e=await this.invokeIpc("get_rtc_local_device_info"),t=this.decodeNativeDeviceIdentity(e),{deviceId:i}=t;return i?{deviceId:i,deviceName:this.normalizeNativeDeviceName(t.deviceName),platformType:t.platformType||this.inferNativePlatformTypeFallback(),capabilities:e?.capabilities??void 0,lastSeenAt:typeof e?.last_seen_at=="string"?e.last_seen_at:void 0}:null}catch(e){return console.warn("[NativeIpcBridge] getLocalDeviceInfo failed:",e),null}}async updateLocalDeviceName(e){if(!await this.canUseTauriIpc())return null;try{let t=await this.invokeIpc("update_rtc_local_device_name",{deviceName:e}),i=this.decodeNativeDeviceIdentity(t),{deviceId:a}=i;return a?(this.cachedLocalDeviceName=this.normalizeNativeDeviceName(e),{deviceId:a,deviceName:this.cachedLocalDeviceName,platformType:i.platformType||this.inferNativePlatformTypeFallback(),capabilities:t?.capabilities??void 0,lastSeenAt:typeof t?.last_seen_at=="string"?t.last_seen_at:void 0}):null}catch(t){return console.warn("[NativeIpcBridge] updateLocalDeviceName failed:",t),null}}async startManagedSessionNative(e){if(this.assertManagedCoordinationGateway(),!await this.shouldUseTauriSignaling())throw new Error("[pluto-rtc] Native IPC unavailable for startManagedSessionNative().");if(!await this.ensureNativeAuth("startManagedSessionNative",{requireToken:this.requiresNativeAuthToken(),maxWaitMs:this.nativeAuthWaitMs()}))throw new Error("Native auth token unavailable for startManagedSessionNative");let i=this.resolveNativeSignalingUserId(e.userId);if(!i)throw new Error("Native managed session startup requires a runtime auth-scoped user id.");i!==e.userId&&console.info("[NativeIpcBridge][managed-session][user-id-remap]",{requestedUserId:e.userId,runtimeUserId:this.currentUser?.id??this.getAuthContext()?.userId??null,effectiveUserId:i}),console.info("[NativeIpcBridge][managed-session][start-request]",{requestedUserId:e.userId,runtimeUserId:this.currentUser?.id??this.getAuthContext()?.userId??null,effectiveUserId:i,deviceName:e.deviceName??null,localDeviceId:e.localDeviceId??null,presence:e.presence!==false,autoConnect:e.autoConnect!==false,hasMetadata:typeof e.metadata=="string"&&e.metadata.trim().length>0});let a=await this.buildNativeTransportConfigPayload(),n={userId:i,deviceName:e.deviceName??null,localDeviceId:e.localDeviceId??null,metadata:e.metadata??null,...a?{transports:a}:{},autoConnect:false,presence:false},s=await this.invokeIpc("start_rtc_managed_session",n,{timeoutMs:null});this.syncNativeRuntimeCapabilities("managed-session-started");let o=typeof s?.ticket=="string"&&s.ticket.trim().length>0?s.ticket.trim():null,c=s?.localDevice&&typeof s.localDevice=="object"?s.localDevice:s?.local_device&&typeof s.local_device=="object"?s.local_device:null,d=c?{deviceId:typeof c.deviceId=="string"?c.deviceId:typeof c.device_id=="string"?c.device_id:"",deviceName:this.normalizeNativeDeviceName(typeof c.deviceName=="string"?c.deviceName:typeof c.device_name=="string"?c.device_name:""),platformType:typeof c.platformType=="string"?c.platformType:typeof c.platform_type=="string"?c.platform_type:"desktop",capabilities:c.capabilities??void 0,lastSeenAt:typeof c.lastSeenAt=="string"?c.lastSeenAt:typeof c.last_seen_at=="string"?c.last_seen_at:void 0}:null,r={localNodeId:typeof s?.localNodeId=="string"?s.localNodeId:typeof s?.local_node_id=="string"?s.local_node_id:null,ticket:o,ticketScope:typeof s?.ticketScope=="string"?s.ticketScope:typeof s?.ticket_scope=="string"?s.ticket_scope:null,presenceStarted:typeof s?.presenceStarted=="boolean"?s.presenceStarted:!!s?.presence_started,autoConnectStarted:typeof s?.autoConnectStarted=="boolean"?s.autoConnectStarted:!!s?.auto_connect_started,localDevice:d?.deviceId?d:null};if(this.usesCoordinationGateway()){e.presence!==false&&!r.ticket&&(r.ticket=await this.getEndpointTicketWithToken("user-device",0),r.ticketScope=r.ticket?"user-device":null);let l=r.localDevice?.deviceId||e.localDeviceId?.trim()||await this.resolveLocalDeviceId();if(l&&this.fallback.setCoordinationLocalDeviceId(l),this.fallback.setCoordinationPlatformType(this.normalizeNativeCoordinationPlatform(r.localDevice?.platformType)),e.presence!==false){if(!r.localNodeId||!r.ticket)throw new Error("Native managed session did not return the node identity required for gateway presence.");await this.fallback.updatePresence(r.localNodeId,r.ticket,true,3e5,e.metadata,r.localDevice?.deviceName||e.deviceName),r.presenceStarted=true;}else r.presenceStarted=false;e.autoConnect!==false&&l?(await this.startGatewayAutoConnect(i,l),r.autoConnectStarted=true):r.autoConnectStarted=false;}return console.info("[NativeIpcBridge][managed-session][ipc-started]",{requestedUserId:e.userId,runtimeUserId:this.currentUser?.id??this.getAuthContext()?.userId??null,effectiveUserId:i,localNodeId:r.localNodeId,ticketScope:r.ticketScope,presenceStarted:r.presenceStarted,autoConnectStarted:r.autoConnectStarted,localDeviceId:r.localDevice?.deviceId??null}),r}async reconcileNativeManagedSession(e){return this.assertManagedCoordinationGateway(),await this.fallback.reconnectCoordinationAfterHostResume(),console.info("[NativeIpcBridge] reattached gateway coordination after host resume.",{reason:e?.reason??"frontend"}),null}async notifyNetworkChange(e){return await this.canUseTauriIpc()?(c$1("[NativeIpcBridge] forwarding host network-change hint",{reason:e?.reason??"host"}),this.invokeIpc("notify_rtc_network_change")):null}async getManagedNodeId(e){let t=e?.initializeIfMissing??true;console.info("[NativeIpcBridge][getManagedNodeId] enter",{initializeIfMissing:t});let i=await this.canUseTauriIpc();if(console.info("[NativeIpcBridge][getManagedNodeId] canUseTauriIpc",{canUse:i}),!i)return null;try{console.info("[NativeIpcBridge][getManagedNodeId] invoking get_iroh_node_id");let a=await this.invokeIpc("get_iroh_node_id");if(console.info("[NativeIpcBridge][getManagedNodeId] get_iroh_node_id returned",{existing:a}),a||!t)return a;console.info("[NativeIpcBridge][getManagedNodeId] invoking start_iroh_node");let n=await this.invokeIpc("start_iroh_node");return console.info("[NativeIpcBridge][getManagedNodeId] start_iroh_node returned",{started:n}),n}catch(a){if(console.warn("[NativeIpcBridge] getManagedNodeId failed:",a),!t)return null;throw a}}async getEndpointTicket(){if(!await this.canUseTauriIpc())throw new Error("[pluto-rtc] getEndpointTicket requires native IPC in Tauri runtime.");return E(()=>this.invokeIpc("get_iroh_endpoint_ticket"))}async connectToDevice(e){if(!await this.canUseTauriIpc())throw new Error("[pluto-rtc] connectToDevice requires native IPC in Tauri runtime.");this.options.authMode!=="anonymous"?await this.ensureNativeAuth("connectToDevice",{requireToken:true,maxWaitMs:h.AUTH_REQUIRED_WAIT_MS}):c$1("[NativeIpcBridge] connectToDevice using anonymous native ticket path");let t=Math.max(1,Math.floor(e.timeoutMs??h.DEFAULT_BOUNDED_IPC_TIMEOUT_MS));return this.invokeIpc("connect_to_device",{deviceId:e.deviceId??null,endpointTicket:e.endpointTicket,timeoutMs:t},{timeoutMs:t+1e3})}async registerSessionToken(e,t,i){await this.canUseTauriIpc()&&await this.invokeIpc("register_session_token",{token:e,scope:t,maxConnections:i});}async getEndpointTicketWithToken(e,t){if(!await this.canUseTauriIpc())return null;try{return await E(()=>this.invokeIpc("get_endpoint_ticket_with_token",{scope:e,maxConnections:t}))}catch{return null}}async validateSessionToken(e,t){if(!await this.canUseTauriIpc())return null;try{return await this.invokeIpc("validate_session_token",{token:e,connectionId:t??null})}catch{return null}}async revokeSessionTokensByScope(e){if(g("NativeIpcBridge.revokeSessionTokensByScope",{grantScope:e}),!await this.canUseTauriIpc())return [];try{return await this.invokeIpc("revoke_session_tokens_by_scope",{scope:e})}catch{return []}}async disconnectDevice(e){if(!await this.canUseTauriIpc())throw new Error("[pluto-rtc] disconnectDevice requires native IPC in Tauri runtime.");await this.invokeIpc("disconnect_device",{deviceId:e});}async setAutoConnectExcluded(e,t){if(!await this.canUseTauriIpc())return;let i=e.trim().toLowerCase();i&&(this.usesCoordinationGateway()&&(t?this.gatewayExcludedPeers.add(i):this.gatewayExcludedPeers.delete(i)),await this.invokeIpc(this.usesCoordinationGateway()?"set_rtc_external_auto_connect_excluded":"set_auto_connect_excluded",{deviceId:e,excluded:t}),this.usesCoordinationGateway()&&await this.fallback.setCoordinationExcludedPeers([...this.gatewayExcludedPeers].sort()));}onDevicesChange(e,t){return this.assertManagedCoordinationGateway(),this.fallback.onDevicesChange(e,t)}async subscribeDevices(e){return this.assertManagedCoordinationGateway(),this.fallback.subscribeDevices(e)}async subscribeSessions(e){return this.assertManagedCoordinationGateway(),this.fallback.subscribeSessions(e)}async getLocalDeviceId(){return this.resolveLocalDeviceId()}async updatePresence(e,t,i=true,a=3e5,n){return this.assertManagedCoordinationGateway(),await this.syncCoordinationDeviceIdentity(),this.fallback.updatePresence(e,t,i,a,n)}startAutoConnect(e,t){this.assertManagedCoordinationGateway(),this.startGatewayAutoConnect(e,t).catch(i=>{console.warn("[NativeIpcBridge] gateway auto-connect failed:",i);});}forceReconnectSnapshot(){this.assertManagedCoordinationGateway(),this.fallback.forceReconnectSnapshot();}startPresenceLoop(e,t,i,a,n){this.assertManagedCoordinationGateway(),this.syncCoordinationDeviceIdentity().then(()=>this.fallback.startPresenceLoop(e,t,i,a,n)).catch(s=>{console.warn("[NativeIpcBridge] gateway presence failed:",s);});}async startAutoConnectOnce(e,t){this.assertManagedCoordinationGateway(),await this.startGatewayAutoConnect(e,t);}async clearGatewayDesiredPeerRelay(){let e=this.gatewayDesiredPeerSubmission;this.gatewayDesiredPeerRelayGeneration+=1,this.gatewayDesiredPeersCleanup?.(),this.gatewayDesiredPeersCleanup=null,this.gatewayDesiredPeerRelayKey=null,this.gatewayDesiredPeerRevision=0,this.gatewayDesiredPeerSubmission=Promise.resolve(),await e;}serializeGatewayDesiredPeerLifecycle(e){let t=this.gatewayDesiredPeerLifecycle.then(e);return this.gatewayDesiredPeerLifecycle=t.catch(()=>{}),t}stopGatewayDesiredPeerRelay(){return this.serializeGatewayDesiredPeerLifecycle(async()=>{await this.clearGatewayDesiredPeerRelay();})}startGatewayAutoConnect(e,t){return this.serializeGatewayDesiredPeerLifecycle(()=>this.startGatewayAutoConnectSerialized(e,t))}async startGatewayAutoConnectSerialized(e,t){if(!await this.shouldUseTauriSignaling())throw new Error("[openrtc] Native IPC unavailable for coordination gateway auto-connect.");if(!await this.ensureNativeAuth("startGatewayAutoConnect",{requireToken:this.requiresNativeAuthToken(),maxWaitMs:this.nativeAuthWaitMs()}))throw new Error("Native auth token unavailable for coordination gateway auto-connect");let a=this.resolveNativeSignalingUserId(e);if(!a)throw new Error("Coordination gateway auto-connect requires an authenticated user id.");let n=await this.resolveLocalDeviceId()||t.trim();if(!n)throw new Error("Coordination gateway auto-connect requires a local device id.");let s=JSON.stringify([a,n]);this.fallback.setCoordinationLocalDeviceId(n);let o=this.gatewayDesiredPeerRelayKey===s&&this.gatewayDesiredPeersCleanup;if(o||(await this.clearGatewayDesiredPeerRelay(),this.gatewayDesiredPeerRelayKey=s),await this.invokeIpc("start_rtc_external_auto_connect",{userId:a,localDeviceId:n}),o)return;let c=this.gatewayDesiredPeerRelayGeneration;this.gatewayDesiredPeersCleanup=this.fallback.onDevicesChange(d=>{let r=d.map(u=>({deviceId:String(u.deviceId??"").trim(),nodeId:typeof u.nodeId=="string"&&u.nodeId.trim()||null,ticket:typeof u.ticket=="string"&&u.ticket.trim()||null,online:u.online===true,sessionId:typeof u.sessionId=="string"&&u.sessionId.trim()||null,excludedPeers:Array.isArray(u.excludedPeers)?[...new Set(u.excludedPeers.map(I=>String(I??"").trim().toLowerCase()).filter(Boolean))].sort():[]})).filter(u=>u.deviceId.length>0&&u.deviceId!==n).sort((u,I)=>u.deviceId.localeCompare(I.deviceId)),l=++this.gatewayDesiredPeerRevision;this.gatewayDesiredPeerSubmission=this.gatewayDesiredPeerSubmission.then(async()=>{this.gatewayDesiredPeerRelayGeneration!==c||this.gatewayDesiredPeerRelayKey!==s||await this.invokeIpc("submit_rtc_desired_peers",{revision:l,peersJson:JSON.stringify(r)});}).catch(u=>{console.warn("[NativeIpcBridge] failed to relay gateway desired peers to Rust:",{revision:l,error:u});});},n);}async startPresenceLoopOnce(e,t,i,a,n){this.assertManagedCoordinationGateway(),await this.syncCoordinationDeviceIdentity(),await this.fallback.startPresenceLoop(e,t,i,a,n);}shouldUseResolvedDeviceName(e){let t=e.trim();return t.length===0||t==="Unknown Device"||t==="Desktop Device"}async sendExplicitFilePath(e,t,i=""){if(c$1("[NativeIpcBridge] sendExplicitFilePath start",{connectionId:e,filePath:t,transferId:i||null,authMode:this.options.authMode}),await this.canUseTauriIpc()){this.options.authMode!=="anonymous"?await this.ensureNativeAuth("sendExplicitFilePath"):c$1("[NativeIpcBridge] sendExplicitFilePath using anonymous native path");let a=await this.invokeIpc("send_file",{connectionId:e,filePath:t,transferId:i});return c$1("[NativeIpcBridge] sendExplicitFilePath completed",{connectionId:e,transferId:i||null,result:a}),a}return this.fallback.sendExplicitFilePath(e,t,i)}async sendExplicitFileData(e){c$1("[NativeIpcBridge] sendExplicitFileData start",{connectionId:e.connectionId??null,connectionRemoteNodeId:e.connection?.remoteNodeId??null,remoteNodeId:e.remoteNodeId??null,transferId:e.transferId??null,fileName:e.file.name,fileSize:e.file.size,authMode:this.options.authMode});let t=e.applicationCrypto??this.options.applicationCrypto;if(await this.canUseTauriIpc()){this.options.authMode!=="anonymous"?await this.ensureNativeAuth("sendExplicitFileData"):c$1("[NativeIpcBridge] sendExplicitFileData using anonymous native path");let i=e.connectionId||e.connection?.deviceId||e.connection?.remoteNodeId||e.remoteNodeId||"";if(!i)throw new Error("sendExplicitFileData requires a settled peer identifier in native runtime");let a=new Uint8Array(await e.file.arrayBuffer());await this.invokeIpc("send_file_data",{connectionId:i,filename:e.file.name,data:Array.from(a),transferId:e.transferId}),c$1("[NativeIpcBridge] sendExplicitFileData completed",{connectionId:i,transferId:e.transferId??null,fileName:e.file.name,fileSize:e.file.size});return}return this.fallback.sendExplicitFileData({...e,applicationCrypto:t})}async getConnectionStates(){if(await this.canUseTauriIpc())try{this.options.authMode!=="anonymous"&&await this.ensureNativeAuth("getConnectionStates");let e=await this.invokeIpc("list_rtc_connection_states");return (Array.isArray(e)?e:[]).map(t=>n(t)).filter(t=>!!t)}catch(e){return b(e)?c$1("[NativeIpcBridge] native connection-state replay unavailable; continuing without replay. Install/register openrtc-tauri-plugin default permissions to enable it."):console.warn("[NativeIpcBridge] Failed to fetch native connection states:",e),[]}return []}async getConnectionState(e){let t=e.trim();if(!t||!await this.canUseTauriIpc())return null;try{return this.options.authMode!=="anonymous"&&await this.ensureNativeAuth("getConnectionState"),n(await this.invokeIpc("get_rtc_connection_state",{connectionId:t}))}catch(i){return console.warn("[NativeIpcBridge] Failed to fetch native connection state:",{connectionId:t,error:i}),null}}async onConnectionStateChange(e){let t=false,i=null,a$1=new Map,n$1=Date.now(),s=0,o=()=>{let r=i;r&&Promise.resolve(r());},c=async()=>{try{let r=await this.getConnectionStates();r.length>0&&(b$1("[NativeIpcBridge] replaying current native connection states",r.map(l=>({connectionId:l.connectionId,deviceId:l.deviceId??null,deviceIdHint:l.deviceIdHint??null,remoteNodeId:l.remoteNodeId??null,state:l.state,transportState:l.transportState??null,protocolState:l.protocolState??null,routable:l.routable??null}))),r.forEach(l=>e(l)));}catch(r){console.warn("[NativeIpcBridge] Failed to replay native connection states after event subscription:",r);}},d=async r=>{let l=(a$1.get(r)??0)+1;a$1.set(r,l);let u=await this.getConnectionState(r);if(!u||t||a$1.get(r)!==l)return;if(["closed","failed","disconnected"].includes(String(u.state??"").trim().toLowerCase())){if(await a(h.CONNECTION_TERMINAL_CONFIRMATION_MS),t||a$1.get(r)!==l)return;u=await this.getConnectionState(r)??u;}!t&&a$1.get(r)===l&&e(u);};for(;!t&&Date.now()-n$1<=h.CONNECTION_EVENT_SUBSCRIBE_WINDOW_MS;){if(s+=1,!await this.canUseTauriIpc()){await a(this.nextConnectionEventRetryDelayMs(s));continue}return i=await this.listenIpc("connection-state-changed",r=>{let l=n(r?.payload);l&&(b$1("[NativeIpcBridge] connection-state-changed trigger",{connectionId:l.connectionId}),d(l.connectionId));}),await c(),()=>{t=true,o();}}return ()=>{t=true,o();}}async onIncomingNativeMessage(e){if(!await this.canUseTauriIpc())return ()=>{};let t=await this.listenIpc("iroh://message",i=>{if(i?.payload?.data&&i.payload.streamId==="main")try{let a=new Uint8Array(i.payload.data);if(a.length<2||a[0]!==0)return;let s=a.slice(1),o=new TextDecoder().decode(s),c=JSON.parse(o);e(i.payload.connectionId,i.payload.remoteNodeId??null,c);}catch{}});return typeof t=="function"?t:()=>{}}async getTransferHistory(e=50){return await this.canUseTauriIpc()?this.invokeIpc("get_transfer_history",{limit:e}):[]}async deleteTransferJob(e){await this.canUseTauriIpc()&&await this.invokeIpc("delete_transfer_job",{jobId:e});}};h.AUTH_REQUIRED_WAIT_MS=o.nativeIpc.authRequiredWaitMs,h.DEFAULT_BOUNDED_IPC_TIMEOUT_MS=o.nativeIpc.defaultBoundedCommandTimeoutMs,h.CONNECTION_EVENT_SUBSCRIBE_WINDOW_MS=o.nativeIpc.connectionEventSubscribeWindowMs,h.CONNECTION_EVENT_RETRY_MIN_DELAY_MS=o.nativeIpc.connectionEventRetryMinDelayMs,h.CONNECTION_EVENT_RETRY_MAX_DELAY_MS=o.nativeIpc.connectionEventRetryMaxDelayMs,h.CONNECTION_TERMINAL_CONFIRMATION_MS=1500,h.TAURI_IPC_NEGATIVE_CACHE_MS=o.nativeIpc.tauriIpcNegativeCacheMs,h.NATIVE_STATUS_IPC_TIMEOUT_MS=2500;var M=h;var J=class extends a$1{constructor(e){let t=c(e.bridge,"IpcRuntimeAdapter");super(new M({...e,ipcBridge:t,allowWasmFallback:e.allowWasmFallback??false}));}};
|
|
2
|
-
export{Y as a,k as b,j as c,ae as d,E as e,J as f};
|
package/dist/chunk-Q4QVXWCW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {f}from'./chunk-PDXJVQ7Z.js';import {d}from'./chunk-K37WVIZL.js';function c(){return d()}var i=class extends f{constructor(r){super({...r,bridge:d(),allowWasmFallback:r.allowWasmFallback??false});}};export{c as a,i as b};
|
package/dist/chunk-RKLFCEAL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b as b$1,a as a$2}from'./chunk-2QHDEGVX.js';import {a as a$1}from'./chunk-I4TY5LGB.js';import {a as a$3}from'./chunk-EXE6ZAE7.js';import {b}from'./chunk-N4SX7C3W.js';import {d}from'./chunk-K37WVIZL.js';import {a}from'./chunk-N26S7V4N.js';async function c(t){return a(b),b$1(await a$1(a$2(t)),"web")}c.native=function(t,a$1=d()){return a(b),b$1(a$3(a$2(t),a$1),"native")};export{c as a};
|
package/dist/chunk-VK6KX433.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {c}from'./chunk-NB4H5TP3.js';import {b,e}from'./chunk-C7YN5MSV.js';import {xchacha20poly1305}from'@noble/ciphers/chacha.js';function v(){if(typeof globalThis<"u"&&globalThis.__OPENRTC_DEBUG__===true)return true;if(typeof localStorage<"u")try{return localStorage.getItem("openrtc:debug")==="1"}catch{return false}return false}function R(t,e,r){if(v()){if(typeof r>"u"){console[t](e);return}console[t](e,r);}}function M(t,e){R("debug",t,e);}function $(t,e){R("info",t,e);}function G(t,e){R("log",t,e);}var N=b,I=new Set(N);function g(t){if(typeof t!="string")return;let e=t.trim().toLowerCase();return I.has(e)?e:void 0}function K(t){let e$1=g(t);return e$1?e(e$1).baseProtocol==="iroh":false}function Q(t){let e$1=g(t);if(!e$1)return false;let r=e(e$1);return r.baseProtocol==="iroh"&&(r.locality==="nearby"||r.locality==="direct-internet")}function j(t){let e$1=g(t);return e$1?e(e$1).family==="optional-route":false}function J(t){let e$1=g(t);return e$1?e(e$1).baseProtocol==="webrtc":false}function Z(t,e,r=false){return t==="relay"||e==="relay"?"webrtc-turn":t==="host"&&e==="host"||r&&t&&e?"webrtc-lan":"webrtc"}function ee(t){let e$1=g(t);return e$1?e(e$1).independentlyInstantiable:false}var u=new Uint8Array([79,82,84,67,69,49]),U=2,d=8,h=24,_=32,k=3,F=16*1024*1024,D=4096;function q(t,e){if(t.byteLength<e.byteLength)return false;let r=0;for(let a=0;a<e.byteLength;a+=1)r|=t[a]^e[a];return r===0}function V(t){let e=new Uint8Array(t),r=globalThis.crypto;if(!r||typeof r.getRandomValues!="function")throw new Error("[OpenRTC] application payload crypto requires crypto.getRandomValues");return r.getRandomValues(e),e}function Y(t,e){let r="";for(let a of e)r+=a.toString(16).padStart(2,"0");return `${t}:${r}`}function B(t){if(!q(t,u))return null;let e=t[u.byteLength];return e===U?e:null}function z(t){return B(t)===U&&t.byteLength>u.byteLength+1+d+h}function oe(t,e={}){if(!(t instanceof Uint8Array)||t.byteLength!==_)throw new Error(`[OpenRTC] application payload crypto key must be ${_} bytes`);let r=new Uint8Array(t),a=e.requireEncrypted??true,T=e.randomBytes??V,m=e.replayProtection??true,w=0,p=new Set,f=[];return {requireEncrypted:a,protectPayload(y,n){let i=T(h);if(!(i instanceof Uint8Array)||i.byteLength!==h)throw new Error(`[OpenRTC] application payload crypto nonce must be ${h} bytes`);let l=new Uint8Array(1+n.byteLength);l[0]=y,l.set(n,1);let c=xchacha20poly1305(r,i).encrypt(l);if(!m)throw new Error("[OpenRTC] ORTCE1 v1 envelopes are not supported; replay protection is required");let s=new Uint8Array(u.byteLength+1+d+i.byteLength+c.byteLength),o=0;s.set(u,o),o+=u.byteLength,s[o]=U,o+=1;let E=w;return w+=1,new DataView(s.buffer,s.byteOffset+o,d).setBigUint64(0,BigInt(E),false),o+=d,s.set(i,o),o+=i.byteLength,s.set(c,o),s},openPayload(y,n){if(!z(n))return a?null:n;if(B(n)!==U)return null;let l=u.byteLength+1,c=Number(new DataView(n.buffer,n.byteOffset+l,d).getBigUint64(0,false));if(!Number.isFinite(c))return null;let s=l+d,o=s+h,E=n.slice(s,o),A=m?Y(c,E):null;if(A&&p.has(A))return null;let C=n.slice(o),L;try{L=xchacha20poly1305(r,E).decrypt(C);}catch{return null}if(L.byteLength<1||L[0]!==y)return null;if(A)for(p.add(A),f.push(A);f.length>D;){let P=f.shift();P&&p.delete(P);}return L.slice(1)}}}function W(t){let e=new Uint8Array(4+t.byteLength);return new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t.byteLength,false),e.set(t,4),e}function ie(t,e={}){let r=e.typeId??k,a=e.maxFrameBytes??F;if(!Number.isInteger(r)||r<0||r>255)throw new Error("[OpenRTC] raw application crypto stream typeId must be an integer from 0 to 255");if(!Number.isInteger(a)||a<=0)throw new Error("[OpenRTC] raw application crypto maxFrameBytes must be a positive integer");let T=n=>t.protectPayload(r,n),m=n=>t.openPayload(r,n),w=()=>new TransformStream({transform(n,i){i.enqueue(W(T(new Uint8Array(n))));}}),p=()=>{let n=new Uint8Array(0);return new TransformStream({transform(i,l){for(n=c([n,new Uint8Array(i)]);n.byteLength>=4;){let c=new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,false);if(c===0||c>a)throw new Error("[OpenRTC] invalid encrypted raw stream frame length");if(n.byteLength<4+c)return;let s=n.slice(4,4+c);n=n.slice(4+c);let o=m(s);if(!o)throw new Error("[OpenRTC] encrypted raw stream frame failed authentication");l.enqueue(o);}},flush(){if(n.byteLength!==0)throw new Error("[OpenRTC] encrypted raw stream ended mid-frame")}})},f=n=>n.pipeThrough(p()),y=n=>{let i=w();return i.readable.pipeTo(n).catch(()=>{}),i.writable};return {typeId:r,protectFrame:T,openFrame:m,createOutboundTransform:w,createInboundTransform:p,wrapReadable:f,wrapWritable:y,wrapBiStream(n){return {...n,send:y(n.send),recv:f(n.recv)}}}}export{v as a,M as b,$ as c,G as d,N as e,g as f,K as g,Q as h,j as i,J as j,Z as k,ee as l,z as m,oe as n,ie as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as createIpcClient,a as createWasmClient}from'./chunk-I4TY5LGB.js';import'./chunk-7LYYPXCV.js';import'./chunk-AHHBPPQW.js';import'./chunk-PDXJVQ7Z.js';import'./chunk-4UZFT2P6.js';import'./chunk-7Z6N46RB.js';import'./chunk-3HCG7RQF.js';import'./chunk-VK6KX433.js';import'./chunk-NT5YHZQH.js';import'./chunk-K37WVIZL.js';import'./chunk-BXFXPIXO.js';import'./chunk-N26S7V4N.js';import'./chunk-NB4H5TP3.js';import'./chunk-RD3JEGGF.js';import'./chunk-C7YN5MSV.js';
|
package/dist/ipc-CflAVodw.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type PlutoIpcUnlisten = () => void | Promise<void>;
|
|
2
|
-
interface PlutoIpcBridge {
|
|
3
|
-
invoke<T = unknown>(command: string, args?: Record<string, unknown>): Promise<T>;
|
|
4
|
-
listen<T = unknown>(event: string, handler: (payload: T) => void): Promise<PlutoIpcUnlisten>;
|
|
5
|
-
isAvailable?(): boolean | Promise<boolean>;
|
|
6
|
-
}
|
|
7
|
-
type NativeIpcFailureKind = 'command-unavailable' | 'runtime-unavailable' | 'timeout' | 'unknown';
|
|
8
|
-
declare function classifyNativeIpcFailure(error: unknown): NativeIpcFailureKind;
|
|
9
|
-
declare function isNativeIpcCommandUnavailable(error: unknown): boolean;
|
|
10
|
-
|
|
11
|
-
export { type NativeIpcFailureKind as N, type PlutoIpcBridge as P, type PlutoIpcUnlisten as a, classifyNativeIpcFailure as c, isNativeIpcCommandUnavailable as i };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as createIpcClient}from'./chunk-EXE6ZAE7.js';import'./chunk-7LYYPXCV.js';import'./chunk-AHHBPPQW.js';import'./chunk-PDXJVQ7Z.js';import'./chunk-4UZFT2P6.js';import'./chunk-7Z6N46RB.js';import'./chunk-3HCG7RQF.js';import'./chunk-VK6KX433.js';import'./chunk-NT5YHZQH.js';import'./chunk-K37WVIZL.js';import'./chunk-BXFXPIXO.js';import'./chunk-N26S7V4N.js';import'./chunk-NB4H5TP3.js';import'./chunk-RD3JEGGF.js';import'./chunk-C7YN5MSV.js';
|
package/dist/openrtc-C53CKZUM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var z=class s{static __wrap(t){let e=Object.create(s.prototype);return e.__wbg_ptr=t,K.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,K.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_bistream_free(t,0);}get applicationCryptoWrapped(){return n.bistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}get endpoint_id(){let t,e;try{let i=n.__wbindgen_add_to_stack_pointer(-16);n.bistream_endpoint_id(i,this.__wbg_ptr);var _=f().getInt32(i+0,!0),r=f().getInt32(i+4,!0);return t=_,e=r,v(_,r)}finally{n.__wbindgen_add_to_stack_pointer(16),n.__wbindgen_export4(t,e,1);}}finishSend(){let t=n.bistream_finishSend(this.__wbg_ptr);return p(t)}get recv(){let t=n.bistream_recv(this.__wbg_ptr);return p(t)}get send(){let t=n.bistream_send(this.__wbg_ptr);return p(t)}};Symbol.dispose&&(z.prototype[Symbol.dispose]=z.prototype.free);var U=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,kt.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_intounderlyingbytesource_free(t,0);}get autoAllocateChunkSize(){return n.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}cancel(){let t=this.__destroy_into_raw();n.intounderlyingbytesource_cancel(t);}pull(t){let e=n.intounderlyingbytesource_pull(this.__wbg_ptr,w(t));return p(e)}start(t){n.intounderlyingbytesource_start(this.__wbg_ptr,w(t));}get type(){let t=n.intounderlyingbytesource_type(this.__wbg_ptr);return mt[t]}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var B=class s{static __wrap(t){let e=Object.create(s.prototype);return e.__wbg_ptr=t,H.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,H.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_intounderlyingsink_free(t,0);}abort(t){let e=this.__destroy_into_raw(),_=n.intounderlyingsink_abort(e,w(t));return p(_)}close(){let t=this.__destroy_into_raw(),e=n.intounderlyingsink_close(t);return p(e)}write(t){let e=n.intounderlyingsink_write(this.__wbg_ptr,w(t));return p(e)}};Symbol.dispose&&(B.prototype[Symbol.dispose]=B.prototype.free);var N=class s{static __wrap(t){let e=Object.create(s.prototype);return e.__wbg_ptr=t,J.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,J.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_intounderlyingsource_free(t,0);}cancel(){let t=this.__destroy_into_raw();n.intounderlyingsource_cancel(t);}pull(t){let e=n.intounderlyingsource_pull(this.__wbg_ptr,w(t));return p(e)}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);var q=class s{static __wrap(t){let e=Object.create(s.prototype);return e.__wbg_ptr=t,Y.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Y.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_peerunistream_free(t,0);}get applicationCryptoWrapped(){return n.peerunistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}finishSend(){let t=n.peerunistream_finishSend(this.__wbg_ptr);return p(t)}get writable(){let t=n.peerunistream_writable(this.__wbg_ptr);return p(t)}};Symbol.dispose&&(q.prototype[Symbol.dispose]=q.prototype.free);var D=class s{static __wrap(t){let e=Object.create(s.prototype);return e.__wbg_ptr=t,Q.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Q.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_wasmclient_free(t,0);}add_peer_scope(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_add_peer_scope(this.__wbg_ptr,_,r,i,a);return p(g)}bind_connection_device_id(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_bind_connection_device_id(this.__wbg_ptr,_,r,i,a);return p(g)}bind_node_device_id(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_bind_node_device_id(this.__wbg_ptr,_,r,i,a);return p(g)}clearConnectionApplicationCryptoKey(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c;n.wasmclient_clearConnectionApplicationCryptoKey(this.__wbg_ptr,e,_);}clearIdentityCredential(){n.wasmclient_clearIdentityCredential(this.__wbg_ptr);}clear_session_tokens(){n.wasmclient_clear_session_tokens(this.__wbg_ptr);}confirm_inline_reciprocal_session_admission(t,e,_,r,i,a){let g=b(t,n.__wbindgen_export,n.__wbindgen_export2),d=c,x=b(_,n.__wbindgen_export,n.__wbindgen_export2),l=c,h=b(r,n.__wbindgen_export,n.__wbindgen_export2),y=c;var k=u(a)?0:b(a,n.__wbindgen_export,n.__wbindgen_export2),I=c;let R=n.wasmclient_confirm_inline_reciprocal_session_admission(this.__wbg_ptr,g,d,e,x,l,h,y,i,k,I);return p(R)}connect(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_connect(this.__wbg_ptr,e,_);return p(r)}connect_device(t,e){var _=u(t)?0:b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c;let i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_connect_device(this.__wbg_ptr,_,r,i,a);return p(g)}connection_state(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_connection_state(this.__wbg_ptr,e,_);return p(r)}connection_states(){let t=n.wasmclient_connection_states(this.__wbg_ptr);return p(t)}create_room(t,e,_,r,i,a){let g=b(t,n.__wbindgen_export,n.__wbindgen_export2),d=c,x=b(e,n.__wbindgen_export,n.__wbindgen_export2),l=c,h=b(_,n.__wbindgen_export,n.__wbindgen_export2),y=c,k=b(r,n.__wbindgen_export,n.__wbindgen_export2),I=c,R=b(i,n.__wbindgen_export,n.__wbindgen_export2),C=c,X=n.wasmclient_create_room(this.__wbg_ptr,g,d,x,l,h,y,k,I,R,C,u(a)?Number.MAX_SAFE_INTEGER:a>>>0);return p(X)}create_session(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_create_session(this.__wbg_ptr,e,_);return p(r)}delete_device(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_delete_device(this.__wbg_ptr,_,r,i,a);return p(g)}devices_with_status(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_devices_with_status(this.__wbg_ptr,e,_);return p(r)}disconnect(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_disconnect(this.__wbg_ptr,e,_);return p(r)}disconnect_device(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c;var i=u(e)?0:b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c;let g=n.wasmclient_disconnect_device(this.__wbg_ptr,_,r,i,a);return p(g)}disconnect_transient(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_disconnect_transient(this.__wbg_ptr,e,_);return p(r)}endpoint_id_from_ticket(t){let e,_;try{let l=n.__wbindgen_add_to_stack_pointer(-16),h=b(t,n.__wbindgen_export,n.__wbindgen_export2),y=c;n.wasmclient_endpoint_id_from_ticket(l,this.__wbg_ptr,h,y);var r=f().getInt32(l+0,!0),i=f().getInt32(l+4,!0),a=f().getInt32(l+8,!0),g=f().getInt32(l+12,!0),d=r,x=i;if(g)throw d=0,x=0,p(a);return e=d,_=x,v(d,x)}finally{n.__wbindgen_add_to_stack_pointer(16),n.__wbindgen_export4(e,_,1);}}endpoint_ticket(){let t=n.wasmclient_endpoint_ticket(this.__wbg_ptr);return p(t)}endpoint_ticket_with_token(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_endpoint_ticket_with_token(this.__wbg_ptr,_,r,e);return p(i)}force_reconnect_snapshot(){n.wasmclient_force_reconnect_snapshot(this.__wbg_ptr);}get_members(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(_,n.__wbindgen_export,n.__wbindgen_export2),x=c,l=n.wasmclient_get_members(this.__wbg_ptr,r,i,a,g,d,x);return p(l)}heartbeat_tick(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(_,n.__wbindgen_export,n.__wbindgen_export2),x=c,l=n.wasmclient_heartbeat_tick(this.__wbg_ptr,r,i,a,g,d,x);return p(l)}incoming_streams(){let t=n.wasmclient_incoming_streams(this.__wbg_ptr);return p(t)}initIrohWithTestRelay(t,e){var _=u(t)?0:j(t,n.__wbindgen_export),r=c,i=u(e)?0:b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c;let g=n.wasmclient_initIrohWithTestRelay(this.__wbg_ptr,_,r,i,a);return p(g)}init_iroh(t){var e=u(t)?0:j(t,n.__wbindgen_export),_=c;let r=n.wasmclient_init_iroh(this.__wbg_ptr,e,_);return p(r)}iroh_path_kind(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_iroh_path_kind(this.__wbg_ptr,e,_);return p(r)}iroh_secret_key(){let t=n.wasmclient_iroh_secret_key(this.__wbg_ptr);return p(t)}iroh_transport_rtt_ms(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_iroh_transport_rtt_ms(this.__wbg_ptr,e,_);return p(r)}is_auto_connect_excluded(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c;return n.wasmclient_is_auto_connect_excluded(this.__wbg_ptr,e,_)!==0}is_connected(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_is_connected(this.__wbg_ptr,e,_);return p(r)}is_current_transport_stable_id(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_is_current_transport_stable_id(this.__wbg_ptr,_,r,e);return p(i)}join_room(t,e,_,r,i){let a=b(t,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(e,n.__wbindgen_export,n.__wbindgen_export2),x=c,l=b(_,n.__wbindgen_export,n.__wbindgen_export2),h=c,y=b(r,n.__wbindgen_export,n.__wbindgen_export2),k=c,I=b(i,n.__wbindgen_export,n.__wbindgen_export2),R=c,C=n.wasmclient_join_room(this.__wbg_ptr,a,g,d,x,l,h,y,k,I,R);return p(C)}leave_room(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(_,n.__wbindgen_export,n.__wbindgen_export2),x=c,l=n.wasmclient_leave_room(this.__wbg_ptr,r,i,a,g,d,x);return p(l)}list_managed_connections(){let t=n.wasmclient_list_managed_connections(this.__wbg_ptr);return p(t)}static newV2(t){try{let i=n.__wbindgen_add_to_stack_pointer(-16),a=b(t,n.__wbindgen_export,n.__wbindgen_export2),g=c;n.wasmclient_newV2(i,a,g);var e=f().getInt32(i+0,!0),_=f().getInt32(i+4,!0),r=f().getInt32(i+8,!0);if(r)throw p(_);return s.__wrap(e)}finally{n.__wbindgen_add_to_stack_pointer(16);}}node_addr(){let t=n.wasmclient_node_addr(this.__wbg_ptr);return p(t)}open_bi(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_open_bi(this.__wbg_ptr,e,_);return p(r)}open_native_main_control_bi(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_open_native_main_control_bi(this.__wbg_ptr,e,_);return p(r)}open_peer_bi(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_open_peer_bi(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(i)}open_peer_bi_explicit_file_sender(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_open_peer_bi_explicit_file_sender(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(i)}open_peer_bi_transport_only(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_open_peer_bi_transport_only(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(i)}open_peer_native_bi(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=n.wasmclient_open_peer_native_bi(this.__wbg_ptr,r,i,a,g,u(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(d)}open_peer_uni(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_open_peer_uni(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(i)}open_uni(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_open_uni(this.__wbg_ptr,e,_);return p(r)}peer_scopes(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_peer_scopes(this.__wbg_ptr,e,_);return p(r)}peer_session(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_peer_session(this.__wbg_ptr,e,_);return p(r)}peer_sessions(){let t=n.wasmclient_peer_sessions(this.__wbg_ptr);return p(t)}peer_snapshot(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_peer_snapshot(this.__wbg_ptr,e,_);return p(r)}prepare_inline_reciprocal_session_admission(t,e,_,r,i,a,g,d){let x=b(t,n.__wbindgen_export,n.__wbindgen_export2),l=c,h=b(_,n.__wbindgen_export,n.__wbindgen_export2),y=c,k=b(r,n.__wbindgen_export,n.__wbindgen_export2),I=c,R=b(i,n.__wbindgen_export,n.__wbindgen_export2),C=c,X=b(a,n.__wbindgen_export,n.__wbindgen_export2),_t=c,rt=b(g,n.__wbindgen_export,n.__wbindgen_export2),ot=c,it=b(d,n.__wbindgen_export,n.__wbindgen_export2),st=c,ct=n.wasmclient_prepare_inline_reciprocal_session_admission(this.__wbg_ptr,x,l,e,h,y,k,I,R,C,X,_t,rt,ot,it,st);return p(ct)}present_session_token_to_host(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_present_session_token_to_host(this.__wbg_ptr,_,r,i,a);return p(g)}present_session_token_to_host_with_payload(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c;var d=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),x=c;let l=n.wasmclient_present_session_token_to_host_with_payload(this.__wbg_ptr,r,i,a,g,d,x);return p(l)}present_session_token_to_host_with_payload_and_device_id(t,e,_,r){let i=b(t,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=b(e,n.__wbindgen_export,n.__wbindgen_export2),d=c;var x=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),l=c,h=u(r)?0:b(r,n.__wbindgen_export,n.__wbindgen_export2),y=c;let k=n.wasmclient_present_session_token_to_host_with_payload_and_device_id(this.__wbg_ptr,i,a,g,d,x,l,h,y);return p(k)}rankRoutes(t,e){try{let a=n.__wbindgen_add_to_stack_pointer(-16),g=tt(t,n.__wbindgen_export),d=c,x=tt(e,n.__wbindgen_export),l=c;n.wasmclient_rankRoutes(a,this.__wbg_ptr,g,d,x,l);var _=f().getInt32(a+0,!0),r=f().getInt32(a+4,!0),i=At(_,r).slice();return n.__wbindgen_export4(_,r*4,4),i}finally{n.__wbindgen_add_to_stack_pointer(16);}}register_session_token(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c;n.wasmclient_register_session_token(this.__wbg_ptr,r,i,a,g,_);}register_session_token_with_expiry_ms(t,e,_,r){let i=b(t,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=b(e,n.__wbindgen_export,n.__wbindgen_export2),d=c;n.wasmclient_register_session_token_with_expiry_ms(this.__wbg_ptr,i,a,g,d,_,r);}reject_connection_admission(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_reject_connection_admission(this.__wbg_ptr,_,r,i,a);return p(g)}release_peer_scope(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c;var i=u(e)?0:b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c;let g=n.wasmclient_release_peer_scope(this.__wbg_ptr,_,r,i,a);return p(g)}remote_session_admission_ready_for_ticket(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_remote_session_admission_ready_for_ticket(this.__wbg_ptr,e,_);return p(r)}report_managed_connection_settled(t,e,_,r,i,a){let g=b(t,n.__wbindgen_export,n.__wbindgen_export2),d=c;var x=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),l=c;let h=n.wasmclient_report_managed_connection_settled(this.__wbg_ptr,g,d,e,x,l,!u(r),u(r)?BigInt(0):r,!u(i),u(i)?BigInt(0):i,!u(a),u(a)?BigInt(0):a);return p(h)}report_transport_status(t,e,_,r,i,a){let g=b(t,n.__wbindgen_export,n.__wbindgen_export2),d=c,x=b(e,n.__wbindgen_export,n.__wbindgen_export2),l=c;var h=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),y=c;let k=n.wasmclient_report_transport_status(this.__wbg_ptr,g,d,x,l,h,y,!u(r),u(r)?BigInt(0):r,!u(i),u(i)?BigInt(0):i,!u(a),u(a)?BigInt(0):a);return p(k)}resolve_peer_connection_records(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_resolve_peer_connection_records(this.__wbg_ptr,e,_);return p(r)}revoke_session_token(t){try{let i=n.__wbindgen_add_to_stack_pointer(-16),a=b(t,n.__wbindgen_export,n.__wbindgen_export2),g=c;n.wasmclient_revoke_session_token(i,this.__wbg_ptr,a,g);var e=f().getInt32(i+0,!0),_=f().getInt32(i+4,!0),r=f().getInt32(i+8,!0);if(r)throw p(_);return p(e)}finally{n.__wbindgen_add_to_stack_pointer(16);}}revoke_tokens_by_scope(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_revoke_tokens_by_scope(this.__wbg_ptr,e,_);return p(r)}runtime_policy(){try{let r=n.__wbindgen_add_to_stack_pointer(-16);n.wasmclient_runtime_policy(r,this.__wbg_ptr);var t=f().getInt32(r+0,!0),e=f().getInt32(r+4,!0),_=f().getInt32(r+8,!0);if(_)throw p(e);return p(t)}finally{n.__wbindgen_add_to_stack_pointer(16);}}same_peer(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_same_peer(this.__wbg_ptr,_,r,i,a);return p(g)}search_devices(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_search_devices(this.__wbg_ptr,e,_);return p(r)}send_message(t,e,_,r){let i=b(t,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=b(e,n.__wbindgen_export,n.__wbindgen_export2),d=c;var x=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),l=c,h=u(r)?0:b(r,n.__wbindgen_export,n.__wbindgen_export2),y=c;let k=n.wasmclient_send_message(this.__wbg_ptr,i,a,g,d,x,l,h,y);return p(k)}send_peer(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=j(e,n.__wbindgen_export),a=c,g=n.wasmclient_send_peer(this.__wbg_ptr,_,r,i,a);return p(g)}send_peer_application_frame(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=j(e,n.__wbindgen_export),g=c,d=n.wasmclient_send_peer_application_frame(this.__wbg_ptr,r,i,a,g,u(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(d)}setConnectionApplicationCryptoKey(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=j(e,n.__wbindgen_export),a=c,g=n.wasmclient_setConnectionApplicationCryptoKey(this.__wbg_ptr,_,r,i,a);return p(g)}setConnectionApplicationCryptoRequired(t){try{let r=n.__wbindgen_add_to_stack_pointer(-16),i=b(t,n.__wbindgen_export,n.__wbindgen_export2),a=c;n.wasmclient_setConnectionApplicationCryptoRequired(r,this.__wbg_ptr,i,a);var e=f().getInt32(r+0,!0),_=f().getInt32(r+4,!0);if(_)throw p(e)}finally{n.__wbindgen_add_to_stack_pointer(16);}}setIdentityCredential(t){var e=u(t)?0:b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c;n.wasmclient_setIdentityCredential(this.__wbg_ptr,e,_);}set_auto_connect_excluded(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_set_auto_connect_excluded(this.__wbg_ptr,_,r,e);return p(i)}set_offline(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmclient_set_offline(this.__wbg_ptr,e,_);return p(r)}start_auto_connect(t,e){try{let i=n.__wbindgen_add_to_stack_pointer(-16),a=b(t,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(e,n.__wbindgen_export,n.__wbindgen_export2),x=c;n.wasmclient_start_auto_connect(i,this.__wbg_ptr,a,g,d,x);var _=f().getInt32(i+0,!0),r=f().getInt32(i+4,!0);if(r)throw p(_)}finally{n.__wbindgen_add_to_stack_pointer(16);}}start_presence_loop(t,e,_,r){let i=b(t,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=b(e,n.__wbindgen_export,n.__wbindgen_export2),d=c,x=b(_,n.__wbindgen_export,n.__wbindgen_export2),l=c;var h=u(r)?0:b(r,n.__wbindgen_export,n.__wbindgen_export2),y=c;n.wasmclient_start_presence_loop(this.__wbg_ptr,i,a,g,d,x,l,h,y);}stop_auth_scoped_activity(){n.wasmclient_stop_auth_scoped_activity(this.__wbg_ptr);}stop_auto_connect(){n.wasmclient_stop_auto_connect(this.__wbg_ptr);}stop_presence_loop(){n.wasmclient_stop_presence_loop(this.__wbg_ptr);}submit_browser_desired_peers(t,e){try{let a=n.__wbindgen_add_to_stack_pointer(-16),g=b(e,n.__wbindgen_export,n.__wbindgen_export2),d=c;n.wasmclient_submit_browser_desired_peers(a,this.__wbg_ptr,t,g,d);var _=f().getInt32(a+0,!0),r=f().getInt32(a+4,!0),i=f().getInt32(a+8,!0);if(i)throw p(r);return _!==0}finally{n.__wbindgen_add_to_stack_pointer(16);}}update_device(t,e,_,r,i){let a=b(t,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(e,n.__wbindgen_export,n.__wbindgen_export2),x=c;var l=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),h=c,y=u(i)?0:b(i,n.__wbindgen_export,n.__wbindgen_export2),k=c;let I=n.wasmclient_update_device(this.__wbg_ptr,a,g,d,x,l,h,u(r)?0:w(r),y,k);return p(I)}update_presence(t,e,_,r,i){let a=b(t,n.__wbindgen_export,n.__wbindgen_export2),g=c,d=b(e,n.__wbindgen_export,n.__wbindgen_export2),x=c,l=b(_,n.__wbindgen_export,n.__wbindgen_export2),h=c;var y=u(r)?0:b(r,n.__wbindgen_export,n.__wbindgen_export2),k=c;let I=n.wasmclient_update_presence(this.__wbg_ptr,a,g,d,x,l,h,y,k,!u(i),u(i)?BigInt(0):i);return p(I)}update_session(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_update_session(this.__wbg_ptr,_,r,i,a);return p(g)}validate_session_token(t){let e,_;try{let l=n.__wbindgen_add_to_stack_pointer(-16),h=b(t,n.__wbindgen_export,n.__wbindgen_export2),y=c;n.wasmclient_validate_session_token(l,this.__wbg_ptr,h,y);var r=f().getInt32(l+0,!0),i=f().getInt32(l+4,!0),a=f().getInt32(l+8,!0),g=f().getInt32(l+12,!0),d=r,x=i;if(g)throw d=0,x=0,p(a);return e=d,_=x,v(d,x)}finally{n.__wbindgen_add_to_stack_pointer(16),n.__wbindgen_export4(e,_,1);}}validate_session_token_for_connection(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=b(e,n.__wbindgen_export,n.__wbindgen_export2),a=c,g=n.wasmclient_validate_session_token_for_connection(this.__wbg_ptr,_,r,i,a);return p(g)}validate_session_token_for_connection_with_payload(t,e,_){let r=b(t,n.__wbindgen_export,n.__wbindgen_export2),i=c,a=b(e,n.__wbindgen_export,n.__wbindgen_export2),g=c;var d=u(_)?0:b(_,n.__wbindgen_export,n.__wbindgen_export2),x=c;let l=n.wasmclient_validate_session_token_for_connection_with_payload(this.__wbg_ptr,r,i,a,g,d,x);return p(l)}wait_for_settled_peer(t,e){let _=b(t,n.__wbindgen_export,n.__wbindgen_export2),r=c,i=n.wasmclient_wait_for_settled_peer(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(i)}wake_browser_auto_connect(){return n.wasmclient_wake_browser_auto_connect(this.__wbg_ptr)!==0}};Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);var V=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Z.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_wasmconnection_free(t,0);}create_data_channel(t){let e=b(t,n.__wbindgen_export,n.__wbindgen_export2),_=c,r=n.wasmconnection_create_data_channel(this.__wbg_ptr,e,_);return p(r)}constructor(){try{let r=n.__wbindgen_add_to_stack_pointer(-16);n.wasmconnection_new(r);var t=f().getInt32(r+0,!0),e=f().getInt32(r+4,!0),_=f().getInt32(r+8,!0);if(_)throw p(e);return this.__wbg_ptr=t,Z.register(this,this.__wbg_ptr,this),this}finally{n.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);function jt(){n.start();}function et(){return {__proto__:null,"./openrtc_bg.js":{__proto__:null,__wbg_Error_9dc85fe1bc224456:function(t,e){let _=Error(v(t,e));return w(_)},__wbg_String_8564e559799eccda:function(t,e){let _=String(o(e)),r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg___wbindgen_boolean_get_b131b2f36d6b2f55:function(t){let e=o(t),_=typeof e=="boolean"?e:void 0;return u(_)?16777215:_?1:0},__wbg___wbindgen_debug_string_56c147eb1a51f0c4:function(t,e){let _=P(o(e)),r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg___wbindgen_in_ce8569b2fc6f5088:function(t,e){return o(t)in o(e)},__wbg___wbindgen_is_function_147961669f068cd4:function(t){return typeof o(t)=="function"},__wbg___wbindgen_is_null_ced4761460071341:function(t){return o(t)===null},__wbg___wbindgen_is_object_3a2c414391dbf751:function(t){let e=o(t);return typeof e=="object"&&e!==null},__wbg___wbindgen_is_string_6541b0f6ecd4e8e5:function(t){return typeof o(t)=="string"},__wbg___wbindgen_is_undefined_4410e3c20a99fa97:function(t){return o(t)===void 0},__wbg___wbindgen_jsval_eq_174c93ec61bab0c5:function(t,e){return o(t)===o(e)},__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c:function(t,e){return o(t)==o(e)},__wbg___wbindgen_number_get_588ed6b97f0d7e14:function(t,e){let _=o(e),r=typeof _=="number"?_:void 0;f().setFloat64(t+8,u(r)?0:r,true),f().setInt32(t+0,!u(r),true);},__wbg___wbindgen_string_get_fa2687d531ed17a5:function(t,e){let _=o(e),r=typeof _=="string"?_:void 0;var i=u(r)?0:b(r,n.__wbindgen_export,n.__wbindgen_export2),a=c;f().setInt32(t+4,a,true),f().setInt32(t+0,i,true);},__wbg___wbindgen_throw_bbadd78c1bac3a77:function(t,e){throw new Error(v(t,e))},__wbg__wbg_cb_unref_c2301a3c9b78104b:function(t){o(t)._wbg_cb_unref();},__wbg_abort_56c00f462c9261d9:function(t,e){o(t).abort(o(e));},__wbg_abort_f2416f4a9852003e:function(t){o(t).abort();},__wbg_addEventListener_b635263c509aa7de:function(){return m(function(t,e,_,r){o(t).addEventListener(v(e,_),o(r));},arguments)},__wbg_append_c5a0c94a6a73b22e:function(){return m(function(t,e,_,r,i){o(t).append(v(e,_),v(r,i));},arguments)},__wbg_arrayBuffer_cc7704fa158b907a:function(){return m(function(t){let e=o(t).arrayBuffer();return w(e)},arguments)},__wbg_bistream_new:function(t){let e=z.__wrap(t);return w(e)},__wbg_body_442a47f02322d7b0:function(t){let e=o(t).body;return u(e)?0:w(e)},__wbg_buffer_8524b3453cde4918:function(t){let e=o(t).buffer;return w(e)},__wbg_byobRequest_cc72d210de793e64:function(t){let e=o(t).byobRequest;return u(e)?0:w(e)},__wbg_byteLength_96807b1d9ab24a4c:function(t){return o(t).byteLength},__wbg_byteOffset_a9c7002428843c41:function(t){return o(t).byteOffset},__wbg_call_ec09a4cf93377d3a:function(){return m(function(t,e,_){let r=o(t).call(o(e),o(_));return w(r)},arguments)},__wbg_cancel_f3a197b26dc88b39:function(t){let e=o(t).cancel();return w(e)},__wbg_catch_66060324c27be6f7:function(t,e){let _=o(t).catch(o(e));return w(_)},__wbg_clearTimeout_113b1cde814ec762:function(t){let e=clearTimeout(p(t));return w(e)},__wbg_clearTimeout_333bba87532ab9d3:function(t){let e=clearTimeout(p(t));return w(e)},__wbg_clearTimeout_47a40e3be01ed7a3:function(){return m(function(t,e){o(t).clearTimeout(p(e));},arguments)},__wbg_close_296263cfe1bb2999:function(){return m(function(t){o(t).close();},arguments)},__wbg_close_388d99468213b286:function(){return m(function(t){o(t).close();},arguments)},__wbg_close_4857e22d08b71356:function(){return m(function(t){o(t).close();},arguments)},__wbg_code_1cda2855fcd9b009:function(t){return o(t).code},__wbg_code_70beb7b22374d55e:function(t){return o(t).code},__wbg_createDataChannel_122bd3d8aacee49b:function(t,e,_){let r=o(t).createDataChannel(v(e,_));return w(r)},__wbg_crypto_38df2bab126b63dc:function(t){let e=o(t).crypto;return w(e)},__wbg_data_8a04443c1e5a8cd3:function(t){let e=o(t).data;return w(e)},__wbg_dispatchEvent_cc62a6a43d28b01c:function(){return m(function(t,e){return o(t).dispatchEvent(o(e))},arguments)},__wbg_done_6a8439e544ec6206:function(t){return o(t).done},__wbg_enqueue_bbeb09ba0b140f76:function(){return m(function(t,e){o(t).enqueue(o(e));},arguments)},__wbg_entries_4e00eefd3fd54cf1:function(t){let e=o(t).entries();return w(e)},__wbg_error_6651fee1c71e5da9:function(t){console.error(o(t));},__wbg_error_a6fa202b58aa1cd3:function(t,e){let _,r;try{_=t,r=e,console.error(v(t,e));}finally{n.__wbindgen_export4(_,r,1);}},__wbg_fetch_074561c3e313c86f:function(t){let e=fetch(o(t));return w(e)},__wbg_fetch_22858a12fcf93152:function(t,e){let _=o(t).fetch(o(e));return w(_)},__wbg_getRandomValues_76dfc69825c9c552:function(){return m(function(t,e){globalThis.crypto.getRandomValues(S(t,e));},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return m(function(t,e){o(t).getRandomValues(o(e));},arguments)},__wbg_getReader_9facd4f899beac89:function(){return m(function(t){let e=o(t).getReader();return w(e)},arguments)},__wbg_get_4b90d6d8c5deb5d5:function(t,e){let _=o(t)[e>>>0];return w(_)},__wbg_get_52a8a619f7b88df6:function(){return m(function(t,e){let _=Reflect.get(o(t),o(e));return w(_)},arguments)},__wbg_get_done_c21b9933fc9a9e9c:function(t){let e=o(t).done;return u(e)?16777215:e?1:0},__wbg_get_value_ad568c7d3db9073f:function(t){let e=o(t).value;return w(e)},__wbg_get_with_ref_key_6412cf3094599694:function(t,e){let _=o(t)[o(e)];return w(_)},__wbg_has_14676d88c1340d2c:function(){return m(function(t,e){return Reflect.has(o(t),o(e))},arguments)},__wbg_headers_5b19cf40627ae54d:function(t){let e=o(t).headers;return w(e)},__wbg_info_a2b5f8a5dae8b26c:function(t){console.info(o(t));},__wbg_instanceof_ArrayBuffer_a581da923203f29f:function(t){let e;try{e=o(t)instanceof ArrayBuffer;}catch{e=false;}return e},__wbg_instanceof_Blob_5c4e145be35f9b1e:function(t){let e;try{e=o(t)instanceof Blob;}catch{e=false;}return e},__wbg_instanceof_Response_36a65a969abaa7c6:function(t){let e;try{e=o(t)instanceof Response;}catch{e=false;}return e},__wbg_instanceof_Uint8Array_b6fe1ac89eba107e:function(t){let e;try{e=o(t)instanceof Uint8Array;}catch{e=false;}return e},__wbg_instanceof_Window_9e0fe7d3d1ff4342:function(t){let e;try{e=o(t)instanceof Window;}catch{e=false;}return e},__wbg_isArray_139f48e3c057ede8:function(t){return Array.isArray(o(t))},__wbg_length_68a9d5278d084f4f:function(t){return o(t).length},__wbg_log_6614a4effdb4e983:function(t){console.log(o(t));},__wbg_message_12958526424a887b:function(t,e){let _=o(e).message,r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg_msCrypto_bd5a034af96bcba6:function(t){let e=o(t).msCrypto;return w(e)},__wbg_new_0b303268aa395a38:function(){let t=new Array;return w(t)},__wbg_new_189262ff31890c23:function(){return m(function(){let t=new Headers;return w(t)},arguments)},__wbg_new_20b778a4c5c691c3:function(){let t=new Object;return w(t)},__wbg_new_227d7c05414eb861:function(){let t=new Error;return w(t)},__wbg_new_24739629d416f982:function(){return m(function(){let t=new AbortController;return w(t)},arguments)},__wbg_new_5fae30e6b23db8df:function(t,e){let _=new Error(v(t,e));return w(_)},__wbg_new_883c0db065f06efd:function(){return w(new Map)},__wbg_new_a3e5112401a82338:function(){return m(function(t,e){let _=new WebSocket(v(t,e));return w(_)},arguments)},__wbg_new_b06772b280cc6e52:function(t){let e=new Uint8Array(o(t));return w(e)},__wbg_new_from_slice_bb2d1778c0b87eb1:function(t,e){let _=new Uint8Array(S(t,e));return w(_)},__wbg_new_typed_90c3f6c29ba36d19:function(t,e){try{var _={a:t,b:e},r=(a,g)=>{let d=_.a;_.a=0;try{return lt(d,_.b,a,g)}finally{_.a=d;}};let i=new Promise(r);return w(i)}finally{_.a=0;}},__wbg_new_with_byte_offset_and_length_9e1e664fe1a5d385:function(t,e,_){let r=new Uint8Array(o(t),e>>>0,_>>>0);return w(r)},__wbg_new_with_configuration_3a96aa953ca17197:function(){return m(function(t){let e=new RTCPeerConnection(o(t));return w(e)},arguments)},__wbg_new_with_event_init_dict_bd850674488710b1:function(){return m(function(t,e,_){let r=new CustomEvent(v(t,e),o(_));return w(r)},arguments)},__wbg_new_with_into_underlying_sink_2596343f9b6c8e58:function(t){let e=new WritableStream(B.__wrap(t));return w(e)},__wbg_new_with_into_underlying_source_fd904252f385f59c:function(t,e){let _=new ReadableStream(N.__wrap(t),p(e));return w(_)},__wbg_new_with_length_4b57a7a5dc67221c:function(t){let e=new Uint8Array(t>>>0);return w(e)},__wbg_new_with_str_and_init_df876572184fe639:function(){return m(function(t,e,_){let r=new Request(v(t,e),o(_));return w(r)},arguments)},__wbg_new_with_str_sequence_505a4829cc247e79:function(){return m(function(t,e,_){let r=new WebSocket(v(t,e),o(_));return w(r)},arguments)},__wbg_next_8cb028b6ba50743f:function(){return m(function(t){let e=o(t).next();return w(e)},arguments)},__wbg_node_84ea875411254db1:function(t){let e=o(t).node;return w(e)},__wbg_now_bce4dc999095ea77:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(t){return o(t).now()},__wbg_parse_a5c06e19bc1187fd:function(t,e){return Date.parse(v(t,e))},__wbg_peerunistream_new:function(t){let e=q.__wrap(t);return w(e)},__wbg_performance_3fcf6e32a7e1ed0a:function(t){let e=o(t).performance;return w(e)},__wbg_process_44c7a14e11e9f69e:function(t){let e=o(t).process;return w(e)},__wbg_protocol_28aaef5ea42981d6:function(t,e){let _=o(e).protocol,r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg_prototypesetcall_956c7493c68e29b4:function(t,e,_){Uint8Array.prototype.set.call(S(t,e),o(_));},__wbg_push_ceb8ef046afb2041:function(t,e){return o(t).push(o(e))},__wbg_queueMicrotask_4698f900840e3286:function(t){queueMicrotask(o(t));},__wbg_queueMicrotask_477a5533c7100338:function(t){let e=o(t).queueMicrotask;return w(e)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return m(function(t,e){o(t).randomFillSync(p(e));},arguments)},__wbg_read_8426c146431f2905:function(t){let e=o(t).read();return w(e)},__wbg_readyState_25243ad6ce649774:function(t){return o(t).readyState},__wbg_reason_4ec455bac79b33ce:function(t,e){let _=o(e).reason,r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg_releaseLock_188846ef719acb10:function(t){o(t).releaseLock();},__wbg_removeEventListener_016c1d24523b4730:function(){return m(function(t,e,_,r){o(t).removeEventListener(v(e,_),o(r));},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return m(function(){let t=module.require;return w(t)},arguments)},__wbg_resolve_0183de2e8c6b1d54:function(t){let e=Promise.resolve(o(t));return w(e)},__wbg_respond_3cdb4cf32683fd79:function(){return m(function(t,e){o(t).respond(e>>>0);},arguments)},__wbg_send_99d049cae69c53cc:function(){return m(function(t,e,_){o(t).send(S(e,_));},arguments)},__wbg_send_bac9d3dc4f21ef28:function(){return m(function(t,e,_){o(t).send(v(e,_));},arguments)},__wbg_setTimeout_3a808dd861dd3c12:function(t,e){let _=setTimeout(o(t),e);return w(_)},__wbg_setTimeout_6613a51400c1bf9f:function(){return m(function(t,e,_){let r=o(t).setTimeout(p(e),_);return w(r)},arguments)},__wbg_setTimeout_ef24d2fc3ad97385:function(){return m(function(t,e){let _=setTimeout(o(t),e);return w(_)},arguments)},__wbg_set_5f806304fb633ab3:function(t,e,_){let r=o(t).set(o(e),o(_));return w(r)},__wbg_set_6be42768c690e380:function(t,e,_){o(t)[p(e)]=p(_);},__wbg_set_86698c227e5b9dad:function(t,e,_){o(t).set(S(e,_));},__wbg_set_a6ba3ac0e634b822:function(){return m(function(t,e,_){return Reflect.set(o(t),o(e),o(_))},arguments)},__wbg_set_binaryType_8c2dd2cf1cfc2e28:function(t,e){o(t).binaryType=xt[e];},__wbg_set_body_d1153b16a2b95ca1:function(t,e){o(t).body=o(e);},__wbg_set_cache_5a01a8b5e6ca6cf2:function(t,e){o(t).cache=ht[e];},__wbg_set_credentials_e9120ed88b1fc0b8:function(t,e){o(t).credentials=yt[e];},__wbg_set_da33c120a6584674:function(t,e,_){o(t)[e>>>0]=p(_);},__wbg_set_detail_c7af5edea934390b:function(t,e){o(t).detail=o(e);},__wbg_set_handle_event_6147c38b782c7b42:function(t,e){o(t).handleEvent=o(e);},__wbg_set_headers_877ed41890d28af2:function(t,e){o(t).headers=o(e);},__wbg_set_high_water_mark_77da20c49668427d:function(t,e){o(t).highWaterMark=e;},__wbg_set_method_b4ede299b2064f37:function(t,e,_){o(t).method=v(e,_);},__wbg_set_mode_d6c2e1991aa963c6:function(t,e){o(t).mode=vt[e];},__wbg_set_onclose_9cb5c3372e16c192:function(t,e){o(t).onclose=o(e);},__wbg_set_onerror_190fe67e911ebf28:function(t,e){o(t).onerror=o(e);},__wbg_set_onmessage_96337495f0bfb796:function(t,e){o(t).onmessage=o(e);},__wbg_set_onopen_3e2bf6b11d434c2d:function(t,e){o(t).onopen=o(e);},__wbg_set_signal_9022b5aa06a6ce5b:function(t,e){o(t).signal=o(e);},__wbg_signal_41dd1a8913cd0b7d:function(t){let e=o(t).signal;return w(e)},__wbg_stack_3b0d974bbf31e44f:function(t,e){let _=o(e).stack,r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg_static_accessor_GLOBAL_60a4124bab7dcc9a:function(){let t=typeof global>"u"?null:global;return u(t)?0:w(t)},__wbg_static_accessor_GLOBAL_THIS_95ca6460658b5d13:function(){let t=typeof globalThis>"u"?null:globalThis;return u(t)?0:w(t)},__wbg_static_accessor_SELF_4c95f759a91e9aae:function(){let t=typeof self>"u"?null:self;return u(t)?0:w(t)},__wbg_static_accessor_WINDOW_44b435597f9e9ee7:function(){let t=typeof window>"u"?null:window;return u(t)?0:w(t)},__wbg_status_9e6505cfa3e73a7c:function(t){return o(t).status},__wbg_subarray_42216645a367cd7a:function(t,e,_){let r=o(t).subarray(e>>>0,_>>>0);return w(r)},__wbg_then_254bab9b266a77a5:function(t,e,_){let r=o(t).then(o(e),o(_));return w(r)},__wbg_then_3ea18602c6a5123b:function(t,e){let _=o(t).then(o(e));return w(_)},__wbg_url_72c67c175685a054:function(t,e){let _=o(e).url,r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg_url_d0b8042af0d1bbba:function(t,e){let _=o(e).url,r=b(_,n.__wbindgen_export,n.__wbindgen_export2),i=c;f().setInt32(t+4,i,true),f().setInt32(t+0,r,true);},__wbg_value_3d3defe09fb1ffca:function(t){let e=o(t).value;return w(e)},__wbg_versions_276b2795b1c6a219:function(t){let e=o(t).versions;return w(e)},__wbg_view_15fa5865c6b336e3:function(t){let e=o(t).view;return u(e)?0:w(e)},__wbg_warn_633bacc13ba7e6c3:function(t){console.warn(o(t));},__wbg_wasClean_f17429d064911939:function(t){return o(t).wasClean},__wbindgen_cast_0000000000000001:function(t,e){let _=F(t,e,gt);return w(_)},__wbindgen_cast_0000000000000002:function(t,e){let _=F(t,e,ft);return w(_)},__wbindgen_cast_0000000000000003:function(t,e){let _=F(t,e,dt);return w(_)},__wbindgen_cast_0000000000000004:function(t,e){let _=F(t,e,ut);return w(_)},__wbindgen_cast_0000000000000005:function(t,e){let _=F(t,e,bt);return w(_)},__wbindgen_cast_0000000000000006:function(t,e){let _=F(t,e,at);return w(_)},__wbindgen_cast_0000000000000007:function(t,e){let _=Rt(t,e,pt);return w(_)},__wbindgen_cast_0000000000000008:function(t,e){let _=F(t,e,wt);return w(_)},__wbindgen_cast_0000000000000009:function(t){return w(t)},__wbindgen_cast_000000000000000a:function(t){return w(t)},__wbindgen_cast_000000000000000b:function(t,e){let _=S(t,e);return w(_)},__wbindgen_cast_000000000000000c:function(t,e){let _=v(t,e);return w(_)},__wbindgen_cast_000000000000000d:function(t){let e=BigInt.asUintN(64,t);return w(e)},__wbindgen_cast_000000000000000e:function(t,e){var _=S(t,e).slice();return n.__wbindgen_export4(t,e*1,1),w(_)},__wbindgen_object_clone_ref:function(t){let e=o(t);return w(e)},__wbindgen_object_drop_ref:function(t){p(t);}}}}function bt(s,t){n.__wasm_bindgen_func_elem_8801(s,t);}function at(s,t){n.__wasm_bindgen_func_elem_9944(s,t);}function pt(s,t){n.__wasm_bindgen_func_elem_9998(s,t);}function wt(s,t){n.__wasm_bindgen_func_elem_17767(s,t);}function gt(s,t,e){n.__wasm_bindgen_func_elem_9005(s,t,w(e));}function dt(s,t,e){n.__wasm_bindgen_func_elem_6464(s,t,w(e));}function ut(s,t,e){n.__wasm_bindgen_func_elem_10631(s,t,w(e));}function ft(s,t,e){try{let i=n.__wbindgen_add_to_stack_pointer(-16);n.__wasm_bindgen_func_elem_17912(i,s,t,w(e));var _=f().getInt32(i+0,!0),r=f().getInt32(i+4,!0);if(r)throw p(_)}finally{n.__wbindgen_add_to_stack_pointer(16);}}function lt(s,t,e,_){n.__wasm_bindgen_func_elem_17914(s,t,w(e),w(_));}var xt=["blob","arraybuffer"],mt=["bytes"],ht=["default","no-store","reload","no-cache","force-cache","only-if-cached"],yt=["omit","same-origin","include"],vt=["same-origin","no-cors","cors","navigate"],K=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_bistream_free(s,1)),kt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_intounderlyingbytesource_free(s,1)),H=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_intounderlyingsink_free(s,1)),J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_intounderlyingsource_free(s,1)),Y=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_peerunistream_free(s,1)),Q=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_wasmclient_free(s,1)),Z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbg_wasmconnection_free(s,1));function w(s){W===A.length&&A.push(A.length+1);let t=W;return W=A[t],A[t]=s,t}var G=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>n.__wbindgen_export5(s.a,s.b));function P(s){let t=typeof s;if(t=="number"||t=="boolean"||s==null)return `${s}`;if(t=="string")return `"${s}"`;if(t=="symbol"){let r=s.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){let r=s.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(s)){let r=s.length,i="[";r>0&&(i+=P(s[0]));for(let a=1;a<r;a++)i+=", "+P(s[a]);return i+="]",i}let e=/\[object ([^\]]+)\]/.exec(toString.call(s)),_;if(e&&e.length>1)_=e[1];else return toString.call(s);if(_=="Object")try{return "Object("+JSON.stringify(s)+")"}catch{return "Object"}return s instanceof Error?`${s.name}: ${s.message}
|
|
2
|
-
${s.stack}`:_}function It(s){s<1028||(A[s]=W,W=s);}function At(s,t){s=s>>>0;let e=f(),_=[];for(let r=s;r<s+4*t;r+=4)_.push(p(e.getUint32(r,true)));return _}function S(s,t){return s=s>>>0,T().subarray(s/1,s/1+t)}var E=null;function f(){return (E===null||E.buffer.detached===true||E.buffer.detached===void 0&&E.buffer!==n.memory.buffer)&&(E=new DataView(n.memory.buffer)),E}function v(s,t){return Ft(s>>>0,t)}var O=null;function T(){return (O===null||O.byteLength===0)&&(O=new Uint8Array(n.memory.buffer)),O}function o(s){return A[s]}function m(s,t){try{return s.apply(this,t)}catch(e){n.__wbindgen_export3(w(e));}}var A=new Array(1024).fill(void 0);A.push(void 0,null,true,false);var W=A.length;function u(s){return s==null}function Rt(s,t,e){let _={a:s,b:t,cnt:1},r=(...i)=>{_.cnt++;try{return e(_.a,_.b,...i)}finally{r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(n.__wbindgen_export5(_.a,_.b),_.a=0,G.unregister(_));},G.register(r,_,_),r}function F(s,t,e){let _={a:s,b:t,cnt:1},r=(...i)=>{_.cnt++;let a=_.a;_.a=0;try{return e(a,_.b,...i)}finally{_.a=a,r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(n.__wbindgen_export5(_.a,_.b),_.a=0,G.unregister(_));},G.register(r,_,_),r}function j(s,t){let e=t(s.length*1,1)>>>0;return T().set(s,e/1),c=s.length,e}function tt(s,t){let e=t(s.length*4,4)>>>0,_=f();for(let r=0;r<s.length;r++)_.setUint32(e+4*r,w(s[r]),true);return c=s.length,e}function b(s,t,e){if(e===void 0){let g=M.encode(s),d=t(g.length,1)>>>0;return T().subarray(d,d+g.length).set(g),c=g.length,d}let _=s.length,r=t(_,1)>>>0,i=T(),a=0;for(;a<_;a++){let g=s.charCodeAt(a);if(g>127)break;i[r+a]=g;}if(a!==_){a!==0&&(s=s.slice(a)),r=e(r,_,_=a+s.length*3,1)>>>0;let g=T().subarray(r+a,r+_),d=M.encodeInto(s,g);a+=d.written,r=e(r,_,a,1)>>>0;}return c=a,r}function p(s){let t=o(s);return It(s),t}var L=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});L.decode();var St=2146435072,$=0;function Ft(s,t){return $+=t,$>=St&&(L=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),L.decode(),$=t),L.decode(T().subarray(s,s+t))}var M=new TextEncoder;"encodeInto"in M||(M.encodeInto=function(s,t){let e=M.encode(s);return t.set(e),{read:s.length,written:e.length}});var c=0,n;function nt(s,t){return n=s.exports,E=null,O=null,n.__wbindgen_start(),n}async function Ct(s,t){if(typeof Response=="function"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(s,t)}catch(r){if(s.ok&&e(s.type)&&s.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 s.arrayBuffer();return await WebAssembly.instantiate(_,t)}else {let _=await WebAssembly.instantiate(s,t);return _ instanceof WebAssembly.Instance?{instance:_,module:s}:_}function e(_){switch(_){case "basic":case "cors":case "default":return true}return false}}function Ot(s){if(n!==void 0)return n;s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module:s}=s:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=et();s instanceof WebAssembly.Module||(s=new WebAssembly.Module(s));let e=new WebAssembly.Instance(s,t);return nt(e)}async function Wt(s){if(n!==void 0)return n;s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),s===void 0&&(s=new URL("openrtc_bg.wasm",import.meta.url));let t=et();(typeof s=="string"||typeof Request=="function"&&s instanceof Request||typeof URL=="function"&&s instanceof URL)&&(s=fetch(s));let{instance:e,module:_}=await Ct(await s,t);return nt(e)}export{z as BiStream,U as IntoUnderlyingByteSource,B as IntoUnderlyingSink,N as IntoUnderlyingSource,q as PeerUniStream,D as WasmClient,V as WasmConnection,Wt as default,Ot as initSync,jt as start};
|
package/dist/runtime/legacy.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { d as OpenRTCClient } from '../OpenRTCShared-BswnbjpG.js';
|
|
2
|
-
import { P as PlutoIpcBridge } from '../ipc-CflAVodw.js';
|
|
3
|
-
import { a as RuntimeClientOptions } from '../types-D0pqNSOf.js';
|
|
4
|
-
import '../types-BHePJWbM.js';
|
|
5
|
-
import '../IEngineBridge-BbsT8hof.js';
|
|
6
|
-
import '../capabilities-YSskrE8H.js';
|
|
7
|
-
import '../ITransport-BsPcaov7.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Rollback-only constructor for the internal diagnostic sandbox. Shipping 2.0
|
|
11
|
-
* applications must use the root capability API.
|
|
12
|
-
*/
|
|
13
|
-
declare function createLegacyOpenRTC(options: RuntimeClientOptions): Promise<OpenRTCClient>;
|
|
14
|
-
declare namespace createLegacyOpenRTC {
|
|
15
|
-
var native: (options: RuntimeClientOptions, bridge?: PlutoIpcBridge) => OpenRTCClient;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { createLegacyOpenRTC };
|
package/dist/runtime/legacy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as createLegacyOpenRTC}from'../chunk-RKLFCEAL.js';import'../chunk-2QHDEGVX.js';import'../chunk-I4TY5LGB.js';import'../chunk-EXE6ZAE7.js';import'../chunk-7LYYPXCV.js';import'../chunk-N4SX7C3W.js';import'../chunk-AHHBPPQW.js';import'../chunk-PDXJVQ7Z.js';import'../chunk-4UZFT2P6.js';import'../chunk-7Z6N46RB.js';import'../chunk-3HCG7RQF.js';import'../chunk-VK6KX433.js';import'../chunk-NT5YHZQH.js';import'../chunk-K37WVIZL.js';import'../chunk-BXFXPIXO.js';import'../chunk-N26S7V4N.js';import'../chunk-NB4H5TP3.js';import'../chunk-RD3JEGGF.js';import'../chunk-C7YN5MSV.js';
|
package/dist/runtime/tauri.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { T as TauriRuntimeAdapter, b as TauriRuntimeAdapterOptions, c as createTauriIpcBridge } from '../tauri-BgLgJoQA.js';
|
|
2
|
-
import '../ipc-CflAVodw.js';
|
|
3
|
-
import '../types-BHePJWbM.js';
|
|
4
|
-
import '../DelegatingRuntimeAdapter-BLNigcS4.js';
|
|
5
|
-
import '../IEngineBridge-BbsT8hof.js';
|
|
6
|
-
import '../capabilities-YSskrE8H.js';
|
package/dist/runtime/tauri.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-Q4QVXWCW.js';import'../chunk-PDXJVQ7Z.js';import'../chunk-4UZFT2P6.js';import'../chunk-3HCG7RQF.js';import'../chunk-VK6KX433.js';import'../chunk-NT5YHZQH.js';import'../chunk-K37WVIZL.js';import'../chunk-BXFXPIXO.js';import'../chunk-N26S7V4N.js';import'../chunk-NB4H5TP3.js';import'../chunk-RD3JEGGF.js';import'../chunk-C7YN5MSV.js';
|
package/dist/tauri-BgLgJoQA.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { C as ClientOptions } from './types-BHePJWbM.js';
|
|
2
|
-
import { W as WasmBridgeOptions, D as DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter-BLNigcS4.js';
|
|
3
|
-
import { P as PlutoIpcBridge } from './ipc-CflAVodw.js';
|
|
4
|
-
|
|
5
|
-
interface NativeIpcBridgeOptions extends WasmBridgeOptions {
|
|
6
|
-
allowWasmFallback?: boolean;
|
|
7
|
-
ipcBridge?: PlutoIpcBridge;
|
|
8
|
-
transports?: ClientOptions['transports'];
|
|
9
|
-
strictMode?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface IpcRuntimeAdapterOptions extends NativeIpcBridgeOptions {
|
|
13
|
-
bridge: PlutoIpcBridge;
|
|
14
|
-
}
|
|
15
|
-
declare class IpcRuntimeAdapter extends DelegatingRuntimeAdapter {
|
|
16
|
-
constructor(options: IpcRuntimeAdapterOptions);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Native Tauri support now lives in the first-party `openrtc-tauri` package.
|
|
21
|
-
* Removal target: OpenRTC 0.2.0. This shim remains for one compatibility cycle.
|
|
22
|
-
*/
|
|
23
|
-
declare function createTauriIpcBridge(): PlutoIpcBridge;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Native Tauri support now lives in the first-party `openrtc-tauri` package.
|
|
26
|
-
* Removal target: OpenRTC 0.2.0. This shim remains for one compatibility cycle.
|
|
27
|
-
*/
|
|
28
|
-
declare class TauriRuntimeAdapter extends IpcRuntimeAdapter {
|
|
29
|
-
constructor(options: NativeIpcBridgeOptions);
|
|
30
|
-
}
|
|
31
|
-
type TauriRuntimeAdapterOptions = NativeIpcBridgeOptions;
|
|
32
|
-
|
|
33
|
-
export { IpcRuntimeAdapter as I, TauriRuntimeAdapter as T, type IpcRuntimeAdapterOptions as a, type TauriRuntimeAdapterOptions as b, createTauriIpcBridge as c };
|