space-data-module-sdk 0.8.27 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/docs/assembly.js +0 -18
- package/docs/assets/ai-credits/ai-credits.js +116 -0
- package/docs/assets/sdn-chrome/sdn-chrome.css +434 -0
- package/docs/assets/sdn-chrome/sdn-chrome.js +236 -0
- package/docs/browser-wasmedge-isomorphic.html +29 -41
- package/docs/byo-wasm-quickstart.html +29 -41
- package/docs/conformance.html +29 -41
- package/docs/events-abi.html +29 -41
- package/docs/families/analytics.html +29 -41
- package/docs/families/attitude.html +29 -41
- package/docs/families/behavior.html +29 -41
- package/docs/families/breakup.html +29 -41
- package/docs/families/conjunction.html +29 -41
- package/docs/families/data-source.html +29 -41
- package/docs/families/effects.html +29 -41
- package/docs/families/environment.html +29 -41
- package/docs/families/estimation.html +29 -41
- package/docs/families/gnc.html +29 -41
- package/docs/families/maneuver.html +29 -41
- package/docs/families/obstruction.html +29 -41
- package/docs/families/propagator.html +29 -41
- package/docs/families/propulsion.html +29 -41
- package/docs/families/reentry.html +29 -41
- package/docs/families/rf.html +29 -41
- package/docs/families/scheduler.html +29 -41
- package/docs/families/sensor.html +29 -41
- package/docs/families/signature.html +29 -41
- package/docs/flatsql-host-contract.html +29 -41
- package/docs/flatsql-streaming-standard.html +29 -41
- package/docs/gpu-module-abi.html +29 -41
- package/docs/index.html +43 -47
- package/docs/isomorphic-pthreads.html +29 -41
- package/docs/isomorphic-sdn-runtime-plan.html +29 -41
- package/docs/language-runtime-matrix.html +29 -41
- package/docs/media/module-sdk-reel-poster.webp +0 -0
- package/docs/media/module-sdk-reel.mp4 +0 -0
- package/docs/media/module-sdk-reel.webm +0 -0
- package/docs/media/reel/reel.css +53 -0
- package/docs/media/reel/reel.js +272 -0
- package/docs/module-bundle-runtime-plan.html +29 -41
- package/docs/module-publication-standard.html +29 -41
- package/docs/node-red-default-node-parity.html +29 -41
- package/docs/protect-and-sign.html +29 -41
- package/docs/protocol-installation.html +29 -41
- package/docs/publication-submission.html +29 -41
- package/docs/secrets-capability.html +29 -41
- package/docs/styles.css +89 -157
- package/docs/testing-harness.html +29 -41
- package/docs/tri-runtime-parity-gate.html +29 -41
- package/docs/tri-runtime-parity.html +29 -41
- package/package.json +5 -3
- package/schemas/runtime/FlowNotice.fbs +39 -0
- package/schemas/runtime/HostOps.fbs +455 -0
- package/schemas/runtime/HttpRequest.fbs +25 -0
- package/schemas/runtime/HttpResponse.fbs +24 -0
- package/schemas/runtime/IngestRequest.fbs +61 -0
- package/schemas/runtime/IngestResult.fbs +23 -0
- package/schemas/runtime/ModuleConfig.fbs +41 -0
- package/schemas/runtime/RuntimeCommon.fbs +33 -0
- package/schemas/runtime/TimerTick.fbs +18 -0
- package/src/capabilities.js +3 -0
- package/src/compiler/compileModule.js +20 -2
- package/src/generated/runtime/aligned/HostOps_aligned.js +3913 -0
- package/src/generated/runtime/aligned/HostOps_aligned.ts +4605 -0
- package/src/generated/runtime/aligned/HostOps_enums.js +12 -0
- package/src/generated/runtime/aligned/HostOps_enums.ts +6 -0
- package/src/generated/runtime/cpp/FlowNotice_generated.h +367 -0
- package/src/generated/runtime/cpp/HostOps_aligned.h +3540 -0
- package/src/generated/runtime/cpp/HttpRequest_generated.h +317 -0
- package/src/generated/runtime/cpp/HttpResponse_generated.h +315 -0
- package/src/generated/runtime/cpp/IngestRequest_generated.h +829 -0
- package/src/generated/runtime/cpp/IngestResult_generated.h +319 -0
- package/src/generated/runtime/cpp/ModuleConfig_generated.h +604 -0
- package/src/generated/runtime/cpp/RuntimeCommon_generated.h +410 -0
- package/src/generated/runtime/cpp/TimerTick_generated.h +229 -0
- package/src/generated/runtime/sdn/runtime/ArchiveTarget.js +78 -0
- package/src/generated/runtime/sdn/runtime/ArchiveTarget.ts +104 -0
- package/src/generated/runtime/sdn/runtime/ConfigEntry.js +202 -0
- package/src/generated/runtime/sdn/runtime/ConfigEntry.ts +251 -0
- package/src/generated/runtime/sdn/runtime/ConfigTable.js +80 -0
- package/src/generated/runtime/sdn/runtime/ConfigTable.ts +97 -0
- package/src/generated/runtime/sdn/runtime/FlowNotice.js +196 -0
- package/src/generated/runtime/sdn/runtime/FlowNotice.ts +254 -0
- package/src/generated/runtime/sdn/runtime/Header.js +79 -0
- package/src/generated/runtime/sdn/runtime/Header.ts +100 -0
- package/src/generated/runtime/sdn/runtime/HttpRequest.js +216 -0
- package/src/generated/runtime/sdn/runtime/HttpRequest.ts +265 -0
- package/src/generated/runtime/sdn/runtime/HttpResponse.js +216 -0
- package/src/generated/runtime/sdn/runtime/HttpResponse.ts +267 -0
- package/src/generated/runtime/sdn/runtime/IngestRequest.js +121 -0
- package/src/generated/runtime/sdn/runtime/IngestRequest.ts +155 -0
- package/src/generated/runtime/sdn/runtime/IngestResult.js +184 -0
- package/src/generated/runtime/sdn/runtime/IngestResult.ts +235 -0
- package/src/generated/runtime/sdn/runtime/ModuleConfig.js +92 -0
- package/src/generated/runtime/sdn/runtime/ModuleConfig.ts +114 -0
- package/src/generated/runtime/sdn/runtime/Provenance.js +320 -0
- package/src/generated/runtime/sdn/runtime/Provenance.ts +405 -0
- package/src/generated/runtime/sdn/runtime/SourceTags.js +181 -0
- package/src/generated/runtime/sdn/runtime/SourceTags.ts +253 -0
- package/src/generated/runtime/sdn/runtime/TimerTick.js +119 -0
- package/src/generated/runtime/sdn/runtime/TimerTick.ts +148 -0
- package/src/generated/runtime/sdn/runtime/configValueKind.js +12 -0
- package/src/generated/runtime/sdn/runtime/configValueKind.ts +19 -0
- package/src/generated/runtime/sdn/runtime/flowNoticeKind.js +11 -0
- package/src/generated/runtime/sdn/runtime/flowNoticeKind.ts +34 -0
- package/src/generated/runtime/sdn/runtime/reconcileMode.js +9 -0
- package/src/generated/runtime/sdn/runtime/reconcileMode.ts +23 -0
- package/src/generated/runtime/sdn/runtime.js +16 -0
- package/src/generated/runtime/sdn/runtime.ts +17 -0
- package/src/host/abi.js +32 -6
- package/src/host/adapterOperations.js +79 -0
- package/src/host/browserHost.js +65 -2
- package/src/host/cpp/typedHostcall.hpp +252 -0
- package/src/host/hostWorkerBundleSources.js +3 -3
- package/src/host/nodeHost.js +50 -0
- package/src/host/typedDispatch.js +582 -0
- package/src/index.d.ts +25 -2
- package/src/invoke/codec.js +3 -2
- package/src/standards/runtimeContracts.js +596 -0
- package/src/standards/sharedCatalog.js +27 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Self-contained classic-script worker bundles, spawned from blob: URLs
|
|
3
3
|
// (design A39). Rebuild after changing any file they bundle.
|
|
4
4
|
|
|
5
|
-
/** src/host/wasiThreadBrowserWorker.mjs, sha256
|
|
6
|
-
export const WASI_THREAD_POOL_WORKER_BUNDLE = "(()=>{var ge=new TextDecoder,we=new TextEncoder,at=\"$bin\";function xe(t){return t instanceof Uint8Array||t instanceof ArrayBuffer||ArrayBuffer.isView(t)}function Le(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function J(t,e){if(t==null)return t??null;if(xe(t)){let r=e.length;return e.push(Le(t)),{[at]:r}}return t instanceof Date?t.toISOString():typeof t==\"bigint\"?t.toString():Array.isArray(t)?t.map(r=>J(r,e)):typeof t==\"object\"?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0).map(([r,n])=>[r,J(n,e)])):t}function Q(t,e){if(t==null)return t;if(Array.isArray(t))return t.map(r=>Q(r,e));if(typeof t==\"object\"){let r=Object.keys(t);if(r.length===1&&r[0]===at){let n=t[at];if(!Number.isInteger(n)||n<0||n>=e.length)throw new RangeError(`Hostcall envelope references missing binary segment ${n}.`);return e[n]}return Object.fromEntries(r.map(n=>[n,Q(t[n],e)]))}return t}function ut(t,e=[]){let r=we.encode(JSON.stringify(t??null)),n=4+r.length+4;for(let f of e)n+=4+f.length;let o=new Uint8Array(n),c=new DataView(o.buffer),a=0;c.setUint32(a,r.length,!0),a+=4,o.set(r,a),a+=r.length,c.setUint32(a,e.length,!0),a+=4;for(let f of e)c.setUint32(a,f.length,!0),a+=4,o.set(f,a),a+=f.length;return o}function tt(t){if(!(t instanceof Uint8Array))throw new TypeError(\"Hostcall envelope must be a Uint8Array.\");if(t.length<8)throw new RangeError(\"Hostcall envelope is truncated.\");let e=new DataView(t.buffer,t.byteOffset,t.byteLength),r=0,n=e.getUint32(r,!0);if(r+=4,r+n+4>t.length)throw new RangeError(\"Hostcall envelope meta exceeds envelope bounds.\");let o=JSON.parse(ge.decode(t.subarray(r,r+n)));r+=n;let c=e.getUint32(r,!0);r+=4;let a=[];for(let f=0;f<c;f+=1){if(r+4>t.length)throw new RangeError(\"Hostcall envelope segment table is truncated.\");let y=e.getUint32(r,!0);if(r+=4,r+y>t.length)throw new RangeError(\"Hostcall envelope segment exceeds envelope bounds.\");a.push(t.subarray(r,r+y)),r+=y}return{meta:o,segments:a}}function Ot(t){let{meta:e,segments:r}=tt(t);return Q(e,r)}var Be=new TextDecoder,ft=\"space_data_module_host\",G=0,lt=1,fn=Object.freeze([\"host.runtimeTarget\",\"host.listCapabilities\",\"host.listSupportedCapabilities\",\"host.listOperations\",\"host.hasCapability\",\"clock.now\",\"clock.monotonicNow\",\"clock.nowIso\",\"random.bytes\",\"schedule.parse\",\"schedule.matches\",\"schedule.next\",\"filesystem.resolvePath\"]);function be(t,e){let r=String(t??\"\").trim();if(!r)throw new TypeError(`${e} is required.`);return r}function wt(t){if(typeof t!=\"function\")throw new TypeError(\"getMemory must be a function returning WebAssembly.Memory.\");let e=t();if(!e||typeof e!=\"object\"||!(\"buffer\"in e))throw new TypeError(\"getMemory must return a WebAssembly.Memory-like object.\");let r=e.buffer;if(!(r instanceof ArrayBuffer||r instanceof SharedArrayBuffer))throw new TypeError(\"Hostcall memory buffer must be an ArrayBuffer or SharedArrayBuffer.\");return r}function Tt(t,e,r,n){if(!Number.isInteger(e)||e<0)throw new RangeError(`${n} pointer must be a non-negative integer.`);if(!Number.isInteger(r)||r<0)throw new RangeError(`${n} length must be a non-negative integer.`);let o=wt(t);if(e+r>o.byteLength)throw new RangeError(`${n} range exceeds guest memory bounds.`);return new Uint8Array(o,e,r)}function Ce(t,e,r,n){if(!Number.isInteger(e)||e<0)throw new RangeError(\"Response pointer must be a non-negative integer.\");if(!Number.isInteger(n)||n<0)throw new RangeError(\"Response max length must be a non-negative integer.\");let o=r instanceof Uint8Array?r:new Uint8Array(r),c=wt(t),a=Math.min(o.length,n);if(e+a>c.byteLength)throw new RangeError(\"Response range exceeds guest memory bounds.\");return new Uint8Array(c,e,a).set(o.subarray(0,a)),a}function Ne(t){if(t.length===0)return null;let{meta:e,segments:r}=tt(t);return Q(e,r)}function gt(t,e=null){return{name:t?.name??\"Error\",message:t?.message??String(t),code:t?.code??null,operation:t?.operation??e,capability:t?.capability??null}}function De(t){return t!==null&&typeof t==\"object\"&&typeof t.then==\"function\"}function xt(t={}){let e=t.dispatch;if(typeof e!=\"function\")throw new TypeError(\"createHostcallBridge requires a dispatch function.\");let r=t.getMemory,n=be(t.moduleName??ft,\"Hostcall import module name\"),o=Number.isInteger(t.maxRequestBytes)?t.maxRequestBytes:16*1024*1024,c=Number.isInteger(t.maxResponseBytes)?t.maxResponseBytes:64*1024*1024,a=G,f={ok:!0,result:null},y=ut(f,[]);function m(s,i){let u=[],p=J(i,u),E=ut(p,u);if(E.length>c)throw new Error(`Hostcall response exceeds ${c} byte limit.`);a=s,f=i,y=E}function S(s,i,u,p){try{if(p>o)throw new Error(`Hostcall request exceeds ${o} byte limit.`);let E=Be.decode(Tt(r,s,i,\"Operation\")),g=Ne(Tt(r,u,p,\"Payload\")),w=e(E,g);if(De(w))throw new Error(`Operation \"${E}\" returned a Promise. The synchronous hostcall ABI only supports synchronous operations.`);return m(G,{ok:!0,result:w===void 0?null:w}),G}catch(E){try{m(lt,{ok:!1,error:gt(E)})}catch(g){m(lt,{ok:!1,error:gt(g)})}return lt}}function T(){return y.length}function _(s,i){return Ce(r,s,y,i)}function A(){return m(G,{ok:!0,result:null}),G}function l(){return a}return{moduleName:n,imports:{[n]:{call:S,response_len:T,read_response:_,clear_response:A,last_status_code:l}},getLastEnvelope(){return structuredClone(f)},getLastResponseBytes(){return new Uint8Array(y)},getLastResponseEnvelope(){let{meta:s,segments:i}=tt(y);return Q(s,i)}}}var An=Object.freeze({READ:1,WRITE:2,CREATE:4,EXCL:8,TRUNC:16,DELETE_ON_CLOSE:32,PROBE:64,UNLINK:128,CREATE_PARENTS:256,UNLINK_IF_UNUSED:512,OPEN_DEFERRED:1024}),dn=Object.freeze({OK:0,GENERIC:-1,NOENT:-2,ACCESS:-3,IO:-4,NOSPACE:-5,BADHANDLE:-6,BUSY:-7});var En=Object.freeze([\"flatsql_io_open\",\"flatsql_io_read\",\"flatsql_io_write\",\"flatsql_io_truncate\",\"flatsql_io_sync\",\"flatsql_io_size\",\"flatsql_io_close\"]),et=4096;var Sn=typeof TextDecoder==\"function\"?new TextDecoder(\"utf-8\",{fatal:!0}):null;function Lt(t){let e=2166136261;for(let r=0;r<t.length;r+=1)e^=t[r],e=Math.imul(e,16777619);return e>>>0}var Fe=1330201683,Me=1,He=0,Ue=1,Pe=2,ve=3,Qe=4,bt=5;var ke=7;var qe=9,nt=10,Ge=11;var We=13,Ut=64,Ct=Ut*4;var Ye=1;var Ve=1,$e=2,Ke=3,Y=32767,V=0,Pt=1,Nt=2,ze=3,je=4,Xe=5,Ze=6,Je=7,tr=8,er=9,Dt=10,vt=11,rr=12,nr=13,or=8,Qt=9,_t=128,At=0,sr=1,cr=2;var ir=4,ar=0;var ur=0,lr=1,fr=1,W=2,rt=3,_r=4,Ar=5,dr=6,Er=7;var yn=64*1024;var Ft=250,Sr=20;function Mt(){return typeof performance<\"u\"&&performance.now?performance.now():Date.now()}function pr(t,e){return Math.ceil(t/e)*e}function kt(t){if(typeof SharedArrayBuffer!=\"function\"||!(t instanceof SharedArrayBuffer))throw new TypeError(\"The SAB I/O channel requires a SharedArrayBuffer (cross-origin isolation in browsers).\")}function mr(t){kt(t);let e=new Int32Array(t,0,Ut);if(e[He]!==Fe||e[Ue]!==Me)throw new TypeError(\"Not a SAB I/O channel buffer (bad magic or version).\");let r=e[Pe],n=e[ve],o=e[Qe],c=e[Ge],a=pr(Ct+o*4,64),f=new Int32Array(t,Ct,o),y=[];for(let m=0;m<r;m+=1){let S=a+m*n;y.push({index:m,base:S,i32:new Int32Array(t,S,_t/4),f64:new Float64Array(t,S,_t/8),data:new Uint8Array(t,S+_t,c)})}return{buffer:t,header:e,instances:f,slots:y,slotCount:r,slotBytes:n,dataBytes:c,maxInstances:o,channelId:e[We]}}function yr(t){return`sdm-sab-io-doorbell-${t}`}function hr(t,e){Atomics.add(t.header,bt,1),Atomics.notify(t.header,bt),Atomics.load(t.header,ke)===Ye&&e()?.postMessage(0)}function Rr(t){let e=null;return{get(){return!e&&typeof BroadcastChannel==\"function\"&&(e=new BroadcastChannel(t)),e},close(){e?.close(),e=null}}}var Ir=typeof TextEncoder==\"function\"?new TextEncoder:null;function Or(){return(Math.random()*2147483646|0)+1}function Tr(t,e){let r=(Atomics.add(t.header,qe,1)>>>0)%t.slotCount;for(let n=0;n<t.slotCount;n+=1){let o=t.slots[(r+n)%t.slotCount];if(Atomics.compareExchange(o.i32,V,At,sr)===At)return Atomics.store(o.i32,Pt,e),o}return null}function Ht(t,e){Atomics.store(e.i32,Pt,0),Atomics.store(e.i32,V,At),Atomics.add(t.header,nt,1),Atomics.notify(t.header,nt)}function gr(t,e,r){let n=t.i32;n[je]=e,n[Xe]=r.instanceId??Y,n[Ze]=r.handle??-1,n[Je]=r.flags??0,n[tr]=r.ptr??0,n[er]=r.len??0,n[nr]=r.dataInSlot?lr:ur,n[vt]=0,t.f64[or]=r.offset??0,t.f64[Qt]=0,r.path?(t.data.set(r.path,0),n[Dt]=r.path.length):n[Dt]=0}function wr(t){return Atomics.load(t.i32,vt)}function qt(t={}){kt(t.buffer);let e=mr(t.buffer),r=Number.isInteger(t.instanceId)?t.instanceId:Y;if(r!==Y&&(r<0||r>=e.maxInstances))throw new RangeError(`instanceId ${r} is outside 0..${e.maxInstances-1}.`);let n=typeof t.getMemory==\"function\"?t.getMemory:()=>null,o=Number.isFinite(t.spinMicros)?Math.max(0,t.spinMicros):Sr,c=Or(),a=Rr(yr(e.channelId)),f=0;function y(){for(;;){let s=Atomics.load(e.header,nt),i=Tr(e,c);if(i)return i;Atomics.wait(e.header,nt,s,Ft)}}function m(s,i,u){let p=Atomics.load(s.i32,Nt)+1|0||1;gr(s,i,u),Atomics.store(s.i32,rr,ar),Atomics.store(s.i32,Nt,p),Atomics.store(s.i32,V,cr),hr(e,a.get);let E=o>0?Mt()+o/1e3:0;for(;;){let g=Atomics.load(s.i32,V);if(g===ir&&Atomics.load(s.i32,ze)===p)break;E>0&&Mt()<E||Atomics.wait(s.i32,V,g,Ft)}return f+=1,{status:wr(s),result:s.f64[Qt]}}function S(s,i){let u=y();try{return m(u,s,i)}finally{Ht(e,u)}}function T(){return r!==Y&&Atomics.load(e.instances,r)===Ve}function _(){if(r===Y)return!1;let s=Atomics.load(e.instances,r);return s===$e||s===Ke}function A(s,i,u,p){let E=0;for(;E<u.length;){let g=Math.min(e.dataBytes,u.length-E),w=y(),B;try{s===rt&&w.data.set(u.subarray(E,E+g),0),B=m(w,s,{instanceId:r,dataInSlot:!0,handle:i,ptr:0,len:g,offset:p+E}).status,s===W&&B>0&&u.set(w.data.subarray(0,B),E)}finally{Ht(e,w)}if(B<0)return E>0&&s===W?E:B;if(E+=B,B<g)break}return E}function l(s,i){let u=n(),p=u?.buffer??u;return!p||s<0||i<0||s+i>p.byteLength?null:new Uint8Array(p,s,i)}return{instanceId:r,get requests(){return f},open(s,i){let u=typeof s==\"string\"?Ir.encode(s):s;return!(u instanceof Uint8Array)||u.length===0?-1:u.length>Math.min(e.dataBytes,et)?-1:S(fr,{instanceId:r,flags:i|0,path:u}).status},read(s,i,u,p){if(u===0)return 0;if(T())return S(W,{instanceId:r,handle:s,ptr:i,len:u,offset:p}).status;let E=l(i,u);return E?A(W,s,E,p):_()?-3:-1},write(s,i,u,p){if(u===0)return 0;if(T())return S(rt,{instanceId:r,handle:s,ptr:i,len:u,offset:p}).status;let E=l(i,u);return E?A(rt,s,E,p):_()?-3:-1},readInto(s,i,u){return i.length===0?0:A(W,s,i,u)},writeFrom(s,i,u){return i.length===0?0:A(rt,s,i,u)},truncate(s,i){return S(_r,{instanceId:r,handle:s,offset:i}).status},sync(s){return S(Ar,{instanceId:r,handle:s}).status},size(s){let{status:i,result:u}=S(dr,{instanceId:r,handle:s});return i<0?i:u},close(s){return S(Er,{instanceId:r,handle:s}).status},release(){a.close()}}}var xr=typeof TextEncoder==\"function\"?new TextEncoder:null;function Lr(t){let e=2166136261;for(let r=0;r<t.length;r+=1)e^=t[r],e=Math.imul(e,16777619);return e|0}var Gt=new WeakMap;function Wt(t){let e=Gt.get(t);if(e)return e;let r=new Int32Array(t,0,16);if(r[0]!==1380795475||r[1]!==1)throw new TypeError(\"Not a SAB I/O mirror buffer.\");let n=r[2],o=r[3],c=r[4],a=64,f=a+n*32,y=f+n*c;return e={entries:n,entryBytes:o,maxPathBytes:c,i32:new Int32Array(t,a,n*32/4),f64:new Float64Array(t,a,n*32/8),paths:new Uint8Array(t,f,n*c),data:new Uint8Array(t,y,n*o)},Gt.set(t,e),e}function Br(t){return typeof t==\"string\"?xr.encode(t):t}function br(t,e,r){let n=e*8;if(Atomics.load(t.i32,n+3)!==r.length)return!1;let o=e*t.maxPathBytes;for(let c=0;c<r.length;c+=1)if(t.paths[o+c]!==r[c])return!1;return!0}function Cr(t,e,r){let n=(r>>>0)%t.entries;for(let o=0;o<t.entries;o+=1){let c=n*8,a=Atomics.load(t.i32,c+0);if(a===0)return-1;if((a===2||a===3)&&Atomics.load(t.i32,c+2)===r&&br(t,n,e))return n;n=(n+1)%t.entries}return-1}function Yt(t,e){let r=Wt(t),n=Br(e);if(n.length>r.maxPathBytes)return-1;let o=Cr(r,n,Lr(n));return o<0?-1:Atomics.load(r.i32,o*(32/4)+0)===2?o:-1}function Vt(t,e,r,n){let o=Wt(t),c=e*(32/4),a=e*(32/8)+3,f=e*o.entryBytes;for(let y=0;y<64;y+=1){let m=Atomics.load(o.i32,c+1);if(m&1)continue;if(Atomics.load(o.i32,c+0)!==2)return-1;let S=o.f64[a],T=Atomics.load(o.i32,c+4),_;if(n>=S)_=0;else{let A=Math.min(r.length,S-n);n+A>T?_=-1:(r.set(o.data.subarray(f+n,f+n+A),0),_=A)}if(Atomics.load(o.i32,c+1)===m)return _}return-1}function $t(t=[\"/h.fsh\"]){let e=Array.from(t,String);return r=>{let n=String(r);for(let o of e)if(n.endsWith(o)||n===o.replace(/^\\//,\"\"))return!0;return!1}}var Nr=\"flatsql-io\",F=Object.freeze({open:1,read:2,write:3,truncate:4,sync:5,size:6,close:7,mirrorRead:8}),Kt=24,zt=16777215;function dt(){return typeof performance<\"u\"&&performance.now?performance.now()*1e3:Date.now()*1e3}function Dr(t){if(!t?.buffer)return null;let e=new Int32Array(t.buffer,0,4),r=e[1],n=new Float64Array(t.buffer,16,r),o=new Uint8Array(t.buffer,16+r*8,r);return(c,a)=>{let f=Atomics.add(e,0,1);f<r&&(n[f]=dt()-a,o[f]=c)}}function Fr(t,e,r){if(!t||r<=0||r>et||e<0)return null;let n=t.buffer??t;return e+r>n.byteLength?null:new Uint8Array(n,e,r).slice()}function Mr(t={}){let e=t.getMemory;if(typeof e!=\"function\")throw new TypeError(\"createFlatsqlIoImports requires getMemory().\");let r=Array.isArray(t.provider)?t.provider:[t.provider];if(r.length===0||r.some(_=>!_||typeof _.open!=\"function\"))throw new TypeError(\"createFlatsqlIoImports requires at least one provider.\");if(r.length>127)throw new RangeError(\"At most 127 providers can be routed.\");let n=r.length>1,o=Dr(t.trace),c=t.mirror?.buffer??null,a=c?$t(t.mirror.suffixes??[\"/h.fsh\"]):null,f=new Map,y=new TextDecoder;function m(_){if(!n)return{provider:r[0],local:_};let A=_>>>Kt,l=r[A];return l?{provider:l,local:_&zt}:null}function S(_,A,l){let s=o?dt():0,i;try{i=l()}catch{i=A}return o&&o(_,s),i}return{env:{flatsql_io_open(_,A,l){return S(F.open,-1,()=>{let s=Fr(e(),_,A);if(!s)return-1;let i=n?Lt(s)%r.length:0,u=r[i].open(s,l|0);if(u<0)return u;if(n&&u>zt)return-4;let p=n?i<<Kt|u:u;if(a){let E=y.decode(s);a(E)&&f.set(p,E)}return p})},flatsql_io_read(_,A,l,s){if(c&&f.has(_)){let i=o?dt():0;try{let u=e(),p=u.buffer??u;if(A>=0&&l>=0&&A+l<=p.byteLength){let E=Yt(c,f.get(_));if(E>=0){let g=Vt(c,E,new Uint8Array(p,A,l),s);if(g>=0)return o&&o(F.mirrorRead,i),g}}}catch{}}return S(F.read,-4,()=>{let i=m(_);return i?i.provider.read(i.local,A,l,s):-6})},flatsql_io_write(_,A,l,s){return S(F.write,-4,()=>{let i=m(_);return i?i.provider.write(i.local,A,l,s):-6})},flatsql_io_truncate(_,A){return S(F.truncate,-4,()=>{let l=m(_);return l?l.provider.truncate(l.local,A):-6})},flatsql_io_sync(_){return S(F.sync,-4,()=>{let A=m(_);return A?A.provider.sync(A.local):-6})},flatsql_io_size(_){return S(F.size,-4,()=>{let A=m(_);return A?A.provider.size(A.local):-6})},flatsql_io_close(_){return S(F.close,-4,()=>{f.delete(_);let A=m(_);return A?A.provider.close(A.local):-6})}}}}function Hr(t,{getMemory:e}){let r=Array.isArray(t.channels)?t.channels:[t.channel??t.buffer];if(r.length===0||r.some(c=>!(c instanceof SharedArrayBuffer)))throw new TypeError(\"A flatsql-io descriptor needs channels: SharedArrayBuffer[].\");let n=r.map(c=>qt({buffer:c,instanceId:t.instanceId,getMemory:e}));return{imports:Mr({getMemory:e,provider:n,mirror:t.mirror,trace:t.trace}),close(){for(let c of n)c.release()}}}function jt(t,e){let r=[],n=[];for(let o of t??[]){let c;if(typeof o==\"function\")c=o(e);else if(o&&o.provider===Nr)c=Hr(o,e);else if(o&&typeof o.factory==\"function\")c=o.factory({...e,config:o.config});else throw new TypeError(`Unresolvable extraImports entry ${JSON.stringify(o?.provider??o?.moduleUrl??typeof o)}; pass a factory function, a { provider: \"flatsql-io\" } descriptor, or (module workers) a { moduleUrl } descriptor.`);c&&c.imports&&typeof c.close==\"function\"?(r.push(c.imports),n.push(c.close)):c&&r.push(c)}return{fragments:r,close(){for(let o of n)try{o()}catch{}}}}function Xt(t,e){for(let r of e)for(let[n,o]of Object.entries(r??{}))t[n]={...t[n]??{},...o};return t}var $=0,Ur=1,Pr=2,Jt=4,Et=0,Zt=1;var vr=0;var St=Jt*4,Qr=4*1024*1024;function kr(t){if(typeof SharedArrayBuffer!=\"function\"||!(t instanceof SharedArrayBuffer))throw new TypeError(\"SAB hostcall channel requires a SharedArrayBuffer (cross-origin isolation in browsers).\")}function te(t={}){if(typeof SharedArrayBuffer!=\"function\")throw new Error(\"SharedArrayBuffer is unavailable; the async hostcall bridge requires it (browsers additionally require cross-origin isolation: COOP+COEP).\");let e=Number.isInteger(t.maxResponseBytes)?t.maxResponseBytes:Qr;if(e<=0)throw new RangeError(\"maxResponseBytes must be a positive integer.\");return new SharedArrayBuffer(St+e)}function ee(t={}){kr(t.buffer);let e=t.postRequest;if(typeof e!=\"function\")throw new TypeError(\"createSabHostcallClientDispatch requires a postRequest function.\");let r=Number.isFinite(t.timeoutMs)&&t.timeoutMs>0?t.timeoutMs:12e4,n=new Int32Array(t.buffer,0,Jt),o=t.buffer.byteLength-St;return function(a,f=null){if(Atomics.store(n,$,Zt),e({operation:a,params:f}),Atomics.wait(n,$,Zt,r)===\"timed-out\")throw Atomics.store(n,$,Et),new Error(`Hostcall \"${a}\" timed out after ${r}ms waiting for the controlling thread.`);let m=Atomics.load(n,Ur),S=Atomics.load(n,Pr);if(S<0||S>o)throw Atomics.store(n,$,Et),new RangeError(`Hostcall \"${a}\" response length ${S} exceeds channel capacity ${o}.`);let T=new Uint8Array(S);T.set(new Uint8Array(t.buffer,St,S)),Atomics.store(n,$,Et);let _=Ot(T);if(m!==vr){let A=new Error(_?.message??`Hostcall \"${a}\" failed on the host thread.`);throw A.name=_?.name??\"Error\",A.code=_?.code??null,A.operation=_?.operation??a,A.capability=_?.capability??null,A}return _}}var pt=class extends Error{constructor(e){super(`WASI exit with code ${e}`),this.name=\"WasiExitError\",this.code=e}};function qr(t,e,r,n){for(;;){let o=Atomics.load(t,e);if(r>n-o)return-1;if(Atomics.compareExchange(t,e,o,o+r)===o)return o}}function re(t={}){let e=t.processState,r=e?.args??t.args??[],n=e?.env??t.env??{},o=e?.input??new Uint8Array(t.stdinBytes??[]),c=t.logOutput===!0,a=t.performance??globalThis.performance??{now:()=>Date.now(),timeOrigin:0},f=t.crypto??globalThis.crypto??null,y=[],m=[],S=0,T=null;function _(d){T=d}function A(){return T}function l(){return new Uint8Array(T.buffer)}function s(){return new DataView(T.buffer)}let u=Object.entries(n).map(([d,h])=>`${d}=${h}`).map(d=>new TextEncoder().encode(d)),p=r.map(d=>new TextEncoder().encode(d));function E(d,h,I){let O;if(d===0)O=BigInt(Math.round((a.timeOrigin+a.now())*1e6));else if(d===1)O=BigInt(Math.round(a.now()*1e6));else return 28;return s().setBigUint64(I,O,!0),0}function g(d,h,I,O){if(d!==1&&d!==2)return 8;let R=d===1?y:m,x=0,U=s(),P=l();for(let v=0;v<I;v++){let Z=h+v*8,M=U.getUint32(Z,!0),L=U.getUint32(Z+4,!0);if(e){let N=d===1?e.stdout:e.stderr,It=qr(e.control,d,L,N.length);if(It<0)return 51;N.set(P.subarray(M,M+L),It)}else R.push(P.slice(M,M+L));x+=L}return U.setUint32(O,x,!0),0}function w(d,h,I,O){if(d!==0)return s().setUint32(O,0,!0),8;let R=s(),x=l(),U=0;for(let P=0;P<I;P+=1){let v=h+P*8,Z=R.getUint32(v,!0),M=R.getUint32(v+4,!0),L,N;if(e)do L=Atomics.load(e.control,0),N=Math.min(M,o.length-L);while(Atomics.compareExchange(e.control,0,L,L+N)!==L);else L=S,N=Math.min(M,o.length-L),S+=N;if(N===0){if(L>=o.length)break;continue}x.set(o.subarray(L,L+N),Z),U+=N}return R.setUint32(O,U,!0),0}function B(d){return d<=2?0:8}function q(d,h,I,O){return d<=2?70:8}function Ae(d,h){if(d>2)return 8;let I=s();return I.setUint8(h,2),I.setUint16(h+2,0,!0),I.setBigUint64(h+8,0n,!0),I.setBigUint64(h+16,0n,!0),0}function de(d,h){return d<=2?0:8}function Ee(d,h){return 8}function Se(d,h,I){return 8}function pe(){return 8}function me(d,h){let I=s();I.setUint32(d,u.length,!0);let O=0;for(let R of u)O+=R.length+1;return I.setUint32(h,O,!0),0}function ye(d,h){let I=s(),O=l(),R=h;for(let x=0;x<u.length;x++)I.setUint32(d+x*4,R,!0),O.set(u[x],R),R+=u[x].length,O[R]=0,R+=1;return 0}function he(d,h){let I=s();I.setUint32(d,p.length,!0);let O=0;for(let R of p)O+=R.length+1;return I.setUint32(h,O,!0),0}function Re(d,h){let I=s(),O=l(),R=h;for(let x=0;x<p.length;x++)I.setUint32(d+x*4,R,!0),O.set(p[x],R),R+=p[x].length,O[R]=0,R+=1;return 0}function Ie(d,h){return f?.getRandomValues?(f.getRandomValues(l().subarray(d,d+h)),0):52}function Oe(d){throw e&&(Atomics.store(e.control,4,d),Atomics.store(e.control,3,1)),c&&Rt(),new pt(d)}function Te(){return 0}function Rt(){if(y.length>0){let d=X(y);if(c){let h=new TextDecoder().decode(d);h&&console.log(h)}y.length=0}if(m.length>0){let d=X(m);if(c){let h=new TextDecoder().decode(d);h&&console.warn(h)}m.length=0}}function X(d){let h=0;for(let R of d)h+=R.length;let I=new Uint8Array(h),O=0;for(let R of d)I.set(R,O),O+=R.length;return I}return{imports:{wasi_snapshot_preview1:{clock_time_get:E,fd_write:g,fd_read:w,fd_close:B,fd_seek:q,fd_fdstat_get:Ae,fd_fdstat_set_flags:de,fd_prestat_get:Ee,fd_prestat_dir_name:Se,path_open:pe,environ_sizes_get:me,environ_get:ye,args_sizes_get:he,args_get:Re,random_get:Ie,proc_exit:Oe,sched_yield:Te}},setMemory:_,getMemory:A,flushOutput:Rt,get stdout(){return e?e.stdout.slice(0,Atomics.load(e.control,1)):X(y)},get stderr(){return e?e.stderr.slice(0,Atomics.load(e.control,2)):X(m)}}}var Gr=\"sdm.thread-hostcall\";function Wr(t){return WebAssembly.Module.imports(t).some(e=>e.module===ft)}function Yr(t){if(!t||typeof t!=\"object\")throw new Error(\"A threaded guest that imports space_data_module_host requires an owning hostcall channel.\");let e=String(t.channelName??\"\").trim(),r=String(t.token??\"\").trim();if(!e||!r)throw new Error(\"The owning thread-hostcall channel name and token are required.\");if(typeof BroadcastChannel!=\"function\")throw new Error(\"BroadcastChannel is required for nested pthread hostcalls.\");let n=te({maxResponseBytes:t.maxResponseBytes}),o=new BroadcastChannel(e),c=1;return{dispatch:ee({buffer:n,timeoutMs:t.timeoutMs,postRequest(f){o.postMessage({type:Gr,token:r,requestId:c++,buffer:n,...f})}}),close(){o.close()}}}function ne({wasmModule:t,memory:e,hostcallChannel:r,processState:n,extraImports:o,workerIndex:c,tid:a,threadSpawn:f}={}){let y=re({processState:n});y.setMemory(e);let m=null,S=null,T={...y.imports,env:{memory:e},wasi:{\"thread-spawn\":typeof f==\"function\"?f:()=>-1}};if(Wr(t)){S=Yr(r);let A=xt({dispatch:S.dispatch,getMemory:()=>m?.exports?.memory??e});Object.assign(T,A.imports)}let _=jt(o,{memory:e,getMemory:()=>m?.exports?.memory??e,workerIndex:c??null,tid:a??null});return Xt(T,_.fragments),T.env.memory=e,{imports:T,instantiate(){return m=new WebAssembly.Instance(t,T),y.setMemory(m.exports.memory??e),m},close(){S?.close(),_.close()}}}async function oe(t){let e=[];for(let r of t??[])if(r&&typeof r.moduleUrl==\"string\"){let o=(await import(r.moduleUrl))[r.exportName??\"default\"];if(typeof o!=\"function\")throw new TypeError(`extraImports module ${r.moduleUrl} exports no factory \"${r.exportName??\"default\"}\".`);e.push({factory:o,config:r.config??null})}else e.push(r);return e}var Vr=Object.freeze({PENDING:0,IDLE:1,CLAIMED:2,ASSIGNED:3,RUNNING:4,RETIRED:5}),{PENDING:Mn,IDLE:K,CLAIMED:se,ASSIGNED:z,RUNNING:st,RETIRED:yt}=Vr,ct=0,$r=1,Kr=2,zr=3,jr=4,ot=5,Xr=6,Zr=8,Jr=8,b=0,ht=1,ae=2,ce=3,tn=4,ie=1,en=536870911,rn=2;var C=t=>Zr+Jr*t;function mt(){return typeof performance<\"u\"&&typeof performance.now==\"function\"?performance.now():Date.now()}function it(t){Atomics.add(t,ct,1),Atomics.notify(t,ct)}function nn(t,e,r){Atomics.store(t,C(e)+b,r),Atomics.notify(t,C(e)+b),it(t)}function ue(t,e){nn(t.control,e,yt)}function on(t,e,r){let{control:n}=t,o=C(e);for(;;){let c=Atomics.load(n,o+b);if(c!==z&&c!==st||Atomics.load(n,o+ht)!==r)return!1;if(Atomics.compareExchange(n,o+b,c,K)===c)return it(n),!0}}function sn(t,e){let{control:r}=t,n=C(e);return Atomics.compareExchange(r,n+b,z,st)!==z?null:{tid:Atomics.load(r,n+ht),startArg:Atomics.load(r,n+ae)}}function cn(t,e){let{control:r}=t;Atomics.compareExchange(r,C(e)+b,st,K)===st&&it(r)}function le(t,e,{runThread:r,osThreadId:n=0}){let{control:o}=t,c=C(e)+b;for(n&&Atomics.store(o,C(e)+tn,n);;){let a=Atomics.load(o,c);if(a===yt)return;if(a!==z){Atomics.wait(o,c,a);continue}let f=sn(t,e);if(f){if(r(f.tid,f.startArg)===!1){ue(t,e);return}cn(t,e)}}}function fe(t,{owner:e=!1,grow:r=null,dispatchMessage:n=null}={}){let{control:o,spawnWaitMs:c}=t,a=Atomics.load(o,Xr),f=null,y=!0,m=l=>e||(Atomics.load(o,C(l)+ce)&ie)===0,S=()=>{let l=Math.min(Atomics.load(o,ot),a),s=0;for(let i=0;i<l;i+=1)if(m(i)){if(Atomics.compareExchange(o,C(i)+b,K,se)===K)return{slot:i,live:s+1};Atomics.load(o,C(i)+b)!==yt&&(s+=1)}return{slot:-1,live:s}},T=()=>{for(;;){let l=Atomics.load(o,ot);if(l>=a)return-1;if(Atomics.compareExchange(o,ot,l,l+1)===l)return Atomics.store(o,C(l)+b,se),l}},_=()=>{let l=T();if(l<0)return{slot:-1,reason:null};try{return r(l),{slot:l,reason:null}}catch{return ue(t,l),{slot:-1,reason:\"worker-create-failed\"}}},A=()=>{let l=S();if(l.slot>=0)return{slot:l.slot,waited:!1,reason:null};let s=typeof r==\"function\",i=mt(),u=i+(y?c:0),p=i+(y?Math.min(rn,c):0),E=!1;for(;;){let g=Atomics.load(o,ct);if(l=S(),l.slot>=0)return{slot:l.slot,waited:E,reason:null};let w=s&&Math.min(Atomics.load(o,ot),a)<a;if(w&&(l.live===0||mt()>=p)){let q=_();if(q.slot>=0||q.reason)return{...q,waited:E};continue}if(l.live===0)return{slot:-1,waited:E,reason:\"pool-exhausted\"};if(g===f&&!w)return{slot:-1,waited:E,reason:\"pool-exhausted\"};let B=(w?p:u)-mt();if(!w&&B<=0)return f=g,{slot:-1,waited:E,reason:\"pool-exhausted\"};if(B>0){try{Atomics.wait(o,ct,g,B)}catch{if(y=!1,!w)return{slot:-1,waited:E,reason:\"pool-exhausted\"};p=0;continue}E=!0}}};return l=>{let s=A();if(s.slot<0)return s.reason===\"pool-exhausted\"&&Atomics.add(o,jr,1),{tid:-1,slot:-1,reason:s.reason};let{slot:i}=s,u=C(i),p=Atomics.add(o,$r,1);if(p>en)return Atomics.store(o,u+b,K),it(o),{tid:-1,slot:-1,reason:\"tid-exhausted\"};if(Atomics.store(o,u+ht,p),Atomics.store(o,u+ae,l|0),Atomics.store(o,u+b,z),(Atomics.load(o,u+ce)&ie)!==0)try{n(i,p,l)}catch{return on(t,i,p),{tid:-1,slot:-1,reason:\"dispatch-failed\"}}else Atomics.notify(o,u+b);return Atomics.add(o,Kr,1),s.waited&&Atomics.add(o,zr,1),{tid:p,slot:i,reason:null}}}var j=null;function _e(t,e){try{return j.instantiate().exports.wasi_thread_start(t,e),!0}catch(r){return r&&r.name===\"WasiExitError\"?!0:(console.error(`[wasi-thread] guest thread ${t} trapped:`,r),self.postMessage({t:\"error\",tid:t,error:String(r?.message??r)}),!1)}}self.onmessage=async t=>{let e=t.data??{};if(e.t===\"probe\"){let r=e.pool??null;try{let n=await oe(e.extraImports??[]),o=r?fe(r):null;j=ne({wasmModule:e.wasmModule,memory:e.memory,hostcallChannel:e.hostcallChannel??null,processState:e.processState,extraImports:n,workerIndex:e.workerIndex,threadSpawn:o?c=>o(c).tid:void 0}),j.instantiate(),self.postMessage({t:\"ready\",ok:!0,protocol:2})}catch(n){j?.close(),j=null,self.postMessage({t:\"ready\",ok:!1,error:String(n?.message??n)});return}r&&le(r,e.slot,{runThread:_e});return}e.t===\"run\"&&(_e(e.tid,e.startArg),self.postMessage({t:\"exit\",tid:e.tid}))};})();\n";
|
|
7
|
-
export const WASI_THREAD_POOL_WORKER_BUNDLE_SHA256 = "
|
|
5
|
+
/** src/host/wasiThreadBrowserWorker.mjs, sha256 5384b18df8f6fb338126bd1caee7a1f1e8c9587a8ecbafc71958f16d0d22aa92. */
|
|
6
|
+
export const WASI_THREAD_POOL_WORKER_BUNDLE = "(()=>{var xo=Object.defineProperty;var Go=(e,t)=>{for(var s in t)xo(e,s,{get:t[s],enumerable:!0})};var Yo=new TextDecoder,ko=new TextEncoder,Te=\"$bin\";function qo(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function Ko(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Xt(e,t){if(e==null)return e??null;if(qo(e)){let s=t.length;return t.push(Ko(e)),{[Te]:s}}return e instanceof Date?e.toISOString():typeof e==\"bigint\"?e.toString():Array.isArray(e)?e.map(s=>Xt(s,t)):typeof e==\"object\"?Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0).map(([s,i])=>[s,Xt(i,t)])):e}function yt(e,t){if(e==null)return e;if(Array.isArray(e))return e.map(s=>yt(s,t));if(typeof e==\"object\"){let s=Object.keys(e);if(s.length===1&&s[0]===Te){let i=e[Te];if(!Number.isInteger(i)||i<0||i>=t.length)throw new RangeError(`Hostcall envelope references missing binary segment ${i}.`);return t[i]}return Object.fromEntries(s.map(i=>[i,yt(e[i],t)]))}return e}function Oe(e,t=[]){let s=ko.encode(JSON.stringify(e??null)),i=4+s.length+4;for(let E of t)i+=4+E.length;let r=new Uint8Array(i),o=new DataView(r.buffer),a=0;o.setUint32(a,s.length,!0),a+=4,r.set(s,a),a+=s.length,o.setUint32(a,t.length,!0),a+=4;for(let E of t)o.setUint32(a,E.length,!0),a+=4,r.set(E,a),a+=E.length;return r}function Jt(e){if(!(e instanceof Uint8Array))throw new TypeError(\"Hostcall envelope must be a Uint8Array.\");if(e.length<8)throw new RangeError(\"Hostcall envelope is truncated.\");let t=new DataView(e.buffer,e.byteOffset,e.byteLength),s=0,i=t.getUint32(s,!0);if(s+=4,s+i+4>e.length)throw new RangeError(\"Hostcall envelope meta exceeds envelope bounds.\");let r=JSON.parse(Yo.decode(e.subarray(s,s+i)));s+=i;let o=t.getUint32(s,!0);s+=4;let a=[];for(let E=0;E<o;E+=1){if(s+4>e.length)throw new RangeError(\"Hostcall envelope segment table is truncated.\");let l=t.getUint32(s,!0);if(s+=4,s+l>e.length)throw new RangeError(\"Hostcall envelope segment exceeds envelope bounds.\");a.push(e.subarray(s,s+l)),s+=l}return{meta:r,segments:a}}function Oi(e){let{meta:t,segments:s}=Jt(e);return yt(t,s)}var te=new Int32Array(2),mi=new Float32Array(te.buffer),gi=new Float64Array(te.buffer),yi=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ee;(function(e){e[e.UTF8_BYTES=1]=\"UTF8_BYTES\",e[e.UTF16_STRING=2]=\"UTF16_STRING\"})(ee||(ee={}));var dt=(e=>(e[e.Unchanged=0]=\"Unchanged\",e[e.Skipped=1]=\"Skipped\",e[e.Missing=2]=\"Missing\",e[e.Expired=3]=\"Expired\",e[e.Info=4]=\"Info\",e))(dt||{});var Nt=(e=>(e[e.Duplicates=0]=\"Duplicates\",e[e.None=1]=\"None\",e[e.Current=2]=\"Current\",e))(Nt||{});var Dt={};Go(Dt,{BodyRef:()=>se,BoolValue:()=>Xo,CacheKeyParams:()=>ya,ConfigEntry:()=>na,ContextParams:()=>Ef,CountValue:()=>ea,CronField:()=>Xa,CryptoParams:()=>Na,EnvVar:()=>cf,EpochStreamParams:()=>Ra,ExecParams:()=>hf,ExecResult:()=>uf,FsEntry:()=>af,FsParams:()=>of,FsStat:()=>ff,HasCapabilityParams:()=>ia,HttpParams:()=>oa,HttpResult:()=>aa,IpfsLink:()=>va,IpfsParams:()=>Ua,IpfsPin:()=>Ha,IpfsResult:()=>Pa,IpfsSwarmPeer:()=>Ba,KeyslotParams:()=>Da,MqttParams:()=>ef,MqttResult:()=>sf,NodeActivityEvent:()=>Za,NodeActivityParams:()=>$a,NodeBandwidthSample:()=>Wa,NodeStatusReport:()=>ja,NumberValue:()=>Jo,P2pLatestDataset:()=>Ka,P2pParams:()=>xa,P2pPeer:()=>Ya,P2pPeerValue:()=>ka,P2pPnmEntry:()=>qa,P2pSummary:()=>Ga,ProtocolParams:()=>Va,Provenance:()=>Ia,ProvenanceAttribute:()=>pa,PubsubParams:()=>Ma,PubsubSubscribed:()=>Fa,QuerySurfaceLimits:()=>ga,RandomBytesParams:()=>ra,SandboxQueryParams:()=>wa,SandboxQueryResult:()=>Ta,ScheduleParams:()=>za,SecretParams:()=>La,SecretResult:()=>Ca,SocketParams:()=>rf,SocketResult:()=>nf,SqlStreamParams:()=>Aa,StorageDeleteParams:()=>Ea,StorageExpireParams:()=>la,StorageExpireResult:()=>_a,StorageIngestParams:()=>da,StorageIngestResult:()=>Sa,StorageQueryParams:()=>fa,StorageWriteParams:()=>ca,StorageWriteResult:()=>ua,StoredRecordMeta:()=>ha,StreamResult:()=>ba,SurfaceColumn:()=>ma,SurfaceTable:()=>Oa,TextValue:()=>sa,TimeValue:()=>ta,TimersDelayParams:()=>Qa,WebsocketParams:()=>Ja,WebsocketResult:()=>tf});var Qo=Object.defineProperty,zo=(e,t,s)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,n=(e,t,s)=>zo(e,typeof t!=\"symbol\"?t+\"\":t,s);function f(e,t,s){let i=Math.floor(s/8),r=1<<s%8;return(e.getUint8(t+i)&r)!==0}function h(e,t,s,i){let r=Math.floor(s/8),o=1<<s%8,a=e.getUint8(t+r);e.setUint8(t+r,i?a|o:a&~o)}function c(e,t,s){let i=Math.min(e.getUint8(t),s),r=new Uint8Array(e.buffer,e.byteOffset+t+1,i);return new TextDecoder().decode(r)}function u(e,t,s,i){let o=new TextEncoder().encode(i),a=Math.min(o.length,s);e.setUint8(t,a);let E=new Uint8Array(e.buffer,e.byteOffset+t+1,s);E.fill(0),E.set(o.subarray(0,a))}var me=class Ui{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Ui(t,s)}vALUE(){return this.view.getUint8(this.offset+0)!==0}setVALUE(t){this.view.setUint8(this.offset+0,t?1:0)}};n(me,\"SIZE\",1);n(me,\"ALIGN\",1);var Xo=me,ge=class Pi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Pi(t,s)}vALUE(){return this.view.getFloat64(this.offset+0,!0)}setVALUE(t){this.view.setFloat64(this.offset+0,t,!0)}};n(ge,\"SIZE\",8);n(ge,\"ALIGN\",8);var Jo=ge,ye=class vi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new vi(t,s)}uNIX_MS(){return this.view.getBigUint64(this.offset+0,!0)}setUNIX_MS(t){this.view.setBigUint64(this.offset+0,t,!0)}};n(ye,\"SIZE\",8);n(ye,\"ALIGN\",8);var ta=ye,Ne=class Hi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Hi(t,s)}vALUE(){return this.view.getBigUint64(this.offset+0,!0)}setVALUE(t){this.view.setBigUint64(this.offset+0,t,!0)}};n(Ne,\"SIZE\",8);n(Ne,\"ALIGN\",8);var ea=Ne,De=class Bi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Bi(t,s)}hasVALUE(){return f(this.view,this.offset,0)}setHasVALUE(t){h(this.view,this.offset,0,t)}vALUE(){return c(this.view,this.offset+1,255)}setVALUE(t){u(this.view,this.offset+1,255,t),this.setHasVALUE(!0)}};n(De,\"SIZE\",257);n(De,\"ALIGN\",1);var sa=De,Le=class Mi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Mi(t,s)}tOKEN(){return this.view.getBigUint64(this.offset+8,!0)}setTOKEN(t){this.view.setBigUint64(this.offset+8,t,!0)}sIZE(){return this.view.getBigUint64(this.offset+16,!0)}setSIZE(t){this.view.setBigUint64(this.offset+16,t,!0)}fRAMES(){return this.view.getBigInt64(this.offset+24,!0)}setFRAMES(t){this.view.setBigInt64(this.offset+24,t,!0)}hasFNV1A64(){return f(this.view,this.offset,0)}setHasFNV1A64(t){h(this.view,this.offset,0,t)}fNV1A64(){return c(this.view,this.offset+32,16)}setFNV1A64(t){u(this.view,this.offset+32,16,t),this.setHasFNV1A64(!0)}};n(Le,\"SIZE\",56);n(Le,\"ALIGN\",8);var se=Le,Ce=class Fi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Fi(t,s)}hasCAPABILITY(){return f(this.view,this.offset,0)}setHasCAPABILITY(t){h(this.view,this.offset,0,t)}cAPABILITY(){return c(this.view,this.offset+1,64)}setCAPABILITY(t){u(this.view,this.offset+1,64,t),this.setHasCAPABILITY(!0)}};n(Ce,\"SIZE\",66);n(Ce,\"ALIGN\",1);var ia=Ce,Ue=class Vi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Vi(t,s)}lENGTH(){return this.view.getUint32(this.offset+0,!0)}setLENGTH(t){this.view.setUint32(this.offset+0,t,!0)}};n(Ue,\"SIZE\",4);n(Ue,\"ALIGN\",4);var ra=Ue,Pe=class xi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new xi(t,s)}hasKEY(){return f(this.view,this.offset,0)}setHasKEY(t){h(this.view,this.offset,0,t)}kEY(){return c(this.view,this.offset+1,255)}setKEY(t){u(this.view,this.offset+1,255,t),this.setHasKEY(!0)}kIND(){return this.view.getUint8(this.offset+257)}setKIND(t){this.view.setUint8(this.offset+257,t)}hasSTRING_VALUE(){return f(this.view,this.offset,1)}setHasSTRING_VALUE(t){h(this.view,this.offset,1,t)}sTRING_VALUE(){return c(this.view,this.offset+258,255)}setSTRING_VALUE(t){u(this.view,this.offset+258,255,t),this.setHasSTRING_VALUE(!0)}nUMBER_VALUE(){return this.view.getFloat64(this.offset+520,!0)}setNUMBER_VALUE(t){this.view.setFloat64(this.offset+520,t,!0)}bOOL_VALUE(){return this.view.getUint8(this.offset+528)!==0}setBOOL_VALUE(t){this.view.setUint8(this.offset+528,t?1:0)}};n(Pe,\"SIZE\",536);n(Pe,\"ALIGN\",8);var na=Pe,ve=class Gi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Gi(t,s)}hasMETHOD(){return f(this.view,this.offset,0)}setHasMETHOD(t){h(this.view,this.offset,0,t)}mETHOD(){return c(this.view,this.offset+1,16)}setMETHOD(t){u(this.view,this.offset+1,16,t),this.setHasMETHOD(!0)}tIMEOUT_MS(){return this.view.getUint32(this.offset+20,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+20,t,!0)}mAX_BYTES(){return this.view.getBigUint64(this.offset+24,!0)}setMAX_BYTES(t){this.view.setBigUint64(this.offset+24,t,!0)}nO_REDIRECTS(){return this.view.getUint8(this.offset+32)!==0}setNO_REDIRECTS(t){this.view.setUint8(this.offset+32,t?1:0)}};n(ve,\"SIZE\",40);n(ve,\"ALIGN\",8);var oa=ve,He=class Yi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Yi(t,s)}sTATUS(){return this.view.getInt32(this.offset+0,!0)}setSTATUS(t){this.view.setInt32(this.offset+0,t,!0)}rETRIEVED_MS(){return this.view.getBigUint64(this.offset+8,!0)}setRETRIEVED_MS(t){this.view.setBigUint64(this.offset+8,t,!0)}};n(He,\"SIZE\",16);n(He,\"ALIGN\",8);var aa=He,Be=class ki{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new ki(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+1,64)}setSCHEMA(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA(!0)}hasDAY(){return f(this.view,this.offset,1)}setHasDAY(t){h(this.view,this.offset,1,t)}dAY(){return c(this.view,this.offset+66,16)}setDAY(t){u(this.view,this.offset+66,16,t),this.setHasDAY(!0)}hasENTITY_ID(){return f(this.view,this.offset,2)}setHasENTITY_ID(t){h(this.view,this.offset,2,t)}eNTITY_ID(){return c(this.view,this.offset+83,255)}setENTITY_ID(t){u(this.view,this.offset+83,255,t),this.setHasENTITY_ID(!0)}nORAD_CAT_ID(){return this.view.getUint32(this.offset+340,!0)}setNORAD_CAT_ID(t){this.view.setUint32(this.offset+340,t,!0)}lIMIT(){return this.view.getUint32(this.offset+344,!0)}setLIMIT(t){this.view.setUint32(this.offset+344,t,!0)}};n(Be,\"SIZE\",348);n(Be,\"ALIGN\",4);var fa=Be,Me=class qi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new qi(t,s)}hasCID(){return f(this.view,this.offset,0)}setHasCID(t){h(this.view,this.offset,0,t)}cID(){return c(this.view,this.offset+1,128)}setCID(t){u(this.view,this.offset+1,128,t),this.setHasCID(!0)}rOW_ID(){return this.view.getBigInt64(this.offset+136,!0)}setROW_ID(t){this.view.setBigInt64(this.offset+136,t,!0)}hasPEER_ID(){return f(this.view,this.offset,1)}setHasPEER_ID(t){h(this.view,this.offset,1,t)}pEER_ID(){return c(this.view,this.offset+144,128)}setPEER_ID(t){u(this.view,this.offset+144,128,t),this.setHasPEER_ID(!0)}tIMESTAMP_MS(){return this.view.getBigInt64(this.offset+280,!0)}setTIMESTAMP_MS(t){this.view.setBigInt64(this.offset+280,t,!0)}mATERIALIZED_MS(){return this.view.getBigInt64(this.offset+288,!0)}setMATERIALIZED_MS(t){this.view.setBigInt64(this.offset+288,t,!0)}lENGTH(){return this.view.getUint32(this.offset+296,!0)}setLENGTH(t){this.view.setUint32(this.offset+296,t,!0)}hasPROVIDER_ID(){return f(this.view,this.offset,2)}setHasPROVIDER_ID(t){h(this.view,this.offset,2,t)}pROVIDER_ID(){return c(this.view,this.offset+300,128)}setPROVIDER_ID(t){u(this.view,this.offset+300,128,t),this.setHasPROVIDER_ID(!0)}hasSOURCE_NAME(){return f(this.view,this.offset,3)}setHasSOURCE_NAME(t){h(this.view,this.offset,3,t)}sOURCE_NAME(){return c(this.view,this.offset+429,128)}setSOURCE_NAME(t){u(this.view,this.offset+429,128,t),this.setHasSOURCE_NAME(!0)}hasBATCH_ID(){return f(this.view,this.offset,4)}setHasBATCH_ID(t){h(this.view,this.offset,4,t)}bATCH_ID(){return c(this.view,this.offset+558,128)}setBATCH_ID(t){u(this.view,this.offset+558,128,t),this.setHasBATCH_ID(!0)}hasPRODUCER_PEER_ID(){return f(this.view,this.offset,5)}setHasPRODUCER_PEER_ID(t){h(this.view,this.offset,5,t)}pRODUCER_PEER_ID(){return c(this.view,this.offset+687,128)}setPRODUCER_PEER_ID(t){u(this.view,this.offset+687,128,t),this.setHasPRODUCER_PEER_ID(!0)}hasLICENSE(){return f(this.view,this.offset,6)}setHasLICENSE(t){h(this.view,this.offset,6,t)}lICENSE(){return c(this.view,this.offset+816,128)}setLICENSE(t){u(this.view,this.offset+816,128,t),this.setHasLICENSE(!0)}};n(Me,\"SIZE\",952);n(Me,\"ALIGN\",8);var ha=Me,Fe=class Ki{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Ki(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+1,64)}setSCHEMA(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA(!0)}};n(Fe,\"SIZE\",66);n(Fe,\"ALIGN\",1);var ca=Fe,Ve=class ji{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new ji(t,s)}hasCID(){return f(this.view,this.offset,0)}setHasCID(t){h(this.view,this.offset,0,t)}cID(){return c(this.view,this.offset+1,128)}setCID(t){u(this.view,this.offset+1,128,t),this.setHasCID(!0)}};n(Ve,\"SIZE\",130);n(Ve,\"ALIGN\",1);var ua=Ve,xe=class Wi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Wi(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+1,64)}setSCHEMA(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA(!0)}hasCID(){return f(this.view,this.offset,1)}setHasCID(t){h(this.view,this.offset,1,t)}cID(){return c(this.view,this.offset+66,128)}setCID(t){u(this.view,this.offset+66,128,t),this.setHasCID(!0)}};n(xe,\"SIZE\",195);n(xe,\"ALIGN\",1);var Ea=xe,Ge=class $i{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new $i(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+1,64)}setSCHEMA(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA(!0)}hasPROVIDER_ID(){return f(this.view,this.offset,1)}setHasPROVIDER_ID(t){h(this.view,this.offset,1,t)}pROVIDER_ID(){return c(this.view,this.offset+66,128)}setPROVIDER_ID(t){u(this.view,this.offset+66,128,t),this.setHasPROVIDER_ID(!0)}hasSOURCE_NAME(){return f(this.view,this.offset,2)}setHasSOURCE_NAME(t){h(this.view,this.offset,2,t)}sOURCE_NAME(){return c(this.view,this.offset+195,128)}setSOURCE_NAME(t){u(this.view,this.offset+195,128,t),this.setHasSOURCE_NAME(!0)}bEFORE_MS(){return this.view.getBigUint64(this.offset+328,!0)}setBEFORE_MS(t){this.view.setBigUint64(this.offset+328,t,!0)}bATCH(){return this.view.getUint32(this.offset+336,!0)}setBATCH(t){this.view.setUint32(this.offset+336,t,!0)}mAX_DELETES(){return this.view.getUint32(this.offset+340,!0)}setMAX_DELETES(t){this.view.setUint32(this.offset+340,t,!0)}};n(Ge,\"SIZE\",344);n(Ge,\"ALIGN\",8);var la=Ge,Ye=class Zi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Zi(t,s)}dELETED(){return this.view.getBigUint64(this.offset+0,!0)}setDELETED(t){this.view.setBigUint64(this.offset+0,t,!0)}mISSING(){return this.view.getBigUint64(this.offset+8,!0)}setMISSING(t){this.view.setBigUint64(this.offset+8,t,!0)}cAPPED(){return this.view.getUint8(this.offset+16)!==0}setCAPPED(t){this.view.setUint8(this.offset+16,t?1:0)}};n(Ye,\"SIZE\",24);n(Ye,\"ALIGN\",8);var _a=Ye,ke=class Qi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Qi(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+2,64)}setSCHEMA(t){u(this.view,this.offset+2,64,t),this.setHasSCHEMA(!0)}hasPROVIDER_ID(){return f(this.view,this.offset,1)}setHasPROVIDER_ID(t){h(this.view,this.offset,1,t)}pROVIDER_ID(){return c(this.view,this.offset+67,128)}setPROVIDER_ID(t){u(this.view,this.offset+67,128,t),this.setHasPROVIDER_ID(!0)}hasSOURCE_NAME(){return f(this.view,this.offset,2)}setHasSOURCE_NAME(t){h(this.view,this.offset,2,t)}sOURCE_NAME(){return c(this.view,this.offset+196,128)}setSOURCE_NAME(t){u(this.view,this.offset+196,128,t),this.setHasSOURCE_NAME(!0)}hasBATCH_ID(){return f(this.view,this.offset,3)}setHasBATCH_ID(t){h(this.view,this.offset,3,t)}bATCH_ID(){return c(this.view,this.offset+325,128)}setBATCH_ID(t){u(this.view,this.offset+325,128,t),this.setHasBATCH_ID(!0)}hasSOURCE_URL(){return f(this.view,this.offset,4)}setHasSOURCE_URL(t){h(this.view,this.offset,4,t)}sOURCE_URL(){return c(this.view,this.offset+454,255)}setSOURCE_URL(t){u(this.view,this.offset+454,255,t),this.setHasSOURCE_URL(!0)}hasCONTENT_KEY_ID(){return f(this.view,this.offset,5)}setHasCONTENT_KEY_ID(t){h(this.view,this.offset,5,t)}cONTENT_KEY_ID(){return c(this.view,this.offset+710,128)}setCONTENT_KEY_ID(t){u(this.view,this.offset+710,128,t),this.setHasCONTENT_KEY_ID(!0)}hasSOURCE_PEER(){return f(this.view,this.offset,6)}setHasSOURCE_PEER(t){h(this.view,this.offset,6,t)}sOURCE_PEER(){return c(this.view,this.offset+839,128)}setSOURCE_PEER(t){u(this.view,this.offset+839,128,t),this.setHasSOURCE_PEER(!0)}hasLICENSE(){return f(this.view,this.offset,7)}setHasLICENSE(t){h(this.view,this.offset,7,t)}lICENSE(){return c(this.view,this.offset+968,128)}setLICENSE(t){u(this.view,this.offset+968,128,t),this.setHasLICENSE(!0)}hasLICENSE_URL(){return f(this.view,this.offset,8)}setHasLICENSE_URL(t){h(this.view,this.offset,8,t)}lICENSE_URL(){return c(this.view,this.offset+1097,255)}setLICENSE_URL(t){u(this.view,this.offset+1097,255,t),this.setHasLICENSE_URL(!0)}hasCITATION(){return f(this.view,this.offset,9)}setHasCITATION(t){h(this.view,this.offset,9,t)}cITATION(){return c(this.view,this.offset+1353,255)}setCITATION(t){u(this.view,this.offset+1353,255,t),this.setHasCITATION(!0)}sHARE_ALIKE(){return this.view.getUint8(this.offset+1609)!==0}setSHARE_ALIKE(t){this.view.setUint8(this.offset+1609,t?1:0)}rECONCILE(){return this.view.getUint8(this.offset+1610)}setRECONCILE(t){this.view.setUint8(this.offset+1610,t)}hasARCHIVE_SOURCE(){return f(this.view,this.offset,10)}setHasARCHIVE_SOURCE(t){h(this.view,this.offset,10,t)}aRCHIVE_SOURCE(){return c(this.view,this.offset+1611,128)}setARCHIVE_SOURCE(t){u(this.view,this.offset+1611,128,t),this.setHasARCHIVE_SOURCE(!0)}hasARCHIVE_NAME(){return f(this.view,this.offset,11)}setHasARCHIVE_NAME(t){h(this.view,this.offset,11,t)}aRCHIVE_NAME(){return c(this.view,this.offset+1740,255)}setARCHIVE_NAME(t){u(this.view,this.offset+1740,255,t),this.setHasARCHIVE_NAME(!0)}};n(ke,\"SIZE\",1996);n(ke,\"ALIGN\",1);var da=ke,qe=class zi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new zi(t,s)}hasSOURCE_URL(){return f(this.view,this.offset,0)}setHasSOURCE_URL(t){h(this.view,this.offset,0,t)}sOURCE_URL(){return c(this.view,this.offset+1,255)}setSOURCE_URL(t){u(this.view,this.offset+1,255,t),this.setHasSOURCE_URL(!0)}hTTP_STATUS(){return this.view.getInt32(this.offset+260,!0)}setHTTP_STATUS(t){this.view.setInt32(this.offset+260,t,!0)}hasETAG(){return f(this.view,this.offset,1)}setHasETAG(t){h(this.view,this.offset,1,t)}eTAG(){return c(this.view,this.offset+264,255)}setETAG(t){u(this.view,this.offset+264,255,t),this.setHasETAG(!0)}hasLAST_MODIFIED(){return f(this.view,this.offset,2)}setHasLAST_MODIFIED(t){h(this.view,this.offset,2,t)}lAST_MODIFIED(){return c(this.view,this.offset+520,64)}setLAST_MODIFIED(t){u(this.view,this.offset+520,64,t),this.setHasLAST_MODIFIED(!0)}hasCONTENT_TYPE(){return f(this.view,this.offset,3)}setHasCONTENT_TYPE(t){h(this.view,this.offset,3,t)}cONTENT_TYPE(){return c(this.view,this.offset+585,128)}setCONTENT_TYPE(t){u(this.view,this.offset+585,128,t),this.setHasCONTENT_TYPE(!0)}rETRIEVED_MS(){return this.view.getBigUint64(this.offset+720,!0)}setRETRIEVED_MS(t){this.view.setBigUint64(this.offset+720,t,!0)}hasPARSER(){return f(this.view,this.offset,4)}setHasPARSER(t){h(this.view,this.offset,4,t)}pARSER(){return c(this.view,this.offset+728,128)}setPARSER(t){u(this.view,this.offset+728,128,t),this.setHasPARSER(!0)}hasPARSER_VERSION(){return f(this.view,this.offset,5)}setHasPARSER_VERSION(t){h(this.view,this.offset,5,t)}pARSER_VERSION(){return c(this.view,this.offset+857,64)}setPARSER_VERSION(t){u(this.view,this.offset+857,64,t),this.setHasPARSER_VERSION(!0)}hasSOURCE_SHA256(){return f(this.view,this.offset,6)}setHasSOURCE_SHA256(t){h(this.view,this.offset,6,t)}sOURCE_SHA256(){return c(this.view,this.offset+922,64)}setSOURCE_SHA256(t){u(this.view,this.offset+922,64,t),this.setHasSOURCE_SHA256(!0)}hasNORMALIZED_SHA256(){return f(this.view,this.offset,7)}setHasNORMALIZED_SHA256(t){h(this.view,this.offset,7,t)}nORMALIZED_SHA256(){return c(this.view,this.offset+987,64)}setNORMALIZED_SHA256(t){u(this.view,this.offset+987,64,t),this.setHasNORMALIZED_SHA256(!0)}nORMALIZED_COUNT(){return this.view.getBigUint64(this.offset+1056,!0)}setNORMALIZED_COUNT(t){this.view.setBigUint64(this.offset+1056,t,!0)}fROM_CACHE(){return this.view.getUint8(this.offset+1064)!==0}setFROM_CACHE(t){this.view.setUint8(this.offset+1064,t?1:0)}};n(qe,\"SIZE\",1072);n(qe,\"ALIGN\",8);var Ia=qe,Ke=class Xi{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Xi(t,s)}hasNAME(){return f(this.view,this.offset,0)}setHasNAME(t){h(this.view,this.offset,0,t)}nAME(){return c(this.view,this.offset+1,128)}setNAME(t){u(this.view,this.offset+1,128,t),this.setHasNAME(!0)}hasVALUE(){return f(this.view,this.offset,1)}setHasVALUE(t){h(this.view,this.offset,1,t)}vALUE(){return c(this.view,this.offset+130,255)}setVALUE(t){u(this.view,this.offset+130,255,t),this.setHasVALUE(!0)}};n(Ke,\"SIZE\",386);n(Ke,\"ALIGN\",1);var pa=Ke,je=class Ji{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Ji(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+1,64)}setSCHEMA(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA(!0)}hasBATCH_ID(){return f(this.view,this.offset,1)}setHasBATCH_ID(t){h(this.view,this.offset,1,t)}bATCH_ID(){return c(this.view,this.offset+66,128)}setBATCH_ID(t){u(this.view,this.offset+66,128,t),this.setHasBATCH_ID(!0)}iNSERTED(){return this.view.getBigUint64(this.offset+200,!0)}setINSERTED(t){this.view.setBigUint64(this.offset+200,t,!0)}rECONCILED_DUPLICATES(){return this.view.getBigUint64(this.offset+208,!0)}setRECONCILED_DUPLICATES(t){this.view.setBigUint64(this.offset+208,t,!0)}rECONCILED_OLD_BATCHES(){return this.view.getBigUint64(this.offset+216,!0)}setRECONCILED_OLD_BATCHES(t){this.view.setBigUint64(this.offset+216,t,!0)}hasARCHIVED(){return f(this.view,this.offset,2)}setHasARCHIVED(t){h(this.view,this.offset,2,t)}aRCHIVED(){return c(this.view,this.offset+224,255)}setARCHIVED(t){u(this.view,this.offset+224,255,t),this.setHasARCHIVED(!0)}hasPROVENANCE_FILE(){return f(this.view,this.offset,3)}setHasPROVENANCE_FILE(t){h(this.view,this.offset,3,t)}pROVENANCE_FILE(){return c(this.view,this.offset+480,255)}setPROVENANCE_FILE(t){u(this.view,this.offset+480,255,t),this.setHasPROVENANCE_FILE(!0)}};n(je,\"SIZE\",736);n(je,\"ALIGN\",8);var Sa=je,We=class tr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new tr(t,s)}dELIVER(){return this.view.getUint8(this.offset+0)}setDELIVER(t){this.view.setUint8(this.offset+0,t)}};n(We,\"SIZE\",1);n(We,\"ALIGN\",1);var Aa=We,$e=class er{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new er(t,s)}rOWS(){return this.view.getBigUint64(this.offset+8,!0)}setROWS(t){this.view.setBigUint64(this.offset+8,t,!0)}cOLUMNS(){return this.view.getUint32(this.offset+16,!0)}setCOLUMNS(t){this.view.setUint32(this.offset+16,t,!0)}hasREF(){return f(this.view,this.offset,0)}setHasREF(t){h(this.view,this.offset,0,t)}rEF(){return new se(this.buffer,this.offset+24)}};n($e,\"SIZE\",80);n($e,\"ALIGN\",8);var ba=$e,Ze=class sr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new sr(t,s)}hasSCHEMA(){return f(this.view,this.offset,0)}setHasSCHEMA(t){h(this.view,this.offset,0,t)}sCHEMA(){return c(this.view,this.offset+1,64)}setSCHEMA(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA(!0)}hasSOURCE(){return f(this.view,this.offset,1)}setHasSOURCE(t){h(this.view,this.offset,1,t)}sOURCE(){return c(this.view,this.offset+66,128)}setSOURCE(t){u(this.view,this.offset+66,128,t),this.setHasSOURCE(!0)}hasPROFILE(){return f(this.view,this.offset,2)}setHasPROFILE(t){h(this.view,this.offset,2,t)}pROFILE(){return c(this.view,this.offset+195,32)}setPROFILE(t){u(this.view,this.offset+195,32,t),this.setHasPROFILE(!0)}ePOCH(){return this.view.getFloat64(this.offset+232,!0)}setEPOCH(t){this.view.setFloat64(this.offset+232,t,!0)}lIMIT(){return this.view.getUint32(this.offset+240,!0)}setLIMIT(t){this.view.setUint32(this.offset+240,t,!0)}dELIVER(){return this.view.getUint8(this.offset+244)}setDELIVER(t){this.view.setUint8(this.offset+244,t)}};n(Ze,\"SIZE\",248);n(Ze,\"ALIGN\",8);var Ra=Ze,Qe=class ir{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new ir(t,s)}wANT(){return this.view.getUint8(this.offset+0)}setWANT(t){this.view.setUint8(this.offset+0,t)}dELIVER(){return this.view.getUint8(this.offset+1)}setDELIVER(t){this.view.setUint8(this.offset+1,t)}};n(Qe,\"SIZE\",2);n(Qe,\"ALIGN\",1);var wa=Qe,ze=class rr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new rr(t,s)}kIND(){return this.view.getUint8(this.offset+1)}setKIND(t){this.view.setUint8(this.offset+1,t)}rOWS(){return this.view.getBigUint64(this.offset+8,!0)}setROWS(t){this.view.setBigUint64(this.offset+8,t,!0)}cOLUMNS(){return this.view.getUint32(this.offset+16,!0)}setCOLUMNS(t){this.view.setUint32(this.offset+16,t,!0)}hasREF(){return f(this.view,this.offset,0)}setHasREF(t){h(this.view,this.offset,0,t)}rEF(){return new se(this.buffer,this.offset+24)}};n(ze,\"SIZE\",80);n(ze,\"ALIGN\",8);var Ta=ze,Xe=class nr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new nr(t,s)}hasNAME(){return f(this.view,this.offset,0)}setHasNAME(t){h(this.view,this.offset,0,t)}nAME(){return c(this.view,this.offset+1,128)}setNAME(t){u(this.view,this.offset+1,128,t),this.setHasNAME(!0)}hasKIND(){return f(this.view,this.offset,1)}setHasKIND(t){h(this.view,this.offset,1,t)}kIND(){return c(this.view,this.offset+130,16)}setKIND(t){u(this.view,this.offset+130,16,t),this.setHasKIND(!0)}hasSOURCE(){return f(this.view,this.offset,2)}setHasSOURCE(t){h(this.view,this.offset,2,t)}sOURCE(){return c(this.view,this.offset+147,128)}setSOURCE(t){u(this.view,this.offset+147,128,t),this.setHasSOURCE(!0)}rECORDS(){return this.view.getBigInt64(this.offset+280,!0)}setRECORDS(t){this.view.setBigInt64(this.offset+280,t,!0)}};n(Xe,\"SIZE\",288);n(Xe,\"ALIGN\",8);var Oa=Xe,Je=class or{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new or(t,s)}hasTABLE(){return f(this.view,this.offset,0)}setHasTABLE(t){h(this.view,this.offset,0,t)}tABLE(){return c(this.view,this.offset+1,128)}setTABLE(t){u(this.view,this.offset+1,128,t),this.setHasTABLE(!0)}hasNAME(){return f(this.view,this.offset,1)}setHasNAME(t){h(this.view,this.offset,1,t)}nAME(){return c(this.view,this.offset+130,128)}setNAME(t){u(this.view,this.offset+130,128,t),this.setHasNAME(!0)}pLACEHOLDER(){return this.view.getUint8(this.offset+259)!==0}setPLACEHOLDER(t){this.view.setUint8(this.offset+259,t?1:0)}};n(Je,\"SIZE\",260);n(Je,\"ALIGN\",1);var ma=Je,ts=class ar{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new ar(t,s)}tIMEOUT_MS(){return this.view.getUint32(this.offset+0,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+0,t,!0)}mAX_ROWS(){return this.view.getBigUint64(this.offset+8,!0)}setMAX_ROWS(t){this.view.setBigUint64(this.offset+8,t,!0)}mAX_BYTES(){return this.view.getBigUint64(this.offset+16,!0)}setMAX_BYTES(t){this.view.setBigUint64(this.offset+16,t,!0)}};n(ts,\"SIZE\",24);n(ts,\"ALIGN\",8);var ga=ts,es=class fr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new fr(t,s)}hasSCHEMA_NAME(){return f(this.view,this.offset,0)}setHasSCHEMA_NAME(t){h(this.view,this.offset,0,t)}sCHEMA_NAME(){return c(this.view,this.offset+1,64)}setSCHEMA_NAME(t){u(this.view,this.offset+1,64,t),this.setHasSCHEMA_NAME(!0)}hasSCHEMA_VERSION(){return f(this.view,this.offset,1)}setHasSCHEMA_VERSION(t){h(this.view,this.offset,1,t)}sCHEMA_VERSION(){return c(this.view,this.offset+66,32)}setSCHEMA_VERSION(t){u(this.view,this.offset+66,32,t),this.setHasSCHEMA_VERSION(!0)}hasFORMAT(){return f(this.view,this.offset,2)}setHasFORMAT(t){h(this.view,this.offset,2,t)}fORMAT(){return c(this.view,this.offset+99,32)}setFORMAT(t){u(this.view,this.offset+99,32,t),this.setHasFORMAT(!0)}hasPUBLISH_EVENT_KEY(){return f(this.view,this.offset,3)}setHasPUBLISH_EVENT_KEY(t){h(this.view,this.offset,3,t)}pUBLISH_EVENT_KEY(){return c(this.view,this.offset+132,128)}setPUBLISH_EVENT_KEY(t){u(this.view,this.offset+132,128,t),this.setHasPUBLISH_EVENT_KEY(!0)}};n(es,\"SIZE\",261);n(es,\"ALIGN\",1);var ya=es,ss=class hr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new hr(t,s)}aLGORITHM(){return this.view.getUint8(this.offset+0)}setALGORITHM(t){this.view.setUint8(this.offset+0,t)}lENGTH(){return this.view.getUint32(this.offset+4,!0)}setLENGTH(t){this.view.setUint32(this.offset+4,t,!0)}};n(ss,\"SIZE\",8);n(ss,\"ALIGN\",4);var Na=ss,is=class cr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new cr(t,s)}hasSLOT_ID(){return f(this.view,this.offset,0)}setHasSLOT_ID(t){h(this.view,this.offset,0,t)}sLOT_ID(){return c(this.view,this.offset+1,128)}setSLOT_ID(t){u(this.view,this.offset+1,128,t),this.setHasSLOT_ID(!0)}aLGORITHM(){return this.view.getUint8(this.offset+130)}setALGORITHM(t){this.view.setUint8(this.offset+130,t)}};n(is,\"SIZE\",131);n(is,\"ALIGN\",1);var Da=is,rs=class ur{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new ur(t,s)}hasID(){return f(this.view,this.offset,0)}setHasID(t){h(this.view,this.offset,0,t)}iD(){return c(this.view,this.offset+1,128)}setID(t){u(this.view,this.offset+1,128,t),this.setHasID(!0)}hasUSERNAME(){return f(this.view,this.offset,1)}setHasUSERNAME(t){h(this.view,this.offset,1,t)}uSERNAME(){return c(this.view,this.offset+130,255)}setUSERNAME(t){u(this.view,this.offset+130,255,t),this.setHasUSERNAME(!0)}};n(rs,\"SIZE\",386);n(rs,\"ALIGN\",1);var La=rs,ns=class Er{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Er(t,s)}hasID(){return f(this.view,this.offset,0)}setHasID(t){h(this.view,this.offset,0,t)}iD(){return c(this.view,this.offset+1,128)}setID(t){u(this.view,this.offset+1,128,t),this.setHasID(!0)}hasUSERNAME(){return f(this.view,this.offset,1)}setHasUSERNAME(t){h(this.view,this.offset,1,t)}uSERNAME(){return c(this.view,this.offset+130,255)}setUSERNAME(t){u(this.view,this.offset+130,255,t),this.setHasUSERNAME(!0)}cONFIGURED(){return this.view.getUint8(this.offset+386)!==0}setCONFIGURED(t){this.view.setUint8(this.offset+386,t?1:0)}hasUSERNAME_MASKED(){return f(this.view,this.offset,2)}setHasUSERNAME_MASKED(t){h(this.view,this.offset,2,t)}uSERNAME_MASKED(){return c(this.view,this.offset+387,255)}setUSERNAME_MASKED(t){u(this.view,this.offset+387,255,t),this.setHasUSERNAME_MASKED(!0)}uPDATED_MS(){return this.view.getBigUint64(this.offset+648,!0)}setUPDATED_MS(t){this.view.setBigUint64(this.offset+648,t,!0)}vERIFIED_MS(){return this.view.getBigUint64(this.offset+656,!0)}setVERIFIED_MS(t){this.view.setBigUint64(this.offset+656,t,!0)}};n(ns,\"SIZE\",664);n(ns,\"ALIGN\",8);var Ca=ns,os=class lr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new lr(t,s)}hasCID(){return f(this.view,this.offset,0)}setHasCID(t){h(this.view,this.offset,0,t)}cID(){return c(this.view,this.offset+1,128)}setCID(t){u(this.view,this.offset+1,128,t),this.setHasCID(!0)}hasNAME(){return f(this.view,this.offset,1)}setHasNAME(t){h(this.view,this.offset,1,t)}nAME(){return c(this.view,this.offset+130,255)}setNAME(t){u(this.view,this.offset+130,255,t),this.setHasNAME(!0)}hasTYPE(){return f(this.view,this.offset,2)}setHasTYPE(t){h(this.view,this.offset,2,t)}tYPE(){return c(this.view,this.offset+386,32)}setTYPE(t){u(this.view,this.offset+386,32,t),this.setHasTYPE(!0)}hasLIFETIME(){return f(this.view,this.offset,3)}setHasLIFETIME(t){h(this.view,this.offset,3,t)}lIFETIME(){return c(this.view,this.offset+419,32)}setLIFETIME(t){u(this.view,this.offset+419,32,t),this.setHasLIFETIME(!0)}hasTTL(){return f(this.view,this.offset,4)}setHasTTL(t){h(this.view,this.offset,4,t)}tTL(){return c(this.view,this.offset+452,32)}setTTL(t){u(this.view,this.offset+452,32,t),this.setHasTTL(!0)}nO_PIN(){return this.view.getUint8(this.offset+485)!==0}setNO_PIN(t){this.view.setUint8(this.offset+485,t?1:0)}};n(os,\"SIZE\",486);n(os,\"ALIGN\",1);var Ua=os,as=class _r{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new _r(t,s)}hasCID(){return f(this.view,this.offset,0)}setHasCID(t){h(this.view,this.offset,0,t)}cID(){return c(this.view,this.offset+1,128)}setCID(t){u(this.view,this.offset+1,128,t),this.setHasCID(!0)}hasNAME(){return f(this.view,this.offset,1)}setHasNAME(t){h(this.view,this.offset,1,t)}nAME(){return c(this.view,this.offset+130,255)}setNAME(t){u(this.view,this.offset+130,255,t),this.setHasNAME(!0)}hasVALUE(){return f(this.view,this.offset,2)}setHasVALUE(t){h(this.view,this.offset,2,t)}vALUE(){return c(this.view,this.offset+386,255)}setVALUE(t){u(this.view,this.offset+386,255,t),this.setHasVALUE(!0)}sIZE(){return this.view.getBigUint64(this.offset+648,!0)}setSIZE(t){this.view.setBigUint64(this.offset+648,t,!0)}hasAGENT_VERSION(){return f(this.view,this.offset,3)}setHasAGENT_VERSION(t){h(this.view,this.offset,3,t)}aGENT_VERSION(){return c(this.view,this.offset+656,128)}setAGENT_VERSION(t){u(this.view,this.offset+656,128,t),this.setHasAGENT_VERSION(!0)}hasPROTOCOL_VERSION(){return f(this.view,this.offset,4)}setHasPROTOCOL_VERSION(t){h(this.view,this.offset,4,t)}pROTOCOL_VERSION(){return c(this.view,this.offset+785,64)}setPROTOCOL_VERSION(t){u(this.view,this.offset+785,64,t),this.setHasPROTOCOL_VERSION(!0)}};n(as,\"SIZE\",856);n(as,\"ALIGN\",8);var Pa=as,fs=class dr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new dr(t,s)}hasNAME(){return f(this.view,this.offset,0)}setHasNAME(t){h(this.view,this.offset,0,t)}nAME(){return c(this.view,this.offset+1,255)}setNAME(t){u(this.view,this.offset+1,255,t),this.setHasNAME(!0)}hasCID(){return f(this.view,this.offset,1)}setHasCID(t){h(this.view,this.offset,1,t)}cID(){return c(this.view,this.offset+257,128)}setCID(t){u(this.view,this.offset+257,128,t),this.setHasCID(!0)}sIZE(){return this.view.getBigUint64(this.offset+392,!0)}setSIZE(t){this.view.setBigUint64(this.offset+392,t,!0)}tYPE(){return this.view.getInt32(this.offset+400,!0)}setTYPE(t){this.view.setInt32(this.offset+400,t,!0)}};n(fs,\"SIZE\",408);n(fs,\"ALIGN\",8);var va=fs,hs=class Ir{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Ir(t,s)}hasCID(){return f(this.view,this.offset,0)}setHasCID(t){h(this.view,this.offset,0,t)}cID(){return c(this.view,this.offset+1,128)}setCID(t){u(this.view,this.offset+1,128,t),this.setHasCID(!0)}hasTYPE(){return f(this.view,this.offset,1)}setHasTYPE(t){h(this.view,this.offset,1,t)}tYPE(){return c(this.view,this.offset+130,32)}setTYPE(t){u(this.view,this.offset+130,32,t),this.setHasTYPE(!0)}};n(hs,\"SIZE\",163);n(hs,\"ALIGN\",1);var Ha=hs,cs=class pr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new pr(t,s)}hasPEER_ID(){return f(this.view,this.offset,0)}setHasPEER_ID(t){h(this.view,this.offset,0,t)}pEER_ID(){return c(this.view,this.offset+1,128)}setPEER_ID(t){u(this.view,this.offset+1,128,t),this.setHasPEER_ID(!0)}hasADDRESS(){return f(this.view,this.offset,1)}setHasADDRESS(t){h(this.view,this.offset,1,t)}aDDRESS(){return c(this.view,this.offset+130,255)}setADDRESS(t){u(this.view,this.offset+130,255,t),this.setHasADDRESS(!0)}lATENCY_MS(){return this.view.getFloat64(this.offset+392,!0)}setLATENCY_MS(t){this.view.setFloat64(this.offset+392,t,!0)}};n(cs,\"SIZE\",400);n(cs,\"ALIGN\",8);var Ba=cs,us=class Sr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Sr(t,s)}hasTOPIC(){return f(this.view,this.offset,0)}setHasTOPIC(t){h(this.view,this.offset,0,t)}tOPIC(){return c(this.view,this.offset+1,255)}setTOPIC(t){u(this.view,this.offset+1,255,t),this.setHasTOPIC(!0)}};n(us,\"SIZE\",257);n(us,\"ALIGN\",1);var Ma=us,Es=class Ar{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Ar(t,s)}aLREADY(){return this.view.getUint8(this.offset+0)!==0}setALREADY(t){this.view.setUint8(this.offset+0,t?1:0)}};n(Es,\"SIZE\",1);n(Es,\"ALIGN\",1);var Fa=Es,ls=class br{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new br(t,s)}hasTARGET(){return f(this.view,this.offset,0)}setHasTARGET(t){h(this.view,this.offset,0,t)}tARGET(){return c(this.view,this.offset+1,255)}setTARGET(t){u(this.view,this.offset+1,255,t),this.setHasTARGET(!0)}hasPROTOCOL_ID(){return f(this.view,this.offset,1)}setHasPROTOCOL_ID(t){h(this.view,this.offset,1,t)}pROTOCOL_ID(){return c(this.view,this.offset+257,128)}setPROTOCOL_ID(t){u(this.view,this.offset+257,128,t),this.setHasPROTOCOL_ID(!0)}hasPEER_ID(){return f(this.view,this.offset,2)}setHasPEER_ID(t){h(this.view,this.offset,2,t)}pEER_ID(){return c(this.view,this.offset+386,128)}setPEER_ID(t){u(this.view,this.offset+386,128,t),this.setHasPEER_ID(!0)}tIMEOUT_MS(){return this.view.getUint32(this.offset+516,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+516,t,!0)}};n(ls,\"SIZE\",520);n(ls,\"ALIGN\",4);var Va=ls,_s=class Rr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Rr(t,s)}hasPEER_ID(){return f(this.view,this.offset,0)}setHasPEER_ID(t){h(this.view,this.offset,0,t)}pEER_ID(){return c(this.view,this.offset+1,128)}setPEER_ID(t){u(this.view,this.offset+1,128,t),this.setHasPEER_ID(!0)}lIMIT(){return this.view.getUint32(this.offset+132,!0)}setLIMIT(t){this.view.setUint32(this.offset+132,t,!0)}hasSTANDARD(){return f(this.view,this.offset,1)}setHasSTANDARD(t){h(this.view,this.offset,1,t)}sTANDARD(){return c(this.view,this.offset+136,16)}setSTANDARD(t){u(this.view,this.offset+136,16,t),this.setHasSTANDARD(!0)}dELIVER(){return this.view.getUint8(this.offset+153)}setDELIVER(t){this.view.setUint8(this.offset+153,t)}};n(_s,\"SIZE\",156);n(_s,\"ALIGN\",4);var xa=_s,ds=class wr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new wr(t,s)}hasSELF(){return f(this.view,this.offset,0)}setHasSELF(t){h(this.view,this.offset,0,t)}sELF(){return c(this.view,this.offset+1,128)}setSELF(t){u(this.view,this.offset+1,128,t),this.setHasSELF(!0)}hasPEER_ID(){return f(this.view,this.offset,1)}setHasPEER_ID(t){h(this.view,this.offset,1,t)}pEER_ID(){return c(this.view,this.offset+130,128)}setPEER_ID(t){u(this.view,this.offset+130,128,t),this.setHasPEER_ID(!0)}pUBLISHER_KEY_AVAILABLE(){return this.view.getUint8(this.offset+259)!==0}setPUBLISHER_KEY_AVAILABLE(t){this.view.setUint8(this.offset+259,t?1:0)}gOSSIP_ONLY_EXCLUDED(){return this.view.getUint32(this.offset+260,!0)}setGOSSIP_ONLY_EXCLUDED(t){this.view.setUint32(this.offset+260,t,!0)}};n(ds,\"SIZE\",264);n(ds,\"ALIGN\",4);var Ga=ds,Is=class Tr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Tr(t,s)}hasPEER_ID(){return f(this.view,this.offset,0)}setHasPEER_ID(t){h(this.view,this.offset,0,t)}pEER_ID(){return c(this.view,this.offset+1,128)}setPEER_ID(t){u(this.view,this.offset+1,128,t),this.setHasPEER_ID(!0)}cONNECTED(){return this.view.getUint8(this.offset+130)!==0}setCONNECTED(t){this.view.setUint8(this.offset+130,t?1:0)}sELF(){return this.view.getUint8(this.offset+131)!==0}setSELF(t){this.view.setUint8(this.offset+131,t?1:0)}ePM_INDEX(){return this.view.getInt32(this.offset+132,!0)}setEPM_INDEX(t){this.view.setInt32(this.offset+132,t,!0)}hasAGENT_VERSION(){return f(this.view,this.offset,1)}setHasAGENT_VERSION(t){h(this.view,this.offset,1,t)}aGENT_VERSION(){return c(this.view,this.offset+136,128)}setAGENT_VERSION(t){u(this.view,this.offset+136,128,t),this.setHasAGENT_VERSION(!0)}};n(Is,\"SIZE\",268);n(Is,\"ALIGN\",4);var Ya=Is,ps=class Or{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Or(t,s)}hasPEER_ID(){return f(this.view,this.offset,0)}setHasPEER_ID(t){h(this.view,this.offset,0,t)}pEER_ID(){return c(this.view,this.offset+1,128)}setPEER_ID(t){u(this.view,this.offset+1,128,t),this.setHasPEER_ID(!0)}hasVALUE(){return f(this.view,this.offset,1)}setHasVALUE(t){h(this.view,this.offset,1,t)}vALUE(){return c(this.view,this.offset+130,255)}setVALUE(t){u(this.view,this.offset+130,255,t),this.setHasVALUE(!0)}};n(ps,\"SIZE\",386);n(ps,\"ALIGN\",1);var ka=ps,Ss=class mr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new mr(t,s)}hasPEER_ID(){return f(this.view,this.offset,0)}setHasPEER_ID(t){h(this.view,this.offset,0,t)}pEER_ID(){return c(this.view,this.offset+2,128)}setPEER_ID(t){u(this.view,this.offset+2,128,t),this.setHasPEER_ID(!0)}hasPUBLISHER_PEER_ID(){return f(this.view,this.offset,1)}setHasPUBLISHER_PEER_ID(t){h(this.view,this.offset,1,t)}pUBLISHER_PEER_ID(){return c(this.view,this.offset+131,128)}setPUBLISHER_PEER_ID(t){u(this.view,this.offset+131,128,t),this.setHasPUBLISHER_PEER_ID(!0)}hasGOSSIP_PEER_ID(){return f(this.view,this.offset,2)}setHasGOSSIP_PEER_ID(t){h(this.view,this.offset,2,t)}gOSSIP_PEER_ID(){return c(this.view,this.offset+260,128)}setGOSSIP_PEER_ID(t){u(this.view,this.offset+260,128,t),this.setHasGOSSIP_PEER_ID(!0)}hasSTANDARD(){return f(this.view,this.offset,3)}setHasSTANDARD(t){h(this.view,this.offset,3,t)}sTANDARD(){return c(this.view,this.offset+389,16)}setSTANDARD(t){u(this.view,this.offset+389,16,t),this.setHasSTANDARD(!0)}hasSCHEMA(){return f(this.view,this.offset,4)}setHasSCHEMA(t){h(this.view,this.offset,4,t)}sCHEMA(){return c(this.view,this.offset+406,64)}setSCHEMA(t){u(this.view,this.offset+406,64,t),this.setHasSCHEMA(!0)}hasFILE_ID(){return f(this.view,this.offset,5)}setHasFILE_ID(t){h(this.view,this.offset,5,t)}fILE_ID(){return c(this.view,this.offset+471,255)}setFILE_ID(t){u(this.view,this.offset+471,255,t),this.setHasFILE_ID(!0)}hasFILE_NAME(){return f(this.view,this.offset,6)}setHasFILE_NAME(t){h(this.view,this.offset,6,t)}fILE_NAME(){return c(this.view,this.offset+727,255)}setFILE_NAME(t){u(this.view,this.offset+727,255,t),this.setHasFILE_NAME(!0)}hasCID(){return f(this.view,this.offset,7)}setHasCID(t){h(this.view,this.offset,7,t)}cID(){return c(this.view,this.offset+983,128)}setCID(t){u(this.view,this.offset+983,128,t),this.setHasCID(!0)}pUBLISH_MS(){return this.view.getBigUint64(this.offset+1112,!0)}setPUBLISH_MS(t){this.view.setBigUint64(this.offset+1112,t,!0)}hasSIGNATURE_TYPE(){return f(this.view,this.offset,8)}setHasSIGNATURE_TYPE(t){h(this.view,this.offset,8,t)}sIGNATURE_TYPE(){return c(this.view,this.offset+1120,32)}setSIGNATURE_TYPE(t){u(this.view,this.offset+1120,32,t),this.setHasSIGNATURE_TYPE(!0)}hasSIGNATURE_HEX(){return f(this.view,this.offset,9)}setHasSIGNATURE_HEX(t){h(this.view,this.offset,9,t)}sIGNATURE_HEX(){return c(this.view,this.offset+1153,255)}setSIGNATURE_HEX(t){u(this.view,this.offset+1153,255,t),this.setHasSIGNATURE_HEX(!0)}sIGNATURE_VERIFIED(){return this.view.getUint8(this.offset+1409)!==0}setSIGNATURE_VERIFIED(t){this.view.setUint8(this.offset+1409,t?1:0)}hasATTRIBUTION(){return f(this.view,this.offset,10)}setHasATTRIBUTION(t){h(this.view,this.offset,10,t)}aTTRIBUTION(){return c(this.view,this.offset+1410,16)}setATTRIBUTION(t){u(this.view,this.offset+1410,16,t),this.setHasATTRIBUTION(!0)}pNM_INDEX(){return this.view.getInt32(this.offset+1428,!0)}setPNM_INDEX(t){this.view.setInt32(this.offset+1428,t,!0)}hasPUBLISHER_KEY_HEX(){return f(this.view,this.offset,11)}setHasPUBLISHER_KEY_HEX(t){h(this.view,this.offset,11,t)}pUBLISHER_KEY_HEX(){return c(this.view,this.offset+1432,128)}setPUBLISHER_KEY_HEX(t){u(this.view,this.offset+1432,128,t),this.setHasPUBLISHER_KEY_HEX(!0)}hasPUBLISHER_KEY_SOURCE(){return f(this.view,this.offset,12)}setHasPUBLISHER_KEY_SOURCE(t){h(this.view,this.offset,12,t)}pUBLISHER_KEY_SOURCE(){return c(this.view,this.offset+1561,64)}setPUBLISHER_KEY_SOURCE(t){u(this.view,this.offset+1561,64,t),this.setHasPUBLISHER_KEY_SOURCE(!0)}};n(Ss,\"SIZE\",1632);n(Ss,\"ALIGN\",8);var qa=Ss,As=class gr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new gr(t,s)}kNOWN(){return this.view.getUint8(this.offset+2)!==0}setKNOWN(t){this.view.setUint8(this.offset+2,t?1:0)}hasREASON(){return f(this.view,this.offset,0)}setHasREASON(t){h(this.view,this.offset,0,t)}rEASON(){return c(this.view,this.offset+3,64)}setREASON(t){u(this.view,this.offset+3,64,t),this.setHasREASON(!0)}pINNED(){return this.view.getUint8(this.offset+68)!==0}setPINNED(t){this.view.setUint8(this.offset+68,t?1:0)}sELF(){return this.view.getUint8(this.offset+69)!==0}setSELF(t){this.view.setUint8(this.offset+69,t?1:0)}fRESH(){return this.view.getUint8(this.offset+70)!==0}setFRESH(t){this.view.setUint8(this.offset+70,t?1:0)}hasSTANDARD(){return f(this.view,this.offset,1)}setHasSTANDARD(t){h(this.view,this.offset,1,t)}sTANDARD(){return c(this.view,this.offset+71,16)}setSTANDARD(t){u(this.view,this.offset+71,16,t),this.setHasSTANDARD(!0)}hasSCHEMA(){return f(this.view,this.offset,2)}setHasSCHEMA(t){h(this.view,this.offset,2,t)}sCHEMA(){return c(this.view,this.offset+88,64)}setSCHEMA(t){u(this.view,this.offset+88,64,t),this.setHasSCHEMA(!0)}hasPNM_CID(){return f(this.view,this.offset,3)}setHasPNM_CID(t){h(this.view,this.offset,3,t)}pNM_CID(){return c(this.view,this.offset+153,128)}setPNM_CID(t){u(this.view,this.offset+153,128,t),this.setHasPNM_CID(!0)}hasPNM_FILE_ID(){return f(this.view,this.offset,4)}setHasPNM_FILE_ID(t){h(this.view,this.offset,4,t)}pNM_FILE_ID(){return c(this.view,this.offset+282,255)}setPNM_FILE_ID(t){u(this.view,this.offset+282,255,t),this.setHasPNM_FILE_ID(!0)}pNM_PUBLISH_MS(){return this.view.getBigUint64(this.offset+544,!0)}setPNM_PUBLISH_MS(t){this.view.setBigUint64(this.offset+544,t,!0)}pNM_SIGNATURE_VERIFIED(){return this.view.getUint8(this.offset+552)!==0}setPNM_SIGNATURE_VERIFIED(t){this.view.setUint8(this.offset+552,t?1:0)}hasPNM_ATTRIBUTION(){return f(this.view,this.offset,5)}setHasPNM_ATTRIBUTION(t){h(this.view,this.offset,5,t)}pNM_ATTRIBUTION(){return c(this.view,this.offset+553,16)}setPNM_ATTRIBUTION(t){u(this.view,this.offset+553,16,t),this.setHasPNM_ATTRIBUTION(!0)}hasBATCH_ID(){return f(this.view,this.offset,6)}setHasBATCH_ID(t){h(this.view,this.offset,6,t)}bATCH_ID(){return c(this.view,this.offset+570,128)}setBATCH_ID(t){u(this.view,this.offset+570,128,t),this.setHasBATCH_ID(!0)}hasPROVIDER_ID(){return f(this.view,this.offset,7)}setHasPROVIDER_ID(t){h(this.view,this.offset,7,t)}pROVIDER_ID(){return c(this.view,this.offset+699,128)}setPROVIDER_ID(t){u(this.view,this.offset+699,128,t),this.setHasPROVIDER_ID(!0)}hasSOURCE_NAME(){return f(this.view,this.offset,8)}setHasSOURCE_NAME(t){h(this.view,this.offset,8,t)}sOURCE_NAME(){return c(this.view,this.offset+828,128)}setSOURCE_NAME(t){u(this.view,this.offset+828,128,t),this.setHasSOURCE_NAME(!0)}rECORD_COUNT(){return this.view.getBigUint64(this.offset+960,!0)}setRECORD_COUNT(t){this.view.setBigUint64(this.offset+960,t,!0)}bYTE_COUNT(){return this.view.getBigUint64(this.offset+968,!0)}setBYTE_COUNT(t){this.view.setBigUint64(this.offset+968,t,!0)}pARTS(){return this.view.getUint32(this.offset+976,!0)}setPARTS(t){this.view.setUint32(this.offset+976,t,!0)}pUBLISHED_MS(){return this.view.getBigUint64(this.offset+984,!0)}setPUBLISHED_MS(t){this.view.setBigUint64(this.offset+984,t,!0)}hasETAG_FNV1A64(){return f(this.view,this.offset,9)}setHasETAG_FNV1A64(t){h(this.view,this.offset,9,t)}eTAG_FNV1A64(){return c(this.view,this.offset+992,16)}setETAG_FNV1A64(t){u(this.view,this.offset+992,16,t),this.setHasETAG_FNV1A64(!0)}hasREF(){return f(this.view,this.offset,10)}setHasREF(t){h(this.view,this.offset,10,t)}rEF(){return new se(this.buffer,this.offset+1016)}};n(As,\"SIZE\",1072);n(As,\"ALIGN\",8);var Ka=As,bs=class yr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new yr(t,s)}uPTIME_S(){return this.view.getBigUint64(this.offset+8,!0)}setUPTIME_S(t){this.view.setBigUint64(this.offset+8,t,!0)}sTARTED_MS(){return this.view.getBigUint64(this.offset+16,!0)}setSTARTED_MS(t){this.view.setBigUint64(this.offset+16,t,!0)}sTORE_TOTAL_BYTES(){return this.view.getBigUint64(this.offset+24,!0)}setSTORE_TOTAL_BYTES(t){this.view.setBigUint64(this.offset+24,t,!0)}sTORE_TOTAL_RECORDS(){return this.view.getBigUint64(this.offset+32,!0)}setSTORE_TOTAL_RECORDS(t){this.view.setBigUint64(this.offset+32,t,!0)}hasSTORAGE_PATH(){return f(this.view,this.offset,0)}setHasSTORAGE_PATH(t){h(this.view,this.offset,0,t)}sTORAGE_PATH(){return c(this.view,this.offset+40,255)}setSTORAGE_PATH(t){u(this.view,this.offset+40,255,t),this.setHasSTORAGE_PATH(!0)}hAS_DISK(){return this.view.getUint8(this.offset+296)!==0}setHAS_DISK(t){this.view.setUint8(this.offset+296,t?1:0)}dISK_CAPACITY_BYTES(){return this.view.getBigUint64(this.offset+304,!0)}setDISK_CAPACITY_BYTES(t){this.view.setBigUint64(this.offset+304,t,!0)}dISK_FREE_BYTES(){return this.view.getBigUint64(this.offset+312,!0)}setDISK_FREE_BYTES(t){this.view.setBigUint64(this.offset+312,t,!0)}dISK_AVAILABLE_BYTES(){return this.view.getBigUint64(this.offset+320,!0)}setDISK_AVAILABLE_BYTES(t){this.view.setBigUint64(this.offset+320,t,!0)}hasSERVICE_STATE(){return f(this.view,this.offset,1)}setHasSERVICE_STATE(t){h(this.view,this.offset,1,t)}sERVICE_STATE(){return c(this.view,this.offset+328,32)}setSERVICE_STATE(t){u(this.view,this.offset+328,32,t),this.setHasSERVICE_STATE(!0)}hasSERVICE_MODE(){return f(this.view,this.offset,2)}setHasSERVICE_MODE(t){h(this.view,this.offset,2,t)}sERVICE_MODE(){return c(this.view,this.offset+361,32)}setSERVICE_MODE(t){u(this.view,this.offset+361,32,t),this.setHasSERVICE_MODE(!0)}hAS_BANDWIDTH(){return this.view.getUint8(this.offset+394)!==0}setHAS_BANDWIDTH(t){this.view.setUint8(this.offset+394,t?1:0)}tOTAL_IN_BYTES(){return this.view.getBigUint64(this.offset+400,!0)}setTOTAL_IN_BYTES(t){this.view.setBigUint64(this.offset+400,t,!0)}tOTAL_OUT_BYTES(){return this.view.getBigUint64(this.offset+408,!0)}setTOTAL_OUT_BYTES(t){this.view.setBigUint64(this.offset+408,t,!0)}rATE_IN_BPS(){return this.view.getFloat64(this.offset+416,!0)}setRATE_IN_BPS(t){this.view.setFloat64(this.offset+416,t,!0)}rATE_OUT_BPS(){return this.view.getFloat64(this.offset+424,!0)}setRATE_OUT_BPS(t){this.view.setFloat64(this.offset+424,t,!0)}};n(bs,\"SIZE\",432);n(bs,\"ALIGN\",8);var ja=bs,Rs=class Nr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Nr(t,s)}tS_MS(){return this.view.getBigUint64(this.offset+0,!0)}setTS_MS(t){this.view.setBigUint64(this.offset+0,t,!0)}tOTAL_IN_BYTES(){return this.view.getBigUint64(this.offset+8,!0)}setTOTAL_IN_BYTES(t){this.view.setBigUint64(this.offset+8,t,!0)}tOTAL_OUT_BYTES(){return this.view.getBigUint64(this.offset+16,!0)}setTOTAL_OUT_BYTES(t){this.view.setBigUint64(this.offset+16,t,!0)}rATE_IN_BPS(){return this.view.getFloat64(this.offset+24,!0)}setRATE_IN_BPS(t){this.view.setFloat64(this.offset+24,t,!0)}rATE_OUT_BPS(){return this.view.getFloat64(this.offset+32,!0)}setRATE_OUT_BPS(t){this.view.setFloat64(this.offset+32,t,!0)}};n(Rs,\"SIZE\",40);n(Rs,\"ALIGN\",8);var Wa=Rs,ws=class Dr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Dr(t,s)}lIMIT(){return this.view.getUint32(this.offset+0,!0)}setLIMIT(t){this.view.setUint32(this.offset+0,t,!0)}};n(ws,\"SIZE\",4);n(ws,\"ALIGN\",4);var $a=ws,Ts=class Lr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Lr(t,s)}tS_MS(){return this.view.getBigUint64(this.offset+8,!0)}setTS_MS(t){this.view.setBigUint64(this.offset+8,t,!0)}hasKIND(){return f(this.view,this.offset,0)}setHasKIND(t){h(this.view,this.offset,0,t)}kIND(){return c(this.view,this.offset+16,32)}setKIND(t){u(this.view,this.offset+16,32,t),this.setHasKIND(!0)}hasDETAIL(){return f(this.view,this.offset,1)}setHasDETAIL(t){h(this.view,this.offset,1,t)}dETAIL(){return c(this.view,this.offset+49,255)}setDETAIL(t){u(this.view,this.offset+49,255,t),this.setHasDETAIL(!0)}hasPEER_ID(){return f(this.view,this.offset,2)}setHasPEER_ID(t){h(this.view,this.offset,2,t)}pEER_ID(){return c(this.view,this.offset+305,128)}setPEER_ID(t){u(this.view,this.offset+305,128,t),this.setHasPEER_ID(!0)}};n(Ts,\"SIZE\",440);n(Ts,\"ALIGN\",8);var Za=Ts,Os=class Cr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Cr(t,s)}mS(){return this.view.getUint32(this.offset+0,!0)}setMS(t){this.view.setUint32(this.offset+0,t,!0)}};n(Os,\"SIZE\",4);n(Os,\"ALIGN\",4);var Qa=Os,ms=class Ur{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Ur(t,s)}hasEXPRESSION(){return f(this.view,this.offset,0)}setHasEXPRESSION(t){h(this.view,this.offset,0,t)}eXPRESSION(){return c(this.view,this.offset+1,128)}setEXPRESSION(t){u(this.view,this.offset+1,128,t),this.setHasEXPRESSION(!0)}aT_MS(){return this.view.getBigUint64(this.offset+136,!0)}setAT_MS(t){this.view.setBigUint64(this.offset+136,t,!0)}};n(ms,\"SIZE\",144);n(ms,\"ALIGN\",8);var za=ms,gs=class Pr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Pr(t,s)}hasNAME(){return f(this.view,this.offset,0)}setHasNAME(t){h(this.view,this.offset,0,t)}nAME(){return c(this.view,this.offset+1,16)}setNAME(t){u(this.view,this.offset+1,16,t),this.setHasNAME(!0)}hasSOURCE(){return f(this.view,this.offset,1)}setHasSOURCE(t){h(this.view,this.offset,1,t)}sOURCE(){return c(this.view,this.offset+18,64)}setSOURCE(t){u(this.view,this.offset+18,64,t),this.setHasSOURCE(!0)}hAS_WILDCARD(){return this.view.getUint8(this.offset+83)!==0}setHAS_WILDCARD(t){this.view.setUint8(this.offset+83,t?1:0)}hasVALUES(){return f(this.view,this.offset,2)}setHasVALUES(t){h(this.view,this.offset,2,t)}vALUESLength(){return this.hasVALUES()?Math.min(this.view.getUint32(this.offset+84,!0),60):0}setVALUESLength(t){let s=Math.max(0,Math.min(t,60));this.view.setUint32(this.offset+84,s,!0),this.setHasVALUES(!0)}vALUESAt(t){return this.view.getInt32(this.offset+84+4+t*4,!0)}setVALUESAt(t,s){this.view.setInt32(this.offset+84+4+t*4,s,!0),this.setHasVALUES(!0)}};n(gs,\"SIZE\",328);n(gs,\"ALIGN\",4);var Xa=gs,ys=class vr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new vr(t,s)}tIMEOUT_MS(){return this.view.getUint32(this.offset+0,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+0,t,!0)}nO_RESPONSE(){return this.view.getUint8(this.offset+4)!==0}setNO_RESPONSE(t){this.view.setUint8(this.offset+4,t?1:0)}mESSAGE_IS_TEXT(){return this.view.getUint8(this.offset+5)!==0}setMESSAGE_IS_TEXT(t){this.view.setUint8(this.offset+5,t?1:0)}};n(ys,\"SIZE\",8);n(ys,\"ALIGN\",4);var Ja=ys,Ns=class Hr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Hr(t,s)}hasPROTOCOL(){return f(this.view,this.offset,0)}setHasPROTOCOL(t){h(this.view,this.offset,0,t)}pROTOCOL(){return c(this.view,this.offset+1,64)}setPROTOCOL(t){u(this.view,this.offset+1,64,t),this.setHasPROTOCOL(!0)}hasEXTENSIONS(){return f(this.view,this.offset,1)}setHasEXTENSIONS(t){h(this.view,this.offset,1,t)}eXTENSIONS(){return c(this.view,this.offset+66,255)}setEXTENSIONS(t){u(this.view,this.offset+66,255,t),this.setHasEXTENSIONS(!0)}cLOSE_CODE(){return this.view.getInt32(this.offset+324,!0)}setCLOSE_CODE(t){this.view.setInt32(this.offset+324,t,!0)}hasCLOSE_REASON(){return f(this.view,this.offset,2)}setHasCLOSE_REASON(t){h(this.view,this.offset,2,t)}cLOSE_REASON(){return c(this.view,this.offset+328,255)}setCLOSE_REASON(t){u(this.view,this.offset+328,255,t),this.setHasCLOSE_REASON(!0)}bODY_IS_TEXT(){return this.view.getUint8(this.offset+584)!==0}setBODY_IS_TEXT(t){this.view.setUint8(this.offset+584,t?1:0)}};n(Ns,\"SIZE\",588);n(Ns,\"ALIGN\",4);var tf=Ns,Ds=class Br{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Br(t,s)}hasHOST(){return f(this.view,this.offset,0)}setHasHOST(t){h(this.view,this.offset,0,t)}hOST(){return c(this.view,this.offset+1,255)}setHOST(t){u(this.view,this.offset+1,255,t),this.setHasHOST(!0)}pORT(){return this.view.getUint16(this.offset+258,!0)}setPORT(t){this.view.setUint16(this.offset+258,t,!0)}hasCLIENT_ID(){return f(this.view,this.offset,1)}setHasCLIENT_ID(t){h(this.view,this.offset,1,t)}cLIENT_ID(){return c(this.view,this.offset+260,128)}setCLIENT_ID(t){u(this.view,this.offset+260,128,t),this.setHasCLIENT_ID(!0)}hasTOPIC(){return f(this.view,this.offset,2)}setHasTOPIC(t){h(this.view,this.offset,2,t)}tOPIC(){return c(this.view,this.offset+389,255)}setTOPIC(t){u(this.view,this.offset+389,255,t),this.setHasTOPIC(!0)}hasUSERNAME(){return f(this.view,this.offset,3)}setHasUSERNAME(t){h(this.view,this.offset,3,t)}uSERNAME(){return c(this.view,this.offset+645,128)}setUSERNAME(t){u(this.view,this.offset+645,128,t),this.setHasUSERNAME(!0)}kEEP_ALIVE_S(){return this.view.getUint16(this.offset+774,!0)}setKEEP_ALIVE_S(t){this.view.setUint16(this.offset+774,t,!0)}tIMEOUT_MS(){return this.view.getUint32(this.offset+776,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+776,t,!0)}pACKET_ID(){return this.view.getUint16(this.offset+780,!0)}setPACKET_ID(t){this.view.setUint16(this.offset+780,t,!0)}};n(Ds,\"SIZE\",784);n(Ds,\"ALIGN\",4);var ef=Ds,Ls=class Mr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Mr(t,s)}hasHOST(){return f(this.view,this.offset,0)}setHasHOST(t){h(this.view,this.offset,0,t)}hOST(){return c(this.view,this.offset+1,255)}setHOST(t){u(this.view,this.offset+1,255,t),this.setHasHOST(!0)}pORT(){return this.view.getUint16(this.offset+258,!0)}setPORT(t){this.view.setUint16(this.offset+258,t,!0)}hasCLIENT_ID(){return f(this.view,this.offset,1)}setHasCLIENT_ID(t){h(this.view,this.offset,1,t)}cLIENT_ID(){return c(this.view,this.offset+260,128)}setCLIENT_ID(t){u(this.view,this.offset+260,128,t),this.setHasCLIENT_ID(!0)}hasTOPIC(){return f(this.view,this.offset,2)}setHasTOPIC(t){h(this.view,this.offset,2,t)}tOPIC(){return c(this.view,this.offset+389,255)}setTOPIC(t){u(this.view,this.offset+389,255,t),this.setHasTOPIC(!0)}pAYLOAD_BYTES(){return this.view.getBigUint64(this.offset+648,!0)}setPAYLOAD_BYTES(t){this.view.setBigUint64(this.offset+648,t,!0)}};n(Ls,\"SIZE\",656);n(Ls,\"ALIGN\",8);var sf=Ls,Cs=class Fr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Fr(t,s)}hasHOST(){return f(this.view,this.offset,0)}setHasHOST(t){h(this.view,this.offset,0,t)}hOST(){return c(this.view,this.offset+1,255)}setHOST(t){u(this.view,this.offset+1,255,t),this.setHasHOST(!0)}pORT(){return this.view.getUint16(this.offset+258,!0)}setPORT(t){this.view.setUint16(this.offset+258,t,!0)}tIMEOUT_MS(){return this.view.getUint32(this.offset+260,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+260,t,!0)}nO_RESPONSE(){return this.view.getUint8(this.offset+264)!==0}setNO_RESPONSE(t){this.view.setUint8(this.offset+264,t?1:0)}hasBIND_ADDRESS(){return f(this.view,this.offset,1)}setHasBIND_ADDRESS(t){h(this.view,this.offset,1,t)}bIND_ADDRESS(){return c(this.view,this.offset+265,64)}setBIND_ADDRESS(t){u(this.view,this.offset+265,64,t),this.setHasBIND_ADDRESS(!0)}bIND_PORT(){return this.view.getUint16(this.offset+330,!0)}setBIND_PORT(t){this.view.setUint16(this.offset+330,t,!0)}hasUDP_TYPE(){return f(this.view,this.offset,2)}setHasUDP_TYPE(t){h(this.view,this.offset,2,t)}uDP_TYPE(){return c(this.view,this.offset+332,8)}setUDP_TYPE(t){u(this.view,this.offset+332,8,t),this.setHasUDP_TYPE(!0)}aLLOW_UNAUTHORIZED(){return this.view.getUint8(this.offset+341)!==0}setALLOW_UNAUTHORIZED(t){this.view.setUint8(this.offset+341,t?1:0)}hasSERVER_NAME(){return f(this.view,this.offset,3)}setHasSERVER_NAME(t){h(this.view,this.offset,3,t)}sERVER_NAME(){return c(this.view,this.offset+342,255)}setSERVER_NAME(t){u(this.view,this.offset+342,255,t),this.setHasSERVER_NAME(!0)}};n(Cs,\"SIZE\",600);n(Cs,\"ALIGN\",4);var rf=Cs,Us=class Vr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Vr(t,s)}hasHOST(){return f(this.view,this.offset,0)}setHasHOST(t){h(this.view,this.offset,0,t)}hOST(){return c(this.view,this.offset+1,255)}setHOST(t){u(this.view,this.offset+1,255,t),this.setHasHOST(!0)}pORT(){return this.view.getUint16(this.offset+258,!0)}setPORT(t){this.view.setUint16(this.offset+258,t,!0)}hasLOCAL_ADDRESS(){return f(this.view,this.offset,1)}setHasLOCAL_ADDRESS(t){h(this.view,this.offset,1,t)}lOCAL_ADDRESS(){return c(this.view,this.offset+260,64)}setLOCAL_ADDRESS(t){u(this.view,this.offset+260,64,t),this.setHasLOCAL_ADDRESS(!0)}lOCAL_PORT(){return this.view.getUint16(this.offset+326,!0)}setLOCAL_PORT(t){this.view.setUint16(this.offset+326,t,!0)}hasREMOTE_ADDRESS(){return f(this.view,this.offset,2)}setHasREMOTE_ADDRESS(t){h(this.view,this.offset,2,t)}rEMOTE_ADDRESS(){return c(this.view,this.offset+328,64)}setREMOTE_ADDRESS(t){u(this.view,this.offset+328,64,t),this.setHasREMOTE_ADDRESS(!0)}rEMOTE_PORT(){return this.view.getUint16(this.offset+394,!0)}setREMOTE_PORT(t){this.view.setUint16(this.offset+394,t,!0)}aUTHORIZED(){return this.view.getUint8(this.offset+396)!==0}setAUTHORIZED(t){this.view.setUint8(this.offset+396,t?1:0)}hasAUTHORIZATION_ERROR(){return f(this.view,this.offset,3)}setHasAUTHORIZATION_ERROR(t){h(this.view,this.offset,3,t)}aUTHORIZATION_ERROR(){return c(this.view,this.offset+397,255)}setAUTHORIZATION_ERROR(t){u(this.view,this.offset+397,255,t),this.setHasAUTHORIZATION_ERROR(!0)}};n(Us,\"SIZE\",654);n(Us,\"ALIGN\",2);var nf=Us,Ps=class xr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new xr(t,s)}nOT_RECURSIVE(){return this.view.getUint8(this.offset+0)!==0}setNOT_RECURSIVE(t){this.view.setUint8(this.offset+0,t?1:0)}};n(Ps,\"SIZE\",1);n(Ps,\"ALIGN\",1);var of=Ps,vs=class Gr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Gr(t,s)}hasNAME(){return f(this.view,this.offset,0)}setHasNAME(t){h(this.view,this.offset,0,t)}nAME(){return c(this.view,this.offset+1,255)}setNAME(t){u(this.view,this.offset+1,255,t),this.setHasNAME(!0)}iS_FILE(){return this.view.getUint8(this.offset+257)!==0}setIS_FILE(t){this.view.setUint8(this.offset+257,t?1:0)}iS_DIRECTORY(){return this.view.getUint8(this.offset+258)!==0}setIS_DIRECTORY(t){this.view.setUint8(this.offset+258,t?1:0)}};n(vs,\"SIZE\",259);n(vs,\"ALIGN\",1);var af=vs,Hs=class Yr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Yr(t,s)}sIZE(){return this.view.getBigUint64(this.offset+0,!0)}setSIZE(t){this.view.setBigUint64(this.offset+0,t,!0)}iS_FILE(){return this.view.getUint8(this.offset+8)!==0}setIS_FILE(t){this.view.setUint8(this.offset+8,t?1:0)}iS_DIRECTORY(){return this.view.getUint8(this.offset+9)!==0}setIS_DIRECTORY(t){this.view.setUint8(this.offset+9,t?1:0)}cTIME_MS(){return this.view.getFloat64(this.offset+16,!0)}setCTIME_MS(t){this.view.setFloat64(this.offset+16,t,!0)}mTIME_MS(){return this.view.getFloat64(this.offset+24,!0)}setMTIME_MS(t){this.view.setFloat64(this.offset+24,t,!0)}};n(Hs,\"SIZE\",32);n(Hs,\"ALIGN\",8);var ff=Hs,Bs=class kr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new kr(t,s)}tIMEOUT_MS(){return this.view.getUint32(this.offset+0,!0)}setTIMEOUT_MS(t){this.view.setUint32(this.offset+0,t,!0)}};n(Bs,\"SIZE\",4);n(Bs,\"ALIGN\",4);var hf=Bs,Ms=class qr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new qr(t,s)}hasNAME(){return f(this.view,this.offset,0)}setHasNAME(t){h(this.view,this.offset,0,t)}nAME(){return c(this.view,this.offset+1,128)}setNAME(t){u(this.view,this.offset+1,128,t),this.setHasNAME(!0)}hasVALUE(){return f(this.view,this.offset,1)}setHasVALUE(t){h(this.view,this.offset,1,t)}vALUE(){return c(this.view,this.offset+130,255)}setVALUE(t){u(this.view,this.offset+130,255,t),this.setHasVALUE(!0)}};n(Ms,\"SIZE\",386);n(Ms,\"ALIGN\",1);var cf=Ms,Fs=class Kr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new Kr(t,s)}eXIT_CODE(){return this.view.getInt32(this.offset+4,!0)}setEXIT_CODE(t){this.view.setInt32(this.offset+4,t,!0)}hasSIGNAL(){return f(this.view,this.offset,0)}setHasSIGNAL(t){h(this.view,this.offset,0,t)}sIGNAL(){return c(this.view,this.offset+8,16)}setSIGNAL(t){u(this.view,this.offset+8,16,t),this.setHasSIGNAL(!0)}};n(Fs,\"SIZE\",28);n(Fs,\"ALIGN\",4);var uf=Fs,Vs=class jr{constructor(t,s=0){n(this,\"buffer\",t),n(this,\"offset\",s),n(this,\"view\"),this.view=new DataView(t)}static fromPointer(t,s=0){return new jr(t,s)}hasSCOPE(){return f(this.view,this.offset,0)}setHasSCOPE(t){h(this.view,this.offset,0,t)}sCOPE(){return c(this.view,this.offset+1,128)}setSCOPE(t){u(this.view,this.offset+1,128,t),this.setHasSCOPE(!0)}hasKEY(){return f(this.view,this.offset,1)}setHasKEY(t){h(this.view,this.offset,1,t)}kEY(){return c(this.view,this.offset+130,255)}setKEY(t){u(this.view,this.offset+130,255,t),this.setHasKEY(!0)}};n(Vs,\"SIZE\",386);n(Vs,\"ALIGN\",1);var Ef=Vs;var ot=new Int32Array(2),ie=new Float32Array(ot.buffer),re=new Float64Array(ot.buffer),Lt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Ht;(function(e){e[e.UTF8_BYTES=1]=\"UTF8_BYTES\",e[e.UTF16_STRING=2]=\"UTF16_STRING\"})(Ht||(Ht={}));var at=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return ot[0]=this.readInt32(t),ie[0]}readFloat64(t){return ot[Lt?0:1]=this.readInt32(t),ot[Lt?1:0]=this.readInt32(t+4),re[0]}writeInt8(t,s){this.bytes_[t]=s}writeUint8(t,s){this.bytes_[t]=s}writeInt16(t,s){this.bytes_[t]=s,this.bytes_[t+1]=s>>8}writeUint16(t,s){this.bytes_[t]=s,this.bytes_[t+1]=s>>8}writeInt32(t,s){this.bytes_[t]=s,this.bytes_[t+1]=s>>8,this.bytes_[t+2]=s>>16,this.bytes_[t+3]=s>>24}writeUint32(t,s){this.bytes_[t]=s,this.bytes_[t+1]=s>>8,this.bytes_[t+2]=s>>16,this.bytes_[t+3]=s>>24}writeInt64(t,s){this.writeInt32(t,Number(BigInt.asIntN(32,s))),this.writeInt32(t+4,Number(BigInt.asIntN(32,s>>BigInt(32))))}writeUint64(t,s){this.writeUint32(t,Number(BigInt.asUintN(32,s))),this.writeUint32(t+4,Number(BigInt.asUintN(32,s>>BigInt(32))))}writeFloat32(t,s){ie[0]=s,this.writeInt32(t,ot[0])}writeFloat64(t,s){re[0]=s,this.writeInt32(t,ot[Lt?0:1]),this.writeInt32(t+4,ot[Lt?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error(\"FlatBuffers: ByteBuffer is too short to contain an identifier.\");let t=\"\";for(let s=0;s<4;s++)t+=String.fromCharCode(this.readInt8(this.position_+4+s));return t}__offset(t,s){let i=t-this.readInt32(t);return s<this.readInt16(i)?this.readInt16(i+s):0}__union(t,s){return t.bb_pos=s+this.readInt32(s),t.bb=this,t}__string(t,s){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let r=this.bytes_.subarray(t,t+i);return s===Ht.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(t,s){return typeof t==\"string\"?this.__string(s):this.__union(t,s)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error(\"FlatBuffers: file identifier must be length \"+4);for(let s=0;s<4;s++)if(t.charCodeAt(s)!=this.readInt8(this.position()+4+s))return!1;return!0}createScalarList(t,s){let i=[];for(let r=0;r<s;++r){let o=t(r);o!==null&&i.push(o)}return i}createObjList(t,s){let i=[];for(let r=0;r<s;++r){let o=t(r);o!==null&&i.push(o.unpack())}return i}};var Bt=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let s;t?s=t:s=1024,this.bb=at.allocate(s),this.space=s}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,s){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+s)+1&t-1;for(;this.space<i+t+s;){let r=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(t){for(let s=0;s<t;s++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,s,i){(this.force_defaults||s!=i)&&(this.addInt8(s),this.slot(t))}addFieldInt16(t,s,i){(this.force_defaults||s!=i)&&(this.addInt16(s),this.slot(t))}addFieldInt32(t,s,i){(this.force_defaults||s!=i)&&(this.addInt32(s),this.slot(t))}addFieldInt64(t,s,i){(this.force_defaults||s!==i)&&(this.addInt64(s),this.slot(t))}addFieldFloat32(t,s,i){(this.force_defaults||s!=i)&&(this.addFloat32(s),this.slot(t))}addFieldFloat64(t,s,i){(this.force_defaults||s!=i)&&(this.addFloat64(s),this.slot(t))}addFieldOffset(t,s,i){(this.force_defaults||s!=i)&&(this.addOffset(s),this.slot(t))}addFieldStruct(t,s,i){s!=i&&(this.nested(s),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError(\"FlatBuffers: struct must be serialized inline.\")}notNested(){if(this.isNested)throw new TypeError(\"FlatBuffers: object serialization must not be nested.\")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let s=t.capacity();if(s&3221225472)throw new Error(\"FlatBuffers: cannot grow buffer beyond 2 gigabytes.\");let i=s<<1,r=at.allocate(i);return r.setPosition(i-s),r.bytes().set(t.bytes(),i-s),r}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let s=0;s<t;s++)this.vtable[s]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error(\"FlatBuffers: endObject called without startObject\");this.addInt32(0);let t=this.offset(),s=this.vtable_in_use-1;for(;s>=0&&this.vtable[s]==0;s--);let i=s+1;for(;s>=0;s--)this.addInt16(this.vtable[s]!=0?t-this.vtable[s]:0);let r=2;this.addInt16(t-this.object_start);let o=(i+r)*2;this.addInt16(o);let a=0,E=this.space;t:for(s=0;s<this.vtables.length;s++){let l=this.bb.capacity()-this.vtables[s];if(o==this.bb.readInt16(l)){for(let _=2;_<o;_+=2)if(this.bb.readInt16(E+_)!=this.bb.readInt16(l+_))continue t;a=this.vtables[s];break}}return a?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,a-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,s,i){let r=i?4:0;if(s){let o=s;if(this.prep(this.minalign,8+r),o.length!=4)throw new TypeError(\"FlatBuffers: file identifier must be length \"+4);for(let a=3;a>=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,s){this.finish(t,s,!0)}requiredField(t,s){let i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(s<this.bb.readInt16(r)&&this.bb.readInt16(r+s)!=0))throw new TypeError(\"FlatBuffers: field \"+s+\" must be set\")}startVector(t,s,i){this.notNested(),this.vector_num_elems=s,this.prep(4,t*s),this.prep(i,t*s)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let s=this.createString(t);return this.string_maps.set(t,s),s}createString(t){if(t==null)return 0;let s;return t instanceof Uint8Array?s=t:s=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,s.length,1),this.bb.setPosition(this.space-=s.length),this.bb.bytes().set(s,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t==\"string\"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let s=[];for(let i=0;i<t.length;++i){let r=t[i];if(r!==null)s.push(this.createObjectOffset(r));else throw new TypeError(\"FlatBuffers: Argument for createObjectOffsetList cannot contain null.\")}return s}createStructOffsetList(t,s){return s(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var xs;(function(e){e[e.DIRECT=0]=\"DIRECT\",e[e.COMMAND=1]=\"COMMAND\"})(xs||(xs={}));var ft;(function(e){e[e.IMMUTABLE=0]=\"IMMUTABLE\",e[e.APPEND_ONLY=1]=\"APPEND_ONLY\",e[e.MUTABLE=2]=\"MUTABLE\"})(ft||(ft={}));var W;(function(e){e[e.BORROWED=0]=\"BORROWED\",e[e.PRODUCER_OWNED=1]=\"PRODUCER_OWNED\",e[e.HOST_OWNED=2]=\"HOST_OWNED\",e[e.SHARED=3]=\"SHARED\"})(W||(W={}));function $r(e){if(e==null)return{valid:!0,present:!1,bytes:[]};if(typeof e==\"string\"){let s=e.startsWith(\"0x\")?e.slice(2):e;if(s.length===0)return{valid:!0,present:!1,bytes:[]};if(s.length%2!==0||!/^[0-9a-fA-F]+$/.test(s))return{valid:!1,present:!0,bytes:[]};let i=[];for(let r=0;r<s.length;r+=2)i.push(Number.parseInt(s.slice(r,r+2),16));return{valid:!0,present:!0,bytes:i}}if(!Array.isArray(e)&&!(e instanceof Uint8Array))return{valid:!1,present:!0,bytes:[]};let t=Array.from(e);return t.length===0?{valid:!0,present:!1,bytes:[]}:t.some(s=>!Number.isInteger(s)||s<0||s>255)?{valid:!1,present:!0,bytes:[]}:{valid:!0,present:!0,bytes:t}}function Zr(e){let t=$r(e);return t.valid&&t.present?t.bytes:void 0}function Qr(e){return $r(e).valid}function _f(e){return Object.prototype.toString.call(e)}function df(e){if(!e||typeof e!=\"object\")return!1;let t=_f(e);return t===\"[object ArrayBuffer]\"||t===\"[object SharedArrayBuffer]\"}function J(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):df(e)?new Uint8Array(e):null}var q;(function(e){e[e.FLATBUFFER=0]=\"FLATBUFFER\",e[e.ALIGNED_BINARY=1]=\"ALIGNED_BINARY\"})(q||(q={}));var Ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,s){return this.bb_pos=t,this.bb=s,this}static getRootAsFlatBufferTypeRef(t,s){return(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFlatBufferTypeRef(t,s){return t.setPosition(t.position()+4),(s||new e).__init(t.readInt32(t.position())+t.position(),t)}SCHEMA_NAME(t){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,t):null}FILE_IDENTIFIER(t){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__string(this.bb_pos+s,t):null}SCHEMA_VERSION(t){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__string(this.bb_pos+s,t):null}ROOT_TYPE(t){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.__string(this.bb_pos+s,t):null}SCHEMA_HASH(t){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.readUint8(this.bb.__vector(this.bb_pos+s)+t):0}schemaHashLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}schemaHashArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ACCEPTS_ANY_FLATBUFFER(){let t=this.bb.__offset(this.bb_pos,14);return t?!!this.bb.readInt8(this.bb_pos+t):!1}WIRE_FORMAT(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):q.FLATBUFFER}FIXED_STRING_LENGTH(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.readUint16(this.bb_pos+t):0}BYTE_LENGTH(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint32(this.bb_pos+t):0}REQUIRED_ALIGNMENT(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):0}static startFlatBufferTypeRef(t){t.startObject(10)}static addSchemaName(t,s){t.addFieldOffset(0,s,0)}static addFileIdentifier(t,s){t.addFieldOffset(1,s,0)}static addSchemaVersion(t,s){t.addFieldOffset(2,s,0)}static addRootType(t,s){t.addFieldOffset(3,s,0)}static addSchemaHash(t,s){t.addFieldOffset(4,s,0)}static createSchemaHashVector(t,s){t.startVector(1,s.length,1);for(let i=s.length-1;i>=0;i--)t.addInt8(s[i]);return t.endVector()}static startSchemaHashVector(t,s){t.startVector(1,s,1)}static addAcceptsAnyFlatbuffer(t,s){t.addFieldInt8(5,+s,0)}static addWireFormat(t,s){t.addFieldInt8(6,s,q.FLATBUFFER)}static addFixedStringLength(t,s){t.addFieldInt16(7,s,0)}static addByteLength(t,s){t.addFieldInt32(8,s,0)}static addRequiredAlignment(t,s){t.addFieldInt16(9,s,0)}static endFlatBufferTypeRef(t){return t.endObject()}static createFlatBufferTypeRef(t,s,i,r,o,a,E,l,_,p,O){return e.startFlatBufferTypeRef(t),e.addSchemaName(t,s),e.addFileIdentifier(t,i),e.addSchemaVersion(t,r),e.addRootType(t,o),e.addSchemaHash(t,a),e.addAcceptsAnyFlatbuffer(t,E),e.addWireFormat(t,l),e.addFixedStringLength(t,_),e.addByteLength(t,p),e.addRequiredAlignment(t,O),e.endFlatBufferTypeRef(t)}unpack(){return new Mt(this.SCHEMA_NAME(),this.FILE_IDENTIFIER(),this.SCHEMA_VERSION(),this.ROOT_TYPE(),this.bb.createScalarList(this.SCHEMA_HASH.bind(this),this.schemaHashLength()),this.ACCEPTS_ANY_FLATBUFFER(),this.WIRE_FORMAT(),this.FIXED_STRING_LENGTH(),this.BYTE_LENGTH(),this.REQUIRED_ALIGNMENT())}unpackTo(t){t.SCHEMA_NAME=this.SCHEMA_NAME(),t.FILE_IDENTIFIER=this.FILE_IDENTIFIER(),t.SCHEMA_VERSION=this.SCHEMA_VERSION(),t.ROOT_TYPE=this.ROOT_TYPE(),t.SCHEMA_HASH=this.bb.createScalarList(this.SCHEMA_HASH.bind(this),this.schemaHashLength()),t.ACCEPTS_ANY_FLATBUFFER=this.ACCEPTS_ANY_FLATBUFFER(),t.WIRE_FORMAT=this.WIRE_FORMAT(),t.FIXED_STRING_LENGTH=this.FIXED_STRING_LENGTH(),t.BYTE_LENGTH=this.BYTE_LENGTH(),t.REQUIRED_ALIGNMENT=this.REQUIRED_ALIGNMENT()}},Mt=class{constructor(t=null,s=null,i=null,r=null,o=[],a=!1,E=q.FLATBUFFER,l=0,_=0,p=0){this.SCHEMA_NAME=t,this.FILE_IDENTIFIER=s,this.SCHEMA_VERSION=i,this.ROOT_TYPE=r,this.SCHEMA_HASH=o,this.ACCEPTS_ANY_FLATBUFFER=a,this.WIRE_FORMAT=E,this.FIXED_STRING_LENGTH=l,this.BYTE_LENGTH=_,this.REQUIRED_ALIGNMENT=p}pack(t){let s=this.SCHEMA_NAME!==null?t.createString(this.SCHEMA_NAME):0,i=this.FILE_IDENTIFIER!==null?t.createString(this.FILE_IDENTIFIER):0,r=this.SCHEMA_VERSION!==null?t.createString(this.SCHEMA_VERSION):0,o=this.ROOT_TYPE!==null?t.createString(this.ROOT_TYPE):0,a=Ct.createSchemaHashVector(t,this.SCHEMA_HASH);return Ct.createFlatBufferTypeRef(t,s,i,r,o,a,this.ACCEPTS_ANY_FLATBUFFER,this.WIRE_FORMAT,this.FIXED_STRING_LENGTH,this.BYTE_LENGTH,this.REQUIRED_ALIGNMENT)}};var $;(function(e){e[e.IMMUTABLE=0]=\"IMMUTABLE\",e[e.SINGLE_WRITER_MUTABLE=1]=\"SINGLE_WRITER_MUTABLE\",e[e.APPEND_ONLY=2]=\"APPEND_ONLY\"})($||($={}));var Z;(function(e){e[e.HOST_OWNED=0]=\"HOST_OWNED\",e[e.PLUGIN_OWNED=1]=\"PLUGIN_OWNED\",e[e.TRANSFERRED=2]=\"TRANSFERRED\"})(Z||(Z={}));var x=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,s){return this.bb_pos=t,this.bb=s,this}static getRootAsTAB(t,s){return(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTAB(t,s){return t.setPosition(t.position()+4),(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier(\"$TAB\")}OFFSET(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0}SIZE(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint32(this.bb_pos+t):0}ALIGNMENT(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint32(this.bb_pos+t):0}WIRE_FORMAT(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint8(this.bb_pos+t):q.FLATBUFFER}TYPE_REF(t){let s=this.bb.__offset(this.bb_pos,12);return s?(t||new Ct).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}MUTABILITY(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readUint8(this.bb_pos+t):$.IMMUTABLE}OWNERSHIP(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):Z.HOST_OWNED}FRAME_ID(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.readUint64(this.bb_pos+t):BigInt(\"0\")}PORT_ID(t){let s=this.bb.__offset(this.bb_pos,20);return s?this.bb.__string(this.bb_pos+s,t):null}static startTAB(t){t.startObject(9)}static addOffset(t,s){t.addFieldInt32(0,s,0)}static addSize(t,s){t.addFieldInt32(1,s,0)}static addAlignment(t,s){t.addFieldInt32(2,s,0)}static addWireFormat(t,s){t.addFieldInt8(3,s,q.FLATBUFFER)}static addTypeRef(t,s){t.addFieldOffset(4,s,0)}static addMutability(t,s){t.addFieldInt8(5,s,$.IMMUTABLE)}static addOwnership(t,s){t.addFieldInt8(6,s,Z.HOST_OWNED)}static addFrameId(t,s){t.addFieldInt64(7,s,BigInt(\"0\"))}static addPortId(t,s){t.addFieldOffset(8,s,0)}static endTAB(t){return t.endObject()}static finishTABBuffer(t,s){t.finish(s,\"$TAB\")}static finishSizePrefixedTABBuffer(t,s){t.finish(s,\"$TAB\",!0)}unpack(){return new Ut(this.OFFSET(),this.SIZE(),this.ALIGNMENT(),this.WIRE_FORMAT(),this.TYPE_REF()!==null?this.TYPE_REF().unpack():null,this.MUTABILITY(),this.OWNERSHIP(),this.FRAME_ID(),this.PORT_ID())}unpackTo(t){t.OFFSET=this.OFFSET(),t.SIZE=this.SIZE(),t.ALIGNMENT=this.ALIGNMENT(),t.WIRE_FORMAT=this.WIRE_FORMAT(),t.TYPE_REF=this.TYPE_REF()!==null?this.TYPE_REF().unpack():null,t.MUTABILITY=this.MUTABILITY(),t.OWNERSHIP=this.OWNERSHIP(),t.FRAME_ID=this.FRAME_ID(),t.PORT_ID=this.PORT_ID()}},Ut=class{constructor(t=0,s=0,i=0,r=q.FLATBUFFER,o=null,a=$.IMMUTABLE,E=Z.HOST_OWNED,l=BigInt(\"0\"),_=null){this.OFFSET=t,this.SIZE=s,this.ALIGNMENT=i,this.WIRE_FORMAT=r,this.TYPE_REF=o,this.MUTABILITY=a,this.OWNERSHIP=E,this.FRAME_ID=l,this.PORT_ID=_}pack(t){let s=this.TYPE_REF!==null?this.TYPE_REF.pack(t):0,i=this.PORT_ID!==null?t.createString(this.PORT_ID):0;return x.startTAB(t),x.addOffset(t,this.OFFSET),x.addSize(t,this.SIZE),x.addAlignment(t,this.ALIGNMENT),x.addWireFormat(t,this.WIRE_FORMAT),x.addTypeRef(t,s),x.addMutability(t,this.MUTABILITY),x.addOwnership(t,this.OWNERSHIP),x.addFrameId(t,this.FRAME_ID),x.addPortId(t,i),x.endTAB(t)}};var It=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,s){return this.bb_pos=t,this.bb=s,this}static getRootAsPIVRequest(t,s){return(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsPIVRequest(t,s){return t.setPosition(t.position()+4),(s||new e).__init(t.readInt32(t.position())+t.position(),t)}METHOD_ID(t){let s=this.bb.__offset(this.bb_pos,4);return this.bb.__string(this.bb_pos+s,t)}INPUTS(t,s){let i=this.bb.__offset(this.bb_pos,6);return i?(s||new x).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}PAYLOAD_ARENA(t){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.readUint8(this.bb.__vector(this.bb_pos+s)+t):0}payloadArenaLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}payloadArenaArray(){let t=this.bb.__offset(this.bb_pos,8);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}TRACE_ID(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint64(this.bb_pos+t):BigInt(\"0\")}OUTPUT_STREAM_CAP(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint32(this.bb_pos+t):0}static startPIVRequest(t){t.startObject(5)}static addMethodId(t,s){t.addFieldOffset(0,s,0)}static addInputs(t,s){t.addFieldOffset(1,s,0)}static createInputsVector(t,s){t.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)t.addOffset(s[i]);return t.endVector()}static startInputsVector(t,s){t.startVector(4,s,4)}static addPayloadArena(t,s){t.addFieldOffset(2,s,0)}static createPayloadArenaVector(t,s){t.startVector(1,s.length,1);for(let i=s.length-1;i>=0;i--)t.addInt8(s[i]);return t.endVector()}static startPayloadArenaVector(t,s){t.startVector(1,s,1)}static addTraceId(t,s){t.addFieldInt64(3,s,BigInt(\"0\"))}static addOutputStreamCap(t,s){t.addFieldInt32(4,s,0)}static endPIVRequest(t){let s=t.endObject();return t.requiredField(s,4),s}static createPIVRequest(t,s,i,r,o,a){return e.startPIVRequest(t),e.addMethodId(t,s),e.addInputs(t,i),e.addPayloadArena(t,r),e.addTraceId(t,o),e.addOutputStreamCap(t,a),e.endPIVRequest(t)}unpack(){return new Gs(this.METHOD_ID(),this.bb.createObjList(this.INPUTS.bind(this),this.inputsLength()),this.bb.createScalarList(this.PAYLOAD_ARENA.bind(this),this.payloadArenaLength()),this.TRACE_ID(),this.OUTPUT_STREAM_CAP())}unpackTo(t){t.METHOD_ID=this.METHOD_ID(),t.INPUTS=this.bb.createObjList(this.INPUTS.bind(this),this.inputsLength()),t.PAYLOAD_ARENA=this.bb.createScalarList(this.PAYLOAD_ARENA.bind(this),this.payloadArenaLength()),t.TRACE_ID=this.TRACE_ID(),t.OUTPUT_STREAM_CAP=this.OUTPUT_STREAM_CAP()}},Gs=class{constructor(t=null,s=[],i=[],r=BigInt(\"0\"),o=0){this.METHOD_ID=t,this.INPUTS=s,this.PAYLOAD_ARENA=i,this.TRACE_ID=r,this.OUTPUT_STREAM_CAP=o}pack(t){let s=this.METHOD_ID!==null?t.createString(this.METHOD_ID):0,i=It.createInputsVector(t,t.createObjectOffsetList(this.INPUTS)),r=It.createPayloadArenaVector(t,this.PAYLOAD_ARENA);return It.createPIVRequest(t,s,i,r,this.TRACE_ID,this.OUTPUT_STREAM_CAP)}};var ht;(function(e){e[e.OK=0]=\"OK\",e[e.NOT_FOUND=1]=\"NOT_FOUND\",e[e.YIELDED=2]=\"YIELDED\",e[e.FAILED=3]=\"FAILED\"})(ht||(ht={}));var B=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,s){return this.bb_pos=t,this.bb=s,this}static getRootAsPIVResponse(t,s){return(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsPIVResponse(t,s){return t.setPosition(t.position()+4),(s||new e).__init(t.readInt32(t.position())+t.position(),t)}STATUS_CODE(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}STATUS(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):ht.OK}YIELDED(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}BACKLOG_REMAINING(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint32(this.bb_pos+t):0}OUTPUTS(t,s){let i=this.bb.__offset(this.bb_pos,12);return i?(s||new x).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}PAYLOAD_ARENA(t){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.readUint8(this.bb.__vector(this.bb_pos+s)+t):0}payloadArenaLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}payloadArenaArray(){let t=this.bb.__offset(this.bb_pos,14);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ERROR_CODE(t){let s=this.bb.__offset(this.bb_pos,16);return s?this.bb.__string(this.bb_pos+s,t):null}ERROR_MESSAGE(t){let s=this.bb.__offset(this.bb_pos,18);return s?this.bb.__string(this.bb_pos+s,t):null}TRACE_ID(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):BigInt(\"0\")}static startPIVResponse(t){t.startObject(9)}static addStatusCode(t,s){t.addFieldInt32(0,s,0)}static addStatus(t,s){t.addFieldInt32(1,s,ht.OK)}static addYielded(t,s){t.addFieldInt8(2,+s,0)}static addBacklogRemaining(t,s){t.addFieldInt32(3,s,0)}static addOutputs(t,s){t.addFieldOffset(4,s,0)}static createOutputsVector(t,s){t.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)t.addOffset(s[i]);return t.endVector()}static startOutputsVector(t,s){t.startVector(4,s,4)}static addPayloadArena(t,s){t.addFieldOffset(5,s,0)}static createPayloadArenaVector(t,s){t.startVector(1,s.length,1);for(let i=s.length-1;i>=0;i--)t.addInt8(s[i]);return t.endVector()}static startPayloadArenaVector(t,s){t.startVector(1,s,1)}static addErrorCode(t,s){t.addFieldOffset(6,s,0)}static addErrorMessage(t,s){t.addFieldOffset(7,s,0)}static addTraceId(t,s){t.addFieldInt64(8,s,BigInt(\"0\"))}static endPIVResponse(t){return t.endObject()}static createPIVResponse(t,s,i,r,o,a,E,l,_,p){return e.startPIVResponse(t),e.addStatusCode(t,s),e.addStatus(t,i),e.addYielded(t,r),e.addBacklogRemaining(t,o),e.addOutputs(t,a),e.addPayloadArena(t,E),e.addErrorCode(t,l),e.addErrorMessage(t,_),e.addTraceId(t,p),e.endPIVResponse(t)}unpack(){return new Ys(this.STATUS_CODE(),this.STATUS(),this.YIELDED(),this.BACKLOG_REMAINING(),this.bb.createObjList(this.OUTPUTS.bind(this),this.outputsLength()),this.bb.createScalarList(this.PAYLOAD_ARENA.bind(this),this.payloadArenaLength()),this.ERROR_CODE(),this.ERROR_MESSAGE(),this.TRACE_ID())}unpackTo(t){t.STATUS_CODE=this.STATUS_CODE(),t.STATUS=this.STATUS(),t.YIELDED=this.YIELDED(),t.BACKLOG_REMAINING=this.BACKLOG_REMAINING(),t.OUTPUTS=this.bb.createObjList(this.OUTPUTS.bind(this),this.outputsLength()),t.PAYLOAD_ARENA=this.bb.createScalarList(this.PAYLOAD_ARENA.bind(this),this.payloadArenaLength()),t.ERROR_CODE=this.ERROR_CODE(),t.ERROR_MESSAGE=this.ERROR_MESSAGE(),t.TRACE_ID=this.TRACE_ID()}},Ys=class{constructor(t=0,s=ht.OK,i=!1,r=0,o=[],a=[],E=null,l=null,_=BigInt(\"0\")){this.STATUS_CODE=t,this.STATUS=s,this.YIELDED=i,this.BACKLOG_REMAINING=r,this.OUTPUTS=o,this.PAYLOAD_ARENA=a,this.ERROR_CODE=E,this.ERROR_MESSAGE=l,this.TRACE_ID=_}pack(t){let s=B.createOutputsVector(t,t.createObjectOffsetList(this.OUTPUTS)),i=B.createPayloadArenaVector(t,this.PAYLOAD_ARENA),r=this.ERROR_CODE!==null?t.createString(this.ERROR_CODE):0,o=this.ERROR_MESSAGE!==null?t.createString(this.ERROR_MESSAGE):0;return B.createPIVResponse(t,this.STATUS_CODE,this.STATUS,this.YIELDED,this.BACKLOG_REMAINING,s,i,r,o,this.TRACE_ID)}};var j=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,s){return this.bb_pos=t,this.bb=s,this}static getRootAsPIV(t,s){return(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsPIV(t,s){return t.setPosition(t.position()+4),(s||new e).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier(\"$PIV\")}REQUEST(t){let s=this.bb.__offset(this.bb_pos,4);return s?(t||new It).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}RESPONSE(t){let s=this.bb.__offset(this.bb_pos,6);return s?(t||new B).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}static startPIV(t){t.startObject(2)}static addRequest(t,s){t.addFieldOffset(0,s,0)}static addResponse(t,s){t.addFieldOffset(1,s,0)}static endPIV(t){return t.endObject()}static finishPIVBuffer(t,s){t.finish(s,\"$PIV\")}static finishSizePrefixedPIVBuffer(t,s){t.finish(s,\"$PIV\",!0)}unpack(){return new ks(this.REQUEST()!==null?this.REQUEST().unpack():null,this.RESPONSE()!==null?this.RESPONSE().unpack():null)}unpackTo(t){t.REQUEST=this.REQUEST()!==null?this.REQUEST().unpack():null,t.RESPONSE=this.RESPONSE()!==null?this.RESPONSE().unpack():null}},ks=class{constructor(t=null,s=null){this.REQUEST=t,this.RESPONSE=s}pack(t){let s=this.REQUEST!==null?this.REQUEST.pack(t):0,i=this.RESPONSE!==null?this.RESPONSE.pack(t):0;return j.startPIV(t),j.addRequest(t,s),j.addResponse(t,i),j.endPIV(t)}};var Vt=65535,it=4294967295,Xr=new WeakMap,If=new WeakMap,pf=new WeakMap;function Y(...e){return e.find(t=>t!=null)}function Q(e,t,s={}){let{defaultValue:i,minimum:r=0,maximum:o=Number.MAX_SAFE_INTEGER}=s;if(e==null||e===\"\"){if(i!==void 0)return i;throw new TypeError(`${t} is required.`)}let a;if(typeof e==\"bigint\"){if(e<BigInt(r)||e>BigInt(o))throw new RangeError(`${t} must be an integer between ${r} and ${o}.`);a=Number(e)}else a=typeof e==\"number\"?e:Number(e);if(!Number.isSafeInteger(a)||a<r||a>o)throw new RangeError(`${t} must be an integer between ${r} and ${o}.`);return a}function oe(e){return e>0&&Number.isInteger(Math.log2(e))}function js(e,t,s={}){let i=Q(e,t,{defaultValue:s.defaultValue,minimum:0,maximum:s.maximum??it});if(!oe(i))throw new RangeError(`${t} must be a positive power of two.`);return i}function Ws(e,t,s){if(e>it-t)throw new RangeError(`${s} offset + size exceeds the uint32 address range.`)}function $s(e,t,s){if(e.buffer!==t.buffer||e.byteOffset<t.byteOffset||e.byteOffset+e.byteLength>t.byteOffset+t.byteLength)throw new Error(`${s} is outside its arena lease.`)}function Zs(e){let t=Xr.get(e);if(!t)throw new TypeError(\"SDS PIV/TAB arena lease is invalid.\");return t}function Sf(e,t,s,i){let r=Zs(e);if(r.closed)throw new Error(`${i} arena lease is closed.`);if(t!==r.generation)throw new Error(`${i} has stale arena lease generation ${String(t)}; active generation is ${r.generation}.`);return s&&$s(s,r.arena,i),r}function Jr(e,t,s={}){let i=e?.arenaLease;if(!i){if(s.required===!0)throw new Error(`${t} requires a live arena lease.`);return null}let r=J(e.payload),o=Y(e.generation,e.arenaGeneration);return Sf(i,o,r,t)}function tn(e,t){let s=Jr(e,t);if(!s)return null;let i=on(e.ownership),r=nn(e.mutability);if(i===W.PRODUCER_OWNED||r!==ft.IMMUTABLE){let o=J(e.payload),a=Y(e.generation,e.arenaGeneration),E=pf.get(e);if(E&&i===W.SHARED&&E.lease===e.arenaLease&&E.generation===a&&E.payloadBuffer===o?.buffer&&E.payloadByteOffset===o?.byteOffset&&E.payloadByteLength===o?.byteLength&&E.frameId===ae(e)&&E.ownership===i&&E.mutability===r)return s;throw new Error(`${t} producer-owned or mutable cross-invocation alias requires explicit compatible transfer forwarding.`)}return s}function Af(e){if(e instanceof at)return e;let t=J(e);if(t)return new at(t);throw new TypeError(\"Expected ByteBuffer, Uint8Array, ArrayBufferView, or ArrayBuffer.\")}function qs(e,t=0){let s=Number(e??t);return Number.isFinite(s)?Math.max(0,Math.trunc(s)):t}function Pt(e,t=BigInt(0)){if(typeof e==\"bigint\")return e;if(typeof e==\"number\"&&Number.isFinite(e))return BigInt(Math.trunc(e));if(typeof e==\"string\"&&e.trim())try{return BigInt(e.trim())}catch{return t}return t}function Ft(e){let t=typeof e==\"string\"?e.trim().toLowerCase():\"\";if(e===1||t===\"aligned-binary\"||t===\"aligned_binary\"||t===\"alignedbinary\")return\"aligned-binary\";if(e==null||e===0||t===\"\"||t===\"flatbuffer\")return\"flatbuffer\";throw new TypeError(`Unsupported SDS PIV/TAB wire format: ${String(e)}.`)}function Qs(e){return Ft(e)===\"aligned-binary\"?q.ALIGNED_BINARY:q.FLATBUFFER}function en(e){if(e===q.ALIGNED_BINARY)return\"aligned-binary\";if(e===q.FLATBUFFER)return\"flatbuffer\";throw new TypeError(`Unsupported SDS PIV/TAB wire format value: ${e}.`)}function zs(e){if(e==null||e===ft.IMMUTABLE||e===\"immutable\"||e===\"IMMUTABLE\")return $.IMMUTABLE;if(e===ft.APPEND_ONLY||e===\"append-only\"||e===\"APPEND_ONLY\")return $.APPEND_ONLY;if(e===ft.MUTABLE||e===\"mutable\"||e===\"single-writer-mutable\"||e===\"SINGLE_WRITER_MUTABLE\")return $.SINGLE_WRITER_MUTABLE;throw new TypeError(`Unsupported SDS PIV/TAB mutability: ${String(e)}.`)}function sn(e){if(e===$.APPEND_ONLY)return ft.APPEND_ONLY;if(e===$.SINGLE_WRITER_MUTABLE)return ft.MUTABLE;if(e===$.IMMUTABLE)return ft.IMMUTABLE;throw new TypeError(`Unsupported SDS PIV/TAB mutability value: ${e}.`)}function Xs(e){if(e==null||e===W.BORROWED||e===W.HOST_OWNED||e===\"borrowed\"||e===\"BORROWED\"||e===\"host-owned\"||e===\"host_owned\"||e===\"HOST_OWNED\")return Z.HOST_OWNED;if(e===W.PRODUCER_OWNED||e===\"producer-owned\"||e===\"producer_owned\"||e===\"PRODUCER_OWNED\"||e===\"plugin-owned\"||e===\"plugin_owned\"||e===\"PLUGIN_OWNED\")return Z.PLUGIN_OWNED;if(e===W.SHARED||e===\"shared\"||e===\"SHARED\"||e===\"transferred\"||e===\"TRANSFERRED\")return Z.TRANSFERRED;throw new TypeError(`Unsupported SDS PIV/TAB ownership: ${String(e)}.`)}function rn(e){if(e===Z.PLUGIN_OWNED)return W.PRODUCER_OWNED;if(e===Z.TRANSFERRED)return W.SHARED;if(e===Z.HOST_OWNED)return W.HOST_OWNED;throw new TypeError(`Unsupported SDS PIV/TAB ownership value: ${e}.`)}function nn(e){return sn(zs(e))}function on(e){return rn(Xs(e))}function bf(e={},t=void 0){let s=Y(e.schemaHash,e.SCHEMA_HASH);if(!Qr(s))throw new TypeError(\"SDS PIV/TAB schemaHash must contain valid bytes or hex.\");let i=Ft(Y(e.wireFormat,e.WIRE_FORMAT,t));return new Mt(e.schemaName??e.SCHEMA_NAME??null,e.fileIdentifier??e.FILE_IDENTIFIER??null,e.schemaVersion??e.SCHEMA_VERSION??null,e.rootTypeName??e.rootType??e.ROOT_TYPE??null,Zr(s)??[],!!(e.acceptsAnyFlatbuffer??e.ACCEPTS_ANY_FLATBUFFER??!1),Qs(i),Q(Y(e.fixedStringLength,e.FIXED_STRING_LENGTH),\"SDS PIV/TAB fixedStringLength\",{defaultValue:0,maximum:Vt}),Q(Y(e.byteLength,e.BYTE_LENGTH),\"SDS PIV/TAB byteLength\",{defaultValue:0,maximum:it}),Q(Y(e.requiredAlignment,e.REQUIRED_ALIGNMENT),\"SDS PIV/TAB requiredAlignment\",{defaultValue:0,maximum:Vt}))}function an(e={}){let t=e.typeRef??e.allowedType??{},s=Y(e.wireFormat,e.WIRE_FORMAT),i=Y(t.wireFormat,t.WIRE_FORMAT),r=Ft(Y(i,s));if(i!==void 0&&s!==void 0&&Ft(i)!==Ft(s))throw new Error(\"SDS PIV/TAB frame and typeRef wire formats disagree.\");let o=bf(t,r);if(r===\"aligned-binary\")o.REQUIRED_ALIGNMENT=js(o.REQUIRED_ALIGNMENT,\"SDS PIV/TAB aligned type requiredAlignment\",{maximum:Vt}),o.BYTE_LENGTH=Q(o.BYTE_LENGTH,\"SDS PIV/TAB aligned type byteLength\",{minimum:0,maximum:it});else if(o.REQUIRED_ALIGNMENT>0&&!oe(o.REQUIRED_ALIGNMENT))throw new RangeError(\"SDS PIV/TAB type requiredAlignment must be a positive power of two when declared.\");return{typeRef:o,wireFormat:r}}function fn(e,t){let s=Y(e?.alignment,e?.ALIGNMENT),i=js(s,\"SDS PIV/TAB frame alignment\",{defaultValue:Math.max(bt,t||1)});if(i<t)throw new RangeError(`SDS PIV/TAB frame alignment ${i} is below required alignment ${t}.`);return i}function hn(e,t,s){if(e===\"aligned-binary\"&&t.BYTE_LENGTH>0&&s!==t.BYTE_LENGTH)throw new RangeError(`SDS PIV/TAB aligned payload size ${s} does not match declared byteLength ${t.BYTE_LENGTH}.`)}function ae(e={}){return e.frameId!==void 0&&e.frameId!==null?Pt(e.frameId):e.sequence!==void 0||e.endOfStream!==void 0||e.endOfStream===!0?Pt(e.sequence)<<BigInt(1)|(e.endOfStream===!0?BigInt(1):BigInt(0)):Pt(e.traceId)}function Rf(e){let t=Pt(e);return{sequence:t>>BigInt(1),endOfStream:(t&BigInt(1))===BigInt(1)}}function wf(e,t){if(t<=1)return e;let s=e%t;return s===0?e:e+t-s}function Ks(e){return Q(Y(e?.offset,e?.OFFSET),\"SDS PIV/TAB frame offset\",{defaultValue:0,maximum:it})}function cn(e){return Q(Y(e?.size,e?.SIZE),\"SDS PIV/TAB frame size\",{defaultValue:0,maximum:it})}function fe(e){return js(Y(e?.alignment,e?.ALIGNMENT),\"SDS PIV/TAB frame alignment\",{defaultValue:bt})}function Tf(e={},t){let s=J(e.payload??new Uint8Array)??new Uint8Array;tn(e,\"SDS PIV/TAB frame forwarding\");let{typeRef:i,wireFormat:r}=an(e),o=i.REQUIRED_ALIGNMENT,a=fn(e,o);hn(r,i,s.length);let E=wf(t,a);return Ws(E,s.length,\"SDS PIV/TAB frame\"),{payload:s,padding:E-t,buffer:new Ut(E,s.length,a,Qs(r),i,zs(e.mutability),Xs(e.ownership),ae(e),e.portId??null)}}var bt=8;function Of(e,t={}){let s=J(e);if(!s)throw new TypeError(\"createInvokeArenaLease requires Uint8Array-compatible arena bytes.\");let i={arena:s,generation:Q(t.generation,\"SDS PIV/TAB arena lease generation\",{defaultValue:1,maximum:it}),closed:!1},r={get arena(){return i.arena},get generation(){return i.generation},get closed(){return i.closed},advance(o=void 0){if(i.closed)throw new Error(\"SDS PIV/TAB arena lease is closed.\");if(i.generation>=it)throw new RangeError(\"SDS PIV/TAB arena lease generation exceeds the uint32 range.\");if(o!==void 0){let a=J(o);if(!a)throw new TypeError(\"SDS PIV/TAB arena lease advance requires Uint8Array-compatible bytes.\");i.arena=a}return i.generation+=1,i.generation},close(){i.closed=!0},createTransferToken(o,a={}){if(Jr(o,\"SDS PIV/TAB arena transfer\",{required:!0})!==i||o.arenaLease!==r)throw new Error(\"SDS PIV/TAB arena transfer frame belongs to a different lease.\");let l=on(a.ownership??\"transferred\");if(l!==W.SHARED)throw new Error(\"SDS PIV/TAB arena transfer ownership must be transferred/shared.\");let _=nn(a.mutability??o.mutability),p=J(o.payload),O=Object.freeze({});return If.set(O,{lease:r,generation:i.generation,payloadBuffer:p.buffer,payloadByteOffset:p.byteOffset,payloadByteLength:p.byteLength,frameId:ae(o),ownership:l,mutability:_,consumed:!1}),O}};return Xr.set(r,i),Object.freeze(r)}function mf(e,t,s){return e.startVector(1,t.length,s),e.bb.setPosition(e.space-=t.length),e.bb.bytes().set(t,e.space),e.endVector()}function zr(e){return e===\"request\"?\"PIV request\":\"PIV response\"}function gf(e,t,s,i=bt){if(e.byteOffset%bt!==0)throw new Error(`${zr(s)} buffer base is not ${bt}-byte aligned (byteOffset ${e.byteOffset}).`);if(t&&t.length>0&&t.byteOffset%i!==0)throw new Error(`${zr(s)} payload arena base is not ${i}-byte aligned (byteOffset ${t.byteOffset}).`)}function yf(e=[],t=Tf){let s=[],i=[],r=0,o=bt;for(let E of e){let l=t(E,r);r=Ks(l.buffer)+cn(l.buffer),o=Math.max(o,fe(l.buffer)),s.push(l.buffer),i.push(l)}let a=new Uint8Array(r);for(let E of i)a.set(E.payload,Ks(E.buffer));return{frames:s,arena:a,arenaAlignment:o}}function Nf(e={}){return e.offset!==void 0||e.OFFSET!==void 0}function Df(e={},t){let s=J(e.payload),i=tn(e,\"SDS PIV/TAB external frame forwarding\");i&&t&&$s(t,i.arena,\"SDS PIV/TAB external arena\");let{typeRef:r,wireFormat:o}=an(e),a=fn(e,r.REQUIRED_ALIGNMENT),E=Q(Y(e.offset,e.OFFSET),\"SDS PIV/TAB external arena frame offset\",{defaultValue:0,maximum:it});!Nf(e)&&s&&t&&s.buffer===t.buffer&&(E=s.byteOffset-t.byteOffset);let l=Q(Y(e.size,e.SIZE,e.byteLength,s?.byteLength),\"SDS PIV/TAB external arena frame size\",{defaultValue:0,maximum:it});if(Ws(E,l,\"SDS PIV/TAB external arena frame\"),hn(o,r,l),l>0&&t){if(E>t.length||l>t.length-E)throw new Error(\"SDS PIV external arena frame range exceeds externalArena.\");let _=t.byteOffset+E;if(a>1&&_%a!==0)throw new Error(`SDS PIV external arena frame \"${e.portId??\"\"}\" is misaligned: absolute offset ${_} violates alignment ${a}.`)}return new Ut(E,l,a,Qs(o),r,zs(e.mutability),Xs(e.ownership),ae(e),e.portId??null)}function Lf(e=[],t){let s=J(t);if(!s)throw new TypeError(\"SDS PIV external arena encoding requires externalArena bytes.\");let i=bt;return{frames:e.map(o=>{let a=Df(o,s);return i=Math.max(i,fe(a)),a}),arena:new Uint8Array,arenaAlignment:i,externalArena:s}}function Cf(e){if(!e)return null;let t=e.schemaHashArray?.()??new Uint8Array;return{schemaName:e.SCHEMA_NAME()??null,fileIdentifier:e.FILE_IDENTIFIER()??null,schemaVersion:e.SCHEMA_VERSION()??null,schemaHash:t.byteLength>0?new Uint8Array(t):void 0,acceptsAnyFlatbuffer:e.ACCEPTS_ANY_FLATBUFFER?.()===!0,wireFormat:en(e.WIRE_FORMAT()),rootTypeName:e.ROOT_TYPE()??null,fixedStringLength:Q(e.FIXED_STRING_LENGTH(),\"SDS PIV/TAB decoded fixedStringLength\",{defaultValue:0,maximum:Vt}),byteLength:Q(e.BYTE_LENGTH(),\"SDS PIV/TAB decoded byteLength\",{defaultValue:0,maximum:it}),requiredAlignment:Q(e.REQUIRED_ALIGNMENT(),\"SDS PIV/TAB decoded requiredAlignment\",{defaultValue:0,maximum:Vt})}}function Uf(e){let t=e.typeRef;if(t&&t.wireFormat!==e.wireFormat)throw new Error(\"SDS PIV/TAB frame and typeRef wire formats disagree.\");let s=t?.requiredAlignment??0;if(s>0&&!oe(s))throw new RangeError(\"SDS PIV/TAB decoded requiredAlignment must be a positive power of two.\");if(e.alignment<s)throw new RangeError(`SDS PIV/TAB frame alignment ${e.alignment} is below required alignment ${s}.`);if(e.wireFormat===\"aligned-binary\"){if(!t)throw new Error(\"SDS PIV/TAB aligned frame requires a typeRef.\");if(!oe(s))throw new RangeError(\"SDS PIV/TAB aligned type requiredAlignment must be a positive power of two.\");let i=Number(t.byteLength??0);if(i>0&&e.size!==i)throw new RangeError(`SDS PIV/TAB aligned payload size ${e.size} does not match declared byteLength ${i}.`)}}function Pf(e){if(!e)return null;let t=qs(e.OFFSET()),s=qs(e.SIZE()),i=fe({ALIGNMENT:e.ALIGNMENT()}),r=en(e.WIRE_FORMAT()),o=Pt(e.FRAME_ID()),a=Rf(o),E={typeRef:Cf(e.TYPE_REF()),portId:e.PORT_ID()??null,alignment:i,offset:t,size:s,ownership:rn(e.OWNERSHIP()),generation:0,mutability:sn(e.MUTABILITY()),frameId:o,traceId:o,streamId:0,sequence:a.sequence,endOfStream:a.endOfStream,wireFormat:r};return Uf(E),E}function vf(e,t){let s=[];for(let i=0;i<e;i++){let r=Pf(t(i));r&&s.push(r)}return s}function Hf(e,t={}){let s=J(t.externalArena),i=e.length>0?e:s??e;if(!t.arenaLease)return Of(i);let r=Zs(t.arenaLease);if(r.closed)throw new Error(\"SDS PIV/TAB decoded arena lease is closed.\");return $s(i,r.arena,\"SDS PIV/TAB decoded arena\"),t.arenaLease}function Bf(e=[],t,s={}){let i=J(s.externalArena),r=s.arenaLease,o=r?Zs(r).generation:void 0;return e.map(a=>{let E=Ks(a),l=cn(a),_=t.length>0?t:i,p=t.length>0?\"PAYLOAD_ARENA\":\"external arena\";if(Ws(E,l,\"SDS PIV/TAB decoded frame\"),l>0&&!_)throw new Error(\"SDS PIV external arena bytes are required when PAYLOAD_ARENA is empty.\");if(_&&(E>_.length||l>_.length-E))throw new Error(`SDS PIV TAB payload range exceeds ${p}.`);let O=fe(a);if(_&&O>1&&l>0){let w=_.byteOffset+E;if(w%O!==0)throw new Error(`SDS PIV TAB \"${a.portId??\"\"}\" payload is misaligned: absolute offset ${w} violates alignment ${O}.`)}let A=_?_.subarray(E,E+l):new Uint8Array;return{...a,payload:A,typeRef:a.typeRef??null,arenaLease:r,arenaGeneration:o,generation:o}})}function Mf(e,t){return t.map(s=>s.pack(e))}function un(e,t={}){let s=Af(e);if(!j.bufferHasIdentifier(s))throw new Error(\"SDS PIV invoke request buffer identifier mismatch.\");let r=j.getRootAsPIV(s).REQUEST();if(!r)throw new Error(\"SDS PIV invoke envelope does not contain a request.\");let o=r.payloadArenaArray()??new Uint8Array,a=vf(r.inputsLength(),_=>r.INPUTS(_)),E=Hf(o,t),l=Bf(a,o,{...t,arenaLease:E});return{methodId:r.METHOD_ID()??null,inputFrames:l,inputs:l,payloadArena:o,arenaLease:E,traceId:r.TRACE_ID()??BigInt(0),outputStreamCap:r.OUTPUT_STREAM_CAP()??0,envelope:\"PIV\"}}function Ff(e={}){return e.status!==void 0?e.status:e.yielded===!0?ht.YIELDED:Number(e.statusCode??0)!==0||e.errorCode?ht.FAILED:ht.OK}function Js(e={}){let t=Array.isArray(e.outputs)?e.outputs:e.outputFrames??[],{frames:s,arena:i,arenaAlignment:r}=e.externalArena!==void 0?Lf(t,e.externalArena):yf(t),o=new Bt(1024),a=e.errorCode!==null&&e.errorCode!==void 0?o.createString(String(e.errorCode)):0,E=e.errorMessage!==null&&e.errorMessage!==void 0?o.createString(String(e.errorMessage)):0,l=B.createOutputsVector(o,Mf(o,s)),_=mf(o,i,r);B.startPIVResponse(o),B.addStatusCode(o,Number(e.statusCode??0)),B.addStatus(o,Ff(e)),B.addYielded(o,e.yielded===!0),B.addBacklogRemaining(o,qs(e.backlogRemaining)),B.addOutputs(o,l),B.addPayloadArena(o,_),B.addErrorCode(o,a),B.addErrorMessage(o,E),B.addTraceId(o,Pt(e.traceId));let p=B.endPIVResponse(o);j.startPIV(o),j.addResponse(o,p),j.finishPIVBuffer(o,j.endPIV(o));let O=o.asUint8Array(),A=j.getRootAsPIV(new at(O));return gf(O,A.RESPONSE()?.payloadArenaArray(),\"response\",r),O}var En=Object.freeze({Inline:0,Ref:1}),hl=Object.freeze({String:0,Number:1,Bool:2}),ln=Object.freeze({Duplicates:0,None:1,Current:2}),he=Object.freeze({Stream:0,Rows:1,Auto:2}),cl=Object.freeze({Default:0,Ed25519:1,Secp256k1:2,Secp256k1Digest:3,X25519:4,Sha256:5,Sha512:6,Aes256Gcm:7,HkdfSha256:8});var Bl=Object.freeze({TimerTick:\"TICK\",HttpRequest:\"HREQ\",HttpResponse:\"HRSP\",ModuleConfig:\"MCFG\",IngestRequest:\"INGQ\",IngestResult:\"INGR\",FlowNotice:\"FNTC\"});function Vf(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return t.length<8?\"\":String.fromCharCode(t[4],t[5],t[6],t[7])}var xf=e=>e==null?\"\":String(e);var Gf={duplicates:Nt.Duplicates,none:Nt.None,current:Nt.Current},Ml=Object.fromEntries(Object.entries(Gf).map(([e,t])=>[t,e]));var Yf={unchanged:dt.Unchanged,skipped:dt.Skipped,missing:dt.Missing,expired:dt.Expired,info:dt.Info},Fl=Object.fromEntries(Object.entries(Yf).map(([e,t])=>[t,e]));var _n=\"HostOps.fbs\";function xt(e){let t=Dt[e];if(typeof t!=\"function\"||!t.SIZE)throw new Error(`hostcall: ${e} is not a HostOps record`);return t}var In=e=>e[0].toLowerCase()+e.slice(1);function kf(e){let t=Object.getOwnPropertyNames(e.prototype);return t.filter(s=>s.startsWith(\"set\")&&!s.startsWith(\"setHas\")&&!s.endsWith(\"Length\")&&!s.endsWith(\"At\")).map(s=>s.slice(3)).concat(t.filter(s=>s.startsWith(\"set\")&&s.endsWith(\"At\")&&!s.startsWith(\"setHas\")).map(s=>s.slice(3,-2)))}function ei(e,t,s,i){for(let[r,o]of Object.entries(s||{})){if(o==null)continue;let a=e.prototype,E=In(r);if(typeof a[`set${r}At`]==\"function\"){if(t[`set${r}Length`](o.length),o.forEach((l,_)=>t[`set${r}At`](_,l)),typeof a[`setHas${r}`]==\"function\"&&t[`setHas${r}`](!0),t[`${E}Length`]()!==o.length)throw new RangeError(`${i}.${r}: ${o.length} items exceed the record's bound`);continue}if(typeof a[`set${r}`]!=\"function\"){if(typeof a[E]==\"function\"&&typeof o==\"object\"){let l=t[E]();ei(l.constructor,l,o,`${i}.${r}`),typeof a[`setHas${r}`]==\"function\"&&t[`setHas${r}`](!0);continue}throw new Error(`${i}: no field ${r}`)}if(typeof a[`setHas${r}`]==\"function\"&&t[`setHas${r}`](!0),t[`set${r}`](typeof o==\"number\"&&typeof t[E]()==\"bigint\"?BigInt(o):o),typeof o==\"string\"&&t[E]()!==o)throw new RangeError(`${i}.${r}: \"${o.slice(0,40)}...\" exceeds the record's ${new TextEncoder().encode(t[E]()).length}-byte string`)}}function pn(e,t){let s={};for(let i of kf(e)){let r=In(i);if(typeof t[`has${i}`]==\"function\"&&!t[`has${i}`]()){s[i]=typeof t[`${r}Length`]==\"function\"?[]:null;continue}if(typeof t[`${r}Length`]==\"function\"){s[i]=Array.from({length:t[`${r}Length`]()},(o,a)=>t[`${r}At`](a));continue}s[i]=t[r]()}for(let i of Object.getOwnPropertyNames(e.prototype)){if(i.startsWith(\"has\")||i.startsWith(\"set\")||i===\"constructor\")continue;let r=i[0].toUpperCase()+i.slice(1);r in s||typeof e.prototype[`setHas${r}`]!=\"function\"||(s[r]=t[`has${r}`]()?pn(t[i]().constructor,t[i]()):null)}return s}function qf(e,t){let s=xt(e),i=new Uint8Array(s.SIZE);return ei(s,s.fromPointer(i.buffer,0),t,e),i}function Kf(e,t){let s=xt(e),i=new Uint8Array(s.SIZE*t.length);return t.forEach((r,o)=>ei(s,s.fromPointer(i.buffer,o*s.SIZE),r,`${e}[${o}]`)),i}function jf(e,t){let s={},i={},r={};for(let o of e||[]){let a=o.portId??o.PORT_ID,E=o.typeRef||{},l=E.rootType??E.rootTypeName??E.ROOT_TYPE??null,_=o.payload instanceof Uint8Array?o.payload:new Uint8Array(o.payload||[]);if((o.wireFormat??E.wireFormat)===\"aligned-binary\"&&l){let p=xt(l),O=_.slice();if(O.length%p.SIZE)throw new RangeError(`${t}: ${a} is ${O.length} bytes, not a whole number of ${l} (${p.SIZE})`);let A=Array.from({length:O.length/p.SIZE},(w,R)=>pn(p,p.fromPointer(O.buffer,R*p.SIZE)));Number(E.byteLength??0)>0?s[a]={type:l,value:A[0]??null}:i[a]={type:l,values:A}}else r[a]=_.slice()}return{records:s,lists:i,raw:r}}var Wf=e=>typeof e==\"string\"?new TextEncoder().encode(e):e instanceof Uint8Array?e:new Uint8Array(e);function $f(e,{record:t,recordPort:s,recordType:i,raw:r={},lists:o={}},a,E,l){let _=[];if(t!=null){if(!i)throw new Error(`${l}: takes no ${s} record`);let p=xt(i);_.push({portId:s,wireFormat:\"aligned-binary\",typeRef:{schemaName:_n,rootType:i,wireFormat:\"aligned-binary\",byteLength:p.SIZE,requiredAlignment:p.ALIGN},payload:qf(i,t)})}for(let[p,O]of Object.entries(o)){let A=E[p];if(!A)throw new Error(`${l}: no list port ${p}`);let w=xt(A);_.push({portId:p,wireFormat:\"aligned-binary\",typeRef:{schemaName:_n,rootType:A,wireFormat:\"aligned-binary\",byteLength:0,requiredAlignment:w.ALIGN},payload:Kf(A,O)})}for(let[p,O]of Object.entries(r)){if(!a.includes(p))throw new Error(`${l}: no raw port ${p}`);_.push({portId:p,payload:Wf(O)})}return _}function Sn(e){let t=un(e),s=t.methodId??\"\",{records:i,lists:r,raw:o}=jf(t.inputs,s),a=Gt[s];if(a&&i.params&&i.params.type!==a.params)throw new Error(`hostcall: ${s} takes ${a.params}, the frame carries ${i.params.type}`);return{op:s,params:i.params?.value??null,lists:Object.fromEntries(Object.entries(r).map(([E,l])=>[E,l.values])),raw:o}}var An=Object.freeze({null:0,bool:1,i64:2,f64:3,str:4,bytes:5}),Zf=Object.fromEntries(Object.entries(An).map(([e,t])=>[t,e]));function bn(e){let t=(e||[]).map(o=>{let a=o&&typeof o==\"object\"&&!(o instanceof Uint8Array)&&\"t\"in o?o:null,E=a?a.t:o==null?\"null\":typeof o==\"boolean\"?\"bool\":typeof o==\"bigint\"?\"i64\":typeof o==\"number\"?Number.isInteger(o)?\"i64\":\"f64\":typeof o==\"string\"?\"str\":o instanceof Uint8Array?\"bytes\":null,l=a?a.v:o,_;switch(E){case\"null\":_=new Uint8Array(0);break;case\"bool\":_=Uint8Array.of(l?1:0);break;case\"i64\":_=new Uint8Array(8),new DataView(_.buffer).setBigInt64(0,BigInt(l),!0);break;case\"f64\":_=new Uint8Array(8),new DataView(_.buffer).setFloat64(0,Number(l),!0);break;case\"str\":_=new TextEncoder().encode(String(l));break;case\"bytes\":_=l instanceof Uint8Array?l:new Uint8Array(l);break;default:throw new TypeError(`SQL value ${String(o)} has no FlatSQL parameter tag`)}return[An[E],_]}),s=new Uint8Array(t.reduce((o,[,a])=>o+5+a.length,0)),i=new DataView(s.buffer),r=0;for(let[o,a]of t)s[r]=o,i.setUint32(r+1,a.length,!0),s.set(a,r+5),r+=5+a.length;return s}function Rn(e){let t=e instanceof Uint8Array?e:new Uint8Array(e||[]),s=new DataView(t.buffer,t.byteOffset,t.byteLength),i=[],r=0;for(;r<t.length;){if(r+5>t.length)throw new RangeError(\"SQL values: truncated value header\");let o=t[r],a=s.getUint32(r+1,!0),E=r+5;if(E+a>t.length)throw new RangeError(\"SQL values: payload exceeds the buffer\");let l=Zf[o],_={null:0,bool:1,i64:8,f64:8}[l];if(l===void 0)throw new RangeError(`SQL values: unknown tag ${o}`);if(_!==void 0&&a!==_)throw new RangeError(`SQL values: a ${l} carries ${_} bytes, not ${a}`);let p=t.subarray(E,E+a);i.push({t:l,v:l===\"null\"?null:l===\"bool\"?p[0]!==0:l===\"i64\"?s.getBigInt64(E,!0):l===\"f64\"?s.getFloat64(E,!0):l===\"str\"?new TextDecoder().decode(p):p.slice()}),r=E+a}return i}var Qf=Object.freeze([\"unsupported\",\"not-authorized\",\"invalid-params\",\"failed\",\"refused\",\"sandbox\",\"timeout\",\"too-large\"]);function si(e){if(e?.ok){let s=Gt[e.op];if(!s)throw new Error(`hostcall: unknown operation ${e.op}`);let i=$f(s,{record:e.result,recordPort:\"result\",recordType:s.result,raw:e.raw,lists:e.lists},s.rawOut,s.listsOut,`${e.op} result`);return Js({statusCode:0,outputs:i})}let t=e?.error?.code??\"failed\";if(!Qf.includes(t))throw new Error(`hostcall: unknown error code ${t}`);return Js({statusCode:1,status:\"FAILED\",errorCode:t,errorMessage:xf(e?.error?.message)})}function wn(e){return Vf(e)===\"$PIV\"}var I=(e,t,s,i={})=>Object.freeze({params:e,result:t,capability:s,rawIn:Object.freeze(i.rawIn||[]),rawOut:Object.freeze(i.rawOut||[]),listsIn:Object.freeze(i.listsIn||{}),listsOut:Object.freeze(i.listsOut||{})}),zf=[\"data\",\"key\",\"private_key\",\"public_key\",\"signature\",\"nonce\",\"aad\",\"ikm\",\"salt\",\"info\",\"envelope\"],Xf=[\"data\",\"nonce\",\"private_key\",\"public_key\"],D=(e,t)=>I(\"CryptoParams\",e,t,{rawIn:zf,rawOut:Xf}),dn={rawOut:[\"stream\"]},ti={rawIn:[\"sql\",\"params\"]},Gt=Object.freeze({\"host.runtimeTarget\":I(null,null,null,{rawOut:[\"value\"]}),\"host.listCapabilities\":I(null,null,null,{listsOut:{items:\"TextValue\"}}),\"host.listSupportedCapabilities\":I(null,null,null,{listsOut:{items:\"TextValue\"}}),\"host.listOperations\":I(null,null,null,{listsOut:{items:\"TextValue\"}}),\"host.hasCapability\":I(\"HasCapabilityParams\",\"BoolValue\",null),\"clock.now\":I(null,\"TimeValue\",\"clock\"),\"clock.nowIso\":I(null,null,\"clock\",{rawOut:[\"value\"]}),\"clock.monotonicNow\":I(null,\"NumberValue\",\"clock\"),\"random.bytes\":I(\"RandomBytesParams\",null,\"random\",{rawOut:[\"data\"]}),\"node.publicKey\":I(null,null,null,{rawOut:[\"value\"]}),\"node.peerId\":I(null,null,null,{rawOut:[\"value\"]}),\"plugin.getConfig\":I(null,null,null,{listsOut:{entries:\"ConfigEntry\"}}),\"http.request\":I(\"HttpParams\",\"HttpResult\",\"http\",{rawIn:[\"url\",\"headers\",\"body\"],rawOut:[\"url\",\"headers\",\"body\"]}),\"websocket.exchange\":I(\"WebsocketParams\",\"WebsocketResult\",\"websocket\",{rawIn:[\"url\",\"protocols\",\"message\"],rawOut:[\"url\",\"body\"]}),\"mqtt.publish\":I(\"MqttParams\",\"MqttResult\",\"mqtt\",{rawIn:[\"payload\",\"password\"]}),\"mqtt.subscribeOnce\":I(\"MqttParams\",\"MqttResult\",\"mqtt\",{rawIn:[\"password\"],rawOut:[\"body\"]}),\"tcp.request\":I(\"SocketParams\",\"SocketResult\",\"tcp\",{rawIn:[\"data\"],rawOut:[\"body\"]}),\"udp.request\":I(\"SocketParams\",\"SocketResult\",\"udp\",{rawIn:[\"data\"],rawOut:[\"body\"]}),\"tls.request\":I(\"SocketParams\",\"SocketResult\",\"tls\",{rawIn:[\"data\",\"ca\",\"cert\",\"key\"],rawOut:[\"body\"]}),\"storage.query\":I(\"StorageQueryParams\",null,\"storage_query\",{listsOut:{records_meta:\"StoredRecordMeta\"},rawOut:[\"records\"]}),\"storage.write\":I(\"StorageWriteParams\",\"StorageWriteResult\",\"storage_write\",{rawIn:[\"data\"]}),\"storage.delete\":I(\"StorageDeleteParams\",null,\"storage_write\"),\"storage.expire\":I(\"StorageExpireParams\",\"StorageExpireResult\",\"storage_write\"),\"storage.ingest_with_source\":I(\"StorageIngestParams\",\"StorageIngestResult\",\"storage_ingest\",{rawIn:[\"records\",\"archive\"],listsIn:{provenance:\"Provenance\",provenance_attributes:\"ProvenanceAttribute\"}}),\"storage.flatsql_query_stream\":I(\"SqlStreamParams\",\"StreamResult\",\"storage_query\",{...ti,...dn}),\"storage.flatsql_epoch_stream\":I(\"EpochStreamParams\",\"StreamResult\",\"storage_query\",dn),\"storage.query_sandboxed\":I(\"SandboxQueryParams\",\"SandboxQueryResult\",\"storage_query\",{...ti,rawOut:[\"stream\",\"cells\"],listsOut:{columns:\"TextValue\"}}),\"storage.query_surface\":I(null,\"QuerySurfaceLimits\",\"storage_query\",{listsOut:{tables:\"SurfaceTable\",columns:\"SurfaceColumn\"}}),\"storage.flatsql_cache_key\":I(\"CacheKeyParams\",null,\"storage_query\",{...ti,listsIn:{projection:\"TextValue\"},rawOut:[\"value\"]}),\"crypto.hash\":D(null,\"crypto_hash\"),\"crypto.sign\":D(null,\"crypto_sign\"),\"crypto.verify\":D(\"BoolValue\",\"crypto_verify\"),\"crypto.encrypt\":D(null,\"crypto_encrypt\"),\"crypto.decrypt\":D(null,\"crypto_decrypt\"),\"crypto.key_agreement\":D(null,\"crypto_key_agreement\"),\"crypto.kdf\":D(null,\"crypto_kdf\"),\"crypto.generate_key\":D(null,\"crypto_sign\"),\"crypto.random\":D(null,\"crypto_hash\"),\"crypto.ed25519.publicKeyFromSeed\":D(null,\"crypto_sign\"),\"crypto.ed25519.sign\":D(null,\"crypto_sign\"),\"crypto.ed25519.verify\":D(\"BoolValue\",\"crypto_verify\"),\"crypto.secp256k1.publicKeyFromPrivate\":D(null,\"crypto_sign\"),\"crypto.secp256k1.sign\":D(null,\"crypto_sign\"),\"crypto.secp256k1.verify\":D(\"BoolValue\",\"crypto_verify\"),\"crypto.sha256\":D(null,\"crypto_hash\"),\"crypto.sha512\":D(null,\"crypto_hash\"),\"crypto.hkdf\":D(null,\"crypto_kdf\"),\"crypto.aesGcmEncrypt\":D(null,\"crypto_encrypt\"),\"crypto.aesGcmDecrypt\":D(null,\"crypto_decrypt\"),\"crypto.x25519.generateKeypair\":D(null,\"crypto_key_agreement\"),\"crypto.x25519.publicKey\":D(null,\"crypto_key_agreement\"),\"crypto.x25519.sharedSecret\":D(null,\"crypto_key_agreement\"),\"crypto.sealedBox.encryptForRecipient\":D(null,\"crypto_encrypt\"),\"crypto.sealedBox.decryptFromEnvelope\":D(null,\"crypto_decrypt\"),\"crypto.secp256k1.signDigest\":D(null,\"crypto_sign\"),\"crypto.secp256k1.verifyDigest\":D(\"BoolValue\",\"crypto_verify\"),\"keyslot.sign\":I(\"KeyslotParams\",null,\"wallet_sign\",{rawIn:[\"payload\"],rawOut:[\"data\"]}),\"keyslot.unwrap\":I(\"KeyslotParams\",null,\"wallet_sign\",{rawIn:[\"ephemeral_public_key\",\"nonce\",\"ciphertext\"],rawOut:[\"data\"]}),\"secrets.get\":I(\"SecretParams\",\"SecretResult\",\"secrets\",{rawOut:[\"secret\"]}),\"secrets.status\":I(\"SecretParams\",\"SecretResult\",\"secrets\"),\"secrets.put\":I(\"SecretParams\",\"SecretResult\",\"secrets\",{rawIn:[\"secret\"]}),\"secrets.clear\":I(\"SecretParams\",null,\"secrets\"),\"ipfs.add\":I(\"IpfsParams\",\"IpfsResult\",\"ipfs\",{rawIn:[\"data\"]}),\"ipfs.cat\":I(\"IpfsParams\",null,\"ipfs\",{rawOut:[\"data\"]}),\"ipfs.ls\":I(\"IpfsParams\",null,\"ipfs\",{listsOut:{links:\"IpfsLink\"}}),\"ipfs.pin_add\":I(\"IpfsParams\",null,\"ipfs\",{listsOut:{items:\"TextValue\"}}),\"ipfs.pin_rm\":I(\"IpfsParams\",null,\"ipfs\",{listsOut:{items:\"TextValue\"}}),\"ipfs.pin_ls\":I(\"IpfsParams\",null,\"ipfs\",{listsOut:{pins:\"IpfsPin\"}}),\"ipfs.dag_get\":I(\"IpfsParams\",null,\"ipfs\",{rawOut:[\"data\"]}),\"ipfs.name_resolve\":I(\"IpfsParams\",\"IpfsResult\",\"ipfs\"),\"ipfs.name_publish\":I(\"IpfsParams\",\"IpfsResult\",\"ipfs\"),\"ipfs.id\":I(null,\"IpfsResult\",\"ipfs\",{listsOut:{addresses:\"TextValue\"}}),\"ipfs.swarm_peers\":I(null,null,\"ipfs\",{listsOut:{peers:\"IpfsSwarmPeer\"}}),\"ipfs.pubsub_publish\":I(\"PubsubParams\",null,\"ipfs\",{rawIn:[\"data\"]}),\"pubsub.publish\":I(\"PubsubParams\",null,\"pubsub\",{rawIn:[\"data\"]}),\"pubsub.subscribe\":I(\"PubsubParams\",\"PubsubSubscribed\",\"pubsub\"),\"pubsub.unsubscribe\":I(\"PubsubParams\",null,\"pubsub\"),\"pubsub.list_topics\":I(null,null,\"pubsub\",{listsOut:{items:\"TextValue\"}}),\"protocol.request\":I(\"ProtocolParams\",null,\"protocol_dial\",{rawIn:[\"payload\"],rawOut:[\"data\"]}),\"protocol_dial.dial\":I(\"ProtocolParams\",null,\"protocol_dial\"),\"protocol_handle.register\":I(\"ProtocolParams\",null,\"protocol_handle\"),\"protocol_handle.unregister\":I(\"ProtocolParams\",null,\"protocol_handle\"),\"p2p.peers_snapshot\":I(\"P2pParams\",\"P2pSummary\",\"p2p_read\",{listsOut:{peers:\"P2pPeer\",peer_addresses:\"P2pPeerValue\",peer_standards:\"P2pPeerValue\"},rawOut:[\"records\"]}),\"p2p.standards_snapshot\":I(\"P2pParams\",null,\"p2p_read\",{listsOut:{entries:\"P2pPnmEntry\"},rawOut:[\"records\"]}),\"p2p.pnm_history\":I(\"P2pParams\",\"P2pSummary\",\"p2p_read\",{listsOut:{entries:\"P2pPnmEntry\"},rawOut:[\"records\"]}),\"p2p.latest_dataset\":I(\"P2pParams\",\"P2pLatestDataset\",\"p2p_read\",{rawOut:[\"stream\"]}),\"node_status_read.status\":I(null,\"NodeStatusReport\",\"node_status_read\",{listsOut:{bandwidth_history:\"NodeBandwidthSample\"}}),\"node_activity_read.activity\":I(\"NodeActivityParams\",null,\"node_activity_read\",{listsOut:{events:\"NodeActivityEvent\"}}),\"timers.delay\":I(\"TimersDelayParams\",null,\"timers\"),\"schedule.parse\":I(\"ScheduleParams\",null,\"schedule_cron\",{listsOut:{fields:\"CronField\"}}),\"schedule.matches\":I(\"ScheduleParams\",\"BoolValue\",\"schedule_cron\"),\"schedule.next\":I(\"ScheduleParams\",\"TimeValue\",\"schedule_cron\"),\"filesystem.resolvePath\":I(null,null,\"filesystem\",{rawIn:[\"path\"],rawOut:[\"path\"]}),\"filesystem.readFile\":I(null,null,\"filesystem\",{rawIn:[\"path\"],rawOut:[\"data\"]}),\"filesystem.writeFile\":I(null,null,\"filesystem\",{rawIn:[\"path\",\"data\"]}),\"filesystem.appendFile\":I(null,null,\"filesystem\",{rawIn:[\"path\",\"data\"]}),\"filesystem.deleteFile\":I(null,null,\"filesystem\",{rawIn:[\"path\"]}),\"filesystem.mkdir\":I(\"FsParams\",null,\"filesystem\",{rawIn:[\"path\"]}),\"filesystem.readdir\":I(null,null,\"filesystem\",{rawIn:[\"path\"],listsOut:{entries:\"FsEntry\"}}),\"filesystem.stat\":I(null,\"FsStat\",\"filesystem\",{rawIn:[\"path\"],rawOut:[\"path\"]}),\"filesystem.rename\":I(null,null,\"filesystem\",{rawIn:[\"path\",\"to_path\"]}),\"exec.execFile\":I(\"ExecParams\",\"ExecResult\",\"process_exec\",{rawIn:[\"file\",\"cwd\",\"input\"],listsIn:{args:\"TextValue\",env:\"EnvVar\"},rawOut:[\"stdout\",\"stderr\"]}),\"context.get\":I(\"ContextParams\",\"BoolValue\",\"context_read\",{rawOut:[\"value\"]}),\"context.listKeys\":I(\"ContextParams\",null,\"context_read\",{listsOut:{items:\"TextValue\"}}),\"context.listScopes\":I(null,null,\"context_read\",{listsOut:{items:\"TextValue\"}}),\"context.set\":I(\"ContextParams\",null,\"context_write\",{rawIn:[\"value\"]}),\"context.delete\":I(\"ContextParams\",\"BoolValue\",\"context_write\")});function Jf(e){if(!Number.isInteger(e)||e<0||e>255)throw new TypeError(\"Expected byte values in range 0..255.\")}function th(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(Array.isArray(e))return e.forEach(Jf),Uint8Array.from(e);throw new TypeError(\"Expected Uint8Array, ArrayBuffer, ArrayBufferView, or byte array.\")}function On(e){return Buffer.from(th(e)).toString(\"base64\")}var Tn=256*1024*1024;function mn(e){let t=String(e??\"\").trim();if(t.length>Tn)throw new RangeError(`Base64 input exceeds ${Tn} character limit.`);return new Uint8Array(Buffer.from(t,\"base64\"))}var eh=new TextDecoder,le=new TextEncoder,C=e=>e===void 0?void 0:eh.decode(e),rt=e=>e==null?void 0:e instanceof Uint8Array?e:typeof e==\"string\"?le.encode(e):new Uint8Array(e),Yt=e=>(e||[]).map(t=>({VALUE:String(t)})),gn=e=>BigInt(Math.round(e instanceof Date?e.getTime():Number(e))),Un=e=>e.toLowerCase().replace(/_([a-z0-9])/g,(t,s)=>s.toUpperCase()),sh=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1_$2\").toUpperCase();function _e(e){let t={};for(let[s,i]of Object.entries(e||{}))i==null||i===\"\"||i===0||i===0n||i===!1||(t[Un(s)]=typeof i==\"bigint\"?Number(i):i);return t}function de(e,t){if(!e||!t||typeof t!=\"object\")return null;let s={};for(let[i,r]of Object.entries(t))r==null||r instanceof Uint8Array||typeof r==\"object\"||(s[sh(i)]=r);return ih(e,s)}function ih(e,t){let s=Dt[e]?.prototype;return s?Object.fromEntries(Object.entries(t).filter(([i])=>typeof s[`set${i}`]==\"function\")):t}function rh(e){if(!e)return;let t={};for(let s of C(e).split(/\\r?\\n/)){let i=s.indexOf(\":\");i>0&&(t[s.slice(0,i).trim()]=s.slice(i+1).trim())}return t}function nh(e){return e?(typeof e.entries==\"function\"&&!(e instanceof Map)&&!Array.isArray(e)?Array.from(e.entries()):e instanceof Map?Array.from(e):Object.entries(e)).map(([s,i])=>`${s}: ${Array.isArray(i)?i.join(\", \"):i}`).join(`\\r\n`):void 0}var ii=16;function oh(e){if(!e||e.length<ii)throw Object.assign(new Error(\"AES-GCM data is shorter than its 16-byte tag\"),{hostcallCode:\"invalid-params\"});return{ciphertext:e.subarray(0,e.length-ii),tag:e.subarray(e.length-ii)}}var ah=(e,t)=>{let s=new Uint8Array(e.length+t.length);return s.set(e,0),s.set(t,e.length),s},lt=(e,t=\"failed\")=>Object.assign(new Error(e),{hostcallCode:t}),y=e=>e==null?\"\":String(e);function ct(e){if(e==null||e===\"\")return;if(e instanceof Date)return BigInt(Number.isFinite(e.getTime())?e.getTime():0);if(typeof e==\"bigint\")return e;if(typeof e==\"number\")return BigInt(Number.isFinite(e)?Math.trunc(e):0);let t=Date.parse(String(e));return BigInt(Number.isFinite(t)?t:0)}var hi=(e,t)=>Object.keys(e).find(s=>e[s]===Number(t??0))??\"\",Et=e=>e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):void 0,yn=new Map;function fh(e){let t=yn.get(e);return t||yn.set(e,t=e.fromPointer(new ArrayBuffer(e.SIZE),0)),t}function hh(e){if(typeof e==\"bigint\")return e;if(typeof e==\"boolean\")return e?1n:0n;if(typeof e==\"string\"&&/^-?\\d+$/.test(e.trim()))return BigInt(e.trim());let t=Number(e);return BigInt(Number.isFinite(t)?Math.trunc(t):0)}function Pn(e,t){let s=fh(e),i=e.prototype,r={};for(let[o,a]of Object.entries(t||{})){if(a==null)continue;let E=o[0].toLowerCase()+o.slice(1);if(typeof i[`set${o}`]!=\"function\"){typeof i[E]==\"function\"&&typeof i[`setHas${o}`]==\"function\"&&typeof a==\"object\"&&(r[o]=Pn(s[E]().constructor,a));continue}let l=typeof s[E]();r[o]=l===\"bigint\"?hh(a):l===\"number\"?Number.isFinite(Number(a))?Number(a):0:l===\"boolean\"?a===!0||a===\"true\":String(a)}return r}var V=(e,t)=>Pn(Dt[e],t);function ce(e,t){let s={};for(let[i,r]of Object.entries(t||{}))[\"string\",\"number\",\"boolean\",\"bigint\"].includes(typeof r)&&(s[i.toUpperCase()]=r);return V(e,s)}function ut(e){let t={};for(let[s,i]of Object.entries(e||{}))i==null||i===\"\"||i===!1||i===0||i===0n||Array.isArray(i)&&i.length===0||(t[s.toLowerCase()]=typeof i==\"bigint\"?Number(i):i);return t}function ch(e){let t=new Uint8Array(e.reduce((r,o)=>r+4+o.length,0)),s=new DataView(t.buffer),i=0;for(let r of e)s.setUint32(i,r.length,!0),t.set(r,i+4),i+=4+r.length;return t}var Nn=2**53;function uh(e){if(!e.params)return;let t;try{t=Rn(e.params)}catch(s){throw lt(`params: ${s.message}`,\"invalid-params\")}return t.map(({t:s,v:i})=>s===\"null\"?{t:s}:s===\"i64\"?{t:s,v:i>BigInt(Nn)||i<-BigInt(Nn)?i.toString():Number(i)}:{t:s,v:i})}var Eh=e=>hi(En,e?.DELIVER)===\"Ref\"?\"ref\":void 0;function ci(e,t){delete e.deliver;let s=Eh(t);return s&&(e.deliver=s),e}function ri({params:e,raw:t}){let s={sql:C(t.sql)??\"\"},i=uh(t);return i&&(s.params=i),ci(s,e)}var vn=e=>({TOKEN:e.token,SIZE:e.size,FRAMES:e.frames??-1,FNV1A64:y(e.fnv1a64)});function ni(e,t=\"StreamResult\"){let s={ROWS:e?.rows??0,COLUMNS:e?.columns??0},i={raw:{}};return e?.ref&&typeof e.ref==\"object\"?s.REF=vn(e.ref):Et(e?.stream)&&(i.raw.stream=Et(e.stream)),i.result=V(t,s),i}function lh(e){if(e==null)return{t:\"null\"};if(typeof e==\"boolean\")return{t:\"bool\",v:e};if(typeof e==\"number\")return Number.isInteger(e)?{t:\"i64\",v:BigInt(e)}:{t:\"f64\",v:e};if(typeof e==\"string\")return{t:\"str\",v:e};throw lt(`storage.query_sandboxed: a cell is a ${Array.isArray(e)?\"list\":typeof e} (nested values are not SQL values)`)}function _h(e){let t=[],s=(i,r)=>{if(r!=null){if(Array.isArray(r)){r.forEach((o,a)=>s(`${i}.${a}`,o));return}if(typeof r==\"object\"&&!(r instanceof Date)){for(let o of Object.keys(r).sort())s(i?`${i}.${o}`:o,r[o]);return}if(typeof r==\"boolean\")t.push({KEY:i,KIND:2,BOOL_VALUE:r});else if(typeof r==\"string\")t.push({KEY:i,KIND:0,STRING_VALUE:r});else if(typeof r==\"number\"||typeof r==\"bigint\")t.push({KEY:i,KIND:1,NUMBER_VALUE:Number(r)});else throw lt(`plugin.getConfig: ${i} is a ${r instanceof Date?\"Date\":typeof r}`)}};s(\"\",e??{});for(let i of t)if(le.encode(i.KEY).length>255||le.encode(i.STRING_VALUE??\"\").length>255)throw lt(`plugin.getConfig: ${i.KEY} does not fit a ConfigEntry (255 bytes)`,\"too-large\");return t}function ue({params:e,raw:t}){let s={id:y(e?.ID)};return e?.USERNAME&&(s.username=e.USERNAME),t.secret&&(s.secret=C(t.secret)),s}function Dn(e){return{result:V(\"SecretResult\",{ID:y(e?.id),CONFIGURED:e?.configured===!0||e?.stored===!0,USERNAME_MASKED:y(e?.username_masked),UPDATED_MS:ct(e?.updated_at??e?.updatedAt)??0n,VERIFIED_MS:ct(e?.verified_at)??0n})}}function Ln(e){return t=>{if(t==null||t===\"\")throw lt(`node ${e} not available`);return{raw:{value:String(t)}}}}function Cn(e){return V(\"P2pPnmEntry\",{PEER_ID:e.peer_id,PUBLISHER_PEER_ID:e.publisher_peer_id,GOSSIP_PEER_ID:e.gossip_peer_id,STANDARD:e.standard,SCHEMA:e.schema,FILE_ID:e.file_id,FILE_NAME:e.file_name,CID:e.cid,PUBLISH_MS:ct(e.publish_timestamp??e.publish_ms),SIGNATURE_TYPE:e.signature_type,SIGNATURE_HEX:e.signature??e.signature_hex,SIGNATURE_VERIFIED:e.signature_verified,ATTRIBUTION:e.attribution,PNM_INDEX:e.pnm_index??-1,PUBLISHER_KEY_HEX:e.publisher_key??e.publisher_key_hex,PUBLISHER_KEY_SOURCE:e.publisher_key_source})}var oi=e=>Et(e?.records)?{records:Et(e.records)}:{},Ee=({params:e})=>ci(ut(e),e),Rt=e=>Array.isArray(e)?e.filter(t=>t&&typeof t==\"object\"):[],Hn={\"host.runtimeTarget\":{out:e=>({raw:{value:String(e)}})},\"host.listCapabilities\":{out:e=>({lists:{items:Yt(e)}})},\"host.listSupportedCapabilities\":{out:e=>({lists:{items:Yt(e)}})},\"host.listOperations\":{out:e=>({lists:{items:Yt(e)}})},\"host.hasCapability\":{in:({params:e})=>({capability:e?.CAPABILITY}),out:e=>({result:{VALUE:!!e}})},\"clock.now\":{out:e=>({result:{UNIX_MS:gn(e)}})},\"clock.nowIso\":{out:e=>({raw:{value:String(e)}})},\"clock.monotonicNow\":{out:e=>({result:{VALUE:Number(e)}})},\"random.bytes\":{in:({params:e})=>({length:e?.LENGTH||32}),out:e=>({raw:{data:rt(e)}})},\"timers.delay\":{in:({params:e})=>({ms:e?.MS??0}),out:()=>({})},\"schedule.parse\":{in:({params:e})=>({expression:e?.EXPRESSION}),out:e=>({lists:{fields:Object.entries(e||{}).filter(([,t])=>t&&typeof t==\"object\"&&Array.isArray(t.values)).map(([t,s])=>({NAME:t,SOURCE:String(s.source??\"\"),HAS_WILDCARD:!!s.hasWildcard,VALUES:s.values}))}})},\"schedule.matches\":{in:({params:e})=>({expression:e?.EXPRESSION,date:e?.AT_MS?new Date(Number(e.AT_MS)):new Date}),out:e=>({result:{VALUE:!!e}})},\"schedule.next\":{in:({params:e})=>({expression:e?.EXPRESSION,from:e?.AT_MS?new Date(Number(e.AT_MS)):new Date}),out:e=>({result:{UNIX_MS:gn(e)}})},\"http.request\":{in:({params:e,raw:t})=>({url:C(t.url),method:e?.METHOD||\"GET\",headers:rh(t.headers),body:t.body,timeoutMs:e?.TIMEOUT_MS||void 0,responseType:\"bytes\",redirect:e?.NO_REDIRECTS?\"manual\":\"follow\",maxBytes:e?.MAX_BYTES?Number(e.MAX_BYTES):void 0}),out:(e,{params:t})=>{let s=rt(e?.body)??new Uint8Array(0);if(t?.MAX_BYTES&&s.length>Number(t.MAX_BYTES))throw Object.assign(new Error(`HTTP body of ${s.length} bytes exceeds MAX_BYTES ${t.MAX_BYTES}`),{hostcallCode:\"too-large\"});return{result:{STATUS:e?.status??0,RETRIEVED_MS:BigInt(Date.now())},raw:{url:String(e?.url??\"\"),headers:nh(e?.headers)??\"\",body:s}}}},\"websocket.exchange\":{in:({params:e,raw:t})=>({url:C(t.url),protocols:t.protocols?C(t.protocols).split(\",\").map(s=>s.trim()).filter(Boolean):void 0,message:t.message===void 0?void 0:e?.MESSAGE_IS_TEXT?C(t.message):t.message,timeoutMs:e?.TIMEOUT_MS||void 0,expectResponse:!e?.NO_RESPONSE,responseType:\"bytes\"}),out:e=>({result:{PROTOCOL:e?.protocol??\"\",EXTENSIONS:e?.extensions??\"\",CLOSE_CODE:e?.closeCode??-1,CLOSE_REASON:e?.closeReason??\"\",BODY_IS_TEXT:typeof e?.body==\"string\"},raw:{url:String(e?.url??\"\"),...e?.body==null?{}:{body:rt(e.body)}}})},\"mqtt.publish\":{in:({params:e,raw:t})=>({..._e(e),keepAliveSeconds:e?.KEEP_ALIVE_S||void 0,payload:t.payload,password:C(t.password)}),out:e=>({result:de(\"MqttResult\",e)})},\"mqtt.subscribeOnce\":{in:({params:e,raw:t})=>({..._e(e),keepAliveSeconds:e?.KEEP_ALIVE_S||void 0,password:C(t.password),responseType:\"bytes\"}),out:e=>({result:de(\"MqttResult\",e),raw:e?.payload==null&&e?.body==null?{}:{body:rt(e.payload??e.body)}})},\"tcp.request\":fi(),\"udp.request\":fi(),\"tls.request\":fi(({raw:e})=>({ca:C(e.ca),cert:C(e.cert),key:C(e.key)})),\"filesystem.resolvePath\":{in:({raw:e})=>({path:C(e.path)}),out:e=>({raw:{path:String(e)}})},\"filesystem.readFile\":{in:({raw:e})=>({path:C(e.path)}),out:e=>({raw:{data:rt(e)}})},\"filesystem.writeFile\":{in:({raw:e})=>({path:C(e.path),value:e.data??new Uint8Array(0)}),out:()=>({})},\"filesystem.appendFile\":{in:({raw:e})=>({path:C(e.path),value:e.data??new Uint8Array(0)}),out:()=>({})},\"filesystem.deleteFile\":{in:({raw:e})=>({path:C(e.path)}),out:()=>({})},\"filesystem.mkdir\":{in:({params:e,raw:t})=>({path:C(t.path),recursive:!e?.NOT_RECURSIVE}),out:()=>({})},\"filesystem.readdir\":{in:({raw:e})=>({path:C(e.path)??\".\"}),out:e=>({lists:{entries:(e||[]).map(t=>({NAME:t.name,IS_FILE:!!t.isFile,IS_DIRECTORY:!!t.isDirectory}))}})},\"filesystem.stat\":{in:({raw:e})=>({path:C(e.path)}),out:e=>({result:{SIZE:BigInt(e?.size??0),IS_FILE:!!e?.isFile,IS_DIRECTORY:!!e?.isDirectory,CTIME_MS:Number(e?.ctimeMs??0),MTIME_MS:Number(e?.mtimeMs??0)},raw:{path:String(e?.path??\"\")}})},\"filesystem.rename\":{in:({raw:e})=>({fromPath:C(e.path),toPath:C(e.to_path)}),out:()=>({})},\"exec.execFile\":{in:({params:e,raw:t,lists:s})=>({file:C(t.file),args:(s.args||[]).map(i=>i.VALUE),cwd:C(t.cwd),input:t.input,env:s.env?Object.fromEntries(s.env.map(i=>[i.NAME,i.VALUE])):void 0,timeoutMs:e?.TIMEOUT_MS||void 0}),out:e=>({result:{EXIT_CODE:e?.exitCode??-1,SIGNAL:e?.signal??\"\"},raw:{stdout:rt(e?.stdout)??new Uint8Array(0),stderr:rt(e?.stderr)??new Uint8Array(0)}})},\"context.get\":{in:({params:e})=>({scope:e?.SCOPE,key:e?.KEY}),out:e=>({result:{VALUE:e!=null},raw:e==null?{}:{value:rt(e)}})},\"context.set\":{in:({params:e,raw:t})=>({scope:e?.SCOPE,key:e?.KEY,value:t.value??new Uint8Array(0)}),out:()=>({})},\"context.delete\":{in:({params:e})=>({scope:e?.SCOPE,key:e?.KEY}),out:e=>({result:{VALUE:!!e}})},\"context.listKeys\":{in:({params:e})=>({scope:e?.SCOPE}),out:e=>({lists:{items:Yt(e)}})},\"context.listScopes\":{out:e=>({lists:{items:Yt(e)}})},\"crypto.sha256\":{in:({raw:e})=>({value:e.data??new Uint8Array(0)}),out:tt},\"crypto.sha512\":{in:({raw:e})=>({value:e.data??new Uint8Array(0)}),out:tt},\"crypto.hkdf\":{in:({params:e,raw:t})=>({ikm:t.ikm,salt:t.salt??new Uint8Array(0),info:t.info,length:e?.LENGTH||32}),out:tt},\"crypto.aesGcmEncrypt\":{in:({raw:e})=>({key:e.key,plaintext:e.data??new Uint8Array(0),iv:e.nonce,aad:e.aad}),out:(e,{raw:t})=>({raw:{data:ah(e.ciphertext,e.tag),nonce:t.nonce}})},\"crypto.aesGcmDecrypt\":{in:({raw:e})=>({key:e.key,...oh(e.data),iv:e.nonce,aad:e.aad}),out:tt},\"crypto.x25519.generateKeypair\":{out:e=>({raw:{private_key:e.privateKey,public_key:e.publicKey}})},\"crypto.x25519.publicKey\":{in:({raw:e})=>({privateKey:e.private_key}),out:tt},\"crypto.x25519.sharedSecret\":{in:({raw:e})=>({privateKey:e.private_key,publicKey:e.public_key}),out:tt},\"crypto.sealedBox.encryptForRecipient\":{in:({raw:e})=>({plaintext:e.data??new Uint8Array(0),recipientPublicKey:e.public_key,context:e.info?C(e.info):void 0}),out:e=>({raw:{data:mn(e.protectedBlobBase64)}})},\"crypto.sealedBox.decryptFromEnvelope\":{in:({raw:e})=>({envelope:{protectedBlobBase64:On(e.envelope??e.data)},recipientPrivateKey:e.private_key}),out:tt},\"crypto.secp256k1.publicKeyFromPrivate\":{in:({raw:e})=>({privateKey:e.private_key}),out:tt},\"crypto.secp256k1.sign\":{in:({raw:e})=>({message:e.data,privateKey:e.private_key}),out:tt},\"crypto.secp256k1.verify\":{in:({raw:e})=>({message:e.data,signature:e.signature,publicKey:e.public_key}),out:ai},\"crypto.secp256k1.signDigest\":{in:({raw:e})=>({digest:e.data,privateKey:e.private_key}),out:tt},\"crypto.secp256k1.verifyDigest\":{in:({raw:e})=>({digest:e.data,signature:e.signature,publicKey:e.public_key}),out:ai},\"crypto.ed25519.publicKeyFromSeed\":{in:({raw:e})=>({seed:e.private_key}),out:tt},\"crypto.ed25519.sign\":{in:({raw:e})=>({message:e.data,seed:e.private_key}),out:tt},\"crypto.ed25519.verify\":{in:({raw:e})=>({message:e.data,signature:e.signature,publicKey:e.public_key}),out:ai},\"plugin.getConfig\":{in:()=>({}),out:e=>({lists:{entries:_h(e)}})},\"node.peerId\":{in:()=>({}),out:Ln(\"peer ID\")},\"node.publicKey\":{in:()=>({}),out:Ln(\"public key\")},\"secrets.get\":{in:ue,out:e=>({result:V(\"SecretResult\",{ID:y(e?.id),USERNAME:y(e?.username),CONFIGURED:!0}),raw:{secret:rt(e?.secret)??new Uint8Array(0)}})},\"secrets.status\":{in:ue,out:Dn},\"secrets.put\":{in:ue,out:Dn},\"secrets.clear\":{in:ue,out:()=>({})},\"storage.write\":{in:({params:e,raw:t})=>({...ut(e),data:t.data??new Uint8Array(0)}),out:e=>({result:V(\"StorageWriteResult\",{CID:y(e?.cid)})})},\"storage.query\":{in:({params:e})=>ut(e),out:e=>{let t=[],s=[];for(let i of Rt(Array.isArray(e)?e:e?.records)){let r=i.SourceTags||{},o=Et(i.Data)??new Uint8Array(0);s.push(o),t.push(V(\"StoredRecordMeta\",{CID:y(i.CID),ROW_ID:i.RowID??0,PEER_ID:y(i.PeerID),TIMESTAMP_MS:ct(i.Timestamp)??0n,MATERIALIZED_MS:ct(i.MaterializedAt)??0n,LENGTH:o.length,PROVIDER_ID:y(r.ProviderID),SOURCE_NAME:y(r.SourceName),BATCH_ID:y(r.BatchID),PRODUCER_PEER_ID:y(r.ProducerPeerID),LICENSE:y(r.License)}))}return{lists:{records_meta:t},raw:{records:ch(s)}}}},\"storage.delete\":{in:({params:e})=>ut(e),out:()=>({})},\"storage.expire\":{in:({params:e})=>ut(e),out:e=>({result:ce(\"StorageExpireResult\",e)})},\"storage.ingest_with_source\":{in:({params:e,raw:t,lists:s})=>{let i=ut(e);delete i.archive_source,delete i.archive_name,i.reconcile=hi(ln,e?.RECONCILE).toLowerCase(),t.records&&(i.records=t.records),t.archive&&(i.archive={source:y(e?.ARCHIVE_SOURCE),name:y(e?.ARCHIVE_NAME),raw:t.archive});let r=s.provenance?.[0],o=s.provenance_attributes;if(r||o?.length){let a={};o?.length&&(a.attributes=o.map(l=>({name:y(l.NAME),value:y(l.VALUE)})));for(let[l,_]of Object.entries(r||{}))a[l.toLowerCase()]=typeof _==\"bigint\"?Number(_):_??\"\";let E=Object.fromEntries(Object.keys(a).sort().map(l=>[l,a[l]]));i.provenance={source:y(e?.SOURCE_NAME),json:le.encode(JSON.stringify(E))}}return i},out:e=>{let t=ce(\"StorageIngestResult\",e);return e?.provenance&&(t.PROVENANCE_FILE=y(e.provenance)),{result:t}}},\"storage.flatsql_query_stream\":{in:ri,out:e=>ni(e)},\"storage.flatsql_epoch_stream\":{in:({params:e})=>ci(ut(e),e),out:e=>ni(e)},\"storage.query_sandboxed\":{in:e=>({...ri(e),want:hi(he,e.params?.WANT).toLowerCase()}),out:e=>{if(e?.kind!==\"rows\"){let o=ni(e,\"SandboxQueryResult\");return o.result.KIND=he.Stream,o}let t=typeof e.json==\"string\"?e.json:Et(e.json)?C(Et(e.json)):void 0;if(t===void 0)throw lt(\"storage.query_sandboxed: rows answer carries no rows\");let s;try{s=JSON.parse(t)}catch(o){throw lt(`storage.query_sandboxed: ${o.message}`)}if(!Array.isArray(s))throw lt(\"storage.query_sandboxed: rows are not a JSON array\");let i=s.length&&s[0]&&typeof s[0]==\"object\"?Object.keys(s[0]):[],r=[];for(let o of s){if(!o||typeof o!=\"object\"||Array.isArray(o))throw lt(\"storage.query_sandboxed: a row is not an object\");for(let a of Object.values(o))r.push(lh(a))}return{result:V(\"SandboxQueryResult\",{KIND:he.Rows,ROWS:s.length,COLUMNS:i.length}),lists:{columns:i.map(o=>({VALUE:o}))},raw:{cells:bn(r)}}}},\"storage.query_surface\":{in:()=>({}),out:e=>{let t=[],s=[];for(let r of Rt(e?.tables)){let o=y(r.name);t.push(V(\"SurfaceTable\",{NAME:o,KIND:y(r.kind),SOURCE:y(r.source),RECORDS:r.records??0}));for(let a of Array.isArray(r.columns)?r.columns:[])typeof a==\"string\"?s.push(V(\"SurfaceColumn\",{TABLE:o,NAME:a})):a&&typeof a==\"object\"&&s.push(V(\"SurfaceColumn\",{TABLE:o,NAME:y(a.name),PLACEHOLDER:a.placeholder===!0}))}let i=e?.caps&&typeof e.caps==\"object\"?e.caps:null;return{...i?{result:V(\"QuerySurfaceLimits\",{TIMEOUT_MS:i.timeout_ms??0,MAX_ROWS:i.max_rows??0,MAX_BYTES:i.max_bytes??0})}:{},lists:{tables:t,columns:s}}}},\"storage.flatsql_cache_key\":{in:e=>{let t={...ut(e.params),...ri(e)};return e.lists.projection&&(t.projection=e.lists.projection.map(s=>y(s.VALUE))),t},out:e=>({raw:{value:y(e?.key)}})},\"p2p.peers_snapshot\":{in:Ee,out:e=>{let t=[],s=[],i=[];for(let r of Rt(e?.peers)){t.push(V(\"P2pPeer\",{PEER_ID:y(r.peer_id),CONNECTED:r.connected===!0,SELF:r.self===!0,EPM_INDEX:r.epm_index??-1,AGENT_VERSION:r.agent_version}));for(let o of Array.isArray(r.addrs)?r.addrs:[])s.push(V(\"P2pPeerValue\",{PEER_ID:y(r.peer_id),VALUE:y(o)}));for(let o of Array.isArray(r.standards)?r.standards:[])i.push(V(\"P2pPeerValue\",{PEER_ID:y(r.peer_id),VALUE:y(o)}))}return{result:ce(\"P2pSummary\",e),lists:{peers:t,peer_addresses:s,peer_standards:i},raw:oi(e)}}},\"p2p.standards_snapshot\":{in:Ee,out:e=>({lists:{entries:Rt(e?.entries).map(Cn)},raw:oi(e)})},\"p2p.pnm_history\":{in:Ee,out:e=>({result:ce(\"P2pSummary\",e),lists:{entries:Rt(e?.entries).map(Cn)},raw:oi(e)})},\"p2p.latest_dataset\":{in:Ee,out:e=>{let t=e?.serving&&typeof e.serving==\"object\"?e.serving:{},s=(t.pnm&&typeof t.pnm==\"object\"?t.pnm:e?.pnm)||{};return{result:V(\"P2pLatestDataset\",{KNOWN:e?.known===!0,REASON:e?.reason,PINNED:e?.pinned,SELF:e?.self,FRESH:e?.fresh,STANDARD:e?.standard,SCHEMA:e?.schema,PNM_CID:s.CID??s.cid,PNM_FILE_ID:s.FILE_ID??s.file_id,PNM_PUBLISH_MS:ct(s.PUBLISH_TIMESTAMP??s.publish_timestamp),PNM_SIGNATURE_VERIFIED:s.signature_verified,PNM_ATTRIBUTION:s.attribution,BATCH_ID:t.batch_id,PROVIDER_ID:t.provider_id,SOURCE_NAME:t.source_name,RECORD_COUNT:t.record_count,BYTE_COUNT:t.byte_count,PARTS:t.parts,PUBLISHED_MS:ct(t.published_at),ETAG_FNV1A64:t.etag_fnv1a64,REF:t.ref&&typeof t.ref==\"object\"?vn(t.ref):void 0}),raw:Et(t.stream)?{stream:Et(t.stream)}:{}}}},\"node_status_read.status\":{in:()=>({}),out:e=>{let t=e?.store||{},s=e?.service||{},i={UPTIME_S:e?.uptime_seconds??0,STARTED_MS:ct(e?.started_at)??0n,STORE_TOTAL_BYTES:t.total_bytes??0,STORE_TOTAL_RECORDS:t.total_records??0,STORAGE_PATH:y(t.storage_path),SERVICE_STATE:y(s.state),SERVICE_MODE:y(s.mode)};e?.disk&&typeof e.disk==\"object\"&&Object.assign(i,{HAS_DISK:!0,DISK_CAPACITY_BYTES:e.disk.capacity_bytes??0,DISK_FREE_BYTES:e.disk.free_bytes??0,DISK_AVAILABLE_BYTES:e.disk.available_bytes??0});let r=[];if(e?.bandwidth&&typeof e.bandwidth==\"object\"){let o=e.bandwidth;Object.assign(i,{HAS_BANDWIDTH:!0,TOTAL_IN_BYTES:o.total_in_bytes??0,TOTAL_OUT_BYTES:o.total_out_bytes??0,RATE_IN_BPS:o.rate_in_bps??0,RATE_OUT_BPS:o.rate_out_bps??0});for(let a of Rt(o.history))r.push(V(\"NodeBandwidthSample\",{TS_MS:ct(a.ts)??0n,TOTAL_IN_BYTES:a.total_in_bytes??0,TOTAL_OUT_BYTES:a.total_out_bytes??0,RATE_IN_BPS:a.rate_in_bps??0,RATE_OUT_BPS:a.rate_out_bps??0}))}return{result:V(\"NodeStatusReport\",i),lists:{bandwidth_history:r}}}},\"node_activity_read.activity\":{in:({params:e})=>ut(e),out:e=>({lists:{events:Rt(e?.events).map(t=>V(\"NodeActivityEvent\",{TS_MS:ct(t.ts)??0n,KIND:y(t.kind),DETAIL:y(t.detail),PEER_ID:y(t.peer_id)}))}})}};function tt(e){return{raw:{data:rt(e)??new Uint8Array(0)}}}function ai(e){return{result:{VALUE:!!e}}}function fi(e=()=>({})){return{in:t=>{let{params:s,raw:i}=t,r=_e(s);return delete r.noResponse,delete r.allowUnauthorized,delete r.serverName,{...r,data:i.data,responseEncoding:\"bytes\",expectResponse:!s?.NO_RESPONSE,rejectUnauthorized:!s?.ALLOW_UNAUTHORIZED,servername:s?.SERVER_NAME||void 0,...e(t)}},out:t=>({result:de(\"SocketResult\",t),raw:t?.body==null?{}:{body:rt(t.body)}})}}function dh(e){let t=Hn[e.op];return t?.in?t.in(e):{..._e(e.params),...Object.fromEntries(Object.entries(e.raw).map(([s,i])=>[Un(s),i]))}}function Ih(e,t){let s=Hn[e.op];if(s?.out)return s.out(t,e);let i=Gt[e.op];return{result:i?.result?de(i.result,t):void 0}}function ph(e){if(e?.hostcallCode)return e.hostcallCode;let t=e?.name??e?.constructor?.name??\"\";return t===\"HostCapabilityError\"||t===\"BrowserHostCapabilityError\"||e?.code===\"host-capability-denied\"?\"not-authorized\":t===\"HostFilesystemScopeError\"?\"sandbox\":t===\"AbortError\"||t===\"TimeoutError\"||/timed out/i.test(e?.message??\"\")?\"timeout\":/^Unknown .* operation|not available in the synchronous hostcall ABI|does not implement/.test(e?.message??\"\")?\"unsupported\":/exceeds? the record/.test(e?.message??\"\")?\"too-large\":e instanceof RangeError||e instanceof TypeError?\"invalid-params\":\"failed\"}function Bn(e,t,{allowAsync:s=!1}={}){let i,r=a=>si({ok:!1,error:{code:ph(a),message:String(a?.message??a)}}),o=a=>{try{return si({ok:!0,op:i.op,...Ih(i,a)})}catch(E){return r(E)}};try{if(i=Sn(e),!Gt[i.op])throw Object.assign(new Error(`Unknown host operation \"${i.op}\".`),{hostcallCode:\"unsupported\"});let a=t(i.op,dh(i));if(a&&typeof a.then==\"function\"){if(!s)throw typeof a.catch==\"function\"&&a.catch(()=>{}),Object.assign(new Error(`Operation \"${i.op}\" is not available in the synchronous hostcall ABI.`),{hostcallCode:\"unsupported\"});return a.then(o,r)}return o(a)}catch(a){return a&&!a.hostcallCode&&i===void 0&&(a.hostcallCode=\"invalid-params\"),r(a)}}var Mn=Object.freeze({\"node.peerId\":{capability:null,adapter:\"node\",method:\"peerId\"},\"node.publicKey\":{capability:null,adapter:\"node\",method:\"publicKey\"},\"secrets.get\":{capability:\"secrets\",adapter:\"secrets\",method:\"get\"},\"secrets.status\":{capability:\"secrets\",adapter:\"secrets\",method:\"status\"},\"secrets.put\":{capability:\"secrets\",adapter:\"secrets\",method:\"put\"},\"secrets.clear\":{capability:\"secrets\",adapter:\"secrets\",method:\"clear\"},\"storage.write\":{capability:\"storage_write\",adapter:\"storage\",method:\"write\"},\"storage.query\":{capability:\"storage_query\",adapter:\"storage\",method:\"query\"},\"storage.delete\":{capability:\"storage_write\",adapter:\"storage\",method:\"delete\"},\"storage.expire\":{capability:\"storage_write\",adapter:\"storage\",method:\"expire\"},\"storage.ingest_with_source\":{capability:\"storage_ingest\",adapter:\"storage\",method:\"ingest_with_source\"},\"storage.flatsql_query_stream\":{capability:\"storage_query\",adapter:\"storage\",method:\"flatsql_query_stream\"},\"storage.flatsql_epoch_stream\":{capability:\"storage_query\",adapter:\"storage\",method:\"flatsql_epoch_stream\"},\"storage.query_sandboxed\":{capability:\"storage_query\",adapter:\"storage\",method:\"query_sandboxed\"},\"storage.query_surface\":{capability:\"storage_query\",adapter:\"storage\",method:\"query_surface\"},\"storage.flatsql_cache_key\":{capability:\"storage_query\",adapter:\"storage\",method:\"flatsql_cache_key\"},\"p2p.peers_snapshot\":{capability:\"p2p_read\",adapter:\"p2p\",method:\"peers_snapshot\"},\"p2p.standards_snapshot\":{capability:\"p2p_read\",adapter:\"p2p\",method:\"standards_snapshot\"},\"p2p.pnm_history\":{capability:\"p2p_read\",adapter:\"p2p\",method:\"pnm_history\"},\"p2p.latest_dataset\":{capability:\"p2p_read\",adapter:\"p2p\",method:\"latest_dataset\"},\"node_status_read.status\":{capability:\"node_status_read\",adapter:\"node\",method:\"status\"},\"node_activity_read.activity\":{capability:\"node_activity_read\",adapter:\"node\",method:\"activity\"}}),Wl=Object.freeze([...new Set(Object.values(Mn).map(e=>e.capability).filter(Boolean))]);var Sh=new TextDecoder,Ei=\"space_data_module_host\",wt=0,ui=1,Jl=Object.freeze([\"host.runtimeTarget\",\"host.listCapabilities\",\"host.listSupportedCapabilities\",\"host.listOperations\",\"host.hasCapability\",\"plugin.getConfig\",\"clock.now\",\"clock.monotonicNow\",\"clock.nowIso\",\"random.bytes\",\"schedule.parse\",\"schedule.matches\",\"schedule.next\",\"filesystem.resolvePath\"]);function Ah(e,t){let s=String(e??\"\").trim();if(!s)throw new TypeError(`${t} is required.`);return s}function xn(e){if(typeof e!=\"function\")throw new TypeError(\"getMemory must be a function returning WebAssembly.Memory.\");let t=e();if(!t||typeof t!=\"object\"||!(\"buffer\"in t))throw new TypeError(\"getMemory must return a WebAssembly.Memory-like object.\");let s=t.buffer;if(!(s instanceof ArrayBuffer||s instanceof SharedArrayBuffer))throw new TypeError(\"Hostcall memory buffer must be an ArrayBuffer or SharedArrayBuffer.\");return s}function Fn(e,t,s,i){if(!Number.isInteger(t)||t<0)throw new RangeError(`${i} pointer must be a non-negative integer.`);if(!Number.isInteger(s)||s<0)throw new RangeError(`${i} length must be a non-negative integer.`);let r=xn(e);if(t+s>r.byteLength)throw new RangeError(`${i} range exceeds guest memory bounds.`);return new Uint8Array(r,t,s)}function bh(e,t,s,i){if(!Number.isInteger(t)||t<0)throw new RangeError(\"Response pointer must be a non-negative integer.\");if(!Number.isInteger(i)||i<0)throw new RangeError(\"Response max length must be a non-negative integer.\");let r=s instanceof Uint8Array?s:new Uint8Array(s),o=xn(e),a=Math.min(r.length,i);if(t+a>o.byteLength)throw new RangeError(\"Response range exceeds guest memory bounds.\");return new Uint8Array(o,t,a).set(r.subarray(0,a)),a}function Rh(e){if(e.length===0)return null;let{meta:t,segments:s}=Jt(e);return yt(t,s)}function Vn(e,t=null){return{name:e?.name??\"Error\",message:e?.message??String(e),code:e?.code??null,operation:e?.operation??t,capability:e?.capability??null}}function wh(e){return e!==null&&typeof e==\"object\"&&typeof e.then==\"function\"}function Gn(e={}){let t=e.dispatch;if(typeof t!=\"function\")throw new TypeError(\"createHostcallBridge requires a dispatch function.\");let s=e.getMemory,i=Ah(e.moduleName??Ei,\"Hostcall import module name\"),r=Number.isInteger(e.maxRequestBytes)?e.maxRequestBytes:16*1024*1024,o=Number.isInteger(e.maxResponseBytes)?e.maxResponseBytes:64*1024*1024,a=wt,E={ok:!0,result:null},l=Oe(E,[]);function _(d,S){let b=[],g=Xt(S,b),m=Oe(g,b);if(m.length>o)throw new Error(`Hostcall response exceeds ${o} byte limit.`);a=d,E=S,l=m}function p(d,S,b,g){try{if(g>r)throw new Error(`Hostcall request exceeds ${r} byte limit.`);let m=Sh.decode(Fn(s,d,S,\"Operation\")),H=Fn(s,b,g,\"Payload\");if(wn(H)){let _t=Bn(H.slice(),t);if(_t.length>o)throw new Error(`Hostcall response exceeds ${o} byte limit.`);return a=wt,E=null,l=_t,wt}let K=Rh(H),M=t(m,K);if(wh(M))throw typeof M.catch==\"function\"&&M.catch(()=>{}),new Error(`Operation \"${m}\" returned a Promise. The synchronous hostcall ABI only supports synchronous operations.`);return _(wt,{ok:!0,result:M===void 0?null:M}),wt}catch(m){try{_(ui,{ok:!1,error:Vn(m)})}catch(H){_(ui,{ok:!1,error:Vn(H)})}return ui}}function O(){return l.length}function A(d,S){return bh(s,d,l,S)}function w(){return _(wt,{ok:!0,result:null}),wt}function R(){return a}return{moduleName:i,imports:{[i]:{call:p,response_len:O,read_response:A,clear_response:w,last_status_code:R}},getLastEnvelope(){return structuredClone(E)},getLastResponseBytes(){return new Uint8Array(l)},getLastResponseEnvelope(){let{meta:d,segments:S}=Jt(l);return yt(d,S)}}}var e_=Object.freeze({READ:1,WRITE:2,CREATE:4,EXCL:8,TRUNC:16,DELETE_ON_CLOSE:32,PROBE:64,UNLINK:128,CREATE_PARENTS:256,UNLINK_IF_UNUSED:512,OPEN_DEFERRED:1024}),s_=Object.freeze({OK:0,GENERIC:-1,NOENT:-2,ACCESS:-3,IO:-4,NOSPACE:-5,BADHANDLE:-6,BUSY:-7});var i_=Object.freeze([\"flatsql_io_open\",\"flatsql_io_read\",\"flatsql_io_write\",\"flatsql_io_truncate\",\"flatsql_io_sync\",\"flatsql_io_size\",\"flatsql_io_close\"]),Ie=4096;var r_=typeof TextDecoder==\"function\"?new TextDecoder(\"utf-8\",{fatal:!0}):null;function Yn(e){let t=2166136261;for(let s=0;s<e.length;s+=1)t^=e[s],t=Math.imul(t,16777619);return t>>>0}var Th=1330201683,Oh=1,mh=0,gh=1,yh=2,Nh=3,Dh=4,qn=5;var Lh=7;var Ch=9,Se=10,Uh=11;var Ph=13,zn=64,Kn=zn*4;var vh=1;var Hh=1,Bh=2,Mh=3,qt=32767,Kt=0,Xn=1,jn=2,Fh=3,Vh=4,xh=5,Gh=6,Yh=7,kh=8,qh=9,Wn=10,Jn=11,Kh=12,jh=13,Wh=8,to=9,li=128,_i=0,$h=1,Zh=2;var Qh=4,zh=0;var Xh=0,Jh=1,tc=1,kt=2,pe=3,ec=4,sc=5,ic=6,rc=7;var a_=64*1024;var $n=250,nc=20;function Zn(){return typeof performance<\"u\"&&performance.now?performance.now():Date.now()}function oc(e,t){return Math.ceil(e/t)*t}function eo(e){if(typeof SharedArrayBuffer!=\"function\"||!(e instanceof SharedArrayBuffer))throw new TypeError(\"The SAB I/O channel requires a SharedArrayBuffer (cross-origin isolation in browsers).\")}function ac(e){eo(e);let t=new Int32Array(e,0,zn);if(t[mh]!==Th||t[gh]!==Oh)throw new TypeError(\"Not a SAB I/O channel buffer (bad magic or version).\");let s=t[yh],i=t[Nh],r=t[Dh],o=t[Uh],a=oc(Kn+r*4,64),E=new Int32Array(e,Kn,r),l=[];for(let _=0;_<s;_+=1){let p=a+_*i;l.push({index:_,base:p,i32:new Int32Array(e,p,li/4),f64:new Float64Array(e,p,li/8),data:new Uint8Array(e,p+li,o)})}return{buffer:e,header:t,instances:E,slots:l,slotCount:s,slotBytes:i,dataBytes:o,maxInstances:r,channelId:t[Ph]}}function fc(e){return`sdm-sab-io-doorbell-${e}`}function hc(e,t){Atomics.add(e.header,qn,1),Atomics.notify(e.header,qn),Atomics.load(e.header,Lh)===vh&&t()?.postMessage(0)}function cc(e){let t=null;return{get(){return!t&&typeof BroadcastChannel==\"function\"&&(t=new BroadcastChannel(e)),t},close(){t?.close(),t=null}}}var uc=typeof TextEncoder==\"function\"?new TextEncoder:null;function Ec(){return(Math.random()*2147483646|0)+1}function lc(e,t){let s=(Atomics.add(e.header,Ch,1)>>>0)%e.slotCount;for(let i=0;i<e.slotCount;i+=1){let r=e.slots[(s+i)%e.slotCount];if(Atomics.compareExchange(r.i32,Kt,_i,$h)===_i)return Atomics.store(r.i32,Xn,t),r}return null}function Qn(e,t){Atomics.store(t.i32,Xn,0),Atomics.store(t.i32,Kt,_i),Atomics.add(e.header,Se,1),Atomics.notify(e.header,Se)}function _c(e,t,s){let i=e.i32;i[Vh]=t,i[xh]=s.instanceId??qt,i[Gh]=s.handle??-1,i[Yh]=s.flags??0,i[kh]=s.ptr??0,i[qh]=s.len??0,i[jh]=s.dataInSlot?Jh:Xh,i[Jn]=0,e.f64[Wh]=s.offset??0,e.f64[to]=0,s.path?(e.data.set(s.path,0),i[Wn]=s.path.length):i[Wn]=0}function dc(e){return Atomics.load(e.i32,Jn)}function so(e={}){eo(e.buffer);let t=ac(e.buffer),s=Number.isInteger(e.instanceId)?e.instanceId:qt;if(s!==qt&&(s<0||s>=t.maxInstances))throw new RangeError(`instanceId ${s} is outside 0..${t.maxInstances-1}.`);let i=typeof e.getMemory==\"function\"?e.getMemory:()=>null,r=Number.isFinite(e.spinMicros)?Math.max(0,e.spinMicros):nc,o=Ec(),a=cc(fc(t.channelId)),E=0;function l(){for(;;){let d=Atomics.load(t.header,Se),S=lc(t,o);if(S)return S;Atomics.wait(t.header,Se,d,$n)}}function _(d,S,b){let g=Atomics.load(d.i32,jn)+1|0||1;_c(d,S,b),Atomics.store(d.i32,Kh,zh),Atomics.store(d.i32,jn,g),Atomics.store(d.i32,Kt,Zh),hc(t,a.get);let m=r>0?Zn()+r/1e3:0;for(;;){let H=Atomics.load(d.i32,Kt);if(H===Qh&&Atomics.load(d.i32,Fh)===g)break;m>0&&Zn()<m||Atomics.wait(d.i32,Kt,H,$n)}return E+=1,{status:dc(d),result:d.f64[to]}}function p(d,S){let b=l();try{return _(b,d,S)}finally{Qn(t,b)}}function O(){return s!==qt&&Atomics.load(t.instances,s)===Hh}function A(){if(s===qt)return!1;let d=Atomics.load(t.instances,s);return d===Bh||d===Mh}function w(d,S,b,g){let m=0;for(;m<b.length;){let H=Math.min(t.dataBytes,b.length-m),K=l(),M;try{d===pe&&K.data.set(b.subarray(m,m+H),0),M=_(K,d,{instanceId:s,dataInSlot:!0,handle:S,ptr:0,len:H,offset:g+m}).status,d===kt&&M>0&&b.set(K.data.subarray(0,M),m)}finally{Qn(t,K)}if(M<0)return m>0&&d===kt?m:M;if(m+=M,M<H)break}return m}function R(d,S){let b=i(),g=b?.buffer??b;return!g||d<0||S<0||d+S>g.byteLength?null:new Uint8Array(g,d,S)}return{instanceId:s,get requests(){return E},open(d,S){let b=typeof d==\"string\"?uc.encode(d):d;return!(b instanceof Uint8Array)||b.length===0?-1:b.length>Math.min(t.dataBytes,Ie)?-1:p(tc,{instanceId:s,flags:S|0,path:b}).status},read(d,S,b,g){if(b===0)return 0;if(O())return p(kt,{instanceId:s,handle:d,ptr:S,len:b,offset:g}).status;let m=R(S,b);return m?w(kt,d,m,g):A()?-3:-1},write(d,S,b,g){if(b===0)return 0;if(O())return p(pe,{instanceId:s,handle:d,ptr:S,len:b,offset:g}).status;let m=R(S,b);return m?w(pe,d,m,g):A()?-3:-1},readInto(d,S,b){return S.length===0?0:w(kt,d,S,b)},writeFrom(d,S,b){return S.length===0?0:w(pe,d,S,b)},truncate(d,S){return p(ec,{instanceId:s,handle:d,offset:S}).status},sync(d){return p(sc,{instanceId:s,handle:d}).status},size(d){let{status:S,result:b}=p(ic,{instanceId:s,handle:d});return S<0?S:b},close(d){return p(rc,{instanceId:s,handle:d}).status},release(){a.close()}}}var Ic=typeof TextEncoder==\"function\"?new TextEncoder:null;function pc(e){let t=2166136261;for(let s=0;s<e.length;s+=1)t^=e[s],t=Math.imul(t,16777619);return t|0}var io=new WeakMap;function ro(e){let t=io.get(e);if(t)return t;let s=new Int32Array(e,0,16);if(s[0]!==1380795475||s[1]!==1)throw new TypeError(\"Not a SAB I/O mirror buffer.\");let i=s[2],r=s[3],o=s[4],a=64,E=a+i*32,l=E+i*o;return t={entries:i,entryBytes:r,maxPathBytes:o,i32:new Int32Array(e,a,i*32/4),f64:new Float64Array(e,a,i*32/8),paths:new Uint8Array(e,E,i*o),data:new Uint8Array(e,l,i*r)},io.set(e,t),t}function Sc(e){return typeof e==\"string\"?Ic.encode(e):e}function Ac(e,t,s){let i=t*8;if(Atomics.load(e.i32,i+3)!==s.length)return!1;let r=t*e.maxPathBytes;for(let o=0;o<s.length;o+=1)if(e.paths[r+o]!==s[o])return!1;return!0}function bc(e,t,s){let i=(s>>>0)%e.entries;for(let r=0;r<e.entries;r+=1){let o=i*8,a=Atomics.load(e.i32,o+0);if(a===0)return-1;if((a===2||a===3)&&Atomics.load(e.i32,o+2)===s&&Ac(e,i,t))return i;i=(i+1)%e.entries}return-1}function no(e,t){let s=ro(e),i=Sc(t);if(i.length>s.maxPathBytes)return-1;let r=bc(s,i,pc(i));return r<0?-1:Atomics.load(s.i32,r*(32/4)+0)===2?r:-1}function oo(e,t,s,i){let r=ro(e),o=t*(32/4),a=t*(32/8)+3,E=t*r.entryBytes;for(let l=0;l<64;l+=1){let _=Atomics.load(r.i32,o+1);if(_&1)continue;if(Atomics.load(r.i32,o+0)!==2)return-1;let p=r.f64[a],O=Atomics.load(r.i32,o+4),A;if(i>=p)A=0;else{let w=Math.min(s.length,p-i);i+w>O?A=-1:(s.set(r.data.subarray(E+i,E+i+w),0),A=w)}if(Atomics.load(r.i32,o+1)===_)return A}return-1}function ao(e=[\"/h.fsh\"]){let t=Array.from(e,String);return s=>{let i=String(s);for(let r of t)if(i.endsWith(r)||i===r.replace(/^\\//,\"\"))return!0;return!1}}var Rc=\"flatsql-io\",St=Object.freeze({open:1,read:2,write:3,truncate:4,sync:5,size:6,close:7,mirrorRead:8}),fo=24,ho=16777215;function di(){return typeof performance<\"u\"&&performance.now?performance.now()*1e3:Date.now()*1e3}function wc(e){if(!e?.buffer)return null;let t=new Int32Array(e.buffer,0,4),s=t[1],i=new Float64Array(e.buffer,16,s),r=new Uint8Array(e.buffer,16+s*8,s);return(o,a)=>{let E=Atomics.add(t,0,1);E<s&&(i[E]=di()-a,r[E]=o)}}function Tc(e,t,s){if(!e||s<=0||s>Ie||t<0)return null;let i=e.buffer??e;return t+s>i.byteLength?null:new Uint8Array(i,t,s).slice()}function Oc(e={}){let t=e.getMemory;if(typeof t!=\"function\")throw new TypeError(\"createFlatsqlIoImports requires getMemory().\");let s=Array.isArray(e.provider)?e.provider:[e.provider];if(s.length===0||s.some(A=>!A||typeof A.open!=\"function\"))throw new TypeError(\"createFlatsqlIoImports requires at least one provider.\");if(s.length>127)throw new RangeError(\"At most 127 providers can be routed.\");let i=s.length>1,r=wc(e.trace),o=e.mirror?.buffer??null,a=o?ao(e.mirror.suffixes??[\"/h.fsh\"]):null,E=new Map,l=new TextDecoder;function _(A){if(!i)return{provider:s[0],local:A};let w=A>>>fo,R=s[w];return R?{provider:R,local:A&ho}:null}function p(A,w,R){let d=r?di():0,S;try{S=R()}catch{S=w}return r&&r(A,d),S}return{env:{flatsql_io_open(A,w,R){return p(St.open,-1,()=>{let d=Tc(t(),A,w);if(!d)return-1;let S=i?Yn(d)%s.length:0,b=s[S].open(d,R|0);if(b<0)return b;if(i&&b>ho)return-4;let g=i?S<<fo|b:b;if(a){let m=l.decode(d);a(m)&&E.set(g,m)}return g})},flatsql_io_read(A,w,R,d){if(o&&E.has(A)){let S=r?di():0;try{let b=t(),g=b.buffer??b;if(w>=0&&R>=0&&w+R<=g.byteLength){let m=no(o,E.get(A));if(m>=0){let H=oo(o,m,new Uint8Array(g,w,R),d);if(H>=0)return r&&r(St.mirrorRead,S),H}}}catch{}}return p(St.read,-4,()=>{let S=_(A);return S?S.provider.read(S.local,w,R,d):-6})},flatsql_io_write(A,w,R,d){return p(St.write,-4,()=>{let S=_(A);return S?S.provider.write(S.local,w,R,d):-6})},flatsql_io_truncate(A,w){return p(St.truncate,-4,()=>{let R=_(A);return R?R.provider.truncate(R.local,w):-6})},flatsql_io_sync(A){return p(St.sync,-4,()=>{let w=_(A);return w?w.provider.sync(w.local):-6})},flatsql_io_size(A){return p(St.size,-4,()=>{let w=_(A);return w?w.provider.size(w.local):-6})},flatsql_io_close(A){return p(St.close,-4,()=>{E.delete(A);let w=_(A);return w?w.provider.close(w.local):-6})}}}}function mc(e,{getMemory:t}){let s=Array.isArray(e.channels)?e.channels:[e.channel??e.buffer];if(s.length===0||s.some(o=>!(o instanceof SharedArrayBuffer)))throw new TypeError(\"A flatsql-io descriptor needs channels: SharedArrayBuffer[].\");let i=s.map(o=>so({buffer:o,instanceId:e.instanceId,getMemory:t}));return{imports:Oc({getMemory:t,provider:i,mirror:e.mirror,trace:e.trace}),close(){for(let o of i)o.release()}}}function co(e,t){let s=[],i=[];for(let r of e??[]){let o;if(typeof r==\"function\")o=r(t);else if(r&&r.provider===Rc)o=mc(r,t);else if(r&&typeof r.factory==\"function\")o=r.factory({...t,config:r.config});else throw new TypeError(`Unresolvable extraImports entry ${JSON.stringify(r?.provider??r?.moduleUrl??typeof r)}; pass a factory function, a { provider: \"flatsql-io\" } descriptor, or (module workers) a { moduleUrl } descriptor.`);o&&o.imports&&typeof o.close==\"function\"?(s.push(o.imports),i.push(o.close)):o&&s.push(o)}return{fragments:s,close(){for(let r of i)try{r()}catch{}}}}function uo(e,t){for(let s of t)for(let[i,r]of Object.entries(s??{}))e[i]={...e[i]??{},...r};return e}var jt=0,gc=1,yc=2,lo=4,Ii=0,Eo=1;var Nc=0;var pi=lo*4,Dc=4*1024*1024;function Lc(e){if(typeof SharedArrayBuffer!=\"function\"||!(e instanceof SharedArrayBuffer))throw new TypeError(\"SAB hostcall channel requires a SharedArrayBuffer (cross-origin isolation in browsers).\")}function _o(e={}){if(typeof SharedArrayBuffer!=\"function\")throw new Error(\"SharedArrayBuffer is unavailable; the async hostcall bridge requires it (browsers additionally require cross-origin isolation: COOP+COEP).\");let t=Number.isInteger(e.maxResponseBytes)?e.maxResponseBytes:Dc;if(t<=0)throw new RangeError(\"maxResponseBytes must be a positive integer.\");return new SharedArrayBuffer(pi+t)}function Io(e={}){Lc(e.buffer);let t=e.postRequest;if(typeof t!=\"function\")throw new TypeError(\"createSabHostcallClientDispatch requires a postRequest function.\");let s=Number.isFinite(e.timeoutMs)&&e.timeoutMs>0?e.timeoutMs:12e4,i=new Int32Array(e.buffer,0,lo),r=e.buffer.byteLength-pi;return function(a,E=null){if(Atomics.store(i,jt,Eo),t({operation:a,params:E}),Atomics.wait(i,jt,Eo,s)===\"timed-out\")throw Atomics.store(i,jt,Ii),new Error(`Hostcall \"${a}\" timed out after ${s}ms waiting for the controlling thread.`);let _=Atomics.load(i,gc),p=Atomics.load(i,yc);if(p<0||p>r)throw Atomics.store(i,jt,Ii),new RangeError(`Hostcall \"${a}\" response length ${p} exceeds channel capacity ${r}.`);let O=new Uint8Array(p);O.set(new Uint8Array(e.buffer,pi,p)),Atomics.store(i,jt,Ii);let A=Oi(O);if(_!==Nc){let w=new Error(A?.message??`Hostcall \"${a}\" failed on the host thread.`);throw w.name=A?.name??\"Error\",w.code=A?.code??null,w.operation=A?.operation??a,w.capability=A?.capability??null,w}return A}}var Si=class extends Error{constructor(t){super(`WASI exit with code ${t}`),this.name=\"WasiExitError\",this.code=t}};function Cc(e,t,s,i){for(;;){let r=Atomics.load(e,t);if(s>i-r)return-1;if(Atomics.compareExchange(e,t,r,r+s)===r)return r}}function po(e={}){let t=e.processState,s=t?.args??e.args??[],i=t?.env??e.env??{},r=t?.input??new Uint8Array(e.stdinBytes??[]),o=e.logOutput===!0,a=e.performance??globalThis.performance??{now:()=>Date.now(),timeOrigin:0},E=e.crypto??globalThis.crypto??null,l=[],_=[],p=0,O=null;function A(T){O=T}function w(){return O}function R(){return new Uint8Array(O.buffer)}function d(){return new DataView(O.buffer)}let b=Object.entries(i).map(([T,N])=>`${T}=${N}`).map(T=>new TextEncoder().encode(T)),g=s.map(T=>new TextEncoder().encode(T));function m(T,N,U){let P;if(T===0)P=BigInt(Math.round((a.timeOrigin+a.now())*1e6));else if(T===1)P=BigInt(Math.round(a.now()*1e6));else return 28;return d().setBigUint64(U,P,!0),0}function H(T,N,U,P){if(T!==1&&T!==2)return 8;let L=T===1?l:_,G=0,Ot=d(),mt=R();for(let gt=0;gt<U;gt++){let zt=N+gt*8,At=Ot.getUint32(zt,!0),k=Ot.getUint32(zt+4,!0);if(t){let nt=T===1?t.stdout:t.stderr,Ti=Cc(t.control,T,k,nt.length);if(Ti<0)return 51;nt.set(mt.subarray(At,At+k),Ti)}else L.push(mt.slice(At,At+k));G+=k}return Ot.setUint32(P,G,!0),0}function K(T,N,U,P){if(T!==0)return d().setUint32(P,0,!0),8;let L=d(),G=R(),Ot=0;for(let mt=0;mt<U;mt+=1){let gt=N+mt*8,zt=L.getUint32(gt,!0),At=L.getUint32(gt+4,!0),k,nt;if(t)do k=Atomics.load(t.control,0),nt=Math.min(At,r.length-k);while(Atomics.compareExchange(t.control,0,k,k+nt)!==k);else k=p,nt=Math.min(At,r.length-k),p+=nt;if(nt===0){if(k>=r.length)break;continue}G.set(r.subarray(k,k+nt),zt),Ot+=nt}return L.setUint32(P,Ot,!0),0}function M(T){return T<=2?0:8}function _t(T,N,U,P){return T<=2?70:8}function No(T,N){if(T>2)return 8;let U=d();return U.setUint8(N,2),U.setUint16(N+2,0,!0),U.setBigUint64(N+8,0n,!0),U.setBigUint64(N+16,0n,!0),0}function Do(T,N){return T<=2?0:8}function Lo(T,N){return 8}function Co(T,N,U){return 8}function Uo(){return 8}function Po(T,N){let U=d();U.setUint32(T,b.length,!0);let P=0;for(let L of b)P+=L.length+1;return U.setUint32(N,P,!0),0}function vo(T,N){let U=d(),P=R(),L=N;for(let G=0;G<b.length;G++)U.setUint32(T+G*4,L,!0),P.set(b[G],L),L+=b[G].length,P[L]=0,L+=1;return 0}function Ho(T,N){let U=d();U.setUint32(T,g.length,!0);let P=0;for(let L of g)P+=L.length+1;return U.setUint32(N,P,!0),0}function Bo(T,N){let U=d(),P=R(),L=N;for(let G=0;G<g.length;G++)U.setUint32(T+G*4,L,!0),P.set(g[G],L),L+=g[G].length,P[L]=0,L+=1;return 0}function Mo(T,N){return E?.getRandomValues?(E.getRandomValues(R().subarray(T,T+N)),0):52}function Fo(T){throw t&&(Atomics.store(t.control,4,T),Atomics.store(t.control,3,1)),o&&wi(),new Si(T)}function Vo(){return 0}function wi(){if(l.length>0){let T=Qt(l);if(o){let N=new TextDecoder().decode(T);N&&console.log(N)}l.length=0}if(_.length>0){let T=Qt(_);if(o){let N=new TextDecoder().decode(T);N&&console.warn(N)}_.length=0}}function Qt(T){let N=0;for(let L of T)N+=L.length;let U=new Uint8Array(N),P=0;for(let L of T)U.set(L,P),P+=L.length;return U}return{imports:{wasi_snapshot_preview1:{clock_time_get:m,fd_write:H,fd_read:K,fd_close:M,fd_seek:_t,fd_fdstat_get:No,fd_fdstat_set_flags:Do,fd_prestat_get:Lo,fd_prestat_dir_name:Co,path_open:Uo,environ_sizes_get:Po,environ_get:vo,args_sizes_get:Ho,args_get:Bo,random_get:Mo,proc_exit:Fo,sched_yield:Vo}},setMemory:A,getMemory:w,flushOutput:wi,get stdout(){return t?t.stdout.slice(0,Atomics.load(t.control,1)):Qt(l)},get stderr(){return t?t.stderr.slice(0,Atomics.load(t.control,2)):Qt(_)}}}var Uc=\"sdm.thread-hostcall\";function Pc(e){return WebAssembly.Module.imports(e).some(t=>t.module===Ei)}function vc(e){if(!e||typeof e!=\"object\")throw new Error(\"A threaded guest that imports space_data_module_host requires an owning hostcall channel.\");let t=String(e.channelName??\"\").trim(),s=String(e.token??\"\").trim();if(!t||!s)throw new Error(\"The owning thread-hostcall channel name and token are required.\");if(typeof BroadcastChannel!=\"function\")throw new Error(\"BroadcastChannel is required for nested pthread hostcalls.\");let i=_o({maxResponseBytes:e.maxResponseBytes}),r=new BroadcastChannel(t),o=1;return{dispatch:Io({buffer:i,timeoutMs:e.timeoutMs,postRequest(E){r.postMessage({type:Uc,token:s,requestId:o++,buffer:i,...E})}}),close(){r.close()}}}function So({wasmModule:e,memory:t,hostcallChannel:s,processState:i,extraImports:r,workerIndex:o,tid:a,threadSpawn:E}={}){let l=po({processState:i});l.setMemory(t);let _=null,p=null,O={...l.imports,env:{memory:t},wasi:{\"thread-spawn\":typeof E==\"function\"?E:()=>-1}};if(Pc(e)){p=vc(s);let w=Gn({dispatch:p.dispatch,getMemory:()=>_?.exports?.memory??t});Object.assign(O,w.imports)}let A=co(r,{memory:t,getMemory:()=>_?.exports?.memory??t,workerIndex:o??null,tid:a??null});return uo(O,A.fragments),O.env.memory=t,{imports:O,instantiate(){return _=new WebAssembly.Instance(e,O),l.setMemory(_.exports.memory??t),_},close(){p?.close(),A.close()}}}async function Ao(e){let t=[];for(let s of e??[])if(s&&typeof s.moduleUrl==\"string\"){let r=(await import(s.moduleUrl))[s.exportName??\"default\"];if(typeof r!=\"function\")throw new TypeError(`extraImports module ${s.moduleUrl} exports no factory \"${s.exportName??\"default\"}\".`);t.push({factory:r,config:s.config??null})}else t.push(s);return t}var Hc=Object.freeze({PENDING:0,IDLE:1,CLAIMED:2,ASSIGNED:3,RUNNING:4,RETIRED:5}),{PENDING:T_,IDLE:Wt,CLAIMED:bo,ASSIGNED:$t,RUNNING:be,RETIRED:bi}=Hc,Re=0,Bc=1,Mc=2,Fc=3,Vc=4,Ae=5,xc=6,Gc=8,Yc=8,z=0,Ri=1,To=2,Ro=3,kc=4,wo=1,qc=536870911,Kc=2;var et=e=>Gc+Yc*e;function Ai(){return typeof performance<\"u\"&&typeof performance.now==\"function\"?performance.now():Date.now()}function we(e){Atomics.add(e,Re,1),Atomics.notify(e,Re)}function jc(e,t,s){Atomics.store(e,et(t)+z,s),Atomics.notify(e,et(t)+z),we(e)}function Oo(e,t){jc(e.control,t,bi)}function Wc(e,t,s){let{control:i}=e,r=et(t);for(;;){let o=Atomics.load(i,r+z);if(o!==$t&&o!==be||Atomics.load(i,r+Ri)!==s)return!1;if(Atomics.compareExchange(i,r+z,o,Wt)===o)return we(i),!0}}function $c(e,t){let{control:s}=e,i=et(t);return Atomics.compareExchange(s,i+z,$t,be)!==$t?null:{tid:Atomics.load(s,i+Ri),startArg:Atomics.load(s,i+To)}}function Zc(e,t){let{control:s}=e;Atomics.compareExchange(s,et(t)+z,be,Wt)===be&&we(s)}function mo(e,t,{runThread:s,osThreadId:i=0}){let{control:r}=e,o=et(t)+z;for(i&&Atomics.store(r,et(t)+kc,i);;){let a=Atomics.load(r,o);if(a===bi)return;if(a!==$t){Atomics.wait(r,o,a);continue}let E=$c(e,t);if(E){if(s(E.tid,E.startArg)===!1){Oo(e,t);return}Zc(e,t)}}}function go(e,{owner:t=!1,grow:s=null,dispatchMessage:i=null}={}){let{control:r,spawnWaitMs:o}=e,a=Atomics.load(r,xc),E=null,l=!0,_=R=>t||(Atomics.load(r,et(R)+Ro)&wo)===0,p=()=>{let R=Math.min(Atomics.load(r,Ae),a),d=0;for(let S=0;S<R;S+=1)if(_(S)){if(Atomics.compareExchange(r,et(S)+z,Wt,bo)===Wt)return{slot:S,live:d+1};Atomics.load(r,et(S)+z)!==bi&&(d+=1)}return{slot:-1,live:d}},O=()=>{for(;;){let R=Atomics.load(r,Ae);if(R>=a)return-1;if(Atomics.compareExchange(r,Ae,R,R+1)===R)return Atomics.store(r,et(R)+z,bo),R}},A=()=>{let R=O();if(R<0)return{slot:-1,reason:null};try{return s(R),{slot:R,reason:null}}catch{return Oo(e,R),{slot:-1,reason:\"worker-create-failed\"}}},w=()=>{let R=p();if(R.slot>=0)return{slot:R.slot,waited:!1,reason:null};let d=typeof s==\"function\",S=Ai(),b=S+(l?o:0),g=S+(l?Math.min(Kc,o):0),m=!1;for(;;){let H=Atomics.load(r,Re);if(R=p(),R.slot>=0)return{slot:R.slot,waited:m,reason:null};let K=d&&Math.min(Atomics.load(r,Ae),a)<a;if(K&&(R.live===0||Ai()>=g)){let _t=A();if(_t.slot>=0||_t.reason)return{..._t,waited:m};continue}if(R.live===0)return{slot:-1,waited:m,reason:\"pool-exhausted\"};if(H===E&&!K)return{slot:-1,waited:m,reason:\"pool-exhausted\"};let M=(K?g:b)-Ai();if(!K&&M<=0)return E=H,{slot:-1,waited:m,reason:\"pool-exhausted\"};if(M>0){try{Atomics.wait(r,Re,H,M)}catch{if(l=!1,!K)return{slot:-1,waited:m,reason:\"pool-exhausted\"};g=0;continue}m=!0}}};return R=>{let d=w();if(d.slot<0)return d.reason===\"pool-exhausted\"&&Atomics.add(r,Vc,1),{tid:-1,slot:-1,reason:d.reason};let{slot:S}=d,b=et(S),g=Atomics.add(r,Bc,1);if(g>qc)return Atomics.store(r,b+z,Wt),we(r),{tid:-1,slot:-1,reason:\"tid-exhausted\"};if(Atomics.store(r,b+Ri,g),Atomics.store(r,b+To,R|0),Atomics.store(r,b+z,$t),(Atomics.load(r,b+Ro)&wo)!==0)try{i(S,g,R)}catch{return Wc(e,S,g),{tid:-1,slot:-1,reason:\"dispatch-failed\"}}else Atomics.notify(r,b+z);return Atomics.add(r,Mc,1),d.waited&&Atomics.add(r,Fc,1),{tid:g,slot:S,reason:null}}}var Zt=null;function yo(e,t){try{return Zt.instantiate().exports.wasi_thread_start(e,t),!0}catch(s){return s&&s.name===\"WasiExitError\"?!0:(console.error(`[wasi-thread] guest thread ${e} trapped:`,s),self.postMessage({t:\"error\",tid:e,error:String(s?.message??s)}),!1)}}self.onmessage=async e=>{let t=e.data??{};if(t.t===\"probe\"){let s=t.pool??null;try{let i=await Ao(t.extraImports??[]),r=s?go(s):null;Zt=So({wasmModule:t.wasmModule,memory:t.memory,hostcallChannel:t.hostcallChannel??null,processState:t.processState,extraImports:i,workerIndex:t.workerIndex,threadSpawn:r?o=>r(o).tid:void 0}),Zt.instantiate(),self.postMessage({t:\"ready\",ok:!0,protocol:2})}catch(i){Zt?.close(),Zt=null,self.postMessage({t:\"ready\",ok:!1,error:String(i?.message??i)});return}s&&mo(s,t.slot,{runThread:yo});return}t.t===\"run\"&&(yo(t.tid,t.startArg),self.postMessage({t:\"exit\",tid:t.tid}))};})();\n";
|
|
7
|
+
export const WASI_THREAD_POOL_WORKER_BUNDLE_SHA256 = "5384b18df8f6fb338126bd1caee7a1f1e8c9587a8ecbafc71958f16d0d22aa92";
|
|
8
8
|
|
|
9
9
|
/** src/host/opfsIoWorker.mjs, sha256 9b5cf50741217bd829e7f1ee4cbdbf3e6b6b8ecc20a700501adf0faf9ee429b1. */
|
|
10
10
|
export const FLATSQL_IO_WORKER_BUNDLE = "(()=>{var Nn=Object.freeze({READ:1,WRITE:2,CREATE:4,EXCL:8,TRUNC:16,DELETE_ON_CLOSE:32,PROBE:64,UNLINK:128,CREATE_PARENTS:256,UNLINK_IF_UNUSED:512,OPEN_DEFERRED:1024}),Cn=Object.freeze({OK:0,GENERIC:-1,NOENT:-2,ACCESS:-3,IO:-4,NOSPACE:-5,BADHANDLE:-6,BUSY:-7});var Fn=Object.freeze([\"flatsql_io_open\",\"flatsql_io_read\",\"flatsql_io_write\",\"flatsql_io_truncate\",\"flatsql_io_sync\",\"flatsql_io_size\",\"flatsql_io_close\"]),Ye=4096;function vt(t,{during:n}={}){if(!t)return-1;let r=typeof t.code==\"string\"?t.code:null;if(r)switch(r){case\"ENOENT\":case\"ENOTDIR\":return-2;case\"EACCES\":case\"EPERM\":case\"EROFS\":return-3;case\"ENOSPC\":case\"EDQUOT\":return-5;case\"EBADF\":return-4;case\"EEXIST\":return-1;case\"EBUSY\":case\"ETXTBSY\":return-7;case\"ENAMETOOLONG\":case\"EINVAL\":return-1;default:return-4}switch(t.name){case\"NotFoundError\":return-2;case\"NoModificationAllowedError\":return-7;case\"InvalidStateError\":return n===\"open\"?-7:-6;case\"QuotaExceededError\":return-5;case\"TypeMismatchError\":case\"SecurityError\":case\"NotAllowedError\":return-3;case\"InvalidModificationError\":return-7;case\"TypeError\":case\"RangeError\":return-1;default:return-4}}var N=class extends Error{constructor(n,r){super(r??`flatsql_io status ${n}`),this.name=\"FlatsqlIoStatusError\",this.status=n}};function V(t,n){return t&&typeof t.status==\"number\"&&t.status<0?t.status:vt(t,n)}function oe(t){if(typeof t!=\"string\"||t.length===0||t.includes(\"\\0\"))return-1;let n=[];for(let r of t.split(\"/\"))if(!(r===\"\"||r===\".\")){if(r===\"..\")return-3;n.push(r)}return n.length===0?-1:n}var Ve=typeof TextDecoder==\"function\"?new TextDecoder(\"utf-8\",{fatal:!0}):null;function Ge(t){if(!Ve||t.length===0||t.length>Ye)return-1;let n=t.buffer instanceof ArrayBuffer?t:new Uint8Array(t);try{return Ve.decode(n)}catch{return-1}}var Vt=1330201683,Yt=1,Gt=0,qt=1,Wt=2,$t=3,Kt=4,H=5,Ie=6,We=7,$e=8;var Xt=11,Ke=12,zt=13,Xe=64,qe=Xe*4;var ze=1,Ze=2;var se=0,Oe=1,Je=0,ae=1,ie=2,ce=3,je=32767,G=0;var Zt=2,Jt=3,et=4,tt=5,nt=6,rt=7,ot=8,st=9,at=10,jt=11,en=12,it=13,ct=8,tn=9,de=128;var _e=2,_t=3,nn=4;var rn=1;var ft=1,pe=1,fe=2,he=3,Re=4,Te=5,me=6,Le=7;var Mn=64*1024;function on(t,n){return Math.ceil(t/n)*n}function sn(t){if(typeof SharedArrayBuffer!=\"function\"||!(t instanceof SharedArrayBuffer))throw new TypeError(\"The SAB I/O channel requires a SharedArrayBuffer (cross-origin isolation in browsers).\")}function lt(t){sn(t);let n=new Int32Array(t,0,Xe);if(n[Gt]!==Vt||n[qt]!==Yt)throw new TypeError(\"Not a SAB I/O channel buffer (bad magic or version).\");let r=n[Wt],s=n[$t],f=n[Kt],a=n[Xt],l=on(qe+f*4,64),L=new Int32Array(t,qe,f),S=[];for(let p=0;p<r;p+=1){let T=l+p*s;S.push({index:p,base:T,i32:new Int32Array(t,T,de/4),f64:new Float64Array(t,T,de/8),data:new Uint8Array(t,T+de,a)})}return{buffer:t,header:n,instances:L,slots:S,slotCount:r,slotBytes:s,dataBytes:a,maxInstances:f,channelId:n[zt]}}function ut(t){return`sdm-sab-io-doorbell-${t}`}function an(t){return`sdm-sab-io-done-${t}`}var Qn=typeof TextEncoder==\"function\"?new TextEncoder:null;var Y=null;function cn(t){return typeof BroadcastChannel!=\"function\"?null:((!Y||Y.id!==t.channelId)&&(Y?.channel.close(),Y={id:t.channelId,channel:new BroadcastChannel(an(t.channelId))}),Y.channel)}function Et(t,n,r,s=0){n.f64[tn]=s,Atomics.store(n.i32,jt,r|0),Atomics.store(n.i32,Jt,Atomics.load(n.i32,Zt)),Atomics.store(n.i32,G,nn),Atomics.notify(n.i32,G),Atomics.load(n.i32,en)===rn&&cn(t)?.postMessage(n.index)}var _n=typeof TextEncoder==\"function\"?new TextEncoder:null;function St(t){let n=2166136261;for(let r=0;r<t.length;r+=1)n^=t[r],n=Math.imul(n,16777619);return n|0}var At=new WeakMap;function ye(t){let n=At.get(t);if(n)return n;let r=new Int32Array(t,0,16);if(r[0]!==1380795475||r[1]!==1)throw new TypeError(\"Not a SAB I/O mirror buffer.\");let s=r[2],f=r[3],a=r[4],l=64,L=l+s*32,S=L+s*a;return n={entries:s,entryBytes:f,maxPathBytes:a,i32:new Int32Array(t,l,s*32/4),f64:new Float64Array(t,l,s*32/8),paths:new Uint8Array(t,L,s*a),data:new Uint8Array(t,S,s*f)},At.set(t,n),n}function dt(t){return ye(t).entryBytes}function It(t){return typeof t==\"string\"?_n.encode(t):t}function fn(t,n,r){let s=n*8;if(Atomics.load(t.i32,s+3)!==r.length)return!1;let f=n*t.maxPathBytes;for(let a=0;a<r.length;a+=1)if(t.paths[f+a]!==r[a])return!1;return!0}function Ot(t,n,r){let s=(r>>>0)%t.entries;for(let f=0;f<t.entries;f+=1){let a=s*8,l=Atomics.load(t.i32,a+0);if(l===0)return-1;if((l===2||l===3)&&Atomics.load(t.i32,a+2)===r&&fn(t,s,n))return s;s=(s+1)%t.entries}return-1}function ln(t,n,r){let s=(r>>>0)%t.entries;for(let f=0;f<t.entries;f+=1){let a=s*8;if(Atomics.compareExchange(t.i32,a+0,0,1)===0)return t.paths.set(n,s*t.maxPathBytes),Atomics.store(t.i32,a+3,n.length),Atomics.store(t.i32,a+2,r),Atomics.store(t.i32,a+4,0),t.f64[s*(32/8)+3]=0,Atomics.store(t.i32,a+0,3),s;s=(s+1)%t.entries}return-1}function W(t,n,r,s,{truncateTo:f}={}){let a=ye(t),l=It(n);if(l.length>a.maxPathBytes)return!1;let L=St(l),S=Ot(a,l,L);if(S<0&&(S=ln(a,l,L)),S<0)return!1;let p=S*(32/4),T=S*(32/8)+3,A=S*a.entryBytes,c=Atomics.load(a.i32,p+0)===2;Atomics.add(a.i32,p+1,1);let E=c?a.f64[T]:0,d=c?Atomics.load(a.i32,p+4):0;if(c||a.data.fill(0,A,A+a.entryBytes),s.length>0&&r<a.entryBytes){let m=Math.min(a.entryBytes,r+s.length);r>d&&a.data.fill(0,A+d,A+r),a.data.set(s.subarray(0,m-r),A+r)}return s.length>0&&(E=Math.max(E,r+s.length)),f!==void 0&&(f<d&&a.data.fill(0,A+f,A+d),E=f),d=Math.min(E,a.entryBytes),a.f64[T]=E,Atomics.store(a.i32,p+4,d),Atomics.store(a.i32,p+0,2),Atomics.add(a.i32,p+1,1),!0}function we(t,n){let r=ye(t),s=It(n);if(s.length>r.maxPathBytes)return;let f=Ot(r,s,St(s));if(f<0)return;let a=f*(32/4);Atomics.add(r.i32,a+1,1),Atomics.store(r.i32,a+0,3),Atomics.store(r.i32,a+4,0),r.f64[f*(32/8)+3]=0,Atomics.add(r.i32,a+1,1)}function pt(t=[\"/h.fsh\"]){let n=Array.from(t,String);return r=>{let s=String(r);for(let f of n)if(s.endsWith(f)||s===f.replace(/^\\//,\"\"))return!0;return!1}}var Ce=256*1024,dn=50,In=8,Tt=250,mt=16777215,R=0,xe=1,Lt=2;function le(){return typeof performance<\"u\"&&performance.now?performance.now():Date.now()}function On(){if(typeof MessageChannel==\"function\"){let t=new MessageChannel,n=[];return t.port1.onmessage=()=>n.shift()?.(),t.port1.unref?.(),t.port2.unref?.(),()=>new Promise(r=>{n.push(r),t.port2.postMessage(0)})}return()=>new Promise(t=>setTimeout(t,0))}function yt(t={}){let n=lt(t.buffer),r=t.backend;if(!r||typeof r.openFile!=\"function\")throw new TypeError(\"createFlatsqlIoServer requires a backend with openFile().\");let s=Number.isInteger(t.chunkBytes)&&t.chunkBytes>0?t.chunkBytes:Ce,f=t.doorbell??\"auto\",a=f===\"message\"||f===\"auto\"&&typeof Atomics.waitAsync!=\"function\"?Oe:se,l=t.mirror??null,L=Number.isFinite(t.spinMicros)?Math.max(0,t.spinMicros):dn,S=typeof t.onEvent==\"function\"?t.onEvent:null,p=On(),T=new Map,A=new Map,c=new Map,E=new Map,d=new Map,m=[],y=new Set,x=1,F=!1,g=null,D=null,U=null,J=null,j=!1,w={served:0,opens:0,deferredOpens:0,parked:0,chunks:0,busy:0,revoked:0,sharedViewsRejected:!1,maxReady:0};function v(e){if(S)try{S(e)}catch{}}function ee(){if(a===se)Atomics.add(n.header,H,1),Atomics.notify(n.header,H);else{let e=D;D=null,e?.()}}async function Ft(e){if(a===se){let o=Atomics.waitAsync(n.header,H,e,Tt);o.async&&await o.value;return}Atomics.load(n.header,H)===e&&await new Promise(o=>{let _=setTimeout(()=>{D===u&&(D=null),o()},Tt),u=()=>{clearTimeout(_),o()};D=u})}function Ae(e,o){let u=(d.get(e)??Promise.resolve()).then(o,o),i=u.then(()=>{},()=>{});return d.set(e,i),i.then(()=>{d.get(e)===i&&d.delete(e)}),u}function gt(){for(let e=0;e<mt;e+=1){let o=x;if(x=x>=mt?1:x+1,!c.has(o))return o}return-1}function te(e,o,_){let u=gt();if(u<0)return-1;let i=(_&2)!==0,O={id:u,entry:e,instanceId:o,canWrite:i,canRead:!i||(_&1)!==0};c.set(u,O),e.refs+=1,_&32&&(e.deleteOnClose=!0);let I=E.get(o);return I||(I=new Set,E.set(o,I)),I.add(u),u}function ne(e){if(!(e.refs>0||e.pins>0)){if(A.get(e.path)===e&&A.delete(e.path),e.file){try{e.file.close()}catch{}e.file=null}e.deleteOnClose&&e.openStatus===0&&Ae(e.path,async()=>{try{await r.remove(e.path,e.components)}catch{}l&&l.write!==!1&&we(l.buffer,e.path)})}}function De(e){c.delete(e.id)&&(E.get(e.instanceId)?.delete(e.id),e.entry.refs-=1,ne(e.entry))}function Dt(e){return e===je?ae:e<0||e>=n.maxInstances?-1:Atomics.load(n.instances,e)}function Se(e){let o=Dt(e);return o===ie||o===ce}function Me(e){let{slot:o,ptr:_,len:u}=e;if(u<0||_<0)return null;if(e.dataMode===ft)return _+u>o.data.length?null:o.data.subarray(_,_+u);let i=T.get(e.instanceId),O=i?.buffer??i;return!O||_+u>O.byteLength?null:new Uint8Array(O,_,u)}function Qe(e){return(!J||J.length<e)&&(J=new Uint8Array(Math.max(e,s))),J.subarray(0,e)}function Pe(e,o,_){if(!j)try{return e.read(o,{at:_})}catch(O){if(!(O instanceof TypeError)||!(o.buffer instanceof SharedArrayBuffer))throw O;j=!0,w.sharedViewsRejected=!0,v({type:\"shared-views-rejected\"})}let u=Qe(o.length),i=e.read(u,{at:_});return o.set(u.subarray(0,i),0),i}function Mt(e,o,_){if(!j)try{return e.write(o,{at:_})}catch(i){if(!(i instanceof TypeError)||!(o.buffer instanceof SharedArrayBuffer))throw i;j=!0,w.sharedViewsRejected=!0,v({type:\"shared-views-rejected\"})}let u=Qe(o.length);return u.set(o,0),e.write(u,{at:_})}function h(e,o,_=0){y.delete(e.slot.index),w.served+=1,Atomics.add(n.header,Ke,1),Et(n,e.slot,o,_)}function Qt(e){let o=e.i32;return{slot:e,op:o[et],instanceId:o[tt],handleId:o[nt],flags:o[rt],ptr:o[ot],len:o[st],dataMode:o[it],pathLen:o[at],offset:e.f64[ct],done:0,phase:0}}function He(){let e=0;for(let o of n.slots)y.has(o.index)||Atomics.load(o.i32,G)===_e&&Atomics.compareExchange(o.i32,G,_e,_t)===_e&&(y.add(o.index),m.push(Qt(o)),e+=1);return m.length>w.maxReady&&(w.maxReady=m.length),e}function Ue(){for(let e=0;e<n.maxInstances;e+=1){if(Atomics.load(n.instances,e)!==ie)continue;let o=E.get(e);if(o){for(let _ of Array.from(o)){let u=c.get(_);u&&De(u)}E.delete(e)}T.delete(e),w.revoked+=1,Atomics.store(n.instances,e,ce),Atomics.notify(n.instances,e),v({type:\"revoked\",instanceId:e})}}function re(e,o){return w.parked+=1,o.waiters.push(e),Lt}function ke(e,o,_){if(e.opening=null,e.openStatus=o,e.file=_??null,o===0&&l&&l.write!==!1&&l.match(e.path)&&e.file)try{let i=e.file.getSize(),O=new Uint8Array(Math.min(i,dt(l.buffer)));O.length>0&&Pe(e.file,O,0),W(l.buffer,e.path,0,O,{truncateTo:i})}catch{}let u=e.waiters;e.waiters=[];for(let i of u)i.op===pe&&i.phase===1&&i.entry===e&&(o<0?i.result=o:Se(i.instanceId)?i.result=-3:i.result=te(e,i.instanceId,i.flags),i.phase=2),m.push(i);o<0&&e.refs===0&&e.pins===0&&A.get(e.path)===e?A.delete(e.path):o===0&&e.refs===0&&e.pins===0&&ne(e),ee()}function be(e,o){w.opens+=1,e.opening=Ae(e.path,async()=>{try{let _=await r.openFile(e.path,e.components,o);ke(e,0,_)}catch(_){ke(e,V(_,{during:\"open\"}),null)}})}function Pt(e){if(e.phase===2)return h(e,e.result),R;if(Se(e.instanceId))return h(e,-3),R;if(e.path===void 0){let I=e.slot.data.slice(0,Math.max(0,e.pathLen)),Q=Ge(I);if(typeof Q!=\"string\")return h(e,Q),R;let P=oe(Q);if(!Array.isArray(P))return h(e,P),R;e.path=P.join(\"/\"),e.components=P}let{path:o,components:_,flags:u}=e,i=A.get(o);if(u&704)return i?.opening?re(e,i):u&64?i&&i.openStatus===0?(h(e,0),R):ve(e,async()=>await r.exists(o,_)?0:-2):i&&i.refs>0?(w.busy+=1,h(e,-7),R):(i&&i.pins>0&&(i.pins=0,ne(i)),ve(e,async()=>(await r.remove(o,_),l&&l.write!==!1&&we(l.buffer,o),0)));if(i){if(i.opening){if(u&1024){w.deferredOpens+=1;let I=te(i,e.instanceId,u);return h(e,I),R}return re(e,i)}if(i.openStatus===0){if(u&8)return h(e,-1),R;if(u&16&&u&2)try{i.file.truncate(0),l&&l.write!==!1&&l.match(o)&&W(l.buffer,o,0,new Uint8Array(0),{truncateTo:0})}catch(Q){return h(e,V(Q)),R}let I=te(i,e.instanceId,u);return h(e,I),R}A.get(o)===i&&A.delete(o)}let O={path:o,components:_,file:null,opening:null,openStatus:0,refs:0,pins:0,deleteOnClose:!1,waiters:[]};if(A.set(o,O),be(O,u),u&1024){w.deferredOpens+=1;let I=te(O,e.instanceId,u);return h(e,I),R}return e.phase=1,e.entry=O,re(e,O)}function ve(e,o){return e.phase=2,Ae(e.path,async()=>{try{e.result=await o()}catch(_){e.result=V(_)}m.push(e),ee()}),w.parked+=1,Lt}function Ht(e){if(Se(e.instanceId))return h(e,-3),R;let o=c.get(e.handleId);if(!o)return h(e,-6),R;let _=o.entry;if(_.opening)return re(e,_);if(e.op===Le)return De(o),h(e,0),R;if(_.openStatus<0||!_.file)return h(e,_.openStatus<0?_.openStatus:-6),R;let u=_.file;try{switch(e.op){case fe:{if(!o.canRead)return h(e,-4),R;let i=Me(e);if(!i)return h(e,-1),R;let O=Math.min(s,e.len-e.done),I=Pe(u,i.subarray(e.done,e.done+O),e.offset+e.done);return w.chunks+=1,e.done+=I,I<O||e.done>=e.len?(h(e,e.done),R):xe}case he:{if(!o.canWrite)return h(e,-4),R;let i=Me(e);if(!i)return h(e,-1),R;let O=Math.min(s,e.len-e.done),I=i.subarray(e.done,e.done+O),Q=e.offset+e.done,P=Mt(u,I,Q);return w.chunks+=1,l&&l.write!==!1&&l.match(_.path)&&W(l.buffer,_.path,Q,I.subarray(0,P)),e.done+=P,P<O||e.done>=e.len?(h(e,e.done),R):xe}case Re:return o.canWrite?(u.truncate(e.offset),l&&l.write!==!1&&l.match(_.path)&&W(l.buffer,_.path,0,new Uint8Array(0),{truncateTo:e.offset}),h(e,0),R):(h(e,-4),R);case Te:return u.flush(),h(e,0),R;case me:return h(e,0,u.getSize()),R;default:return h(e,-1),R}}catch(i){let O=V(i);return h(e,e.done>0&&e.op===fe?e.done:O),R}}function Ut(e){try{return e.op===pe?Pt(e):e.op===fe||e.op===he||e.op===Re||e.op===Te||e.op===me||e.op===Le?Ht(e):(h(e,-1),R)}catch(o){return v({type:\"step-error\",error:o}),h(e,-4),R}}function kt(){let e=le();for(;m.length>0;){let o=m.shift();if(Ut(o)===xe&&m.push(o),Ue(),He(),le()-e>In)return!1}return!0}async function bt(){for(Atomics.store(n.header,We,a),Atomics.add(n.header,$e,1),Atomics.store(n.header,Ie,ze);F;){let e=Atomics.load(n.header,H);Ue(),He();let o=kt();if(!F)break;if(!o||m.length>0){await p();continue}if(L>0){let _=le()+L/1e3;for(;le()<_&&Atomics.load(n.header,H)===e;);if(Atomics.load(n.header,H)!==e)continue}await Ft(e)}}return{doorbellMode:a,stats:w,start(){return F||(F=!0,a===Oe&&typeof BroadcastChannel==\"function\"&&(U=new BroadcastChannel(ut(n.channelId)),U.onmessage=()=>{let e=D;D=null,e?.()}),g=bt().catch(e=>{throw v({type:\"loop-error\",error:e}),e})),g},async stop(){F=!1,ee();try{await g}catch{}U?.close(),U=null;for(let e of A.values())try{e.file?.close()}catch{}A.clear(),c.clear(),E.clear(),Atomics.store(n.header,Ie,Ze)},attachMemory(e,o){if(!Number.isInteger(e)||e<0||e>=n.maxInstances)return!1;let _=Atomics.load(n.instances,e);return _===ie||_===ce?!1:(T.set(e,o),Atomics.store(n.instances,e,ae),!0)},detachMemory(e){T.delete(e),Atomics.load(n.instances,e)===ae&&Atomics.store(n.instances,e,Je)},async preopen(e,o=7){let _=await Promise.all(e.map(async u=>{let i=oe(String(u));if(!Array.isArray(i))return i;let O=i.join(\"/\"),I=A.get(O);return I||(I={path:O,components:i,file:null,opening:null,openStatus:0,refs:0,pins:0,deleteOnClose:!1,waiters:[]},A.set(O,I),be(I,o&-1025)),I.pins+=1,I.opening&&await I.opening,I.openStatus<0?(I.pins=Math.max(0,I.pins-1),I.openStatus):0}));return ee(),_},releasePreopen(e){for(let o of e){let _=oe(String(o));if(!Array.isArray(_))continue;let u=A.get(_.join(\"/\"));u&&u.pins>0&&(u.pins-=1,ne(u))}},inventory(){return{files:Array.from(A.values()).map(e=>({path:e.path,refs:e.refs,pins:e.pins,opening:!!e.opening,openStatus:e.openStatus})),handles:c.size}}}}var vn=263;var Fe=class{constructor(){this.bytes=new Uint8Array(0),this.length=0}ensureCapacity(n,r){if(n<=this.bytes.length)return;let s=Math.max(64,this.bytes.length);for(;s<n;)s*=2;r.reserve(s-this.bytes.length);let f=new Uint8Array(s);f.set(this.bytes.subarray(0,this.length)),this.bytes=f}};function wt(t={}){let n=Number.isFinite(t.maxBytes)?t.maxBytes:1/0,r=new Map,s=new Set([\"\"]),f=0,a={reserve(S){if(f+S>n)throw new N(-5,\"memory store budget exhausted\");f+=S},release(S){f=Math.max(0,f-S)}};function l(S){return S.slice(0,-1).join(\"/\")}function L(S){let p=!1,T=()=>{if(p){let c=new Error(\"handle closed\");throw c.name=\"InvalidStateError\",c}let A=r.get(S);if(!A){let c=new Error(\"file removed\");throw c.name=\"NotFoundError\",c}return A};return{read(A,{at:c=0}={}){let E=T();if(c>=E.length)return 0;let d=Math.min(A.length,E.length-c);return A.set(E.bytes.subarray(c,c+d),0),d},write(A,{at:c=0}={}){let E=T(),d=c+A.length;return E.ensureCapacity(d,a),c>E.length&&E.bytes.fill(0,E.length,c),E.bytes.set(A,c),d>E.length&&(E.length=d),A.length},truncate(A){let c=T();A>c.length&&(c.ensureCapacity(A,a),c.bytes.fill(0,c.length,A)),c.length=A},flush(){T()},getSize(){return T().length},close(){p=!0}}}return{kind:\"memory\",openFile(S,p,T){let A=l(p);if(!s.has(A)){if(!(T&256)||!(T&4))throw new N(-2,`no directory ${A}`);for(let E=1;E<p.length;E+=1)s.add(p.slice(0,E).join(\"/\"))}if(s.has(S))throw new N(-3,`${S} is a directory`);let c=r.get(S);if(c&&T&8)throw new N(-1,`${S} exists`);if(c)T&16&&(c.length=0);else{if(!(T&4))throw new N(-2,`no file ${S}`);c=new Fe,r.set(S,c)}return L(S)},exists(S){return r.has(S)||s.has(S)},remove(S){let p=r.get(S);if(!p)throw new N(-2,`no file ${S}`);a.release(p.bytes.length),r.delete(S)},reset(){r.clear(),s.clear(),s.add(\"\"),f=0},usage(){return{files:r.size,allocatedBytes:f}},list(){return Array.from(r.keys()).sort()}}}var Ee=\"readwrite-unsafe\";function hn(t){let n=new Error(t);return n.name=\"NotFoundError\",n}function Bt(t){return new Promise(n=>setTimeout(n,t))}async function Rn(t,n=\".sdm-mode-probe\"){let r=null,s=null;try{let f=await t.getFileHandle(n,{create:!0});return r=await f.createSyncAccessHandle({mode:Ee}),r.mode!==Ee?{supported:!1,detail:\"mode option ignored\"}:(s=await f.createSyncAccessHandle({mode:Ee}),{supported:!0,detail:\"two readwrite-unsafe handles\"})}catch(f){return{supported:!1,detail:`${f?.name??\"Error\"}: ${f?.message??f}`}}finally{try{s?.close()}catch{}try{r?.close()}catch{}try{await t.removeEntry(n)}catch{}}}async function Tn(t,n=\".sdm-view-probe\"){let r=null;try{r=await(await t.getFileHandle(n,{create:!0})).createSyncAccessHandle();let f=new Uint8Array(new SharedArrayBuffer(16));f.fill(90);let a=r.write(f,{at:0}),l=new Uint8Array(new SharedArrayBuffer(16)),L=r.read(l,{at:0});return a===16&&L===16&&l[15]===90}catch{return!1}finally{try{r?.close()}catch{}try{await t.removeEntry(n)}catch{}}}function xt(t={}){let n=t.root??null,r=!1,s=null,f=t.handleMode??\"auto\",a=typeof t.openDelayMs==\"function\"?t.openDelayMs:null,l=new Map,L={attempts:Math.max(0,t.busyRetry?.attempts??0),baseMs:Math.max(1,t.busyRetry?.baseMs??10)};async function S(c){for(let E=0;;E+=1)try{return r?await c.createSyncAccessHandle({mode:Ee}):await c.createSyncAccessHandle()}catch(d){if(!(d?.name===\"NoModificationAllowedError\"||d?.name===\"InvalidStateError\")||E>=L.attempts)throw d;await Bt(L.baseMs*2**Math.min(E,8))}}async function p(){if(!n){if(typeof navigator>\"u\"||!navigator.storage?.getDirectory)throw new N(-1,\"OPFS is unavailable here\");if(n=await navigator.storage.getDirectory(),t.rootDirectory)for(let E of String(t.rootDirectory).split(\"/\").filter(Boolean))n=await n.getDirectoryHandle(E,{create:!0})}let c=await Rn(n);if(s=await Tn(n),f===\"shared\"&&!c.supported)throw new N(-1,`shared OPFS handle modes are unsupported here (${c.detail})`);return r=f!==\"exclusive\"&&c.supported,l.set(\"\",n),{sharedModes:r,sharedModesDetail:c.detail,sharedViews:s}}async function T(c,E){let d=c.join(\"/\"),m=l.get(d);if(m)return m;let y=n,x=\"\";for(let F of c){x=x?`${x}/${F}`:F;let g=l.get(x);if(g){y=g;continue}y=await y.getDirectoryHandle(F,{create:E}),l.set(x,y)}return y}async function A(c,E){try{return await c.getFileHandle(E)}catch(d){if(d?.name===\"NotFoundError\")return null;throw d}}return{kind:\"opfs\",init:p,get sharedModes(){return r},get sharedViews(){return s},async openFile(c,E,d){if(n||await p(),a){let U=a(c);U>0&&await Bt(U)}let m=(d&4)!==0,y=m&&(d&256)!==0,x=await T(E.slice(0,-1),y),F=E[E.length-1],g=null;if(d&8&&await A(x,F))throw new N(-1,`${c} exists`);g=await x.getFileHandle(F,{create:m});let D=await S(g);return d&16&&D.truncate(0),D},async exists(c,E){n||await p();let d;try{d=await T(E.slice(0,-1),!1)}catch(y){if(y?.name===\"NotFoundError\"||y?.name===\"TypeMismatchError\")return!1;throw y}let m=E[E.length-1];if(await A(d,m))return!0;try{return await d.getDirectoryHandle(m),!0}catch{return!1}},async remove(c,E){n||await p();let d;try{d=await T(E.slice(0,-1),!1)}catch(m){throw m?.name===\"TypeMismatchError\"?hn(c):m}await d.removeEntry(E[E.length-1])},async clear(){n||await p();for await(let c of n.keys())await n.removeEntry(c,{recursive:!0});l.clear(),l.set(\"\",n)}}}var Nt=\"node:\";var mn=typeof process<\"u\"&&!!process.release&&process.release.name===\"node\",B=null,M=null,Z=null;function Ln({name:t,ifAvailable:n=!1}){return typeof navigator>\"u\"||!navigator.locks?Promise.reject(new Error(\"Web Locks are unavailable in this context\")):new Promise((r,s)=>{navigator.locks.request(t,{mode:\"exclusive\",ifAvailable:n},f=>{if(!f){r(!1);return}return r(!0),new Promise(a=>{Z=a})}).catch(s)})}function ge(t){return`${t?.name??\"Error\"}: ${t?.message??String(t)}`}function yn(t){if(!t||!t.pattern||!(t.ms>0))return;let n=new RegExp(t.pattern);return r=>n.test(r)?t.ms:0}async function wn(t,n){let r=t.role===\"reader\"?\"reader\":\"writer\";if(t.lock?.name&&!await Ln(t.lock)){let l=new Error(`the store lock ${t.lock.name} is held by another context`);throw l.name=\"LockUnavailableError\",l}t.backend===\"memory\"?M=wt({maxBytes:t.memoryMaxBytes}):M=xt({rootDirectory:t.rootDirectory,handleMode:t.handleMode??\"auto\",openDelayMs:yn(t.openDelay),busyRetry:t.busyRetry??void 0});let s={backend:M.kind,role:r,lock:t.lock?.name??null};M.init&&Object.assign(s,await M.init());let f=t.mirror?.buffer?{buffer:t.mirror.buffer,match:pt(t.mirror.suffixes??[\"/h.fsh\"]),write:t.mirror.write??r===\"writer\"}:null;return B=yt({buffer:t.buffer,backend:M,chunkBytes:t.chunkBytes??Ce,doorbell:t.doorbell??\"auto\",mirror:f,onEvent(a){(a.type===\"loop-error\"||a.type===\"step-error\")&&n({t:\"event\",event:{type:a.type,error:ge(a.error)}})}}),s.doorbellMode=B.doorbellMode===1?\"message\":\"atomics\",B.start().catch(a=>{setTimeout(()=>{throw a},0)}),s}async function Ct(t,n){switch(t?.t){case\"init\":try{let r=await wn(t,n);n({t:\"ready\",ok:!0,info:r})}catch(r){Z?.(),Z=null,n({t:\"ready\",ok:!1,error:ge(r),lockUnavailable:r?.name===\"LockUnavailableError\"})}return;case\"attach\":n({t:\"attached\",instanceId:t.instanceId,ok:!!B?.attachMemory(t.instanceId,t.memory)});return;case\"detach\":B?.detachMemory(t.instanceId);return;case\"preopen\":{let r=B?await B.preopen(t.paths??[],t.flags):[];n({t:\"preopened\",id:t.id,statuses:r});return}case\"release-preopen\":B?.releasePreopen(t.paths??[]);return;case\"stats\":n({t:\"stats\",id:t.id,stats:B?{...B.stats}:null,inventory:B?B.inventory():null,usage:M?.usage?M.usage():null});return;case\"reset\":M?.reset?.(),n({t:\"reset\",id:t.id});return;case\"clear\":try{await M?.clear?.(),n({t:\"cleared\",id:t.id,ok:!0})}catch(r){n({t:\"cleared\",id:t.id,ok:!1,error:ge(r)})}return;case\"stop\":await B?.stop(),B=null,Z?.(),Z=null,n({t:\"stopped\",id:t.id});return;default:}}function Bn(){let t=n=>self.postMessage(n);self.onmessage=n=>{Ct(n.data,t)}}async function xn(){let t=Nt+\"worker_threads\",{parentPort:n}=await import(t);if(!n)return;let r=s=>n.postMessage(s);n.on(\"message\",s=>{Ct(s,r)})}mn?xn():typeof self<\"u\"&&typeof self.postMessage==\"function\"&&typeof window>\"u\"&&Bn();})();\n";
|