openrtc 2.8.7 → 2.8.9

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/node.js CHANGED
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-UBLYBL3O.js';import {a}from'./chunk-WD2FZUOM.js';import {c}from'./chunk-72NEEJQG.js';import {a as a$3}from'./chunk-67RYEH6T.js';import'./chunk-AUICRD2W.js';import {i,b as b$1,a as a$4}from'./chunk-TWIZQT6M.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import {a as a$2,c as c$1,d,i as i$1,f as f$1}from'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';import {spawn}from'child_process';import {constants}from'fs';import {access,readFile}from'fs/promises';import {isAbsolute,resolve,dirname}from'path';import {fileURLToPath}from'url';import {isDeepStrictEqual}from'util';import {randomUUID,verify,createHash}from'crypto';var N=1,F=24*1024,U=96*1024,E=128*1024,C=64*1024,ne=256,ie=256,L=3e4,se=/^[A-Za-z0-9_.:@-]+$/,ae=/(?:^|_)(?:SECRET|TOKEN|PASSWORD|PRIVATE(?:_KEY)?|CREDENTIALS?)(?:_|$)/i,ce=1;function de(r){return Buffer.from(JSON.stringify({schema:r.schema,kind:r.kind,platform:r.platform,arch:r.arch,rustTarget:r.rustTarget,sourceCommit:r.sourceCommit,sourceDigest:r.sourceDigest,binarySha256:r.binarySha256,protocol:r.protocol,signingKeySha256:r.signingKeySha256,signatureAlgorithm:r.signatureAlgorithm}),"utf8")}async function le(r,e,t){let[o,n,a]=await Promise.all([readFile(t),readFile(resolve(e,"openrtc-node-host.manifest.json")),readFile(resolve(r,"native","openrtc-node-host-signing-public.pem"))]).catch(()=>{throw new Error("[OpenRTC] Packaged Node host provenance is incomplete.")}),i;try{i=JSON.parse(n.toString("utf8"));}catch{throw new Error("[OpenRTC] Packaged Node host manifest is invalid.")}let c=s=>createHash("sha256").update(s).digest("hex"),l={"darwin-arm64":"aarch64-apple-darwin","darwin-x64":"x86_64-apple-darwin","linux-x64":"x86_64-unknown-linux-gnu"}[`${process.platform}-${process.arch}`];if(!(i!=null&&l!==void 0&&i.schema===ce&&i.kind==="openrtc-node-host"&&i.platform===process.platform&&i.arch===process.arch&&i.rustTarget===l&&/^[0-9a-f]{40}$/.test(i.sourceCommit)&&/^[0-9a-f]{64}$/.test(i.sourceDigest)&&i.binarySha256===c(o)&&i.signingKeySha256===c(a)&&i.signatureAlgorithm==="ed25519"&&/^[A-Za-z0-9+/]{86}==$/.test(i.signature)&&verify(null,de(i),a,Buffer.from(i.signature,"base64"))))throw new Error("[OpenRTC] Packaged Node host provenance verification failed.")}function z(r){return Object.fromEntries(Object.entries(process.env).filter(([e,t])=>!ae.test(e)&&(!r||!t?.includes(r))))}function f(r,e){queueMicrotask(()=>{try{let t=r(e);t&&typeof t.then=="function"&&t.catch(()=>{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}});}catch{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}}});}function $(r){let e=/^\d{1,20}$/;return typeof r.transportStableId!="string"||!e.test(r.transportStableId)||!e.test(r.transportGeneration)||!e.test(r.routeGeneration)?null:{transportStableId:r.transportStableId,transportGeneration:r.transportGeneration,routeGeneration:r.routeGeneration}}function ue(r,e){return r.transportStableId===e.transportStableId&&r.transportGeneration===e.transportGeneration&&r.routeGeneration===e.routeGeneration}function m(r,e,t=160){let o=r.trim();if(!o||o.length>t||!se.test(o))throw new TypeError(`[OpenRTC] ${e} is invalid.`);return o}function v(r,e,t=Number.MAX_SAFE_INTEGER){if(!Number.isSafeInteger(r)||r<1||r>t)throw new RangeError(`[OpenRTC] ${e} must be a positive safe integer.`);return r}function pe(r){if(!/^pk_(?:live|test)_[A-Za-z0-9]+$/.test(r.apiKey))throw new TypeError("[OpenRTC] apiKey is invalid.");if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(r.secretKey)||r.secretKey.length>128)throw new TypeError("[OpenRTC] secretKey is invalid.");let e=[...r.shardIds].map(t=>m(t,"shardId",80)).sort();if(e.length<1||e.length>64||new Set(e).size!==e.length)throw new RangeError("[OpenRTC] shardIds must contain 1..64 unique identifiers.");if(!isAbsolute(r.stateDirectory))throw new TypeError("[OpenRTC] stateDirectory must be absolute.");return r.maxPeers!==void 0&&v(r.maxPeers,"maxPeers",50),r.startupTimeoutMs!==void 0&&v(r.startupTimeoutMs,"startupTimeoutMs",12e4),{...r,serviceId:m(r.serviceId,"serviceId",80),generation:v(r.generation,"generation"),shardIds:e,deviceId:m(r.deviceId,"deviceId"),deviceName:r.deviceName?.trim()||"OpenRTC Node service"}}async function y(r){try{return await access(r,process.platform==="win32"?constants.F_OK:constants.X_OK),!0}catch{return false}}async function V(r,e,t,o,n){return new Promise((a,i)=>{let c=spawn(r,e,{cwd:t,env:z(n),stdio:["ignore","pipe","pipe"]}),d=Buffer.alloc(0),l=Buffer.alloc(0),u=(p,Y)=>Buffer.concat([p,Y]).subarray(-E);c.stdout.on("data",p=>{d=u(d,p);}),c.stderr.on("data",p=>{l=u(l,p);});let s=setTimeout(()=>{c.kill(),i(new Error(`[OpenRTC] Node host command timed out: ${r}.`));},o);c.once("error",p=>{clearTimeout(s),i(p);}),c.once("exit",p=>{clearTimeout(s),p===0?a(d.toString("utf8")):i(new Error(`[OpenRTC] Node host command failed (${p??"signal"}): ${l.toString("utf8").trim().slice(-4096)}`));});})}async function J(r){let e=r.binaryPath||process.env.OPENRTC_NODE_HOST_BINARY;if(e){if(!isAbsolute(e)||!await y(e))throw new Error("[OpenRTC] Node host binaryPath must name an executable absolute path.");return {command:e,args:[...r.binaryArgs??[]]}}if(r.buildFromSource){let a=r.sourceRoot||process.env.OPENRTC_SOURCE_ROOT;if(!a||!isAbsolute(a))throw new Error("[OpenRTC] buildFromSource requires an absolute sourceRoot or OPENRTC_SOURCE_ROOT.");let i=resolve(a,"crates/openrtc/Cargo.toml"),c=resolve(a,"target");await V("cargo",["build","--locked","--manifest-path",i,"--features","node-host","--bin","openrtc-node-host","--target-dir",c],a,12e4,r.secretKey);let d=resolve(c,"debug",`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(d))throw new Error("[OpenRTC] local Node host build did not produce an executable.");return {command:d,args:[]}}let t=resolve(dirname(fileURLToPath(import.meta.url)),".."),o=resolve(t,"native",`${process.platform}-${process.arch}`),n=resolve(o,`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(n))throw new Error(`[OpenRTC] This package has no Node host for ${process.platform}-${process.arch}. Install a supported OpenRTC package, set OPENRTC_NODE_HOST_BINARY, or use buildFromSource with sourceRoot.`);return await le(t,o,n),{command:n,args:[]}}async function X(r,e){let t=await V(r.command,[...r.args,"--protocol-info"],process.cwd(),12e4,e),o=JSON.parse(t);if(o.protocolVersion!==N||o.lifecycleOwner!=="rust-peer-session"||o.maxConfigBytes!==F||o.maxCommandBytes!==U||o.maxApplicationPayloadBytes!==C)throw new Error("[OpenRTC] Node host protocol is incompatible.");return o}var I=class{constructor(e,t,o){this.options=e;this.roomId=t;this.onEvent=o;this.child=null;this.childClosed=Promise.resolve();this.output=Buffer.alloc(0);this.stderr=Buffer.alloc(0);this.pending=new Map;this.writeQueue=Promise.resolve();this.stopped=false;this.closing=null;}async start(){let e=await J(this.options),t=await X(e,this.options.secretKey),o=new Promise((n,a)=>{let i=spawn(e.command,[...e.args],{env:z(this.options.secretKey),stdio:["pipe","pipe","pipe"]});this.child=i,this.childClosed=new Promise(u=>i.once("close",()=>u()));let c,d=setTimeout(()=>{a(this.failure("Node host startup timed out")),i.kill();},this.options.startupTimeoutMs??L),l=u=>{clearTimeout(d);let s=f$1.is(u)?u:this.failure(u.message);a(s),this.failAll(s);};i.once("error",l),i.stderr.on("data",u=>{this.stderr=Buffer.concat([this.stderr,u]).subarray(-4096);}),i.stdout.on("data",u=>{try{for(let s of this.parse(u)){if(s.type==="failure"){c=this.failure(s.error,s.serviceError),l(c);continue}if(t.testLane&&process.env.OPENRTC_NODE_HOST_LOCAL_TRACE==="1"&&s.type==="connection-state"&&console.error("[openrtc-local-node]",this.options.deviceId,{connectionId:s.snapshot.connectionId,deviceId:s.snapshot.deviceId,state:s.snapshot.state,routable:s.snapshot.routable,transportStableId:s.transportStableId,transportGeneration:s.transportGeneration,routeGeneration:s.routeGeneration}),s.type==="ready"){if(s.protocolVersion!==N||s.roomId!==this.roomId||s.deviceId!==this.options.deviceId||!isDeepStrictEqual(s.testLane,t.testLane))throw new Error("Node host returned inconsistent readiness metadata");clearTimeout(d),n();}this.dispatch(s);}}catch(s){l(s instanceof Error?s:new Error(String(s))),i.kill();}}),i.once("exit",(u,s)=>{clearTimeout(d),this.stopped=true;let p=c??this.failure(`Node host exited (${u??s??"unknown"})`);this.onEvent({type:"host-exit",error:p}),l(p);});});await this.writeLine({protocolVersion:N,apiKey:this.options.apiKey,secretKey:this.options.secretKey,serviceId:this.options.serviceId,generation:this.options.generation,shardIds:this.options.shardIds,deviceId:this.options.deviceId,roomId:this.roomId,deviceName:this.options.deviceName,stateDirectory:this.options.stateDirectory,maxPeers:this.options.maxPeers,irohRelay:this.options.irohRelay!==false},F),await o;}async request(e,t){if(!this.child||this.stopped||!this.child.stdin.writable)throw new Error("[OpenRTC] Node host is closed.");if(this.pending.size>=ne)throw new Error("[OpenRTC] Node host has too many pending requests.");let o=randomUUID(),n=new Promise((a,i)=>{let c=setTimeout(()=>{this.pending.delete(o),i(new Error(`[OpenRTC] Node host ${e} response timed out.`));},L);this.pending.set(o,{resolve:a,reject:i,timer:c});});try{await this.writeLine({type:e,id:o,...t},U);}catch(a){let i=this.pending.get(o);throw i&&clearTimeout(i.timer),this.pending.delete(o),this.failure(a instanceof Error?a.message:String(a))}return n}close(){return this.closing??(this.closing=this.stop())}async stop(){if(!this.child)return;let e=this.child;try{this.stopped||await this.request("shutdown",{});}finally{e.stdin.end();let t=setTimeout(()=>e.kill("SIGTERM"),2e3),o=setTimeout(()=>e.kill("SIGKILL"),4e3);try{await this.childClosed;}finally{clearTimeout(t),clearTimeout(o);}}}parse(e){if(this.output=Buffer.concat([this.output,e]),this.output.length>E&&!this.output.includes(10))throw new Error("Node host output line exceeded its byte limit");let t=[];for(;;){let o=this.output.indexOf(10);if(o<0)break;if(o>E)throw new Error("Node host output line exceeded its byte limit");let n=this.output.subarray(0,o).toString("utf8").trim();this.output=this.output.subarray(o+1),n&&t.push(JSON.parse(n));}return t}writeLine(e,t){let o=`${JSON.stringify(e)}
1
+ import {a as a$1}from'./chunk-UBLYBL3O.js';import {a}from'./chunk-WD2FZUOM.js';import {c}from'./chunk-72NEEJQG.js';import {a as a$3}from'./chunk-67RYEH6T.js';import'./chunk-AUICRD2W.js';import {i,b as b$1,a as a$4}from'./chunk-IR5VXG3N.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import {a as a$2,c as c$1,d,i as i$1,f as f$1}from'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';import {spawn}from'child_process';import {constants}from'fs';import {access,readFile}from'fs/promises';import {isAbsolute,resolve,dirname}from'path';import {fileURLToPath}from'url';import {isDeepStrictEqual}from'util';import {randomUUID,verify,createHash}from'crypto';var N=1,F=24*1024,U=96*1024,E=128*1024,C=64*1024,ne=256,ie=256,L=3e4,se=/^[A-Za-z0-9_.:@-]+$/,ae=/(?:^|_)(?:SECRET|TOKEN|PASSWORD|PRIVATE(?:_KEY)?|CREDENTIALS?)(?:_|$)/i,ce=1;function de(r){return Buffer.from(JSON.stringify({schema:r.schema,kind:r.kind,platform:r.platform,arch:r.arch,rustTarget:r.rustTarget,sourceCommit:r.sourceCommit,sourceDigest:r.sourceDigest,binarySha256:r.binarySha256,protocol:r.protocol,signingKeySha256:r.signingKeySha256,signatureAlgorithm:r.signatureAlgorithm}),"utf8")}async function le(r,e,t){let[o,n,a]=await Promise.all([readFile(t),readFile(resolve(e,"openrtc-node-host.manifest.json")),readFile(resolve(r,"native","openrtc-node-host-signing-public.pem"))]).catch(()=>{throw new Error("[OpenRTC] Packaged Node host provenance is incomplete.")}),i;try{i=JSON.parse(n.toString("utf8"));}catch{throw new Error("[OpenRTC] Packaged Node host manifest is invalid.")}let c=s=>createHash("sha256").update(s).digest("hex"),l={"darwin-arm64":"aarch64-apple-darwin","darwin-x64":"x86_64-apple-darwin","linux-x64":"x86_64-unknown-linux-gnu"}[`${process.platform}-${process.arch}`];if(!(i!=null&&l!==void 0&&i.schema===ce&&i.kind==="openrtc-node-host"&&i.platform===process.platform&&i.arch===process.arch&&i.rustTarget===l&&/^[0-9a-f]{40}$/.test(i.sourceCommit)&&/^[0-9a-f]{64}$/.test(i.sourceDigest)&&i.binarySha256===c(o)&&i.signingKeySha256===c(a)&&i.signatureAlgorithm==="ed25519"&&/^[A-Za-z0-9+/]{86}==$/.test(i.signature)&&verify(null,de(i),a,Buffer.from(i.signature,"base64"))))throw new Error("[OpenRTC] Packaged Node host provenance verification failed.")}function z(r){return Object.fromEntries(Object.entries(process.env).filter(([e,t])=>!ae.test(e)&&(!r||!t?.includes(r))))}function f(r,e){queueMicrotask(()=>{try{let t=r(e);t&&typeof t.then=="function"&&t.catch(()=>{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}});}catch{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}}});}function $(r){let e=/^\d{1,20}$/;return typeof r.transportStableId!="string"||!e.test(r.transportStableId)||!e.test(r.transportGeneration)||!e.test(r.routeGeneration)?null:{transportStableId:r.transportStableId,transportGeneration:r.transportGeneration,routeGeneration:r.routeGeneration}}function ue(r,e){return r.transportStableId===e.transportStableId&&r.transportGeneration===e.transportGeneration&&r.routeGeneration===e.routeGeneration}function m(r,e,t=160){let o=r.trim();if(!o||o.length>t||!se.test(o))throw new TypeError(`[OpenRTC] ${e} is invalid.`);return o}function v(r,e,t=Number.MAX_SAFE_INTEGER){if(!Number.isSafeInteger(r)||r<1||r>t)throw new RangeError(`[OpenRTC] ${e} must be a positive safe integer.`);return r}function pe(r){if(!/^pk_(?:live|test)_[A-Za-z0-9]+$/.test(r.apiKey))throw new TypeError("[OpenRTC] apiKey is invalid.");if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(r.secretKey)||r.secretKey.length>128)throw new TypeError("[OpenRTC] secretKey is invalid.");let e=[...r.shardIds].map(t=>m(t,"shardId",80)).sort();if(e.length<1||e.length>64||new Set(e).size!==e.length)throw new RangeError("[OpenRTC] shardIds must contain 1..64 unique identifiers.");if(!isAbsolute(r.stateDirectory))throw new TypeError("[OpenRTC] stateDirectory must be absolute.");return r.maxPeers!==void 0&&v(r.maxPeers,"maxPeers",50),r.startupTimeoutMs!==void 0&&v(r.startupTimeoutMs,"startupTimeoutMs",12e4),{...r,serviceId:m(r.serviceId,"serviceId",80),generation:v(r.generation,"generation"),shardIds:e,deviceId:m(r.deviceId,"deviceId"),deviceName:r.deviceName?.trim()||"OpenRTC Node service"}}async function y(r){try{return await access(r,process.platform==="win32"?constants.F_OK:constants.X_OK),!0}catch{return false}}async function V(r,e,t,o,n){return new Promise((a,i)=>{let c=spawn(r,e,{cwd:t,env:z(n),stdio:["ignore","pipe","pipe"]}),d=Buffer.alloc(0),l=Buffer.alloc(0),u=(p,Y)=>Buffer.concat([p,Y]).subarray(-E);c.stdout.on("data",p=>{d=u(d,p);}),c.stderr.on("data",p=>{l=u(l,p);});let s=setTimeout(()=>{c.kill(),i(new Error(`[OpenRTC] Node host command timed out: ${r}.`));},o);c.once("error",p=>{clearTimeout(s),i(p);}),c.once("exit",p=>{clearTimeout(s),p===0?a(d.toString("utf8")):i(new Error(`[OpenRTC] Node host command failed (${p??"signal"}): ${l.toString("utf8").trim().slice(-4096)}`));});})}async function J(r){let e=r.binaryPath||process.env.OPENRTC_NODE_HOST_BINARY;if(e){if(!isAbsolute(e)||!await y(e))throw new Error("[OpenRTC] Node host binaryPath must name an executable absolute path.");return {command:e,args:[...r.binaryArgs??[]]}}if(r.buildFromSource){let a=r.sourceRoot||process.env.OPENRTC_SOURCE_ROOT;if(!a||!isAbsolute(a))throw new Error("[OpenRTC] buildFromSource requires an absolute sourceRoot or OPENRTC_SOURCE_ROOT.");let i=resolve(a,"crates/openrtc/Cargo.toml"),c=resolve(a,"target");await V("cargo",["build","--locked","--manifest-path",i,"--features","node-host","--bin","openrtc-node-host","--target-dir",c],a,12e4,r.secretKey);let d=resolve(c,"debug",`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(d))throw new Error("[OpenRTC] local Node host build did not produce an executable.");return {command:d,args:[]}}let t=resolve(dirname(fileURLToPath(import.meta.url)),".."),o=resolve(t,"native",`${process.platform}-${process.arch}`),n=resolve(o,`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(n))throw new Error(`[OpenRTC] This package has no Node host for ${process.platform}-${process.arch}. Install a supported OpenRTC package, set OPENRTC_NODE_HOST_BINARY, or use buildFromSource with sourceRoot.`);return await le(t,o,n),{command:n,args:[]}}async function X(r,e){let t=await V(r.command,[...r.args,"--protocol-info"],process.cwd(),12e4,e),o=JSON.parse(t);if(o.protocolVersion!==N||o.lifecycleOwner!=="rust-peer-session"||o.maxConfigBytes!==F||o.maxCommandBytes!==U||o.maxApplicationPayloadBytes!==C)throw new Error("[OpenRTC] Node host protocol is incompatible.");return o}var I=class{constructor(e,t,o){this.options=e;this.roomId=t;this.onEvent=o;this.child=null;this.childClosed=Promise.resolve();this.output=Buffer.alloc(0);this.stderr=Buffer.alloc(0);this.pending=new Map;this.writeQueue=Promise.resolve();this.stopped=false;this.closing=null;}async start(){let e=await J(this.options),t=await X(e,this.options.secretKey),o=new Promise((n,a)=>{let i=spawn(e.command,[...e.args],{env:z(this.options.secretKey),stdio:["pipe","pipe","pipe"]});this.child=i,this.childClosed=new Promise(u=>i.once("close",()=>u()));let c,d=setTimeout(()=>{a(this.failure("Node host startup timed out")),i.kill();},this.options.startupTimeoutMs??L),l=u=>{clearTimeout(d);let s=f$1.is(u)?u:this.failure(u.message);a(s),this.failAll(s);};i.once("error",l),i.stderr.on("data",u=>{this.stderr=Buffer.concat([this.stderr,u]).subarray(-4096);}),i.stdout.on("data",u=>{try{for(let s of this.parse(u)){if(s.type==="failure"){c=this.failure(s.error,s.serviceError),l(c);continue}if(t.testLane&&process.env.OPENRTC_NODE_HOST_LOCAL_TRACE==="1"&&s.type==="connection-state"&&console.error("[openrtc-local-node]",this.options.deviceId,{connectionId:s.snapshot.connectionId,deviceId:s.snapshot.deviceId,state:s.snapshot.state,routable:s.snapshot.routable,transportStableId:s.transportStableId,transportGeneration:s.transportGeneration,routeGeneration:s.routeGeneration}),s.type==="ready"){if(s.protocolVersion!==N||s.roomId!==this.roomId||s.deviceId!==this.options.deviceId||!isDeepStrictEqual(s.testLane,t.testLane))throw new Error("Node host returned inconsistent readiness metadata");clearTimeout(d),n();}this.dispatch(s);}}catch(s){l(s instanceof Error?s:new Error(String(s))),i.kill();}}),i.once("exit",(u,s)=>{clearTimeout(d),this.stopped=true;let p=c??this.failure(`Node host exited (${u??s??"unknown"})`);this.onEvent({type:"host-exit",error:p}),l(p);});});await this.writeLine({protocolVersion:N,apiKey:this.options.apiKey,secretKey:this.options.secretKey,serviceId:this.options.serviceId,generation:this.options.generation,shardIds:this.options.shardIds,deviceId:this.options.deviceId,roomId:this.roomId,deviceName:this.options.deviceName,stateDirectory:this.options.stateDirectory,maxPeers:this.options.maxPeers,irohRelay:this.options.irohRelay!==false},F),await o;}async request(e,t){if(!this.child||this.stopped||!this.child.stdin.writable)throw new Error("[OpenRTC] Node host is closed.");if(this.pending.size>=ne)throw new Error("[OpenRTC] Node host has too many pending requests.");let o=randomUUID(),n=new Promise((a,i)=>{let c=setTimeout(()=>{this.pending.delete(o),i(new Error(`[OpenRTC] Node host ${e} response timed out.`));},L);this.pending.set(o,{resolve:a,reject:i,timer:c});});try{await this.writeLine({type:e,id:o,...t},U);}catch(a){let i=this.pending.get(o);throw i&&clearTimeout(i.timer),this.pending.delete(o),this.failure(a instanceof Error?a.message:String(a))}return n}close(){return this.closing??(this.closing=this.stop())}async stop(){if(!this.child)return;let e=this.child;try{this.stopped||await this.request("shutdown",{});}finally{e.stdin.end();let t=setTimeout(()=>e.kill("SIGTERM"),2e3),o=setTimeout(()=>e.kill("SIGKILL"),4e3);try{await this.childClosed;}finally{clearTimeout(t),clearTimeout(o);}}}parse(e){if(this.output=Buffer.concat([this.output,e]),this.output.length>E&&!this.output.includes(10))throw new Error("Node host output line exceeded its byte limit");let t=[];for(;;){let o=this.output.indexOf(10);if(o<0)break;if(o>E)throw new Error("Node host output line exceeded its byte limit");let n=this.output.subarray(0,o).toString("utf8").trim();this.output=this.output.subarray(o+1),n&&t.push(JSON.parse(n));}return t}writeLine(e,t){let o=`${JSON.stringify(e)}
2
2
  `;if(Buffer.byteLength(o,"utf8")-1>t)return Promise.reject(new Error("Node host input line exceeded its byte limit"));let n=this.writeQueue.then(()=>new Promise((a,i)=>{if(!this.child||this.stopped||!this.child.stdin.writable){i(new Error("Node host is closed"));return}this.child.stdin.write(o,c=>{c?i(c):a();});}));return this.writeQueue=n.catch(()=>{}),n}dispatch(e){if(e.type!=="response"){this.onEvent(e);return}let t=this.pending.get(e.id);t&&(clearTimeout(t.timer),this.pending.delete(e.id),e.ok?t.resolve(e.value):t.reject(this.failure(e.error||"Node host request failed",e.serviceError)));}failure(e,t){let o=c=>c.split(this.options.secretKey).join("[REDACTED]"),n=o(e),a=o(this.stderr.toString("utf8")).trim(),i=`[OpenRTC] ${n}.${a?` Host stderr: ${a}`:""}`;if(t&&typeof t=="object"&&!Array.isArray(t)){let c=t,d$1=a$2(c.code);if(c$1(c.code)||d$1){let l=d(c);return i$1({...l,requestId:l.requestId?o(l.requestId):void 0,code:c.code,retryable:typeof c.retryable=="boolean"?c.retryable:!!d$1,message:i})}}return new Error(i)}failAll(e){for(let t of this.pending.values())clearTimeout(t.timer),t.reject(e);this.pending.clear();}},S=class{constructor(e,t,o,n,a){this.id=e;this.peerId=t;this.host=o;this.nativeGeneration=n;this.capabilityKey=a;this.messages=new Set;this.closeListeners=new Set;this.queued=[];this.isClosed=false;}async send(e){if(this.isClosed)throw new Error("[OpenRTC] Connection is closed.");let t=he(e instanceof Uint8Array||e instanceof ArrayBuffer?e:a$4("raw","message",e,this.capabilityKey));await this.host.request("send",{connectionId:this.id,payloadBase64:t.toString("base64")});}onMessage(e){let t=e;this.messages.add(t);for(let o of this.queued.splice(0))f(t,o);return ()=>this.messages.delete(t)}onClose(e){return this.isClosed?f(e,void 0):this.closeListeners.add(e),()=>this.closeListeners.delete(e)}receive(e){if(!this.isClosed){if(this.messages.size===0){this.queued.length===ie&&this.queued.shift(),this.queued.push(e);return}for(let t of this.messages)f(t,e);}}close(){if(!this.isClosed){this.isClosed=true,this.queued.length=0;for(let e of this.closeListeners)f(e,void 0);this.messages.clear(),this.closeListeners.clear();}}accepts(e){return ue(e,this.nativeGeneration)}replaceGeneration(e){this.nativeGeneration=e;}},T=class{constructor(e,t,o){this.id=e;this.host=t;this.onServiceError=o;this.kind="room";this.listeners=new Set;this.connections=new Map;this.closed=false;}publishAssignment(e){if(this.closed)return Promise.reject(new Error("[OpenRTC] Service room is closed."));let t=(e.priorityDeviceIds??[]).map(n=>m(n,"priorityDeviceId")),o=(e.relevantEntityIds??[]).map(n=>m(n,"relevantEntityId"));return t.length>8||o.length>32||new Set(t).size!==t.length||new Set(o).size!==o.length?Promise.reject(new Error("[OpenRTC] Authority assignment identifiers are invalid.")):this.host.request("publish-assignment",{revision:v(e.revision,"revision"),subjectDeviceId:m(e.subjectDeviceId,"subjectDeviceId"),shardId:m(e.shardId,"shardId",80),priorityDeviceIds:t,relevantEntityIds:o,ttlMs:e.ttlMs===void 0?void 0:v(e.ttlMs,"ttlMs",12e4)})}onConnection(e){this.listeners.add(e);for(let t of this.connections.values())f(e,t);return ()=>this.listeners.delete(e)}project(e){if(this.closed)return;if(e.type==="host-exit"){this.closed=true;for(let d of this.connections.values())d.close();this.connections.clear(),this.listeners.clear();return}if(e.type==="service-error"){let d=e.avenue;if(!d||typeof d!="object"||Array.isArray(d))return;let l=d;if(l.kind!=="room"||l.id!==this.id||typeof e.runtimeInstanceId!="string"||e.runtimeInstanceId.trim().length===0)return;let u=a$3(e.serviceError,{kind:"room",id:this.id});u&&this.onServiceError&&f(()=>{if(!this.closed)return this.onServiceError?.(u)},void 0);return}if(e.type==="peer-message"){let d=this.connections.get(e.connectionId),l=$(e);if(d&&l&&d.accepts(l)){let u=fe(e.payloadBase64),s=b$1(u);s?s.capability===`room:${this.id}`&&s.kind==="raw"&&d.receive(s.value):d.receive(u);}return}if(e.type!=="connection-state")return;let t=e.snapshot,o=$(e);if(typeof t.connectionId!="string"||!o)return;let n=this.connections.get(t.connectionId);if(typeof t.state=="string"&&["closed","failed"].includes(t.state.toLowerCase())){n?.accepts(o)&&(n.close(),this.connections.delete(t.connectionId));return}if(n){t.routable===true&&n.replaceGeneration(o);return}let i=typeof t.remoteNodeId=="string"?t.remoteNodeId:null;if(t.routable!==true||!i)return;let c=new S(t.connectionId,i,this.host,o,`room:${this.id}`);this.connections.set(c.id,c);for(let d of this.listeners)f(d,c);}async close(){if(this.closed)return this.host.close();this.closed=true;for(let e of this.connections.values())e.close();this.connections.clear(),this.listeners.clear(),await this.host.close();}};function he(r){let e;if(r instanceof Uint8Array)e=Buffer.from(r);else if(r instanceof ArrayBuffer)e=Buffer.from(r);else if(typeof r=="string")e=Buffer.from(r,"utf8");else {let t=JSON.stringify(r);if(t===void 0)throw new TypeError("[OpenRTC] Message must be a string, bytes, or JSON value.");e=Buffer.from(t,"utf8");}if(e.length>C)throw new RangeError("[OpenRTC] Message exceeds the Node host payload limit.");return e}function fe(r){let e=Buffer.from(r,"base64");if(e.length>C)throw new Error("[OpenRTC] Node host returned an oversized application payload.");try{let t=new TextDecoder("utf-8",{fatal:!0}).decode(e);try{return JSON.parse(t)}catch{return t}}catch{return new Uint8Array(e)}}var b=class{constructor(e){this.listeners=new Set;this.roomPromise=null;this.roomId=null;this.closed=false;this.closing=null;this.options=pe(e);}onConnection(e){if(this.closed)throw new Error("[OpenRTC] ServiceNode is closed.");return this.listeners.add(e),()=>this.listeners.delete(e)}listen(e){return this.closed?Promise.reject(new Error("[OpenRTC] ServiceNode is closed.")):(e=m(e,"roomId"),this.roomId&&this.roomId!==e?Promise.reject(new Error("[OpenRTC] A Node ServiceNode owns exactly one room.")):this.roomPromise?this.roomPromise:(this.roomId=e,this.roomPromise=this.open(e),this.roomPromise))}close(){return this.closing??(this.closing=this.stop())}async stop(){this.closed=true,await(await this.roomPromise?.catch(()=>null))?.close(),this.listeners.clear();}async open(e){let t,o=new I(this.options,e,n=>t?.project(n));t=new T(e,o,this.options.onServiceError);try{return await o.start(),t.onConnection(n=>{for(let a of this.listeners)f(a,{room:t,connection:n});}),t}catch(n){throw await o.close().catch(()=>{}),this.roomPromise=null,this.roomId=null,n}}};async function me(r){let e=await J(r);return X(e)}function ke(r,e){let t=c(e,"openrtc/node"),o=new a;return i(r,{platform:"native",broadcastHostFactory:async n=>{let{NativeManagedBroadcastHost:a}=await import('./NativeManagedBroadcastHost-WCQ6TPUU.js');return new a(t,n)},offlineSupport:()=>t.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async n=>{let a=await t.invoke("start_iroh_node");return t.invoke("openrtc_create_offline_enrollment_request",{trustDomain:n.trustDomain,deviceId:n.deviceId,endpointId:a,enrollmentNonce:crypto.randomUUID(),requestedRoles:n.requestedRoles})},close:()=>o.close(),deviceKeyProvider:a$1(t),deviceIdProvider:async()=>{let n=await t.invoke("get_rtc_local_device_info");return String(n?.deviceId??"")},runtimeFactory:async n=>{let{createIpcClient:a}=await import('./ipcFactory-DOEPQPOP.js');return a(n,t,o)}})}export{ke as OpenRTC,b as ServiceNode,me as inspectNodeHost};
@@ -1,2 +1,2 @@
1
- var G=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,tt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_bistream_free(e,0);}get applicationCryptoWrapped(){return t.bistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let e=t.bistream_cancelSend(this.__wbg_ptr);return p(e)}get endpoint_id(){let e,n;try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.bistream_endpoint_id(o,this.__wbg_ptr);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);return e=_,n=r,F(_,r)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(e,n,1);}}finishSend(){let e=t.bistream_finishSend(this.__wbg_ptr);return p(e)}get recv(){let e=t.bistream_recv(this.__wbg_ptr);return p(e)}get send(){let e=t.bistream_send(this.__wbg_ptr);return p(e)}get transport_stable_id(){try{let _=t.__wbindgen_add_to_stack_pointer(-16);t.bistream_transport_stable_id(_,this.__wbg_ptr);var e=b().getInt32(_+0,!0),n=b().getFloat64(_+8,!0);return e===0?void 0:n}finally{t.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);var $=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Rt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_intounderlyingbytesource_free(e,0);}get autoAllocateChunkSize(){return t.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}cancel(){let e=this.__destroy_into_raw();t.intounderlyingbytesource_cancel(e);}pull(e){let n=t.intounderlyingbytesource_pull(this.__wbg_ptr,u(e));return p(n)}start(e){t.intounderlyingbytesource_start(this.__wbg_ptr,u(e));}get type(){let e=t.intounderlyingbytesource_type(this.__wbg_ptr);return ht[e]}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var L=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,et.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_intounderlyingsink_free(e,0);}abort(e){let n=this.__destroy_into_raw(),_=t.intounderlyingsink_abort(n,u(e));return p(_)}close(){let e=this.__destroy_into_raw(),n=t.intounderlyingsink_close(e);return p(n)}write(e){let n=t.intounderlyingsink_write(this.__wbg_ptr,u(e));return p(n)}};Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);var U=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,nt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,nt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_intounderlyingsource_free(e,0);}cancel(){let e=this.__destroy_into_raw();t.intounderlyingsource_cancel(e);}pull(e){let n=t.intounderlyingsource_pull(this.__wbg_ptr,u(e));return p(n)}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var X=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,_t.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,_t.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_peerunistream_free(e,0);}get applicationCryptoWrapped(){return t.peerunistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let e=t.peerunistream_cancelSend(this.__wbg_ptr);return p(e)}finishSend(){let e=t.peerunistream_finishSend(this.__wbg_ptr);return p(e)}get writable(){let e=t.peerunistream_writable(this.__wbg_ptr);return p(e)}};Symbol.dispose&&(X.prototype[Symbol.dispose]=X.prototype.free);var K=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,rt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_wasmclient_free(e,0);}__acceptOpenRtcBroadcastObject(e,n,_){try{let a=t.__wbindgen_add_to_stack_pointer(-16),w=c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(n,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=k(_,t.__wbindgen_export),y=i;t.wasmclient___acceptOpenRtcBroadcastObject(a,this.__wbg_ptr,w,l,f,m,h,y);var r=b().getInt32(a+0,!0),o=b().getInt32(a+4,!0),s=b().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__acknowledgePersistentIrohOutbox(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient___acknowledgePersistentIrohOutbox(this.__wbg_ptr,n,_);return p(r)}__advancePreferredIrohCarrier(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient___advancePreferredIrohCarrier(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__applyIrohCarrierPolicy(){let e=t.wasmclient___applyIrohCarrierPolicy(this.__wbg_ptr);return p(e)}__attachMoqCarrier(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(r,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=t.wasmclient___attachMoqCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__attachWebRtcCarrier(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(r,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=t.wasmclient___attachWebRtcCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__beginMoqCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___beginMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__beginOpenRtcBroadcastPublication(e,n,_,r,o,s,a,w,l){try{let R=t.__wbindgen_add_to_stack_pointer(-16),A=c(e,t.__wbindgen_export,t.__wbindgen_export2),S=i,P=c(n,t.__wbindgen_export,t.__wbindgen_export2),M=i;var f=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i;let O=c(r,t.__wbindgen_export,t.__wbindgen_export2),T=i,N=c(o,t.__wbindgen_export,t.__wbindgen_export2),Q=i;t.wasmclient___beginOpenRtcBroadcastPublication(R,this.__wbg_ptr,A,S,P,M,f,m,O,T,N,Q,s,x(a)?Number.MAX_SAFE_INTEGER:a>>>0,x(w)?Number.MAX_SAFE_INTEGER:w>>>0,x(l)?16777215:l);var h=b().getInt32(R+0,!0),y=b().getInt32(R+4,!0),v=b().getInt32(R+8,!0);if(v)throw p(y);return p(h)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__beginOpenRtcMediaPublication(e,n,_,r,o,s,a){try{let y=t.__wbindgen_add_to_stack_pointer(-16);var w=x(e)?0:c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i;let v=c(n,t.__wbindgen_export,t.__wbindgen_export2),R=i,A=c(_,t.__wbindgen_export,t.__wbindgen_export2),S=i;t.wasmclient___beginOpenRtcMediaPublication(y,this.__wbg_ptr,w,l,v,R,A,S,r,x(o)?Number.MAX_SAFE_INTEGER:o>>>0,x(s)?Number.MAX_SAFE_INTEGER:s>>>0,x(a)?16777215:a);var f=b().getInt32(y+0,!0),m=b().getInt32(y+4,!0),h=b().getInt32(y+8,!0);if(h)throw p(m);return p(f)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__beginPreferredIrohCarrier(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=t.wasmclient___beginPreferredIrohCarrier(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__beginWebRtcCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___beginWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__closeOpenRtcBroadcast(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___closeOpenRtcBroadcast(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__configureIrohRoutePolicy(e,n,_){var r=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),o=i;let s=t.wasmclient___configureIrohRoutePolicy(this.__wbg_ptr,e,r,o,u(_));return p(s)}__configureMoqCarrier(e,n){var _=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),r=i;let o=t.wasmclient___configureMoqCarrier(this.__wbg_ptr,e,_,r);return p(o)}__configureWebRtcCarrier(e,n){let _=t.wasmclient___configureWebRtcCarrier(this.__wbg_ptr,e,n);return p(_)}__createOpenRtcBroadcastPublisherSigner(){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmclient___createOpenRtcBroadcastPublisherSigner(r,this.__wbg_ptr);var e=b().getInt32(r+0,!0),n=b().getInt32(r+4,!0),_=b().getInt32(r+8,!0);if(_)throw p(n);return p(e)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__createPersistentIrohNamespace(e,n){let _=t.wasmclient___createPersistentIrohNamespace(this.__wbg_ptr,e,n);return p(_)}__decodeOpenRtcMediaChunk(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmclient___decodeOpenRtcMediaChunk(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__decodeOpenRtcMediaControl(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmclient___decodeOpenRtcMediaControl(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__deletePersistentIrohPrefix(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient___deletePersistentIrohPrefix(this.__wbg_ptr,_,r,o,s);return p(a)}__encodeOpenRtcMediaSample(e,n,_,r,o,s){try{let h=t.__wbindgen_add_to_stack_pointer(-16),y=c(e,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(s,t.__wbindgen_export),A=i;t.wasmclient___encodeOpenRtcMediaSample(h,this.__wbg_ptr,y,v,n,_,r,o,R,A);var a=b().getInt32(h+0,!0),w=b().getInt32(h+4,!0),l=b().getInt32(h+8,!0),f=b().getInt32(h+12,!0);if(f)throw p(l);var m=C(a,w).slice();return t.__wbindgen_export4(a,w*1,1),m}finally{t.__wbindgen_add_to_stack_pointer(16);}}__flushPersistentIrohProtocols(){let e=t.wasmclient___flushPersistentIrohProtocols(this.__wbg_ptr);return p(e)}__forgetIrohCarrierPeer(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient___forgetIrohCarrierPeer(this.__wbg_ptr,n,_);return p(r)}__forgetManagedRoomGroup(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;t.wasmclient___forgetManagedRoomGroup(this.__wbg_ptr,n,_);}__getIrohCarrierReadiness(){let e=t.wasmclient___getIrohCarrierReadiness(this.__wbg_ptr);return p(e)}__getOpenRtcBroadcastStats(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient___getOpenRtcBroadcastStats(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__handleIrohCarrierControl(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=t.wasmclient___handleIrohCarrierControl(this.__wbg_ptr,r,o,s,a,u(_));return p(w)}__handleManagedRoomArtifactChunk(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___handleManagedRoomArtifactChunk(s,this.__wbg_ptr,a,w,u(n));var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__handleManagedRoomPreparePage(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___handleManagedRoomPreparePage(s,this.__wbg_ptr,a,w,u(n));var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__hydratePersistentIrohBlob(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient___hydratePersistentIrohBlob(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohAuthor(e){let n=k(e,t.__wbindgen_export),_=i,r=t.wasmclient___importPersistentIrohAuthor(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohNamespace(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=k(n,t.__wbindgen_export),w=i,l=t.wasmclient___importPersistentIrohNamespace(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__importPersistentIrohTicket(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient___importPersistentIrohTicket(this.__wbg_ptr,r,o,n,_);return p(s)}__initManagedRoomGroup(e,n,_,r){try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(n,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(_,t.__wbindgen_export),A=i;var o=x(r)?0:k(r,t.__wbindgen_export),s=i;t.wasmclient___initManagedRoomGroup(f,this.__wbg_ptr,m,h,y,v,R,A,o,s);var a=b().getInt32(f+0,!0),w=b().getInt32(f+4,!0),l=b().getInt32(f+8,!0);if(l)throw p(w);return p(a)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__initPersistentIrohProtocols(e){let n=t.wasmclient___initPersistentIrohProtocols(this.__wbg_ptr,u(e));return p(n)}__moqCarrierFailed(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient___moqCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__moqCarrierPrepared(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___moqCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}__observeOpenRtcBroadcastAdapter(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient___observeOpenRtcBroadcastAdapter(o,this.__wbg_ptr,s,a,u(n));var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__openManagedRoomPayload(e,n,_,r,o,s,a,w){try{let v=t.__wbindgen_add_to_stack_pointer(-16),R=c(e,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=c(r,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=c(o,t.__wbindgen_export,t.__wbindgen_export2),O=i;var l=x(a)?0:c(a,t.__wbindgen_export,t.__wbindgen_export2),f=i;let T=k(w,t.__wbindgen_export),N=i;t.wasmclient___openManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,S,P,M,O,s,l,f,T,N);var m=b().getInt32(v+0,!0),h=b().getInt32(v+4,!0),y=b().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__openOpenRtcBroadcast(e,n,_,r,o,s){try{let h=t.__wbindgen_add_to_stack_pointer(-16),y=c(e,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(n,t.__wbindgen_export),A=i,S=c(_,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=k(r,t.__wbindgen_export),O=i;var a=x(o)?0:c(o,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___openOpenRtcBroadcast(h,this.__wbg_ptr,y,v,R,A,S,P,M,O,a,w,s);var l=b().getInt32(h+0,!0),f=b().getInt32(h+4,!0),m=b().getInt32(h+8,!0);if(m)throw p(f);return p(l)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcBroadcastPublication(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;t.wasmclient___pauseOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcMediaPublication(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___pauseOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__prepareOpenRtcBroadcastGrant(e,n,_){try{let a=t.__wbindgen_add_to_stack_pointer(-16),w=c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=k(n,t.__wbindgen_export),m=i;t.wasmclient___prepareOpenRtcBroadcastGrant(a,this.__wbg_ptr,w,l,f,m,_);var r=b().getInt32(a+0,!0),o=b().getInt32(a+4,!0),s=b().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__publishOpenRtcBroadcastSample(e,n,_,r,o,s,a){try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(n,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(a,t.__wbindgen_export),A=i;t.wasmclient___publishOpenRtcBroadcastSample(f,this.__wbg_ptr,m,h,y,v,_,r,o,s,R,A);var w=b().getInt32(f+0,!0),l=b().getInt32(f+4,!0);if(l)throw p(w)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__putPersistentIrohBytes(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=k(n,t.__wbindgen_export),a=i,w=k(_,t.__wbindgen_export),l=i,f=t.wasmclient___putPersistentIrohBytes(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__queryPersistentIrohNamespace(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient___queryPersistentIrohNamespace(this.__wbg_ptr,_,r,o,s);return p(a)}__reconcileIrohCarriersAfterNetworkChange(){let e=t.wasmclient___reconcileIrohCarriersAfterNetworkChange(this.__wbg_ptr);return p(e)}__reconcilePersistentIrohProtocols(){let e=t.wasmclient___reconcilePersistentIrohProtocols(this.__wbg_ptr);return p(e)}__releaseOpenRtcBroadcastPublisherSigner(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;return t.wasmclient___releaseOpenRtcBroadcastPublisherSigner(this.__wbg_ptr,n,_)!==0}__removePersistentIrohNamespace(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient___removePersistentIrohNamespace(this.__wbg_ptr,r,o,n,_);return p(s)}__requireScopePeerAdmission(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___requireScopePeerAdmission(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireIrohCarrierPeer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient___retireIrohCarrierPeer(this.__wbg_ptr,_,r,o,s);return p(a)}__retireMoqCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient___retireMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__retireOpenRtcBroadcastPublication(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;t.wasmclient___retireOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaPublication(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___retireOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaReceiver(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient___retireOpenRtcMediaReceiver(o,this.__wbg_ptr,s,a,n);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireWebRtcCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient___retireWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__sealManagedRoomPayload(e,n,_,r,o,s,a,w){try{let v=t.__wbindgen_add_to_stack_pointer(-16),R=c(e,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=c(r,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=c(o,t.__wbindgen_export,t.__wbindgen_export2),O=i;var l=x(a)?0:c(a,t.__wbindgen_export,t.__wbindgen_export2),f=i;let T=k(w,t.__wbindgen_export),N=i;t.wasmclient___sealManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,S,P,M,O,s,l,f,T,N);var m=b().getInt32(v+0,!0),h=b().getInt32(v+4,!0),y=b().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__setIrohCarrierActionHandler(e){t.wasmclient___setIrohCarrierActionHandler(this.__wbg_ptr,x(e)?0:u(e));}__setPersistentIrohHash(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=k(n,t.__wbindgen_export),w=i,l=c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=t.wasmclient___setPersistentIrohHash(this.__wbg_ptr,o,s,a,w,l,f,r);return p(m)}__sharePersistentIrohNamespace(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient___sharePersistentIrohNamespace(this.__wbg_ptr,_,r,n);return p(o)}__shutdownPersistentIrohProtocols(){let e=t.wasmclient___shutdownPersistentIrohProtocols(this.__wbg_ptr);return p(e)}__takeOpenRtcBroadcastActions(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___takeOpenRtcBroadcastActions(s,this.__wbg_ptr,a,w,n);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__updateScopePeerAdmission(e,n,_,r){try{let a=t.__wbindgen_add_to_stack_pointer(-16),w=c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(r,t.__wbindgen_export,t.__wbindgen_export2),m=i;t.wasmclient___updateScopePeerAdmission(a,this.__wbg_ptr,w,l,n,_,f,m);var o=b().getInt32(a+0,!0),s=b().getInt32(a+4,!0);if(s)throw p(o)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__webRtcCarrierFailed(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient___webRtcCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__webRtcCarrierPrepared(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___webRtcCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}acceptSparseFanoutMessage(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=k(_,t.__wbindgen_export),l=i,f=t.wasmclient_acceptSparseFanoutMessage(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}acknowledge_session_token_response(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),f=i;let m=t.wasmclient_acknowledge_session_token_response(this.__wbg_ptr,o,s,a,w,_,l,f);return p(m)}add_peer_scope(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_add_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}bind_connection_device_id(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_bind_connection_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}bind_node_device_id(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_bind_node_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}clearConnectionApplicationCryptoKey(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;t.wasmclient_clearConnectionApplicationCryptoKey(this.__wbg_ptr,n,_);}clearIdentityCredential(){t.wasmclient_clearIdentityCredential(this.__wbg_ptr);}clear_session_tokens(){t.wasmclient_clear_session_tokens(this.__wbg_ptr);}close_ticket_mesh(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_close_ticket_mesh(this.__wbg_ptr,n,_);return p(r)}confirm_reciprocal_admission(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;var y=x(s)?0:c(s,t.__wbindgen_export,t.__wbindgen_export2),v=i;let R=t.wasmclient_confirm_reciprocal_admission(this.__wbg_ptr,a,w,n,l,f,m,h,o,y,v);return p(R)}connect_device(e,n,_){var r=x(e)?0:c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i;let s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=t.wasmclient_connect_device(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}connect_known_device_with_token(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=t.wasmclient_connect_known_device_with_token(this.__wbg_ptr,a,w,l,f,m,h,r,!x(o),x(o)?BigInt(0):o,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(y)}connect_ticket_invite(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_connect_ticket_invite(this.__wbg_ptr,n,_);return p(r)}connectionApplicationCryptoReady(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;return t.wasmclient_connectionApplicationCryptoReady(this.__wbg_ptr,_,r,n)!==0}connection_state(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_connection_state(this.__wbg_ptr,n,_);return p(r)}connection_states(){let e=t.wasmclient_connection_states(this.__wbg_ptr);return p(e)}createPeerDatagramPolicy(){let e=t.wasmclient_createPeerDatagramPolicy(this.__wbg_ptr);return V.__wrap(e)}create_room(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(r,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=c(o,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=t.wasmclient_create_room(this.__wbg_ptr,a,w,l,f,m,h,y,v,R,A,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(S)}create_session(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_create_session(this.__wbg_ptr,n,_);return p(r)}decodeIncomingChannelEnvelope(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmclient_decodeIncomingChannelEnvelope(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}delete_device(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_delete_device(this.__wbg_ptr,_,r,o,s);return p(a)}devices_with_status(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_devices_with_status(this.__wbg_ptr,n,_);return p(r)}disconnect(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_disconnect(this.__wbg_ptr,n,_);return p(r)}disconnect_device(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient_disconnect_device(this.__wbg_ptr,_,r,o,s);return p(a)}disconnect_transient(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_disconnect_transient(this.__wbg_ptr,n,_);return p(r)}endpoint_id_from_ticket(e){let n,_;try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_endpoint_id_from_ticket(f,this.__wbg_ptr,m,h);var r=b().getInt32(f+0,!0),o=b().getInt32(f+4,!0),s=b().getInt32(f+8,!0),a=b().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,F(w,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(n,_,1);}}endpoint_ticket(){let e=t.wasmclient_endpoint_ticket(this.__wbg_ptr);return p(e)}endpoint_ticket_with_token(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_endpoint_ticket_with_token(this.__wbg_ptr,_,r,n);return p(o)}ensureConnectionApplicationCrypto(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=t.wasmclient_ensureConnectionApplicationCrypto(this.__wbg_ptr,o,s,a,w,_,u(r));return p(l)}finalizeSparseFanoutMessage(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_finalizeSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}force_reconnect_snapshot(){t.wasmclient_force_reconnect_snapshot(this.__wbg_ptr);}get_members(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient_get_members(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}handleConnectionApplicationCryptoHandshake(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;var f=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),m=i;let h=k(o,t.__wbindgen_export),y=i,v=t.wasmclient_handleConnectionApplicationCryptoHandshake(this.__wbg_ptr,s,a,w,l,!x(_),x(_)?BigInt(0):_,f,m,h,y);return p(v)}incoming_streams(){let e=t.wasmclient_incoming_streams(this.__wbg_ptr);return p(e)}initIrohWithTestRelay(e,n){var _=x(e)?0:k(e,t.__wbindgen_export),r=i,o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient_initIrohWithTestRelay(this.__wbg_ptr,_,r,o,s);return p(a)}init_iroh(e){var n=x(e)?0:k(e,t.__wbindgen_export),_=i;let r=t.wasmclient_init_iroh(this.__wbg_ptr,n,_);return p(r)}inspectIncomingStreamPrefix(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=k(e,t.__wbindgen_export),w=i;t.wasmclient_inspectIncomingStreamPrefix(s,this.__wbg_ptr,a,w,n);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}iroh_path_kind(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_iroh_path_kind(this.__wbg_ptr,n,_);return p(r)}iroh_secret_key(){let e=t.wasmclient_iroh_secret_key(this.__wbg_ptr);return p(e)}iroh_transport_rtt_ms(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_iroh_transport_rtt_ms(this.__wbg_ptr,n,_);return p(r)}is_auto_connect_excluded(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;return t.wasmclient_is_auto_connect_excluded(this.__wbg_ptr,n,_)!==0}is_connected(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_is_connected(this.__wbg_ptr,n,_);return p(r)}is_current_transport_stable_id(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_is_current_transport_stable_id(this.__wbg_ptr,_,r,n);return p(o)}is_remote_admitted(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_is_remote_admitted(this.__wbg_ptr,n,_);return p(r)}issue_ticket_invite(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient_issue_ticket_invite(this.__wbg_ptr,r,o,n,_);return p(s)}issue_ticket_mesh(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient_issue_ticket_mesh(this.__wbg_ptr,r,o,n,u(_));return p(s)}join_room(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=c(r,t.__wbindgen_export,t.__wbindgen_export2),y=i,v=c(o,t.__wbindgen_export,t.__wbindgen_export2),R=i,A=t.wasmclient_join_room(this.__wbg_ptr,s,a,w,l,f,m,h,y,v,R);return p(A)}join_ticket_mesh(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_join_ticket_mesh(this.__wbg_ptr,_,r,u(n));return p(o)}leave_room(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient_leave_room(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}list_managed_connections(){let e=t.wasmclient_list_managed_connections(this.__wbg_ptr);return p(e)}constructor(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient_new(o,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return this.__wbg_ptr=n,rt.register(this,this.__wbg_ptr,this),this}finally{t.__wbindgen_add_to_stack_pointer(16);}}node_addr(){let e=t.wasmclient_node_addr(this.__wbg_ptr);return p(e)}observe_known_device_endpoint(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_observe_known_device_endpoint(this.__wbg_ptr,_,r,o,s);return p(a)}openConnectionApplicationPayload(e,n,_){try{let l=t.__wbindgen_add_to_stack_pointer(-16),f=c(e,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=k(_,t.__wbindgen_export),y=i;t.wasmclient_openConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=b().getInt32(l+0,!0),o=b().getInt32(l+4,!0),s=b().getInt32(l+8,!0),a=b().getInt32(l+12,!0);if(a)throw p(s);var w=C(r,o).slice();return t.__wbindgen_export4(r,o*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16);}}open_bi(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_open_bi(this.__wbg_ptr,n,_);return p(r)}open_native_main_control_bi(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_open_native_main_control_bi(this.__wbg_ptr,n,_);return p(r)}open_peer_bi(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_bi(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_explicit_file_sender(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_bi_explicit_file_sender(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_transport_only(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_bi_transport_only(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_uni(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_uni(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_uni(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_open_uni(this.__wbg_ptr,n,_);return p(r)}peerDatagramMaxSize(){return t.wasmclient_peerDatagramMaxSize(this.__wbg_ptr)>>>0}peer_scopes(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_peer_scopes(this.__wbg_ptr,n,_);return p(r)}peer_session(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_peer_session(this.__wbg_ptr,n,_);return p(r)}peer_sessions(){let e=t.wasmclient_peer_sessions(this.__wbg_ptr);return p(e)}peer_snapshot(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_peer_snapshot(this.__wbg_ptr,n,_);return p(r)}prepareSparseFanoutMessage(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_prepareSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}prepare_reciprocal_admission(e,n,_,r,o,s,a,w){let l=c(e,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(r,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=c(o,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=c(s,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=c(a,t.__wbindgen_export,t.__wbindgen_export2),O=i,T=c(w,t.__wbindgen_export,t.__wbindgen_export2),N=i,Q=t.wasmclient_prepare_reciprocal_admission(this.__wbg_ptr,l,f,n,m,h,y,v,R,A,S,P,M,O,T,N);return p(Q)}present_session_token(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;let y=t.wasmclient_present_session_token(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}protectConnectionApplicationPayload(e,n,_){try{let l=t.__wbindgen_add_to_stack_pointer(-16),f=c(e,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=k(_,t.__wbindgen_export),y=i;t.wasmclient_protectConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=b().getInt32(l+0,!0),o=b().getInt32(l+4,!0),s=b().getInt32(l+8,!0),a=b().getInt32(l+12,!0);if(a)throw p(s);var w=C(r,o).slice();return t.__wbindgen_export4(r,o*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16);}}rankRoutes(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=it(e,t.__wbindgen_export),w=i,l=it(n,t.__wbindgen_export),f=i;t.wasmclient_rankRoutes(s,this.__wbg_ptr,a,w,l,f);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=Ft(_,r).slice();return t.__wbindgen_export4(_,r*4,4),o}finally{t.__wbindgen_add_to_stack_pointer(16);}}receivePeerDatagram(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_receivePeerDatagram(this.__wbg_ptr,n,_);return p(r)}receive_ticket_mesh_frame(e,n,_){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_receive_ticket_mesh_frame(s,this.__wbg_ptr,a,w,l,f,m,h);var r=b().getInt32(s+0,!0),o=b().getInt32(s+4,!0);if(o)throw p(r)}finally{t.__wbindgen_add_to_stack_pointer(16);}}recordSparseFanoutForwardQueueDrop(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_recordSparseFanoutForwardQueueDrop(this.__wbg_ptr,_,r,n);return p(o)}register_session_token(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient_register_session_token(this.__wbg_ptr,r,o,s,a,_);}register_token_until(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient_register_token_until(this.__wbg_ptr,o,s,a,w,_,r);}reject_connection_admission(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_reject_connection_admission(this.__wbg_ptr,_,r,o,s);return p(a)}release_peer_scope(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient_release_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}report_managed_connection_settled(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i;let m=t.wasmclient_report_managed_connection_settled(this.__wbg_ptr,a,w,n,l,f,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(m)}report_transport_status(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i;var m=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i;let y=t.wasmclient_report_transport_status(this.__wbg_ptr,a,w,l,f,m,h,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(y)}resolve_peer_connection_records(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_resolve_peer_connection_records(this.__wbg_ptr,n,_);return p(r)}revoke_session_token(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient_revoke_session_token(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}revoke_tokens_by_scope(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_revoke_tokens_by_scope(this.__wbg_ptr,n,_);return p(r)}runtime_policy(){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmclient_runtime_policy(r,this.__wbg_ptr);var e=b().getInt32(r+0,!0),n=b().getInt32(r+4,!0),_=b().getInt32(r+8,!0);if(_)throw p(n);return p(e)}finally{t.__wbindgen_add_to_stack_pointer(16);}}same_peer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_same_peer(this.__wbg_ptr,_,r,o,s);return p(a)}search_devices(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_search_devices(this.__wbg_ptr,n,_);return p(r)}sendPeerDatagram(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=k(n,t.__wbindgen_export),a=i,w=t.wasmclient_sendPeerDatagram(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}send_message(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;let y=t.wasmclient_send_message(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}send_native_main_control_frame(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_send_native_main_control_frame(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_send_peer(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer_application_frame(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=k(n,t.__wbindgen_export),a=i,w=t.wasmclient_send_peer_application_frame(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}setConnectionApplicationCryptoKey(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_setConnectionApplicationCryptoKey(this.__wbg_ptr,_,r,o,s);return p(a)}setConnectionApplicationCryptoRequired(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient_setConnectionApplicationCryptoRequired(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}setIdentityCredential(e){var n=x(e)?0:c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;t.wasmclient_setIdentityCredential(this.__wbg_ptr,n,_);}setRelay(e){let n=t.wasmclient_setRelay(this.__wbg_ptr,e);return p(n)}set_auto_connect_excluded(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_set_auto_connect_excluded(this.__wbg_ptr,_,r,n);return p(o)}set_offline(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_set_offline(this.__wbg_ptr,n,_);return p(r)}sparseFanoutDiagnostics(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_sparseFanoutDiagnostics(this.__wbg_ptr,n,_);return p(r)}start_auto_connect(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;t.wasmclient_start_auto_connect(o,this.__wbg_ptr,s,a,w,l);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}start_presence_loop(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i;var m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_start_presence_loop(this.__wbg_ptr,o,s,a,w,l,f,m,h);}stop_auth_scoped_activity(){t.wasmclient_stop_auth_scoped_activity(this.__wbg_ptr);}stop_auto_connect(){t.wasmclient_stop_auto_connect(this.__wbg_ptr);}stop_presence_loop(){t.wasmclient_stop_presence_loop(this.__wbg_ptr);}submit_browser_desired_peers(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient_submit_browser_desired_peers(s,this.__wbg_ptr,e,a,w);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{t.__wbindgen_add_to_stack_pointer(16);}}submit_browser_desired_peers_with_sparse_fanout(e,n,_,r,o,s){let a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=x(o)?0:c(o,t.__wbindgen_export,t.__wbindgen_export2),v=i;let R=t.wasmclient_submit_browser_desired_peers_with_sparse_fanout(this.__wbg_ptr,e,a,w,l,f,m,h,y,v,x(s)?16777215:s?1:0);return p(R)}ticket_mesh_issuer_node(e){let n,_;try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_ticket_mesh_issuer_node(f,this.__wbg_ptr,m,h);var r=b().getInt32(f+0,!0),o=b().getInt32(f+4,!0),s=b().getInt32(f+8,!0),a=b().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,F(w,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(n,_,1);}}ticket_mesh_peers(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_ticket_mesh_peers(this.__wbg_ptr,n,_);return p(r)}update_device(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;var f=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=x(o)?0:c(o,t.__wbindgen_export,t.__wbindgen_export2),y=i;let v=t.wasmclient_update_device(this.__wbg_ptr,s,a,w,l,f,m,x(r)?0:u(r),h,y);return p(v)}update_presence(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i;var h=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),y=i;let v=t.wasmclient_update_presence(this.__wbg_ptr,s,a,w,l,f,m,h,y,!x(o),x(o)?BigInt(0):o);return p(v)}update_session(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_update_session(this.__wbg_ptr,_,r,o,s);return p(a)}validate_connection_token(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i;var w=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i;let f=t.wasmclient_validate_connection_token(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}validate_session_token(e){let n,_;try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_validate_session_token(f,this.__wbg_ptr,m,h);var r=b().getInt32(f+0,!0),o=b().getInt32(f+4,!0),s=b().getInt32(f+8,!0),a=b().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,F(w,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(n,_,1);}}wait_for_peer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_wait_for_peer(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wait_for_settled_scope(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_wait_for_settled_scope(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wake_browser_auto_connect(){return t.wasmclient_wake_browser_auto_connect(this.__wbg_ptr)!==0}};Symbol.dispose&&(K.prototype[Symbol.dispose]=K.prototype.free);var V=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,ot.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ot.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_wasmpeerdatagrampolicy_free(e,0);}close(){t.wasmpeerdatagrampolicy_close(this.__wbg_ptr);}closeIncoming(){t.wasmpeerdatagrampolicy_closeIncoming(this.__wbg_ptr);}closeOutgoing(){t.wasmpeerdatagrampolicy_closeOutgoing(this.__wbg_ptr);}getStats(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_getStats(o,this.__wbg_ptr,e);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}popIncoming(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_popIncoming(r,this.__wbg_ptr,e);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);let o;return n!==0&&(o=C(n,_).slice(),t.__wbindgen_export4(n,_*1,1)),o}finally{t.__wbindgen_add_to_stack_pointer(16);}}popOutgoing(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_popOutgoing(o,this.__wbg_ptr,e);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}pushIncoming(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmpeerdatagrampolicy_pushIncoming(o,this.__wbg_ptr,s,a,n);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}pushOutgoing(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=k(e,t.__wbindgen_export),w=i;t.wasmpeerdatagrampolicy_pushOutgoing(s,this.__wbg_ptr,a,w,n);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{t.__wbindgen_add_to_stack_pointer(16);}}recordExpiredOutgoing(){t.wasmpeerdatagrampolicy_recordExpiredOutgoing(this.__wbg_ptr);}recordSendFailure(){t.wasmpeerdatagrampolicy_recordSendFailure(this.__wbg_ptr);}recordSent(e){t.wasmpeerdatagrampolicy_recordSent(this.__wbg_ptr,e);}setIncomingMaxAge(e,n){t.wasmpeerdatagrampolicy_setIncomingMaxAge(this.__wbg_ptr,x(e)?Number.MAX_SAFE_INTEGER:e>>>0,n);}setIncomingMaxBufferedDatagrams(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_setIncomingMaxBufferedDatagrams(r,this.__wbg_ptr,e);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}setOutgoingMaxAge(e){t.wasmpeerdatagrampolicy_setOutgoingMaxAge(this.__wbg_ptr,x(e)?Number.MAX_SAFE_INTEGER:e>>>0);}setOutgoingMaxBufferedDatagrams(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_setOutgoingMaxBufferedDatagrams(r,this.__wbg_ptr,e);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);function Bt(){t.start();}function st(){return {__proto__:null,"./openrtc_bg.js":{__proto__:null,__wbg_Error_9dc85fe1bc224456:function(e,n){let _=Error(F(e,n));return u(_)},__wbg_Number_4779d427bae39753:function(e){return Number(g(e))},__wbg_String_8564e559799eccda:function(e,n){let _=String(g(n)),r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg___wbindgen_bigint_get_as_i64_8ea6736501f396b6:function(e,n){let _=g(n),r=typeof _=="bigint"?_:void 0;b().setBigInt64(e+8,x(r)?BigInt(0):r,true),b().setInt32(e+0,!x(r),true);},__wbg___wbindgen_boolean_get_b131b2f36d6b2f55:function(e){let n=g(e),_=typeof n=="boolean"?n:void 0;return x(_)?16777215:_?1:0},__wbg___wbindgen_debug_string_56c147eb1a51f0c4:function(e,n){let _=Z(g(n)),r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg___wbindgen_in_ce8569b2fc6f5088:function(e,n){return g(e)in g(n)},__wbg___wbindgen_is_bigint_df272c65456269c2:function(e){return typeof g(e)=="bigint"},__wbg___wbindgen_is_function_147961669f068cd4:function(e){return typeof g(e)=="function"},__wbg___wbindgen_is_null_ced4761460071341:function(e){return g(e)===null},__wbg___wbindgen_is_object_3a2c414391dbf751:function(e){let n=g(e);return typeof n=="object"&&n!==null},__wbg___wbindgen_is_string_6541b0f6ecd4e8e5:function(e){return typeof g(e)=="string"},__wbg___wbindgen_is_undefined_4410e3c20a99fa97:function(e){return g(e)===void 0},__wbg___wbindgen_jsval_eq_174c93ec61bab0c5:function(e,n){return g(e)===g(n)},__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c:function(e,n){return g(e)==g(n)},__wbg___wbindgen_number_get_588ed6b97f0d7e14:function(e,n){let _=g(n),r=typeof _=="number"?_:void 0;b().setFloat64(e+8,x(r)?0:r,true),b().setInt32(e+0,!x(r),true);},__wbg___wbindgen_string_get_fa2687d531ed17a5:function(e,n){let _=g(n),r=typeof _=="string"?_:void 0;var o=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),s=i;b().setInt32(e+4,s,true),b().setInt32(e+0,o,true);},__wbg___wbindgen_throw_bbadd78c1bac3a77:function(e,n){throw new Error(F(e,n))},__wbg__wbg_cb_unref_c2301a3c9b78104b:function(e){g(e)._wbg_cb_unref();},__wbg_abort_56c00f462c9261d9:function(e,n){g(e).abort(g(n));},__wbg_abort_f2416f4a9852003e:function(e){g(e).abort();},__wbg_addEventListener_b635263c509aa7de:function(){return I(function(e,n,_,r){g(e).addEventListener(F(n,_),g(r));},arguments)},__wbg_append_c5a0c94a6a73b22e:function(){return I(function(e,n,_,r,o){g(e).append(F(n,_),F(r,o));},arguments)},__wbg_apply_5d99f956e2dda74d:function(){return I(function(e,n,_){let r=g(e).apply(g(n),g(_));return u(r)},arguments)},__wbg_arrayBuffer_cc7704fa158b907a:function(){return I(function(e){let n=g(e).arrayBuffer();return u(n)},arguments)},__wbg_bistream_new:function(e){let n=G.__wrap(e);return u(n)},__wbg_body_442a47f02322d7b0:function(e){let n=g(e).body;return x(n)?0:u(n)},__wbg_buffer_8524b3453cde4918:function(e){let n=g(e).buffer;return u(n)},__wbg_bufferedAmount_c1581bbb06f4f36c:function(e){return g(e).bufferedAmount},__wbg_byobRequest_cc72d210de793e64:function(e){let n=g(e).byobRequest;return x(n)?0:u(n)},__wbg_byteLength_96807b1d9ab24a4c:function(e){return g(e).byteLength},__wbg_byteOffset_a9c7002428843c41:function(e){return g(e).byteOffset},__wbg_call_91f00ddc43e01490:function(){return I(function(e,n){let _=g(e).call(g(n));return u(_)},arguments)},__wbg_call_ec09a4cf93377d3a:function(){return I(function(e,n,_){let r=g(e).call(g(n),g(_));return u(r)},arguments)},__wbg_cancel_f3a197b26dc88b39:function(e){let n=g(e).cancel();return u(n)},__wbg_catch_66060324c27be6f7:function(e,n){let _=g(e).catch(g(n));return u(_)},__wbg_clearTimeout_113b1cde814ec762:function(e){let n=clearTimeout(p(e));return u(n)},__wbg_clearTimeout_333bba87532ab9d3:function(e){let n=clearTimeout(p(e));return u(n)},__wbg_clearTimeout_47a40e3be01ed7a3:function(){return I(function(e,n){g(e).clearTimeout(p(n));},arguments)},__wbg_close_296263cfe1bb2999:function(){return I(function(e){g(e).close();},arguments)},__wbg_close_388d99468213b286:function(){return I(function(e){g(e).close();},arguments)},__wbg_close_4857e22d08b71356:function(){return I(function(e){g(e).close();},arguments)},__wbg_close_f3365df7ba1b74d3:function(e){g(e).close();},__wbg_code_1cda2855fcd9b009:function(e){return g(e).code},__wbg_code_70beb7b22374d55e:function(e){return g(e).code},__wbg_crypto_38df2bab126b63dc:function(e){let n=g(e).crypto;return u(n)},__wbg_data_8a04443c1e5a8cd3:function(e){let n=g(e).data;return u(n)},__wbg_debug_de823612d4d12f74:function(e){console.debug(g(e));},__wbg_dispatchEvent_cc62a6a43d28b01c:function(){return I(function(e,n){return g(e).dispatchEvent(g(n))},arguments)},__wbg_done_6a8439e544ec6206:function(e){return g(e).done},__wbg_enqueue_bbeb09ba0b140f76:function(){return I(function(e,n){g(e).enqueue(g(n));},arguments)},__wbg_entries_4e00eefd3fd54cf1:function(e){let n=g(e).entries();return u(n)},__wbg_entries_5a6a7e7e0df09fe5:function(e){let n=Object.entries(g(e));return u(n)},__wbg_error_6651fee1c71e5da9:function(e){console.error(g(e));},__wbg_error_9a99766f65a03031:function(e,n){console.error(g(e),g(n));},__wbg_error_a6fa202b58aa1cd3:function(e,n){let _,r;try{_=e,r=n,console.error(F(e,n));}finally{t.__wbindgen_export4(_,r,1);}},__wbg_fetch_074561c3e313c86f:function(e){let n=fetch(g(e));return u(n)},__wbg_fetch_22858a12fcf93152:function(e,n){let _=g(e).fetch(g(n));return u(_)},__wbg_from_8a57180716c586ee:function(e){let n=Array.from(g(e));return u(n)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return I(function(e,n){g(e).getRandomValues(g(n));},arguments)},__wbg_getRandomValues_cc7f052a444bb2ce:function(){return I(function(e,n){globalThis.crypto.getRandomValues(C(e,n));},arguments)},__wbg_getReader_9facd4f899beac89:function(){return I(function(e){let n=g(e).getReader();return u(n)},arguments)},__wbg_get_44e98e27bda25b5b:function(){return I(function(e,n){let _=Reflect.get(g(e),g(n));return u(_)},arguments)},__wbg_get_4b90d6d8c5deb5d5:function(e,n){let _=g(e)[n>>>0];return u(_)},__wbg_get_52a8a619f7b88df6:function(){return I(function(e,n){let _=Reflect.get(g(e),g(n));return u(_)},arguments)},__wbg_get_done_c21b9933fc9a9e9c:function(e){let n=g(e).done;return x(n)?16777215:n?1:0},__wbg_get_unchecked_46e778e3cec74b5e:function(e,n){let _=g(e)[n>>>0];return u(_)},__wbg_get_value_ad568c7d3db9073f:function(e){let n=g(e).value;return u(n)},__wbg_get_with_ref_key_6412cf3094599694:function(e,n){let _=g(e)[g(n)];return u(_)},__wbg_has_14676d88c1340d2c:function(){return I(function(e,n){return Reflect.has(g(e),g(n))},arguments)},__wbg_headers_5b19cf40627ae54d:function(e){let n=g(e).headers;return u(n)},__wbg_info_a2b5f8a5dae8b26c:function(e){console.info(g(e));},__wbg_instanceof_ArrayBuffer_a581da923203f29f:function(e){let n;try{n=g(e)instanceof ArrayBuffer;}catch{n=false;}return n},__wbg_instanceof_Blob_5c4e145be35f9b1e:function(e){let n;try{n=g(e)instanceof Blob;}catch{n=false;}return n},__wbg_instanceof_Map_7f94c740225003e2:function(e){let n;try{n=g(e)instanceof Map;}catch{n=false;}return n},__wbg_instanceof_Promise_aa24ea31000d4ee6:function(e){let n;try{n=g(e)instanceof Promise;}catch{n=false;}return n},__wbg_instanceof_Response_36a65a969abaa7c6:function(e){let n;try{n=g(e)instanceof Response;}catch{n=false;}return n},__wbg_instanceof_Uint8Array_b6fe1ac89eba107e:function(e){let n;try{n=g(e)instanceof Uint8Array;}catch{n=false;}return n},__wbg_instanceof_Window_9e0fe7d3d1ff4342:function(e){let n;try{n=g(e)instanceof Window;}catch{n=false;}return n},__wbg_isArray_139f48e3c057ede8:function(e){return Array.isArray(g(e))},__wbg_isSafeInteger_c22ccb4af2201fe9:function(e){return Number.isSafeInteger(g(e))},__wbg_iterator_9b36cebf3be7b7cd:function(){return u(Symbol.iterator)},__wbg_length_68a9d5278d084f4f:function(e){return g(e).length},__wbg_length_fb04d16d7bdf6d4c:function(e){return g(e).length},__wbg_log_6614a4effdb4e983:function(e){console.log(g(e));},__wbg_maxRetransmits_dfa0382c31f8e2ca:function(e){let n=g(e).maxRetransmits;return x(n)?16777215:n},__wbg_message_12958526424a887b:function(e,n){let _=g(n).message,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_msCrypto_bd5a034af96bcba6:function(e){let n=g(e).msCrypto;return u(n)},__wbg_new_0b303268aa395a38:function(){let e=new Array;return u(e)},__wbg_new_189262ff31890c23:function(){return I(function(){let e=new Headers;return u(e)},arguments)},__wbg_new_20b778a4c5c691c3:function(){let e=new Object;return u(e)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return u(e)},__wbg_new_24739629d416f982:function(){return I(function(){let e=new AbortController;return u(e)},arguments)},__wbg_new_5fae30e6b23db8df:function(e,n){let _=new Error(F(e,n));return u(_)},__wbg_new_883c0db065f06efd:function(){return u(new Map)},__wbg_new_a3e5112401a82338:function(){return I(function(e,n){let _=new WebSocket(F(e,n));return u(_)},arguments)},__wbg_new_b06772b280cc6e52:function(e){let n=new Uint8Array(g(e));return u(n)},__wbg_new_from_slice_bb2d1778c0b87eb1:function(e,n){let _=new Uint8Array(C(e,n));return u(_)},__wbg_new_typed_90c3f6c29ba36d19:function(e,n){try{var _={a:e,b:n},r=(s,a)=>{let w=_.a;_.a=0;try{return xt(w,_.b,s,a)}finally{_.a=w;}};let o=new Promise(r);return u(o)}finally{_.a=0;}},__wbg_new_with_byte_offset_and_length_9e1e664fe1a5d385:function(e,n,_){let r=new Uint8Array(g(e),n>>>0,_>>>0);return u(r)},__wbg_new_with_event_init_dict_bd850674488710b1:function(){return I(function(e,n,_){let r=new CustomEvent(F(e,n),g(_));return u(r)},arguments)},__wbg_new_with_into_underlying_sink_2596343f9b6c8e58:function(e){let n=new WritableStream(L.__wrap(e));return u(n)},__wbg_new_with_into_underlying_source_fd904252f385f59c:function(e,n){let _=new ReadableStream(U.__wrap(e),p(n));return u(_)},__wbg_new_with_length_4b57a7a5dc67221c:function(e){let n=new Uint8Array(e>>>0);return u(n)},__wbg_new_with_str_and_init_df876572184fe639:function(){return I(function(e,n,_){let r=new Request(F(e,n),g(_));return u(r)},arguments)},__wbg_new_with_str_sequence_505a4829cc247e79:function(){return I(function(e,n,_){let r=new WebSocket(F(e,n),g(_));return u(r)},arguments)},__wbg_next_8cb028b6ba50743f:function(){return I(function(e){let n=g(e).next();return u(n)},arguments)},__wbg_next_cfd0b146c9538df8:function(e){let n=g(e).next;return u(n)},__wbg_node_84ea875411254db1:function(e){let n=g(e).node;return u(n)},__wbg_now_bce4dc999095ea77:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(e){return g(e).now()},__wbg_parse_a5c06e19bc1187fd:function(e,n){return Date.parse(F(e,n))},__wbg_peerunistream_new:function(e){let n=X.__wrap(e);return u(n)},__wbg_performance_3fcf6e32a7e1ed0a:function(e){let n=g(e).performance;return u(n)},__wbg_process_44c7a14e11e9f69e:function(e){let n=g(e).process;return u(n)},__wbg_protocol_28aaef5ea42981d6:function(e,n){let _=g(n).protocol,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_prototypesetcall_956c7493c68e29b4:function(e,n,_){Uint8Array.prototype.set.call(C(e,n),g(_));},__wbg_push_ceb8ef046afb2041:function(e,n){return g(e).push(g(n))},__wbg_queueMicrotask_4698f900840e3286:function(e){queueMicrotask(g(e));},__wbg_queueMicrotask_477a5533c7100338:function(e){let n=g(e).queueMicrotask;return u(n)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return I(function(e,n){g(e).randomFillSync(p(n));},arguments)},__wbg_read_8426c146431f2905:function(e){let n=g(e).read();return u(n)},__wbg_readyState_25243ad6ce649774:function(e){return g(e).readyState},__wbg_reason_4ec455bac79b33ce:function(e,n){let _=g(n).reason,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_releaseLock_188846ef719acb10:function(e){g(e).releaseLock();},__wbg_removeEventListener_016c1d24523b4730:function(){return I(function(e,n,_,r){g(e).removeEventListener(F(n,_),g(r));},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return I(function(){let e=module.require;return u(e)},arguments)},__wbg_resolve_0183de2e8c6b1d54:function(e){let n=Promise.resolve(g(e));return u(n)},__wbg_respond_3cdb4cf32683fd79:function(){return I(function(e,n){g(e).respond(n>>>0);},arguments)},__wbg_send_77521d09456dd693:function(){return I(function(e,n,_){g(e).send(C(n,_));},arguments)},__wbg_send_99d049cae69c53cc:function(){return I(function(e,n,_){g(e).send(C(n,_));},arguments)},__wbg_send_bac9d3dc4f21ef28:function(){return I(function(e,n,_){g(e).send(F(n,_));},arguments)},__wbg_setTimeout_3a808dd861dd3c12:function(e,n){let _=setTimeout(g(e),n);return u(_)},__wbg_setTimeout_6613a51400c1bf9f:function(){return I(function(e,n,_){let r=g(e).setTimeout(p(n),_);return u(r)},arguments)},__wbg_setTimeout_ef24d2fc3ad97385:function(){return I(function(e,n){let _=setTimeout(g(e),n);return u(_)},arguments)},__wbg_set_5f806304fb633ab3:function(e,n,_){let r=g(e).set(g(n),g(_));return u(r)},__wbg_set_6be42768c690e380:function(e,n,_){g(e)[p(n)]=p(_);},__wbg_set_86698c227e5b9dad:function(e,n,_){g(e).set(C(n,_));},__wbg_set_a6ba3ac0e634b822:function(){return I(function(e,n,_){return Reflect.set(g(e),g(n),g(_))},arguments)},__wbg_set_binaryType_07905e4563fcd9b2:function(e,n){g(e).binaryType=kt[n];},__wbg_set_binaryType_8c2dd2cf1cfc2e28:function(e,n){g(e).binaryType=mt[n];},__wbg_set_body_d1153b16a2b95ca1:function(e,n){g(e).body=g(n);},__wbg_set_bufferedAmountLowThreshold_8969a2db2c745257:function(e,n){g(e).bufferedAmountLowThreshold=n>>>0;},__wbg_set_cache_5a01a8b5e6ca6cf2:function(e,n){g(e).cache=yt[n];},__wbg_set_credentials_e9120ed88b1fc0b8:function(e,n){g(e).credentials=vt[n];},__wbg_set_da33c120a6584674:function(e,n,_){g(e)[n>>>0]=p(_);},__wbg_set_detail_c7af5edea934390b:function(e,n){g(e).detail=g(n);},__wbg_set_handle_event_6147c38b782c7b42:function(e,n){g(e).handleEvent=g(n);},__wbg_set_headers_877ed41890d28af2:function(e,n){g(e).headers=g(n);},__wbg_set_high_water_mark_77da20c49668427d:function(e,n){g(e).highWaterMark=n;},__wbg_set_method_b4ede299b2064f37:function(e,n,_){g(e).method=F(n,_);},__wbg_set_mode_d6c2e1991aa963c6:function(e,n){g(e).mode=It[n];},__wbg_set_onbufferedamountlow_b695487bdd219f98:function(e,n){g(e).onbufferedamountlow=g(n);},__wbg_set_onclose_9cb5c3372e16c192:function(e,n){g(e).onclose=g(n);},__wbg_set_onclose_f8bec1cbeb64aa93:function(e,n){g(e).onclose=g(n);},__wbg_set_onerror_190fe67e911ebf28:function(e,n){g(e).onerror=g(n);},__wbg_set_onmessage_4d57c4ddab951294:function(e,n){g(e).onmessage=g(n);},__wbg_set_onmessage_96337495f0bfb796:function(e,n){g(e).onmessage=g(n);},__wbg_set_onopen_3e2bf6b11d434c2d:function(e,n){g(e).onopen=g(n);},__wbg_set_signal_9022b5aa06a6ce5b:function(e,n){g(e).signal=g(n);},__wbg_signal_41dd1a8913cd0b7d:function(e){let n=g(e).signal;return u(n)},__wbg_stack_3b0d974bbf31e44f:function(e,n){let _=g(n).stack,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_static_accessor_GLOBAL_60a4124bab7dcc9a:function(){let e=typeof global>"u"?null:global;return x(e)?0:u(e)},__wbg_static_accessor_GLOBAL_THIS_95ca6460658b5d13:function(){let e=typeof globalThis>"u"?null:globalThis;return x(e)?0:u(e)},__wbg_static_accessor_SELF_4c95f759a91e9aae:function(){let e=typeof self>"u"?null:self;return x(e)?0:u(e)},__wbg_static_accessor_WINDOW_44b435597f9e9ee7:function(){let e=typeof window>"u"?null:window;return x(e)?0:u(e)},__wbg_status_9e6505cfa3e73a7c:function(e){return g(e).status},__wbg_subarray_42216645a367cd7a:function(e,n,_){let r=g(e).subarray(n>>>0,_>>>0);return u(r)},__wbg_then_254bab9b266a77a5:function(e,n,_){let r=g(e).then(g(n),g(_));return u(r)},__wbg_then_3ea18602c6a5123b:function(e,n){let _=g(e).then(g(n));return u(_)},__wbg_url_72c67c175685a054:function(e,n){let _=g(n).url,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_url_d0b8042af0d1bbba:function(e,n){let _=g(n).url,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_value_3d3defe09fb1ffca:function(e){let n=g(e).value;return u(n)},__wbg_versions_276b2795b1c6a219:function(e){let n=g(e).versions;return u(n)},__wbg_view_15fa5865c6b336e3:function(e){let n=g(e).view;return x(n)?0:u(n)},__wbg_warn_633bacc13ba7e6c3:function(e){console.warn(g(e));},__wbg_wasClean_f17429d064911939:function(e){return g(e).wasClean},__wbindgen_cast_0000000000000001:function(e,n){let _=B(e,n,dt);return u(_)},__wbindgen_cast_0000000000000002:function(e,n){let _=B(e,n,ft);return u(_)},__wbindgen_cast_0000000000000003:function(e,n){let _=B(e,n,wt);return u(_)},__wbindgen_cast_0000000000000004:function(e,n){let _=B(e,n,ut);return u(_)},__wbindgen_cast_0000000000000005:function(e,n){let _=B(e,n,lt);return u(_)},__wbindgen_cast_0000000000000006:function(e,n){let _=B(e,n,at);return u(_)},__wbindgen_cast_0000000000000007:function(e,n){let _=B(e,n,pt);return u(_)},__wbindgen_cast_0000000000000008:function(e,n){let _=St(e,n,gt);return u(_)},__wbindgen_cast_0000000000000009:function(e,n){let _=B(e,n,bt);return u(_)},__wbindgen_cast_000000000000000a:function(e){return u(e)},__wbindgen_cast_000000000000000b:function(e){return u(e)},__wbindgen_cast_000000000000000c:function(e,n){let _=C(e,n);return u(_)},__wbindgen_cast_000000000000000d:function(e,n){let _=F(e,n);return u(_)},__wbindgen_cast_000000000000000e:function(e){let n=BigInt.asUintN(64,e);return u(n)},__wbindgen_cast_000000000000000f:function(e,n){var _=C(e,n).slice();return t.__wbindgen_export4(e,n*1,1),u(_)},__wbindgen_object_clone_ref:function(e){let n=g(e);return u(n)},__wbindgen_object_drop_ref:function(e){p(e);}}}}function at(d,e){t.__wasm_bindgen_func_elem_30095(d,e);}function pt(d,e){t.__wasm_bindgen_func_elem_31230(d,e);}function gt(d,e){t.__wasm_bindgen_func_elem_31302(d,e);}function bt(d,e){t.__wasm_bindgen_func_elem_39364(d,e);}function dt(d,e,n){t.__wasm_bindgen_func_elem_30298(d,e,u(n));}function wt(d,e,n){t.__wasm_bindgen_func_elem_27656(d,e,u(n));}function ut(d,e,n){t.__wasm_bindgen_func_elem_6443(d,e,u(n));}function lt(d,e,n){t.__wasm_bindgen_func_elem_32009(d,e,u(n));}function ft(d,e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.__wasm_bindgen_func_elem_40873(o,d,e,u(n));var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}function xt(d,e,n,_){t.__wasm_bindgen_func_elem_40875(d,e,u(n),u(_));}var mt=["blob","arraybuffer"],ht=["bytes"],yt=["default","no-store","reload","no-cache","force-cache","only-if-cached"],vt=["omit","same-origin","include"],It=["same-origin","no-cors","cors","navigate"],kt=["arraybuffer","blob"],tt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_bistream_free(d,1)),Rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_intounderlyingbytesource_free(d,1)),et=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_intounderlyingsink_free(d,1)),nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_intounderlyingsource_free(d,1)),_t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_peerunistream_free(d,1)),rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_wasmclient_free(d,1)),ot=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_wasmpeerdatagrampolicy_free(d,1));function u(d){D===E.length&&E.push(E.length+1);let e=D;return D=E[e],E[e]=d,e}var J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbindgen_export5(d.a,d.b));function Z(d){let e=typeof d;if(e=="number"||e=="boolean"||d==null)return `${d}`;if(e=="string")return `"${d}"`;if(e=="symbol"){let r=d.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=d.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(d)){let r=d.length,o="[";r>0&&(o+=Z(d[0]));for(let s=1;s<r;s++)o+=", "+Z(d[s]);return o+="]",o}let n=/\[object ([^\]]+)\]/.exec(toString.call(d)),_;if(n&&n.length>1)_=n[1];else return toString.call(d);if(_=="Object")try{return "Object("+JSON.stringify(d)+")"}catch{return "Object"}return d instanceof Error?`${d.name}: ${d.message}
1
+ var G=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,tt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_bistream_free(e,0);}get applicationCryptoWrapped(){return t.bistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let e=t.bistream_cancelSend(this.__wbg_ptr);return p(e)}get endpoint_id(){let e,n;try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.bistream_endpoint_id(o,this.__wbg_ptr);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);return e=_,n=r,F(_,r)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(e,n,1);}}finishSend(){let e=t.bistream_finishSend(this.__wbg_ptr);return p(e)}get recv(){let e=t.bistream_recv(this.__wbg_ptr);return p(e)}get send(){let e=t.bistream_send(this.__wbg_ptr);return p(e)}get transport_stable_id(){try{let _=t.__wbindgen_add_to_stack_pointer(-16);t.bistream_transport_stable_id(_,this.__wbg_ptr);var e=b().getInt32(_+0,!0),n=b().getFloat64(_+8,!0);return e===0?void 0:n}finally{t.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);var $=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Rt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_intounderlyingbytesource_free(e,0);}get autoAllocateChunkSize(){return t.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}cancel(){let e=this.__destroy_into_raw();t.intounderlyingbytesource_cancel(e);}pull(e){let n=t.intounderlyingbytesource_pull(this.__wbg_ptr,u(e));return p(n)}start(e){t.intounderlyingbytesource_start(this.__wbg_ptr,u(e));}get type(){let e=t.intounderlyingbytesource_type(this.__wbg_ptr);return ht[e]}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var L=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,et.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_intounderlyingsink_free(e,0);}abort(e){let n=this.__destroy_into_raw(),_=t.intounderlyingsink_abort(n,u(e));return p(_)}close(){let e=this.__destroy_into_raw(),n=t.intounderlyingsink_close(e);return p(n)}write(e){let n=t.intounderlyingsink_write(this.__wbg_ptr,u(e));return p(n)}};Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);var U=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,nt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,nt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_intounderlyingsource_free(e,0);}cancel(){let e=this.__destroy_into_raw();t.intounderlyingsource_cancel(e);}pull(e){let n=t.intounderlyingsource_pull(this.__wbg_ptr,u(e));return p(n)}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var X=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,_t.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,_t.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_peerunistream_free(e,0);}get applicationCryptoWrapped(){return t.peerunistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}cancelSend(){let e=t.peerunistream_cancelSend(this.__wbg_ptr);return p(e)}finishSend(){let e=t.peerunistream_finishSend(this.__wbg_ptr);return p(e)}get writable(){let e=t.peerunistream_writable(this.__wbg_ptr);return p(e)}};Symbol.dispose&&(X.prototype[Symbol.dispose]=X.prototype.free);var K=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,rt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_wasmclient_free(e,0);}__acceptOpenRtcBroadcastObject(e,n,_){try{let a=t.__wbindgen_add_to_stack_pointer(-16),w=c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(n,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=k(_,t.__wbindgen_export),y=i;t.wasmclient___acceptOpenRtcBroadcastObject(a,this.__wbg_ptr,w,l,f,m,h,y);var r=b().getInt32(a+0,!0),o=b().getInt32(a+4,!0),s=b().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__acknowledgePersistentIrohOutbox(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient___acknowledgePersistentIrohOutbox(this.__wbg_ptr,n,_);return p(r)}__advancePreferredIrohCarrier(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient___advancePreferredIrohCarrier(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__applyIrohCarrierPolicy(){let e=t.wasmclient___applyIrohCarrierPolicy(this.__wbg_ptr);return p(e)}__attachMoqCarrier(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(r,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=t.wasmclient___attachMoqCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__attachWebRtcCarrier(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(r,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=t.wasmclient___attachWebRtcCarrier(this.__wbg_ptr,o,s,a,w,u(_),l,f);return p(m)}__beginMoqCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___beginMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__beginOpenRtcBroadcastPublication(e,n,_,r,o,s,a,w,l){try{let R=t.__wbindgen_add_to_stack_pointer(-16),A=c(e,t.__wbindgen_export,t.__wbindgen_export2),S=i,P=c(n,t.__wbindgen_export,t.__wbindgen_export2),M=i;var f=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i;let O=c(r,t.__wbindgen_export,t.__wbindgen_export2),T=i,N=c(o,t.__wbindgen_export,t.__wbindgen_export2),Q=i;t.wasmclient___beginOpenRtcBroadcastPublication(R,this.__wbg_ptr,A,S,P,M,f,m,O,T,N,Q,s,x(a)?Number.MAX_SAFE_INTEGER:a>>>0,x(w)?Number.MAX_SAFE_INTEGER:w>>>0,x(l)?16777215:l);var h=b().getInt32(R+0,!0),y=b().getInt32(R+4,!0),v=b().getInt32(R+8,!0);if(v)throw p(y);return p(h)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__beginOpenRtcMediaPublication(e,n,_,r,o,s,a){try{let y=t.__wbindgen_add_to_stack_pointer(-16);var w=x(e)?0:c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i;let v=c(n,t.__wbindgen_export,t.__wbindgen_export2),R=i,A=c(_,t.__wbindgen_export,t.__wbindgen_export2),S=i;t.wasmclient___beginOpenRtcMediaPublication(y,this.__wbg_ptr,w,l,v,R,A,S,r,x(o)?Number.MAX_SAFE_INTEGER:o>>>0,x(s)?Number.MAX_SAFE_INTEGER:s>>>0,x(a)?16777215:a);var f=b().getInt32(y+0,!0),m=b().getInt32(y+4,!0),h=b().getInt32(y+8,!0);if(h)throw p(m);return p(f)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__beginPreferredIrohCarrier(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=t.wasmclient___beginPreferredIrohCarrier(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__beginWebRtcCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___beginWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__closeOpenRtcBroadcast(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___closeOpenRtcBroadcast(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__configureIrohRoutePolicy(e,n,_){var r=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),o=i;let s=t.wasmclient___configureIrohRoutePolicy(this.__wbg_ptr,e,r,o,u(_));return p(s)}__configureMoqCarrier(e,n){var _=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),r=i;let o=t.wasmclient___configureMoqCarrier(this.__wbg_ptr,e,_,r);return p(o)}__configureWebRtcCarrier(e,n){let _=t.wasmclient___configureWebRtcCarrier(this.__wbg_ptr,e,n);return p(_)}__createOpenRtcBroadcastPublisherSigner(){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmclient___createOpenRtcBroadcastPublisherSigner(r,this.__wbg_ptr);var e=b().getInt32(r+0,!0),n=b().getInt32(r+4,!0),_=b().getInt32(r+8,!0);if(_)throw p(n);return p(e)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__createPersistentIrohNamespace(e,n){let _=t.wasmclient___createPersistentIrohNamespace(this.__wbg_ptr,e,n);return p(_)}__decodeOpenRtcMediaChunk(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmclient___decodeOpenRtcMediaChunk(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__decodeOpenRtcMediaControl(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmclient___decodeOpenRtcMediaControl(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__deletePersistentIrohPrefix(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient___deletePersistentIrohPrefix(this.__wbg_ptr,_,r,o,s);return p(a)}__encodeOpenRtcMediaSample(e,n,_,r,o,s){try{let h=t.__wbindgen_add_to_stack_pointer(-16),y=c(e,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(s,t.__wbindgen_export),A=i;t.wasmclient___encodeOpenRtcMediaSample(h,this.__wbg_ptr,y,v,n,_,r,o,R,A);var a=b().getInt32(h+0,!0),w=b().getInt32(h+4,!0),l=b().getInt32(h+8,!0),f=b().getInt32(h+12,!0);if(f)throw p(l);var m=C(a,w).slice();return t.__wbindgen_export4(a,w*1,1),m}finally{t.__wbindgen_add_to_stack_pointer(16);}}__flushPersistentIrohProtocols(){let e=t.wasmclient___flushPersistentIrohProtocols(this.__wbg_ptr);return p(e)}__forgetIrohCarrierPeer(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient___forgetIrohCarrierPeer(this.__wbg_ptr,n,_);return p(r)}__forgetManagedRoomGroup(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;t.wasmclient___forgetManagedRoomGroup(this.__wbg_ptr,n,_);}__getIrohCarrierReadiness(){let e=t.wasmclient___getIrohCarrierReadiness(this.__wbg_ptr);return p(e)}__getOpenRtcBroadcastStats(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient___getOpenRtcBroadcastStats(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__handleIrohCarrierControl(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=t.wasmclient___handleIrohCarrierControl(this.__wbg_ptr,r,o,s,a,u(_));return p(w)}__handleManagedRoomArtifactChunk(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___handleManagedRoomArtifactChunk(s,this.__wbg_ptr,a,w,u(n));var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__handleManagedRoomPreparePage(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___handleManagedRoomPreparePage(s,this.__wbg_ptr,a,w,u(n));var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__hydratePersistentIrohBlob(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient___hydratePersistentIrohBlob(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohAuthor(e){let n=k(e,t.__wbindgen_export),_=i,r=t.wasmclient___importPersistentIrohAuthor(this.__wbg_ptr,n,_);return p(r)}__importPersistentIrohNamespace(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=k(n,t.__wbindgen_export),w=i,l=t.wasmclient___importPersistentIrohNamespace(this.__wbg_ptr,o,s,a,w,_,r);return p(l)}__importPersistentIrohTicket(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient___importPersistentIrohTicket(this.__wbg_ptr,r,o,n,_);return p(s)}__initManagedRoomGroup(e,n,_,r){try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(n,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(_,t.__wbindgen_export),A=i;var o=x(r)?0:k(r,t.__wbindgen_export),s=i;t.wasmclient___initManagedRoomGroup(f,this.__wbg_ptr,m,h,y,v,R,A,o,s);var a=b().getInt32(f+0,!0),w=b().getInt32(f+4,!0),l=b().getInt32(f+8,!0);if(l)throw p(w);return p(a)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__initPersistentIrohProtocols(e){let n=t.wasmclient___initPersistentIrohProtocols(this.__wbg_ptr,u(e));return p(n)}__moqCarrierFailed(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient___moqCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__moqCarrierPrepared(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___moqCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}__observeOpenRtcBroadcastAdapter(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient___observeOpenRtcBroadcastAdapter(o,this.__wbg_ptr,s,a,u(n));var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__openManagedRoomPayload(e,n,_,r,o,s,a,w){try{let v=t.__wbindgen_add_to_stack_pointer(-16),R=c(e,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=c(r,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=c(o,t.__wbindgen_export,t.__wbindgen_export2),O=i;var l=x(a)?0:c(a,t.__wbindgen_export,t.__wbindgen_export2),f=i;let T=k(w,t.__wbindgen_export),N=i;t.wasmclient___openManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,S,P,M,O,s,l,f,T,N);var m=b().getInt32(v+0,!0),h=b().getInt32(v+4,!0),y=b().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__openOpenRtcBroadcast(e,n,_,r,o,s){try{let h=t.__wbindgen_add_to_stack_pointer(-16),y=c(e,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(n,t.__wbindgen_export),A=i,S=c(_,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=k(r,t.__wbindgen_export),O=i;var a=x(o)?0:c(o,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___openOpenRtcBroadcast(h,this.__wbg_ptr,y,v,R,A,S,P,M,O,a,w,s);var l=b().getInt32(h+0,!0),f=b().getInt32(h+4,!0),m=b().getInt32(h+8,!0);if(m)throw p(f);return p(l)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcBroadcastPublication(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;t.wasmclient___pauseOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__pauseOpenRtcMediaPublication(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___pauseOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__prepareOpenRtcBroadcastGrant(e,n,_){try{let a=t.__wbindgen_add_to_stack_pointer(-16),w=c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=k(n,t.__wbindgen_export),m=i;t.wasmclient___prepareOpenRtcBroadcastGrant(a,this.__wbg_ptr,w,l,f,m,_);var r=b().getInt32(a+0,!0),o=b().getInt32(a+4,!0),s=b().getInt32(a+8,!0);if(s)throw p(o);return p(r)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__publishOpenRtcBroadcastSample(e,n,_,r,o,s,a){try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(n,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=k(a,t.__wbindgen_export),A=i;t.wasmclient___publishOpenRtcBroadcastSample(f,this.__wbg_ptr,m,h,y,v,_,r,o,s,R,A);var w=b().getInt32(f+0,!0),l=b().getInt32(f+4,!0);if(l)throw p(w)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__putPersistentIrohBytes(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=k(n,t.__wbindgen_export),a=i,w=k(_,t.__wbindgen_export),l=i,f=t.wasmclient___putPersistentIrohBytes(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__queryPersistentIrohNamespace(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient___queryPersistentIrohNamespace(this.__wbg_ptr,_,r,o,s);return p(a)}__reconcileIrohCarriersAfterNetworkChange(){let e=t.wasmclient___reconcileIrohCarriersAfterNetworkChange(this.__wbg_ptr);return p(e)}__reconcilePersistentIrohProtocols(){let e=t.wasmclient___reconcilePersistentIrohProtocols(this.__wbg_ptr);return p(e)}__releaseOpenRtcBroadcastPublisherSigner(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;return t.wasmclient___releaseOpenRtcBroadcastPublisherSigner(this.__wbg_ptr,n,_)!==0}__removePersistentIrohNamespace(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient___removePersistentIrohNamespace(this.__wbg_ptr,r,o,n,_);return p(s)}__requireScopePeerAdmission(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___requireScopePeerAdmission(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireIrohCarrierPeer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient___retireIrohCarrierPeer(this.__wbg_ptr,_,r,o,s);return p(a)}__retireMoqCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient___retireMoqCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__retireOpenRtcBroadcastPublication(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;t.wasmclient___retireOpenRtcBroadcastPublication(o,this.__wbg_ptr,s,a,w,l);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaPublication(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient___retireOpenRtcMediaPublication(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireOpenRtcMediaReceiver(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient___retireOpenRtcMediaReceiver(o,this.__wbg_ptr,s,a,n);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__retireWebRtcCarrier(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient___retireWebRtcCarrier(this.__wbg_ptr,_,r,o,s);return p(a)}__sealManagedRoomPayload(e,n,_,r,o,s,a,w){try{let v=t.__wbindgen_add_to_stack_pointer(-16),R=c(e,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=c(r,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=c(o,t.__wbindgen_export,t.__wbindgen_export2),O=i;var l=x(a)?0:c(a,t.__wbindgen_export,t.__wbindgen_export2),f=i;let T=k(w,t.__wbindgen_export),N=i;t.wasmclient___sealManagedRoomPayload(v,this.__wbg_ptr,R,A,n,_,S,P,M,O,s,l,f,T,N);var m=b().getInt32(v+0,!0),h=b().getInt32(v+4,!0),y=b().getInt32(v+8,!0);if(y)throw p(h);return p(m)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__setIrohCarrierActionHandler(e){t.wasmclient___setIrohCarrierActionHandler(this.__wbg_ptr,x(e)?0:u(e));}__setPersistentIrohHash(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=k(n,t.__wbindgen_export),w=i,l=c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=t.wasmclient___setPersistentIrohHash(this.__wbg_ptr,o,s,a,w,l,f,r);return p(m)}__sharePersistentIrohNamespace(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient___sharePersistentIrohNamespace(this.__wbg_ptr,_,r,n);return p(o)}__shutdownPersistentIrohProtocols(){let e=t.wasmclient___shutdownPersistentIrohProtocols(this.__wbg_ptr);return p(e)}__takeOpenRtcBroadcastActions(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient___takeOpenRtcBroadcastActions(s,this.__wbg_ptr,a,w,n);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__updateScopePeerAdmission(e,n,_,r){try{let a=t.__wbindgen_add_to_stack_pointer(-16),w=c(e,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(r,t.__wbindgen_export,t.__wbindgen_export2),m=i;t.wasmclient___updateScopePeerAdmission(a,this.__wbg_ptr,w,l,n,_,f,m);var o=b().getInt32(a+0,!0),s=b().getInt32(a+4,!0);if(s)throw p(o)}finally{t.__wbindgen_add_to_stack_pointer(16);}}__webRtcCarrierFailed(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient___webRtcCarrierFailed(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}__webRtcCarrierPrepared(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient___webRtcCarrierPrepared(this.__wbg_ptr,_,r,o,s);return p(a)}acceptSparseFanoutMessage(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=k(_,t.__wbindgen_export),l=i,f=t.wasmclient_acceptSparseFanoutMessage(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}acknowledge_session_token_response(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),f=i;let m=t.wasmclient_acknowledge_session_token_response(this.__wbg_ptr,o,s,a,w,_,l,f);return p(m)}add_peer_scope(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_add_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}bind_connection_device_id(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_bind_connection_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}bind_node_device_id(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_bind_node_device_id(this.__wbg_ptr,_,r,o,s);return p(a)}clearConnectionApplicationCryptoKey(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;t.wasmclient_clearConnectionApplicationCryptoKey(this.__wbg_ptr,n,_);}clearIdentityCredential(){t.wasmclient_clearIdentityCredential(this.__wbg_ptr);}clear_session_tokens(){t.wasmclient_clear_session_tokens(this.__wbg_ptr);}close_ticket_mesh(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_close_ticket_mesh(this.__wbg_ptr,n,_);return p(r)}confirm_reciprocal_admission(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;var y=x(s)?0:c(s,t.__wbindgen_export,t.__wbindgen_export2),v=i;let R=t.wasmclient_confirm_reciprocal_admission(this.__wbg_ptr,a,w,n,l,f,m,h,o,y,v);return p(R)}connect_device(e,n,_){var r=x(e)?0:c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i;let s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=t.wasmclient_connect_device(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}connect_known_device_with_token(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=t.wasmclient_connect_known_device_with_token(this.__wbg_ptr,a,w,l,f,m,h,r,!x(o),x(o)?BigInt(0):o,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(y)}connect_ticket_invite(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_connect_ticket_invite(this.__wbg_ptr,n,_);return p(r)}connectionApplicationCryptoReady(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;return t.wasmclient_connectionApplicationCryptoReady(this.__wbg_ptr,_,r,n)!==0}connection_state(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_connection_state(this.__wbg_ptr,n,_);return p(r)}connection_states(){let e=t.wasmclient_connection_states(this.__wbg_ptr);return p(e)}createPeerDatagramPolicy(){let e=t.wasmclient_createPeerDatagramPolicy(this.__wbg_ptr);return V.__wrap(e)}create_room(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(r,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=c(o,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=t.wasmclient_create_room(this.__wbg_ptr,a,w,l,f,m,h,y,v,R,A,x(s)?Number.MAX_SAFE_INTEGER:s>>>0);return p(S)}create_session(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_create_session(this.__wbg_ptr,n,_);return p(r)}decodeIncomingChannelEnvelope(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmclient_decodeIncomingChannelEnvelope(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}delete_device(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_delete_device(this.__wbg_ptr,_,r,o,s);return p(a)}devices_with_status(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_devices_with_status(this.__wbg_ptr,n,_);return p(r)}disconnect(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_disconnect(this.__wbg_ptr,n,_);return p(r)}disconnect_device(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient_disconnect_device(this.__wbg_ptr,_,r,o,s);return p(a)}disconnect_transient(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_disconnect_transient(this.__wbg_ptr,n,_);return p(r)}endpoint_id_from_ticket(e){let n,_;try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_endpoint_id_from_ticket(f,this.__wbg_ptr,m,h);var r=b().getInt32(f+0,!0),o=b().getInt32(f+4,!0),s=b().getInt32(f+8,!0),a=b().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,F(w,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(n,_,1);}}endpoint_ticket(){let e=t.wasmclient_endpoint_ticket(this.__wbg_ptr);return p(e)}endpoint_ticket_with_token(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_endpoint_ticket_with_token(this.__wbg_ptr,_,r,n);return p(o)}ensureConnectionApplicationCrypto(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=t.wasmclient_ensureConnectionApplicationCrypto(this.__wbg_ptr,o,s,a,w,_,u(r));return p(l)}finalizeSparseFanoutMessage(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_finalizeSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}force_reconnect_snapshot(){t.wasmclient_force_reconnect_snapshot(this.__wbg_ptr);}get_members(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient_get_members(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}handleConnectionApplicationCryptoHandshake(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;var f=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),m=i;let h=k(o,t.__wbindgen_export),y=i,v=t.wasmclient_handleConnectionApplicationCryptoHandshake(this.__wbg_ptr,s,a,w,l,!x(_),x(_)?BigInt(0):_,f,m,h,y);return p(v)}incoming_streams(){let e=t.wasmclient_incoming_streams(this.__wbg_ptr);return p(e)}initIrohWithTestRelay(e,n){var _=x(e)?0:k(e,t.__wbindgen_export),r=i,o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient_initIrohWithTestRelay(this.__wbg_ptr,_,r,o,s);return p(a)}init_iroh(e){var n=x(e)?0:k(e,t.__wbindgen_export),_=i;let r=t.wasmclient_init_iroh(this.__wbg_ptr,n,_);return p(r)}inspectIncomingStreamPrefix(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=k(e,t.__wbindgen_export),w=i;t.wasmclient_inspectIncomingStreamPrefix(s,this.__wbg_ptr,a,w,n);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}iroh_path_kind(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_iroh_path_kind(this.__wbg_ptr,n,_);return p(r)}iroh_secret_key(){let e=t.wasmclient_iroh_secret_key(this.__wbg_ptr);return p(e)}iroh_transport_rtt_ms(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_iroh_transport_rtt_ms(this.__wbg_ptr,n,_);return p(r)}is_auto_connect_excluded(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;return t.wasmclient_is_auto_connect_excluded(this.__wbg_ptr,n,_)!==0}is_connected(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_is_connected(this.__wbg_ptr,n,_);return p(r)}is_current_transport_stable_id(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_is_current_transport_stable_id(this.__wbg_ptr,_,r,n);return p(o)}is_remote_admitted(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_is_remote_admitted(this.__wbg_ptr,n,_);return p(r)}issue_ticket_invite(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient_issue_ticket_invite(this.__wbg_ptr,r,o,n,_);return p(s)}issue_ticket_mesh(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=t.wasmclient_issue_ticket_mesh(this.__wbg_ptr,r,o,n,u(_));return p(s)}join_room(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=c(r,t.__wbindgen_export,t.__wbindgen_export2),y=i,v=c(o,t.__wbindgen_export,t.__wbindgen_export2),R=i,A=t.wasmclient_join_room(this.__wbg_ptr,s,a,w,l,f,m,h,y,v,R);return p(A)}join_ticket_mesh(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_join_ticket_mesh(this.__wbg_ptr,_,r,u(n));return p(o)}leave_room(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=t.wasmclient_leave_room(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}list_managed_connections(){let e=t.wasmclient_list_managed_connections(this.__wbg_ptr);return p(e)}constructor(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient_new(o,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return this.__wbg_ptr=n,rt.register(this,this.__wbg_ptr,this),this}finally{t.__wbindgen_add_to_stack_pointer(16);}}node_addr(){let e=t.wasmclient_node_addr(this.__wbg_ptr);return p(e)}observe_known_device_endpoint(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_observe_known_device_endpoint(this.__wbg_ptr,_,r,o,s);return p(a)}openConnectionApplicationPayload(e,n,_){try{let l=t.__wbindgen_add_to_stack_pointer(-16),f=c(e,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=k(_,t.__wbindgen_export),y=i;t.wasmclient_openConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=b().getInt32(l+0,!0),o=b().getInt32(l+4,!0),s=b().getInt32(l+8,!0),a=b().getInt32(l+12,!0);if(a)throw p(s);var w=C(r,o).slice();return t.__wbindgen_export4(r,o*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16);}}open_bi(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_open_bi(this.__wbg_ptr,n,_);return p(r)}open_native_main_control_bi(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_open_native_main_control_bi(this.__wbg_ptr,n,_);return p(r)}open_peer_bi(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_bi(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_explicit_file_sender(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_bi_explicit_file_sender(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_bi_transport_only(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_bi_transport_only(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_peer_uni(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_open_peer_uni(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}open_uni(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_open_uni(this.__wbg_ptr,n,_);return p(r)}peerDatagramMaxSize(){return t.wasmclient_peerDatagramMaxSize(this.__wbg_ptr)>>>0}peer_scopes(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_peer_scopes(this.__wbg_ptr,n,_);return p(r)}peer_session(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_peer_session(this.__wbg_ptr,n,_);return p(r)}peer_sessions(){let e=t.wasmclient_peer_sessions(this.__wbg_ptr);return p(e)}peer_snapshot(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_peer_snapshot(this.__wbg_ptr,n,_);return p(r)}prepareSparseFanoutMessage(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_prepareSparseFanoutMessage(this.__wbg_ptr,_,r,o,s);return p(a)}prepare_reciprocal_admission(e,n,_,r,o,s,a,w){let l=c(e,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=c(r,t.__wbindgen_export,t.__wbindgen_export2),v=i,R=c(o,t.__wbindgen_export,t.__wbindgen_export2),A=i,S=c(s,t.__wbindgen_export,t.__wbindgen_export2),P=i,M=c(a,t.__wbindgen_export,t.__wbindgen_export2),O=i,T=c(w,t.__wbindgen_export,t.__wbindgen_export2),N=i,Q=t.wasmclient_prepare_reciprocal_admission(this.__wbg_ptr,l,f,n,m,h,y,v,R,A,S,P,M,O,T,N);return p(Q)}present_session_token(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;let y=t.wasmclient_present_session_token(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}protectConnectionApplicationPayload(e,n,_){try{let l=t.__wbindgen_add_to_stack_pointer(-16),f=c(e,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=k(_,t.__wbindgen_export),y=i;t.wasmclient_protectConnectionApplicationPayload(l,this.__wbg_ptr,f,m,n,h,y);var r=b().getInt32(l+0,!0),o=b().getInt32(l+4,!0),s=b().getInt32(l+8,!0),a=b().getInt32(l+12,!0);if(a)throw p(s);var w=C(r,o).slice();return t.__wbindgen_export4(r,o*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16);}}rankRoutes(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=it(e,t.__wbindgen_export),w=i,l=it(n,t.__wbindgen_export),f=i;t.wasmclient_rankRoutes(s,this.__wbg_ptr,a,w,l,f);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=Ft(_,r).slice();return t.__wbindgen_export4(_,r*4,4),o}finally{t.__wbindgen_add_to_stack_pointer(16);}}receivePeerDatagram(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_receivePeerDatagram(this.__wbg_ptr,n,_);return p(r)}receive_ticket_mesh_frame(e,n,_){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_receive_ticket_mesh_frame(s,this.__wbg_ptr,a,w,l,f,m,h);var r=b().getInt32(s+0,!0),o=b().getInt32(s+4,!0);if(o)throw p(r)}finally{t.__wbindgen_add_to_stack_pointer(16);}}recordSparseFanoutForwardQueueDrop(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_recordSparseFanoutForwardQueueDrop(this.__wbg_ptr,_,r,n);return p(o)}register_session_token(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient_register_session_token(this.__wbg_ptr,r,o,s,a,_);}register_token_until(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient_register_token_until(this.__wbg_ptr,o,s,a,w,_,r);}reject_connection_admission(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_reject_connection_admission(this.__wbg_ptr,_,r,o,s);return p(a)}release_peer_scope(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i;var o=x(n)?0:c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i;let a=t.wasmclient_release_peer_scope(this.__wbg_ptr,_,r,o,s);return p(a)}report_managed_connection_settled(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i;let m=t.wasmclient_report_managed_connection_settled(this.__wbg_ptr,a,w,n,l,f,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(m)}report_transport_status(e,n,_,r,o,s){let a=c(e,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(n,t.__wbindgen_export,t.__wbindgen_export2),f=i;var m=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),h=i;let y=t.wasmclient_report_transport_status(this.__wbg_ptr,a,w,l,f,m,h,!x(r),x(r)?BigInt(0):r,!x(o),x(o)?BigInt(0):o,!x(s),x(s)?BigInt(0):s);return p(y)}resolve_peer_connection_records(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_resolve_peer_connection_records(this.__wbg_ptr,n,_);return p(r)}revoke_session_token(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i;t.wasmclient_revoke_session_token(o,this.__wbg_ptr,s,a);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}revoke_tokens_by_scope(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_revoke_tokens_by_scope(this.__wbg_ptr,n,_);return p(r)}runtime_policy(){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmclient_runtime_policy(r,this.__wbg_ptr);var e=b().getInt32(r+0,!0),n=b().getInt32(r+4,!0),_=b().getInt32(r+8,!0);if(_)throw p(n);return p(e)}finally{t.__wbindgen_add_to_stack_pointer(16);}}same_peer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_same_peer(this.__wbg_ptr,_,r,o,s);return p(a)}search_devices(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_search_devices(this.__wbg_ptr,n,_);return p(r)}sendPeerDatagram(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=k(n,t.__wbindgen_export),a=i,w=t.wasmclient_sendPeerDatagram(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}send_message(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;let y=t.wasmclient_send_message(this.__wbg_ptr,o,s,a,w,l,f,m,h);return p(y)}send_native_main_control_frame(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_send_native_main_control_frame(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_send_peer(this.__wbg_ptr,_,r,o,s);return p(a)}send_peer_application_frame(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=k(n,t.__wbindgen_export),a=i,w=t.wasmclient_send_peer_application_frame(this.__wbg_ptr,r,o,s,a,x(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(w)}setConnectionApplicationCryptoKey(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=k(n,t.__wbindgen_export),s=i,a=t.wasmclient_setConnectionApplicationCryptoKey(this.__wbg_ptr,_,r,o,s);return p(a)}setConnectionApplicationCryptoRequired(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16),o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i;t.wasmclient_setConnectionApplicationCryptoRequired(r,this.__wbg_ptr,o,s);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}setIdentityCredential(e){var n=x(e)?0:c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i;t.wasmclient_setIdentityCredential(this.__wbg_ptr,n,_);}setRelay(e){let n=t.wasmclient_setRelay(this.__wbg_ptr,e);return p(n)}set_auto_connect_excluded(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_set_auto_connect_excluded(this.__wbg_ptr,_,r,n);return p(o)}set_offline(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_set_offline(this.__wbg_ptr,n,_);return p(r)}sparseFanoutDiagnostics(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_sparseFanoutDiagnostics(this.__wbg_ptr,n,_);return p(r)}start_auto_connect(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;t.wasmclient_start_auto_connect(o,this.__wbg_ptr,s,a,w,l);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}start_presence_loop(e,n,_,r){let o=c(e,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i,l=c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i;var m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_start_presence_loop(this.__wbg_ptr,o,s,a,w,l,f,m,h);}stop_auth_scoped_activity(){t.wasmclient_stop_auth_scoped_activity(this.__wbg_ptr);}stop_auto_connect(){t.wasmclient_stop_auto_connect(this.__wbg_ptr);}stop_presence_loop(){t.wasmclient_stop_presence_loop(this.__wbg_ptr);}submit_browser_desired_peers(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;t.wasmclient_submit_browser_desired_peers(s,this.__wbg_ptr,e,a,w);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{t.__wbindgen_add_to_stack_pointer(16);}}submit_browser_desired_peers_with_sparse_fanout(e,n,_,r,o,s){let a=c(n,t.__wbindgen_export,t.__wbindgen_export2),w=i;var l=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),f=i,m=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),h=i,y=x(o)?0:c(o,t.__wbindgen_export,t.__wbindgen_export2),v=i;let R=t.wasmclient_submit_browser_desired_peers_with_sparse_fanout(this.__wbg_ptr,e,a,w,l,f,m,h,y,v,x(s)?16777215:s?1:0);return p(R)}ticket_mesh_issuer_node(e){let n,_;try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_ticket_mesh_issuer_node(f,this.__wbg_ptr,m,h);var r=b().getInt32(f+0,!0),o=b().getInt32(f+4,!0),s=b().getInt32(f+8,!0),a=b().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,F(w,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(n,_,1);}}ticket_mesh_peers(e){let n=c(e,t.__wbindgen_export,t.__wbindgen_export2),_=i,r=t.wasmclient_ticket_mesh_peers(this.__wbg_ptr,n,_);return p(r)}update_device(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i;var f=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i,h=x(o)?0:c(o,t.__wbindgen_export,t.__wbindgen_export2),y=i;let v=t.wasmclient_update_device(this.__wbg_ptr,s,a,w,l,f,m,x(r)?0:u(r),h,y);return p(v)}update_presence(e,n,_,r,o){let s=c(e,t.__wbindgen_export,t.__wbindgen_export2),a=i,w=c(n,t.__wbindgen_export,t.__wbindgen_export2),l=i,f=c(_,t.__wbindgen_export,t.__wbindgen_export2),m=i;var h=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),y=i;let v=t.wasmclient_update_presence(this.__wbg_ptr,s,a,w,l,f,m,h,y,!x(o),x(o)?BigInt(0):o);return p(v)}update_session(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=c(n,t.__wbindgen_export,t.__wbindgen_export2),s=i,a=t.wasmclient_update_session(this.__wbg_ptr,_,r,o,s);return p(a)}validate_connection_token(e,n,_){let r=c(e,t.__wbindgen_export,t.__wbindgen_export2),o=i,s=c(n,t.__wbindgen_export,t.__wbindgen_export2),a=i;var w=x(_)?0:c(_,t.__wbindgen_export,t.__wbindgen_export2),l=i;let f=t.wasmclient_validate_connection_token(this.__wbg_ptr,r,o,s,a,w,l);return p(f)}validate_session_token(e){let n,_;try{let f=t.__wbindgen_add_to_stack_pointer(-16),m=c(e,t.__wbindgen_export,t.__wbindgen_export2),h=i;t.wasmclient_validate_session_token(f,this.__wbg_ptr,m,h);var r=b().getInt32(f+0,!0),o=b().getInt32(f+4,!0),s=b().getInt32(f+8,!0),a=b().getInt32(f+12,!0),w=r,l=o;if(a)throw w=0,l=0,p(s);return n=w,_=l,F(w,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export4(n,_,1);}}wait_for_peer(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_wait_for_peer(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wait_for_settled_scope(e,n){let _=c(e,t.__wbindgen_export,t.__wbindgen_export2),r=i,o=t.wasmclient_wait_for_settled_scope(this.__wbg_ptr,_,r,x(n)?Number.MAX_SAFE_INTEGER:n>>>0);return p(o)}wake_browser_auto_connect(){return t.wasmclient_wake_browser_auto_connect(this.__wbg_ptr)!==0}};Symbol.dispose&&(K.prototype[Symbol.dispose]=K.prototype.free);var V=class d{static __wrap(e){let n=Object.create(d.prototype);return n.__wbg_ptr=e,ot.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ot.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_wasmpeerdatagrampolicy_free(e,0);}close(){t.wasmpeerdatagrampolicy_close(this.__wbg_ptr);}closeIncoming(){t.wasmpeerdatagrampolicy_closeIncoming(this.__wbg_ptr);}closeOutgoing(){t.wasmpeerdatagrampolicy_closeOutgoing(this.__wbg_ptr);}getStats(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_getStats(o,this.__wbg_ptr,e);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}popIncoming(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_popIncoming(r,this.__wbg_ptr,e);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);let o;return n!==0&&(o=C(n,_).slice(),t.__wbindgen_export4(n,_*1,1)),o}finally{t.__wbindgen_add_to_stack_pointer(16);}}popOutgoing(e){try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_popOutgoing(o,this.__wbg_ptr,e);var n=b().getInt32(o+0,!0),_=b().getInt32(o+4,!0),r=b().getInt32(o+8,!0);if(r)throw p(_);return p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}pushIncoming(e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16),s=k(e,t.__wbindgen_export),a=i;t.wasmpeerdatagrampolicy_pushIncoming(o,this.__wbg_ptr,s,a,n);var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}pushOutgoing(e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),a=k(e,t.__wbindgen_export),w=i;t.wasmpeerdatagrampolicy_pushOutgoing(s,this.__wbg_ptr,a,w,n);var _=b().getInt32(s+0,!0),r=b().getInt32(s+4,!0),o=b().getInt32(s+8,!0);if(o)throw p(r);return _!==0}finally{t.__wbindgen_add_to_stack_pointer(16);}}recordExpiredOutgoing(){t.wasmpeerdatagrampolicy_recordExpiredOutgoing(this.__wbg_ptr);}recordSendFailure(){t.wasmpeerdatagrampolicy_recordSendFailure(this.__wbg_ptr);}recordSent(e){t.wasmpeerdatagrampolicy_recordSent(this.__wbg_ptr,e);}setIncomingMaxAge(e,n){t.wasmpeerdatagrampolicy_setIncomingMaxAge(this.__wbg_ptr,x(e)?Number.MAX_SAFE_INTEGER:e>>>0,n);}setIncomingMaxBufferedDatagrams(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_setIncomingMaxBufferedDatagrams(r,this.__wbg_ptr,e);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}setOutgoingMaxAge(e){t.wasmpeerdatagrampolicy_setOutgoingMaxAge(this.__wbg_ptr,x(e)?Number.MAX_SAFE_INTEGER:e>>>0);}setOutgoingMaxBufferedDatagrams(e){try{let r=t.__wbindgen_add_to_stack_pointer(-16);t.wasmpeerdatagrampolicy_setOutgoingMaxBufferedDatagrams(r,this.__wbg_ptr,e);var n=b().getInt32(r+0,!0),_=b().getInt32(r+4,!0);if(_)throw p(n)}finally{t.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);function Bt(){t.start();}function st(){return {__proto__:null,"./openrtc_bg.js":{__proto__:null,__wbg_Error_9dc85fe1bc224456:function(e,n){let _=Error(F(e,n));return u(_)},__wbg_Number_4779d427bae39753:function(e){return Number(g(e))},__wbg_String_8564e559799eccda:function(e,n){let _=String(g(n)),r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg___wbindgen_bigint_get_as_i64_8ea6736501f396b6:function(e,n){let _=g(n),r=typeof _=="bigint"?_:void 0;b().setBigInt64(e+8,x(r)?BigInt(0):r,true),b().setInt32(e+0,!x(r),true);},__wbg___wbindgen_boolean_get_b131b2f36d6b2f55:function(e){let n=g(e),_=typeof n=="boolean"?n:void 0;return x(_)?16777215:_?1:0},__wbg___wbindgen_debug_string_56c147eb1a51f0c4:function(e,n){let _=Z(g(n)),r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg___wbindgen_in_ce8569b2fc6f5088:function(e,n){return g(e)in g(n)},__wbg___wbindgen_is_bigint_df272c65456269c2:function(e){return typeof g(e)=="bigint"},__wbg___wbindgen_is_function_147961669f068cd4:function(e){return typeof g(e)=="function"},__wbg___wbindgen_is_null_ced4761460071341:function(e){return g(e)===null},__wbg___wbindgen_is_object_3a2c414391dbf751:function(e){let n=g(e);return typeof n=="object"&&n!==null},__wbg___wbindgen_is_string_6541b0f6ecd4e8e5:function(e){return typeof g(e)=="string"},__wbg___wbindgen_is_undefined_4410e3c20a99fa97:function(e){return g(e)===void 0},__wbg___wbindgen_jsval_eq_174c93ec61bab0c5:function(e,n){return g(e)===g(n)},__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c:function(e,n){return g(e)==g(n)},__wbg___wbindgen_number_get_588ed6b97f0d7e14:function(e,n){let _=g(n),r=typeof _=="number"?_:void 0;b().setFloat64(e+8,x(r)?0:r,true),b().setInt32(e+0,!x(r),true);},__wbg___wbindgen_string_get_fa2687d531ed17a5:function(e,n){let _=g(n),r=typeof _=="string"?_:void 0;var o=x(r)?0:c(r,t.__wbindgen_export,t.__wbindgen_export2),s=i;b().setInt32(e+4,s,true),b().setInt32(e+0,o,true);},__wbg___wbindgen_throw_bbadd78c1bac3a77:function(e,n){throw new Error(F(e,n))},__wbg__wbg_cb_unref_c2301a3c9b78104b:function(e){g(e)._wbg_cb_unref();},__wbg_abort_56c00f462c9261d9:function(e,n){g(e).abort(g(n));},__wbg_abort_f2416f4a9852003e:function(e){g(e).abort();},__wbg_addEventListener_b635263c509aa7de:function(){return I(function(e,n,_,r){g(e).addEventListener(F(n,_),g(r));},arguments)},__wbg_append_c5a0c94a6a73b22e:function(){return I(function(e,n,_,r,o){g(e).append(F(n,_),F(r,o));},arguments)},__wbg_apply_5d99f956e2dda74d:function(){return I(function(e,n,_){let r=g(e).apply(g(n),g(_));return u(r)},arguments)},__wbg_arrayBuffer_cc7704fa158b907a:function(){return I(function(e){let n=g(e).arrayBuffer();return u(n)},arguments)},__wbg_bistream_new:function(e){let n=G.__wrap(e);return u(n)},__wbg_body_442a47f02322d7b0:function(e){let n=g(e).body;return x(n)?0:u(n)},__wbg_buffer_8524b3453cde4918:function(e){let n=g(e).buffer;return u(n)},__wbg_bufferedAmount_c1581bbb06f4f36c:function(e){return g(e).bufferedAmount},__wbg_byobRequest_cc72d210de793e64:function(e){let n=g(e).byobRequest;return x(n)?0:u(n)},__wbg_byteLength_96807b1d9ab24a4c:function(e){return g(e).byteLength},__wbg_byteOffset_a9c7002428843c41:function(e){return g(e).byteOffset},__wbg_call_91f00ddc43e01490:function(){return I(function(e,n){let _=g(e).call(g(n));return u(_)},arguments)},__wbg_call_ec09a4cf93377d3a:function(){return I(function(e,n,_){let r=g(e).call(g(n),g(_));return u(r)},arguments)},__wbg_cancel_f3a197b26dc88b39:function(e){let n=g(e).cancel();return u(n)},__wbg_catch_66060324c27be6f7:function(e,n){let _=g(e).catch(g(n));return u(_)},__wbg_clearTimeout_113b1cde814ec762:function(e){let n=clearTimeout(p(e));return u(n)},__wbg_clearTimeout_333bba87532ab9d3:function(e){let n=clearTimeout(p(e));return u(n)},__wbg_clearTimeout_47a40e3be01ed7a3:function(){return I(function(e,n){g(e).clearTimeout(p(n));},arguments)},__wbg_close_296263cfe1bb2999:function(){return I(function(e){g(e).close();},arguments)},__wbg_close_388d99468213b286:function(){return I(function(e){g(e).close();},arguments)},__wbg_close_4857e22d08b71356:function(){return I(function(e){g(e).close();},arguments)},__wbg_close_f3365df7ba1b74d3:function(e){g(e).close();},__wbg_code_1cda2855fcd9b009:function(e){return g(e).code},__wbg_code_70beb7b22374d55e:function(e){return g(e).code},__wbg_crypto_38df2bab126b63dc:function(e){let n=g(e).crypto;return u(n)},__wbg_data_8a04443c1e5a8cd3:function(e){let n=g(e).data;return u(n)},__wbg_debug_de823612d4d12f74:function(e){console.debug(g(e));},__wbg_dispatchEvent_cc62a6a43d28b01c:function(){return I(function(e,n){return g(e).dispatchEvent(g(n))},arguments)},__wbg_done_6a8439e544ec6206:function(e){return g(e).done},__wbg_enqueue_bbeb09ba0b140f76:function(){return I(function(e,n){g(e).enqueue(g(n));},arguments)},__wbg_entries_4e00eefd3fd54cf1:function(e){let n=g(e).entries();return u(n)},__wbg_entries_5a6a7e7e0df09fe5:function(e){let n=Object.entries(g(e));return u(n)},__wbg_error_6651fee1c71e5da9:function(e){console.error(g(e));},__wbg_error_9a99766f65a03031:function(e,n){console.error(g(e),g(n));},__wbg_error_a6fa202b58aa1cd3:function(e,n){let _,r;try{_=e,r=n,console.error(F(e,n));}finally{t.__wbindgen_export4(_,r,1);}},__wbg_fetch_074561c3e313c86f:function(e){let n=fetch(g(e));return u(n)},__wbg_fetch_22858a12fcf93152:function(e,n){let _=g(e).fetch(g(n));return u(_)},__wbg_from_8a57180716c586ee:function(e){let n=Array.from(g(e));return u(n)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return I(function(e,n){g(e).getRandomValues(g(n));},arguments)},__wbg_getRandomValues_cc7f052a444bb2ce:function(){return I(function(e,n){globalThis.crypto.getRandomValues(C(e,n));},arguments)},__wbg_getReader_9facd4f899beac89:function(){return I(function(e){let n=g(e).getReader();return u(n)},arguments)},__wbg_get_44e98e27bda25b5b:function(){return I(function(e,n){let _=Reflect.get(g(e),g(n));return u(_)},arguments)},__wbg_get_4b90d6d8c5deb5d5:function(e,n){let _=g(e)[n>>>0];return u(_)},__wbg_get_52a8a619f7b88df6:function(){return I(function(e,n){let _=Reflect.get(g(e),g(n));return u(_)},arguments)},__wbg_get_done_c21b9933fc9a9e9c:function(e){let n=g(e).done;return x(n)?16777215:n?1:0},__wbg_get_unchecked_46e778e3cec74b5e:function(e,n){let _=g(e)[n>>>0];return u(_)},__wbg_get_value_ad568c7d3db9073f:function(e){let n=g(e).value;return u(n)},__wbg_get_with_ref_key_6412cf3094599694:function(e,n){let _=g(e)[g(n)];return u(_)},__wbg_has_14676d88c1340d2c:function(){return I(function(e,n){return Reflect.has(g(e),g(n))},arguments)},__wbg_headers_5b19cf40627ae54d:function(e){let n=g(e).headers;return u(n)},__wbg_info_a2b5f8a5dae8b26c:function(e){console.info(g(e));},__wbg_instanceof_ArrayBuffer_a581da923203f29f:function(e){let n;try{n=g(e)instanceof ArrayBuffer;}catch{n=false;}return n},__wbg_instanceof_Blob_5c4e145be35f9b1e:function(e){let n;try{n=g(e)instanceof Blob;}catch{n=false;}return n},__wbg_instanceof_Map_7f94c740225003e2:function(e){let n;try{n=g(e)instanceof Map;}catch{n=false;}return n},__wbg_instanceof_Promise_aa24ea31000d4ee6:function(e){let n;try{n=g(e)instanceof Promise;}catch{n=false;}return n},__wbg_instanceof_Response_36a65a969abaa7c6:function(e){let n;try{n=g(e)instanceof Response;}catch{n=false;}return n},__wbg_instanceof_Uint8Array_b6fe1ac89eba107e:function(e){let n;try{n=g(e)instanceof Uint8Array;}catch{n=false;}return n},__wbg_instanceof_Window_9e0fe7d3d1ff4342:function(e){let n;try{n=g(e)instanceof Window;}catch{n=false;}return n},__wbg_isArray_139f48e3c057ede8:function(e){return Array.isArray(g(e))},__wbg_isSafeInteger_c22ccb4af2201fe9:function(e){return Number.isSafeInteger(g(e))},__wbg_iterator_9b36cebf3be7b7cd:function(){return u(Symbol.iterator)},__wbg_length_68a9d5278d084f4f:function(e){return g(e).length},__wbg_length_fb04d16d7bdf6d4c:function(e){return g(e).length},__wbg_log_6614a4effdb4e983:function(e){console.log(g(e));},__wbg_maxRetransmits_dfa0382c31f8e2ca:function(e){let n=g(e).maxRetransmits;return x(n)?16777215:n},__wbg_message_12958526424a887b:function(e,n){let _=g(n).message,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_msCrypto_bd5a034af96bcba6:function(e){let n=g(e).msCrypto;return u(n)},__wbg_new_0b303268aa395a38:function(){let e=new Array;return u(e)},__wbg_new_189262ff31890c23:function(){return I(function(){let e=new Headers;return u(e)},arguments)},__wbg_new_20b778a4c5c691c3:function(){let e=new Object;return u(e)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return u(e)},__wbg_new_24739629d416f982:function(){return I(function(){let e=new AbortController;return u(e)},arguments)},__wbg_new_5fae30e6b23db8df:function(e,n){let _=new Error(F(e,n));return u(_)},__wbg_new_883c0db065f06efd:function(){return u(new Map)},__wbg_new_a3e5112401a82338:function(){return I(function(e,n){let _=new WebSocket(F(e,n));return u(_)},arguments)},__wbg_new_b06772b280cc6e52:function(e){let n=new Uint8Array(g(e));return u(n)},__wbg_new_from_slice_bb2d1778c0b87eb1:function(e,n){let _=new Uint8Array(C(e,n));return u(_)},__wbg_new_typed_90c3f6c29ba36d19:function(e,n){try{var _={a:e,b:n},r=(s,a)=>{let w=_.a;_.a=0;try{return xt(w,_.b,s,a)}finally{_.a=w;}};let o=new Promise(r);return u(o)}finally{_.a=0;}},__wbg_new_with_byte_offset_and_length_9e1e664fe1a5d385:function(e,n,_){let r=new Uint8Array(g(e),n>>>0,_>>>0);return u(r)},__wbg_new_with_event_init_dict_bd850674488710b1:function(){return I(function(e,n,_){let r=new CustomEvent(F(e,n),g(_));return u(r)},arguments)},__wbg_new_with_into_underlying_sink_2596343f9b6c8e58:function(e){let n=new WritableStream(L.__wrap(e));return u(n)},__wbg_new_with_into_underlying_source_fd904252f385f59c:function(e,n){let _=new ReadableStream(U.__wrap(e),p(n));return u(_)},__wbg_new_with_length_4b57a7a5dc67221c:function(e){let n=new Uint8Array(e>>>0);return u(n)},__wbg_new_with_str_and_init_df876572184fe639:function(){return I(function(e,n,_){let r=new Request(F(e,n),g(_));return u(r)},arguments)},__wbg_new_with_str_sequence_505a4829cc247e79:function(){return I(function(e,n,_){let r=new WebSocket(F(e,n),g(_));return u(r)},arguments)},__wbg_next_8cb028b6ba50743f:function(){return I(function(e){let n=g(e).next();return u(n)},arguments)},__wbg_next_cfd0b146c9538df8:function(e){let n=g(e).next;return u(n)},__wbg_node_84ea875411254db1:function(e){let n=g(e).node;return u(n)},__wbg_now_bce4dc999095ea77:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(e){return g(e).now()},__wbg_parse_a5c06e19bc1187fd:function(e,n){return Date.parse(F(e,n))},__wbg_peerunistream_new:function(e){let n=X.__wrap(e);return u(n)},__wbg_performance_3fcf6e32a7e1ed0a:function(e){let n=g(e).performance;return u(n)},__wbg_process_44c7a14e11e9f69e:function(e){let n=g(e).process;return u(n)},__wbg_protocol_28aaef5ea42981d6:function(e,n){let _=g(n).protocol,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_prototypesetcall_956c7493c68e29b4:function(e,n,_){Uint8Array.prototype.set.call(C(e,n),g(_));},__wbg_push_ceb8ef046afb2041:function(e,n){return g(e).push(g(n))},__wbg_queueMicrotask_4698f900840e3286:function(e){queueMicrotask(g(e));},__wbg_queueMicrotask_477a5533c7100338:function(e){let n=g(e).queueMicrotask;return u(n)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return I(function(e,n){g(e).randomFillSync(p(n));},arguments)},__wbg_read_8426c146431f2905:function(e){let n=g(e).read();return u(n)},__wbg_readyState_25243ad6ce649774:function(e){return g(e).readyState},__wbg_reason_4ec455bac79b33ce:function(e,n){let _=g(n).reason,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_releaseLock_188846ef719acb10:function(e){g(e).releaseLock();},__wbg_removeEventListener_016c1d24523b4730:function(){return I(function(e,n,_,r){g(e).removeEventListener(F(n,_),g(r));},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return I(function(){let e=module.require;return u(e)},arguments)},__wbg_resolve_0183de2e8c6b1d54:function(e){let n=Promise.resolve(g(e));return u(n)},__wbg_respond_3cdb4cf32683fd79:function(){return I(function(e,n){g(e).respond(n>>>0);},arguments)},__wbg_send_77521d09456dd693:function(){return I(function(e,n,_){g(e).send(C(n,_));},arguments)},__wbg_send_99d049cae69c53cc:function(){return I(function(e,n,_){g(e).send(C(n,_));},arguments)},__wbg_send_bac9d3dc4f21ef28:function(){return I(function(e,n,_){g(e).send(F(n,_));},arguments)},__wbg_setTimeout_3a808dd861dd3c12:function(e,n){let _=setTimeout(g(e),n);return u(_)},__wbg_setTimeout_6613a51400c1bf9f:function(){return I(function(e,n,_){let r=g(e).setTimeout(p(n),_);return u(r)},arguments)},__wbg_setTimeout_ef24d2fc3ad97385:function(){return I(function(e,n){let _=setTimeout(g(e),n);return u(_)},arguments)},__wbg_set_5f806304fb633ab3:function(e,n,_){let r=g(e).set(g(n),g(_));return u(r)},__wbg_set_6be42768c690e380:function(e,n,_){g(e)[p(n)]=p(_);},__wbg_set_86698c227e5b9dad:function(e,n,_){g(e).set(C(n,_));},__wbg_set_a6ba3ac0e634b822:function(){return I(function(e,n,_){return Reflect.set(g(e),g(n),g(_))},arguments)},__wbg_set_binaryType_07905e4563fcd9b2:function(e,n){g(e).binaryType=kt[n];},__wbg_set_binaryType_8c2dd2cf1cfc2e28:function(e,n){g(e).binaryType=mt[n];},__wbg_set_body_d1153b16a2b95ca1:function(e,n){g(e).body=g(n);},__wbg_set_bufferedAmountLowThreshold_8969a2db2c745257:function(e,n){g(e).bufferedAmountLowThreshold=n>>>0;},__wbg_set_cache_5a01a8b5e6ca6cf2:function(e,n){g(e).cache=yt[n];},__wbg_set_credentials_e9120ed88b1fc0b8:function(e,n){g(e).credentials=vt[n];},__wbg_set_da33c120a6584674:function(e,n,_){g(e)[n>>>0]=p(_);},__wbg_set_detail_c7af5edea934390b:function(e,n){g(e).detail=g(n);},__wbg_set_handle_event_6147c38b782c7b42:function(e,n){g(e).handleEvent=g(n);},__wbg_set_headers_877ed41890d28af2:function(e,n){g(e).headers=g(n);},__wbg_set_high_water_mark_77da20c49668427d:function(e,n){g(e).highWaterMark=n;},__wbg_set_method_b4ede299b2064f37:function(e,n,_){g(e).method=F(n,_);},__wbg_set_mode_d6c2e1991aa963c6:function(e,n){g(e).mode=It[n];},__wbg_set_onbufferedamountlow_b695487bdd219f98:function(e,n){g(e).onbufferedamountlow=g(n);},__wbg_set_onclose_9cb5c3372e16c192:function(e,n){g(e).onclose=g(n);},__wbg_set_onclose_f8bec1cbeb64aa93:function(e,n){g(e).onclose=g(n);},__wbg_set_onerror_190fe67e911ebf28:function(e,n){g(e).onerror=g(n);},__wbg_set_onmessage_4d57c4ddab951294:function(e,n){g(e).onmessage=g(n);},__wbg_set_onmessage_96337495f0bfb796:function(e,n){g(e).onmessage=g(n);},__wbg_set_onopen_3e2bf6b11d434c2d:function(e,n){g(e).onopen=g(n);},__wbg_set_signal_9022b5aa06a6ce5b:function(e,n){g(e).signal=g(n);},__wbg_signal_41dd1a8913cd0b7d:function(e){let n=g(e).signal;return u(n)},__wbg_stack_3b0d974bbf31e44f:function(e,n){let _=g(n).stack,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_static_accessor_GLOBAL_60a4124bab7dcc9a:function(){let e=typeof global>"u"?null:global;return x(e)?0:u(e)},__wbg_static_accessor_GLOBAL_THIS_95ca6460658b5d13:function(){let e=typeof globalThis>"u"?null:globalThis;return x(e)?0:u(e)},__wbg_static_accessor_SELF_4c95f759a91e9aae:function(){let e=typeof self>"u"?null:self;return x(e)?0:u(e)},__wbg_static_accessor_WINDOW_44b435597f9e9ee7:function(){let e=typeof window>"u"?null:window;return x(e)?0:u(e)},__wbg_status_9e6505cfa3e73a7c:function(e){return g(e).status},__wbg_subarray_42216645a367cd7a:function(e,n,_){let r=g(e).subarray(n>>>0,_>>>0);return u(r)},__wbg_then_254bab9b266a77a5:function(e,n,_){let r=g(e).then(g(n),g(_));return u(r)},__wbg_then_3ea18602c6a5123b:function(e,n){let _=g(e).then(g(n));return u(_)},__wbg_url_72c67c175685a054:function(e,n){let _=g(n).url,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_url_d0b8042af0d1bbba:function(e,n){let _=g(n).url,r=c(_,t.__wbindgen_export,t.__wbindgen_export2),o=i;b().setInt32(e+4,o,true),b().setInt32(e+0,r,true);},__wbg_value_3d3defe09fb1ffca:function(e){let n=g(e).value;return u(n)},__wbg_versions_276b2795b1c6a219:function(e){let n=g(e).versions;return u(n)},__wbg_view_15fa5865c6b336e3:function(e){let n=g(e).view;return x(n)?0:u(n)},__wbg_warn_633bacc13ba7e6c3:function(e){console.warn(g(e));},__wbg_wasClean_f17429d064911939:function(e){return g(e).wasClean},__wbindgen_cast_0000000000000001:function(e,n){let _=B(e,n,dt);return u(_)},__wbindgen_cast_0000000000000002:function(e,n){let _=B(e,n,ft);return u(_)},__wbindgen_cast_0000000000000003:function(e,n){let _=B(e,n,wt);return u(_)},__wbindgen_cast_0000000000000004:function(e,n){let _=B(e,n,ut);return u(_)},__wbindgen_cast_0000000000000005:function(e,n){let _=B(e,n,lt);return u(_)},__wbindgen_cast_0000000000000006:function(e,n){let _=B(e,n,at);return u(_)},__wbindgen_cast_0000000000000007:function(e,n){let _=B(e,n,pt);return u(_)},__wbindgen_cast_0000000000000008:function(e,n){let _=St(e,n,gt);return u(_)},__wbindgen_cast_0000000000000009:function(e,n){let _=B(e,n,bt);return u(_)},__wbindgen_cast_000000000000000a:function(e){return u(e)},__wbindgen_cast_000000000000000b:function(e){return u(e)},__wbindgen_cast_000000000000000c:function(e,n){let _=C(e,n);return u(_)},__wbindgen_cast_000000000000000d:function(e,n){let _=F(e,n);return u(_)},__wbindgen_cast_000000000000000e:function(e){let n=BigInt.asUintN(64,e);return u(n)},__wbindgen_cast_000000000000000f:function(e,n){var _=C(e,n).slice();return t.__wbindgen_export4(e,n*1,1),u(_)},__wbindgen_object_clone_ref:function(e){let n=g(e);return u(n)},__wbindgen_object_drop_ref:function(e){p(e);}}}}function at(d,e){t.__wasm_bindgen_func_elem_30101(d,e);}function pt(d,e){t.__wasm_bindgen_func_elem_31236(d,e);}function gt(d,e){t.__wasm_bindgen_func_elem_31308(d,e);}function bt(d,e){t.__wasm_bindgen_func_elem_39370(d,e);}function dt(d,e,n){t.__wasm_bindgen_func_elem_30304(d,e,u(n));}function wt(d,e,n){t.__wasm_bindgen_func_elem_27662(d,e,u(n));}function ut(d,e,n){t.__wasm_bindgen_func_elem_6447(d,e,u(n));}function lt(d,e,n){t.__wasm_bindgen_func_elem_32015(d,e,u(n));}function ft(d,e,n){try{let o=t.__wbindgen_add_to_stack_pointer(-16);t.__wasm_bindgen_func_elem_40879(o,d,e,u(n));var _=b().getInt32(o+0,!0),r=b().getInt32(o+4,!0);if(r)throw p(_)}finally{t.__wbindgen_add_to_stack_pointer(16);}}function xt(d,e,n,_){t.__wasm_bindgen_func_elem_40881(d,e,u(n),u(_));}var mt=["blob","arraybuffer"],ht=["bytes"],yt=["default","no-store","reload","no-cache","force-cache","only-if-cached"],vt=["omit","same-origin","include"],It=["same-origin","no-cors","cors","navigate"],kt=["arraybuffer","blob"],tt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_bistream_free(d,1)),Rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_intounderlyingbytesource_free(d,1)),et=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_intounderlyingsink_free(d,1)),nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_intounderlyingsource_free(d,1)),_t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_peerunistream_free(d,1)),rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_wasmclient_free(d,1)),ot=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbg_wasmpeerdatagrampolicy_free(d,1));function u(d){D===E.length&&E.push(E.length+1);let e=D;return D=E[e],E[e]=d,e}var J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>t.__wbindgen_export5(d.a,d.b));function Z(d){let e=typeof d;if(e=="number"||e=="boolean"||d==null)return `${d}`;if(e=="string")return `"${d}"`;if(e=="symbol"){let r=d.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=d.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(d)){let r=d.length,o="[";r>0&&(o+=Z(d[0]));for(let s=1;s<r;s++)o+=", "+Z(d[s]);return o+="]",o}let n=/\[object ([^\]]+)\]/.exec(toString.call(d)),_;if(n&&n.length>1)_=n[1];else return toString.call(d);if(_=="Object")try{return "Object("+JSON.stringify(d)+")"}catch{return "Object"}return d instanceof Error?`${d.name}: ${d.message}
2
2
  ${d.stack}`:_}function At(d){d<1028||(E[d]=D,D=d);}function Ft(d,e){d=d>>>0;let n=b(),_=[];for(let r=d;r<d+4*e;r+=4)_.push(p(n.getUint32(r,true)));return _}function C(d,e){return d=d>>>0,W().subarray(d/1,d/1+e)}var j=null;function b(){return (j===null||j.buffer.detached===true||j.buffer.detached===void 0&&j.buffer!==t.memory.buffer)&&(j=new DataView(t.memory.buffer)),j}function F(d,e){return Pt(d>>>0,e)}var q=null;function W(){return (q===null||q.byteLength===0)&&(q=new Uint8Array(t.memory.buffer)),q}function g(d){return E[d]}function I(d,e){try{return d.apply(this,e)}catch(n){t.__wbindgen_export3(u(n));}}var E=new Array(1024).fill(void 0);E.push(void 0,null,true,false);var D=E.length;function x(d){return d==null}function St(d,e,n){let _={a:d,b:e,cnt:1},r=(...o)=>{_.cnt++;try{return n(_.a,_.b,...o)}finally{r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(t.__wbindgen_export5(_.a,_.b),_.a=0,J.unregister(_));},J.register(r,_,_),r}function B(d,e,n){let _={a:d,b:e,cnt:1},r=(...o)=>{_.cnt++;let s=_.a;_.a=0;try{return n(s,_.b,...o)}finally{_.a=s,r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(t.__wbindgen_export5(_.a,_.b),_.a=0,J.unregister(_));},J.register(r,_,_),r}function k(d,e){let n=e(d.length*1,1)>>>0;return W().set(d,n/1),i=d.length,n}function it(d,e){let n=e(d.length*4,4)>>>0,_=b();for(let r=0;r<d.length;r++)_.setUint32(n+4*r,u(d[r]),true);return i=d.length,n}function c(d,e,n){if(n===void 0){let a=z.encode(d),w=e(a.length,1)>>>0;return W().subarray(w,w+a.length).set(a),i=a.length,w}let _=d.length,r=e(_,1)>>>0,o=W(),s=0;for(;s<_;s++){let a=d.charCodeAt(s);if(a>127)break;o[r+s]=a;}if(s!==_){s!==0&&(d=d.slice(s)),r=n(r,_,_=s+d.length*3,1)>>>0;let a=W().subarray(r+s,r+_),w=z.encodeInto(d,a);s+=w.written,r=n(r,_,s,1)>>>0;}return i=s,r}function p(d){let e=g(d);return At(d),e}var H=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});H.decode();var Ct=2146435072,Y=0;function Pt(d,e){return Y+=e,Y>=Ct&&(H=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),H.decode(),Y=e),H.decode(W().subarray(d,d+e))}var z=new TextEncoder;"encodeInto"in z||(z.encodeInto=function(d,e){let n=z.encode(d);return e.set(n),{read:d.length,written:n.length}});var i=0,t;function ct(d,e){return t=d.exports,j=null,q=null,t.__wbindgen_start(),t}async function Et(d,e){if(typeof Response=="function"&&d instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(d,e)}catch(r){if(d.ok&&n(d.type)&&d.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 d.arrayBuffer();return await WebAssembly.instantiate(_,e)}else {let _=await WebAssembly.instantiate(d,e);return _ instanceof WebAssembly.Instance?{instance:_,module:d}:_}function n(_){switch(_){case "basic":case "cors":case "default":return true}return false}}function Tt(d){if(t!==void 0)return t;d!==void 0&&(Object.getPrototypeOf(d)===Object.prototype?{module:d}=d:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=st();d instanceof WebAssembly.Module||(d=new WebAssembly.Module(d));let n=new WebAssembly.Instance(d,e);return ct(n)}async function Nt(d){if(t!==void 0)return t;d!==void 0&&(Object.getPrototypeOf(d)===Object.prototype?{module_or_path:d}=d:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),d===void 0&&(d=new URL("openrtc_bg.wasm",import.meta.url));let e=st();(typeof d=="string"||typeof Request=="function"&&d instanceof Request||typeof URL=="function"&&d instanceof URL)&&(d=fetch(d));let{instance:n,module:_}=await Et(await d,e);return ct(n)}export{G as BiStream,$ as IntoUnderlyingByteSource,L as IntoUnderlyingSink,U as IntoUnderlyingSource,X as PeerUniStream,K as WasmClient,V as WasmPeerDatagramPolicy,Nt as default,Tt as initSync,Bt as start};
Binary file
@@ -1 +1 @@
1
- import {h,e,g,f}from'./chunk-TWIZQT6M.js';import {b}from'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function M(t){let e=t.architecture??(t.advancedFanout===true?"sparse":"auto");if(t.advancedFanout===true&&e!=="sparse")throw new Error("[OpenRTC] advancedFanout conflicts with architecture; use architecture: sparse only.");return {architecture:e,delivery:t.payload??(t.advancedFanout===true?"latest-state":"reliable")}}var R=class{constructor(e){this.mode=e==="sparse"?"sparse":"direct";}create(e){return new w(e,()=>this.mode)}setArchitecture(e){e.phase==="settled"&&(this.mode=e.effective==="sparse"?"sparse":e.effective==="managed"?"managed":"direct");}},w=class{constructor(e,r){this.host=e;this.mode=r;this.sparseForwardQueue=[];this.sparseForwardRunning=false;this.sparseForwardQueueDropsPending=0;this.sparseForwardDropReport=null;this.closed=false;let i=e.client.advanced.runtime.onManagedRoomMessage;this.stopManagedMessage=typeof i=="function"?i.call(e.client.advanced.runtime,a=>{e.deliver(a.senderId,a.payload,a.channel);}):()=>{};}isSparse(){return this.mode()==="sparse"}publishState(e,r){return this.mode()!=="managed"?false:(this.publishManaged(e,r).catch(()=>{}),true)}async sendChannel(e,r){let i=this.mode();if(i==="managed")return await this.publishManaged(e,r),true;if(i!=="sparse")return false;let a=this.host.connections();if(a.length===0)return true;let o=await this.host.client.advanced.runtime.encodeSparseFanoutMessage(this.host.capabilityKey,r);return await Promise.all(a.map(n=>n.send(o))),true}assertTargetedSendAllowed(){if(this.mode()==="managed")throw new Error("[OpenRTC] Targeted messages are not available in managed fanout rooms; use authority mode for targeted request semantics.")}receive(e,r,i){return this.mode()!=="sparse"?false:(i instanceof Uint8Array&&this.receiveSparseBroadcast(e,r,i),true)}close(){this.closed||(this.closed=true,this.stopManagedMessage(),this.sparseForwardQueue.length=0);}publishManaged(e,r){return this.host.client.advanced.runtime.publishManagedRoomMessage({messageId:crypto.randomUUID(),channel:e,priority:1,payload:r})}async receiveSparseBroadcast(e,r,i){let a;try{a=await this.host.client.advanced.runtime.acceptSparseFanoutMessage(this.host.capabilityKey,r,i);}catch{return}if(a.forward){let o=Number.isSafeInteger(a.forwardPeerLimit)&&a.forwardPeerLimit>0?a.forwardPeerLimit:0,n=Number.isSafeInteger(a.forwardQueueCapacity)&&a.forwardQueueCapacity>0?Math.min(a.forwardQueueCapacity,64):0,c=new Set(Array.isArray(a.forwardPeerIds)?a.forwardPeerIds.slice(0,o):[]),s=this.host.connections().filter(u=>u.id!==e.id).filter(u=>c.has(u.remoteNodeId)).slice(0,o);this.enqueueSparseForward(a.forward,s,n);}this.host.deliver(a.authorDeviceId,a.payload);}enqueueSparseForward(e,r,i){if(i===0||r.length===0||this.closed)return;if(this.sparseForwardQueue.length+(this.sparseForwardRunning?1:0)>=i){this.sparseForwardQueueDropsPending+=1,this.flushSparseForwardDropReport();return}this.sparseForwardQueue.push({payload:e,targets:r}),this.sparseForwardRunning||this.drainSparseForwardQueue();}async drainSparseForwardQueue(){if(!this.sparseForwardRunning){this.sparseForwardRunning=true;try{for(;!this.closed;){let e=this.sparseForwardQueue.shift();if(!e)break;await Promise.allSettled(e.targets.map(r=>r.send(e.payload)));}}finally{this.sparseForwardRunning=false,!this.closed&&this.sparseForwardQueue.length>0&&this.drainSparseForwardQueue();}}}flushSparseForwardDropReport(){if(this.sparseForwardDropReport||this.sparseForwardQueueDropsPending===0)return;let e=this.sparseForwardQueueDropsPending;this.sparseForwardQueueDropsPending=0,this.sparseForwardDropReport=this.host.client.advanced.runtime.recordSparseFanoutForwardQueueDrop(this.host.capabilityKey,e).catch(()=>{}).finally(()=>{this.sparseForwardDropReport=null,this.flushSparseForwardDropReport();});}},y=class extends h{constructor(r,i,a,o,n,c="auto"){let s=new R(c);super("room",r,i,a,s);this.membership=o;this.onLeave=n;this.kind="room";this.left=false;this.architectureListeners=new Set;this.authorityAssignmentSnapshot=null;this.authorityAssignmentListeners=new Set;this.architectureSnapshot=x(c);let u=i.advanced.runtime.onRoomArchitectureChange;this.stopArchitecture=typeof u=="function"?u.call(i.advanced.runtime,d=>{if(!(d.epoch<this.architectureSnapshot.epoch)){this.architectureSnapshot=Object.freeze({...d}),this.setArchitecture(d);for(let l of this.architectureListeners)l(this.architectureSnapshot);}}):()=>{};let h=i.advanced.runtime.onRoomAuthorityAssignmentChange;this.stopAuthorityAssignment=typeof h=="function"?h.call(i.advanced.runtime,d=>{this.authorityAssignmentSnapshot=d?O(d):null;for(let l of this.authorityAssignmentListeners)l(S(this.authorityAssignmentSnapshot));}):()=>{};}architecture(){return {...this.architectureSnapshot}}onArchitectureChanged(r){return this.architectureListeners.add(r),r(this.architecture()),()=>this.architectureListeners.delete(r)}authorityAssignment(){return S(this.authorityAssignmentSnapshot)}onAuthorityAssignmentChanged(r){return this.authorityAssignmentListeners.add(r),r(this.authorityAssignment()),()=>this.authorityAssignmentListeners.delete(r)}async leave(){this.left||(this.left=true,await this.onLeave?.()),await this.close();}async close(){this.stopArchitecture(),this.stopAuthorityAssignment(),this.architectureListeners.clear(),this.authorityAssignmentListeners.clear(),await super.close();}};async function L(t,e$1,r){t.assertOpen();let i=e(e$1),a=r.access??"capability",{architecture:o,delivery:n}=M(r);return t.activateOnce(`room:${i}`,JSON.stringify({access:a,membership:r.membership??"ephemeral",identity:r.identity??null,maxPeers:r.maxPeers??null,payload:n,architecture:o,advancedFanout:r.advancedFanout===true}),a==="authenticated"?r.auth??t.options.auth:void 0,()=>D(t,i,r,o,n))}async function D(t,e,r,i,a){let o=r.membership??"ephemeral",n=r.access??"capability";if(i==="sparse"&&a!=="latest-state")throw new Error("[OpenRTC] Sparse rooms require payload: latest-state.");if(o==="durable"&&n!=="authenticated")throw new Error("[OpenRTC] Durable room membership requires access: authenticated.");if(r.identity==="session"&&n!=="capability")throw new Error("[OpenRTC] Session room identity requires access: capability.");if(n==="authenticated"){let l=r.auth??t.options.auth;if(!l)throw new Error("[OpenRTC] Authenticated rooms require an auth provider.");let A=await t.deviceId(),v=await t.controlPlane(),m=await v.deviceCertificate(l,A,{kind:"room",id:e});o==="durable"&&await v.durableRoomMembership(m.source,e,"join");let f;try{f=await t.activate({kind:"room",id:e,source:m.source,principalId:m.principalId,deviceId:A,maxPeers:r.maxPeers,autoConnect:!0,durableMembership:o==="durable",advancedFanout:r.advancedFanout,architecture:i,defaultDelivery:a});}catch(I){throw o==="durable"&&await v.durableRoomMembership(m.source,e,"leave").catch(()=>{}),I}let g;return g=new y(e,f,()=>{t.channels.detach(f),t.onClosed(g);},o,o==="durable"?async()=>{await v.durableRoomMembership(m.source,e,"leave");}:void 0,i),t.trackHandle(g)}let c=await(r.identity==="session"?t.sessionPlane():t.controlPlane()),s=await c.capability("room",e,r.maxPeers,r.advancedFanout,i,a),u=String(b(s.token).principalId),h=await t.activate({kind:"room",id:e,source:s,principalId:u,deviceId:g(s),maxPeers:r.maxPeers,autoConnect:true,advancedFanout:r.advancedFanout,architecture:i,defaultDelivery:a,controlPlane:c}),d;return d=new y(e,h,()=>{t.channels.detach(h),t.onClosed(d);},"ephemeral",void 0,i),t.trackHandle(d)}function T(t,e$1){t.assertOpen();let r=e(e$1.roomId),i=e(e$1.serviceId),a=f(e$1.deviceId);if(!Number.isSafeInteger(e$1.generation)||e$1.generation<1)throw new Error("[OpenRTC] Authority service generation is invalid.");let o=[...e$1.shardIds].map(e).sort();if(o.length<1||o.length>64||new Set(o).size!==o.length)throw new Error("[OpenRTC] Authority service shards are invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.devicePublicKeyX))throw new Error("[OpenRTC] Authority service device public key is invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.assignmentPublicKeyX))throw new Error("[OpenRTC] Authority assignment public key is invalid.");if(e$1.maxPeers!==void 0&&(!Number.isSafeInteger(e$1.maxPeers)||e$1.maxPeers<1||e$1.maxPeers>50))throw new Error("[OpenRTC] Authority service maxPeers must be within 1..50.");return t.activateOnce(`room:${r}`,JSON.stringify({architecture:"authority",serviceId:i,generation:e$1.generation,shardIds:o,deviceId:a,maxPeers:e$1.maxPeers??null,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSignerId:t.authorityCallableId(e$1.deviceSign),grantProviderId:t.authorityCallableId(e$1.grantProvider)}),void 0,async()=>{let n={type:"capability",token:"",avenue:{kind:"room",id:r},expiresAtMs:Number.MAX_SAFE_INTEGER,irohRelay:e$1.irohRelay,managedTurn:false},c=await t.activate({kind:"room",id:r,source:n,principalId:i,deviceId:a,maxPeers:e$1.maxPeers,autoConnect:true,architecture:"authority",defaultDelivery:"reliable",authority:{serviceId:i,generation:e$1.generation,shardIds:o,deviceId:a,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSign:e$1.deviceSign,grantProvider:e$1.grantProvider}}),s;return s=new y(r,c,()=>{t.channels.detach(c),t.onClosed(s);},"ephemeral",void 0,"authority"),t.trackHandle(s)})}function O(t){return Object.freeze({...t,priorityDeviceIds:Object.freeze([...t.priorityDeviceIds]),relevantEntityIds:Object.freeze([...t.relevantEntityIds])})}function S(t){return t?{...t,priorityDeviceIds:[...t.priorityDeviceIds],relevantEntityIds:[...t.relevantEntityIds]}:null}function x(t){return {requested:t,effective:t==="sparse"?"sparse":"mesh",epoch:0,phase:t==="mesh"||t==="sparse"?"settled":"preparing",reason:t==="auto"?"size":"manual",heldCreditsUsd:0,quoteExpiresAtMs:Date.now()+5*6e4}}export{y as RoomHandle,L as joinRoom,T as openAuthorityRoom,M as resolveRoomJoinOptions};
1
+ import {h,e,g,f}from'./chunk-IR5VXG3N.js';import {b}from'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function M(t){let e=t.architecture??(t.advancedFanout===true?"sparse":"auto");if(t.advancedFanout===true&&e!=="sparse")throw new Error("[OpenRTC] advancedFanout conflicts with architecture; use architecture: sparse only.");return {architecture:e,delivery:t.payload??(t.advancedFanout===true?"latest-state":"reliable")}}var R=class{constructor(e){this.mode=e==="sparse"?"sparse":"direct";}create(e){return new w(e,()=>this.mode)}setArchitecture(e){e.phase==="settled"&&(this.mode=e.effective==="sparse"?"sparse":e.effective==="managed"?"managed":"direct");}},w=class{constructor(e,r){this.host=e;this.mode=r;this.sparseForwardQueue=[];this.sparseForwardRunning=false;this.sparseForwardQueueDropsPending=0;this.sparseForwardDropReport=null;this.closed=false;let i=e.client.advanced.runtime.onManagedRoomMessage;this.stopManagedMessage=typeof i=="function"?i.call(e.client.advanced.runtime,a=>{e.deliver(a.senderId,a.payload,a.channel);}):()=>{};}isSparse(){return this.mode()==="sparse"}publishState(e,r){return this.mode()!=="managed"?false:(this.publishManaged(e,r).catch(()=>{}),true)}async sendChannel(e,r){let i=this.mode();if(i==="managed")return await this.publishManaged(e,r),true;if(i!=="sparse")return false;let a=this.host.connections();if(a.length===0)return true;let o=await this.host.client.advanced.runtime.encodeSparseFanoutMessage(this.host.capabilityKey,r);return await Promise.all(a.map(n=>n.send(o))),true}assertTargetedSendAllowed(){if(this.mode()==="managed")throw new Error("[OpenRTC] Targeted messages are not available in managed fanout rooms; use authority mode for targeted request semantics.")}receive(e,r,i){return this.mode()!=="sparse"?false:(i instanceof Uint8Array&&this.receiveSparseBroadcast(e,r,i),true)}close(){this.closed||(this.closed=true,this.stopManagedMessage(),this.sparseForwardQueue.length=0);}publishManaged(e,r){return this.host.client.advanced.runtime.publishManagedRoomMessage({messageId:crypto.randomUUID(),channel:e,priority:1,payload:r})}async receiveSparseBroadcast(e,r,i){let a;try{a=await this.host.client.advanced.runtime.acceptSparseFanoutMessage(this.host.capabilityKey,r,i);}catch{return}if(a.forward){let o=Number.isSafeInteger(a.forwardPeerLimit)&&a.forwardPeerLimit>0?a.forwardPeerLimit:0,n=Number.isSafeInteger(a.forwardQueueCapacity)&&a.forwardQueueCapacity>0?Math.min(a.forwardQueueCapacity,64):0,c=new Set(Array.isArray(a.forwardPeerIds)?a.forwardPeerIds.slice(0,o):[]),s=this.host.connections().filter(u=>u.id!==e.id).filter(u=>c.has(u.remoteNodeId)).slice(0,o);this.enqueueSparseForward(a.forward,s,n);}this.host.deliver(a.authorDeviceId,a.payload);}enqueueSparseForward(e,r,i){if(i===0||r.length===0||this.closed)return;if(this.sparseForwardQueue.length+(this.sparseForwardRunning?1:0)>=i){this.sparseForwardQueueDropsPending+=1,this.flushSparseForwardDropReport();return}this.sparseForwardQueue.push({payload:e,targets:r}),this.sparseForwardRunning||this.drainSparseForwardQueue();}async drainSparseForwardQueue(){if(!this.sparseForwardRunning){this.sparseForwardRunning=true;try{for(;!this.closed;){let e=this.sparseForwardQueue.shift();if(!e)break;await Promise.allSettled(e.targets.map(r=>r.send(e.payload)));}}finally{this.sparseForwardRunning=false,!this.closed&&this.sparseForwardQueue.length>0&&this.drainSparseForwardQueue();}}}flushSparseForwardDropReport(){if(this.sparseForwardDropReport||this.sparseForwardQueueDropsPending===0)return;let e=this.sparseForwardQueueDropsPending;this.sparseForwardQueueDropsPending=0,this.sparseForwardDropReport=this.host.client.advanced.runtime.recordSparseFanoutForwardQueueDrop(this.host.capabilityKey,e).catch(()=>{}).finally(()=>{this.sparseForwardDropReport=null,this.flushSparseForwardDropReport();});}},y=class extends h{constructor(r,i,a,o,n,c="auto"){let s=new R(c);super("room",r,i,a,s);this.membership=o;this.onLeave=n;this.kind="room";this.left=false;this.architectureListeners=new Set;this.authorityAssignmentSnapshot=null;this.authorityAssignmentListeners=new Set;this.architectureSnapshot=x(c);let u=i.advanced.runtime.onRoomArchitectureChange;this.stopArchitecture=typeof u=="function"?u.call(i.advanced.runtime,d=>{if(!(d.epoch<this.architectureSnapshot.epoch)){this.architectureSnapshot=Object.freeze({...d}),this.setArchitecture(d);for(let l of this.architectureListeners)l(this.architectureSnapshot);}}):()=>{};let h=i.advanced.runtime.onRoomAuthorityAssignmentChange;this.stopAuthorityAssignment=typeof h=="function"?h.call(i.advanced.runtime,d=>{this.authorityAssignmentSnapshot=d?O(d):null;for(let l of this.authorityAssignmentListeners)l(S(this.authorityAssignmentSnapshot));}):()=>{};}architecture(){return {...this.architectureSnapshot}}onArchitectureChanged(r){return this.architectureListeners.add(r),r(this.architecture()),()=>this.architectureListeners.delete(r)}authorityAssignment(){return S(this.authorityAssignmentSnapshot)}onAuthorityAssignmentChanged(r){return this.authorityAssignmentListeners.add(r),r(this.authorityAssignment()),()=>this.authorityAssignmentListeners.delete(r)}async leave(){this.left||(this.left=true,await this.onLeave?.()),await this.close();}async close(){this.stopArchitecture(),this.stopAuthorityAssignment(),this.architectureListeners.clear(),this.authorityAssignmentListeners.clear(),await super.close();}};async function L(t,e$1,r){t.assertOpen();let i=e(e$1),a=r.access??"capability",{architecture:o,delivery:n}=M(r);return t.activateOnce(`room:${i}`,JSON.stringify({access:a,membership:r.membership??"ephemeral",identity:r.identity??null,maxPeers:r.maxPeers??null,payload:n,architecture:o,advancedFanout:r.advancedFanout===true}),a==="authenticated"?r.auth??t.options.auth:void 0,()=>D(t,i,r,o,n))}async function D(t,e,r,i,a){let o=r.membership??"ephemeral",n=r.access??"capability";if(i==="sparse"&&a!=="latest-state")throw new Error("[OpenRTC] Sparse rooms require payload: latest-state.");if(o==="durable"&&n!=="authenticated")throw new Error("[OpenRTC] Durable room membership requires access: authenticated.");if(r.identity==="session"&&n!=="capability")throw new Error("[OpenRTC] Session room identity requires access: capability.");if(n==="authenticated"){let l=r.auth??t.options.auth;if(!l)throw new Error("[OpenRTC] Authenticated rooms require an auth provider.");let A=await t.deviceId(),v=await t.controlPlane(),m=await v.deviceCertificate(l,A,{kind:"room",id:e});o==="durable"&&await v.durableRoomMembership(m.source,e,"join");let f;try{f=await t.activate({kind:"room",id:e,source:m.source,principalId:m.principalId,deviceId:A,maxPeers:r.maxPeers,autoConnect:!0,durableMembership:o==="durable",advancedFanout:r.advancedFanout,architecture:i,defaultDelivery:a});}catch(I){throw o==="durable"&&await v.durableRoomMembership(m.source,e,"leave").catch(()=>{}),I}let g;return g=new y(e,f,()=>{t.channels.detach(f),t.onClosed(g);},o,o==="durable"?async()=>{await v.durableRoomMembership(m.source,e,"leave");}:void 0,i),t.trackHandle(g)}let c=await(r.identity==="session"?t.sessionPlane():t.controlPlane()),s=await c.capability("room",e,r.maxPeers,r.advancedFanout,i,a),u=String(b(s.token).principalId),h=await t.activate({kind:"room",id:e,source:s,principalId:u,deviceId:g(s),maxPeers:r.maxPeers,autoConnect:true,advancedFanout:r.advancedFanout,architecture:i,defaultDelivery:a,controlPlane:c}),d;return d=new y(e,h,()=>{t.channels.detach(h),t.onClosed(d);},"ephemeral",void 0,i),t.trackHandle(d)}function T(t,e$1){t.assertOpen();let r=e(e$1.roomId),i=e(e$1.serviceId),a=f(e$1.deviceId);if(!Number.isSafeInteger(e$1.generation)||e$1.generation<1)throw new Error("[OpenRTC] Authority service generation is invalid.");let o=[...e$1.shardIds].map(e).sort();if(o.length<1||o.length>64||new Set(o).size!==o.length)throw new Error("[OpenRTC] Authority service shards are invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.devicePublicKeyX))throw new Error("[OpenRTC] Authority service device public key is invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.assignmentPublicKeyX))throw new Error("[OpenRTC] Authority assignment public key is invalid.");if(e$1.maxPeers!==void 0&&(!Number.isSafeInteger(e$1.maxPeers)||e$1.maxPeers<1||e$1.maxPeers>50))throw new Error("[OpenRTC] Authority service maxPeers must be within 1..50.");return t.activateOnce(`room:${r}`,JSON.stringify({architecture:"authority",serviceId:i,generation:e$1.generation,shardIds:o,deviceId:a,maxPeers:e$1.maxPeers??null,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSignerId:t.authorityCallableId(e$1.deviceSign),grantProviderId:t.authorityCallableId(e$1.grantProvider)}),void 0,async()=>{let n={type:"capability",token:"",avenue:{kind:"room",id:r},expiresAtMs:Number.MAX_SAFE_INTEGER,irohRelay:e$1.irohRelay,managedTurn:false},c=await t.activate({kind:"room",id:r,source:n,principalId:i,deviceId:a,maxPeers:e$1.maxPeers,autoConnect:true,architecture:"authority",defaultDelivery:"reliable",authority:{serviceId:i,generation:e$1.generation,shardIds:o,deviceId:a,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSign:e$1.deviceSign,grantProvider:e$1.grantProvider}}),s;return s=new y(r,c,()=>{t.channels.detach(c),t.onClosed(s);},"ephemeral",void 0,"authority"),t.trackHandle(s)})}function O(t){return Object.freeze({...t,priorityDeviceIds:Object.freeze([...t.priorityDeviceIds]),relevantEntityIds:Object.freeze([...t.relevantEntityIds])})}function S(t){return t?{...t,priorityDeviceIds:[...t.priorityDeviceIds],relevantEntityIds:[...t.relevantEntityIds]}:null}function x(t){return {requested:t,effective:t==="sparse"?"sparse":"mesh",epoch:0,phase:t==="mesh"||t==="sparse"?"settled":"preparing",reason:t==="auto"?"size":"manual",heldCreditsUsd:0,quoteExpiresAtMs:Date.now()+5*6e4}}export{y as RoomHandle,L as joinRoom,T as openAuthorityRoom,M as resolveRoomJoinOptions};
@@ -1 +1 @@
1
- import {b}from'../chunk-YCQH66MU.js';import'../chunk-AYHD4X2R.js';import {a}from'../chunk-T3G55YPI.js';import'../chunk-WD47V4PK.js';import'../chunk-XMYBBLYK.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import'../chunk-67RYEH6T.js';import'../chunk-CNAW5BZ3.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';var n=class extends a{constructor(e){super(new b(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
1
+ import {b}from'../chunk-RCQ6MLBL.js';import'../chunk-AYHD4X2R.js';import {a}from'../chunk-T3G55YPI.js';import'../chunk-WD47V4PK.js';import'../chunk-XMYBBLYK.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import'../chunk-67RYEH6T.js';import'../chunk-CNAW5BZ3.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';var n=class extends a{constructor(e){super(new b(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
@@ -1 +1 @@
1
- import {a as a$2}from'../chunk-EUVLZSGT.js';import {s}from'../chunk-LAL63F6X.js';import'../chunk-BGWJHPBC.js';import'../chunk-T3G55YPI.js';import'../chunk-WD47V4PK.js';import {a as a$1}from'../chunk-XMYBBLYK.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import {a}from'../chunk-WD2FZUOM.js';import'../chunk-72NEEJQG.js';import'../chunk-67RYEH6T.js';import'../chunk-CNAW5BZ3.js';import'../chunk-OC4VXLX7.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';async function l(e){let t=a$1(e),{WasmBridge:o}=await import('../WasmBridge-OTPV26MU.js');return a$2(t,new o(t))}function y(e,t,o=new a){let m=a$1(e);return a$2(m,new s({...m,bridge:t,projectionBroker:o}))}export{y as createIpcClient,l as createWasmClient};
1
+ import {a as a$2}from'../chunk-EUVLZSGT.js';import {s}from'../chunk-LAL63F6X.js';import'../chunk-BGWJHPBC.js';import'../chunk-T3G55YPI.js';import'../chunk-WD47V4PK.js';import {a as a$1}from'../chunk-XMYBBLYK.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import {a}from'../chunk-WD2FZUOM.js';import'../chunk-72NEEJQG.js';import'../chunk-67RYEH6T.js';import'../chunk-CNAW5BZ3.js';import'../chunk-OC4VXLX7.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';async function l(e){let t=a$1(e),{WasmBridge:o}=await import('../WasmBridge-QNS6SWNZ.js');return a$2(t,new o(t))}function y(e,t,o=new a){let m=a$1(e);return a$2(m,new s({...m,bridge:t,projectionBroker:o}))}export{y as createIpcClient,l as createWasmClient};
@@ -1 +1 @@
1
- export{a as isDeviceActive,c as isDeviceConnectable,b as isDeviceRoutable}from'../chunk-CK6WQV7J.js';export{h as ConnectionActor,e as ConnectionActorError,i as ConnectionActors,a as ConnectionController,s as IpcRuntimeAdapter,r as RuntimeClient,d as clog,p as concatRuntimeBytes,f as connectionActorKey,g as connectionActorKeyString,o as createJsonDecoder,k as createU32Decoder,m as decodeJsonPayload,n as encodeJsonFrame,l as encodeJsonPayload,j as encodeU32Frame,c as grantCorrelation,q as readRuntimeU32BE,b as renderCorrelation}from'../chunk-LAL63F6X.js';import'../chunk-BGWJHPBC.js';import'../chunk-T3G55YPI.js';export{q as BROWSER_CAPABILITIES,r as NATIVE_CAPABILITIES,o as RUNTIME_POLICY,t as browserCapabilities,v as capabilityProfile,s as cloneCapabilities,p as getRuntimePolicy,h as logTeardownTrace,d as openRtcDebug,c as openRtcDebugEnabled,e as openRtcDebugInfo,f as openRtcDebugLog,u as statusCapabilities}from'../chunk-WD47V4PK.js';import'../chunk-XMYBBLYK.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';export{a as classifyIpcFailure,b as isIpcUnavailable}from'../chunk-72NEEJQG.js';import'../chunk-67RYEH6T.js';import'../chunk-CNAW5BZ3.js';export{c as runtimeFromCapability}from'../chunk-TWIZQT6M.js';import'../chunk-ZA44REGI.js';import'../chunk-LLZT3MR6.js';import'../chunk-OC4VXLX7.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';
1
+ export{a as isDeviceActive,c as isDeviceConnectable,b as isDeviceRoutable}from'../chunk-CK6WQV7J.js';export{h as ConnectionActor,e as ConnectionActorError,i as ConnectionActors,a as ConnectionController,s as IpcRuntimeAdapter,r as RuntimeClient,d as clog,p as concatRuntimeBytes,f as connectionActorKey,g as connectionActorKeyString,o as createJsonDecoder,k as createU32Decoder,m as decodeJsonPayload,n as encodeJsonFrame,l as encodeJsonPayload,j as encodeU32Frame,c as grantCorrelation,q as readRuntimeU32BE,b as renderCorrelation}from'../chunk-LAL63F6X.js';import'../chunk-BGWJHPBC.js';import'../chunk-T3G55YPI.js';export{q as BROWSER_CAPABILITIES,r as NATIVE_CAPABILITIES,o as RUNTIME_POLICY,t as browserCapabilities,v as capabilityProfile,s as cloneCapabilities,p as getRuntimePolicy,h as logTeardownTrace,d as openRtcDebug,c as openRtcDebugEnabled,e as openRtcDebugInfo,f as openRtcDebugLog,u as statusCapabilities}from'../chunk-WD47V4PK.js';import'../chunk-XMYBBLYK.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';export{a as classifyIpcFailure,b as isIpcUnavailable}from'../chunk-72NEEJQG.js';import'../chunk-67RYEH6T.js';import'../chunk-CNAW5BZ3.js';export{c as runtimeFromCapability}from'../chunk-IR5VXG3N.js';import'../chunk-ZA44REGI.js';import'../chunk-LLZT3MR6.js';import'../chunk-OC4VXLX7.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';
package/dist/server.js CHANGED
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-S3U4WUZ2.js';import'./chunk-TWIZQT6M.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function y(n){let e=new URL(n??"https://api.openrtc.app"),t=e.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(e.hostname.toLowerCase());if(e.protocol!=="https:"&&!t||e.username||e.password||e.search||e.hash)throw new TypeError("[OpenRTC] authority control-plane endpoint is invalid.");return e.toString().replace(/\/$/,"")}function h(){if(typeof document<"u"||typeof window<"u")throw new Error("[OpenRTC] openrtc/server is unavailable in browsers; use openrtc/service-node with a delegated grant.")}var c=class{constructor(e){h();let t=e.secretKey?.trim()??"";if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(t))throw new TypeError("[OpenRTC] secretKey is invalid.");let i=e.fetch??globalThis.fetch;if(typeof i!="function")throw new TypeError("[OpenRTC] a Fetch-compatible implementation is required.");let u=y(e.endpoint);this.authority=new a({apiKey:e.apiKey,serviceId:e.serviceId,generation:e.generation,shardIds:e.shardIds,deviceId:e.deviceId,deviceSigner:e.deviceSigner,assignmentSigner:e.assignmentSigner,grantIssuer:async s=>{let r=await i(`${u}/v2/developer/authority/grants`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","x-openrtc-idempotency-key":s.idempotencyKey},body:JSON.stringify(s.body)});if(!r.ok){let o=await r.json().catch(()=>null),d=typeof o?.error=="string"?o.error.slice(0,256):`HTTP ${r.status}`;throw new Error(`[OpenRTC] authority service grant failed: ${d}`)}return r.json()}});}requestGrant(e){return this.authority.requestGrant(e)}signAssignment(e){return this.authority.signAssignment(e)}devicePublicKey(){return this.authority.devicePublicKey()}signDeviceBytes(e){return this.authority.signDeviceBytes(e)}grantIssuer(){return async e=>{let t=e.body;return this.requestGrant({roomId:String(t.avenue?.id??""),runtimeInstanceId:String(t.runtimeInstanceId??""),ticketFingerprint:String(t.ticketFingerprint??""),maxPeers:typeof t.maxPeers=="number"?t.maxPeers:void 0,refreshGrant:typeof t.refreshGrant=="string"?t.refreshGrant:void 0,features:typeof t.features=="object"&&t.features?t.features:void 0})}}};
1
+ import {a}from'./chunk-H4XCP4Z4.js';import'./chunk-IR5VXG3N.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function y(n){let e=new URL(n??"https://api.openrtc.app"),t=e.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(e.hostname.toLowerCase());if(e.protocol!=="https:"&&!t||e.username||e.password||e.search||e.hash)throw new TypeError("[OpenRTC] authority control-plane endpoint is invalid.");return e.toString().replace(/\/$/,"")}function h(){if(typeof document<"u"||typeof window<"u")throw new Error("[OpenRTC] openrtc/server is unavailable in browsers; use openrtc/service-node with a delegated grant.")}var c=class{constructor(e){h();let t=e.secretKey?.trim()??"";if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(t))throw new TypeError("[OpenRTC] secretKey is invalid.");let i=e.fetch??globalThis.fetch;if(typeof i!="function")throw new TypeError("[OpenRTC] a Fetch-compatible implementation is required.");let u=y(e.endpoint);this.authority=new a({apiKey:e.apiKey,serviceId:e.serviceId,generation:e.generation,shardIds:e.shardIds,deviceId:e.deviceId,deviceSigner:e.deviceSigner,assignmentSigner:e.assignmentSigner,grantIssuer:async s=>{let r=await i(`${u}/v2/developer/authority/grants`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","x-openrtc-idempotency-key":s.idempotencyKey},body:JSON.stringify(s.body)});if(!r.ok){let o=await r.json().catch(()=>null),d=typeof o?.error=="string"?o.error.slice(0,256):`HTTP ${r.status}`;throw new Error(`[OpenRTC] authority service grant failed: ${d}`)}return r.json()}});}requestGrant(e){return this.authority.requestGrant(e)}signAssignment(e){return this.authority.signAssignment(e)}devicePublicKey(){return this.authority.devicePublicKey()}signDeviceBytes(e){return this.authority.signDeviceBytes(e)}grantIssuer(){return async e=>{let t=e.body;return this.requestGrant({roomId:String(t.avenue?.id??""),runtimeInstanceId:String(t.runtimeInstanceId??""),ticketFingerprint:String(t.ticketFingerprint??""),maxPeers:typeof t.maxPeers=="number"?t.maxPeers:void 0,refreshGrant:typeof t.refreshGrant=="string"?t.refreshGrant:void 0,features:typeof t.features=="object"&&t.features?t.features:void 0})}}};
2
2
  export{c as AuthorityServiceControlPlane};
@@ -1 +1 @@
1
- export{a as DelegatedAuthorityService,b as ServiceNode}from'./chunk-S3U4WUZ2.js';import'./chunk-TWIZQT6M.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';
1
+ export{a as DelegatedAuthorityService,b as ServiceNode}from'./chunk-H4XCP4Z4.js';import'./chunk-IR5VXG3N.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';
@@ -1 +1 @@
1
- import {a as a$1}from'../chunk-UBLYBL3O.js';import {a}from'../chunk-WD2FZUOM.js';import'../chunk-67RYEH6T.js';import'../chunk-AUICRD2W.js';import {i}from'../chunk-TWIZQT6M.js';import'../chunk-ZA44REGI.js';import'../chunk-LLZT3MR6.js';import'../chunk-OC4VXLX7.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';function v(c,p,e){let o=new a;return i(c,{endpoints:p,testingAllowInsecureLoopback:true,platform:"native",close:()=>o.close(),deviceKeyProvider:a$1(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:a}=await import('../ipcFactory-DOEPQPOP.js');return a(t,e,o)}})}export{v as OpenRTC};
1
+ import {a as a$1}from'../chunk-UBLYBL3O.js';import {a}from'../chunk-WD2FZUOM.js';import'../chunk-67RYEH6T.js';import'../chunk-AUICRD2W.js';import {i}from'../chunk-IR5VXG3N.js';import'../chunk-ZA44REGI.js';import'../chunk-LLZT3MR6.js';import'../chunk-OC4VXLX7.js';import'../chunk-CCCYE3XN.js';import'../chunk-577A77JB.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';function v(c,p,e){let o=new a;return i(c,{endpoints:p,testingAllowInsecureLoopback:true,platform:"native",close:()=>o.close(),deviceKeyProvider:a$1(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:a}=await import('../ipcFactory-DOEPQPOP.js');return a(t,e,o)}})}export{v as OpenRTC};
package/dist/testing.js CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-ESBROG6S.js';import {a as a$1,d,c}from'./chunk-CNAW5BZ3.js';import {c as c$1}from'./chunk-AUICRD2W.js';import {i}from'./chunk-TWIZQT6M.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function v(o){let t=e=>`${e}:${o}`;return {getOrCreate:e=>c$1.getOrCreate(t(e)),delete:async e=>{await c$1.delete?.(t(e));},readSecureRecord:(e,i)=>c$1.readSecureRecord?.(t(e),i)??Promise.resolve(null),writeSecureRecord:(e,i,c)=>c$1.writeSecureRecord?.(t(e),i,c)??Promise.resolve(),deleteSecureRecord:(e,i)=>c$1.deleteSecureRecord?.(t(e),i)??Promise.resolve()}}function b(o,t,e){return new a(o,t,v(e))}function g(o,t,e={}){if(e.initialTicketLifetimeMs!==void 0){let i=(c,s)=>{let r=new URL(c);return r.protocol===s&&["127.0.0.1","[::1]"].includes(r.hostname)&&Number(r.port)>0&&r.pathname==="/"&&!r.username&&!r.password&&!r.search&&!r.hash};if(e.initialTicketLifetimeMs!==9e4||o.apiKey!=="pk_test_0000000000000000000000000000000000000000"||!i(t.controlPlane,"http:")||!i(t.gateway,"http:")||!e.irohTestRelayUrl||!i(e.irohTestRelayUrl,"https:"))throw new Error("Short initial tickets require the disposable local service lane")}return i(o,{endpoints:t,testingAllowInsecureLoopback:true,platform:"web",...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async i=>{let{createWasmClient:c$1}=await import('./runtime/factories.js'),s=await c$1(i);if(e.initialTicketLifetimeMs!==void 0){let r=s.runtime,p=r.getTicketWithToken.bind(r);r.getTicketWithToken=async(l,d$1=0)=>{if(r.getTicketWithToken=p,!l.startsWith("v2:room:"))throw new Error("Short initial ticket requires room scope");let{irohTicket:u,tokenSuffix:m}=a$1(await p(l,d$1)),n=m&&d(u,m);if(!n||!n.t||n.s!==l||n.m!==d$1)throw new Error("Invalid initial service ticket");let h=Date.now()+9e4;return await r.registerToken({token:n.t,scope:l,maxConnections:d$1,expiresAtMs:h}),c(u,n.t,l,d$1,h)};}return s}})}export{g as OpenRTC,b as controlPlane};
1
+ import {a}from'./chunk-ESBROG6S.js';import {a as a$1,d,c}from'./chunk-CNAW5BZ3.js';import {c as c$1}from'./chunk-AUICRD2W.js';import {i}from'./chunk-IR5VXG3N.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-OC4VXLX7.js';import'./chunk-CCCYE3XN.js';import'./chunk-577A77JB.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function v(o){let t=e=>`${e}:${o}`;return {getOrCreate:e=>c$1.getOrCreate(t(e)),delete:async e=>{await c$1.delete?.(t(e));},readSecureRecord:(e,i)=>c$1.readSecureRecord?.(t(e),i)??Promise.resolve(null),writeSecureRecord:(e,i,c)=>c$1.writeSecureRecord?.(t(e),i,c)??Promise.resolve(),deleteSecureRecord:(e,i)=>c$1.deleteSecureRecord?.(t(e),i)??Promise.resolve()}}function b(o,t,e){return new a(o,t,v(e))}function g(o,t,e={}){if(e.initialTicketLifetimeMs!==void 0){let i=(c,s)=>{let r=new URL(c);return r.protocol===s&&["127.0.0.1","[::1]"].includes(r.hostname)&&Number(r.port)>0&&r.pathname==="/"&&!r.username&&!r.password&&!r.search&&!r.hash};if(e.initialTicketLifetimeMs!==9e4||o.apiKey!=="pk_test_0000000000000000000000000000000000000000"||!i(t.controlPlane,"http:")||!i(t.gateway,"http:")||!e.irohTestRelayUrl||!i(e.irohTestRelayUrl,"https:"))throw new Error("Short initial tickets require the disposable local service lane")}return i(o,{endpoints:t,testingAllowInsecureLoopback:true,platform:"web",...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async i=>{let{createWasmClient:c$1}=await import('./runtime/factories.js'),s=await c$1(i);if(e.initialTicketLifetimeMs!==void 0){let r=s.runtime,p=r.getTicketWithToken.bind(r);r.getTicketWithToken=async(l,d$1=0)=>{if(r.getTicketWithToken=p,!l.startsWith("v2:room:"))throw new Error("Short initial ticket requires room scope");let{irohTicket:u,tokenSuffix:m}=a$1(await p(l,d$1)),n=m&&d(u,m);if(!n||!n.t||n.s!==l||n.m!==d$1)throw new Error("Invalid initial service ticket");let h=Date.now()+9e4;return await r.registerToken({token:n.t,scope:l,maxConnections:d$1,expiresAtMs:h}),c(u,n.t,l,d$1,h)};}return s}})}export{g as OpenRTC,b as controlPlane};
@@ -4,9 +4,9 @@
4
4
  "platform": "darwin",
5
5
  "arch": "arm64",
6
6
  "rustTarget": "aarch64-apple-darwin",
7
- "sourceCommit": "d6238cb3c51ec142fdeaa2e33c06a6842f7bd455",
8
- "sourceDigest": "3e14f166921ed9e364775f3d6e67989b2dfa0df09922c1c79d05072eeb1e8420",
9
- "binarySha256": "5686eed4ef13f0d61524aa47dfe0f0c5957f04b0d4d9c72c7a5aa27920f7662e",
7
+ "sourceCommit": "56bd11983572fa924e92796253625364185a550a",
8
+ "sourceDigest": "18f626c9d21dc2952bf9ff077089a6c1eb6f779135acc0c8778ae7693d6c958b",
9
+ "binarySha256": "571114d33e4678fcdebf68d928e9b3e7d378515fc12e02ebc7b8d3260f68f7eb",
10
10
  "protocol": {
11
11
  "lifecycleOwner": "rust-peer-session",
12
12
  "maxApplicationPayloadBytes": 65536,
@@ -16,5 +16,5 @@
16
16
  },
17
17
  "signingKeySha256": "0391c617f3df12611b419e129cace36fa792e73da03271649cbed9e9f9f155ef",
18
18
  "signatureAlgorithm": "ed25519",
19
- "signature": "7Hu5xfidomyWxaZd36eaoMd55V6+itmTjk+926ToUkwIw/AzjbZHCPiWhfzqjW7uRbDPX6p81aPDpp22+YF6Cw=="
19
+ "signature": "o64784tsrrBiAkEznxmSmrhu2aKp3Z3egagzStyVD03Ej63sKQp+wJU3UOgUHyr5wYvdNL3Ru/Au0vQFWhUkBg=="
20
20
  }
Binary file