diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..6f965d6 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,103 @@ +# Continuous deployment of the demo site to GitHub Pages. +# +# The site was previously BUILT ON A LAPTOP and committed: every rebuild +# added an ~11 MB engine composite to git history, and "keep Pages +# updated" was a manual step that could silently drift from the source. +# Here the artifact is built from the source tree on every push instead, +# so the deployed demo is always the committed spike. +# +# Build runs on PRs too (a broken demo build should fail the PR, not the +# deploy); only main deploys. +# +# CUTOVER, in this order — the committed docs/spike-demo/ is still what +# serves today, and is deliberately NOT deleted by the change that +# introduced this workflow: +# 1. land this workflow and confirm a green `build` job on main; +# 2. switch Pages source from "branch: main /docs" to "GitHub Actions" +# (repo settings, or `gh api -X POST .../pages -f build_type=workflow`) +# and confirm the `deploy` job publishes the same site; +# 3. THEN delete docs/spike-demo/ from git and gitignore it — the +# artifacts stop accruing in history only once nothing serves them. +# Doing (3) first would take the demo offline for the length of the gap. + +name: Pages + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + # One deploy at a time; a superseded run is cancelled rather than + # racing another deployment of the same site. + group: pages-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + # The engine composite pulls keyhive + subduction + automerge from + # source; a cold cache is a long build. + timeout-minutes: 60 + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Install Deno (the deltic host; stock, no flags) + uses: denoland/setup-deno@v2 + with: + deno-version: "2.9.5" + + - name: Set up siblings and tools + # Same script developers run: sibling ports pinned by commit, the + # toolchain from rust-toolchain.toml, wasm-tools/wac/just pinned. + run: ./scripts/setup.sh + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + with: + workspaces: | + spikes/tasks-engine + spikes/demo/guest-app + spikes/demo/guest-panel-s3 + spikes/demo/guest-panel-dropbox + + - name: Build the demo site + working-directory: spikes/demo + env: + IROH_CHECKOUT: ../../../polymorph-iroh + run: just pages + + - name: Assemble the site + # docs/ is the site root: the index and the todomvc spike are + # committed builds; spike-demo is the one this workflow rebuilds. + run: | + test -f docs/spike-demo/engine.component.wasm + test -f docs/spike-demo/panel-dropbox.component.wasm + test -f docs/index.html + du -sh docs + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v4 + with: + path: docs + + deploy: + # Only the default branch deploys; PR builds stop at the artifact. + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/spike-demo/demo.js b/docs/spike-demo/demo.js index f067e5b..47ebbed 100644 --- a/docs/spike-demo/demo.js +++ b/docs/spike-demo/demo.js @@ -1,15 +1,15 @@ -var ts=Symbol.for("deltic.witError/1"),ns=Symbol.for("deltic.trap/1"),xo=Symbol.for("deltic.dropped/1"),Eo=Symbol.for("deltic.peerTrapped/1"),vo=Symbol.for("deltic.invalidHandle/1"),rs=Symbol.for("deltic.streamProducer/1"),ss=Symbol.for("deltic.suspending/1"),os=Symbol.for("deltic.stream/1"),is=Symbol.for("deltic.future/1"),kt=Symbol.for("deltic.errorContext/1"),To=Symbol.for("deltic.resourceState/1"),ba=Symbol.for("deltic.pollable/1"),ka=Symbol.for("deltic.wasiExit/1"),So=Symbol.for("deltic.runtimeCopies/1"),$o=1;function Pe(t,e){if(t===null)return!1;let n=typeof t;return n!=="object"&&n!=="function"?!1:t[e]===!0}function ye(t,e){Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:!0,enumerable:!1,writable:!1,configurable:!1})}var j=class extends Error{payload;constructor(e,n){super(n??`component error: ${Dm(e)}`),this.name="ComponentException",this.payload=e}};ye(j.prototype,ts);var be=class extends Error{constructor(e="canonical ABI trap"){super(e),this.name="Trap"}};ye(be.prototype,ns);var Gt=class extends Error{constructor(e="the write end was dropped without a value"){super(e),this.name="DroppedError"}};ye(Gt.prototype,xo);var je=class extends Error{constructor(e){super(e),this.name="InvalidHandleError"}};ye(je.prototype,vo);var Rt=class extends Error{cause;progress;constructor(e,n,r){super(`${e}: the peer component instance trapped, so this stream/future operation can never complete \u2014 ${n instanceof Error?n.message:String(n)}`),this.name="PeerTrappedError",this.cause=n,r!==void 0&&(this.progress=r)}};ye(Rt.prototype,Eo);var Xt=class extends Error{cause;constructor(e,n){super(`${e}: the stream producer failed \u2014 ${Fm(n)}. The guest's stream is NOT closed cleanly: the in-flight call fails instead, because a short stream presented as end-of-stream would be wrong data reported as success.`),this.name="StreamProducerError",this.cause=n}};ye(Xt.prototype,rs);function rr(t){return Pe(t,ts)}function sr(t){return Pe(t,ns)}function as(t){return Pe(t,rs)}function Dm(t){return t==null?String(t):typeof t=="object"&&"kind"in t?String(t.kind):typeof t=="object"?JSON.stringify(t):String(t)}function Fm(t){return t instanceof Error?`${t.name}: ${t.message}`:String(t)}function ie(t,e,n){if(typeof e=="string"||typeof e=="symbol"||n!==void 0)throw new TypeError("suspending: legacy (experimentalDecorators) method decoration is not supported \u2014 the decorator would receive the prototype, not the method. Compile with stage-3 decorators (the default), or use the call form: `f: suspending(fn)`.");if(e!==void 0){let r=e.kind;if(r!=="method")throw new TypeError(`suspending: cannot decorate a ${String(r)} \u2014 only methods (instance or static) can be marked suspendable. Constructors are synchronous by contract; for record-literal imports use the call form: \`f: suspending(fn)\`.`)}if(typeof t!="function")throw new TypeError(`suspending: expected a function, got ${typeof t}`);return ye(t,ss),t}function Qe(t){return typeof t=="function"&&Pe(t,ss)}function Ao(t){if(t===void 0)return!1;for(let e of Object.values(t)){if(Qe(e))return!0;if(e!==null&&typeof e=="object"){for(let n of Object.values(e))if(Qe(n))return!0}}return!1}function wu(){let e=globalThis[So];if(Array.isArray(e))return e;let n=[];return Object.defineProperty(globalThis,So,{value:n,enumerable:!1,writable:!0,configurable:!0}),n}function Io(t){let e=wu();for(let n of e)if(n.url===t.url)return e;return e.push(Object.freeze({url:t.url,runtimeVersion:t.runtimeVersion,protocolGeneration:t.protocolGeneration})),e}function Pt(){let t=wu();return t.length<=1?"":`${t.length} deltic copies loaded: ${t.map(e=>e.url).join(", ")}`}var wn=import.meta.url,xa="0.1.0";function gn(t,e){let n=Pt();return`${t} was minted by a DIFFERENT deltic runtime copy and cannot be used through this one (this copy: ${wn}${n===""?"":`; ${n}`}). Handles are stateful \u2014 their machinery lives in the copy that minted them (contracts/embedder-api.md amendment A9, issue #83)${e===void 0?"":`. ${e}`}`}function Ea(t,e){return t.params.length===e.params.length&&t.results.length===e.results.length&&t.params.every((n,r)=>n===e.params[r])&&t.results.every((n,r)=>n===e.results[r])}var cs=class{impl;dtor;dtorHost;constructor(e,n=null,r=null){this.impl=e,this.dtor=n,this.dtorHost=r}};function K(t){switch(t.kind){case"tuple":return{kind:"record",fields:t.elements.map((e,n)=>({label:String(n),type:e}))};case"enum":return{kind:"variant",cases:t.labels.map(e=>({label:e,type:null}))};case"option":return{kind:"variant",cases:[{label:"none",type:null},{label:"some",type:t.type}]};case"result":return{kind:"variant",cases:[{label:"ok",type:t.ok},{label:"error",type:t.error}]};case"map":return{kind:"list",element:K({kind:"tuple",elements:[t.key,t.value]})};default:return t}}function Lt(t){let e=t.length;if(!(0or(r.type,e));case"variant":return e(n)||n.cases.some(r=>or(r.type,e));default:return e(n)}}function xu(t,e){return t.length===e.length&&t.every((n,r)=>Ke(n,e[r]))}function Ke(t,e){if(t===e)return!0;if(t.kind!==e.kind)return!1;switch(t.kind){case"list":{let n=e;return t.length===n.length&&Ke(t.element,n.element)}case"record":{let n=e;return t.fields.length===n.fields.length&&t.fields.every((r,s)=>r.label===n.fields[s].label&&Ke(r.type,n.fields[s].type))}case"tuple":{let n=e;return t.elements.length===n.elements.length&&t.elements.every((r,s)=>Ke(r,n.elements[s]))}case"variant":{let n=e;return t.cases.length===n.cases.length&&t.cases.every((r,s)=>{let o=n.cases[s];return r.label!==o.label?!1:r.type===null||o.type===null?r.type===o.type:Ke(r.type,o.type)})}case"enum":case"flags":{let n=e;return t.labels.length===n.labels.length&&t.labels.every((r,s)=>r===n.labels[s])}case"option":{let n=e;return Ke(t.type,n.type)}case"result":{let n=e;return t.ok===null!=(n.ok===null)||t.error===null!=(n.error===null)?!1:(t.ok===null||Ke(t.ok,n.ok))&&(t.error===null||Ke(t.error,n.error))}case"map":{let n=e;return Ke(t.key,n.key)&&Ke(t.value,n.value)}case"own":case"borrow":{let n=e;return t.rt===n.rt}case"stream":case"future":{let n=e;return t.element===null!=(n.element===null)?!1:t.element===null||Ke(t.element,n.element)}case"error-context":return!0;default:return!0}}function Ie(t){if(t===null)return"_";switch(t.kind){case"list":return t.length===void 0?`list<${Ie(t.element)}>`:`list<${Ie(t.element)}, ${t.length}>`;case"record":return`record{${t.fields.map(e=>`${e.label}: ${Ie(e.type)}`).join(", ")}}`;case"tuple":return`tuple<${t.elements.map(Ie).join(", ")}>`;case"variant":return`variant{${t.cases.map(e=>e.type===null?e.label:`${e.label}(${Ie(e.type)})`).join(", ")}}`;case"enum":return`enum{${t.labels.join(", ")}}`;case"flags":return`flags{${t.labels.join(", ")}}`;case"option":return`option<${Ie(t.type)}>`;case"result":return`result<${Ie(t.ok)}, ${Ie(t.error)}>`;case"map":return`map<${Ie(t.key)}, ${Ie(t.value)}>`;case"own":case"borrow":return`${t.kind}`;case"stream":case"future":return`${t.kind}<${Ie(t.element)}>`;default:return t.kind}}var v=class extends Error{constructor(e){super(e),this.name="PlanError"}},Ta=class extends Error{phase;detail;constructor(e){super(`translator error [${e.phase}]: ${e.message}`),this.name="TranslateError",this.phase=e.phase,this.detail=e.detail??e.message}get isValidationVerdict(){return this.phase==="validation"}},Eu=3;function bn(t){if(t.formatVersion!==Eu)throw new v(`unsupported plan formatVersion ${t.formatVersion} (this runtime implements v${Eu})`);for(let a of["modules","initializers","trampolines","canonicalOptions","types","resourceTables","streamTables","futureTables","errorContextTables","imports","exports"])if(!Array.isArray(t[a]))throw new v(`plan.${a} missing or not an array`);t.initializers.forEach((a,c)=>Um(a,`initializers[${c}]`)),t.trampolines.forEach((a,c)=>Wm(a,`trampolines[${c}]`)),t.canonicalOptions.forEach((a,c)=>jm(a,`canonicalOptions[${c}]`)),t.errorContextTables.forEach((a,c)=>{let l=`errorContextTables[${c}]`;we(lt(a),l,`must be an object, got ${Ce(a)}`),ae(a,"instance",l)});let e=t.importedResources??[];for(let[a,c]of e.entries())if(typeof c?.import!="number"||c.import<0||c.import>=t.imports.length)throw new v(`importedResources[${a}].import = ${c?.import} is not a valid index into plan.imports (length ${t.imports.length})`);let n=new Map,r=t.resourceTables.map(a=>{if(a.kind!=="concrete")return new cs(null,null);let c=n.get(a.resource);return c===void 0&&(c=new cs(null,null),n.set(a.resource,c)),c}),s=t.types.map((a,c)=>Km(a,r,`types[${c}]`)),o=new Map;for(let[a,c]of t.trampolines.entries()){if(c.kind!=="task-return")continue;let l=c;if(l.resultType===null)continue;if(l.resultType<0||l.resultType>=t.types.length)throw new v(`trampolines[${a}].resultType = ${l.resultType} is not a valid index into plan.types (length ${t.types.length})`);let u=o.get(l.results);if(u!==void 0&&u!==l.resultType)throw new v(`trampolines[${a}]: task-return tuple ${l.results} maps to both type ${u} and type ${l.resultType}`);o.set(l.results,l.resultType)}let i=(a,c)=>(a??[]).map((l,u)=>l.element===null?null:De(l.element,r,`${c}[${u}].element`));return{wire:t,types:s,resourceTokens:r,numImportedResources:e.length,streamElems:i(t.streamTables,"streamTables"),futureElems:i(t.futureTables,"futureTables"),streamTableInstances:t.streamTables.map(a=>a.instance),futureTableInstances:t.futureTables.map(a=>a.instance),errorContextTableInstances:t.errorContextTables.map(a=>a.instance),resultTupleTypes:o}}function Su(t,e){return t.numImportedResources+e}function Co(t){let e;try{e=JSON.parse(t)}catch(r){throw new v(`envelope is not valid JSON: ${r}`)}if(e.error!==void 0)throw new Ta(e.errorDetail??{phase:"internal",message:e.error});if(!e.plan)throw new v("envelope missing `plan`");bn(e.plan);let n=new Map;for(let r of e.adapters??[])n.set(r.file,Mm(r.wasm));return{wire:e.plan,adapters:n}}function Mm(t){let e=atob(t),n=new Uint8Array(e.length);for(let r=0;rva(r,`${e}.args[${s}]`));return;case"lower-import":ae(n,"index",e),ae(n,"import",e);return;case"extract-memory":ae(n,"index",e),Tu(n.export,`${e}.export`);return;case"extract-realloc":case"extract-callback":case"extract-post-return":ae(n,"index",e),va(n.def,`${e}.def`);return;case"extract-table":ae(n,"index",e),Tu(n.export,`${e}.export`);return;case"resource":ae(n,"index",e),we(typeof n.rep=="string"&&$u.has(n.rep),e,`.rep must be one of i32/i64/f32/f64, got ${Ce(n.rep)}`),we(n.dtor===null||lt(n.dtor),e,".dtor must be a CoreDef object or null"),n.dtor!==null&&va(n.dtor,`${e}.dtor`),ae(n,"instance",e);return;default:throw new v(`${e}: unknown initializer op ${Ce(n.op)}`)}}function Wm(t,e){we(lt(t),e,`must be an object, got ${Ce(t)}`);let n=t;switch(ls(n,"kind",e),ae(n,"index",e),n.kind){case"lower-import":ae(n,"lowered",e),ae(n,"options",e),ae(n,"type",e);return;case"trap":case"enter-sync-call":case"exit-sync-call":return;case"task-return":ae(n,"instance",e),ae(n,"results",e),ir(n,"resultType",e),ae(n,"options",e);return;case"resource-drop":case"resource-new":case"resource-rep":ae(n,"instance",e),ae(n,"resource",e);return;default:return}}function jm(t,e){we(lt(t),e,`must be an object, got ${Ce(t)}`);let n=t;ae(n,"instance",e),we(typeof n.stringEncoding=="string"&&["utf8","utf16","latin1+utf16"].includes(n.stringEncoding),e,".stringEncoding must be one of utf8/utf16/latin1+utf16, got "+Ce(n.stringEncoding)),ir(n,"memory",e),ir(n,"realloc",e),ir(n,"postReturn",e),ir(n,"callback",e),vu(n,"async",e),vu(n,"cancellable",e),we(lt(n.coreType),e,".coreType must be an object");let r=n.coreType;Sa(r,"params",`${e}.coreType`),Sa(r,"results",`${e}.coreType`);for(let[s,o]of[["params",r.params],["results",r.results]])o.forEach((i,a)=>{we(typeof i=="string"&&$u.has(i),`${e}.coreType.${s}[${a}]`,`must be one of i32/i64/f32/f64, got ${Ce(i)}`)})}function Km(t,e,n){if(t.kind==="func"){let r=t;return{kind:"func",funcType:{params:r.params.map(s=>De(s.type,e,`${n}.params.${s.label}`)),results:r.results.map((s,o)=>De(s,e,`${n}.results[${o}]`)),async:r.async},paramNames:r.params.map(s=>s.label)}}return{kind:"value",type:De(t,e,n)}}function De(t,e,n){switch(t.kind){case"bool":case"s8":case"u8":case"s16":case"u16":case"s32":case"u32":case"s64":case"u64":case"f32":case"f64":case"char":case"string":case"error-context":return{kind:t.kind};case"list":return{kind:"list",element:De(t.element,e,`${n}.element`),...t.length!==void 0?{length:t.length}:{}};case"record":return{kind:"record",fields:t.fields.map(r=>({label:r.label,type:De(r.type,e,`${n}.${r.label}`)}))};case"tuple":return{kind:"tuple",elements:t.elements.map((r,s)=>De(r,e,`${n}[${s}]`))};case"variant":return{kind:"variant",cases:t.cases.map(r=>({label:r.label,type:r.type===null?null:De(r.type,e,`${n}.${r.label}`)}))};case"enum":return{kind:"enum",labels:[...t.labels]};case"option":return{kind:"option",type:De(t.type,e,`${n}.some`)};case"result":return{kind:"result",ok:t.ok===null?null:De(t.ok,e,`${n}.ok`),error:t.err===null?null:De(t.err,e,`${n}.err`)};case"map":return{kind:"map",key:De(t.key,e,`${n}.key`),value:De(t.value,e,`${n}.value`)};case"flags":return{kind:"flags",labels:[...t.labels]};case"own":case"borrow":{let r=e[t.resource];if(r===void 0)throw new v(`${n}: ${t.kind} references resource table ${t.resource}, but the plan has ${e.length} resource tables`);return{kind:t.kind,rt:r}}case"stream":case"future":return{kind:t.kind,element:t.element===null?null:De(t.element,e,`${n}.element`)};default:{let r=t;throw new v(`${n}: unknown ValType kind ${r.kind}`)}}}function pe(t){throw new be(t)}function h(t,e){t&&pe(e)}var ar=class extends Error{constructor(e="internal assertion failed"){super(e),this.name="AssertionError"}};function p(t,e){if(!t)throw new ar(e)}function us(t){return t==="i32"?4:8}function $a(t){return typeof t=="bigint"?(p(t>=0n&&t<=BigInt(Number.MAX_SAFE_INTEGER),"index overflow"),Number(t)):(p(Number.isSafeInteger(t)&&t>=0,"index not a safe integer"),t)}function ke(t,e,n){switch(p(e+n<=t.length,"load out of bounds"),n){case 1:return t.view.getUint8(e);case 2:return t.view.getUint16(e,!0);case 4:return t.view.getUint32(e,!0);case 8:return t.view.getBigUint64(e,!0)}}function fs(t,e,n){switch(p(e+n<=t.length,"load out of bounds"),n){case 1:return t.view.getInt8(e);case 2:return t.view.getInt16(e,!0);case 4:return t.view.getInt32(e,!0);case 8:return t.view.getBigInt64(e,!0)}}function cr(t,e){return t.ptrSize()===4?ke(t,e,4):ke(t,e,8)}function Hm(t,e){return e?t>=-(2n**63n)&&t<2n**63n:t>=0n&&t<2n**64n}function zm(t,e,n){let r=e*8;if(n){let s=-(2**(r-1)),o=2**(r-1)-1;return t>=s&&t<=o}return t>=0&&t<=2**r-1}function ee(t,e,n,r,s=!1){if(p(n+r<=t.length,"store out of bounds"),r===8){p(typeof e=="bigint","64-bit store requires bigint"),p(Hm(e,s),"int store: value out of range"),s?t.view.setBigInt64(n,e,!0):t.view.setBigUint64(n,e,!0);return}switch(p(typeof e=="number"&&Number.isInteger(e),"int store"),p(zm(e,r,s),"int store: value out of range"),r){case 1:s?t.view.setInt8(n,e):t.view.setUint8(n,e);break;case 2:s?t.view.setInt16(n,e,!0):t.view.setUint16(n,e,!0);break;case 4:s?t.view.setInt32(n,e,!0):t.view.setUint32(n,e,!0);break}}function Aa(t,e,n){t.ptrSize()===4?ee(t,e,n,4):ee(t,BigInt(e),n,8)}function Nt(t,e,n){return p(e>=0&&n>=0&&e+n<=t.length,"range OOB"),t.bytes.subarray(e,e+n)}function Ro(t,e,n){p(e>=0&&e+n.length<=t.length,"write OOB"),t.bytes.set(n,e)}function xt(t,e,n,r="out of bounds of linear memory"){h(BigInt(e)+BigInt(n)>BigInt(t.length),r)}function ce(t,e){return Math.ceil(t/e)*e}function xe(t,e){let n=K(t);switch(n.kind){case"bool":case"s8":case"u8":return 1;case"s16":case"u16":return 2;case"s32":case"u32":case"f32":case"char":return 4;case"s64":case"u64":case"f64":return 8;case"string":return us(e);case"error-context":return 4;case"list":return Vm(n.element,n.length??null,e);case"record":return Iu(n.fields,e);case"variant":return Cu(n.cases,e);case"flags":return Jm(n.labels);case"own":case"borrow":case"stream":case"future":return 4}}function Vm(t,e,n){return e!==null?xe(t,n):us(n)}function Iu(t,e){let n=1;for(let r of t)n=Math.max(n,xe(r.type,e));return n}function Cu(t,e){return Math.max(xe(Lt(t),e),lr(t,e))}function lr(t,e){let n=1;for(let r of t)r.type!==null&&(n=Math.max(n,xe(r.type,e)));return n}function Jm(t){let e=t.length;return p(00,"empty record"),ce(n,Iu(t,e))}function Xm(t,e){let n=le(Lt(t),e);n=ce(n,lr(t,e));let r=0;for(let s of t)s.type!==null&&(r=Math.max(r,le(s.type,e)));return n+=r,ce(n,Cu(t,e))}function ds(t){let e=t.length;return p(0>>0:null}var ty=ey(),Lu=0;function ny(){let t=Lu||2654435769;return t^=t<<13,t>>>=0,t^=t>>>17,t^=t<<5,t>>>=0,Lu=t,t}function dr(t){return p(t.length>0,"chooseCandidate on an empty candidate set"),ty===null?t[0]:t[ny()%t.length]}var Ot=[];function Fu(t){Ot.push(t)}function Bu(t){let e=Ot.pop();p(e===t,"current-thread stack imbalance")}function _o(t,e){Ot.push(t),No.push(t);try{return e()}finally{No.pop();let n=Ot.pop();p(n===t,"withActivation: current-thread stack imbalance")}}var No=[];function ry(){return No[No.length-1]??Le[Le.length-1]??void 0}var Le=[];function pr(t){if(t==null)return;Do&&Na("claim",t);let e=Le.indexOf(t);e===Le.length-1&&e!==-1||(e!==-1&&Le.splice(e,1),Le.push(t))}function Na(t,e){console.error(`[amb] ${t} ${Ee(e)} | stack=[${Ot.map(Ee).join(",")}] claims=[${Le.map(Ee).join(",")}] resuming=${ve===null?"-":Ee(ve)} +var rs=Symbol.for("deltic.witError/1"),ss=Symbol.for("deltic.trap/1"),vo=Symbol.for("deltic.dropped/1"),To=Symbol.for("deltic.peerTrapped/1"),So=Symbol.for("deltic.invalidHandle/1"),os=Symbol.for("deltic.streamProducer/1"),is=Symbol.for("deltic.suspending/1"),as=Symbol.for("deltic.stream/1"),cs=Symbol.for("deltic.future/1"),Et=Symbol.for("deltic.errorContext/1"),$o=Symbol.for("deltic.resourceState/1"),va=Symbol.for("deltic.pollable/1"),Ta=Symbol.for("deltic.wasiExit/1"),Io=Symbol.for("deltic.runtimeCopies/1"),Ao=1;function Ne(t,e){if(t===null)return!1;let n=typeof t;return n!=="object"&&n!=="function"?!1:t[e]===!0}function we(t,e){Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:!0,enumerable:!1,writable:!1,configurable:!1})}var j=class extends Error{payload;constructor(e,n){super(n??`component error: ${zm(e)}`),this.name="ComponentException",this.payload=e}};we(j.prototype,rs);var ke=class extends Error{constructor(e="canonical ABI trap"){super(e),this.name="Trap"}};we(ke.prototype,ss);var Yt=class extends Error{constructor(e="the write end was dropped without a value"){super(e),this.name="DroppedError"}};we(Yt.prototype,vo);var Ke=class extends Error{constructor(e){super(e),this.name="InvalidHandleError"}};we(Ke.prototype,So);var Lt=class extends Error{cause;progress;constructor(e,n,r){super(`${e}: the peer component instance trapped, so this stream/future operation can never complete \u2014 ${n instanceof Error?n.message:String(n)}`),this.name="PeerTrappedError",this.cause=n,r!==void 0&&(this.progress=r)}};we(Lt.prototype,To);var Zt=class extends Error{cause;constructor(e,n){super(`${e}: the stream producer failed \u2014 ${Vm(n)}. The guest's stream is NOT closed cleanly: the in-flight call fails instead, because a short stream presented as end-of-stream would be wrong data reported as success.`),this.name="StreamProducerError",this.cause=n}};we(Zt.prototype,os);function ir(t){return Ne(t,rs)}function ar(t){return Ne(t,ss)}function ls(t){return Ne(t,os)}function zm(t){return t==null?String(t):typeof t=="object"&&"kind"in t?String(t.kind):typeof t=="object"?JSON.stringify(t):String(t)}function Vm(t){return t instanceof Error?`${t.name}: ${t.message}`:String(t)}function oe(t,e,n){if(typeof e=="string"||typeof e=="symbol"||n!==void 0)throw new TypeError("suspending: legacy (experimentalDecorators) method decoration is not supported \u2014 the decorator would receive the prototype, not the method. Compile with stage-3 decorators (the default), or use the call form: `f: suspending(fn)`.");if(e!==void 0){let r=e.kind;if(r!=="method")throw new TypeError(`suspending: cannot decorate a ${String(r)} \u2014 only methods (instance or static) can be marked suspendable. Constructors are synchronous by contract; for record-literal imports use the call form: \`f: suspending(fn)\`.`)}if(typeof t!="function")throw new TypeError(`suspending: expected a function, got ${typeof t}`);return we(t,is),t}function et(t){return typeof t=="function"&&Ne(t,is)}function Co(t){if(t===void 0)return!1;for(let e of Object.values(t)){if(et(e))return!0;if(e!==null&&typeof e=="object"){for(let n of Object.values(e))if(et(n))return!0}}return!1}function Tu(){let e=globalThis[Io];if(Array.isArray(e))return e;let n=[];return Object.defineProperty(globalThis,Io,{value:n,enumerable:!1,writable:!0,configurable:!0}),n}function Ro(t){let e=Tu();for(let n of e)if(n.url===t.url)return e;return e.push(Object.freeze({url:t.url,runtimeVersion:t.runtimeVersion,protocolGeneration:t.protocolGeneration})),e}function Nt(){let t=Tu();return t.length<=1?"":`${t.length} deltic copies loaded: ${t.map(e=>e.url).join(", ")}`}var bn=import.meta.url,Sa="0.1.0";function kn(t,e){let n=Nt();return`${t} was minted by a DIFFERENT deltic runtime copy and cannot be used through this one (this copy: ${bn}${n===""?"":`; ${n}`}). Handles are stateful \u2014 their machinery lives in the copy that minted them (contracts/embedder-api.md amendment A9, issue #83)${e===void 0?"":`. ${e}`}`}function $a(t,e){return t.params.length===e.params.length&&t.results.length===e.results.length&&t.params.every((n,r)=>n===e.params[r])&&t.results.every((n,r)=>n===e.results[r])}var us=class{impl;dtor;dtorHost;constructor(e,n=null,r=null){this.impl=e,this.dtor=n,this.dtorHost=r}};function K(t){switch(t.kind){case"tuple":return{kind:"record",fields:t.elements.map((e,n)=>({label:String(n),type:e}))};case"enum":return{kind:"variant",cases:t.labels.map(e=>({label:e,type:null}))};case"option":return{kind:"variant",cases:[{label:"none",type:null},{label:"some",type:t.type}]};case"result":return{kind:"variant",cases:[{label:"ok",type:t.ok},{label:"error",type:t.error}]};case"map":return{kind:"list",element:K({kind:"tuple",elements:[t.key,t.value]})};default:return t}}function Ot(t){let e=t.length;if(!(0cr(r.type,e));case"variant":return e(n)||n.cases.some(r=>cr(r.type,e));default:return e(n)}}function Au(t,e){return t.length===e.length&&t.every((n,r)=>He(n,e[r]))}function He(t,e){if(t===e)return!0;if(t.kind!==e.kind)return!1;switch(t.kind){case"list":{let n=e;return t.length===n.length&&He(t.element,n.element)}case"record":{let n=e;return t.fields.length===n.fields.length&&t.fields.every((r,s)=>r.label===n.fields[s].label&&He(r.type,n.fields[s].type))}case"tuple":{let n=e;return t.elements.length===n.elements.length&&t.elements.every((r,s)=>He(r,n.elements[s]))}case"variant":{let n=e;return t.cases.length===n.cases.length&&t.cases.every((r,s)=>{let o=n.cases[s];return r.label!==o.label?!1:r.type===null||o.type===null?r.type===o.type:He(r.type,o.type)})}case"enum":case"flags":{let n=e;return t.labels.length===n.labels.length&&t.labels.every((r,s)=>r===n.labels[s])}case"option":{let n=e;return He(t.type,n.type)}case"result":{let n=e;return t.ok===null!=(n.ok===null)||t.error===null!=(n.error===null)?!1:(t.ok===null||He(t.ok,n.ok))&&(t.error===null||He(t.error,n.error))}case"map":{let n=e;return He(t.key,n.key)&&He(t.value,n.value)}case"own":case"borrow":{let n=e;return t.rt===n.rt}case"stream":case"future":{let n=e;return t.element===null!=(n.element===null)?!1:t.element===null||He(t.element,n.element)}case"error-context":return!0;default:return!0}}function Ce(t){if(t===null)return"_";switch(t.kind){case"list":return t.length===void 0?`list<${Ce(t.element)}>`:`list<${Ce(t.element)}, ${t.length}>`;case"record":return`record{${t.fields.map(e=>`${e.label}: ${Ce(e.type)}`).join(", ")}}`;case"tuple":return`tuple<${t.elements.map(Ce).join(", ")}>`;case"variant":return`variant{${t.cases.map(e=>e.type===null?e.label:`${e.label}(${Ce(e.type)})`).join(", ")}}`;case"enum":return`enum{${t.labels.join(", ")}}`;case"flags":return`flags{${t.labels.join(", ")}}`;case"option":return`option<${Ce(t.type)}>`;case"result":return`result<${Ce(t.ok)}, ${Ce(t.error)}>`;case"map":return`map<${Ce(t.key)}, ${Ce(t.value)}>`;case"own":case"borrow":return`${t.kind}`;case"stream":case"future":return`${t.kind}<${Ce(t.element)}>`;default:return t.kind}}var E=class extends Error{constructor(e){super(e),this.name="PlanError"}},Aa=class extends Error{phase;detail;constructor(e){super(`translator error [${e.phase}]: ${e.message}`),this.name="TranslateError",this.phase=e.phase,this.detail=e.detail??e.message}get isValidationVerdict(){return this.phase==="validation"}},Cu=3;function xn(t){if(t.formatVersion!==Cu)throw new E(`unsupported plan formatVersion ${t.formatVersion} (this runtime implements v${Cu})`);for(let a of["modules","initializers","trampolines","canonicalOptions","types","resourceTables","streamTables","futureTables","errorContextTables","imports","exports"])if(!Array.isArray(t[a]))throw new E(`plan.${a} missing or not an array`);t.initializers.forEach((a,c)=>Gm(a,`initializers[${c}]`)),t.trampolines.forEach((a,c)=>Xm(a,`trampolines[${c}]`)),t.canonicalOptions.forEach((a,c)=>Ym(a,`canonicalOptions[${c}]`)),t.errorContextTables.forEach((a,c)=>{let l=`errorContextTables[${c}]`;ge(ft(a),l,`must be an object, got ${Re(a)}`),ie(a,"instance",l)});let e=t.importedResources??[];for(let[a,c]of e.entries())if(typeof c?.import!="number"||c.import<0||c.import>=t.imports.length)throw new E(`importedResources[${a}].import = ${c?.import} is not a valid index into plan.imports (length ${t.imports.length})`);let n=new Map,r=t.resourceTables.map(a=>{if(a.kind!=="concrete")return new us(null,null);let c=n.get(a.resource);return c===void 0&&(c=new us(null,null),n.set(a.resource,c)),c}),s=t.types.map((a,c)=>Zm(a,r,`types[${c}]`)),o=new Map;for(let[a,c]of t.trampolines.entries()){if(c.kind!=="task-return")continue;let l=c;if(l.resultType===null)continue;if(l.resultType<0||l.resultType>=t.types.length)throw new E(`trampolines[${a}].resultType = ${l.resultType} is not a valid index into plan.types (length ${t.types.length})`);let u=o.get(l.results);if(u!==void 0&&u!==l.resultType)throw new E(`trampolines[${a}]: task-return tuple ${l.results} maps to both type ${u} and type ${l.resultType}`);o.set(l.results,l.resultType)}let i=(a,c)=>(a??[]).map((l,u)=>l.element===null?null:Fe(l.element,r,`${c}[${u}].element`));return{wire:t,types:s,resourceTokens:r,numImportedResources:e.length,streamElems:i(t.streamTables,"streamTables"),futureElems:i(t.futureTables,"futureTables"),streamTableInstances:t.streamTables.map(a=>a.instance),futureTableInstances:t.futureTables.map(a=>a.instance),errorContextTableInstances:t.errorContextTables.map(a=>a.instance),resultTupleTypes:o}}function Lu(t,e){return t.numImportedResources+e}function Po(t){let e;try{e=JSON.parse(t)}catch(r){throw new E(`envelope is not valid JSON: ${r}`)}if(e.error!==void 0)throw new Aa(e.errorDetail??{phase:"internal",message:e.error});if(!e.plan)throw new E("envelope missing `plan`");xn(e.plan);let n=new Map;for(let r of e.adapters??[])n.set(r.file,qm(r.wasm));return{wire:e.plan,adapters:n}}function qm(t){let e=atob(t),n=new Uint8Array(e.length);for(let r=0;rIa(r,`${e}.args[${s}]`));return;case"lower-import":ie(n,"index",e),ie(n,"import",e);return;case"extract-memory":ie(n,"index",e),Pu(n.export,`${e}.export`);return;case"extract-realloc":case"extract-callback":case"extract-post-return":ie(n,"index",e),Ia(n.def,`${e}.def`);return;case"extract-table":ie(n,"index",e),Pu(n.export,`${e}.export`);return;case"resource":ie(n,"index",e),ge(typeof n.rep=="string"&&Nu.has(n.rep),e,`.rep must be one of i32/i64/f32/f64, got ${Re(n.rep)}`),ge(n.dtor===null||ft(n.dtor),e,".dtor must be a CoreDef object or null"),n.dtor!==null&&Ia(n.dtor,`${e}.dtor`),ie(n,"instance",e);return;default:throw new E(`${e}: unknown initializer op ${Re(n.op)}`)}}function Xm(t,e){ge(ft(t),e,`must be an object, got ${Re(t)}`);let n=t;switch(fs(n,"kind",e),ie(n,"index",e),n.kind){case"lower-import":ie(n,"lowered",e),ie(n,"options",e),ie(n,"type",e);return;case"trap":case"enter-sync-call":case"exit-sync-call":return;case"task-return":ie(n,"instance",e),ie(n,"results",e),lr(n,"resultType",e),ie(n,"options",e);return;case"resource-drop":case"resource-new":case"resource-rep":ie(n,"instance",e),ie(n,"resource",e);return;default:return}}function Ym(t,e){ge(ft(t),e,`must be an object, got ${Re(t)}`);let n=t;ie(n,"instance",e),ge(typeof n.stringEncoding=="string"&&["utf8","utf16","latin1+utf16"].includes(n.stringEncoding),e,".stringEncoding must be one of utf8/utf16/latin1+utf16, got "+Re(n.stringEncoding)),lr(n,"memory",e),lr(n,"realloc",e),lr(n,"postReturn",e),lr(n,"callback",e),Ru(n,"async",e),Ru(n,"cancellable",e),ge(ft(n.coreType),e,".coreType must be an object");let r=n.coreType;Ca(r,"params",`${e}.coreType`),Ca(r,"results",`${e}.coreType`);for(let[s,o]of[["params",r.params],["results",r.results]])o.forEach((i,a)=>{ge(typeof i=="string"&&Nu.has(i),`${e}.coreType.${s}[${a}]`,`must be one of i32/i64/f32/f64, got ${Re(i)}`)})}function Zm(t,e,n){if(t.kind==="func"){let r=t;return{kind:"func",funcType:{params:r.params.map(s=>Fe(s.type,e,`${n}.params.${s.label}`)),results:r.results.map((s,o)=>Fe(s,e,`${n}.results[${o}]`)),async:r.async},paramNames:r.params.map(s=>s.label)}}return{kind:"value",type:Fe(t,e,n)}}function Fe(t,e,n){switch(t.kind){case"bool":case"s8":case"u8":case"s16":case"u16":case"s32":case"u32":case"s64":case"u64":case"f32":case"f64":case"char":case"string":case"error-context":return{kind:t.kind};case"list":return{kind:"list",element:Fe(t.element,e,`${n}.element`),...t.length!==void 0?{length:t.length}:{}};case"record":return{kind:"record",fields:t.fields.map(r=>({label:r.label,type:Fe(r.type,e,`${n}.${r.label}`)}))};case"tuple":return{kind:"tuple",elements:t.elements.map((r,s)=>Fe(r,e,`${n}[${s}]`))};case"variant":return{kind:"variant",cases:t.cases.map(r=>({label:r.label,type:r.type===null?null:Fe(r.type,e,`${n}.${r.label}`)}))};case"enum":return{kind:"enum",labels:[...t.labels]};case"option":return{kind:"option",type:Fe(t.type,e,`${n}.some`)};case"result":return{kind:"result",ok:t.ok===null?null:Fe(t.ok,e,`${n}.ok`),error:t.err===null?null:Fe(t.err,e,`${n}.err`)};case"map":return{kind:"map",key:Fe(t.key,e,`${n}.key`),value:Fe(t.value,e,`${n}.value`)};case"flags":return{kind:"flags",labels:[...t.labels]};case"own":case"borrow":{let r=e[t.resource];if(r===void 0)throw new E(`${n}: ${t.kind} references resource table ${t.resource}, but the plan has ${e.length} resource tables`);return{kind:t.kind,rt:r}}case"stream":case"future":return{kind:t.kind,element:t.element===null?null:Fe(t.element,e,`${n}.element`)};default:{let r=t;throw new E(`${n}: unknown ValType kind ${r.kind}`)}}}function pe(t){throw new ke(t)}function h(t,e){t&&pe(e)}var ur=class extends Error{constructor(e="internal assertion failed"){super(e),this.name="AssertionError"}};function p(t,e){if(!t)throw new ur(e)}function ds(t){return t==="i32"?4:8}function Ra(t){return typeof t=="bigint"?(p(t>=0n&&t<=BigInt(Number.MAX_SAFE_INTEGER),"index overflow"),Number(t)):(p(Number.isSafeInteger(t)&&t>=0,"index not a safe integer"),t)}function xe(t,e,n){switch(p(e+n<=t.length,"load out of bounds"),n){case 1:return t.view.getUint8(e);case 2:return t.view.getUint16(e,!0);case 4:return t.view.getUint32(e,!0);case 8:return t.view.getBigUint64(e,!0)}}function ps(t,e,n){switch(p(e+n<=t.length,"load out of bounds"),n){case 1:return t.view.getInt8(e);case 2:return t.view.getInt16(e,!0);case 4:return t.view.getInt32(e,!0);case 8:return t.view.getBigInt64(e,!0)}}function fr(t,e){return t.ptrSize()===4?xe(t,e,4):xe(t,e,8)}function Qm(t,e){return e?t>=-(2n**63n)&&t<2n**63n:t>=0n&&t<2n**64n}function ey(t,e,n){let r=e*8;if(n){let s=-(2**(r-1)),o=2**(r-1)-1;return t>=s&&t<=o}return t>=0&&t<=2**r-1}function ee(t,e,n,r,s=!1){if(p(n+r<=t.length,"store out of bounds"),r===8){p(typeof e=="bigint","64-bit store requires bigint"),p(Qm(e,s),"int store: value out of range"),s?t.view.setBigInt64(n,e,!0):t.view.setBigUint64(n,e,!0);return}switch(p(typeof e=="number"&&Number.isInteger(e),"int store"),p(ey(e,r,s),"int store: value out of range"),r){case 1:s?t.view.setInt8(n,e):t.view.setUint8(n,e);break;case 2:s?t.view.setInt16(n,e,!0):t.view.setUint16(n,e,!0);break;case 4:s?t.view.setInt32(n,e,!0):t.view.setUint32(n,e,!0);break}}function Pa(t,e,n){t.ptrSize()===4?ee(t,e,n,4):ee(t,BigInt(e),n,8)}function _t(t,e,n){return p(e>=0&&n>=0&&e+n<=t.length,"range OOB"),t.bytes.subarray(e,e+n)}function Lo(t,e,n){p(e>=0&&e+n.length<=t.length,"write OOB"),t.bytes.set(n,e)}function vt(t,e,n,r="out of bounds of linear memory"){h(BigInt(e)+BigInt(n)>BigInt(t.length),r)}function ae(t,e){return Math.ceil(t/e)*e}function Ee(t,e){let n=K(t);switch(n.kind){case"bool":case"s8":case"u8":return 1;case"s16":case"u16":return 2;case"s32":case"u32":case"f32":case"char":return 4;case"s64":case"u64":case"f64":return 8;case"string":return ds(e);case"error-context":return 4;case"list":return ty(n.element,n.length??null,e);case"record":return _u(n.fields,e);case"variant":return Du(n.cases,e);case"flags":return ny(n.labels);case"own":case"borrow":case"stream":case"future":return 4}}function ty(t,e,n){return e!==null?Ee(t,n):ds(n)}function _u(t,e){let n=1;for(let r of t)n=Math.max(n,Ee(r.type,e));return n}function Du(t,e){return Math.max(Ee(Ot(t),e),dr(t,e))}function dr(t,e){let n=1;for(let r of t)r.type!==null&&(n=Math.max(n,Ee(r.type,e)));return n}function ny(t){let e=t.length;return p(00,"empty record"),ae(n,_u(t,e))}function oy(t,e){let n=ce(Ot(t),e);n=ae(n,dr(t,e));let r=0;for(let s of t)s.type!==null&&(r=Math.max(r,ce(s.type,e)));return n+=r,ae(n,Du(t,e))}function hs(t){let e=t.length;return p(0>>0:null}var uy=ly(),Mu=0;function fy(){let t=Mu||2654435769;return t^=t<<13,t>>>=0,t^=t>>>17,t^=t<<5,t>>>=0,Mu=t,t}function mr(t){return p(t.length>0,"chooseCandidate on an empty candidate set"),uy===null?t[0]:t[fy()%t.length]}var Dt=[];function Hu(t){Dt.push(t)}function zu(t){let e=Dt.pop();p(e===t,"current-thread stack imbalance")}function Fo(t,e){Dt.push(t),_o.push(t);try{return e()}finally{_o.pop();let n=Dt.pop();p(n===t,"withActivation: current-thread stack imbalance")}}var _o=[];function dy(){return _o[_o.length-1]??Oe[Oe.length-1]??void 0}var Oe=[];function yr(t){if(t==null)return;Bo&&Fa("claim",t);let e=Oe.indexOf(t);e===Oe.length-1&&e!==-1||(e!==-1&&Oe.splice(e,1),Oe.push(t))}function Fa(t,e){console.error(`[amb] ${t} ${ve(e)} | stack=[${Dt.map(ve).join(",")}] claims=[${Oe.map(ve).join(",")}] resuming=${Te===null?"-":ve(Te)} ${(new Error().stack??"").split(` `).slice(2,6).join(` -`)}`)}var Nu=new WeakMap,sy=1;function Ee(t){if(t==null||typeof t!="object")return String(t);let e=Nu.get(t);return e===void 0&&(e=sy++,Nu.set(t,e)),`T${e}`}function Oa(t){if(t==null)return;Do&&Na("release",t);let e=Le.indexOf(t);if(e===-1){let n=t?.task?.implicitThread;if(n==null||(e=Le.indexOf(n),e===-1))return}Le.splice(e,1)}var ve=null;function ws(t){Do&&Na("set-resuming",t),p(ve===null||ve===t,"two activations claim the resumed ambient at once \u2014 the resolve-one-per-turn discipline was violated"),ve=t}function kn(){return ve!==null}function Mu(){ve=null}function _a(){ve!==null&&ry()===ve&&(ve=null)}function Ou(t){Oa(t),ve!==null&&(ve===t||t?.task?.implicitThread===ve)&&(ve=null)}var Do=(()=>{try{return Deno.env.get("CE_AMBIENT_TRACE")==="1"}catch{return!1}})();function Uu(){return{stack:[...Ot],claims:[...Le],resuming:ve}}function Wu(){return Ot[Ot.length-1]??Le[Le.length-1]??ve??void 0}function hr(){Do&&Ot.length===0&&console.error(`[ambient] bracket empty; claims=${Le.length} head=${Le[0]?.constructor?.name??"none"} resuming=${ve?.constructor?.name??"none"}`);let t=Wu();if(t===void 0)throw new Fe("instantiation-time task context \u2014 a task-scoped canonical built-in ran outside any task (a core start function calling task.return / task.cancel / thread.yield / subtask.*; see test/async/dont-block-start.wast)");return t}function Ft(){return Wu()}function Ne(){return hr().task}function ju(){return Ft()?.task??null}var ur=class{waiting=[];nestingDepth=0;pendingHostCalls=new Set;hostFailure=void 0;startWaiting(e){p(!this.waiting.includes(e),"thread already in the waiting list"),this.waiting.push(e)}stopWaiting(e){let n=this.waiting.indexOf(e);p(n!==-1,"thread not in the waiting list"),this.waiting.splice(n,1)}readyCandidates(){return this.waiting.filter(e=>e.ready())}awaiting=new Set;settled=[];noteAwaiting(e,n){this.awaiting.add(e),n.then(r=>{this.settled.push({t:e,value:r,failure:void 0}),Ou(e)},r=>{this.settled.push({t:e,value:void 0,failure:{error:r}}),Ou(e)})}serviceSettled(){let e=!1;for(;this.settled.length>0;){let n=this.settled.shift();this.awaiting.has(n.t)&&(n.t.resumeWith(n.value,n.failure),e=!0)}return e}hasRunnableWork(e,n){let r=i=>i?.task?.inst,s=i=>r(i)===e&&i?.task!==n;for(let i of this.settled)if(s(i.t))return!0;for(let i of this.waiting)if(s(i)&&i.ready())return!0;if(this.awaiting.size===0)return!1;let o=new Set;for(let i of this.waiting){let a=i.owner;a!=null&&o.add(a)}for(let i of this.awaiting)if(s(i)&&!o.has(i))return!0;return!1}tick(){if(ve!==null||this.settled.length>0)return!1;let e=this.readyCandidates();if(e.length===0)return!1;let n=dr(e),r=n.task.inst;p(r.mayEnterFrom(null),"tick: waiting thread's instance is not enterable from the host"),r.enterFrom(null);try{n.resume()}catch(s){throw s instanceof ze||s instanceof Fe?r.leaveTo(null):(r.releaseSyntheticRootOnPoison?.(),La?.(r,s)),s}return r.leaveTo(null),!0}},Da=new WeakSet;function Ku(t){Da.add(t)}function Fo(t){for(let e of t.pendingHostCalls)if(!Da.has(e))return!0;return!1}function Hu(t){let e=[];for(let n of t.pendingHostCalls)Da.has(n)||e.push(n);return e}function mr(t){return t.settled.length===0&&t.awaiting.size===0&&!Fo(t)}function zu(t){for(;t.state!=="resolved";){let e=[...t.inst.threads].filter(n=>n.ready()&&n!==t.inst.exclusiveThread);h(e.length===0,"deadlock: synchronous task cannot resolve and no thread is ready"),dr(e).resume()}}var gs=class t{static MAX_LENGTH=2**28-1;array=[null];free=[];get(e){return h(e>=this.array.length,"table index out of range"),h(this.array[e]===null,"table entry empty"),this.array[e]}add(e){let n;return this.free.length>0?(n=this.free.pop(),p(this.array[n]===null),this.array[n]=e):(n=this.array.length,h(n>t.MAX_LENGTH,"table full"),this.array.push(e)),n}remove(e){let n=this.get(e);return this.array[e]=null,this.free.push(e),n}*[Symbol.iterator](){for(let e of this.array)e!==null&&(yield e)}},Be=class{rt;rep;own;borrowScope;numLends;constructor(e,n,r,s=null){this.rt=e,this.rep=n,this.own=r,this.borrowScope=s,this.numLends=0}};function Bo(t){return p(t.inst!==null,"context requires a component instance"),t.inst}function Mo(t,e,n){let r=Bo(t).handles.remove(e);h(!(r instanceof Be),"not a resource handle");let s=r;return h(s.rt!==n.rt,"resource type mismatch"),h(s.numLends!==0,"handle still lent out"),h(!s.own,"expected own handle"),s.rep}function Uo(t,e,n){let r=t.borrowScope;p(r!==null&&typeof r.addLender=="function","lifting a borrow requires a subtask borrow scope");let s=Bo(t).handles.get(e);h(!(s instanceof Be),"not a resource handle");let o=s;return h(o.rt!==n.rt,"resource type mismatch"),r.addLender(o),o.rep}function Wo(t,e,n){let r=new Be(n.rt,e,!0);return Bo(t).handles.add(r)}function jo(t,e,n){let r=t.borrowScope;if(p(r!==null&&typeof r.numBorrows=="number","lowering a borrow requires a task borrow scope"),t.inst!==null&&t.inst===n.rt.impl)return e;let s=new Be(n.rt,e,!1,r);return r.numBorrows+=1,Bo(t).handles.add(s)}function qu(t,e,n){h(!t.mayLeave,"may_leave violation");let r=new Be(e,n,!0);return t.handles.add(r)}function Vu(t){if(t===null||typeof t!="object")return null;let e=t;return typeof e.mayEnterFrom=="function"&&typeof e.enterFrom=="function"&&typeof e.leaveTo=="function"?t:null}function Ju(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"}function yr(t,e,n,r=!1){let s=Vu(t.impl),o=r?t.dtorHost??t.dtor:t.dtor;if(s===null){let l=o?.(e);h(!r&&Ju(l),"resource destructor did not complete synchronously");return}let i=Vu(n)===null?null:n;s.mayEnterFrom(i)||pe(Dt(s,"cannot enter component instance")),s.enterFrom(i);let a=l=>{if(l instanceof ze||l instanceof Fe){s.leaveTo(i);return}_t(s,l)},c;try{c=o?.(e)}catch(l){throw a(l),l}if(Ju(c)){if(!r){let f=new be("resource destructor did not complete synchronously");throw a(f),f}let l=s.store,u=Promise.resolve(c).then(()=>{l?.pendingHostCalls.delete(u),s.leaveTo(i)},f=>{l?.pendingHostCalls.delete(u),l!==void 0&&l.hostFailure===void 0&&(l.hostFailure=f),a(f)});l?.pendingHostCalls.add(u);return}s.leaveTo(i)}function Gu(t,e,n){h(!t.mayLeave,"may_leave violation");let r=t.handles.remove(n);h(!(r instanceof Be),"not a resource handle");let s=r;h(s.rt!==e,"resource type mismatch"),h(s.numLends!==0,"handle still lent out"),s.own?(p(s.borrowScope===null),yr(e,s.rep,t)):(p(s.borrowScope!==null),s.borrowScope.numBorrows-=1)}function Xu(t,e,n){let r=t.handles.get(n);h(!(r instanceof Be),"not a resource handle");let s=r;return h(s.rt!==e,"resource type mismatch"),s.rep}var En=2**32-1,xn="realloc return: result not aligned",Et="realloc return: beyond end of memory",oy=(1<<28)-1;function Yu(t){return 1n<BigInt(oy),"string too long");let l=Number(a),u=BigInt(e);h(u%BigInt(i)!==0n,"misaligned string pointer"),xt(r,u,a,"string pointer/length out of bounds of memory");let f=Number(u),d=Nt(r,f,l);try{switch(c){case"utf-8":return iy.decode(d);case"utf-16-le":return ay.decode(d);case"latin-1":return ly(d)}}catch{pe(c==="utf-8"?uy(d):"invalid string encoding")}}function uy(t){let e="invalid utf-8",n="incomplete utf-8 byte sequence",r=0;for(;r=194&&s<=223)o=2;else if(s===224)o=3,i=160;else if(s>=225&&s<=236)o=3;else if(s===237)o=3,a=159;else if(s>=238&&s<=239)o=3;else if(s===240)o=4,i=144;else if(s>=241&&s<=243)o=4;else if(s===244)o=4,a=143;else return e;for(let c=1;c=t.length)return n;let l=t[r+c],u=c===1?i:128,f=c===1?a:191;if(lf)return e}r+=o}return e}function Ko(t,e,n){let r=N(t.opts),[s,o]=Fa(t,e);ee(r,r.ptrSize()===4?Number(o):o,n+r.ptrSize(),r.ptrSize()),ee(r,r.ptrSize()===4?s:BigInt(s),n,r.ptrSize())}function Fa(t,e){let n=e.length;switch(t.opts.stringEncoding){case"utf8":return dy(t,e,n);case"utf16":return fy(t,e,n);case"latin1+utf16":return hy(t,e,n)}}function fy(t,e,n){let r=N(t.opts),s=2*n;p(s<=En);let o=t.allocate(2,s);h(o!==ce(o,2),xn),xt(r,o,s,Et);let i=Qu(e);return p(s===i.length),Ro(r,o,i),[o,BigInt(n)]}function dy(t,e,n){let r=n*3;return py(t,e,n,r)}function py(t,e,n,r){let s=N(t.opts);p(n<=En);let o=t.allocate(1,n);xt(s,o,n,Et);for(let i=0;ic.length&&(o=t.reallocate(o,r,1,c.length),xt(s,o,c.length,Et)),[o,BigInt(c.length)]}}return[o,BigInt(n)]}function hy(t,e,n){let r=N(t.opts),s=Zu(e);p(n<=En);let o=t.allocate(2,n);h(o!==ce(o,2),xn),xt(r,o,n,Et);let i=0;for(let a=0;a=0;d--)r.bytes[o+2*d]=r.bytes[o+d],r.bytes[o+2*d+1]=0;let u=Qu(s);Ro(r,o+2*i,u.subarray(2*i)),l>u.length&&(o=t.reallocate(o,l,2,u.length),h(o!==ce(o,2),xn),xt(r,o,u.length,Et));let f=BigInt(u.length/2)|Yu(r.ptrType());return[o,f]}}return i=0),h(t>=1114112,"char out of range"),h(55296<=t&&t<=57343,"char is a surrogate"),String.fromCodePoint(t)}function zo(t){let e=t.codePointAt(0);return p(e!==void 0,"empty char"),p(t.length===(e>65535?2:1),"char must be one code point"),p(0<=e&&e<=55295||57344<=e&&e<=1114111,"char must be a Unicode scalar value"),e}var yy=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,tf={s8:Int8Array,u16:Uint16Array,s16:Int16Array,u32:Uint32Array,s32:Int32Array},nf={u64:BigUint64Array,s64:BigInt64Array},rf={f32:Float32Array,f64:Float64Array};function wr(t,e,n,r){if(!yy)return null;let s=e.bytes.byteOffset+n;return s%t.BYTES_PER_ELEMENT!==0?null:new t(e.bytes.buffer,s,r)}function sf(t,e,n,r){if(r==="bool"){let a=new Array(n),c=Nt(t,e,n);for(let l=0;lr.length,Et),Vo(t,e,i,n),[i,e.length]}function Vo(t,e,n,r){let s=N(t.opts),o=K(r).kind;if(o==="u8"){let a=Nt(s,n,e.length);if(e instanceof Uint8Array){a.set(e);return}for(let c=0;co.label===r?[i]:[]);return p(s.length===1,`variant case '${r}' not found`),[s[0],t[r]]}function by(t,e,n,r){let s=N(t.opts),[o,i]=Ma(e,r),a=le(Lt(r),s.ptrType());ee(s,o,n,a);let c=n+a;c=ce(c,lr(r,s.ptrType()));let l=r[o];l.type!==null&&Zt(t,i,l.type,c)}function ky(t,e,n,r){let s=N(t.opts),o=Ua(e,r);ee(s,o,n,ds(r))}function Ua(t,e){let n=0,r=0;for(let s of e)n=(n|(t[s]?1:0)<>>0,r+=1;return n}var te=function(t){return t[t.NONE=0]="NONE",t[t.SUBTASK=1]="SUBTASK",t[t.STREAM_READ=2]="STREAM_READ",t[t.STREAM_WRITE=3]="STREAM_WRITE",t[t.FUTURE_READ=4]="FUTURE_READ",t[t.FUTURE_WRITE=5]="FUTURE_WRITE",t[t.TASK_CANCELLED=6]="TASK_CANCELLED",t}({}),wE=[te.NONE,0,0],Bt=class{pendingEvent=null;wset=null;hasSyncWaiter=!1;setPendingEvent(e){this.pendingEvent=e}hasPendingEvent(){return this.pendingEvent!==null}inWaitableSet(){return this.wset!==null}*waitForPendingEvent(e){p(!this.inWaitableSet()&&!this.hasSyncWaiter,"waitForPendingEvent on a joined or already-awaited waitable"),this.hasSyncWaiter=!0,yield*e.waitUntil(()=>this.hasPendingEvent(),!1),this.hasSyncWaiter=!1}getPendingEvent(){let e=this.pendingEvent;return p(e!==null,"getPendingEvent with no pending event"),this.pendingEvent=null,e()}join(e){if(p(!this.hasSyncWaiter,"join on a waitable with a sync waiter"),this.wset){let n=this.wset.elems.indexOf(this);p(n!==-1,"waitable not in its own waitable set"),this.wset.elems.splice(n,1)}this.wset=e,e&&e.elems.push(this)}drop(){p(!this.hasPendingEvent(),"dropping a waitable with a pending event"),p(!this.hasSyncWaiter,"dropping a waitable with a sync waiter"),this.join(null)}},xy=(()=>{try{return Deno.env.get("CE_EVENT_TRACE")==="1"}catch{return!1}})(),Mt=class{elems=[];numWaiting=0;hasPendingEvent(){return this.elems.some(e=>e.hasPendingEvent())}getPendingEvent(){let e=this.elems.filter(s=>s.hasPendingEvent());p(e.length>0,"getPendingEvent on a set with no pending event");let n=dr(e);p(n.wset===this,"waitable/waitable-set back-reference mismatch");let r=n.getPendingEvent();return xy&&console.error(`[event] deliver code=${r[0]} idx=${r[1]} payload=${r[2]} readyCount=${e.length} setSize=${this.elems.length} chosenPos=${this.elems.indexOf(n)}`),r}*waitForEventAnd(e,n,r){this.numWaiting+=1;try{return(yield*e.waitUntil(()=>n()&&this.hasPendingEvent(),r))?[te.TASK_CANCELLED,0,0]:this.getPendingEvent()}finally{this.numWaiting-=1}}*waitForEvent(e,n){return yield*this.waitForEventAnd(e,()=>!0,n)}poll(e,n){return e.deliverPendingCancel(n)?[te.TASK_CANCELLED,0,0]:this.hasPendingEvent()?this.getPendingEvent():[te.NONE,0,0]}drop(){h(this.elems.length>0,"cannot drop waitable set with waitables"),h(this.numWaiting>0,"cannot drop waitable set with waiters")}};function Me(t,e){return t===null||e===null?t===e:Ke(t,e)}var gr=2**28-1,D=function(t){return t[t.COMPLETED=0]="COMPLETED",t[t.DROPPED=1]="DROPPED",t[t.CANCELLED=2]="CANCELLED",t}({}),ue=function(t){return t[t.IDLE=1]="IDLE",t[t.COPYING=2]="COPYING",t[t.CANCELLING_COPY=3]="CANCELLING_COPY",t[t.DONE=4]="DONE",t}({}),ks=class{t;cx;ptr;length;progress;constructor(e,n,r,s){if(this.t=e,this.cx=n,this.ptr=r,this.length=s,this.progress=0,h(s>gr,"buffer length exceeds MAX_LENGTH"),e!==null&&s>0){let o=n.opts.memory;p(o!==null,"buffer requires a memory");let i=o.ptrType();h(r!==ce(r,xe(e,i)),"unaligned buffer pointer"),h(r+s*le(e,i)>o.length,"buffer out of bounds")}}remain(){return this.length-this.progress}isZeroLength(){return this.length===0}read(e){p(e<=this.remain(),"buffer read beyond remaining");let n;return this.t!==null?(n=Yo(this.cx,this.ptr,e,this.t),this.ptr+=e*le(this.t,this.cx.opts.memory.ptrType())):n=new Array(e).fill(null),this.progress+=e,n}write(e){p(e.length<=this.remain(),"buffer write beyond remaining"),this.t!==null?(Vo(this.cx,e,this.ptr,this.t),this.ptr+=e.length*le(this.t,this.cx.opts.memory.ptrType())):p(!(e instanceof Uint8Array)&&e.every(n=>n===null),"zero-width buffer written with a non-empty element"),this.progress+=e.length}};function Wa(t){if(t===null)return!0;switch(K(t).kind){case"u8":case"u16":case"u32":case"u64":case"s8":case"s16":case"s32":case"s64":case"f32":case"f64":return!0;default:return!1}}var vt=class{t;onLowered;boundStore;dropped;pendingInst;pendingBuffer;pendingOnCopy;pendingOnCopyDone;#e;whenDropped(e){if(this.#e===null){e();return}this.#e.push(e)}notifyDropped(){let e=this.#e;if(e!==null){this.#e=null;for(let n of e)try{n()}catch{}}}constructor(e){this.t=e,this.onLowered=null,this.boundStore=null,this.dropped=!1,this.pendingInst=null,this.pendingBuffer=null,this.pendingOnCopy=null,this.pendingOnCopyDone=null,this.#e=[]}resetPending(){this.setPending(null,null,null,null)}setPending(e,n,r,s){this.pendingInst=e,this.pendingBuffer=n,this.pendingOnCopy=r,this.pendingOnCopyDone=s}resetAndNotifyPending(e){let n=this.pendingOnCopyDone;p(n!==null,"reset_and_notify_pending with nothing pending"),this.resetPending(),n(e)}cancel(){this.resetAndNotifyPending(D.CANCELLED)}drop(){this.dropped||(this.dropped=!0,this.pendingBuffer&&this.resetAndNotifyPending(D.DROPPED),this.notifyDropped())}read(e,n,r,s){if(this.dropped)s(D.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#t(n),this.#n(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());n.write(this.pendingBuffer.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(D.COMPLETED)}else this.resetAndNotifyPending(D.COMPLETED),this.setPending(e,n,r,s)}write(e,n,r,s){if(this.dropped)s(D.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#t(n),this.#n(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());this.pendingBuffer.write(n.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(D.COMPLETED)}else n.isZeroLength()&&this.pendingBuffer.isZeroLength()?s(D.COMPLETED):(this.resetAndNotifyPending(D.COMPLETED),this.setPending(e,n,r,s))}#t(e){p(Me(this.t,e.t)&&Me(e.t,this.pendingBuffer.t),"stream element type mismatch between ends")}#n(e){h(e===this.pendingInst&&!Wa(this.t),"cannot read from and write to intra-component stream")}},ut=class{t;onLowered;boundStore;dropped;abandonReason;pendingInst;pendingBuffer;pendingOnCopyDone;constructor(e){this.t=e,this.onLowered=null,this.boundStore=null,this.dropped=!1,this.abandonReason=null,this.pendingInst=null,this.pendingBuffer=null,this.pendingOnCopyDone=null}resetPending(){this.setPending(null,null,null)}setPending(e,n,r){this.pendingInst=e,this.pendingBuffer=n,this.pendingOnCopyDone=r}resetAndNotifyPending(e){let n=this.pendingOnCopyDone;p(n!==null,"reset_and_notify_pending with nothing pending"),this.resetPending(),n(e)}cancel(){this.resetAndNotifyPending(D.CANCELLED)}drop(){this.dropped||(this.dropped=!0,this.pendingBuffer&&this.resetAndNotifyPending(D.DROPPED))}read(e,n,r){if(this.dropped&&this.abandonReason!==null)throw Ka(this.abandonReason);p(!this.dropped&&n.remain()===1,"future read shape"),this.pendingBuffer?(h(e===this.pendingInst&&!Wa(this.t),"cannot read from and write to intra-component future"),n.write(this.pendingBuffer.read(1)),this.resetAndNotifyPending(D.COMPLETED),r(D.COMPLETED)):this.setPending(e,n,r)}write(e,n,r){p(n.remain()===1,"future write shape"),this.dropped?r(D.DROPPED):this.pendingBuffer?(h(e===this.pendingInst&&!Wa(this.t),"cannot read from and write to intra-component future"),this.pendingBuffer.write(n.read(1)),this.resetAndNotifyPending(D.COMPLETED),r(D.COMPLETED)):this.setPending(e,n,r)}},vn=class extends Bt{shared;state;constructor(e){super(),this.shared=e,this.state=ue.IDLE}copying(){return this.state===ue.COPYING||this.state===ue.CANCELLING_COPY}drop(){h(this.copying(),"cannot drop busy stream"),this.shared.drop(),super.drop()}},ft=class extends vn{copy(e,n,r,s){this.shared.read(e,n,r,s)}},Tn=class extends vn{copy(e,n,r,s){this.shared.write(e,n,r,s)}},dt=class extends vn{copy(e,n,r){this.shared.read(e,n,r)}},Qt=class extends vn{copy(e,n,r){this.shared.write(e,n,r)}drop(){h(this.state!==ue.DONE,"cannot drop future write end without first writing a value"),super.drop()}},Xo=new WeakMap;function af(t){return typeof t=="object"&&t!==null?Xo.get(t):void 0}var ja=new WeakSet;function Ka(t){let e=new be(`future.read can never complete: ${t.message}`);return e.cause=t,e}function cf(t){return t instanceof ut?t.abandonReason:null}function lf(t,e){t.dropped||(t.abandonReason??=e,xs(t))}function xs(t){if(!t.dropped){if(t.dropped=!0,t.pendingBuffer){let e=t.pendingInst;typeof e=="object"&&e!==null&&(Oo(e)||ja.has(e))?t.resetPending():t.resetAndNotifyPending(D.DROPPED)}t instanceof vt&&t.notifyDropped()}}function Ey(t,e){if(ja.has(t))return;ja.add(t);let n=t.index!==void 0?`component instance ${t.index}`:"a component instance",r=[];for(let i of t.handles)i instanceof vn&&r.push(i);for(let i of r){let a=i.shared;Xo.get(a)===void 0&&Xo.set(a,new Error(`${n} trapped while it held an end of this stream/future; the peer can never rendezvous again`,{cause:e})),i instanceof Qt&&a instanceof ut&&i.state!==ue.DONE&&!a.dropped&&(a.abandonReason??=Xo.get(a))}let s,o=!1;for(let i of r)try{xs(i.shared)}catch(a){o||(o=!0,s=a)}if(o)throw s}Du(Ey);var et=class{debugMessage;constructor(e){this.debugMessage=e}};ye(et.prototype,kt);function Es(t,e){if(!Pe(e,kt))return`${t}: handle is not an error-context`;let n=Pt();return`${t}: this error-context was minted by a DIFFERENT deltic runtime copy and cannot be used through this one${n===""?"":` (${n})`} (contracts/embedder-api.md amendment A9, issue #83)`}function Ha(t){return or(t,e=>e.kind==="borrow")}function uf(t,e,n,r,s,o){p(!Ha(n),`${o} may not contain a borrow`);let i=t.inst;p(i!==null,`${o} lift requires a component instance`);let a=i.handles.remove(e);h(!(a instanceof r),`${o} lift: handle is not a ${o} end`);let c=a;h(!Me(c.shared.t,s),`${o} lift: element type mismatch`),h(c.state===ue.DONE,o==="future"?"cannot lift future after previous read succeeded":"cannot lift stream after being notified that the writable end dropped"),h(c.state!==ue.IDLE,`cannot remove busy ${o}`),h(c.inWaitableSet(),`cannot lift ${o} while it's in a waitable set`);let l=c.shared,u=i.store;if(l.boundStore!=null&&u!=null){let f=Pt();p(l.boundStore===u,`${o} crossed into a second store; multi-store is unsupported`+(f===""?"":` (${f} \u2014 a value from one copy cannot be lowered through another)`))}return l.boundStore??=u,c.shared}function Zo(t,e,n){return uf(t,e,n,ft,n.element,"stream")}function Qo(t,e,n){return uf(t,e,n,dt,n.element,"future")}function Jo(t,e,n){p(e instanceof vt,"lower_stream expects a shared stream value"),p(!Ha(n),"stream may not contain a borrow");let r=n.element??null;Me(e.t,r)||p(!1,`stream element type mismatch: host end carries ${Ie(e.t)}, callee expects ${Ie(r)}`);let s=t.inst;return p(s!==null,"stream lower requires a component instance"),e.boundStore??=s.store,e.onLowered?.(s),s.handles.add(new ft(e))}function qo(t,e,n){p(e instanceof ut,"lower_future expects a shared future value"),p(!Ha(n),"future may not contain a borrow");let r=n.element??null;Me(e.t,r)||p(!1,`future element type mismatch: host end carries ${Ie(e.t)}, callee expects ${Ie(r)}`);let s=t.inst;return p(s!==null,"future lower requires a component instance"),e.boundStore??=s.store,e.onLowered?.(s),s.handles.add(new dt(e))}function ei(t,e){let n=t.inst;p(n!==null,"error-context lift requires a component instance");let r=n.handles.get(e);return h(!(r instanceof et),Es("error-context lift",r)),r}function Go(t,e){let n=t.inst;return p(n!==null,"error-context lower requires a component instance"),n.handles.add(e)}var vy=(1<<28)-1;function vs(t,e,n){let r=N(t.opts);p(e===ce(e,xe(n,r.ptrType())),"load misaligned"),p(e+le(n,r.ptrType())<=r.length,"load OOB");let s=K(n);switch(s.kind){case"bool":return za(ke(r,e,1));case"u8":return ke(r,e,1);case"u16":return ke(r,e,2);case"u32":return ke(r,e,4);case"u64":return ke(r,e,8);case"s8":return fs(r,e,1);case"s16":return fs(r,e,2);case"s32":return fs(r,e,4);case"s64":return fs(r,e,8);case"f32":return hs(ke(r,e,4));case"f64":return Po(ke(r,e,8));case"char":return Ho(ke(r,e,4));case"string":return ef(t,e);case"error-context":return ei(t,ke(t.opts.memory,e,4));case"list":return Ty(t,e,s.element,s.length??null);case"record":return Sy(t,e,s.fields);case"variant":return $y(t,e,s.cases);case"flags":return Ay(t,e,s.labels);case"own":return Mo(t,ke(r,e,4),s);case"borrow":return Uo(t,ke(r,e,4),s);case"stream":return Zo(t,ke(t.opts.memory,e,4),s);case"future":return Qo(t,ke(t.opts.memory,e,4),s)}}function za(t){return p(t>=0),!!t}function Ty(t,e,n,r){if(r!==null)return Yo(t,e,r,n);let s=N(t.opts),o=cr(s,e),i=cr(s,e+s.ptrSize());return Va(t,o,i,n)}function Va(t,e,n,r){let s=N(t.opts),o=le(r,s.ptrType()),i=xe(r,s.ptrType()),a=BigInt(n)*BigInt(o);h(a>BigInt(vy),"list too long");let c=BigInt(e);return h(c%BigInt(i)!==0n,"misaligned list pointer"),h(c+a>BigInt(s.length),"list out of bounds"),Yo(t,Number(c),Number(n),r)}function Yo(t,e,n,r){let s=N(t.opts),o=K(r).kind;if(o==="u8")return Nt(s,e,n).slice();let i=sf(s,e,n,o);if(i!==null)return i;let a=le(r,s.ptrType()),c=[];for(let l=0;l=n.length,"invalid variant discriminant");let a=n[o];return i=ce(i,lr(n,r.ptrType())),a.type===null?{[a.label]:null}:{[a.label]:vs(t,i,a.type)}}function Ay(t,e,n){let r=N(t.opts),s=ke(r,e,ds(n));return Ja(s,n)}function Ja(t,e){let n={},r=t>>>0;for(let s of e)n[s]=!!(r&1),r=r>>>1;return n}var Sn=16,qa=4,br=1;function Ga(t,e,n){let r=Ts(e.params,t),s=Ts(e.results,t);if(t.async_){switch(n){case"lift":r.length>Sn&&(r=[N(t).ptrType()]),t.callback?s=["i32"]:s=[];break;case"lower":r.length>qa&&(r=[N(t).ptrType()]),s.length>0&&(r=[...r,N(t).ptrType()]),s=["i32"];break}return{params:r,results:s}}else{if(r.length>Sn&&(r=[N(t).ptrType()]),s.length>br)switch(n){case"lift":s=[N(t).ptrType()];break;case"lower":r=[...r,N(t).ptrType()],s=[];break}return{params:r,results:s}}}function Ts(t,e){return t.flatMap(n=>$n(n,e))}function $n(t,e){let n=K(t);switch(n.kind){case"bool":case"u8":case"u16":case"u32":case"s8":case"s16":case"s32":case"char":return["i32"];case"s64":case"u64":return["i64"];case"f32":return["f32"];case"f64":return["f64"];case"string":{let r=N(e).ptrType();return[r,r]}case"error-context":return["i32"];case"list":return Iy(n.element,n.length??null,e);case"record":return Cy(n.fields,e);case"variant":return Ss(n.cases,e);case"flags":return["i32"];case"own":case"borrow":case"stream":case"future":return["i32"]}}function Iy(t,e,n){if(e!==null){let s=[],o=$n(t,n);for(let i=0;i{o=2**(e-1)?r-2**e:r}function Ly(t){let e=t.next("i64");return p(0n<=e&&e<1n<<64n),e>=1n<<63n?e-(1n<<64n):e}function Ny(t,e){let n=N(t.opts).ptrType(),r=e.next(n),s=e.next(n);return bs(t,r,s)}function Oy(t,e,n,r){if(r!==null){let a=[];for(let c=0;c=n.length,"invalid variant discriminant");let o={next(c){let l=r.shift(),u=e.next(l);return l==="i32"&&c==="f32"?hs(u):l==="i64"&&c==="i32"?ff(u):l==="i64"&&c==="f32"?hs(ff(u)):l==="i64"&&c==="f64"?Po(u):(p(l===c,`lane mismatch ${l} -> ${c}`),u)}},i=n[s],a;i.type===null?a=null:a=$s(t,o,i.type);for(let c of r)e.next(c);return{[i.label]:a}}function ff(t){return p(0n<=t&&t<1n<<64n),Number(t&0xffffffffn)}function Fy(t,e){p(0 ${d}`)}}for(let c of o)a.push(c==="i64"?0n:0);return[r,...a]}function Hy(t,e){return p(0e){let o=N(t.opts),i=n.next(o.ptrType()),a={kind:"tuple",elements:r},c=xe(a,o.ptrType()),l=le(a,o.ptrType());h(BigInt(i)%BigInt(c)!==0n,"misaligned spill pointer"),h(BigInt(i)+BigInt(l)>BigInt(o.length),"spill tuple out of bounds");let u=$a(i),f=vs(t,u,a);return Object.values(f)}else return r.map(o=>$s(t,n,o))}function Za(t,e,n,r,s=null){if(Ts(r,t.opts).length>e){let i=N(t.opts),a={kind:"tuple",elements:r},c={};n.forEach((w,y)=>{c[String(y)]=w});let l,u,f=xe(a,i.ptrType()),d=le(a,i.ptrType());return s===null?(l=t.allocate(f,d),u=i.ptrType()==="i32"?[l]:[BigInt(l)]):(l=$a(s.next(i.ptrType())),u=[]),h(l!==ce(l,f),"misaligned spill pointer"),h(l+d>i.length,"spill tuple out of bounds"),Zt(t,c,a,l),u}else{let i=[];for(let a=0;a!0)}awaiting;resumeWith(e,n){p(this.awaiting!==null,"resumeWith on a thread that is not awaiting"),this.awaiting=null,this.#s.awaiting.delete(this),this.#e="suspended";let r=this.task.inst;if(!Oo(r)){p(r.mayEnterFrom(null),"resumeWith: parked thread's instance is not enterable from the host"),r.enterFrom(null);try{this.#i(e,n)}catch(s){throw s instanceof ze||s instanceof Fe?r.leaveTo(null):(r.releaseSyntheticRootOnPoison(),_t(r,s)),s}r.leaveTo(null)}}resume(e=_u){p(!this.running()&&!this.done(),"resume() on a running or finished thread"),p(this.cancellable||!e,"cancelled resume of a non-cancellable block point"),this.waiting()&&this.#o(e),this.#i(e)}#i(e,n){this.#e="running",Fu(this);let r;try{r=n===void 0?this.#t.next(e):this.#t.throw(n.error)}catch(o){throw this.#e="done",o}finally{Bu(this)}if(r.done){this.#e="done";return}let s=r.value;if(this.cancellable=s.cancellable,s.awaitValue!==void 0){this.#e="suspended",this.awaiting=s.awaitValue,this.#s.noteAwaiting(this,s.awaitValue);return}s.readyFunc===null?this.#e="suspended":(this.#e="suspended",this.#r(s.readyFunc))}*waitUntil(e,n=!1){return p(this.running(),"waitUntil on a non-running thread"),this.task.deliverPendingCancel(n)?fr:yield{readyFunc:e,cancellable:n}}*suspend(e){return p(this.running(),"suspend on a non-running thread"),this.task.deliverPendingCancel(e)?fr:yield{readyFunc:null,cancellable:e}}*yield_(e){return yield*this.waitUntil(()=>!0,e)}};var ne=function(t){return t[t.STARTING=0]="STARTING",t[t.STARTED=1]="STARTED",t[t.RETURNED=2]="RETURNED",t[t.CANCELLED_BEFORE_STARTED=3]="CANCELLED_BEFORE_STARTED",t[t.CANCELLED_BEFORE_RETURNED=4]="CANCELLED_BEFORE_RETURNED",t}({}),Tt=class extends Bt{state=ne.STARTING;onCancel=null;cancellationRequested=!1;flatResults=[];calleeTask=null;lenders=[];resolved(){switch(this.state){case ne.STARTING:case ne.STARTED:return!1;default:return!0}}addLender(e){p(!this.resolveDelivered()&&!this.resolved(),"addLender on a resolved subtask"),e.numLends+=1,this.lenders.push(e)}resolve(e,n){p(e===ne.RETURNED||n.length===0,"non-RETURNED subtask resolution carries results"),p(!this.resolved(),"resolve on an already-resolved subtask"),this.state=e,this.flatResults=n}deliverResolve(){p(!this.resolveDelivered()&&this.resolved(),"deliverResolve on an unresolved or already-delivered subtask");for(let e of this.lenders)e.numLends-=1;this.lenders=null}resolveDelivered(){return p(this.lenders!==null||this.resolved(),"lenders released on an unresolved subtask"),this.lenders===null}unwindLenders(){this.resolved()||this.resolve(this.state===ne.STARTING?ne.CANCELLED_BEFORE_STARTED:ne.CANCELLED_BEFORE_RETURNED,[]),this.resolveDelivered()||this.deliverResolve()}drop(){h(!this.resolveDelivered(),"cannot drop a subtask which has not yet resolved"),super.drop()}setSubtaskPendingEvent(e){this.setPendingEvent(()=>(this.resolved()&&!this.resolveDelivered()&&this.deliverResolve(),[te.SUBTASK,e,this.state]))}};function ti(t,e){return p(e>0&&e<=2**28-1,"subtask index out of packing range"),p(t>=0&&t<2**4,"subtask state out of packing range"),(t|e<<4)>>>0}var df=new WeakMap,pf=-1,hf=Symbol("synthetic-root"),ni=class t{index;flags;handles=new gs;threads=new gs;mayEnter=!0;backpressure=0;numWaitingToEnter=0;exclusiveThread=null;parent;store;static rootOf(e){let n=df.get(e);return n===void 0&&(n=new t(pf,e,hf),df.set(e,n)),n}get isSyntheticRoot(){return this.index===pf&&this.parent===null}constructor(e,n,r){this.index=e,this.store=n??new ur,this.flags=new WebAssembly.Global({value:"i32",mutable:!0},1),this.parent=r===hf?null:t.rootOf(this.store)}releaseSyntheticRootOnPoison(){for(let e of this.selfAndAncestors())e.isSyntheticRoot&&(e.mayEnter=!0)}get mayLeave(){return this.flags.value!==0}set mayLeave(e){this.flags.value=e?1:0}selfAndAncestors(){let e=new Set([this]),n=this.parent;for(;n!==null;)e.add(n),n=n.parent;return e}enteringSet(e){let n=this.selfAndAncestors();if(e===null)return n;for(let r of e.selfAndAncestors())n.delete(r);return n}mayEnterFrom(e){for(let n of this.enteringSet(e))if(!n.mayEnter)return!1;return!0}enterFrom(e){for(let n of this.enteringSet(e))p(n.mayEnter,"enter_from without may_enter"),n.mayEnter=!1}leaveTo(e){for(let n of this.enteringSet(e))p(!n.mayEnter,"leave_to without a matching enter_from"),n.mayEnter=!0}enter(){this.enterFrom(null)}leave(){this.leaveTo(null)}};function mf(t,e){return t.stringEncoding===e.stringEncoding&&t.memory===e.memory}var zy=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})(),kr=class{ft;opts;inst;onStart;onResolve;state;numBorrows;implicitThread;threads;factPassthrough;factResultTypesKnown;constructor(e,n,r,s,o){this.ft=e,this.opts=n,this.inst=r,this.onStart=s,this.onResolve=o,this.state="initial",this.numBorrows=0,this.implicitThread=null,this.threads=[],this.factPassthrough=!1,this.factResultTypesKnown=!1}needsExclusive(){return p(this.ft.async===!0,"needs_exclusive on a sync-typed task"),!this.opts.async_||this.opts.callback}*enterImplicitThread(e){if(p(this.state==="initial","enter_implicit_thread after start"),this.implicitThread=e,this.ft.async===!0){let n=()=>this.inst.backpressure>0||this.needsExclusive()&&this.inst.exclusiveThread!==null;if(n()||this.inst.numWaitingToEnter>0){this.inst.numWaitingToEnter+=1;let r;try{r=yield*e.waitUntil(()=>!n(),!0)}finally{this.inst.numWaitingToEnter-=1}if(r)return this.cancel(),!1}this.needsExclusive()&&(p(this.inst.exclusiveThread===null,"entering with the exclusive thread already taken"),this.inst.exclusiveThread=e)}return zy&&console.error(`[admit] task=${Ee(this)} thread=${Ee(e)}`),this.registerThread(e),!0}registerThread(e){p(!this.threads.includes(e)&&e.task===this,"register_thread of a foreign or duplicate thread"),this.threads.push(e),p(e.index===null,"register_thread of an indexed thread"),e.index=this.inst.threads.add(e)}exitImplicitThread(e){p(e===this.implicitThread,"exit of a non-implicit thread"),this.unregisterThread(e),this.ft.async===!0&&this.needsExclusive()&&(p(this.inst.exclusiveThread===e,"exit_implicit_thread without holding the exclusive thread"),this.inst.exclusiveThread=null)}unregisterThread(e){let n=this.threads.indexOf(e);p(n!==-1&&e.task===this,"unregister of a foreign thread"),this.threads.splice(n,1),this.threads.length===0&&(h(this.state!=="resolved","task finished all threads without resolving"),p(this.numBorrows===0,"task exited with live borrows")),p(e.index!==null,"unregister of an unindexed thread"),this.inst.threads.remove(e.index),e.index=null}requestCancellation(e){if(this.state==="initial"){this.state="cancel-delivered",this.implicitThread.resume(fr);return}p(this.state==="started",`request_cancellation in state ${this.state}`);let n=this.threads.filter(s=>s.cancellable),r=this.ft.async===!0&&this.needsExclusive()&&this.inst.exclusiveThread!==null&&this.inst.exclusiveThread!==this.implicitThread;if(r&&(n=n.filter(s=>s!==this.implicitThread)),!r){let s=this.inst.store;for(let o of s.waiting)o.task===this&&o.cancellable===!0&&!n.includes(o)&&n.push(o)}if(n.length>0&&this.inst.mayEnterFrom(e)){this.state="cancel-delivered",this.inst.enterFrom(e);try{dr(n).resume(fr)}finally{this.inst.leaveTo(e)}}else this.state="pending-cancel"}deliverPendingCancel(e){return e&&this.state==="pending-cancel"?(this.state="cancel-delivered",!0):!1}start(){return p(this.state==="initial","start on a started task"),this.state="started",this.onStart()}return_(e){h(this.state==="resolved","task.return on a resolved task"),h(this.numBorrows>0,"task returned with live borrows"),this.onResolve(e),this.state="resolved"}cancel(){h(this.state!=="cancel-delivered","task.cancel without a delivered cancellation request"),h(this.numBorrows>0,"task cancelled with live borrows"),this.onResolve(null),this.state="resolved"}};function ri(){let t=WebAssembly;return typeof t.promising=="function"&&typeof t.Suspending=="function"?t:null}function Cs(){return typeof globalThis.WebAssembly=="object"&&ri()!==null}function yf(){if(!Cs())throw new Error("JSPI (WebAssembly.promising / WebAssembly.Suspending) is not available in this engine; see docs/architecture.md \xA73 for the compatibility floor (no fallback path exists).")}function wf(t){return yf(),ri().promising(t)}function gf(t){return yf(),new(ri()).Suspending(t)}function bf(t,e){return t===!1?"plain":(t===!0||e===!0)&&Cs()?"jspi":"plain"}function si(t,e){switch(t.kind){case"sync-start-call":case"waitable-set-wait":case"thread-yield":return!0;case"subtask-cancel":case"stream-cancel-read":case"stream-cancel-write":case"future-cancel-read":case"future-cancel-write":return t.async!==!0;case"stream-read":case"stream-write":case"future-read":case"future-write":return typeof t.options=="number"?!e(t.options):!0;default:return!1}}function kf(t,e){return t.kind==="async-start-call"||t.kind==="subtask-cancel"||si(t,e)}function xf(t){for(let n of t.canonicalOptions)if(n.async&&n.callback===null)return!0;let e=n=>t.canonicalOptions[n]?.async===!0;for(let n of t.trampolines)if(si(n,e))return!0;return!1}function en(t,e){return e==="plain"?t:(p(Cs(),"jspi mode selected on an engine without JSPI"),wf(t))}function Qa(t){t!=null&&Vy.then(()=>pr(t))}var Vy=Promise.resolve();function Jy(t,e){return Promise.resolve(e).then(n=>(Qa(t),n),n=>{throw Qa(t),n})}function nc(t,e){return e==="plain"?t:(p(Cs(),"jspi mode selected on an engine without JSPI"),gf((...r)=>{let s=Ft()??null,o=()=>t(...r),i;try{i=s===null?o():_o(s,o)}catch(a){throw pr(s),a}return i===null||typeof i?.then!="function"?(pr(s),Qa(s),i):(ec&&console.error(`[sp] hop-suspend owner=${Ee(s)} promise=${Ee(i)}`),Jy(s,i))}))}function Ef(t,e,n){if(t==="plain"){p(!e&&!n,`plain mode with wrapped entries=${e} / imports=${n} \u2014 wrapping ran under the wrong mode`);return}p(e||!n,`suspension mode jspi wrapped imports without wrapping any entry (entries=${e}, imports=${n}) \u2014 a Suspending import reached from a non-promising activation traps unconditionally (jspi pin (c))`)}var ec=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})(),tc=class{task;readyFunc;cancellable;produce;onSettled;promise;#e;#t;#n;#s;#r;owner;constructor(e,n,r,s,o,i,a){this.task=n,this.readyFunc=r,this.cancellable=s,this.produce=o,this.onSettled=a,this.#n=!1,this.#s=!1,this.#r=e,this.owner=i??Ft()??n?.implicitThread??null,ec&&console.error(`[sp] mint ${Ee(this)} owner=${Ee(this.owner)} task=${Ee(this.task)} +`)}`)}var Uu=new WeakMap,py=1;function ve(t){if(t==null||typeof t!="object")return String(t);let e=Uu.get(t);return e===void 0&&(e=py++,Uu.set(t,e)),`T${e}`}function Ba(t){if(t==null)return;Bo&&Fa("release",t);let e=Oe.indexOf(t);if(e===-1){let n=t?.task?.implicitThread;if(n==null||(e=Oe.indexOf(n),e===-1))return}Oe.splice(e,1)}var Te=null;function bs(t){Bo&&Fa("set-resuming",t),p(Te===null||Te===t,"two activations claim the resumed ambient at once \u2014 the resolve-one-per-turn discipline was violated"),Te=t}function En(){return Te!==null}function Vu(){Te=null}function Ma(){Te!==null&&dy()===Te&&(Te=null)}function Wu(t){Ba(t),Te!==null&&(Te===t||t?.task?.implicitThread===Te)&&(Te=null)}var Bo=(()=>{try{return Deno.env.get("CE_AMBIENT_TRACE")==="1"}catch{return!1}})();function Ju(){return{stack:[...Dt],claims:[...Oe],resuming:Te}}function qu(){return Dt[Dt.length-1]??Oe[Oe.length-1]??Te??void 0}function wr(){Bo&&Dt.length===0&&console.error(`[ambient] bracket empty; claims=${Oe.length} head=${Oe[0]?.constructor?.name??"none"} resuming=${Te?.constructor?.name??"none"}`);let t=qu();if(t===void 0)throw new Be("instantiation-time task context \u2014 a task-scoped canonical built-in ran outside any task (a core start function calling task.return / task.cancel / thread.yield / subtask.*; see test/async/dont-block-start.wast)");return t}function Mt(){return qu()}function _e(){return wr().task}function Gu(){return Mt()?.task??null}var pr=class{waiting=[];nestingDepth=0;pendingHostCalls=new Set;hostFailure=void 0;startWaiting(e){p(!this.waiting.includes(e),"thread already in the waiting list"),this.waiting.push(e)}stopWaiting(e){let n=this.waiting.indexOf(e);p(n!==-1,"thread not in the waiting list"),this.waiting.splice(n,1)}readyCandidates(){return this.waiting.filter(e=>e.ready())}awaiting=new Set;settled=[];noteAwaiting(e,n){this.awaiting.add(e),n.then(r=>{this.settled.push({t:e,value:r,failure:void 0}),Wu(e)},r=>{this.settled.push({t:e,value:void 0,failure:{error:r}}),Wu(e)})}serviceSettled(){let e=!1;for(;this.settled.length>0;){let n=this.settled.shift();this.awaiting.has(n.t)&&(n.t.resumeWith(n.value,n.failure),e=!0)}return e}hasRunnableWork(e,n){let r=i=>i?.task?.inst,s=i=>r(i)===e&&i?.task!==n;for(let i of this.settled)if(s(i.t))return!0;for(let i of this.waiting)if(s(i)&&i.ready())return!0;if(this.awaiting.size===0)return!1;let o=new Set;for(let i of this.waiting){let a=i.owner;a!=null&&o.add(a)}for(let i of this.awaiting)if(s(i)&&!o.has(i))return!0;return!1}tick(){if(Te!==null||this.settled.length>0)return!1;let e=this.readyCandidates();if(e.length===0)return!1;let n=mr(e),r=n.task.inst;p(r.mayEnterFrom(null),"tick: waiting thread's instance is not enterable from the host"),r.enterFrom(null);try{n.resume()}catch(s){throw s instanceof Ve||s instanceof Be?r.leaveTo(null):(r.releaseSyntheticRootOnPoison?.(),Da?.(r,s)),s}return r.leaveTo(null),!0}},Ua=new WeakSet;function Xu(t){Ua.add(t)}function Mo(t){for(let e of t.pendingHostCalls)if(!Ua.has(e))return!0;return!1}function Yu(t){let e=[];for(let n of t.pendingHostCalls)Ua.has(n)||e.push(n);return e}function gr(t){return t.settled.length===0&&t.awaiting.size===0&&!Mo(t)}function Zu(t){for(;t.state!=="resolved";){let e=[...t.inst.threads].filter(n=>n.ready()&&n!==t.inst.exclusiveThread);h(e.length===0,"deadlock: synchronous task cannot resolve and no thread is ready"),mr(e).resume()}}var ks=class t{static MAX_LENGTH=2**28-1;array=[null];free=[];get(e){return h(e>=this.array.length,"table index out of range"),h(this.array[e]===null,"table entry empty"),this.array[e]}add(e){let n;return this.free.length>0?(n=this.free.pop(),p(this.array[n]===null),this.array[n]=e):(n=this.array.length,h(n>t.MAX_LENGTH,"table full"),this.array.push(e)),n}remove(e){let n=this.get(e);return this.array[e]=null,this.free.push(e),n}*[Symbol.iterator](){for(let e of this.array)e!==null&&(yield e)}},Me=class{rt;rep;own;borrowScope;numLends;constructor(e,n,r,s=null){this.rt=e,this.rep=n,this.own=r,this.borrowScope=s,this.numLends=0}};function Uo(t){return p(t.inst!==null,"context requires a component instance"),t.inst}function Wo(t,e,n){let r=Uo(t).handles.remove(e);h(!(r instanceof Me),"not a resource handle");let s=r;return h(s.rt!==n.rt,"resource type mismatch"),h(s.numLends!==0,"handle still lent out"),h(!s.own,"expected own handle"),s.rep}function jo(t,e,n){let r=t.borrowScope;p(r!==null&&typeof r.addLender=="function","lifting a borrow requires a subtask borrow scope");let s=Uo(t).handles.get(e);h(!(s instanceof Me),"not a resource handle");let o=s;return h(o.rt!==n.rt,"resource type mismatch"),r.addLender(o),o.rep}function Ko(t,e,n){let r=new Me(n.rt,e,!0);return Uo(t).handles.add(r)}function Ho(t,e,n){let r=t.borrowScope;if(p(r!==null&&typeof r.numBorrows=="number","lowering a borrow requires a task borrow scope"),t.inst!==null&&t.inst===n.rt.impl)return e;let s=new Me(n.rt,e,!1,r);return r.numBorrows+=1,Uo(t).handles.add(s)}function tf(t,e,n){h(!t.mayLeave,"may_leave violation");let r=new Me(e,n,!0);return t.handles.add(r)}function Qu(t){if(t===null||typeof t!="object")return null;let e=t;return typeof e.mayEnterFrom=="function"&&typeof e.enterFrom=="function"&&typeof e.leaveTo=="function"?t:null}function ef(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"}function br(t,e,n,r=!1){let s=Qu(t.impl),o=r?t.dtorHost??t.dtor:t.dtor;if(s===null){let l=o?.(e);h(!r&&ef(l),"resource destructor did not complete synchronously");return}let i=Qu(n)===null?null:n;s.mayEnterFrom(i)||pe(Bt(s,"cannot enter component instance")),s.enterFrom(i);let a=l=>{if(l instanceof Ve||l instanceof Be){s.leaveTo(i);return}Ft(s,l)},c;try{c=o?.(e)}catch(l){throw a(l),l}if(ef(c)){if(!r){let f=new ke("resource destructor did not complete synchronously");throw a(f),f}let l=s.store,u=Promise.resolve(c).then(()=>{l?.pendingHostCalls.delete(u),s.leaveTo(i)},f=>{l?.pendingHostCalls.delete(u),l!==void 0&&l.hostFailure===void 0&&(l.hostFailure=f),a(f)});l?.pendingHostCalls.add(u);return}s.leaveTo(i)}function nf(t,e,n){h(!t.mayLeave,"may_leave violation");let r=t.handles.remove(n);h(!(r instanceof Me),"not a resource handle");let s=r;h(s.rt!==e,"resource type mismatch"),h(s.numLends!==0,"handle still lent out"),s.own?(p(s.borrowScope===null),br(e,s.rep,t)):(p(s.borrowScope!==null),s.borrowScope.numBorrows-=1)}function rf(t,e,n){let r=t.handles.get(n);h(!(r instanceof Me),"not a resource handle");let s=r;return h(s.rt!==e,"resource type mismatch"),s.rep}var Tn=2**32-1,vn="realloc return: result not aligned",Tt="realloc return: beyond end of memory",hy=(1<<28)-1;function sf(t){return 1n<BigInt(hy),"string too long");let l=Number(a),u=BigInt(e);h(u%BigInt(i)!==0n,"misaligned string pointer"),vt(r,u,a,"string pointer/length out of bounds of memory");let f=Number(u),d=_t(r,f,l);try{switch(c){case"utf-8":return my.decode(d);case"utf-16-le":return yy.decode(d);case"latin-1":return gy(d)}}catch{pe(c==="utf-8"?by(d):"invalid string encoding")}}function by(t){let e="invalid utf-8",n="incomplete utf-8 byte sequence",r=0;for(;r=194&&s<=223)o=2;else if(s===224)o=3,i=160;else if(s>=225&&s<=236)o=3;else if(s===237)o=3,a=159;else if(s>=238&&s<=239)o=3;else if(s===240)o=4,i=144;else if(s>=241&&s<=243)o=4;else if(s===244)o=4,a=143;else return e;for(let c=1;c=t.length)return n;let l=t[r+c],u=c===1?i:128,f=c===1?a:191;if(lf)return e}r+=o}return e}function zo(t,e,n){let r=L(t.opts),[s,o]=Wa(t,e);ee(r,r.ptrSize()===4?Number(o):o,n+r.ptrSize(),r.ptrSize()),ee(r,r.ptrSize()===4?s:BigInt(s),n,r.ptrSize())}function Wa(t,e){let n=e.length;switch(t.opts.stringEncoding){case"utf8":return xy(t,e,n);case"utf16":return ky(t,e,n);case"latin1+utf16":return vy(t,e,n)}}function ky(t,e,n){let r=L(t.opts),s=2*n;p(s<=Tn);let o=t.allocate(2,s);h(o!==ae(o,2),vn),vt(r,o,s,Tt);let i=af(e);return p(s===i.length),Lo(r,o,i),[o,BigInt(n)]}function xy(t,e,n){let r=n*3;return Ey(t,e,n,r)}function Ey(t,e,n,r){let s=L(t.opts);p(n<=Tn);let o=t.allocate(1,n);vt(s,o,n,Tt);for(let i=0;ic.length&&(o=t.reallocate(o,r,1,c.length),vt(s,o,c.length,Tt)),[o,BigInt(c.length)]}}return[o,BigInt(n)]}function vy(t,e,n){let r=L(t.opts),s=of(e);p(n<=Tn);let o=t.allocate(2,n);h(o!==ae(o,2),vn),vt(r,o,n,Tt);let i=0;for(let a=0;a=0;d--)r.bytes[o+2*d]=r.bytes[o+d],r.bytes[o+2*d+1]=0;let u=af(s);Lo(r,o+2*i,u.subarray(2*i)),l>u.length&&(o=t.reallocate(o,l,2,u.length),h(o!==ae(o,2),vn),vt(r,o,u.length,Tt));let f=BigInt(u.length/2)|sf(r.ptrType());return[o,f]}}return i=0),h(t>=1114112,"char out of range"),h(55296<=t&&t<=57343,"char is a surrogate"),String.fromCodePoint(t)}function Jo(t){let e=t.codePointAt(0);return p(e!==void 0,"empty char"),p(t.length===(e>65535?2:1),"char must be one code point"),p(0<=e&&e<=55295||57344<=e&&e<=1114111,"char must be a Unicode scalar value"),e}var Sy=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,lf={s8:Int8Array,u16:Uint16Array,s16:Int16Array,u32:Uint32Array,s32:Int32Array},uf={u64:BigUint64Array,s64:BigInt64Array},ff={f32:Float32Array,f64:Float64Array};function kr(t,e,n,r){if(!Sy)return null;let s=e.bytes.byteOffset+n;return s%t.BYTES_PER_ELEMENT!==0?null:new t(e.bytes.buffer,s,r)}function df(t,e,n,r){if(r==="bool"){let a=new Array(n),c=_t(t,e,n);for(let l=0;lr.length,Tt),qo(t,e,i,n),[i,e.length]}function qo(t,e,n,r){let s=L(t.opts),o=K(r).kind;if(o==="u8"){let a=_t(s,n,e.length);if(e instanceof Uint8Array){a.set(e);return}for(let c=0;co.label===r?[i]:[]);return p(s.length===1,`variant case '${r}' not found`),[s[0],t[r]]}function Ay(t,e,n,r){let s=L(t.opts),[o,i]=Ka(e,r),a=ce(Ot(r),s.ptrType());ee(s,o,n,a);let c=n+a;c=ae(c,dr(r,s.ptrType()));let l=r[o];l.type!==null&&en(t,i,l.type,c)}function Cy(t,e,n,r){let s=L(t.opts),o=Ha(e,r);ee(s,o,n,hs(r))}function Ha(t,e){let n=0,r=0;for(let s of e)n=(n|(t[s]?1:0)<>>0,r+=1;return n}var te=function(t){return t[t.NONE=0]="NONE",t[t.SUBTASK=1]="SUBTASK",t[t.STREAM_READ=2]="STREAM_READ",t[t.STREAM_WRITE=3]="STREAM_WRITE",t[t.FUTURE_READ=4]="FUTURE_READ",t[t.FUTURE_WRITE=5]="FUTURE_WRITE",t[t.TASK_CANCELLED=6]="TASK_CANCELLED",t}({}),SE=[te.NONE,0,0],Ut=class{pendingEvent=null;wset=null;hasSyncWaiter=!1;setPendingEvent(e){this.pendingEvent=e}hasPendingEvent(){return this.pendingEvent!==null}inWaitableSet(){return this.wset!==null}*waitForPendingEvent(e){p(!this.inWaitableSet()&&!this.hasSyncWaiter,"waitForPendingEvent on a joined or already-awaited waitable"),this.hasSyncWaiter=!0,yield*e.waitUntil(()=>this.hasPendingEvent(),!1),this.hasSyncWaiter=!1}getPendingEvent(){let e=this.pendingEvent;return p(e!==null,"getPendingEvent with no pending event"),this.pendingEvent=null,e()}join(e){if(p(!this.hasSyncWaiter,"join on a waitable with a sync waiter"),this.wset){let n=this.wset.elems.indexOf(this);p(n!==-1,"waitable not in its own waitable set"),this.wset.elems.splice(n,1)}this.wset=e,e&&e.elems.push(this)}drop(){p(!this.hasPendingEvent(),"dropping a waitable with a pending event"),p(!this.hasSyncWaiter,"dropping a waitable with a sync waiter"),this.join(null)}},Ry=(()=>{try{return Deno.env.get("CE_EVENT_TRACE")==="1"}catch{return!1}})(),Wt=class{elems=[];numWaiting=0;hasPendingEvent(){return this.elems.some(e=>e.hasPendingEvent())}getPendingEvent(){let e=this.elems.filter(s=>s.hasPendingEvent());p(e.length>0,"getPendingEvent on a set with no pending event");let n=mr(e);p(n.wset===this,"waitable/waitable-set back-reference mismatch");let r=n.getPendingEvent();return Ry&&console.error(`[event] deliver code=${r[0]} idx=${r[1]} payload=${r[2]} readyCount=${e.length} setSize=${this.elems.length} chosenPos=${this.elems.indexOf(n)}`),r}*waitForEventAnd(e,n,r){this.numWaiting+=1;try{return(yield*e.waitUntil(()=>n()&&this.hasPendingEvent(),r))?[te.TASK_CANCELLED,0,0]:this.getPendingEvent()}finally{this.numWaiting-=1}}*waitForEvent(e,n){return yield*this.waitForEventAnd(e,()=>!0,n)}poll(e,n){return e.deliverPendingCancel(n)?[te.TASK_CANCELLED,0,0]:this.hasPendingEvent()?this.getPendingEvent():[te.NONE,0,0]}drop(){h(this.elems.length>0,"cannot drop waitable set with waitables"),h(this.numWaiting>0,"cannot drop waitable set with waiters")}};function Ue(t,e){return t===null||e===null?t===e:He(t,e)}var xr=2**28-1,D=function(t){return t[t.COMPLETED=0]="COMPLETED",t[t.DROPPED=1]="DROPPED",t[t.CANCELLED=2]="CANCELLED",t}({}),le=function(t){return t[t.IDLE=1]="IDLE",t[t.COPYING=2]="COPYING",t[t.CANCELLING_COPY=3]="CANCELLING_COPY",t[t.DONE=4]="DONE",t}({}),Es=class{t;cx;ptr;length;progress;constructor(e,n,r,s){if(this.t=e,this.cx=n,this.ptr=r,this.length=s,this.progress=0,h(s>xr,"buffer length exceeds MAX_LENGTH"),e!==null&&s>0){let o=n.opts.memory;p(o!==null,"buffer requires a memory");let i=o.ptrType();h(r!==ae(r,Ee(e,i)),"unaligned buffer pointer"),h(r+s*ce(e,i)>o.length,"buffer out of bounds")}}remain(){return this.length-this.progress}isZeroLength(){return this.length===0}read(e){p(e<=this.remain(),"buffer read beyond remaining");let n;return this.t!==null?(n=Qo(this.cx,this.ptr,e,this.t),this.ptr+=e*ce(this.t,this.cx.opts.memory.ptrType())):n=new Array(e).fill(null),this.progress+=e,n}write(e){p(e.length<=this.remain(),"buffer write beyond remaining"),this.t!==null?(qo(this.cx,e,this.ptr,this.t),this.ptr+=e.length*ce(this.t,this.cx.opts.memory.ptrType())):p(!(e instanceof Uint8Array)&&e.every(n=>n===null),"zero-width buffer written with a non-empty element"),this.progress+=e.length}};function za(t){if(t===null)return!0;switch(K(t).kind){case"u8":case"u16":case"u32":case"u64":case"s8":case"s16":case"s32":case"s64":case"f32":case"f64":return!0;default:return!1}}var St=class{t;onLowered;boundStore;dropped;pendingInst;pendingBuffer;pendingOnCopy;pendingOnCopyDone;#e;whenDropped(e){if(this.#e===null){e();return}this.#e.push(e)}notifyDropped(){let e=this.#e;if(e!==null){this.#e=null;for(let n of e)try{n()}catch{}}}constructor(e){this.t=e,this.onLowered=null,this.boundStore=null,this.dropped=!1,this.pendingInst=null,this.pendingBuffer=null,this.pendingOnCopy=null,this.pendingOnCopyDone=null,this.#e=[]}resetPending(){this.setPending(null,null,null,null)}setPending(e,n,r,s){this.pendingInst=e,this.pendingBuffer=n,this.pendingOnCopy=r,this.pendingOnCopyDone=s}resetAndNotifyPending(e){let n=this.pendingOnCopyDone;p(n!==null,"reset_and_notify_pending with nothing pending"),this.resetPending(),n(e)}cancel(){this.resetAndNotifyPending(D.CANCELLED)}drop(){this.dropped||(this.dropped=!0,this.pendingBuffer&&this.resetAndNotifyPending(D.DROPPED),this.notifyDropped())}read(e,n,r,s){if(this.dropped)s(D.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#t(n),this.#n(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());n.write(this.pendingBuffer.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(D.COMPLETED)}else this.resetAndNotifyPending(D.COMPLETED),this.setPending(e,n,r,s)}write(e,n,r,s){if(this.dropped)s(D.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#t(n),this.#n(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());this.pendingBuffer.write(n.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(D.COMPLETED)}else n.isZeroLength()&&this.pendingBuffer.isZeroLength()?s(D.COMPLETED):(this.resetAndNotifyPending(D.COMPLETED),this.setPending(e,n,r,s))}#t(e){p(Ue(this.t,e.t)&&Ue(e.t,this.pendingBuffer.t),"stream element type mismatch between ends")}#n(e){h(e===this.pendingInst&&!za(this.t),"cannot read from and write to intra-component stream")}},dt=class{t;onLowered;boundStore;dropped;abandonReason;pendingInst;pendingBuffer;pendingOnCopyDone;constructor(e){this.t=e,this.onLowered=null,this.boundStore=null,this.dropped=!1,this.abandonReason=null,this.pendingInst=null,this.pendingBuffer=null,this.pendingOnCopyDone=null}resetPending(){this.setPending(null,null,null)}setPending(e,n,r){this.pendingInst=e,this.pendingBuffer=n,this.pendingOnCopyDone=r}resetAndNotifyPending(e){let n=this.pendingOnCopyDone;p(n!==null,"reset_and_notify_pending with nothing pending"),this.resetPending(),n(e)}cancel(){this.resetAndNotifyPending(D.CANCELLED)}drop(){this.dropped||(this.dropped=!0,this.pendingBuffer&&this.resetAndNotifyPending(D.DROPPED))}read(e,n,r){if(this.dropped&&this.abandonReason!==null)throw Ja(this.abandonReason);p(!this.dropped&&n.remain()===1,"future read shape"),this.pendingBuffer?(h(e===this.pendingInst&&!za(this.t),"cannot read from and write to intra-component future"),n.write(this.pendingBuffer.read(1)),this.resetAndNotifyPending(D.COMPLETED),r(D.COMPLETED)):this.setPending(e,n,r)}write(e,n,r){p(n.remain()===1,"future write shape"),this.dropped?r(D.DROPPED):this.pendingBuffer?(h(e===this.pendingInst&&!za(this.t),"cannot read from and write to intra-component future"),this.pendingBuffer.write(n.read(1)),this.resetAndNotifyPending(D.COMPLETED),r(D.COMPLETED)):this.setPending(e,n,r)}},Sn=class extends Ut{shared;state;constructor(e){super(),this.shared=e,this.state=le.IDLE}copying(){return this.state===le.COPYING||this.state===le.CANCELLING_COPY}drop(){h(this.copying(),"cannot drop busy stream"),this.shared.drop(),super.drop()}},pt=class extends Sn{copy(e,n,r,s){this.shared.read(e,n,r,s)}},$n=class extends Sn{copy(e,n,r,s){this.shared.write(e,n,r,s)}},ht=class extends Sn{copy(e,n,r){this.shared.read(e,n,r)}},tn=class extends Sn{copy(e,n,r){this.shared.write(e,n,r)}drop(){h(this.state!==le.DONE,"cannot drop future write end without first writing a value"),super.drop()}},Zo=new WeakMap;function hf(t){return typeof t=="object"&&t!==null?Zo.get(t):void 0}var Va=new WeakSet;function Ja(t){let e=new ke(`future.read can never complete: ${t.message}`);return e.cause=t,e}function mf(t){return t instanceof dt?t.abandonReason:null}function yf(t,e){t.dropped||(t.abandonReason??=e,vs(t))}function vs(t){if(!t.dropped){if(t.dropped=!0,t.pendingBuffer){let e=t.pendingInst;typeof e=="object"&&e!==null&&(Do(e)||Va.has(e))?t.resetPending():t.resetAndNotifyPending(D.DROPPED)}t instanceof St&&t.notifyDropped()}}function Py(t,e){if(Va.has(t))return;Va.add(t);let n=t.index!==void 0?`component instance ${t.index}`:"a component instance",r=[];for(let i of t.handles)i instanceof Sn&&r.push(i);for(let i of r){let a=i.shared;Zo.get(a)===void 0&&Zo.set(a,new Error(`${n} trapped while it held an end of this stream/future; the peer can never rendezvous again`,{cause:e})),i instanceof tn&&a instanceof dt&&i.state!==le.DONE&&!a.dropped&&(a.abandonReason??=Zo.get(a))}let s,o=!1;for(let i of r)try{vs(i.shared)}catch(a){o||(o=!0,s=a)}if(o)throw s}Ku(Py);var tt=class{debugMessage;constructor(e){this.debugMessage=e}};we(tt.prototype,Et);function Ts(t,e){if(!Ne(e,Et))return`${t}: handle is not an error-context`;let n=Nt();return`${t}: this error-context was minted by a DIFFERENT deltic runtime copy and cannot be used through this one${n===""?"":` (${n})`} (contracts/embedder-api.md amendment A9, issue #83)`}function qa(t){return cr(t,e=>e.kind==="borrow")}function wf(t,e,n,r,s,o){p(!qa(n),`${o} may not contain a borrow`);let i=t.inst;p(i!==null,`${o} lift requires a component instance`);let a=i.handles.remove(e);h(!(a instanceof r),`${o} lift: handle is not a ${o} end`);let c=a;h(!Ue(c.shared.t,s),`${o} lift: element type mismatch`),h(c.state===le.DONE,o==="future"?"cannot lift future after previous read succeeded":"cannot lift stream after being notified that the writable end dropped"),h(c.state!==le.IDLE,`cannot remove busy ${o}`),h(c.inWaitableSet(),`cannot lift ${o} while it's in a waitable set`);let l=c.shared,u=i.store;if(l.boundStore!=null&&u!=null){let f=Nt();p(l.boundStore===u,`${o} crossed into a second store; multi-store is unsupported`+(f===""?"":` (${f} \u2014 a value from one copy cannot be lowered through another)`))}return l.boundStore??=u,c.shared}function ei(t,e,n){return wf(t,e,n,pt,n.element,"stream")}function ti(t,e,n){return wf(t,e,n,ht,n.element,"future")}function Go(t,e,n){p(e instanceof St,"lower_stream expects a shared stream value"),p(!qa(n),"stream may not contain a borrow");let r=n.element??null;Ue(e.t,r)||p(!1,`stream element type mismatch: host end carries ${Ce(e.t)}, callee expects ${Ce(r)}`);let s=t.inst;return p(s!==null,"stream lower requires a component instance"),e.boundStore??=s.store,e.onLowered?.(s),s.handles.add(new pt(e))}function Xo(t,e,n){p(e instanceof dt,"lower_future expects a shared future value"),p(!qa(n),"future may not contain a borrow");let r=n.element??null;Ue(e.t,r)||p(!1,`future element type mismatch: host end carries ${Ce(e.t)}, callee expects ${Ce(r)}`);let s=t.inst;return p(s!==null,"future lower requires a component instance"),e.boundStore??=s.store,e.onLowered?.(s),s.handles.add(new ht(e))}function ni(t,e){let n=t.inst;p(n!==null,"error-context lift requires a component instance");let r=n.handles.get(e);return h(!(r instanceof tt),Ts("error-context lift",r)),r}function Yo(t,e){let n=t.inst;return p(n!==null,"error-context lower requires a component instance"),n.handles.add(e)}var Ly=(1<<28)-1;function Ss(t,e,n){let r=L(t.opts);p(e===ae(e,Ee(n,r.ptrType())),"load misaligned"),p(e+ce(n,r.ptrType())<=r.length,"load OOB");let s=K(n);switch(s.kind){case"bool":return Ga(xe(r,e,1));case"u8":return xe(r,e,1);case"u16":return xe(r,e,2);case"u32":return xe(r,e,4);case"u64":return xe(r,e,8);case"s8":return ps(r,e,1);case"s16":return ps(r,e,2);case"s32":return ps(r,e,4);case"s64":return ps(r,e,8);case"f32":return ys(xe(r,e,4));case"f64":return No(xe(r,e,8));case"char":return Vo(xe(r,e,4));case"string":return cf(t,e);case"error-context":return ni(t,xe(t.opts.memory,e,4));case"list":return Ny(t,e,s.element,s.length??null);case"record":return Oy(t,e,s.fields);case"variant":return _y(t,e,s.cases);case"flags":return Dy(t,e,s.labels);case"own":return Wo(t,xe(r,e,4),s);case"borrow":return jo(t,xe(r,e,4),s);case"stream":return ei(t,xe(t.opts.memory,e,4),s);case"future":return ti(t,xe(t.opts.memory,e,4),s)}}function Ga(t){return p(t>=0),!!t}function Ny(t,e,n,r){if(r!==null)return Qo(t,e,r,n);let s=L(t.opts),o=fr(s,e),i=fr(s,e+s.ptrSize());return Xa(t,o,i,n)}function Xa(t,e,n,r){let s=L(t.opts),o=ce(r,s.ptrType()),i=Ee(r,s.ptrType()),a=BigInt(n)*BigInt(o);h(a>BigInt(Ly),"list too long");let c=BigInt(e);return h(c%BigInt(i)!==0n,"misaligned list pointer"),h(c+a>BigInt(s.length),"list out of bounds"),Qo(t,Number(c),Number(n),r)}function Qo(t,e,n,r){let s=L(t.opts),o=K(r).kind;if(o==="u8")return _t(s,e,n).slice();let i=df(s,e,n,o);if(i!==null)return i;let a=ce(r,s.ptrType()),c=[];for(let l=0;l=n.length,"invalid variant discriminant");let a=n[o];return i=ae(i,dr(n,r.ptrType())),a.type===null?{[a.label]:null}:{[a.label]:Ss(t,i,a.type)}}function Dy(t,e,n){let r=L(t.opts),s=xe(r,e,hs(n));return Ya(s,n)}function Ya(t,e){let n={},r=t>>>0;for(let s of e)n[s]=!!(r&1),r=r>>>1;return n}var In=16,Za=4,Er=1;function Qa(t,e,n){let r=$s(e.params,t),s=$s(e.results,t);if(t.async_){switch(n){case"lift":r.length>In&&(r=[L(t).ptrType()]),t.callback?s=["i32"]:s=[];break;case"lower":r.length>Za&&(r=[L(t).ptrType()]),s.length>0&&(r=[...r,L(t).ptrType()]),s=["i32"];break}return{params:r,results:s}}else{if(r.length>In&&(r=[L(t).ptrType()]),s.length>Er)switch(n){case"lift":s=[L(t).ptrType()];break;case"lower":r=[...r,L(t).ptrType()],s=[];break}return{params:r,results:s}}}function $s(t,e){return t.flatMap(n=>An(n,e))}function An(t,e){let n=K(t);switch(n.kind){case"bool":case"u8":case"u16":case"u32":case"s8":case"s16":case"s32":case"char":return["i32"];case"s64":case"u64":return["i64"];case"f32":return["f32"];case"f64":return["f64"];case"string":{let r=L(e).ptrType();return[r,r]}case"error-context":return["i32"];case"list":return Fy(n.element,n.length??null,e);case"record":return By(n.fields,e);case"variant":return Is(n.cases,e);case"flags":return["i32"];case"own":case"borrow":case"stream":case"future":return["i32"]}}function Fy(t,e,n){if(e!==null){let s=[],o=An(t,n);for(let i=0;i{o=2**(e-1)?r-2**e:r}function Wy(t){let e=t.next("i64");return p(0n<=e&&e<1n<<64n),e>=1n<<63n?e-(1n<<64n):e}function jy(t,e){let n=L(t.opts).ptrType(),r=e.next(n),s=e.next(n);return xs(t,r,s)}function Ky(t,e,n,r){if(r!==null){let a=[];for(let c=0;c=n.length,"invalid variant discriminant");let o={next(c){let l=r.shift(),u=e.next(l);return l==="i32"&&c==="f32"?ys(u):l==="i64"&&c==="i32"?gf(u):l==="i64"&&c==="f32"?ys(gf(u)):l==="i64"&&c==="f64"?No(u):(p(l===c,`lane mismatch ${l} -> ${c}`),u)}},i=n[s],a;i.type===null?a=null:a=As(t,o,i.type);for(let c of r)e.next(c);return{[i.label]:a}}function gf(t){return p(0n<=t&&t<1n<<64n),Number(t&0xffffffffn)}function Vy(t,e){p(0 ${d}`)}}for(let c of o)a.push(c==="i64"?0n:0);return[r,...a]}function Qy(t,e){return p(0e){let o=L(t.opts),i=n.next(o.ptrType()),a={kind:"tuple",elements:r},c=Ee(a,o.ptrType()),l=ce(a,o.ptrType());h(BigInt(i)%BigInt(c)!==0n,"misaligned spill pointer"),h(BigInt(i)+BigInt(l)>BigInt(o.length),"spill tuple out of bounds");let u=Ra(i),f=Ss(t,u,a);return Object.values(f)}else return r.map(o=>As(t,n,o))}function nc(t,e,n,r,s=null){if($s(r,t.opts).length>e){let i=L(t.opts),a={kind:"tuple",elements:r},c={};n.forEach((w,y)=>{c[String(y)]=w});let l,u,f=Ee(a,i.ptrType()),d=ce(a,i.ptrType());return s===null?(l=t.allocate(f,d),u=i.ptrType()==="i32"?[l]:[BigInt(l)]):(l=Ra(s.next(i.ptrType())),u=[]),h(l!==ae(l,f),"misaligned spill pointer"),h(l+d>i.length,"spill tuple out of bounds"),en(t,c,a,l),u}else{let i=[];for(let a=0;a!0)}awaiting;resumeWith(e,n){p(this.awaiting!==null,"resumeWith on a thread that is not awaiting"),this.awaiting=null,this.#s.awaiting.delete(this),this.#e="suspended";let r=this.task.inst;if(!Do(r)){p(r.mayEnterFrom(null),"resumeWith: parked thread's instance is not enterable from the host"),r.enterFrom(null);try{this.#i(e,n)}catch(s){throw s instanceof Ve||s instanceof Be?r.leaveTo(null):(r.releaseSyntheticRootOnPoison(),Ft(r,s)),s}r.leaveTo(null)}}resume(e=ju){p(!this.running()&&!this.done(),"resume() on a running or finished thread"),p(this.cancellable||!e,"cancelled resume of a non-cancellable block point"),this.waiting()&&this.#o(e),this.#i(e)}#i(e,n){this.#e="running",Hu(this);let r;try{r=n===void 0?this.#t.next(e):this.#t.throw(n.error)}catch(o){throw this.#e="done",o}finally{zu(this)}if(r.done){this.#e="done";return}let s=r.value;if(this.cancellable=s.cancellable,s.awaitValue!==void 0){this.#e="suspended",this.awaiting=s.awaitValue,this.#s.noteAwaiting(this,s.awaitValue);return}s.readyFunc===null?this.#e="suspended":(this.#e="suspended",this.#r(s.readyFunc))}*waitUntil(e,n=!1){return p(this.running(),"waitUntil on a non-running thread"),this.task.deliverPendingCancel(n)?hr:yield{readyFunc:e,cancellable:n}}*suspend(e){return p(this.running(),"suspend on a non-running thread"),this.task.deliverPendingCancel(e)?hr:yield{readyFunc:null,cancellable:e}}*yield_(e){return yield*this.waitUntil(()=>!0,e)}};var ne=function(t){return t[t.STARTING=0]="STARTING",t[t.STARTED=1]="STARTED",t[t.RETURNED=2]="RETURNED",t[t.CANCELLED_BEFORE_STARTED=3]="CANCELLED_BEFORE_STARTED",t[t.CANCELLED_BEFORE_RETURNED=4]="CANCELLED_BEFORE_RETURNED",t}({}),$t=class extends Ut{state=ne.STARTING;onCancel=null;cancellationRequested=!1;flatResults=[];calleeTask=null;lenders=[];resolved(){switch(this.state){case ne.STARTING:case ne.STARTED:return!1;default:return!0}}addLender(e){p(!this.resolveDelivered()&&!this.resolved(),"addLender on a resolved subtask"),e.numLends+=1,this.lenders.push(e)}resolve(e,n){p(e===ne.RETURNED||n.length===0,"non-RETURNED subtask resolution carries results"),p(!this.resolved(),"resolve on an already-resolved subtask"),this.state=e,this.flatResults=n}deliverResolve(){p(!this.resolveDelivered()&&this.resolved(),"deliverResolve on an unresolved or already-delivered subtask");for(let e of this.lenders)e.numLends-=1;this.lenders=null}resolveDelivered(){return p(this.lenders!==null||this.resolved(),"lenders released on an unresolved subtask"),this.lenders===null}unwindLenders(){this.resolved()||this.resolve(this.state===ne.STARTING?ne.CANCELLED_BEFORE_STARTED:ne.CANCELLED_BEFORE_RETURNED,[]),this.resolveDelivered()||this.deliverResolve()}drop(){h(!this.resolveDelivered(),"cannot drop a subtask which has not yet resolved"),super.drop()}setSubtaskPendingEvent(e){this.setPendingEvent(()=>(this.resolved()&&!this.resolveDelivered()&&this.deliverResolve(),[te.SUBTASK,e,this.state]))}};function ri(t,e){return p(e>0&&e<=2**28-1,"subtask index out of packing range"),p(t>=0&&t<2**4,"subtask state out of packing range"),(t|e<<4)>>>0}var bf=new WeakMap,kf=-1,xf=Symbol("synthetic-root"),si=class t{index;flags;handles=new ks;threads=new ks;mayEnter=!0;backpressure=0;numWaitingToEnter=0;exclusiveThread=null;parent;store;static rootOf(e){let n=bf.get(e);return n===void 0&&(n=new t(kf,e,xf),bf.set(e,n)),n}get isSyntheticRoot(){return this.index===kf&&this.parent===null}constructor(e,n,r){this.index=e,this.store=n??new pr,this.flags=new WebAssembly.Global({value:"i32",mutable:!0},1),this.parent=r===xf?null:t.rootOf(this.store)}releaseSyntheticRootOnPoison(){for(let e of this.selfAndAncestors())e.isSyntheticRoot&&(e.mayEnter=!0)}get mayLeave(){return this.flags.value!==0}set mayLeave(e){this.flags.value=e?1:0}selfAndAncestors(){let e=new Set([this]),n=this.parent;for(;n!==null;)e.add(n),n=n.parent;return e}enteringSet(e){let n=this.selfAndAncestors();if(e===null)return n;for(let r of e.selfAndAncestors())n.delete(r);return n}mayEnterFrom(e){for(let n of this.enteringSet(e))if(!n.mayEnter)return!1;return!0}enterFrom(e){for(let n of this.enteringSet(e))p(n.mayEnter,"enter_from without may_enter"),n.mayEnter=!1}leaveTo(e){for(let n of this.enteringSet(e))p(!n.mayEnter,"leave_to without a matching enter_from"),n.mayEnter=!0}enter(){this.enterFrom(null)}leave(){this.leaveTo(null)}};function Ef(t,e){return t.stringEncoding===e.stringEncoding&&t.memory===e.memory}var ew=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})(),vr=class{ft;opts;inst;onStart;onResolve;state;numBorrows;implicitThread;threads;factPassthrough;factResultTypesKnown;constructor(e,n,r,s,o){this.ft=e,this.opts=n,this.inst=r,this.onStart=s,this.onResolve=o,this.state="initial",this.numBorrows=0,this.implicitThread=null,this.threads=[],this.factPassthrough=!1,this.factResultTypesKnown=!1}needsExclusive(){return p(this.ft.async===!0,"needs_exclusive on a sync-typed task"),!this.opts.async_||this.opts.callback}*enterImplicitThread(e){if(p(this.state==="initial","enter_implicit_thread after start"),this.implicitThread=e,this.ft.async===!0){let n=()=>this.inst.backpressure>0||this.needsExclusive()&&this.inst.exclusiveThread!==null;if(n()||this.inst.numWaitingToEnter>0){this.inst.numWaitingToEnter+=1;let r;try{r=yield*e.waitUntil(()=>!n(),!0)}finally{this.inst.numWaitingToEnter-=1}if(r)return this.cancel(),!1}this.needsExclusive()&&(p(this.inst.exclusiveThread===null,"entering with the exclusive thread already taken"),this.inst.exclusiveThread=e)}return ew&&console.error(`[admit] task=${ve(this)} thread=${ve(e)}`),this.registerThread(e),!0}registerThread(e){p(!this.threads.includes(e)&&e.task===this,"register_thread of a foreign or duplicate thread"),this.threads.push(e),p(e.index===null,"register_thread of an indexed thread"),e.index=this.inst.threads.add(e)}exitImplicitThread(e){p(e===this.implicitThread,"exit of a non-implicit thread"),this.unregisterThread(e),this.ft.async===!0&&this.needsExclusive()&&(p(this.inst.exclusiveThread===e,"exit_implicit_thread without holding the exclusive thread"),this.inst.exclusiveThread=null)}unregisterThread(e){let n=this.threads.indexOf(e);p(n!==-1&&e.task===this,"unregister of a foreign thread"),this.threads.splice(n,1),this.threads.length===0&&(h(this.state!=="resolved","task finished all threads without resolving"),p(this.numBorrows===0,"task exited with live borrows")),p(e.index!==null,"unregister of an unindexed thread"),this.inst.threads.remove(e.index),e.index=null}requestCancellation(e){if(this.state==="initial"){this.state="cancel-delivered",this.implicitThread.resume(hr);return}p(this.state==="started",`request_cancellation in state ${this.state}`);let n=this.threads.filter(s=>s.cancellable),r=this.ft.async===!0&&this.needsExclusive()&&this.inst.exclusiveThread!==null&&this.inst.exclusiveThread!==this.implicitThread;if(r&&(n=n.filter(s=>s!==this.implicitThread)),!r){let s=this.inst.store;for(let o of s.waiting)o.task===this&&o.cancellable===!0&&!n.includes(o)&&n.push(o)}if(n.length>0&&this.inst.mayEnterFrom(e)){this.state="cancel-delivered",this.inst.enterFrom(e);try{mr(n).resume(hr)}finally{this.inst.leaveTo(e)}}else this.state="pending-cancel"}deliverPendingCancel(e){return e&&this.state==="pending-cancel"?(this.state="cancel-delivered",!0):!1}start(){return p(this.state==="initial","start on a started task"),this.state="started",this.onStart()}return_(e){h(this.state==="resolved","task.return on a resolved task"),h(this.numBorrows>0,"task returned with live borrows"),this.onResolve(e),this.state="resolved"}cancel(){h(this.state!=="cancel-delivered","task.cancel without a delivered cancellation request"),h(this.numBorrows>0,"task cancelled with live borrows"),this.onResolve(null),this.state="resolved"}};function oi(){let t=WebAssembly;return typeof t.promising=="function"&&typeof t.Suspending=="function"?t:null}function Ps(){return typeof globalThis.WebAssembly=="object"&&oi()!==null}function vf(){if(!Ps())throw new Error("JSPI (WebAssembly.promising / WebAssembly.Suspending) is not available in this engine; see docs/architecture.md \xA73 for the compatibility floor (no fallback path exists).")}function Tf(t){return vf(),oi().promising(t)}function Sf(t){return vf(),new(oi()).Suspending(t)}function $f(t,e){return t===!1?"plain":(t===!0||e===!0)&&Ps()?"jspi":"plain"}function ii(t,e){switch(t.kind){case"sync-start-call":case"waitable-set-wait":case"thread-yield":return!0;case"subtask-cancel":case"stream-cancel-read":case"stream-cancel-write":case"future-cancel-read":case"future-cancel-write":return t.async!==!0;case"stream-read":case"stream-write":case"future-read":case"future-write":return typeof t.options=="number"?!e(t.options):!0;default:return!1}}function If(t,e){return t.kind==="async-start-call"||t.kind==="subtask-cancel"||ii(t,e)}function Af(t){for(let n of t.canonicalOptions)if(n.async&&n.callback===null)return!0;let e=n=>t.canonicalOptions[n]?.async===!0;for(let n of t.trampolines)if(ii(n,e))return!0;return!1}function nn(t,e){return e==="plain"?t:(p(Ps(),"jspi mode selected on an engine without JSPI"),Tf(t))}function rc(t){t!=null&&tw.then(()=>yr(t))}var tw=Promise.resolve();function nw(t,e){return Promise.resolve(e).then(n=>(rc(t),n),n=>{throw rc(t),n})}function ic(t,e){return e==="plain"?t:(p(Ps(),"jspi mode selected on an engine without JSPI"),Sf((...r)=>{let s=Mt()??null,o=()=>t(...r),i;try{i=s===null?o():Fo(s,o)}catch(a){throw yr(s),a}return i===null||typeof i?.then!="function"?(yr(s),rc(s),i):(sc&&console.error(`[sp] hop-suspend owner=${ve(s)} promise=${ve(i)}`),nw(s,i))}))}function Cf(t,e,n){if(t==="plain"){p(!e&&!n,`plain mode with wrapped entries=${e} / imports=${n} \u2014 wrapping ran under the wrong mode`);return}p(e||!n,`suspension mode jspi wrapped imports without wrapping any entry (entries=${e}, imports=${n}) \u2014 a Suspending import reached from a non-promising activation traps unconditionally (jspi pin (c))`)}var sc=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})(),oc=class{task;readyFunc;cancellable;produce;onSettled;promise;#e;#t;#n;#s;#r;owner;constructor(e,n,r,s,o,i,a){this.task=n,this.readyFunc=r,this.cancellable=s,this.produce=o,this.onSettled=a,this.#n=!1,this.#s=!1,this.#r=e,this.owner=i??Mt()??n?.implicitThread??null,sc&&console.error(`[sp] mint ${ve(this)} owner=${ve(this.owner)} task=${ve(this.task)} ${(new Error().stack??"").split(` `).slice(2,5).join(` -`)}`),this.promise=new Promise((c,l)=>{this.#e=c,this.#t=l}),e.startWaiting(this)}waiting(){return!this.#n}ready(){return!this.#n&&this.readyFunc!==null&&this.readyFunc()}resume(e=!1){p(!this.#n,"resume of an already-resumed suspension point"),p(this.cancellable||!e,"cancelled resume of a non-cancellable suspension point"),ec&&console.error(`[sp] resume ${Ee(this)} owner=${Ee(this.owner)} +`)}`),this.promise=new Promise((c,l)=>{this.#e=c,this.#t=l}),e.startWaiting(this)}waiting(){return!this.#n}ready(){return!this.#n&&this.readyFunc!==null&&this.readyFunc()}resume(e=!1){p(!this.#n,"resume of an already-resumed suspension point"),p(this.cancellable||!e,"cancelled resume of a non-cancellable suspension point"),sc&&console.error(`[sp] resume ${ve(this)} owner=${ve(this.owner)} ${(new Error().stack??"").split(` `).slice(2,5).join(` -`)}`),this.#n=!0,this.#r.stopWaiting(this);try{this.#o(e)}finally{this.#i()}}#o(e){let n;try{n=this.produce(e)}catch(r){Ft()===void 0&&pr(this.owner),ws(this.task?.implicitThread??null),this.#t(r);return}_a(),Ft()===void 0&&pr(this.owner),ws(this.task?.implicitThread??null),this.#e(n)}abandon(e){if(!this.#n){this.#n=!0,this.#r.stopWaiting(this);try{this.#t(e)}finally{this.#i()}}}#i(){if(!this.#s&&(this.#s=!0,this.onSettled!==void 0))try{this.onSettled()}catch(e){console.error(`[sp] onSettled threw for ${Ee(this)}:`,e)}}};function Je(t){let e=Ft()??t.task?.implicitThread??null;return _a(),Oa(e),new tc(t.store,t.task,t.readyFunc,t.cancellable,t.produce,e,t.onSettled).promise}function Sf(){return{liftedCalls:0,tasksResolved:0,postReturnsRun:0,loweredCalls:0,enterSyncCalls:0,exitSyncCalls:0,callbackInvocations:0}}var Ps=class{addrType="i32";#e;#t;#n=null;#s=new Uint8Array(0);#r=new DataView(new ArrayBuffer(0));constructor(e,n){this.#e=e,this.#t=n}#o(){let e=this.#e();if(e===void 0)throw new v(`${this.#t} accessed before its extract-memory initializer ran`);return e}#i(){let e=this.#o().buffer;e!==this.#n&&(this.#n=e,this.#s=new Uint8Array(e),this.#r=new DataView(e))}get bytes(){return this.#i(),this.#s}get view(){return this.#i(),this.#r}get length(){return this.#o().buffer.byteLength}ptrType(){return this.addrType}ptrSize(){return 4}},ET=new Ps(()=>{},"check");function sc(t,e){if(t===null)return null;let n=t();if(n===void 0)throw new v(`${e} accessed before its extract initializer ran`);return n}function tt(t){return{stringEncoding:t.stringEncoding,memory:t.memory,realloc:t.realloc===null?null:(e,n,r,s)=>{let o=sc(t.realloc,"realloc"),i=Cn(o,[e,n,r,s]);return h(i.length!==1||typeof i[0]!="number","realloc result"),i[0]>>>0},postReturn:null,async_:t.async,callback:t.callback===null?null:t.callback}}function Cn(t,e){let n;try{n=t(...e)}catch(r){throw $f(r)}return n===void 0?[]:Array.isArray(n)?n:[n]}function $f(t){if(t instanceof WebAssembly.RuntimeError)try{pe(`guest trapped: ${t.message}`)}catch(e){return e}return t}function Ut(t,e,n){if(t.length!==e.length)throw new ar(`${n}: expected ${e.length} core values, got ${t.length}`);return t.map((r,s)=>{switch(e[s]){case"i32":return p(typeof r=="number",`${n}[${s}]: i32 lane`),r>>>0;case"i64":return p(typeof r=="bigint",`${n}[${s}]: i64 lane`),BigInt.asUintN(64,r);case"f32":case"f64":return p(typeof r=="number",`${n}[${s}]: float lane`),r}})}function qy(t){if(t.length!==0)return t.length===1?t[0]:t}function Af(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"}var Gy=(()=>{try{return Deno.env.get("DELTIC_DRIVE_TRACE")==="1"}catch{return!1}})(),Xy=0;function Yy(t){let e=t,n=e?.constructor?.name??"?",r="?";try{r=e.ready?.()?"READY":e.readyFunc===null?"explicit":"not-ready"}catch(s){r=`threw:${s}`}return`${n}[${r}]`}function qe(t,e,n,r){if(!Gy)return;let s="?";try{s=String(n())}catch(a){s=`threw:${a}`}let o=e.waiting.map(Yy).join(","),i=[...e.awaiting].map(a=>`${a?.constructor?.name??"?"}`).join(",");console.error(`[drive #${Xy++}] ${t} branch=${r} ready=${e.readyCandidates().length} waiting=${e.waiting.length}{${o}} awaiting=${e.awaiting.size} hostCalls=${e.pendingHostCalls.size} awaiters={${i}} claim=${kn()} done=${s}`)}function Zy(t,e,n){for(;;){for(qe("drive",t,e,"top");t.awaiting.size===0&&t.tick();)if(qe("drive",t,e,"ticked"),t.hostFailure!==void 0)throw Rs(t);if(t.hostFailure!==void 0)throw Rs(t);if(e()){qe("drive",t,e,"EXIT-done"),uc(t);return}return t.awaiting.size>0||kn()?(qe("drive",t,e,"->async(awaiting/claim)"),ac(t,e,n)):(t.pendingHostCalls.size===0&&(qe("drive",t,e,"DEADLOCK-TRAP"),h(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: no thread is ready and no host call is outstanding)`)),qe("drive",t,e,"->async(hostcalls)"),ac(t,e,n))}}var vf=new WeakMap;function rc(t){let e=t.awaiting,n=vf.get(e);return n===void 0&&(n=e.then(r=>({t,p:e,value:r,failure:void 0}),r=>({t,p:e,value:void 0,failure:{error:r}})),vf.set(e,n)),n}async function cc(t,e,n){return await ac(t,e,n)}var oc=new WeakMap,ii=new WeakMap;function St(t){return oc.get(t)??0}function lc(t){if(St(t)===0)return Promise.resolve();let e=ii.get(t);if(e===void 0){let n;e={p:new Promise(s=>n=s),r:n},ii.set(t,e)}return e.p}var ic=new WeakSet,ai=new WeakMap;function Qy(t){let e=ai.get(t);if(e===void 0){let n;e={p:new Promise(s=>n=s),r:n},ai.set(t,e)}return e.p}function ew(t){let e=ai.get(t);e!==void 0&&(ai.delete(t),e.r())}function uc(t){if(ic.has(t)){ew(t);return}t.hostFailure===void 0&&Fo(t)&&(ic.add(t),tw(t))}async function tw(t){let e=!1;try{for(;;){for(;St(t)>0;)await lc(t);if(t.hostFailure!==void 0)return;let n=Hu(t);if(n.length===0)return;let r=Qy(t);await Promise.race([...n.map(s=>s.then(()=>{},()=>{})),r]),!(St(t)>0)&&await cc(t,()=>t.pendingHostCalls.size===0||mr(t)||St(t)>1,"settlement pump")}}catch(n){e=!0,t.hostFailure??=n}finally{ic.delete(t),!e&&t.hostFailure===void 0&&St(t)===0&&Fo(t)&&uc(t)}}async function ac(t,e,n){oc.set(t,St(t)+1);try{let r=0;for(;;){if(qe("driveAsync",t,e,"top"),t.serviceSettled(),t.hostFailure!==void 0)throw Rs(t);if(kn()){qe("driveAsync",t,e,"yield-claim"),r++,p(r<1e4,"driveAsync: a resumed-activation claim was never released (the activation neither parked, finished, nor trapped)"),r%100===0?await new Promise(s=>setTimeout(s,0)):await Promise.resolve();continue}for(r=0;t.tick();){if(t.hostFailure!==void 0)throw Rs(t);if(t.awaiting.size>0&&(await Promise.resolve(),t.settled.length>0))break}if(t.hostFailure!==void 0)throw Rs(t);if(e()){qe("driveAsync",t,e,"EXIT-done");return}if(!(t.settled.length>0||kn())){if(t.awaiting.size>0){if(t.pendingHostCalls.size===0&&!kn()){qe("driveAsync",t,e,"deadlock-probe");let l=[...t.awaiting],u=await Promise.race([...l.map(f=>rc(f).then(()=>!0)),new Promise(f=>setTimeout(()=>f(!1),0))]);if(qe("driveAsync",t,e,`deadlock-probe:progressed=${u}`),!u){let f=[...t.awaiting];if(f.length!==l.length||f.some((w,y)=>w!==l[y])||t.pendingHostCalls.size>0||kn())continue;t.readyCandidates().length===0&&h(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: every suspended activation is waiting on a suspension only this scheduler could resume, and none is ready)`);continue}}if(t.awaiting.size===0)continue;let s=[...t.awaiting],o=s[0],i=rc(o),a=s.slice(1).map(rc);for(let l of t.pendingHostCalls)a.push(l.then(()=>null,()=>null));ws(o);let c;try{c=await Promise.race([i,...a])}finally{Mu()}c!==null&&t.awaiting.has(c.t)&&c.t.awaiting===c.p&&c.t.resumeWith(c.value,c.failure);continue}t.pendingHostCalls.size===0&&(qe("driveAsync",t,e,"DEADLOCK-TRAP"),h(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: no thread is ready and no host call is outstanding)`)),qe("driveAsync",t,e,"await-race"),await Promise.race([...t.pendingHostCalls]).catch(()=>{})}}}finally{let r=St(t)-1;if(oc.set(t,r),r===0){let s=ii.get(t);ii.delete(t),s?.r(),uc(t)}}}function Rs(t){let e=t.hostFailure;return t.hostFailure=void 0,e}var ci=Symbol("deltic.constructorSyncEntry");function fc(t){let{name:e,ft:n,opts:r,core:s,stats:o,trapState:i,syncCallStack:a,allInstances:c}=t,l=r.instance,u=l.store,f=t.suspensionMode??"plain",d=en(s,f),w={async_:r.async,callback:r.callback!==null,stringEncoding:r.stringEncoding,memory:r.memory};if(r.callback!==null&&!r.async)throw new v(`export '${e}': canonical options carry a callback but are not async (callback is meaningless for a sync lift)`);let y=Ga(tt(r),n,"lift");if(!Ea(y,r.coreType))throw new v(`export '${e}': computed flat type ${JSON.stringify(y)} != plan coreType ${JSON.stringify(r.coreType)}`);let x=E=>{o.liftedCalls++,i!==void 0&&(i.pending=void 0);let b=a?.length??0;l.mayEnterFrom(null)||pe(Dt(l,`cannot enter component instance ${l.index} (reentrance forbidden)`));let m=l.enteringSet(null);l.enterFrom(null);let g=!0,k=!1,T=null,S=!1,$=new kr(n,w,l,()=>E,L=>{T=L,S=!0,o.tasksResolved++}),O=new In($,sw({name:e,ft:n,opts:r,core:d,stats:o,task:$,thread:()=>O,mode:f})),_=()=>{if(k=!0,h(!S,`${e}: task finished without resolving (deadlock)`),T===null)throw new ar(`${e}: task resolved as cancelled, but the host never requested cancellation`);return qy(T)},R=()=>{if(!k){for(let L of $.threads)for(;L.syncCallStack.length>0;)L.syncCallStack.pop().releaseLenders();for(let L of c?.()??[])m.has(L)||(L.mayLeave=!0)}},P=()=>{g&&(g=!1,l.leaveTo(null))},H=L=>{g=!1,l.releaseSyntheticRootOnPoison();for(let me of m)me.isSyntheticRoot||_t(me,L)},bt=L=>L instanceof ze||L instanceof Fe;try{O.resume(),!n.async&&f!=="jspi"&&zu($)}catch(L){throw R(),bt(L)?P():H(L),L}P();let qt;try{let L=()=>$.threads.some(me=>u.awaiting.has(me));qt=Zy(u,()=>S&&!L(),`export '${e}'`)}catch(L){throw R(),L}if(qt===void 0)try{return _()}catch(L){throw R(),L}return qt.then(_,L=>{throw R(),L})};return(...E)=>{if(E.length!==n.params.length)throw new TypeError(`${e}: expected ${n.params.length} argument(s), got ${E.length}`);return f==="jspi"&&If(u,l).length>0?nw(u,l).then(()=>x(E)):x(E)}}function If(t,e){if(t.awaiting.size===0)return[];let n=new Set;for(let s of t.waiting){let o=s.owner;o!=null&&n.add(o)}let r=[];for(let s of t.awaiting){let o=s;o.task.inst===e&&!n.has(s)&&r.push(o)}return r}async function nw(t,e){for(;;){let n=If(t,e);if(n.length===0)return;await Promise.race(n.map(r=>(r.awaiting??Promise.resolve()).then(()=>{},()=>{}))),t.serviceSettled()}}function*xr(t,e,n){let r=_o(n,()=>Cn(t,e));if(r.length===1&&Af(r[0])){let s=yield{readyFunc:null,cancellable:!1,awaitValue:Promise.resolve(r[0]).then(void 0,o=>{throw $f(o)})};return s===void 0?[]:Array.isArray(s)?s:[s]}return r}var oi=function(t){return t[t.EXIT=0]="EXIT",t[t.YIELD=1]="YIELD",t[t.WAIT=2]="WAIT",t}(oi||{}),rw=2;function Tf(t){let e=t&15;return h(e>rw,`invalid callback code ${e}`),[e,t>>>4]}function*sw(t){let{name:e,ft:n,opts:r,core:s,stats:o,task:i}=t,a=t.thread(),c=r.instance;if(!(yield*i.enterImplicitThread(a)))return;let l=new He(tt(r),c,i),u=i.start(),f=Za(l,Sn,u,n.params);if(!r.async){let y=Ut(yield*xr(s,f,a),r.coreType.results,`${e} results`),x=Is(l,br,new An(y),n.results);i.return_(x);let E=sc(r.postReturn,`${e} post-return`);E!==null&&(p(c.mayLeave,"post-return with may_leave already false"),c.mayLeave=!1,Cn(E,y),c.mayLeave=!0,o.postReturnsRun++),i.exitImplicitThread(a);return}if(r.callback===null){t.mode!=="jspi"&&Ve(`stackful async lift of export '${e}' (async canonical options without a callback)`),yield*xr(s,f,a),i.exitImplicitThread(a);return}let d=en(sc(r.callback,`${e} callback`),t.mode),[w]=Ut(yield*xr(s,f,a),r.coreType.results,`${e} results`);yield*dc({name:e,task:i,thread:a,inst:c,callback:d,packed:w,stats:o}),i.exitImplicitThread(a)}function Cf(t){let{name:e,ft:n,opts:r,hostFn:s,stats:o,mode:i,suspendable:a}=t,c=r.instance,l=c.store,u=Ga(tt(r),n,"lower");if(!Ea(u,r.coreType))throw new v(`import '${e}': computed flat type ${JSON.stringify(u)} != plan coreType ${JSON.stringify(r.coreType)}`);let f=r.async?qa:Sn,d=r.async?0:br;return(...w)=>{o.loweredCalls++,h(!c.mayLeave,`cannot leave component instance ${c.index} (may_leave violation)`);let y=new Tt,x=new He(tt(r),c,y),E=new An(Ut(w,r.coreType.params,`${e} args`)),b=()=>{},m=()=>(b(),p(y.state===ne.STARTING,`${e}: on_start on a started subtask`),y.state=ne.STARTED,Is(x,f,E,n.params)),g=O=>{if(b(),O===null){p(y.cancellationRequested,`${e}: resolved as cancelled without a cancellation request`),y.resolve(y.state===ne.STARTING?ne.CANCELLED_BEFORE_STARTED:ne.CANCELLED_BEFORE_RETURNED,[]);return}p(y.state===ne.STARTED,`${e}: on_resolve on a subtask that never started`);let _=Za(x,d,O,n.results,E);y.resolve(ne.RETURNED,_)};y.onCancel=()=>{};let k=m(),T=s(...k),S=O=>n.results.length===0?[]:[O];if(Af(T)){if(!r.async){(i!=="jspi"||!a)&&(y.unwindLenders(),Ve(a?`synchronous lower of import '${e}', whose host implementation returned a Promise (the guest's wasm frame must block)`:`synchronous lower of import '${e}', whose host implementation returned a Promise; a sync-typed import may only park the frame when declared with suspending() (contracts/embedder-api.md \xA7"Functions and async")`));let _,R=Promise.resolve(T).then(P=>{l.pendingHostCalls.delete(R),_={value:P}},P=>{l.pendingHostCalls.delete(R),_={error:P}});return l.pendingHostCalls.add(R),Je({store:l,task:Ne(),readyFunc:()=>_!==void 0,cancellable:!1,produce:()=>{let P=_;if("error"in P)throw P.error;g(S(P.value)),y.deliverResolve(),p(E.done(),`${e}: unconsumed flat arguments`);let H=y.flatResults;if(H.length!==0)return H.length===1?H[0]:H},onSettled:()=>y.unwindLenders()})}let O=Promise.resolve(T).then(_=>{l.pendingHostCalls.delete(O);try{g(S(_))}catch(R){l.hostFailure=R}},_=>{l.pendingHostCalls.delete(O),l.hostFailure=_});l.pendingHostCalls.add(O)}else g(S(T));if(p(n.async||y.resolved(),`${e}: a non-async-typed import must resolve before returning`),!r.async){y.resolved()||Ve(`synchronous lower of import '${e}' on an unresolved subtask`),y.deliverResolve(),p(E.done(),`${e}: unconsumed flat arguments`);let O=y.flatResults;return O.length===0?void 0:O.length===1?O[0]:O}if(y.resolved())return y.deliverResolve(),p(y.flatResults.length===0,`${e}: async lower produced flat results`),ne.RETURNED;let $=c.handles.add(y);return b=()=>y.setSubtaskPendingEvent($),ti(y.state,$)}}function*dc(t){let{name:e,task:n,thread:r,inst:s,callback:o,stats:i}=t,[a,c]=Tf(t.packed);for(;a!==oi.EXIT;){p(n.needsExclusive()&&s.exclusiveThread===n.implicitThread,"callback loop without holding the exclusive thread"),s.exclusiveThread=null;let l;switch(a){case oi.YIELD:{l=(yield*r.waitUntil(()=>s.exclusiveThread===null,!0))?[te.TASK_CANCELLED,0,0]:[te.NONE,0,0];break}case oi.WAIT:{let f=s.handles.get(c);h(!(f instanceof Mt),`callback returned WAIT with index ${c}, which is not a waitable set`),l=yield*f.waitForEventAnd(r,()=>s.exclusiveThread===null,!0);break}default:pe(`invalid callback code ${a}`)}p(s.exclusiveThread===null,"exclusive thread taken while this task was waiting"),s.exclusiveThread=n.implicitThread,i.callbackInvocations++;let[u]=Ut(yield*xr(o,[l[0],l[1],l[2]],r),["i32"],`${e} callback result`);[a,c]=Tf(u)}}var Wt=class extends Error{milestone;constructor(e,n){super(`${n} \u2014 scheduled for ${e}, not implemented in the current executor (contracts/intrinsics.md \xA7B)`),this.milestone=e,this.name="UnsupportedFeatureError"}};var ow=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();function Ge(t){ow&&console.error(`[copy] ${t}`)}function Pf(t,e,n){return()=>{h(!n.mayLeave,"stream.new: cannot leave component instance");let r=new vt(e.streamElem(t.streamTable)),s=n.handles.add(new ft(r)),o=n.handles.add(new Tn(r));return Nf(s,o)}}function Lf(t,e,n){return()=>{h(!n.mayLeave,"future.new: cannot leave component instance");let r=new ut(e.futureElem(t.futureTable)),s=n.handles.add(new dt(r)),o=n.handles.add(new Qt(r));return Nf(s,o)}}function Nf(t,e){return BigInt(t>>>0)|BigInt(e>>>0)<<32n}function Of(t){let{EndT:e,reading:n,eventCode:r,elem:s,opts:o,inst:i,i:a,ptr:c,n:l}=t,u=t.mode??"plain";h(!i.mayLeave,"stream copy: cannot leave component instance");let f=i.handles.get(a);h(!(f instanceof e),"stream copy: wrong end type for this handle");let d=f;h(!Me(d.shared.t,s),"stream copy: element type mismatch"),h(d.state===ue.DONE,n?"cannot read from stream after being notified that the writable end dropped":"cannot write to stream after being notified that the readable end dropped"),h(d.state!==ue.IDLE,"cannot have concurrent operations active on a future/stream"),h(d.inWaitableSet()&&!o.async,"synchronous stream copy on an end that is in a waitable set");let w=new He(tt(o),i,null),y=new ks(s,w,c,l),x=(m,g)=>(g(),p(d.copying(),"stream event on a non-copying end"),d.state=m===D.DROPPED?ue.DONE:ue.IDLE,p(y.progress<=gr,"stream progress out of packing range"),[r,a,(m|y.progress<<4)>>>0]);d.state=ue.COPYING;let E=m=>d.setPendingEvent(()=>x(D.COMPLETED,m)),b=m=>d.setPendingEvent(()=>x(m,()=>{}));return d.copy(i,y,E,b),Df(d,r,a,o.async,"stream",i,u)}function _f(t){let{EndT:e,reading:n,eventCode:r,elem:s,opts:o,inst:i,i:a,ptr:c}=t,l=t.mode??"plain";h(!i.mayLeave,"future copy: cannot leave component instance");let u=i.handles.get(a);h(!(u instanceof e),"future copy: wrong end type for this handle");let f=u;h(!Me(f.shared.t,s),"future copy: element type mismatch"),h(f.state===ue.DONE,n?"cannot read from future after previous read succeeded":"cannot write to future after previous write succeeded or readable end dropped"),h(f.state!==ue.IDLE,"cannot have concurrent operations active on a future/stream"),h(f.inWaitableSet()&&!o.async,"synchronous future copy on an end that is in a waitable set");let d=new He(tt(o),i,null),w=new ks(s,d,c,1),y=E=>(p(w.remain()===0==(E===D.COMPLETED),"future event/progress disagreement"),p(f.copying(),"future event on a non-copying end"),f.state=E===D.DROPPED||E===D.COMPLETED?ue.DONE:ue.IDLE,[r,a,E]);f.state=ue.COPYING;let x=E=>{let b=n&&E===D.DROPPED?cf(f.shared):null;if(b!==null){f.setPendingEvent(()=>{throw Ka(b)});return}p(E!==D.DROPPED||r===te.FUTURE_WRITE,"a readable future end cannot observe DROPPED"),f.setPendingEvent(()=>y(E))};return f.copy(i,w,x),Df(f,r,a,o.async,"future",i,l)}function Df(t,e,n,r,s,o,i="plain"){let a=()=>{let[l,u,f]=t.getPendingEvent();return p(l===e&&u===n,`unexpected event delivered by a ${s} copy`),f};if(!t.hasPendingEvent()){if(!r){if(i==="jspi"&&o!==void 0)return t.hasSyncWaiter=!0,Ge(`${s} sync copy i=${n} BLOCKS`),Je({store:o.store,task:Ne(),readyFunc:()=>t.hasPendingEvent(),cancellable:!1,produce:()=>{t.hasSyncWaiter=!1;let l=a();return Ge(`${s} sync copy i=${n} RESUME -> 0x${l.toString(16)}`),l},onSettled:()=>{t.hasSyncWaiter=!1}});Ve(`synchronous ${s} copy with no counterpart ready (the calling wasm frame must block until the other end arrives)`)}return Ge(`${s} async copy i=${n} -> BLOCKED`),Er}let c=a();return Ge(`${s} copy(async=${r}) i=${n} -> 0x${c.toString(16)}`),c}function Rf(t,e,n,r){let[s,o,i]=t.getPendingEvent();if(p(!t.copying()&&s===e&&o===n,`unexpected event delivered by ${r}`),(e===te.STREAM_READ||e===te.STREAM_WRITE)&&(i&15)===D.COMPLETED){let c=(i&-16|D.CANCELLED)>>>0;return Ge(`${r} i=${n} -> 0x${c.toString(16)} (superseded COMPLETED)`),c}return Ge(`${r} i=${n} -> 0x${i.toString(16)}`),i}function li(t){let{EndT:e,eventCode:n,elem:r,inst:s,async_:o,i,what:a}=t,c=t.mode??"plain";h(!s.mayLeave,`${a}: cannot leave component instance`);let l=s.handles.get(i);h(!(l instanceof e),`${a}: wrong end type for this handle`);let u=l;if(h(!Me(u.shared.t,r),`${a}: element type mismatch`),h(u.state!==ue.COPYING||u.hasSyncWaiter,`${a}: end is not in a cancellable copy`),h(u.inWaitableSet()&&!o,`${a}: synchronous cancel on an end that is in a waitable set`),u.state=ue.CANCELLING_COPY,!u.hasPendingEvent()&&(u.shared.cancel(),!u.hasPendingEvent())){if(!o){if(c==="jspi")return Je({store:s.store,task:Ne(),readyFunc:()=>u.hasPendingEvent(),cancellable:!1,produce:()=>Rf(u,n,i,a)});Ve(`synchronous ${a} whose copy did not settle immediately (the calling wasm frame must block)`)}return Er}return Rf(u,n,i,a)}function ui(t,e,n,r,s){h(!n.mayLeave,`${s}: cannot leave component instance`);let o=n.handles.remove(r);h(!(o instanceof t),`${s}: wrong end type for this handle`);let i=o;h(!Me(i.shared.t,e),`${s}: element type mismatch`),i.drop()}function Ff(t,e,n){let r=e.options(t.options);return(s,o)=>{h(!n.mayLeave,"error-context.new: cannot leave component instance");let i=new He(tt(r),n,null),a=bs(i,s??0,o??0);return n.handles.add(new et(a))}}function Bf(t,e,n){let r=e.options(t.options);return(s,o)=>{h(!n.mayLeave,"error-context.debug-message: cannot leave component instance");let i=n.handles.get(s??0);h(!(i instanceof et),Es("error-context.debug-message",i));let a=new He(tt(r),n,null);Ko(a,i.debugMessage,o??0)}}function Mf(t){return e=>{h(!t.mayLeave,"error-context.drop: cannot leave component instance");let n=t.handles.remove(e??0);h(!(n instanceof et),Es("error-context.drop",n))}}function Uf(t,e,n){let r=e.options(t.options),s=e.streamElem(t.streamTable);return(o,i,a)=>Of({mode:e.suspensionMode??"plain",EndT:ft,reading:!0,eventCode:te.STREAM_READ,elem:s,opts:r,inst:n,i:o??0,ptr:i??0,n:a??0})}function Wf(t,e,n){let r=e.options(t.options),s=e.streamElem(t.streamTable);return(o,i,a)=>Of({mode:e.suspensionMode??"plain",EndT:Tn,reading:!1,eventCode:te.STREAM_WRITE,elem:s,opts:r,inst:n,i:o??0,ptr:i??0,n:a??0})}function jf(t,e,n){let r=e.options(t.options),s=e.futureElem(t.futureTable);return(o,i)=>_f({mode:e.suspensionMode??"plain",EndT:dt,reading:!0,eventCode:te.FUTURE_READ,elem:s,opts:r,inst:n,i:o??0,ptr:i??0})}function Kf(t,e,n){let r=e.options(t.options),s=e.futureElem(t.futureTable);return(o,i)=>_f({mode:e.suspensionMode??"plain",EndT:Qt,reading:!1,eventCode:te.FUTURE_WRITE,elem:s,opts:r,inst:n,i:o??0,ptr:i??0})}function Hf(t,e,n){let r=e.streamElem(t.streamTable);return s=>li({mode:e.suspensionMode??"plain",EndT:ft,eventCode:te.STREAM_READ,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"stream.cancel-read"})}function zf(t,e,n){let r=e.streamElem(t.streamTable);return s=>li({mode:e.suspensionMode??"plain",EndT:Tn,eventCode:te.STREAM_WRITE,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"stream.cancel-write"})}function Vf(t,e,n){let r=e.futureElem(t.futureTable);return s=>li({mode:e.suspensionMode??"plain",EndT:dt,eventCode:te.FUTURE_READ,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"future.cancel-read"})}function Jf(t,e,n){let r=e.futureElem(t.futureTable);return s=>li({mode:e.suspensionMode??"plain",EndT:Qt,eventCode:te.FUTURE_WRITE,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"future.cancel-write"})}function qf(t,e,n){let r=e.streamElem(t.streamTable);return s=>ui(ft,r,n,s??0,"stream.drop-readable")}function Gf(t,e,n){let r=e.streamElem(t.streamTable);return s=>ui(Tn,r,n,s??0,"stream.drop-writable")}function Xf(t,e,n){let r=e.futureElem(t.futureTable);return s=>ui(dt,r,n,s??0,"future.drop-readable")}function Yf(t,e,n){let r=e.futureElem(t.futureTable);return s=>ui(Qt,r,n,s??0,"future.drop-writable")}function Zf(t){let{EndT:e,srcInst:n,dstInst:r,srcElem:s,dstElem:o,srcIdx:i,what:a}=t,c=n.handles.remove(i);h(!(c instanceof e),`${a}: handle is not a readable ${a} end`);let l=c;h(!Me(l.shared.t,s),`${a}: source element mismatch`),h(!Me(l.shared.t,o),`${a}: destination element mismatch`),h(l.state===ue.DONE,a==="future"?"cannot lift future after previous read succeeded":"cannot lift stream after being notified that the writable end dropped"),h(l.state!==ue.IDLE,`cannot remove busy ${a}`),h(l.inWaitableSet(),`cannot lift ${a} while it's in a waitable set`);let u=e;return r.handles.add(new u(l.shared))}function Qf(t){return(e,n,r)=>Zf({EndT:ft,srcInst:t.streamTableInstance(n??0),dstInst:t.streamTableInstance(r??0),srcElem:t.streamElem(n??0),dstElem:t.streamElem(r??0),srcIdx:e??0,what:"stream"})}function ed(t){return(e,n,r)=>Zf({EndT:dt,srcInst:t.futureTableInstance(n??0),dstInst:t.futureTableInstance(r??0),srcElem:t.futureElem(n??0),dstElem:t.futureElem(r??0),srcIdx:e??0,what:"future"})}function td(t,e){return(n,r,s)=>{p(typeof n=="number"&&typeof r=="number"&&typeof s=="number","error-context transfer: expected (handle, srcTable, dstTable)");let o=e(r),i=e(s),a=o.handles.get(n);return h(!(a instanceof et),Es("error-context transfer",a)),i.handles.add(a)}}var Er=4294967295;function nd(t,e){let n=e.options(t.options),r=t.resultType===null?[]:e.resultTypes(t.resultType);return(...s)=>{let o=Ne();h(!o.inst.mayLeave,"task.return: cannot leave component instance (may_leave violation)"),h(!o.opts.async_,"task.return from a non-async task"),h((!o.factPassthrough||o.factResultTypesKnown)&&!xu(r,o.ft.results),"task.return with a result type that is not the task's result type"),h(!mf({stringEncoding:n.stringEncoding,memory:n.memory},o.factPassthrough?{stringEncoding:o.opts.stringEncoding,memory:n.memory}:o.opts),"task.return with canonical options differing from the task's");let i=Ut(s,n.coreType.params,"task.return arguments");if(o.factPassthrough){o.return_(i);return}let a=new He(tt(n),o.inst,o),c=new An(i),l=Is(a,Sn,c,o.ft.results);o.return_(l)}}function rd(){return()=>{let t=Ne();h(!t.inst.mayLeave,"task.cancel: cannot leave component instance (may_leave violation)"),h(!t.opts.async_,"task.cancel from a non-async task"),t.cancel()}}function sd(t){return()=>{p(t.backpressure>=0&&t.backpressure<2**16,"backpressure counter out of range"),t.backpressure+=1,h(t.backpressure===2**16,"backpressure counter overflow")}}function od(t){return()=>{p(t.backpressure>=0&&t.backpressure<2**16,"backpressure counter out of range"),t.backpressure-=1,h(t.backpressure<0,"backpressure counter underflow")}}function id(t){return()=>(h(!t.mayLeave,"waitable-set.new: cannot leave component instance"),t.handles.add(new Mt))}function ad(t,e,n,r="plain"){let s=e.options(t.options),o=s.cancellable;return(i,a)=>{h(!n.mayLeave,"waitable-set.wait: cannot leave component instance");let c=hc(n,i??0,"waitable-set.wait"),l=Ne(),u;if(l.deliverPendingCancel(o))u=[te.TASK_CANCELLED,0,0];else if(c.hasPendingEvent())Ge(`waitable-set.wait si=${i} FAST (pending event)`),u=c.getPendingEvent();else{if(r==="jspi")return Ge(`waitable-set.wait si=${i} BLOCKS`),c.numWaiting+=1,Je({store:n.store,task:l,readyFunc:()=>c.hasPendingEvent(),cancellable:o,produce:f=>{let d=f?[te.TASK_CANCELLED,0,0]:c.getPendingEvent();return pc(s,n,a??0,d)},onSettled:()=>{c.numWaiting-=1}});Ve("waitable-set.wait with no pending event (the calling wasm frame must block; a callback-ABI guest should return the WAIT code instead)")}return pc(s,n,a??0,u)}}function cd(t,e,n){let r=e.options(t.options),s=r.cancellable;return(o,i)=>{h(!n.mayLeave,"waitable-set.poll: cannot leave component instance");let c=hc(n,o??0,"waitable-set.poll").poll(Ne(),s);return pc(r,n,i??0,c)}}function ld(t){return e=>{h(!t.mayLeave,"waitable-set.drop: cannot leave component instance");let n=t.handles.remove(e??0);h(!(n instanceof Mt),"waitable-set.drop: handle is not a waitable set"),n.drop()}}function ud(t){return(e,n)=>{h(!t.mayLeave,"waitable.join: cannot leave component instance");let r=t.handles.get(e??0);if(h(!(r instanceof Bt),"waitable.join: handle is not a waitable"),h(r.hasSyncWaiter,"waitable.join on a waitable with a synchronous waiter"),(n??0)===0){r.join(null);return}let s=hc(t,n,"waitable.join");r.join(s)}}function fd(t){return e=>{h(!t.mayLeave,"subtask.drop: cannot leave component instance");let n=t.handles.remove(e??0);h(!(n instanceof Tt),"subtask.drop: handle is not a subtask"),n.drop()}}function iw(t,e){return()=>{let[n,r,s]=e.getPendingEvent();return p(n===te.SUBTASK&&r===(t??0)&&s===e.state,"unexpected event delivered by subtask.cancel"),p(e.resolveDelivered(),"subtask.cancel did not deliver the resolution"),e.state}}function dd(t,e,n="plain"){let r=t.async===!0;return s=>{h(!e.mayLeave,"subtask.cancel: cannot leave component instance");let o=e.handles.get(s??0);h(!(o instanceof Tt),"subtask.cancel: handle is not a subtask");let i=o,a=iw(s,i);if(h(i.resolveDelivered(),"subtask.cancel on a subtask whose resolution was already delivered"),h(i.cancellationRequested,"subtask.cancel on a subtask that was already cancelled"),h(i.inWaitableSet()&&!r,"synchronous subtask.cancel on a subtask that is in a waitable set"),i.resolved())p(i.hasPendingEvent(),"resolved subtask without a pending event at cancellation");else if(i.cancellationRequested=!0,p(i.onCancel!==null,"subtask.cancel on a subtask with no cancellation handler"),i.onCancel(e),!i.resolved()){if(!r){if(n==="jspi")return i.hasSyncWaiter=!0,Je({store:e.store,task:Ne(),readyFunc:()=>i.hasPendingEvent(),cancellable:!1,produce:()=>(i.hasSyncWaiter=!1,a()),onSettled:()=>{i.hasSyncWaiter=!1}});Ve("synchronous subtask.cancel whose callee did not resolve immediately (the calling wasm frame must block)")}if(n==="jspi"&&i.calleeTask!==null){let c=i.calleeTask,l=e.store,u=()=>i.resolved()||c.threads.every(f=>f.done())||l.waiting.some(f=>f.task===i.calleeTask);return u()?i.resolved()?a():Er:Je({store:e.store,task:Ne(),readyFunc:u,cancellable:!1,produce:()=>i.resolved()?a():Er})}return Er}return a()}}function pd(t,e="plain"){let n=t.cancellable===!0;return()=>{let r=hr();if(h(!r.task.inst.mayLeave,"thread.yield: cannot leave component instance"),r.task.deliverPendingCancel(n))return 1;if(e==="jspi")return Je({store:r.task.inst.store,task:r.task,readyFunc:()=>!0,cancellable:n,produce:s=>s?1:0});Ve("thread.yield (the calling wasm frame must block; a callback-ABI guest should return the YIELD code instead)")}}function hc(t,e,n){let r=t.handles.get(e);return h(!(r instanceof Mt),`${n}: handle ${e} is not a waitable set`),r}function pc(t,e,n,r){let[s,o,i]=r,a=new He(tt(t),e,null);return Zt(a,o,{kind:"u32"},n),Zt(a,i,{kind:"u32"},n+4),s}var aw=4294967295,cw=4294967294,lw=1,mc=8;function uw(t,e,n,r){return{async_:r,callback:e!==null,stringEncoding:fw(t.stringEncoding),memory:n}}function fw(t){switch(t){case 0:return"utf8";case 1:return"utf16";case 2:return"latin1+utf16";default:return"utf8"}}function yd(t,e){return(...n)=>{p(n.length>=mc,`prepare-call: expected at least ${mc} arguments`);let[r,s,o,i,a,c,l,u]=n;p(typeof r=="function"&&typeof s=="function","prepare-call: start/return must be funcrefs"),p(e.prepared.current===null,"prepare-call with a preparation already outstanding");let f=n.slice(mc),d=Number(u)>>>0,w=()=>(p(f.length>0,"prepare-call: retptr missing"),f[f.length-1]),y,x=!1;d===cw?(y={kind:"heap",retptr:w()},x=!0):d===aw?y={kind:"stack"}:d>br?y={kind:"heap",retptr:w()}:y={kind:"stack"},e.prepared.current={start:r,return_:s,callerInst:e.componentInstance(Number(o)>>>0),calleeInst:e.componentInstance(Number(i)>>>0),taskReturnType:Number(a)>>>0,calleeAsync:Number(c)!==0,stringEncoding:Number(l)>>>0,resultCountOrMax:d,params:f,memory:t.memory===null?null:e.memoryToken(t.memory),resultInfo:y,asyncCallerWithResult:x}}}function wd(t){let{prepared:e,callee:n,callback:r,postReturn:s,ctx:o,calleeUsesAsyncAbi:i}=t,a=t.mode??"plain",c=t.canBlock??!1,l=e.memory,u=e.calleeInst,f=o.resultTypesForTuple(e.taskReturnType),d={params:[],results:f??[],async:e.calleeAsync},w=new kr(d,uw(e,r,l,i),u,()=>{o.factStartScopes.push({taskScope:w,lenders:t.lenderScope});let x;try{x=Cn(e.start,e.asyncCallerWithResult?e.params.slice(0,-1):e.params)}finally{o.factStartScopes.pop()}return t.onStarted?.(),x},x=>{if(x===null){t.onCallerResults(null);return}let E=x,b=e.resultInfo.kind==="heap"?[...E,e.resultInfo.retptr]:E;t.onCallerResults(Cn(e.return_,b))});return w.factPassthrough=!0,w.factResultTypesKnown=f!==null,{task:w,body:function*(x){if(!(yield*w.enterImplicitThread(x)))return;let E=w.start();Ge(`mkCalleeTask callee canBlock=${c} mode=${a}`);let b=yield*xr(c?en(n,a):n,E,x);if(!i){w.return_(b),s!==null&&(p(u.mayLeave,"post-return with may_leave already false"),u.mayLeave=!1,Cn(s,b),u.mayLeave=!0,o.stats.postReturnsRun++),w.exitImplicitThread(x);return}if(r===null){Ut(b,[],"stackful callee result"),w.exitImplicitThread(x);return}let[m]=Ut(b,["i32"],"callee result");yield*dc({name:"fact-callee",task:w,thread:x,inst:u,callback:c?en(r,a):r,packed:m,stats:o.stats}),w.exitImplicitThread(x)}}}function gd(t,e){let n=t.prepared.current;return p(n!==null,`${e} without a preceding prepare-call`),t.prepared.current=null,n}function bd(t,e){return(n,r)=>{let s=gd(e,"sync-start-call");p(typeof n=="function","sync-start-call: callee funcref");let o=t.callback===null?null:e.callback(t.callback),i=null,a=[],c={addLender(d){d.numLends+=1,a.push(d)},releaseLenders(){for(let d of a)d.numLends-=1;a.length=0}},{task:l,body:u}=wd({prepared:s,callee:n,callback:o,postReturn:null,ctx:e,calleeUsesAsyncAbi:!0,mode:e.suspensionMode,canBlock:e.calleeCanBlock?.(n)??!1,onCallerResults:d=>{i=d??[]},lenderScope:c});s.calleeInst.mayEnterFrom(s.callerInst)||pe(Dt(s.calleeInst,"cannot enter component instance")),s.calleeInst.enterFrom(s.callerInst);let f=!1;try{xd(l,u).resume(),f=!0}catch(d){throw d instanceof ze||d instanceof Fe?s.calleeInst.leaveTo(s.callerInst):_t(s.calleeInst,d),c.releaseLenders(),d}if(f&&s.calleeInst.leaveTo(s.callerInst),i===null){if(e.suspensionMode==="jspi")return Je({store:s.callerInst.store,task:Ne(),readyFunc:()=>i!==null,cancellable:!1,produce:()=>(c.releaseLenders(),md(i)),onSettled:()=>c.releaseLenders()});c.releaseLenders(),Ve("sync-start-call whose async-lifted callee did not resolve in its first activation (the caller's wasm frame must block)")}return c.releaseLenders(),md(i)}}function hd(t){t.unwindLenders()}function md(t){if(!(t===null||t.length===0))return t.length===1?t[0]:t}function kd(t,e){return(n,r,s,o)=>{let i=gd(e,"async-start-call");p(typeof n=="function","async-start-call: callee funcref");let a=t.callback===null?null:e.callback(t.callback),c=new Tt,l=()=>{},{task:u,body:f}=wd({prepared:i,callee:n,callback:a,postReturn:t.postReturn===null?null:e.callback(t.postReturn),ctx:e,calleeUsesAsyncAbi:((o??0)&lw)!==0,mode:e.suspensionMode,canBlock:e.calleeCanBlock?.(n)??!1,onStarted:()=>{c.state===ne.STARTING&&(c.state=ne.STARTED,l())},onCallerResults:x=>{c.resolved()||c.resolve(x===null?c.state===ne.STARTING?ne.CANCELLED_BEFORE_STARTED:ne.CANCELLED_BEFORE_RETURNED:ne.RETURNED,[]),l()},lenderScope:c});c.onCancel=x=>u.requestCancellation(x),c.calleeTask=u,i.calleeInst.mayEnterFrom(i.callerInst)||pe(Dt(i.calleeInst,"cannot enter component instance")),i.calleeInst.enterFrom(i.callerInst);let d=!1,w;try{w=xd(u,f),w.resume(),d=!0}catch(x){throw x instanceof ze||x instanceof Fe?i.calleeInst.leaveTo(i.callerInst):_t(i.calleeInst,x),hd(c),x}d&&i.calleeInst.leaveTo(i.callerInst);let y=()=>{if(c.resolved())return c.deliverResolve(),Ge("async-start-call -> RETURNED (eager)"),ne.RETURNED;let x=i.callerInst.handles.add(c);l=()=>c.setSubtaskPendingEvent(x);let E=ti(c.state,x);return Ge(`async-start-call -> state=${c.state} i=${x} packed=0x${E.toString(16)}`),E};if(e.suspensionMode==="jspi"){let x=i.callerInst.store,E=i.calleeInst,b=ju(),m=()=>c.state===ne.STARTING&&!c.resolved()&&!w.done()&&w.waiting(),g=()=>m()?!x.hasRunnableWork(E,b):c.resolved()||w.done()||x.waiting.some(k=>k.task===u);if(!g()){let k=!1;return Je({store:i.callerInst.store,task:Ne(),readyFunc:g,cancellable:!1,produce:()=>{let T=y();return k=!0,T},onSettled:()=>{k||hd(c)}})}}return y()}}function xd(t,e){let n;return n=new In(t,function*(){yield*e(n)}()),n}var dw=2147483648,di=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}bytes(){let e=this.#e();if(e===void 0)throw new Error(`${this.#t} accessed before it was extracted`);return new Uint8Array(e.buffer)}},Td=["utf8-to-utf8","utf16-to-utf16","latin1-to-latin1","latin1-to-utf16","latin1-to-utf8","utf16-to-compact-probably-utf16","utf16-to-compact-utf16","utf16-to-latin1","utf16-to-utf8","utf8-to-compact-utf16","utf8-to-latin1","utf8-to-utf16"],pw=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function yc(t){try{return pw.decode(t)}catch{pe("invalid utf8 encoding")}}function*fi(t,e,n){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),s=0;for(;s57343){s+=1,yield[o,1];continue}(o>=56320||s+1>=n)&&pe("invalid utf16 encoding");let i=r.getUint16(e+2*(s+1),!0);(i<56320||i>57343)&&pe("invalid utf16 encoding"),s+=2,yield[65536+(o-55296<<10)+(i-56320),2]}}function hw(t){return t<128?1:t<2048?2:t<65536?3:4}function Ed(t,e,n){return n<128?(t[e]=n,1):n<2048?(t[e]=192|n>>6,t[e+1]=128|n&63,2):n<65536?(t[e]=224|n>>12,t[e+1]=128|n>>6&63,t[e+2]=128|n&63,3):(t[e]=240|n>>18,t[e+1]=128|n>>12&63,t[e+2]=128|n>>6&63,t[e+3]=128|n&63,4)}function mw(t,e,n,r){if(r<65536)return t.setUint16(e+2*n,r,!0),1;let s=r-65536;return t.setUint16(e+2*n,55296+(s>>10),!0),t.setUint16(e+2*(n+1),56320+(s&1023),!0),2}function yw(t,e,n){let r=0;for(;r191)break;r+=2}else break}return r}function vd(t,e,n){for(let r=n-1;r>=0;r--)t[e+2*r]=t[e+r],t[e+2*r+1]=0}function pt(t,e,n){return t.slice(e,e+n)}function ww(t,e,n,r,s,o){if(t.buffer!==r.buffer)return;let i=t.byteOffset+e,a=i+n,c=r.byteOffset+s,l=c+o;i{let i=e.bytes();n.bytes().set(pt(i,r,s),o)};case"utf8-to-utf8":return(r,s,o)=>{let i=e.bytes(),a=pt(i,r,s);yc(a),n.bytes().set(a,o)};case"utf16-to-utf16":return(r,s,o)=>{let i=e.bytes(),a=pt(i,r,2*s);for(let c of fi(a,0,s));n.bytes().set(a,o)};case"latin1-to-utf16":return(r,s,o)=>{let i=pt(e.bytes(),r,s),a=n.bytes();for(let c=0;c{let i=yc(pt(e.bytes(),r,s)),a=n.bytes(),c=new DataView(a.buffer,a.byteOffset,a.byteLength),l=0;for(let u=0;u{let i=pt(e.bytes(),r,2*s),a=!0;for(let[l]of fi(i,0,s))l>255&&(a=!1);let c=n.bytes();if(c.set(i,o),!a)return(s|dw)>>>0;for(let l=0;l{let i=pt(e.bytes(),r,s),a=yw(i,0,s),c=n.bytes(),l=0,u=0;for(;u{let i=e.bytes(),a=n.bytes();ww(i,r,2*s,a,o,s);let c=new DataView(i.buffer,i.byteOffset,i.byteLength),l=[];for(let u=0;u255)break;l.push(f)}for(let u=0;u{let c=pt(e.bytes(),r,2*s),l=n.bytes(),u=0,f=0,d=0;for(let[w,y]of fi(c,0,s)){if(d+=y,a!==0&&w>=128)break;let x=i-f;if(x<4&&x{let c=pt(e.bytes(),r,s),l=s;if(a!==0){for(let w=0;w=128){l=w;break}}let u=n.bytes(),f=0,d=0;for(;fi)break;d+=Ed(u,o+d,w),f++}return[f,d]};case"utf8-to-compact-utf16":return(r,s,o,i,a)=>{let c=yc(pt(e.bytes(),r,s)),l=n.bytes();vd(l,o,a);let u=new DataView(l.buffer,l.byteOffset,l.byteLength),f=i-a;c.length>f&&pe("utf8-to-compact-utf16: destination capacity exceeded");let d=0;for(let w=0;w{let c=pt(e.bytes(),r,2*s),l=n.bytes();vd(l,o,a);let u=new DataView(l.buffer,l.byteOffset,l.byteLength),f=a;for(let[d]of fi(c,0,s))f+=mw(u,o,f,d);return s+a};default:{let r=t;throw new Error(`unknown transcode op ${r}`)}}}var hi=2;function gw(t){let e=hr();p(t ${n}`,e),n>>>0}var $d=(()=>{try{return Deno.env.get("CE_CTX_TRACE")==="1"}catch{return!1}})();function pi(t){return Ee(t)}function Ad(t,e){let n=Uu();console.error(`[ctx] ${pi(e)} ${t} storage=${JSON.stringify(e.storage)} | stack=[${n.stack.map(pi).join(",")}] claims=[${n.claims.map(pi).join(",")}] resuming=${n.resuming===null?"-":pi(n.resuming)}`)}function bw(t,e){let n=hr();p(t>>0}`,n),n.storage[t]=e>>>0}function Id(t){let e=/^context-(get|set)-i32-(\d+)$/.exec(t);if(e===null)throw new Wt("M2",`component imports the unsafe intrinsic '${t}', which has no portable meaning in a JS host (only context.{get,set} do)`);let n=Number(e[2]);return h(n>=hi,`unsafe intrinsic '${t}' addresses context slot ${n}, but a thread has ${hi}`),e[1]==="get"?()=>gw(n):r=>{bw(n,(r??0)>>>0)}}var kw={9:"wasm `unreachable` instruction executed",17:"cannot enter component instance",23:"cannot leave component instance",24:"cannot block a synchronous task before returning",25:"invalid `char` bit pattern",30:"string content out-of-bounds",31:"list content out-of-bounds",32:"invalid variant discriminant",33:"unaligned pointer",46:"reference count overflow",49:"uncaught exception propagated out of component"},xw=49,Ew={"lower-import":"M0",trap:"M0","enter-sync-call":"M0","exit-sync-call":"M0","resource-new":"M1","resource-rep":"M1","resource-drop":"M1",transcoder:"M1","resource-transfer-own":"M1","resource-transfer-borrow":"M1"};function vw(t){return Ew[t]??"M2"}var wc=class{numBorrows=0;lenders=[];addLender(e){e.numLends+=1,this.lenders.push(e)}releaseLenders(){for(let e of this.lenders)e.numLends-=1;this.lenders.length=0}};function Rd(t,e){let n=Aw(t,e);return(...r)=>{try{return n(...r)}catch(s){throw e.trapState.pending=s,s}}}function V(t,e){let n=t.instance;return p(typeof n=="number",`trampoline '${t.kind}' has no declared component instance`),e.componentInstance(n)}var Tw=(()=>{try{return Deno.env.get("CE_SCOPE_TRACE")==="1"}catch{return!1}})(),Cd=new WeakMap,Sw=1;function $w(t){if(t==null)return"NONE(->ctx fallback)";let e=Cd.get(t);return e===void 0&&(e=Sw++,Cd.set(t,e)),`T${e}`}function gc(t,e="?"){let n=Ft(),r=n?.syncCallStack??t.syncCallStack;return Tw&&console.error(`[scope] ${e} act=${$w(n)} depth=${r.length}`),r}function Aw(t,e){switch(t.kind){case"lower-import":{let n=t;return e.loweredImport(n)}case"trap":return n=>{if(n===xw){let s=e.trapState.pending;if(s!==void 0)throw s}let r=n===void 0?void 0:kw[n];pe(r===void 0?`FACT adapter trap (code ${n??"?"})`:`wasm trap: ${r}`)};case"enter-sync-call":return(n,r,s)=>{if(typeof n=="number"&&typeof s=="number"){let i=e.componentInstance(n>>>0),a=e.componentInstance(s>>>0);a.mayEnterFrom(i)||pe(Dt(a,"cannot enter component instance"))}e.stats.enterSyncCalls++,gc(e,"enter").push(new wc)};case"exit-sync-call":return(...n)=>{e.stats.exitSyncCalls++,p(e.stats.exitSyncCalls<=e.stats.enterSyncCalls,"exit-sync-call without matching enter-sync-call");let r=gc(e,"exit").pop();p(r!==void 0,"exit-sync-call with an empty sync-call stack"),h(r.numBorrows>0,"cannot return from a call with outstanding borrow handles"),r.releaseLenders()};case"resource-new":{let n=t,r=e.componentInstance(n.instance),s=e.resourceToken(n.resource);return o=>qu(r,s,o>>>0)}case"resource-rep":{let n=t,r=e.componentInstance(n.instance),s=e.resourceToken(n.resource);return o=>Xu(r,s,o>>>0)}case"resource-drop":{let n=t,r=e.componentInstance(n.instance),s=e.resourceToken(n.resource);return o=>{Gu(r,s,o>>>0)}}case"transcoder":{let n=t;if(n.from64||n.to64)throw new Wt("M2",`transcoder '${n.op}' over a 64-bit linear memory`);if(!Td.includes(n.op))throw new Wt("M2",`unknown string transcode operation '${n.op}'`);return Sd(n.op,e.runtimeMemory(n.from),e.runtimeMemory(n.to))}case"task-return":return nd(t,e);case"task-cancel":return rd();case"backpressure-inc":return sd(V(t,e));case"backpressure-dec":return od(V(t,e));case"waitable-set-new":return id(V(t,e));case"waitable-set-wait":return ad(t,e,V(t,e),e.suspensionMode);case"waitable-set-poll":return cd(t,e,V(t,e));case"waitable-set-drop":return ld(V(t,e));case"waitable-join":return ud(V(t,e));case"subtask-drop":return fd(V(t,e));case"subtask-cancel":return dd(t,V(t,e),e.suspensionMode);case"thread-yield":return pd(t,e.suspensionMode);case"prepare-call":return yd(t,e);case"sync-start-call":return bd(t,e);case"async-start-call":return kd(t,e);case"stream-new":return Pf(t,e,V(t,e));case"future-new":return Lf(t,e,V(t,e));case"stream-read":return Uf(t,e,V(t,e));case"stream-write":return Wf(t,e,V(t,e));case"future-read":return jf(t,e,V(t,e));case"future-write":return Kf(t,e,V(t,e));case"stream-cancel-read":return Hf(t,e,V(t,e));case"stream-cancel-write":return zf(t,e,V(t,e));case"future-cancel-read":return Vf(t,e,V(t,e));case"future-cancel-write":return Jf(t,e,V(t,e));case"stream-drop-readable":return qf(t,e,V(t,e));case"stream-drop-writable":return Gf(t,e,V(t,e));case"future-drop-readable":return Xf(t,e,V(t,e));case"future-drop-writable":return Yf(t,e,V(t,e));case"error-context-new":return Ff(t,e,V(t,e));case"error-context-debug-message":return Bf(t,e,V(t,e));case"error-context-drop":return Mf(V(t,e));case"stream-transfer":return Qf(e);case"future-transfer":return ed(e);case"error-context-transfer":return td(e,n=>e.errorContextTableInstance(n));case"resource-transfer-own":return(n,r,s)=>Iw(e,n>>>0,r,s);case"resource-transfer-borrow":return(n,r,s)=>Cw(e,n>>>0,r,s);default:throw new Wt(vw(t.kind)==="M1"?"M1":"M2",`component requires host trampoline '${t.kind}'`)}}function Iw(t,e,n,r){let s=t.resourceTableInstance(n),o=t.resourceTableInstance(r),i=t.resourceToken(n),a=t.resourceToken(r),c=s.handles.remove(e);h(!(c instanceof Be),"transfer-own: not a resource handle");let l=c;return h(l.rt!==i,"transfer-own: resource type mismatch"),h(l.numLends!==0,"cannot remove owned resource while borrowed (handle still lent out)"),h(!l.own,"transfer-own: expected an owning handle"),o.handles.add(new Be(a,l.rep,!0))}function Cw(t,e,n,r){let s=t.resourceTableInstance(n),o=t.resourceTableInstance(r),i=t.resourceToken(n),a=t.resourceToken(r),c=t.factStartScopes[t.factStartScopes.length-1],l=gc(t),u=l[l.length-1];p(c!==void 0||u!==void 0,"transfer-borrow outside an enter-sync-call/exit-sync-call bracket or FACT start window");let f=s.handles.get(e);h(!(f instanceof Be),"transfer-borrow: not a resource handle");let d=f;if(h(d.rt!==i,"transfer-borrow: resource type mismatch"),(c?.lenders??u).addLender(d),a.impl!==null&&a.impl===o)return d.rep;let w=c!==void 0?c.taskScope:u;return w.numBorrows+=1,o.handles.add(new Be(a,d.rep,!1,w))}var Rw=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})(),yi=class{options;constructor(e={}){this.options=e}};function Ld(t){return new yi(t??{})}var mi=new WeakMap;async function Nd(t){let e=t.loadedPlan??bn(t.plan);if(e.wire!==t.plan)throw new v("instantiateComponent: `loadedPlan` was converted from a different plan document than `plan`");let n=new kc(e,t);return await n.verifyComponent(),await n.compileModules(),n.bindImportedResources(),await n.runInitializers(),n.finish()}var kc=class{wire;loaded;componentBytes;adapterBytes;hostImports;verifyHash;suspensionMode;stats=Sf();modules=[];instances=[];componentInstances=new Map;store=new ur;unsafeIntrinsics=new Map;preparedCall={current:null};liveMemories=new Map;wrappedEntries=!1;wrappedImports=!1;noteEntry(){return this.suspensionMode==="jspi"&&(this.wrappedEntries=!0),this.suspensionMode}noteImport(){return this.suspensionMode==="jspi"&&(this.wrappedImports=!0),this.suspensionMode}taskMayBlock=new WebAssembly.Global({value:"i32",mutable:!0},1);memories=[];reallocs=[];postReturns=[];callbacks=[];tables=[];lowerings=new Map;trampolineCache=new Map;hostResourceTypes=new Map;syncCallStack=[];factStartScopes=[];suspendableFuncs=new WeakSet;sawBlockingImport=!1;suspendableLowerings=new Set;trapState={pending:void 0};omittedExports=new Map;constructor(e,n){this.loaded=e,this.wire=e.wire,this.componentBytes=n.componentBytes,this.adapterBytes=n.adapters??new Map,this.hostImports=n.imports??{},this.verifyHash=n.verifyHash??!0,this.suspensionMode=bf(n.jspi,xf(e.wire)||Ao(this.hostImports))}async verifyComponent(){let{sha256:e,len:n}=this.wire.component;if(this.componentBytes.length!==n)throw new v(`component byte length ${this.componentBytes.length} != plan's ${n}`);if(!this.verifyHash)return;let r=await crypto.subtle.digest("SHA-256",this.componentBytes.slice().buffer),s=[...new Uint8Array(r)].map(o=>o.toString(16).padStart(2,"0")).join("");if(s!==e)throw new v(`component sha256 mismatch: plan has ${e}, bytes are ${s}`)}async compileModules(){let e=mi.get(this.wire);if(e!==void 0&&e.componentBytes===this.componentBytes&&this.wire.modules.every((s,o)=>s.kind==="embedded"||e.adapterRefs[o]===this.adapterBytes.get(s.file))){this.modules.push(...await e.modules);return}let n=Promise.all(this.wire.modules.map((s,o)=>{if(s.kind==="embedded"){let a=s.offset+s.len;if(a>this.componentBytes.length)throw new v(`module ${o}: byte range ${s.offset}..${a} exceeds component size ${this.componentBytes.length}`);return WebAssembly.compile(this.componentBytes.slice(s.offset,a).buffer)}let i=this.adapterBytes.get(s.file);if(!i)throw new v(`adapter artifact ${s.file} not provided`);if(i.length!==s.len)throw new v(`adapter ${s.file}: expected ${s.len} bytes, got ${i.length}`);return WebAssembly.compile(i.slice().buffer)})),r={componentBytes:this.componentBytes,adapterRefs:this.wire.modules.map(s=>s.kind==="embedded"?void 0:this.adapterBytes.get(s.file)),modules:n};mi.set(this.wire,r),n.catch(()=>{mi.get(this.wire)===r&&mi.delete(this.wire)}),this.modules.push(...await n)}bindImportedResources(){(this.wire.importedResources??[]).forEach((n,r)=>{let s=this.wire.imports[n.import],o=Pd(s.name,s.path),i=this.lookupHostImport(s.name,s.path,o);if(!(i instanceof yi))throw new v(`host import '${o}' must be a HostResourceType (the component imports a resource type); got ${bc(i)}`);let a=i.options.dtor;this.wire.resourceTables.forEach((c,l)=>{if(c.kind!=="concrete"||c.resource!==r)return;let u=this.loaded.resourceTokens[l];u.impl=null,u.dtor=a===void 0?null:f=>a(f)}),this.hostResourceTypes.set(r,i)})}async runInitializers(){for(let e of this.wire.initializers)switch(e.op){case"instantiate-module":{let n=this.modules[e.module];if(n===void 0)throw new v(`instantiate-module: no module ${e.module}`);let r=WebAssembly.Module.imports(n);if(r.length!==e.args.length)throw new v(`module ${e.module}: ${r.length} imports but ${e.args.length} args in plan`);let s={};this.sawBlockingImport=!1;let o=new Map;r.forEach((a,c)=>{let l=this.sawBlockingImport,u=this.importValue(e.args[c]);!l&&this.sawBlockingImport&&Rw&&console.error(`[suspendable] module ${e.module}: import ${a.module}.${a.name} (${JSON.stringify(e.args[c])})`);let f=`${a.module}\0${a.name}`,d=o.get(f);if(d!==void 0&&d.value!==u)throw new v(`module ${e.module}: duplicate import ${JSON.stringify(a.module)}.${JSON.stringify(a.name)} at arg indices ${d.index} and ${c} resolve to different values (plan args[${d.index}]=${JSON.stringify(e.args[d.index])}, args[${c}]=${JSON.stringify(e.args[c])})`);o.set(f,{index:c,value:u}),(s[a.module]??={})[a.name]=u});let i;try{i=await WebAssembly.instantiate(n,s)}catch(a){throw a?.constructor?.name==="SuspendError"?new be("cannot block a synchronous task before returning"):a}if(this.sawBlockingImport)for(let a of Object.values(i.exports))typeof a=="function"&&this.suspendableFuncs.add(a);this.instances.push(i);break}case"lower-import":{this.lowerings.set(e.index,e.import);break}case"extract-memory":{let n=this.resolveCoreExport(e.export);if(!(n instanceof WebAssembly.Memory))throw new v(`extract-memory ${e.index}: resolved to non-memory`);this.memories[e.index]=n;break}case"extract-realloc":{this.reallocs[e.index]=this.resolveFunction(e.def,`extract-realloc ${e.index}`);break}case"extract-callback":{this.callbacks[e.index]=this.resolveFunction(e.def,`extract-callback ${e.index}`);break}case"extract-post-return":{this.postReturns[e.index]=this.resolveFunction(e.def,`extract-post-return ${e.index}`);break}case"extract-table":{let n=this.resolveCoreExport(e.export);if(!(n instanceof WebAssembly.Table))throw new v(`extract-table ${e.index}: resolved to non-table`);this.tables[e.index]=n;break}case"resource":{let n=e.dtor===null?null:this.resolveFunction(e.dtor,`resource ${e.index} dtor`),r=this.componentInstance(e.instance),s=Su(this.loaded,e.index);this.wire.resourceTables.forEach((o,i)=>{if(o.kind==="concrete"&&o.resource===s){let a=this.loaded.resourceTokens[i];if(a.impl=r,a.dtor=n===null?null:c=>{n(c)},n!==null&&this.suspensionMode==="jspi"&&this.suspendableFuncs.has(n))try{a.dtorHost=en(n,this.suspensionMode)}catch{a.dtorHost=null}}});break}default:{let n=e;throw new v(`unsupported initializer op ${n.op}`)}}}finish(){let e={};for(let r of this.wire.exports){let s=this.buildExport(r,r.name);s.kind==="value"&&(e[r.name]=s.value)}Ef(this.suspensionMode,this.wrappedEntries,this.wrappedImports);let n=[];for(let[r,s]of this.componentInstances)n[r]=s;return{exports:e,stats:this.stats,componentInstances:n,coreInstances:this.instances,suspendableFuncs:this.suspendableFuncs,taskMayBlock:this.taskMayBlock,hostResourceTypes:this.hostResourceTypes,omittedExports:this.omittedExports,loadedPlan:this.loaded}}buildExport(e,n){switch(e.kind){case"lifted-func":{let r=this.funcType(e.type,`export '${n}'`),s=this.resolveFunction(e.coreDef,`export '${n}'`),o=this.resolveOptions(e.options),i=fc({name:n,ft:r,opts:o,core:s,stats:this.stats,suspensionMode:this.noteEntry(),trapState:this.trapState,syncCallStack:this.syncCallStack,allInstances:()=>this.componentInstances.values()});return this.suspensionMode==="jspi"&&e.name.startsWith("[constructor]")&&(i[ci]=fc({name:`${n} (sync entry)`,ft:r,opts:o,core:s,stats:this.stats,suspensionMode:"plain",trapState:this.trapState,syncCallStack:this.syncCallStack,allInstances:()=>this.componentInstances.values()})),{kind:"value",value:i}}case"instance":{let r={};for(let s of e.exports){let o=this.buildExport(s,`${n}/${s.name}`);o.kind==="value"&&(r[s.name]=o.value)}return{kind:"value",value:r}}case"type":return this.omittedExports.set(n,"type export: no runtime surface (plan-format.md)"),{kind:"omitted",reason:"type export: no runtime surface"};default:{let r=e;throw new v(`unsupported export kind ${r.kind}`)}}}componentInstance(e){let n=this.componentInstances.get(e);return n===void 0&&(n=new ni(e,this.store),this.componentInstances.set(e,n)),n}liveMemory(e){let n=this.liveMemories.get(e);return n===void 0&&(n=new Ps(()=>this.memories[e],`memory ${e}`),this.liveMemories.set(e,n)),n}unsafeIntrinsic(e){let n=this.unsafeIntrinsics.get(e);return n===void 0&&(n=Id(e),this.unsafeIntrinsics.set(e,n)),n}importValue(e){let n=this.resolveCoreDef(e);if(typeof n=="function"&&this.suspendableFuncs.has(n)&&(this.sawBlockingImport=!0),this.suspensionMode!=="jspi"||e.kind!=="trampoline"||typeof n!="function")return n;let r=this.wire.trampolines[e.index];if(r===void 0)return n;let s=i=>this.wire.canonicalOptions[i]?.async===!0,o=r;if(o.kind==="lower-import"){let i=o.lowered;return this.suspendableLowerings.has(i)?(this.sawBlockingImport=!0,this.noteImport(),nc(n,"jspi")):n}return kf(o,s)?(si(o,s)&&(this.sawBlockingImport=!0),this.noteImport(),nc(n,"jspi")):n}resolveCoreDef(e){switch(e.kind){case"export":return this.resolveCoreExport({instance:e.instance,item:e.item});case"instance-flags":return this.componentInstance(e.instance).flags;case"trampoline":return this.trampoline(e.index);case"unsafe-intrinsic":return this.unsafeIntrinsic(e.intrinsic);case"task-may-block":return this.taskMayBlock;default:{let n=e;throw new v(`unsupported CoreDef kind ${n.kind}`)}}}resolveCoreExport(e){let n=this.instances[e.instance];if(n===void 0)throw new v(`core export ref: runtime instance ${e.instance} not created yet`);let r=n.exports[e.item.name];if(r===void 0)throw new v(`core instance ${e.instance} has no export '${e.item.name}'`);return r}resolveFunction(e,n){let r=this.resolveCoreDef(e);if(typeof r!="function")throw new v(`${n}: resolved to non-function`);return r}trampoline(e){let n=this.trampolineCache.get(e);if(n!==void 0)return n;let r=this.wire.trampolines[e];if(r===void 0)throw new v(`no trampoline ${e} in plan`);let s=Rd(r,{componentInstance:o=>this.componentInstance(o),resourceToken:o=>{let i=this.loaded.resourceTokens[o];if(i===void 0)throw new v(`no resource table ${o} in plan`);return i},runtimeMemory:o=>new di(()=>this.memories[o],`runtime memory ${o}`),resourceTableInstance:o=>{let i=this.wire.resourceTables[o];if(i===void 0)throw new v(`no resource table ${o} in plan`);if(i.kind!=="concrete")throw new v(`resource table ${o} is abstract (type-only) and has no runtime handle table`);return this.componentInstance(i.instance)},options:o=>this.resolveOptions(o),resultTypes:o=>this.resultTypes(o),callback:o=>{let i=this.callbacks[o];if(i===void 0)throw new v(`callback ${o} accessed before its extract-callback initializer ran`);return i},memoryToken:o=>this.liveMemory(o),streamElem:o=>{if(o>=this.loaded.streamElems.length)throw new v(`stream table ${o} is not in the plan's streamTables (plan v2)`);return this.loaded.streamElems[o]},streamTableInstance:o=>{let i=this.loaded.streamTableInstances[o];if(i===void 0)throw new v(`stream table ${o} is not in the plan's streamTables (plan v2)`);return this.componentInstance(i)},futureTableInstance:o=>{let i=this.loaded.futureTableInstances[o];if(i===void 0)throw new v(`future table ${o} is not in the plan's futureTables (plan v2)`);return this.componentInstance(i)},errorContextTableInstance:o=>{let i=this.loaded.errorContextTableInstances[o];if(i===void 0)throw new v(`error-context table ${o} is not in the plan's errorContextTables (plan v3)`);return this.componentInstance(i)},resultTypesForTuple:o=>{let i=this.loaded.resultTupleTypes.get(o);return i===void 0?null:this.resultTypes(i)},futureElem:o=>{if(o>=this.loaded.futureElems.length)throw new v(`future table ${o} is not in the plan's futureTables (plan v2)`);return this.loaded.futureElems[o]},prepared:this.preparedCall,suspensionMode:this.suspensionMode,calleeCanBlock:o=>this.suspendableFuncs.has(o),syncCallStack:this.syncCallStack,factStartScopes:this.factStartScopes,trapState:this.trapState,loweredImport:o=>this.buildLoweredImport(o),stats:this.stats});return this.trampolineCache.set(e,s),s}buildLoweredImport(e){let n=this.lowerings.get(e.lowered);if(n===void 0)throw new v(`lower-import trampoline: lowering ${e.lowered} was never initialized (initializer order violation)`);let r=this.wire.imports[n];if(r===void 0)throw new v(`no import ${n} in plan`);let s=Pd(r.name,r.path),o=this.lookupHostImport(r.name,r.path,s);if(typeof o!="function")throw new v(`host import '${s}' missing or not a function (got ${bc(o)})`);let i=this.funcType(e.type,`import '${s}'`),a=this.resolveOptions(e.options),c=Qe(o);return c&&this.suspendableLowerings.add(e.lowered),Cf({name:s,ft:i,opts:a,hostFn:o,stats:this.stats,mode:this.suspensionMode,suspendable:c})}lookupHostImport(e,n,r){if(!(e in this.hostImports))throw new v(`host import '${r}' not provided (no key '${e}' in imports)`);let s=this.hostImports[e],o=[];for(let i of n){if(s===null||typeof s!="object")throw new v(`host import '${r}': '${[e,...o].join("/")}' is ${bc(s)}, expected an object to read '${i}' from`);s=s[i],o.push(i)}return s}resultTypes(e){let n=this.loaded.types[e];if(n===void 0)throw new v(`task-return results: no type ${e}`);if(n.kind!=="value"||n.type.kind!=="tuple")throw new v(`task-return results: type ${e} is not a tuple type`);return n.type.elements}funcType(e,n){let r=this.loaded.types[e];if(r===void 0)throw new v(`${n}: no type ${e}`);if(r.kind!=="func")throw new v(`${n}: type ${e} is not a function type`);return r.funcType}resolveOptions(e){let n=this.wire.canonicalOptions[e];if(n===void 0)throw new v(`no canonicalOptions ${e} in plan`);let r=n.memory;return{stringEncoding:n.stringEncoding,memory:r===null?null:this.liveMemory(r),realloc:n.realloc===null?null:()=>this.reallocs[n.realloc],postReturn:n.postReturn===null?null:()=>this.postReturns[n.postReturn],callback:n.callback===null?null:()=>this.callbacks[n.callback],async:n.async,cancellable:n.cancellable,coreType:n.coreType,instance:this.componentInstance(n.instance)}}};function Pd(t,e){return e.length===0?t:`${t}/${e.join("/")}`}function bc(t){return t===null?"null":t===void 0?"undefined":typeof t=="object"?`a ${t.constructor?.name??"object"}`:`a ${typeof t}`}function wi(t){return Object.freeze({hostEnd:t})}var vr=class{t;values;length;progress;#e;constructor(e,n,r){if(this.t=e,this.values=n,this.length=r,this.progress=0,this.#e=[],!Number.isInteger(r)||r<0)throw new RangeError(`host buffer length must be a non-negative integer, got ${r}`);if(r>gr)throw new RangeError(`host buffer length ${r} exceeds the Component Model's Buffer.MAX_LENGTH (${gr})`)}remain(){return this.length-this.progress}isZeroLength(){return this.length===0}read(e){p(e<=this.remain(),"host buffer read beyond remaining");let n=this.values===null?new Array(e).fill(null):this.values.slice(this.progress,this.progress+e);return this.progress+=e,n}write(e){p(e.length<=this.remain(),"host buffer write beyond remaining"),this.#e.push(e),this.progress+=e.length}taken(){if(this.t!==null&&K(this.t).kind==="u8"){if(this.#e.length===1&&this.#e[0]instanceof Uint8Array)return this.#e[0];let r=new Uint8Array(this.progress),s=0;for(let o of this.#e){if(o instanceof Uint8Array)r.set(o,s);else for(let i=0;ithis.#n=e),Ku(this.#t),this.#e.pendingHostCalls.add(this.#t))}notify(){let e=this.#t,n=this.#n;this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.(),this.#o()}pump(){let e=this.#e;if(e!==null){for(;;){let n=e.serviceSettled(),r=e.tick();if(!n&&!r)break}this.#r||mr(e)||(this.#r=!0,this.#i(e))}}async#i(e){try{for(;!mr(e);){if(St(e)>0){await lc(e);continue}await cc(e,()=>e.pendingHostCalls.size===0||mr(e)||St(e)>1,"host stream/future activity")}}catch(n){e.hostFailure??=n}finally{this.#r=!1}this.notify()}close(){let e=this.#t,n=this.#n;this.#s=!0,this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.()}};function gi(t,e,n){let r=t;p(r.onLowered==null,"internal: a second host wrapper was built for an already-wrapped stream/future (the wrapper cache should have returned the first)"),r.onLowered=o=>{n?.(),e.bind(o.store)};let s=t.boundStore;s&&e.bind(s)}function Od(t,e){let n=wi("write"),r=wi("read"),s={read:!1,write:!1},o=i=>{i===D.DROPPED?e.close():e.notify()};return{writable:{write(i){if(s.write)throw new TypeError("a write is already in flight on this stream's writable end; await it or cancelWrite() first");let a=new vr(t.t,i,i.length);return new Promise(c=>{s.write=!0,t.write(n,a,l=>{a.remain()>0||(l(),s.write=!1,e.notify(),c(a.progress))},l=>{s.write=!1,o(l),c(a.progress)}),e.notify(),e.pump()})},async writeAll(i){let a=0;for(;a{s.read=!0,t.read(r,a,l=>{l(),s.read=!1,e.notify(),c(a.taken())},l=>{s.read=!1,o(l),c(a.taken())}),e.notify(),e.pump()})},cancelRead(){s.read&&(s.read=!1,t.cancel(),e.notify(),e.pump())},drop(){t.drop(),e.close(),e.pump()}}}}var xc=new WeakMap,Ec=new WeakMap;function vc(t){let e=new vt(t),n=new Tr;gi(e,n);let s={...Od(e,n),value:e};return xc.set(e,s),s}function _d(t){let e=t;p(e instanceof vt,"hostStreamFor expects a lifted stream value");let n=xc.get(e);if(n!==void 0)return n;let r=new Tr;gi(e,r);let o={...Od(e,r),value:t};return xc.set(e,o),o}function Dd(t){let e=new ut(t),n=new Tr,r={lowered:!1};gi(e,n,()=>r.lowered=!0);let s=Fd(e,n,e,r);return Ec.set(e,s),s}function Tc(t){let e=t;p(e instanceof ut,"hostFutureFor expects a lifted future value");let n=Ec.get(e);if(n!==void 0)return n;let r=new Tr,s={lowered:!1};gi(e,r,()=>s.lowered=!0);let o=Fd(e,r,t,s);return Ec.set(e,o),o}function Fd(t,e,n,r){let s=wi("write"),o=wi("read"),i={any:!1},a=!1,c=u=>{i.any=!1,u===D.COMPLETED&&(a=!0),u===D.DROPPED?e.close():e.notify()},l={write(u){if(i.any)throw new TypeError("an operation is already in flight on this future; await it or cancel() first");let f=new vr(t.t,[u],1);return new Promise(d=>{i.any=!0,t.write(s,f,w=>{c(w),d()}),e.notify(),e.pump()})},readResult(){if(i.any)throw new TypeError("an operation is already in flight on this future; await it or cancel() first");if(t.dropped)return Promise.resolve({value:void 0,result:D.DROPPED});let u=new vr(t.t,null,1);return new Promise(f=>{i.any=!0,t.read(o,u,d=>{c(d),f({value:u.taken()[0],result:d})}),e.notify(),e.pump()})},async read(){return(await l.readResult()).value},cancel(){i.any&&(i.any=!1,t.cancel(),e.notify(),e.pump())},drop(){!a&&r.lowered&&!t.dropped?lf(t,new Error("the host dropped the writable end of this future without writing a value")):t.drop(),e.close(),e.pump()},value:n};return l}function J(t){let e=t.split("-");return e[0]+e.slice(1).map(Bd).join("")}function nt(t){return t.split("-").map(Bd).join("")}function Bd(t){return t.length===0?t:t[0].toUpperCase()+t.slice(1)}var Pw=/^\[([a-z-]+)\](.*)$/;function Ls(t){let e=Pw.exec(t);if(e===null)return{form:"plain",name:t};let[,n,r]=e;switch(n){case"constructor":return{form:"constructor",resource:r};case"method":case"static":{let s=r.indexOf(".");if(s<0)break;return{form:n,resource:r.slice(0,s),member:r.slice(s+1)}}}return{form:"plain",name:t}}var Ns=class t{#e;buildHash;constructor(e,n){this.#e=e,this.buildHash=n;for(let r of["memory","ts_alloc","ts_dealloc","ts_translate"])if(!(r in this.#e))throw new v(`shim module missing export '${r}'`)}static async create(e){let n,r=null;if(e instanceof WebAssembly.Module)n=e;else{n=await WebAssembly.compile(e.slice().buffer);let o=await crypto.subtle.digest("SHA-256",e.slice().buffer);r=Array.from(new Uint8Array(o)).map(i=>i.toString(16).padStart(2,"0")).join("")}let s=await WebAssembly.instantiate(n,{});return new t(s.exports,r)}static fromExports(e,n={}){return new t(e,n.buildHash??null)}translate(e){let n=this.translateRaw(e),{wire:r,adapters:s}=Co(n);return{plan:r,adapters:s,envelopeJson:n}}translateRaw(e){let n=this.#e,r=n.ts_alloc(e.length);new Uint8Array(n.memory.buffer,r,e.length).set(e);let s=n.ts_alloc(4),o=n.ts_translate(r,e.length,s),i=new DataView(n.memory.buffer).getUint32(s,!0),a=new TextDecoder().decode(new Uint8Array(n.memory.buffer,o,i));return n.ts_dealloc(o,i),n.ts_dealloc(s,4),n.ts_dealloc(r,e.length),a}};var Rn=class extends Error{constructor(e){super(e),this.name="NameCollisionError"}};function Lw(t){if("wire"in t&&"types"in t)return t;let e="plan"in t?t.plan:t;return bn(e)}function Sc(t){let e=Lw(t);return e.wire.imports.map(n=>{let r=n.path.length===0?n.name:n.path[n.path.length-1],s=Ls(r),o={interfaceId:n.name,path:[...n.path],leaf:r,kind:n.kind,member:s,jsName:Nw(s,n.kind)};if(s.form!=="plain"&&(o.jsClass=nt(s.resource)),n.type!==void 0){let i=e.types[n.type];i!==void 0&&i.kind==="func"&&(o.type={params:i.funcType.params.map((a,c)=>({name:i.paramNames[c]??String(c),type:a})),results:i.funcType.results,async:i.funcType.async===!0})}return o})}function Nw(t,e){switch(t.form){case"plain":return e==="resource"?nt(t.name):J(t.name);case"constructor":return"constructor";case"method":case"static":return J(t.member)}}var $c=To,bi=class{drop(){Md(this)}[Symbol.dispose](){Md(this)}},Ow=t=>{if(!(!t.valid||!t.owns)){if(t.valid=!1,t.lends>0){t.pendingDrop=!0;return}Ud(t)}},ki=new FinalizationRegistry(Ow);function Ud(t){try{yr(t.rt,t.rep,null,!0)}catch(e){_w(t.rt,e)}}function _w(t,e){let n=t.impl?.store;n!==void 0&&n.hostFailure===void 0&&(n.hostFailure=e)}function Wd(t,e){e.copyUrl??=wn,t[$c]=e,e.owns&&ki.register(t,e,t)}function xi(t){let e=t[$c];if(e!==void 0)return e.copyUrl===wn?e:void 0}function Dw(t){return t[$c]!==void 0}function Fw(t,e){let n=xi(t);if(n===void 0)throw Dw(t)?new je(`${e}: ${gn("this resource handle","Resource wrappers hold a rep in the minting copy's tables; there is no by-value form \u2014 call through the copy that created it.")}`):new je(`${e}: not a resource handle`);if(!n.valid)throw new je(`${e}: this ${n.className} handle is no longer valid (it was transferred as own<\u2026>, dropped, or was a borrow that outlived its call)`);return n}function Md(t){let e=xi(t);if(!(e===void 0||!e.valid)&&(e.valid=!1,ki.unregister(t),!!e.owns)){if(e.lends>0){e.pendingDrop=!0;return}yr(e.rt,e.rep,null,!0)}}function jd(t){let e=xi(t);if(e===void 0)return()=>{};e.lends+=1;let n=!1;return()=>{n||(n=!0,Bw(e))}}function Bw(t){t.lends-=1,!(t.lends>0||!t.pendingDrop)&&(t.pendingDrop=!1,Ud(t))}function Kd(t){let e=xi(t);e!==void 0&&(e.valid=!1,ki.unregister(t))}function Ac(t,e,n){if(typeof t!="object"||t===null)throw new je(`${n}: expected a resource class instance, got ${typeof t}`);let r=Fw(t,n);if(e){if(r.lends>0)throw new je(`${n}: this ${r.className} handle is still lent out as a borrow to an in-flight call and cannot be transferred`);r.valid=!1,ki.unregister(t)}return r.rep}function Ic(t,e,n,r){let s=nt(t.name),o=class extends bi{constructor(...i){if(super(),t.ctor===null)throw new TypeError(`${s} has no WIT constructor; use its static functions`);let a=`${s} constructor`,c=r(i,t.ctorParams??[],a),l=t.ctor(...c);if(l!==null&&typeof l=="object"&&"then"in l)throw new TypeError(`${a}: the guest constructor did not complete synchronously. A JS constructor cannot await; expose an async factory instead.`);if(typeof l!="number")throw new TypeError(`${a}: expected an own handle rep, got ${typeof l}`);Wd(this,{rep:l,valid:!0,owns:!0,rt:e,className:s,lends:0,pendingDrop:!1})}};Object.defineProperty(o,"name",{value:s});for(let i of t.methods){let a=J(i.member),c=`${s}.${a}`;Object.defineProperty(o.prototype,a,{configurable:!0,writable:!0,value:function(...l){return n(i.raw,i.params,i.results,c,[this,...l])}})}for(let i of t.statics){let a=J(i.member),c=`${s}.${a} (static)`;Object.defineProperty(o,a,{configurable:!0,writable:!0,value:(...l)=>n(i.raw,i.params,i.results,c,l)})}return o}function Cc(t,e,n,r){let s=Object.create(t.prototype);return Wd(s,{rep:e,valid:!0,owns:r,rt:n,className:t.name??"resource",lends:0,pendingDrop:!1}),s}var Os=class{className;#e;#t;#n;constructor(e){this.className=e,this.#e=new Map,this.#t=new WeakMap,this.#n=1}repFor(e){if(e===null||typeof e!="object")throw new TypeError(`${this.className}: expected a class instance, got ${typeof e}`);let n=this.#t.get(e);if(n!==void 0&&this.#e.has(n))return n;let r=this.#n++;return this.#e.set(r,e),this.#t.set(e,r),r}hasInstance(e){if(e===null||typeof e!="object")return!1;let n=this.#t.get(e);return n!==void 0&&this.#e.has(n)}hasRep(e){return this.#e.has(e)}releaseIfPresent(e){this.#e.delete(e)}lookup(e){let n=this.#e.get(e);if(n===void 0)throw new je(`${this.className}: no live instance for rep ${e}`);return n}release(e){let n=this.lookup(e);return this.#e.delete(e),n}dtor(e){let n=this.#e.get(e);n!==void 0&&(this.#e.delete(e),n[Symbol.dispose]?.())}get liveCount(){return this.#e.size}};var Vd=new WeakMap;function Jd(t,e,n){let r=as(n)?n:new Xt(e,n),s=t.value;Vd.set(t.value,r);let o=s.boundStore;return o!=null&&typeof o=="object"?(o.hostFailure===void 0&&(o.hostFailure=r),!0):!1}function Rc(t,e="stream"){let n=Vd.get(t);if(n!==void 0)throw n;_s(t,e)}function _s(t,e,n){let r=af(t);if(r!==void 0)throw new Rt(e,r,n)}function qd(t){return t!==null&&K(t).kind==="u8"}var rt=class t{#e;#t;#n=!1;#s=!1;#r=[];constructor(e,n){this.#e=e,this.#t=n}static fromLifted(e,n){return new t(_d(e),n)}static fromHostStream(e,n){return new t(e,n)}static create(){let e=new t(null,null);return{stream:e,writer:new Ti(e)}}bindElement(e){if(this.#e!==null)return;this.#t=e,this.#e=vc(e.element),Xd(this,this.#e);let n=this.#r;this.#r=[];for(let r of n)r()}whenBound(){return this.#e!==null?Promise.resolve():new Promise(e=>this.#r.push(e))}get bound(){return this.#e!==null}takeValue(e){if(this.bindElement(e),this.#n)throw new TypeError("this Stream handle has already been passed to a guest; a stream value may only be transferred once");return this.#n=!0,this.#e.value}get codec(){return this.#t}#o(){if(this.#e===null)throw new TypeError("this Stream was created with Stream.create() and has not been passed to a guest yet, so it has no element type; pass it first, or use the writer, which parks until then");return this.#e}async read(e){let n=this.#o(),r=this.#t?.where??"stream read";Rc(n.value,r);let s=await n.readable.read(e);return s.length===0&&_s(n.value,r),this.#i(s)}#i(e){let n=this.#t;return qd(n.element)?e instanceof Uint8Array?e:Uint8Array.from(e):(e instanceof Uint8Array?Array.from(e):e).map(s=>n.toHost(s))}cancelRead(){this.#e?.readable.cancelRead()}drop(){this.#s||(this.#s=!0,this.#e?.readable.drop())}dropForTeardown(){this.#s||(this.#s=!0,this.#e!==null&&xs(this.#e.value))}[Symbol.dispose](){this.drop()}readable(){let e=this;return new ReadableStream({async pull(n){let r=await e.read(Hd);if(r.length===0){n.close();return}n.enqueue(r)},cancel(){e.drop()}})}async*[Symbol.asyncIterator](){for(;;){let e=await this.read(Hd);if(e.length===0)return;yield e}}},Hd=4096,Ti=class{#e;constructor(e){this.#e=e}async write(e){await this.#e.whenBound();let n=Ei(this.#e),r=this.#e.codec?.where??"stream write";Rc(n.value,r);let s=await n.writable.write(Pc(e,this.#e.codec));return s{let o=Tc(s);return r.adopt(o),o}),n);return r}adopt(e){this.#e=e}takeValue(){if(this.#e===null)throw new TypeError("this Future is still in flight and cannot be passed to a guest yet");if(this.#s)throw new TypeError("this Future handle has already been passed to a guest");return this.#s=!0,this.#e.value}#i(){return this.#o??=(async()=>{let e=await this.#t,{value:n,result:r}=await e.readResult();if(r!==D.COMPLETED)throw _s(e.value,this.#n.where??"future read"),new Gt(r===D.CANCELLED?"the future read was cancelled":"the future's write end was dropped without a value");return this.#n.toHost(n)})(),this.#o}then(e,n){return this.#i().then(e,n)}cancel(){this.#e!==null?this.#e.cancel():this.#t.then(e=>e.cancel())}drop(){this.#r||(this.#r=!0,this.#e!==null?this.#e.drop():this.#t.then(e=>e.drop(),()=>{}))}dropForTeardown(){this.#r||(this.#e!==null?(this.#r=!0,xs(this.#e.value)):this.drop())}[Symbol.dispose](){this.drop()}},Pn=class{message;internal;constructor(e){this.internal=e,this.message=e.debugMessage}};ye(rt.prototype,os);ye($t.prototype,is);ye(Pn.prototype,kt);function Yd(t,e){if(t instanceof rt)return t.takeValue(e);if(Pe(t,os))throw new TypeError(gn("this stream handle","To pipe it by value, pass `src.readable()` instead."));let n=vc(e.element),r=rt.fromHostStream(n,e);return Xd(r,n),Mw(t,n,e),n.value}function Pc(t,e){let n=qd(e.element);if(t instanceof Uint8Array)return n?t:Array.from(t).map(s=>e.fromHost(s));let r=t.map(s=>e.fromHost(s));return n?Uint8Array.from(r):r}var Lc=Symbol("deltic reader gone");async function Mw(t,e,n){let r=n.where??"stream producer",s,o=0,i=new Promise(a=>e.writable.onDropped(()=>a(Lc)));try{for await(let a of Uw(t,i)){let c=Pc(a,n),l;try{l=await e.writable.writeAll(c)}catch(u){throw zd(c,u instanceof Rt?u.progress??0:0,n),u}if(o+=l,l{});return}if(r.done)return;yield vi(r.value)}}finally{n.releaseLock()}}if(Symbol.asyncIterator in t){let n=t[Symbol.asyncIterator]();try{for(;;){let r=n.next(),s=await Promise.race([r,e]);if(s===Lc){t.cancel?.();try{let o=await r;o.done||(yield vi(o.value))}catch{}return}if(s.done)return;yield vi(s.value)}}finally{await n.return?.()}}for(let n of t)yield vi(n)}function vi(t){return t instanceof Uint8Array||Array.isArray(t)?t:[t]}function Ww(t){return typeof ReadableStream<"u"&&t instanceof ReadableStream}function Zd(t,e){if(t instanceof $t)return t.takeValue();if(Pe(t,is))throw new TypeError(gn("this future handle","To pipe it by value, pass `Promise.resolve(f)` instead."));let n=Dd(e.element);return(async()=>{try{let r=await t;await n.write(e.fromHost(r))}catch(r){Jd({value:n.value},e.where??"future producer",r)||n.drop()}})(),n.value}var $r=class{#e=[];add(e){this.#e.push(e)}end(){for(let e of this.#e)e();this.#e.length=0}},jw=new $r,Qd=new WeakSet;function $i(t,e,n){if(Qd.has(t))return;let r=new Map;for(let s of e){let o=J(s),i=r.get(o);if(i!==void 0)throw new Rn(`${n}: the labels '${i}' and '${s}' both map to the JS name '${o}'. Rename one in the WIT; the conventions layer will not guess which one wins.`);r.set(o,s)}Qd.add(t)}function $e(t,e,n,r=jw,s=!1){switch(e.kind){case"bool":case"s8":case"u8":case"s16":case"u16":case"s32":case"u32":case"s64":case"u64":case"f32":case"f64":case"char":case"string":return t;case"error-context":return new Pn(t);case"list":return K(e.element).kind==="u8"?t instanceof Uint8Array?t:Uint8Array.from(t):t.map(i=>$e(i,e.element,n,r));case"record":{$i(e,e.fields.map(a=>a.label),`${n.where}: record`);let o=t,i={};for(let a of e.fields){if(a.type.kind==="option"){let c=o[a.label];if("none"in c)continue;i[J(a.label)]=$e(c.some,a.type.type,n,r,!0);continue}i[J(a.label)]=$e(o[a.label],a.type,n,r)}return i}case"tuple":{let o=t;return e.elements.map((i,a)=>$e(o[String(a)],i,n,r))}case"variant":{let[o,i]=Si(t,n),a=e.cases.find(c=>c.label===o);if(a===void 0)throw new TypeError(`${n.where}: unknown variant case '${o}'`);return a.type===null?{kind:o}:{kind:o,value:$e(i,a.type,n,r)}}case"enum":{let[o]=Si(t,n);return o}case"option":{let[o,i]=Si(t,n);return s?o==="none"?{kind:"none"}:{kind:"some",value:$e(i,e.type,n,r,!0)}:o==="none"?void 0:$e(i,e.type,n,r,!0)}case"result":{let[o,i]=Si(t,n),a=o==="error"?"err":"ok",c=o==="error"?e.error:e.ok;return c===null?{kind:a}:{kind:a,value:$e(i,c,n,r)}}case"flags":{$i(e,e.labels,`${n.where}: flags`);let o=t,i={};for(let a of e.labels)i[J(a)]=!!o[a];return i}case"map":return $e(t,K(e),n,r);case"own":return n.bridge.liftOwn(t,e);case"borrow":return n.bridge.liftBorrow(t,e,r);case"stream":return rt.fromLifted(t,Ai(e.element,n));case"future":return $t.fromLifted(t,Ai(e.element,n))}}function Si(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`${e.where}: expected a single-key case object, got ${Ln(t)}`);let n=Object.keys(t);if(n.length!==1)throw new TypeError(`${e.where}: expected exactly one case key, got ${n.length}`);return[n[0],t[n[0]]]}function Te(t,e,n,r=!1){switch(e.kind){case"bool":return!!t;case"u8":return Sr(t,e.kind,0,255,n);case"u16":return Sr(t,e.kind,0,65535,n);case"u32":return Sr(t,e.kind,0,4294967295,n);case"s8":return Sr(t,e.kind,-128,127,n);case"s16":return Sr(t,e.kind,-32768,32767,n);case"s32":return Sr(t,e.kind,-2147483648,2147483647,n);case"u64":return ep(t,e.kind,0n,(1n<<64n)-1n,n);case"s64":return ep(t,e.kind,-(1n<<63n),(1n<<63n)-1n,n);case"f32":case"f64":if(typeof t!="number")throw new TypeError(`${n.where}: ${e.kind} expects a number`);return t;case"char":{if(typeof t!="string"||[...t].length!==1)throw new TypeError(`${n.where}: char expects a single-code-point string`);let s=t.codePointAt(0);if(s>=55296&&s<=57343)throw new TypeError(`${n.where}: char expects a Unicode scalar value, got the lone surrogate U+${s.toString(16).toUpperCase()}`);return t}case"string":if(typeof t!="string")throw new TypeError(`${n.where}: string expects a string`);return t;case"error-context":{if(t instanceof Pn)return t.internal;if(t instanceof et)return t;throw Pe(t,kt)?new TypeError(`${n.where}: ${gn("this error-context")}`):new TypeError(`${n.where}: expected an ErrorContext`)}case"list":{if(K(e.element).kind==="u8"){if(t instanceof Uint8Array)return t;if(Array.isArray(t))return Uint8Array.from(t);throw new TypeError(`${n.where}: list expects a Uint8Array`)}if(!Array.isArray(t))throw new TypeError(`${n.where}: list expects an array`);return t.map(o=>Te(o,e.element,n))}case"record":{if(t===null||typeof t!="object")throw new TypeError(`${n.where}: record expects an object`);$i(e,e.fields.map(i=>i.label),`${n.where}: record`);let s=t,o={};for(let i of e.fields){let a=J(i.label);if(i.type.kind==="option"){let c=s[a];o[i.label]=c===void 0?{none:null}:{some:Te(c,i.type.type,n,!0)};continue}if(!(a in s))throw new TypeError(`${n.where}: record field '${a}' is missing`);o[i.label]=Te(s[a],i.type,n)}return o}case"tuple":{if(!Array.isArray(t)||t.length!==e.elements.length)throw new TypeError(`${n.where}: tuple expects an array of ${e.elements.length}`);let s={};return e.elements.forEach((o,i)=>{s[String(i)]=Te(t[i],o,n)}),s}case"variant":{let{kind:s,value:o,has:i}=Nc(t,n),a=e.cases.find(c=>c.label===s);if(a===void 0)throw new TypeError(`${n.where}: unknown variant case '${s}'`);if(a.type===null)return{[s]:null};if(!i)throw new TypeError(`${n.where}: variant case '${s}' needs a 'value'`);return{[s]:Te(o,a.type,n)}}case"enum":{if(typeof t!="string"||!e.labels.includes(t))throw new TypeError(`${n.where}: enum expects one of ${e.labels.join(" | ")}, got `+Ln(t));return{[t]:null}}case"option":{if(r){let{kind:s,value:o,has:i}=Nc(t,n);if(s==="none")return{none:null};if(s!=="some")throw new TypeError(`${n.where}: a nested option must be { kind: "some" | "none" }`);return{some:i?Te(o,e.type,n,!0):null}}return t===void 0?{none:null}:{some:Te(t,e.type,n,!0)}}case"result":{let{kind:s,value:o,has:i}=Nc(t,n);if(s!=="ok"&&s!=="err")throw new TypeError(`${n.where}: a result value must be { kind: "ok" | "err" }`);let a=s==="err"?"error":"ok",c=s==="err"?e.error:e.ok;if(c===null)return{[a]:null};if(!i)throw new TypeError(`${n.where}: result case '${s}' carries a payload and needs a 'value'`);return{[a]:Te(o,c,n)}}case"flags":{if(t===null||typeof t!="object")throw new TypeError(`${n.where}: flags expects an object`);$i(e,e.labels,`${n.where}: flags`);let s=t,o={};for(let i of e.labels)o[i]=!!s[J(i)];return o}case"map":return Te(t,K(e),n);case"own":return n.bridge.lowerOwn(t,e);case"borrow":return n.bridge.lowerBorrow(t,e);case"stream":return Yd(t,Ai(e.element,n));case"future":return Zd(t,Ai(e.element,n))}}function Nc(t,e){if(t===null||typeof t!="object"||!("kind"in t))throw new TypeError(`${e.where}: expected a { kind, value? } value, got ${Ln(t)}`);let n=t;if(typeof n.kind!="string")throw new TypeError(`${e.where}: 'kind' must be a string`);return{kind:n.kind,value:n.value,has:"value"in n}}function Sr(t,e,n,r,s){if(typeof t!="number"||!Number.isInteger(t))throw new TypeError(`${s.where}: ${e} expects an integer number`);if(tr)throw new TypeError(`${s.where}: ${e} out of range: ${t}`);return t}function ep(t,e,n,r,s){if(typeof t!="bigint")throw new TypeError(`${s.where}: ${e} expects a bigint`);if(tr)throw new TypeError(`${s.where}: ${e} out of range: ${t}`);return t}function Ai(t,e){return{element:t,where:e.where,toHost:n=>t===null?void 0:$e(n,t,e),fromHost:n=>t===null?null:Te(n,t,e),release:t!==null&&t.kind==="own"?n=>e.bridge.dropOwn(n,t):void 0}}function Ln(t){return t===null?"null":t===void 0?"undefined":typeof t=="object"?`a ${t.constructor?.name??"object"}`:`a ${typeof t} (${String(t)})`}var Nn=class extends Error{constructor(e){super(e),this.name="ImportRegistrationError"}},Fs=class extends Error{constructor(e){super(e),this.name="ImportResolutionError"}},Kw=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?$/;function Ds(t){let e=t.lastIndexOf("@");if(e<0)return{base:t,version:null,semver:null};let n=t.slice(0,e),r=t.slice(e+1);return{base:n,version:r,semver:tp(r)}}function tp(t){let e=Kw.exec(t);return e===null?null:{major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:e[4]===void 0?[]:e[4].split("."),build:e[5]??null}}function Oc(t,e){return e.prerelease.length>0?null:e.major>0?`${t}@${e.major}`:e.minor>0?`${t}@0.${e.minor}`:null}function np(t){let e=Ds(t);return e.version===null||e.semver!==null?null:/^\d+$/.test(e.version)?e.version==="0"?null:t:/^0\.\d+$/.test(e.version)?t:null}var Bs=class{#e=new Map;#t=new Map;#n=new Map;constructor(e){for(let n of Object.keys(e)){if(this.#e.has(n))throw new Nn(`duplicate import key '${n}'`);this.#e.set(n,e[n]),this.#s(n)}}#s(e){let n=np(e);if(n!==null){this.#r(n,{key:e,version:null});return}let r=Ds(e);if(r.version==="0")throw new Nn(`import key '${e}': '@0' is not a compatibility track. Major 0 tracks the MINOR version (\`@0.2\`), so no version canonicalizes to '@0' and this registration could never be resolved.`);if(r.version===null){(r.base.includes("/")||r.base.includes(":"))&&this.#n.set(r.base,e);return}if(r.semver===null)return;let s=Oc(r.base,r.semver);s!==null&&this.#r(s,{key:e,version:r.semver})}#r(e,n){let r=this.#t.get(e);if(r===void 0){this.#t.set(e,n);return}if(r.version===null!=(n.version===null)){let[s,o]=r.version===null?[r.key,n.key]:[n.key,r.key];throw new Nn(`import registration is ambiguous on compatibility track '${e}': the track key '${s}' and the full version '${o}' are both registered. Register one or the other, never both.`)}if(r.version===null)throw new Nn(`compatibility track '${e}' is claimed twice ('${r.key}' and '${n.key}')`);rp(n.version,r.version)>0&&this.#t.set(e,n)}keys(){return[...this.#e.keys()]}resolve(e){if(this.#e.has(e))return{key:e,value:this.#e.get(e)};let n=Ds(e);if(n.semver!==null){let r=Oc(n.base,n.semver);if(r!==null){let o=this.#t.get(r);if(o!==void 0)return{key:o.key,value:this.#e.get(o.key)}}let s=this.#n.get(n.base);if(s!==void 0)throw new Fs(`import '${e}' is versioned but the only registration for '${n.base}' is the unversioned key '${s}'. Version-agnostic folding is banned (contracts/embedder-api.md, C0 finding D-1): register '${n.base}@${n.version}' or the compatibility-track key '${Oc(n.base,n.semver)??n.base+"@"+n.version}'.`);return}if(n.version===null){let r=[...this.#e.keys()].filter(s=>Ds(s).base===n.base);if(r.length>0)throw new Fs(`import '${e}' is unversioned but the registrations for it are versioned (${r.join(", ")}). Version-agnostic folding is banned (contracts/embedder-api.md, C0 finding D-1).`)}}};function rp(t,e){if(t.major!==e.major)return t.major-e.major;if(t.minor!==e.minor)return t.minor-e.minor;if(t.patch!==e.patch)return t.patch-e.patch;let n=t.prerelease,r=e.prerelease;if(n.length===0&&r.length===0)return 0;if(n.length===0)return 1;if(r.length===0)return-1;for(let s=0;st===null?void 0:$e(n,t,e),fromHost:n=>t===null?null:Te(n,t,e)}}function On(t,e){let{wire:n,adapters:r}=Co(t);return{plan:n,componentBytes:e,adapters:r}}async function zw(t){if("plan"in t)return t;let e=t.translator instanceof Ns?t.translator:await Ns.create(t.translator),{plan:n,adapters:r}=e.translate(t.componentBytes);return{plan:n,componentBytes:t.componentBytes,adapters:r}}async function _n(t,e={},n={}){let r=await zw(t),s=new Dc(r,e),o=await Nd({plan:r.plan,componentBytes:r.componentBytes,adapters:r.adapters,imports:s.rawImports,jspi:n.jspi,verifyHash:n.verifyHash,loadedPlan:s.loaded});s.bind(o);let i={exports:s.buildExports(o),handle:o,imports:s.leaves};return Object.defineProperty(i,Vw,{value:s.hostRegistries,enumerable:!1}),i}var Vw=Symbol("deltic.embedder.hostRegistries"),Dc=class{artifacts;leaves;rawImports;#e;#t;#n;loaded;#s;#r;hostRegistries;#o;constructor(e,n){this.artifacts=e,this.rawImports={},this.#t=new Map,this.#n=new Map,this.#r=null,this.hostRegistries=new Map,this.#o=!1,this.#y=[],this.#e=new Bs(n),this.loaded=bn(e.plan),e.plan.resourceTables.forEach((s,o)=>{if(s.kind!=="concrete")return;let i=this.loaded.resourceTokens[o];i!==void 0&&this.#n.set(i,s.resource)}),this.leaves=Sc(this.loaded);let r=this.leaves.filter(s=>s.kind==="resource");if(r.length>0&&(e.plan.importedResources??[]).length===0)throw new v(`this component imports the resource type(s) ${r.map(s=>`'${s.leaf}'`).join(", ")}, but the plan carries no \`importedResources\` table, so they cannot be bound to a ResourceIndex (contracts/plan-format.md v0.2). Re-translate with a shim that emits it.`);this.#s=this.#u(),this.#d(),this.#l()}bind(e){if(e.loadedPlan!==this.loaded)throw new v("the executor instantiated from a different LoadedPlan than the facade built its import wrappers from; resource identity tokens would not match")}#i(e){let n=this.#n.get(e);if(n===void 0)throw new v("resource type is not bound to any resource table in this plan");return n}#a(e){let n=this.#i(e),r=this.#t.get(n);if(r===void 0){if(!this.#o)throw new v(`a guest-implemented resource (ResourceIndex ${n}) crossed the boundary before instantiation finished \u2014 a guest \`start\` function passed an own/borrow handle to a host import. Its class is assembled from the component's own lifted exports, which do not exist yet. Host-implemented resources are unaffected. If a real component needs this, the class must be built lazily from the plan's export table instead of the runtime's export surface.`);r={kind:"guest",name:`resource-${n}`},this.#t.set(n,r)}return r}#c(e){return e.cls??=Ic({name:e.name,ctor:null,ctorParams:null,methods:[],statics:[]},{impl:null,dtor:null},()=>Promise.reject(new TypeError("no methods")),()=>[]),e.cls}#l(){let e=this.artifacts.plan.importedResources??[];for(let n of this.#y){let r=e.findIndex(s=>s.import===n.importIndex);r<0||(this.#t.set(r,{kind:"host",name:this.leaves[n.importIndex].leaf,registry:n.registry,cls:n.cls}),this.hostRegistries.set(r,n.registry))}}#u(){let e=this;return{liftOwn(n,r){let s=e.#a(r.rt);return s.kind==="host"?s.registry.release(n):Cc(e.#c(s),n,r.rt,!0)},liftBorrow(n,r,s){let o=e.#a(r.rt);if(o.kind==="host")return o.registry.lookup(n);let i=Cc(e.#c(o),n,r.rt,!1);return s.add(()=>Kd(i)),i},lowerOwn(n,r){let s=e.#a(r.rt);return s.kind==="host"?s.registry.repFor(n):Ac(n,!0,`own<${s.name}>`)},lowerBorrow(n,r){let s=e.#a(r.rt);if(s.kind==="host"){let a=s.registry.hasInstance(n),c=s.registry.repFor(n);return a||e.#r?.push(()=>s.registry.releaseIfPresent(c)),c}let o=Ac(n,!1,`borrow<${s.name}>`),i=jd(n);return e.#r===null?i():e.#r.push(i),o},dropOwn(n,r){let s=e.#a(r.rt);if(s.kind==="host"){s.registry.dtor(n);return}yr(r.rt,n,null,!0)}}}#f(e){return{bridge:this.#s,where:e}}#p(e,n){let r=this.loaded;if(e===void 0)throw new v(`${n}: no type index`);let s=r.types[e];if(s===void 0||s.kind!=="func")throw new v(`${n}: type ${e} is not a function type`);return s.funcType}#d(){this.leaves.forEach((e,n)=>{let r=this.#h(e),s=e.path.length===0?null:Jw(this.rawImports,e.interfaceId,e.path.slice(0,-1)),o=this.#m(e,n,r);s===null?this.rawImports[e.interfaceId]=o:s[e.path[e.path.length-1]]=o})}#h(e){if(e.path.length===0&&e.member.form!=="plain"){let s=e.member.resource,o=this.#e.resolve(s)??this.#e.resolve(J(s));if(o===void 0)throw new v(`host import '${ht(e)}' not provided: the component imports the world-level resource '${s}'; provide its class under the key '${J(s)}' (registered: ${this.#e.keys().join(", ")||""})`);return o.value}let n=this.#e.resolve(e.interfaceId)??(e.path.length===0?this.#e.resolve(J(e.interfaceId)):void 0);if(n===void 0)throw new v(`host import '${ht(e)}' not provided (no key '${e.interfaceId}' in imports; registered: ${this.#e.keys().join(", ")||""})`);let r=n.value;for(let s of e.path.slice(0,-1)){if(r===null||typeof r!="object")throw new v(`host import '${ht(e)}': '${s}' is not reachable (${Ln(r)})`);r=r[s]}return r}#m(e,n,r){if(e.kind==="resource")return this.#k(e,n,r);if(e.kind!=="func")throw new v(`host import '${ht(e)}': unsupported import kind '${e.kind}'`);let s=this.#x(e,r),o=null,i=(...a)=>{if(o===null){let c=this.#p(this.artifacts.plan.imports[n].type,`import '${ht(e)}'`);o=this.#E(e,c,s)}return o(...a)};return Qe(s)?ie(i):i}#k(e,n,r){let s=e.path.length===0?r:_c(r,[],[nt(e.leaf),e.leaf]);if(s===void 0)throw new v(`host import '${ht(e)}': the component imports the resource type '${e.leaf}'; provide the implementing class as '${nt(e.leaf)}'`);let o=new Os(nt(e.leaf));return this.#y.push({importIndex:n,registry:o,cls:s}),Ld({name:e.leaf,dtor:i=>o.dtor(i)})}#y;#x(e,n){let r=e.member;if(r.form==="plain"){let i=e.path.length===0?n:_c(n,[],[J(r.name),r.name]);if(typeof i!="function")throw new v(`host import '${ht(e)}' missing or not a function (got ${Ln(i)}); expected '${J(r.name)}'`);let a=e.path.length===0?void 0:n,c=l=>i.apply(a,l);return Qe(i)?ie(c):c}let s=nt(r.resource),o=e.path.length===0?n:_c(n,[],[s,r.resource]);if(o===void 0)throw new v(`host import '${ht(e)}': no class '${s}' provided`);switch(r.form){case"constructor":return i=>new o(...i);case"method":{let i=qw(o?.prototype,J(r.member)),a=c=>{let[l,...u]=c,f=l?.[J(r.member)];if(typeof f!="function")throw new be(`host import '${ht(e)}': the ${s} instance has no method '${J(r.member)}'`);return f.apply(l,u)};return Qe(i)?ie(a):a}case"static":{let i=o[J(r.member)];if(typeof i!="function")throw new v(`host import '${ht(e)}': ${s} has no static '${J(r.member)}'`);let a=c=>i.apply(o,c);return Qe(i)?ie(a):a}}}#E(e,n,r){let s=`import '${ht(e)}'`,o=this.#f(s),i=n.results.length===0?null:n.results[0],a=i!==null&&i.kind==="result",c=u=>{if(i!==null){if(a){let f=i;return{ok:f.ok===null?null:Te(u,f.ok,o)}}return Te(u,i,o)}},l=(u,f)=>{if(rr(u)&&a){let w=i;return{error:w.error===null?null:Te(u.payload,w.error,o)}}if(Xw(f),sr(u))throw u;if(rr(u))throw new be(`${s} threw a ComponentException, but its WIT type has no err side; only a fallible import may signal an error value`);let d=Pt();throw new be(`${s} threw ${Yw(u)}. An unbranded throw from a host import is a host bug and becomes a trap: signal a WIT error with \`throw new ComponentException(payload)\`.`+(d===""?"":` (${d} \u2014 an error carrying no deltic brand in a multi-copy graph usually means a pre-A9 runtime copy threw it, issue #83.)`))};return(...u)=>{let f=new $r,d=n.params.map((y,x)=>$e(u[x],y,o,f)),w;try{w=r(d)}catch(y){return f.end(),l(y,d)}return Gw(w)?i!==null&&i.kind==="future"?(f.end(),c(w)):w.then(y=>(f.end(),c(y)),y=>(f.end(),l(y,d))):(f.end(),c(w))}}buildExports(e){this.#o=!0;let n={},r=[];for(let s of this.artifacts.plan.exports)s.kind==="instance"?n[s.name]=this.#w(s.name,s.exports,e.exports[s.name]):r.push(s);return r.length>0&&Object.assign(n,this.#w("",r,e.exports)),n}#w(e,n,r){let s={},o=new Map,i=(u,f)=>{let d=o.get(u);if(d!==void 0)throw new Rn(`export '${e||""}': the leaves '${d}' and '${f}' both map to the JS name '${u}'. Rename one in the WIT; the conventions layer will not guess which one wins.`);return o.set(u,f),u},a=new Map,c=new Map,l=u=>{let f=a.get(u);return f===void 0&&(f={name:u,ctor:null,ctorParams:null,methods:[],statics:[]},a.set(u,f)),f};for(let u of n){if(u.kind==="type"){if(u.type.kind==="resource"){let x=this.loaded.resourceTokens[u.type.resource];if(x!==void 0&&this.#n.has(x)){let E=this.#n.get(x),b=this.#t.get(E);b===void 0?this.#t.set(E,{kind:"guest",name:u.name}):b.kind==="guest"&&(b.name=u.name)}}continue}if(u.kind==="instance")throw new v(`export '${e||""}/${u.name}': nested instance exports are not surfaced by the conventions layer (only one level of interface nesting exists in plan v2)`);if(u.kind!=="lifted-func")throw new v(`export '${e||""}/${u.name}': unsupported export kind '${u.kind}'`);let f=r[u.name];if(typeof f!="function")throw new v(`export '${e||""}/${u.name}': the runtime produced no callable for this lifted function`);let d=this.#p(u.type,`export '${e}/${u.name}'`),w=Ls(u.name),y=e===""?u.name:`${e}#${u.name}`;switch(w.form){case"plain":s[i(J(w.name),w.name)]=this.#b(f,d,y);break;case"constructor":{let x=l(w.resource);x.ctor=f[ci]??f,x.ctorParams=d.params,sp(d.results[0],c,w.resource);break}case"method":{l(w.resource).methods.push({member:w.member,raw:f,params:d.params,results:d.results}),sp(d.params[0],c,w.resource);break}case"static":{l(w.resource).statics.push({member:w.member,raw:f,params:d.params,results:d.results});break}}}for(let[u,f]of a){let d=c.get(u);if(d===void 0)throw new v(`export '${e}': resource '${u}' has leaves but no own/borrow type to identify it by`);let w=Ic(f,d,(x,E,b,m,g)=>this.#b(x,{params:E,results:b},m)(...g),(x,E,b)=>x.map((m,g)=>Te(m,E[g],this.#f(b))));s[i(nt(u),u)]=w;let y=this.#n.get(d);y!==void 0&&this.#t.set(y,{kind:"guest",name:u,cls:w})}return s}#g(e,n,r){let s=[],o=this.#r;this.#r=s;let i;try{i=e.map((c,l)=>Te(n[l],c,r))}catch(c){for(let l of s)l();throw c}finally{this.#r=o}let a=!1;return{lowered:i,release:()=>{if(!a){a=!0;for(let c of s)c()}}}}#b(e,n,r){let s=this.#f(r),o=n.results.length===0?null:n.results[0];if(o!==null&&o.kind==="future"){let i=o.element;return(...a)=>{if(a.length!==n.params.length)throw new TypeError(`${r}: expected ${n.params.length} argument(s), got ${a.length}`);let{lowered:c,release:l}=this.#g(n.params,a,s),u;try{u=Promise.resolve(e(...c))}catch(f){throw l(),f}return u.then(l,l),$t.deferred(u,Hw(i,s))}}return async(...i)=>{if(i.length!==n.params.length)throw new TypeError(`${r}: expected ${n.params.length} argument(s), got ${i.length}`);let{lowered:a,release:c}=this.#g(n.params,i,s),l;try{l=await e(...a)}finally{c()}if(o!==null){if(o.kind==="result"){let u=l;if("error"in u)throw new j(o.error===null?void 0:$e(u.error,o.error,s));return o.ok===null?void 0:$e(u.ok,o.ok,s)}return $e(l,o,s)}}}};function sp(t,e,n){t!==void 0&&(t.kind==="own"||t.kind==="borrow")&&e.set(n,t.rt)}function ht(t){return t.path.length===0?t.interfaceId:`${t.interfaceId}/${t.path.join("/")}`}function Jw(t,e,n){let r=t[e]??={};for(let s of n)r=r[s]??={};return r}function _c(t,e,n){let r=t;for(let s of e){if(r===null||typeof r!="object")return;r=r[s]}if(r===null||typeof r!="object")return n.length===0?r:void 0;for(let s of n){let o=r[s];if(o!==void 0)return o}}function qw(t,e){for(let n=t;n!==null&&(typeof n=="object"||typeof n=="function");n=Object.getPrototypeOf(n)){let r=Object.getOwnPropertyDescriptor(n,e);if(r!==void 0)return"value"in r?r.value:void 0}}function Gw(t){return t!==null&&typeof t=="object"&&"then"in t&&typeof t.then=="function"}function Xw(t){for(let e of t)if(e instanceof rt||e instanceof $t)try{e.dropForTeardown()}catch{}}function Yw(t){return t instanceof Error?`${t.name}: ${t.message}`:Ln(t)}Io({url:wn,runtimeVersion:xa,protocolGeneration:$o});var Zw=new Set(["a","button","div","footer","h1","header","input","label","li","section","span","strong","ul"]),Qw=new Set(["class","id"]),eg={input:new Set(["type","placeholder"]),label:new Set(["for"]),a:new Set(["href"])},tg=/^#(\/[a-z-]*)?$/,ng=new Set(["click","dblclick","input","change","keydown","blur"]);function Ii(t){if(!Zw.has(t))throw new Error(`surface: tag <${t}> is not in the allowlist`)}function Fc(t,e){if(!(Qw.has(e)||eg[t]?.has(e)))throw new Error(`surface: attribute '${e}' is not allowed on <${t}>`)}function Ci(t,e,n){switch(Fc(t,e),`${t} ${e}`){case"input type":if(n!=="text"&&n!=="checkbox")throw new Error(`surface: input type '${n}' is not allowed`);return;case"a href":if(!tg.test(n))throw new Error(`surface: href '${n}' rejected (fragment routes only)`);return;default:return}}function Ri(t){if(!ng.has(t))throw new Error(`surface: event kind '${t}' is not in the allowlist`)}function Pi(t,e){let n="#text";class r{rep;tag;isRoot=!1;constructor(l){Ii(l),this.tag=l,this.rep=t.create(l)}setAttribute(l,u){s(this,"set-attribute"),Ci(this.tag,l,u),t.attr(this.rep,l,u)}removeAttribute(l){s(this,"remove-attribute"),Fc(this.tag,l),t.attr(this.rep,l,null)}appendChild(l){s(this,"append-child"),t.append(this.rep,l.rep)}before(l){t.before(this.rep,l.rep)}after(l){t.after(this.rep,l.rep)}remove(){t.remove(this.rep)}setTextContent(l){t.text(this.rep,l)}setValue(l){o(this,"set-value"),t.value(this.rep,l)}setChecked(l){o(this,"set-checked"),t.checked(this.rep,l)}focus(){s(this,"focus"),t.focus(this.rep)}[Symbol.dispose](){this.isRoot||t.free(this.rep)}}function s(c,l){if(c.tag===n)throw new Error(`surface: ${l} is not valid on a text node`)}function o(c,l){if(c.tag!=="input")throw new Error(`surface: ${l} is only valid on , not <${c.tag}>`)}function i(){let c=Object.create(r.prototype);return c.rep=t.root,c.tag="div",c.isRoot=!0,c}function a(c){let l=Object.create(r.prototype);return l.rep=t.textNode(c),l.tag=n,l.isRoot=!1,l}return{imports:{"polymorph:todomvc-spike/dom@0.0.1":{Element:r,createElement:c=>new r(c),createTextNode:c=>a(c)},"polymorph:todomvc-spike/events@0.0.1":{listen:(c,l,u)=>{if(c.tag===n)throw new Error("surface: listen is not valid on a text node");Ri(l),t.listen(c.rep,l,u)}},"polymorph:todomvc-spike/shell@0.0.1":{root:()=>i(),route:e}},flush:()=>t.flush(),drain:()=>t.drain()}}function Li(t,e,n,r){t.addEventListener(e,s=>{let o={token:n,kind:e};if(e==="keydown"){let a=s.key;o.key=a,a==="Enter"&&s.preventDefault()}let i=s.currentTarget;i&&typeof i.value=="string"&&(o.value=i.value),i&&i.type==="checkbox"&&(o.checked=i.checked),r(o)})}function op(t,e){return{root:t,create:n=>document.createElement(n),textNode:n=>document.createTextNode(n),attr:(n,r,s)=>{let o=n;s===null?o.removeAttribute(r):o.setAttribute(r,s)},append:(n,r)=>n.appendChild(r),before:(n,r)=>n.before(r),after:(n,r)=>n.after(r),remove:n=>{n!==t&&n.remove()},text:(n,r)=>{n.textContent=r},value:(n,r)=>{n.value=r},checked:(n,r)=>{n.checked=r},focus:n=>n.focus(),listen:(n,r,s)=>Li(n,r,s,e),free:()=>{},flush:()=>{},drain:()=>Promise.resolve()}}function Ni(t){let e=1,n=[],r=o=>{n.push(o)},s=o=>o;return{root:0,create:o=>{let i=e++;return r(["create",i,o]),i},textNode:o=>{let i=e++;return r(["textnode",i,o]),i},attr:(o,i,a)=>r(["attr",s(o),i,a]),append:(o,i)=>r(["append",s(o),s(i)]),before:(o,i)=>r(["before",s(o),s(i)]),after:(o,i)=>r(["after",s(o),s(i)]),remove:o=>r(["remove",s(o)]),text:(o,i)=>r(["text",s(o),i]),value:(o,i)=>r(["value",s(o),i]),checked:(o,i)=>r(["checked",s(o),i]),focus:o=>r(["focus",s(o)]),listen:(o,i,a)=>r(["listen",s(o),i,a]),free:o=>r(["free",s(o)]),flush:()=>{if(n.length===0)return;let o=n;n=[],t(o)},drain:()=>Promise.resolve()}}function Oi(t,e){let n=new Map([[0,t]]),r=i=>{let a=n.get(i);if(!a)throw new Error(`applier: unknown node ${i}`);return a},s=i=>{let a=r(i);if(!(a instanceof Element))throw new Error(`applier: node ${i} is not an element`);return a};function o(i){for(let a of i)switch(a[0]){case"create":{Ii(a[2]),n.set(a[1],document.createElement(a[2]));break}case"textnode":n.set(a[1],document.createTextNode(a[2]));break;case"attr":{let[,c,l,u]=a,f=s(c);u===null?f.removeAttribute(l):(Ci(f.tagName.toLowerCase(),l,u),f.setAttribute(l,u));break}case"append":s(a[1]).appendChild(r(a[2]));break;case"before":r(a[1]).before(r(a[2]));break;case"after":r(a[1]).after(r(a[2]));break;case"remove":a[1]!==0&&r(a[1]).remove();break;case"text":r(a[1]).textContent=a[2];break;case"value":s(a[1]).value=a[2];break;case"checked":s(a[1]).checked=a[2];break;case"focus":s(a[1]).focus();break;case"listen":{Ri(a[2]),Li(s(a[1]),a[2],a[3],e);break}case"free":a[1]!==0&&n.delete(a[1]);break;default:throw new Error(`applier: unknown op ${JSON.stringify(a)}`)}}return{apply:o}}function ip(t,e){let{port1:n,port2:r}=new MessageChannel,s=Oi(t,c=>r.postMessage({t:"event",ev:c}));r.onmessage=c=>{c.data.t==="ops"?s.apply(c.data.ops):c.data.t==="drain"&&r.postMessage({t:"drained",id:c.data.id})};let o=new Map,i=0;return n.onmessage=c=>{c.data.t==="event"?e(c.data.ev):c.data.t==="drained"&&(o.get(c.data.id)?.(),o.delete(c.data.id))},{...Ni(c=>n.postMessage({t:"ops",ops:c})),drain:()=>new Promise(c=>{let l=i++;o.set(l,c),n.postMessage({t:"drain",id:l})})}}function Mc(t,e,n){switch(t){case"direct":return op(e,n);case"queued":{let r=Oi(e,n);return Ni(s=>r.apply(structuredClone(s)))}case"channel":return ip(e,n)}}function Uc(t){let e=Promise.resolve(),n=0,r=Promise.resolve(),s=null;return{call:i=>{n++;let a=e.then(()=>r).then(i).then(c=>(t.flush(),c),c=>{throw t.flush(),c});return e=a.catch(()=>{}),a},settle:async()=>{await e,await t.drain()},get generation(){return n},pause(){s||(r=new Promise(i=>{s=i}))},resume(){s?.(),s=null,r=Promise.resolve()}}}function rg(){function t(u,f){return function(w){n(f,"addInitializer"),r(w,"An initializer"),u.push(w)}}function e(u,f,d,w,y,x,E,b,m){var g;switch(y){case 1:g="accessor";break;case 2:g="method";break;case 3:g="getter";break;case 4:g="setter";break;default:g="field"}var k={kind:g,name:E?"#"+f:f,static:x,private:E,metadata:b},T={v:!1};k.addInitializer=t(w,T);var S,$;if(y===0?E?(S=d.get,$=d.set):(S=function(){return this[f]},$=function(P){this[f]=P}):y===2?S=function(){return d.value}:((y===1||y===3)&&(S=function(){return d.get.call(this)}),(y===1||y===4)&&($=function(P){d.set.call(this,P)})),E)k.access=S&&$?{get:S,set:$}:S?{get:S}:{set:$};else{if(S){var O=S;S=function(P){return arguments.length===0&&(P=this),O.call(P)}}if($){var _=$;$=function(P,H){return arguments.length===1&&(H=P,P=this),_.call(P,H)}}var R=function(P){return f in P};k.access=S&&$?{has:R,get:S,set:$}:S?{has:R,get:S}:{has:R,set:$}}try{return u(m,k)}finally{T.v=!0}}function n(u,f){if(u.v)throw new Error("attempted to call "+f+" after decoration was finished")}function r(u,f){if(typeof u!="function")throw new TypeError(f+" must be a function")}function s(u,f){var d=typeof f;if(u===1){if(d!=="object"||f===null)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");f.get!==void 0&&r(f.get,"accessor.get"),f.set!==void 0&&r(f.set,"accessor.set"),f.init!==void 0&&r(f.init,"accessor.init")}else if(d!=="function"){var w;throw u===0?w="field":u===10?w="class":w="method",new TypeError(w+" decorators must return a function or void 0")}}function o(u,f,d,w,y,x,E,b,m){var g=d[0],k,T,S;E?y===0||y===1?k={get:d[3],set:d[4]}:y===3?k={get:d[3]}:y===4?k={set:d[3]}:k={value:d[3]}:y!==0&&(k=Object.getOwnPropertyDescriptor(f,w)),y===1?S={get:k.get,set:k.set}:y===2?S=k.value:y===3?S=k.get:y===4&&(S=k.set);var $,O,_;if(typeof g=="function")$=e(g,w,k,b,y,x,E,m,S),$!==void 0&&(s(y,$),y===0?T=$:y===1?(T=$.init,O=$.get||S.get,_=$.set||S.set,S={get:O,set:_}):S=$);else for(var R=g.length-1;R>=0;R--){var P=g[R];if($=e(P,w,k,b,y,x,E,m,S),$!==void 0){s(y,$);var H;y===0?H=$:y===1?(H=$.init,O=$.get||S.get,_=$.set||S.set,S={get:O,set:_}):S=$,H!==void 0&&(T===void 0?T=H:typeof T=="function"?T=[T,H]:T.push(H))}}if(y===0||y===1){if(T===void 0)T=function(L,me){return me};else if(typeof T!="function"){var bt=T;T=function(L,me){for(var yn=me,Zr=0;Zr3,$=k>=5,O,_;if($?(O=u,k=k-5,x=x||[],_=x):(O=u.prototype,y=y||[],_=y),k!==0&&!S){var R=$?b:E,P=R.get(T)||0;if(P===!0||P===3&&k!==4||P===4&&k!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+T);!P&&k>2?R.set(T,k):R.set(T,!0)}o(w,O,g,T,k,$,S,_,d)}}return a(w,y),a(w,x),w}function a(u,f){f&&u.push(function(d){for(var w=0;w0){for(var w=[],y=u,x=u.name,E=f.length-1;E>=0;E--){var b={v:!1};try{var m=f[E](y,{kind:"class",name:x,addInitializer:t(w,b),metadata:d})}finally{b.v=!0}m!==void 0&&(s(10,m),y=m)}return[l(y,d),function(){for(var g=0;g!0,n=()=>Promise.resolve()){ap(this),this.#e=e,this.#t=n}static timer(e,n){let r,s=()=>r??=new Promise(o=>{let i=Number(e-n())/1e6;setTimeout(o,Math.min(Math.max(0,i),sg))}).then(()=>{r=void 0});return new t(()=>n()>=e,s)}ready(){return this.#e()}block(){if(!this.#e())return(async()=>{for(;!this.#e();)await this.#t()})()}waitPromise(){return this.#t()}};ye(mt.prototype,ba);var og=ie(t=>{if(t.length===0)throw new Error("wasi:io/poll.poll: empty pollable list");let e=()=>{let r=[];for(let s=0;s0?n:(async()=>{for(;;){await Promise.race(t.map(s=>s.waitPromise()));let r=e();if(r.length>0)return r}})()});hp=Symbol.dispose;var Ms=class{static{({e:[cp]}=Ir(this,[[ie,2,"blockingRead"],[ie,2,"blockingSkip"]],[]))}#e;#t=(cp(this),0);#n=!1;constructor(e=new Uint8Array(0)){this.#e=e}read(e){if(this.#n)throw Dn();let n=Math.max(0,Math.min(Number(e),this.#e.length-this.#t)),r=this.#e.slice(this.#t,this.#t+n);return this.#t+=n,r}blockingRead(e){return this.read(e)}skip(e){return BigInt(this.read(e).length)}blockingSkip(e){return this.skip(e)}subscribe(){return new mt}[hp](){this.#n=!0}};mp=Symbol.dispose;var Ar=class{static{({e:[lp]}=Ir(this,[[ie,2,"blockingWriteAndFlush"],[ie,2,"blockingFlush"],[ie,2,"blockingWriteZeroesAndFlush"],[ie,2,"blockingSplice"]],[]))}#e;#t=(lp(this),!1);constructor(e){this.#e=e}checkWrite(){if(this.#t)throw Dn();return 65536n}write(e){if(this.#t)throw Dn();this.#e(e)}blockingWriteAndFlush(e){this.write(e)}flush(){if(this.#t)throw Dn()}blockingFlush(){this.flush()}subscribe(){return new mt}writeZeroes(e){this.write(new Uint8Array(Number(e)))}blockingWriteZeroesAndFlush(e){this.writeZeroes(e)}splice(e,n){let r=e.read(n);return this.write(r),BigInt(r.length)}blockingSplice(e,n){return this.splice(e,n)}[mp](){this.#t=!0}},gp=65536;yp=Symbol.dispose;var dp=class{static{({e:[up]}=Ir(this,[[ie,2,"blockingRead"],[ie,2,"blockingSkip"]],[]))}#e=(up(this),[]);#t=0;#n=!1;#s;#r=!1;#o;#i=()=>{};#a;#c=()=>{};constructor(e,n=gp){this.#o=n,this.#a=new Promise(r=>this.#i=r),this.#u(e)}#l(){let e=this.#i;this.#a=new Promise(n=>this.#i=n),e()}async#u(e){try{for await(let n of e){if(this.#r)return;if(n.length!==0)for(this.#e.push(n),this.#t+=n.length,this.#l();this.#t>=this.#o&&!this.#r;)await new Promise(r=>this.#c=r)}this.#n=!0}catch(n){this.#s=n,this.#n=!0}this.#l()}#f(e){let n=new Uint8Array(Math.min(e,this.#t)),r=0;for(;r0)return this.#f(Number(e));if(this.#s!==void 0)throw new j({kind:"last-operation-failed",value:this.#s instanceof Fn?this.#s:new Fn(this.#s instanceof Error?this.#s.message:String(this.#s))});if(this.#n)throw Dn();return new Uint8Array(0)}blockingRead(e){return this.#t>0||this.#n||this.#r?this.read(e):(async()=>{for(;this.#t===0&&!this.#n&&!this.#r;)await this.#a;return this.read(e)})()}skip(e){return BigInt(this.read(e).length)}blockingSkip(e){let n=this.blockingRead(e);return n instanceof Uint8Array?BigInt(n.length):n.then(r=>BigInt(r.length))}subscribe(){return new mt(()=>this.#t>0||this.#n||this.#r,()=>this.#a)}[yp](){this.#r=!0,this.#c(),this.#l()}};wp=Symbol.dispose;var pp=class{static{({e:[fp]}=Ir(this,[[ie,2,"blockingFlush"],[ie,2,"blockingWriteAndFlush"],[ie,2,"blockingWriteZeroesAndFlush"],[ie,2,"blockingSplice"]],[]))}#e;#t;#n=(fp(this),0);#s=!1;#r;#o=Promise.resolve();#i=()=>{};#a;constructor(e,n=gp){this.#e=e,this.#t=n,this.#a=new Promise(r=>this.#i=r)}#c(){let e=this.#i;this.#a=new Promise(n=>this.#i=n),e()}#l(){if(this.#s)throw Dn();if(this.#r!==void 0)throw new j({kind:"last-operation-failed",value:this.#r instanceof Fn?this.#r:new Fn(this.#r instanceof Error?this.#r.message:String(this.#r))})}checkWrite(){return this.#l(),BigInt(Math.max(0,this.#t-this.#n))}write(e){if(this.#l(),e.length>this.#t-this.#n)throw new Error("wasi:io/streams.write: contents exceed the check-write permit");this.#n+=e.length,this.#o=this.#o.then(async()=>{try{this.#r===void 0&&await this.#e(e)}catch(n){this.#r=n}finally{this.#n-=e.length,this.#c()}})}flush(){this.#l()}blockingFlush(){if(this.#l(),this.#n!==0)return(async()=>{for(;this.#n>0&&this.#r===void 0;)await this.#a;this.#l()})()}blockingWriteAndFlush(e){return this.write(e),this.blockingFlush()}subscribe(){return new mt(()=>this.#s||this.#r!==void 0||this.#nthis.#a)}writeZeroes(e){this.write(new Uint8Array(Number(e)))}blockingWriteZeroesAndFlush(e){return this.blockingWriteAndFlush(new Uint8Array(Number(e)))}splice(e,n){let r=e.read(n);return this.write(r),BigInt(r.length)}blockingSplice(e,n){let r=this.splice(e,n),s=this.blockingFlush();return s===void 0?r:s.then(()=>r)}[wp](){this.#s=!0,this.#c()}};function bp(){return{imports:{"wasi:io/error@0.2":{Error:Fn},"wasi:io/poll@0.2":{Pollable:mt,poll:og},"wasi:io/streams@0.2":{InputStream:Ms,OutputStream:Ar}}}}var jt=class extends Error{ok;code;constructor(e,n){super(`wasi:cli/exit#exit(${e?"success":"failure"}${n===void 0?"":`, code ${n}`})`),this.ok=e,this.code=n,this.name="ExitError"}};ye(jt.prototype,ka);var Cr=class{},Rr=class{};function _i(t){let e=t.reduce((s,o)=>s+o.length,0),n=new Uint8Array(e),r=0;for(let s of t)n.set(s,r),r+=s.length;return n}function kp(t={}){let e=[],n=[],r=t.passthrough??!1,s=!1,o,i,a=new Ar(d=>{e.push(d),r&&console.log(new TextDecoder().decode(d))}),c=new Ar(d=>{n.push(d),r&&console.error(new TextDecoder().decode(d))}),l={stdout:()=>_i(e),stderr:()=>_i(n),stdoutText:()=>new TextDecoder().decode(_i(e)),stderrText:()=>new TextDecoder().decode(_i(n)),exited:()=>s,exitOk:()=>o,exitCode:()=>i},u=(d,w)=>async y=>{for await(let x of y){let E=x instanceof Uint8Array?x:Uint8Array.from(x);d.push(E),w?.(new TextDecoder().decode(E))}return{kind:"ok"}};return{imports:{"wasi:cli/environment@0.2":{getEnvironment:()=>Object.entries(t.env??{}),getArguments:()=>t.args??[],initialCwd:()=>t.cwd},"wasi:cli/exit@0.2":{exit:d=>{if(s=!0,o=d.kind==="ok",t.throwOnExit)throw new jt(o)}},"wasi:cli/stdin@0.2":{getStdin:()=>new Ms(t.stdinBuffer)},"wasi:cli/stdout@0.2":{getStdout:()=>a},"wasi:cli/stderr@0.2":{getStderr:()=>c},"wasi:cli/terminal-input@0.2":{TerminalInput:Cr},"wasi:cli/terminal-output@0.2":{TerminalOutput:Rr},"wasi:cli/terminal-stdin@0.2":{getTerminalStdin:()=>{}},"wasi:cli/terminal-stdout@0.2":{getTerminalStdout:()=>{}},"wasi:cli/terminal-stderr@0.2":{getTerminalStderr:()=>{}},"wasi:cli/types@0.3":{},"wasi:cli/environment@0.3":{getEnvironment:()=>Object.entries(t.env??{}),getArguments:()=>t.args??[],getInitialCwd:()=>t.cwd},"wasi:cli/exit@0.3":{exit:d=>{if(s=!0,o=d.kind==="ok",t.throwOnExit)throw new jt(o)},exitWithCode:d=>{if(s=!0,o=d===0,i=d,t.throwOnExit)throw new jt(o)}},"wasi:cli/stdin@0.3":{readViaStream:()=>[t.stdinBuffer===void 0?[]:[t.stdinBuffer],Promise.resolve({kind:"ok"})]},"wasi:cli/stdout@0.3":{writeViaStream:u(e,r?d=>console.log(d):void 0)},"wasi:cli/stderr@0.3":{writeViaStream:u(n,r?d=>console.error(d):void 0)},"wasi:cli/terminal-input@0.3":{TerminalInput:Cr},"wasi:cli/terminal-output@0.3":{TerminalOutput:Rr},"wasi:cli/terminal-stdin@0.3":{getTerminalStdin:()=>{}},"wasi:cli/terminal-stdout@0.3":{getTerminalStdout:()=>{}},"wasi:cli/terminal-stderr@0.3":{getTerminalStderr:()=>{}}},captured:l}}function xp(t){return new Promise(e=>setTimeout(e,Math.max(0,t)))}function Ep(t={}){let e=t.now??(()=>BigInt(Math.round(performance.now()*1e6))),n=1000n;return{imports:{"wasi:clocks/monotonic-clock@0.2":{now:e,resolution:()=>n,subscribeInstant:a=>mt.timer(a,e),subscribeDuration:a=>mt.timer(e()+a,e)},"wasi:clocks/wall-clock@0.2":{now:()=>{let a=Date.now();return{seconds:BigInt(Math.floor(a/1e3)),nanoseconds:a%1e3*1e6}},resolution:()=>({seconds:0n,nanoseconds:1e6})},"wasi:clocks/monotonic-clock@0.3":{now:e,getResolution:()=>n,waitUntil:async a=>{let c=a-e();await xp(Number(c)/1e6)},waitFor:async a=>{await xp(Number(a)/1e6)}},"wasi:clocks/system-clock@0.3":{now:()=>{let a=Date.now();return{seconds:BigInt(Math.floor(a/1e3)),nanoseconds:a%1e3*1e6}},getResolution:()=>1000000n},"wasi:clocks/types@0.3":{}}}}var Wc=class{constructor(){throw new TypeError("wasi:filesystem/types.descriptor is never constructed by this shim (preopens#get-directories always returns [] \u2014 CONTRACT: contracts/embedder-api.md 'WASI examination' filesystem scope calls the type 'constructible-never')")}#e(e){throw new TypeError(`wasi:filesystem/types#[method]descriptor.${e}: unreachable \u2014 no descriptor instance can exist (preopens is empty)`)}getFlags(){return this.#e("get-flags")}getType(){return this.#e("get-type")}stat(){return this.#e("stat")}statAt(){return this.#e("stat-at")}openAt(){return this.#e("open-at")}readViaStream(){return this.#e("read-via-stream")}writeViaStream(){return this.#e("write-via-stream")}appendViaStream(){return this.#e("append-via-stream")}metadataHashAt(){return this.#e("metadata-hash-at")}},jc=class{};function vp(){return{imports:{"wasi:filesystem/types@0.2":{Descriptor:Wc,DirectoryEntryStream:jc,filesystemErrorCode:t=>{}},"wasi:filesystem/preopens@0.2":{getDirectories:()=>[]}}}}function ig(t){let e=new Uint8Array(Number(t));for(let n=0;n{let n=t(Number(e));if(n.length!==Number(e))throw new TypeError(`random source returned ${n.length} bytes, need exactly ${e} (the @0.2 WIT permits no short reads)`);return n}}function cg(t){return()=>{let e=t(8n);return new DataView(e.buffer,e.byteOffset,8).getBigUint64(0,!0)}}var lg=[0n,1n];function Tp(t={}){let e=t.insecureSeed??lg,n=ag(t.source),r=cg(n),s={getRandomBytes:n,getRandomU64:r},o={getInsecureRandomBytes:n,getInsecureRandomU64:r},i={insecureSeed:()=>e};return{imports:{"wasi:random/random@0.2":s,"wasi:random/insecure@0.2":o,"wasi:random/insecure-seed@0.2":i,"wasi:random/random@0.3":s,"wasi:random/insecure@0.3":o,"wasi:random/insecure-seed@0.3":i}}}function Sp(t={}){let e=kp(t.cli),n={...e.imports,...bp().imports,...Ep(t.clocks).imports,...Tp(t.random).imports,...vp().imports};return Object.assign(n,{captured:e.captured})}var ug="0.3",fg={kind:"ok"};function Bn(t,e){return new j(t,`wasi:http: ${e}`)}function Mn(t,e){return new j({kind:t},`wasi:http/types: ${e}`)}function $p(t){let e=t instanceof Error?t.message:String(t),n=[];for(let s=t;s instanceof Error;s=s.cause)n.push(s.message);let r=n.join(" | ").toLowerCase();return e=n[0]??e,r.includes("refused")?{kind:"connection-refused"}:r.includes("dns error")||r.includes("name not resolved")||r.includes("getaddrinfo")?{kind:"DNS-error",value:{rcode:void 0,infoCode:void 0}}:r.includes("timed out")||r.includes("timeout")?{kind:"connection-timeout"}:r.includes("tls")||r.includes("certificate")||r.includes("ssl")?{kind:"TLS-protocol-error"}:r.includes("reset")?{kind:"connection-terminated"}:{kind:"internal-error",value:e}}async function dg(t){let e=[],n=0;for await(let o of t){let i=o instanceof Uint8Array?o:Uint8Array.from(o);e.push(i),n+=i.length}let r=new Uint8Array(n),s=0;for(let o of e)r.set(o,s),s+=o.length;return r}var Di=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Kc(t){return!t.some(e=>e===0||e===10||e===13)}var pg=new TextEncoder,hg=new TextDecoder;function Ap(t={}){let e=t.onCall??(()=>{}),n=t.version??ug;class r{entries=[];mutable=!0;constructor(){e("fields.constructor")}static fromList(m){e("fields.from-list");let g=o([],!0);for(let[k,T]of m){if(!Di.test(k))throw Mn("invalid-syntax",`from-list: invalid field name ${JSON.stringify(k)}`);if(!Kc(T))throw Mn("invalid-syntax",`from-list: invalid value for ${JSON.stringify(k)}`);g.entries.push([k,T.slice()])}return g}get(m){e("fields.get");let g=m.toLowerCase();return this.entries.filter(([k])=>k.toLowerCase()===g).map(([,k])=>k.slice())}has(m){e("fields.has");let g=m.toLowerCase();return this.entries.some(([k])=>k.toLowerCase()===g)}set(m,g){if(e("fields.set"),s(this,"fields.set"),!Di.test(m))throw Mn("invalid-syntax",`set: invalid field name ${JSON.stringify(m)}`);for(let T of g)if(!Kc(T))throw Mn("invalid-syntax",`set: invalid value for ${JSON.stringify(m)}`);let k=m.toLowerCase();this.entries=this.entries.filter(([T])=>T.toLowerCase()!==k);for(let T of g)this.entries.push([m,T.slice()])}delete(m){e("fields.delete"),s(this,"fields.delete");let g=m.toLowerCase();this.entries=this.entries.filter(([k])=>k.toLowerCase()!==g)}getAndDelete(m){e("fields.get-and-delete"),s(this,"fields.get-and-delete");let g=m.toLowerCase(),k=this.entries.filter(([T])=>T.toLowerCase()===g).map(([,T])=>T);return this.entries=this.entries.filter(([T])=>T.toLowerCase()!==g),k}append(m,g){if(e("fields.append"),s(this,"fields.append"),!Di.test(m))throw Mn("invalid-syntax",`append: invalid field name ${JSON.stringify(m)}`);if(!Kc(g))throw Mn("invalid-syntax",`append: invalid value for ${JSON.stringify(m)}`);this.entries.push([m,g.slice()])}copyAll(){return e("fields.copy-all"),this.entries.map(([m,g])=>[m,g.slice()])}clone(){return e("fields.clone"),o(this.entries.map(([m,g])=>[m,g.slice()]),!0)}[Symbol.dispose](){}}function s(b,m){if(!b.mutable)throw Mn("immutable",`${m}: these fields are immutable`)}function o(b,m){let g=Object.create(r.prototype);return g.entries=b,g.mutable=m,g}function i(b){let m=[];return b.forEach((g,k)=>m.push([k,pg.encode(g)])),o(m,!1)}class a{connectTimeout;firstByteTimeout;betweenBytesTimeout;mutable=!0;constructor(){e("request-options.constructor")}getConnectTimeout(){return e("request-options.get-connect-timeout"),this.connectTimeout}setConnectTimeout(m){throw e("request-options.set-connect-timeout"),c(this,"set-connect-timeout"),new j({kind:"not-supported"},"wasi:http/types: set-connect-timeout: fetch exposes no connect phase")}getFirstByteTimeout(){return e("request-options.get-first-byte-timeout"),this.firstByteTimeout}setFirstByteTimeout(m){e("request-options.set-first-byte-timeout"),c(this,"set-first-byte-timeout"),this.firstByteTimeout=m}getBetweenBytesTimeout(){return e("request-options.get-between-bytes-timeout"),this.betweenBytesTimeout}setBetweenBytesTimeout(m){e("request-options.set-between-bytes-timeout"),c(this,"set-between-bytes-timeout"),this.betweenBytesTimeout=m}clone(){e("request-options.clone");let m=Object.create(a.prototype);return m.connectTimeout=this.connectTimeout,m.firstByteTimeout=this.firstByteTimeout,m.betweenBytesTimeout=this.betweenBytesTimeout,m.mutable=!0,m}[Symbol.dispose](){}}function c(b,m){if(!b.mutable)throw new j({kind:"immutable"},`wasi:http/types: ${m}: this request-options is immutable`)}class l{method={kind:"get"};pathWithQuery;scheme;authority;headers;contents;trailers;options;settleTransmission;consumed=!1;sent=!1;constructor(){}static new(m,g,k,T){e("request.new");let S=new l;S.headers=m,m.mutable=!1,S.contents=g,S.trailers=k,S.options=T,T!==void 0&&(T.mutable=!1);let $=new Promise(O=>{S.settleTransmission=O});return[S,$]}getMethod(){return e("request.get-method"),this.method}setMethod(m){if(e("request.set-method"),m.kind==="other"&&!Di.test(m.value))throw new j(null,"wasi:http/types: set-method: invalid method token");this.method=m}getPathWithQuery(){return e("request.get-path-with-query"),this.pathWithQuery}setPathWithQuery(m){if(e("request.set-path-with-query"),m!==void 0&&/[ \t\r\n#]/.test(m))throw new j(null,"wasi:http/types: set-path-with-query: invalid path");this.pathWithQuery=m}getScheme(){return e("request.get-scheme"),this.scheme}setScheme(m){if(e("request.set-scheme"),m?.kind==="other"&&!/^[A-Za-z][A-Za-z0-9+.-]*$/.test(m.value))throw new j(null,"wasi:http/types: set-scheme: invalid scheme");this.scheme=m}getAuthority(){return e("request.get-authority"),this.authority}setAuthority(m){if(e("request.set-authority"),m!==void 0&&/[ \t\r\n/#?@]/.test(m.replace(/@/,"")))throw new j(null,"wasi:http/types: set-authority: invalid authority");this.authority=m}getOptions(){return e("request.get-options"),this.options}getHeaders(){return e("request.get-headers"),o(this.headers.entries.map(([m,g])=>[m,g.slice()]),!1)}static consumeBody(m,g){return e("request.consume-body"),f(m,g)}[Symbol.dispose](){!this.sent&&!this.consumed&&this.settleTransmission({kind:"err",value:{kind:"internal-error",value:"request dropped without being sent"}})}}class u{statusCode=200;headers;contents;trailers;fetchBody=null;settleTransmission;firstByteTimeout;betweenBytesTimeout;consumed=!1;constructor(){}static new(m,g,k){e("response.new");let T=new u;T.headers=m,m.mutable=!1,T.contents=g,T.trailers=k;let S=new Promise($=>{T.settleTransmission=$});return[T,S]}static fromFetch(m,g){let k=new u;return k.statusCode=m.status,k.headers=i(m.headers),k.fetchBody=m.body,k.firstByteTimeout=g?.firstByteTimeout,k.betweenBytesTimeout=g?.betweenBytesTimeout,k}getStatusCode(){return e("response.get-status-code"),this.statusCode}setStatusCode(m){if(e("response.set-status-code"),!Number.isInteger(m)||m<100||m>999)throw new j(null,"wasi:http/types: set-status-code: invalid status code");this.statusCode=m}getHeaders(){return e("response.get-headers"),o(this.headers.entries.map(([m,g])=>[m,g.slice()]),!1)}static consumeBody(m,g){return e("response.consume-body"),m.fetchBody!==null||m.contents===void 0&&m.trailers===void 0?d(m,g):f(m,g)}[Symbol.dispose](){this.fetchBody!==null&&!this.consumed&&this.fetchBody.cancel().catch(()=>{}),this.settleTransmission!==void 0&&!this.consumed&&this.settleTransmission({kind:"err",value:{kind:"internal-error",value:"response dropped without being sent"}})}}function f(b,m){if(b.consumed)return[[],Promise.resolve({kind:"err",value:{kind:"internal-error",value:"body already consumed"}})];b.consumed=!0;let g=b.contents,k=b.trailers??Promise.resolve({kind:"ok",value:void 0}),T=b.settleTransmission;return T!==void 0&&Promise.resolve(m).then($=>T($),()=>T({kind:"err",value:{kind:"internal-error",value:"consumer failed"}})),[async function*(){if(g!==void 0)for await(let $ of g)yield $ instanceof Uint8Array?$:Uint8Array.from($)}(),Promise.resolve(k).then($=>$)]}function d(b,m){if(b.consumed)return[[],Promise.resolve({kind:"err",value:{kind:"internal-error",value:"body already consumed"}})];b.consumed=!0;let g=b.fetchBody,k,T=new Promise(_=>k=_),S=y(b.firstByteTimeout),$=y(b.betweenBytesTimeout);return[async function*(){if(g===null){k({kind:"ok",value:void 0});return}let _=g.getReader(),R=!0;try{for(;;){let P=R?S:$,H;try{H=await x(_,P)}catch(bt){k({kind:"err",value:bt===w?{kind:R?"HTTP-response-timeout":"connection-read-timeout"}:$p(bt)});return}if(R=!1,H.done){k({kind:"ok",value:void 0});return}H.value.length>0&&(yield H.value)}}finally{k({kind:"ok",value:void 0}),_.cancel().catch(()=>{}),_.releaseLock()}}(),T]}let w=Symbol("timed out");function y(b){return b===void 0?void 0:Number(b/1000000n)}function x(b,m){let g=b.read();return m===void 0?g:new Promise((k,T)=>{let S=setTimeout(()=>T(w),m);g.then($=>{clearTimeout(S),k($)},$=>{clearTimeout(S),T($)})})}async function E(b){if(e("client.send"),b.sent||b.consumed)throw Bn({kind:"internal-error",value:"request already sent or consumed"},"client.send: request already sent or consumed");b.sent=!0;let m=b.scheme===void 0?"https":b.scheme.kind==="other"?b.scheme.value.toLowerCase():b.scheme.kind.toLowerCase();if(m!=="http"&&m!=="https")throw Bn({kind:"internal-error",value:`fetch cannot carry scheme '${m}'`},`client.send: unsupported scheme '${m}'`);if(b.authority===void 0)throw Bn({kind:"HTTP-request-URI-invalid"},"client.send: no authority");let g=b.pathWithQuery??"",k=`${m}://${b.authority}${g.startsWith("/")||g===""?g:"/"+g}`,T=b.method.kind==="other"?b.method.value.toUpperCase():b.method.kind.toUpperCase(),S=new Headers;for(let[R,P]of b.headers.entries)try{S.append(R,hg.decode(P))}catch(H){throw Bn({kind:"internal-error",value:`header '${R}' refused by the platform`},`client.send: ${H}`)}let $;b.contents!==void 0&&($=await dg(b.contents));let O=await b.trailers;if(O.kind==="err"){let R={kind:"err",value:O.value};throw b.settleTransmission(R),Bn(O.value,"client.send: request trailers resolved to an error")}if(O.value!==void 0){let R={kind:"internal-error",value:"fetch cannot transmit request trailers"};throw b.settleTransmission({kind:"err",value:R}),Bn(R,"client.send: request trailers are not transmissible over fetch")}let _;try{_=await fetch(k,{method:T,headers:S,body:$===void 0||$.length===0?void 0:$,redirect:"manual",cache:"no-store",credentials:"omit"})}catch(R){let P=$p(R);throw b.settleTransmission({kind:"err",value:P}),Bn(P,`client.send: ${R instanceof Error?R.message:String(R)}`)}return b.settleTransmission(fg),u.fromFetch(_,b.options)}return{imports:{[`wasi:http/types@${n}`]:{Fields:r,Request:l,RequestOptions:a,Response:u},[`wasi:http/client@${n}`]:{send:E},[`wasi:http/handler@${n}`]:{handle:E}},Fields:r,Request:l,RequestOptions:a,Response:u,send:E}}var Pr=class extends Error{constructor(e){super(e),this.name="PlanError"}};var Un=class extends Error{constructor(e="canonical ABI trap"){super(e),this.name="Trap"}};function Lr(t){throw new Un(t)}function fe(t,e){t&&Lr(e)}var Fi=class extends Error{constructor(e="internal assertion failed"){super(e),this.name="AssertionError"}};function re(t,e){if(!t)throw new Fi(e)}var qA=new DataView(new ArrayBuffer(8));var zc=class t{static MAX_LENGTH=2**28-1;array=[null];free=[];get(e){return fe(e>=this.array.length,"table index out of range"),fe(this.array[e]===null,"table entry empty"),this.array[e]}add(e){let n;return this.free.length>0?(n=this.free.pop(),re(this.array[n]===null),this.array[n]=e):(n=this.array.length,fe(n>t.MAX_LENGTH,"table full"),this.array.push(e)),n}remove(e){let n=this.get(e);return this.array[e]=null,this.free.push(e),n}*[Symbol.iterator](){for(let e of this.array)e!==null&&(yield e)}};var gg=2**32-1;var iI=(1<<28)-1;var aI=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),cI=new TextDecoder("utf-16le",{fatal:!0,ignoreBOM:!0}),lI=new TextEncoder;function Rg(){let t;try{t=Deno.env.get("DELTIC_SCHED_SEED")}catch{return null}if(t===void 0||t==="")return null;let e=Number(t);return Number.isFinite(e)?Math.trunc(e)>>>0:null}var SI=Rg();var $I=(()=>{try{return Deno.env.get("CE_AMBIENT_TRACE")==="1"}catch{return!1}})();var Us=function(t){return t[t.NONE=0]="NONE",t[t.SUBTASK=1]="SUBTASK",t[t.STREAM_READ=2]="STREAM_READ",t[t.STREAM_WRITE=3]="STREAM_WRITE",t[t.FUTURE_READ=4]="FUTURE_READ",t[t.FUTURE_WRITE=5]="FUTURE_WRITE",t[t.TASK_CANCELLED=6]="TASK_CANCELLED",t}({}),RI=[Us.NONE,0,0];var PI=(()=>{try{return Deno.env.get("CE_EVENT_TRACE")==="1"}catch{return!1}})();var Lg=2**28-1;var aC=(1<<28)-1;var _R=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var ZR=Promise.resolve();var QR=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var Mi=class{addrType="i32";#e;#t;#n=null;#s=new Uint8Array(0);#r=new DataView(new ArrayBuffer(0));constructor(e,n){this.#e=e,this.#t=n}#o(){let e=this.#e();if(e===void 0)throw new Pr(`${this.#t} accessed before its extract-memory initializer ran`);return e}#i(){let e=this.#o().buffer;e!==this.#n&&(this.#n=e,this.#s=new Uint8Array(e),this.#r=new DataView(e))}get bytes(){return this.#i(),this.#s}get view(){return this.#i(),this.#r}get length(){return this.#o().buffer.byteLength}ptrType(){return this.addrType}ptrSize(){return 4}},y1=new Mi(()=>{},"check");var w1=(()=>{try{return Deno.env.get("DELTIC_DRIVE_TRACE")==="1"}catch{return!1}})();var Fp=Symbol("deltic.constructorSyncEntry");var P1=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var t2=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var c2=(()=>{try{return Deno.env.get("CE_CTX_TRACE")==="1"}catch{return!1}})();var aP=(()=>{try{return Deno.env.get("CE_SCOPE_TRACE")==="1"}catch{return!1}})();var _P=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var KP=Object.freeze({hostEnd:!0});var yt=class extends Error{payload;constructor(e,n){super(n??`WIT error: ${ub(e)}`),this.name="WitError",this.payload=e}};function ub(t){return t==null?String(t):typeof t=="object"&&"tag"in t?String(t.tag):typeof t=="object"?JSON.stringify(t):String(t)}var rL=Symbol("deltic.resource-state");var sL=new FinalizationRegistry(t=>{if(t.valid&&t.owns){t.valid=!1;try{t.rt.dtor?.(t.rep)}catch{}}});var Ws=class{#e=[];add(e){this.#e.push(e)}end(){for(let e of this.#e)e();this.#e.length=0}},EL=new Ws;var jL=Symbol("deltic.embedder.hostRegistries");function Kt(t){throw new yt(t)}function A(t){return Kt({tag:"invalid-key",val:t})}function Wn(t){return Kt({tag:"invalid-nonce",val:t})}function st(){return Kt({tag:"authentication-failed"})}function Se(){return Kt({tag:"not-extractable"})}function de(t){return Kt({tag:"unsupported",val:t})}function Xe(t){return Kt({tag:"not-permitted",val:t})}function B(t){return Kt({tag:"other",val:t})}function q(t){return Xe(`this key does not permit ${t}`)}function Qc(t){let e=t,n=typeof e?.name=="string"?e.name:void 0,r=typeof e?.message=="string"?e.message:void 0;return{name:n,detail:r??String(t)}}async function I(t,e){try{return await e()}catch(n){if(n instanceof yt)throw n;let{name:r,detail:s}=Qc(n);throw n instanceof DOMException&&(r==="NotSupportedError"&&de(`${t} is not served by this platform: ${s}`),B(`${t} failed: ${s}`)),n instanceof TypeError&&de(`${t} is not served by this platform: ${s}`),n instanceof Error&&B(`${t} failed: ${s}`),n}}function Wi(t,e="open"){t instanceof DOMException&&t.name==="OperationError"&&st();let{detail:n}=Qc(t);B(`${e}: ${n}`)}function Or(t){let e=t.filter(([,n])=>n).map(([n])=>n);return e.length===0&&Xe("a key with no enabled usage cannot be minted"),e}function Vp(t){return Qc(t)}async function Ue(t){let e=[],n=0;for(;;){let o=await t.read(65536);if(o.length===0)break;let a=o instanceof Uint8Array?o:Uint8Array.from(o);e.push(a),n+=a.length}let r=new Uint8Array(n),s=0;for(let o of e)r.set(o,s),s+=o.length;return r}var kb=new TextEncoder,xb=new TextDecoder("utf-8",{fatal:!0});function Jp(t){return kb.encode(t)}function Eb(t){try{return xb.decode(t)}catch{A("unwrapped material is not valid UTF-8")}}function ge(t,e,n){let r=Eb(t),s;try{s=JSON.parse(r)}catch{return A("unwrapped JWK is not valid JSON")}(typeof s!="object"||s===null||Array.isArray(s))&&A("unwrapped JWK must be a JSON object");let{use:o,key_ops:i,...a}=s;return o!==void 0&&o!==e&&A("unwrapped JWK `use` does not match the key's family"),i!==void 0&&(!Array.isArray(i)||!n.every(c=>i.includes(c)))&&A("unwrapped JWK `key_ops` does not cover the granted usages"),JSON.stringify(a)}var vb=globalThis.crypto.subtle,js=class{#e;constructor(e){this.#e=e}async compute(e){let n=await Ue(e),r=await I(`${this.#e} digest`,()=>vb.digest(this.#e,n));return new Uint8Array(r)}algorithmName(){return this.#e}},Tb=Object.freeze({sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"});function Sb(t){let e=Tb[t];return e===void 0&&de(`${t} is not served by this implementation`),e}var el={makeDigest:t=>new js(Sb(t))},qp={Digest:js};function Gp(){de("sha1-checked is not served by this implementation")}var tl={makeRejectingDigest:()=>Gp(),makeMitigatingDigest:()=>Gp()};var ji=globalThis.crypto.subtle;function he(t,e){let n=t[e];return n===void 0&&de(`${e} is not served by this implementation`),n}var $b=Object.freeze({aes128:16,aes256:32});function At(t){return he($b,t)}var Ki=Object.freeze({sha256:{hash:"SHA-256",digestBytes:32},sha384:{hash:"SHA-384",digestBytes:48},sha512:{hash:"SHA-512",digestBytes:64}}),Xp=Object.freeze({hash:"SHA-1",digestBytes:20});function Yp(t,e){let n=t instanceof Error?t.message:String(t);A(`invalid ${e}: ${n}`)}async function G(t,e,n,r,s,o){try{return await ji.importKey(e,n,r,s,o)}catch(i){if(i instanceof yt)throw i;Yp(i,t)}}async function X(t,e,n,r,s){try{return await ji.importKey("jwk",e,n,r,s)}catch(o){if(o instanceof yt)throw o;Yp(o,t)}}async function _r(t){return t.extractable||Se(),new Uint8Array(await I("raw key export",()=>ji.exportKey("raw",t)))}async function Dr(t){t.extractable||Se();let e=await I("jwk key export",()=>ji.exportKey("jwk",t));return JSON.stringify({kty:e.kty,k:e.k,alg:e.alg})}function nn(t){return typeof t=="string"?Math.floor(t.length*3/4):0}function Zp(t){let e=(c,l)=>(c-1-t&t-l-1)>>>31,n=e(65,90),r=e(97,122),s=e(48,57),o=e(45,45),i=e(95,95),a=n|r|s|o|i;return n*(t-65)+r*(t-97+26)+s*(t-48+52)+o*62+i*63-(1-a)}function Ks(t){let e=new Uint8Array(Math.floor(t.length*3/4)),n=0,r=0,s=0;for(let o=0;o=8&&(r-=8,e[s++]=n>>r&255);return e}function W(t){if(typeof t!="string")return;t.length%4===1&&A("JWK member has an impossible base64url length");let e=0,n=0;for(let s=0;s>31,n=o}e!==0&&A("JWK member is not unpadded base64url");let r=t.length%4;r!==0&&(n&(r===2?15:3))!==0&&A("JWK member has non-zero trailing bits")}function Y(t){let e;try{e=JSON.parse(t)}catch(o){A(`JWK is not valid JSON: ${o}`)}(typeof e!="object"||e===null||Array.isArray(e))&&A("JWK must be a JSON object");let{use:n,key_ops:r,...s}=e;return s}async function Z(t,e){try{return await e()}catch(n){throw n instanceof yt&&n.payload?.tag==="invalid-key"&&A(`invalid ${t}`),n}}function Qp(t){if(t.length>=2&&t[0]===48){let e=t[1];if(e<128)return 2;if(e===129&&t.length>=3&&t[2]>=128)return 3;if(e===130&&t.length>=4&&t[2]!==0)return 4}return 0}var Ab=Object.freeze({"P-256":Uint8Array.from([48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7]),"P-384":Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34])});function Hi(t,e){let n=Ab[t],r=Qp(e);(n===void 0||r===0||!n.every((s,o)=>e[r+o]===s))&&A(`${t} SPKI must name the curve by OID`)}var Ib=Uint8Array.from([48,13,6,9,42,134,72,134,247,13,1,1,1,5,0]);function zi(t){let e=Qp(t);(e===0||!Ib.every((n,r)=>t[e+r]===n))&&A("RSA SPKI must carry the rsaEncryption AlgorithmIdentifier")}function eh(t,e,n){let r=[48,42,48,5,6,3,43,101,t,3,33,0];return e.length===44&&r.every((o,i)=>e[i]===o)||A(`${n}: not an RFC 8410 SubjectPublicKeyInfo`),e.slice(12)}var nl=globalThis.crypto.subtle,th=new WeakMap;function rl(t){let e=th.get(t);return e===void 0&&B("derive-options minted by another provider"),e}var Vi=class{constructor(){th.set(this,{deriveBits:!1,deriveKey:!1})}canDeriveBits(e){rl(this).deriveBits=e}canDeriveKey(e){rl(this).deriveKey=e}};function Ji(t){return{...rl(t)}}function Vs(t){let e=[];return t.deriveBits&&e.push("deriveBits"),t.deriveKey&&e.push("deriveKey"),e.length===0&&Xe("an options resource granting nothing cannot mint"),e}var nh=new WeakMap;function Hs(t){let e=nh.get(t);return e===void 0&&B("derive-input minted by another provider"),e}function jn(t,e,n,r){let s=new zs;return nh.set(s,{key:t,params:{...e},policy:{...n},hasNaturalLength:r}),s}var zs=class{canDeriveBits(){return Hs(this).policy.deriveBits}canDeriveKey(){return Hs(this).policy.deriveKey}async deriveBits(e){let n=Hs(this);if(n.policy.deriveBits||q("derive-bits"),e===void 0){n.hasNaturalLength||B("a KDF's output length is a caller choice: it has no natural output length, which only agreement sources define");let s=await I("agreement derive",()=>nl.deriveBits(n.params,n.key,null));return new Uint8Array(s)}(e===0||e%8!==0)&&B(`derive length must be a non-zero multiple of 8 bits, got ${e}`);let r=await I("KDF derive",()=>nl.deriveBits(n.params,n.key,e));return new Uint8Array(r)}};function rh(t){return Hs(t)}async function rn(t,e,n,r){let s=Hs(t);return s.policy.deriveKey||q("derive-key"),n&&!s.policy.deriveBits&&Xe("minting an extractable key requires the derive-bits grant: an exportable key is bits disclosure by other means"),await I("KDF derive-key",()=>nl.deriveKey(s.params,s.key,e,n,r))}var sl={DeriveOptions:Vi,DeriveInput:zs};var ol=new WeakMap,il=new WeakMap,se=class{constructor(e,n){ol.set(this,{format:e,bytes:n})}},ot=class{constructor(e){il.set(this,{bytes:e})}};function sn(t){let e=ol.get(t);return ol.delete(t),e===void 0&&B("wrap-input already consumed or minted by another provider"),e}function F(t){let e=il.get(t);return il.delete(t),e===void 0&&B("unwrap-input already consumed or minted by another provider"),e}var al={WrapInput:se,UnwrapInput:ot};var Mr=globalThis.crypto.subtle,ih=new WeakMap;function on(t){let e=ih.get(t);return e===void 0&&B("mac-key-options minted by another provider"),e}var qi=class{constructor(){ih.set(this,{sign:!1,verify:!1,extractable:!1})}canSign(e){on(this).sign=e}canVerify(e){on(this).verify=e}extractable(e){on(this).extractable=e}};function Js(t){let e=[];return t.sign&&e.push("sign"),t.verify&&e.push("verify"),e.length===0&&Xe("a key with no enabled usage cannot be minted"),e}var an=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n=r}extractable(){return this.#e.extractable}canSign(){return this.#e.usages.includes("sign")}canVerify(){return this.#e.usages.includes("verify")}algorithmName(){return this.#e.algorithm.name}algorithmHash(){return this.#n}algorithmLength(){return this.#t}async sign(e){let n=await Ue(e);this.canSign()||q("sign");let r=await I("HMAC sign",()=>Mr.sign("HMAC",this.#e,n));return new Uint8Array(r)}async verify(e,n){let r=await Ue(e);this.canVerify()||q("verify"),await I("HMAC verify",()=>Mr.verify("HMAC",this.#e,n,r))||st()}async exportKeyRaw(){return sh(this.#e)}async exportKeyJwk(){return oh(this.#e)}async toWrapInputRaw(){return new se("raw",await sh(this.#e))}async toWrapInputJwk(){let e=await oh(this.#e);return new se("jwk",Jp(e))}};async function sh(t){t.extractable||Se();let e=await I("export raw",()=>Mr.exportKey("raw",t));return new Uint8Array(e)}async function oh(t){t.extractable||Se();let e=await I("export jwk",()=>Mr.exportKey("jwk",t));return JSON.stringify(e)}var ah={MacKey:an,MacKeyOptions:qi};async function cl(t,e,n){let r=on(n),s=Js(r);e.length===0&&A("empty key");let o=await I("HMAC import key",()=>Mr.importKey("raw",e,{name:"HMAC",hash:t.hash},r.extractable,s));return new an(o,e.length*8,t.hash)}async function ch(t,e,n){let r=on(n),s=Js(r);e===0&&A("HMAC key length must be non-zero"),e!==void 0&&e%8!==0&&de(`HMAC key length ${e} is not a multiple of 8; sub-byte lengths are not served`);let o=e??t.blockBytes*8,i=await I(`HMAC-${t.hash} key generation`,()=>Mr.generateKey({name:"HMAC",hash:t.hash,length:o},r.extractable,s));return new an(i,o,t.hash)}async function ll(t,e,n){let r=on(n),s=Js(r),o=Y(e);W(o.k);let i=await X("HMAC JWK",o,{name:"HMAC",hash:t.hash},r.extractable,s),a=typeof o.k=="string"?nn(o.k)*8:0;return new an(i,a,t.hash)}async function lh(t,e,n,r){let s=on(r),o=Js(s);n===0&&A("HMAC key length must be non-zero"),n!==void 0&&n%8!==0&&de(`HMAC key length ${n} is not a multiple of 8; sub-byte lengths are not served`);let i=n??t.blockBytes*8,a=await rn(e,{name:"HMAC",hash:t.hash,length:i},s.extractable,o);return new an(a,i,t.hash)}function uh(t,e,n){let{bytes:r}=F(e);return cl(t,r,n)}function fh(t,e,n){let{bytes:r}=F(e),s=on(n),o=ge(r,"sig",Js(s));return ll(t,o,n)}var Fr={hash:"SHA-1",blockBytes:64},Cb=Object.freeze({sha256:{hash:"SHA-256",blockBytes:64},sha384:{hash:"SHA-384",blockBytes:128},sha512:{hash:"SHA-512",blockBytes:128}});function Br(t){let e=Cb[t];return e===void 0&&de(`${t} is not served by this implementation`),e}var ul={importKeyRaw:(t,e)=>cl(Fr,t,e),importKeyJwk:(t,e)=>ll(Fr,t,e),generateKey:(t,e)=>ch(Fr,t,e),deriveKey:(t,e,n)=>lh(Fr,t,e,n),unwrapKeyRaw:(t,e)=>uh(Fr,t,e),unwrapKeyJwk:(t,e)=>fh(Fr,t,e)},fl={importKeyRaw:(t,e,n)=>cl(Br(t),e,n),importKeyJwk:(t,e,n)=>ll(Br(t),e,n),generateKey:(t,e,n)=>ch(Br(t),e,n),deriveKey:(t,e,n,r)=>lh(Br(t),e,n,r),unwrapKeyRaw:(t,e,n)=>uh(Br(t),e,n),unwrapKeyJwk:(t,e,n)=>fh(Br(t),e,n)};var cn=globalThis.crypto.subtle,Kn=Object.freeze({name:"Ed25519",namedCurve:void 0,hash:void 0,publicLength:32,signatureLength:64});function dh(t){return t.name==="ECDSA"?{name:"ECDSA",hash:t.hash}:t.name==="RSA-PSS"?{name:"RSA-PSS",saltLength:t.saltLength}:t.name}function dl(t){let e=t.match(/../g);if(e===null||e.length*2!==t.length)throw new Error("malformed hex literal in the Ed25519 constant table");return Uint8Array.from(e,n=>parseInt(n,16))}var Rb=dl("edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f"),Pb=dl("edd3f55c1a631258d69cf7a2def9de14"+"00".repeat(15)+"10"),Lb=["0000000000000000000000000000000000000000000000000000000000000000","0100000000000000000000000000000000000000000000000000000000000000","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f"].map(dl);function ph(t,e){for(let n=t.length-1;n>=0;n--)if(t[n]!==e[n])return t[n]Nb(e,n)):!1}var Ae=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}get cryptoKey(){return this.#e}async verify(e,n){let r=await Ue(e);n.length!==this.#t.signatureLength&&st(),this.#t.name==="Ed25519"&&(ph(n.subarray(32),Pb)||st(),Gi(n.subarray(0,32))||st()),await I(`${this.#t.name} verify`,()=>cn.verify(dh(this.#t),this.#e,n,r))||st()}algorithmName(){return this.#t.name}algorithmCurve(){return this.#t.namedCurve}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.length}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}async exportKeyRaw(){(this.#t.name==="RSASSA-PKCS1-v1_5"||this.#t.name==="RSA-PSS")&&de("RSA public keys have no raw form");let e=await I("raw key export",()=>cn.exportKey("raw",this.#e));return new Uint8Array(e)}async exportKeySpki(){let e=await I("spki key export",()=>cn.exportKey("spki",this.#e));return new Uint8Array(e)}async exportKeyJwk(){let e=await I("jwk key export",()=>cn.exportKey("jwk",this.#e));return e.kty==="OKP"?JSON.stringify({kty:e.kty,crv:e.crv,x:e.x}):e.kty==="RSA"?JSON.stringify({kty:e.kty,n:e.n,e:e.e}):JSON.stringify({kty:e.kty,crv:e.crv,x:e.x,y:e.y})}},Oe=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}async sign(e){let n=await Ue(e);this.canSign()||q("sign");let r=await I(`${this.#t.name} sign`,()=>cn.sign(dh(this.#t),this.#e,n));return new Uint8Array(r)}algorithmName(){return this.#t.name}algorithmCurve(){return this.#t.namedCurve}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.length}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}extractable(){return this.#e.extractable}canSign(){return this.#e.usages.includes("sign")}async exportKeyJwk(){this.#e.extractable||Se();let e=await I("jwk key export",()=>cn.exportKey("jwk",this.#e));return e.kty==="RSA"?JSON.stringify({kty:e.kty,n:e.n,e:e.e,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}):JSON.stringify(e.kty==="OKP"?{kty:e.kty,crv:e.crv,x:e.x,d:e.d}:{kty:e.kty,crv:e.crv,x:e.x,y:e.y,d:e.d})}async exportKeyPkcs8(){this.#e.extractable||Se();let e=await I("pkcs8 key export",()=>cn.exportKey("pkcs8",this.#e));return new Uint8Array(e)}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await this.exportKeyJwk()))}async toWrapInputPkcs8(){return new se("pkcs8",await this.exportKeyPkcs8())}},hh=new WeakMap;function Re(t){let e=hh.get(t);return e===void 0&&B("signing-key-options minted by another provider"),e}var qs=class{constructor(){hh.set(this,{sign:!1,extractable:!1})}canSign(e){Re(this).sign=e}extractable(e){Re(this).extractable=e}};function We(t){Or([["sign",t.sign]])}var mh={VerifyingKey:Ae,SigningKey:Oe,SigningKeyOptions:qs};function yh(t){let e=t.alg;e!==void 0&&e!=="Ed25519"&&e!=="EdDSA"&&A(`Ed25519 JWK declares alg ${String(e)}; the registered spellings are Ed25519 and EdDSA`)}var pl={importVerifyingKeyRaw:async t=>{t.length!==32&&A(`Ed25519 public keys are 32 bytes, got ${t.length}`),Gi(t)||A("non-canonical or small-order Ed25519 public key");let e=await G("Ed25519 public key","raw",t,"Ed25519",!0,["verify"]);return new Ae(e,Kn)},importVerifyingKeySpki:async t=>{let e=eh(112,t,"Ed25519");Gi(e)||A("non-canonical or small-order Ed25519 public key");let n=await G("Ed25519 spki","spki",t,"Ed25519",!0,["verify"]);return new Ae(n,Kn)},importVerifyingKeyJwk:async t=>{let e=Y(t);yh(e),W(e.x),(typeof e.x!="string"||!Gi(Ks(e.x)))&&A("non-canonical or small-order Ed25519 public key");let n=await X("Ed25519 public JWK",e,"Ed25519",!0,["verify"]);return new Ae(n,Kn)}},Gs={SigningKeyOptions:qs,generateKey:async t=>{let e=Re(t);We(e);let n=await I("Ed25519 key generation",()=>cn.generateKey("Ed25519",e.extractable,["sign","verify"]));return[new Oe(n.privateKey,Kn),new Ae(n.publicKey,Kn)]},importSigningKeyPkcs8:async(t,e)=>{let n=Re(e);We(n);let r=await G("Ed25519 pkcs8","pkcs8",t,"Ed25519",n.extractable,["sign"]);return new Oe(r,Kn)},importSigningKeyJwk:async(t,e)=>{let n=Re(e);We(n);let r=Y(t);yh(r),W(r.x),W(r.d);let s=await X("Ed25519 private JWK",r,"Ed25519",n.extractable,["sign"]);return s.type!=="private"&&A("OKP private JWK must carry `d` (base64url private key)"),new Oe(s,Kn)},unwrapSigningKeyPkcs8:(t,e)=>{let{bytes:n}=F(t);return Z("unwrapped Ed25519 pkcs8",()=>Gs.importSigningKeyPkcs8(n,e))},unwrapSigningKeyJwk:(t,e)=>{let{bytes:n}=F(t);We(Re(e));let r=ge(n,"sig",["sign"]);return Z("unwrapped Ed25519 private JWK",()=>Gs.importSigningKeyJwk(r,e))}};var hl=Object.freeze({"P-256":{p:2n**256n-2n**224n+2n**192n+2n**96n-1n,b:0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn,coordBytes:32},"P-384":{p:2n**384n-2n**128n-2n**96n+2n**32n-1n,b:0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aefn,coordBytes:48}});function Xi(t){let e=0n;for(let n of t)e=e<<8n|BigInt(n);return e}function wh(t,e,n){let{p:r,b:s}=t;if(e<0n||e>=r||n<0n||n>=r)return!1;let o=n*n%r,i=(e*e%r*e%r-3n*e%r+s)%r;return o===(i%r+r)%r}function Xs(t,e){let n=hl[t];if(n===void 0)return;let r=1+2*n.coordBytes;(e.length!==r||e[0]!==4)&&A(`${t} public keys are uncompressed SEC1 points (${r} bytes, leading 0x04)`);let s=Xi(e.subarray(1,1+n.coordBytes)),o=Xi(e.subarray(1+n.coordBytes));wh(n,s,o)||A(`${t} public key is not a point on the declared curve`)}function Yi(t,e){let n=hl[t];if(n===void 0)return;let r=1+2*n.coordBytes;if(e.length>=r){let o=e.subarray(e.length-r);if(o[0]===4){Xs(t,o);return}}let s=1+n.coordBytes;if(e.length>=s){let o=e[e.length-s];(o===2||o===3)&&A(`${t} SPKI carries a compressed point, which this implementation does not admit`)}}function Ur(t,e){e.crv!==t&&A(`EC JWK declares crv ${String(e.crv)}; the requested curve is ${t}`);let n=hl[t];if(n===void 0)return;let{x:r,y:s}=e;if(typeof r!="string"||typeof s!="string")return;W(r),W(s);let o=Ks(r),i=Ks(s);(o.length!==n.coordBytes||i.length!==n.coordBytes)&&A(`EC JWK coordinates must be ${n.coordBytes} bytes for ${t}`),wh(n,Xi(o),Xi(i))||A(`EC JWK is not a point on ${t}`)}var Ob=Object.freeze({"P-256":"ES256","P-384":"ES384"});function ml(t,e){let n=e.alg;if(n===void 0)return;let r=Ob[t];r!==void 0&&n!==r&&A(`EC JWK declares alg ${String(n)}; ${t} signature keys use ${r}`)}var _b=globalThis.crypto.subtle,Db=Object.freeze({"p256-sha256":Wr(256,"SHA-256"),"p256-sha384":Wr(256,"SHA-384"),"p256-sha512":Wr(256,"SHA-512"),"p384-sha256":Wr(384,"SHA-256"),"p384-sha384":Wr(384,"SHA-384"),"p384-sha512":Wr(384,"SHA-512")});function Wr(t,e){let n=t===256?32:48;return Object.freeze({name:"ECDSA",namedCurve:`P-${t}`,hash:e,publicLength:n*2+1,signatureLength:n*2})}function jr(t){return he(Db,t)}var yl={importVerifyingKeyRaw:async(t,e)=>{let n=jr(t);(e.length!==n.publicLength||e[0]!==4)&&A(`${t} public keys are uncompressed SEC1 points (${n.publicLength} bytes, leading 0x04)`),Xs(n.namedCurve,e);let r=await G(`${t} public key`,"raw",e,{name:"ECDSA",namedCurve:n.namedCurve},!0,["verify"]);return new Ae(r,n)},importVerifyingKeySpki:async(t,e)=>{let n=jr(t);Hi(n.namedCurve,e),Yi(n.namedCurve,e);let r=await G(`${t} spki`,"spki",e,{name:"ECDSA",namedCurve:n.namedCurve},!0,["verify"]);return new Ae(r,n)},importVerifyingKeyJwk:async(t,e)=>{let n=jr(t),r=Y(e);Ur(n.namedCurve,r),ml(n.namedCurve,r);let s=await X(`${t} public JWK`,r,{name:"ECDSA",namedCurve:n.namedCurve},!0,["verify"]);return new Ae(s,n)}},Ys={generateKey:async(t,e)=>{let n=Re(e);We(n);let r=jr(t),s=await I(`${t} key generation`,()=>_b.generateKey({name:"ECDSA",namedCurve:r.namedCurve},n.extractable,["sign","verify"]));return[new Oe(s.privateKey,r),new Ae(s.publicKey,r)]},importSigningKeyPkcs8:async(t,e,n)=>{let r=Re(n);We(r);let s=jr(t),o=await G(`${t} pkcs8`,"pkcs8",e,{name:"ECDSA",namedCurve:s.namedCurve},r.extractable,["sign"]);return new Oe(o,s)},importSigningKeyJwk:async(t,e,n)=>{let r=Re(n);We(r);let s=jr(t),o=Y(e);Ur(s.namedCurve,o),ml(s.namedCurve,o),W(o.d);let i=await X(`${t} private JWK`,o,{name:"ECDSA",namedCurve:s.namedCurve},r.extractable,["sign"]);return i.type!=="private"&&A("EC private JWK must carry `d` (base64url private scalar)"),new Oe(i,s)},unwrapSigningKeyPkcs8:(t,e,n)=>{let{bytes:r}=F(e);return Z(`unwrapped ${t} pkcs8`,()=>Ys.importSigningKeyPkcs8(t,r,n))},unwrapSigningKeyJwk:(t,e,n)=>{let{bytes:r}=F(e);We(Re(n));let s=ge(r,"sig",["sign"]);return Z(`unwrapped ${t} private JWK`,()=>Ys.importSigningKeyJwk(t,s,n))}};var Fb=globalThis.crypto.subtle,wt=Ki,Bb=1024,Mb=16384,kh=2048,xh=8192,wl=Object.freeze({m2048:2048,m3072:3072,m4096:4096,m8192:8192});function Kr(t,e,n=Bb,r=Mb){let{modulusLength:s,publicExponent:o}=t.algorithm;(sr)&&A(`invalid ${e}: RSA modulus must be ${n}-${r} bits, got ${s}`);let i=0;for(;iEh("RSASSA-PKCS1-v1_5",t,e,void 0),importVerifyingKeyJwk:(t,e)=>vh("RSASSA-PKCS1-v1_5",t,e,void 0)},xl={importVerifyingKeySpki:(t,e,n)=>Eh("RSA-PSS",t,n,e),importVerifyingKeyJwk:(t,e,n)=>vh("RSA-PSS",t,n,e)};async function Wb(t,e,n,r){Hn();let s=Re(r);We(s);let o=he(wt,e),i=he(wl,n),a=await I(`${t} key generation`,()=>Fb.generateKey({name:t,hash:o.hash,modulusLength:i,publicExponent:new Uint8Array([1,0,1])},s.extractable,["sign","verify"])),c=bl(t,o,i);return[new Oe(a.privateKey,c),new Ae(a.publicKey,c)]}async function gh(t,e,n,r){Hn();let s=Re(r);We(s);let o=he(wt,e),i=await G(`${t} pkcs8`,"pkcs8",n,{name:t,hash:o.hash},s.extractable,["sign"]),a=Kr(i,`${t} pkcs8`,kh,xh);return new Oe(i,bl(t,o,a))}async function bh(t,e,n,r){Hn();let s=Re(r);We(s);let o=he(wt,e),i=Y(n);Zs(Qs(t),e,i);for(let l of["n","e","d","p","q","dp","dq","qi"])W(i[l]);let a=await X(`${t} private JWK`,i,{name:t,hash:o.hash},s.extractable,["sign"]);a.type!=="private"&&A("RSA private JWK must carry `d` and the CRT members");let c=Kr(a,`${t} private JWK`,kh,xh);return new Oe(a,bl(t,o,c))}function Th(t){return{generateKey:(e,n,r)=>Wb(t,e,n,r),importSigningKeyPkcs8:(e,n,r)=>gh(t,e,n,r),importSigningKeyJwk:(e,n,r)=>bh(t,e,n,r),unwrapSigningKeyPkcs8:(e,n,r)=>{let{bytes:s}=F(n);return Z(`unwrapped ${t} pkcs8`,()=>gh(t,e,s,r))},unwrapSigningKeyJwk:(e,n,r)=>{let{bytes:s}=F(n);We(Re(r));let o=ge(s,"sig",["sign"]);return Z(`unwrapped ${t} private JWK`,()=>bh(t,e,o,r))}}}var El=Th("RSASSA-PKCS1-v1_5"),vl=Th("RSA-PSS");var zn=globalThis.crypto.subtle,Sh=new WeakMap;function it(t){let e=Sh.get(t);return e===void 0&&B("agreement-key-options minted by another provider"),e}var Zi=class{constructor(){Sh.set(this,{deriveBits:!1,deriveKey:!1,extractable:!1})}canDeriveBits(e){it(this).deriveBits=e}canDeriveKey(e){it(this).deriveKey=e}extractable(e){it(this).extractable=e}},Ye=class{#e;constructor(e){this.#e=e}get cryptoKey(){return this.#e}algorithmName(){return this.#e.algorithm.name}async exportKeyRaw(){let e=await I("export raw",()=>zn.exportKey("raw",this.#e));return new Uint8Array(e)}async exportKeyJwk(){let e=await I("export jwk",()=>zn.exportKey("jwk",this.#e));return JSON.stringify(e.kty==="OKP"?{kty:e.kty,crv:e.crv,x:e.x}:{kty:e.kty,crv:e.crv,x:e.x,y:e.y})}async exportKeySpki(){let e=await I("export spki",()=>zn.exportKey("spki",this.#e));return new Uint8Array(e)}},gt=class{#e;#t;constructor(e,n){this.#e=e,this.#t={...n}}async agree(e){let n={name:this.#e.algorithm.name,public:e.cryptoKey};try{await zn.deriveBits(n,this.#e,null)}catch(r){let s=Vp(r);s.name==="OperationError"&&A("the shared secret is all-zero: the peer public key is a small-order point"),s.name==="InvalidAccessError"&&A(`peer key is not usable with this key: ${s.detail}`),B(`agreement failed: ${s.detail}`)}return jn(this.#e,n,this.#t,!0)}algorithmName(){return this.#e.algorithm.name}canDeriveBits(){return this.#t.deriveBits}canDeriveKey(){return this.#t.deriveKey}extractable(){return this.#t.extractable}async exportKeyJwk(){this.#t.extractable||Se();let e=await I("export jwk",()=>zn.exportKey("jwk",this.#e));return JSON.stringify(e.kty==="OKP"?{kty:e.kty,crv:e.crv,x:e.x,d:e.d}:{kty:e.kty,crv:e.crv,x:e.x,y:e.y,d:e.d})}async exportKeyPkcs8(){this.#t.extractable||Se();let e=await I("export pkcs8",()=>zn.exportKey("pkcs8",this.#e));return new Uint8Array(e)}async toWrapInputJwk(){let e=await this.exportKeyJwk();return new se("jwk",new TextEncoder().encode(e))}async toWrapInputPkcs8(){return new se("pkcs8",await this.exportKeyPkcs8())}},Tl={AgreementKeyOptions:Zi,PublicKey:Ye,SecretKey:gt},Vn=["deriveBits","deriveKey"];function zt(t){!t.deriveBits&&!t.deriveKey&&Xe("a key with no enabled usage cannot be minted")}function Sl(t){let e=[];return t.deriveBits&&e.push("deriveBits"),t.deriveKey&&e.push("deriveKey"),e}var eo={importPublicKeyRaw:async t=>{t.length!==32&&A("X25519 public key must be 32 bytes (RFC 7748 u-coordinate)");let e=await G("X25519 public key","raw",t,"X25519",!0,[]);return new Ye(e)},importPublicKeySpki:async t=>{let e=await G("X25519 spki","spki",t,"X25519",!0,[]);return new Ye(e)},importPublicKeyJwk:async t=>{let e=Y(t);W(e.x);let n=await X("X25519 public JWK",e,"X25519",!0,[]);return new Ye(n)},importSecretKeyJwk:async(t,e)=>{let n=it(e);zt(n);let r=Y(t);W(r.x),W(r.d);let s=await X("X25519 private JWK",r,"X25519",n.extractable,Vn);return s.type!=="private"&&A("OKP private JWK must carry `d` (base64url private key)"),new gt(s,n)},importSecretKeyPkcs8:async(t,e)=>{let n=it(e);zt(n);let r=await G("X25519 pkcs8","pkcs8",t,"X25519",n.extractable,Vn);return new gt(r,n)},generateKey:async t=>{let e=it(t);zt(e);let n=await I("X25519 key generation",()=>zn.generateKey("X25519",e.extractable,Vn));return[new gt(n.privateKey,e),new Ye(n.publicKey)]},unwrapSecretKeyJwk:(t,e)=>{let{bytes:n}=F(t),r=it(e);zt(r);let s=ge(n,"enc",Sl(r));return Z("unwrapped X25519 private JWK",()=>eo.importSecretKeyJwk(s,e))},unwrapSecretKeyPkcs8:(t,e)=>{let{bytes:n}=F(t);return Z("unwrapped X25519 pkcs8",()=>eo.importSecretKeyPkcs8(n,e))}};var jb=globalThis.crypto.subtle,Kb=Object.freeze({p256:{namedCurve:"P-256",publicLength:65},p384:{namedCurve:"P-384",publicLength:97}});function Hr(t){return he(Kb,t)}var to={importPublicKeyRaw:async(t,e)=>{let n=Hr(t);(e.length!==n.publicLength||e[0]!==4)&&A(`${t} public keys are uncompressed SEC1 points (${n.publicLength} bytes, leading 0x04)`),Xs(n.namedCurve,e);let r=await G(`${t} public key`,"raw",e,{name:"ECDH",namedCurve:n.namedCurve},!0,[]);return new Ye(r)},importPublicKeySpki:async(t,e)=>{let n=Hr(t);Hi(n.namedCurve,e),Yi(n.namedCurve,e);let r=await G(`${t} spki`,"spki",e,{name:"ECDH",namedCurve:n.namedCurve},!0,[]);return new Ye(r)},importPublicKeyJwk:async(t,e)=>{let n=Hr(t),r=Y(e);Ur(n.namedCurve,r);let s=await X(`${t} public JWK`,r,{name:"ECDH",namedCurve:n.namedCurve},!0,[]);return new Ye(s)},importSecretKeyJwk:async(t,e,n)=>{let r=it(n);zt(r);let s=Hr(t),o=Y(e);Ur(s.namedCurve,o),W(o.d);let i=await X(`${t} private JWK`,o,{name:"ECDH",namedCurve:s.namedCurve},r.extractable,Vn);return i.type!=="private"&&A("EC private JWK must carry `d` (base64url private scalar)"),new gt(i,r)},importSecretKeyPkcs8:async(t,e,n)=>{let r=it(n);zt(r);let s=Hr(t),o=await G(`${t} pkcs8`,"pkcs8",e,{name:"ECDH",namedCurve:s.namedCurve},r.extractable,Vn);return new gt(o,r)},generateKey:async(t,e)=>{let n=it(e);zt(n);let r=Hr(t),s=await I(`${t} key generation`,()=>jb.generateKey({name:"ECDH",namedCurve:r.namedCurve},n.extractable,Vn));return[new gt(s.privateKey,n),new Ye(s.publicKey)]},unwrapSecretKeyJwk:(t,e,n)=>{let{bytes:r}=F(e),s=it(n);zt(s);let o=ge(r,"enc",Sl(s));return Z(`unwrapped ${t} private JWK`,()=>to.importSecretKeyJwk(t,o,n))},unwrapSecretKeyPkcs8:(t,e,n)=>{let{bytes:r}=F(e);return Z(`unwrapped ${t} pkcs8`,()=>to.importSecretKeyPkcs8(t,r,n))}};var $l=globalThis.crypto.subtle,Qi=new WeakMap,no=class{canDeriveBits(){return Qi.get(this).policy.deriveBits}canDeriveKey(){return Qi.get(this).policy.deriveKey}};function Hb(t,e){let n=new no;return Qi.set(n,{key:t,policy:{...e}}),n}async function $h(t,e){let n=zb(e),r=Vs(n),s=await I("HKDF import ikm",()=>$l.importKey("raw",t,"HKDF",!1,r));return Hb(s,n)}function zb(t){return Ji(t)}var Al={Ikm:no,importIkm:(t,e)=>$h(t,e),unwrapIkm:(t,e)=>{let{bytes:n}=F(t);return $h(n,e)}},Vb=Object.freeze({sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"});function Ah(t){let e=Vb[t];return e===void 0&&de(`${t} is not served by this implementation`),e}async function Ih(t,e,n,r){let s=Qi.get(e);s===void 0&&B("ikm minted by another provider");let o={name:"HKDF",hash:t,salt:n.slice(),info:r.slice()};return jn(s.key,o,s.policy,!1)}async function Ch(t,e,n,r){let s=rh(e);s.policy.deriveKey||q("derive-key"),s.hasNaturalLength||B("chaining from another KDF's input is not served: a KDF's output length is a caller choice, not natural");let o=await $l.deriveBits(s.params,s.key,null),i=await $l.importKey("raw",o,"HKDF",!1,Vs(s.policy)),a={name:"HKDF",hash:t,salt:n.slice(),info:r.slice()};return jn(i,a,s.policy,!1)}var Il={prepare:(t,e,n,r)=>Ih(Ah(t),e,n,r),prepareFrom:(t,e,n,r)=>Ch(Ah(t),e,n,r)},Cl={prepare:(t,e,n)=>Ih("SHA-1",t,e,n),prepareFrom:(t,e,n)=>Ch("SHA-1",t,e,n)};var Jb=globalThis.crypto.subtle,Ph=new WeakMap;function Rl(t){let e=Ph.get(t);return e===void 0&&B("password minted by another provider"),e}var ro=class{canDeriveBits(){return Rl(this).policy.deriveBits}canDeriveKey(){return Rl(this).policy.deriveKey}};async function Rh(t,e){let n=Ji(e),r=Vs(n),s=await I("PBKDF2 password import",()=>Jb.importKey("raw",t,"PBKDF2",!1,r)),o=new ro;return Ph.set(o,{key:s,policy:n}),o}var Pl={Password:ro,importPassword:Rh,unwrapPassword:(t,e)=>{let{bytes:n}=F(t);return Z("unwrapped PBKDF2 password",()=>Rh(n,e))}};function Lh(t,e,n,r){r===0&&B("PBKDF2 requires a positive iteration count");let{key:s,policy:o}=Rl(e),i={name:"PBKDF2",hash:t,salt:n.slice(),iterations:r};return jn(s,i,o,!1)}var Ll={prepare:(t,e,n,r)=>Promise.resolve(Lh(he(Ki,t).hash,e,n,r))},Nl={prepare:(t,e,n)=>Promise.resolve(Lh(Xp.hash,t,e,n))};var zr=globalThis.crypto.subtle,Oh=new WeakMap;function It(t){let e=Oh.get(t);return e===void 0&&B("aead-key-options minted by another provider"),e}var ea=class{constructor(){Oh.set(this,{seal:!1,open:!1,wrap:!1,unwrap:!1,extractable:!1})}canSeal(e){It(this).seal=e}canOpen(e){It(this).open=e}canWrap(e){It(this).wrap=e}canUnwrap(e){It(this).unwrap=e}extractable(e){It(this).extractable=e}};function oo(t){let e=[];return(t.seal||t.wrap)&&e.push("encrypt"),(t.open||t.unwrap)&&e.push("decrypt"),e.length===0&&Xe("a key with no enabled usage cannot be minted"),e}var qb=new Set([32,64,96,104,112,120,128]);function Gb(t){if(t===void 0)return 128;let e=t*8;return qb.has(e)||de(`AES-GCM tag size ${t} bytes is outside the registry's 32-128 bit set`),e}var ln=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n={...r}}algorithmName(){return this.#e.algorithm.name}algorithmLength(){return this.#t}nonceSize(){return 12}tagSize(){return 16}extractable(){return this.#e.extractable}canSeal(){return this.#n.seal}canOpen(){return this.#n.open}canWrap(){return this.#n.wrap}canUnwrap(){return this.#n.unwrap}async#s(e,n,r,s,o,i=e){(n.length<12||n.length>128)&&Wn(`AES-GCM nonce must be 12 to 128 bytes, got ${n.length}`);let a={name:"AES-GCM",iv:n,additionalData:r,tagLength:Gb(s)};if(e==="seal"){let c=await I(`AES-GCM ${i}`,()=>zr.encrypt(a,this.#e,o));return new Uint8Array(c)}try{let c=await zr.decrypt(a,this.#e,o);return new Uint8Array(c)}catch(c){Wi(c,i)}}async seal(e,n,r,s){let o=await Ue(s);return this.canSeal()||q("seal"),this.#s("seal",e,n,r,o)}async open(e,n,r,s){let o=await Ue(s);return this.canOpen()||q("open"),this.#s("open",e,n,r,o)}async wrap(e,n,r,s){let{bytes:o}=sn(s);return this.canWrap()||q("wrap"),this.#s("seal",e,n,r,o,"wrap")}async unwrap(e,n,r,s){this.canUnwrap()||q("unwrap");let o=await this.#s("open",e,n,r,s,"unwrap");return new ot(o)}async exportKeyRaw(){this.#e.extractable||Se();let e=await I("export raw",()=>zr.exportKey("raw",this.#e));return new Uint8Array(e)}async exportKeyJwk(){this.#e.extractable||Se();let e=await I("export jwk",()=>zr.exportKey("jwk",this.#e));return JSON.stringify(e)}async toWrapInputRaw(){return new se("raw",await this.exportKeyRaw())}async toWrapInputJwk(){let e=await this.exportKeyJwk();return new se("jwk",new TextEncoder().encode(e))}},Ol={AeadKey:ln,AeadKeyOptions:ea},Xb=Object.freeze({aes128:128,aes256:256});function so(t){let e=Xb[t];return e===void 0&&de(`${t} is not served by this implementation`),e}async function Nh(t,e,n){let r=It(n);e.length*8!==t&&A(`AES-GCM key must be ${t/8} bytes for the declared variant, got ${e.length}`);let s=oo(r),o=await I("AES-GCM import key",()=>zr.importKey("raw",e,{name:"AES-GCM",length:t},r.extractable,s));return new ln(o,t,r)}var ta={importKeyRaw:(t,e,n)=>Nh(so(t),e,n),importKeyJwk:async(t,e,n)=>{let r=so(t),s=It(n),o=oo(s),i=Y(e);W(i.k);let a=await X(`${t} JWK`,i,{name:"AES-GCM",length:r},s.extractable,o),c=nn(i.k)*8;return c!==r&&A(`JWK carries a ${c}-bit key; ${t} requires ${r}`),new ln(a,r,s)},generateKey:async(t,e)=>{let n=so(t),r=It(e),s=oo(r),o=await I(`AES-${n}-GCM key generation`,()=>zr.generateKey({name:"AES-GCM",length:n},r.extractable,s));return new ln(o,n,r)},deriveKey:async(t,e,n)=>{let r=so(t),s=It(n),o=oo(s),i=await rn(e,{name:"AES-GCM",length:r},s.extractable,o);return new ln(i,r,s)},unwrapKeyRaw:(t,e,n)=>{let{bytes:r}=F(e);return Nh(so(t),r,n)},unwrapKeyJwk:(t,e,n)=>{let{bytes:r}=F(e),s=It(n),o=ge(r,"enc",oo(s));return ta.importKeyJwk(t,o,n)}};var _l=globalThis.crypto.subtle,Dh=new WeakMap;function Ct(t){let e=Dh.get(t);return e===void 0&&B("cipher-key-options minted by another provider"),e}var na=class{constructor(){Dh.set(this,{encrypt:!1,decrypt:!1,wrap:!1,unwrap:!1,extractable:!1})}canEncrypt(e){Ct(this).encrypt=e}canDecrypt(e){Ct(this).decrypt=e}canWrap(e){Ct(this).wrap=e}canUnwrap(e){Ct(this).unwrap=e}extractable(e){Ct(this).extractable=e}};function io(t){let e=[];return(t.encrypt||t.wrap)&&e.push("encrypt"),(t.decrypt||t.unwrap)&&e.push("decrypt"),e.length===0&&Xe("a key with no enabled usage cannot be minted"),e}function Yb(t){let e=[];return t.encrypt&&e.push("encrypt"),t.decrypt&&e.push("decrypt"),t.wrap&&e.push("wrapKey"),t.unwrap&&e.push("unwrapKey"),e}function _h(t,e,n){return t==="AES-CBC"&&n!==void 0&&Wn("AES-CBC takes no counter length"),t==="AES-CTR"&&(n===void 0&&Wn("AES-CTR requires a counter length"),(n===0||n>128)&&Wn(`the counter length must be 1 to 128 bits, got ${n}`)),e.length!==16&&Wn(`${t} requires a 16-byte IV, got ${e.length} bytes`),t==="AES-CBC"?{name:t,iv:e}:{name:t,counter:e,length:n}}var un=class{#e;#t;#n;#s;constructor(e,n,r,s){this.#e=e,this.#t=n,this.#n=r,this.#s={...s}}async#r(e,n,r){let s=_h(this.#t,e,n),o=await I(`${this.#t} encrypt`,()=>_l.encrypt(s,this.#e,r));return new Uint8Array(o)}async#o(e,n,r){let s=_h(this.#t,e,n);try{return new Uint8Array(await _l.decrypt(s,this.#e,r))}catch{B(`${this.#t} decryption failed`)}}async encrypt(e,n,r){let s=await Ue(r);return this.canEncrypt()||q("encrypt"),[await this.#r(e,n,s)]}async decrypt(e,n,r){let s=await Ue(r);return this.canDecrypt()||q("decrypt"),[await this.#o(e,n,s)]}async wrap(e,n,r){let{bytes:s}=sn(r);return this.canWrap()||q("wrap"),this.#r(e,n,s)}async unwrap(e,n,r){return this.canUnwrap()||q("unwrap"),new ot(await this.#o(e,n,r))}algorithmName(){return this.#t}algorithmLength(){return this.#n}ivSize(){return 16}extractable(){return this.#e.extractable}canEncrypt(){return this.#s.encrypt}canDecrypt(){return this.#s.decrypt}canWrap(){return this.#s.wrap}canUnwrap(){return this.#s.unwrap}exportKeyRaw(){return _r(this.#e)}exportKeyJwk(){return Dr(this.#e)}async toWrapInputRaw(){return new se("raw",await _r(this.#e))}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await Dr(this.#e)))}};function Fh(t){let e={async importKeyRaw(n,r,s){let o=Ct(s),i=io(o),a=At(n);r.length!==a&&A(`${n} requires ${a} key bytes, got ${r.length}`);let c=await G(`${n} key`,"raw",r,{name:t},o.extractable,i);return new un(c,t,a*8,o)},async importKeyJwk(n,r,s){let o=Ct(s),i=io(o),a=At(n)*8,c=Y(r);W(c.k);let l=await X(`${n} JWK`,c,{name:t},o.extractable,i),u=nn(c.k)*8;return u!==a&&A(`JWK carries a ${u}-bit key; ${n} requires ${a}`),new un(l,t,a,o)},async generateKey(n,r){let s=Ct(r),o=io(s),i=At(n)*8,a=await I(`${n} key generation`,()=>_l.generateKey({name:t,length:i},s.extractable,o));return new un(a,t,i,s)},async deriveKey(n,r,s){let o=Ct(s),i=io(o),a=At(n)*8,c=await rn(r,{name:t,length:a},o.extractable,i);return new un(c,t,a,o)},unwrapKeyRaw(n,r,s){let{bytes:o}=F(r);return Z(`unwrapped ${n} key material`,()=>e.importKeyRaw(n,o,s))},unwrapKeyJwk(n,r,s){let{bytes:o}=F(r),i=Ct(s);io(i);let a=ge(o,"enc",Yb(i));return Z(`unwrapped ${n} JWK`,()=>e.importKeyJwk(n,a,s))}};return e}var Dl={CipherKey:un,CipherKeyOptions:na},Fl=Fh("AES-CBC"),Bl=Fh("AES-CTR");var co=globalThis.crypto.subtle,Bh=new WeakMap;function fn(t){let e=Bh.get(t);return e===void 0&&B("kw-key-options minted by another provider"),e}var ra=class{constructor(){Bh.set(this,{wrap:!1,unwrap:!1,extractable:!1})}canWrap(e){fn(this).wrap=e}canUnwrap(e){fn(this).unwrap=e}extractable(e){fn(this).extractable=e}};function ao(t){return Or([["wrapKey",t.wrap],["unwrapKey",t.unwrap]])}function Zb(t){let e=[];return t.wrap&&e.push("wrapKey"),t.unwrap&&e.push("unwrapKey"),e}var dn=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n={...r}}async wrap(e){let n=sn(e);this.canWrap()||q("wrap");let r=n.bytes;if(n.format==="jwk"&&r.length%8!==0){let i=new Uint8Array(r.length+8-r.length%8);i.set(r),i.fill(32,r.length),r=i}(r.length%8!==0||r.length<16)&&A("AES-KW wraps key material of at least 16 bytes, a multiple of 8");let s=await I("AES-KW wrap",()=>co.importKey("raw",r,{name:"HMAC",hash:"SHA-256"},!0,["sign"])),o=await I("AES-KW wrap",()=>co.wrapKey("raw",s,this.#e,"AES-KW"));return new Uint8Array(o)}async unwrap(e){this.canUnwrap()||q("unwrap"),(e.length%8!==0||e.length<24)&&st();let n;try{n=await co.unwrapKey("raw",e,this.#e,"AES-KW",{name:"HMAC",hash:"SHA-256"},!0,["sign"])}catch(s){Wi(s,"unwrap")}let r=new Uint8Array(await I("AES-KW unwrap",()=>co.exportKey("raw",n)));return new ot(r)}algorithmName(){return this.#e.algorithm.name}algorithmLength(){return this.#t}extractable(){return this.#n.extractable}canWrap(){return this.#n.wrap}canUnwrap(){return this.#n.unwrap}exportKeyRaw(){return _r(this.#e)}exportKeyJwk(){return Dr(this.#e)}async toWrapInputRaw(){return new se("raw",await _r(this.#e))}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await Dr(this.#e)))}},Ml={KwKey:dn,KwKeyOptions:ra},lo={async importKeyRaw(t,e,n){let r=fn(n),s=ao(r),o=At(t);e.length!==o&&A(`${t} requires ${o} key bytes, got ${e.length}`);let i=await G(`${t} key`,"raw",e,{name:"AES-KW"},r.extractable,s);return new dn(i,o*8,r)},async importKeyJwk(t,e,n){let r=fn(n),s=ao(r),o=At(t)*8,i=Y(e);W(i.k);let a=await X(`${t} JWK`,i,{name:"AES-KW"},r.extractable,s),c=nn(i.k)*8;return c!==o&&A(`JWK carries a ${c}-bit key; ${t} requires ${o}`),new dn(a,o,r)},async generateKey(t,e){let n=fn(e),r=ao(n),s=At(t)*8,o=await I(`${t} key generation`,()=>co.generateKey({name:"AES-KW",length:s},n.extractable,r));return new dn(o,s,n)},async deriveKey(t,e,n){let r=fn(n),s=ao(r),o=At(t)*8,i=await rn(e,{name:"AES-KW",length:o},r.extractable,s);return new dn(i,o,r)},unwrapKeyRaw(t,e,n){let{bytes:r}=F(e);return Z(`unwrapped ${t} key material`,()=>lo.importKeyRaw(t,r,n))},unwrapKeyJwk(t,e,n){let{bytes:r}=F(e),s=fn(n);ao(s);let o=ge(r,"enc",Zb(s));return Z(`unwrapped ${t} JWK`,()=>lo.importKeyJwk(t,o,n))}};var pn=globalThis.crypto.subtle,Qb=2048,ek=8192;function oa(t,e){return Kr(t,e,Qb,ek)}function uo(t,e){return{hash:t.hash,modulusLength:e,plaintextBound:Math.ceil(e/8)-2*t.digestBytes-2}}function Mh(t,e,n){Kt({tag:"extension",val:{origin:"polymorph:webcrypto",name:"message-too-long",message:`${t} is ${e} bytes; this key's RSA-OAEP bound is ${n.plaintextBound}`}})}function Ul(t){return t===void 0?{name:"RSA-OAEP"}:{name:"RSA-OAEP",label:t}}async function Uh(t,e,n){try{return new Uint8Array(await pn.decrypt(Ul(e),t,n))}catch{st()}}var Gn=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}async encrypt(e,n){n.length>this.#t.plaintextBound&&Mh("plaintext",n.length,this.#t);let r=await I("RSA-OAEP encrypt",()=>pn.encrypt(Ul(e),this.#e,n));return new Uint8Array(r)}async wrap(e,n){let{bytes:r}=sn(n);r.length>this.#t.plaintextBound&&Mh("wrapped key material",r.length,this.#t);let s=await I("RSA-OAEP wrap",()=>pn.encrypt(Ul(e),this.#e,r));return new Uint8Array(s)}algorithmName(){return this.#e.algorithm.name}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.modulusLength}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}exportKeyRaw(){de("RSA public keys have no raw form")}async exportKeySpki(){let e=await I("spki key export",()=>pn.exportKey("spki",this.#e));return new Uint8Array(e)}async exportKeyJwk(){let e=await I("jwk key export",()=>pn.exportKey("jwk",this.#e));return JSON.stringify({kty:e.kty,n:e.n,e:e.e})}},Wh=new WeakMap;function Jn(t){let e=Wh.get(t);return e===void 0&&B("decryption-key-options minted by another provider"),e}var ia=class{constructor(){Wh.set(this,{decrypt:!1,unwrap:!1,extractable:!1})}canDecrypt(e){Jn(this).decrypt=e}canUnwrap(e){Jn(this).unwrap=e}extractable(e){Jn(this).extractable=e}};function sa(t){return Or([["decrypt",t.decrypt||t.unwrap]])}function tk(t){let e=[];return t.decrypt&&e.push("decrypt"),t.unwrap&&e.push("unwrapKey"),e}var qn=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n={...r}}decrypt(e,n){return this.canDecrypt()||q("decrypt"),Uh(this.#e,e,n)}async unwrap(e,n){return this.canUnwrap()||q("unwrap"),new ot(await Uh(this.#e,e,n))}algorithmName(){return this.#e.algorithm.name}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.modulusLength}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}canDecrypt(){return this.#n.decrypt}canUnwrap(){return this.#n.unwrap}extractable(){return this.#e.extractable}async exportKeyJwk(){this.#e.extractable||Se();let e=await I("jwk key export",()=>pn.exportKey("jwk",this.#e));return JSON.stringify({kty:e.kty,n:e.n,e:e.e,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi})}async exportKeyPkcs8(){this.#e.extractable||Se();let e=await I("pkcs8 key export",()=>pn.exportKey("pkcs8",this.#e));return new Uint8Array(e)}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await this.exportKeyJwk()))}async toWrapInputPkcs8(){return new se("pkcs8",await this.exportKeyPkcs8())}},Wl={EncryptionKey:Gn,DecryptionKey:qn,DecryptionKeyOptions:ia},jl={importEncryptionKeySpki:async(t,e)=>{let n=he(wt,t);zi(e);let r=await G("RSA-OAEP spki","spki",e,{name:"RSA-OAEP",hash:n.hash},!0,["encrypt"]),s=oa(r,"RSA-OAEP spki");return new Gn(r,uo(n,s))},importEncryptionKeyJwk:async(t,e)=>{let n=he(wt,t),r=Y(e);Zs(Qs("RSA-OAEP"),t,r),W(r.n),W(r.e);let s=await X("RSA-OAEP public JWK",r,{name:"RSA-OAEP",hash:n.hash},!0,["encrypt"]),o=oa(s,"RSA-OAEP public JWK");return new Gn(s,uo(n,o))}},fo={generateKey:async(t,e,n)=>{Hn();let r=Jn(n);sa(r);let s=he(wt,t),o=he(wl,e),i=await I("RSA-OAEP key generation",()=>pn.generateKey({name:"RSA-OAEP",hash:s.hash,modulusLength:o,publicExponent:new Uint8Array([1,0,1])},r.extractable,["encrypt","decrypt"])),a=uo(s,o);return[new qn(i.privateKey,a,r),new Gn(i.publicKey,a)]},importDecryptionKeyPkcs8:async(t,e,n)=>{Hn();let r=Jn(n),s=sa(r),o=he(wt,t),i=await G("RSA-OAEP pkcs8","pkcs8",e,{name:"RSA-OAEP",hash:o.hash},r.extractable,s),a=oa(i,"RSA-OAEP pkcs8");return new qn(i,uo(o,a),r)},importDecryptionKeyJwk:async(t,e,n)=>{Hn();let r=Jn(n),s=sa(r),o=he(wt,t),i=Y(e);Zs(Qs("RSA-OAEP"),t,i);for(let l of["n","e","d","p","q","dp","dq","qi"])W(i[l]);let a=await X("RSA-OAEP private JWK",i,{name:"RSA-OAEP",hash:o.hash},r.extractable,s);a.type!=="private"&&A("RSA private JWK must carry `d` and the CRT members");let c=oa(a,"RSA-OAEP private JWK");return new qn(a,uo(o,c),r)},unwrapDecryptionKeyPkcs8:(t,e,n)=>{let{bytes:r}=F(e);return Z("unwrapped RSA-OAEP pkcs8",()=>fo.importDecryptionKeyPkcs8(t,r,n))},unwrapDecryptionKeyJwk:(t,e,n)=>{let{bytes:r}=F(e),s=Jn(n);sa(s);let o=ge(r,"enc",tk(s));return Z("unwrapped RSA-OAEP private JWK",()=>fo.importDecryptionKeyJwk(t,o,n))}};function jh(){return{"polymorph:webcrypto/digest@0.1.0":qp,"polymorph:webcrypto/sha2@0.1.0":el,"polymorph:webcrypto/sha1-checked@0.1.0":tl,"polymorph:webcrypto/mac@0.1.0":ah,"polymorph:webcrypto/hmac-sha1@0.1.0":ul,"polymorph:webcrypto/hmac-sha2@0.1.0":fl,"polymorph:webcrypto/signature@0.1.0":mh,"polymorph:webcrypto/ed25519-verify@0.1.0":pl,"polymorph:webcrypto/ed25519-sign@0.1.0":Gs,"polymorph:webcrypto/ecdsa-verify@0.1.0":yl,"polymorph:webcrypto/ecdsa-sign@0.1.0":Ys,"polymorph:webcrypto/rsassa-pkcs1-v15-verify@0.1.0":kl,"polymorph:webcrypto/rsassa-pkcs1-v15-sign@0.1.0":El,"polymorph:webcrypto/rsa-pss-verify@0.1.0":xl,"polymorph:webcrypto/rsa-pss-sign@0.1.0":vl,"polymorph:webcrypto/key-agreement@0.1.0":Tl,"polymorph:webcrypto/x25519@0.1.0":eo,"polymorph:webcrypto/ecdh@0.1.0":to,"polymorph:webcrypto/derivation@0.1.0":sl,"polymorph:webcrypto/wrapping@0.1.0":al,"polymorph:webcrypto/hkdf@0.1.0":Al,"polymorph:webcrypto/hkdf-sha2@0.1.0":Il,"polymorph:webcrypto/hkdf-sha1@0.1.0":Cl,"polymorph:webcrypto/pbkdf2@0.1.0":Pl,"polymorph:webcrypto/pbkdf2-sha2@0.1.0":Ll,"polymorph:webcrypto/pbkdf2-sha1@0.1.0":Nl,"polymorph:webcrypto/aead@0.1.0":Ol,"polymorph:webcrypto/aes-gcm@0.1.0":ta,"polymorph:webcrypto/cipher@0.1.0":Dl,"polymorph:webcrypto/aes-cbc@0.1.0":Fl,"polymorph:webcrypto/aes-ctr@0.1.0":Bl,"polymorph:webcrypto/key-wrap@0.1.0":Ml,"polymorph:webcrypto/aes-kw@0.1.0":lo,"polymorph:webcrypto/public-encryption@0.1.0":Wl,"polymorph:webcrypto/rsa-oaep-encrypt@0.1.0":jl,"polymorph:webcrypto/rsa-oaep-decrypt@0.1.0":fo}}function z(t){return new j(t,t.kind+("value"in t?`: ${t.value}`:""))}var nk=3e4,rk=1e4,sk=8*1024*1024,ok=8*1024*1024,ik=4,ak=65536,Kh=sk,Kl=nk,Hl=rk;function ck(t){t.maxInboundBufferBytes!==void 0&&lk(t.maxInboundBufferBytes),t.connectTimeoutMs!==void 0&&uk(t.connectTimeoutMs),t.closeTimeoutMs!==void 0&&fk(t.closeTimeoutMs)}function lk(t){if(!(Number.isFinite(t)&&t>0))throw new Error(`invalid inbound buffer bound ${t}: expected a positive byte count`);Kh=t}function uk(t){if(!(Number.isFinite(t)&&t>0))throw new Error(`invalid connect timeout ${t}: expected positive milliseconds`);Kl=t}function fk(t){if(!(Number.isFinite(t)&&t>0))throw new Error(`invalid close timeout ${t}: expected positive milliseconds`);Hl=t}var dk=new TextEncoder;function Hh(t){return dk.encode(t).byteLength}function pk(t){if(!t.length)return!1;for(let e=0;e=127||'"(),/:;<=>?@[\\]{}'.includes(t[e]))return!1}return!0}function hk(t){if(t.includes("#"))throw z({kind:"invalid-url",value:"URL must not have a fragment"});let e;try{e=new URL(t)}catch(n){throw z({kind:"invalid-url",value:`URL does not parse: ${n?.message??n}`})}if(e.protocol!=="ws:"&&e.protocol!=="wss:")throw z({kind:"invalid-url",value:`URL scheme must be ws or wss, not ${JSON.stringify(e.protocol)}`});if(!e.hostname)throw z({kind:"invalid-url",value:"URL must have a host"});if(e.username||e.password)throw z({kind:"invalid-url",value:"URL must not have userinfo"})}function mk(t){for(let e=0;e=3e3&&t<=4999))throw z({kind:"invalid-argument",value:`close code must be 1000 or in 3000-4999, not ${t}`})}else if(e.length)throw z({kind:"invalid-argument",value:"a close reason requires a close code"});let n=Hh(e);if(n>123)throw z({kind:"invalid-argument",value:`close reason must be at most 123 bytes, got ${n}`})}var wk=new Set([0,1006,1015]),zl=class t{#e;#t;#n=!1;#s=!1;#r=!1;#o=void 0;#i=[];#a=null;static async connect(e,n){hk(e),mk(n);let r;try{r=n.length?new WebSocket(e,n):new WebSocket(e)}catch(s){throw z({kind:"connect-failed",value:String(s?.message??s)})}if(r.binaryType="arraybuffer",await new Promise((s,o)=>{let i,a=(f,d)=>{clearTimeout(i),r.removeEventListener("open",c),r.removeEventListener("close",l),r.removeEventListener("error",u),f(d)},c=()=>a(s),l=f=>{let d=f;a(o,z({kind:"connect-failed",value:d.reason||`connection failed (code ${d.code})`}))},u=()=>{};r.addEventListener("open",c,{once:!0}),r.addEventListener("close",l,{once:!0}),r.addEventListener("error",u,{once:!0}),i=setTimeout(()=>{a(o,z({kind:"connect-failed",value:`handshake timed out after ${Kl}ms`}));try{r.close()}catch{}},Kl)}),n.length&&!n.includes(r.protocol)){try{r.close()}catch{}throw z({kind:"connect-failed",value:r.protocol?`server selected subprotocol ${JSON.stringify(r.protocol)} which was not offered`:"server selected no subprotocol although one was offered"})}if(!n.length&&r.protocol){try{r.close()}catch{}throw z({kind:"connect-failed",value:`server selected subprotocol ${JSON.stringify(r.protocol)} although none was offered`})}return new t(r)}constructor(e){this.#e=e,this.#t=gk(e,()=>this.#c()),e.addEventListener("close",n=>this.#u(n),{once:!0}),e.addEventListener("error",()=>{},{once:!0})}protocol(){return this.#e.protocol}async send(e){for(;;){if(this.#n||this.#e.readyState!==WebSocket.OPEN)throw z({kind:"closed"});if(this.#e.bufferedAmount<=ok)break;await new Promise(n=>setTimeout(n,ik))}try{this.#e.send(e.value)}catch(n){throw z({kind:"other",value:String(n?.message??n)})}}receive(){return this.#n?Promise.reject(z({kind:"closed"})):this.#s?Promise.reject(z({kind:"receiving-via-stream"})):this.#t.next()}async sendViaStream(e){let n=0n;try{for await(let r of bk(e)){let{bytes:s,excess:o}=await Ek(r.data,r.length);if(o>0||s.length!==r.length)throw z({kind:"other",value:`stream-message payload was ${s.length+o} bytes but length declared ${r.length}`});let i;if(r.kind==="string"){let a;try{a=new TextDecoder("utf-8",{fatal:!0}).decode(s)}catch{throw z({kind:"other",value:"string stream-message payload is not valid UTF-8"})}i={kind:"string",value:a}}else i={kind:"binary",value:s};await this.send(i),n+=1n}}catch(r){let s=r instanceof j?r.payload:{kind:"other",value:String(r)};throw new j({error:s,sent:n},`send-via-stream failed after ${n} message(s)`)}}receiveViaStream(){if(this.#n)throw z({kind:"closed"});if(this.#s)throw z({kind:"receiving-via-stream"});this.#s=!0;let e=this.#t;return e.rejectWaiters({kind:"receiving-via-stream"}),new ReadableStream({async pull(n){let r;try{r=await e.next()}catch{n.close();return}let s=r.kind==="string"?new TextEncoder().encode(r.value):r.value;n.enqueue({kind:r.kind,length:s.length,data:xk(s)})}})}state(){return this.#l()}waitClosed(){return this.#r?Promise.resolve(this.#o):new Promise(e=>this.#i.push(e))}close(e,n){if(yk(e,n),!this.#n){this.#n=!0,this.#t.discard(),this.#a=setTimeout(()=>this.#u(null),Hl);try{e==null?this.#e.close():n.length?this.#e.close(e,n):this.#e.close(e)}catch{}}}[Symbol.dispose](){try{this.close(void 0,"")}catch{}}#c(){!this.#r&&this.#a===null&&(this.#a=setTimeout(()=>this.#u(null),Hl))}#l(){if(this.#r)return"closed";if(this.#n)return"closing";switch(this.#e.readyState){case WebSocket.CLOSING:return"closing";case WebSocket.CLOSED:return"closed";default:return"open"}}#u(e){if(this.#r)return;this.#r=!0,this.#a!==null&&(clearTimeout(this.#a),this.#a=null),this.#t.end(),e&&!wk.has(e.code)?this.#o={code:e.code,reason:e.reason??""}:this.#o=void 0;let n=this.#i;this.#i=[];for(let r of n)r(this.#o)}};function gk(t,e){let n=Kh,r=[],s=[],o=0,i=!1,a=!1,c=(f,d)=>{let w=s.shift();w?w.resolve(f):(o+=d,r.push({message:f,size:d}))};t.addEventListener("message",f=>{let d=f.data;if(i)return;let w=typeof d=="string"?Hh(d):d.byteLength;if(o+w>n){i=!0;try{t.close()}catch{}e();return}let y=typeof d=="string"?{kind:"string",value:d}:{kind:"binary",value:new Uint8Array(d)};c(y,w)});let l=()=>i?{kind:"receive-buffer-overflow"}:{kind:"closed"},u=()=>{if(!a)for(a=!0;s.length;)s.shift().reject(z(l()))};return t.addEventListener("close",u),t.addEventListener("error",u),{next(){if(r.length){let{message:f,size:d}=r.shift();return o-=d,Promise.resolve(f)}return i?Promise.reject(z({kind:"receive-buffer-overflow"})):a?Promise.reject(z({kind:"closed"})):new Promise((f,d)=>s.push({resolve:f,reject:d}))},rejectWaiters(f){for(;s.length;)s.shift().reject(z(f))},end:u,discard(){for(r.length=0,o=0,a=!0;s.length;)s.shift().reject(z({kind:"closed"}))}}}async function*bk(t){if(typeof ReadableStream<"u"&&t instanceof ReadableStream){let e=t.getReader();try{for(;;){let{value:n,done:r}=await e.read();if(r)break;yield n}}finally{e.releaseLock()}return}for await(let e of t)Array.isArray(e)?yield*e:yield e}function kk(t){return typeof t=="number"?Uint8Array.of(t):t instanceof Uint8Array?t:Uint8Array.from(t)}function xk(t){return new ReadableStream({start(e){t.length&&e.enqueue(t),e.close()}})}async function Ek(t,e){let n=[],r=0,s=0,o=c=>{if(c==null)return;let l=kk(c);if(!l.length)return;let u=e-r;if(l.length>u){if(s+=l.length-Math.max(u,0),u<=0)return;l=l.subarray(0,u)}n.push(l),r+=l.length};if(typeof ReadableStream<"u"&&t instanceof ReadableStream){let c=t.getReader();try{for(;;){let{value:l,done:u}=await c.read();if(u)break;o(l)}}finally{c.releaseLock()}}else if(t instanceof rt)for(;;){let c=await t.read(ak);if(c.length===0)break;o(c)}else for await(let c of t)o(c);let i=new Uint8Array(r),a=0;for(let c of n)i.set(c,a),a+=c.length;return{bytes:i,excess:s}}var vk="polymorph:websocket/connections@0.1.0",Tk={Websocket:zl};function zh(t){return t&&ck(t),{[vk]:Tk}}function ct(t){switch(t.kind){case"tuple":return{kind:"record",fields:t.elements.map((e,n)=>({label:String(n),type:e}))};case"enum":return{kind:"variant",cases:t.labels.map(e=>({label:e,type:null}))};case"option":return{kind:"variant",cases:[{label:"none",type:null},{label:"some",type:t.type}]};case"result":return{kind:"variant",cases:[{label:"ok",type:t.ok},{label:"error",type:t.error}]};case"map":return{kind:"list",element:ct({kind:"tuple",elements:[t.key,t.value]})};default:return t}}function at(t,e){if(t===e)return!0;if(t.kind!==e.kind)return!1;switch(t.kind){case"list":{let n=e;return t.length===n.length&&at(t.element,n.element)}case"record":{let n=e;return t.fields.length===n.fields.length&&t.fields.every((r,s)=>r.label===n.fields[s].label&&at(r.type,n.fields[s].type))}case"tuple":{let n=e;return t.elements.length===n.elements.length&&t.elements.every((r,s)=>at(r,n.elements[s]))}case"variant":{let n=e;return t.cases.length===n.cases.length&&t.cases.every((r,s)=>{let o=n.cases[s];return r.label!==o.label?!1:r.type===null||o.type===null?r.type===o.type:at(r.type,o.type)})}case"enum":case"flags":{let n=e;return t.labels.length===n.labels.length&&t.labels.every((r,s)=>r===n.labels[s])}case"option":{let n=e;return at(t.type,n.type)}case"result":{let n=e;return t.ok===null!=(n.ok===null)||t.error===null!=(n.error===null)?!1:(t.ok===null||at(t.ok,n.ok))&&(t.error===null||at(t.error,n.error))}case"map":{let n=e;return at(t.key,n.key)&&at(t.value,n.value)}case"own":case"borrow":{let n=e;return t.rt===n.rt}case"stream":case"future":{let n=e;return t.element===null!=(n.element===null)?!1:t.element===null||at(t.element,n.element)}case"error-context":return!0;default:return!0}}var Vr=class extends Error{constructor(e){super(e),this.name="PlanError"}};var Xn=class extends Error{constructor(e="canonical ABI trap"){super(e),this.name="Trap"}};function Jr(t){throw new Xn(t)}function Q(t,e){t&&Jr(e)}var aa=class extends Error{constructor(e="internal assertion failed"){super(e),this.name="AssertionError"}};function M(t,e){if(!t)throw new aa(e)}var J_=new DataView(new ArrayBuffer(8));var Jl=class t{static MAX_LENGTH=2**28-1;array=[null];free=[];get(e){return Q(e>=this.array.length,"table index out of range"),Q(this.array[e]===null,"table entry empty"),this.array[e]}add(e){let n;return this.free.length>0?(n=this.free.pop(),M(this.array[n]===null),this.array[n]=e):(n=this.array.length,Q(n>t.MAX_LENGTH,"table full"),this.array.push(e)),n}remove(e){let n=this.get(e);return this.array[e]=null,this.free.push(e),n}*[Symbol.iterator](){for(let e of this.array)e!==null&&(yield e)}};var Ik=2**32-1;var oD=(1<<28)-1;var iD=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),aD=new TextDecoder("utf-16le",{fatal:!0,ignoreBOM:!0}),cD=new TextEncoder;function Uk(){let t;try{t=Deno.env.get("DELTIC_SCHED_SEED")}catch{return null}if(t===void 0||t==="")return null;let e=Number(t);return Number.isFinite(e)?Math.trunc(e)>>>0:null}var TD=Uk();var Wk=[];var jk=[];function Kk(t,e){console.error(`[amb] ${t} ${Yn(e)} | stack=[${Wk.map(Yn).join(",")}] claims=[${jk.map(Yn).join(",")}] resuming=${Zn===null?"-":Yn(Zn)} +`)}`),this.#n=!0,this.#r.stopWaiting(this);try{this.#o(e)}finally{this.#i()}}#o(e){let n;try{n=this.produce(e)}catch(r){Mt()===void 0&&yr(this.owner),bs(this.task?.implicitThread??null),this.#t(r);return}Ma(),Mt()===void 0&&yr(this.owner),bs(this.task?.implicitThread??null),this.#e(n)}abandon(e){if(!this.#n){this.#n=!0,this.#r.stopWaiting(this);try{this.#t(e)}finally{this.#i()}}}#i(){if(!this.#s&&(this.#s=!0,this.onSettled!==void 0))try{this.onSettled()}catch(e){console.error(`[sp] onSettled threw for ${ve(this)}:`,e)}}};function qe(t){let e=Mt()??t.task?.implicitThread??null;return Ma(),Ba(e),new oc(t.store,t.task,t.readyFunc,t.cancellable,t.produce,e,t.onSettled).promise}function Lf(){return{liftedCalls:0,tasksResolved:0,postReturnsRun:0,loweredCalls:0,enterSyncCalls:0,exitSyncCalls:0,callbackInvocations:0}}var Ns=class{addrType="i32";#e;#t;#n=null;#s=new Uint8Array(0);#r=new DataView(new ArrayBuffer(0));constructor(e,n){this.#e=e,this.#t=n}#o(){let e=this.#e();if(e===void 0)throw new E(`${this.#t} accessed before its extract-memory initializer ran`);return e}#i(){let e=this.#o().buffer;e!==this.#n&&(this.#n=e,this.#s=new Uint8Array(e),this.#r=new DataView(e))}get bytes(){return this.#i(),this.#s}get view(){return this.#i(),this.#r}get length(){return this.#o().buffer.byteLength}ptrType(){return this.addrType}ptrSize(){return 4}},RT=new Ns(()=>{},"check");function cc(t,e){if(t===null)return null;let n=t();if(n===void 0)throw new E(`${e} accessed before its extract initializer ran`);return n}function nt(t){return{stringEncoding:t.stringEncoding,memory:t.memory,realloc:t.realloc===null?null:(e,n,r,s)=>{let o=cc(t.realloc,"realloc"),i=Pn(o,[e,n,r,s]);return h(i.length!==1||typeof i[0]!="number","realloc result"),i[0]>>>0},postReturn:null,async_:t.async,callback:t.callback===null?null:t.callback}}function Pn(t,e){let n;try{n=t(...e)}catch(r){throw Nf(r)}return n===void 0?[]:Array.isArray(n)?n:[n]}function Nf(t){if(t instanceof WebAssembly.RuntimeError)try{pe(`guest trapped: ${t.message}`)}catch(e){return e}return t}function jt(t,e,n){if(t.length!==e.length)throw new ur(`${n}: expected ${e.length} core values, got ${t.length}`);return t.map((r,s)=>{switch(e[s]){case"i32":return p(typeof r=="number",`${n}[${s}]: i32 lane`),r>>>0;case"i64":return p(typeof r=="bigint",`${n}[${s}]: i64 lane`),BigInt.asUintN(64,r);case"f32":case"f64":return p(typeof r=="number",`${n}[${s}]: float lane`),r}})}function rw(t){if(t.length!==0)return t.length===1?t[0]:t}function Of(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"}var sw=(()=>{try{return Deno.env.get("DELTIC_DRIVE_TRACE")==="1"}catch{return!1}})(),ow=0;function iw(t){let e=t,n=e?.constructor?.name??"?",r="?";try{r=e.ready?.()?"READY":e.readyFunc===null?"explicit":"not-ready"}catch(s){r=`threw:${s}`}return`${n}[${r}]`}function Ge(t,e,n,r){if(!sw)return;let s="?";try{s=String(n())}catch(a){s=`threw:${a}`}let o=e.waiting.map(iw).join(","),i=[...e.awaiting].map(a=>`${a?.constructor?.name??"?"}`).join(",");console.error(`[drive #${ow++}] ${t} branch=${r} ready=${e.readyCandidates().length} waiting=${e.waiting.length}{${o}} awaiting=${e.awaiting.size} hostCalls=${e.pendingHostCalls.size} awaiters={${i}} claim=${En()} done=${s}`)}function aw(t,e,n){for(;;){for(Ge("drive",t,e,"top");t.awaiting.size===0&&t.tick();)if(Ge("drive",t,e,"ticked"),t.hostFailure!==void 0)throw Ls(t);if(t.hostFailure!==void 0)throw Ls(t);if(e()){Ge("drive",t,e,"EXIT-done"),hc(t);return}return t.awaiting.size>0||En()?(Ge("drive",t,e,"->async(awaiting/claim)"),fc(t,e,n)):(t.pendingHostCalls.size===0&&(Ge("drive",t,e,"DEADLOCK-TRAP"),h(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: no thread is ready and no host call is outstanding)`)),Ge("drive",t,e,"->async(hostcalls)"),fc(t,e,n))}}var Rf=new WeakMap;function ac(t){let e=t.awaiting,n=Rf.get(e);return n===void 0&&(n=e.then(r=>({t,p:e,value:r,failure:void 0}),r=>({t,p:e,value:void 0,failure:{error:r}})),Rf.set(e,n)),n}async function dc(t,e,n){return await fc(t,e,n)}var lc=new WeakMap,ci=new WeakMap;function It(t){return lc.get(t)??0}function pc(t){if(It(t)===0)return Promise.resolve();let e=ci.get(t);if(e===void 0){let n;e={p:new Promise(s=>n=s),r:n},ci.set(t,e)}return e.p}var uc=new WeakSet,li=new WeakMap;function cw(t){let e=li.get(t);if(e===void 0){let n;e={p:new Promise(s=>n=s),r:n},li.set(t,e)}return e.p}function lw(t){let e=li.get(t);e!==void 0&&(li.delete(t),e.r())}function hc(t){if(uc.has(t)){lw(t);return}t.hostFailure===void 0&&Mo(t)&&(uc.add(t),uw(t))}async function uw(t){let e=!1;try{for(;;){for(;It(t)>0;)await pc(t);if(t.hostFailure!==void 0)return;let n=Yu(t);if(n.length===0)return;let r=cw(t);await Promise.race([...n.map(s=>s.then(()=>{},()=>{})),r]),!(It(t)>0)&&await dc(t,()=>t.pendingHostCalls.size===0||gr(t)||It(t)>1,"settlement pump")}}catch(n){e=!0,t.hostFailure??=n}finally{uc.delete(t),!e&&t.hostFailure===void 0&&It(t)===0&&Mo(t)&&hc(t)}}async function fc(t,e,n){lc.set(t,It(t)+1);try{let r=0;for(;;){if(Ge("driveAsync",t,e,"top"),t.serviceSettled(),t.hostFailure!==void 0)throw Ls(t);if(En()){Ge("driveAsync",t,e,"yield-claim"),r++,p(r<1e4,"driveAsync: a resumed-activation claim was never released (the activation neither parked, finished, nor trapped)"),r%100===0?await new Promise(s=>setTimeout(s,0)):await Promise.resolve();continue}for(r=0;t.tick();){if(t.hostFailure!==void 0)throw Ls(t);if(t.awaiting.size>0&&(await Promise.resolve(),t.settled.length>0))break}if(t.hostFailure!==void 0)throw Ls(t);if(e()){Ge("driveAsync",t,e,"EXIT-done");return}if(!(t.settled.length>0||En())){if(t.awaiting.size>0){if(t.pendingHostCalls.size===0&&!En()){Ge("driveAsync",t,e,"deadlock-probe");let l=[...t.awaiting],u=await Promise.race([...l.map(f=>ac(f).then(()=>!0)),new Promise(f=>setTimeout(()=>f(!1),0))]);if(Ge("driveAsync",t,e,`deadlock-probe:progressed=${u}`),!u){let f=[...t.awaiting];if(f.length!==l.length||f.some((w,y)=>w!==l[y])||t.pendingHostCalls.size>0||En())continue;t.readyCandidates().length===0&&h(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: every suspended activation is waiting on a suspension only this scheduler could resume, and none is ready)`);continue}}if(t.awaiting.size===0)continue;let s=[...t.awaiting],o=s[0],i=ac(o),a=s.slice(1).map(ac);for(let l of t.pendingHostCalls)a.push(l.then(()=>null,()=>null));bs(o);let c;try{c=await Promise.race([i,...a])}finally{Vu()}c!==null&&t.awaiting.has(c.t)&&c.t.awaiting===c.p&&c.t.resumeWith(c.value,c.failure);continue}t.pendingHostCalls.size===0&&(Ge("driveAsync",t,e,"DEADLOCK-TRAP"),h(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: no thread is ready and no host call is outstanding)`)),Ge("driveAsync",t,e,"await-race"),await Promise.race([...t.pendingHostCalls]).catch(()=>{})}}}finally{let r=It(t)-1;if(lc.set(t,r),r===0){let s=ci.get(t);ci.delete(t),s?.r(),hc(t)}}}function Ls(t){let e=t.hostFailure;return t.hostFailure=void 0,e}var ui=Symbol("deltic.constructorSyncEntry");function mc(t){let{name:e,ft:n,opts:r,core:s,stats:o,trapState:i,syncCallStack:a,allInstances:c}=t,l=r.instance,u=l.store,f=t.suspensionMode??"plain",d=nn(s,f),w={async_:r.async,callback:r.callback!==null,stringEncoding:r.stringEncoding,memory:r.memory};if(r.callback!==null&&!r.async)throw new E(`export '${e}': canonical options carry a callback but are not async (callback is meaningless for a sync lift)`);let y=Qa(nt(r),n,"lift");if(!$a(y,r.coreType))throw new E(`export '${e}': computed flat type ${JSON.stringify(y)} != plan coreType ${JSON.stringify(r.coreType)}`);let x=v=>{o.liftedCalls++,i!==void 0&&(i.pending=void 0);let b=a?.length??0;l.mayEnterFrom(null)||pe(Bt(l,`cannot enter component instance ${l.index} (reentrance forbidden)`));let m=l.enteringSet(null);l.enterFrom(null);let g=!0,k=!1,T=null,S=!1,$=new vr(n,w,l,()=>v,O=>{T=O,S=!0,o.tasksResolved++}),N=new Rn($,pw({name:e,ft:n,opts:r,core:d,stats:o,task:$,thread:()=>N,mode:f})),_=()=>{if(k=!0,h(!S,`${e}: task finished without resolving (deadlock)`),T===null)throw new ur(`${e}: task resolved as cancelled, but the host never requested cancellation`);return rw(T)},R=()=>{if(!k){for(let O of $.threads)for(;O.syncCallStack.length>0;)O.syncCallStack.pop().releaseLenders();for(let O of c?.()??[])m.has(O)||(O.mayLeave=!0)}},P=()=>{g&&(g=!1,l.leaveTo(null))},z=O=>{g=!1,l.releaseSyntheticRootOnPoison();for(let ye of m)ye.isSyntheticRoot||Ft(ye,O)},xt=O=>O instanceof Ve||O instanceof Be;try{N.resume(),!n.async&&f!=="jspi"&&Zu($)}catch(O){throw R(),xt(O)?P():z(O),O}P();let gn;try{let O=()=>$.threads.some(ye=>u.awaiting.has(ye));gn=aw(u,()=>S&&!O(),`export '${e}'`)}catch(O){throw R(),O}if(gn===void 0)try{return _()}catch(O){throw R(),O}return gn.then(_,O=>{throw R(),O})};return(...v)=>{if(v.length!==n.params.length)throw new TypeError(`${e}: expected ${n.params.length} argument(s), got ${v.length}`);return f==="jspi"&&_f(u,l).length>0?fw(u,l).then(()=>x(v)):x(v)}}function _f(t,e){if(t.awaiting.size===0)return[];let n=new Set;for(let s of t.waiting){let o=s.owner;o!=null&&n.add(o)}let r=[];for(let s of t.awaiting){let o=s;o.task.inst===e&&!n.has(s)&&r.push(o)}return r}async function fw(t,e){for(;;){let n=_f(t,e);if(n.length===0)return;await Promise.race(n.map(r=>(r.awaiting??Promise.resolve()).then(()=>{},()=>{}))),t.serviceSettled()}}function*Tr(t,e,n){let r=Fo(n,()=>Pn(t,e));if(r.length===1&&Of(r[0])){let s=yield{readyFunc:null,cancellable:!1,awaitValue:Promise.resolve(r[0]).then(void 0,o=>{throw Nf(o)})};return s===void 0?[]:Array.isArray(s)?s:[s]}return r}var ai=function(t){return t[t.EXIT=0]="EXIT",t[t.YIELD=1]="YIELD",t[t.WAIT=2]="WAIT",t}(ai||{}),dw=2;function Pf(t){let e=t&15;return h(e>dw,`invalid callback code ${e}`),[e,t>>>4]}function*pw(t){let{name:e,ft:n,opts:r,core:s,stats:o,task:i}=t,a=t.thread(),c=r.instance;if(!(yield*i.enterImplicitThread(a)))return;let l=new ze(nt(r),c,i),u=i.start(),f=nc(l,In,u,n.params);if(!r.async){let y=jt(yield*Tr(s,f,a),r.coreType.results,`${e} results`),x=Rs(l,Er,new Cn(y),n.results);i.return_(x);let v=cc(r.postReturn,`${e} post-return`);v!==null&&(p(c.mayLeave,"post-return with may_leave already false"),c.mayLeave=!1,Pn(v,y),c.mayLeave=!0,o.postReturnsRun++),i.exitImplicitThread(a);return}if(r.callback===null){t.mode!=="jspi"&&Je(`stackful async lift of export '${e}' (async canonical options without a callback)`),yield*Tr(s,f,a),i.exitImplicitThread(a);return}let d=nn(cc(r.callback,`${e} callback`),t.mode),[w]=jt(yield*Tr(s,f,a),r.coreType.results,`${e} results`);yield*yc({name:e,task:i,thread:a,inst:c,callback:d,packed:w,stats:o}),i.exitImplicitThread(a)}function Df(t){let{name:e,ft:n,opts:r,hostFn:s,stats:o,mode:i,suspendable:a}=t,c=r.instance,l=c.store,u=Qa(nt(r),n,"lower");if(!$a(u,r.coreType))throw new E(`import '${e}': computed flat type ${JSON.stringify(u)} != plan coreType ${JSON.stringify(r.coreType)}`);let f=r.async?Za:In,d=r.async?0:Er;return(...w)=>{o.loweredCalls++,h(!c.mayLeave,`cannot leave component instance ${c.index} (may_leave violation)`);let y=new $t,x=new ze(nt(r),c,y),v=new Cn(jt(w,r.coreType.params,`${e} args`)),b=()=>{},m=()=>(b(),p(y.state===ne.STARTING,`${e}: on_start on a started subtask`),y.state=ne.STARTED,Rs(x,f,v,n.params)),g=N=>{if(b(),N===null){p(y.cancellationRequested,`${e}: resolved as cancelled without a cancellation request`),y.resolve(y.state===ne.STARTING?ne.CANCELLED_BEFORE_STARTED:ne.CANCELLED_BEFORE_RETURNED,[]);return}p(y.state===ne.STARTED,`${e}: on_resolve on a subtask that never started`);let _=nc(x,d,N,n.results,v);y.resolve(ne.RETURNED,_)};y.onCancel=()=>{};let k=m(),T=s(...k),S=N=>n.results.length===0?[]:[N];if(Of(T)){if(!r.async){(i!=="jspi"||!a)&&(y.unwindLenders(),Je(a?`synchronous lower of import '${e}', whose host implementation returned a Promise (the guest's wasm frame must block)`:`synchronous lower of import '${e}', whose host implementation returned a Promise; a sync-typed import may only park the frame when declared with suspending() (contracts/embedder-api.md \xA7"Functions and async")`));let _,R=Promise.resolve(T).then(P=>{l.pendingHostCalls.delete(R),_={value:P}},P=>{l.pendingHostCalls.delete(R),_={error:P}});return l.pendingHostCalls.add(R),qe({store:l,task:_e(),readyFunc:()=>_!==void 0,cancellable:!1,produce:()=>{let P=_;if("error"in P)throw P.error;g(S(P.value)),y.deliverResolve(),p(v.done(),`${e}: unconsumed flat arguments`);let z=y.flatResults;if(z.length!==0)return z.length===1?z[0]:z},onSettled:()=>y.unwindLenders()})}let N=Promise.resolve(T).then(_=>{l.pendingHostCalls.delete(N);try{g(S(_))}catch(R){l.hostFailure=R}},_=>{l.pendingHostCalls.delete(N),l.hostFailure=_});l.pendingHostCalls.add(N)}else g(S(T));if(p(n.async||y.resolved(),`${e}: a non-async-typed import must resolve before returning`),!r.async){y.resolved()||Je(`synchronous lower of import '${e}' on an unresolved subtask`),y.deliverResolve(),p(v.done(),`${e}: unconsumed flat arguments`);let N=y.flatResults;return N.length===0?void 0:N.length===1?N[0]:N}if(y.resolved())return y.deliverResolve(),p(y.flatResults.length===0,`${e}: async lower produced flat results`),ne.RETURNED;let $=c.handles.add(y);return b=()=>y.setSubtaskPendingEvent($),ri(y.state,$)}}function*yc(t){let{name:e,task:n,thread:r,inst:s,callback:o,stats:i}=t,[a,c]=Pf(t.packed);for(;a!==ai.EXIT;){p(n.needsExclusive()&&s.exclusiveThread===n.implicitThread,"callback loop without holding the exclusive thread"),s.exclusiveThread=null;let l;switch(a){case ai.YIELD:{l=(yield*r.waitUntil(()=>s.exclusiveThread===null,!0))?[te.TASK_CANCELLED,0,0]:[te.NONE,0,0];break}case ai.WAIT:{let f=s.handles.get(c);h(!(f instanceof Wt),`callback returned WAIT with index ${c}, which is not a waitable set`),l=yield*f.waitForEventAnd(r,()=>s.exclusiveThread===null,!0);break}default:pe(`invalid callback code ${a}`)}p(s.exclusiveThread===null,"exclusive thread taken while this task was waiting"),s.exclusiveThread=n.implicitThread,i.callbackInvocations++;let[u]=jt(yield*Tr(o,[l[0],l[1],l[2]],r),["i32"],`${e} callback result`);[a,c]=Pf(u)}}var Kt=class extends Error{milestone;constructor(e,n){super(`${n} \u2014 scheduled for ${e}, not implemented in the current executor (contracts/intrinsics.md \xA7B)`),this.milestone=e,this.name="UnsupportedFeatureError"}};var hw=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();function Xe(t){hw&&console.error(`[copy] ${t}`)}function Bf(t,e,n){return()=>{h(!n.mayLeave,"stream.new: cannot leave component instance");let r=new St(e.streamElem(t.streamTable)),s=n.handles.add(new pt(r)),o=n.handles.add(new $n(r));return Uf(s,o)}}function Mf(t,e,n){return()=>{h(!n.mayLeave,"future.new: cannot leave component instance");let r=new dt(e.futureElem(t.futureTable)),s=n.handles.add(new ht(r)),o=n.handles.add(new tn(r));return Uf(s,o)}}function Uf(t,e){return BigInt(t>>>0)|BigInt(e>>>0)<<32n}function Wf(t){let{EndT:e,reading:n,eventCode:r,elem:s,opts:o,inst:i,i:a,ptr:c,n:l}=t,u=t.mode??"plain";h(!i.mayLeave,"stream copy: cannot leave component instance");let f=i.handles.get(a);h(!(f instanceof e),"stream copy: wrong end type for this handle");let d=f;h(!Ue(d.shared.t,s),"stream copy: element type mismatch"),h(d.state===le.DONE,n?"cannot read from stream after being notified that the writable end dropped":"cannot write to stream after being notified that the readable end dropped"),h(d.state!==le.IDLE,"cannot have concurrent operations active on a future/stream"),h(d.inWaitableSet()&&!o.async,"synchronous stream copy on an end that is in a waitable set");let w=new ze(nt(o),i,null),y=new Es(s,w,c,l),x=(m,g)=>(g(),p(d.copying(),"stream event on a non-copying end"),d.state=m===D.DROPPED?le.DONE:le.IDLE,p(y.progress<=xr,"stream progress out of packing range"),[r,a,(m|y.progress<<4)>>>0]);d.state=le.COPYING;let v=m=>d.setPendingEvent(()=>x(D.COMPLETED,m)),b=m=>d.setPendingEvent(()=>x(m,()=>{}));return d.copy(i,y,v,b),Kf(d,r,a,o.async,"stream",i,u)}function jf(t){let{EndT:e,reading:n,eventCode:r,elem:s,opts:o,inst:i,i:a,ptr:c}=t,l=t.mode??"plain";h(!i.mayLeave,"future copy: cannot leave component instance");let u=i.handles.get(a);h(!(u instanceof e),"future copy: wrong end type for this handle");let f=u;h(!Ue(f.shared.t,s),"future copy: element type mismatch"),h(f.state===le.DONE,n?"cannot read from future after previous read succeeded":"cannot write to future after previous write succeeded or readable end dropped"),h(f.state!==le.IDLE,"cannot have concurrent operations active on a future/stream"),h(f.inWaitableSet()&&!o.async,"synchronous future copy on an end that is in a waitable set");let d=new ze(nt(o),i,null),w=new Es(s,d,c,1),y=v=>(p(w.remain()===0==(v===D.COMPLETED),"future event/progress disagreement"),p(f.copying(),"future event on a non-copying end"),f.state=v===D.DROPPED||v===D.COMPLETED?le.DONE:le.IDLE,[r,a,v]);f.state=le.COPYING;let x=v=>{let b=n&&v===D.DROPPED?mf(f.shared):null;if(b!==null){f.setPendingEvent(()=>{throw Ja(b)});return}p(v!==D.DROPPED||r===te.FUTURE_WRITE,"a readable future end cannot observe DROPPED"),f.setPendingEvent(()=>y(v))};return f.copy(i,w,x),Kf(f,r,a,o.async,"future",i,l)}function Kf(t,e,n,r,s,o,i="plain"){let a=()=>{let[l,u,f]=t.getPendingEvent();return p(l===e&&u===n,`unexpected event delivered by a ${s} copy`),f};if(!t.hasPendingEvent()){if(!r){if(i==="jspi"&&o!==void 0)return t.hasSyncWaiter=!0,Xe(`${s} sync copy i=${n} BLOCKS`),qe({store:o.store,task:_e(),readyFunc:()=>t.hasPendingEvent(),cancellable:!1,produce:()=>{t.hasSyncWaiter=!1;let l=a();return Xe(`${s} sync copy i=${n} RESUME -> 0x${l.toString(16)}`),l},onSettled:()=>{t.hasSyncWaiter=!1}});Je(`synchronous ${s} copy with no counterpart ready (the calling wasm frame must block until the other end arrives)`)}return Xe(`${s} async copy i=${n} -> BLOCKED`),Sr}let c=a();return Xe(`${s} copy(async=${r}) i=${n} -> 0x${c.toString(16)}`),c}function Ff(t,e,n,r){let[s,o,i]=t.getPendingEvent();if(p(!t.copying()&&s===e&&o===n,`unexpected event delivered by ${r}`),(e===te.STREAM_READ||e===te.STREAM_WRITE)&&(i&15)===D.COMPLETED){let c=(i&-16|D.CANCELLED)>>>0;return Xe(`${r} i=${n} -> 0x${c.toString(16)} (superseded COMPLETED)`),c}return Xe(`${r} i=${n} -> 0x${i.toString(16)}`),i}function fi(t){let{EndT:e,eventCode:n,elem:r,inst:s,async_:o,i,what:a}=t,c=t.mode??"plain";h(!s.mayLeave,`${a}: cannot leave component instance`);let l=s.handles.get(i);h(!(l instanceof e),`${a}: wrong end type for this handle`);let u=l;if(h(!Ue(u.shared.t,r),`${a}: element type mismatch`),h(u.state!==le.COPYING||u.hasSyncWaiter,`${a}: end is not in a cancellable copy`),h(u.inWaitableSet()&&!o,`${a}: synchronous cancel on an end that is in a waitable set`),u.state=le.CANCELLING_COPY,!u.hasPendingEvent()&&(u.shared.cancel(),!u.hasPendingEvent())){if(!o){if(c==="jspi")return qe({store:s.store,task:_e(),readyFunc:()=>u.hasPendingEvent(),cancellable:!1,produce:()=>Ff(u,n,i,a)});Je(`synchronous ${a} whose copy did not settle immediately (the calling wasm frame must block)`)}return Sr}return Ff(u,n,i,a)}function di(t,e,n,r,s){h(!n.mayLeave,`${s}: cannot leave component instance`);let o=n.handles.remove(r);h(!(o instanceof t),`${s}: wrong end type for this handle`);let i=o;h(!Ue(i.shared.t,e),`${s}: element type mismatch`),i.drop()}function Hf(t,e,n){let r=e.options(t.options);return(s,o)=>{h(!n.mayLeave,"error-context.new: cannot leave component instance");let i=new ze(nt(r),n,null),a=xs(i,s??0,o??0);return n.handles.add(new tt(a))}}function zf(t,e,n){let r=e.options(t.options);return(s,o)=>{h(!n.mayLeave,"error-context.debug-message: cannot leave component instance");let i=n.handles.get(s??0);h(!(i instanceof tt),Ts("error-context.debug-message",i));let a=new ze(nt(r),n,null);zo(a,i.debugMessage,o??0)}}function Vf(t){return e=>{h(!t.mayLeave,"error-context.drop: cannot leave component instance");let n=t.handles.remove(e??0);h(!(n instanceof tt),Ts("error-context.drop",n))}}function Jf(t,e,n){let r=e.options(t.options),s=e.streamElem(t.streamTable);return(o,i,a)=>Wf({mode:e.suspensionMode??"plain",EndT:pt,reading:!0,eventCode:te.STREAM_READ,elem:s,opts:r,inst:n,i:o??0,ptr:i??0,n:a??0})}function qf(t,e,n){let r=e.options(t.options),s=e.streamElem(t.streamTable);return(o,i,a)=>Wf({mode:e.suspensionMode??"plain",EndT:$n,reading:!1,eventCode:te.STREAM_WRITE,elem:s,opts:r,inst:n,i:o??0,ptr:i??0,n:a??0})}function Gf(t,e,n){let r=e.options(t.options),s=e.futureElem(t.futureTable);return(o,i)=>jf({mode:e.suspensionMode??"plain",EndT:ht,reading:!0,eventCode:te.FUTURE_READ,elem:s,opts:r,inst:n,i:o??0,ptr:i??0})}function Xf(t,e,n){let r=e.options(t.options),s=e.futureElem(t.futureTable);return(o,i)=>jf({mode:e.suspensionMode??"plain",EndT:tn,reading:!1,eventCode:te.FUTURE_WRITE,elem:s,opts:r,inst:n,i:o??0,ptr:i??0})}function Yf(t,e,n){let r=e.streamElem(t.streamTable);return s=>fi({mode:e.suspensionMode??"plain",EndT:pt,eventCode:te.STREAM_READ,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"stream.cancel-read"})}function Zf(t,e,n){let r=e.streamElem(t.streamTable);return s=>fi({mode:e.suspensionMode??"plain",EndT:$n,eventCode:te.STREAM_WRITE,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"stream.cancel-write"})}function Qf(t,e,n){let r=e.futureElem(t.futureTable);return s=>fi({mode:e.suspensionMode??"plain",EndT:ht,eventCode:te.FUTURE_READ,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"future.cancel-read"})}function ed(t,e,n){let r=e.futureElem(t.futureTable);return s=>fi({mode:e.suspensionMode??"plain",EndT:tn,eventCode:te.FUTURE_WRITE,elem:r,inst:n,async_:t.async===!0,i:s??0,what:"future.cancel-write"})}function td(t,e,n){let r=e.streamElem(t.streamTable);return s=>di(pt,r,n,s??0,"stream.drop-readable")}function nd(t,e,n){let r=e.streamElem(t.streamTable);return s=>di($n,r,n,s??0,"stream.drop-writable")}function rd(t,e,n){let r=e.futureElem(t.futureTable);return s=>di(ht,r,n,s??0,"future.drop-readable")}function sd(t,e,n){let r=e.futureElem(t.futureTable);return s=>di(tn,r,n,s??0,"future.drop-writable")}function od(t){let{EndT:e,srcInst:n,dstInst:r,srcElem:s,dstElem:o,srcIdx:i,what:a}=t,c=n.handles.remove(i);h(!(c instanceof e),`${a}: handle is not a readable ${a} end`);let l=c;h(!Ue(l.shared.t,s),`${a}: source element mismatch`),h(!Ue(l.shared.t,o),`${a}: destination element mismatch`),h(l.state===le.DONE,a==="future"?"cannot lift future after previous read succeeded":"cannot lift stream after being notified that the writable end dropped"),h(l.state!==le.IDLE,`cannot remove busy ${a}`),h(l.inWaitableSet(),`cannot lift ${a} while it's in a waitable set`);let u=e;return r.handles.add(new u(l.shared))}function id(t){return(e,n,r)=>od({EndT:pt,srcInst:t.streamTableInstance(n??0),dstInst:t.streamTableInstance(r??0),srcElem:t.streamElem(n??0),dstElem:t.streamElem(r??0),srcIdx:e??0,what:"stream"})}function ad(t){return(e,n,r)=>od({EndT:ht,srcInst:t.futureTableInstance(n??0),dstInst:t.futureTableInstance(r??0),srcElem:t.futureElem(n??0),dstElem:t.futureElem(r??0),srcIdx:e??0,what:"future"})}function cd(t,e){return(n,r,s)=>{p(typeof n=="number"&&typeof r=="number"&&typeof s=="number","error-context transfer: expected (handle, srcTable, dstTable)");let o=e(r),i=e(s),a=o.handles.get(n);return h(!(a instanceof tt),Ts("error-context transfer",a)),i.handles.add(a)}}var Sr=4294967295;function ld(t,e){let n=e.options(t.options),r=t.resultType===null?[]:e.resultTypes(t.resultType);return(...s)=>{let o=_e();h(!o.inst.mayLeave,"task.return: cannot leave component instance (may_leave violation)"),h(!o.opts.async_,"task.return from a non-async task"),h((!o.factPassthrough||o.factResultTypesKnown)&&!Au(r,o.ft.results),"task.return with a result type that is not the task's result type"),h(!Ef({stringEncoding:n.stringEncoding,memory:n.memory},o.factPassthrough?{stringEncoding:o.opts.stringEncoding,memory:n.memory}:o.opts),"task.return with canonical options differing from the task's");let i=jt(s,n.coreType.params,"task.return arguments");if(o.factPassthrough){o.return_(i);return}let a=new ze(nt(n),o.inst,o),c=new Cn(i),l=Rs(a,In,c,o.ft.results);o.return_(l)}}function ud(){return()=>{let t=_e();h(!t.inst.mayLeave,"task.cancel: cannot leave component instance (may_leave violation)"),h(!t.opts.async_,"task.cancel from a non-async task"),t.cancel()}}function fd(t){return()=>{p(t.backpressure>=0&&t.backpressure<2**16,"backpressure counter out of range"),t.backpressure+=1,h(t.backpressure===2**16,"backpressure counter overflow")}}function dd(t){return()=>{p(t.backpressure>=0&&t.backpressure<2**16,"backpressure counter out of range"),t.backpressure-=1,h(t.backpressure<0,"backpressure counter underflow")}}function pd(t){return()=>(h(!t.mayLeave,"waitable-set.new: cannot leave component instance"),t.handles.add(new Wt))}function hd(t,e,n,r="plain"){let s=e.options(t.options),o=s.cancellable;return(i,a)=>{h(!n.mayLeave,"waitable-set.wait: cannot leave component instance");let c=gc(n,i??0,"waitable-set.wait"),l=_e(),u;if(l.deliverPendingCancel(o))u=[te.TASK_CANCELLED,0,0];else if(c.hasPendingEvent())Xe(`waitable-set.wait si=${i} FAST (pending event)`),u=c.getPendingEvent();else{if(r==="jspi")return Xe(`waitable-set.wait si=${i} BLOCKS`),c.numWaiting+=1,qe({store:n.store,task:l,readyFunc:()=>c.hasPendingEvent(),cancellable:o,produce:f=>{let d=f?[te.TASK_CANCELLED,0,0]:c.getPendingEvent();return wc(s,n,a??0,d)},onSettled:()=>{c.numWaiting-=1}});Je("waitable-set.wait with no pending event (the calling wasm frame must block; a callback-ABI guest should return the WAIT code instead)")}return wc(s,n,a??0,u)}}function md(t,e,n){let r=e.options(t.options),s=r.cancellable;return(o,i)=>{h(!n.mayLeave,"waitable-set.poll: cannot leave component instance");let c=gc(n,o??0,"waitable-set.poll").poll(_e(),s);return wc(r,n,i??0,c)}}function yd(t){return e=>{h(!t.mayLeave,"waitable-set.drop: cannot leave component instance");let n=t.handles.remove(e??0);h(!(n instanceof Wt),"waitable-set.drop: handle is not a waitable set"),n.drop()}}function wd(t){return(e,n)=>{h(!t.mayLeave,"waitable.join: cannot leave component instance");let r=t.handles.get(e??0);if(h(!(r instanceof Ut),"waitable.join: handle is not a waitable"),h(r.hasSyncWaiter,"waitable.join on a waitable with a synchronous waiter"),(n??0)===0){r.join(null);return}let s=gc(t,n,"waitable.join");r.join(s)}}function gd(t){return e=>{h(!t.mayLeave,"subtask.drop: cannot leave component instance");let n=t.handles.remove(e??0);h(!(n instanceof $t),"subtask.drop: handle is not a subtask"),n.drop()}}function mw(t,e){return()=>{let[n,r,s]=e.getPendingEvent();return p(n===te.SUBTASK&&r===(t??0)&&s===e.state,"unexpected event delivered by subtask.cancel"),p(e.resolveDelivered(),"subtask.cancel did not deliver the resolution"),e.state}}function bd(t,e,n="plain"){let r=t.async===!0;return s=>{h(!e.mayLeave,"subtask.cancel: cannot leave component instance");let o=e.handles.get(s??0);h(!(o instanceof $t),"subtask.cancel: handle is not a subtask");let i=o,a=mw(s,i);if(h(i.resolveDelivered(),"subtask.cancel on a subtask whose resolution was already delivered"),h(i.cancellationRequested,"subtask.cancel on a subtask that was already cancelled"),h(i.inWaitableSet()&&!r,"synchronous subtask.cancel on a subtask that is in a waitable set"),i.resolved())p(i.hasPendingEvent(),"resolved subtask without a pending event at cancellation");else if(i.cancellationRequested=!0,p(i.onCancel!==null,"subtask.cancel on a subtask with no cancellation handler"),i.onCancel(e),!i.resolved()){if(!r){if(n==="jspi")return i.hasSyncWaiter=!0,qe({store:e.store,task:_e(),readyFunc:()=>i.hasPendingEvent(),cancellable:!1,produce:()=>(i.hasSyncWaiter=!1,a()),onSettled:()=>{i.hasSyncWaiter=!1}});Je("synchronous subtask.cancel whose callee did not resolve immediately (the calling wasm frame must block)")}if(n==="jspi"&&i.calleeTask!==null){let c=i.calleeTask,l=e.store,u=()=>i.resolved()||c.threads.every(f=>f.done())||l.waiting.some(f=>f.task===i.calleeTask);return u()?i.resolved()?a():Sr:qe({store:e.store,task:_e(),readyFunc:u,cancellable:!1,produce:()=>i.resolved()?a():Sr})}return Sr}return a()}}function kd(t,e="plain"){let n=t.cancellable===!0;return()=>{let r=wr();if(h(!r.task.inst.mayLeave,"thread.yield: cannot leave component instance"),r.task.deliverPendingCancel(n))return 1;if(e==="jspi")return qe({store:r.task.inst.store,task:r.task,readyFunc:()=>!0,cancellable:n,produce:s=>s?1:0});Je("thread.yield (the calling wasm frame must block; a callback-ABI guest should return the YIELD code instead)")}}function gc(t,e,n){let r=t.handles.get(e);return h(!(r instanceof Wt),`${n}: handle ${e} is not a waitable set`),r}function wc(t,e,n,r){let[s,o,i]=r,a=new ze(nt(t),e,null);return en(a,o,{kind:"u32"},n),en(a,i,{kind:"u32"},n+4),s}var yw=4294967295,ww=4294967294,gw=1,bc=8;function bw(t,e,n,r){return{async_:r,callback:e!==null,stringEncoding:kw(t.stringEncoding),memory:n}}function kw(t){switch(t){case 0:return"utf8";case 1:return"utf16";case 2:return"latin1+utf16";default:return"utf8"}}function vd(t,e){return(...n)=>{p(n.length>=bc,`prepare-call: expected at least ${bc} arguments`);let[r,s,o,i,a,c,l,u]=n;p(typeof r=="function"&&typeof s=="function","prepare-call: start/return must be funcrefs"),p(e.prepared.current===null,"prepare-call with a preparation already outstanding");let f=n.slice(bc),d=Number(u)>>>0,w=()=>(p(f.length>0,"prepare-call: retptr missing"),f[f.length-1]),y,x=!1;d===ww?(y={kind:"heap",retptr:w()},x=!0):d===yw?y={kind:"stack"}:d>Er?y={kind:"heap",retptr:w()}:y={kind:"stack"},e.prepared.current={start:r,return_:s,callerInst:e.componentInstance(Number(o)>>>0),calleeInst:e.componentInstance(Number(i)>>>0),taskReturnType:Number(a)>>>0,calleeAsync:Number(c)!==0,stringEncoding:Number(l)>>>0,resultCountOrMax:d,params:f,memory:t.memory===null?null:e.memoryToken(t.memory),resultInfo:y,asyncCallerWithResult:x}}}function Td(t){let{prepared:e,callee:n,callback:r,postReturn:s,ctx:o,calleeUsesAsyncAbi:i}=t,a=t.mode??"plain",c=t.canBlock??!1,l=e.memory,u=e.calleeInst,f=o.resultTypesForTuple(e.taskReturnType),d={params:[],results:f??[],async:e.calleeAsync},w=new vr(d,bw(e,r,l,i),u,()=>{o.factStartScopes.push({taskScope:w,lenders:t.lenderScope});let x;try{x=Pn(e.start,e.asyncCallerWithResult?e.params.slice(0,-1):e.params)}finally{o.factStartScopes.pop()}return t.onStarted?.(),x},x=>{if(x===null){t.onCallerResults(null);return}let v=x,b=e.resultInfo.kind==="heap"?[...v,e.resultInfo.retptr]:v;t.onCallerResults(Pn(e.return_,b))});return w.factPassthrough=!0,w.factResultTypesKnown=f!==null,{task:w,body:function*(x){if(!(yield*w.enterImplicitThread(x)))return;let v=w.start();Xe(`mkCalleeTask callee canBlock=${c} mode=${a}`);let b=yield*Tr(c?nn(n,a):n,v,x);if(!i){w.return_(b),s!==null&&(p(u.mayLeave,"post-return with may_leave already false"),u.mayLeave=!1,Pn(s,b),u.mayLeave=!0,o.stats.postReturnsRun++),w.exitImplicitThread(x);return}if(r===null){jt(b,[],"stackful callee result"),w.exitImplicitThread(x);return}let[m]=jt(b,["i32"],"callee result");yield*yc({name:"fact-callee",task:w,thread:x,inst:u,callback:c?nn(r,a):r,packed:m,stats:o.stats}),w.exitImplicitThread(x)}}}function Sd(t,e){let n=t.prepared.current;return p(n!==null,`${e} without a preceding prepare-call`),t.prepared.current=null,n}function $d(t,e){return(n,r)=>{let s=Sd(e,"sync-start-call");p(typeof n=="function","sync-start-call: callee funcref");let o=t.callback===null?null:e.callback(t.callback),i=null,a=[],c={addLender(d){d.numLends+=1,a.push(d)},releaseLenders(){for(let d of a)d.numLends-=1;a.length=0}},{task:l,body:u}=Td({prepared:s,callee:n,callback:o,postReturn:null,ctx:e,calleeUsesAsyncAbi:!0,mode:e.suspensionMode,canBlock:e.calleeCanBlock?.(n)??!1,onCallerResults:d=>{i=d??[]},lenderScope:c});s.calleeInst.mayEnterFrom(s.callerInst)||pe(Bt(s.calleeInst,"cannot enter component instance")),s.calleeInst.enterFrom(s.callerInst);let f=!1;try{Ad(l,u).resume(),f=!0}catch(d){throw d instanceof Ve||d instanceof Be?s.calleeInst.leaveTo(s.callerInst):Ft(s.calleeInst,d),c.releaseLenders(),d}if(f&&s.calleeInst.leaveTo(s.callerInst),i===null){if(e.suspensionMode==="jspi")return qe({store:s.callerInst.store,task:_e(),readyFunc:()=>i!==null,cancellable:!1,produce:()=>(c.releaseLenders(),Ed(i)),onSettled:()=>c.releaseLenders()});c.releaseLenders(),Je("sync-start-call whose async-lifted callee did not resolve in its first activation (the caller's wasm frame must block)")}return c.releaseLenders(),Ed(i)}}function xd(t){t.unwindLenders()}function Ed(t){if(!(t===null||t.length===0))return t.length===1?t[0]:t}function Id(t,e){return(n,r,s,o)=>{let i=Sd(e,"async-start-call");p(typeof n=="function","async-start-call: callee funcref");let a=t.callback===null?null:e.callback(t.callback),c=new $t,l=()=>{},{task:u,body:f}=Td({prepared:i,callee:n,callback:a,postReturn:t.postReturn===null?null:e.callback(t.postReturn),ctx:e,calleeUsesAsyncAbi:((o??0)&gw)!==0,mode:e.suspensionMode,canBlock:e.calleeCanBlock?.(n)??!1,onStarted:()=>{c.state===ne.STARTING&&(c.state=ne.STARTED,l())},onCallerResults:x=>{c.resolved()||c.resolve(x===null?c.state===ne.STARTING?ne.CANCELLED_BEFORE_STARTED:ne.CANCELLED_BEFORE_RETURNED:ne.RETURNED,[]),l()},lenderScope:c});c.onCancel=x=>u.requestCancellation(x),c.calleeTask=u,i.calleeInst.mayEnterFrom(i.callerInst)||pe(Bt(i.calleeInst,"cannot enter component instance")),i.calleeInst.enterFrom(i.callerInst);let d=!1,w;try{w=Ad(u,f),w.resume(),d=!0}catch(x){throw x instanceof Ve||x instanceof Be?i.calleeInst.leaveTo(i.callerInst):Ft(i.calleeInst,x),xd(c),x}d&&i.calleeInst.leaveTo(i.callerInst);let y=()=>{if(c.resolved())return c.deliverResolve(),Xe("async-start-call -> RETURNED (eager)"),ne.RETURNED;let x=i.callerInst.handles.add(c);l=()=>c.setSubtaskPendingEvent(x);let v=ri(c.state,x);return Xe(`async-start-call -> state=${c.state} i=${x} packed=0x${v.toString(16)}`),v};if(e.suspensionMode==="jspi"){let x=i.callerInst.store,v=i.calleeInst,b=Gu(),m=()=>c.state===ne.STARTING&&!c.resolved()&&!w.done()&&w.waiting(),g=()=>m()?!x.hasRunnableWork(v,b):c.resolved()||w.done()||x.waiting.some(k=>k.task===u);if(!g()){let k=!1;return qe({store:i.callerInst.store,task:_e(),readyFunc:g,cancellable:!1,produce:()=>{let T=y();return k=!0,T},onSettled:()=>{k||xd(c)}})}}return y()}}function Ad(t,e){let n;return n=new Rn(t,function*(){yield*e(n)}()),n}var xw=2147483648,hi=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}bytes(){let e=this.#e();if(e===void 0)throw new Error(`${this.#t} accessed before it was extracted`);return new Uint8Array(e.buffer)}},Pd=["utf8-to-utf8","utf16-to-utf16","latin1-to-latin1","latin1-to-utf16","latin1-to-utf8","utf16-to-compact-probably-utf16","utf16-to-compact-utf16","utf16-to-latin1","utf16-to-utf8","utf8-to-compact-utf16","utf8-to-latin1","utf8-to-utf16"],Ew=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function kc(t){try{return Ew.decode(t)}catch{pe("invalid utf8 encoding")}}function*pi(t,e,n){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),s=0;for(;s57343){s+=1,yield[o,1];continue}(o>=56320||s+1>=n)&&pe("invalid utf16 encoding");let i=r.getUint16(e+2*(s+1),!0);(i<56320||i>57343)&&pe("invalid utf16 encoding"),s+=2,yield[65536+(o-55296<<10)+(i-56320),2]}}function vw(t){return t<128?1:t<2048?2:t<65536?3:4}function Cd(t,e,n){return n<128?(t[e]=n,1):n<2048?(t[e]=192|n>>6,t[e+1]=128|n&63,2):n<65536?(t[e]=224|n>>12,t[e+1]=128|n>>6&63,t[e+2]=128|n&63,3):(t[e]=240|n>>18,t[e+1]=128|n>>12&63,t[e+2]=128|n>>6&63,t[e+3]=128|n&63,4)}function Tw(t,e,n,r){if(r<65536)return t.setUint16(e+2*n,r,!0),1;let s=r-65536;return t.setUint16(e+2*n,55296+(s>>10),!0),t.setUint16(e+2*(n+1),56320+(s&1023),!0),2}function Sw(t,e,n){let r=0;for(;r191)break;r+=2}else break}return r}function Rd(t,e,n){for(let r=n-1;r>=0;r--)t[e+2*r]=t[e+r],t[e+2*r+1]=0}function mt(t,e,n){return t.slice(e,e+n)}function $w(t,e,n,r,s,o){if(t.buffer!==r.buffer)return;let i=t.byteOffset+e,a=i+n,c=r.byteOffset+s,l=c+o;i{let i=e.bytes();n.bytes().set(mt(i,r,s),o)};case"utf8-to-utf8":return(r,s,o)=>{let i=e.bytes(),a=mt(i,r,s);kc(a),n.bytes().set(a,o)};case"utf16-to-utf16":return(r,s,o)=>{let i=e.bytes(),a=mt(i,r,2*s);for(let c of pi(a,0,s));n.bytes().set(a,o)};case"latin1-to-utf16":return(r,s,o)=>{let i=mt(e.bytes(),r,s),a=n.bytes();for(let c=0;c{let i=kc(mt(e.bytes(),r,s)),a=n.bytes(),c=new DataView(a.buffer,a.byteOffset,a.byteLength),l=0;for(let u=0;u{let i=mt(e.bytes(),r,2*s),a=!0;for(let[l]of pi(i,0,s))l>255&&(a=!1);let c=n.bytes();if(c.set(i,o),!a)return(s|xw)>>>0;for(let l=0;l{let i=mt(e.bytes(),r,s),a=Sw(i,0,s),c=n.bytes(),l=0,u=0;for(;u{let i=e.bytes(),a=n.bytes();$w(i,r,2*s,a,o,s);let c=new DataView(i.buffer,i.byteOffset,i.byteLength),l=[];for(let u=0;u255)break;l.push(f)}for(let u=0;u{let c=mt(e.bytes(),r,2*s),l=n.bytes(),u=0,f=0,d=0;for(let[w,y]of pi(c,0,s)){if(d+=y,a!==0&&w>=128)break;let x=i-f;if(x<4&&x{let c=mt(e.bytes(),r,s),l=s;if(a!==0){for(let w=0;w=128){l=w;break}}let u=n.bytes(),f=0,d=0;for(;fi)break;d+=Cd(u,o+d,w),f++}return[f,d]};case"utf8-to-compact-utf16":return(r,s,o,i,a)=>{let c=kc(mt(e.bytes(),r,s)),l=n.bytes();Rd(l,o,a);let u=new DataView(l.buffer,l.byteOffset,l.byteLength),f=i-a;c.length>f&&pe("utf8-to-compact-utf16: destination capacity exceeded");let d=0;for(let w=0;w{let c=mt(e.bytes(),r,2*s),l=n.bytes();Rd(l,o,a);let u=new DataView(l.buffer,l.byteOffset,l.byteLength),f=a;for(let[d]of pi(c,0,s))f+=Tw(u,o,f,d);return s+a};default:{let r=t;throw new Error(`unknown transcode op ${r}`)}}}var yi=2;function Iw(t){let e=wr();p(t ${n}`,e),n>>>0}var Nd=(()=>{try{return Deno.env.get("CE_CTX_TRACE")==="1"}catch{return!1}})();function mi(t){return ve(t)}function Od(t,e){let n=Ju();console.error(`[ctx] ${mi(e)} ${t} storage=${JSON.stringify(e.storage)} | stack=[${n.stack.map(mi).join(",")}] claims=[${n.claims.map(mi).join(",")}] resuming=${n.resuming===null?"-":mi(n.resuming)}`)}function Aw(t,e){let n=wr();p(t>>0}`,n),n.storage[t]=e>>>0}function _d(t){let e=/^context-(get|set)-i32-(\d+)$/.exec(t);if(e===null)throw new Kt("M2",`component imports the unsafe intrinsic '${t}', which has no portable meaning in a JS host (only context.{get,set} do)`);let n=Number(e[2]);return h(n>=yi,`unsafe intrinsic '${t}' addresses context slot ${n}, but a thread has ${yi}`),e[1]==="get"?()=>Iw(n):r=>{Aw(n,(r??0)>>>0)}}var Cw={9:"wasm `unreachable` instruction executed",17:"cannot enter component instance",23:"cannot leave component instance",24:"cannot block a synchronous task before returning",25:"invalid `char` bit pattern",30:"string content out-of-bounds",31:"list content out-of-bounds",32:"invalid variant discriminant",33:"unaligned pointer",46:"reference count overflow",49:"uncaught exception propagated out of component"},Rw=49,Pw={"lower-import":"M0",trap:"M0","enter-sync-call":"M0","exit-sync-call":"M0","resource-new":"M1","resource-rep":"M1","resource-drop":"M1",transcoder:"M1","resource-transfer-own":"M1","resource-transfer-borrow":"M1"};function Lw(t){return Pw[t]??"M2"}var xc=class{numBorrows=0;lenders=[];addLender(e){e.numLends+=1,this.lenders.push(e)}releaseLenders(){for(let e of this.lenders)e.numLends-=1;this.lenders.length=0}};function Fd(t,e){let n=Dw(t,e);return(...r)=>{try{return n(...r)}catch(s){throw e.trapState.pending=s,s}}}function V(t,e){let n=t.instance;return p(typeof n=="number",`trampoline '${t.kind}' has no declared component instance`),e.componentInstance(n)}var Nw=(()=>{try{return Deno.env.get("CE_SCOPE_TRACE")==="1"}catch{return!1}})(),Dd=new WeakMap,Ow=1;function _w(t){if(t==null)return"NONE(->ctx fallback)";let e=Dd.get(t);return e===void 0&&(e=Ow++,Dd.set(t,e)),`T${e}`}function Ec(t,e="?"){let n=Mt(),r=n?.syncCallStack??t.syncCallStack;return Nw&&console.error(`[scope] ${e} act=${_w(n)} depth=${r.length}`),r}function Dw(t,e){switch(t.kind){case"lower-import":{let n=t;return e.loweredImport(n)}case"trap":return n=>{if(n===Rw){let s=e.trapState.pending;if(s!==void 0)throw s}let r=n===void 0?void 0:Cw[n];pe(r===void 0?`FACT adapter trap (code ${n??"?"})`:`wasm trap: ${r}`)};case"enter-sync-call":return(n,r,s)=>{if(typeof n=="number"&&typeof s=="number"){let i=e.componentInstance(n>>>0),a=e.componentInstance(s>>>0);a.mayEnterFrom(i)||pe(Bt(a,"cannot enter component instance"))}e.stats.enterSyncCalls++,Ec(e,"enter").push(new xc)};case"exit-sync-call":return(...n)=>{e.stats.exitSyncCalls++,p(e.stats.exitSyncCalls<=e.stats.enterSyncCalls,"exit-sync-call without matching enter-sync-call");let r=Ec(e,"exit").pop();p(r!==void 0,"exit-sync-call with an empty sync-call stack"),h(r.numBorrows>0,"cannot return from a call with outstanding borrow handles"),r.releaseLenders()};case"resource-new":{let n=t,r=e.componentInstance(n.instance),s=e.resourceToken(n.resource);return o=>tf(r,s,o>>>0)}case"resource-rep":{let n=t,r=e.componentInstance(n.instance),s=e.resourceToken(n.resource);return o=>rf(r,s,o>>>0)}case"resource-drop":{let n=t,r=e.componentInstance(n.instance),s=e.resourceToken(n.resource);return o=>{nf(r,s,o>>>0)}}case"transcoder":{let n=t;if(n.from64||n.to64)throw new Kt("M2",`transcoder '${n.op}' over a 64-bit linear memory`);if(!Pd.includes(n.op))throw new Kt("M2",`unknown string transcode operation '${n.op}'`);return Ld(n.op,e.runtimeMemory(n.from),e.runtimeMemory(n.to))}case"task-return":return ld(t,e);case"task-cancel":return ud();case"backpressure-inc":return fd(V(t,e));case"backpressure-dec":return dd(V(t,e));case"waitable-set-new":return pd(V(t,e));case"waitable-set-wait":return hd(t,e,V(t,e),e.suspensionMode);case"waitable-set-poll":return md(t,e,V(t,e));case"waitable-set-drop":return yd(V(t,e));case"waitable-join":return wd(V(t,e));case"subtask-drop":return gd(V(t,e));case"subtask-cancel":return bd(t,V(t,e),e.suspensionMode);case"thread-yield":return kd(t,e.suspensionMode);case"prepare-call":return vd(t,e);case"sync-start-call":return $d(t,e);case"async-start-call":return Id(t,e);case"stream-new":return Bf(t,e,V(t,e));case"future-new":return Mf(t,e,V(t,e));case"stream-read":return Jf(t,e,V(t,e));case"stream-write":return qf(t,e,V(t,e));case"future-read":return Gf(t,e,V(t,e));case"future-write":return Xf(t,e,V(t,e));case"stream-cancel-read":return Yf(t,e,V(t,e));case"stream-cancel-write":return Zf(t,e,V(t,e));case"future-cancel-read":return Qf(t,e,V(t,e));case"future-cancel-write":return ed(t,e,V(t,e));case"stream-drop-readable":return td(t,e,V(t,e));case"stream-drop-writable":return nd(t,e,V(t,e));case"future-drop-readable":return rd(t,e,V(t,e));case"future-drop-writable":return sd(t,e,V(t,e));case"error-context-new":return Hf(t,e,V(t,e));case"error-context-debug-message":return zf(t,e,V(t,e));case"error-context-drop":return Vf(V(t,e));case"stream-transfer":return id(e);case"future-transfer":return ad(e);case"error-context-transfer":return cd(e,n=>e.errorContextTableInstance(n));case"resource-transfer-own":return(n,r,s)=>Fw(e,n>>>0,r,s);case"resource-transfer-borrow":return(n,r,s)=>Bw(e,n>>>0,r,s);default:throw new Kt(Lw(t.kind)==="M1"?"M1":"M2",`component requires host trampoline '${t.kind}'`)}}function Fw(t,e,n,r){let s=t.resourceTableInstance(n),o=t.resourceTableInstance(r),i=t.resourceToken(n),a=t.resourceToken(r),c=s.handles.remove(e);h(!(c instanceof Me),"transfer-own: not a resource handle");let l=c;return h(l.rt!==i,"transfer-own: resource type mismatch"),h(l.numLends!==0,"cannot remove owned resource while borrowed (handle still lent out)"),h(!l.own,"transfer-own: expected an owning handle"),o.handles.add(new Me(a,l.rep,!0))}function Bw(t,e,n,r){let s=t.resourceTableInstance(n),o=t.resourceTableInstance(r),i=t.resourceToken(n),a=t.resourceToken(r),c=t.factStartScopes[t.factStartScopes.length-1],l=Ec(t),u=l[l.length-1];p(c!==void 0||u!==void 0,"transfer-borrow outside an enter-sync-call/exit-sync-call bracket or FACT start window");let f=s.handles.get(e);h(!(f instanceof Me),"transfer-borrow: not a resource handle");let d=f;if(h(d.rt!==i,"transfer-borrow: resource type mismatch"),(c?.lenders??u).addLender(d),a.impl!==null&&a.impl===o)return d.rep;let w=c!==void 0?c.taskScope:u;return w.numBorrows+=1,o.handles.add(new Me(a,d.rep,!1,w))}var Mw=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})(),gi=class{options;constructor(e={}){this.options=e}};function Md(t){return new gi(t??{})}var wi=new WeakMap;async function Ud(t){let e=t.loadedPlan??xn(t.plan);if(e.wire!==t.plan)throw new E("instantiateComponent: `loadedPlan` was converted from a different plan document than `plan`");let n=new Tc(e,t);return await n.verifyComponent(),await n.compileModules(),n.bindImportedResources(),await n.runInitializers(),n.finish()}var Tc=class{wire;loaded;componentBytes;adapterBytes;hostImports;verifyHash;suspensionMode;stats=Lf();modules=[];instances=[];componentInstances=new Map;store=new pr;unsafeIntrinsics=new Map;preparedCall={current:null};liveMemories=new Map;wrappedEntries=!1;wrappedImports=!1;noteEntry(){return this.suspensionMode==="jspi"&&(this.wrappedEntries=!0),this.suspensionMode}noteImport(){return this.suspensionMode==="jspi"&&(this.wrappedImports=!0),this.suspensionMode}taskMayBlock=new WebAssembly.Global({value:"i32",mutable:!0},1);memories=[];reallocs=[];postReturns=[];callbacks=[];tables=[];lowerings=new Map;trampolineCache=new Map;hostResourceTypes=new Map;syncCallStack=[];factStartScopes=[];suspendableFuncs=new WeakSet;sawBlockingImport=!1;suspendableLowerings=new Set;trapState={pending:void 0};omittedExports=new Map;constructor(e,n){this.loaded=e,this.wire=e.wire,this.componentBytes=n.componentBytes,this.adapterBytes=n.adapters??new Map,this.hostImports=n.imports??{},this.verifyHash=n.verifyHash??!0,this.suspensionMode=$f(n.jspi,Af(e.wire)||Co(this.hostImports))}async verifyComponent(){let{sha256:e,len:n}=this.wire.component;if(this.componentBytes.length!==n)throw new E(`component byte length ${this.componentBytes.length} != plan's ${n}`);if(!this.verifyHash)return;let r=await crypto.subtle.digest("SHA-256",this.componentBytes.slice().buffer),s=[...new Uint8Array(r)].map(o=>o.toString(16).padStart(2,"0")).join("");if(s!==e)throw new E(`component sha256 mismatch: plan has ${e}, bytes are ${s}`)}async compileModules(){let e=wi.get(this.wire);if(e!==void 0&&e.componentBytes===this.componentBytes&&this.wire.modules.every((s,o)=>s.kind==="embedded"||e.adapterRefs[o]===this.adapterBytes.get(s.file))){this.modules.push(...await e.modules);return}let n=Promise.all(this.wire.modules.map((s,o)=>{if(s.kind==="embedded"){let a=s.offset+s.len;if(a>this.componentBytes.length)throw new E(`module ${o}: byte range ${s.offset}..${a} exceeds component size ${this.componentBytes.length}`);return WebAssembly.compile(this.componentBytes.slice(s.offset,a).buffer)}let i=this.adapterBytes.get(s.file);if(!i)throw new E(`adapter artifact ${s.file} not provided`);if(i.length!==s.len)throw new E(`adapter ${s.file}: expected ${s.len} bytes, got ${i.length}`);return WebAssembly.compile(i.slice().buffer)})),r={componentBytes:this.componentBytes,adapterRefs:this.wire.modules.map(s=>s.kind==="embedded"?void 0:this.adapterBytes.get(s.file)),modules:n};wi.set(this.wire,r),n.catch(()=>{wi.get(this.wire)===r&&wi.delete(this.wire)}),this.modules.push(...await n)}bindImportedResources(){(this.wire.importedResources??[]).forEach((n,r)=>{let s=this.wire.imports[n.import],o=Bd(s.name,s.path),i=this.lookupHostImport(s.name,s.path,o);if(!(i instanceof gi))throw new E(`host import '${o}' must be a HostResourceType (the component imports a resource type); got ${vc(i)}`);let a=i.options.dtor;this.wire.resourceTables.forEach((c,l)=>{if(c.kind!=="concrete"||c.resource!==r)return;let u=this.loaded.resourceTokens[l];u.impl=null,u.dtor=a===void 0?null:f=>a(f)}),this.hostResourceTypes.set(r,i)})}async runInitializers(){for(let e of this.wire.initializers)switch(e.op){case"instantiate-module":{let n=this.modules[e.module];if(n===void 0)throw new E(`instantiate-module: no module ${e.module}`);let r=WebAssembly.Module.imports(n);if(r.length!==e.args.length)throw new E(`module ${e.module}: ${r.length} imports but ${e.args.length} args in plan`);let s={};this.sawBlockingImport=!1;let o=new Map;r.forEach((a,c)=>{let l=this.sawBlockingImport,u=this.importValue(e.args[c]);!l&&this.sawBlockingImport&&Mw&&console.error(`[suspendable] module ${e.module}: import ${a.module}.${a.name} (${JSON.stringify(e.args[c])})`);let f=`${a.module}\0${a.name}`,d=o.get(f);if(d!==void 0&&d.value!==u)throw new E(`module ${e.module}: duplicate import ${JSON.stringify(a.module)}.${JSON.stringify(a.name)} at arg indices ${d.index} and ${c} resolve to different values (plan args[${d.index}]=${JSON.stringify(e.args[d.index])}, args[${c}]=${JSON.stringify(e.args[c])})`);o.set(f,{index:c,value:u}),(s[a.module]??={})[a.name]=u});let i;try{i=await WebAssembly.instantiate(n,s)}catch(a){throw a?.constructor?.name==="SuspendError"?new ke("cannot block a synchronous task before returning"):a}if(this.sawBlockingImport)for(let a of Object.values(i.exports))typeof a=="function"&&this.suspendableFuncs.add(a);this.instances.push(i);break}case"lower-import":{this.lowerings.set(e.index,e.import);break}case"extract-memory":{let n=this.resolveCoreExport(e.export);if(!(n instanceof WebAssembly.Memory))throw new E(`extract-memory ${e.index}: resolved to non-memory`);this.memories[e.index]=n;break}case"extract-realloc":{this.reallocs[e.index]=this.resolveFunction(e.def,`extract-realloc ${e.index}`);break}case"extract-callback":{this.callbacks[e.index]=this.resolveFunction(e.def,`extract-callback ${e.index}`);break}case"extract-post-return":{this.postReturns[e.index]=this.resolveFunction(e.def,`extract-post-return ${e.index}`);break}case"extract-table":{let n=this.resolveCoreExport(e.export);if(!(n instanceof WebAssembly.Table))throw new E(`extract-table ${e.index}: resolved to non-table`);this.tables[e.index]=n;break}case"resource":{let n=e.dtor===null?null:this.resolveFunction(e.dtor,`resource ${e.index} dtor`),r=this.componentInstance(e.instance),s=Lu(this.loaded,e.index);this.wire.resourceTables.forEach((o,i)=>{if(o.kind==="concrete"&&o.resource===s){let a=this.loaded.resourceTokens[i];if(a.impl=r,a.dtor=n===null?null:c=>{n(c)},n!==null&&this.suspensionMode==="jspi"&&this.suspendableFuncs.has(n))try{a.dtorHost=nn(n,this.suspensionMode)}catch{a.dtorHost=null}}});break}default:{let n=e;throw new E(`unsupported initializer op ${n.op}`)}}}finish(){let e={};for(let r of this.wire.exports){let s=this.buildExport(r,r.name);s.kind==="value"&&(e[r.name]=s.value)}Cf(this.suspensionMode,this.wrappedEntries,this.wrappedImports);let n=[];for(let[r,s]of this.componentInstances)n[r]=s;return{exports:e,stats:this.stats,componentInstances:n,coreInstances:this.instances,suspendableFuncs:this.suspendableFuncs,taskMayBlock:this.taskMayBlock,hostResourceTypes:this.hostResourceTypes,omittedExports:this.omittedExports,loadedPlan:this.loaded}}buildExport(e,n){switch(e.kind){case"lifted-func":{let r=this.funcType(e.type,`export '${n}'`),s=this.resolveFunction(e.coreDef,`export '${n}'`),o=this.resolveOptions(e.options),i=mc({name:n,ft:r,opts:o,core:s,stats:this.stats,suspensionMode:this.noteEntry(),trapState:this.trapState,syncCallStack:this.syncCallStack,allInstances:()=>this.componentInstances.values()});return this.suspensionMode==="jspi"&&e.name.startsWith("[constructor]")&&(i[ui]=mc({name:`${n} (sync entry)`,ft:r,opts:o,core:s,stats:this.stats,suspensionMode:"plain",trapState:this.trapState,syncCallStack:this.syncCallStack,allInstances:()=>this.componentInstances.values()})),{kind:"value",value:i}}case"instance":{let r={};for(let s of e.exports){let o=this.buildExport(s,`${n}/${s.name}`);o.kind==="value"&&(r[s.name]=o.value)}return{kind:"value",value:r}}case"type":return this.omittedExports.set(n,"type export: no runtime surface (plan-format.md)"),{kind:"omitted",reason:"type export: no runtime surface"};default:{let r=e;throw new E(`unsupported export kind ${r.kind}`)}}}componentInstance(e){let n=this.componentInstances.get(e);return n===void 0&&(n=new si(e,this.store),this.componentInstances.set(e,n)),n}liveMemory(e){let n=this.liveMemories.get(e);return n===void 0&&(n=new Ns(()=>this.memories[e],`memory ${e}`),this.liveMemories.set(e,n)),n}unsafeIntrinsic(e){let n=this.unsafeIntrinsics.get(e);return n===void 0&&(n=_d(e),this.unsafeIntrinsics.set(e,n)),n}importValue(e){let n=this.resolveCoreDef(e);if(typeof n=="function"&&this.suspendableFuncs.has(n)&&(this.sawBlockingImport=!0),this.suspensionMode!=="jspi"||e.kind!=="trampoline"||typeof n!="function")return n;let r=this.wire.trampolines[e.index];if(r===void 0)return n;let s=i=>this.wire.canonicalOptions[i]?.async===!0,o=r;if(o.kind==="lower-import"){let i=o.lowered;return this.suspendableLowerings.has(i)?(this.sawBlockingImport=!0,this.noteImport(),ic(n,"jspi")):n}return If(o,s)?(ii(o,s)&&(this.sawBlockingImport=!0),this.noteImport(),ic(n,"jspi")):n}resolveCoreDef(e){switch(e.kind){case"export":return this.resolveCoreExport({instance:e.instance,item:e.item});case"instance-flags":return this.componentInstance(e.instance).flags;case"trampoline":return this.trampoline(e.index);case"unsafe-intrinsic":return this.unsafeIntrinsic(e.intrinsic);case"task-may-block":return this.taskMayBlock;default:{let n=e;throw new E(`unsupported CoreDef kind ${n.kind}`)}}}resolveCoreExport(e){let n=this.instances[e.instance];if(n===void 0)throw new E(`core export ref: runtime instance ${e.instance} not created yet`);let r=n.exports[e.item.name];if(r===void 0)throw new E(`core instance ${e.instance} has no export '${e.item.name}'`);return r}resolveFunction(e,n){let r=this.resolveCoreDef(e);if(typeof r!="function")throw new E(`${n}: resolved to non-function`);return r}trampoline(e){let n=this.trampolineCache.get(e);if(n!==void 0)return n;let r=this.wire.trampolines[e];if(r===void 0)throw new E(`no trampoline ${e} in plan`);let s=Fd(r,{componentInstance:o=>this.componentInstance(o),resourceToken:o=>{let i=this.loaded.resourceTokens[o];if(i===void 0)throw new E(`no resource table ${o} in plan`);return i},runtimeMemory:o=>new hi(()=>this.memories[o],`runtime memory ${o}`),resourceTableInstance:o=>{let i=this.wire.resourceTables[o];if(i===void 0)throw new E(`no resource table ${o} in plan`);if(i.kind!=="concrete")throw new E(`resource table ${o} is abstract (type-only) and has no runtime handle table`);return this.componentInstance(i.instance)},options:o=>this.resolveOptions(o),resultTypes:o=>this.resultTypes(o),callback:o=>{let i=this.callbacks[o];if(i===void 0)throw new E(`callback ${o} accessed before its extract-callback initializer ran`);return i},memoryToken:o=>this.liveMemory(o),streamElem:o=>{if(o>=this.loaded.streamElems.length)throw new E(`stream table ${o} is not in the plan's streamTables (plan v2)`);return this.loaded.streamElems[o]},streamTableInstance:o=>{let i=this.loaded.streamTableInstances[o];if(i===void 0)throw new E(`stream table ${o} is not in the plan's streamTables (plan v2)`);return this.componentInstance(i)},futureTableInstance:o=>{let i=this.loaded.futureTableInstances[o];if(i===void 0)throw new E(`future table ${o} is not in the plan's futureTables (plan v2)`);return this.componentInstance(i)},errorContextTableInstance:o=>{let i=this.loaded.errorContextTableInstances[o];if(i===void 0)throw new E(`error-context table ${o} is not in the plan's errorContextTables (plan v3)`);return this.componentInstance(i)},resultTypesForTuple:o=>{let i=this.loaded.resultTupleTypes.get(o);return i===void 0?null:this.resultTypes(i)},futureElem:o=>{if(o>=this.loaded.futureElems.length)throw new E(`future table ${o} is not in the plan's futureTables (plan v2)`);return this.loaded.futureElems[o]},prepared:this.preparedCall,suspensionMode:this.suspensionMode,calleeCanBlock:o=>this.suspendableFuncs.has(o),syncCallStack:this.syncCallStack,factStartScopes:this.factStartScopes,trapState:this.trapState,loweredImport:o=>this.buildLoweredImport(o),stats:this.stats});return this.trampolineCache.set(e,s),s}buildLoweredImport(e){let n=this.lowerings.get(e.lowered);if(n===void 0)throw new E(`lower-import trampoline: lowering ${e.lowered} was never initialized (initializer order violation)`);let r=this.wire.imports[n];if(r===void 0)throw new E(`no import ${n} in plan`);let s=Bd(r.name,r.path),o=this.lookupHostImport(r.name,r.path,s);if(typeof o!="function")throw new E(`host import '${s}' missing or not a function (got ${vc(o)})`);let i=this.funcType(e.type,`import '${s}'`),a=this.resolveOptions(e.options),c=et(o);return c&&this.suspendableLowerings.add(e.lowered),Df({name:s,ft:i,opts:a,hostFn:o,stats:this.stats,mode:this.suspensionMode,suspendable:c})}lookupHostImport(e,n,r){if(!(e in this.hostImports))throw new E(`host import '${r}' not provided (no key '${e}' in imports)`);let s=this.hostImports[e],o=[];for(let i of n){if(s===null||typeof s!="object")throw new E(`host import '${r}': '${[e,...o].join("/")}' is ${vc(s)}, expected an object to read '${i}' from`);s=s[i],o.push(i)}return s}resultTypes(e){let n=this.loaded.types[e];if(n===void 0)throw new E(`task-return results: no type ${e}`);if(n.kind!=="value"||n.type.kind!=="tuple")throw new E(`task-return results: type ${e} is not a tuple type`);return n.type.elements}funcType(e,n){let r=this.loaded.types[e];if(r===void 0)throw new E(`${n}: no type ${e}`);if(r.kind!=="func")throw new E(`${n}: type ${e} is not a function type`);return r.funcType}resolveOptions(e){let n=this.wire.canonicalOptions[e];if(n===void 0)throw new E(`no canonicalOptions ${e} in plan`);let r=n.memory;return{stringEncoding:n.stringEncoding,memory:r===null?null:this.liveMemory(r),realloc:n.realloc===null?null:()=>this.reallocs[n.realloc],postReturn:n.postReturn===null?null:()=>this.postReturns[n.postReturn],callback:n.callback===null?null:()=>this.callbacks[n.callback],async:n.async,cancellable:n.cancellable,coreType:n.coreType,instance:this.componentInstance(n.instance)}}};function Bd(t,e){return e.length===0?t:`${t}/${e.join("/")}`}function vc(t){return t===null?"null":t===void 0?"undefined":typeof t=="object"?`a ${t.constructor?.name??"object"}`:`a ${typeof t}`}function bi(t){return Object.freeze({hostEnd:t})}var $r=class{t;values;length;progress;#e;constructor(e,n,r){if(this.t=e,this.values=n,this.length=r,this.progress=0,this.#e=[],!Number.isInteger(r)||r<0)throw new RangeError(`host buffer length must be a non-negative integer, got ${r}`);if(r>xr)throw new RangeError(`host buffer length ${r} exceeds the Component Model's Buffer.MAX_LENGTH (${xr})`)}remain(){return this.length-this.progress}isZeroLength(){return this.length===0}read(e){p(e<=this.remain(),"host buffer read beyond remaining");let n=this.values===null?new Array(e).fill(null):this.values.slice(this.progress,this.progress+e);return this.progress+=e,n}write(e){p(e.length<=this.remain(),"host buffer write beyond remaining"),this.#e.push(e),this.progress+=e.length}taken(){if(this.t!==null&&K(this.t).kind==="u8"){if(this.#e.length===1&&this.#e[0]instanceof Uint8Array)return this.#e[0];let r=new Uint8Array(this.progress),s=0;for(let o of this.#e){if(o instanceof Uint8Array)r.set(o,s);else for(let i=0;ithis.#n=e),Xu(this.#t),this.#e.pendingHostCalls.add(this.#t))}notify(){let e=this.#t,n=this.#n;this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.(),this.#o()}pump(){let e=this.#e;if(e!==null){for(;;){let n=e.serviceSettled(),r=e.tick();if(!n&&!r)break}this.#r||gr(e)||(this.#r=!0,this.#i(e))}}async#i(e){try{for(;!gr(e);){if(It(e)>0){await pc(e);continue}await dc(e,()=>e.pendingHostCalls.size===0||gr(e)||It(e)>1,"host stream/future activity")}}catch(n){e.hostFailure??=n}finally{this.#r=!1}this.notify()}close(){let e=this.#t,n=this.#n;this.#s=!0,this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.()}};function ki(t,e,n){let r=t;p(r.onLowered==null,"internal: a second host wrapper was built for an already-wrapped stream/future (the wrapper cache should have returned the first)"),r.onLowered=o=>{n?.(),e.bind(o.store)};let s=t.boundStore;s&&e.bind(s)}function Wd(t,e){let n=bi("write"),r=bi("read"),s={read:!1,write:!1},o=i=>{i===D.DROPPED?e.close():e.notify()};return{writable:{write(i){if(s.write)throw new TypeError("a write is already in flight on this stream's writable end; await it or cancelWrite() first");let a=new $r(t.t,i,i.length);return new Promise(c=>{s.write=!0,t.write(n,a,l=>{a.remain()>0||(l(),s.write=!1,e.notify(),c(a.progress))},l=>{s.write=!1,o(l),c(a.progress)}),e.notify(),e.pump()})},async writeAll(i){let a=0;for(;a{s.read=!0,t.read(r,a,l=>{l(),s.read=!1,e.notify(),c(a.taken())},l=>{s.read=!1,o(l),c(a.taken())}),e.notify(),e.pump()})},cancelRead(){s.read&&(s.read=!1,t.cancel(),e.notify(),e.pump())},drop(){t.drop(),e.close(),e.pump()}}}}var Sc=new WeakMap,$c=new WeakMap;function Ic(t){let e=new St(t),n=new Ir;ki(e,n);let s={...Wd(e,n),value:e};return Sc.set(e,s),s}function jd(t){let e=t;p(e instanceof St,"hostStreamFor expects a lifted stream value");let n=Sc.get(e);if(n!==void 0)return n;let r=new Ir;ki(e,r);let o={...Wd(e,r),value:t};return Sc.set(e,o),o}function Kd(t){let e=new dt(t),n=new Ir,r={lowered:!1};ki(e,n,()=>r.lowered=!0);let s=Hd(e,n,e,r);return $c.set(e,s),s}function Ac(t){let e=t;p(e instanceof dt,"hostFutureFor expects a lifted future value");let n=$c.get(e);if(n!==void 0)return n;let r=new Ir,s={lowered:!1};ki(e,r,()=>s.lowered=!0);let o=Hd(e,r,t,s);return $c.set(e,o),o}function Hd(t,e,n,r){let s=bi("write"),o=bi("read"),i={any:!1},a=!1,c=u=>{i.any=!1,u===D.COMPLETED&&(a=!0),u===D.DROPPED?e.close():e.notify()},l={write(u){if(i.any)throw new TypeError("an operation is already in flight on this future; await it or cancel() first");let f=new $r(t.t,[u],1);return new Promise(d=>{i.any=!0,t.write(s,f,w=>{c(w),d()}),e.notify(),e.pump()})},readResult(){if(i.any)throw new TypeError("an operation is already in flight on this future; await it or cancel() first");if(t.dropped)return Promise.resolve({value:void 0,result:D.DROPPED});let u=new $r(t.t,null,1);return new Promise(f=>{i.any=!0,t.read(o,u,d=>{c(d),f({value:u.taken()[0],result:d})}),e.notify(),e.pump()})},async read(){return(await l.readResult()).value},cancel(){i.any&&(i.any=!1,t.cancel(),e.notify(),e.pump())},drop(){!a&&r.lowered&&!t.dropped?yf(t,new Error("the host dropped the writable end of this future without writing a value")):t.drop(),e.close(),e.pump()},value:n};return l}function J(t){let e=t.split("-");return e[0]+e.slice(1).map(zd).join("")}function rt(t){return t.split("-").map(zd).join("")}function zd(t){return t.length===0?t:t[0].toUpperCase()+t.slice(1)}var Uw=/^\[([a-z-]+)\](.*)$/;function Os(t){let e=Uw.exec(t);if(e===null)return{form:"plain",name:t};let[,n,r]=e;switch(n){case"constructor":return{form:"constructor",resource:r};case"method":case"static":{let s=r.indexOf(".");if(s<0)break;return{form:n,resource:r.slice(0,s),member:r.slice(s+1)}}}return{form:"plain",name:t}}var _s=class t{#e;buildHash;constructor(e,n){this.#e=e,this.buildHash=n;for(let r of["memory","ts_alloc","ts_dealloc","ts_translate"])if(!(r in this.#e))throw new E(`shim module missing export '${r}'`)}static async create(e){let n,r=null;if(e instanceof WebAssembly.Module)n=e;else{n=await WebAssembly.compile(e.slice().buffer);let o=await crypto.subtle.digest("SHA-256",e.slice().buffer);r=Array.from(new Uint8Array(o)).map(i=>i.toString(16).padStart(2,"0")).join("")}let s=await WebAssembly.instantiate(n,{});return new t(s.exports,r)}static fromExports(e,n={}){return new t(e,n.buildHash??null)}translate(e){let n=this.translateRaw(e),{wire:r,adapters:s}=Po(n);return{plan:r,adapters:s,envelopeJson:n}}translateRaw(e){let n=this.#e,r=n.ts_alloc(e.length);new Uint8Array(n.memory.buffer,r,e.length).set(e);let s=n.ts_alloc(4),o=n.ts_translate(r,e.length,s),i=new DataView(n.memory.buffer).getUint32(s,!0),a=new TextDecoder().decode(new Uint8Array(n.memory.buffer,o,i));return n.ts_dealloc(o,i),n.ts_dealloc(s,4),n.ts_dealloc(r,e.length),a}};var Ln=class extends Error{constructor(e){super(e),this.name="NameCollisionError"}};function Ww(t){if("wire"in t&&"types"in t)return t;let e="plan"in t?t.plan:t;return xn(e)}function Cc(t){let e=Ww(t);return e.wire.imports.map(n=>{let r=n.path.length===0?n.name:n.path[n.path.length-1],s=Os(r),o={interfaceId:n.name,path:[...n.path],leaf:r,kind:n.kind,member:s,jsName:jw(s,n.kind)};if(s.form!=="plain"&&(o.jsClass=rt(s.resource)),n.type!==void 0){let i=e.types[n.type];i!==void 0&&i.kind==="func"&&(o.type={params:i.funcType.params.map((a,c)=>({name:i.paramNames[c]??String(c),type:a})),results:i.funcType.results,async:i.funcType.async===!0})}return o})}function jw(t,e){switch(t.form){case"plain":return e==="resource"?rt(t.name):J(t.name);case"constructor":return"constructor";case"method":case"static":return J(t.member)}}var Rc=$o,xi=class{drop(){Vd(this)}[Symbol.dispose](){Vd(this)}},Kw=t=>{if(!(!t.valid||!t.owns)){if(t.valid=!1,t.lends>0){t.pendingDrop=!0;return}Jd(t)}},Ei=new FinalizationRegistry(Kw);function Jd(t){try{br(t.rt,t.rep,null,!0)}catch(e){Hw(t.rt,e)}}function Hw(t,e){let n=t.impl?.store;n!==void 0&&n.hostFailure===void 0&&(n.hostFailure=e)}function qd(t,e){e.copyUrl??=bn,t[Rc]=e,e.owns&&Ei.register(t,e,t)}function vi(t){let e=t[Rc];if(e!==void 0)return e.copyUrl===bn?e:void 0}function zw(t){return t[Rc]!==void 0}function Vw(t,e){let n=vi(t);if(n===void 0)throw zw(t)?new Ke(`${e}: ${kn("this resource handle","Resource wrappers hold a rep in the minting copy's tables; there is no by-value form \u2014 call through the copy that created it.")}`):new Ke(`${e}: not a resource handle`);if(!n.valid)throw new Ke(`${e}: this ${n.className} handle is no longer valid (it was transferred as own<\u2026>, dropped, or was a borrow that outlived its call)`);return n}function Vd(t){let e=vi(t);if(!(e===void 0||!e.valid)&&(e.valid=!1,Ei.unregister(t),!!e.owns)){if(e.lends>0){e.pendingDrop=!0;return}br(e.rt,e.rep,null,!0)}}function Gd(t){let e=vi(t);if(e===void 0)return()=>{};e.lends+=1;let n=!1;return()=>{n||(n=!0,Jw(e))}}function Jw(t){t.lends-=1,!(t.lends>0||!t.pendingDrop)&&(t.pendingDrop=!1,Jd(t))}function Xd(t){let e=vi(t);e!==void 0&&(e.valid=!1,Ei.unregister(t))}function Pc(t,e,n){if(typeof t!="object"||t===null)throw new Ke(`${n}: expected a resource class instance, got ${typeof t}`);let r=Vw(t,n);if(e){if(r.lends>0)throw new Ke(`${n}: this ${r.className} handle is still lent out as a borrow to an in-flight call and cannot be transferred`);r.valid=!1,Ei.unregister(t)}return r.rep}function Lc(t,e,n,r){let s=rt(t.name),o=class extends xi{constructor(...i){if(super(),t.ctor===null)throw new TypeError(`${s} has no WIT constructor; use its static functions`);let a=`${s} constructor`,c=r(i,t.ctorParams??[],a),l=t.ctor(...c);if(l!==null&&typeof l=="object"&&"then"in l)throw new TypeError(`${a}: the guest constructor did not complete synchronously. A JS constructor cannot await; expose an async factory instead.`);if(typeof l!="number")throw new TypeError(`${a}: expected an own handle rep, got ${typeof l}`);qd(this,{rep:l,valid:!0,owns:!0,rt:e,className:s,lends:0,pendingDrop:!1})}};Object.defineProperty(o,"name",{value:s});for(let i of t.methods){let a=J(i.member),c=`${s}.${a}`;Object.defineProperty(o.prototype,a,{configurable:!0,writable:!0,value:function(...l){return n(i.raw,i.params,i.results,c,[this,...l])}})}for(let i of t.statics){let a=J(i.member),c=`${s}.${a} (static)`;Object.defineProperty(o,a,{configurable:!0,writable:!0,value:(...l)=>n(i.raw,i.params,i.results,c,l)})}return o}function Nc(t,e,n,r){let s=Object.create(t.prototype);return qd(s,{rep:e,valid:!0,owns:r,rt:n,className:t.name??"resource",lends:0,pendingDrop:!1}),s}var Ds=class{className;#e;#t;#n;constructor(e){this.className=e,this.#e=new Map,this.#t=new WeakMap,this.#n=1}repFor(e){if(e===null||typeof e!="object")throw new TypeError(`${this.className}: expected a class instance, got ${typeof e}`);let n=this.#t.get(e);if(n!==void 0&&this.#e.has(n))return n;let r=this.#n++;return this.#e.set(r,e),this.#t.set(e,r),r}hasInstance(e){if(e===null||typeof e!="object")return!1;let n=this.#t.get(e);return n!==void 0&&this.#e.has(n)}hasRep(e){return this.#e.has(e)}releaseIfPresent(e){this.#e.delete(e)}lookup(e){let n=this.#e.get(e);if(n===void 0)throw new Ke(`${this.className}: no live instance for rep ${e}`);return n}release(e){let n=this.lookup(e);return this.#e.delete(e),n}dtor(e){let n=this.#e.get(e);n!==void 0&&(this.#e.delete(e),n[Symbol.dispose]?.())}get liveCount(){return this.#e.size}};var Qd=new WeakMap;function ep(t,e,n){let r=ls(n)?n:new Zt(e,n),s=t.value;Qd.set(t.value,r);let o=s.boundStore;return o!=null&&typeof o=="object"?(o.hostFailure===void 0&&(o.hostFailure=r),!0):!1}function Oc(t,e="stream"){let n=Qd.get(t);if(n!==void 0)throw n;Fs(t,e)}function Fs(t,e,n){let r=hf(t);if(r!==void 0)throw new Lt(e,r,n)}function tp(t){return t!==null&&K(t).kind==="u8"}var st=class t{#e;#t;#n=!1;#s=!1;#r=[];constructor(e,n){this.#e=e,this.#t=n}static fromLifted(e,n){return new t(jd(e),n)}static fromHostStream(e,n){return new t(e,n)}static create(){let e=new t(null,null);return{stream:e,writer:new $i(e)}}bindElement(e){if(this.#e!==null)return;this.#t=e,this.#e=Ic(e.element),rp(this,this.#e);let n=this.#r;this.#r=[];for(let r of n)r()}whenBound(){return this.#e!==null?Promise.resolve():new Promise(e=>this.#r.push(e))}get bound(){return this.#e!==null}takeValue(e){if(this.bindElement(e),this.#n)throw new TypeError("this Stream handle has already been passed to a guest; a stream value may only be transferred once");return this.#n=!0,this.#e.value}get codec(){return this.#t}#o(){if(this.#e===null)throw new TypeError("this Stream was created with Stream.create() and has not been passed to a guest yet, so it has no element type; pass it first, or use the writer, which parks until then");return this.#e}async read(e){let n=this.#o(),r=this.#t?.where??"stream read";Oc(n.value,r);let s=await n.readable.read(e);return s.length===0&&Fs(n.value,r),this.#i(s)}#i(e){let n=this.#t;return tp(n.element)?e instanceof Uint8Array?e:Uint8Array.from(e):(e instanceof Uint8Array?Array.from(e):e).map(s=>n.toHost(s))}cancelRead(){this.#e?.readable.cancelRead()}drop(){this.#s||(this.#s=!0,this.#e?.readable.drop())}dropForTeardown(){this.#s||(this.#s=!0,this.#e!==null&&vs(this.#e.value))}[Symbol.dispose](){this.drop()}readable(){let e=this;return new ReadableStream({async pull(n){let r=await e.read(Yd);if(r.length===0){n.close();return}n.enqueue(r)},cancel(){e.drop()}})}async*[Symbol.asyncIterator](){for(;;){let e=await this.read(Yd);if(e.length===0)return;yield e}}},Yd=4096,$i=class{#e;constructor(e){this.#e=e}async write(e){await this.#e.whenBound();let n=Ti(this.#e),r=this.#e.codec?.where??"stream write";Oc(n.value,r);let s=await n.writable.write(_c(e,this.#e.codec));return s{let o=Ac(s);return r.adopt(o),o}),n);return r}adopt(e){this.#e=e}takeValue(){if(this.#e===null)throw new TypeError("this Future is still in flight and cannot be passed to a guest yet");if(this.#s)throw new TypeError("this Future handle has already been passed to a guest");return this.#s=!0,this.#e.value}#i(){return this.#o??=(async()=>{let e=await this.#t,{value:n,result:r}=await e.readResult();if(r!==D.COMPLETED)throw Fs(e.value,this.#n.where??"future read"),new Yt(r===D.CANCELLED?"the future read was cancelled":"the future's write end was dropped without a value");return this.#n.toHost(n)})(),this.#o}then(e,n){return this.#i().then(e,n)}cancel(){this.#e!==null?this.#e.cancel():this.#t.then(e=>e.cancel())}drop(){this.#r||(this.#r=!0,this.#e!==null?this.#e.drop():this.#t.then(e=>e.drop(),()=>{}))}dropForTeardown(){this.#r||(this.#e!==null?(this.#r=!0,vs(this.#e.value)):this.drop())}[Symbol.dispose](){this.drop()}},Nn=class{message;internal;constructor(e){this.internal=e,this.message=e.debugMessage}};we(st.prototype,as);we(At.prototype,cs);we(Nn.prototype,Et);function sp(t,e){if(t instanceof st)return t.takeValue(e);if(Ne(t,as))throw new TypeError(kn("this stream handle","To pipe it by value, pass `src.readable()` instead."));let n=Ic(e.element),r=st.fromHostStream(n,e);return rp(r,n),qw(t,n,e),n.value}function _c(t,e){let n=tp(e.element);if(t instanceof Uint8Array)return n?t:Array.from(t).map(s=>e.fromHost(s));let r=t.map(s=>e.fromHost(s));return n?Uint8Array.from(r):r}var Dc=Symbol("deltic reader gone");async function qw(t,e,n){let r=n.where??"stream producer",s,o=0,i=new Promise(a=>e.writable.onDropped(()=>a(Dc)));try{for await(let a of Gw(t,i)){let c=_c(a,n),l;try{l=await e.writable.writeAll(c)}catch(u){throw Zd(c,u instanceof Lt?u.progress??0:0,n),u}if(o+=l,l{});return}if(r.done)return;yield Si(r.value)}}finally{n.releaseLock()}}if(Symbol.asyncIterator in t){let n=t[Symbol.asyncIterator]();try{for(;;){let r=n.next(),s=await Promise.race([r,e]);if(s===Dc){t.cancel?.();try{let o=await r;o.done||(yield Si(o.value))}catch{}return}if(s.done)return;yield Si(s.value)}}finally{await n.return?.()}}for(let n of t)yield Si(n)}function Si(t){return t instanceof Uint8Array||Array.isArray(t)?t:[t]}function Xw(t){return typeof ReadableStream<"u"&&t instanceof ReadableStream}function op(t,e){if(t instanceof At)return t.takeValue();if(Ne(t,cs))throw new TypeError(kn("this future handle","To pipe it by value, pass `Promise.resolve(f)` instead."));let n=Kd(e.element);return(async()=>{try{let r=await t;await n.write(e.fromHost(r))}catch(r){ep({value:n.value},e.where??"future producer",r)||n.drop()}})(),n.value}var Cr=class{#e=[];add(e){this.#e.push(e)}end(){for(let e of this.#e)e();this.#e.length=0}},Yw=new Cr,ip=new WeakSet;function Ai(t,e,n){if(ip.has(t))return;let r=new Map;for(let s of e){let o=J(s),i=r.get(o);if(i!==void 0)throw new Ln(`${n}: the labels '${i}' and '${s}' both map to the JS name '${o}'. Rename one in the WIT; the conventions layer will not guess which one wins.`);r.set(o,s)}ip.add(t)}function Ie(t,e,n,r=Yw,s=!1){switch(e.kind){case"bool":case"s8":case"u8":case"s16":case"u16":case"s32":case"u32":case"s64":case"u64":case"f32":case"f64":case"char":case"string":return t;case"error-context":return new Nn(t);case"list":return K(e.element).kind==="u8"?t instanceof Uint8Array?t:Uint8Array.from(t):t.map(i=>Ie(i,e.element,n,r));case"record":{Ai(e,e.fields.map(a=>a.label),`${n.where}: record`);let o=t,i={};for(let a of e.fields){if(a.type.kind==="option"){let c=o[a.label];if("none"in c)continue;i[J(a.label)]=Ie(c.some,a.type.type,n,r,!0);continue}i[J(a.label)]=Ie(o[a.label],a.type,n,r)}return i}case"tuple":{let o=t;return e.elements.map((i,a)=>Ie(o[String(a)],i,n,r))}case"variant":{let[o,i]=Ii(t,n),a=e.cases.find(c=>c.label===o);if(a===void 0)throw new TypeError(`${n.where}: unknown variant case '${o}'`);return a.type===null?{kind:o}:{kind:o,value:Ie(i,a.type,n,r)}}case"enum":{let[o]=Ii(t,n);return o}case"option":{let[o,i]=Ii(t,n);return s?o==="none"?{kind:"none"}:{kind:"some",value:Ie(i,e.type,n,r,!0)}:o==="none"?void 0:Ie(i,e.type,n,r,!0)}case"result":{let[o,i]=Ii(t,n),a=o==="error"?"err":"ok",c=o==="error"?e.error:e.ok;return c===null?{kind:a}:{kind:a,value:Ie(i,c,n,r)}}case"flags":{Ai(e,e.labels,`${n.where}: flags`);let o=t,i={};for(let a of e.labels)i[J(a)]=!!o[a];return i}case"map":return Ie(t,K(e),n,r);case"own":return n.bridge.liftOwn(t,e);case"borrow":return n.bridge.liftBorrow(t,e,r);case"stream":return st.fromLifted(t,Ci(e.element,n));case"future":return At.fromLifted(t,Ci(e.element,n))}}function Ii(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`${e.where}: expected a single-key case object, got ${On(t)}`);let n=Object.keys(t);if(n.length!==1)throw new TypeError(`${e.where}: expected exactly one case key, got ${n.length}`);return[n[0],t[n[0]]]}function Se(t,e,n,r=!1){switch(e.kind){case"bool":return!!t;case"u8":return Ar(t,e.kind,0,255,n);case"u16":return Ar(t,e.kind,0,65535,n);case"u32":return Ar(t,e.kind,0,4294967295,n);case"s8":return Ar(t,e.kind,-128,127,n);case"s16":return Ar(t,e.kind,-32768,32767,n);case"s32":return Ar(t,e.kind,-2147483648,2147483647,n);case"u64":return ap(t,e.kind,0n,(1n<<64n)-1n,n);case"s64":return ap(t,e.kind,-(1n<<63n),(1n<<63n)-1n,n);case"f32":case"f64":if(typeof t!="number")throw new TypeError(`${n.where}: ${e.kind} expects a number`);return t;case"char":{if(typeof t!="string"||[...t].length!==1)throw new TypeError(`${n.where}: char expects a single-code-point string`);let s=t.codePointAt(0);if(s>=55296&&s<=57343)throw new TypeError(`${n.where}: char expects a Unicode scalar value, got the lone surrogate U+${s.toString(16).toUpperCase()}`);return t}case"string":if(typeof t!="string")throw new TypeError(`${n.where}: string expects a string`);return t;case"error-context":{if(t instanceof Nn)return t.internal;if(t instanceof tt)return t;throw Ne(t,Et)?new TypeError(`${n.where}: ${kn("this error-context")}`):new TypeError(`${n.where}: expected an ErrorContext`)}case"list":{if(K(e.element).kind==="u8"){if(t instanceof Uint8Array)return t;if(Array.isArray(t))return Uint8Array.from(t);throw new TypeError(`${n.where}: list expects a Uint8Array`)}if(!Array.isArray(t))throw new TypeError(`${n.where}: list expects an array`);return t.map(o=>Se(o,e.element,n))}case"record":{if(t===null||typeof t!="object")throw new TypeError(`${n.where}: record expects an object`);Ai(e,e.fields.map(i=>i.label),`${n.where}: record`);let s=t,o={};for(let i of e.fields){let a=J(i.label);if(i.type.kind==="option"){let c=s[a];o[i.label]=c===void 0?{none:null}:{some:Se(c,i.type.type,n,!0)};continue}if(!(a in s))throw new TypeError(`${n.where}: record field '${a}' is missing`);o[i.label]=Se(s[a],i.type,n)}return o}case"tuple":{if(!Array.isArray(t)||t.length!==e.elements.length)throw new TypeError(`${n.where}: tuple expects an array of ${e.elements.length}`);let s={};return e.elements.forEach((o,i)=>{s[String(i)]=Se(t[i],o,n)}),s}case"variant":{let{kind:s,value:o,has:i}=Fc(t,n),a=e.cases.find(c=>c.label===s);if(a===void 0)throw new TypeError(`${n.where}: unknown variant case '${s}'`);if(a.type===null)return{[s]:null};if(!i)throw new TypeError(`${n.where}: variant case '${s}' needs a 'value'`);return{[s]:Se(o,a.type,n)}}case"enum":{if(typeof t!="string"||!e.labels.includes(t))throw new TypeError(`${n.where}: enum expects one of ${e.labels.join(" | ")}, got `+On(t));return{[t]:null}}case"option":{if(r){let{kind:s,value:o,has:i}=Fc(t,n);if(s==="none")return{none:null};if(s!=="some")throw new TypeError(`${n.where}: a nested option must be { kind: "some" | "none" }`);return{some:i?Se(o,e.type,n,!0):null}}return t===void 0?{none:null}:{some:Se(t,e.type,n,!0)}}case"result":{let{kind:s,value:o,has:i}=Fc(t,n);if(s!=="ok"&&s!=="err")throw new TypeError(`${n.where}: a result value must be { kind: "ok" | "err" }`);let a=s==="err"?"error":"ok",c=s==="err"?e.error:e.ok;if(c===null)return{[a]:null};if(!i)throw new TypeError(`${n.where}: result case '${s}' carries a payload and needs a 'value'`);return{[a]:Se(o,c,n)}}case"flags":{if(t===null||typeof t!="object")throw new TypeError(`${n.where}: flags expects an object`);Ai(e,e.labels,`${n.where}: flags`);let s=t,o={};for(let i of e.labels)o[i]=!!s[J(i)];return o}case"map":return Se(t,K(e),n);case"own":return n.bridge.lowerOwn(t,e);case"borrow":return n.bridge.lowerBorrow(t,e);case"stream":return sp(t,Ci(e.element,n));case"future":return op(t,Ci(e.element,n))}}function Fc(t,e){if(t===null||typeof t!="object"||!("kind"in t))throw new TypeError(`${e.where}: expected a { kind, value? } value, got ${On(t)}`);let n=t;if(typeof n.kind!="string")throw new TypeError(`${e.where}: 'kind' must be a string`);return{kind:n.kind,value:n.value,has:"value"in n}}function Ar(t,e,n,r,s){if(typeof t!="number"||!Number.isInteger(t))throw new TypeError(`${s.where}: ${e} expects an integer number`);if(tr)throw new TypeError(`${s.where}: ${e} out of range: ${t}`);return t}function ap(t,e,n,r,s){if(typeof t!="bigint")throw new TypeError(`${s.where}: ${e} expects a bigint`);if(tr)throw new TypeError(`${s.where}: ${e} out of range: ${t}`);return t}function Ci(t,e){return{element:t,where:e.where,toHost:n=>t===null?void 0:Ie(n,t,e),fromHost:n=>t===null?null:Se(n,t,e),release:t!==null&&t.kind==="own"?n=>e.bridge.dropOwn(n,t):void 0}}function On(t){return t===null?"null":t===void 0?"undefined":typeof t=="object"?`a ${t.constructor?.name??"object"}`:`a ${typeof t} (${String(t)})`}var _n=class extends Error{constructor(e){super(e),this.name="ImportRegistrationError"}},Ms=class extends Error{constructor(e){super(e),this.name="ImportResolutionError"}},Zw=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?$/;function Bs(t){let e=t.lastIndexOf("@");if(e<0)return{base:t,version:null,semver:null};let n=t.slice(0,e),r=t.slice(e+1);return{base:n,version:r,semver:cp(r)}}function cp(t){let e=Zw.exec(t);return e===null?null:{major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:e[4]===void 0?[]:e[4].split("."),build:e[5]??null}}function Bc(t,e){return e.prerelease.length>0?null:e.major>0?`${t}@${e.major}`:e.minor>0?`${t}@0.${e.minor}`:null}function lp(t){let e=Bs(t);return e.version===null||e.semver!==null?null:/^\d+$/.test(e.version)?e.version==="0"?null:t:/^0\.\d+$/.test(e.version)?t:null}var Us=class{#e=new Map;#t=new Map;#n=new Map;constructor(e){for(let n of Object.keys(e)){if(this.#e.has(n))throw new _n(`duplicate import key '${n}'`);this.#e.set(n,e[n]),this.#s(n)}}#s(e){let n=lp(e);if(n!==null){this.#r(n,{key:e,version:null});return}let r=Bs(e);if(r.version==="0")throw new _n(`import key '${e}': '@0' is not a compatibility track. Major 0 tracks the MINOR version (\`@0.2\`), so no version canonicalizes to '@0' and this registration could never be resolved.`);if(r.version===null){(r.base.includes("/")||r.base.includes(":"))&&this.#n.set(r.base,e);return}if(r.semver===null)return;let s=Bc(r.base,r.semver);s!==null&&this.#r(s,{key:e,version:r.semver})}#r(e,n){let r=this.#t.get(e);if(r===void 0){this.#t.set(e,n);return}if(r.version===null!=(n.version===null)){let[s,o]=r.version===null?[r.key,n.key]:[n.key,r.key];throw new _n(`import registration is ambiguous on compatibility track '${e}': the track key '${s}' and the full version '${o}' are both registered. Register one or the other, never both.`)}if(r.version===null)throw new _n(`compatibility track '${e}' is claimed twice ('${r.key}' and '${n.key}')`);up(n.version,r.version)>0&&this.#t.set(e,n)}keys(){return[...this.#e.keys()]}resolve(e){if(this.#e.has(e))return{key:e,value:this.#e.get(e)};let n=Bs(e);if(n.semver!==null){let r=Bc(n.base,n.semver);if(r!==null){let o=this.#t.get(r);if(o!==void 0)return{key:o.key,value:this.#e.get(o.key)}}let s=this.#n.get(n.base);if(s!==void 0)throw new Ms(`import '${e}' is versioned but the only registration for '${n.base}' is the unversioned key '${s}'. Version-agnostic folding is banned (contracts/embedder-api.md, C0 finding D-1): register '${n.base}@${n.version}' or the compatibility-track key '${Bc(n.base,n.semver)??n.base+"@"+n.version}'.`);return}if(n.version===null){let r=[...this.#e.keys()].filter(s=>Bs(s).base===n.base);if(r.length>0)throw new Ms(`import '${e}' is unversioned but the registrations for it are versioned (${r.join(", ")}). Version-agnostic folding is banned (contracts/embedder-api.md, C0 finding D-1).`)}}};function up(t,e){if(t.major!==e.major)return t.major-e.major;if(t.minor!==e.minor)return t.minor-e.minor;if(t.patch!==e.patch)return t.patch-e.patch;let n=t.prerelease,r=e.prerelease;if(n.length===0&&r.length===0)return 0;if(n.length===0)return 1;if(r.length===0)return-1;for(let s=0;st===null?void 0:Ie(n,t,e),fromHost:n=>t===null?null:Se(n,t,e)}}function Dn(t,e){let{wire:n,adapters:r}=Po(t);return{plan:n,componentBytes:e,adapters:r}}async function eg(t){if("plan"in t)return t;let e=t.translator instanceof _s?t.translator:await _s.create(t.translator),{plan:n,adapters:r}=e.translate(t.componentBytes);return{plan:n,componentBytes:t.componentBytes,adapters:r}}async function Fn(t,e={},n={}){let r=await eg(t),s=new Uc(r,e),o=await Ud({plan:r.plan,componentBytes:r.componentBytes,adapters:r.adapters,imports:s.rawImports,jspi:n.jspi,verifyHash:n.verifyHash,loadedPlan:s.loaded});s.bind(o);let i={exports:s.buildExports(o),handle:o,imports:s.leaves};return Object.defineProperty(i,tg,{value:s.hostRegistries,enumerable:!1}),i}var tg=Symbol("deltic.embedder.hostRegistries"),Uc=class{artifacts;leaves;rawImports;#e;#t;#n;loaded;#s;#r;hostRegistries;#o;constructor(e,n){this.artifacts=e,this.rawImports={},this.#t=new Map,this.#n=new Map,this.#r=null,this.hostRegistries=new Map,this.#o=!1,this.#y=[],this.#e=new Us(n),this.loaded=xn(e.plan),e.plan.resourceTables.forEach((s,o)=>{if(s.kind!=="concrete")return;let i=this.loaded.resourceTokens[o];i!==void 0&&this.#n.set(i,s.resource)}),this.leaves=Cc(this.loaded);let r=this.leaves.filter(s=>s.kind==="resource");if(r.length>0&&(e.plan.importedResources??[]).length===0)throw new E(`this component imports the resource type(s) ${r.map(s=>`'${s.leaf}'`).join(", ")}, but the plan carries no \`importedResources\` table, so they cannot be bound to a ResourceIndex (contracts/plan-format.md v0.2). Re-translate with a shim that emits it.`);this.#s=this.#u(),this.#d(),this.#l()}bind(e){if(e.loadedPlan!==this.loaded)throw new E("the executor instantiated from a different LoadedPlan than the facade built its import wrappers from; resource identity tokens would not match")}#i(e){let n=this.#n.get(e);if(n===void 0)throw new E("resource type is not bound to any resource table in this plan");return n}#a(e){let n=this.#i(e),r=this.#t.get(n);if(r===void 0){if(!this.#o)throw new E(`a guest-implemented resource (ResourceIndex ${n}) crossed the boundary before instantiation finished \u2014 a guest \`start\` function passed an own/borrow handle to a host import. Its class is assembled from the component's own lifted exports, which do not exist yet. Host-implemented resources are unaffected. If a real component needs this, the class must be built lazily from the plan's export table instead of the runtime's export surface.`);r={kind:"guest",name:`resource-${n}`},this.#t.set(n,r)}return r}#c(e){return e.cls??=Lc({name:e.name,ctor:null,ctorParams:null,methods:[],statics:[]},{impl:null,dtor:null},()=>Promise.reject(new TypeError("no methods")),()=>[]),e.cls}#l(){let e=this.artifacts.plan.importedResources??[];for(let n of this.#y){let r=e.findIndex(s=>s.import===n.importIndex);r<0||(this.#t.set(r,{kind:"host",name:this.leaves[n.importIndex].leaf,registry:n.registry,cls:n.cls}),this.hostRegistries.set(r,n.registry))}}#u(){let e=this;return{liftOwn(n,r){let s=e.#a(r.rt);return s.kind==="host"?s.registry.release(n):Nc(e.#c(s),n,r.rt,!0)},liftBorrow(n,r,s){let o=e.#a(r.rt);if(o.kind==="host")return o.registry.lookup(n);let i=Nc(e.#c(o),n,r.rt,!1);return s.add(()=>Xd(i)),i},lowerOwn(n,r){let s=e.#a(r.rt);return s.kind==="host"?s.registry.repFor(n):Pc(n,!0,`own<${s.name}>`)},lowerBorrow(n,r){let s=e.#a(r.rt);if(s.kind==="host"){let a=s.registry.hasInstance(n),c=s.registry.repFor(n);return a||e.#r?.push(()=>s.registry.releaseIfPresent(c)),c}let o=Pc(n,!1,`borrow<${s.name}>`),i=Gd(n);return e.#r===null?i():e.#r.push(i),o},dropOwn(n,r){let s=e.#a(r.rt);if(s.kind==="host"){s.registry.dtor(n);return}br(r.rt,n,null,!0)}}}#f(e){return{bridge:this.#s,where:e}}#p(e,n){let r=this.loaded;if(e===void 0)throw new E(`${n}: no type index`);let s=r.types[e];if(s===void 0||s.kind!=="func")throw new E(`${n}: type ${e} is not a function type`);return s.funcType}#d(){this.leaves.forEach((e,n)=>{let r=this.#h(e),s=e.path.length===0?null:ng(this.rawImports,e.interfaceId,e.path.slice(0,-1)),o=this.#m(e,n,r);s===null?this.rawImports[e.interfaceId]=o:s[e.path[e.path.length-1]]=o})}#h(e){if(e.path.length===0&&e.member.form!=="plain"){let s=e.member.resource,o=this.#e.resolve(s)??this.#e.resolve(J(s));if(o===void 0)throw new E(`host import '${yt(e)}' not provided: the component imports the world-level resource '${s}'; provide its class under the key '${J(s)}' (registered: ${this.#e.keys().join(", ")||""})`);return o.value}let n=this.#e.resolve(e.interfaceId)??(e.path.length===0?this.#e.resolve(J(e.interfaceId)):void 0);if(n===void 0)throw new E(`host import '${yt(e)}' not provided (no key '${e.interfaceId}' in imports; registered: ${this.#e.keys().join(", ")||""})`);let r=n.value;for(let s of e.path.slice(0,-1)){if(r===null||typeof r!="object")throw new E(`host import '${yt(e)}': '${s}' is not reachable (${On(r)})`);r=r[s]}return r}#m(e,n,r){if(e.kind==="resource")return this.#k(e,n,r);if(e.kind!=="func")throw new E(`host import '${yt(e)}': unsupported import kind '${e.kind}'`);let s=this.#x(e,r),o=null,i=(...a)=>{if(o===null){let c=this.#p(this.artifacts.plan.imports[n].type,`import '${yt(e)}'`);o=this.#E(e,c,s)}return o(...a)};return et(s)?oe(i):i}#k(e,n,r){let s=e.path.length===0?r:Mc(r,[],[rt(e.leaf),e.leaf]);if(s===void 0)throw new E(`host import '${yt(e)}': the component imports the resource type '${e.leaf}'; provide the implementing class as '${rt(e.leaf)}'`);let o=new Ds(rt(e.leaf));return this.#y.push({importIndex:n,registry:o,cls:s}),Md({name:e.leaf,dtor:i=>o.dtor(i)})}#y;#x(e,n){let r=e.member;if(r.form==="plain"){let i=e.path.length===0?n:Mc(n,[],[J(r.name),r.name]);if(typeof i!="function")throw new E(`host import '${yt(e)}' missing or not a function (got ${On(i)}); expected '${J(r.name)}'`);let a=e.path.length===0?void 0:n,c=l=>i.apply(a,l);return et(i)?oe(c):c}let s=rt(r.resource),o=e.path.length===0?n:Mc(n,[],[s,r.resource]);if(o===void 0)throw new E(`host import '${yt(e)}': no class '${s}' provided`);switch(r.form){case"constructor":return i=>new o(...i);case"method":{let i=rg(o?.prototype,J(r.member)),a=c=>{let[l,...u]=c,f=l?.[J(r.member)];if(typeof f!="function")throw new ke(`host import '${yt(e)}': the ${s} instance has no method '${J(r.member)}'`);return f.apply(l,u)};return et(i)?oe(a):a}case"static":{let i=o[J(r.member)];if(typeof i!="function")throw new E(`host import '${yt(e)}': ${s} has no static '${J(r.member)}'`);let a=c=>i.apply(o,c);return et(i)?oe(a):a}}}#E(e,n,r){let s=`import '${yt(e)}'`,o=this.#f(s),i=n.results.length===0?null:n.results[0],a=i!==null&&i.kind==="result",c=u=>{if(i!==null){if(a){let f=i;return{ok:f.ok===null?null:Se(u,f.ok,o)}}return Se(u,i,o)}},l=(u,f)=>{if(ir(u)&&a){let w=i;return{error:w.error===null?null:Se(u.payload,w.error,o)}}if(og(f),ar(u))throw u;if(ir(u))throw new ke(`${s} threw a ComponentException, but its WIT type has no err side; only a fallible import may signal an error value`);let d=Nt();throw new ke(`${s} threw ${ig(u)}. An unbranded throw from a host import is a host bug and becomes a trap: signal a WIT error with \`throw new ComponentException(payload)\`.`+(d===""?"":` (${d} \u2014 an error carrying no deltic brand in a multi-copy graph usually means a pre-A9 runtime copy threw it, issue #83.)`))};return(...u)=>{let f=new Cr,d=n.params.map((y,x)=>Ie(u[x],y,o,f)),w;try{w=r(d)}catch(y){return f.end(),l(y,d)}return sg(w)?i!==null&&i.kind==="future"?(f.end(),c(w)):w.then(y=>(f.end(),c(y)),y=>(f.end(),l(y,d))):(f.end(),c(w))}}buildExports(e){this.#o=!0;let n={},r=[];for(let s of this.artifacts.plan.exports)s.kind==="instance"?n[s.name]=this.#w(s.name,s.exports,e.exports[s.name]):r.push(s);return r.length>0&&Object.assign(n,this.#w("",r,e.exports)),n}#w(e,n,r){let s={},o=new Map,i=(u,f)=>{let d=o.get(u);if(d!==void 0)throw new Ln(`export '${e||""}': the leaves '${d}' and '${f}' both map to the JS name '${u}'. Rename one in the WIT; the conventions layer will not guess which one wins.`);return o.set(u,f),u},a=new Map,c=new Map,l=u=>{let f=a.get(u);return f===void 0&&(f={name:u,ctor:null,ctorParams:null,methods:[],statics:[]},a.set(u,f)),f};for(let u of n){if(u.kind==="type"){if(u.type.kind==="resource"){let x=this.loaded.resourceTokens[u.type.resource];if(x!==void 0&&this.#n.has(x)){let v=this.#n.get(x),b=this.#t.get(v);b===void 0?this.#t.set(v,{kind:"guest",name:u.name}):b.kind==="guest"&&(b.name=u.name)}}continue}if(u.kind==="instance")throw new E(`export '${e||""}/${u.name}': nested instance exports are not surfaced by the conventions layer (only one level of interface nesting exists in plan v2)`);if(u.kind!=="lifted-func")throw new E(`export '${e||""}/${u.name}': unsupported export kind '${u.kind}'`);let f=r[u.name];if(typeof f!="function")throw new E(`export '${e||""}/${u.name}': the runtime produced no callable for this lifted function`);let d=this.#p(u.type,`export '${e}/${u.name}'`),w=Os(u.name),y=e===""?u.name:`${e}#${u.name}`;switch(w.form){case"plain":s[i(J(w.name),w.name)]=this.#b(f,d,y);break;case"constructor":{let x=l(w.resource);x.ctor=f[ui]??f,x.ctorParams=d.params,fp(d.results[0],c,w.resource);break}case"method":{l(w.resource).methods.push({member:w.member,raw:f,params:d.params,results:d.results}),fp(d.params[0],c,w.resource);break}case"static":{l(w.resource).statics.push({member:w.member,raw:f,params:d.params,results:d.results});break}}}for(let[u,f]of a){let d=c.get(u);if(d===void 0)throw new E(`export '${e}': resource '${u}' has leaves but no own/borrow type to identify it by`);let w=Lc(f,d,(x,v,b,m,g)=>this.#b(x,{params:v,results:b},m)(...g),(x,v,b)=>x.map((m,g)=>Se(m,v[g],this.#f(b))));s[i(rt(u),u)]=w;let y=this.#n.get(d);y!==void 0&&this.#t.set(y,{kind:"guest",name:u,cls:w})}return s}#g(e,n,r){let s=[],o=this.#r;this.#r=s;let i;try{i=e.map((c,l)=>Se(n[l],c,r))}catch(c){for(let l of s)l();throw c}finally{this.#r=o}let a=!1;return{lowered:i,release:()=>{if(!a){a=!0;for(let c of s)c()}}}}#b(e,n,r){let s=this.#f(r),o=n.results.length===0?null:n.results[0];if(o!==null&&o.kind==="future"){let i=o.element;return(...a)=>{if(a.length!==n.params.length)throw new TypeError(`${r}: expected ${n.params.length} argument(s), got ${a.length}`);let{lowered:c,release:l}=this.#g(n.params,a,s),u;try{u=Promise.resolve(e(...c))}catch(f){throw l(),f}return u.then(l,l),At.deferred(u,Qw(i,s))}}return async(...i)=>{if(i.length!==n.params.length)throw new TypeError(`${r}: expected ${n.params.length} argument(s), got ${i.length}`);let{lowered:a,release:c}=this.#g(n.params,i,s),l;try{l=await e(...a)}finally{c()}if(o!==null){if(o.kind==="result"){let u=l;if("error"in u)throw new j(o.error===null?void 0:Ie(u.error,o.error,s));return o.ok===null?void 0:Ie(u.ok,o.ok,s)}return Ie(l,o,s)}}}};function fp(t,e,n){t!==void 0&&(t.kind==="own"||t.kind==="borrow")&&e.set(n,t.rt)}function yt(t){return t.path.length===0?t.interfaceId:`${t.interfaceId}/${t.path.join("/")}`}function ng(t,e,n){let r=t[e]??={};for(let s of n)r=r[s]??={};return r}function Mc(t,e,n){let r=t;for(let s of e){if(r===null||typeof r!="object")return;r=r[s]}if(r===null||typeof r!="object")return n.length===0?r:void 0;for(let s of n){let o=r[s];if(o!==void 0)return o}}function rg(t,e){for(let n=t;n!==null&&(typeof n=="object"||typeof n=="function");n=Object.getPrototypeOf(n)){let r=Object.getOwnPropertyDescriptor(n,e);if(r!==void 0)return"value"in r?r.value:void 0}}function sg(t){return t!==null&&typeof t=="object"&&"then"in t&&typeof t.then=="function"}function og(t){for(let e of t)if(e instanceof st||e instanceof At)try{e.dropForTeardown()}catch{}}function ig(t){return t instanceof Error?`${t.name}: ${t.message}`:On(t)}Ro({url:bn,runtimeVersion:Sa,protocolGeneration:Ao});var ag=new Set(["a","button","div","footer","h1","header","input","label","li","section","span","strong","ul"]),cg=new Set(["class","id"]),lg={input:new Set(["type","placeholder"]),label:new Set(["for"]),a:new Set(["href"])},ug=/^#(\/[a-z-]*)?$/,fg=new Set(["click","dblclick","input","change","keydown","blur"]);function Ri(t){if(!ag.has(t))throw new Error(`surface: tag <${t}> is not in the allowlist`)}function Wc(t,e){if(!(cg.has(e)||lg[t]?.has(e)))throw new Error(`surface: attribute '${e}' is not allowed on <${t}>`)}function Pi(t,e,n){switch(Wc(t,e),`${t} ${e}`){case"input type":if(n!=="text"&&n!=="checkbox")throw new Error(`surface: input type '${n}' is not allowed`);return;case"a href":if(!ug.test(n))throw new Error(`surface: href '${n}' rejected (fragment routes only)`);return;default:return}}function Li(t){if(!fg.has(t))throw new Error(`surface: event kind '${t}' is not in the allowlist`)}function Ni(t,e){let n="#text";class r{rep;tag;isRoot=!1;constructor(l){Ri(l),this.tag=l,this.rep=t.create(l)}setAttribute(l,u){s(this,"set-attribute"),Pi(this.tag,l,u),t.attr(this.rep,l,u)}removeAttribute(l){s(this,"remove-attribute"),Wc(this.tag,l),t.attr(this.rep,l,null)}appendChild(l){s(this,"append-child"),t.append(this.rep,l.rep)}before(l){t.before(this.rep,l.rep)}after(l){t.after(this.rep,l.rep)}remove(){t.remove(this.rep)}setTextContent(l){t.text(this.rep,l)}setValue(l){o(this,"set-value"),t.value(this.rep,l)}setChecked(l){o(this,"set-checked"),t.checked(this.rep,l)}focus(){s(this,"focus"),t.focus(this.rep)}[Symbol.dispose](){this.isRoot||t.free(this.rep)}}function s(c,l){if(c.tag===n)throw new Error(`surface: ${l} is not valid on a text node`)}function o(c,l){if(c.tag!=="input")throw new Error(`surface: ${l} is only valid on , not <${c.tag}>`)}function i(){let c=Object.create(r.prototype);return c.rep=t.root,c.tag="div",c.isRoot=!0,c}function a(c){let l=Object.create(r.prototype);return l.rep=t.textNode(c),l.tag=n,l.isRoot=!1,l}return{imports:{"polymorph:todomvc-spike/dom@0.0.1":{Element:r,createElement:c=>new r(c),createTextNode:c=>a(c)},"polymorph:todomvc-spike/events@0.0.1":{listen:(c,l,u)=>{if(c.tag===n)throw new Error("surface: listen is not valid on a text node");Li(l),t.listen(c.rep,l,u)}},"polymorph:todomvc-spike/shell@0.0.1":{root:()=>i(),route:e}},flush:()=>t.flush(),drain:()=>t.drain()}}function Oi(t,e,n,r){t.addEventListener(e,s=>{let o={token:n,kind:e};if(e==="keydown"){let a=s.key;o.key=a,a==="Enter"&&s.preventDefault()}let i=s.currentTarget;i&&typeof i.value=="string"&&(o.value=i.value),i&&i.type==="checkbox"&&(o.checked=i.checked),r(o)})}function dp(t,e){return{root:t,create:n=>document.createElement(n),textNode:n=>document.createTextNode(n),attr:(n,r,s)=>{let o=n;s===null?o.removeAttribute(r):o.setAttribute(r,s)},append:(n,r)=>n.appendChild(r),before:(n,r)=>n.before(r),after:(n,r)=>n.after(r),remove:n=>{n!==t&&n.remove()},text:(n,r)=>{n.textContent=r},value:(n,r)=>{n.value=r},checked:(n,r)=>{n.checked=r},focus:n=>n.focus(),listen:(n,r,s)=>Oi(n,r,s,e),free:()=>{},flush:()=>{},drain:()=>Promise.resolve()}}function _i(t){let e=1,n=[],r=o=>{n.push(o)},s=o=>o;return{root:0,create:o=>{let i=e++;return r(["create",i,o]),i},textNode:o=>{let i=e++;return r(["textnode",i,o]),i},attr:(o,i,a)=>r(["attr",s(o),i,a]),append:(o,i)=>r(["append",s(o),s(i)]),before:(o,i)=>r(["before",s(o),s(i)]),after:(o,i)=>r(["after",s(o),s(i)]),remove:o=>r(["remove",s(o)]),text:(o,i)=>r(["text",s(o),i]),value:(o,i)=>r(["value",s(o),i]),checked:(o,i)=>r(["checked",s(o),i]),focus:o=>r(["focus",s(o)]),listen:(o,i,a)=>r(["listen",s(o),i,a]),free:o=>r(["free",s(o)]),flush:()=>{if(n.length===0)return;let o=n;n=[],t(o)},drain:()=>Promise.resolve()}}function Di(t,e){let n=new Map([[0,t]]),r=i=>{let a=n.get(i);if(!a)throw new Error(`applier: unknown node ${i}`);return a},s=i=>{let a=r(i);if(!(a instanceof Element))throw new Error(`applier: node ${i} is not an element`);return a};function o(i){for(let a of i)switch(a[0]){case"create":{Ri(a[2]),n.set(a[1],document.createElement(a[2]));break}case"textnode":n.set(a[1],document.createTextNode(a[2]));break;case"attr":{let[,c,l,u]=a,f=s(c);u===null?f.removeAttribute(l):(Pi(f.tagName.toLowerCase(),l,u),f.setAttribute(l,u));break}case"append":s(a[1]).appendChild(r(a[2]));break;case"before":r(a[1]).before(r(a[2]));break;case"after":r(a[1]).after(r(a[2]));break;case"remove":a[1]!==0&&r(a[1]).remove();break;case"text":r(a[1]).textContent=a[2];break;case"value":s(a[1]).value=a[2];break;case"checked":s(a[1]).checked=a[2];break;case"focus":s(a[1]).focus();break;case"listen":{Li(a[2]),Oi(s(a[1]),a[2],a[3],e);break}case"free":a[1]!==0&&n.delete(a[1]);break;default:throw new Error(`applier: unknown op ${JSON.stringify(a)}`)}}return{apply:o}}function pp(t,e){let{port1:n,port2:r}=new MessageChannel,s=Di(t,c=>r.postMessage({t:"event",ev:c}));r.onmessage=c=>{c.data.t==="ops"?s.apply(c.data.ops):c.data.t==="drain"&&r.postMessage({t:"drained",id:c.data.id})};let o=new Map,i=0;return n.onmessage=c=>{c.data.t==="event"?e(c.data.ev):c.data.t==="drained"&&(o.get(c.data.id)?.(),o.delete(c.data.id))},{..._i(c=>n.postMessage({t:"ops",ops:c})),drain:()=>new Promise(c=>{let l=i++;o.set(l,c),n.postMessage({t:"drain",id:l})})}}function Kc(t,e,n){switch(t){case"direct":return dp(e,n);case"queued":{let r=Di(e,n);return _i(s=>r.apply(structuredClone(s)))}case"channel":return pp(e,n)}}function Hc(t){let e=Promise.resolve(),n=0,r=Promise.resolve(),s=null;return{call:i=>{n++;let a=e.then(()=>r).then(i).then(c=>(t.flush(),c),c=>{throw t.flush(),c});return e=a.catch(()=>{}),a},settle:async()=>{await e,await t.drain()},get generation(){return n},pause(){s||(r=new Promise(i=>{s=i}))},resume(){s?.(),s=null,r=Promise.resolve()}}}function dg(){function t(u,f){return function(w){n(f,"addInitializer"),r(w,"An initializer"),u.push(w)}}function e(u,f,d,w,y,x,v,b,m){var g;switch(y){case 1:g="accessor";break;case 2:g="method";break;case 3:g="getter";break;case 4:g="setter";break;default:g="field"}var k={kind:g,name:v?"#"+f:f,static:x,private:v,metadata:b},T={v:!1};k.addInitializer=t(w,T);var S,$;if(y===0?v?(S=d.get,$=d.set):(S=function(){return this[f]},$=function(P){this[f]=P}):y===2?S=function(){return d.value}:((y===1||y===3)&&(S=function(){return d.get.call(this)}),(y===1||y===4)&&($=function(P){d.set.call(this,P)})),v)k.access=S&&$?{get:S,set:$}:S?{get:S}:{set:$};else{if(S){var N=S;S=function(P){return arguments.length===0&&(P=this),N.call(P)}}if($){var _=$;$=function(P,z){return arguments.length===1&&(z=P,P=this),_.call(P,z)}}var R=function(P){return f in P};k.access=S&&$?{has:R,get:S,set:$}:S?{has:R,get:S}:{has:R,set:$}}try{return u(m,k)}finally{T.v=!0}}function n(u,f){if(u.v)throw new Error("attempted to call "+f+" after decoration was finished")}function r(u,f){if(typeof u!="function")throw new TypeError(f+" must be a function")}function s(u,f){var d=typeof f;if(u===1){if(d!=="object"||f===null)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");f.get!==void 0&&r(f.get,"accessor.get"),f.set!==void 0&&r(f.set,"accessor.set"),f.init!==void 0&&r(f.init,"accessor.init")}else if(d!=="function"){var w;throw u===0?w="field":u===10?w="class":w="method",new TypeError(w+" decorators must return a function or void 0")}}function o(u,f,d,w,y,x,v,b,m){var g=d[0],k,T,S;v?y===0||y===1?k={get:d[3],set:d[4]}:y===3?k={get:d[3]}:y===4?k={set:d[3]}:k={value:d[3]}:y!==0&&(k=Object.getOwnPropertyDescriptor(f,w)),y===1?S={get:k.get,set:k.set}:y===2?S=k.value:y===3?S=k.get:y===4&&(S=k.set);var $,N,_;if(typeof g=="function")$=e(g,w,k,b,y,x,v,m,S),$!==void 0&&(s(y,$),y===0?T=$:y===1?(T=$.init,N=$.get||S.get,_=$.set||S.set,S={get:N,set:_}):S=$);else for(var R=g.length-1;R>=0;R--){var P=g[R];if($=e(P,w,k,b,y,x,v,m,S),$!==void 0){s(y,$);var z;y===0?z=$:y===1?(z=$.init,N=$.get||S.get,_=$.set||S.set,S={get:N,set:_}):S=$,z!==void 0&&(T===void 0?T=z:typeof T=="function"?T=[T,z]:T.push(z))}}if(y===0||y===1){if(T===void 0)T=function(O,ye){return ye};else if(typeof T!="function"){var xt=T;T=function(O,ye){for(var Xt=ye,rr=0;rr3,$=k>=5,N,_;if($?(N=u,k=k-5,x=x||[],_=x):(N=u.prototype,y=y||[],_=y),k!==0&&!S){var R=$?b:v,P=R.get(T)||0;if(P===!0||P===3&&k!==4||P===4&&k!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+T);!P&&k>2?R.set(T,k):R.set(T,!0)}o(w,N,g,T,k,$,S,_,d)}}return a(w,y),a(w,x),w}function a(u,f){f&&u.push(function(d){for(var w=0;w0){for(var w=[],y=u,x=u.name,v=f.length-1;v>=0;v--){var b={v:!1};try{var m=f[v](y,{kind:"class",name:x,addInitializer:t(w,b),metadata:d})}finally{b.v=!0}m!==void 0&&(s(10,m),y=m)}return[l(y,d),function(){for(var g=0;g!0,n=()=>Promise.resolve()){hp(this),this.#e=e,this.#t=n}static timer(e,n){let r,s=()=>r??=new Promise(o=>{let i=Number(e-n())/1e6;setTimeout(o,Math.min(Math.max(0,i),pg))}).then(()=>{r=void 0});return new t(()=>n()>=e,s)}ready(){return this.#e()}block(){if(!this.#e())return(async()=>{for(;!this.#e();)await this.#t()})()}waitPromise(){return this.#t()}};we(wt.prototype,va);var hg=oe(t=>{if(t.length===0)throw new Error("wasi:io/poll.poll: empty pollable list");let e=()=>{let r=[];for(let s=0;s0?n:(async()=>{for(;;){await Promise.race(t.map(s=>s.waitPromise()));let r=e();if(r.length>0)return r}})()});xp=Symbol.dispose;var Ws=class{static{({e:[mp]}=Pr(this,[[oe,2,"blockingRead"],[oe,2,"blockingSkip"]],[]))}#e;#t=(mp(this),0);#n=!1;constructor(e=new Uint8Array(0)){this.#e=e}read(e){if(this.#n)throw Bn();let n=Math.max(0,Math.min(Number(e),this.#e.length-this.#t)),r=this.#e.slice(this.#t,this.#t+n);return this.#t+=n,r}blockingRead(e){return this.read(e)}skip(e){return BigInt(this.read(e).length)}blockingSkip(e){return this.skip(e)}subscribe(){return new wt}[xp](){this.#n=!0}};Ep=Symbol.dispose;var Rr=class{static{({e:[yp]}=Pr(this,[[oe,2,"blockingWriteAndFlush"],[oe,2,"blockingFlush"],[oe,2,"blockingWriteZeroesAndFlush"],[oe,2,"blockingSplice"]],[]))}#e;#t=(yp(this),!1);constructor(e){this.#e=e}checkWrite(){if(this.#t)throw Bn();return 65536n}write(e){if(this.#t)throw Bn();this.#e(e)}blockingWriteAndFlush(e){this.write(e)}flush(){if(this.#t)throw Bn()}blockingFlush(){this.flush()}subscribe(){return new wt}writeZeroes(e){this.write(new Uint8Array(Number(e)))}blockingWriteZeroesAndFlush(e){this.writeZeroes(e)}splice(e,n){let r=e.read(n);return this.write(r),BigInt(r.length)}blockingSplice(e,n){return this.splice(e,n)}[Ep](){this.#t=!0}},Sp=65536;vp=Symbol.dispose;var bp=class{static{({e:[wp]}=Pr(this,[[oe,2,"blockingRead"],[oe,2,"blockingSkip"]],[]))}#e=(wp(this),[]);#t=0;#n=!1;#s;#r=!1;#o;#i=()=>{};#a;#c=()=>{};constructor(e,n=Sp){this.#o=n,this.#a=new Promise(r=>this.#i=r),this.#u(e)}#l(){let e=this.#i;this.#a=new Promise(n=>this.#i=n),e()}async#u(e){try{for await(let n of e){if(this.#r)return;if(n.length!==0)for(this.#e.push(n),this.#t+=n.length,this.#l();this.#t>=this.#o&&!this.#r;)await new Promise(r=>this.#c=r)}this.#n=!0}catch(n){this.#s=n,this.#n=!0}this.#l()}#f(e){let n=new Uint8Array(Math.min(e,this.#t)),r=0;for(;r0)return this.#f(Number(e));if(this.#s!==void 0)throw new j({kind:"last-operation-failed",value:this.#s instanceof Mn?this.#s:new Mn(this.#s instanceof Error?this.#s.message:String(this.#s))});if(this.#n)throw Bn();return new Uint8Array(0)}blockingRead(e){return this.#t>0||this.#n||this.#r?this.read(e):(async()=>{for(;this.#t===0&&!this.#n&&!this.#r;)await this.#a;return this.read(e)})()}skip(e){return BigInt(this.read(e).length)}blockingSkip(e){let n=this.blockingRead(e);return n instanceof Uint8Array?BigInt(n.length):n.then(r=>BigInt(r.length))}subscribe(){return new wt(()=>this.#t>0||this.#n||this.#r,()=>this.#a)}[vp](){this.#r=!0,this.#c(),this.#l()}};Tp=Symbol.dispose;var kp=class{static{({e:[gp]}=Pr(this,[[oe,2,"blockingFlush"],[oe,2,"blockingWriteAndFlush"],[oe,2,"blockingWriteZeroesAndFlush"],[oe,2,"blockingSplice"]],[]))}#e;#t;#n=(gp(this),0);#s=!1;#r;#o=Promise.resolve();#i=()=>{};#a;constructor(e,n=Sp){this.#e=e,this.#t=n,this.#a=new Promise(r=>this.#i=r)}#c(){let e=this.#i;this.#a=new Promise(n=>this.#i=n),e()}#l(){if(this.#s)throw Bn();if(this.#r!==void 0)throw new j({kind:"last-operation-failed",value:this.#r instanceof Mn?this.#r:new Mn(this.#r instanceof Error?this.#r.message:String(this.#r))})}checkWrite(){return this.#l(),BigInt(Math.max(0,this.#t-this.#n))}write(e){if(this.#l(),e.length>this.#t-this.#n)throw new Error("wasi:io/streams.write: contents exceed the check-write permit");this.#n+=e.length,this.#o=this.#o.then(async()=>{try{this.#r===void 0&&await this.#e(e)}catch(n){this.#r=n}finally{this.#n-=e.length,this.#c()}})}flush(){this.#l()}blockingFlush(){if(this.#l(),this.#n!==0)return(async()=>{for(;this.#n>0&&this.#r===void 0;)await this.#a;this.#l()})()}blockingWriteAndFlush(e){return this.write(e),this.blockingFlush()}subscribe(){return new wt(()=>this.#s||this.#r!==void 0||this.#nthis.#a)}writeZeroes(e){this.write(new Uint8Array(Number(e)))}blockingWriteZeroesAndFlush(e){return this.blockingWriteAndFlush(new Uint8Array(Number(e)))}splice(e,n){let r=e.read(n);return this.write(r),BigInt(r.length)}blockingSplice(e,n){let r=this.splice(e,n),s=this.blockingFlush();return s===void 0?r:s.then(()=>r)}[Tp](){this.#s=!0,this.#c()}};function $p(){return{imports:{"wasi:io/error@0.2":{Error:Mn},"wasi:io/poll@0.2":{Pollable:wt,poll:hg},"wasi:io/streams@0.2":{InputStream:Ws,OutputStream:Rr}}}}var Ht=class extends Error{ok;code;constructor(e,n){super(`wasi:cli/exit#exit(${e?"success":"failure"}${n===void 0?"":`, code ${n}`})`),this.ok=e,this.code=n,this.name="ExitError"}};we(Ht.prototype,Ta);var Lr=class{},Nr=class{};function Fi(t){let e=t.reduce((s,o)=>s+o.length,0),n=new Uint8Array(e),r=0;for(let s of t)n.set(s,r),r+=s.length;return n}function Ip(t={}){let e=[],n=[],r=t.passthrough??!1,s=!1,o,i,a=new Rr(d=>{e.push(d),r&&console.log(new TextDecoder().decode(d))}),c=new Rr(d=>{n.push(d),r&&console.error(new TextDecoder().decode(d))}),l={stdout:()=>Fi(e),stderr:()=>Fi(n),stdoutText:()=>new TextDecoder().decode(Fi(e)),stderrText:()=>new TextDecoder().decode(Fi(n)),exited:()=>s,exitOk:()=>o,exitCode:()=>i},u=(d,w)=>async y=>{for await(let x of y){let v=x instanceof Uint8Array?x:Uint8Array.from(x);d.push(v),w?.(new TextDecoder().decode(v))}return{kind:"ok"}};return{imports:{"wasi:cli/environment@0.2":{getEnvironment:()=>Object.entries(t.env??{}),getArguments:()=>t.args??[],initialCwd:()=>t.cwd},"wasi:cli/exit@0.2":{exit:d=>{if(s=!0,o=d.kind==="ok",t.throwOnExit)throw new Ht(o)}},"wasi:cli/stdin@0.2":{getStdin:()=>new Ws(t.stdinBuffer)},"wasi:cli/stdout@0.2":{getStdout:()=>a},"wasi:cli/stderr@0.2":{getStderr:()=>c},"wasi:cli/terminal-input@0.2":{TerminalInput:Lr},"wasi:cli/terminal-output@0.2":{TerminalOutput:Nr},"wasi:cli/terminal-stdin@0.2":{getTerminalStdin:()=>{}},"wasi:cli/terminal-stdout@0.2":{getTerminalStdout:()=>{}},"wasi:cli/terminal-stderr@0.2":{getTerminalStderr:()=>{}},"wasi:cli/types@0.3":{},"wasi:cli/environment@0.3":{getEnvironment:()=>Object.entries(t.env??{}),getArguments:()=>t.args??[],getInitialCwd:()=>t.cwd},"wasi:cli/exit@0.3":{exit:d=>{if(s=!0,o=d.kind==="ok",t.throwOnExit)throw new Ht(o)},exitWithCode:d=>{if(s=!0,o=d===0,i=d,t.throwOnExit)throw new Ht(o)}},"wasi:cli/stdin@0.3":{readViaStream:()=>[t.stdinBuffer===void 0?[]:[t.stdinBuffer],Promise.resolve({kind:"ok"})]},"wasi:cli/stdout@0.3":{writeViaStream:u(e,r?d=>console.log(d):void 0)},"wasi:cli/stderr@0.3":{writeViaStream:u(n,r?d=>console.error(d):void 0)},"wasi:cli/terminal-input@0.3":{TerminalInput:Lr},"wasi:cli/terminal-output@0.3":{TerminalOutput:Nr},"wasi:cli/terminal-stdin@0.3":{getTerminalStdin:()=>{}},"wasi:cli/terminal-stdout@0.3":{getTerminalStdout:()=>{}},"wasi:cli/terminal-stderr@0.3":{getTerminalStderr:()=>{}}},captured:l}}function Ap(t){return new Promise(e=>setTimeout(e,Math.max(0,t)))}function Cp(t={}){let e=t.now??(()=>BigInt(Math.round(performance.now()*1e6))),n=1000n;return{imports:{"wasi:clocks/monotonic-clock@0.2":{now:e,resolution:()=>n,subscribeInstant:a=>wt.timer(a,e),subscribeDuration:a=>wt.timer(e()+a,e)},"wasi:clocks/wall-clock@0.2":{now:()=>{let a=Date.now();return{seconds:BigInt(Math.floor(a/1e3)),nanoseconds:a%1e3*1e6}},resolution:()=>({seconds:0n,nanoseconds:1e6})},"wasi:clocks/monotonic-clock@0.3":{now:e,getResolution:()=>n,waitUntil:async a=>{let c=a-e();await Ap(Number(c)/1e6)},waitFor:async a=>{await Ap(Number(a)/1e6)}},"wasi:clocks/system-clock@0.3":{now:()=>{let a=Date.now();return{seconds:BigInt(Math.floor(a/1e3)),nanoseconds:a%1e3*1e6}},getResolution:()=>1000000n},"wasi:clocks/types@0.3":{}}}}var zc=class{constructor(){throw new TypeError("wasi:filesystem/types.descriptor is never constructed by this shim (preopens#get-directories always returns [] \u2014 CONTRACT: contracts/embedder-api.md 'WASI examination' filesystem scope calls the type 'constructible-never')")}#e(e){throw new TypeError(`wasi:filesystem/types#[method]descriptor.${e}: unreachable \u2014 no descriptor instance can exist (preopens is empty)`)}getFlags(){return this.#e("get-flags")}getType(){return this.#e("get-type")}stat(){return this.#e("stat")}statAt(){return this.#e("stat-at")}openAt(){return this.#e("open-at")}readViaStream(){return this.#e("read-via-stream")}writeViaStream(){return this.#e("write-via-stream")}appendViaStream(){return this.#e("append-via-stream")}metadataHashAt(){return this.#e("metadata-hash-at")}},Vc=class{};function Rp(){return{imports:{"wasi:filesystem/types@0.2":{Descriptor:zc,DirectoryEntryStream:Vc,filesystemErrorCode:t=>{}},"wasi:filesystem/preopens@0.2":{getDirectories:()=>[]}}}}function mg(t){let e=new Uint8Array(Number(t));for(let n=0;n{let n=t(Number(e));if(n.length!==Number(e))throw new TypeError(`random source returned ${n.length} bytes, need exactly ${e} (the @0.2 WIT permits no short reads)`);return n}}function wg(t){return()=>{let e=t(8n);return new DataView(e.buffer,e.byteOffset,8).getBigUint64(0,!0)}}var gg=[0n,1n];function Pp(t={}){let e=t.insecureSeed??gg,n=yg(t.source),r=wg(n),s={getRandomBytes:n,getRandomU64:r},o={getInsecureRandomBytes:n,getInsecureRandomU64:r},i={insecureSeed:()=>e};return{imports:{"wasi:random/random@0.2":s,"wasi:random/insecure@0.2":o,"wasi:random/insecure-seed@0.2":i,"wasi:random/random@0.3":s,"wasi:random/insecure@0.3":o,"wasi:random/insecure-seed@0.3":i}}}function Lp(t={}){let e=Ip(t.cli),n={...e.imports,...$p().imports,...Cp(t.clocks).imports,...Pp(t.random).imports,...Rp().imports};return Object.assign(n,{captured:e.captured})}var bg="0.3",kg={kind:"ok"};function Un(t,e){return new j(t,`wasi:http: ${e}`)}function Wn(t,e){return new j({kind:t},`wasi:http/types: ${e}`)}function Np(t){let e=t instanceof Error?t.message:String(t),n=[];for(let s=t;s instanceof Error;s=s.cause)n.push(s.message);let r=n.join(" | ").toLowerCase();return e=n[0]??e,r.includes("refused")?{kind:"connection-refused"}:r.includes("dns error")||r.includes("name not resolved")||r.includes("getaddrinfo")?{kind:"DNS-error",value:{rcode:void 0,infoCode:void 0}}:r.includes("timed out")||r.includes("timeout")?{kind:"connection-timeout"}:r.includes("tls")||r.includes("certificate")||r.includes("ssl")?{kind:"TLS-protocol-error"}:r.includes("reset")?{kind:"connection-terminated"}:{kind:"internal-error",value:e}}async function xg(t){let e=[],n=0;for await(let o of t){let i=o instanceof Uint8Array?o:Uint8Array.from(o);e.push(i),n+=i.length}let r=new Uint8Array(n),s=0;for(let o of e)r.set(o,s),s+=o.length;return r}var Bi=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Jc(t){return!t.some(e=>e===0||e===10||e===13)}var Eg=new TextEncoder,vg=new TextDecoder;function Op(t={}){let e=t.onCall??(()=>{}),n=t.version??bg;class r{entries=[];mutable=!0;constructor(){e("fields.constructor")}static fromList(m){e("fields.from-list");let g=o([],!0);for(let[k,T]of m){if(!Bi.test(k))throw Wn("invalid-syntax",`from-list: invalid field name ${JSON.stringify(k)}`);if(!Jc(T))throw Wn("invalid-syntax",`from-list: invalid value for ${JSON.stringify(k)}`);g.entries.push([k,T.slice()])}return g}get(m){e("fields.get");let g=m.toLowerCase();return this.entries.filter(([k])=>k.toLowerCase()===g).map(([,k])=>k.slice())}has(m){e("fields.has");let g=m.toLowerCase();return this.entries.some(([k])=>k.toLowerCase()===g)}set(m,g){if(e("fields.set"),s(this,"fields.set"),!Bi.test(m))throw Wn("invalid-syntax",`set: invalid field name ${JSON.stringify(m)}`);for(let T of g)if(!Jc(T))throw Wn("invalid-syntax",`set: invalid value for ${JSON.stringify(m)}`);let k=m.toLowerCase();this.entries=this.entries.filter(([T])=>T.toLowerCase()!==k);for(let T of g)this.entries.push([m,T.slice()])}delete(m){e("fields.delete"),s(this,"fields.delete");let g=m.toLowerCase();this.entries=this.entries.filter(([k])=>k.toLowerCase()!==g)}getAndDelete(m){e("fields.get-and-delete"),s(this,"fields.get-and-delete");let g=m.toLowerCase(),k=this.entries.filter(([T])=>T.toLowerCase()===g).map(([,T])=>T);return this.entries=this.entries.filter(([T])=>T.toLowerCase()!==g),k}append(m,g){if(e("fields.append"),s(this,"fields.append"),!Bi.test(m))throw Wn("invalid-syntax",`append: invalid field name ${JSON.stringify(m)}`);if(!Jc(g))throw Wn("invalid-syntax",`append: invalid value for ${JSON.stringify(m)}`);this.entries.push([m,g.slice()])}copyAll(){return e("fields.copy-all"),this.entries.map(([m,g])=>[m,g.slice()])}clone(){return e("fields.clone"),o(this.entries.map(([m,g])=>[m,g.slice()]),!0)}[Symbol.dispose](){}}function s(b,m){if(!b.mutable)throw Wn("immutable",`${m}: these fields are immutable`)}function o(b,m){let g=Object.create(r.prototype);return g.entries=b,g.mutable=m,g}function i(b){let m=[];return b.forEach((g,k)=>m.push([k,Eg.encode(g)])),o(m,!1)}class a{connectTimeout;firstByteTimeout;betweenBytesTimeout;mutable=!0;constructor(){e("request-options.constructor")}getConnectTimeout(){return e("request-options.get-connect-timeout"),this.connectTimeout}setConnectTimeout(m){throw e("request-options.set-connect-timeout"),c(this,"set-connect-timeout"),new j({kind:"not-supported"},"wasi:http/types: set-connect-timeout: fetch exposes no connect phase")}getFirstByteTimeout(){return e("request-options.get-first-byte-timeout"),this.firstByteTimeout}setFirstByteTimeout(m){e("request-options.set-first-byte-timeout"),c(this,"set-first-byte-timeout"),this.firstByteTimeout=m}getBetweenBytesTimeout(){return e("request-options.get-between-bytes-timeout"),this.betweenBytesTimeout}setBetweenBytesTimeout(m){e("request-options.set-between-bytes-timeout"),c(this,"set-between-bytes-timeout"),this.betweenBytesTimeout=m}clone(){e("request-options.clone");let m=Object.create(a.prototype);return m.connectTimeout=this.connectTimeout,m.firstByteTimeout=this.firstByteTimeout,m.betweenBytesTimeout=this.betweenBytesTimeout,m.mutable=!0,m}[Symbol.dispose](){}}function c(b,m){if(!b.mutable)throw new j({kind:"immutable"},`wasi:http/types: ${m}: this request-options is immutable`)}class l{method={kind:"get"};pathWithQuery;scheme;authority;headers;contents;trailers;options;settleTransmission;consumed=!1;sent=!1;constructor(){}static new(m,g,k,T){e("request.new");let S=new l;S.headers=m,m.mutable=!1,S.contents=g,S.trailers=k,S.options=T,T!==void 0&&(T.mutable=!1);let $=new Promise(N=>{S.settleTransmission=N});return[S,$]}getMethod(){return e("request.get-method"),this.method}setMethod(m){if(e("request.set-method"),m.kind==="other"&&!Bi.test(m.value))throw new j(null,"wasi:http/types: set-method: invalid method token");this.method=m}getPathWithQuery(){return e("request.get-path-with-query"),this.pathWithQuery}setPathWithQuery(m){if(e("request.set-path-with-query"),m!==void 0&&/[ \t\r\n#]/.test(m))throw new j(null,"wasi:http/types: set-path-with-query: invalid path");this.pathWithQuery=m}getScheme(){return e("request.get-scheme"),this.scheme}setScheme(m){if(e("request.set-scheme"),m?.kind==="other"&&!/^[A-Za-z][A-Za-z0-9+.-]*$/.test(m.value))throw new j(null,"wasi:http/types: set-scheme: invalid scheme");this.scheme=m}getAuthority(){return e("request.get-authority"),this.authority}setAuthority(m){if(e("request.set-authority"),m!==void 0&&/[ \t\r\n/#?@]/.test(m.replace(/@/,"")))throw new j(null,"wasi:http/types: set-authority: invalid authority");this.authority=m}getOptions(){return e("request.get-options"),this.options}getHeaders(){return e("request.get-headers"),o(this.headers.entries.map(([m,g])=>[m,g.slice()]),!1)}static consumeBody(m,g){return e("request.consume-body"),f(m,g)}[Symbol.dispose](){!this.sent&&!this.consumed&&this.settleTransmission({kind:"err",value:{kind:"internal-error",value:"request dropped without being sent"}})}}class u{statusCode=200;headers;contents;trailers;fetchBody=null;settleTransmission;firstByteTimeout;betweenBytesTimeout;consumed=!1;constructor(){}static new(m,g,k){e("response.new");let T=new u;T.headers=m,m.mutable=!1,T.contents=g,T.trailers=k;let S=new Promise($=>{T.settleTransmission=$});return[T,S]}static fromFetch(m,g){let k=new u;return k.statusCode=m.status,k.headers=i(m.headers),k.fetchBody=m.body,k.firstByteTimeout=g?.firstByteTimeout,k.betweenBytesTimeout=g?.betweenBytesTimeout,k}getStatusCode(){return e("response.get-status-code"),this.statusCode}setStatusCode(m){if(e("response.set-status-code"),!Number.isInteger(m)||m<100||m>999)throw new j(null,"wasi:http/types: set-status-code: invalid status code");this.statusCode=m}getHeaders(){return e("response.get-headers"),o(this.headers.entries.map(([m,g])=>[m,g.slice()]),!1)}static consumeBody(m,g){return e("response.consume-body"),m.fetchBody!==null||m.contents===void 0&&m.trailers===void 0?d(m,g):f(m,g)}[Symbol.dispose](){this.fetchBody!==null&&!this.consumed&&this.fetchBody.cancel().catch(()=>{}),this.settleTransmission!==void 0&&!this.consumed&&this.settleTransmission({kind:"err",value:{kind:"internal-error",value:"response dropped without being sent"}})}}function f(b,m){if(b.consumed)return[[],Promise.resolve({kind:"err",value:{kind:"internal-error",value:"body already consumed"}})];b.consumed=!0;let g=b.contents,k=b.trailers??Promise.resolve({kind:"ok",value:void 0}),T=b.settleTransmission;return T!==void 0&&Promise.resolve(m).then($=>T($),()=>T({kind:"err",value:{kind:"internal-error",value:"consumer failed"}})),[async function*(){if(g!==void 0)for await(let $ of g)yield $ instanceof Uint8Array?$:Uint8Array.from($)}(),Promise.resolve(k).then($=>$)]}function d(b,m){if(b.consumed)return[[],Promise.resolve({kind:"err",value:{kind:"internal-error",value:"body already consumed"}})];b.consumed=!0;let g=b.fetchBody,k,T=new Promise(_=>k=_),S=y(b.firstByteTimeout),$=y(b.betweenBytesTimeout);return[async function*(){if(g===null){k({kind:"ok",value:void 0});return}let _=g.getReader(),R=!0;try{for(;;){let P=R?S:$,z;try{z=await x(_,P)}catch(xt){k({kind:"err",value:xt===w?{kind:R?"HTTP-response-timeout":"connection-read-timeout"}:Np(xt)});return}if(R=!1,z.done){k({kind:"ok",value:void 0});return}z.value.length>0&&(yield z.value)}}finally{k({kind:"ok",value:void 0}),_.cancel().catch(()=>{}),_.releaseLock()}}(),T]}let w=Symbol("timed out");function y(b){return b===void 0?void 0:Number(b/1000000n)}function x(b,m){let g=b.read();return m===void 0?g:new Promise((k,T)=>{let S=setTimeout(()=>T(w),m);g.then($=>{clearTimeout(S),k($)},$=>{clearTimeout(S),T($)})})}async function v(b){if(e("client.send"),b.sent||b.consumed)throw Un({kind:"internal-error",value:"request already sent or consumed"},"client.send: request already sent or consumed");b.sent=!0;let m=b.scheme===void 0?"https":b.scheme.kind==="other"?b.scheme.value.toLowerCase():b.scheme.kind.toLowerCase();if(m!=="http"&&m!=="https")throw Un({kind:"internal-error",value:`fetch cannot carry scheme '${m}'`},`client.send: unsupported scheme '${m}'`);if(b.authority===void 0)throw Un({kind:"HTTP-request-URI-invalid"},"client.send: no authority");let g=b.pathWithQuery??"",k=`${m}://${b.authority}${g.startsWith("/")||g===""?g:"/"+g}`,T=b.method.kind==="other"?b.method.value.toUpperCase():b.method.kind.toUpperCase(),S=new Headers;for(let[R,P]of b.headers.entries)try{S.append(R,vg.decode(P))}catch(z){throw Un({kind:"internal-error",value:`header '${R}' refused by the platform`},`client.send: ${z}`)}let $;b.contents!==void 0&&($=await xg(b.contents));let N=await b.trailers;if(N.kind==="err"){let R={kind:"err",value:N.value};throw b.settleTransmission(R),Un(N.value,"client.send: request trailers resolved to an error")}if(N.value!==void 0){let R={kind:"internal-error",value:"fetch cannot transmit request trailers"};throw b.settleTransmission({kind:"err",value:R}),Un(R,"client.send: request trailers are not transmissible over fetch")}let _;try{_=await fetch(k,{method:T,headers:S,body:$===void 0||$.length===0?void 0:$,redirect:"manual",cache:"no-store",credentials:"omit"})}catch(R){let P=Np(R);throw b.settleTransmission({kind:"err",value:P}),Un(P,`client.send: ${R instanceof Error?R.message:String(R)}`)}return b.settleTransmission(kg),u.fromFetch(_,b.options)}return{imports:{[`wasi:http/types@${n}`]:{Fields:r,Request:l,RequestOptions:a,Response:u},[`wasi:http/client@${n}`]:{send:v},[`wasi:http/handler@${n}`]:{handle:v}},Fields:r,Request:l,RequestOptions:a,Response:u,send:v}}var Or=class extends Error{constructor(e){super(e),this.name="PlanError"}};var jn=class extends Error{constructor(e="canonical ABI trap"){super(e),this.name="Trap"}};function _r(t){throw new jn(t)}function ue(t,e){t&&_r(e)}var Mi=class extends Error{constructor(e="internal assertion failed"){super(e),this.name="AssertionError"}};function re(t,e){if(!t)throw new Mi(e)}var nA=new DataView(new ArrayBuffer(8));var Gc=class t{static MAX_LENGTH=2**28-1;array=[null];free=[];get(e){return ue(e>=this.array.length,"table index out of range"),ue(this.array[e]===null,"table entry empty"),this.array[e]}add(e){let n;return this.free.length>0?(n=this.free.pop(),re(this.array[n]===null),this.array[n]=e):(n=this.array.length,ue(n>t.MAX_LENGTH,"table full"),this.array.push(e)),n}remove(e){let n=this.get(e);return this.array[e]=null,this.free.push(e),n}*[Symbol.iterator](){for(let e of this.array)e!==null&&(yield e)}};var Ig=2**32-1;var hA=(1<<28)-1;var mA=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),yA=new TextDecoder("utf-16le",{fatal:!0,ignoreBOM:!0}),wA=new TextEncoder;function Mg(){let t;try{t=Deno.env.get("DELTIC_SCHED_SEED")}catch{return null}if(t===void 0||t==="")return null;let e=Number(t);return Number.isFinite(e)?Math.trunc(e)>>>0:null}var NA=Mg();var OA=(()=>{try{return Deno.env.get("CE_AMBIENT_TRACE")==="1"}catch{return!1}})();var js=function(t){return t[t.NONE=0]="NONE",t[t.SUBTASK=1]="SUBTASK",t[t.STREAM_READ=2]="STREAM_READ",t[t.STREAM_WRITE=3]="STREAM_WRITE",t[t.FUTURE_READ=4]="FUTURE_READ",t[t.FUTURE_WRITE=5]="FUTURE_WRITE",t[t.TASK_CANCELLED=6]="TASK_CANCELLED",t}({}),BA=[js.NONE,0,0];var MA=(()=>{try{return Deno.env.get("CE_EVENT_TRACE")==="1"}catch{return!1}})();var Wg=2**28-1;var mC=(1<<28)-1;var KR=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var i1=Promise.resolve();var a1=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var Wi=class{addrType="i32";#e;#t;#n=null;#s=new Uint8Array(0);#r=new DataView(new ArrayBuffer(0));constructor(e,n){this.#e=e,this.#t=n}#o(){let e=this.#e();if(e===void 0)throw new Or(`${this.#t} accessed before its extract-memory initializer ran`);return e}#i(){let e=this.#o().buffer;e!==this.#n&&(this.#n=e,this.#s=new Uint8Array(e),this.#r=new DataView(e))}get bytes(){return this.#i(),this.#s}get view(){return this.#i(),this.#r}get length(){return this.#o().buffer.byteLength}ptrType(){return this.addrType}ptrSize(){return 4}},T1=new Wi(()=>{},"check");var S1=(()=>{try{return Deno.env.get("DELTIC_DRIVE_TRACE")==="1"}catch{return!1}})();var Hp=Symbol("deltic.constructorSyncEntry");var M1=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var l2=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var y2=(()=>{try{return Deno.env.get("CE_CTX_TRACE")==="1"}catch{return!1}})();var mP=(()=>{try{return Deno.env.get("CE_SCOPE_TRACE")==="1"}catch{return!1}})();var KP=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var YP=Object.freeze({hostEnd:!0});var gt=class extends Error{payload;constructor(e,n){super(n??`WIT error: ${bb(e)}`),this.name="WitError",this.payload=e}};function bb(t){return t==null?String(t):typeof t=="object"&&"tag"in t?String(t.tag):typeof t=="object"?JSON.stringify(t):String(t)}var fL=Symbol("deltic.resource-state");var dL=new FinalizationRegistry(t=>{if(t.valid&&t.owns){t.valid=!1;try{t.rt.dtor?.(t.rep)}catch{}}});var Ks=class{#e=[];add(e){this.#e.push(e)}end(){for(let e of this.#e)e();this.#e.length=0}},RL=new Ks;var XL=Symbol("deltic.embedder.hostRegistries");function zt(t){throw new gt(t)}function A(t){return zt({tag:"invalid-key",val:t})}function Kn(t){return zt({tag:"invalid-nonce",val:t})}function ot(){return zt({tag:"authentication-failed"})}function $e(){return zt({tag:"not-extractable"})}function fe(t){return zt({tag:"unsupported",val:t})}function Ye(t){return zt({tag:"not-permitted",val:t})}function B(t){return zt({tag:"other",val:t})}function q(t){return Ye(`this key does not permit ${t}`)}function rl(t){let e=t,n=typeof e?.name=="string"?e.name:void 0,r=typeof e?.message=="string"?e.message:void 0;return{name:n,detail:r??String(t)}}async function C(t,e){try{return await e()}catch(n){if(n instanceof gt)throw n;let{name:r,detail:s}=rl(n);throw n instanceof DOMException&&(r==="NotSupportedError"&&fe(`${t} is not served by this platform: ${s}`),B(`${t} failed: ${s}`)),n instanceof TypeError&&fe(`${t} is not served by this platform: ${s}`),n instanceof Error&&B(`${t} failed: ${s}`),n}}function Ki(t,e="open"){t instanceof DOMException&&t.name==="OperationError"&&ot();let{detail:n}=rl(t);B(`${e}: ${n}`)}function Fr(t){let e=t.filter(([,n])=>n).map(([n])=>n);return e.length===0&&Ye("a key with no enabled usage cannot be minted"),e}function Qp(t){return rl(t)}async function We(t){let e=[],n=0;for(;;){let o=await t.read(65536);if(o.length===0)break;let a=o instanceof Uint8Array?o:Uint8Array.from(o);e.push(a),n+=a.length}let r=new Uint8Array(n),s=0;for(let o of e)r.set(o,s),s+=o.length;return r}var Cb=new TextEncoder,Rb=new TextDecoder("utf-8",{fatal:!0});function eh(t){return Cb.encode(t)}function Pb(t){try{return Rb.decode(t)}catch{A("unwrapped material is not valid UTF-8")}}function be(t,e,n){let r=Pb(t),s;try{s=JSON.parse(r)}catch{return A("unwrapped JWK is not valid JSON")}(typeof s!="object"||s===null||Array.isArray(s))&&A("unwrapped JWK must be a JSON object");let{use:o,key_ops:i,...a}=s;return o!==void 0&&o!==e&&A("unwrapped JWK `use` does not match the key's family"),i!==void 0&&(!Array.isArray(i)||!n.every(c=>i.includes(c)))&&A("unwrapped JWK `key_ops` does not cover the granted usages"),JSON.stringify(a)}var Lb=globalThis.crypto.subtle,Hs=class{#e;constructor(e){this.#e=e}async compute(e){let n=await We(e),r=await C(`${this.#e} digest`,()=>Lb.digest(this.#e,n));return new Uint8Array(r)}algorithmName(){return this.#e}},Nb=Object.freeze({sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"});function Ob(t){let e=Nb[t];return e===void 0&&fe(`${t} is not served by this implementation`),e}var sl={makeDigest:t=>new Hs(Ob(t))},th={Digest:Hs};function nh(){fe("sha1-checked is not served by this implementation")}var ol={makeRejectingDigest:()=>nh(),makeMitigatingDigest:()=>nh()};var Hi=globalThis.crypto.subtle;function me(t,e){let n=t[e];return n===void 0&&fe(`${e} is not served by this implementation`),n}var _b=Object.freeze({aes128:16,aes256:32});function Ct(t){return me(_b,t)}var zi=Object.freeze({sha256:{hash:"SHA-256",digestBytes:32},sha384:{hash:"SHA-384",digestBytes:48},sha512:{hash:"SHA-512",digestBytes:64}}),rh=Object.freeze({hash:"SHA-1",digestBytes:20});function sh(t,e){let n=t instanceof Error?t.message:String(t);A(`invalid ${e}: ${n}`)}async function G(t,e,n,r,s,o){try{return await Hi.importKey(e,n,r,s,o)}catch(i){if(i instanceof gt)throw i;sh(i,t)}}async function X(t,e,n,r,s){try{return await Hi.importKey("jwk",e,n,r,s)}catch(o){if(o instanceof gt)throw o;sh(o,t)}}async function Br(t){return t.extractable||$e(),new Uint8Array(await C("raw key export",()=>Hi.exportKey("raw",t)))}async function Mr(t){t.extractable||$e();let e=await C("jwk key export",()=>Hi.exportKey("jwk",t));return JSON.stringify({kty:e.kty,k:e.k,alg:e.alg})}function sn(t){return typeof t=="string"?Math.floor(t.length*3/4):0}function oh(t){let e=(c,l)=>(c-1-t&t-l-1)>>>31,n=e(65,90),r=e(97,122),s=e(48,57),o=e(45,45),i=e(95,95),a=n|r|s|o|i;return n*(t-65)+r*(t-97+26)+s*(t-48+52)+o*62+i*63-(1-a)}function zs(t){let e=new Uint8Array(Math.floor(t.length*3/4)),n=0,r=0,s=0;for(let o=0;o=8&&(r-=8,e[s++]=n>>r&255);return e}function W(t){if(typeof t!="string")return;t.length%4===1&&A("JWK member has an impossible base64url length");let e=0,n=0;for(let s=0;s>31,n=o}e!==0&&A("JWK member is not unpadded base64url");let r=t.length%4;r!==0&&(n&(r===2?15:3))!==0&&A("JWK member has non-zero trailing bits")}function Y(t){let e;try{e=JSON.parse(t)}catch(o){A(`JWK is not valid JSON: ${o}`)}(typeof e!="object"||e===null||Array.isArray(e))&&A("JWK must be a JSON object");let{use:n,key_ops:r,...s}=e;return s}async function Z(t,e){try{return await e()}catch(n){throw n instanceof gt&&n.payload?.tag==="invalid-key"&&A(`invalid ${t}`),n}}function ih(t){if(t.length>=2&&t[0]===48){let e=t[1];if(e<128)return 2;if(e===129&&t.length>=3&&t[2]>=128)return 3;if(e===130&&t.length>=4&&t[2]!==0)return 4}return 0}var Db=Object.freeze({"P-256":Uint8Array.from([48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7]),"P-384":Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34])});function Vi(t,e){let n=Db[t],r=ih(e);(n===void 0||r===0||!n.every((s,o)=>e[r+o]===s))&&A(`${t} SPKI must name the curve by OID`)}var Fb=Uint8Array.from([48,13,6,9,42,134,72,134,247,13,1,1,1,5,0]);function Ji(t){let e=ih(t);(e===0||!Fb.every((n,r)=>t[e+r]===n))&&A("RSA SPKI must carry the rsaEncryption AlgorithmIdentifier")}function ah(t,e,n){let r=[48,42,48,5,6,3,43,101,t,3,33,0];return e.length===44&&r.every((o,i)=>e[i]===o)||A(`${n}: not an RFC 8410 SubjectPublicKeyInfo`),e.slice(12)}var il=globalThis.crypto.subtle,ch=new WeakMap;function al(t){let e=ch.get(t);return e===void 0&&B("derive-options minted by another provider"),e}var qi=class{constructor(){ch.set(this,{deriveBits:!1,deriveKey:!1})}canDeriveBits(e){al(this).deriveBits=e}canDeriveKey(e){al(this).deriveKey=e}};function Gi(t){return{...al(t)}}function qs(t){let e=[];return t.deriveBits&&e.push("deriveBits"),t.deriveKey&&e.push("deriveKey"),e.length===0&&Ye("an options resource granting nothing cannot mint"),e}var lh=new WeakMap;function Vs(t){let e=lh.get(t);return e===void 0&&B("derive-input minted by another provider"),e}function Hn(t,e,n,r){let s=new Js;return lh.set(s,{key:t,params:{...e},policy:{...n},hasNaturalLength:r}),s}var Js=class{canDeriveBits(){return Vs(this).policy.deriveBits}canDeriveKey(){return Vs(this).policy.deriveKey}async deriveBits(e){let n=Vs(this);if(n.policy.deriveBits||q("derive-bits"),e===void 0){n.hasNaturalLength||B("a KDF's output length is a caller choice: it has no natural output length, which only agreement sources define");let s=await C("agreement derive",()=>il.deriveBits(n.params,n.key,null));return new Uint8Array(s)}(e===0||e%8!==0)&&B(`derive length must be a non-zero multiple of 8 bits, got ${e}`);let r=await C("KDF derive",()=>il.deriveBits(n.params,n.key,e));return new Uint8Array(r)}};function uh(t){return Vs(t)}async function on(t,e,n,r){let s=Vs(t);return s.policy.deriveKey||q("derive-key"),n&&!s.policy.deriveBits&&Ye("minting an extractable key requires the derive-bits grant: an exportable key is bits disclosure by other means"),await C("KDF derive-key",()=>il.deriveKey(s.params,s.key,e,n,r))}var cl={DeriveOptions:qi,DeriveInput:Js};var ll=new WeakMap,ul=new WeakMap,se=class{constructor(e,n){ll.set(this,{format:e,bytes:n})}},it=class{constructor(e){ul.set(this,{bytes:e})}};function an(t){let e=ll.get(t);return ll.delete(t),e===void 0&&B("wrap-input already consumed or minted by another provider"),e}function F(t){let e=ul.get(t);return ul.delete(t),e===void 0&&B("unwrap-input already consumed or minted by another provider"),e}var fl={WrapInput:se,UnwrapInput:it};var jr=globalThis.crypto.subtle,ph=new WeakMap;function cn(t){let e=ph.get(t);return e===void 0&&B("mac-key-options minted by another provider"),e}var Xi=class{constructor(){ph.set(this,{sign:!1,verify:!1,extractable:!1})}canSign(e){cn(this).sign=e}canVerify(e){cn(this).verify=e}extractable(e){cn(this).extractable=e}};function Gs(t){let e=[];return t.sign&&e.push("sign"),t.verify&&e.push("verify"),e.length===0&&Ye("a key with no enabled usage cannot be minted"),e}var ln=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n=r}extractable(){return this.#e.extractable}canSign(){return this.#e.usages.includes("sign")}canVerify(){return this.#e.usages.includes("verify")}algorithmName(){return this.#e.algorithm.name}algorithmHash(){return this.#n}algorithmLength(){return this.#t}async sign(e){let n=await We(e);this.canSign()||q("sign");let r=await C("HMAC sign",()=>jr.sign("HMAC",this.#e,n));return new Uint8Array(r)}async verify(e,n){let r=await We(e);this.canVerify()||q("verify"),await C("HMAC verify",()=>jr.verify("HMAC",this.#e,n,r))||ot()}async exportKeyRaw(){return fh(this.#e)}async exportKeyJwk(){return dh(this.#e)}async toWrapInputRaw(){return new se("raw",await fh(this.#e))}async toWrapInputJwk(){let e=await dh(this.#e);return new se("jwk",eh(e))}};async function fh(t){t.extractable||$e();let e=await C("export raw",()=>jr.exportKey("raw",t));return new Uint8Array(e)}async function dh(t){t.extractable||$e();let e=await C("export jwk",()=>jr.exportKey("jwk",t));return JSON.stringify(e)}var hh={MacKey:ln,MacKeyOptions:Xi};async function dl(t,e,n){let r=cn(n),s=Gs(r);e.length===0&&A("empty key");let o=await C("HMAC import key",()=>jr.importKey("raw",e,{name:"HMAC",hash:t.hash},r.extractable,s));return new ln(o,e.length*8,t.hash)}async function mh(t,e,n){let r=cn(n),s=Gs(r);e===0&&A("HMAC key length must be non-zero"),e!==void 0&&e%8!==0&&fe(`HMAC key length ${e} is not a multiple of 8; sub-byte lengths are not served`);let o=e??t.blockBytes*8,i=await C(`HMAC-${t.hash} key generation`,()=>jr.generateKey({name:"HMAC",hash:t.hash,length:o},r.extractable,s));return new ln(i,o,t.hash)}async function pl(t,e,n){let r=cn(n),s=Gs(r),o=Y(e);W(o.k);let i=await X("HMAC JWK",o,{name:"HMAC",hash:t.hash},r.extractable,s),a=typeof o.k=="string"?sn(o.k)*8:0;return new ln(i,a,t.hash)}async function yh(t,e,n,r){let s=cn(r),o=Gs(s);n===0&&A("HMAC key length must be non-zero"),n!==void 0&&n%8!==0&&fe(`HMAC key length ${n} is not a multiple of 8; sub-byte lengths are not served`);let i=n??t.blockBytes*8,a=await on(e,{name:"HMAC",hash:t.hash,length:i},s.extractable,o);return new ln(a,i,t.hash)}function wh(t,e,n){let{bytes:r}=F(e);return dl(t,r,n)}function gh(t,e,n){let{bytes:r}=F(e),s=cn(n),o=be(r,"sig",Gs(s));return pl(t,o,n)}var Ur={hash:"SHA-1",blockBytes:64},Bb=Object.freeze({sha256:{hash:"SHA-256",blockBytes:64},sha384:{hash:"SHA-384",blockBytes:128},sha512:{hash:"SHA-512",blockBytes:128}});function Wr(t){let e=Bb[t];return e===void 0&&fe(`${t} is not served by this implementation`),e}var hl={importKeyRaw:(t,e)=>dl(Ur,t,e),importKeyJwk:(t,e)=>pl(Ur,t,e),generateKey:(t,e)=>mh(Ur,t,e),deriveKey:(t,e,n)=>yh(Ur,t,e,n),unwrapKeyRaw:(t,e)=>wh(Ur,t,e),unwrapKeyJwk:(t,e)=>gh(Ur,t,e)},ml={importKeyRaw:(t,e,n)=>dl(Wr(t),e,n),importKeyJwk:(t,e,n)=>pl(Wr(t),e,n),generateKey:(t,e,n)=>mh(Wr(t),e,n),deriveKey:(t,e,n,r)=>yh(Wr(t),e,n,r),unwrapKeyRaw:(t,e,n)=>wh(Wr(t),e,n),unwrapKeyJwk:(t,e,n)=>gh(Wr(t),e,n)};var un=globalThis.crypto.subtle,zn=Object.freeze({name:"Ed25519",namedCurve:void 0,hash:void 0,publicLength:32,signatureLength:64});function bh(t){return t.name==="ECDSA"?{name:"ECDSA",hash:t.hash}:t.name==="RSA-PSS"?{name:"RSA-PSS",saltLength:t.saltLength}:t.name}function yl(t){let e=t.match(/../g);if(e===null||e.length*2!==t.length)throw new Error("malformed hex literal in the Ed25519 constant table");return Uint8Array.from(e,n=>parseInt(n,16))}var Mb=yl("edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f"),Ub=yl("edd3f55c1a631258d69cf7a2def9de14"+"00".repeat(15)+"10"),Wb=["0000000000000000000000000000000000000000000000000000000000000000","0100000000000000000000000000000000000000000000000000000000000000","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f"].map(yl);function kh(t,e){for(let n=t.length-1;n>=0;n--)if(t[n]!==e[n])return t[n]jb(e,n)):!1}var Ae=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}get cryptoKey(){return this.#e}async verify(e,n){let r=await We(e);n.length!==this.#t.signatureLength&&ot(),this.#t.name==="Ed25519"&&(kh(n.subarray(32),Ub)||ot(),Yi(n.subarray(0,32))||ot()),await C(`${this.#t.name} verify`,()=>un.verify(bh(this.#t),this.#e,n,r))||ot()}algorithmName(){return this.#t.name}algorithmCurve(){return this.#t.namedCurve}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.length}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}async exportKeyRaw(){(this.#t.name==="RSASSA-PKCS1-v1_5"||this.#t.name==="RSA-PSS")&&fe("RSA public keys have no raw form");let e=await C("raw key export",()=>un.exportKey("raw",this.#e));return new Uint8Array(e)}async exportKeySpki(){let e=await C("spki key export",()=>un.exportKey("spki",this.#e));return new Uint8Array(e)}async exportKeyJwk(){let e=await C("jwk key export",()=>un.exportKey("jwk",this.#e));return e.kty==="OKP"?JSON.stringify({kty:e.kty,crv:e.crv,x:e.x}):e.kty==="RSA"?JSON.stringify({kty:e.kty,n:e.n,e:e.e}):JSON.stringify({kty:e.kty,crv:e.crv,x:e.x,y:e.y})}},De=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}async sign(e){let n=await We(e);this.canSign()||q("sign");let r=await C(`${this.#t.name} sign`,()=>un.sign(bh(this.#t),this.#e,n));return new Uint8Array(r)}algorithmName(){return this.#t.name}algorithmCurve(){return this.#t.namedCurve}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.length}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}extractable(){return this.#e.extractable}canSign(){return this.#e.usages.includes("sign")}async exportKeyJwk(){this.#e.extractable||$e();let e=await C("jwk key export",()=>un.exportKey("jwk",this.#e));return e.kty==="RSA"?JSON.stringify({kty:e.kty,n:e.n,e:e.e,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}):JSON.stringify(e.kty==="OKP"?{kty:e.kty,crv:e.crv,x:e.x,d:e.d}:{kty:e.kty,crv:e.crv,x:e.x,y:e.y,d:e.d})}async exportKeyPkcs8(){this.#e.extractable||$e();let e=await C("pkcs8 key export",()=>un.exportKey("pkcs8",this.#e));return new Uint8Array(e)}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await this.exportKeyJwk()))}async toWrapInputPkcs8(){return new se("pkcs8",await this.exportKeyPkcs8())}},xh=new WeakMap;function Pe(t){let e=xh.get(t);return e===void 0&&B("signing-key-options minted by another provider"),e}var Xs=class{constructor(){xh.set(this,{sign:!1,extractable:!1})}canSign(e){Pe(this).sign=e}extractable(e){Pe(this).extractable=e}};function je(t){Fr([["sign",t.sign]])}var Eh={VerifyingKey:Ae,SigningKey:De,SigningKeyOptions:Xs};function vh(t){let e=t.alg;e!==void 0&&e!=="Ed25519"&&e!=="EdDSA"&&A(`Ed25519 JWK declares alg ${String(e)}; the registered spellings are Ed25519 and EdDSA`)}var wl={importVerifyingKeyRaw:async t=>{t.length!==32&&A(`Ed25519 public keys are 32 bytes, got ${t.length}`),Yi(t)||A("non-canonical or small-order Ed25519 public key");let e=await G("Ed25519 public key","raw",t,"Ed25519",!0,["verify"]);return new Ae(e,zn)},importVerifyingKeySpki:async t=>{let e=ah(112,t,"Ed25519");Yi(e)||A("non-canonical or small-order Ed25519 public key");let n=await G("Ed25519 spki","spki",t,"Ed25519",!0,["verify"]);return new Ae(n,zn)},importVerifyingKeyJwk:async t=>{let e=Y(t);vh(e),W(e.x),(typeof e.x!="string"||!Yi(zs(e.x)))&&A("non-canonical or small-order Ed25519 public key");let n=await X("Ed25519 public JWK",e,"Ed25519",!0,["verify"]);return new Ae(n,zn)}},Ys={SigningKeyOptions:Xs,generateKey:async t=>{let e=Pe(t);je(e);let n=await C("Ed25519 key generation",()=>un.generateKey("Ed25519",e.extractable,["sign","verify"]));return[new De(n.privateKey,zn),new Ae(n.publicKey,zn)]},importSigningKeyPkcs8:async(t,e)=>{let n=Pe(e);je(n);let r=await G("Ed25519 pkcs8","pkcs8",t,"Ed25519",n.extractable,["sign"]);return new De(r,zn)},importSigningKeyJwk:async(t,e)=>{let n=Pe(e);je(n);let r=Y(t);vh(r),W(r.x),W(r.d);let s=await X("Ed25519 private JWK",r,"Ed25519",n.extractable,["sign"]);return s.type!=="private"&&A("OKP private JWK must carry `d` (base64url private key)"),new De(s,zn)},unwrapSigningKeyPkcs8:(t,e)=>{let{bytes:n}=F(t);return Z("unwrapped Ed25519 pkcs8",()=>Ys.importSigningKeyPkcs8(n,e))},unwrapSigningKeyJwk:(t,e)=>{let{bytes:n}=F(t);je(Pe(e));let r=be(n,"sig",["sign"]);return Z("unwrapped Ed25519 private JWK",()=>Ys.importSigningKeyJwk(r,e))}};var gl=Object.freeze({"P-256":{p:2n**256n-2n**224n+2n**192n+2n**96n-1n,b:0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn,coordBytes:32},"P-384":{p:2n**384n-2n**128n-2n**96n+2n**32n-1n,b:0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aefn,coordBytes:48}});function Zi(t){let e=0n;for(let n of t)e=e<<8n|BigInt(n);return e}function Th(t,e,n){let{p:r,b:s}=t;if(e<0n||e>=r||n<0n||n>=r)return!1;let o=n*n%r,i=(e*e%r*e%r-3n*e%r+s)%r;return o===(i%r+r)%r}function Zs(t,e){let n=gl[t];if(n===void 0)return;let r=1+2*n.coordBytes;(e.length!==r||e[0]!==4)&&A(`${t} public keys are uncompressed SEC1 points (${r} bytes, leading 0x04)`);let s=Zi(e.subarray(1,1+n.coordBytes)),o=Zi(e.subarray(1+n.coordBytes));Th(n,s,o)||A(`${t} public key is not a point on the declared curve`)}function Qi(t,e){let n=gl[t];if(n===void 0)return;let r=1+2*n.coordBytes;if(e.length>=r){let o=e.subarray(e.length-r);if(o[0]===4){Zs(t,o);return}}let s=1+n.coordBytes;if(e.length>=s){let o=e[e.length-s];(o===2||o===3)&&A(`${t} SPKI carries a compressed point, which this implementation does not admit`)}}function Kr(t,e){e.crv!==t&&A(`EC JWK declares crv ${String(e.crv)}; the requested curve is ${t}`);let n=gl[t];if(n===void 0)return;let{x:r,y:s}=e;if(typeof r!="string"||typeof s!="string")return;W(r),W(s);let o=zs(r),i=zs(s);(o.length!==n.coordBytes||i.length!==n.coordBytes)&&A(`EC JWK coordinates must be ${n.coordBytes} bytes for ${t}`),Th(n,Zi(o),Zi(i))||A(`EC JWK is not a point on ${t}`)}var Kb=Object.freeze({"P-256":"ES256","P-384":"ES384"});function bl(t,e){let n=e.alg;if(n===void 0)return;let r=Kb[t];r!==void 0&&n!==r&&A(`EC JWK declares alg ${String(n)}; ${t} signature keys use ${r}`)}var Hb=globalThis.crypto.subtle,zb=Object.freeze({"p256-sha256":Hr(256,"SHA-256"),"p256-sha384":Hr(256,"SHA-384"),"p256-sha512":Hr(256,"SHA-512"),"p384-sha256":Hr(384,"SHA-256"),"p384-sha384":Hr(384,"SHA-384"),"p384-sha512":Hr(384,"SHA-512")});function Hr(t,e){let n=t===256?32:48;return Object.freeze({name:"ECDSA",namedCurve:`P-${t}`,hash:e,publicLength:n*2+1,signatureLength:n*2})}function zr(t){return me(zb,t)}var kl={importVerifyingKeyRaw:async(t,e)=>{let n=zr(t);(e.length!==n.publicLength||e[0]!==4)&&A(`${t} public keys are uncompressed SEC1 points (${n.publicLength} bytes, leading 0x04)`),Zs(n.namedCurve,e);let r=await G(`${t} public key`,"raw",e,{name:"ECDSA",namedCurve:n.namedCurve},!0,["verify"]);return new Ae(r,n)},importVerifyingKeySpki:async(t,e)=>{let n=zr(t);Vi(n.namedCurve,e),Qi(n.namedCurve,e);let r=await G(`${t} spki`,"spki",e,{name:"ECDSA",namedCurve:n.namedCurve},!0,["verify"]);return new Ae(r,n)},importVerifyingKeyJwk:async(t,e)=>{let n=zr(t),r=Y(e);Kr(n.namedCurve,r),bl(n.namedCurve,r);let s=await X(`${t} public JWK`,r,{name:"ECDSA",namedCurve:n.namedCurve},!0,["verify"]);return new Ae(s,n)}},Qs={generateKey:async(t,e)=>{let n=Pe(e);je(n);let r=zr(t),s=await C(`${t} key generation`,()=>Hb.generateKey({name:"ECDSA",namedCurve:r.namedCurve},n.extractable,["sign","verify"]));return[new De(s.privateKey,r),new Ae(s.publicKey,r)]},importSigningKeyPkcs8:async(t,e,n)=>{let r=Pe(n);je(r);let s=zr(t),o=await G(`${t} pkcs8`,"pkcs8",e,{name:"ECDSA",namedCurve:s.namedCurve},r.extractable,["sign"]);return new De(o,s)},importSigningKeyJwk:async(t,e,n)=>{let r=Pe(n);je(r);let s=zr(t),o=Y(e);Kr(s.namedCurve,o),bl(s.namedCurve,o),W(o.d);let i=await X(`${t} private JWK`,o,{name:"ECDSA",namedCurve:s.namedCurve},r.extractable,["sign"]);return i.type!=="private"&&A("EC private JWK must carry `d` (base64url private scalar)"),new De(i,s)},unwrapSigningKeyPkcs8:(t,e,n)=>{let{bytes:r}=F(e);return Z(`unwrapped ${t} pkcs8`,()=>Qs.importSigningKeyPkcs8(t,r,n))},unwrapSigningKeyJwk:(t,e,n)=>{let{bytes:r}=F(e);je(Pe(n));let s=be(r,"sig",["sign"]);return Z(`unwrapped ${t} private JWK`,()=>Qs.importSigningKeyJwk(t,s,n))}};var Vb=globalThis.crypto.subtle,bt=zi,Jb=1024,qb=16384,Ih=2048,Ah=8192,xl=Object.freeze({m2048:2048,m3072:3072,m4096:4096,m8192:8192});function Vr(t,e,n=Jb,r=qb){let{modulusLength:s,publicExponent:o}=t.algorithm;(sr)&&A(`invalid ${e}: RSA modulus must be ${n}-${r} bits, got ${s}`);let i=0;for(;iCh("RSASSA-PKCS1-v1_5",t,e,void 0),importVerifyingKeyJwk:(t,e)=>Rh("RSASSA-PKCS1-v1_5",t,e,void 0)},Sl={importVerifyingKeySpki:(t,e,n)=>Ch("RSA-PSS",t,n,e),importVerifyingKeyJwk:(t,e,n)=>Rh("RSA-PSS",t,n,e)};async function Xb(t,e,n,r){Vn();let s=Pe(r);je(s);let o=me(bt,e),i=me(xl,n),a=await C(`${t} key generation`,()=>Vb.generateKey({name:t,hash:o.hash,modulusLength:i,publicExponent:new Uint8Array([1,0,1])},s.extractable,["sign","verify"])),c=vl(t,o,i);return[new De(a.privateKey,c),new Ae(a.publicKey,c)]}async function Sh(t,e,n,r){Vn();let s=Pe(r);je(s);let o=me(bt,e),i=await G(`${t} pkcs8`,"pkcs8",n,{name:t,hash:o.hash},s.extractable,["sign"]),a=Vr(i,`${t} pkcs8`,Ih,Ah);return new De(i,vl(t,o,a))}async function $h(t,e,n,r){Vn();let s=Pe(r);je(s);let o=me(bt,e),i=Y(n);eo(to(t),e,i);for(let l of["n","e","d","p","q","dp","dq","qi"])W(i[l]);let a=await X(`${t} private JWK`,i,{name:t,hash:o.hash},s.extractable,["sign"]);a.type!=="private"&&A("RSA private JWK must carry `d` and the CRT members");let c=Vr(a,`${t} private JWK`,Ih,Ah);return new De(a,vl(t,o,c))}function Ph(t){return{generateKey:(e,n,r)=>Xb(t,e,n,r),importSigningKeyPkcs8:(e,n,r)=>Sh(t,e,n,r),importSigningKeyJwk:(e,n,r)=>$h(t,e,n,r),unwrapSigningKeyPkcs8:(e,n,r)=>{let{bytes:s}=F(n);return Z(`unwrapped ${t} pkcs8`,()=>Sh(t,e,s,r))},unwrapSigningKeyJwk:(e,n,r)=>{let{bytes:s}=F(n);je(Pe(r));let o=be(s,"sig",["sign"]);return Z(`unwrapped ${t} private JWK`,()=>$h(t,e,o,r))}}}var $l=Ph("RSASSA-PKCS1-v1_5"),Il=Ph("RSA-PSS");var Jn=globalThis.crypto.subtle,Lh=new WeakMap;function at(t){let e=Lh.get(t);return e===void 0&&B("agreement-key-options minted by another provider"),e}var ea=class{constructor(){Lh.set(this,{deriveBits:!1,deriveKey:!1,extractable:!1})}canDeriveBits(e){at(this).deriveBits=e}canDeriveKey(e){at(this).deriveKey=e}extractable(e){at(this).extractable=e}},Ze=class{#e;constructor(e){this.#e=e}get cryptoKey(){return this.#e}algorithmName(){return this.#e.algorithm.name}async exportKeyRaw(){let e=await C("export raw",()=>Jn.exportKey("raw",this.#e));return new Uint8Array(e)}async exportKeyJwk(){let e=await C("export jwk",()=>Jn.exportKey("jwk",this.#e));return JSON.stringify(e.kty==="OKP"?{kty:e.kty,crv:e.crv,x:e.x}:{kty:e.kty,crv:e.crv,x:e.x,y:e.y})}async exportKeySpki(){let e=await C("export spki",()=>Jn.exportKey("spki",this.#e));return new Uint8Array(e)}},kt=class{#e;#t;constructor(e,n){this.#e=e,this.#t={...n}}async agree(e){let n={name:this.#e.algorithm.name,public:e.cryptoKey};try{await Jn.deriveBits(n,this.#e,null)}catch(r){let s=Qp(r);s.name==="OperationError"&&A("the shared secret is all-zero: the peer public key is a small-order point"),s.name==="InvalidAccessError"&&A(`peer key is not usable with this key: ${s.detail}`),B(`agreement failed: ${s.detail}`)}return Hn(this.#e,n,this.#t,!0)}algorithmName(){return this.#e.algorithm.name}canDeriveBits(){return this.#t.deriveBits}canDeriveKey(){return this.#t.deriveKey}extractable(){return this.#t.extractable}async exportKeyJwk(){this.#t.extractable||$e();let e=await C("export jwk",()=>Jn.exportKey("jwk",this.#e));return JSON.stringify(e.kty==="OKP"?{kty:e.kty,crv:e.crv,x:e.x,d:e.d}:{kty:e.kty,crv:e.crv,x:e.x,y:e.y,d:e.d})}async exportKeyPkcs8(){this.#t.extractable||$e();let e=await C("export pkcs8",()=>Jn.exportKey("pkcs8",this.#e));return new Uint8Array(e)}async toWrapInputJwk(){let e=await this.exportKeyJwk();return new se("jwk",new TextEncoder().encode(e))}async toWrapInputPkcs8(){return new se("pkcs8",await this.exportKeyPkcs8())}},Al={AgreementKeyOptions:ea,PublicKey:Ze,SecretKey:kt},qn=["deriveBits","deriveKey"];function Jt(t){!t.deriveBits&&!t.deriveKey&&Ye("a key with no enabled usage cannot be minted")}function Cl(t){let e=[];return t.deriveBits&&e.push("deriveBits"),t.deriveKey&&e.push("deriveKey"),e}var no={importPublicKeyRaw:async t=>{t.length!==32&&A("X25519 public key must be 32 bytes (RFC 7748 u-coordinate)");let e=await G("X25519 public key","raw",t,"X25519",!0,[]);return new Ze(e)},importPublicKeySpki:async t=>{let e=await G("X25519 spki","spki",t,"X25519",!0,[]);return new Ze(e)},importPublicKeyJwk:async t=>{let e=Y(t);W(e.x);let n=await X("X25519 public JWK",e,"X25519",!0,[]);return new Ze(n)},importSecretKeyJwk:async(t,e)=>{let n=at(e);Jt(n);let r=Y(t);W(r.x),W(r.d);let s=await X("X25519 private JWK",r,"X25519",n.extractable,qn);return s.type!=="private"&&A("OKP private JWK must carry `d` (base64url private key)"),new kt(s,n)},importSecretKeyPkcs8:async(t,e)=>{let n=at(e);Jt(n);let r=await G("X25519 pkcs8","pkcs8",t,"X25519",n.extractable,qn);return new kt(r,n)},generateKey:async t=>{let e=at(t);Jt(e);let n=await C("X25519 key generation",()=>Jn.generateKey("X25519",e.extractable,qn));return[new kt(n.privateKey,e),new Ze(n.publicKey)]},unwrapSecretKeyJwk:(t,e)=>{let{bytes:n}=F(t),r=at(e);Jt(r);let s=be(n,"enc",Cl(r));return Z("unwrapped X25519 private JWK",()=>no.importSecretKeyJwk(s,e))},unwrapSecretKeyPkcs8:(t,e)=>{let{bytes:n}=F(t);return Z("unwrapped X25519 pkcs8",()=>no.importSecretKeyPkcs8(n,e))}};var Yb=globalThis.crypto.subtle,Zb=Object.freeze({p256:{namedCurve:"P-256",publicLength:65},p384:{namedCurve:"P-384",publicLength:97}});function Jr(t){return me(Zb,t)}var ro={importPublicKeyRaw:async(t,e)=>{let n=Jr(t);(e.length!==n.publicLength||e[0]!==4)&&A(`${t} public keys are uncompressed SEC1 points (${n.publicLength} bytes, leading 0x04)`),Zs(n.namedCurve,e);let r=await G(`${t} public key`,"raw",e,{name:"ECDH",namedCurve:n.namedCurve},!0,[]);return new Ze(r)},importPublicKeySpki:async(t,e)=>{let n=Jr(t);Vi(n.namedCurve,e),Qi(n.namedCurve,e);let r=await G(`${t} spki`,"spki",e,{name:"ECDH",namedCurve:n.namedCurve},!0,[]);return new Ze(r)},importPublicKeyJwk:async(t,e)=>{let n=Jr(t),r=Y(e);Kr(n.namedCurve,r);let s=await X(`${t} public JWK`,r,{name:"ECDH",namedCurve:n.namedCurve},!0,[]);return new Ze(s)},importSecretKeyJwk:async(t,e,n)=>{let r=at(n);Jt(r);let s=Jr(t),o=Y(e);Kr(s.namedCurve,o),W(o.d);let i=await X(`${t} private JWK`,o,{name:"ECDH",namedCurve:s.namedCurve},r.extractable,qn);return i.type!=="private"&&A("EC private JWK must carry `d` (base64url private scalar)"),new kt(i,r)},importSecretKeyPkcs8:async(t,e,n)=>{let r=at(n);Jt(r);let s=Jr(t),o=await G(`${t} pkcs8`,"pkcs8",e,{name:"ECDH",namedCurve:s.namedCurve},r.extractable,qn);return new kt(o,r)},generateKey:async(t,e)=>{let n=at(e);Jt(n);let r=Jr(t),s=await C(`${t} key generation`,()=>Yb.generateKey({name:"ECDH",namedCurve:r.namedCurve},n.extractable,qn));return[new kt(s.privateKey,n),new Ze(s.publicKey)]},unwrapSecretKeyJwk:(t,e,n)=>{let{bytes:r}=F(e),s=at(n);Jt(s);let o=be(r,"enc",Cl(s));return Z(`unwrapped ${t} private JWK`,()=>ro.importSecretKeyJwk(t,o,n))},unwrapSecretKeyPkcs8:(t,e,n)=>{let{bytes:r}=F(e);return Z(`unwrapped ${t} pkcs8`,()=>ro.importSecretKeyPkcs8(t,r,n))}};var Rl=globalThis.crypto.subtle,ta=new WeakMap,so=class{canDeriveBits(){return ta.get(this).policy.deriveBits}canDeriveKey(){return ta.get(this).policy.deriveKey}};function Qb(t,e){let n=new so;return ta.set(n,{key:t,policy:{...e}}),n}async function Nh(t,e){let n=ek(e),r=qs(n),s=await C("HKDF import ikm",()=>Rl.importKey("raw",t,"HKDF",!1,r));return Qb(s,n)}function ek(t){return Gi(t)}var Pl={Ikm:so,importIkm:(t,e)=>Nh(t,e),unwrapIkm:(t,e)=>{let{bytes:n}=F(t);return Nh(n,e)}},tk=Object.freeze({sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"});function Oh(t){let e=tk[t];return e===void 0&&fe(`${t} is not served by this implementation`),e}async function _h(t,e,n,r){let s=ta.get(e);s===void 0&&B("ikm minted by another provider");let o={name:"HKDF",hash:t,salt:n.slice(),info:r.slice()};return Hn(s.key,o,s.policy,!1)}async function Dh(t,e,n,r){let s=uh(e);s.policy.deriveKey||q("derive-key"),s.hasNaturalLength||B("chaining from another KDF's input is not served: a KDF's output length is a caller choice, not natural");let o=await Rl.deriveBits(s.params,s.key,null),i=await Rl.importKey("raw",o,"HKDF",!1,qs(s.policy)),a={name:"HKDF",hash:t,salt:n.slice(),info:r.slice()};return Hn(i,a,s.policy,!1)}var Ll={prepare:(t,e,n,r)=>_h(Oh(t),e,n,r),prepareFrom:(t,e,n,r)=>Dh(Oh(t),e,n,r)},Nl={prepare:(t,e,n)=>_h("SHA-1",t,e,n),prepareFrom:(t,e,n)=>Dh("SHA-1",t,e,n)};var nk=globalThis.crypto.subtle,Bh=new WeakMap;function Ol(t){let e=Bh.get(t);return e===void 0&&B("password minted by another provider"),e}var oo=class{canDeriveBits(){return Ol(this).policy.deriveBits}canDeriveKey(){return Ol(this).policy.deriveKey}};async function Fh(t,e){let n=Gi(e),r=qs(n),s=await C("PBKDF2 password import",()=>nk.importKey("raw",t,"PBKDF2",!1,r)),o=new oo;return Bh.set(o,{key:s,policy:n}),o}var _l={Password:oo,importPassword:Fh,unwrapPassword:(t,e)=>{let{bytes:n}=F(t);return Z("unwrapped PBKDF2 password",()=>Fh(n,e))}};function Mh(t,e,n,r){r===0&&B("PBKDF2 requires a positive iteration count");let{key:s,policy:o}=Ol(e),i={name:"PBKDF2",hash:t,salt:n.slice(),iterations:r};return Hn(s,i,o,!1)}var Dl={prepare:(t,e,n,r)=>Promise.resolve(Mh(me(zi,t).hash,e,n,r))},Fl={prepare:(t,e,n)=>Promise.resolve(Mh(rh.hash,t,e,n))};var qr=globalThis.crypto.subtle,Wh=new WeakMap;function Rt(t){let e=Wh.get(t);return e===void 0&&B("aead-key-options minted by another provider"),e}var na=class{constructor(){Wh.set(this,{seal:!1,open:!1,wrap:!1,unwrap:!1,extractable:!1})}canSeal(e){Rt(this).seal=e}canOpen(e){Rt(this).open=e}canWrap(e){Rt(this).wrap=e}canUnwrap(e){Rt(this).unwrap=e}extractable(e){Rt(this).extractable=e}};function ao(t){let e=[];return(t.seal||t.wrap)&&e.push("encrypt"),(t.open||t.unwrap)&&e.push("decrypt"),e.length===0&&Ye("a key with no enabled usage cannot be minted"),e}var rk=new Set([32,64,96,104,112,120,128]);function sk(t){if(t===void 0)return 128;let e=t*8;return rk.has(e)||fe(`AES-GCM tag size ${t} bytes is outside the registry's 32-128 bit set`),e}var fn=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n={...r}}algorithmName(){return this.#e.algorithm.name}algorithmLength(){return this.#t}nonceSize(){return 12}tagSize(){return 16}extractable(){return this.#e.extractable}canSeal(){return this.#n.seal}canOpen(){return this.#n.open}canWrap(){return this.#n.wrap}canUnwrap(){return this.#n.unwrap}async#s(e,n,r,s,o,i=e){(n.length<12||n.length>128)&&Kn(`AES-GCM nonce must be 12 to 128 bytes, got ${n.length}`);let a={name:"AES-GCM",iv:n,additionalData:r,tagLength:sk(s)};if(e==="seal"){let c=await C(`AES-GCM ${i}`,()=>qr.encrypt(a,this.#e,o));return new Uint8Array(c)}try{let c=await qr.decrypt(a,this.#e,o);return new Uint8Array(c)}catch(c){Ki(c,i)}}async seal(e,n,r,s){let o=await We(s);return this.canSeal()||q("seal"),this.#s("seal",e,n,r,o)}async open(e,n,r,s){let o=await We(s);return this.canOpen()||q("open"),this.#s("open",e,n,r,o)}async wrap(e,n,r,s){let{bytes:o}=an(s);return this.canWrap()||q("wrap"),this.#s("seal",e,n,r,o,"wrap")}async unwrap(e,n,r,s){this.canUnwrap()||q("unwrap");let o=await this.#s("open",e,n,r,s,"unwrap");return new it(o)}async exportKeyRaw(){this.#e.extractable||$e();let e=await C("export raw",()=>qr.exportKey("raw",this.#e));return new Uint8Array(e)}async exportKeyJwk(){this.#e.extractable||$e();let e=await C("export jwk",()=>qr.exportKey("jwk",this.#e));return JSON.stringify(e)}async toWrapInputRaw(){return new se("raw",await this.exportKeyRaw())}async toWrapInputJwk(){let e=await this.exportKeyJwk();return new se("jwk",new TextEncoder().encode(e))}},Bl={AeadKey:fn,AeadKeyOptions:na},ok=Object.freeze({aes128:128,aes256:256});function io(t){let e=ok[t];return e===void 0&&fe(`${t} is not served by this implementation`),e}async function Uh(t,e,n){let r=Rt(n);e.length*8!==t&&A(`AES-GCM key must be ${t/8} bytes for the declared variant, got ${e.length}`);let s=ao(r),o=await C("AES-GCM import key",()=>qr.importKey("raw",e,{name:"AES-GCM",length:t},r.extractable,s));return new fn(o,t,r)}var ra={importKeyRaw:(t,e,n)=>Uh(io(t),e,n),importKeyJwk:async(t,e,n)=>{let r=io(t),s=Rt(n),o=ao(s),i=Y(e);W(i.k);let a=await X(`${t} JWK`,i,{name:"AES-GCM",length:r},s.extractable,o),c=sn(i.k)*8;return c!==r&&A(`JWK carries a ${c}-bit key; ${t} requires ${r}`),new fn(a,r,s)},generateKey:async(t,e)=>{let n=io(t),r=Rt(e),s=ao(r),o=await C(`AES-${n}-GCM key generation`,()=>qr.generateKey({name:"AES-GCM",length:n},r.extractable,s));return new fn(o,n,r)},deriveKey:async(t,e,n)=>{let r=io(t),s=Rt(n),o=ao(s),i=await on(e,{name:"AES-GCM",length:r},s.extractable,o);return new fn(i,r,s)},unwrapKeyRaw:(t,e,n)=>{let{bytes:r}=F(e);return Uh(io(t),r,n)},unwrapKeyJwk:(t,e,n)=>{let{bytes:r}=F(e),s=Rt(n),o=be(r,"enc",ao(s));return ra.importKeyJwk(t,o,n)}};var Ml=globalThis.crypto.subtle,Kh=new WeakMap;function Pt(t){let e=Kh.get(t);return e===void 0&&B("cipher-key-options minted by another provider"),e}var sa=class{constructor(){Kh.set(this,{encrypt:!1,decrypt:!1,wrap:!1,unwrap:!1,extractable:!1})}canEncrypt(e){Pt(this).encrypt=e}canDecrypt(e){Pt(this).decrypt=e}canWrap(e){Pt(this).wrap=e}canUnwrap(e){Pt(this).unwrap=e}extractable(e){Pt(this).extractable=e}};function co(t){let e=[];return(t.encrypt||t.wrap)&&e.push("encrypt"),(t.decrypt||t.unwrap)&&e.push("decrypt"),e.length===0&&Ye("a key with no enabled usage cannot be minted"),e}function ik(t){let e=[];return t.encrypt&&e.push("encrypt"),t.decrypt&&e.push("decrypt"),t.wrap&&e.push("wrapKey"),t.unwrap&&e.push("unwrapKey"),e}function jh(t,e,n){return t==="AES-CBC"&&n!==void 0&&Kn("AES-CBC takes no counter length"),t==="AES-CTR"&&(n===void 0&&Kn("AES-CTR requires a counter length"),(n===0||n>128)&&Kn(`the counter length must be 1 to 128 bits, got ${n}`)),e.length!==16&&Kn(`${t} requires a 16-byte IV, got ${e.length} bytes`),t==="AES-CBC"?{name:t,iv:e}:{name:t,counter:e,length:n}}var dn=class{#e;#t;#n;#s;constructor(e,n,r,s){this.#e=e,this.#t=n,this.#n=r,this.#s={...s}}async#r(e,n,r){let s=jh(this.#t,e,n),o=await C(`${this.#t} encrypt`,()=>Ml.encrypt(s,this.#e,r));return new Uint8Array(o)}async#o(e,n,r){let s=jh(this.#t,e,n);try{return new Uint8Array(await Ml.decrypt(s,this.#e,r))}catch{B(`${this.#t} decryption failed`)}}async encrypt(e,n,r){let s=await We(r);return this.canEncrypt()||q("encrypt"),[await this.#r(e,n,s)]}async decrypt(e,n,r){let s=await We(r);return this.canDecrypt()||q("decrypt"),[await this.#o(e,n,s)]}async wrap(e,n,r){let{bytes:s}=an(r);return this.canWrap()||q("wrap"),this.#r(e,n,s)}async unwrap(e,n,r){return this.canUnwrap()||q("unwrap"),new it(await this.#o(e,n,r))}algorithmName(){return this.#t}algorithmLength(){return this.#n}ivSize(){return 16}extractable(){return this.#e.extractable}canEncrypt(){return this.#s.encrypt}canDecrypt(){return this.#s.decrypt}canWrap(){return this.#s.wrap}canUnwrap(){return this.#s.unwrap}exportKeyRaw(){return Br(this.#e)}exportKeyJwk(){return Mr(this.#e)}async toWrapInputRaw(){return new se("raw",await Br(this.#e))}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await Mr(this.#e)))}};function Hh(t){let e={async importKeyRaw(n,r,s){let o=Pt(s),i=co(o),a=Ct(n);r.length!==a&&A(`${n} requires ${a} key bytes, got ${r.length}`);let c=await G(`${n} key`,"raw",r,{name:t},o.extractable,i);return new dn(c,t,a*8,o)},async importKeyJwk(n,r,s){let o=Pt(s),i=co(o),a=Ct(n)*8,c=Y(r);W(c.k);let l=await X(`${n} JWK`,c,{name:t},o.extractable,i),u=sn(c.k)*8;return u!==a&&A(`JWK carries a ${u}-bit key; ${n} requires ${a}`),new dn(l,t,a,o)},async generateKey(n,r){let s=Pt(r),o=co(s),i=Ct(n)*8,a=await C(`${n} key generation`,()=>Ml.generateKey({name:t,length:i},s.extractable,o));return new dn(a,t,i,s)},async deriveKey(n,r,s){let o=Pt(s),i=co(o),a=Ct(n)*8,c=await on(r,{name:t,length:a},o.extractable,i);return new dn(c,t,a,o)},unwrapKeyRaw(n,r,s){let{bytes:o}=F(r);return Z(`unwrapped ${n} key material`,()=>e.importKeyRaw(n,o,s))},unwrapKeyJwk(n,r,s){let{bytes:o}=F(r),i=Pt(s);co(i);let a=be(o,"enc",ik(i));return Z(`unwrapped ${n} JWK`,()=>e.importKeyJwk(n,a,s))}};return e}var Ul={CipherKey:dn,CipherKeyOptions:sa},Wl=Hh("AES-CBC"),jl=Hh("AES-CTR");var uo=globalThis.crypto.subtle,zh=new WeakMap;function pn(t){let e=zh.get(t);return e===void 0&&B("kw-key-options minted by another provider"),e}var oa=class{constructor(){zh.set(this,{wrap:!1,unwrap:!1,extractable:!1})}canWrap(e){pn(this).wrap=e}canUnwrap(e){pn(this).unwrap=e}extractable(e){pn(this).extractable=e}};function lo(t){return Fr([["wrapKey",t.wrap],["unwrapKey",t.unwrap]])}function ak(t){let e=[];return t.wrap&&e.push("wrapKey"),t.unwrap&&e.push("unwrapKey"),e}var hn=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n={...r}}async wrap(e){let n=an(e);this.canWrap()||q("wrap");let r=n.bytes;if(n.format==="jwk"&&r.length%8!==0){let i=new Uint8Array(r.length+8-r.length%8);i.set(r),i.fill(32,r.length),r=i}(r.length%8!==0||r.length<16)&&A("AES-KW wraps key material of at least 16 bytes, a multiple of 8");let s=await C("AES-KW wrap",()=>uo.importKey("raw",r,{name:"HMAC",hash:"SHA-256"},!0,["sign"])),o=await C("AES-KW wrap",()=>uo.wrapKey("raw",s,this.#e,"AES-KW"));return new Uint8Array(o)}async unwrap(e){this.canUnwrap()||q("unwrap"),(e.length%8!==0||e.length<24)&&ot();let n;try{n=await uo.unwrapKey("raw",e,this.#e,"AES-KW",{name:"HMAC",hash:"SHA-256"},!0,["sign"])}catch(s){Ki(s,"unwrap")}let r=new Uint8Array(await C("AES-KW unwrap",()=>uo.exportKey("raw",n)));return new it(r)}algorithmName(){return this.#e.algorithm.name}algorithmLength(){return this.#t}extractable(){return this.#n.extractable}canWrap(){return this.#n.wrap}canUnwrap(){return this.#n.unwrap}exportKeyRaw(){return Br(this.#e)}exportKeyJwk(){return Mr(this.#e)}async toWrapInputRaw(){return new se("raw",await Br(this.#e))}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await Mr(this.#e)))}},Kl={KwKey:hn,KwKeyOptions:oa},fo={async importKeyRaw(t,e,n){let r=pn(n),s=lo(r),o=Ct(t);e.length!==o&&A(`${t} requires ${o} key bytes, got ${e.length}`);let i=await G(`${t} key`,"raw",e,{name:"AES-KW"},r.extractable,s);return new hn(i,o*8,r)},async importKeyJwk(t,e,n){let r=pn(n),s=lo(r),o=Ct(t)*8,i=Y(e);W(i.k);let a=await X(`${t} JWK`,i,{name:"AES-KW"},r.extractable,s),c=sn(i.k)*8;return c!==o&&A(`JWK carries a ${c}-bit key; ${t} requires ${o}`),new hn(a,o,r)},async generateKey(t,e){let n=pn(e),r=lo(n),s=Ct(t)*8,o=await C(`${t} key generation`,()=>uo.generateKey({name:"AES-KW",length:s},n.extractable,r));return new hn(o,s,n)},async deriveKey(t,e,n){let r=pn(n),s=lo(r),o=Ct(t)*8,i=await on(e,{name:"AES-KW",length:o},r.extractable,s);return new hn(i,o,r)},unwrapKeyRaw(t,e,n){let{bytes:r}=F(e);return Z(`unwrapped ${t} key material`,()=>fo.importKeyRaw(t,r,n))},unwrapKeyJwk(t,e,n){let{bytes:r}=F(e),s=pn(n);lo(s);let o=be(r,"enc",ak(s));return Z(`unwrapped ${t} JWK`,()=>fo.importKeyJwk(t,o,n))}};var mn=globalThis.crypto.subtle,ck=2048,lk=8192;function aa(t,e){return Vr(t,e,ck,lk)}function po(t,e){return{hash:t.hash,modulusLength:e,plaintextBound:Math.ceil(e/8)-2*t.digestBytes-2}}function Vh(t,e,n){zt({tag:"extension",val:{origin:"polymorph:webcrypto",name:"message-too-long",message:`${t} is ${e} bytes; this key's RSA-OAEP bound is ${n.plaintextBound}`}})}function Hl(t){return t===void 0?{name:"RSA-OAEP"}:{name:"RSA-OAEP",label:t}}async function Jh(t,e,n){try{return new Uint8Array(await mn.decrypt(Hl(e),t,n))}catch{ot()}}var Yn=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n}async encrypt(e,n){n.length>this.#t.plaintextBound&&Vh("plaintext",n.length,this.#t);let r=await C("RSA-OAEP encrypt",()=>mn.encrypt(Hl(e),this.#e,n));return new Uint8Array(r)}async wrap(e,n){let{bytes:r}=an(n);r.length>this.#t.plaintextBound&&Vh("wrapped key material",r.length,this.#t);let s=await C("RSA-OAEP wrap",()=>mn.encrypt(Hl(e),this.#e,r));return new Uint8Array(s)}algorithmName(){return this.#e.algorithm.name}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.modulusLength}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}exportKeyRaw(){fe("RSA public keys have no raw form")}async exportKeySpki(){let e=await C("spki key export",()=>mn.exportKey("spki",this.#e));return new Uint8Array(e)}async exportKeyJwk(){let e=await C("jwk key export",()=>mn.exportKey("jwk",this.#e));return JSON.stringify({kty:e.kty,n:e.n,e:e.e})}},qh=new WeakMap;function Gn(t){let e=qh.get(t);return e===void 0&&B("decryption-key-options minted by another provider"),e}var ca=class{constructor(){qh.set(this,{decrypt:!1,unwrap:!1,extractable:!1})}canDecrypt(e){Gn(this).decrypt=e}canUnwrap(e){Gn(this).unwrap=e}extractable(e){Gn(this).extractable=e}};function ia(t){return Fr([["decrypt",t.decrypt||t.unwrap]])}function uk(t){let e=[];return t.decrypt&&e.push("decrypt"),t.unwrap&&e.push("unwrapKey"),e}var Xn=class{#e;#t;#n;constructor(e,n,r){this.#e=e,this.#t=n,this.#n={...r}}decrypt(e,n){return this.canDecrypt()||q("decrypt"),Jh(this.#e,e,n)}async unwrap(e,n){return this.canUnwrap()||q("unwrap"),new it(await Jh(this.#e,e,n))}algorithmName(){return this.#e.algorithm.name}algorithmHash(){return this.#t.hash}algorithmLength(){return this.#t.modulusLength}algorithmPublicExponent(){let e=this.#e.algorithm.publicExponent;return e===void 0?void 0:new Uint8Array(e)}canDecrypt(){return this.#n.decrypt}canUnwrap(){return this.#n.unwrap}extractable(){return this.#e.extractable}async exportKeyJwk(){this.#e.extractable||$e();let e=await C("jwk key export",()=>mn.exportKey("jwk",this.#e));return JSON.stringify({kty:e.kty,n:e.n,e:e.e,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi})}async exportKeyPkcs8(){this.#e.extractable||$e();let e=await C("pkcs8 key export",()=>mn.exportKey("pkcs8",this.#e));return new Uint8Array(e)}async toWrapInputJwk(){return new se("jwk",new TextEncoder().encode(await this.exportKeyJwk()))}async toWrapInputPkcs8(){return new se("pkcs8",await this.exportKeyPkcs8())}},zl={EncryptionKey:Yn,DecryptionKey:Xn,DecryptionKeyOptions:ca},Vl={importEncryptionKeySpki:async(t,e)=>{let n=me(bt,t);Ji(e);let r=await G("RSA-OAEP spki","spki",e,{name:"RSA-OAEP",hash:n.hash},!0,["encrypt"]),s=aa(r,"RSA-OAEP spki");return new Yn(r,po(n,s))},importEncryptionKeyJwk:async(t,e)=>{let n=me(bt,t),r=Y(e);eo(to("RSA-OAEP"),t,r),W(r.n),W(r.e);let s=await X("RSA-OAEP public JWK",r,{name:"RSA-OAEP",hash:n.hash},!0,["encrypt"]),o=aa(s,"RSA-OAEP public JWK");return new Yn(s,po(n,o))}},ho={generateKey:async(t,e,n)=>{Vn();let r=Gn(n);ia(r);let s=me(bt,t),o=me(xl,e),i=await C("RSA-OAEP key generation",()=>mn.generateKey({name:"RSA-OAEP",hash:s.hash,modulusLength:o,publicExponent:new Uint8Array([1,0,1])},r.extractable,["encrypt","decrypt"])),a=po(s,o);return[new Xn(i.privateKey,a,r),new Yn(i.publicKey,a)]},importDecryptionKeyPkcs8:async(t,e,n)=>{Vn();let r=Gn(n),s=ia(r),o=me(bt,t),i=await G("RSA-OAEP pkcs8","pkcs8",e,{name:"RSA-OAEP",hash:o.hash},r.extractable,s),a=aa(i,"RSA-OAEP pkcs8");return new Xn(i,po(o,a),r)},importDecryptionKeyJwk:async(t,e,n)=>{Vn();let r=Gn(n),s=ia(r),o=me(bt,t),i=Y(e);eo(to("RSA-OAEP"),t,i);for(let l of["n","e","d","p","q","dp","dq","qi"])W(i[l]);let a=await X("RSA-OAEP private JWK",i,{name:"RSA-OAEP",hash:o.hash},r.extractable,s);a.type!=="private"&&A("RSA private JWK must carry `d` and the CRT members");let c=aa(a,"RSA-OAEP private JWK");return new Xn(a,po(o,c),r)},unwrapDecryptionKeyPkcs8:(t,e,n)=>{let{bytes:r}=F(e);return Z("unwrapped RSA-OAEP pkcs8",()=>ho.importDecryptionKeyPkcs8(t,r,n))},unwrapDecryptionKeyJwk:(t,e,n)=>{let{bytes:r}=F(e),s=Gn(n);ia(s);let o=be(r,"enc",uk(s));return Z("unwrapped RSA-OAEP private JWK",()=>ho.importDecryptionKeyJwk(t,o,n))}};function Gh(){return{"polymorph:webcrypto/digest@0.1.0":th,"polymorph:webcrypto/sha2@0.1.0":sl,"polymorph:webcrypto/sha1-checked@0.1.0":ol,"polymorph:webcrypto/mac@0.1.0":hh,"polymorph:webcrypto/hmac-sha1@0.1.0":hl,"polymorph:webcrypto/hmac-sha2@0.1.0":ml,"polymorph:webcrypto/signature@0.1.0":Eh,"polymorph:webcrypto/ed25519-verify@0.1.0":wl,"polymorph:webcrypto/ed25519-sign@0.1.0":Ys,"polymorph:webcrypto/ecdsa-verify@0.1.0":kl,"polymorph:webcrypto/ecdsa-sign@0.1.0":Qs,"polymorph:webcrypto/rsassa-pkcs1-v15-verify@0.1.0":Tl,"polymorph:webcrypto/rsassa-pkcs1-v15-sign@0.1.0":$l,"polymorph:webcrypto/rsa-pss-verify@0.1.0":Sl,"polymorph:webcrypto/rsa-pss-sign@0.1.0":Il,"polymorph:webcrypto/key-agreement@0.1.0":Al,"polymorph:webcrypto/x25519@0.1.0":no,"polymorph:webcrypto/ecdh@0.1.0":ro,"polymorph:webcrypto/derivation@0.1.0":cl,"polymorph:webcrypto/wrapping@0.1.0":fl,"polymorph:webcrypto/hkdf@0.1.0":Pl,"polymorph:webcrypto/hkdf-sha2@0.1.0":Ll,"polymorph:webcrypto/hkdf-sha1@0.1.0":Nl,"polymorph:webcrypto/pbkdf2@0.1.0":_l,"polymorph:webcrypto/pbkdf2-sha2@0.1.0":Dl,"polymorph:webcrypto/pbkdf2-sha1@0.1.0":Fl,"polymorph:webcrypto/aead@0.1.0":Bl,"polymorph:webcrypto/aes-gcm@0.1.0":ra,"polymorph:webcrypto/cipher@0.1.0":Ul,"polymorph:webcrypto/aes-cbc@0.1.0":Wl,"polymorph:webcrypto/aes-ctr@0.1.0":jl,"polymorph:webcrypto/key-wrap@0.1.0":Kl,"polymorph:webcrypto/aes-kw@0.1.0":fo,"polymorph:webcrypto/public-encryption@0.1.0":zl,"polymorph:webcrypto/rsa-oaep-encrypt@0.1.0":Vl,"polymorph:webcrypto/rsa-oaep-decrypt@0.1.0":ho}}function H(t){return new j(t,t.kind+("value"in t?`: ${t.value}`:""))}var fk=3e4,dk=1e4,pk=8*1024*1024,hk=8*1024*1024,mk=4,yk=65536,Xh=pk,Jl=fk,ql=dk;function wk(t){t.maxInboundBufferBytes!==void 0&&gk(t.maxInboundBufferBytes),t.connectTimeoutMs!==void 0&&bk(t.connectTimeoutMs),t.closeTimeoutMs!==void 0&&kk(t.closeTimeoutMs)}function gk(t){if(!(Number.isFinite(t)&&t>0))throw new Error(`invalid inbound buffer bound ${t}: expected a positive byte count`);Xh=t}function bk(t){if(!(Number.isFinite(t)&&t>0))throw new Error(`invalid connect timeout ${t}: expected positive milliseconds`);Jl=t}function kk(t){if(!(Number.isFinite(t)&&t>0))throw new Error(`invalid close timeout ${t}: expected positive milliseconds`);ql=t}var xk=new TextEncoder;function Yh(t){return xk.encode(t).byteLength}function Ek(t){if(!t.length)return!1;for(let e=0;e=127||'"(),/:;<=>?@[\\]{}'.includes(t[e]))return!1}return!0}function vk(t){if(t.includes("#"))throw H({kind:"invalid-url",value:"URL must not have a fragment"});let e;try{e=new URL(t)}catch(n){throw H({kind:"invalid-url",value:`URL does not parse: ${n?.message??n}`})}if(e.protocol!=="ws:"&&e.protocol!=="wss:")throw H({kind:"invalid-url",value:`URL scheme must be ws or wss, not ${JSON.stringify(e.protocol)}`});if(!e.hostname)throw H({kind:"invalid-url",value:"URL must have a host"});if(e.username||e.password)throw H({kind:"invalid-url",value:"URL must not have userinfo"})}function Tk(t){for(let e=0;e=3e3&&t<=4999))throw H({kind:"invalid-argument",value:`close code must be 1000 or in 3000-4999, not ${t}`})}else if(e.length)throw H({kind:"invalid-argument",value:"a close reason requires a close code"});let n=Yh(e);if(n>123)throw H({kind:"invalid-argument",value:`close reason must be at most 123 bytes, got ${n}`})}var $k=new Set([0,1006,1015]),Gl=class t{#e;#t;#n=!1;#s=!1;#r=!1;#o=void 0;#i=[];#a=null;static async connect(e,n){vk(e),Tk(n);let r;try{r=n.length?new WebSocket(e,n):new WebSocket(e)}catch(s){throw H({kind:"connect-failed",value:String(s?.message??s)})}if(r.binaryType="arraybuffer",await new Promise((s,o)=>{let i,a=(f,d)=>{clearTimeout(i),r.removeEventListener("open",c),r.removeEventListener("close",l),r.removeEventListener("error",u),f(d)},c=()=>a(s),l=f=>{let d=f;a(o,H({kind:"connect-failed",value:d.reason||`connection failed (code ${d.code})`}))},u=()=>{};r.addEventListener("open",c,{once:!0}),r.addEventListener("close",l,{once:!0}),r.addEventListener("error",u,{once:!0}),i=setTimeout(()=>{a(o,H({kind:"connect-failed",value:`handshake timed out after ${Jl}ms`}));try{r.close()}catch{}},Jl)}),n.length&&!n.includes(r.protocol)){try{r.close()}catch{}throw H({kind:"connect-failed",value:r.protocol?`server selected subprotocol ${JSON.stringify(r.protocol)} which was not offered`:"server selected no subprotocol although one was offered"})}if(!n.length&&r.protocol){try{r.close()}catch{}throw H({kind:"connect-failed",value:`server selected subprotocol ${JSON.stringify(r.protocol)} although none was offered`})}return new t(r)}constructor(e){this.#e=e,this.#t=Ik(e,()=>this.#c()),e.addEventListener("close",n=>this.#u(n),{once:!0}),e.addEventListener("error",()=>{},{once:!0})}protocol(){return this.#e.protocol}async send(e){for(;;){if(this.#n||this.#e.readyState!==WebSocket.OPEN)throw H({kind:"closed"});if(this.#e.bufferedAmount<=hk)break;await new Promise(n=>setTimeout(n,mk))}try{this.#e.send(e.value)}catch(n){throw H({kind:"other",value:String(n?.message??n)})}}receive(){return this.#n?Promise.reject(H({kind:"closed"})):this.#s?Promise.reject(H({kind:"receiving-via-stream"})):this.#t.next()}async sendViaStream(e){let n=0n;try{for await(let r of Ak(e)){let{bytes:s,excess:o}=await Pk(r.data,r.length);if(o>0||s.length!==r.length)throw H({kind:"other",value:`stream-message payload was ${s.length+o} bytes but length declared ${r.length}`});let i;if(r.kind==="string"){let a;try{a=new TextDecoder("utf-8",{fatal:!0}).decode(s)}catch{throw H({kind:"other",value:"string stream-message payload is not valid UTF-8"})}i={kind:"string",value:a}}else i={kind:"binary",value:s};await this.send(i),n+=1n}}catch(r){let s=r instanceof j?r.payload:{kind:"other",value:String(r)};throw new j({error:s,sent:n},`send-via-stream failed after ${n} message(s)`)}}receiveViaStream(){if(this.#n)throw H({kind:"closed"});if(this.#s)throw H({kind:"receiving-via-stream"});this.#s=!0;let e=this.#t;return e.rejectWaiters({kind:"receiving-via-stream"}),new ReadableStream({async pull(n){let r;try{r=await e.next()}catch{n.close();return}let s=r.kind==="string"?new TextEncoder().encode(r.value):r.value;n.enqueue({kind:r.kind,length:s.length,data:Rk(s)})}})}state(){return this.#l()}waitClosed(){return this.#r?Promise.resolve(this.#o):new Promise(e=>this.#i.push(e))}close(e,n){if(Sk(e,n),!this.#n){this.#n=!0,this.#t.discard(),this.#a=setTimeout(()=>this.#u(null),ql);try{e==null?this.#e.close():n.length?this.#e.close(e,n):this.#e.close(e)}catch{}}}[Symbol.dispose](){try{this.close(void 0,"")}catch{}}#c(){!this.#r&&this.#a===null&&(this.#a=setTimeout(()=>this.#u(null),ql))}#l(){if(this.#r)return"closed";if(this.#n)return"closing";switch(this.#e.readyState){case WebSocket.CLOSING:return"closing";case WebSocket.CLOSED:return"closed";default:return"open"}}#u(e){if(this.#r)return;this.#r=!0,this.#a!==null&&(clearTimeout(this.#a),this.#a=null),this.#t.end(),e&&!$k.has(e.code)?this.#o={code:e.code,reason:e.reason??""}:this.#o=void 0;let n=this.#i;this.#i=[];for(let r of n)r(this.#o)}};function Ik(t,e){let n=Xh,r=[],s=[],o=0,i=!1,a=!1,c=(f,d)=>{let w=s.shift();w?w.resolve(f):(o+=d,r.push({message:f,size:d}))};t.addEventListener("message",f=>{let d=f.data;if(i)return;let w=typeof d=="string"?Yh(d):d.byteLength;if(o+w>n){i=!0;try{t.close()}catch{}e();return}let y=typeof d=="string"?{kind:"string",value:d}:{kind:"binary",value:new Uint8Array(d)};c(y,w)});let l=()=>i?{kind:"receive-buffer-overflow"}:{kind:"closed"},u=()=>{if(!a)for(a=!0;s.length;)s.shift().reject(H(l()))};return t.addEventListener("close",u),t.addEventListener("error",u),{next(){if(r.length){let{message:f,size:d}=r.shift();return o-=d,Promise.resolve(f)}return i?Promise.reject(H({kind:"receive-buffer-overflow"})):a?Promise.reject(H({kind:"closed"})):new Promise((f,d)=>s.push({resolve:f,reject:d}))},rejectWaiters(f){for(;s.length;)s.shift().reject(H(f))},end:u,discard(){for(r.length=0,o=0,a=!0;s.length;)s.shift().reject(H({kind:"closed"}))}}}async function*Ak(t){if(typeof ReadableStream<"u"&&t instanceof ReadableStream){let e=t.getReader();try{for(;;){let{value:n,done:r}=await e.read();if(r)break;yield n}}finally{e.releaseLock()}return}for await(let e of t)Array.isArray(e)?yield*e:yield e}function Ck(t){return typeof t=="number"?Uint8Array.of(t):t instanceof Uint8Array?t:Uint8Array.from(t)}function Rk(t){return new ReadableStream({start(e){t.length&&e.enqueue(t),e.close()}})}async function Pk(t,e){let n=[],r=0,s=0,o=c=>{if(c==null)return;let l=Ck(c);if(!l.length)return;let u=e-r;if(l.length>u){if(s+=l.length-Math.max(u,0),u<=0)return;l=l.subarray(0,u)}n.push(l),r+=l.length};if(typeof ReadableStream<"u"&&t instanceof ReadableStream){let c=t.getReader();try{for(;;){let{value:l,done:u}=await c.read();if(u)break;o(l)}}finally{c.releaseLock()}}else if(t instanceof st)for(;;){let c=await t.read(yk);if(c.length===0)break;o(c)}else for await(let c of t)o(c);let i=new Uint8Array(r),a=0;for(let c of n)i.set(c,a),a+=c.length;return{bytes:i,excess:s}}var Lk="polymorph:websocket/connections@0.1.0",Nk={Websocket:Gl};function Zh(t){return t&&wk(t),{[Lk]:Nk}}function lt(t){switch(t.kind){case"tuple":return{kind:"record",fields:t.elements.map((e,n)=>({label:String(n),type:e}))};case"enum":return{kind:"variant",cases:t.labels.map(e=>({label:e,type:null}))};case"option":return{kind:"variant",cases:[{label:"none",type:null},{label:"some",type:t.type}]};case"result":return{kind:"variant",cases:[{label:"ok",type:t.ok},{label:"error",type:t.error}]};case"map":return{kind:"list",element:lt({kind:"tuple",elements:[t.key,t.value]})};default:return t}}function ct(t,e){if(t===e)return!0;if(t.kind!==e.kind)return!1;switch(t.kind){case"list":{let n=e;return t.length===n.length&&ct(t.element,n.element)}case"record":{let n=e;return t.fields.length===n.fields.length&&t.fields.every((r,s)=>r.label===n.fields[s].label&&ct(r.type,n.fields[s].type))}case"tuple":{let n=e;return t.elements.length===n.elements.length&&t.elements.every((r,s)=>ct(r,n.elements[s]))}case"variant":{let n=e;return t.cases.length===n.cases.length&&t.cases.every((r,s)=>{let o=n.cases[s];return r.label!==o.label?!1:r.type===null||o.type===null?r.type===o.type:ct(r.type,o.type)})}case"enum":case"flags":{let n=e;return t.labels.length===n.labels.length&&t.labels.every((r,s)=>r===n.labels[s])}case"option":{let n=e;return ct(t.type,n.type)}case"result":{let n=e;return t.ok===null!=(n.ok===null)||t.error===null!=(n.error===null)?!1:(t.ok===null||ct(t.ok,n.ok))&&(t.error===null||ct(t.error,n.error))}case"map":{let n=e;return ct(t.key,n.key)&&ct(t.value,n.value)}case"own":case"borrow":{let n=e;return t.rt===n.rt}case"stream":case"future":{let n=e;return t.element===null!=(n.element===null)?!1:t.element===null||ct(t.element,n.element)}case"error-context":return!0;default:return!0}}var Gr=class extends Error{constructor(e){super(e),this.name="PlanError"}};var Zn=class extends Error{constructor(e="canonical ABI trap"){super(e),this.name="Trap"}};function Xr(t){throw new Zn(t)}function Q(t,e){t&&Xr(e)}var la=class extends Error{constructor(e="internal assertion failed"){super(e),this.name="AssertionError"}};function M(t,e){if(!t)throw new la(e)}var tD=new DataView(new ArrayBuffer(8));var Yl=class t{static MAX_LENGTH=2**28-1;array=[null];free=[];get(e){return Q(e>=this.array.length,"table index out of range"),Q(this.array[e]===null,"table entry empty"),this.array[e]}add(e){let n;return this.free.length>0?(n=this.free.pop(),M(this.array[n]===null),this.array[n]=e):(n=this.array.length,Q(n>t.MAX_LENGTH,"table full"),this.array.push(e)),n}remove(e){let n=this.get(e);return this.array[e]=null,this.free.push(e),n}*[Symbol.iterator](){for(let e of this.array)e!==null&&(yield e)}};var Fk=2**32-1;var pD=(1<<28)-1;var hD=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),mD=new TextDecoder("utf-16le",{fatal:!0,ignoreBOM:!0}),yD=new TextEncoder;function Gk(){let t;try{t=Deno.env.get("DELTIC_SCHED_SEED")}catch{return null}if(t===void 0||t==="")return null;let e=Number(t);return Number.isFinite(e)?Math.trunc(e)>>>0:null}var LD=Gk();var Xk=[];var Yk=[];function Zk(t,e){console.error(`[amb] ${t} ${Qn(e)} | stack=[${Xk.map(Qn).join(",")}] claims=[${Yk.map(Qn).join(",")}] resuming=${er===null?"-":Qn(er)} ${(new Error().stack??"").split(` `).slice(2,6).join(` -`)}`)}var Vh=new WeakMap,Hk=1;function Yn(t){if(t==null||typeof t!="object")return String(t);let e=Vh.get(t);return e===void 0&&(e=Hk++,Vh.set(t,e)),`T${e}`}var Zn=null;function Xl(t){zk&&Kk("set-resuming",t),M(Zn===null||Zn===t,"two activations claim the resumed ambient at once \u2014 the resolve-one-per-turn discipline was violated"),Zn=t}function po(){return Zn!==null}function Jh(){Zn=null}var zk=(()=>{try{return Deno.env.get("CE_AMBIENT_TRACE")==="1"}catch{return!1}})();var ho=function(t){return t[t.NONE=0]="NONE",t[t.SUBTASK=1]="SUBTASK",t[t.STREAM_READ=2]="STREAM_READ",t[t.STREAM_WRITE=3]="STREAM_WRITE",t[t.FUTURE_READ=4]="FUTURE_READ",t[t.FUTURE_WRITE=5]="FUTURE_WRITE",t[t.TASK_CANCELLED=6]="TASK_CANCELLED",t}({}),ID=[ho.NONE,0,0];var CD=(()=>{try{return Deno.env.get("CE_EVENT_TRACE")==="1"}catch{return!1}})();function mo(t,e){return t===null||e===null?t===e:at(t,e)}var Jk=2**28-1,Ze=function(t){return t[t.COMPLETED=0]="COMPLETED",t[t.DROPPED=1]="DROPPED",t[t.CANCELLED=2]="CANCELLED",t}({});function qk(t){if(t===null)return!0;switch(ct(t).kind){case"u8":case"u16":case"u32":case"u64":case"s8":case"s16":case"s32":case"s64":case"f32":case"f64":return!0;default:return!1}}var Qn=class{t;onLowered;boundStore;dropped;pendingInst;pendingBuffer;pendingOnCopy;pendingOnCopyDone;constructor(e){this.t=e,this.onLowered=null,this.boundStore=null,this.dropped=!1,this.pendingInst=null,this.pendingBuffer=null,this.pendingOnCopy=null,this.pendingOnCopyDone=null}resetPending(){this.setPending(null,null,null,null)}setPending(e,n,r,s){this.pendingInst=e,this.pendingBuffer=n,this.pendingOnCopy=r,this.pendingOnCopyDone=s}resetAndNotifyPending(e){let n=this.pendingOnCopyDone;M(n!==null,"reset_and_notify_pending with nothing pending"),this.resetPending(),n(e)}cancel(){this.resetAndNotifyPending(Ze.CANCELLED)}drop(){this.dropped||(this.dropped=!0,this.pendingBuffer&&this.resetAndNotifyPending(Ze.DROPPED))}read(e,n,r,s){if(this.dropped)s(Ze.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#e(n),this.#t(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());n.write(this.pendingBuffer.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(Ze.COMPLETED)}else this.resetAndNotifyPending(Ze.COMPLETED),this.setPending(e,n,r,s)}write(e,n,r,s){if(this.dropped)s(Ze.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#e(n),this.#t(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());this.pendingBuffer.write(n.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(Ze.COMPLETED)}else n.isZeroLength()&&this.pendingBuffer.isZeroLength()?s(Ze.COMPLETED):(this.resetAndNotifyPending(Ze.COMPLETED),this.setPending(e,n,r,s))}#e(e){M(mo(this.t,e.t)&&mo(e.t,this.pendingBuffer.t),"stream element type mismatch between ends")}#t(e){Q(e===this.pendingInst&&!qk(this.t),"cannot read from and write to intra-component stream")}};var sF=(1<<28)-1;var LB=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var GB=Promise.resolve();var XB=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var la=class{addrType="i32";#e;#t;#n=null;#s=new Uint8Array(0);#r=new DataView(new ArrayBuffer(0));constructor(e,n){this.#e=e,this.#t=n}#o(){let e=this.#e();if(e===void 0)throw new Vr(`${this.#t} accessed before its extract-memory initializer ran`);return e}#i(){let e=this.#o().buffer;e!==this.#n&&(this.#n=e,this.#s=new Uint8Array(e),this.#r=new DataView(e))}get bytes(){return this.#i(),this.#s}get view(){return this.#i(),this.#r}get length(){return this.#o().buffer.byteLength}ptrType(){return this.addrType}ptrSize(){return 4}},fM=new la(()=>{},"check");var xx=(()=>{try{return Deno.env.get("DELTIC_DRIVE_TRACE")==="1"}catch{return!1}})(),Ex=0;function vx(t){let e=t,n=e?.constructor?.name??"?",r="?";try{r=e.ready?.()?"READY":e.readyFunc===null?"explicit":"not-ready"}catch(s){r=`threw:${s}`}return`${n}[${r}]`}function er(t,e,n,r){if(!xx)return;let s="?";try{s=String(n())}catch(a){s=`threw:${a}`}let o=e.waiting.map(vx).join(","),i=[...e.awaiting].map(a=>`${a?.constructor?.name??"?"}`).join(",");console.error(`[drive #${Ex++}] ${t} branch=${r} ready=${e.readyCandidates().length} waiting=${e.waiting.length}{${o}} awaiting=${e.awaiting.size} hostCalls=${e.pendingHostCalls.size} awaiters={${i}} claim=${po()} done=${s}`)}var Qh=new WeakMap;function eu(t){let e=t.awaiting,n=Qh.get(e);return n===void 0&&(n=e.then(r=>({t,p:e,value:r,failure:void 0}),r=>({t,p:e,value:void 0,failure:{error:r}})),Qh.set(e,n)),n}async function tm(t,e,n){return await Tx(t,e,n)}var nu=new WeakMap,ua=new WeakMap;function Gr(t){return nu.get(t)??0}function nm(t){if(Gr(t)===0)return Promise.resolve();let e=ua.get(t);if(e===void 0){let n;e={p:new Promise(s=>n=s),r:n},ua.set(t,e)}return e.p}async function Tx(t,e,n){nu.set(t,Gr(t)+1);try{let r=0;for(;;){if(er("driveAsync",t,e,"top"),t.serviceSettled(),t.hostFailure!==void 0)throw tu(t);if(po()){er("driveAsync",t,e,"yield-claim"),r++,M(r<1e4,"driveAsync: a resumed-activation claim was never released (the activation neither parked, finished, nor trapped)"),r%100===0?await new Promise(s=>setTimeout(s,0)):await Promise.resolve();continue}for(r=0;t.tick();){if(t.hostFailure!==void 0)throw tu(t);if(t.awaiting.size>0&&(await Promise.resolve(),t.settled.length>0))break}if(t.hostFailure!==void 0)throw tu(t);if(e()){er("driveAsync",t,e,"EXIT-done");return}if(!(t.settled.length>0||po())){if(t.awaiting.size>0){if(t.pendingHostCalls.size===0&&!po()){er("driveAsync",t,e,"deadlock-probe");let l=[...t.awaiting],u=await Promise.race([...l.map(f=>eu(f).then(()=>!0)),new Promise(f=>setTimeout(()=>f(!1),0))]);if(er("driveAsync",t,e,`deadlock-probe:progressed=${u}`),!u){let f=[...t.awaiting];if(f.length!==l.length||f.some((w,y)=>w!==l[y]))continue;t.readyCandidates().length===0&&Q(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: every suspended activation is waiting on a suspension only this scheduler could resume, and none is ready)`);continue}}if(t.awaiting.size===0)continue;let s=[...t.awaiting],o=s[0],i=eu(o),a=s.slice(1).map(eu);for(let l of t.pendingHostCalls)a.push(l.then(()=>null,()=>null));Xl(o);let c;try{c=await Promise.race([i,...a])}finally{Jh()}c!==null&&t.awaiting.has(c.t)&&c.t.awaiting===c.p&&c.t.resumeWith(c.value,c.failure);continue}t.pendingHostCalls.size===0&&(er("driveAsync",t,e,"DEADLOCK-TRAP"),Q(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: no thread is ready and no host call is outstanding)`)),er("driveAsync",t,e,"await-race"),await Promise.race([...t.pendingHostCalls]).catch(()=>{})}}}finally{let r=Gr(t)-1;if(nu.set(t,r),r===0){let s=ua.get(t);ua.delete(t),s?.r()}}}function tu(t){let e=t.hostFailure;return t.hostFailure=void 0,e}var SM=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var GM=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var n6=(()=>{try{return Deno.env.get("CE_CTX_TRACE")==="1"}catch{return!1}})();var t8=(()=>{try{return Deno.env.get("CE_SCOPE_TRACE")==="1"}catch{return!1}})();var C8=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var am=Object.freeze({hostEnd:!0}),fa=class{t;values;length;progress;taken;constructor(e,n,r){this.t=e,this.values=n,this.length=r,this.progress=0,this.taken=[]}remain(){return this.length-this.progress}isZeroLength(){return this.length===0}read(e){M(e<=this.remain(),"host buffer read beyond remaining");let n=this.values===null?new Array(e).fill(null):this.values.slice(this.progress,this.progress+e);return this.progress+=e,n}write(e){M(e.length<=this.remain(),"host buffer write beyond remaining");for(let n of e)this.taken.push(n);this.progress+=e.length}},cm=new WeakSet;function su(t){return t.settled.length===0&&t.awaiting.size===0&&!Cx(t)}function Cx(t){for(let e of t.pendingHostCalls)if(!cm.has(e))return!0;return!1}var da=class{#e=null;#t=null;#n=null;#s=!1;#r=!1;bind(e){this.#e!==null||this.#s||(this.#e=e,this.#o())}#o(){this.#e===null||this.#t!==null||this.#s||(this.#t=new Promise(e=>this.#n=e),cm.add(this.#t),this.#e.pendingHostCalls.add(this.#t))}notify(){let e=this.#t,n=this.#n;this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.(),this.#o()}pump(){let e=this.#e;if(e!==null){for(;;){let n=e.serviceSettled(),r=e.tick();if(!n&&!r)break}this.#r||su(e)||(this.#r=!0,this.#i(e))}}async#i(e){try{for(;!su(e);){if(Gr(e)>0){await nm(e);continue}await tm(e,()=>e.pendingHostCalls.size===0||su(e)||Gr(e)>1,"host stream/future activity")}}catch(n){e.hostFailure??=n}finally{this.#r=!1}this.notify()}close(){let e=this.#t,n=this.#n;this.#s=!0,this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.()}};function lm(t,e){let n=t;M(n.onLowered==null,"this stream/future is already wrapped by a host end; hostStreamFor/hostFutureFor may wrap a shared object once"),n.onLowered=s=>e.bind(s.store);let r=t.boundStore;r&&e.bind(r)}function um(t,e){let n={read:!1,write:!1},r=s=>{s===Ze.DROPPED?e.close():e.notify()};return{writable:{write(s){let o=new fa(t.t,s,s.length);return new Promise(i=>{n.write=!0,t.write(am,o,a=>{o.remain()>0||(a(),n.write=!1,e.notify(),i(o.progress))},a=>{n.write=!1,r(a),i(o.progress)}),e.notify(),e.pump()})},async writeAll(s){let o=0;for(;o{n.read=!0,t.read(am,o,a=>{a(),n.read=!1,e.notify(),i(o.taken)},a=>{n.read=!1,r(a),i(o.taken)}),e.notify(),e.pump()})},cancelRead(){n.read&&(n.read=!1,t.cancel(),e.notify(),e.pump())},drop(){t.drop(),e.close(),e.pump()}}}}function fm(t){let e=new Qn(t),n=new da;return lm(e,n),{...um(e,n),value:e}}function dm(t){let e=t;M(e instanceof Qn,"hostStreamFor expects a lifted stream value");let n=new da;return lm(e,n),{...um(e,n),value:t}}var U=class extends Error{payload;constructor(e,n){super(n??`WIT error: ${Rx(e)}`),this.name="WitError",this.payload=e}};function Rx(t){return t==null?String(t):typeof t=="object"&&"tag"in t?String(t.tag):typeof t=="object"?JSON.stringify(t):String(t)}var J8=Symbol("deltic.resource-state");var q8=new FinalizationRegistry(t=>{if(t.valid&&t.owns){t.valid=!1;try{t.rt.dtor?.(t.rep)}catch{}}});var Nx=new WeakMap;function iu(t){let e=Nx.get(t);if(e!==void 0)throw e}function Ox(t){return t!==null&&ct(t).kind==="u8"}var Xr=class t{#e;#t;#n=!1;#s=!1;#r=[];constructor(e,n){this.#e=e,this.#t=n}static fromLifted(e,n){return new t(dm(e),n)}static fromHostStream(e,n){return new t(e,n)}static create(){let e=new t(null,null);return{stream:e,writer:new ma(e)}}bindElement(e){if(this.#e!==null)return;this.#t=e,this.#e=fm(e.element),_x(this,this.#e);let n=this.#r;this.#r=[];for(let r of n)r()}whenBound(){return this.#e!==null?Promise.resolve():new Promise(e=>this.#r.push(e))}get bound(){return this.#e!==null}takeValue(e){if(this.bindElement(e),this.#n)throw new TypeError("this Stream handle has already been passed to a guest; a stream value may only be transferred once");return this.#n=!0,this.#e.value}get codec(){return this.#t}#o(){if(this.#e===null)throw new TypeError("this Stream was created with Stream.create() and has not been passed to a guest yet, so it has no element type; pass it first, or use the writer, which parks until then");return this.#e}async read(e){let n=this.#o();iu(n.value);let r=await n.readable.read(e);return this.#i(r)}#i(e){let n=this.#t;return Ox(n.element)?Uint8Array.from(e):e.map(r=>n.toHost(r))}cancelRead(){this.#e?.readable.cancelRead()}drop(){this.#s||(this.#s=!0,this.#e?.readable.drop())}[Symbol.dispose](){this.drop()}readable(){let e=this;return new ReadableStream({async pull(n){let r=await e.read(hm);if(r.length===0){n.close();return}n.enqueue(r)},cancel(){e.drop()}})}async*[Symbol.asyncIterator](){for(;;){let e=await this.read(hm);if(e.length===0)return;yield e}}},hm=4096,ma=class{#e;constructor(e){this.#e=e}async write(e){await this.#e.whenBound();let n=ha(this.#e);iu(n.value);let r=this.#e.codec;return await n.writable.write(e.map(s=>r.fromHost(s)))}async writeAll(e){await this.#e.whenBound();let n=ha(this.#e);iu(n.value);let r=this.#e.codec;return await n.writable.writeAll(e.map(s=>r.fromHost(s)))}cancelWrite(){this.#e.bound&&ha(this.#e).writable.cancelWrite()}async close(){await this.#e.whenBound(),ha(this.#e).writable.drop()}},mm=new WeakMap;function ha(t){let e=mm.get(t);if(e===void 0)throw new TypeError("stream writer used before the stream was bound");return e}function _x(t,e){mm.set(t,e)}var yo=class{#e=[];add(e){this.#e.push(e)}end(){for(let e of this.#e)e();this.#e.length=0}},u3=new yo;var R3=Symbol("deltic.embedder.hostRegistries");var km=!1,Vt;async function xm(){if(Vt)return Vt;let t=globalThis;if(t.RTCPeerConnection)return Vt=t.RTCPeerConnection,Vt;try{let{RTCPeerConnection:e}=await import("node-datachannel/polyfill");return km=!0,Vt=e,Vt}catch(e){throw new Error("no RTCPeerConnection available: not running in a browser and node-datachannel could not be loaded (run `deno install --allow-scripts=npm:node-datachannel` in deltic-impl)",{cause:e})}}var gm=8*1024*1024,jx=2e4,Kx=1e3,Hx=8*1024*1024,zx=Hx;var Vx=new TextEncoder;function Jx(t){return Vx.encode(t).byteLength}var au=class{#e="";#t=!0;#n=void 0;label(){return this.#e}setLabel(e){this.#e=e}ordered(){return this.#t}setOrdered(e){this.#t=e}maxRetransmits(){return this.#n}setMaxRetransmits(e){this.#n=e}toInit(){let e={ordered:this.#t};return this.#n!=null&&(e.maxRetransmits=this.#n),e}},cu=class{#e=[];#t="all";iceServers(){return this.#e}setIceServers(e){for(let n of e){if(!n.urls.length)throw new U({tag:"invalid",val:"ice-server has no urls"});for(let r of n.urls)if(!/^(stun|stuns|turn|turns):/.test(r))throw new U({tag:"invalid",val:`ice-server url ${JSON.stringify(r)} has no stun:/stuns:/turn:/turns: scheme`})}this.#e=e}iceTransportPolicy(){return this.#t}setIceTransportPolicy(e){this.#t=e}toConfiguration(){let e={iceTransportPolicy:this.#t};return this.#e.length&&(e.iceServers=this.#e.map(n=>{let r={urls:n.urls};return n.username&&(r.username=n.username),n.credential&&(r.credential=n.credential),r})),e}};function qx(t){let e=zx,n=[],r=[],s=0,o=!1,i=!1,a=(u,f)=>{let d=r.shift();d?d.resolve(u):(s+=f,n.push({message:u,size:f}))};t.addEventListener("message",({data:u})=>{if(o)return;let f=typeof u=="string"?Jx(u):u.byteLength;if(s+f>e&&!r.length){o=!0,t.close();return}let d=typeof u=="string"?{tag:"string",val:u}:{tag:"binary",val:new Uint8Array(u)};a(d,f)});let c=()=>o?{tag:"receive-buffer-overflow"}:{tag:"closed"},l=()=>{if(!i)for(i=!0;r.length;)r.shift().reject(c())};return t.addEventListener("close",l),t.addEventListener("error",l),{next(){if(n.length){let{message:u,size:f}=n.shift();return s-=f,Promise.resolve(u)}return o?Promise.reject(new U({tag:"receive-buffer-overflow"})):i?Promise.reject(new U({tag:"closed"})):new Promise((u,f)=>{r.push({resolve:u,reject:d=>f(new U(d))})})},rejectWaiters(u){for(;r.length;)r.shift().reject(u)},discard(){for(n.length=0,s=0,i=!0;r.length;)r.shift().reject({tag:"closed"})}}}var wo=class{#e;#t;#n=!1;#s=!1;#r=!1;#o=new Set;constructor(e){this.#e=e,e.binaryType="arraybuffer",this.#t=qx(e)}label(){return this.#e.label}async send(e){if(this.#s)throw new U({tag:"closed"});await this.#i(),await this.#a();try{this.#e.send(e.val)}catch{throw new U({tag:"closed"})}}async receive(){if(this.#s)throw new U({tag:"closed"});if(this.#n)throw new U({tag:"receiving-via-stream"});return this.#t.next()}async sendViaStream(e){let n=0n;try{for await(let r of Yx(e)){let s=await Zx(r.data);if(s.length!==r.length)throw{tag:"other",val:`stream-message payload was ${s.length} bytes but length declared ${r.length}`};let o=r.kind==="string"?{tag:"string",val:new TextDecoder().decode(s)}:{tag:"binary",val:s};await this.send(o),n+=1n}}catch(r){let s=r instanceof U?r.payload:Gx(r)?r:{tag:"closed"};throw new U({error:s,sent:n})}}receiveViaStream(){if(this.#s)throw new U({tag:"closed"});if(this.#n)throw new U({tag:"receiving-via-stream"});this.#n=!0;let e=this.#t;return e.rejectWaiters({tag:"receiving-via-stream"}),new ReadableStream({async pull(n){let r;try{r=await e.next()}catch{n.close();return}let s=r.tag==="string"?new TextEncoder().encode(r.val):r.val;n.enqueue({kind:r.tag,length:s.length,data:e0(s)})}})}#i(){let e=this.#e;return e.readyState==="open"?Promise.resolve():e.readyState==="closing"||e.readyState==="closed"?Promise.reject(new U({tag:"closed"})):new Promise((n,r)=>{e.addEventListener("open",()=>n(),{once:!0}),e.addEventListener("close",()=>r(new U({tag:"closed"})),{once:!0}),e.addEventListener("error",()=>r(new U({tag:"closed"})),{once:!0})})}close(){if(!this.#s){this.#s=!0,this.#t.discard();try{this.#e.close()}catch{}for(let e of this.#o)e()}}stateChanges(){return this.#r?new ReadableStream({start(e){e.close()}}):(this.#r=!0,Em(()=>this.#e.readyState,e=>{for(let n of["open","closing","close","error"])this.#e.addEventListener(n,e);this.#o.add(e)},e=>e==="closed"))}[Symbol.dispose](){try{this.close()}catch{}}#a(){let e=this.#e;return e.bufferedAmount<=gm?Promise.resolve():new Promise(n=>{e.bufferedAmountLowThreshold=gm/2;let r=()=>{e.removeEventListener("bufferedamountlow",r),n()};e.addEventListener("bufferedamountlow",r)})}};function Gx(t){return typeof t=="object"&&t!==null&&typeof t.tag=="string"}var lu=class t{#e;#t;#n;#s=!1;#r=!1;#o=!1;#i=!1;#a=!1;#c=new Set;#l=new Set;#u=new Set;#f=!1;#p=new Set;constructor(e){if(!Vt)throw new Error("PeerConnection constructed before the RTCPeerConnection backend resolved \u2014 this should be unreachable via normal module import (top-level await); if resolution failed, the actionable error was already thrown/logged at module load. Use `await PeerConnection.create(config)` after `resetResolvedBackend()`.");let n=Vt;this.#e=new n(e?e.toConfiguration():void 0);let r=()=>{if(this.#h()&&(this.#s=!0),!this.#o&&this.#m()){this.#o=!0;for(let s of this.#c)s();this.#c.clear(),this.#t.end(),this.#n.end();for(let s of this.#p)s()}};this.#e.addEventListener("connectionstatechange",r),this.#e.addEventListener("iceconnectionstatechange",r),this.#t=bm((s,o)=>{let i=new Set,a=(c,l,u)=>{let f=c.trim().replace(/^a=/,"");i.has(f)||(i.add(f),s({candidate:f,sdpMid:l,sdpMlineIndex:u}))};this.#e.addEventListener("icecandidate",({candidate:c})=>{if(c==null||c.candidate===""){o();return}a(c.candidate,c.sdpMid??void 0,c.sdpMLineIndex??void 0)}),this.#e.addEventListener("icegatheringstatechange",()=>{if(this.#e.iceGatheringState==="complete"){for(let c of Xx(this.#e.localDescription?.sdp))a(c.candidate,c.sdpMid,c.sdpMlineIndex);o()}})}),this.#n=bm(s=>{this.#e.addEventListener("datachannel",({channel:o})=>{this.#l.add(o);let i=new wo(o);this.#u.add(i),s(i)})})}static async create(e){return await xm(),new t(e)}#d(){if(this.#r||this.#o||this.#m()||this.#e.connectionState==="closed")throw new U({tag:"closed"})}#h(){return this.#e.connectionState==="connected"||this.#e.iceConnectionState==="connected"||this.#e.iceConnectionState==="completed"}#m(){return this.#e.connectionState==="failed"||this.#e.iceConnectionState==="failed"}createDataChannel(e){this.#d();try{let n=this.#e.createDataChannel(e.label(),e.toInit());this.#l.add(n);let r=new wo(n);return this.#u.add(r),r}catch(n){throw new U({tag:"other",val:String(n)})}}incomingDataChannels(){return this.#a?new ReadableStream({start(e){e.close()}}):(this.#a=!0,this.#n.stream)}async createOffer(){this.#d();try{return km&&this.#l.size===0&&this.#e.createDataChannel("",{negotiated:!0,id:1023}),{kind:"offer",sdp:(await this.#e.createOffer()).sdp}}catch(e){throw new U({tag:"other",val:String(e)})}}async createAnswer(){this.#d();try{return{kind:"answer",sdp:(await this.#e.createAnswer()).sdp}}catch(e){throw new U({tag:"other",val:String(e)})}}async setLocalDescription(e){this.#d();try{await this.#e.setLocalDescription({type:e.kind,sdp:e.sdp})}catch(n){throw new U({tag:"invalid-signaling",val:String(n)})}}async setRemoteDescription(e){this.#d();try{await this.#e.setRemoteDescription({type:e.kind,sdp:e.sdp})}catch(n){throw new U({tag:"invalid-signaling",val:String(n)})}}localIceCandidates(){return this.#i?new ReadableStream({start(e){e.close()}}):(this.#i=!0,this.#t.stream)}async addIceCandidate(e){this.#d();try{await this.#e.addIceCandidate({candidate:e.candidate,sdpMid:e.sdpMid??null,sdpMLineIndex:e.sdpMlineIndex??null})}catch(n){throw new U({tag:"invalid-signaling",val:String(n)})}}stateChanges(){return this.#f?new ReadableStream({start(e){e.close()}}):(this.#f=!0,Em(()=>this.#r?"closed":this.#o?"failed":this.#e.connectionState,e=>{this.#e.addEventListener("connectionstatechange",e),this.#e.addEventListener("iceconnectionstatechange",e),this.#p.add(e)},e=>e==="failed"||e==="closed"))}async waitConnected(){let e=this.#e,n=()=>this.#m()||e.connectionState==="closed";if(this.#h()&&(this.#s=!0),!this.#s){if(this.#r||n())throw new U({tag:"closed"});await new Promise((r,s)=>{let o=setTimeout(()=>{c(),s(new U({tag:"timed-out"}))},jx),i=()=>{this.#h()?(this.#s=!0,c(),r()):n()&&(c(),s(new U({tag:"closed"})))},a=()=>{c(),s(new U({tag:"closed"}))},c=()=>{clearTimeout(o),this.#c.delete(a),e.removeEventListener("connectionstatechange",i),e.removeEventListener("iceconnectionstatechange",i)};this.#c.add(a),e.addEventListener("connectionstatechange",i),e.addEventListener("iceconnectionstatechange",i)})}}close(){if(this.#r)return;this.#r=!0;for(let s of this.#c)s();this.#c.clear(),this.#t.end(),this.#n.end();for(let s of this.#p)s();for(let s of this.#u)try{s.close()}catch{}let e=Date.now()+Kx,n=()=>[...this.#l].every(s=>s.bufferedAmount===0),r=setInterval(()=>{(n()||Date.now()>=e)&&(clearInterval(r),this.#e.close())},10);r.unref?.()}[Symbol.dispose](){try{this.close()}catch{}}};function Xx(t){if(!t)return[];let e=[],n,r=-1;for(let s of t.split(/\r?\n/))s.startsWith("m=")?(r+=1,n=void 0):s.startsWith("a=mid:")?n=s.slice(6).trim():s.startsWith("a=candidate:")&&e.push({candidate:s.slice(2).trim(),sdpMid:n,sdpMlineIndex:r>=0?r:void 0});return e}async function*Yx(t){if(t instanceof ReadableStream){let e=t.getReader();try{for(;;){let{value:n,done:r}=await e.read();if(r)break;yield n}}finally{e.releaseLock()}return}for await(let e of t)Array.isArray(e)?yield*e:yield e}async function Zx(t){let e=[],n=0,r=i=>{if(i==null)return;let a=Qx(i);a.length&&(e.push(a),n+=a.length)};if(typeof ReadableStream<"u"&&t instanceof ReadableStream){let i=t.getReader();try{for(;;){let{value:a,done:c}=await i.read();if(c)break;r(a)}}finally{i.releaseLock()}}else if(t instanceof Xr)for(;;){let a=await t.read(65536);if(a.length===0)break;r(a)}else for await(let i of t)r(i);let s=new Uint8Array(n),o=0;for(let i of e)s.set(i,o),o+=i.length;return s}function Qx(t){return typeof t=="number"?Uint8Array.of(t):t instanceof Uint8Array?t:Uint8Array.from(t)}function e0(t){return new ReadableStream({start(e){t.length&&e.enqueue(t),e.close()}})}function bm(t){let e,n=!1,r=[],s=new ReadableStream({start(a){e=a;for(let c of r)a.enqueue(c);r.length=0,n&&a.close()}}),o=a=>{n||(e?e.enqueue(a):r.push(a))},i=()=>{if(!n&&(n=!0,e))try{e.close()}catch{}};return t(o,i),{stream:s,end:i}}function Em(t,e,n){let r,s=!1,o=null;return e(()=>{if(o){let i=o;o=null,i()}}),new ReadableStream({async pull(i){for(;;){let a=new Promise(l=>{o=l}),c=t();if(!s||c!==r){s=!0,r=c,i.enqueue(c),n(c)&&i.close();return}if(n(c)){i.close();return}await a}}})}await xm().catch(()=>{Vt=void 0});var t0="polymorph:webrtc-datachannels/connections@0.1.0",n0={DataChannelOptions:au,PeerConnectionConfig:cu,DataChannel:wo,PeerConnection:lu};function vm(){return{[t0]:n0}}var r0=[];function go(t){r0.push(t);let e={tag:"not-supported"};throw new j(e,`wasi:sockets/types@0.3.0: ${t} is not provided by this host`)}var uu=class{static create(e){return go("udp-socket.create")}bind(e){return go("udp-socket.bind")}send(e,n){return go("udp-socket.send")}receive(){return go("udp-socket.receive")}getLocalAddress(){return go("udp-socket.get-local-address")}},s0="wasi:sockets/types@0.3.0";function Tm(){return{[s0]:{UdpSocket:uu}}}var Sm="polymorph:engine-spike/driver@0.1.0",o0="polymorph-data:tasks/tasks@0.1.0";async function $m(t,e){let n=Sp({cli:{args:[`engine-${t}`]}}),r={...n,...Ap().imports,...jh(),...zh(),...vm(),...Tm()},s=await _n(On(e.envelope,e.bytes),r),o=s.exports[Sm],i=s.exports[o0];if(!o||typeof o.init!="function")throw new Error(`export "${Sm}" missing or shapeless; exports: ${Object.keys(s.exports).join(", ")}`);return{driver:o,tasks:i,stdout:()=>n.captured.stdoutText(),stderr:()=>n.captured.stderrText()}}function fu(t){let e=new Uint8Array(t.length/2);for(let n=0;nn)throw new Error(`timeout: ${t}`);await new Promise(i=>setTimeout(i,r))}}var mn=new URLSearchParams(location.search),ya=mn.get("relay")??"https://use1-1.relay.n0.iroh.link",Pm=mn.get("code"),i0=!!Pm&&!!window.opener;if(i0){window.opener.postMessage({pmDropboxCode:Pm,state:mn.get("state")},location.origin);let t=document.getElementById("banner");t&&(t.textContent="authorization relayed \u2014 close this window"),window.close()}var Lm="pm-demo-storage",a0="pm-demo-s3";function wa(){if(mn.get("s3"))return{provider:"s3",endpoint:mn.get("s3"),bucket:mn.get("bucket")??"pm-demo",access:mn.get("access")??"",secret:mn.get("secret")??""};try{let t=localStorage.getItem(Lm);if(t)return JSON.parse(t);let e=localStorage.getItem(a0);return e?{provider:"s3",...JSON.parse(e)}:null}catch{return null}}var c0=`the live path needs the relay to be reachable (default: n0's public +`)}`)}var Qh=new WeakMap,Qk=1;function Qn(t){if(t==null||typeof t!="object")return String(t);let e=Qh.get(t);return e===void 0&&(e=Qk++,Qh.set(t,e)),`T${e}`}var er=null;function eu(t){ex&&Zk("set-resuming",t),M(er===null||er===t,"two activations claim the resumed ambient at once \u2014 the resolve-one-per-turn discipline was violated"),er=t}function mo(){return er!==null}function em(){er=null}var ex=(()=>{try{return Deno.env.get("CE_AMBIENT_TRACE")==="1"}catch{return!1}})();var yo=function(t){return t[t.NONE=0]="NONE",t[t.SUBTASK=1]="SUBTASK",t[t.STREAM_READ=2]="STREAM_READ",t[t.STREAM_WRITE=3]="STREAM_WRITE",t[t.FUTURE_READ=4]="FUTURE_READ",t[t.FUTURE_WRITE=5]="FUTURE_WRITE",t[t.TASK_CANCELLED=6]="TASK_CANCELLED",t}({}),DD=[yo.NONE,0,0];var FD=(()=>{try{return Deno.env.get("CE_EVENT_TRACE")==="1"}catch{return!1}})();function wo(t,e){return t===null||e===null?t===e:ct(t,e)}var nx=2**28-1,Qe=function(t){return t[t.COMPLETED=0]="COMPLETED",t[t.DROPPED=1]="DROPPED",t[t.CANCELLED=2]="CANCELLED",t}({});function rx(t){if(t===null)return!0;switch(lt(t).kind){case"u8":case"u16":case"u32":case"u64":case"s8":case"s16":case"s32":case"s64":case"f32":case"f64":return!0;default:return!1}}var tr=class{t;onLowered;boundStore;dropped;pendingInst;pendingBuffer;pendingOnCopy;pendingOnCopyDone;constructor(e){this.t=e,this.onLowered=null,this.boundStore=null,this.dropped=!1,this.pendingInst=null,this.pendingBuffer=null,this.pendingOnCopy=null,this.pendingOnCopyDone=null}resetPending(){this.setPending(null,null,null,null)}setPending(e,n,r,s){this.pendingInst=e,this.pendingBuffer=n,this.pendingOnCopy=r,this.pendingOnCopyDone=s}resetAndNotifyPending(e){let n=this.pendingOnCopyDone;M(n!==null,"reset_and_notify_pending with nothing pending"),this.resetPending(),n(e)}cancel(){this.resetAndNotifyPending(Qe.CANCELLED)}drop(){this.dropped||(this.dropped=!0,this.pendingBuffer&&this.resetAndNotifyPending(Qe.DROPPED))}read(e,n,r,s){if(this.dropped)s(Qe.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#e(n),this.#t(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());n.write(this.pendingBuffer.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(Qe.COMPLETED)}else this.resetAndNotifyPending(Qe.COMPLETED),this.setPending(e,n,r,s)}write(e,n,r,s){if(this.dropped)s(Qe.DROPPED);else if(!this.pendingBuffer)this.setPending(e,n,r,s);else if(this.#e(n),this.#t(e),this.pendingBuffer.remain()>0){if(n.remain()>0){let o=Math.min(n.remain(),this.pendingBuffer.remain());this.pendingBuffer.write(n.read(o)),this.pendingOnCopy(()=>this.resetPending())}s(Qe.COMPLETED)}else n.isZeroLength()&&this.pendingBuffer.isZeroLength()?s(Qe.COMPLETED):(this.resetAndNotifyPending(Qe.COMPLETED),this.setPending(e,n,r,s))}#e(e){M(wo(this.t,e.t)&&wo(e.t,this.pendingBuffer.t),"stream element type mismatch between ends")}#t(e){Q(e===this.pendingInst&&!rx(this.t),"cannot read from and write to intra-component stream")}};var dF=(1<<28)-1;var UB=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var rM=Promise.resolve();var sM=(()=>{try{return Deno.env.get("CE_SP_TRACE")==="1"}catch{return!1}})();var fa=class{addrType="i32";#e;#t;#n=null;#s=new Uint8Array(0);#r=new DataView(new ArrayBuffer(0));constructor(e,n){this.#e=e,this.#t=n}#o(){let e=this.#e();if(e===void 0)throw new Gr(`${this.#t} accessed before its extract-memory initializer ran`);return e}#i(){let e=this.#o().buffer;e!==this.#n&&(this.#n=e,this.#s=new Uint8Array(e),this.#r=new DataView(e))}get bytes(){return this.#i(),this.#s}get view(){return this.#i(),this.#r}get length(){return this.#o().buffer.byteLength}ptrType(){return this.addrType}ptrSize(){return 4}},bM=new fa(()=>{},"check");var Rx=(()=>{try{return Deno.env.get("DELTIC_DRIVE_TRACE")==="1"}catch{return!1}})(),Px=0;function Lx(t){let e=t,n=e?.constructor?.name??"?",r="?";try{r=e.ready?.()?"READY":e.readyFunc===null?"explicit":"not-ready"}catch(s){r=`threw:${s}`}return`${n}[${r}]`}function nr(t,e,n,r){if(!Rx)return;let s="?";try{s=String(n())}catch(a){s=`threw:${a}`}let o=e.waiting.map(Lx).join(","),i=[...e.awaiting].map(a=>`${a?.constructor?.name??"?"}`).join(",");console.error(`[drive #${Px++}] ${t} branch=${r} ready=${e.readyCandidates().length} waiting=${e.waiting.length}{${o}} awaiting=${e.awaiting.size} hostCalls=${e.pendingHostCalls.size} awaiters={${i}} claim=${mo()} done=${s}`)}var im=new WeakMap;function su(t){let e=t.awaiting,n=im.get(e);return n===void 0&&(n=e.then(r=>({t,p:e,value:r,failure:void 0}),r=>({t,p:e,value:void 0,failure:{error:r}})),im.set(e,n)),n}async function cm(t,e,n){return await Nx(t,e,n)}var iu=new WeakMap,da=new WeakMap;function Zr(t){return iu.get(t)??0}function lm(t){if(Zr(t)===0)return Promise.resolve();let e=da.get(t);if(e===void 0){let n;e={p:new Promise(s=>n=s),r:n},da.set(t,e)}return e.p}async function Nx(t,e,n){iu.set(t,Zr(t)+1);try{let r=0;for(;;){if(nr("driveAsync",t,e,"top"),t.serviceSettled(),t.hostFailure!==void 0)throw ou(t);if(mo()){nr("driveAsync",t,e,"yield-claim"),r++,M(r<1e4,"driveAsync: a resumed-activation claim was never released (the activation neither parked, finished, nor trapped)"),r%100===0?await new Promise(s=>setTimeout(s,0)):await Promise.resolve();continue}for(r=0;t.tick();){if(t.hostFailure!==void 0)throw ou(t);if(t.awaiting.size>0&&(await Promise.resolve(),t.settled.length>0))break}if(t.hostFailure!==void 0)throw ou(t);if(e()){nr("driveAsync",t,e,"EXIT-done");return}if(!(t.settled.length>0||mo())){if(t.awaiting.size>0){if(t.pendingHostCalls.size===0&&!mo()){nr("driveAsync",t,e,"deadlock-probe");let l=[...t.awaiting],u=await Promise.race([...l.map(f=>su(f).then(()=>!0)),new Promise(f=>setTimeout(()=>f(!1),0))]);if(nr("driveAsync",t,e,`deadlock-probe:progressed=${u}`),!u){let f=[...t.awaiting];if(f.length!==l.length||f.some((w,y)=>w!==l[y]))continue;t.readyCandidates().length===0&&Q(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: every suspended activation is waiting on a suspension only this scheduler could resume, and none is ready)`);continue}}if(t.awaiting.size===0)continue;let s=[...t.awaiting],o=s[0],i=su(o),a=s.slice(1).map(su);for(let l of t.pendingHostCalls)a.push(l.then(()=>null,()=>null));eu(o);let c;try{c=await Promise.race([i,...a])}finally{em()}c!==null&&t.awaiting.has(c.t)&&c.t.awaiting===c.p&&c.t.resumeWith(c.value,c.failure);continue}t.pendingHostCalls.size===0&&(nr("driveAsync",t,e,"DEADLOCK-TRAP"),Q(!0,`wasm trap: deadlock detected: event loop cannot make further progress (${n}: no thread is ready and no host call is outstanding)`)),nr("driveAsync",t,e,"await-race"),await Promise.race([...t.pendingHostCalls]).catch(()=>{})}}}finally{let r=Zr(t)-1;if(iu.set(t,r),r===0){let s=da.get(t);da.delete(t),s?.r()}}}function ou(t){let e=t.hostFailure;return t.hostFailure=void 0,e}var NM=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var r6=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var u6=(()=>{try{return Deno.env.get("CE_CTX_TRACE")==="1"}catch{return!1}})();var l8=(()=>{try{return Deno.env.get("CE_SCOPE_TRACE")==="1"}catch{return!1}})();var F8=(()=>{try{return Deno.env.get("CE_COPY_TRACE")==="1"}catch{return!1}})();var hm=Object.freeze({hostEnd:!0}),pa=class{t;values;length;progress;taken;constructor(e,n,r){this.t=e,this.values=n,this.length=r,this.progress=0,this.taken=[]}remain(){return this.length-this.progress}isZeroLength(){return this.length===0}read(e){M(e<=this.remain(),"host buffer read beyond remaining");let n=this.values===null?new Array(e).fill(null):this.values.slice(this.progress,this.progress+e);return this.progress+=e,n}write(e){M(e.length<=this.remain(),"host buffer write beyond remaining");for(let n of e)this.taken.push(n);this.progress+=e.length}},mm=new WeakSet;function cu(t){return t.settled.length===0&&t.awaiting.size===0&&!Bx(t)}function Bx(t){for(let e of t.pendingHostCalls)if(!mm.has(e))return!0;return!1}var ha=class{#e=null;#t=null;#n=null;#s=!1;#r=!1;bind(e){this.#e!==null||this.#s||(this.#e=e,this.#o())}#o(){this.#e===null||this.#t!==null||this.#s||(this.#t=new Promise(e=>this.#n=e),mm.add(this.#t),this.#e.pendingHostCalls.add(this.#t))}notify(){let e=this.#t,n=this.#n;this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.(),this.#o()}pump(){let e=this.#e;if(e!==null){for(;;){let n=e.serviceSettled(),r=e.tick();if(!n&&!r)break}this.#r||cu(e)||(this.#r=!0,this.#i(e))}}async#i(e){try{for(;!cu(e);){if(Zr(e)>0){await lm(e);continue}await cm(e,()=>e.pendingHostCalls.size===0||cu(e)||Zr(e)>1,"host stream/future activity")}}catch(n){e.hostFailure??=n}finally{this.#r=!1}this.notify()}close(){let e=this.#t,n=this.#n;this.#s=!0,this.#t=null,this.#n=null,e!==null&&this.#e!==null&&this.#e.pendingHostCalls.delete(e),n?.()}};function ym(t,e){let n=t;M(n.onLowered==null,"this stream/future is already wrapped by a host end; hostStreamFor/hostFutureFor may wrap a shared object once"),n.onLowered=s=>e.bind(s.store);let r=t.boundStore;r&&e.bind(r)}function wm(t,e){let n={read:!1,write:!1},r=s=>{s===Qe.DROPPED?e.close():e.notify()};return{writable:{write(s){let o=new pa(t.t,s,s.length);return new Promise(i=>{n.write=!0,t.write(hm,o,a=>{o.remain()>0||(a(),n.write=!1,e.notify(),i(o.progress))},a=>{n.write=!1,r(a),i(o.progress)}),e.notify(),e.pump()})},async writeAll(s){let o=0;for(;o{n.read=!0,t.read(hm,o,a=>{a(),n.read=!1,e.notify(),i(o.taken)},a=>{n.read=!1,r(a),i(o.taken)}),e.notify(),e.pump()})},cancelRead(){n.read&&(n.read=!1,t.cancel(),e.notify(),e.pump())},drop(){t.drop(),e.close(),e.pump()}}}}function gm(t){let e=new tr(t),n=new ha;return ym(e,n),{...wm(e,n),value:e}}function bm(t){let e=t;M(e instanceof tr,"hostStreamFor expects a lifted stream value");let n=new ha;return ym(e,n),{...wm(e,n),value:t}}var U=class extends Error{payload;constructor(e,n){super(n??`WIT error: ${Mx(e)}`),this.name="WitError",this.payload=e}};function Mx(t){return t==null?String(t):typeof t=="object"&&"tag"in t?String(t.tag):typeof t=="object"?JSON.stringify(t):String(t)}var t3=Symbol("deltic.resource-state");var n3=new FinalizationRegistry(t=>{if(t.valid&&t.owns){t.valid=!1;try{t.rt.dtor?.(t.rep)}catch{}}});var jx=new WeakMap;function uu(t){let e=jx.get(t);if(e!==void 0)throw e}function Kx(t){return t!==null&<(t).kind==="u8"}var Qr=class t{#e;#t;#n=!1;#s=!1;#r=[];constructor(e,n){this.#e=e,this.#t=n}static fromLifted(e,n){return new t(bm(e),n)}static fromHostStream(e,n){return new t(e,n)}static create(){let e=new t(null,null);return{stream:e,writer:new wa(e)}}bindElement(e){if(this.#e!==null)return;this.#t=e,this.#e=gm(e.element),Hx(this,this.#e);let n=this.#r;this.#r=[];for(let r of n)r()}whenBound(){return this.#e!==null?Promise.resolve():new Promise(e=>this.#r.push(e))}get bound(){return this.#e!==null}takeValue(e){if(this.bindElement(e),this.#n)throw new TypeError("this Stream handle has already been passed to a guest; a stream value may only be transferred once");return this.#n=!0,this.#e.value}get codec(){return this.#t}#o(){if(this.#e===null)throw new TypeError("this Stream was created with Stream.create() and has not been passed to a guest yet, so it has no element type; pass it first, or use the writer, which parks until then");return this.#e}async read(e){let n=this.#o();uu(n.value);let r=await n.readable.read(e);return this.#i(r)}#i(e){let n=this.#t;return Kx(n.element)?Uint8Array.from(e):e.map(r=>n.toHost(r))}cancelRead(){this.#e?.readable.cancelRead()}drop(){this.#s||(this.#s=!0,this.#e?.readable.drop())}[Symbol.dispose](){this.drop()}readable(){let e=this;return new ReadableStream({async pull(n){let r=await e.read(xm);if(r.length===0){n.close();return}n.enqueue(r)},cancel(){e.drop()}})}async*[Symbol.asyncIterator](){for(;;){let e=await this.read(xm);if(e.length===0)return;yield e}}},xm=4096,wa=class{#e;constructor(e){this.#e=e}async write(e){await this.#e.whenBound();let n=ya(this.#e);uu(n.value);let r=this.#e.codec;return await n.writable.write(e.map(s=>r.fromHost(s)))}async writeAll(e){await this.#e.whenBound();let n=ya(this.#e);uu(n.value);let r=this.#e.codec;return await n.writable.writeAll(e.map(s=>r.fromHost(s)))}cancelWrite(){this.#e.bound&&ya(this.#e).writable.cancelWrite()}async close(){await this.#e.whenBound(),ya(this.#e).writable.drop()}},Em=new WeakMap;function ya(t){let e=Em.get(t);if(e===void 0)throw new TypeError("stream writer used before the stream was bound");return e}function Hx(t,e){Em.set(t,e)}var go=class{#e=[];add(e){this.#e.push(e)}end(){for(let e of this.#e)e();this.#e.length=0}},g3=new go;var B3=Symbol("deltic.embedder.hostRegistries");var Im=!1,qt;async function Am(){if(qt)return qt;let t=globalThis;if(t.RTCPeerConnection)return qt=t.RTCPeerConnection,qt;try{let{RTCPeerConnection:e}=await import("node-datachannel/polyfill");return Im=!0,qt=e,qt}catch(e){throw new Error("no RTCPeerConnection available: not running in a browser and node-datachannel could not be loaded (run `deno install --allow-scripts=npm:node-datachannel` in deltic-impl)",{cause:e})}}var Sm=8*1024*1024,Yx=2e4,Zx=1e3,Qx=8*1024*1024,e0=Qx;var t0=new TextEncoder;function n0(t){return t0.encode(t).byteLength}var fu=class{#e="";#t=!0;#n=void 0;label(){return this.#e}setLabel(e){this.#e=e}ordered(){return this.#t}setOrdered(e){this.#t=e}maxRetransmits(){return this.#n}setMaxRetransmits(e){this.#n=e}toInit(){let e={ordered:this.#t};return this.#n!=null&&(e.maxRetransmits=this.#n),e}},du=class{#e=[];#t="all";iceServers(){return this.#e}setIceServers(e){for(let n of e){if(!n.urls.length)throw new U({tag:"invalid",val:"ice-server has no urls"});for(let r of n.urls)if(!/^(stun|stuns|turn|turns):/.test(r))throw new U({tag:"invalid",val:`ice-server url ${JSON.stringify(r)} has no stun:/stuns:/turn:/turns: scheme`})}this.#e=e}iceTransportPolicy(){return this.#t}setIceTransportPolicy(e){this.#t=e}toConfiguration(){let e={iceTransportPolicy:this.#t};return this.#e.length&&(e.iceServers=this.#e.map(n=>{let r={urls:n.urls};return n.username&&(r.username=n.username),n.credential&&(r.credential=n.credential),r})),e}};function r0(t){let e=e0,n=[],r=[],s=0,o=!1,i=!1,a=(u,f)=>{let d=r.shift();d?d.resolve(u):(s+=f,n.push({message:u,size:f}))};t.addEventListener("message",({data:u})=>{if(o)return;let f=typeof u=="string"?n0(u):u.byteLength;if(s+f>e&&!r.length){o=!0,t.close();return}let d=typeof u=="string"?{tag:"string",val:u}:{tag:"binary",val:new Uint8Array(u)};a(d,f)});let c=()=>o?{tag:"receive-buffer-overflow"}:{tag:"closed"},l=()=>{if(!i)for(i=!0;r.length;)r.shift().reject(c())};return t.addEventListener("close",l),t.addEventListener("error",l),{next(){if(n.length){let{message:u,size:f}=n.shift();return s-=f,Promise.resolve(u)}return o?Promise.reject(new U({tag:"receive-buffer-overflow"})):i?Promise.reject(new U({tag:"closed"})):new Promise((u,f)=>{r.push({resolve:u,reject:d=>f(new U(d))})})},rejectWaiters(u){for(;r.length;)r.shift().reject(u)},discard(){for(n.length=0,s=0,i=!0;r.length;)r.shift().reject({tag:"closed"})}}}var bo=class{#e;#t;#n=!1;#s=!1;#r=!1;#o=new Set;constructor(e){this.#e=e,e.binaryType="arraybuffer",this.#t=r0(e)}label(){return this.#e.label}async send(e){if(this.#s)throw new U({tag:"closed"});await this.#i(),await this.#a();try{this.#e.send(e.val)}catch{throw new U({tag:"closed"})}}async receive(){if(this.#s)throw new U({tag:"closed"});if(this.#n)throw new U({tag:"receiving-via-stream"});return this.#t.next()}async sendViaStream(e){let n=0n;try{for await(let r of i0(e)){let s=await a0(r.data);if(s.length!==r.length)throw{tag:"other",val:`stream-message payload was ${s.length} bytes but length declared ${r.length}`};let o=r.kind==="string"?{tag:"string",val:new TextDecoder().decode(s)}:{tag:"binary",val:s};await this.send(o),n+=1n}}catch(r){let s=r instanceof U?r.payload:s0(r)?r:{tag:"closed"};throw new U({error:s,sent:n})}}receiveViaStream(){if(this.#s)throw new U({tag:"closed"});if(this.#n)throw new U({tag:"receiving-via-stream"});this.#n=!0;let e=this.#t;return e.rejectWaiters({tag:"receiving-via-stream"}),new ReadableStream({async pull(n){let r;try{r=await e.next()}catch{n.close();return}let s=r.tag==="string"?new TextEncoder().encode(r.val):r.val;n.enqueue({kind:r.tag,length:s.length,data:l0(s)})}})}#i(){let e=this.#e;return e.readyState==="open"?Promise.resolve():e.readyState==="closing"||e.readyState==="closed"?Promise.reject(new U({tag:"closed"})):new Promise((n,r)=>{e.addEventListener("open",()=>n(),{once:!0}),e.addEventListener("close",()=>r(new U({tag:"closed"})),{once:!0}),e.addEventListener("error",()=>r(new U({tag:"closed"})),{once:!0})})}close(){if(!this.#s){this.#s=!0,this.#t.discard();try{this.#e.close()}catch{}for(let e of this.#o)e()}}stateChanges(){return this.#r?new ReadableStream({start(e){e.close()}}):(this.#r=!0,Cm(()=>this.#e.readyState,e=>{for(let n of["open","closing","close","error"])this.#e.addEventListener(n,e);this.#o.add(e)},e=>e==="closed"))}[Symbol.dispose](){try{this.close()}catch{}}#a(){let e=this.#e;return e.bufferedAmount<=Sm?Promise.resolve():new Promise(n=>{e.bufferedAmountLowThreshold=Sm/2;let r=()=>{e.removeEventListener("bufferedamountlow",r),n()};e.addEventListener("bufferedamountlow",r)})}};function s0(t){return typeof t=="object"&&t!==null&&typeof t.tag=="string"}var pu=class t{#e;#t;#n;#s=!1;#r=!1;#o=!1;#i=!1;#a=!1;#c=new Set;#l=new Set;#u=new Set;#f=!1;#p=new Set;constructor(e){if(!qt)throw new Error("PeerConnection constructed before the RTCPeerConnection backend resolved \u2014 this should be unreachable via normal module import (top-level await); if resolution failed, the actionable error was already thrown/logged at module load. Use `await PeerConnection.create(config)` after `resetResolvedBackend()`.");let n=qt;this.#e=new n(e?e.toConfiguration():void 0);let r=()=>{if(this.#h()&&(this.#s=!0),!this.#o&&this.#m()){this.#o=!0;for(let s of this.#c)s();this.#c.clear(),this.#t.end(),this.#n.end();for(let s of this.#p)s()}};this.#e.addEventListener("connectionstatechange",r),this.#e.addEventListener("iceconnectionstatechange",r),this.#t=$m((s,o)=>{let i=new Set,a=(c,l,u)=>{let f=c.trim().replace(/^a=/,"");i.has(f)||(i.add(f),s({candidate:f,sdpMid:l,sdpMlineIndex:u}))};this.#e.addEventListener("icecandidate",({candidate:c})=>{if(c==null||c.candidate===""){o();return}a(c.candidate,c.sdpMid??void 0,c.sdpMLineIndex??void 0)}),this.#e.addEventListener("icegatheringstatechange",()=>{if(this.#e.iceGatheringState==="complete"){for(let c of o0(this.#e.localDescription?.sdp))a(c.candidate,c.sdpMid,c.sdpMlineIndex);o()}})}),this.#n=$m(s=>{this.#e.addEventListener("datachannel",({channel:o})=>{this.#l.add(o);let i=new bo(o);this.#u.add(i),s(i)})})}static async create(e){return await Am(),new t(e)}#d(){if(this.#r||this.#o||this.#m()||this.#e.connectionState==="closed")throw new U({tag:"closed"})}#h(){return this.#e.connectionState==="connected"||this.#e.iceConnectionState==="connected"||this.#e.iceConnectionState==="completed"}#m(){return this.#e.connectionState==="failed"||this.#e.iceConnectionState==="failed"}createDataChannel(e){this.#d();try{let n=this.#e.createDataChannel(e.label(),e.toInit());this.#l.add(n);let r=new bo(n);return this.#u.add(r),r}catch(n){throw new U({tag:"other",val:String(n)})}}incomingDataChannels(){return this.#a?new ReadableStream({start(e){e.close()}}):(this.#a=!0,this.#n.stream)}async createOffer(){this.#d();try{return Im&&this.#l.size===0&&this.#e.createDataChannel("",{negotiated:!0,id:1023}),{kind:"offer",sdp:(await this.#e.createOffer()).sdp}}catch(e){throw new U({tag:"other",val:String(e)})}}async createAnswer(){this.#d();try{return{kind:"answer",sdp:(await this.#e.createAnswer()).sdp}}catch(e){throw new U({tag:"other",val:String(e)})}}async setLocalDescription(e){this.#d();try{await this.#e.setLocalDescription({type:e.kind,sdp:e.sdp})}catch(n){throw new U({tag:"invalid-signaling",val:String(n)})}}async setRemoteDescription(e){this.#d();try{await this.#e.setRemoteDescription({type:e.kind,sdp:e.sdp})}catch(n){throw new U({tag:"invalid-signaling",val:String(n)})}}localIceCandidates(){return this.#i?new ReadableStream({start(e){e.close()}}):(this.#i=!0,this.#t.stream)}async addIceCandidate(e){this.#d();try{await this.#e.addIceCandidate({candidate:e.candidate,sdpMid:e.sdpMid??null,sdpMLineIndex:e.sdpMlineIndex??null})}catch(n){throw new U({tag:"invalid-signaling",val:String(n)})}}stateChanges(){return this.#f?new ReadableStream({start(e){e.close()}}):(this.#f=!0,Cm(()=>this.#r?"closed":this.#o?"failed":this.#e.connectionState,e=>{this.#e.addEventListener("connectionstatechange",e),this.#e.addEventListener("iceconnectionstatechange",e),this.#p.add(e)},e=>e==="failed"||e==="closed"))}async waitConnected(){let e=this.#e,n=()=>this.#m()||e.connectionState==="closed";if(this.#h()&&(this.#s=!0),!this.#s){if(this.#r||n())throw new U({tag:"closed"});await new Promise((r,s)=>{let o=setTimeout(()=>{c(),s(new U({tag:"timed-out"}))},Yx),i=()=>{this.#h()?(this.#s=!0,c(),r()):n()&&(c(),s(new U({tag:"closed"})))},a=()=>{c(),s(new U({tag:"closed"}))},c=()=>{clearTimeout(o),this.#c.delete(a),e.removeEventListener("connectionstatechange",i),e.removeEventListener("iceconnectionstatechange",i)};this.#c.add(a),e.addEventListener("connectionstatechange",i),e.addEventListener("iceconnectionstatechange",i)})}}close(){if(this.#r)return;this.#r=!0;for(let s of this.#c)s();this.#c.clear(),this.#t.end(),this.#n.end();for(let s of this.#p)s();for(let s of this.#u)try{s.close()}catch{}let e=Date.now()+Zx,n=()=>[...this.#l].every(s=>s.bufferedAmount===0),r=setInterval(()=>{(n()||Date.now()>=e)&&(clearInterval(r),this.#e.close())},10);r.unref?.()}[Symbol.dispose](){try{this.close()}catch{}}};function o0(t){if(!t)return[];let e=[],n,r=-1;for(let s of t.split(/\r?\n/))s.startsWith("m=")?(r+=1,n=void 0):s.startsWith("a=mid:")?n=s.slice(6).trim():s.startsWith("a=candidate:")&&e.push({candidate:s.slice(2).trim(),sdpMid:n,sdpMlineIndex:r>=0?r:void 0});return e}async function*i0(t){if(t instanceof ReadableStream){let e=t.getReader();try{for(;;){let{value:n,done:r}=await e.read();if(r)break;yield n}}finally{e.releaseLock()}return}for await(let e of t)Array.isArray(e)?yield*e:yield e}async function a0(t){let e=[],n=0,r=i=>{if(i==null)return;let a=c0(i);a.length&&(e.push(a),n+=a.length)};if(typeof ReadableStream<"u"&&t instanceof ReadableStream){let i=t.getReader();try{for(;;){let{value:a,done:c}=await i.read();if(c)break;r(a)}}finally{i.releaseLock()}}else if(t instanceof Qr)for(;;){let a=await t.read(65536);if(a.length===0)break;r(a)}else for await(let i of t)r(i);let s=new Uint8Array(n),o=0;for(let i of e)s.set(i,o),o+=i.length;return s}function c0(t){return typeof t=="number"?Uint8Array.of(t):t instanceof Uint8Array?t:Uint8Array.from(t)}function l0(t){return new ReadableStream({start(e){t.length&&e.enqueue(t),e.close()}})}function $m(t){let e,n=!1,r=[],s=new ReadableStream({start(a){e=a;for(let c of r)a.enqueue(c);r.length=0,n&&a.close()}}),o=a=>{n||(e?e.enqueue(a):r.push(a))},i=()=>{if(!n&&(n=!0,e))try{e.close()}catch{}};return t(o,i),{stream:s,end:i}}function Cm(t,e,n){let r,s=!1,o=null;return e(()=>{if(o){let i=o;o=null,i()}}),new ReadableStream({async pull(i){for(;;){let a=new Promise(l=>{o=l}),c=t();if(!s||c!==r){s=!0,r=c,i.enqueue(c),n(c)&&i.close();return}if(n(c)){i.close();return}await a}}})}await Am().catch(()=>{qt=void 0});var u0="polymorph:webrtc-datachannels/connections@0.1.0",f0={DataChannelOptions:fu,PeerConnectionConfig:du,DataChannel:bo,PeerConnection:pu};function Rm(){return{[u0]:f0}}var d0=[];function ko(t){d0.push(t);let e={tag:"not-supported"};throw new j(e,`wasi:sockets/types@0.3.0: ${t} is not provided by this host`)}var hu=class{static create(e){return ko("udp-socket.create")}bind(e){return ko("udp-socket.bind")}send(e,n){return ko("udp-socket.send")}receive(){return ko("udp-socket.receive")}getLocalAddress(){return ko("udp-socket.get-local-address")}},p0="wasi:sockets/types@0.3.0";function Pm(){return{[p0]:{UdpSocket:hu}}}var Lm="polymorph:engine-spike/driver@0.1.0",h0="polymorph-data:tasks/tasks@0.1.0";async function Nm(t,e){let n=Lp({cli:{args:[`engine-${t}`]}}),r={...n,...Op().imports,...Gh(),...Zh(),...Rm(),...Pm()},s=await Fn(Dn(e.envelope,e.bytes),r),o=s.exports[Lm],i=s.exports[h0];if(!o||typeof o.init!="function")throw new Error(`export "${Lm}" missing or shapeless; exports: ${Object.keys(s.exports).join(", ")}`);return{driver:o,tasks:i,stdout:()=>n.captured.stdoutText(),stderr:()=>n.captured.stderrText()}}function mu(t){let e=new Uint8Array(t.length/2);for(let n=0;nn)throw new Error(`timeout: ${t}`);await new Promise(i=>setTimeout(i,r))}}var wn=new URLSearchParams(location.search),ga=wn.get("relay")??"https://use1-1.relay.n0.iroh.link",Mm=wn.get("code"),m0=!!Mm&&!!window.opener;if(m0){window.opener.postMessage({pmDropboxCode:Mm,state:wn.get("state")},location.origin);let t=document.getElementById("banner");t&&(t.textContent="authorization relayed \u2014 close this window"),window.close()}var Um="pm-demo-storage",y0="pm-demo-s3";function ba(){if(wn.get("s3"))return{provider:"s3",endpoint:wn.get("s3"),bucket:wn.get("bucket")??"pm-demo",access:wn.get("access")??"",secret:wn.get("secret")??""};try{let t=localStorage.getItem(Um);if(t)return JSON.parse(t);let e=localStorage.getItem(y0);return e?{provider:"s3",...JSON.parse(e)}:null}catch{return null}}var w0=`the live path needs the relay to be reachable (default: n0's public relay; ?relay=\u2026 to override). The bucket pane is configured via the -Storage\u2026 dialog and is optional for boot.`;async function du(t){let[e,n]=await Promise.all([fetch(`./${t}.plan.json`).then(r=>{if(!r.ok)throw new Error(`${t} plan: HTTP ${r.status}`);return r.text()}),fetch(`./${t}.component.wasm`).then(r=>{if(!r.ok)throw new Error(`${t} wasm: HTTP ${r.status}`);return r.arrayBuffer()})]);return{envelope:e,bytes:new Uint8Array(n)}}function Yr(t){throw new j(t)}function Am(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Nm(t){let e=new Uint8Array(t);return crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}var l0=5*6e4;async function Im(t){let e=new Uint8Array(32);crypto.getRandomValues(e);let n=Am(e),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n)),s=Am(new Uint8Array(r)),o=Nm(8),i=location.origin+location.pathname,a=`https://www.dropbox.com/oauth2/authorize?client_id=${encodeURIComponent(t)}&response_type=code&code_challenge=${s}&code_challenge_method=S256&redirect_uri=${encodeURIComponent(i)}&token_access_type=offline&state=${o}`,c=window.open(a,"pm-dropbox-auth","width=680,height=760");c||Yr("could not open the authorization window (popup blocked)");let l=await new Promise((d,w)=>{let y=m=>{globalThis.removeEventListener("message",x),clearInterval(E),clearTimeout(b),m()},x=m=>{if(m.origin!==location.origin)return;let g=m.data;if(!g||typeof g.pmDropboxCode!="string"||g.state!==o)return;let k=g.pmDropboxCode;y(()=>d(k))};globalThis.addEventListener("message",x);let E=setInterval(()=>{c.closed&&y(()=>w(new Error("authorization window closed")))},500),b=setTimeout(()=>y(()=>w(new Error("authorization timed out"))),l0)}).catch(d=>Yr(d instanceof Error?d.message:String(d)));try{c.close()}catch{}let u=await fetch("https://api.dropboxapi.com/oauth2/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({code:l,grant_type:"authorization_code",client_id:t,redirect_uri:i,code_verifier:n})});u.ok||Yr(`token exchange: HTTP ${u.status}: ${await u.text()}`);let f=await u.json();return f.access_token||Yr("token exchange: no access_token in the response"),{accessToken:f.access_token,refreshToken:f.refresh_token??""}}var Cm={"polymorph:fetchspike/fetch@0.1.0":{async request(t,e,n,r){let s;try{s=new URL(e).host}catch{Yr("fetch: host not granted to this panel")}s!=="api.dropboxapi.com"&&Yr("fetch: host not granted to this panel");let o=t==="GET"||t==="HEAD"||r.length===0,i=await fetch(e,{method:t,headers:n,body:o?void 0:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}),a=new Uint8Array(await i.arrayBuffer());return{status:i.status,body:a}}}},u0=12e3,Rm=new Map;function f0(t){let e=document.getElementById(`${t}-status`);return(n,r=!1)=>{!r&&(Rm.get(t)??0)>performance.now()||(r&&Rm.set(t,performance.now()+u0),e.textContent=n)}}async function pu(t,e){let n=await $m(t,e),r=f0(t);return r("engine up"),{name:t,engine:n,id:new Uint8Array,status:r}}async function d0(t,e){let n=document.getElementById(`${t.name}-app`),r=()=>{},s=Mc("direct",n,u=>r(u)),o=Pi(s,()=>""),i={...o.imports,"polymorph-data:tasks/tasks@0.1.0":t.engine.tasks},c=(await _n(On(e.envelope,e.bytes),i)).exports,l=Uc(o);r=u=>{l.call(()=>c.onEvent(u)).catch(f=>t.status(`event: ${f}`))},await l.call(()=>c.run()),t.app=c,t.runner=l,setInterval(()=>{l.call(()=>c.poll()).catch(()=>{})},400)}function Jt(t){let e=t.payload;return typeof e=="string"?e:String(t)}async function p0(){let t=document.getElementById("banner"),e=C=>{t.textContent=C,console.log(`[boot] ${C}`)};e("fetching artifacts\u2026");let[n,r]=await Promise.all([du("engine"),du("app")]);e("instantiating engines\u2026");let s=await pu("alice",n),o=await pu("bob",n),i=await pu("tablet",n),a=[s,o,i];e("identities\u2026");for(let C of a)C.id=fu(await C.engine.driver.init(!1)),C.status(`id ${Array.from(C.id.slice(0,4),oe=>oe.toString(16).padStart(2,"0")).join("")}\u2026`);await s.engine.driver.khIngestContact(await i.engine.driver.khContactCard()),await i.engine.driver.khIngestContact(await s.engine.driver.khContactCard()),e("wire: alice \u21C4 bob over the relay\u2026"),await s.engine.driver.irohBind(ya);let c=fu(await o.engine.driver.irohBind(ya)),l=await o.engine.driver.irohStart(!1,new Uint8Array,ya,new Uint8Array),u=await s.engine.driver.irohStart(!0,c,ya,o.id);await hn("handshake",async()=>await s.engine.driver.connStatus(u)&&await o.engine.driver.connStatus(l)),await hn("contact cards",()=>s.engine.driver.khKnowsAgent(o.id)),e("partition: create \u2192 members \u2192 seal\u2026");let f=await s.engine.driver.createPartition();await s.engine.driver.khAddMember(f,o.id,"edit"),await s.engine.driver.khAddMember(f,i.id,"edit"),await s.engine.driver.sealPartition(f),await o.engine.driver.adoptPartition(f),await i.engine.driver.adoptPartition(f),e("first sync\u2026"),await hn("bob knows the doc",()=>o.engine.driver.khKnowsAgent(f));let d=async(C,oe)=>{let _e=await C.driver.syncStart(oe,f,!1);return await hn("pull",()=>C.driver.syncStatus(_e))};await d(o.engine,s.id),await hn("bob decrypts",async()=>await o.engine.tasks.revision()>=1n);let w=await o.engine.driver.syncStart(s.id,f,!0);await hn("bob subscribe",()=>o.engine.driver.syncStatus(w)),await d(s.engine,o.id);let y=await s.engine.driver.syncStart(o.id,f,!0);await hn("alice subscribe",()=>s.engine.driver.syncStatus(y)),e("mounting apps\u2026");for(let C of a)await d0(C,r);let x=Promise.resolve(),E=C=>{let oe=x.then(C).catch(()=>{});return x=oe,oe};setInterval(()=>{E(()=>d(o.engine,s.id)),E(()=>d(s.engine,o.id))},2500);let b=!1,m=wa()?.provider??"s3",g,k=document.getElementById("bucket-sync"),T=document.getElementById("bucket-auto"),S=document.getElementById("bob-pull");k.disabled=!0,T.disabled=!0,S.disabled=!0,i.status("no storage configured \u2014 use Storage\u2026 to activate this pane");let $=()=>`/run-${Nm(4)}`,O=C=>E(async()=>{try{if(i.status("configuring storage\u2026"),m=C.provider,g=void 0,C.provider==="s3"){let oe={kind:"s3",value:{endpoint:C.endpoint,bucket:C.bucket,accessKey:C.access,secretKey:C.secret}},_e={kind:"s3",value:{endpoint:C.endpoint,bucket:C.bucket,accessKey:"",secretKey:""}};await s.engine.driver.initStore(oe),await i.engine.driver.initStore(oe),await o.engine.driver.initStore(_e),await s.engine.driver.ensureBucket();for(let tr of[s.id,o.id,i.id])await s.engine.driver.storeGrant(f,tr)}else{let oe=C.root+$(),_e={appKey:C.appKey,appSecret:C.appSecret,accessToken:C.accessToken,refreshToken:C.refreshToken,root:oe},tr={kind:"dropbox",value:_e},Qr={kind:"dropbox",value:{..._e,accessToken:"",refreshToken:""}};await s.engine.driver.initStore(tr),await i.engine.driver.initStore(tr),await o.engine.driver.initStore(Qr),await s.engine.driver.ensureBucket(),await s.engine.driver.storeGrant(f,s.id),await s.engine.driver.storeGrant(f,i.id),g=await s.engine.driver.storeGrant(f,o.id)}await s.engine.driver.bucketFlush(f),i.status(await i.engine.driver.bucketPull(f,s.id,void 0)),b=!0,k.disabled=!1,T.disabled=!1,S.disabled=!1}catch(oe){i.status(`storage setup failed: ${Jt(oe)} \u2014 check endpoint + CORS`)}}),_=()=>E(async()=>{if(b)try{await s.engine.driver.bucketFlush(f),await i.engine.driver.bucketFlush(f),i.status(await i.engine.driver.bucketPull(f,s.id,void 0)),s.status(await s.engine.driver.bucketPull(f,s.id,void 0))}catch(C){i.status(`bucket: ${Jt(C)}`)}});k.onclick=()=>{_()},setInterval(()=>{T.checked&&_()},4e3);let R=()=>E(async()=>{if(b)try{let C=await o.engine.driver.bucketPull(f,s.id,m==="dropbox"?g:void 0);o.status(`bucket: ${C}`,!0)}catch(C){o.status(`bucket: ${Jt(C)}`,!0)}});S.onclick=()=>{R()};let P=document.getElementById("storage-dialog"),H=document.getElementById("panel-region"),bt={s3:document.getElementById("prov-s3"),dropbox:document.getElementById("prov-dropbox")},qt=new Map,L=null,me=()=>{},yn=()=>{me=()=>{},H.innerHTML="",L=null},Zr=C=>{if(yn(),P.close(),C!=="")try{let oe=JSON.parse(C);localStorage.setItem(Lm,JSON.stringify(oe)),b?i.status("storage changed \u2014 reload the page to reconfigure"):O(oe)}catch(oe){i.status(`storage config unreadable: ${Jt(oe)}`)}},hu=async C=>{yn();for(let[es,nr]of Object.entries(bt))nr.classList.toggle("active",es===C);let oe=C==="s3"?"panel-s3":"panel-dropbox",_e=qt.get(oe);_e||(_e=await du(oe),qt.set(oe,_e));let tr=Mc("direct",H,es=>me(es)),Qr=Pi(tr,()=>""),Om=C==="s3"?{...Qr.imports}:{...Qr.imports,"polymorph:todomvc-spike/oauth-broker@0.0.1":{authorize:Im},...Cm},bo=(await _n(On(_e.envelope,_e.bytes),Om)).exports,ko=Uc(Qr);L=C,me=es=>{L===C&&ko.call(()=>bo.onEvent(es)).then(()=>ko.call(()=>bo.outcome())).then(nr=>{nr!==void 0&&L===C&&Zr(nr)}).catch(nr=>console.warn(`[panel] event: ${Jt(nr)}`))};let ga=wa(),_m=ga&&ga.provider===C?JSON.stringify(ga):"";await ko.call(()=>bo.seed(_m)),await ko.call(()=>bo.run())},mu=()=>{P.showModal(),hu(wa()?.provider??"s3").catch(C=>{H.textContent=`panel failed to mount: ${Jt(C)}`})};document.getElementById("storage-open").onclick=mu;for(let C of["s3","dropbox"])bt[C].onclick=oe=>{oe.preventDefault(),L!==C&&hu(C).catch(_e=>{H.textContent=`panel failed to mount: ${Jt(_e)}`})};document.getElementById("storage-cancel").onclick=C=>{C.preventDefault(),yn(),P.close()};let yu=wa();yu&&O(yu),document.getElementById("revoke-bob").onclick=()=>{E(async()=>{try{await s.engine.driver.khRevokeMember(f,o.id);let C=await s.engine.driver.storeRevoke(f,o.id);await s.engine.driver.bucketFlush(f),s.status(`revoke: ${C}`,!0),o.status("REVOKED: new epochs are dark from here",!0),document.getElementById("bob-pane").classList.add("revoked")}catch(C){s.status(`revoke: ${Jt(C)}`)}})},setInterval(()=>{E(async()=>{for(let C of a)if(!(C===i&&!b))try{C.status(await C.engine.driver.stats())}catch{}})},4e3),globalThis.__demo={alice:s,bob:o,tablet:i,part:f,pull:d,bobPull:()=>R(),openStorage:()=>mu(),authorize:Im,panelFetch:Cm["polymorph:fetchspike/fetch@0.1.0"]},e("ready \u2014 E2E-encrypted, three replicas, two sync paths")}p0().catch(t=>{console.error(t);let e=document.getElementById("banner");e.textContent=`boot failed: ${Jt(t)}`;let n=document.createElement("pre");n.style.cssText="margin:.5em 0 0; font-size:11px; color:#f5c16c; white-space:pre-wrap",n.textContent=c0,e.appendChild(n)}); +Storage\u2026 dialog and is optional for boot.`,yu=document.querySelector('meta[name="pm-build"]')?.content??"",Om=t=>yu&&yu!=="__BUILD__"?`${t}?v=${yu}`:t;async function wu(t){let[e,n]=await Promise.all([fetch(Om(`./${t}.plan.json`)).then(r=>{if(!r.ok)throw new Error(`${t} plan: HTTP ${r.status}`);return r.text()}),fetch(Om(`./${t}.component.wasm`)).then(r=>{if(!r.ok)throw new Error(`${t} wasm: HTTP ${r.status}`);return r.arrayBuffer()})]);return{envelope:e,bytes:new Uint8Array(n)}}function es(t){throw new j(t)}function _m(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Wm(t){let e=new Uint8Array(t);return crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}var g0=5*6e4;async function Dm(t){let e=new Uint8Array(32);crypto.getRandomValues(e);let n=_m(e),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n)),s=_m(new Uint8Array(r)),o=Wm(8),i=location.origin+location.pathname,a=`https://www.dropbox.com/oauth2/authorize?client_id=${encodeURIComponent(t)}&response_type=code&code_challenge=${s}&code_challenge_method=S256&redirect_uri=${encodeURIComponent(i)}&token_access_type=offline&state=${o}`,c=window.open(a,"pm-dropbox-auth","width=680,height=760");c||es("could not open the authorization window (popup blocked)");let l=await new Promise((d,w)=>{let y=m=>{globalThis.removeEventListener("message",x),clearInterval(v),clearTimeout(b),m()},x=m=>{if(m.origin!==location.origin)return;let g=m.data;if(!g||typeof g.pmDropboxCode!="string"||g.state!==o)return;let k=g.pmDropboxCode;y(()=>d(k))};globalThis.addEventListener("message",x);let v=setInterval(()=>{c.closed&&y(()=>w(new Error("authorization window closed")))},500),b=setTimeout(()=>y(()=>w(new Error("authorization timed out"))),g0)}).catch(d=>es(d instanceof Error?d.message:String(d)));try{c.close()}catch{}let u=await fetch("https://api.dropboxapi.com/oauth2/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({code:l,grant_type:"authorization_code",client_id:t,redirect_uri:i,code_verifier:n})});u.ok||es(`token exchange: HTTP ${u.status}: ${await u.text()}`);let f=await u.json();return f.access_token||es("token exchange: no access_token in the response"),{accessToken:f.access_token,refreshToken:f.refresh_token??""}}var Fm={"polymorph:fetchspike/fetch@0.1.0":{async request(t,e,n,r){let s;try{s=new URL(e).host}catch{es("fetch: host not granted to this panel")}s!=="api.dropboxapi.com"&&es("fetch: host not granted to this panel");let o=t==="GET"||t==="HEAD"||r.length===0,i=await fetch(e,{method:t,headers:n,body:o?void 0:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}),a=new Uint8Array(await i.arrayBuffer());return{status:i.status,body:a}}}},b0=12e3,Bm=new Map;function k0(t){let e=document.getElementById(`${t}-status`);return(n,r=!1)=>{!r&&(Bm.get(t)??0)>performance.now()||(r&&Bm.set(t,performance.now()+b0),e.textContent=n)}}async function gu(t,e){let n=await Nm(t,e),r=k0(t);return r("engine up"),{name:t,engine:n,id:new Uint8Array,status:r}}async function x0(t,e){let n=document.getElementById(`${t.name}-app`),r=()=>{},s=Kc("direct",n,f=>r(f)),o=Ni(s,()=>""),i={...o.imports,"polymorph-data:tasks/tasks@0.1.0":t.engine.tasks},c=(await Fn(Dn(e.envelope,e.bytes),i)).exports,l=Hc(o);r=f=>{l.call(()=>c.onEvent(f)).catch(d=>t.status(`event: ${d}`))},await l.call(()=>c.run()),t.app=c,t.runner=l;let u=!1;t.pollSkips=0,setInterval(()=>{if(u){t.pollSkips++;return}u=!0,l.call(()=>c.poll()).catch(()=>{}).finally(()=>{u=!1})},400)}function Gt(t){let e=t.payload;return typeof e=="string"?e:String(t)}async function E0(){let t=document.getElementById("banner"),e=I=>{t.textContent=I,console.log(`[boot] ${I}`)};e("fetching artifacts\u2026");let[n,r]=await Promise.all([wu("engine"),wu("app")]);e("instantiating engines\u2026");let s=await gu("alice",n),o=await gu("bob",n),i=await gu("tablet",n),a=[s,o,i];e("identities\u2026");for(let I of a)I.id=mu(await I.engine.driver.init(!1)),I.status(`id ${Array.from(I.id.slice(0,4),de=>de.toString(16).padStart(2,"0")).join("")}\u2026`);await s.engine.driver.khIngestContact(await i.engine.driver.khContactCard()),await i.engine.driver.khIngestContact(await s.engine.driver.khContactCard()),e("wire: alice \u21C4 bob over the relay\u2026"),await s.engine.driver.irohBind(ga);let c=mu(await o.engine.driver.irohBind(ga)),l=await o.engine.driver.irohStart(!1,new Uint8Array,ga,new Uint8Array),u=await s.engine.driver.irohStart(!0,c,ga,o.id);await yn("handshake",async()=>await s.engine.driver.connStatus(u)&&await o.engine.driver.connStatus(l)),await yn("contact cards",()=>s.engine.driver.khKnowsAgent(o.id)),e("partition: create \u2192 members \u2192 seal\u2026");let f=await s.engine.driver.createPartition();await s.engine.driver.khAddMember(f,o.id,"edit"),await s.engine.driver.khAddMember(f,i.id,"edit"),await s.engine.driver.sealPartition(f),await o.engine.driver.adoptPartition(f),await i.engine.driver.adoptPartition(f),e("first sync\u2026"),await yn("bob knows the doc",()=>o.engine.driver.khKnowsAgent(f));let d=async(I,de)=>{let he=await I.driver.syncStart(de,f,!1);return await yn("pull",()=>I.driver.syncStatus(he))};await d(o.engine,s.id),await yn("bob decrypts",async()=>await o.engine.tasks.revision()>=1n);let w=await o.engine.driver.syncStart(s.id,f,!0);await yn("bob subscribe",()=>o.engine.driver.syncStatus(w)),await d(s.engine,o.id);let y=await s.engine.driver.syncStart(o.id,f,!0);await yn("alice subscribe",()=>s.engine.driver.syncStatus(y)),e("mounting apps\u2026");for(let I of a)await x0(I,r);let x=Promise.resolve(),v=0,b=I=>{v++;let de=x.then(I).catch(()=>{}).finally(()=>{v--});return x=de,de},m=(I,de,he)=>{let Le=!1,ut=0;return setInterval(()=>{if(Le){ut++;return}Le=!0,b(he).finally(()=>{Le=!1})},de),{name:I,skips:()=>ut}},g=m("reconcile",2500,async()=>{await d(o.engine,s.id),await d(s.engine,o.id)}),k=!1,T=ba()?.provider??"s3",S,$=document.getElementById("bucket-sync"),N=document.getElementById("bucket-auto"),_=document.getElementById("bob-pull");$.disabled=!0,N.disabled=!0,_.disabled=!0,i.status("no storage configured \u2014 use Storage\u2026 to activate this pane");let R=()=>`/run-${Wm(4)}`,P=!1,z=I=>P?(i.status("storage setup already running \u2014 wait for it",!0),Promise.resolve()):(P=!0,b(async()=>{let de="init",he=Le=>{de=Le,i.status(`configuring storage: ${Le}\u2026`,!0)};try{if(he("provider config"),T=I.provider,S=void 0,I.provider==="s3"){let Le={kind:"s3",value:{endpoint:I.endpoint,bucket:I.bucket,accessKey:I.access,secretKey:I.secret}},ut={kind:"s3",value:{endpoint:I.endpoint,bucket:I.bucket,accessKey:"",secretKey:""}};await s.engine.driver.initStore(Le),await i.engine.driver.initStore(Le),await o.engine.driver.initStore(ut),he("bucket + policy"),await s.engine.driver.ensureBucket(),he("grants");for(let sr of[s.id,o.id,i.id])await s.engine.driver.storeGrant(f,sr)}else{let Le=I.root+R(),ut={appKey:I.appKey,appSecret:I.appSecret,accessToken:I.accessToken,refreshToken:I.refreshToken,root:Le},sr={kind:"dropbox",value:ut},vu={kind:"dropbox",value:{...ut,accessToken:"",refreshToken:""}};await s.engine.driver.initStore(sr),await i.engine.driver.initStore(sr),await o.engine.driver.initStore(vu),he("folders"),await s.engine.driver.ensureBucket(),he("grant: alice"),await s.engine.driver.storeGrant(f,s.id),he("grant: tablet"),await s.engine.driver.storeGrant(f,i.id),he("grant: bob (pickup link)"),S=await s.engine.driver.storeGrant(f,o.id)}he("flush"),await s.engine.driver.bucketFlush(f),he("tablet cold pull"),i.status(await i.engine.driver.bucketPull(f,s.id,void 0),!0),k=!0,$.disabled=!1,N.disabled=!1,_.disabled=!1}catch(Le){i.status(`storage setup failed at ${de}: ${Gt(Le)} \u2014 check the endpoint/token and CORS, then Save & connect again`,!0)}finally{P=!1}})),xt=async()=>{if(k)try{await s.engine.driver.bucketFlush(f),await i.engine.driver.bucketFlush(f),i.status(await i.engine.driver.bucketPull(f,s.id,void 0),!0),s.status(await s.engine.driver.bucketPull(f,s.id,void 0),!0)}catch(I){i.status(`bucket: ${Gt(I)}`,!0)}};$.onclick=()=>{b(xt)};let gn=m("auto-sync",4e3,async()=>{N.checked&&await xt()}),O=()=>b(async()=>{if(k)try{let I=await o.engine.driver.bucketPull(f,s.id,T==="dropbox"?S:void 0);o.status(`bucket: ${I}`,!0)}catch(I){o.status(`bucket: ${Gt(I)}`,!0)}});_.onclick=()=>{O()};let ye=document.getElementById("storage-dialog"),Xt=document.getElementById("panel-region"),rr={s3:document.getElementById("prov-s3"),dropbox:document.getElementById("prov-dropbox")},bu=new Map,ts=null,ka=()=>{},xa=()=>{ka=()=>{},Xt.innerHTML="",ts=null},jm=I=>{if(xa(),ye.close(),I!=="")try{let de=JSON.parse(I);localStorage.setItem(Um,JSON.stringify(de)),k?i.status("storage changed \u2014 reload the page to reconfigure"):z(de)}catch(de){i.status(`storage config unreadable: ${Gt(de)}`)}},ku=async I=>{xa();for(let[ns,or]of Object.entries(rr))or.classList.toggle("active",ns===I);let de=I==="s3"?"panel-s3":"panel-dropbox",he=bu.get(de);he||(he=await wu(de),bu.set(de,he));let Le=Kc("direct",Xt,ns=>ka(ns)),ut=Ni(Le,()=>""),sr=I==="s3"?{...ut.imports}:{...ut.imports,"polymorph:todomvc-spike/oauth-broker@0.0.1":{authorize:Dm},...Fm},xo=(await Fn(Dn(he.envelope,he.bytes),sr)).exports,Eo=Hc(ut);ts=I,ka=ns=>{ts===I&&Eo.call(()=>xo.onEvent(ns)).then(()=>Eo.call(()=>xo.outcome())).then(or=>{or!==void 0&&ts===I&&jm(or)}).catch(or=>console.warn(`[panel] event: ${Gt(or)}`))};let Ea=ba(),Hm=Ea&&Ea.provider===I?JSON.stringify(Ea):"";await Eo.call(()=>xo.seed(Hm)),await Eo.call(()=>xo.run())},xu=()=>{ye.showModal(),ku(ba()?.provider??"s3").catch(I=>{Xt.textContent=`panel failed to mount: ${Gt(I)}`})};document.getElementById("storage-open").onclick=xu;for(let I of["s3","dropbox"])rr[I].onclick=de=>{de.preventDefault(),ts!==I&&ku(I).catch(he=>{Xt.textContent=`panel failed to mount: ${Gt(he)}`})};document.getElementById("storage-cancel").onclick=I=>{I.preventDefault(),xa(),ye.close()};let Eu=ba();Eu&&z(Eu),document.getElementById("revoke-bob").onclick=()=>{b(async()=>{try{await s.engine.driver.khRevokeMember(f,o.id);let I=await s.engine.driver.storeRevoke(f,o.id);await s.engine.driver.bucketFlush(f),s.status(`revoke: ${I}`,!0),o.status("REVOKED: new epochs are dark from here",!0),document.getElementById("bob-pane").classList.add("revoked")}catch(I){s.status(`revoke: ${Gt(I)}`)}})};let Km=m("stats",4e3,async()=>{for(let I of a)if(!(I===i&&!k))try{I.status(await I.engine.driver.stats())}catch{}});globalThis.__demo={alice:s,bob:o,tablet:i,part:f,pull:d,bobPull:()=>O(),openStorage:()=>xu(),setupBucket:I=>z(I),health:()=>({bgDepth:v,skips:{reconcile:g.skips(),autoSync:gn.skips(),stats:Km.skips(),poll:Object.fromEntries(a.map(I=>[I.name,I.pollSkips??0]))}}),authorize:Dm,panelFetch:Fm["polymorph:fetchspike/fetch@0.1.0"]},e("ready \u2014 E2E-encrypted, three replicas, two sync paths")}E0().catch(t=>{console.error(t);let e=document.getElementById("banner");e.textContent=`boot failed: ${Gt(t)}`;let n=document.createElement("pre");n.style.cssText="margin:.5em 0 0; font-size:11px; color:#f5c16c; white-space:pre-wrap",n.textContent=w0,e.appendChild(n)}); diff --git a/docs/spike-demo/engine.component.wasm b/docs/spike-demo/engine.component.wasm index c46e970..ebe2f83 100644 Binary files a/docs/spike-demo/engine.component.wasm and b/docs/spike-demo/engine.component.wasm differ diff --git a/docs/spike-demo/engine.plan.json b/docs/spike-demo/engine.plan.json index 040d2fd..a9fe362 100644 --- a/docs/spike-demo/engine.plan.json +++ b/docs/spike-demo/engine.plan.json @@ -1 +1 @@ -{"plan":{"formatVersion":3,"producer":{"shimVersion":"0.1.0","wasmtimeEnviron":"47.0.3","features":["cm-async","cm-async-stackful","cm-more-async-builtins","cm-error-context","cm-fixed-length-lists","cm-map","cm-implements","cm-threading"]},"component":{"sha256":"9860f7bd3ddd539e70a9fe621ff3876f12f45072c4545840a33cf2de47b9fea1","len":10865265},"modules":[{"kind":"embedded","offset":15498,"len":312933},{"kind":"embedded","offset":328434,"len":726},{"kind":"embedded","offset":329163,"len":361},{"kind":"embedded","offset":349660,"len":1955618},{"kind":"embedded","offset":2305281,"len":1548},{"kind":"embedded","offset":2306832,"len":680},{"kind":"embedded","offset":2361872,"len":8452610},{"kind":"embedded","offset":10814485,"len":4045},{"kind":"embedded","offset":10818533,"len":1763},{"kind":"embedded","offset":10820299,"len":759},{"kind":"adapter","file":"adapters/10.wasm","len":359,"intrinsics":[{"module":"flags","name":"instance3","category":"instance-flags","def":{"kind":"instance-flags","instance":3}},{"module":"flags","name":"instance8","category":"instance-flags","def":{"kind":"instance-flags","instance":8}},{"module":"callee","name":"adapter0","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[constructor]endpoint-options","space":"func"}}},{"module":"runtime","name":"trap","category":"trampoline:trap","def":{"kind":"trampoline","index":210}},{"module":"instance","name":"task_may_block","category":"task-may-block","def":{"kind":"task-may-block"}},{"module":"async","name":"enter-sync-call","category":"trampoline:enter-sync-call","def":{"kind":"trampoline","index":211}},{"module":"resource","name":"transfer-borrow","category":"trampoline:resource-transfer-borrow","def":{"kind":"trampoline","index":212}},{"module":"async","name":"exit-sync-call","category":"trampoline:exit-sync-call","def":{"kind":"trampoline","index":213}},{"module":"resource","name":"transfer-own","category":"trampoline:resource-transfer-own","def":{"kind":"trampoline","index":214}}]},{"kind":"adapter","file":"adapters/11.wasm","len":12523,"intrinsics":[{"module":"flags","name":"instance3","category":"instance-flags","def":{"kind":"instance-flags","instance":3}},{"module":"memory","name":"m0","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"memory","space":"memory"}}},{"module":"realloc","name":"f0","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"cabi_realloc","space":"func"}}},{"module":"flags","name":"instance8","category":"instance-flags","def":{"kind":"instance-flags","instance":8}},{"module":"memory","name":"m1","category":"core-def","def":{"kind":"export","instance":8,"item":{"name":"memory","space":"memory"}}},{"module":"callee","name":"adapter1","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.add-alpn","space":"func"}}},{"module":"runtime","name":"trap","category":"trampoline:trap","def":{"kind":"trampoline","index":210}},{"module":"instance","name":"task_may_block","category":"task-may-block","def":{"kind":"task-may-block"}},{"module":"async","name":"enter-sync-call","category":"trampoline:enter-sync-call","def":{"kind":"trampoline","index":211}},{"module":"resource","name":"transfer-borrow","category":"trampoline:resource-transfer-borrow","def":{"kind":"trampoline","index":212}},{"module":"async","name":"exit-sync-call","category":"trampoline:exit-sync-call","def":{"kind":"trampoline","index":213}},{"module":"callee","name":"adapter2","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.relay-url","space":"func"}}},{"module":"transcode","name":"utf8-to-utf8 (mem1 => mem0)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":262}},{"module":"realloc","name":"f8","category":"core-def","def":{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}}},{"module":"callee","name":"adapter3","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint.id","space":"func"}}},{"module":"post_return","name":"adapter3","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.alpn","space":"func"}}},{"module":"callee","name":"adapter4","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]send-stream.finish","space":"func"}}},{"module":"post_return","name":"adapter4","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.send-datagram","space":"func"}}},{"module":"transcode","name":"utf8-to-utf8 (mem0 => mem1)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":263}},{"module":"callback","name":"f14","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[callback][async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}}},{"module":"callee","name":"adapter5","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]recv-stream.read","space":"func"}}},{"module":"async","name":"[start-call]adapter5","category":"trampoline:async-start-call","def":{"kind":"trampoline","index":264}},{"module":"sync","name":"[prepare-call]adapter5","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":265}},{"module":"callee","name":"adapter6","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[static]endpoint.bind","space":"func"}}},{"module":"resource","name":"transfer-own","category":"trampoline:resource-transfer-own","def":{"kind":"trampoline","index":214}},{"module":"sync","name":"[prepare-call]adapter6","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter7","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.connect","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter7","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter8","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.accept","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter8","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter9","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.open-bi","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter9","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter10","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter10","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter11","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]send-stream.write","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter11","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":267}},{"module":"flags","name":"instance1","category":"instance-flags","def":{"kind":"instance-flags","instance":1}},{"module":"memory","name":"m2","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"memory","space":"memory"}}},{"module":"realloc","name":"f31","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"cabi_realloc","space":"func"}}},{"module":"callback","name":"f32","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[callback][async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}}},{"module":"callee","name":"adapter12","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}}},{"module":"transcode","name":"utf8-to-utf8 (mem1 => mem2)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":268}},{"module":"transcode","name":"utf8-to-utf8 (mem2 => mem1)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":269}},{"module":"async","name":"[start-call]adapter12","category":"trampoline:async-start-call","def":{"kind":"trampoline","index":270}},{"module":"sync","name":"[prepare-call]adapter12","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":271}},{"module":"callee","name":"adapter13","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/identity-generate@0.1.0#generate","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter13","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":272}}]}],"initializers":[{"op":"instantiate-module","module":1,"instance":1,"args":[]},{"op":"lower-import","index":0,"import":24},{"op":"lower-import","index":1,"import":25},{"op":"lower-import","index":2,"import":26},{"op":"lower-import","index":3,"import":29},{"op":"lower-import","index":4,"import":27},{"op":"lower-import","index":5,"import":28},{"op":"lower-import","index":6,"import":30},{"op":"lower-import","index":7,"import":31},{"op":"lower-import","index":8,"import":32},{"op":"lower-import","index":9,"import":33},{"op":"instantiate-module","module":0,"instance":1,"args":[{"kind":"trampoline","index":0},{"kind":"trampoline","index":1},{"kind":"trampoline","index":2},{"kind":"trampoline","index":3},{"kind":"trampoline","index":4},{"kind":"export","instance":0,"item":{"name":"16","space":"func"}},{"kind":"export","instance":0,"item":{"name":"0","space":"func"}},{"kind":"export","instance":0,"item":{"name":"1","space":"func"}},{"kind":"trampoline","index":5},{"kind":"trampoline","index":6},{"kind":"trampoline","index":7},{"kind":"export","instance":0,"item":{"name":"2","space":"func"}},{"kind":"export","instance":0,"item":{"name":"3","space":"func"}},{"kind":"export","instance":0,"item":{"name":"4","space":"func"}},{"kind":"export","instance":0,"item":{"name":"5","space":"func"}},{"kind":"export","instance":0,"item":{"name":"6","space":"func"}},{"kind":"export","instance":0,"item":{"name":"7","space":"func"}},{"kind":"export","instance":0,"item":{"name":"8","space":"func"}},{"kind":"export","instance":0,"item":{"name":"9","space":"func"}},{"kind":"export","instance":0,"item":{"name":"10","space":"func"}},{"kind":"trampoline","index":8},{"kind":"trampoline","index":9},{"kind":"trampoline","index":10},{"kind":"trampoline","index":11},{"kind":"trampoline","index":12},{"kind":"export","instance":0,"item":{"name":"17","space":"func"}},{"kind":"export","instance":0,"item":{"name":"18","space":"func"}},{"kind":"trampoline","index":13},{"kind":"trampoline","index":14},{"kind":"trampoline","index":15},{"kind":"trampoline","index":16},{"kind":"trampoline","index":17},{"kind":"export","instance":0,"item":{"name":"11","space":"func"}},{"kind":"export","instance":0,"item":{"name":"12","space":"func"}},{"kind":"trampoline","index":18},{"kind":"trampoline","index":19},{"kind":"trampoline","index":20},{"kind":"trampoline","index":21},{"kind":"trampoline","index":22},{"kind":"export","instance":0,"item":{"name":"13","space":"func"}},{"kind":"export","instance":0,"item":{"name":"14","space":"func"}},{"kind":"trampoline","index":13},{"kind":"trampoline","index":14},{"kind":"trampoline","index":15},{"kind":"trampoline","index":16},{"kind":"trampoline","index":17},{"kind":"export","instance":0,"item":{"name":"19","space":"func"}},{"kind":"trampoline","index":23},{"kind":"export","instance":0,"item":{"name":"15","space":"func"}},{"kind":"unsafe-intrinsic","intrinsic":"context-get-i32-0"},{"kind":"unsafe-intrinsic","intrinsic":"context-set-i32-0"},{"kind":"trampoline","index":24},{"kind":"trampoline","index":25},{"kind":"trampoline","index":26},{"kind":"trampoline","index":27},{"kind":"export","instance":0,"item":{"name":"20","space":"func"}},{"kind":"trampoline","index":28},{"kind":"trampoline","index":29},{"kind":"trampoline","index":30},{"kind":"trampoline","index":31},{"kind":"trampoline","index":32},{"kind":"trampoline","index":33},{"kind":"export","instance":0,"item":{"name":"25","space":"func"}},{"kind":"trampoline","index":34},{"kind":"trampoline","index":35},{"kind":"export","instance":0,"item":{"name":"21","space":"func"}},{"kind":"export","instance":0,"item":{"name":"22","space":"func"}},{"kind":"export","instance":0,"item":{"name":"23","space":"func"}},{"kind":"export","instance":0,"item":{"name":"24","space":"func"}},{"kind":"trampoline","index":36},{"kind":"trampoline","index":37},{"kind":"trampoline","index":38},{"kind":"trampoline","index":39},{"kind":"export","instance":0,"item":{"name":"26","space":"func"}},{"kind":"export","instance":0,"item":{"name":"27","space":"func"}},{"kind":"export","instance":0,"item":{"name":"28","space":"func"}},{"kind":"trampoline","index":40}]},{"op":"lower-import","index":10,"import":34},{"op":"extract-memory","index":0,"export":{"instance":1,"item":{"name":"memory","space":"memory"}}},{"op":"lower-import","index":11,"import":35},{"op":"lower-import","index":12,"import":36},{"op":"lower-import","index":13,"import":37},{"op":"extract-realloc","index":0,"def":{"kind":"export","instance":1,"item":{"name":"cabi_realloc","space":"func"}}},{"op":"lower-import","index":14,"import":38},{"op":"lower-import","index":15,"import":39},{"op":"lower-import","index":16,"import":40},{"op":"lower-import","index":17,"import":41},{"op":"lower-import","index":18,"import":42},{"op":"lower-import","index":19,"import":43},{"op":"lower-import","index":20,"import":44},{"op":"lower-import","index":21,"import":45},{"op":"lower-import","index":22,"import":46},{"op":"lower-import","index":23,"import":47},{"op":"lower-import","index":24,"import":48},{"op":"lower-import","index":25,"import":49},{"op":"lower-import","index":26,"import":50},{"op":"lower-import","index":27,"import":51},{"op":"lower-import","index":28,"import":52},{"op":"instantiate-module","module":2,"instance":1,"args":[{"kind":"trampoline","index":41},{"kind":"trampoline","index":42},{"kind":"trampoline","index":43},{"kind":"trampoline","index":44},{"kind":"trampoline","index":45},{"kind":"trampoline","index":46},{"kind":"trampoline","index":47},{"kind":"trampoline","index":48},{"kind":"trampoline","index":49},{"kind":"trampoline","index":50},{"kind":"trampoline","index":51},{"kind":"trampoline","index":52},{"kind":"trampoline","index":53},{"kind":"trampoline","index":54},{"kind":"trampoline","index":55},{"kind":"trampoline","index":56},{"kind":"trampoline","index":57},{"kind":"trampoline","index":54},{"kind":"trampoline","index":55},{"kind":"trampoline","index":58},{"kind":"trampoline","index":59},{"kind":"trampoline","index":60},{"kind":"trampoline","index":61},{"kind":"trampoline","index":62},{"kind":"trampoline","index":63},{"kind":"trampoline","index":64},{"kind":"trampoline","index":65},{"kind":"trampoline","index":66},{"kind":"trampoline","index":67},{"kind":"export","instance":0,"item":{"name":"$imports","space":"table"}}]},{"op":"instantiate-module","module":4,"instance":3,"args":[]},{"op":"resource","index":0,"rep":"i32","dtor":{"kind":"export","instance":3,"item":{"name":"66","space":"func"}},"instance":3},{"op":"resource","index":1,"rep":"i32","dtor":{"kind":"export","instance":3,"item":{"name":"63","space":"func"}},"instance":3},{"op":"resource","index":2,"rep":"i32","dtor":{"kind":"export","instance":3,"item":{"name":"62","space":"func"}},"instance":3},{"op":"resource","index":3,"rep":"i32","dtor":{"kind":"export","instance":3,"item":{"name":"61","space":"func"}},"instance":3},{"op":"resource","index":4,"rep":"i32","dtor":{"kind":"export","instance":3,"item":{"name":"65","space":"func"}},"instance":3},{"op":"resource","index":5,"rep":"i32","dtor":{"kind":"export","instance":3,"item":{"name":"64","space":"func"}},"instance":3},{"op":"lower-import","index":29,"import":53},{"op":"lower-import","index":30,"import":54},{"op":"lower-import","index":31,"import":55},{"op":"lower-import","index":32,"import":56},{"op":"lower-import","index":33,"import":57},{"op":"lower-import","index":34,"import":58},{"op":"lower-import","index":35,"import":59},{"op":"lower-import","index":36,"import":60},{"op":"lower-import","index":37,"import":61},{"op":"lower-import","index":38,"import":62},{"op":"lower-import","index":39,"import":63},{"op":"lower-import","index":40,"import":64},{"op":"lower-import","index":41,"import":65},{"op":"lower-import","index":42,"import":66},{"op":"lower-import","index":43,"import":29},{"op":"lower-import","index":44,"import":27},{"op":"lower-import","index":45,"import":28},{"op":"lower-import","index":46,"import":30},{"op":"lower-import","index":47,"import":31},{"op":"lower-import","index":48,"import":32},{"op":"lower-import","index":49,"import":67},{"op":"lower-import","index":50,"import":33},{"op":"instantiate-module","module":3,"instance":3,"args":[{"kind":"trampoline","index":68},{"kind":"trampoline","index":69},{"kind":"trampoline","index":70},{"kind":"trampoline","index":71},{"kind":"trampoline","index":72},{"kind":"trampoline","index":73},{"kind":"trampoline","index":74},{"kind":"trampoline","index":75},{"kind":"trampoline","index":76},{"kind":"trampoline","index":77},{"kind":"trampoline","index":78},{"kind":"trampoline","index":79},{"kind":"trampoline","index":80},{"kind":"trampoline","index":81},{"kind":"trampoline","index":82},{"kind":"trampoline","index":83},{"kind":"export","instance":3,"item":{"name":"24","space":"func"}},{"kind":"export","instance":3,"item":{"name":"25","space":"func"}},{"kind":"export","instance":3,"item":{"name":"17","space":"func"}},{"kind":"export","instance":3,"item":{"name":"18","space":"func"}},{"kind":"trampoline","index":84},{"kind":"export","instance":3,"item":{"name":"26","space":"func"}},{"kind":"trampoline","index":85},{"kind":"trampoline","index":86},{"kind":"export","instance":3,"item":{"name":"27","space":"func"}},{"kind":"export","instance":3,"item":{"name":"28","space":"func"}},{"kind":"export","instance":3,"item":{"name":"29","space":"func"}},{"kind":"trampoline","index":87},{"kind":"trampoline","index":88},{"kind":"export","instance":3,"item":{"name":"0","space":"func"}},{"kind":"trampoline","index":89},{"kind":"export","instance":3,"item":{"name":"1","space":"func"}},{"kind":"export","instance":3,"item":{"name":"2","space":"func"}},{"kind":"export","instance":3,"item":{"name":"3","space":"func"}},{"kind":"export","instance":3,"item":{"name":"4","space":"func"}},{"kind":"export","instance":3,"item":{"name":"5","space":"func"}},{"kind":"export","instance":3,"item":{"name":"6","space":"func"}},{"kind":"export","instance":3,"item":{"name":"7","space":"func"}},{"kind":"export","instance":3,"item":{"name":"8","space":"func"}},{"kind":"trampoline","index":90},{"kind":"export","instance":3,"item":{"name":"9","space":"func"}},{"kind":"export","instance":3,"item":{"name":"10","space":"func"}},{"kind":"export","instance":3,"item":{"name":"13","space":"func"}},{"kind":"export","instance":3,"item":{"name":"19","space":"func"}},{"kind":"export","instance":3,"item":{"name":"32","space":"func"}},{"kind":"export","instance":3,"item":{"name":"14","space":"func"}},{"kind":"trampoline","index":91},{"kind":"trampoline","index":92},{"kind":"export","instance":3,"item":{"name":"30","space":"func"}},{"kind":"trampoline","index":93},{"kind":"export","instance":3,"item":{"name":"33","space":"func"}},{"kind":"trampoline","index":94},{"kind":"trampoline","index":95},{"kind":"export","instance":3,"item":{"name":"34","space":"func"}},{"kind":"trampoline","index":96},{"kind":"trampoline","index":97},{"kind":"export","instance":3,"item":{"name":"35","space":"func"}},{"kind":"trampoline","index":98},{"kind":"trampoline","index":99},{"kind":"export","instance":3,"item":{"name":"36","space":"func"}},{"kind":"trampoline","index":100},{"kind":"export","instance":3,"item":{"name":"37","space":"func"}},{"kind":"export","instance":3,"item":{"name":"38","space":"func"}},{"kind":"export","instance":3,"item":{"name":"39","space":"func"}},{"kind":"export","instance":3,"item":{"name":"40","space":"func"}},{"kind":"export","instance":3,"item":{"name":"41","space":"func"}},{"kind":"trampoline","index":101},{"kind":"export","instance":3,"item":{"name":"15","space":"func"}},{"kind":"export","instance":3,"item":{"name":"16","space":"func"}},{"kind":"export","instance":3,"item":{"name":"20","space":"func"}},{"kind":"trampoline","index":102},{"kind":"export","instance":3,"item":{"name":"50","space":"func"}},{"kind":"unsafe-intrinsic","intrinsic":"context-get-i32-0"},{"kind":"unsafe-intrinsic","intrinsic":"context-set-i32-0"},{"kind":"trampoline","index":103},{"kind":"trampoline","index":80},{"kind":"trampoline","index":104},{"kind":"trampoline","index":105},{"kind":"trampoline","index":106},{"kind":"trampoline","index":107},{"kind":"trampoline","index":108},{"kind":"trampoline","index":109},{"kind":"export","instance":3,"item":{"name":"31","space":"func"}},{"kind":"export","instance":3,"item":{"name":"21","space":"func"}},{"kind":"export","instance":3,"item":{"name":"11","space":"func"}},{"kind":"export","instance":3,"item":{"name":"12","space":"func"}},{"kind":"export","instance":3,"item":{"name":"51","space":"func"}},{"kind":"trampoline","index":110},{"kind":"trampoline","index":111},{"kind":"trampoline","index":112},{"kind":"export","instance":3,"item":{"name":"42","space":"func"}},{"kind":"export","instance":3,"item":{"name":"43","space":"func"}},{"kind":"trampoline","index":113},{"kind":"trampoline","index":114},{"kind":"trampoline","index":115},{"kind":"trampoline","index":116},{"kind":"trampoline","index":117},{"kind":"export","instance":3,"item":{"name":"44","space":"func"}},{"kind":"export","instance":3,"item":{"name":"45","space":"func"}},{"kind":"trampoline","index":118},{"kind":"trampoline","index":119},{"kind":"trampoline","index":120},{"kind":"trampoline","index":121},{"kind":"trampoline","index":122},{"kind":"export","instance":3,"item":{"name":"46","space":"func"}},{"kind":"export","instance":3,"item":{"name":"47","space":"func"}},{"kind":"trampoline","index":123},{"kind":"trampoline","index":124},{"kind":"trampoline","index":125},{"kind":"trampoline","index":126},{"kind":"trampoline","index":127},{"kind":"export","instance":3,"item":{"name":"48","space":"func"}},{"kind":"export","instance":3,"item":{"name":"49","space":"func"}},{"kind":"trampoline","index":128},{"kind":"trampoline","index":129},{"kind":"trampoline","index":130},{"kind":"trampoline","index":102},{"kind":"export","instance":3,"item":{"name":"22","space":"func"}},{"kind":"export","instance":3,"item":{"name":"23","space":"func"}},{"kind":"trampoline","index":128},{"kind":"trampoline","index":129},{"kind":"trampoline","index":130},{"kind":"trampoline","index":131},{"kind":"trampoline","index":132},{"kind":"trampoline","index":133},{"kind":"trampoline","index":134},{"kind":"trampoline","index":135},{"kind":"trampoline","index":136},{"kind":"export","instance":3,"item":{"name":"56","space":"func"}},{"kind":"trampoline","index":137},{"kind":"trampoline","index":138},{"kind":"export","instance":3,"item":{"name":"52","space":"func"}},{"kind":"export","instance":3,"item":{"name":"53","space":"func"}},{"kind":"export","instance":3,"item":{"name":"54","space":"func"}},{"kind":"export","instance":3,"item":{"name":"55","space":"func"}},{"kind":"trampoline","index":139},{"kind":"trampoline","index":140},{"kind":"trampoline","index":141},{"kind":"trampoline","index":142},{"kind":"export","instance":3,"item":{"name":"57","space":"func"}},{"kind":"export","instance":3,"item":{"name":"58","space":"func"}},{"kind":"export","instance":3,"item":{"name":"59","space":"func"}},{"kind":"trampoline","index":143},{"kind":"trampoline","index":144},{"kind":"export","instance":3,"item":{"name":"60","space":"func"}}]},{"op":"extract-memory","index":1,"export":{"instance":4,"item":{"name":"memory","space":"memory"}}},{"op":"lower-import","index":51,"import":68},{"op":"extract-realloc","index":1,"def":{"kind":"export","instance":4,"item":{"name":"cabi_realloc","space":"func"}}},{"op":"lower-import","index":52,"import":69},{"op":"lower-import","index":53,"import":70},{"op":"lower-import","index":54,"import":71},{"op":"lower-import","index":55,"import":72},{"op":"lower-import","index":56,"import":73},{"op":"lower-import","index":57,"import":74},{"op":"lower-import","index":58,"import":75},{"op":"lower-import","index":59,"import":76},{"op":"lower-import","index":60,"import":77},{"op":"lower-import","index":61,"import":78},{"op":"lower-import","index":62,"import":79},{"op":"lower-import","index":63,"import":80},{"op":"lower-import","index":64,"import":81},{"op":"lower-import","index":65,"import":82},{"op":"lower-import","index":66,"import":83},{"op":"lower-import","index":67,"import":84},{"op":"lower-import","index":68,"import":85},{"op":"lower-import","index":69,"import":86},{"op":"lower-import","index":70,"import":87},{"op":"lower-import","index":71,"import":88},{"op":"lower-import","index":72,"import":89},{"op":"lower-import","index":73,"import":90},{"op":"lower-import","index":74,"import":91},{"op":"lower-import","index":75,"import":92},{"op":"lower-import","index":76,"import":93},{"op":"lower-import","index":77,"import":44},{"op":"lower-import","index":78,"import":45},{"op":"lower-import","index":79,"import":46},{"op":"lower-import","index":80,"import":47},{"op":"lower-import","index":81,"import":48},{"op":"lower-import","index":82,"import":49},{"op":"lower-import","index":83,"import":50},{"op":"lower-import","index":84,"import":51},{"op":"lower-import","index":85,"import":52},{"op":"lower-import","index":86,"import":94},{"op":"instantiate-module","module":5,"instance":3,"args":[{"kind":"trampoline","index":145},{"kind":"trampoline","index":146},{"kind":"trampoline","index":146},{"kind":"trampoline","index":147},{"kind":"trampoline","index":148},{"kind":"trampoline","index":149},{"kind":"trampoline","index":150},{"kind":"trampoline","index":149},{"kind":"trampoline","index":151},{"kind":"trampoline","index":152},{"kind":"trampoline","index":148},{"kind":"trampoline","index":153},{"kind":"trampoline","index":154},{"kind":"trampoline","index":155},{"kind":"trampoline","index":156},{"kind":"trampoline","index":157},{"kind":"trampoline","index":158},{"kind":"trampoline","index":159},{"kind":"trampoline","index":160},{"kind":"trampoline","index":161},{"kind":"trampoline","index":162},{"kind":"trampoline","index":163},{"kind":"trampoline","index":164},{"kind":"trampoline","index":165},{"kind":"trampoline","index":166},{"kind":"trampoline","index":167},{"kind":"trampoline","index":167},{"kind":"trampoline","index":168},{"kind":"trampoline","index":169},{"kind":"trampoline","index":170},{"kind":"trampoline","index":171},{"kind":"trampoline","index":172},{"kind":"trampoline","index":173},{"kind":"trampoline","index":174},{"kind":"trampoline","index":175},{"kind":"trampoline","index":176},{"kind":"trampoline","index":177},{"kind":"trampoline","index":178},{"kind":"trampoline","index":179},{"kind":"trampoline","index":180},{"kind":"trampoline","index":181},{"kind":"trampoline","index":182},{"kind":"trampoline","index":183},{"kind":"trampoline","index":184},{"kind":"trampoline","index":185},{"kind":"trampoline","index":186},{"kind":"trampoline","index":187},{"kind":"trampoline","index":188},{"kind":"trampoline","index":164},{"kind":"trampoline","index":165},{"kind":"trampoline","index":189},{"kind":"trampoline","index":190},{"kind":"trampoline","index":191},{"kind":"trampoline","index":192},{"kind":"trampoline","index":193},{"kind":"trampoline","index":194},{"kind":"trampoline","index":195},{"kind":"trampoline","index":196},{"kind":"trampoline","index":197},{"kind":"trampoline","index":198},{"kind":"trampoline","index":199},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]connection","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]endpoint","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]endpoint-options","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]recv-stream","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]send-stream","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/identity@0.1.0#[dtor]identity","space":"func"}},{"kind":"export","instance":3,"item":{"name":"$imports","space":"table"}}]},{"op":"instantiate-module","module":8,"instance":8,"args":[]},{"op":"instantiate-module","module":10,"instance":null,"args":[{"kind":"instance-flags","instance":3},{"kind":"instance-flags","instance":8},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[constructor]endpoint-options","space":"func"}},{"kind":"trampoline","index":210},{"kind":"task-may-block"},{"kind":"trampoline","index":211},{"kind":"trampoline","index":212},{"kind":"trampoline","index":213},{"kind":"trampoline","index":214}]},{"op":"lower-import","index":87,"import":101},{"op":"lower-import","index":88,"import":102},{"op":"lower-import","index":89,"import":103},{"op":"lower-import","index":90,"import":104},{"op":"lower-import","index":91,"import":95},{"op":"lower-import","index":92,"import":96},{"op":"lower-import","index":93,"import":97},{"op":"lower-import","index":94,"import":98},{"op":"lower-import","index":95,"import":99},{"op":"lower-import","index":96,"import":100},{"op":"lower-import","index":97,"import":53},{"op":"lower-import","index":98,"import":54},{"op":"lower-import","index":99,"import":55},{"op":"lower-import","index":100,"import":57},{"op":"lower-import","index":101,"import":29},{"op":"lower-import","index":102,"import":27},{"op":"lower-import","index":103,"import":28},{"op":"lower-import","index":104,"import":30},{"op":"lower-import","index":105,"import":31},{"op":"lower-import","index":106,"import":32},{"op":"lower-import","index":107,"import":67},{"op":"lower-import","index":108,"import":33},{"op":"instantiate-module","module":6,"instance":8,"args":[{"kind":"trampoline","index":200},{"kind":"trampoline","index":201},{"kind":"trampoline","index":202},{"kind":"trampoline","index":203},{"kind":"trampoline","index":204},{"kind":"trampoline","index":205},{"kind":"trampoline","index":206},{"kind":"trampoline","index":207},{"kind":"trampoline","index":208},{"kind":"trampoline","index":209},{"kind":"export","instance":6,"item":{"name":"20","space":"func"}},{"kind":"export","instance":6,"item":{"name":"21","space":"func"}},{"kind":"export","instance":6,"item":{"name":"22","space":"func"}},{"kind":"export","instance":6,"item":{"name":"23","space":"func"}},{"kind":"export","instance":6,"item":{"name":"24","space":"func"}},{"kind":"export","instance":6,"item":{"name":"25","space":"func"}},{"kind":"export","instance":6,"item":{"name":"26","space":"func"}},{"kind":"export","instance":6,"item":{"name":"27","space":"func"}},{"kind":"export","instance":6,"item":{"name":"28","space":"func"}},{"kind":"export","instance":7,"item":{"name":"adapter0","space":"func"}},{"kind":"export","instance":6,"item":{"name":"0","space":"func"}},{"kind":"export","instance":6,"item":{"name":"1","space":"func"}},{"kind":"export","instance":6,"item":{"name":"2","space":"func"}},{"kind":"export","instance":6,"item":{"name":"29","space":"func"}},{"kind":"export","instance":6,"item":{"name":"30","space":"func"}},{"kind":"export","instance":6,"item":{"name":"31","space":"func"}},{"kind":"export","instance":6,"item":{"name":"32","space":"func"}},{"kind":"export","instance":6,"item":{"name":"33","space":"func"}},{"kind":"export","instance":6,"item":{"name":"34","space":"func"}},{"kind":"export","instance":6,"item":{"name":"35","space":"func"}},{"kind":"export","instance":6,"item":{"name":"36","space":"func"}},{"kind":"export","instance":6,"item":{"name":"37","space":"func"}},{"kind":"export","instance":6,"item":{"name":"38","space":"func"}},{"kind":"export","instance":6,"item":{"name":"39","space":"func"}},{"kind":"export","instance":6,"item":{"name":"40","space":"func"}},{"kind":"export","instance":6,"item":{"name":"41","space":"func"}},{"kind":"export","instance":6,"item":{"name":"42","space":"func"}},{"kind":"export","instance":6,"item":{"name":"43","space":"func"}},{"kind":"export","instance":6,"item":{"name":"44","space":"func"}},{"kind":"export","instance":6,"item":{"name":"45","space":"func"}},{"kind":"export","instance":6,"item":{"name":"46","space":"func"}},{"kind":"export","instance":6,"item":{"name":"47","space":"func"}},{"kind":"export","instance":6,"item":{"name":"48","space":"func"}},{"kind":"export","instance":6,"item":{"name":"49","space":"func"}},{"kind":"export","instance":6,"item":{"name":"50","space":"func"}},{"kind":"export","instance":6,"item":{"name":"51","space":"func"}},{"kind":"export","instance":6,"item":{"name":"52","space":"func"}},{"kind":"export","instance":6,"item":{"name":"53","space":"func"}},{"kind":"export","instance":6,"item":{"name":"54","space":"func"}},{"kind":"export","instance":6,"item":{"name":"55","space":"func"}},{"kind":"trampoline","index":215},{"kind":"trampoline","index":216},{"kind":"trampoline","index":217},{"kind":"export","instance":6,"item":{"name":"3","space":"func"}},{"kind":"trampoline","index":218},{"kind":"export","instance":6,"item":{"name":"4","space":"func"}},{"kind":"export","instance":6,"item":{"name":"5","space":"func"}},{"kind":"export","instance":6,"item":{"name":"6","space":"func"}},{"kind":"export","instance":6,"item":{"name":"7","space":"func"}},{"kind":"export","instance":6,"item":{"name":"8","space":"func"}},{"kind":"export","instance":6,"item":{"name":"9","space":"func"}},{"kind":"export","instance":6,"item":{"name":"10","space":"func"}},{"kind":"export","instance":6,"item":{"name":"59","space":"func"}},{"kind":"export","instance":6,"item":{"name":"60","space":"func"}},{"kind":"trampoline","index":219},{"kind":"trampoline","index":220},{"kind":"trampoline","index":221},{"kind":"trampoline","index":222},{"kind":"trampoline","index":223},{"kind":"trampoline","index":224},{"kind":"trampoline","index":225},{"kind":"trampoline","index":226},{"kind":"trampoline","index":227},{"kind":"trampoline","index":228},{"kind":"trampoline","index":229},{"kind":"trampoline","index":230},{"kind":"trampoline","index":231},{"kind":"trampoline","index":232},{"kind":"trampoline","index":233},{"kind":"export","instance":6,"item":{"name":"11","space":"func"}},{"kind":"trampoline","index":234},{"kind":"export","instance":6,"item":{"name":"12","space":"func"}},{"kind":"export","instance":6,"item":{"name":"13","space":"func"}},{"kind":"export","instance":6,"item":{"name":"19","space":"func"}},{"kind":"export","instance":6,"item":{"name":"16","space":"func"}},{"kind":"export","instance":6,"item":{"name":"61","space":"func"}},{"kind":"export","instance":6,"item":{"name":"62","space":"func"}},{"kind":"export","instance":6,"item":{"name":"63","space":"func"}},{"kind":"export","instance":6,"item":{"name":"64","space":"func"}},{"kind":"export","instance":6,"item":{"name":"14","space":"func"}},{"kind":"export","instance":6,"item":{"name":"15","space":"func"}},{"kind":"export","instance":6,"item":{"name":"65","space":"func"}},{"kind":"export","instance":6,"item":{"name":"17","space":"func"}},{"kind":"export","instance":6,"item":{"name":"18","space":"func"}},{"kind":"trampoline","index":235},{"kind":"trampoline","index":236},{"kind":"trampoline","index":237},{"kind":"trampoline","index":238},{"kind":"export","instance":6,"item":{"name":"56","space":"func"}},{"kind":"trampoline","index":239},{"kind":"trampoline","index":240},{"kind":"trampoline","index":241},{"kind":"export","instance":6,"item":{"name":"57","space":"func"}},{"kind":"trampoline","index":242},{"kind":"trampoline","index":243},{"kind":"unsafe-intrinsic","intrinsic":"context-get-i32-0"},{"kind":"unsafe-intrinsic","intrinsic":"context-set-i32-0"},{"kind":"trampoline","index":244},{"kind":"export","instance":6,"item":{"name":"58","space":"func"}},{"kind":"trampoline","index":245},{"kind":"trampoline","index":246},{"kind":"export","instance":6,"item":{"name":"66","space":"func"}},{"kind":"trampoline","index":247},{"kind":"export","instance":6,"item":{"name":"67","space":"func"}},{"kind":"trampoline","index":248},{"kind":"trampoline","index":249},{"kind":"trampoline","index":250},{"kind":"trampoline","index":251},{"kind":"trampoline","index":252},{"kind":"trampoline","index":253},{"kind":"export","instance":6,"item":{"name":"72","space":"func"}},{"kind":"trampoline","index":254},{"kind":"trampoline","index":255},{"kind":"export","instance":6,"item":{"name":"68","space":"func"}},{"kind":"export","instance":6,"item":{"name":"69","space":"func"}},{"kind":"export","instance":6,"item":{"name":"70","space":"func"}},{"kind":"export","instance":6,"item":{"name":"71","space":"func"}},{"kind":"trampoline","index":256},{"kind":"trampoline","index":257},{"kind":"trampoline","index":258},{"kind":"trampoline","index":259},{"kind":"export","instance":6,"item":{"name":"73","space":"func"}},{"kind":"export","instance":6,"item":{"name":"74","space":"func"}},{"kind":"export","instance":6,"item":{"name":"75","space":"func"}},{"kind":"trampoline","index":260},{"kind":"trampoline","index":261},{"kind":"export","instance":6,"item":{"name":"76","space":"func"}}]},{"op":"instantiate-module","module":7,"instance":8,"args":[{"kind":"export","instance":8,"item":{"name":"memory","space":"memory"}},{"kind":"trampoline","index":248},{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"trampoline","index":251},{"kind":"export","instance":6,"item":{"name":"78","space":"func"}},{"kind":"trampoline","index":259},{"kind":"export","instance":6,"item":{"name":"77","space":"func"}}]},{"op":"extract-memory","index":2,"export":{"instance":8,"item":{"name":"memory","space":"memory"}}},{"op":"extract-callback","index":0,"def":{"kind":"export","instance":4,"item":{"name":"[callback][async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}}},{"op":"extract-callback","index":1,"def":{"kind":"export","instance":1,"item":{"name":"[callback][async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}}},{"op":"instantiate-module","module":11,"instance":null,"args":[{"kind":"instance-flags","instance":3},{"kind":"export","instance":4,"item":{"name":"memory","space":"memory"}},{"kind":"export","instance":4,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"instance-flags","instance":8},{"kind":"export","instance":8,"item":{"name":"memory","space":"memory"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.add-alpn","space":"func"}},{"kind":"trampoline","index":210},{"kind":"task-may-block"},{"kind":"trampoline","index":211},{"kind":"trampoline","index":212},{"kind":"trampoline","index":213},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.relay-url","space":"func"}},{"kind":"trampoline","index":262},{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint.id","space":"func"}},{"kind":"export","instance":4,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.alpn","space":"func"}},{"kind":"export","instance":4,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]send-stream.finish","space":"func"}},{"kind":"export","instance":4,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.send-datagram","space":"func"}},{"kind":"trampoline","index":263},{"kind":"export","instance":4,"item":{"name":"[callback][async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]recv-stream.read","space":"func"}},{"kind":"trampoline","index":264},{"kind":"trampoline","index":265},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[static]endpoint.bind","space":"func"}},{"kind":"trampoline","index":214},{"kind":"trampoline","index":266},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.connect","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.accept","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.open-bi","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]send-stream.write","space":"func"}},{"kind":"trampoline","index":267},{"kind":"instance-flags","instance":1},{"kind":"export","instance":1,"item":{"name":"memory","space":"memory"}},{"kind":"export","instance":1,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"export","instance":1,"item":{"name":"[callback][async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}},{"kind":"trampoline","index":268},{"kind":"trampoline","index":269},{"kind":"trampoline","index":270},{"kind":"trampoline","index":271},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:iroh/identity-generate@0.1.0#generate","space":"func"}},{"kind":"trampoline","index":272}]},{"op":"lower-import","index":109,"import":75},{"op":"extract-realloc","index":2,"def":{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}}},{"op":"lower-import","index":110,"import":74},{"op":"lower-import","index":111,"import":76},{"op":"lower-import","index":112,"import":105},{"op":"lower-import","index":113,"import":106},{"op":"lower-import","index":114,"import":107},{"op":"lower-import","index":115,"import":108},{"op":"lower-import","index":116,"import":77},{"op":"lower-import","index":117,"import":109},{"op":"lower-import","index":118,"import":110},{"op":"lower-import","index":119,"import":111},{"op":"lower-import","index":120,"import":112},{"op":"lower-import","index":121,"import":44},{"op":"lower-import","index":122,"import":45},{"op":"lower-import","index":123,"import":46},{"op":"lower-import","index":124,"import":47},{"op":"lower-import","index":125,"import":48},{"op":"lower-import","index":126,"import":49},{"op":"lower-import","index":127,"import":50},{"op":"lower-import","index":128,"import":51},{"op":"lower-import","index":129,"import":52},{"op":"lower-import","index":130,"import":94},{"op":"lower-import","index":131,"import":113},{"op":"lower-import","index":132,"import":114},{"op":"extract-realloc","index":3,"def":{"kind":"export","instance":9,"item":{"name":"cabi_import_realloc","space":"func"}}},{"op":"instantiate-module","module":9,"instance":8,"args":[{"kind":"export","instance":10,"item":{"name":"adapter1","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter2","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter3","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter4","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter5","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter6","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter7","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter8","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter9","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter10","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter11","space":"func"}},{"kind":"trampoline","index":273},{"kind":"trampoline","index":274},{"kind":"trampoline","index":275},{"kind":"trampoline","index":276},{"kind":"trampoline","index":277},{"kind":"trampoline","index":278},{"kind":"trampoline","index":279},{"kind":"trampoline","index":280},{"kind":"trampoline","index":281},{"kind":"trampoline","index":282},{"kind":"trampoline","index":283},{"kind":"trampoline","index":284},{"kind":"trampoline","index":285},{"kind":"trampoline","index":286},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":282},{"kind":"trampoline","index":287},{"kind":"trampoline","index":282},{"kind":"trampoline","index":284},{"kind":"trampoline","index":288},{"kind":"trampoline","index":288},{"kind":"trampoline","index":282},{"kind":"trampoline","index":289},{"kind":"trampoline","index":290},{"kind":"trampoline","index":290},{"kind":"trampoline","index":290},{"kind":"trampoline","index":282},{"kind":"trampoline","index":282},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":286},{"kind":"trampoline","index":288},{"kind":"trampoline","index":291},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":286},{"kind":"trampoline","index":282},{"kind":"trampoline","index":284},{"kind":"trampoline","index":286},{"kind":"trampoline","index":286},{"kind":"trampoline","index":286},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":292},{"kind":"trampoline","index":293},{"kind":"trampoline","index":294},{"kind":"export","instance":10,"item":{"name":"adapter12","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter13","space":"func"}},{"kind":"trampoline","index":295},{"kind":"trampoline","index":296},{"kind":"trampoline","index":297},{"kind":"trampoline","index":298},{"kind":"trampoline","index":299},{"kind":"export","instance":9,"item":{"name":"random_get","space":"func"}},{"kind":"trampoline","index":300},{"kind":"trampoline","index":301},{"kind":"trampoline","index":302},{"kind":"trampoline","index":303},{"kind":"trampoline","index":304},{"kind":"trampoline","index":305},{"kind":"trampoline","index":306},{"kind":"trampoline","index":307},{"kind":"trampoline","index":308},{"kind":"trampoline","index":309},{"kind":"trampoline","index":310},{"kind":"trampoline","index":311},{"kind":"export","instance":6,"item":{"name":"$imports","space":"table"}}]},{"op":"extract-callback","index":2,"def":{"kind":"export","instance":8,"item":{"name":"[callback][async-lift]polymorph-data:tasks/tasks@0.1.0#add","space":"func"}}}],"trampolines":[{"kind":"resource-drop","index":0,"instance":1,"resource":24},{"kind":"resource-drop","index":1,"instance":1,"resource":25},{"kind":"resource-drop","index":2,"instance":1,"resource":26},{"kind":"resource-drop","index":3,"instance":1,"resource":27},{"kind":"subtask-cancel","index":4,"instance":1,"async":false},{"kind":"lower-import","index":5,"lowered":0,"options":0,"type":0},{"kind":"lower-import","index":6,"lowered":1,"options":0,"type":1},{"kind":"lower-import","index":7,"lowered":2,"options":0,"type":2},{"kind":"future-cancel-write","index":8,"instance":1,"futureTable":2,"async":false},{"kind":"future-cancel-read","index":9,"instance":1,"futureTable":2,"async":false},{"kind":"future-drop-writable","index":10,"instance":1,"futureTable":2},{"kind":"future-drop-readable","index":11,"instance":1,"futureTable":2},{"kind":"future-new","index":12,"instance":1,"futureTable":2},{"kind":"stream-cancel-write","index":13,"instance":1,"streamTable":4,"async":false},{"kind":"stream-cancel-read","index":14,"instance":1,"streamTable":4,"async":false},{"kind":"stream-drop-writable","index":15,"instance":1,"streamTable":4},{"kind":"stream-drop-readable","index":16,"instance":1,"streamTable":4},{"kind":"stream-new","index":17,"instance":1,"streamTable":4},{"kind":"future-cancel-write","index":18,"instance":1,"futureTable":3,"async":false},{"kind":"future-cancel-read","index":19,"instance":1,"futureTable":3,"async":false},{"kind":"future-drop-writable","index":20,"instance":1,"futureTable":3},{"kind":"future-drop-readable","index":21,"instance":1,"futureTable":3},{"kind":"future-new","index":22,"instance":1,"futureTable":3},{"kind":"waitable-join","index":23,"instance":1},{"kind":"waitable-set-new","index":24,"instance":1},{"kind":"waitable-set-drop","index":25,"instance":1},{"kind":"task-cancel","index":26,"instance":1},{"kind":"subtask-drop","index":27,"instance":1},{"kind":"resource-drop","index":28,"instance":1,"resource":28},{"kind":"resource-drop","index":29,"instance":1,"resource":29},{"kind":"resource-drop","index":30,"instance":1,"resource":30},{"kind":"resource-drop","index":31,"instance":1,"resource":31},{"kind":"resource-drop","index":32,"instance":1,"resource":32},{"kind":"resource-drop","index":33,"instance":1,"resource":33},{"kind":"lower-import","index":34,"lowered":3,"options":1,"type":3},{"kind":"lower-import","index":35,"lowered":4,"options":1,"type":4},{"kind":"lower-import","index":36,"lowered":5,"options":0,"type":5},{"kind":"lower-import","index":37,"lowered":6,"options":2,"type":6},{"kind":"lower-import","index":38,"lowered":7,"options":2,"type":7},{"kind":"lower-import","index":39,"lowered":8,"options":2,"type":7},{"kind":"lower-import","index":40,"lowered":9,"options":3,"type":8},{"kind":"lower-import","index":41,"lowered":10,"options":4,"type":9},{"kind":"lower-import","index":42,"lowered":11,"options":5,"type":10},{"kind":"lower-import","index":43,"lowered":12,"options":6,"type":11},{"kind":"lower-import","index":44,"lowered":13,"options":7,"type":12},{"kind":"lower-import","index":45,"lowered":14,"options":8,"type":13},{"kind":"lower-import","index":46,"lowered":15,"options":9,"type":14},{"kind":"lower-import","index":47,"lowered":16,"options":10,"type":15},{"kind":"lower-import","index":48,"lowered":17,"options":5,"type":16},{"kind":"lower-import","index":49,"lowered":18,"options":5,"type":17},{"kind":"future-write","index":50,"instance":1,"futureTable":2,"options":11},{"kind":"future-read","index":51,"instance":1,"futureTable":2,"options":12},{"kind":"future-write","index":52,"instance":1,"futureTable":3,"options":11},{"kind":"future-read","index":53,"instance":1,"futureTable":3,"options":12},{"kind":"stream-write","index":54,"instance":1,"streamTable":4,"options":13},{"kind":"stream-read","index":55,"instance":1,"streamTable":4,"options":13},{"kind":"waitable-set-poll","index":56,"instance":1,"options":14},{"kind":"task-return","index":57,"instance":1,"results":128,"resultType":18,"options":15},{"kind":"lower-import","index":58,"lowered":19,"options":12,"type":19},{"kind":"lower-import","index":59,"lowered":20,"options":16,"type":20},{"kind":"lower-import","index":60,"lowered":21,"options":7,"type":21},{"kind":"lower-import","index":61,"lowered":22,"options":17,"type":22},{"kind":"lower-import","index":62,"lowered":23,"options":15,"type":23},{"kind":"lower-import","index":63,"lowered":24,"options":17,"type":24},{"kind":"lower-import","index":64,"lowered":25,"options":18,"type":25},{"kind":"lower-import","index":65,"lowered":26,"options":16,"type":26},{"kind":"lower-import","index":66,"lowered":27,"options":16,"type":27},{"kind":"lower-import","index":67,"lowered":28,"options":16,"type":27},{"kind":"resource-drop","index":68,"instance":3,"resource":34},{"kind":"resource-drop","index":69,"instance":3,"resource":39},{"kind":"resource-drop","index":70,"instance":3,"resource":35},{"kind":"resource-drop","index":71,"instance":3,"resource":36},{"kind":"subtask-cancel","index":72,"instance":3,"async":false},{"kind":"resource-drop","index":73,"instance":3,"resource":40},{"kind":"subtask-drop","index":74,"instance":3},{"kind":"resource-drop","index":75,"instance":3,"resource":41},{"kind":"resource-drop","index":76,"instance":3,"resource":42},{"kind":"resource-drop","index":77,"instance":3,"resource":43},{"kind":"task-cancel","index":78,"instance":3},{"kind":"resource-drop","index":79,"instance":3,"resource":37},{"kind":"stream-new","index":80,"instance":3,"streamTable":5},{"kind":"lower-import","index":81,"lowered":29,"options":19,"type":28},{"kind":"lower-import","index":82,"lowered":30,"options":20,"type":29},{"kind":"lower-import","index":83,"lowered":31,"options":20,"type":29},{"kind":"lower-import","index":84,"lowered":32,"options":21,"type":30},{"kind":"resource-rep","index":85,"instance":3,"resource":37},{"kind":"lower-import","index":86,"lowered":33,"options":22,"type":31},{"kind":"resource-new","index":87,"instance":3,"resource":38},{"kind":"resource-drop","index":88,"instance":3,"resource":44},{"kind":"resource-drop","index":89,"instance":3,"resource":38},{"kind":"task-return","index":90,"instance":3,"results":0,"resultType":32,"options":23},{"kind":"lower-import","index":91,"lowered":34,"options":24,"type":33},{"kind":"lower-import","index":92,"lowered":35,"options":24,"type":34},{"kind":"lower-import","index":93,"lowered":36,"options":19,"type":35},{"kind":"lower-import","index":94,"lowered":37,"options":20,"type":36},{"kind":"lower-import","index":95,"lowered":38,"options":25,"type":37},{"kind":"resource-drop","index":96,"instance":3,"resource":47},{"kind":"lower-import","index":97,"lowered":39,"options":21,"type":38},{"kind":"resource-drop","index":98,"instance":3,"resource":45},{"kind":"resource-drop","index":99,"instance":3,"resource":46},{"kind":"lower-import","index":100,"lowered":40,"options":21,"type":39},{"kind":"lower-import","index":101,"lowered":41,"options":21,"type":40},{"kind":"stream-drop-readable","index":102,"instance":3,"streamTable":5},{"kind":"resource-new","index":103,"instance":3,"resource":37},{"kind":"resource-new","index":104,"instance":3,"resource":39},{"kind":"lower-import","index":105,"lowered":42,"options":26,"type":41},{"kind":"resource-drop","index":106,"instance":3,"resource":48},{"kind":"resource-new","index":107,"instance":3,"resource":34},{"kind":"resource-new","index":108,"instance":3,"resource":35},{"kind":"resource-new","index":109,"instance":3,"resource":36},{"kind":"waitable-set-drop","index":110,"instance":3},{"kind":"waitable-set-new","index":111,"instance":3},{"kind":"waitable-join","index":112,"instance":3},{"kind":"stream-cancel-write","index":113,"instance":3,"streamTable":7,"async":false},{"kind":"stream-cancel-read","index":114,"instance":3,"streamTable":7,"async":false},{"kind":"stream-drop-writable","index":115,"instance":3,"streamTable":7},{"kind":"stream-drop-readable","index":116,"instance":3,"streamTable":7},{"kind":"stream-new","index":117,"instance":3,"streamTable":7},{"kind":"stream-cancel-write","index":118,"instance":3,"streamTable":6,"async":false},{"kind":"stream-cancel-read","index":119,"instance":3,"streamTable":6,"async":false},{"kind":"stream-drop-writable","index":120,"instance":3,"streamTable":6},{"kind":"stream-drop-readable","index":121,"instance":3,"streamTable":6},{"kind":"stream-new","index":122,"instance":3,"streamTable":6},{"kind":"stream-cancel-write","index":123,"instance":3,"streamTable":8,"async":false},{"kind":"stream-cancel-read","index":124,"instance":3,"streamTable":8,"async":false},{"kind":"stream-drop-writable","index":125,"instance":3,"streamTable":8},{"kind":"stream-drop-readable","index":126,"instance":3,"streamTable":8},{"kind":"stream-new","index":127,"instance":3,"streamTable":8},{"kind":"stream-cancel-write","index":128,"instance":3,"streamTable":5,"async":false},{"kind":"stream-cancel-read","index":129,"instance":3,"streamTable":5,"async":false},{"kind":"stream-drop-writable","index":130,"instance":3,"streamTable":5},{"kind":"resource-drop","index":131,"instance":3,"resource":49},{"kind":"resource-drop","index":132,"instance":3,"resource":50},{"kind":"resource-drop","index":133,"instance":3,"resource":51},{"kind":"resource-drop","index":134,"instance":3,"resource":52},{"kind":"resource-drop","index":135,"instance":3,"resource":53},{"kind":"resource-drop","index":136,"instance":3,"resource":54},{"kind":"lower-import","index":137,"lowered":43,"options":24,"type":3},{"kind":"lower-import","index":138,"lowered":44,"options":24,"type":42},{"kind":"lower-import","index":139,"lowered":45,"options":21,"type":43},{"kind":"lower-import","index":140,"lowered":46,"options":19,"type":44},{"kind":"lower-import","index":141,"lowered":47,"options":19,"type":45},{"kind":"lower-import","index":142,"lowered":48,"options":19,"type":45},{"kind":"lower-import","index":143,"lowered":49,"options":22,"type":31},{"kind":"lower-import","index":144,"lowered":50,"options":27,"type":46},{"kind":"task-return","index":145,"instance":3,"results":156,"resultType":47,"options":28},{"kind":"task-return","index":146,"instance":3,"results":157,"resultType":48,"options":28},{"kind":"task-return","index":147,"instance":3,"results":158,"resultType":49,"options":28},{"kind":"task-return","index":148,"instance":3,"results":159,"resultType":50,"options":28},{"kind":"task-return","index":149,"instance":3,"results":161,"resultType":51,"options":28},{"kind":"task-return","index":150,"instance":3,"results":162,"resultType":52,"options":28},{"kind":"task-return","index":151,"instance":3,"results":163,"resultType":53,"options":28},{"kind":"task-return","index":152,"instance":3,"results":164,"resultType":54,"options":28},{"kind":"waitable-set-poll","index":153,"instance":3,"options":29},{"kind":"waitable-set-wait","index":154,"instance":3,"options":29},{"kind":"lower-import","index":155,"lowered":51,"options":30,"type":55},{"kind":"lower-import","index":156,"lowered":52,"options":31,"type":56},{"kind":"lower-import","index":157,"lowered":53,"options":30,"type":57},{"kind":"lower-import","index":158,"lowered":54,"options":32,"type":58},{"kind":"lower-import","index":159,"lowered":55,"options":33,"type":59},{"kind":"lower-import","index":160,"lowered":56,"options":33,"type":60},{"kind":"lower-import","index":161,"lowered":57,"options":32,"type":61},{"kind":"lower-import","index":162,"lowered":58,"options":30,"type":62},{"kind":"lower-import","index":163,"lowered":59,"options":34,"type":63},{"kind":"stream-write","index":164,"instance":3,"streamTable":5,"options":35},{"kind":"stream-read","index":165,"instance":3,"streamTable":5,"options":35},{"kind":"lower-import","index":166,"lowered":60,"options":32,"type":64},{"kind":"task-return","index":167,"instance":3,"results":174,"resultType":65,"options":28},{"kind":"lower-import","index":168,"lowered":61,"options":33,"type":66},{"kind":"lower-import","index":169,"lowered":62,"options":36,"type":67},{"kind":"lower-import","index":170,"lowered":63,"options":33,"type":68},{"kind":"lower-import","index":171,"lowered":64,"options":32,"type":69},{"kind":"lower-import","index":172,"lowered":65,"options":32,"type":70},{"kind":"lower-import","index":173,"lowered":66,"options":30,"type":71},{"kind":"lower-import","index":174,"lowered":67,"options":37,"type":72},{"kind":"lower-import","index":175,"lowered":68,"options":38,"type":73},{"kind":"lower-import","index":176,"lowered":69,"options":32,"type":74},{"kind":"lower-import","index":177,"lowered":70,"options":30,"type":75},{"kind":"lower-import","index":178,"lowered":71,"options":32,"type":76},{"kind":"lower-import","index":179,"lowered":72,"options":32,"type":77},{"kind":"lower-import","index":180,"lowered":73,"options":30,"type":75},{"kind":"lower-import","index":181,"lowered":74,"options":32,"type":78},{"kind":"lower-import","index":182,"lowered":75,"options":32,"type":74},{"kind":"stream-write","index":183,"instance":3,"streamTable":7,"options":35},{"kind":"stream-read","index":184,"instance":3,"streamTable":7,"options":34},{"kind":"stream-write","index":185,"instance":3,"streamTable":6,"options":35},{"kind":"stream-read","index":186,"instance":3,"streamTable":6,"options":35},{"kind":"stream-write","index":187,"instance":3,"streamTable":8,"options":35},{"kind":"stream-read","index":188,"instance":3,"streamTable":8,"options":35},{"kind":"lower-import","index":189,"lowered":76,"options":39,"type":79},{"kind":"lower-import","index":190,"lowered":77,"options":40,"type":20},{"kind":"lower-import","index":191,"lowered":78,"options":38,"type":80},{"kind":"lower-import","index":192,"lowered":79,"options":41,"type":81},{"kind":"lower-import","index":193,"lowered":80,"options":28,"type":82},{"kind":"lower-import","index":194,"lowered":81,"options":41,"type":83},{"kind":"lower-import","index":195,"lowered":82,"options":42,"type":25},{"kind":"lower-import","index":196,"lowered":83,"options":40,"type":84},{"kind":"lower-import","index":197,"lowered":84,"options":40,"type":85},{"kind":"lower-import","index":198,"lowered":85,"options":40,"type":85},{"kind":"lower-import","index":199,"lowered":86,"options":40,"type":86},{"kind":"resource-drop","index":200,"instance":8,"resource":72},{"kind":"resource-drop","index":201,"instance":8,"resource":78},{"kind":"resource-drop","index":202,"instance":8,"resource":81},{"kind":"resource-drop","index":203,"instance":8,"resource":83},{"kind":"resource-drop","index":204,"instance":8,"resource":85},{"kind":"resource-drop","index":205,"instance":8,"resource":84},{"kind":"resource-drop","index":206,"instance":8,"resource":82},{"kind":"resource-drop","index":207,"instance":8,"resource":79},{"kind":"resource-drop","index":208,"instance":8,"resource":80},{"kind":"resource-drop","index":209,"instance":8,"resource":73},{"kind":"trap","index":210},{"kind":"enter-sync-call","index":211},{"kind":"resource-transfer-borrow","index":212},{"kind":"exit-sync-call","index":213},{"kind":"resource-transfer-own","index":214},{"kind":"resource-drop","index":215,"instance":8,"resource":74},{"kind":"resource-drop","index":216,"instance":8,"resource":75},{"kind":"resource-drop","index":217,"instance":8,"resource":76},{"kind":"subtask-cancel","index":218,"instance":8,"async":false},{"kind":"resource-drop","index":219,"instance":8,"resource":77},{"kind":"stream-new","index":220,"instance":8,"streamTable":9},{"kind":"lower-import","index":221,"lowered":87,"options":43,"type":87},{"kind":"lower-import","index":222,"lowered":88,"options":44,"type":88},{"kind":"lower-import","index":223,"lowered":89,"options":44,"type":88},{"kind":"lower-import","index":224,"lowered":90,"options":44,"type":88},{"kind":"lower-import","index":225,"lowered":91,"options":43,"type":89},{"kind":"lower-import","index":226,"lowered":92,"options":44,"type":90},{"kind":"lower-import","index":227,"lowered":93,"options":44,"type":90},{"kind":"lower-import","index":228,"lowered":94,"options":44,"type":90},{"kind":"lower-import","index":229,"lowered":95,"options":44,"type":90},{"kind":"lower-import","index":230,"lowered":96,"options":44,"type":90},{"kind":"lower-import","index":231,"lowered":97,"options":43,"type":91},{"kind":"lower-import","index":232,"lowered":98,"options":44,"type":92},{"kind":"lower-import","index":233,"lowered":99,"options":44,"type":92},{"kind":"stream-drop-readable","index":234,"instance":8,"streamTable":9},{"kind":"stream-cancel-write","index":235,"instance":8,"streamTable":9,"async":false},{"kind":"stream-cancel-read","index":236,"instance":8,"streamTable":9,"async":false},{"kind":"stream-drop-writable","index":237,"instance":8,"streamTable":9},{"kind":"stream-new","index":238,"instance":8,"streamTable":10},{"kind":"waitable-set-new","index":239,"instance":8},{"kind":"waitable-join","index":240,"instance":8},{"kind":"stream-cancel-read","index":241,"instance":8,"streamTable":10,"async":false},{"kind":"stream-drop-writable","index":242,"instance":8,"streamTable":10},{"kind":"waitable-set-drop","index":243,"instance":8},{"kind":"stream-drop-readable","index":244,"instance":8,"streamTable":10},{"kind":"task-cancel","index":245,"instance":8},{"kind":"subtask-drop","index":246,"instance":8},{"kind":"lower-import","index":247,"lowered":100,"options":45,"type":31},{"kind":"resource-drop","index":248,"instance":8,"resource":86},{"kind":"resource-drop","index":249,"instance":8,"resource":87},{"kind":"resource-drop","index":250,"instance":8,"resource":88},{"kind":"resource-drop","index":251,"instance":8,"resource":89},{"kind":"resource-drop","index":252,"instance":8,"resource":90},{"kind":"resource-drop","index":253,"instance":8,"resource":91},{"kind":"lower-import","index":254,"lowered":101,"options":46,"type":3},{"kind":"lower-import","index":255,"lowered":102,"options":46,"type":93},{"kind":"lower-import","index":256,"lowered":103,"options":47,"type":94},{"kind":"lower-import","index":257,"lowered":104,"options":43,"type":95},{"kind":"lower-import","index":258,"lowered":105,"options":43,"type":96},{"kind":"lower-import","index":259,"lowered":106,"options":43,"type":96},{"kind":"lower-import","index":260,"lowered":107,"options":45,"type":31},{"kind":"lower-import","index":261,"lowered":108,"options":48,"type":97},{"kind":"transcoder","index":262,"op":"utf8-to-utf8","from":2,"from64":false,"to":1,"to64":false},{"kind":"transcoder","index":263,"op":"utf8-to-utf8","from":1,"from64":false,"to":2,"to64":false},{"kind":"async-start-call","index":264,"callback":0,"postReturn":null},{"kind":"prepare-call","index":265,"memory":1},{"kind":"prepare-call","index":266,"memory":1},{"kind":"prepare-call","index":267,"memory":1},{"kind":"transcoder","index":268,"op":"utf8-to-utf8","from":2,"from64":false,"to":0,"to64":false},{"kind":"transcoder","index":269,"op":"utf8-to-utf8","from":0,"from64":false,"to":2,"to64":false},{"kind":"async-start-call","index":270,"callback":1,"postReturn":null},{"kind":"prepare-call","index":271,"memory":0},{"kind":"prepare-call","index":272,"memory":1},{"kind":"lower-import","index":273,"lowered":109,"options":49,"type":98},{"kind":"lower-import","index":274,"lowered":110,"options":50,"type":99},{"kind":"lower-import","index":275,"lowered":111,"options":51,"type":100},{"kind":"lower-import","index":276,"lowered":112,"options":50,"type":101},{"kind":"lower-import","index":277,"lowered":113,"options":50,"type":102},{"kind":"lower-import","index":278,"lowered":114,"options":51,"type":103},{"kind":"stream-write","index":279,"instance":8,"streamTable":9,"options":52},{"kind":"stream-read","index":280,"instance":8,"streamTable":9,"options":52},{"kind":"lower-import","index":281,"lowered":115,"options":51,"type":104},{"kind":"task-return","index":282,"instance":8,"results":268,"resultType":105,"options":53},{"kind":"task-return","index":283,"instance":8,"results":269,"resultType":106,"options":54},{"kind":"task-return","index":284,"instance":8,"results":270,"resultType":107,"options":53},{"kind":"task-return","index":285,"instance":8,"results":271,"resultType":108,"options":55},{"kind":"task-return","index":286,"instance":8,"results":272,"resultType":109,"options":53},{"kind":"task-return","index":287,"instance":8,"results":22,"resultType":110,"options":56},{"kind":"task-return","index":288,"instance":8,"results":273,"resultType":111,"options":53},{"kind":"task-return","index":289,"instance":8,"results":275,"resultType":112,"options":53},{"kind":"task-return","index":290,"instance":8,"results":276,"resultType":113,"options":57},{"kind":"task-return","index":291,"instance":8,"results":277,"resultType":114,"options":53},{"kind":"waitable-set-poll","index":292,"instance":8,"options":58},{"kind":"stream-read","index":293,"instance":8,"streamTable":10,"options":52},{"kind":"stream-write","index":294,"instance":8,"streamTable":10,"options":52},{"kind":"lower-import","index":295,"lowered":116,"options":50,"type":115},{"kind":"lower-import","index":296,"lowered":117,"options":49,"type":116},{"kind":"lower-import","index":297,"lowered":118,"options":49,"type":117},{"kind":"lower-import","index":298,"lowered":119,"options":59,"type":118},{"kind":"lower-import","index":299,"lowered":120,"options":51,"type":119},{"kind":"lower-import","index":300,"lowered":121,"options":60,"type":20},{"kind":"lower-import","index":301,"lowered":122,"options":61,"type":120},{"kind":"lower-import","index":302,"lowered":123,"options":56,"type":121},{"kind":"lower-import","index":303,"lowered":124,"options":57,"type":122},{"kind":"lower-import","index":304,"lowered":125,"options":56,"type":123},{"kind":"lower-import","index":305,"lowered":126,"options":62,"type":25},{"kind":"lower-import","index":306,"lowered":127,"options":60,"type":124},{"kind":"lower-import","index":307,"lowered":128,"options":60,"type":125},{"kind":"lower-import","index":308,"lowered":129,"options":60,"type":125},{"kind":"lower-import","index":309,"lowered":130,"options":60,"type":86},{"kind":"lower-import","index":310,"lowered":131,"options":57,"type":122},{"kind":"lower-import","index":311,"lowered":132,"options":63,"type":126}],"canonicalOptions":[{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i64"]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":3,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i64"]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i64","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i64","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":3,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}}],"types":[{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":27}}],"results":[{"kind":"own","resource":27}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":24}}],"results":[{"kind":"u16"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":24}}],"results":[{"kind":"own","resource":25}],"async":false},{"kind":"func","params":[{"label":"status","type":{"kind":"result","ok":null,"err":null}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":29}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}}],"results":[{"kind":"own","resource":29}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":30}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":31}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":29}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":26}},{"label":"scheme","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"HTTP","type":null},{"label":"HTTPS","type":null},{"label":"other","type":{"kind":"string"}}]}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":26}},{"label":"authority","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"this","type":{"kind":"own","resource":24}},{"label":"res","type":{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}}],"results":[{"kind":"tuple","elements":[{"kind":"stream","element":{"kind":"u8"}},{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":25}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"entries","type":{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":25},"err":{"kind":"variant","cases":[{"label":"invalid-syntax","type":null},{"label":"forbidden","type":null},{"label":"immutable","type":null},{"label":"size-exceeded","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":25}},{"label":"name","type":{"kind":"string"}}],"results":[{"kind":"list","element":{"kind":"list","element":{"kind":"u8"}}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":25}}],"results":[{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}],"async":false},{"kind":"func","params":[{"label":"headers","type":{"kind":"own","resource":25}},{"label":"contents","type":{"kind":"option","type":{"kind":"stream","element":{"kind":"u8"}}}},{"label":"trailers","type":{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":25}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}},{"label":"options","type":{"kind":"option","type":{"kind":"own","resource":27}}}],"results":[{"kind":"tuple","elements":[{"kind":"own","resource":26},{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":26}},{"label":"method","type":{"kind":"variant","cases":[{"label":"get","type":null},{"label":"head","type":null},{"label":"post","type":null},{"label":"put","type":null},{"label":"delete","type":null},{"label":"connect","type":null},{"label":"options","type":null},{"label":"trace","type":null},{"label":"patch","type":null},{"label":"other","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":26}},{"label":"path-with-query","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"status","type":{"kind":"u16"}},{"label":"body","type":{"kind":"list","element":{"kind":"u8"}}}]},"err":{"kind":"string"}}]},{"kind":"func","params":[{"label":"request","type":{"kind":"own","resource":26}}],"results":[{"kind":"result","ok":{"kind":"own","resource":24},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"tuple","elements":[{"kind":"u64"},{"kind":"u64"}]}],"async":false},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":29}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":28}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":28}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":28}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"string"}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":32}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":33}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":43}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":43}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":41}}],"results":[{"kind":"bool"}],"async":false},{"kind":"func","params":[],"results":[{"kind":"u64"}],"async":false},{"kind":"tuple","elements":[]},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":45}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":47}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":47}},{"label":"ordered","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":47}},{"label":"max-retransmits","type":{"kind":"option","type":{"kind":"u16"}}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":45}}],"results":[{"kind":"stream","element":{"kind":"enum","labels":["connecting","open","closing","closed"]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}}],"results":[{"kind":"stream","element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}}],"results":[{"kind":"stream","element":{"kind":"own","resource":45}}],"async":false},{"kind":"func","params":[{"label":"config","type":{"kind":"option","type":{"kind":"own","resource":48}}}],"results":[{"kind":"own","resource":46}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":50}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":52}}],"results":[{"kind":"own","resource":50}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":51}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":52}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":50}],"async":false},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":38},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":34},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"option","type":{"kind":"list","element":{"kind":"u8"}}},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":35},{"kind":"own","resource":36}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":35},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":36},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"func","params":[{"label":"url","type":{"kind":"string"}},{"label":"protocols","type":{"kind":"list","element":{"kind":"string"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":40},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":40}},{"label":"code","type":{"kind":"option","type":{"kind":"u16"}}},{"label":"reason","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":40}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":40}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":41}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}},{"label":"sig","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":41}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"options","type":{"kind":"own","resource":43}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":41},{"kind":"own","resource":42}]},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":39},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"func","params":[{"label":"address-family","type":{"kind":"enum","labels":["ipv4","ipv6"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":44},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":44}},{"label":"local-address","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":44}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":44}},{"label":"data","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"remote-address","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":44}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"list","element":{"kind":"u8"}},{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":45}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":47}},{"label":"label","type":{"kind":"string"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}},{"label":"options","type":{"kind":"own","resource":47}}],"results":[{"kind":"result","ok":{"kind":"own","resource":45},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}}],"results":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}},{"label":"description","type":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}},{"label":"candidate","type":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":46}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":45}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"how-long","type":{"kind":"u64"}}],"results":[],"async":true},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":50}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":52}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":49}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":52}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":49}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":52}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":49}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":53}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":54}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"record","fields":[{"label":"seconds","type":{"kind":"u64"}},{"label":"nanoseconds","type":{"kind":"u32"}}]}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":83}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":83}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":81}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":81}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":78}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":78}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":87}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}}],"results":[{"kind":"own","resource":87}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":88}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":89}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":87}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":79}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}},{"label":"sig","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":79}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":80}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":82}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"plaintext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":82}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"ciphertext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":84}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":85}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"revision","type":{"kind":"u64"}},{"label":"items","type":{"kind":"list","element":{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]}}}]},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":null,"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"string"}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"u32"},{"kind":"u32"}]},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"bool"},"err":{"kind":"string"}}]},{"kind":"func","params":[{"label":"options","type":{"kind":"own","resource":78}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":80},{"kind":"own","resource":79}]},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":83}}],"results":[{"kind":"result","ok":{"kind":"own","resource":84},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["aes128","aes192","aes256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":81}}],"results":[{"kind":"result","ok":{"kind":"own","resource":82},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":85},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":false},{"kind":"func","params":[{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":79},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":87}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":86}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":86}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":86}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":90}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":91}}],"async":false},{"kind":"func","params":[{"label":"len","type":{"kind":"u64"}}],"results":[{"kind":"list","element":{"kind":"u8"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":17}}],"results":[{"kind":"own","resource":17}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":14}}],"results":[{"kind":"u16"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":14}}],"results":[{"kind":"own","resource":15}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":8}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}}],"results":[{"kind":"own","resource":8}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":10}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":11}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":8}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"scheme","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"HTTP","type":null},{"label":"HTTPS","type":null},{"label":"other","type":{"kind":"string"}}]}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"authority","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"this","type":{"kind":"own","resource":14}},{"label":"res","type":{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}}],"results":[{"kind":"tuple","elements":[{"kind":"stream","element":{"kind":"u8"}},{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":15}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"entries","type":{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":15},"err":{"kind":"variant","cases":[{"label":"invalid-syntax","type":null},{"label":"forbidden","type":null},{"label":"immutable","type":null},{"label":"size-exceeded","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}},{"label":"name","type":{"kind":"string"}}],"results":[{"kind":"list","element":{"kind":"list","element":{"kind":"u8"}}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}}],"results":[{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}],"async":false},{"kind":"func","params":[{"label":"headers","type":{"kind":"own","resource":15}},{"label":"contents","type":{"kind":"option","type":{"kind":"stream","element":{"kind":"u8"}}}},{"label":"trailers","type":{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":15}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}},{"label":"options","type":{"kind":"option","type":{"kind":"own","resource":17}}}],"results":[{"kind":"tuple","elements":[{"kind":"own","resource":16},{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"method","type":{"kind":"variant","cases":[{"label":"get","type":null},{"label":"head","type":null},{"label":"post","type":null},{"label":"put","type":null},{"label":"delete","type":null},{"label":"connect","type":null},{"label":"options","type":null},{"label":"trace","type":null},{"label":"patch","type":null},{"label":"other","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"path-with-query","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"request","type":{"kind":"own","resource":16}}],"results":[{"kind":"result","ok":{"kind":"own","resource":14},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":8}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":9}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":9}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":9}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":12}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":13}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":5}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":5}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":7}}],"results":[{"kind":"bool"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":20}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":20}},{"label":"ordered","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":20}},{"label":"max-retransmits","type":{"kind":"option","type":{"kind":"u16"}}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}}],"results":[{"kind":"stream","element":{"kind":"enum","labels":["connecting","open","closing","closed"]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[{"kind":"stream","element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[{"kind":"stream","element":{"kind":"own","resource":18}}],"async":false},{"kind":"func","params":[{"label":"config","type":{"kind":"option","type":{"kind":"own","resource":21}}}],"results":[{"kind":"own","resource":19}],"async":false},{"kind":"func","params":[{"label":"url","type":{"kind":"string"}},{"label":"protocols","type":{"kind":"list","element":{"kind":"string"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":22},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}},{"label":"code","type":{"kind":"option","type":{"kind":"u16"}}},{"label":"reason","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":7}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":6}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":6}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":6}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}},{"label":"sig","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":7}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"options","type":{"kind":"own","resource":5}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":7},{"kind":"own","resource":6}]},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"address-family","type":{"kind":"enum","labels":["ipv4","ipv6"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":23},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":23}},{"label":"local-address","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":23}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":23}},{"label":"data","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"remote-address","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":23}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"list","element":{"kind":"u8"}},{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":20}},{"label":"label","type":{"kind":"string"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}},{"label":"options","type":{"kind":"own","resource":20}}],"results":[{"kind":"result","ok":{"kind":"own","resource":18},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}},{"label":"description","type":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}},{"label":"candidate","type":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"own","resource":2}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":2}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":0}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":0}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":3}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"plaintext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":3}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"ciphertext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":1}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":4}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":0}}],"results":[{"kind":"result","ok":{"kind":"own","resource":1},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["aes128","aes192","aes256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":2}}],"results":[{"kind":"result","ok":{"kind":"own","resource":3},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":4},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":false},{"kind":"func","params":[{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":6},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"record","fields":[{"label":"endpoint","type":{"kind":"string"}},{"label":"bucket","type":{"kind":"string"}},{"label":"access-key","type":{"kind":"string"}},{"label":"secret-key","type":{"kind":"string"}}]},{"kind":"record","fields":[{"label":"app-key","type":{"kind":"string"}},{"label":"app-secret","type":{"kind":"string"}},{"label":"access-token","type":{"kind":"string"}},{"label":"refresh-token","type":{"kind":"string"}},{"label":"root","type":{"kind":"string"}}]},{"kind":"variant","cases":[{"label":"s3","type":{"kind":"record","fields":[{"label":"endpoint","type":{"kind":"string"}},{"label":"bucket","type":{"kind":"string"}},{"label":"access-key","type":{"kind":"string"}},{"label":"secret-key","type":{"kind":"string"}}]}},{"label":"dropbox","type":{"kind":"record","fields":[{"label":"app-key","type":{"kind":"string"}},{"label":"app-secret","type":{"kind":"string"}},{"label":"access-token","type":{"kind":"string"}},{"label":"refresh-token","type":{"kind":"string"}},{"label":"root","type":{"kind":"string"}}]}}]},{"kind":"func","params":[{"label":"exportable-identity","type":{"kind":"bool"}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"bool"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"group-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"level","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"group-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"card","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"level","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"card","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"config","type":{"kind":"variant","cases":[{"label":"s3","type":{"kind":"record","fields":[{"label":"endpoint","type":{"kind":"string"}},{"label":"bucket","type":{"kind":"string"}},{"label":"access-key","type":{"kind":"string"}},{"label":"secret-key","type":{"kind":"string"}}]}},{"label":"dropbox","type":{"kind":"record","fields":[{"label":"app-key","type":{"kind":"string"}},{"label":"app-secret","type":{"kind":"string"}},{"label":"access-token","type":{"kind":"string"}},{"label":"refresh-token","type":{"kind":"string"}},{"label":"root","type":{"kind":"string"}}]}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"owner-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"pickup","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"label","type":{"kind":"string"}},{"label":"passphrase","type":{"kind":"option","type":{"kind":"string"}}},{"label":"secret-slot","type":{"kind":"option","type":{"kind":"list","element":{"kind":"u8"}}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"bundle","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"passphrase","type":{"kind":"option","type":{"kind":"string"}}},{"label":"secret","type":{"kind":"option","type":{"kind":"list","element":{"kind":"u8"}}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"relay-url","type":{"kind":"string"}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"initiator","type":{"kind":"bool"}},{"label":"peer-endpoint-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"relay-url","type":{"kind":"string"}},{"label":"expected-peer","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"conn","type":{"kind":"u32"}}],"results":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"peer","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tree","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"subscribe","type":{"kind":"bool"}}],"results":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"handle","type":{"kind":"u32"}}],"results":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"u32"},{"kind":"u32"}]},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"string"}],"async":true},{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]},{"kind":"record","fields":[{"label":"revision","type":{"kind":"u64"}},{"label":"items","type":{"kind":"list","element":{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]}}}]},{"kind":"func","params":[],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"revision","type":{"kind":"u64"}},{"label":"items","type":{"kind":"list","element":{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]}}}]},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"title","type":{"kind":"string"}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true}],"resourceTables":[{"kind":"concrete","resource":0,"instance":0},{"kind":"concrete","resource":1,"instance":0},{"kind":"concrete","resource":2,"instance":0},{"kind":"concrete","resource":3,"instance":0},{"kind":"concrete","resource":4,"instance":0},{"kind":"concrete","resource":5,"instance":0},{"kind":"concrete","resource":6,"instance":0},{"kind":"concrete","resource":7,"instance":0},{"kind":"concrete","resource":8,"instance":0},{"kind":"concrete","resource":9,"instance":0},{"kind":"concrete","resource":10,"instance":0},{"kind":"concrete","resource":11,"instance":0},{"kind":"concrete","resource":12,"instance":0},{"kind":"concrete","resource":13,"instance":0},{"kind":"concrete","resource":14,"instance":0},{"kind":"concrete","resource":15,"instance":0},{"kind":"concrete","resource":16,"instance":0},{"kind":"concrete","resource":17,"instance":0},{"kind":"concrete","resource":18,"instance":0},{"kind":"concrete","resource":19,"instance":0},{"kind":"concrete","resource":20,"instance":0},{"kind":"concrete","resource":21,"instance":0},{"kind":"concrete","resource":22,"instance":0},{"kind":"concrete","resource":23,"instance":0},{"kind":"concrete","resource":14,"instance":1},{"kind":"concrete","resource":15,"instance":1},{"kind":"concrete","resource":16,"instance":1},{"kind":"concrete","resource":17,"instance":1},{"kind":"concrete","resource":9,"instance":1},{"kind":"concrete","resource":8,"instance":1},{"kind":"concrete","resource":10,"instance":1},{"kind":"concrete","resource":11,"instance":1},{"kind":"concrete","resource":12,"instance":1},{"kind":"concrete","resource":13,"instance":1},{"kind":"concrete","resource":27,"instance":3},{"kind":"concrete","resource":28,"instance":3},{"kind":"concrete","resource":29,"instance":3},{"kind":"concrete","resource":25,"instance":3},{"kind":"concrete","resource":26,"instance":3},{"kind":"concrete","resource":24,"instance":3},{"kind":"concrete","resource":22,"instance":3},{"kind":"concrete","resource":7,"instance":3},{"kind":"concrete","resource":6,"instance":3},{"kind":"concrete","resource":5,"instance":3},{"kind":"concrete","resource":23,"instance":3},{"kind":"concrete","resource":18,"instance":3},{"kind":"concrete","resource":19,"instance":3},{"kind":"concrete","resource":20,"instance":3},{"kind":"concrete","resource":21,"instance":3},{"kind":"concrete","resource":9,"instance":3},{"kind":"concrete","resource":8,"instance":3},{"kind":"concrete","resource":10,"instance":3},{"kind":"concrete","resource":11,"instance":3},{"kind":"concrete","resource":12,"instance":3},{"kind":"concrete","resource":13,"instance":3},{"kind":"concrete","resource":24,"instance":4},{"kind":"concrete","resource":24,"instance":5},{"kind":"concrete","resource":24,"instance":6},{"kind":"concrete","resource":7,"instance":6},{"kind":"concrete","resource":6,"instance":6},{"kind":"concrete","resource":24,"instance":7},{"kind":"concrete","resource":25,"instance":7},{"kind":"concrete","resource":26,"instance":7},{"kind":"concrete","resource":27,"instance":7},{"kind":"concrete","resource":28,"instance":7},{"kind":"concrete","resource":29,"instance":7},{"kind":"concrete","resource":24,"instance":0},{"kind":"concrete","resource":25,"instance":0},{"kind":"concrete","resource":26,"instance":0},{"kind":"concrete","resource":27,"instance":0},{"kind":"concrete","resource":28,"instance":0},{"kind":"concrete","resource":29,"instance":0},{"kind":"concrete","resource":25,"instance":8},{"kind":"concrete","resource":24,"instance":8},{"kind":"concrete","resource":28,"instance":8},{"kind":"concrete","resource":29,"instance":8},{"kind":"concrete","resource":27,"instance":8},{"kind":"concrete","resource":26,"instance":8},{"kind":"concrete","resource":5,"instance":8},{"kind":"concrete","resource":6,"instance":8},{"kind":"concrete","resource":7,"instance":8},{"kind":"concrete","resource":2,"instance":8},{"kind":"concrete","resource":3,"instance":8},{"kind":"concrete","resource":0,"instance":8},{"kind":"concrete","resource":1,"instance":8},{"kind":"concrete","resource":4,"instance":8},{"kind":"concrete","resource":9,"instance":8},{"kind":"concrete","resource":8,"instance":8},{"kind":"concrete","resource":10,"instance":8},{"kind":"concrete","resource":11,"instance":8},{"kind":"concrete","resource":12,"instance":8},{"kind":"concrete","resource":13,"instance":8}],"streamTables":[{"element":{"kind":"u8"},"instance":0},{"element":{"kind":"enum","labels":["connecting","open","closing","closed"]},"instance":0},{"element":{"kind":"own","resource":18},"instance":0},{"element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]},"instance":0},{"element":{"kind":"u8"},"instance":1},{"element":{"kind":"u8"},"instance":3},{"element":{"kind":"enum","labels":["connecting","open","closing","closed"]},"instance":3},{"element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]},"instance":3},{"element":{"kind":"own","resource":45},"instance":3},{"element":{"kind":"u8"},"instance":8},{"element":null,"instance":8}],"futureTables":[{"element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":15}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":0},{"element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":0},{"element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":1},{"element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":25}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":1}],"errorContextTables":[],"importedResources":[{"import":0},{"import":1},{"import":2},{"import":3},{"import":4},{"import":5},{"import":6},{"import":7},{"import":8},{"import":9},{"import":10},{"import":11},{"import":12},{"import":13},{"import":14},{"import":15},{"import":16},{"import":17},{"import":18},{"import":19},{"import":20},{"import":21},{"import":22},{"import":23}],"imports":[{"name":"polymorph:webcrypto/mac@0.1.0","path":["mac-key-options"],"kind":"resource"},{"name":"polymorph:webcrypto/mac@0.1.0","path":["mac-key"],"kind":"resource"},{"name":"polymorph:webcrypto/aead@0.1.0","path":["aead-key-options"],"kind":"resource"},{"name":"polymorph:webcrypto/aead@0.1.0","path":["aead-key"],"kind":"resource"},{"name":"polymorph:webcrypto/digest@0.1.0","path":["digest"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["signing-key-options"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["verifying-key"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["signing-key"],"kind":"resource"},{"name":"wasi:io/poll@0.2.9","path":["pollable"],"kind":"resource"},{"name":"wasi:io/error@0.2.9","path":["error"],"kind":"resource"},{"name":"wasi:io/streams@0.2.9","path":["input-stream"],"kind":"resource"},{"name":"wasi:io/streams@0.2.9","path":["output-stream"],"kind":"resource"},{"name":"wasi:cli/terminal-input@0.2.9","path":["terminal-input"],"kind":"resource"},{"name":"wasi:cli/terminal-output@0.2.9","path":["terminal-output"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["response"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["fields"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["request"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["request-options"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["data-channel"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["peer-connection"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["data-channel-options"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["peer-connection-config"],"kind":"resource"},{"name":"polymorph:websocket/connections@0.1.0","path":["websocket"],"kind":"resource"},{"name":"wasi:sockets/types@0.3.0","path":["udp-socket"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["[method]request-options.clone"],"kind":"func","type":127},{"name":"wasi:http/types@0.3.0","path":["[method]response.get-status-code"],"kind":"func","type":128},{"name":"wasi:http/types@0.3.0","path":["[method]response.get-headers"],"kind":"func","type":129},{"name":"wasi:io/poll@0.2.9","path":["[method]pollable.block"],"kind":"func","type":130},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.subscribe"],"kind":"func","type":131},{"name":"wasi:cli/exit@0.2.9","path":["exit"],"kind":"func","type":3},{"name":"wasi:cli/stdin@0.2.9","path":["get-stdin"],"kind":"func","type":132},{"name":"wasi:cli/stdout@0.2.9","path":["get-stdout"],"kind":"func","type":133},{"name":"wasi:cli/stderr@0.2.9","path":["get-stderr"],"kind":"func","type":133},{"name":"wasi:clocks/monotonic-clock@0.2.9","path":["subscribe-duration"],"kind":"func","type":134},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-scheme"],"kind":"func","type":135},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-authority"],"kind":"func","type":136},{"name":"wasi:http/types@0.3.0","path":["[static]response.consume-body"],"kind":"func","type":137},{"name":"wasi:http/types@0.3.0","path":["[static]fields.from-list"],"kind":"func","type":138},{"name":"wasi:http/types@0.3.0","path":["[method]fields.get"],"kind":"func","type":139},{"name":"wasi:http/types@0.3.0","path":["[method]fields.copy-all"],"kind":"func","type":140},{"name":"wasi:http/types@0.3.0","path":["[static]request.new"],"kind":"func","type":141},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-method"],"kind":"func","type":142},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-path-with-query"],"kind":"func","type":143},{"name":"wasi:http/client@0.3.0","path":["send"],"kind":"func","type":144},{"name":"wasi:random/insecure-seed@0.2.9","path":["insecure-seed"],"kind":"func","type":20},{"name":"wasi:io/poll@0.2.9","path":["poll"],"kind":"func","type":145},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.check-write"],"kind":"func","type":146},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.write"],"kind":"func","type":147},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.blocking-flush"],"kind":"func","type":148},{"name":"wasi:cli/environment@0.2.9","path":["get-environment"],"kind":"func","type":25},{"name":"wasi:cli/terminal-stdin@0.2.9","path":["get-terminal-stdin"],"kind":"func","type":149},{"name":"wasi:cli/terminal-stdout@0.2.9","path":["get-terminal-stdout"],"kind":"func","type":150},{"name":"wasi:cli/terminal-stderr@0.2.9","path":["get-terminal-stderr"],"kind":"func","type":150},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[constructor]signing-key-options"],"kind":"func","type":151},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key-options.can-sign"],"kind":"func","type":152},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key-options.extractable"],"kind":"func","type":152},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key.can-sign"],"kind":"func","type":153},{"name":"wasi:random/random@0.2.9","path":["get-random-u64"],"kind":"func","type":31},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.close"],"kind":"func","type":154},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.close"],"kind":"func","type":155},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[constructor]data-channel-options"],"kind":"func","type":156},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel-options.set-ordered"],"kind":"func","type":157},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel-options.set-max-retransmits"],"kind":"func","type":158},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.state-changes"],"kind":"func","type":159},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.local-ice-candidates"],"kind":"func","type":160},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.incoming-data-channels"],"kind":"func","type":161},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[constructor]peer-connection"],"kind":"func","type":162},{"name":"wasi:clocks/monotonic-clock@0.2.9","path":["now"],"kind":"func","type":31},{"name":"polymorph:websocket/connections@0.1.0","path":["[static]websocket.connect"],"kind":"func","type":163},{"name":"polymorph:websocket/connections@0.1.0","path":["[method]websocket.close"],"kind":"func","type":164},{"name":"polymorph:websocket/connections@0.1.0","path":["[method]websocket.send"],"kind":"func","type":165},{"name":"polymorph:websocket/connections@0.1.0","path":["[method]websocket.receive"],"kind":"func","type":166},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key.algorithm-name"],"kind":"func","type":167},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]verifying-key.algorithm-name"],"kind":"func","type":168},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]verifying-key.export-key-raw"],"kind":"func","type":169},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]verifying-key.verify"],"kind":"func","type":170},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key.sign"],"kind":"func","type":171},{"name":"polymorph:webcrypto/ed25519-sign@0.1.0","path":["generate-key"],"kind":"func","type":172},{"name":"wasi:sockets/types@0.3.0","path":["[static]udp-socket.create"],"kind":"func","type":173},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.bind"],"kind":"func","type":174},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.get-local-address"],"kind":"func","type":175},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.send"],"kind":"func","type":176},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.receive"],"kind":"func","type":177},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.send"],"kind":"func","type":178},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel-options.set-label"],"kind":"func","type":179},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.create-data-channel"],"kind":"func","type":180},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.create-offer"],"kind":"func","type":181},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.set-local-description"],"kind":"func","type":182},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.add-ice-candidate"],"kind":"func","type":183},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.wait-connected"],"kind":"func","type":184},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.set-remote-description"],"kind":"func","type":182},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.receive"],"kind":"func","type":185},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.create-answer"],"kind":"func","type":181},{"name":"wasi:clocks/monotonic-clock@0.3.0","path":["wait-for"],"kind":"func","type":79},{"name":"wasi:clocks/wall-clock@0.2.9","path":["now"],"kind":"func","type":86},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[constructor]aead-key-options"],"kind":"func","type":186},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-seal"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-open"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-wrap"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-unwrap"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.extractable"],"kind":"func","type":187},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[constructor]mac-key-options"],"kind":"func","type":188},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key-options.can-sign"],"kind":"func","type":189},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key-options.can-verify"],"kind":"func","type":189},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key-options.extractable"],"kind":"func","type":189},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key.seal"],"kind":"func","type":190},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key.open"],"kind":"func","type":191},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key.sign"],"kind":"func","type":192},{"name":"polymorph:webcrypto/digest@0.1.0","path":["[method]digest.compute"],"kind":"func","type":193},{"name":"polymorph:webcrypto/hmac-sha2@0.1.0","path":["import-key-raw"],"kind":"func","type":194},{"name":"polymorph:webcrypto/aes-gcm@0.1.0","path":["import-key-raw"],"kind":"func","type":195},{"name":"polymorph:webcrypto/sha2@0.1.0","path":["make-digest"],"kind":"func","type":196},{"name":"polymorph:webcrypto/ed25519-verify@0.1.0","path":["import-verifying-key-raw"],"kind":"func","type":197},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.blocking-write-and-flush"],"kind":"func","type":147},{"name":"wasi:random/random@0.2.9","path":["get-random-bytes"],"kind":"func","type":126}],"exports":[{"kind":"instance","name":"polymorph:engine-spike/driver@0.1.0","exports":[{"kind":"type","name":"s3-config","type":{"kind":"value","type":198}},{"kind":"type","name":"dropbox-config","type":{"kind":"value","type":199}},{"kind":"type","name":"store-config","type":{"kind":"value","type":200}},{"kind":"lifted-func","name":"init","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#init","space":"func"}},"options":64,"type":201},{"kind":"lifted-func","name":"kh-knows-agent","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-knows-agent","space":"func"}},"options":65,"type":202},{"kind":"lifted-func","name":"kh-create-group","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-create-group","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"kh-add-to-group","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-add-to-group","space":"func"}},"options":67,"type":204},{"kind":"lifted-func","name":"kh-revoke-from-group","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-revoke-from-group","space":"func"}},"options":68,"type":205},{"kind":"lifted-func","name":"kh-export-card","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-export-card","space":"func"}},"options":65,"type":206},{"kind":"lifted-func","name":"kh-ingest-card","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-ingest-card","space":"func"}},"options":65,"type":207},{"kind":"lifted-func","name":"kh-add-member","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-add-member","space":"func"}},"options":67,"type":208},{"kind":"lifted-func","name":"kh-revoke-member","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-revoke-member","space":"func"}},"options":68,"type":209},{"kind":"lifted-func","name":"kh-contact-card","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-contact-card","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"kh-ingest-contact","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-ingest-contact","space":"func"}},"options":65,"type":210},{"kind":"lifted-func","name":"init-store","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#init-store","space":"func"}},"options":69,"type":211},{"kind":"lifted-func","name":"ensure-bucket","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#ensure-bucket","space":"func"}},"options":66,"type":212},{"kind":"lifted-func","name":"store-grant","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#store-grant","space":"func"}},"options":68,"type":213},{"kind":"lifted-func","name":"store-revoke","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#store-revoke","space":"func"}},"options":68,"type":214},{"kind":"lifted-func","name":"bucket-flush","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#bucket-flush","space":"func"}},"options":65,"type":215},{"kind":"lifted-func","name":"bucket-pull","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#bucket-pull","space":"func"}},"options":70,"type":216},{"kind":"lifted-func","name":"identity-export","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#identity-export","space":"func"}},"options":71,"type":217},{"kind":"lifted-func","name":"identity-import","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#identity-import","space":"func"}},"options":71,"type":218},{"kind":"lifted-func","name":"iroh-bind","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#iroh-bind","space":"func"}},"options":65,"type":219},{"kind":"lifted-func","name":"iroh-start","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#iroh-start","space":"func"}},"options":70,"type":220},{"kind":"lifted-func","name":"conn-status","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#conn-status","space":"func"}},"options":64,"type":221},{"kind":"lifted-func","name":"sync-start","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#sync-start","space":"func"}},"options":72,"type":222},{"kind":"lifted-func","name":"sync-status","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#sync-status","space":"func"}},"options":64,"type":223},{"kind":"lifted-func","name":"create-partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#create-partition","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"seal-partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#seal-partition","space":"func"}},"options":65,"type":224},{"kind":"lifted-func","name":"adopt-partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#adopt-partition","space":"func"}},"options":65,"type":224},{"kind":"lifted-func","name":"chunk-stats","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#chunk-stats","space":"func"}},"options":65,"type":225},{"kind":"lifted-func","name":"stats","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#stats","space":"func"}},"options":66,"type":226}]},{"kind":"instance","name":"polymorph-data:tasks/tasks@0.1.0","exports":[{"kind":"type","name":"todo-item","type":{"kind":"value","type":227}},{"kind":"type","name":"snapshot","type":{"kind":"value","type":228}},{"kind":"lifted-func","name":"partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#partition","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"revision","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#revision","space":"func"}},"options":66,"type":229},{"kind":"lifted-func","name":"items","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#items","space":"func"}},"options":66,"type":230},{"kind":"lifted-func","name":"add","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#add","space":"func"}},"options":65,"type":231},{"kind":"lifted-func","name":"set-completed","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#set-completed","space":"func"}},"options":73,"type":232},{"kind":"lifted-func","name":"set-title","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#set-title","space":"func"}},"options":68,"type":233},{"kind":"lifted-func","name":"remove","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#remove","space":"func"}},"options":65,"type":234}]}],"worldDigest":"sha256:e6a525a7aab67eb1902fd41084b4ac65b2856f9cb0974b04519e6df253c5a8d1"},"adapters":[{"file":"adapters/10.wasm","wasm":"AGFzbQEAAAABGgVgAX8Bf2ABfwBgA39/fwBgA39/fwF/YAAAAsUBCQVmbGFncwlpbnN0YW5jZTMDfwEFZmxhZ3MJaW5zdGFuY2U4A38BBmNhbGxlZQhhZGFwdGVyMAAAB3J1bnRpbWUEdHJhcAABCGluc3RhbmNlDnRhc2tfbWF5X2Jsb2NrA38BBWFzeW5jD2VudGVyLXN5bmMtY2FsbAACCHJlc291cmNlD3RyYW5zZmVyLWJvcnJvdwADBWFzeW5jDmV4aXQtc3luYy1jYWxsAAQIcmVzb3VyY2UMdHJhbnNmZXItb3duAAMDAgEABwwBCGFkYXB0ZXIwAAYKZwFlAQN/An8CQB9/AQIAAkAjASIBDQBBFxABAAsjAiECQQAkAkEIQQBBAxACIwAhA0EAJAAgAEHJAEEnEAMgAyQAEAAhAxAEQQAkASADQSVByAAQBSABJAEgAiQCCwwBC0ExEAEACws="},{"file":"adapters/11.wasm","wasm":"AGFzbQEAAAABtQEVYAR/f39/AX9gA39/fwBgAX8AYAN/f38Bf2AAAGABfwF/YAJ/fwBgAn9/AX9gAn9/An9/YAV/f39/fwBgBHB/f38Bf2ALcHB/f39/f39/f38AYApwcH9/f39/f39/AGAHf39/f39/fwF/YAF/B39/f39/f39gA39/fwN/f39gDHBwf39/f39/f39/fwBgCH9/f39/f39/AX9gAX8If39/f39/f39gAAF/YAlwcH9/f39/f38AArwILwVmbGFncwlpbnN0YW5jZTMDfwEGbWVtb3J5Am0wAgAAB3JlYWxsb2MCZjAAAAVmbGFncwlpbnN0YW5jZTgDfwEGbWVtb3J5Am0xAgAABmNhbGxlZQhhZGFwdGVyMQABB3J1bnRpbWUEdHJhcAACCGluc3RhbmNlDnRhc2tfbWF5X2Jsb2NrA38BBWFzeW5jD2VudGVyLXN5bmMtY2FsbAABCHJlc291cmNlD3RyYW5zZmVyLWJvcnJvdwADBWFzeW5jDmV4aXQtc3luYy1jYWxsAAQGY2FsbGVlCGFkYXB0ZXIyAAEJdHJhbnNjb2RlG3V0ZjgtdG8tdXRmOCAobWVtMSA9PiBtZW0wKQABB3JlYWxsb2MCZjgAAAZjYWxsZWUIYWRhcHRlcjMABQtwb3N0X3JldHVybghhZGFwdGVyMwACBmNhbGxlZQhhZGFwdGVyNAAFC3Bvc3RfcmV0dXJuCGFkYXB0ZXI0AAIJdHJhbnNjb2RlG3V0ZjgtdG8tdXRmOCAobWVtMCA9PiBtZW0xKQABCGNhbGxiYWNrA2YxNAADBmNhbGxlZQhhZGFwdGVyNQAHBWFzeW5jFFtzdGFydC1jYWxsXWFkYXB0ZXI1AAoEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI1AAsGY2FsbGVlCGFkYXB0ZXI2AAUIcmVzb3VyY2UMdHJhbnNmZXItb3duAAMEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI2AAwGY2FsbGVlCGFkYXB0ZXI3AA0Ec3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI3AAwGY2FsbGVlCGFkYXB0ZXI4AAUEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI4AAwGY2FsbGVlCGFkYXB0ZXI5AAUEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI5AAwGY2FsbGVlCWFkYXB0ZXIxMAAFBHN5bmMXW3ByZXBhcmUtY2FsbF1hZGFwdGVyMTAADAZjYWxsZWUJYWRhcHRlcjExAAMEc3luYxdbcHJlcGFyZS1jYWxsXWFkYXB0ZXIxMQAQBWZsYWdzCWluc3RhbmNlMQN/AQZtZW1vcnkCbTICAAAHcmVhbGxvYwNmMzEAAAhjYWxsYmFjawNmMzIAAwZjYWxsZWUJYWRhcHRlcjEyABEJdHJhbnNjb2RlG3V0ZjgtdG8tdXRmOCAobWVtMSA9PiBtZW0yKQABCXRyYW5zY29kZRt1dGY4LXRvLXV0ZjggKG1lbTIgPT4gbWVtMSkAAQVhc3luYxVbc3RhcnQtY2FsbF1hZGFwdGVyMTIACgRzeW5jF1twcmVwYXJlLWNhbGxdYWRhcHRlcjEyAAwGY2FsbGVlCWFkYXB0ZXIxMwATBHN5bmMXW3ByZXBhcmUtY2FsbF1hZGFwdGVyMTMAFAMgHwEBBgYICQMFCQcOCQcFCQcFCQcFCQcPCQASCQcECQUHzAYoCGFkYXB0ZXIxACgIYWRhcHRlcjIAKQhhZGFwdGVyMwAqCGFkYXB0ZXI0ACsVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI1ACwWW2FzeW5jLXJldHVybl1hZGFwdGVyNQAtCGFkYXB0ZXI1AC4VW2FzeW5jLXN0YXJ0XWFkYXB0ZXI2AC8WW2FzeW5jLXJldHVybl1hZGFwdGVyNgAwCGFkYXB0ZXI2ADEVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI3ADIWW2FzeW5jLXJldHVybl1hZGFwdGVyNwAzCGFkYXB0ZXI3ADQVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI4ADUWW2FzeW5jLXJldHVybl1hZGFwdGVyOAA2CGFkYXB0ZXI4ADcVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI5ADgWW2FzeW5jLXJldHVybl1hZGFwdGVyOQA5CGFkYXB0ZXI5ADoWW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMAA7F1thc3luYy1yZXR1cm5dYWRhcHRlcjEwADwJYWRhcHRlcjEwAD0WW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMQA+F1thc3luYy1yZXR1cm5dYWRhcHRlcjExAD8JYWRhcHRlcjExAEAWW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMgBBF1thc3luYy1yZXR1cm5dYWRhcHRlcjEyAEIJYWRhcHRlcjEyAEMWW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMwBEF1thc3luYy1yZXR1cm5dYWRhcHRlcjEzAEUJYWRhcHRlcjEzAEYYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI1AA8YW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI2ABIYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI3ABUYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI4ABcYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI5ABkZW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXIxMAAbGVthZGFwdGVyLWNhbGxlZV1hZGFwdGVyMTEAHRlbYWRhcHRlci1jYWxsZWVdYWRhcHRlcjEyACEZW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXIxMwAmCvhQH+cBAQl/AkACQB9AAQIAAkAjASIDDQBBFxACAAsjAiEEQQAkAkEIQQBBAxADIwAhBUEAJAAgAEHIAEElEAQgASACIQYhByAGIQggCCEJAkACQD8BrUIQhiAHrSAIrXxaDQELQR8QAgALQQBBAEEBIAkQACEKAkACQD8ArUIQhiAKrSAJrXxaDQELQR8QAgALAkAgBiIJRQ0AIAchCCAKIQsDQCALIAgtQAEAOgAAIAhBAWohCCALQQFqIQsgCUF/aiIJDQALCyAKIAYgBSQAEAEQBUEAJAEgAyQBIAQkAgsMAQtBMRACAAsLxwEBCH8CQAJAH0ABAgACQCMBIgMNAEEXEAIACyMCIQRBACQCQQhBAEEDEAMjACEFQQAkACAAQcgAQSUQBCABIAIhBiEHAkACQD8BrUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAAIQoCQAJAPwCtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQByAKIAggBSQAEAYQBUEAJAEgAyQBIAQkAgsMAQtBMRACAAsLzwIBCX8CQAJAH0ABAgACQCMBIgINAEEXEAIACyMCIQNBACQCQQhBAEEDEAMjACEEQQAkACAAQc0AQSYQBCAEJAAQCSEEEAVBACQBIARBA3EEQEEhEAIACwJAAkA/AK1CEIYgBK1BCK18Wg0BC0EBEAIACyABQQNxBEBBIRACAAsCQAJAPwGtQhCGIAGtQQitfFoNAQtBARACAAsgBCgCACAEKAIEIQUhBiAFIQcgByEIAkACQD8ArUIQhiAGrSAHrXxaDQELQR8QAgALQQBBAEEBIAgQCCEJAkACQD8BrUIQhiAJrSAIrXxaDQELQR8QAgALAkAgBSIIRQ0AIAYhByAJIQoDQCAKIActAAA6QAEAIAdBAWohByAKQQFqIQogCEF/aiIIDQALCyABIAk2QgEAIAEgBTZCAQQgAiQBIAQQCiADJAILDAELQTEQAgALC7AGAQh/AkACQB9AAQIAAkAjASICDQBBFxACAAsjAiEDQQAkAkEIQQBBAxADIwAhBEEAJAAgAEHKAEEjEAQgBCQAEAshBBAFQQAkASAEQQNxBEBBIRACAAsCQAJAPwCtQhCGIAStQRCtfFoNAQtBARACAAsgAUEDcQRAQSEQAgALAkACQD8BrUIQhiABrUEQrXxaDQELQQEQAgALAkACQAJAAkAgBC0AAA4CAQIAC0EgEAIACyABQQA6QAEADAELIAFBATpAAQACQAJAAkACQAJAAkACQCAELQAEDgUBAgMEBQALQSAQAgALIAFBADpAAQQMBAsgAUEBOkABBCAEKAIIIAQoAgwhBSEGAkACQD8ArUIQhiAGrSAFrXxaDQELQR4QAgALIAVB/////wdLBEBBHhACAAsgBSIHIQhBAEEAQQEgCBAIIQkCQAJAPwGtQhCGIAmtIAitfFoNAQtBHhACAAsgBiAFIAkQDSABIAk2QgEIIAEgBzZCAQwMAwsgAUECOkABBCAEKAIIIAQoAgwhByEJAkACQD8ArUIQhiAJrSAHrXxaDQELQR4QAgALIAdB/////wdLBEBBHhACAAsgByIFIQZBAEEAQQEgBhAIIQgCQAJAPwGtQhCGIAitIAatfFoNAQtBHhACAAsgCSAHIAgQDSABIAg2QgEIIAEgBTZCAQwMAgsgAUEDOkABBCAEKAIIIAQoAgwhBSEIAkACQD8ArUIQhiAIrSAFrXxaDQELQR4QAgALIAVB/////wdLBEBBHhACAAsgBSIHIQlBAEEAQQEgCRAIIQYCQAJAPwGtQhCGIAatIAmtfFoNAQtBHhACAAsgCCAFIAYQDSABIAY2QgEIIAEgBzZCAQwMAQsgAUEEOkABBCAEKAIIIAQoAgwhByEGAkACQD8ArUIQhiAGrSAHrXxaDQELQR4QAgALIAdB/////wdLBEBBHhACAAsgByIFIQhBAEEAQQEgCBAIIQkCQAJAPwGtQhCGIAmtIAitfFoNAQtBHhACAAsgBiAHIAkQDSABIAk2QgEIIAEgBTZCAQwLCyACJAEgBBAMIAMkAgsMAQtBMRACAAsLGwEBfyMAIQJBACQAIABBywBBJBAEIAEgAiQAC90GAQd/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAAkACQAJAAkAgAQ4CAQIAC0EgEAIACyAEQQA6QAEEDAELIARBATpAAQQgAiADIQYhByAGIQggCCEJAkACQD8ArUIQhiAHrSAIrXxaDQELQR8QAgALQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR8QAgALAkAgBiIJRQ0AIAchCCAKIQsDQCALIAgtAAA6QAEAIAhBAWohCCALQQFqIQsgCUF/aiIJDQALCyAEIAo2QgEIIAQgBjZCAQwLDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhCiEHAkACQD8ArUIQhiAHrSAKrXxaDQELQR4QAgALIApB/////wdLBEBBHhACAAsgCiIGIQlBAEEAQQEgCRAIIQgCQAJAPwGtQhCGIAitIAmtfFoNAQtBHhACAAsgByAKIAgQDSAEIAg2QgEIIAQgBjZCAQwMAwsgBEECOkABBCACIAMhBiEIAkACQD8ArUIQhiAIrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIKIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCCAGIAkQDSAEIAk2QgEIIAQgCjZCAQwMAgsgBEEDOkABBCACIAMhCiEJAkACQD8ArUIQhiAJrSAKrXxaDQELQR4QAgALIApB/////wdLBEBBHhACAAsgCiIGIQhBAEEAQQEgCBAIIQcCQAJAPwGtQhCGIAetIAitfFoNAQtBHhACAAsgCSAKIAcQDSAEIAc2QgEIIAQgBjZCAQwMAQsgBEEEOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIKIQlBAEEAQQEgCRAIIQgCQAJAPwGtQhCGIAitIAmtfFoNAQtBHhACAAsgByAGIAgQDSAEIAg2QgEIIAQgCjZCAQwLCyAFJAELJQDSLNItQQhBA0GeAUEBQQBBfiAAIAEgAhAR0g9BAkEBQQEQEAsZAQF/IwAhAUEAJAAgAEHIAEElEBMgASQAC6kFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUEmQc0AEBM2QgEEDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELIwDSL9IwQQhBA0GcAUEBQQBBfiAAIAEQFNISQQFBAUEBEBALngkDB38BfgZ/IwAhAUEAJAAgAEEDcQRAQSEQAgALAkACQD8BrUIQhiAArUEcrXxaDQELQQEQAgALIAAoQgEAQc0AQSYQBCAAKEIBBCAAKEIBCCECIQMgAiEEIAQhBQJAAkA/Aa1CEIYgA60gBK18Wg0BC0EfEAIAC0EAQQBBASAFEAAhBgJAAkA/AK1CEIYgBq0gBa18Wg0BC0EfEAIACwJAIAIiBUUNACADIQQgBiEHA0AgByAELUABADoAACAEQQFqIQQgB0EBaiEHIAVBf2oiBQ0ACwsgBiACIAAoQgEMIAAoQgEQIQYhAwJAAkAgBq1CGH4iCEIgiFANAQtBHxACAAsgCKchAiACIQUgA0EHcQRAQSEQAgALAkACQD8BrUIQhiADrSACrXxaDQELQR8QAgALQQBBAEEIIAUQACEEIARBB3EEQEEhEAIACwJAAkA/AK1CEIYgBK0gBa18Wg0BC0EfEAIACwJAIAYiBUUNACADIQIgBCEHA0ACQAJAAkACQAJAAkAgAi1AAQAOBAECAwQAC0EgEAIACyAHQQA6AAAgAihCAQggAihCAQwhCSEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAlB/////wdLBEBBHhACAAsgCSILIQxBAEEAQQEgDBAAIQ0CQAJAPwCtQhCGIA2tIAytfFoNAQtBHhACAAsgCiAJIA0QByAHIA02AgggByALNgIMDAMLIAdBAToAACACKEIBCCACKEIBDCELIQ0CQAJAPwGtQhCGIA2tIAutfFoNAQtBHhACAAsgC0H/////B0sEQEEeEAIACyALIgkhCkEAQQBBASAKEAAhDAJAAkA/AK1CEIYgDK0gCq18Wg0BC0EeEAIACyANIAsgDBAHIAcgDDYCCCAHIAk2AgwMAgsgB0ECOgAAIAIoQgEIIAIoQgEMIQkhDAJAAkA/Aa1CEIYgDK0gCa18Wg0BC0EeEAIACyAJQf////8HSwRAQR4QAgALIAkiCyENQQBBAEEBIA0QACEKAkACQD8ArUIQhiAKrSANrXxaDQELQR4QAgALIAwgCSAKEAcgByAKNgIIIAcgCzYCDAwBCyAHQQM6AAAgByACKUMBCDcDCCACKEIBECACKEIBFCELIQogCyEJIAkhDAJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EfEAIAC0EAQQBBASAMEAAhDQJAAkA/AK1CEIYgDa0gDK18Wg0BC0EfEAIACwJAIAsiDEUNACAKIQkgDSEOA0AgDiAJLUABADoAACAJQQFqIQkgDkEBaiEOIAxBf2oiDA0ACwsgByANNgIQIAcgCzYCFAsgAkEYaiECIAdBGGohByAFQX9qIgUNAAsLIAQgBiAAKEIBFCAAKEIBGCEEIQMgBCEGIAYhBQJAAkA/Aa1CEIYgA60gBq18Wg0BC0EfEAIAC0EAQQBBASAFEAAhAgJAAkA/AK1CEIYgAq0gBa18Wg0BC0EfEAIACwJAIAQiBUUNACADIQYgAiEHA0AgByAGLUABADoAACAGQQFqIQYgB0EBaiEHIAVBf2oiBQ0ACwsgAiAEIAEkAAupBQEGfyMBIQVBACQBIARBA3EEQEEhEAIACwJAAkA/Aa1CEIYgBK1BEK18Wg0BC0EBEAIACwJAAkACQAJAIAAOAgECAAtBIBACAAsgBEEAOkABACAEIAFBIkHMABATNkIBBAwBCyAEQQE6QAEAAkACQAJAAkACQAJAAkAgAQ4FAQIDBAUAC0EgEAIACyAEQQA6QAEEDAQLIARBATpAAQQgAiADIQYhBwJAAkA/AK1CEIYgB60gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgBiAKEA0gBCAKNkIBCCAEIAg2QgEMDAMLIARBAjpAAQQgAiADIQghCgJAAkA/AK1CEIYgCq0gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEHQQBBAEEBIAcQCCEJAkACQD8BrUIQhiAJrSAHrXxaDQELQR4QAgALIAogCCAJEA0gBCAJNkIBCCAEIAY2QgEMDAILIARBAzpAAQQgAiADIQYhCQJAAkA/AK1CEIYgCa0gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEKQQBBAEEBIAoQCCEHAkACQD8BrUIQhiAHrSAKrXxaDQELQR4QAgALIAkgBiAHEA0gBCAHNkIBCCAEIAg2QgEMDAELIARBBDpAAQQgAiADIQghBwJAAkA/AK1CEIYgB60gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgCCAKEA0gBCAKNkIBCCAEIAY2QgEMCwsgBSQBCyMA0jLSM0EIQQNBnQFBAUEAQX4gACABEBbSFUEHQQFBARAQCxkBAX8jACEBQQAkACAAQc0AQSYQBCABJAALqQUBBn8jASEFQQAkASAEQQNxBEBBIRACAAsCQAJAPwGtQhCGIAStQRCtfFoNAQtBARACAAsCQAJAAkACQCAADgIBAgALQSAQAgALIARBADpAAQAgBCABQSJBzAAQEzZCAQQMAQsgBEEBOkABAAJAAkACQAJAAkACQAJAIAEOBQECAwQFAAtBIBACAAsgBEEAOkABBAwECyAEQQE6QAEEIAIgAyEGIQcCQAJAPwCtQhCGIAetIAatfFoNAQtBHhACAAsgBkH/////B0sEQEEeEAIACyAGIgghCUEAQQBBASAJEAghCgJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EeEAIACyAHIAYgChANIAQgCjZCAQggBCAINkIBDAwDCyAEQQI6QAEEIAIgAyEIIQoCQAJAPwCtQhCGIAqtIAitfFoNAQtBHhACAAsgCEH/////B0sEQEEeEAIACyAIIgYhB0EAQQBBASAHEAghCQJAAkA/Aa1CEIYgCa0gB618Wg0BC0EeEAIACyAKIAggCRANIAQgCTZCAQggBCAGNkIBDAwCCyAEQQM6QAEEIAIgAyEGIQkCQAJAPwCtQhCGIAmtIAatfFoNAQtBHhACAAsgBkH/////B0sEQEEeEAIACyAGIgghCkEAQQBBASAKEAghBwJAAkA/Aa1CEIYgB60gCq18Wg0BC0EeEAIACyAJIAYgBxANIAQgBzZCAQggBCAINkIBDAwBCyAEQQQ6QAEEIAIgAyEIIQcCQAJAPwCtQhCGIAetIAitfFoNAQtBHhACAAsgCEH/////B0sEQEEeEAIACyAIIgYhCUEAQQBBASAJEAghCgJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EeEAIACyAHIAggChANIAQgCjZCAQggBCAGNkIBDAsLIAUkAQsjANI10jZBCEEDQZ0BQQFBAEF+IAAgARAY0hdBAUEBQQEQEAsZAQF/IwAhAUEAJAAgAEHMAEEiEAQgASQAC7gFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUEjQcoAEBM2QgEEIAQgAkEkQcsAEBM2QgEIDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELIwDSONI5QQhBA0GhAUEBQQBBfiAAIAEQGtIZQQFBAUEBEBALGQEBfyMAIQFBACQAIABBzABBIhAEIAEkAAu4BQEGfyMBIQVBACQBIARBA3EEQEEhEAIACwJAAkA/Aa1CEIYgBK1BEK18Wg0BC0EBEAIACwJAAkACQAJAIAAOAgECAAtBIBACAAsgBEEAOkABACAEIAFBI0HKABATNkIBBCAEIAJBJEHLABATNkIBCAwBCyAEQQE6QAEAAkACQAJAAkACQAJAAkAgAQ4FAQIDBAUAC0EgEAIACyAEQQA6QAEEDAQLIARBATpAAQQgAiADIQYhBwJAAkA/AK1CEIYgB60gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgBiAKEA0gBCAKNkIBCCAEIAg2QgEMDAMLIARBAjpAAQQgAiADIQghCgJAAkA/AK1CEIYgCq0gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEHQQBBAEEBIAcQCCEJAkACQD8BrUIQhiAJrSAHrXxaDQELQR4QAgALIAogCCAJEA0gBCAJNkIBCCAEIAY2QgEMDAILIARBAzpAAQQgAiADIQYhCQJAAkA/AK1CEIYgCa0gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEKQQBBAEEBIAoQCCEHAkACQD8BrUIQhiAHrSAKrXxaDQELQR4QAgALIAkgBiAHEA0gBCAHNkIBCCAEIAg2QgEMDAELIARBBDpAAQQgAiADIQghBwJAAkA/AK1CEIYgB60gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgCCAKEA0gBCAKNkIBCCAEIAY2QgEMCwsgBSQBCyMA0jvSPEEIQQNBoQFBAUEAQX4gACABEBzSG0EBQQFBARAQC6YBAQd/IwAhA0EAJAAgAEHKAEEjEAQgASACIQQhBSAEIQYgBiEHAkACQD8BrUIQhiAFrSAGrXxaDQELQR8QAgALQQBBAEEBIAcQACEIAkACQD8ArUIQhiAIrSAHrXxaDQELQR8QAgALAkAgBCIHRQ0AIAUhBiAIIQkDQCAJIAYtQAEAOgAAIAZBAWohBiAJQQFqIQkgB0F/aiIHDQALCyAIIAQgAyQAC5oFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEADAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELJwDSPtI/QQhBA0GfAUEBQQBBfiAAIAEgAiADEB7SHUEDQQFBARAQC/wGAwZ/AX4GfyMDIQFBACQDIABBA3EEQEEhEAIACwJAAkA/Aa1CEIYgAK1BIK18Wg0BC0EBEAIACyAAKEIBACAAKEIBBCECIQMCQAJAPwGtQhCGIAOtIAKtfFoNAQtBHhACAAsgAkH/////B0sEQEEeEAIACyACIgQhBUEAQQBBASAFEB8hBgJAAkA/Aq1CEIYgBq0gBa18Wg0BC0EeEAIACyADIAIgBhAiIAYgBCAAKEIBCCAAKEIBDCEEIQYCQAJAPwGtQhCGIAatIAStfFoNAQtBHhACAAsgBEH/////B0sEQEEeEAIACyAEIgIhA0EAQQBBASADEB8hBQJAAkA/Aq1CEIYgBa0gA618Wg0BC0EeEAIACyAGIAQgBRAiIAUgAiAAKEIBECAAKEIBFCECIQUCQAJAIAKtQhB+IgdCIIhQDQELQR8QAgALIAenIQQgBCEGIAVBA3EEQEEhEAIACwJAAkA/Aa1CEIYgBa0gBK18Wg0BC0EfEAIAC0EAQQBBBCAGEB8hAyADQQNxBEBBIRACAAsCQAJAPwKtQhCGIAOtIAatfFoNAQtBHxACAAsCQCACIgZFDQAgBSEEIAMhCANAIAQoQgEAIAQoQgEEIQkhCgJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EeEAIACyAJQf////8HSwRAQR4QAgALIAkiCyEMQQBBAEEBIAwQHyENAkACQD8CrUIQhiANrSAMrXxaDQELQR4QAgALIAogCSANECIgCCANNkICACAIIAs2QgIEIAQoQgEIIAQoQgEMIQshDQJAAkA/Aa1CEIYgDa0gC618Wg0BC0EeEAIACyALQf////8HSwRAQR4QAgALIAsiCSEKQQBBAEEBIAoQHyEMAkACQD8CrUIQhiAMrSAKrXxaDQELQR4QAgALIA0gCyAMECIgCCAMNkICCCAIIAk2QgIMIARBEGohBCAIQRBqIQggBkF/aiIGDQALCyADIAIgAChCARggAChCARwhAyEFIAMhAiACIQYCQAJAPwGtQhCGIAWtIAKtfFoNAQtBHxACAAtBAEEAQQEgBhAfIQQCQAJAPwKtQhCGIAStIAatfFoNAQtBHxACAAsCQCADIgZFDQAgBSECIAQhCANAIAggAi1AAQA6QAIAIAJBAWohAiAIQQFqIQggBkF/aiIGDQALCyAEIAMgASQDC4IDAQd/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUH//wNxO0EBBCACIAMhBiEHIAYhCCAIIQkCQAJAPwKtQhCGIAetIAitfFoNAQtBHxACAAtBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHxACAAsCQCAGIglFDQAgByEIIAohCwNAIAsgCC1AAgA6QAEAIAhBAWohCCALQQFqIQsgCUF/aiIJDQALCyAEIAo2QgEIIAQgBjZCAQwMAQsgBEEBOkABACABIAIhCiEHAkACQD8CrUIQhiAHrSAKrXxaDQELQR4QAgALIApB/////wdLBEBBHhACAAsgCiIGIQlBAEEAQQEgCRAIIQgCQAJAPwGtQhCGIAitIAmtfFoNAQtBHhACAAsgByAKIAgQIyAEIAg2QgEEIAQgBjZCAQgLIAUkAQsjANJB0kJBCEEBQYABQQFBAEF+IAAgARAl0iFBCEEBQQEQJAsQAQF/IwAhAEEAJAAgACQAC6kFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUEnQckAEBM2QgEEDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELIQDSRNJFQQhBA0GuAUEBQQBBfiAAECfSJkEAQQFBARAQCw=="}]} \ No newline at end of file +{"plan":{"formatVersion":3,"producer":{"shimVersion":"0.1.0","wasmtimeEnviron":"47.0.3","features":["cm-async","cm-async-stackful","cm-more-async-builtins","cm-error-context","cm-fixed-length-lists","cm-map","cm-implements","cm-threading"]},"component":{"sha256":"5651afa6d93f6c92c9ea22dcfb07b7eb1528ff2fce6e426aaedc79d1d620daca","len":10863836},"modules":[{"kind":"embedded","offset":18150,"len":1955618},{"kind":"embedded","offset":1973771,"len":1548},{"kind":"embedded","offset":1975322,"len":680},{"kind":"embedded","offset":2028167,"len":312933},{"kind":"embedded","offset":2341103,"len":726},{"kind":"embedded","offset":2341832,"len":361},{"kind":"embedded","offset":2361872,"len":8451181},{"kind":"embedded","offset":10813056,"len":4045},{"kind":"embedded","offset":10817104,"len":1763},{"kind":"embedded","offset":10818870,"len":759},{"kind":"adapter","file":"adapters/10.wasm","len":359,"intrinsics":[{"module":"flags","name":"instance1","category":"instance-flags","def":{"kind":"instance-flags","instance":1}},{"module":"flags","name":"instance8","category":"instance-flags","def":{"kind":"instance-flags","instance":8}},{"module":"callee","name":"adapter0","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[constructor]endpoint-options","space":"func"}}},{"module":"runtime","name":"trap","category":"trampoline:trap","def":{"kind":"trampoline","index":210}},{"module":"instance","name":"task_may_block","category":"task-may-block","def":{"kind":"task-may-block"}},{"module":"async","name":"enter-sync-call","category":"trampoline:enter-sync-call","def":{"kind":"trampoline","index":211}},{"module":"resource","name":"transfer-borrow","category":"trampoline:resource-transfer-borrow","def":{"kind":"trampoline","index":212}},{"module":"async","name":"exit-sync-call","category":"trampoline:exit-sync-call","def":{"kind":"trampoline","index":213}},{"module":"resource","name":"transfer-own","category":"trampoline:resource-transfer-own","def":{"kind":"trampoline","index":214}}]},{"kind":"adapter","file":"adapters/11.wasm","len":12523,"intrinsics":[{"module":"flags","name":"instance1","category":"instance-flags","def":{"kind":"instance-flags","instance":1}},{"module":"memory","name":"m0","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"memory","space":"memory"}}},{"module":"realloc","name":"f0","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"cabi_realloc","space":"func"}}},{"module":"flags","name":"instance8","category":"instance-flags","def":{"kind":"instance-flags","instance":8}},{"module":"memory","name":"m1","category":"core-def","def":{"kind":"export","instance":8,"item":{"name":"memory","space":"memory"}}},{"module":"callee","name":"adapter1","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.add-alpn","space":"func"}}},{"module":"runtime","name":"trap","category":"trampoline:trap","def":{"kind":"trampoline","index":210}},{"module":"instance","name":"task_may_block","category":"task-may-block","def":{"kind":"task-may-block"}},{"module":"async","name":"enter-sync-call","category":"trampoline:enter-sync-call","def":{"kind":"trampoline","index":211}},{"module":"resource","name":"transfer-borrow","category":"trampoline:resource-transfer-borrow","def":{"kind":"trampoline","index":212}},{"module":"async","name":"exit-sync-call","category":"trampoline:exit-sync-call","def":{"kind":"trampoline","index":213}},{"module":"callee","name":"adapter2","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.relay-url","space":"func"}}},{"module":"transcode","name":"utf8-to-utf8 (mem1 => mem0)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":262}},{"module":"realloc","name":"f8","category":"core-def","def":{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}}},{"module":"callee","name":"adapter3","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint.id","space":"func"}}},{"module":"post_return","name":"adapter3","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.alpn","space":"func"}}},{"module":"callee","name":"adapter4","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]send-stream.finish","space":"func"}}},{"module":"post_return","name":"adapter4","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.send-datagram","space":"func"}}},{"module":"transcode","name":"utf8-to-utf8 (mem0 => mem1)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":263}},{"module":"callback","name":"f14","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[callback][async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}}},{"module":"callee","name":"adapter5","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]recv-stream.read","space":"func"}}},{"module":"async","name":"[start-call]adapter5","category":"trampoline:async-start-call","def":{"kind":"trampoline","index":264}},{"module":"sync","name":"[prepare-call]adapter5","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":265}},{"module":"callee","name":"adapter6","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[static]endpoint.bind","space":"func"}}},{"module":"resource","name":"transfer-own","category":"trampoline:resource-transfer-own","def":{"kind":"trampoline","index":214}},{"module":"sync","name":"[prepare-call]adapter6","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter7","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.connect","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter7","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter8","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.accept","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter8","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter9","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.open-bi","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter9","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter10","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter10","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":266}},{"module":"callee","name":"adapter11","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]send-stream.write","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter11","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":267}},{"module":"flags","name":"instance6","category":"instance-flags","def":{"kind":"instance-flags","instance":6}},{"module":"memory","name":"m2","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"memory","space":"memory"}}},{"module":"realloc","name":"f31","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"cabi_realloc","space":"func"}}},{"module":"callback","name":"f32","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[callback][async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}}},{"module":"callee","name":"adapter12","category":"core-def","def":{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}}},{"module":"transcode","name":"utf8-to-utf8 (mem1 => mem2)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":268}},{"module":"transcode","name":"utf8-to-utf8 (mem2 => mem1)","category":"trampoline:transcoder","def":{"kind":"trampoline","index":269}},{"module":"async","name":"[start-call]adapter12","category":"trampoline:async-start-call","def":{"kind":"trampoline","index":270}},{"module":"sync","name":"[prepare-call]adapter12","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":271}},{"module":"callee","name":"adapter13","category":"core-def","def":{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/identity-generate@0.1.0#generate","space":"func"}}},{"module":"sync","name":"[prepare-call]adapter13","category":"trampoline:prepare-call","def":{"kind":"trampoline","index":272}}]}],"initializers":[{"op":"instantiate-module","module":1,"instance":1,"args":[]},{"op":"resource","index":0,"rep":"i32","dtor":{"kind":"export","instance":0,"item":{"name":"66","space":"func"}},"instance":1},{"op":"resource","index":1,"rep":"i32","dtor":{"kind":"export","instance":0,"item":{"name":"63","space":"func"}},"instance":1},{"op":"resource","index":2,"rep":"i32","dtor":{"kind":"export","instance":0,"item":{"name":"62","space":"func"}},"instance":1},{"op":"resource","index":3,"rep":"i32","dtor":{"kind":"export","instance":0,"item":{"name":"61","space":"func"}},"instance":1},{"op":"resource","index":4,"rep":"i32","dtor":{"kind":"export","instance":0,"item":{"name":"65","space":"func"}},"instance":1},{"op":"resource","index":5,"rep":"i32","dtor":{"kind":"export","instance":0,"item":{"name":"64","space":"func"}},"instance":1},{"op":"lower-import","index":0,"import":24},{"op":"lower-import","index":1,"import":25},{"op":"lower-import","index":2,"import":26},{"op":"lower-import","index":3,"import":27},{"op":"lower-import","index":4,"import":28},{"op":"lower-import","index":5,"import":29},{"op":"lower-import","index":6,"import":30},{"op":"lower-import","index":7,"import":31},{"op":"lower-import","index":8,"import":32},{"op":"lower-import","index":9,"import":33},{"op":"lower-import","index":10,"import":34},{"op":"lower-import","index":11,"import":35},{"op":"lower-import","index":12,"import":36},{"op":"lower-import","index":13,"import":37},{"op":"lower-import","index":14,"import":40},{"op":"lower-import","index":15,"import":38},{"op":"lower-import","index":16,"import":39},{"op":"lower-import","index":17,"import":41},{"op":"lower-import","index":18,"import":42},{"op":"lower-import","index":19,"import":43},{"op":"lower-import","index":20,"import":44},{"op":"lower-import","index":21,"import":45},{"op":"instantiate-module","module":0,"instance":1,"args":[{"kind":"trampoline","index":0},{"kind":"trampoline","index":1},{"kind":"trampoline","index":2},{"kind":"trampoline","index":3},{"kind":"trampoline","index":4},{"kind":"trampoline","index":5},{"kind":"trampoline","index":6},{"kind":"trampoline","index":7},{"kind":"trampoline","index":8},{"kind":"trampoline","index":9},{"kind":"trampoline","index":10},{"kind":"trampoline","index":11},{"kind":"trampoline","index":12},{"kind":"trampoline","index":13},{"kind":"trampoline","index":14},{"kind":"trampoline","index":15},{"kind":"export","instance":0,"item":{"name":"24","space":"func"}},{"kind":"export","instance":0,"item":{"name":"25","space":"func"}},{"kind":"export","instance":0,"item":{"name":"17","space":"func"}},{"kind":"export","instance":0,"item":{"name":"18","space":"func"}},{"kind":"trampoline","index":16},{"kind":"export","instance":0,"item":{"name":"26","space":"func"}},{"kind":"trampoline","index":17},{"kind":"trampoline","index":18},{"kind":"export","instance":0,"item":{"name":"27","space":"func"}},{"kind":"export","instance":0,"item":{"name":"28","space":"func"}},{"kind":"export","instance":0,"item":{"name":"29","space":"func"}},{"kind":"trampoline","index":19},{"kind":"trampoline","index":20},{"kind":"export","instance":0,"item":{"name":"0","space":"func"}},{"kind":"trampoline","index":21},{"kind":"export","instance":0,"item":{"name":"1","space":"func"}},{"kind":"export","instance":0,"item":{"name":"2","space":"func"}},{"kind":"export","instance":0,"item":{"name":"3","space":"func"}},{"kind":"export","instance":0,"item":{"name":"4","space":"func"}},{"kind":"export","instance":0,"item":{"name":"5","space":"func"}},{"kind":"export","instance":0,"item":{"name":"6","space":"func"}},{"kind":"export","instance":0,"item":{"name":"7","space":"func"}},{"kind":"export","instance":0,"item":{"name":"8","space":"func"}},{"kind":"trampoline","index":22},{"kind":"export","instance":0,"item":{"name":"9","space":"func"}},{"kind":"export","instance":0,"item":{"name":"10","space":"func"}},{"kind":"export","instance":0,"item":{"name":"13","space":"func"}},{"kind":"export","instance":0,"item":{"name":"19","space":"func"}},{"kind":"export","instance":0,"item":{"name":"32","space":"func"}},{"kind":"export","instance":0,"item":{"name":"14","space":"func"}},{"kind":"trampoline","index":23},{"kind":"trampoline","index":24},{"kind":"export","instance":0,"item":{"name":"30","space":"func"}},{"kind":"trampoline","index":25},{"kind":"export","instance":0,"item":{"name":"33","space":"func"}},{"kind":"trampoline","index":26},{"kind":"trampoline","index":27},{"kind":"export","instance":0,"item":{"name":"34","space":"func"}},{"kind":"trampoline","index":28},{"kind":"trampoline","index":29},{"kind":"export","instance":0,"item":{"name":"35","space":"func"}},{"kind":"trampoline","index":30},{"kind":"trampoline","index":31},{"kind":"export","instance":0,"item":{"name":"36","space":"func"}},{"kind":"trampoline","index":32},{"kind":"export","instance":0,"item":{"name":"37","space":"func"}},{"kind":"export","instance":0,"item":{"name":"38","space":"func"}},{"kind":"export","instance":0,"item":{"name":"39","space":"func"}},{"kind":"export","instance":0,"item":{"name":"40","space":"func"}},{"kind":"export","instance":0,"item":{"name":"41","space":"func"}},{"kind":"trampoline","index":33},{"kind":"export","instance":0,"item":{"name":"15","space":"func"}},{"kind":"export","instance":0,"item":{"name":"16","space":"func"}},{"kind":"export","instance":0,"item":{"name":"20","space":"func"}},{"kind":"trampoline","index":34},{"kind":"export","instance":0,"item":{"name":"50","space":"func"}},{"kind":"unsafe-intrinsic","intrinsic":"context-get-i32-0"},{"kind":"unsafe-intrinsic","intrinsic":"context-set-i32-0"},{"kind":"trampoline","index":35},{"kind":"trampoline","index":12},{"kind":"trampoline","index":36},{"kind":"trampoline","index":37},{"kind":"trampoline","index":38},{"kind":"trampoline","index":39},{"kind":"trampoline","index":40},{"kind":"trampoline","index":41},{"kind":"export","instance":0,"item":{"name":"31","space":"func"}},{"kind":"export","instance":0,"item":{"name":"21","space":"func"}},{"kind":"export","instance":0,"item":{"name":"11","space":"func"}},{"kind":"export","instance":0,"item":{"name":"12","space":"func"}},{"kind":"export","instance":0,"item":{"name":"51","space":"func"}},{"kind":"trampoline","index":42},{"kind":"trampoline","index":43},{"kind":"trampoline","index":44},{"kind":"export","instance":0,"item":{"name":"42","space":"func"}},{"kind":"export","instance":0,"item":{"name":"43","space":"func"}},{"kind":"trampoline","index":45},{"kind":"trampoline","index":46},{"kind":"trampoline","index":47},{"kind":"trampoline","index":48},{"kind":"trampoline","index":49},{"kind":"export","instance":0,"item":{"name":"44","space":"func"}},{"kind":"export","instance":0,"item":{"name":"45","space":"func"}},{"kind":"trampoline","index":50},{"kind":"trampoline","index":51},{"kind":"trampoline","index":52},{"kind":"trampoline","index":53},{"kind":"trampoline","index":54},{"kind":"export","instance":0,"item":{"name":"46","space":"func"}},{"kind":"export","instance":0,"item":{"name":"47","space":"func"}},{"kind":"trampoline","index":55},{"kind":"trampoline","index":56},{"kind":"trampoline","index":57},{"kind":"trampoline","index":58},{"kind":"trampoline","index":59},{"kind":"export","instance":0,"item":{"name":"48","space":"func"}},{"kind":"export","instance":0,"item":{"name":"49","space":"func"}},{"kind":"trampoline","index":60},{"kind":"trampoline","index":61},{"kind":"trampoline","index":62},{"kind":"trampoline","index":34},{"kind":"export","instance":0,"item":{"name":"22","space":"func"}},{"kind":"export","instance":0,"item":{"name":"23","space":"func"}},{"kind":"trampoline","index":60},{"kind":"trampoline","index":61},{"kind":"trampoline","index":62},{"kind":"trampoline","index":63},{"kind":"trampoline","index":64},{"kind":"trampoline","index":65},{"kind":"trampoline","index":66},{"kind":"trampoline","index":67},{"kind":"trampoline","index":68},{"kind":"export","instance":0,"item":{"name":"56","space":"func"}},{"kind":"trampoline","index":69},{"kind":"trampoline","index":70},{"kind":"export","instance":0,"item":{"name":"52","space":"func"}},{"kind":"export","instance":0,"item":{"name":"53","space":"func"}},{"kind":"export","instance":0,"item":{"name":"54","space":"func"}},{"kind":"export","instance":0,"item":{"name":"55","space":"func"}},{"kind":"trampoline","index":71},{"kind":"trampoline","index":72},{"kind":"trampoline","index":73},{"kind":"trampoline","index":74},{"kind":"export","instance":0,"item":{"name":"57","space":"func"}},{"kind":"export","instance":0,"item":{"name":"58","space":"func"}},{"kind":"export","instance":0,"item":{"name":"59","space":"func"}},{"kind":"trampoline","index":75},{"kind":"trampoline","index":76},{"kind":"export","instance":0,"item":{"name":"60","space":"func"}}]},{"op":"extract-memory","index":0,"export":{"instance":1,"item":{"name":"memory","space":"memory"}}},{"op":"lower-import","index":22,"import":46},{"op":"extract-realloc","index":0,"def":{"kind":"export","instance":1,"item":{"name":"cabi_realloc","space":"func"}}},{"op":"lower-import","index":23,"import":47},{"op":"lower-import","index":24,"import":48},{"op":"lower-import","index":25,"import":49},{"op":"lower-import","index":26,"import":50},{"op":"lower-import","index":27,"import":51},{"op":"lower-import","index":28,"import":52},{"op":"lower-import","index":29,"import":53},{"op":"lower-import","index":30,"import":54},{"op":"lower-import","index":31,"import":55},{"op":"lower-import","index":32,"import":56},{"op":"lower-import","index":33,"import":57},{"op":"lower-import","index":34,"import":58},{"op":"lower-import","index":35,"import":59},{"op":"lower-import","index":36,"import":60},{"op":"lower-import","index":37,"import":61},{"op":"lower-import","index":38,"import":62},{"op":"lower-import","index":39,"import":63},{"op":"lower-import","index":40,"import":64},{"op":"lower-import","index":41,"import":65},{"op":"lower-import","index":42,"import":66},{"op":"lower-import","index":43,"import":67},{"op":"lower-import","index":44,"import":68},{"op":"lower-import","index":45,"import":69},{"op":"lower-import","index":46,"import":70},{"op":"lower-import","index":47,"import":71},{"op":"lower-import","index":48,"import":72},{"op":"lower-import","index":49,"import":73},{"op":"lower-import","index":50,"import":74},{"op":"lower-import","index":51,"import":75},{"op":"lower-import","index":52,"import":76},{"op":"lower-import","index":53,"import":77},{"op":"lower-import","index":54,"import":78},{"op":"lower-import","index":55,"import":79},{"op":"lower-import","index":56,"import":80},{"op":"lower-import","index":57,"import":81},{"op":"instantiate-module","module":2,"instance":1,"args":[{"kind":"trampoline","index":77},{"kind":"trampoline","index":78},{"kind":"trampoline","index":78},{"kind":"trampoline","index":79},{"kind":"trampoline","index":80},{"kind":"trampoline","index":81},{"kind":"trampoline","index":82},{"kind":"trampoline","index":81},{"kind":"trampoline","index":83},{"kind":"trampoline","index":84},{"kind":"trampoline","index":80},{"kind":"trampoline","index":85},{"kind":"trampoline","index":86},{"kind":"trampoline","index":87},{"kind":"trampoline","index":88},{"kind":"trampoline","index":89},{"kind":"trampoline","index":90},{"kind":"trampoline","index":91},{"kind":"trampoline","index":92},{"kind":"trampoline","index":93},{"kind":"trampoline","index":94},{"kind":"trampoline","index":95},{"kind":"trampoline","index":96},{"kind":"trampoline","index":97},{"kind":"trampoline","index":98},{"kind":"trampoline","index":99},{"kind":"trampoline","index":99},{"kind":"trampoline","index":100},{"kind":"trampoline","index":101},{"kind":"trampoline","index":102},{"kind":"trampoline","index":103},{"kind":"trampoline","index":104},{"kind":"trampoline","index":105},{"kind":"trampoline","index":106},{"kind":"trampoline","index":107},{"kind":"trampoline","index":108},{"kind":"trampoline","index":109},{"kind":"trampoline","index":110},{"kind":"trampoline","index":111},{"kind":"trampoline","index":112},{"kind":"trampoline","index":113},{"kind":"trampoline","index":114},{"kind":"trampoline","index":115},{"kind":"trampoline","index":116},{"kind":"trampoline","index":117},{"kind":"trampoline","index":118},{"kind":"trampoline","index":119},{"kind":"trampoline","index":120},{"kind":"trampoline","index":96},{"kind":"trampoline","index":97},{"kind":"trampoline","index":121},{"kind":"trampoline","index":122},{"kind":"trampoline","index":123},{"kind":"trampoline","index":124},{"kind":"trampoline","index":125},{"kind":"trampoline","index":126},{"kind":"trampoline","index":127},{"kind":"trampoline","index":128},{"kind":"trampoline","index":129},{"kind":"trampoline","index":130},{"kind":"trampoline","index":131},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]connection","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]endpoint","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]endpoint-options","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]recv-stream","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[dtor]send-stream","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/identity@0.1.0#[dtor]identity","space":"func"}},{"kind":"export","instance":0,"item":{"name":"$imports","space":"table"}}]},{"op":"instantiate-module","module":4,"instance":6,"args":[]},{"op":"lower-import","index":58,"import":82},{"op":"lower-import","index":59,"import":83},{"op":"lower-import","index":60,"import":84},{"op":"lower-import","index":61,"import":40},{"op":"lower-import","index":62,"import":38},{"op":"lower-import","index":63,"import":39},{"op":"lower-import","index":64,"import":41},{"op":"lower-import","index":65,"import":42},{"op":"lower-import","index":66,"import":43},{"op":"lower-import","index":67,"import":45},{"op":"instantiate-module","module":3,"instance":6,"args":[{"kind":"trampoline","index":132},{"kind":"trampoline","index":133},{"kind":"trampoline","index":134},{"kind":"trampoline","index":135},{"kind":"trampoline","index":136},{"kind":"export","instance":3,"item":{"name":"16","space":"func"}},{"kind":"export","instance":3,"item":{"name":"0","space":"func"}},{"kind":"export","instance":3,"item":{"name":"1","space":"func"}},{"kind":"trampoline","index":137},{"kind":"trampoline","index":138},{"kind":"trampoline","index":139},{"kind":"export","instance":3,"item":{"name":"2","space":"func"}},{"kind":"export","instance":3,"item":{"name":"3","space":"func"}},{"kind":"export","instance":3,"item":{"name":"4","space":"func"}},{"kind":"export","instance":3,"item":{"name":"5","space":"func"}},{"kind":"export","instance":3,"item":{"name":"6","space":"func"}},{"kind":"export","instance":3,"item":{"name":"7","space":"func"}},{"kind":"export","instance":3,"item":{"name":"8","space":"func"}},{"kind":"export","instance":3,"item":{"name":"9","space":"func"}},{"kind":"export","instance":3,"item":{"name":"10","space":"func"}},{"kind":"trampoline","index":140},{"kind":"trampoline","index":141},{"kind":"trampoline","index":142},{"kind":"trampoline","index":143},{"kind":"trampoline","index":144},{"kind":"export","instance":3,"item":{"name":"17","space":"func"}},{"kind":"export","instance":3,"item":{"name":"18","space":"func"}},{"kind":"trampoline","index":145},{"kind":"trampoline","index":146},{"kind":"trampoline","index":147},{"kind":"trampoline","index":148},{"kind":"trampoline","index":149},{"kind":"export","instance":3,"item":{"name":"11","space":"func"}},{"kind":"export","instance":3,"item":{"name":"12","space":"func"}},{"kind":"trampoline","index":150},{"kind":"trampoline","index":151},{"kind":"trampoline","index":152},{"kind":"trampoline","index":153},{"kind":"trampoline","index":154},{"kind":"export","instance":3,"item":{"name":"13","space":"func"}},{"kind":"export","instance":3,"item":{"name":"14","space":"func"}},{"kind":"trampoline","index":145},{"kind":"trampoline","index":146},{"kind":"trampoline","index":147},{"kind":"trampoline","index":148},{"kind":"trampoline","index":149},{"kind":"export","instance":3,"item":{"name":"19","space":"func"}},{"kind":"trampoline","index":155},{"kind":"export","instance":3,"item":{"name":"15","space":"func"}},{"kind":"unsafe-intrinsic","intrinsic":"context-get-i32-0"},{"kind":"unsafe-intrinsic","intrinsic":"context-set-i32-0"},{"kind":"trampoline","index":156},{"kind":"trampoline","index":157},{"kind":"trampoline","index":158},{"kind":"trampoline","index":159},{"kind":"export","instance":3,"item":{"name":"20","space":"func"}},{"kind":"trampoline","index":160},{"kind":"trampoline","index":161},{"kind":"trampoline","index":162},{"kind":"trampoline","index":163},{"kind":"trampoline","index":164},{"kind":"trampoline","index":165},{"kind":"export","instance":3,"item":{"name":"25","space":"func"}},{"kind":"trampoline","index":166},{"kind":"trampoline","index":167},{"kind":"export","instance":3,"item":{"name":"21","space":"func"}},{"kind":"export","instance":3,"item":{"name":"22","space":"func"}},{"kind":"export","instance":3,"item":{"name":"23","space":"func"}},{"kind":"export","instance":3,"item":{"name":"24","space":"func"}},{"kind":"trampoline","index":168},{"kind":"trampoline","index":169},{"kind":"trampoline","index":170},{"kind":"trampoline","index":171},{"kind":"export","instance":3,"item":{"name":"26","space":"func"}},{"kind":"export","instance":3,"item":{"name":"27","space":"func"}},{"kind":"export","instance":3,"item":{"name":"28","space":"func"}},{"kind":"trampoline","index":172}]},{"op":"lower-import","index":68,"import":85},{"op":"extract-memory","index":1,"export":{"instance":4,"item":{"name":"memory","space":"memory"}}},{"op":"lower-import","index":69,"import":86},{"op":"lower-import","index":70,"import":87},{"op":"lower-import","index":71,"import":88},{"op":"extract-realloc","index":1,"def":{"kind":"export","instance":4,"item":{"name":"cabi_realloc","space":"func"}}},{"op":"lower-import","index":72,"import":89},{"op":"lower-import","index":73,"import":90},{"op":"lower-import","index":74,"import":91},{"op":"lower-import","index":75,"import":92},{"op":"lower-import","index":76,"import":93},{"op":"lower-import","index":77,"import":94},{"op":"lower-import","index":78,"import":72},{"op":"lower-import","index":79,"import":73},{"op":"lower-import","index":80,"import":74},{"op":"lower-import","index":81,"import":75},{"op":"lower-import","index":82,"import":76},{"op":"lower-import","index":83,"import":77},{"op":"lower-import","index":84,"import":78},{"op":"lower-import","index":85,"import":79},{"op":"lower-import","index":86,"import":80},{"op":"instantiate-module","module":5,"instance":6,"args":[{"kind":"trampoline","index":173},{"kind":"trampoline","index":174},{"kind":"trampoline","index":175},{"kind":"trampoline","index":176},{"kind":"trampoline","index":177},{"kind":"trampoline","index":178},{"kind":"trampoline","index":179},{"kind":"trampoline","index":180},{"kind":"trampoline","index":181},{"kind":"trampoline","index":182},{"kind":"trampoline","index":183},{"kind":"trampoline","index":184},{"kind":"trampoline","index":185},{"kind":"trampoline","index":186},{"kind":"trampoline","index":187},{"kind":"trampoline","index":188},{"kind":"trampoline","index":189},{"kind":"trampoline","index":186},{"kind":"trampoline","index":187},{"kind":"trampoline","index":190},{"kind":"trampoline","index":191},{"kind":"trampoline","index":192},{"kind":"trampoline","index":193},{"kind":"trampoline","index":194},{"kind":"trampoline","index":195},{"kind":"trampoline","index":196},{"kind":"trampoline","index":197},{"kind":"trampoline","index":198},{"kind":"trampoline","index":199},{"kind":"export","instance":3,"item":{"name":"$imports","space":"table"}}]},{"op":"instantiate-module","module":8,"instance":8,"args":[]},{"op":"instantiate-module","module":10,"instance":null,"args":[{"kind":"instance-flags","instance":1},{"kind":"instance-flags","instance":8},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[constructor]endpoint-options","space":"func"}},{"kind":"trampoline","index":210},{"kind":"task-may-block"},{"kind":"trampoline","index":211},{"kind":"trampoline","index":212},{"kind":"trampoline","index":213},{"kind":"trampoline","index":214}]},{"op":"lower-import","index":87,"import":101},{"op":"lower-import","index":88,"import":102},{"op":"lower-import","index":89,"import":103},{"op":"lower-import","index":90,"import":104},{"op":"lower-import","index":91,"import":95},{"op":"lower-import","index":92,"import":96},{"op":"lower-import","index":93,"import":97},{"op":"lower-import","index":94,"import":98},{"op":"lower-import","index":95,"import":99},{"op":"lower-import","index":96,"import":100},{"op":"lower-import","index":97,"import":24},{"op":"lower-import","index":98,"import":25},{"op":"lower-import","index":99,"import":26},{"op":"lower-import","index":100,"import":28},{"op":"lower-import","index":101,"import":40},{"op":"lower-import","index":102,"import":38},{"op":"lower-import","index":103,"import":39},{"op":"lower-import","index":104,"import":41},{"op":"lower-import","index":105,"import":42},{"op":"lower-import","index":106,"import":43},{"op":"lower-import","index":107,"import":44},{"op":"lower-import","index":108,"import":45},{"op":"instantiate-module","module":6,"instance":8,"args":[{"kind":"trampoline","index":200},{"kind":"trampoline","index":201},{"kind":"trampoline","index":202},{"kind":"trampoline","index":203},{"kind":"trampoline","index":204},{"kind":"trampoline","index":205},{"kind":"trampoline","index":206},{"kind":"trampoline","index":207},{"kind":"trampoline","index":208},{"kind":"trampoline","index":209},{"kind":"export","instance":6,"item":{"name":"20","space":"func"}},{"kind":"export","instance":6,"item":{"name":"21","space":"func"}},{"kind":"export","instance":6,"item":{"name":"22","space":"func"}},{"kind":"export","instance":6,"item":{"name":"23","space":"func"}},{"kind":"export","instance":6,"item":{"name":"24","space":"func"}},{"kind":"export","instance":6,"item":{"name":"25","space":"func"}},{"kind":"export","instance":6,"item":{"name":"26","space":"func"}},{"kind":"export","instance":6,"item":{"name":"27","space":"func"}},{"kind":"export","instance":6,"item":{"name":"28","space":"func"}},{"kind":"export","instance":7,"item":{"name":"adapter0","space":"func"}},{"kind":"export","instance":6,"item":{"name":"0","space":"func"}},{"kind":"export","instance":6,"item":{"name":"1","space":"func"}},{"kind":"export","instance":6,"item":{"name":"2","space":"func"}},{"kind":"export","instance":6,"item":{"name":"29","space":"func"}},{"kind":"export","instance":6,"item":{"name":"30","space":"func"}},{"kind":"export","instance":6,"item":{"name":"31","space":"func"}},{"kind":"export","instance":6,"item":{"name":"32","space":"func"}},{"kind":"export","instance":6,"item":{"name":"33","space":"func"}},{"kind":"export","instance":6,"item":{"name":"34","space":"func"}},{"kind":"export","instance":6,"item":{"name":"35","space":"func"}},{"kind":"export","instance":6,"item":{"name":"36","space":"func"}},{"kind":"export","instance":6,"item":{"name":"37","space":"func"}},{"kind":"export","instance":6,"item":{"name":"38","space":"func"}},{"kind":"export","instance":6,"item":{"name":"39","space":"func"}},{"kind":"export","instance":6,"item":{"name":"40","space":"func"}},{"kind":"export","instance":6,"item":{"name":"41","space":"func"}},{"kind":"export","instance":6,"item":{"name":"42","space":"func"}},{"kind":"export","instance":6,"item":{"name":"43","space":"func"}},{"kind":"export","instance":6,"item":{"name":"44","space":"func"}},{"kind":"export","instance":6,"item":{"name":"45","space":"func"}},{"kind":"export","instance":6,"item":{"name":"46","space":"func"}},{"kind":"export","instance":6,"item":{"name":"47","space":"func"}},{"kind":"export","instance":6,"item":{"name":"48","space":"func"}},{"kind":"export","instance":6,"item":{"name":"49","space":"func"}},{"kind":"export","instance":6,"item":{"name":"50","space":"func"}},{"kind":"export","instance":6,"item":{"name":"51","space":"func"}},{"kind":"export","instance":6,"item":{"name":"52","space":"func"}},{"kind":"export","instance":6,"item":{"name":"53","space":"func"}},{"kind":"export","instance":6,"item":{"name":"54","space":"func"}},{"kind":"export","instance":6,"item":{"name":"55","space":"func"}},{"kind":"trampoline","index":215},{"kind":"trampoline","index":216},{"kind":"trampoline","index":217},{"kind":"export","instance":6,"item":{"name":"3","space":"func"}},{"kind":"trampoline","index":218},{"kind":"export","instance":6,"item":{"name":"4","space":"func"}},{"kind":"export","instance":6,"item":{"name":"5","space":"func"}},{"kind":"export","instance":6,"item":{"name":"6","space":"func"}},{"kind":"export","instance":6,"item":{"name":"7","space":"func"}},{"kind":"export","instance":6,"item":{"name":"8","space":"func"}},{"kind":"export","instance":6,"item":{"name":"9","space":"func"}},{"kind":"export","instance":6,"item":{"name":"10","space":"func"}},{"kind":"export","instance":6,"item":{"name":"59","space":"func"}},{"kind":"export","instance":6,"item":{"name":"60","space":"func"}},{"kind":"trampoline","index":219},{"kind":"trampoline","index":220},{"kind":"trampoline","index":221},{"kind":"trampoline","index":222},{"kind":"trampoline","index":223},{"kind":"trampoline","index":224},{"kind":"trampoline","index":225},{"kind":"trampoline","index":226},{"kind":"trampoline","index":227},{"kind":"trampoline","index":228},{"kind":"trampoline","index":229},{"kind":"trampoline","index":230},{"kind":"trampoline","index":231},{"kind":"trampoline","index":232},{"kind":"trampoline","index":233},{"kind":"export","instance":6,"item":{"name":"11","space":"func"}},{"kind":"trampoline","index":234},{"kind":"export","instance":6,"item":{"name":"12","space":"func"}},{"kind":"export","instance":6,"item":{"name":"13","space":"func"}},{"kind":"export","instance":6,"item":{"name":"19","space":"func"}},{"kind":"export","instance":6,"item":{"name":"16","space":"func"}},{"kind":"export","instance":6,"item":{"name":"61","space":"func"}},{"kind":"export","instance":6,"item":{"name":"62","space":"func"}},{"kind":"export","instance":6,"item":{"name":"63","space":"func"}},{"kind":"export","instance":6,"item":{"name":"64","space":"func"}},{"kind":"export","instance":6,"item":{"name":"14","space":"func"}},{"kind":"export","instance":6,"item":{"name":"15","space":"func"}},{"kind":"export","instance":6,"item":{"name":"65","space":"func"}},{"kind":"export","instance":6,"item":{"name":"17","space":"func"}},{"kind":"export","instance":6,"item":{"name":"18","space":"func"}},{"kind":"trampoline","index":235},{"kind":"trampoline","index":236},{"kind":"trampoline","index":237},{"kind":"trampoline","index":238},{"kind":"export","instance":6,"item":{"name":"56","space":"func"}},{"kind":"trampoline","index":239},{"kind":"trampoline","index":240},{"kind":"trampoline","index":241},{"kind":"export","instance":6,"item":{"name":"57","space":"func"}},{"kind":"trampoline","index":242},{"kind":"trampoline","index":243},{"kind":"unsafe-intrinsic","intrinsic":"context-get-i32-0"},{"kind":"unsafe-intrinsic","intrinsic":"context-set-i32-0"},{"kind":"trampoline","index":244},{"kind":"export","instance":6,"item":{"name":"58","space":"func"}},{"kind":"trampoline","index":245},{"kind":"trampoline","index":246},{"kind":"export","instance":6,"item":{"name":"66","space":"func"}},{"kind":"trampoline","index":247},{"kind":"export","instance":6,"item":{"name":"67","space":"func"}},{"kind":"trampoline","index":248},{"kind":"trampoline","index":249},{"kind":"trampoline","index":250},{"kind":"trampoline","index":251},{"kind":"trampoline","index":252},{"kind":"trampoline","index":253},{"kind":"export","instance":6,"item":{"name":"72","space":"func"}},{"kind":"trampoline","index":254},{"kind":"trampoline","index":255},{"kind":"export","instance":6,"item":{"name":"68","space":"func"}},{"kind":"export","instance":6,"item":{"name":"69","space":"func"}},{"kind":"export","instance":6,"item":{"name":"70","space":"func"}},{"kind":"export","instance":6,"item":{"name":"71","space":"func"}},{"kind":"trampoline","index":256},{"kind":"trampoline","index":257},{"kind":"trampoline","index":258},{"kind":"trampoline","index":259},{"kind":"export","instance":6,"item":{"name":"73","space":"func"}},{"kind":"export","instance":6,"item":{"name":"74","space":"func"}},{"kind":"export","instance":6,"item":{"name":"75","space":"func"}},{"kind":"trampoline","index":260},{"kind":"trampoline","index":261},{"kind":"export","instance":6,"item":{"name":"76","space":"func"}}]},{"op":"instantiate-module","module":7,"instance":8,"args":[{"kind":"export","instance":8,"item":{"name":"memory","space":"memory"}},{"kind":"trampoline","index":248},{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"trampoline","index":251},{"kind":"export","instance":6,"item":{"name":"78","space":"func"}},{"kind":"trampoline","index":259},{"kind":"export","instance":6,"item":{"name":"77","space":"func"}}]},{"op":"extract-memory","index":2,"export":{"instance":8,"item":{"name":"memory","space":"memory"}}},{"op":"extract-callback","index":0,"def":{"kind":"export","instance":1,"item":{"name":"[callback][async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}}},{"op":"extract-callback","index":1,"def":{"kind":"export","instance":4,"item":{"name":"[callback][async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}}},{"op":"instantiate-module","module":11,"instance":null,"args":[{"kind":"instance-flags","instance":1},{"kind":"export","instance":1,"item":{"name":"memory","space":"memory"}},{"kind":"export","instance":1,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"instance-flags","instance":8},{"kind":"export","instance":8,"item":{"name":"memory","space":"memory"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.add-alpn","space":"func"}},{"kind":"trampoline","index":210},{"kind":"task-may-block"},{"kind":"trampoline","index":211},{"kind":"trampoline","index":212},{"kind":"trampoline","index":213},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint-options.relay-url","space":"func"}},{"kind":"trampoline","index":262},{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]endpoint.id","space":"func"}},{"kind":"export","instance":1,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.alpn","space":"func"}},{"kind":"export","instance":1,"item":{"name":"polymorph:iroh/endpoint@0.1.0#[method]send-stream.finish","space":"func"}},{"kind":"export","instance":1,"item":{"name":"cabi_post_polymorph:iroh/endpoint@0.1.0#[method]connection.send-datagram","space":"func"}},{"kind":"trampoline","index":263},{"kind":"export","instance":1,"item":{"name":"[callback][async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]recv-stream.read","space":"func"}},{"kind":"trampoline","index":264},{"kind":"trampoline","index":265},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[static]endpoint.bind","space":"func"}},{"kind":"trampoline","index":214},{"kind":"trampoline","index":266},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.connect","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]endpoint.accept","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.open-bi","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]connection.accept-bi","space":"func"}},{"kind":"trampoline","index":266},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/endpoint@0.1.0#[method]send-stream.write","space":"func"}},{"kind":"trampoline","index":267},{"kind":"instance-flags","instance":6},{"kind":"export","instance":4,"item":{"name":"memory","space":"memory"}},{"kind":"export","instance":4,"item":{"name":"cabi_realloc","space":"func"}},{"kind":"export","instance":4,"item":{"name":"[callback][async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}},{"kind":"export","instance":4,"item":{"name":"[async-lift]polymorph:fetchspike/fetch@0.1.0#request","space":"func"}},{"kind":"trampoline","index":268},{"kind":"trampoline","index":269},{"kind":"trampoline","index":270},{"kind":"trampoline","index":271},{"kind":"export","instance":1,"item":{"name":"[async-lift]polymorph:iroh/identity-generate@0.1.0#generate","space":"func"}},{"kind":"trampoline","index":272}]},{"op":"lower-import","index":109,"import":53},{"op":"extract-realloc","index":2,"def":{"kind":"export","instance":8,"item":{"name":"cabi_realloc","space":"func"}}},{"op":"lower-import","index":110,"import":52},{"op":"lower-import","index":111,"import":54},{"op":"lower-import","index":112,"import":105},{"op":"lower-import","index":113,"import":106},{"op":"lower-import","index":114,"import":107},{"op":"lower-import","index":115,"import":108},{"op":"lower-import","index":116,"import":55},{"op":"lower-import","index":117,"import":109},{"op":"lower-import","index":118,"import":110},{"op":"lower-import","index":119,"import":111},{"op":"lower-import","index":120,"import":112},{"op":"lower-import","index":121,"import":72},{"op":"lower-import","index":122,"import":73},{"op":"lower-import","index":123,"import":74},{"op":"lower-import","index":124,"import":75},{"op":"lower-import","index":125,"import":76},{"op":"lower-import","index":126,"import":77},{"op":"lower-import","index":127,"import":78},{"op":"lower-import","index":128,"import":79},{"op":"lower-import","index":129,"import":80},{"op":"lower-import","index":130,"import":81},{"op":"lower-import","index":131,"import":113},{"op":"lower-import","index":132,"import":114},{"op":"extract-realloc","index":3,"def":{"kind":"export","instance":9,"item":{"name":"cabi_import_realloc","space":"func"}}},{"op":"instantiate-module","module":9,"instance":8,"args":[{"kind":"export","instance":10,"item":{"name":"adapter1","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter2","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter3","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter4","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter5","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter6","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter7","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter8","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter9","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter10","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter11","space":"func"}},{"kind":"trampoline","index":273},{"kind":"trampoline","index":274},{"kind":"trampoline","index":275},{"kind":"trampoline","index":276},{"kind":"trampoline","index":277},{"kind":"trampoline","index":278},{"kind":"trampoline","index":279},{"kind":"trampoline","index":280},{"kind":"trampoline","index":281},{"kind":"trampoline","index":282},{"kind":"trampoline","index":283},{"kind":"trampoline","index":284},{"kind":"trampoline","index":285},{"kind":"trampoline","index":286},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":282},{"kind":"trampoline","index":287},{"kind":"trampoline","index":282},{"kind":"trampoline","index":284},{"kind":"trampoline","index":288},{"kind":"trampoline","index":288},{"kind":"trampoline","index":282},{"kind":"trampoline","index":289},{"kind":"trampoline","index":290},{"kind":"trampoline","index":290},{"kind":"trampoline","index":290},{"kind":"trampoline","index":282},{"kind":"trampoline","index":282},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":286},{"kind":"trampoline","index":288},{"kind":"trampoline","index":291},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":286},{"kind":"trampoline","index":282},{"kind":"trampoline","index":284},{"kind":"trampoline","index":286},{"kind":"trampoline","index":286},{"kind":"trampoline","index":286},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":284},{"kind":"trampoline","index":292},{"kind":"trampoline","index":293},{"kind":"trampoline","index":294},{"kind":"export","instance":10,"item":{"name":"adapter12","space":"func"}},{"kind":"export","instance":10,"item":{"name":"adapter13","space":"func"}},{"kind":"trampoline","index":295},{"kind":"trampoline","index":296},{"kind":"trampoline","index":297},{"kind":"trampoline","index":298},{"kind":"trampoline","index":299},{"kind":"export","instance":9,"item":{"name":"random_get","space":"func"}},{"kind":"trampoline","index":300},{"kind":"trampoline","index":301},{"kind":"trampoline","index":302},{"kind":"trampoline","index":303},{"kind":"trampoline","index":304},{"kind":"trampoline","index":305},{"kind":"trampoline","index":306},{"kind":"trampoline","index":307},{"kind":"trampoline","index":308},{"kind":"trampoline","index":309},{"kind":"trampoline","index":310},{"kind":"trampoline","index":311},{"kind":"export","instance":6,"item":{"name":"$imports","space":"table"}}]},{"op":"extract-callback","index":2,"def":{"kind":"export","instance":8,"item":{"name":"[callback][async-lift]polymorph-data:tasks/tasks@0.1.0#add","space":"func"}}}],"trampolines":[{"kind":"resource-drop","index":0,"instance":1,"resource":24},{"kind":"resource-drop","index":1,"instance":1,"resource":29},{"kind":"resource-drop","index":2,"instance":1,"resource":25},{"kind":"resource-drop","index":3,"instance":1,"resource":26},{"kind":"subtask-cancel","index":4,"instance":1,"async":false},{"kind":"resource-drop","index":5,"instance":1,"resource":30},{"kind":"subtask-drop","index":6,"instance":1},{"kind":"resource-drop","index":7,"instance":1,"resource":31},{"kind":"resource-drop","index":8,"instance":1,"resource":32},{"kind":"resource-drop","index":9,"instance":1,"resource":33},{"kind":"task-cancel","index":10,"instance":1},{"kind":"resource-drop","index":11,"instance":1,"resource":27},{"kind":"stream-new","index":12,"instance":1,"streamTable":4},{"kind":"lower-import","index":13,"lowered":0,"options":0,"type":0},{"kind":"lower-import","index":14,"lowered":1,"options":1,"type":1},{"kind":"lower-import","index":15,"lowered":2,"options":1,"type":1},{"kind":"lower-import","index":16,"lowered":3,"options":2,"type":2},{"kind":"resource-rep","index":17,"instance":1,"resource":27},{"kind":"lower-import","index":18,"lowered":4,"options":3,"type":3},{"kind":"resource-new","index":19,"instance":1,"resource":28},{"kind":"resource-drop","index":20,"instance":1,"resource":34},{"kind":"resource-drop","index":21,"instance":1,"resource":28},{"kind":"task-return","index":22,"instance":1,"results":0,"resultType":4,"options":4},{"kind":"lower-import","index":23,"lowered":5,"options":5,"type":5},{"kind":"lower-import","index":24,"lowered":6,"options":5,"type":6},{"kind":"lower-import","index":25,"lowered":7,"options":0,"type":7},{"kind":"lower-import","index":26,"lowered":8,"options":1,"type":8},{"kind":"lower-import","index":27,"lowered":9,"options":6,"type":9},{"kind":"resource-drop","index":28,"instance":1,"resource":37},{"kind":"lower-import","index":29,"lowered":10,"options":2,"type":10},{"kind":"resource-drop","index":30,"instance":1,"resource":35},{"kind":"resource-drop","index":31,"instance":1,"resource":36},{"kind":"lower-import","index":32,"lowered":11,"options":2,"type":11},{"kind":"lower-import","index":33,"lowered":12,"options":2,"type":12},{"kind":"stream-drop-readable","index":34,"instance":1,"streamTable":4},{"kind":"resource-new","index":35,"instance":1,"resource":27},{"kind":"resource-new","index":36,"instance":1,"resource":29},{"kind":"lower-import","index":37,"lowered":13,"options":7,"type":13},{"kind":"resource-drop","index":38,"instance":1,"resource":38},{"kind":"resource-new","index":39,"instance":1,"resource":24},{"kind":"resource-new","index":40,"instance":1,"resource":25},{"kind":"resource-new","index":41,"instance":1,"resource":26},{"kind":"waitable-set-drop","index":42,"instance":1},{"kind":"waitable-set-new","index":43,"instance":1},{"kind":"waitable-join","index":44,"instance":1},{"kind":"stream-cancel-write","index":45,"instance":1,"streamTable":6,"async":false},{"kind":"stream-cancel-read","index":46,"instance":1,"streamTable":6,"async":false},{"kind":"stream-drop-writable","index":47,"instance":1,"streamTable":6},{"kind":"stream-drop-readable","index":48,"instance":1,"streamTable":6},{"kind":"stream-new","index":49,"instance":1,"streamTable":6},{"kind":"stream-cancel-write","index":50,"instance":1,"streamTable":5,"async":false},{"kind":"stream-cancel-read","index":51,"instance":1,"streamTable":5,"async":false},{"kind":"stream-drop-writable","index":52,"instance":1,"streamTable":5},{"kind":"stream-drop-readable","index":53,"instance":1,"streamTable":5},{"kind":"stream-new","index":54,"instance":1,"streamTable":5},{"kind":"stream-cancel-write","index":55,"instance":1,"streamTable":7,"async":false},{"kind":"stream-cancel-read","index":56,"instance":1,"streamTable":7,"async":false},{"kind":"stream-drop-writable","index":57,"instance":1,"streamTable":7},{"kind":"stream-drop-readable","index":58,"instance":1,"streamTable":7},{"kind":"stream-new","index":59,"instance":1,"streamTable":7},{"kind":"stream-cancel-write","index":60,"instance":1,"streamTable":4,"async":false},{"kind":"stream-cancel-read","index":61,"instance":1,"streamTable":4,"async":false},{"kind":"stream-drop-writable","index":62,"instance":1,"streamTable":4},{"kind":"resource-drop","index":63,"instance":1,"resource":39},{"kind":"resource-drop","index":64,"instance":1,"resource":40},{"kind":"resource-drop","index":65,"instance":1,"resource":41},{"kind":"resource-drop","index":66,"instance":1,"resource":42},{"kind":"resource-drop","index":67,"instance":1,"resource":43},{"kind":"resource-drop","index":68,"instance":1,"resource":44},{"kind":"lower-import","index":69,"lowered":14,"options":5,"type":14},{"kind":"lower-import","index":70,"lowered":15,"options":5,"type":15},{"kind":"lower-import","index":71,"lowered":16,"options":2,"type":16},{"kind":"lower-import","index":72,"lowered":17,"options":0,"type":17},{"kind":"lower-import","index":73,"lowered":18,"options":0,"type":18},{"kind":"lower-import","index":74,"lowered":19,"options":0,"type":18},{"kind":"lower-import","index":75,"lowered":20,"options":3,"type":3},{"kind":"lower-import","index":76,"lowered":21,"options":8,"type":19},{"kind":"task-return","index":77,"instance":1,"results":125,"resultType":20,"options":9},{"kind":"task-return","index":78,"instance":1,"results":126,"resultType":21,"options":9},{"kind":"task-return","index":79,"instance":1,"results":127,"resultType":22,"options":9},{"kind":"task-return","index":80,"instance":1,"results":128,"resultType":23,"options":9},{"kind":"task-return","index":81,"instance":1,"results":130,"resultType":24,"options":9},{"kind":"task-return","index":82,"instance":1,"results":131,"resultType":25,"options":9},{"kind":"task-return","index":83,"instance":1,"results":132,"resultType":26,"options":9},{"kind":"task-return","index":84,"instance":1,"results":133,"resultType":27,"options":9},{"kind":"waitable-set-poll","index":85,"instance":1,"options":10},{"kind":"waitable-set-wait","index":86,"instance":1,"options":10},{"kind":"lower-import","index":87,"lowered":22,"options":11,"type":28},{"kind":"lower-import","index":88,"lowered":23,"options":12,"type":29},{"kind":"lower-import","index":89,"lowered":24,"options":11,"type":30},{"kind":"lower-import","index":90,"lowered":25,"options":13,"type":31},{"kind":"lower-import","index":91,"lowered":26,"options":14,"type":32},{"kind":"lower-import","index":92,"lowered":27,"options":14,"type":33},{"kind":"lower-import","index":93,"lowered":28,"options":13,"type":34},{"kind":"lower-import","index":94,"lowered":29,"options":11,"type":35},{"kind":"lower-import","index":95,"lowered":30,"options":15,"type":36},{"kind":"stream-write","index":96,"instance":1,"streamTable":4,"options":16},{"kind":"stream-read","index":97,"instance":1,"streamTable":4,"options":16},{"kind":"lower-import","index":98,"lowered":31,"options":13,"type":37},{"kind":"task-return","index":99,"instance":1,"results":143,"resultType":38,"options":9},{"kind":"lower-import","index":100,"lowered":32,"options":14,"type":39},{"kind":"lower-import","index":101,"lowered":33,"options":17,"type":40},{"kind":"lower-import","index":102,"lowered":34,"options":14,"type":41},{"kind":"lower-import","index":103,"lowered":35,"options":13,"type":42},{"kind":"lower-import","index":104,"lowered":36,"options":13,"type":43},{"kind":"lower-import","index":105,"lowered":37,"options":11,"type":44},{"kind":"lower-import","index":106,"lowered":38,"options":18,"type":45},{"kind":"lower-import","index":107,"lowered":39,"options":19,"type":46},{"kind":"lower-import","index":108,"lowered":40,"options":13,"type":47},{"kind":"lower-import","index":109,"lowered":41,"options":11,"type":48},{"kind":"lower-import","index":110,"lowered":42,"options":13,"type":49},{"kind":"lower-import","index":111,"lowered":43,"options":13,"type":50},{"kind":"lower-import","index":112,"lowered":44,"options":11,"type":48},{"kind":"lower-import","index":113,"lowered":45,"options":13,"type":51},{"kind":"lower-import","index":114,"lowered":46,"options":13,"type":47},{"kind":"stream-write","index":115,"instance":1,"streamTable":6,"options":16},{"kind":"stream-read","index":116,"instance":1,"streamTable":6,"options":15},{"kind":"stream-write","index":117,"instance":1,"streamTable":5,"options":16},{"kind":"stream-read","index":118,"instance":1,"streamTable":5,"options":16},{"kind":"stream-write","index":119,"instance":1,"streamTable":7,"options":16},{"kind":"stream-read","index":120,"instance":1,"streamTable":7,"options":16},{"kind":"lower-import","index":121,"lowered":47,"options":20,"type":52},{"kind":"lower-import","index":122,"lowered":48,"options":21,"type":53},{"kind":"lower-import","index":123,"lowered":49,"options":19,"type":54},{"kind":"lower-import","index":124,"lowered":50,"options":22,"type":55},{"kind":"lower-import","index":125,"lowered":51,"options":9,"type":56},{"kind":"lower-import","index":126,"lowered":52,"options":22,"type":57},{"kind":"lower-import","index":127,"lowered":53,"options":23,"type":58},{"kind":"lower-import","index":128,"lowered":54,"options":21,"type":59},{"kind":"lower-import","index":129,"lowered":55,"options":21,"type":60},{"kind":"lower-import","index":130,"lowered":56,"options":21,"type":60},{"kind":"lower-import","index":131,"lowered":57,"options":21,"type":61},{"kind":"resource-drop","index":132,"instance":6,"resource":62},{"kind":"resource-drop","index":133,"instance":6,"resource":63},{"kind":"resource-drop","index":134,"instance":6,"resource":64},{"kind":"resource-drop","index":135,"instance":6,"resource":65},{"kind":"subtask-cancel","index":136,"instance":6,"async":false},{"kind":"lower-import","index":137,"lowered":58,"options":24,"type":62},{"kind":"lower-import","index":138,"lowered":59,"options":24,"type":63},{"kind":"lower-import","index":139,"lowered":60,"options":24,"type":64},{"kind":"future-cancel-write","index":140,"instance":6,"futureTable":2,"async":false},{"kind":"future-cancel-read","index":141,"instance":6,"futureTable":2,"async":false},{"kind":"future-drop-writable","index":142,"instance":6,"futureTable":2},{"kind":"future-drop-readable","index":143,"instance":6,"futureTable":2},{"kind":"future-new","index":144,"instance":6,"futureTable":2},{"kind":"stream-cancel-write","index":145,"instance":6,"streamTable":8,"async":false},{"kind":"stream-cancel-read","index":146,"instance":6,"streamTable":8,"async":false},{"kind":"stream-drop-writable","index":147,"instance":6,"streamTable":8},{"kind":"stream-drop-readable","index":148,"instance":6,"streamTable":8},{"kind":"stream-new","index":149,"instance":6,"streamTable":8},{"kind":"future-cancel-write","index":150,"instance":6,"futureTable":3,"async":false},{"kind":"future-cancel-read","index":151,"instance":6,"futureTable":3,"async":false},{"kind":"future-drop-writable","index":152,"instance":6,"futureTable":3},{"kind":"future-drop-readable","index":153,"instance":6,"futureTable":3},{"kind":"future-new","index":154,"instance":6,"futureTable":3},{"kind":"waitable-join","index":155,"instance":6},{"kind":"waitable-set-new","index":156,"instance":6},{"kind":"waitable-set-drop","index":157,"instance":6},{"kind":"task-cancel","index":158,"instance":6},{"kind":"subtask-drop","index":159,"instance":6},{"kind":"resource-drop","index":160,"instance":6,"resource":66},{"kind":"resource-drop","index":161,"instance":6,"resource":67},{"kind":"resource-drop","index":162,"instance":6,"resource":68},{"kind":"resource-drop","index":163,"instance":6,"resource":69},{"kind":"resource-drop","index":164,"instance":6,"resource":70},{"kind":"resource-drop","index":165,"instance":6,"resource":71},{"kind":"lower-import","index":166,"lowered":61,"options":25,"type":14},{"kind":"lower-import","index":167,"lowered":62,"options":25,"type":65},{"kind":"lower-import","index":168,"lowered":63,"options":24,"type":66},{"kind":"lower-import","index":169,"lowered":64,"options":26,"type":67},{"kind":"lower-import","index":170,"lowered":65,"options":26,"type":68},{"kind":"lower-import","index":171,"lowered":66,"options":26,"type":68},{"kind":"lower-import","index":172,"lowered":67,"options":27,"type":69},{"kind":"lower-import","index":173,"lowered":68,"options":28,"type":70},{"kind":"lower-import","index":174,"lowered":69,"options":29,"type":71},{"kind":"lower-import","index":175,"lowered":70,"options":30,"type":72},{"kind":"lower-import","index":176,"lowered":71,"options":31,"type":73},{"kind":"lower-import","index":177,"lowered":72,"options":32,"type":74},{"kind":"lower-import","index":178,"lowered":73,"options":33,"type":75},{"kind":"lower-import","index":179,"lowered":74,"options":34,"type":76},{"kind":"lower-import","index":180,"lowered":75,"options":29,"type":77},{"kind":"lower-import","index":181,"lowered":76,"options":29,"type":78},{"kind":"future-write","index":182,"instance":6,"futureTable":2,"options":35},{"kind":"future-read","index":183,"instance":6,"futureTable":2,"options":36},{"kind":"future-write","index":184,"instance":6,"futureTable":3,"options":35},{"kind":"future-read","index":185,"instance":6,"futureTable":3,"options":36},{"kind":"stream-write","index":186,"instance":6,"streamTable":8,"options":37},{"kind":"stream-read","index":187,"instance":6,"streamTable":8,"options":37},{"kind":"waitable-set-poll","index":188,"instance":6,"options":38},{"kind":"task-return","index":189,"instance":6,"results":226,"resultType":79,"options":39},{"kind":"lower-import","index":190,"lowered":77,"options":36,"type":80},{"kind":"lower-import","index":191,"lowered":78,"options":40,"type":53},{"kind":"lower-import","index":192,"lowered":79,"options":31,"type":81},{"kind":"lower-import","index":193,"lowered":80,"options":41,"type":82},{"kind":"lower-import","index":194,"lowered":81,"options":39,"type":83},{"kind":"lower-import","index":195,"lowered":82,"options":41,"type":84},{"kind":"lower-import","index":196,"lowered":83,"options":42,"type":58},{"kind":"lower-import","index":197,"lowered":84,"options":40,"type":85},{"kind":"lower-import","index":198,"lowered":85,"options":40,"type":86},{"kind":"lower-import","index":199,"lowered":86,"options":40,"type":86},{"kind":"resource-drop","index":200,"instance":8,"resource":72},{"kind":"resource-drop","index":201,"instance":8,"resource":78},{"kind":"resource-drop","index":202,"instance":8,"resource":81},{"kind":"resource-drop","index":203,"instance":8,"resource":83},{"kind":"resource-drop","index":204,"instance":8,"resource":85},{"kind":"resource-drop","index":205,"instance":8,"resource":84},{"kind":"resource-drop","index":206,"instance":8,"resource":82},{"kind":"resource-drop","index":207,"instance":8,"resource":79},{"kind":"resource-drop","index":208,"instance":8,"resource":80},{"kind":"resource-drop","index":209,"instance":8,"resource":73},{"kind":"trap","index":210},{"kind":"enter-sync-call","index":211},{"kind":"resource-transfer-borrow","index":212},{"kind":"exit-sync-call","index":213},{"kind":"resource-transfer-own","index":214},{"kind":"resource-drop","index":215,"instance":8,"resource":74},{"kind":"resource-drop","index":216,"instance":8,"resource":75},{"kind":"resource-drop","index":217,"instance":8,"resource":76},{"kind":"subtask-cancel","index":218,"instance":8,"async":false},{"kind":"resource-drop","index":219,"instance":8,"resource":77},{"kind":"stream-new","index":220,"instance":8,"streamTable":9},{"kind":"lower-import","index":221,"lowered":87,"options":43,"type":87},{"kind":"lower-import","index":222,"lowered":88,"options":44,"type":88},{"kind":"lower-import","index":223,"lowered":89,"options":44,"type":88},{"kind":"lower-import","index":224,"lowered":90,"options":44,"type":88},{"kind":"lower-import","index":225,"lowered":91,"options":43,"type":89},{"kind":"lower-import","index":226,"lowered":92,"options":44,"type":90},{"kind":"lower-import","index":227,"lowered":93,"options":44,"type":90},{"kind":"lower-import","index":228,"lowered":94,"options":44,"type":90},{"kind":"lower-import","index":229,"lowered":95,"options":44,"type":90},{"kind":"lower-import","index":230,"lowered":96,"options":44,"type":90},{"kind":"lower-import","index":231,"lowered":97,"options":43,"type":91},{"kind":"lower-import","index":232,"lowered":98,"options":44,"type":92},{"kind":"lower-import","index":233,"lowered":99,"options":44,"type":92},{"kind":"stream-drop-readable","index":234,"instance":8,"streamTable":9},{"kind":"stream-cancel-write","index":235,"instance":8,"streamTable":9,"async":false},{"kind":"stream-cancel-read","index":236,"instance":8,"streamTable":9,"async":false},{"kind":"stream-drop-writable","index":237,"instance":8,"streamTable":9},{"kind":"stream-new","index":238,"instance":8,"streamTable":10},{"kind":"waitable-set-new","index":239,"instance":8},{"kind":"waitable-join","index":240,"instance":8},{"kind":"stream-cancel-read","index":241,"instance":8,"streamTable":10,"async":false},{"kind":"stream-drop-writable","index":242,"instance":8,"streamTable":10},{"kind":"waitable-set-drop","index":243,"instance":8},{"kind":"stream-drop-readable","index":244,"instance":8,"streamTable":10},{"kind":"task-cancel","index":245,"instance":8},{"kind":"subtask-drop","index":246,"instance":8},{"kind":"lower-import","index":247,"lowered":100,"options":45,"type":3},{"kind":"resource-drop","index":248,"instance":8,"resource":86},{"kind":"resource-drop","index":249,"instance":8,"resource":87},{"kind":"resource-drop","index":250,"instance":8,"resource":88},{"kind":"resource-drop","index":251,"instance":8,"resource":89},{"kind":"resource-drop","index":252,"instance":8,"resource":90},{"kind":"resource-drop","index":253,"instance":8,"resource":91},{"kind":"lower-import","index":254,"lowered":101,"options":46,"type":14},{"kind":"lower-import","index":255,"lowered":102,"options":46,"type":93},{"kind":"lower-import","index":256,"lowered":103,"options":47,"type":94},{"kind":"lower-import","index":257,"lowered":104,"options":43,"type":95},{"kind":"lower-import","index":258,"lowered":105,"options":43,"type":96},{"kind":"lower-import","index":259,"lowered":106,"options":43,"type":96},{"kind":"lower-import","index":260,"lowered":107,"options":45,"type":3},{"kind":"lower-import","index":261,"lowered":108,"options":48,"type":97},{"kind":"transcoder","index":262,"op":"utf8-to-utf8","from":2,"from64":false,"to":0,"to64":false},{"kind":"transcoder","index":263,"op":"utf8-to-utf8","from":0,"from64":false,"to":2,"to64":false},{"kind":"async-start-call","index":264,"callback":0,"postReturn":null},{"kind":"prepare-call","index":265,"memory":0},{"kind":"prepare-call","index":266,"memory":0},{"kind":"prepare-call","index":267,"memory":0},{"kind":"transcoder","index":268,"op":"utf8-to-utf8","from":2,"from64":false,"to":1,"to64":false},{"kind":"transcoder","index":269,"op":"utf8-to-utf8","from":1,"from64":false,"to":2,"to64":false},{"kind":"async-start-call","index":270,"callback":1,"postReturn":null},{"kind":"prepare-call","index":271,"memory":1},{"kind":"prepare-call","index":272,"memory":0},{"kind":"lower-import","index":273,"lowered":109,"options":49,"type":98},{"kind":"lower-import","index":274,"lowered":110,"options":50,"type":99},{"kind":"lower-import","index":275,"lowered":111,"options":51,"type":100},{"kind":"lower-import","index":276,"lowered":112,"options":50,"type":101},{"kind":"lower-import","index":277,"lowered":113,"options":50,"type":102},{"kind":"lower-import","index":278,"lowered":114,"options":51,"type":103},{"kind":"stream-write","index":279,"instance":8,"streamTable":9,"options":52},{"kind":"stream-read","index":280,"instance":8,"streamTable":9,"options":52},{"kind":"lower-import","index":281,"lowered":115,"options":51,"type":104},{"kind":"task-return","index":282,"instance":8,"results":268,"resultType":105,"options":53},{"kind":"task-return","index":283,"instance":8,"results":269,"resultType":106,"options":54},{"kind":"task-return","index":284,"instance":8,"results":270,"resultType":107,"options":53},{"kind":"task-return","index":285,"instance":8,"results":271,"resultType":108,"options":55},{"kind":"task-return","index":286,"instance":8,"results":272,"resultType":109,"options":53},{"kind":"task-return","index":287,"instance":8,"results":22,"resultType":110,"options":56},{"kind":"task-return","index":288,"instance":8,"results":273,"resultType":111,"options":53},{"kind":"task-return","index":289,"instance":8,"results":275,"resultType":112,"options":53},{"kind":"task-return","index":290,"instance":8,"results":276,"resultType":113,"options":57},{"kind":"task-return","index":291,"instance":8,"results":277,"resultType":114,"options":53},{"kind":"waitable-set-poll","index":292,"instance":8,"options":58},{"kind":"stream-read","index":293,"instance":8,"streamTable":10,"options":52},{"kind":"stream-write","index":294,"instance":8,"streamTable":10,"options":52},{"kind":"lower-import","index":295,"lowered":116,"options":50,"type":115},{"kind":"lower-import","index":296,"lowered":117,"options":49,"type":116},{"kind":"lower-import","index":297,"lowered":118,"options":49,"type":117},{"kind":"lower-import","index":298,"lowered":119,"options":59,"type":118},{"kind":"lower-import","index":299,"lowered":120,"options":51,"type":119},{"kind":"lower-import","index":300,"lowered":121,"options":60,"type":53},{"kind":"lower-import","index":301,"lowered":122,"options":61,"type":120},{"kind":"lower-import","index":302,"lowered":123,"options":56,"type":121},{"kind":"lower-import","index":303,"lowered":124,"options":57,"type":122},{"kind":"lower-import","index":304,"lowered":125,"options":56,"type":123},{"kind":"lower-import","index":305,"lowered":126,"options":62,"type":58},{"kind":"lower-import","index":306,"lowered":127,"options":60,"type":124},{"kind":"lower-import","index":307,"lowered":128,"options":60,"type":125},{"kind":"lower-import","index":308,"lowered":129,"options":60,"type":125},{"kind":"lower-import","index":309,"lowered":130,"options":60,"type":61},{"kind":"lower-import","index":310,"lowered":131,"options":57,"type":122},{"kind":"lower-import","index":311,"lowered":132,"options":63,"type":126}],"canonicalOptions":[{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i64"]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":1,"stringEncoding":"utf8","memory":0,"realloc":0,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":6,"stringEncoding":"utf8","memory":1,"realloc":1,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":[],"results":["i64"]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":null,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i64","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i64","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":3,"postReturn":null,"callback":null,"async":false,"cancellable":false,"coreType":{"params":["i64","i32"],"results":[]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":null,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":[],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32","i32","i32"],"results":["i32"]}},{"instance":8,"stringEncoding":"utf8","memory":2,"realloc":2,"postReturn":null,"callback":2,"async":true,"cancellable":false,"coreType":{"params":["i32","i32","i32"],"results":["i32"]}}],"types":[{"kind":"func","params":[],"results":[{"kind":"own","resource":33}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":33}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}}],"results":[{"kind":"bool"}],"async":false},{"kind":"func","params":[],"results":[{"kind":"u64"}],"async":false},{"kind":"tuple","elements":[]},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":35}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":37}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":37}},{"label":"ordered","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":37}},{"label":"max-retransmits","type":{"kind":"option","type":{"kind":"u16"}}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":35}}],"results":[{"kind":"stream","element":{"kind":"enum","labels":["connecting","open","closing","closed"]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}}],"results":[{"kind":"stream","element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}}],"results":[{"kind":"stream","element":{"kind":"own","resource":35}}],"async":false},{"kind":"func","params":[{"label":"config","type":{"kind":"option","type":{"kind":"own","resource":38}}}],"results":[{"kind":"own","resource":36}],"async":false},{"kind":"func","params":[{"label":"status","type":{"kind":"result","ok":null,"err":null}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":40}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}}],"results":[{"kind":"own","resource":40}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":41}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":42}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":40}],"async":false},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":28},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":24},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"option","type":{"kind":"list","element":{"kind":"u8"}}},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":25},{"kind":"own","resource":26}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":25},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":26},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"func","params":[{"label":"url","type":{"kind":"string"}},{"label":"protocols","type":{"kind":"list","element":{"kind":"string"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":30},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":30}},{"label":"code","type":{"kind":"option","type":{"kind":"u16"}}},{"label":"reason","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":30}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":30}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":32}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":32}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":32}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}},{"label":"sig","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":31}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"options","type":{"kind":"own","resource":33}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":31},{"kind":"own","resource":32}]},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"own","resource":29},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"reset","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}]},{"kind":"func","params":[{"label":"address-family","type":{"kind":"enum","labels":["ipv4","ipv6"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":34},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":34}},{"label":"local-address","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":34}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":34}},{"label":"data","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"remote-address","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":34}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"list","element":{"kind":"u8"}},{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":35}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":37}},{"label":"label","type":{"kind":"string"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}},{"label":"options","type":{"kind":"own","resource":37}}],"results":[{"kind":"result","ok":{"kind":"own","resource":35},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}}],"results":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}},{"label":"description","type":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}},{"label":"candidate","type":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":36}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":35}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"how-long","type":{"kind":"u64"}}],"results":[],"async":true},{"kind":"func","params":[],"results":[{"kind":"tuple","elements":[{"kind":"u64"},{"kind":"u64"}]}],"async":false},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":40}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":39}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":39}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":42}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":39}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"string"}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":43}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":44}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"record","fields":[{"label":"seconds","type":{"kind":"u64"}},{"label":"nanoseconds","type":{"kind":"u32"}}]}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":65}}],"results":[{"kind":"own","resource":65}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":62}}],"results":[{"kind":"u16"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":62}}],"results":[{"kind":"own","resource":63}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":67}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":69}}],"results":[{"kind":"own","resource":67}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":68}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":69}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":67}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":64}},{"label":"scheme","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"HTTP","type":null},{"label":"HTTPS","type":null},{"label":"other","type":{"kind":"string"}}]}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":64}},{"label":"authority","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"this","type":{"kind":"own","resource":62}},{"label":"res","type":{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}}],"results":[{"kind":"tuple","elements":[{"kind":"stream","element":{"kind":"u8"}},{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":63}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"entries","type":{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":63},"err":{"kind":"variant","cases":[{"label":"invalid-syntax","type":null},{"label":"forbidden","type":null},{"label":"immutable","type":null},{"label":"size-exceeded","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":63}},{"label":"name","type":{"kind":"string"}}],"results":[{"kind":"list","element":{"kind":"list","element":{"kind":"u8"}}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":63}}],"results":[{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}],"async":false},{"kind":"func","params":[{"label":"headers","type":{"kind":"own","resource":63}},{"label":"contents","type":{"kind":"option","type":{"kind":"stream","element":{"kind":"u8"}}}},{"label":"trailers","type":{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":63}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}},{"label":"options","type":{"kind":"option","type":{"kind":"own","resource":65}}}],"results":[{"kind":"tuple","elements":[{"kind":"own","resource":64},{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":64}},{"label":"method","type":{"kind":"variant","cases":[{"label":"get","type":null},{"label":"head","type":null},{"label":"post","type":null},{"label":"put","type":null},{"label":"delete","type":null},{"label":"connect","type":null},{"label":"options","type":null},{"label":"trace","type":null},{"label":"patch","type":null},{"label":"other","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":64}},{"label":"path-with-query","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"status","type":{"kind":"u16"}},{"label":"body","type":{"kind":"list","element":{"kind":"u8"}}}]},"err":{"kind":"string"}}]},{"kind":"func","params":[{"label":"request","type":{"kind":"own","resource":64}}],"results":[{"kind":"result","ok":{"kind":"own","resource":62},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":67}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":69}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":66}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":69}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":66}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":69}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":66}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":70}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":71}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":83}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":83}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":81}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":81}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":78}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":78}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":87}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}}],"results":[{"kind":"own","resource":87}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":88}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":89}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":87}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":79}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}},{"label":"sig","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":79}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":80}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":82}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"plaintext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":82}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"ciphertext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":84}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":85}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"revision","type":{"kind":"u64"}},{"label":"items","type":{"kind":"list","element":{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]}}}]},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":null,"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"string"}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"u32"},{"kind":"u32"}]},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}]},{"kind":"tuple","elements":[{"kind":"result","ok":{"kind":"bool"},"err":{"kind":"string"}}]},{"kind":"func","params":[{"label":"options","type":{"kind":"own","resource":78}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":80},{"kind":"own","resource":79}]},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":83}}],"results":[{"kind":"result","ok":{"kind":"own","resource":84},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["aes128","aes192","aes256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":81}}],"results":[{"kind":"result","ok":{"kind":"own","resource":82},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":85},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":false},{"kind":"func","params":[{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":79},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":87}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":86}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":86}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":89}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":86}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":90}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":91}}],"async":false},{"kind":"func","params":[{"label":"len","type":{"kind":"u64"}}],"results":[{"kind":"list","element":{"kind":"u8"}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":5}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":5}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":7}}],"results":[{"kind":"bool"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":14}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":16}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"ordered","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"max-retransmits","type":{"kind":"option","type":{"kind":"u16"}}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":14}}],"results":[{"kind":"stream","element":{"kind":"enum","labels":["connecting","open","closing","closed"]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}}],"results":[{"kind":"stream","element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}}],"results":[{"kind":"stream","element":{"kind":"own","resource":14}}],"async":false},{"kind":"func","params":[{"label":"config","type":{"kind":"option","type":{"kind":"own","resource":17}}}],"results":[{"kind":"own","resource":15}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":8}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}}],"results":[{"kind":"own","resource":8}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":10}],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":11}],"async":false},{"kind":"func","params":[{"label":"when","type":{"kind":"u64"}}],"results":[{"kind":"own","resource":8}],"async":false},{"kind":"func","params":[{"label":"url","type":{"kind":"string"}},{"label":"protocols","type":{"kind":"list","element":{"kind":"string"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":18},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}},{"label":"code","type":{"kind":"option","type":{"kind":"u16"}}},{"label":"reason","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":18}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"invalid-url","type":{"kind":"string"}},{"label":"connect-failed","type":{"kind":"string"}},{"label":"closed","type":null},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"invalid-argument","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":7}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":6}}],"results":[{"kind":"string"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":6}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":6}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}},{"label":"sig","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":7}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"options","type":{"kind":"own","resource":5}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"own","resource":7},{"kind":"own","resource":6}]},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"address-family","type":{"kind":"enum","labels":["ipv4","ipv6"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":19},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}},{"label":"local-address","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}},{"label":"data","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"remote-address","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":19}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"list","element":{"kind":"u8"}},{"kind":"variant","cases":[{"label":"ipv4","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u8"},{"kind":"u8"},{"kind":"u8"},{"kind":"u8"}]}}]}},{"label":"ipv6","type":{"kind":"record","fields":[{"label":"port","type":{"kind":"u16"}},{"label":"flow-info","type":{"kind":"u32"}},{"label":"address","type":{"kind":"tuple","elements":[{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"},{"kind":"u16"}]}},{"label":"scope-id","type":{"kind":"u32"}}]}}]}]},"err":{"kind":"variant","cases":[{"label":"access-denied","type":null},{"label":"not-supported","type":null},{"label":"invalid-argument","type":null},{"label":"out-of-memory","type":null},{"label":"timeout","type":null},{"label":"invalid-state","type":null},{"label":"address-not-bindable","type":null},{"label":"address-in-use","type":null},{"label":"remote-unreachable","type":null},{"label":"connection-refused","type":null},{"label":"connection-broken","type":null},{"label":"connection-reset","type":null},{"label":"connection-aborted","type":null},{"label":"datagram-too-large","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":14}},{"label":"message","type":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":16}},{"label":"label","type":{"kind":"string"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}},{"label":"options","type":{"kind":"own","resource":16}}],"results":[{"kind":"result","ok":{"kind":"own","resource":14},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}}],"results":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}},{"label":"description","type":{"kind":"record","fields":[{"label":"kind","type":{"kind":"enum","labels":["offer","answer","pranswer","rollback"]}},{"label":"sdp","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}},{"label":"candidate","type":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":15}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":14}}],"results":[{"kind":"result","ok":{"kind":"variant","cases":[{"label":"binary","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"string","type":{"kind":"string"}}]},"err":{"kind":"variant","cases":[{"label":"closed","type":null},{"label":"timed-out","type":null},{"label":"invalid-signaling","type":{"kind":"string"}},{"label":"receiving-via-stream","type":null},{"label":"receive-buffer-overflow","type":null},{"label":"other","type":{"kind":"string"}}]}}],"async":true},{"kind":"func","params":[{"label":"in","type":{"kind":"list","element":{"kind":"borrow","resource":8}}}],"results":[{"kind":"list","element":{"kind":"u32"}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}}],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":9}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}},{"label":"contents","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":9}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":11}}],"results":[{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"last-operation-failed","type":{"kind":"own","resource":9}},{"label":"closed","type":null}]}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":12}}],"async":false},{"kind":"func","params":[],"results":[{"kind":"option","type":{"kind":"own","resource":13}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":23}}],"results":[{"kind":"own","resource":23}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":20}}],"results":[{"kind":"u16"}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":20}}],"results":[{"kind":"own","resource":21}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}},{"label":"scheme","type":{"kind":"option","type":{"kind":"variant","cases":[{"label":"HTTP","type":null},{"label":"HTTPS","type":null},{"label":"other","type":{"kind":"string"}}]}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}},{"label":"authority","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"this","type":{"kind":"own","resource":20}},{"label":"res","type":{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}}],"results":[{"kind":"tuple","elements":[{"kind":"stream","element":{"kind":"u8"}},{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":21}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"entries","type":{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":21},"err":{"kind":"variant","cases":[{"label":"invalid-syntax","type":null},{"label":"forbidden","type":null},{"label":"immutable","type":null},{"label":"size-exceeded","type":null},{"label":"other","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":21}},{"label":"name","type":{"kind":"string"}}],"results":[{"kind":"list","element":{"kind":"list","element":{"kind":"u8"}}}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":21}}],"results":[{"kind":"list","element":{"kind":"tuple","elements":[{"kind":"string"},{"kind":"list","element":{"kind":"u8"}}]}}],"async":false},{"kind":"func","params":[{"label":"headers","type":{"kind":"own","resource":21}},{"label":"contents","type":{"kind":"option","type":{"kind":"stream","element":{"kind":"u8"}}}},{"label":"trailers","type":{"kind":"future","element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":21}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}},{"label":"options","type":{"kind":"option","type":{"kind":"own","resource":23}}}],"results":[{"kind":"tuple","elements":[{"kind":"own","resource":22},{"kind":"future","element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}}]}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}},{"label":"method","type":{"kind":"variant","cases":[{"label":"get","type":null},{"label":"head","type":null},{"label":"post","type":null},{"label":"put","type":null},{"label":"delete","type":null},{"label":"connect","type":null},{"label":"options","type":null},{"label":"trace","type":null},{"label":"patch","type":null},{"label":"other","type":{"kind":"string"}}]}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":22}},{"label":"path-with-query","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":null,"err":null}],"async":false},{"kind":"func","params":[{"label":"request","type":{"kind":"own","resource":22}}],"results":[{"kind":"result","ok":{"kind":"own","resource":20},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"own","resource":2}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":2}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[],"results":[{"kind":"own","resource":0}],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":0}},{"label":"allowed","type":{"kind":"bool"}}],"results":[],"async":false},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":3}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"plaintext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":3}},{"label":"nonce","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"aad","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tag-size","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"ciphertext","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"stream","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":1}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"self","type":{"kind":"borrow","resource":4}},{"label":"data","type":{"kind":"stream","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":0}}],"results":[{"kind":"result","ok":{"kind":"own","resource":1},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["aes128","aes192","aes256"]}},{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"options","type":{"kind":"own","resource":2}}],"results":[{"kind":"result","ok":{"kind":"own","resource":3},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"func","params":[{"label":"variant","type":{"kind":"enum","labels":["sha224","sha256","sha384","sha512","sha512-224","sha512-256"]}}],"results":[{"kind":"result","ok":{"kind":"own","resource":4},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":false},{"kind":"func","params":[{"label":"raw","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"own","resource":6},"err":{"kind":"variant","cases":[{"label":"invalid-key","type":{"kind":"string"}},{"label":"invalid-nonce","type":{"kind":"string"}},{"label":"authentication-failed","type":null},{"label":"not-extractable","type":null},{"label":"unsupported","type":{"kind":"string"}},{"label":"not-permitted","type":{"kind":"string"}},{"label":"other","type":{"kind":"string"}},{"label":"extension","type":{"kind":"record","fields":[{"label":"origin","type":{"kind":"string"}},{"label":"name","type":{"kind":"string"}},{"label":"message","type":{"kind":"string"}}]}}]}}],"async":true},{"kind":"record","fields":[{"label":"endpoint","type":{"kind":"string"}},{"label":"bucket","type":{"kind":"string"}},{"label":"access-key","type":{"kind":"string"}},{"label":"secret-key","type":{"kind":"string"}}]},{"kind":"record","fields":[{"label":"app-key","type":{"kind":"string"}},{"label":"app-secret","type":{"kind":"string"}},{"label":"access-token","type":{"kind":"string"}},{"label":"refresh-token","type":{"kind":"string"}},{"label":"root","type":{"kind":"string"}}]},{"kind":"variant","cases":[{"label":"s3","type":{"kind":"record","fields":[{"label":"endpoint","type":{"kind":"string"}},{"label":"bucket","type":{"kind":"string"}},{"label":"access-key","type":{"kind":"string"}},{"label":"secret-key","type":{"kind":"string"}}]}},{"label":"dropbox","type":{"kind":"record","fields":[{"label":"app-key","type":{"kind":"string"}},{"label":"app-secret","type":{"kind":"string"}},{"label":"access-token","type":{"kind":"string"}},{"label":"refresh-token","type":{"kind":"string"}},{"label":"root","type":{"kind":"string"}}]}}]},{"kind":"func","params":[{"label":"exportable-identity","type":{"kind":"bool"}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"bool"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"group-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"level","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"group-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"card","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"level","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"agent-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"card","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"config","type":{"kind":"variant","cases":[{"label":"s3","type":{"kind":"record","fields":[{"label":"endpoint","type":{"kind":"string"}},{"label":"bucket","type":{"kind":"string"}},{"label":"access-key","type":{"kind":"string"}},{"label":"secret-key","type":{"kind":"string"}}]}},{"label":"dropbox","type":{"kind":"record","fields":[{"label":"app-key","type":{"kind":"string"}},{"label":"app-secret","type":{"kind":"string"}},{"label":"access-token","type":{"kind":"string"}},{"label":"refresh-token","type":{"kind":"string"}},{"label":"root","type":{"kind":"string"}}]}}]}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"member-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"doc-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"owner-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"pickup","type":{"kind":"option","type":{"kind":"string"}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"label","type":{"kind":"string"}},{"label":"passphrase","type":{"kind":"option","type":{"kind":"string"}}},{"label":"secret-slot","type":{"kind":"option","type":{"kind":"list","element":{"kind":"u8"}}}}],"results":[{"kind":"result","ok":{"kind":"list","element":{"kind":"u8"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"bundle","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"passphrase","type":{"kind":"option","type":{"kind":"string"}}},{"label":"secret","type":{"kind":"option","type":{"kind":"list","element":{"kind":"u8"}}}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"relay-url","type":{"kind":"string"}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"initiator","type":{"kind":"bool"}},{"label":"peer-endpoint-id","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"relay-url","type":{"kind":"string"}},{"label":"expected-peer","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"conn","type":{"kind":"u32"}}],"results":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"peer","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"tree","type":{"kind":"list","element":{"kind":"u8"}}},{"label":"subscribe","type":{"kind":"bool"}}],"results":[{"kind":"result","ok":{"kind":"u32"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"handle","type":{"kind":"u32"}}],"results":[{"kind":"result","ok":{"kind":"option","type":{"kind":"string"}},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"list","element":{"kind":"u8"}}}],"results":[{"kind":"result","ok":{"kind":"tuple","elements":[{"kind":"u32"},{"kind":"u32"}]},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"string"}],"async":true},{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]},{"kind":"record","fields":[{"label":"revision","type":{"kind":"u64"}},{"label":"items","type":{"kind":"list","element":{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]}}}]},{"kind":"func","params":[],"results":[{"kind":"result","ok":{"kind":"u64"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[],"results":[{"kind":"result","ok":{"kind":"record","fields":[{"label":"revision","type":{"kind":"u64"}},{"label":"items","type":{"kind":"list","element":{"kind":"record","fields":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}]}}}]},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"title","type":{"kind":"string"}}],"results":[{"kind":"result","ok":{"kind":"string"},"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"string"}},{"label":"completed","type":{"kind":"bool"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"string"}},{"label":"title","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true},{"kind":"func","params":[{"label":"id","type":{"kind":"string"}}],"results":[{"kind":"result","ok":null,"err":{"kind":"string"}}],"async":true}],"resourceTables":[{"kind":"concrete","resource":0,"instance":0},{"kind":"concrete","resource":1,"instance":0},{"kind":"concrete","resource":2,"instance":0},{"kind":"concrete","resource":3,"instance":0},{"kind":"concrete","resource":4,"instance":0},{"kind":"concrete","resource":5,"instance":0},{"kind":"concrete","resource":6,"instance":0},{"kind":"concrete","resource":7,"instance":0},{"kind":"concrete","resource":8,"instance":0},{"kind":"concrete","resource":9,"instance":0},{"kind":"concrete","resource":10,"instance":0},{"kind":"concrete","resource":11,"instance":0},{"kind":"concrete","resource":12,"instance":0},{"kind":"concrete","resource":13,"instance":0},{"kind":"concrete","resource":14,"instance":0},{"kind":"concrete","resource":15,"instance":0},{"kind":"concrete","resource":16,"instance":0},{"kind":"concrete","resource":17,"instance":0},{"kind":"concrete","resource":18,"instance":0},{"kind":"concrete","resource":19,"instance":0},{"kind":"concrete","resource":20,"instance":0},{"kind":"concrete","resource":21,"instance":0},{"kind":"concrete","resource":22,"instance":0},{"kind":"concrete","resource":23,"instance":0},{"kind":"concrete","resource":27,"instance":1},{"kind":"concrete","resource":28,"instance":1},{"kind":"concrete","resource":29,"instance":1},{"kind":"concrete","resource":25,"instance":1},{"kind":"concrete","resource":26,"instance":1},{"kind":"concrete","resource":24,"instance":1},{"kind":"concrete","resource":18,"instance":1},{"kind":"concrete","resource":7,"instance":1},{"kind":"concrete","resource":6,"instance":1},{"kind":"concrete","resource":5,"instance":1},{"kind":"concrete","resource":19,"instance":1},{"kind":"concrete","resource":14,"instance":1},{"kind":"concrete","resource":15,"instance":1},{"kind":"concrete","resource":16,"instance":1},{"kind":"concrete","resource":17,"instance":1},{"kind":"concrete","resource":9,"instance":1},{"kind":"concrete","resource":8,"instance":1},{"kind":"concrete","resource":10,"instance":1},{"kind":"concrete","resource":11,"instance":1},{"kind":"concrete","resource":12,"instance":1},{"kind":"concrete","resource":13,"instance":1},{"kind":"concrete","resource":24,"instance":2},{"kind":"concrete","resource":24,"instance":3},{"kind":"concrete","resource":24,"instance":4},{"kind":"concrete","resource":7,"instance":4},{"kind":"concrete","resource":6,"instance":4},{"kind":"concrete","resource":24,"instance":5},{"kind":"concrete","resource":25,"instance":5},{"kind":"concrete","resource":26,"instance":5},{"kind":"concrete","resource":27,"instance":5},{"kind":"concrete","resource":28,"instance":5},{"kind":"concrete","resource":29,"instance":5},{"kind":"concrete","resource":24,"instance":0},{"kind":"concrete","resource":25,"instance":0},{"kind":"concrete","resource":26,"instance":0},{"kind":"concrete","resource":27,"instance":0},{"kind":"concrete","resource":28,"instance":0},{"kind":"concrete","resource":29,"instance":0},{"kind":"concrete","resource":20,"instance":6},{"kind":"concrete","resource":21,"instance":6},{"kind":"concrete","resource":22,"instance":6},{"kind":"concrete","resource":23,"instance":6},{"kind":"concrete","resource":9,"instance":6},{"kind":"concrete","resource":8,"instance":6},{"kind":"concrete","resource":10,"instance":6},{"kind":"concrete","resource":11,"instance":6},{"kind":"concrete","resource":12,"instance":6},{"kind":"concrete","resource":13,"instance":6},{"kind":"concrete","resource":25,"instance":8},{"kind":"concrete","resource":24,"instance":8},{"kind":"concrete","resource":28,"instance":8},{"kind":"concrete","resource":29,"instance":8},{"kind":"concrete","resource":27,"instance":8},{"kind":"concrete","resource":26,"instance":8},{"kind":"concrete","resource":5,"instance":8},{"kind":"concrete","resource":6,"instance":8},{"kind":"concrete","resource":7,"instance":8},{"kind":"concrete","resource":2,"instance":8},{"kind":"concrete","resource":3,"instance":8},{"kind":"concrete","resource":0,"instance":8},{"kind":"concrete","resource":1,"instance":8},{"kind":"concrete","resource":4,"instance":8},{"kind":"concrete","resource":9,"instance":8},{"kind":"concrete","resource":8,"instance":8},{"kind":"concrete","resource":10,"instance":8},{"kind":"concrete","resource":11,"instance":8},{"kind":"concrete","resource":12,"instance":8},{"kind":"concrete","resource":13,"instance":8}],"streamTables":[{"element":{"kind":"u8"},"instance":0},{"element":{"kind":"enum","labels":["connecting","open","closing","closed"]},"instance":0},{"element":{"kind":"own","resource":14},"instance":0},{"element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]},"instance":0},{"element":{"kind":"u8"},"instance":1},{"element":{"kind":"enum","labels":["connecting","open","closing","closed"]},"instance":1},{"element":{"kind":"record","fields":[{"label":"candidate","type":{"kind":"string"}},{"label":"sdp-mid","type":{"kind":"option","type":{"kind":"string"}}},{"label":"sdp-mline-index","type":{"kind":"option","type":{"kind":"u16"}}}]},"instance":1},{"element":{"kind":"own","resource":35},"instance":1},{"element":{"kind":"u8"},"instance":6},{"element":{"kind":"u8"},"instance":8},{"element":null,"instance":8}],"futureTables":[{"element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":21}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":0},{"element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":0},{"element":{"kind":"result","ok":null,"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":6},{"element":{"kind":"result","ok":{"kind":"option","type":{"kind":"own","resource":63}},"err":{"kind":"variant","cases":[{"label":"DNS-timeout","type":null},{"label":"DNS-error","type":{"kind":"record","fields":[{"label":"rcode","type":{"kind":"option","type":{"kind":"string"}}},{"label":"info-code","type":{"kind":"option","type":{"kind":"u16"}}}]}},{"label":"destination-not-found","type":null},{"label":"destination-unavailable","type":null},{"label":"destination-IP-prohibited","type":null},{"label":"destination-IP-unroutable","type":null},{"label":"connection-refused","type":null},{"label":"connection-terminated","type":null},{"label":"connection-timeout","type":null},{"label":"connection-read-timeout","type":null},{"label":"connection-write-timeout","type":null},{"label":"connection-limit-reached","type":null},{"label":"TLS-protocol-error","type":null},{"label":"TLS-certificate-error","type":null},{"label":"TLS-alert-received","type":{"kind":"record","fields":[{"label":"alert-id","type":{"kind":"option","type":{"kind":"u8"}}},{"label":"alert-message","type":{"kind":"option","type":{"kind":"string"}}}]}},{"label":"HTTP-request-denied","type":null},{"label":"HTTP-request-length-required","type":null},{"label":"HTTP-request-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-request-method-invalid","type":null},{"label":"HTTP-request-URI-invalid","type":null},{"label":"HTTP-request-URI-too-long","type":null},{"label":"HTTP-request-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-header-size","type":{"kind":"option","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}}},{"label":"HTTP-request-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-request-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-incomplete","type":null},{"label":"HTTP-response-header-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-header-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-body-size","type":{"kind":"option","type":{"kind":"u64"}}},{"label":"HTTP-response-trailer-section-size","type":{"kind":"option","type":{"kind":"u32"}}},{"label":"HTTP-response-trailer-size","type":{"kind":"record","fields":[{"label":"field-name","type":{"kind":"option","type":{"kind":"string"}}},{"label":"field-size","type":{"kind":"option","type":{"kind":"u32"}}}]}},{"label":"HTTP-response-transfer-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-content-coding","type":{"kind":"option","type":{"kind":"string"}}},{"label":"HTTP-response-timeout","type":null},{"label":"HTTP-upgrade-failed","type":null},{"label":"HTTP-protocol-error","type":null},{"label":"loop-detected","type":null},{"label":"configuration-error","type":null},{"label":"internal-error","type":{"kind":"option","type":{"kind":"string"}}}]}},"instance":6}],"errorContextTables":[],"importedResources":[{"import":0},{"import":1},{"import":2},{"import":3},{"import":4},{"import":5},{"import":6},{"import":7},{"import":8},{"import":9},{"import":10},{"import":11},{"import":12},{"import":13},{"import":14},{"import":15},{"import":16},{"import":17},{"import":18},{"import":19},{"import":20},{"import":21},{"import":22},{"import":23}],"imports":[{"name":"polymorph:webcrypto/mac@0.1.0","path":["mac-key-options"],"kind":"resource"},{"name":"polymorph:webcrypto/mac@0.1.0","path":["mac-key"],"kind":"resource"},{"name":"polymorph:webcrypto/aead@0.1.0","path":["aead-key-options"],"kind":"resource"},{"name":"polymorph:webcrypto/aead@0.1.0","path":["aead-key"],"kind":"resource"},{"name":"polymorph:webcrypto/digest@0.1.0","path":["digest"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["signing-key-options"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["verifying-key"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["signing-key"],"kind":"resource"},{"name":"wasi:io/poll@0.2.9","path":["pollable"],"kind":"resource"},{"name":"wasi:io/error@0.2.9","path":["error"],"kind":"resource"},{"name":"wasi:io/streams@0.2.9","path":["input-stream"],"kind":"resource"},{"name":"wasi:io/streams@0.2.9","path":["output-stream"],"kind":"resource"},{"name":"wasi:cli/terminal-input@0.2.9","path":["terminal-input"],"kind":"resource"},{"name":"wasi:cli/terminal-output@0.2.9","path":["terminal-output"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["data-channel"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["peer-connection"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["data-channel-options"],"kind":"resource"},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["peer-connection-config"],"kind":"resource"},{"name":"polymorph:websocket/connections@0.1.0","path":["websocket"],"kind":"resource"},{"name":"wasi:sockets/types@0.3.0","path":["udp-socket"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["response"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["fields"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["request"],"kind":"resource"},{"name":"wasi:http/types@0.3.0","path":["request-options"],"kind":"resource"},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[constructor]signing-key-options"],"kind":"func","type":127},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key-options.can-sign"],"kind":"func","type":128},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key-options.extractable"],"kind":"func","type":128},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key.can-sign"],"kind":"func","type":129},{"name":"wasi:random/random@0.2.9","path":["get-random-u64"],"kind":"func","type":3},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.close"],"kind":"func","type":130},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.close"],"kind":"func","type":131},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[constructor]data-channel-options"],"kind":"func","type":132},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel-options.set-ordered"],"kind":"func","type":133},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel-options.set-max-retransmits"],"kind":"func","type":134},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.state-changes"],"kind":"func","type":135},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.local-ice-candidates"],"kind":"func","type":136},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.incoming-data-channels"],"kind":"func","type":137},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[constructor]peer-connection"],"kind":"func","type":138},{"name":"wasi:io/poll@0.2.9","path":["[method]pollable.block"],"kind":"func","type":139},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.subscribe"],"kind":"func","type":140},{"name":"wasi:cli/exit@0.2.9","path":["exit"],"kind":"func","type":14},{"name":"wasi:cli/stdin@0.2.9","path":["get-stdin"],"kind":"func","type":141},{"name":"wasi:cli/stdout@0.2.9","path":["get-stdout"],"kind":"func","type":142},{"name":"wasi:cli/stderr@0.2.9","path":["get-stderr"],"kind":"func","type":142},{"name":"wasi:clocks/monotonic-clock@0.2.9","path":["now"],"kind":"func","type":3},{"name":"wasi:clocks/monotonic-clock@0.2.9","path":["subscribe-duration"],"kind":"func","type":143},{"name":"polymorph:websocket/connections@0.1.0","path":["[static]websocket.connect"],"kind":"func","type":144},{"name":"polymorph:websocket/connections@0.1.0","path":["[method]websocket.close"],"kind":"func","type":145},{"name":"polymorph:websocket/connections@0.1.0","path":["[method]websocket.send"],"kind":"func","type":146},{"name":"polymorph:websocket/connections@0.1.0","path":["[method]websocket.receive"],"kind":"func","type":147},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key.algorithm-name"],"kind":"func","type":148},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]verifying-key.algorithm-name"],"kind":"func","type":149},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]verifying-key.export-key-raw"],"kind":"func","type":150},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]verifying-key.verify"],"kind":"func","type":151},{"name":"polymorph:webcrypto/signature@0.1.0","path":["[method]signing-key.sign"],"kind":"func","type":152},{"name":"polymorph:webcrypto/ed25519-sign@0.1.0","path":["generate-key"],"kind":"func","type":153},{"name":"wasi:sockets/types@0.3.0","path":["[static]udp-socket.create"],"kind":"func","type":154},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.bind"],"kind":"func","type":155},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.get-local-address"],"kind":"func","type":156},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.send"],"kind":"func","type":157},{"name":"wasi:sockets/types@0.3.0","path":["[method]udp-socket.receive"],"kind":"func","type":158},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.send"],"kind":"func","type":159},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel-options.set-label"],"kind":"func","type":160},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.create-data-channel"],"kind":"func","type":161},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.create-offer"],"kind":"func","type":162},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.set-local-description"],"kind":"func","type":163},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.add-ice-candidate"],"kind":"func","type":164},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.wait-connected"],"kind":"func","type":165},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.set-remote-description"],"kind":"func","type":163},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]data-channel.receive"],"kind":"func","type":166},{"name":"polymorph:webrtc-datachannels/connections@0.1.0","path":["[method]peer-connection.create-answer"],"kind":"func","type":162},{"name":"wasi:clocks/monotonic-clock@0.3.0","path":["wait-for"],"kind":"func","type":52},{"name":"wasi:random/insecure-seed@0.2.9","path":["insecure-seed"],"kind":"func","type":53},{"name":"wasi:io/poll@0.2.9","path":["poll"],"kind":"func","type":167},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.check-write"],"kind":"func","type":168},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.write"],"kind":"func","type":169},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.blocking-flush"],"kind":"func","type":170},{"name":"wasi:cli/environment@0.2.9","path":["get-environment"],"kind":"func","type":58},{"name":"wasi:cli/terminal-stdin@0.2.9","path":["get-terminal-stdin"],"kind":"func","type":171},{"name":"wasi:cli/terminal-stdout@0.2.9","path":["get-terminal-stdout"],"kind":"func","type":172},{"name":"wasi:cli/terminal-stderr@0.2.9","path":["get-terminal-stderr"],"kind":"func","type":172},{"name":"wasi:clocks/wall-clock@0.2.9","path":["now"],"kind":"func","type":61},{"name":"wasi:http/types@0.3.0","path":["[method]request-options.clone"],"kind":"func","type":173},{"name":"wasi:http/types@0.3.0","path":["[method]response.get-status-code"],"kind":"func","type":174},{"name":"wasi:http/types@0.3.0","path":["[method]response.get-headers"],"kind":"func","type":175},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-scheme"],"kind":"func","type":176},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-authority"],"kind":"func","type":177},{"name":"wasi:http/types@0.3.0","path":["[static]response.consume-body"],"kind":"func","type":178},{"name":"wasi:http/types@0.3.0","path":["[static]fields.from-list"],"kind":"func","type":179},{"name":"wasi:http/types@0.3.0","path":["[method]fields.get"],"kind":"func","type":180},{"name":"wasi:http/types@0.3.0","path":["[method]fields.copy-all"],"kind":"func","type":181},{"name":"wasi:http/types@0.3.0","path":["[static]request.new"],"kind":"func","type":182},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-method"],"kind":"func","type":183},{"name":"wasi:http/types@0.3.0","path":["[method]request.set-path-with-query"],"kind":"func","type":184},{"name":"wasi:http/client@0.3.0","path":["send"],"kind":"func","type":185},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[constructor]aead-key-options"],"kind":"func","type":186},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-seal"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-open"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-wrap"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.can-unwrap"],"kind":"func","type":187},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key-options.extractable"],"kind":"func","type":187},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[constructor]mac-key-options"],"kind":"func","type":188},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key-options.can-sign"],"kind":"func","type":189},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key-options.can-verify"],"kind":"func","type":189},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key-options.extractable"],"kind":"func","type":189},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key.seal"],"kind":"func","type":190},{"name":"polymorph:webcrypto/aead@0.1.0","path":["[method]aead-key.open"],"kind":"func","type":191},{"name":"polymorph:webcrypto/mac@0.1.0","path":["[method]mac-key.sign"],"kind":"func","type":192},{"name":"polymorph:webcrypto/digest@0.1.0","path":["[method]digest.compute"],"kind":"func","type":193},{"name":"polymorph:webcrypto/hmac-sha2@0.1.0","path":["import-key-raw"],"kind":"func","type":194},{"name":"polymorph:webcrypto/aes-gcm@0.1.0","path":["import-key-raw"],"kind":"func","type":195},{"name":"polymorph:webcrypto/sha2@0.1.0","path":["make-digest"],"kind":"func","type":196},{"name":"polymorph:webcrypto/ed25519-verify@0.1.0","path":["import-verifying-key-raw"],"kind":"func","type":197},{"name":"wasi:io/streams@0.2.9","path":["[method]output-stream.blocking-write-and-flush"],"kind":"func","type":169},{"name":"wasi:random/random@0.2.9","path":["get-random-bytes"],"kind":"func","type":126}],"exports":[{"kind":"instance","name":"polymorph:engine-spike/driver@0.1.0","exports":[{"kind":"type","name":"s3-config","type":{"kind":"value","type":198}},{"kind":"type","name":"dropbox-config","type":{"kind":"value","type":199}},{"kind":"type","name":"store-config","type":{"kind":"value","type":200}},{"kind":"lifted-func","name":"init","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#init","space":"func"}},"options":64,"type":201},{"kind":"lifted-func","name":"kh-knows-agent","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-knows-agent","space":"func"}},"options":65,"type":202},{"kind":"lifted-func","name":"kh-create-group","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-create-group","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"kh-add-to-group","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-add-to-group","space":"func"}},"options":67,"type":204},{"kind":"lifted-func","name":"kh-revoke-from-group","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-revoke-from-group","space":"func"}},"options":68,"type":205},{"kind":"lifted-func","name":"kh-export-card","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-export-card","space":"func"}},"options":65,"type":206},{"kind":"lifted-func","name":"kh-ingest-card","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-ingest-card","space":"func"}},"options":65,"type":207},{"kind":"lifted-func","name":"kh-add-member","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-add-member","space":"func"}},"options":67,"type":208},{"kind":"lifted-func","name":"kh-revoke-member","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-revoke-member","space":"func"}},"options":68,"type":209},{"kind":"lifted-func","name":"kh-contact-card","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-contact-card","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"kh-ingest-contact","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#kh-ingest-contact","space":"func"}},"options":65,"type":210},{"kind":"lifted-func","name":"init-store","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#init-store","space":"func"}},"options":69,"type":211},{"kind":"lifted-func","name":"ensure-bucket","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#ensure-bucket","space":"func"}},"options":66,"type":212},{"kind":"lifted-func","name":"store-grant","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#store-grant","space":"func"}},"options":68,"type":213},{"kind":"lifted-func","name":"store-revoke","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#store-revoke","space":"func"}},"options":68,"type":214},{"kind":"lifted-func","name":"bucket-flush","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#bucket-flush","space":"func"}},"options":65,"type":215},{"kind":"lifted-func","name":"bucket-pull","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#bucket-pull","space":"func"}},"options":70,"type":216},{"kind":"lifted-func","name":"identity-export","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#identity-export","space":"func"}},"options":71,"type":217},{"kind":"lifted-func","name":"identity-import","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#identity-import","space":"func"}},"options":71,"type":218},{"kind":"lifted-func","name":"iroh-bind","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#iroh-bind","space":"func"}},"options":65,"type":219},{"kind":"lifted-func","name":"iroh-start","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#iroh-start","space":"func"}},"options":70,"type":220},{"kind":"lifted-func","name":"conn-status","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#conn-status","space":"func"}},"options":64,"type":221},{"kind":"lifted-func","name":"sync-start","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#sync-start","space":"func"}},"options":72,"type":222},{"kind":"lifted-func","name":"sync-status","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#sync-status","space":"func"}},"options":64,"type":223},{"kind":"lifted-func","name":"create-partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#create-partition","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"seal-partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#seal-partition","space":"func"}},"options":65,"type":224},{"kind":"lifted-func","name":"adopt-partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#adopt-partition","space":"func"}},"options":65,"type":224},{"kind":"lifted-func","name":"chunk-stats","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#chunk-stats","space":"func"}},"options":65,"type":225},{"kind":"lifted-func","name":"stats","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph:engine-spike/driver@0.1.0#stats","space":"func"}},"options":66,"type":226}]},{"kind":"instance","name":"polymorph-data:tasks/tasks@0.1.0","exports":[{"kind":"type","name":"todo-item","type":{"kind":"value","type":227}},{"kind":"type","name":"snapshot","type":{"kind":"value","type":228}},{"kind":"lifted-func","name":"partition","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#partition","space":"func"}},"options":66,"type":203},{"kind":"lifted-func","name":"revision","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#revision","space":"func"}},"options":66,"type":229},{"kind":"lifted-func","name":"items","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#items","space":"func"}},"options":66,"type":230},{"kind":"lifted-func","name":"add","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#add","space":"func"}},"options":65,"type":231},{"kind":"lifted-func","name":"set-completed","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#set-completed","space":"func"}},"options":73,"type":232},{"kind":"lifted-func","name":"set-title","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#set-title","space":"func"}},"options":68,"type":233},{"kind":"lifted-func","name":"remove","coreDef":{"kind":"export","instance":8,"item":{"name":"[async-lift]polymorph-data:tasks/tasks@0.1.0#remove","space":"func"}},"options":65,"type":234}]}],"worldDigest":"sha256:5da66d4723abf415e4a9a9574cb3f8066f4bcd451dc3dfede50de38e0052beab"},"adapters":[{"file":"adapters/10.wasm","wasm":"AGFzbQEAAAABGgVgAX8Bf2ABfwBgA39/fwBgA39/fwF/YAAAAsUBCQVmbGFncwlpbnN0YW5jZTEDfwEFZmxhZ3MJaW5zdGFuY2U4A38BBmNhbGxlZQhhZGFwdGVyMAAAB3J1bnRpbWUEdHJhcAABCGluc3RhbmNlDnRhc2tfbWF5X2Jsb2NrA38BBWFzeW5jD2VudGVyLXN5bmMtY2FsbAACCHJlc291cmNlD3RyYW5zZmVyLWJvcnJvdwADBWFzeW5jDmV4aXQtc3luYy1jYWxsAAQIcmVzb3VyY2UMdHJhbnNmZXItb3duAAMDAgEABwwBCGFkYXB0ZXIwAAYKZwFlAQN/An8CQB9/AQIAAkAjASIBDQBBFxABAAsjAiECQQAkAkEIQQBBARACIwAhA0EAJAAgAEHJAEEdEAMgAyQAEAAhAxAEQQAkASADQRtByAAQBSABJAEgAiQCCwwBC0ExEAEACws="},{"file":"adapters/11.wasm","wasm":"AGFzbQEAAAABtQEVYAR/f39/AX9gA39/fwBgAX8AYAN/f38Bf2AAAGABfwF/YAJ/fwBgAn9/AX9gAn9/An9/YAV/f39/fwBgBHB/f38Bf2ALcHB/f39/f39/f38AYApwcH9/f39/f39/AGAHf39/f39/fwF/YAF/B39/f39/f39gA39/fwN/f39gDHBwf39/f39/f39/fwBgCH9/f39/f39/AX9gAX8If39/f39/f39gAAF/YAlwcH9/f39/f38AArwILwVmbGFncwlpbnN0YW5jZTEDfwEGbWVtb3J5Am0wAgAAB3JlYWxsb2MCZjAAAAVmbGFncwlpbnN0YW5jZTgDfwEGbWVtb3J5Am0xAgAABmNhbGxlZQhhZGFwdGVyMQABB3J1bnRpbWUEdHJhcAACCGluc3RhbmNlDnRhc2tfbWF5X2Jsb2NrA38BBWFzeW5jD2VudGVyLXN5bmMtY2FsbAABCHJlc291cmNlD3RyYW5zZmVyLWJvcnJvdwADBWFzeW5jDmV4aXQtc3luYy1jYWxsAAQGY2FsbGVlCGFkYXB0ZXIyAAEJdHJhbnNjb2RlG3V0ZjgtdG8tdXRmOCAobWVtMSA9PiBtZW0wKQABB3JlYWxsb2MCZjgAAAZjYWxsZWUIYWRhcHRlcjMABQtwb3N0X3JldHVybghhZGFwdGVyMwACBmNhbGxlZQhhZGFwdGVyNAAFC3Bvc3RfcmV0dXJuCGFkYXB0ZXI0AAIJdHJhbnNjb2RlG3V0ZjgtdG8tdXRmOCAobWVtMCA9PiBtZW0xKQABCGNhbGxiYWNrA2YxNAADBmNhbGxlZQhhZGFwdGVyNQAHBWFzeW5jFFtzdGFydC1jYWxsXWFkYXB0ZXI1AAoEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI1AAsGY2FsbGVlCGFkYXB0ZXI2AAUIcmVzb3VyY2UMdHJhbnNmZXItb3duAAMEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI2AAwGY2FsbGVlCGFkYXB0ZXI3AA0Ec3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI3AAwGY2FsbGVlCGFkYXB0ZXI4AAUEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI4AAwGY2FsbGVlCGFkYXB0ZXI5AAUEc3luYxZbcHJlcGFyZS1jYWxsXWFkYXB0ZXI5AAwGY2FsbGVlCWFkYXB0ZXIxMAAFBHN5bmMXW3ByZXBhcmUtY2FsbF1hZGFwdGVyMTAADAZjYWxsZWUJYWRhcHRlcjExAAMEc3luYxdbcHJlcGFyZS1jYWxsXWFkYXB0ZXIxMQAQBWZsYWdzCWluc3RhbmNlNgN/AQZtZW1vcnkCbTICAAAHcmVhbGxvYwNmMzEAAAhjYWxsYmFjawNmMzIAAwZjYWxsZWUJYWRhcHRlcjEyABEJdHJhbnNjb2RlG3V0ZjgtdG8tdXRmOCAobWVtMSA9PiBtZW0yKQABCXRyYW5zY29kZRt1dGY4LXRvLXV0ZjggKG1lbTIgPT4gbWVtMSkAAQVhc3luYxVbc3RhcnQtY2FsbF1hZGFwdGVyMTIACgRzeW5jF1twcmVwYXJlLWNhbGxdYWRhcHRlcjEyAAwGY2FsbGVlCWFkYXB0ZXIxMwATBHN5bmMXW3ByZXBhcmUtY2FsbF1hZGFwdGVyMTMAFAMgHwEBBgYICQMFCQcOCQcFCQcFCQcFCQcPCQASCQcECQUHzAYoCGFkYXB0ZXIxACgIYWRhcHRlcjIAKQhhZGFwdGVyMwAqCGFkYXB0ZXI0ACsVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI1ACwWW2FzeW5jLXJldHVybl1hZGFwdGVyNQAtCGFkYXB0ZXI1AC4VW2FzeW5jLXN0YXJ0XWFkYXB0ZXI2AC8WW2FzeW5jLXJldHVybl1hZGFwdGVyNgAwCGFkYXB0ZXI2ADEVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI3ADIWW2FzeW5jLXJldHVybl1hZGFwdGVyNwAzCGFkYXB0ZXI3ADQVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI4ADUWW2FzeW5jLXJldHVybl1hZGFwdGVyOAA2CGFkYXB0ZXI4ADcVW2FzeW5jLXN0YXJ0XWFkYXB0ZXI5ADgWW2FzeW5jLXJldHVybl1hZGFwdGVyOQA5CGFkYXB0ZXI5ADoWW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMAA7F1thc3luYy1yZXR1cm5dYWRhcHRlcjEwADwJYWRhcHRlcjEwAD0WW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMQA+F1thc3luYy1yZXR1cm5dYWRhcHRlcjExAD8JYWRhcHRlcjExAEAWW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMgBBF1thc3luYy1yZXR1cm5dYWRhcHRlcjEyAEIJYWRhcHRlcjEyAEMWW2FzeW5jLXN0YXJ0XWFkYXB0ZXIxMwBEF1thc3luYy1yZXR1cm5dYWRhcHRlcjEzAEUJYWRhcHRlcjEzAEYYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI1AA8YW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI2ABIYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI3ABUYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI4ABcYW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXI5ABkZW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXIxMAAbGVthZGFwdGVyLWNhbGxlZV1hZGFwdGVyMTEAHRlbYWRhcHRlci1jYWxsZWVdYWRhcHRlcjEyACEZW2FkYXB0ZXItY2FsbGVlXWFkYXB0ZXIxMwAmCvhQH+cBAQl/AkACQB9AAQIAAkAjASIDDQBBFxACAAsjAiEEQQAkAkEIQQBBARADIwAhBUEAJAAgAEHIAEEbEAQgASACIQYhByAGIQggCCEJAkACQD8BrUIQhiAHrSAIrXxaDQELQR8QAgALQQBBAEEBIAkQACEKAkACQD8ArUIQhiAKrSAJrXxaDQELQR8QAgALAkAgBiIJRQ0AIAchCCAKIQsDQCALIAgtQAEAOgAAIAhBAWohCCALQQFqIQsgCUF/aiIJDQALCyAKIAYgBSQAEAEQBUEAJAEgAyQBIAQkAgsMAQtBMRACAAsLxwEBCH8CQAJAH0ABAgACQCMBIgMNAEEXEAIACyMCIQRBACQCQQhBAEEBEAMjACEFQQAkACAAQcgAQRsQBCABIAIhBiEHAkACQD8BrUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAAIQoCQAJAPwCtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQByAKIAggBSQAEAYQBUEAJAEgAyQBIAQkAgsMAQtBMRACAAsLzwIBCX8CQAJAH0ABAgACQCMBIgINAEEXEAIACyMCIQNBACQCQQhBAEEBEAMjACEEQQAkACAAQc0AQRwQBCAEJAAQCSEEEAVBACQBIARBA3EEQEEhEAIACwJAAkA/AK1CEIYgBK1BCK18Wg0BC0EBEAIACyABQQNxBEBBIRACAAsCQAJAPwGtQhCGIAGtQQitfFoNAQtBARACAAsgBCgCACAEKAIEIQUhBiAFIQcgByEIAkACQD8ArUIQhiAGrSAHrXxaDQELQR8QAgALQQBBAEEBIAgQCCEJAkACQD8BrUIQhiAJrSAIrXxaDQELQR8QAgALAkAgBSIIRQ0AIAYhByAJIQoDQCAKIActAAA6QAEAIAdBAWohByAKQQFqIQogCEF/aiIIDQALCyABIAk2QgEAIAEgBTZCAQQgAiQBIAQQCiADJAILDAELQTEQAgALC7AGAQh/AkACQB9AAQIAAkAjASICDQBBFxACAAsjAiEDQQAkAkEIQQBBARADIwAhBEEAJAAgAEHKAEEZEAQgBCQAEAshBBAFQQAkASAEQQNxBEBBIRACAAsCQAJAPwCtQhCGIAStQRCtfFoNAQtBARACAAsgAUEDcQRAQSEQAgALAkACQD8BrUIQhiABrUEQrXxaDQELQQEQAgALAkACQAJAAkAgBC0AAA4CAQIAC0EgEAIACyABQQA6QAEADAELIAFBATpAAQACQAJAAkACQAJAAkACQCAELQAEDgUBAgMEBQALQSAQAgALIAFBADpAAQQMBAsgAUEBOkABBCAEKAIIIAQoAgwhBSEGAkACQD8ArUIQhiAGrSAFrXxaDQELQR4QAgALIAVB/////wdLBEBBHhACAAsgBSIHIQhBAEEAQQEgCBAIIQkCQAJAPwGtQhCGIAmtIAitfFoNAQtBHhACAAsgBiAFIAkQDSABIAk2QgEIIAEgBzZCAQwMAwsgAUECOkABBCAEKAIIIAQoAgwhByEJAkACQD8ArUIQhiAJrSAHrXxaDQELQR4QAgALIAdB/////wdLBEBBHhACAAsgByIFIQZBAEEAQQEgBhAIIQgCQAJAPwGtQhCGIAitIAatfFoNAQtBHhACAAsgCSAHIAgQDSABIAg2QgEIIAEgBTZCAQwMAgsgAUEDOkABBCAEKAIIIAQoAgwhBSEIAkACQD8ArUIQhiAIrSAFrXxaDQELQR4QAgALIAVB/////wdLBEBBHhACAAsgBSIHIQlBAEEAQQEgCRAIIQYCQAJAPwGtQhCGIAatIAmtfFoNAQtBHhACAAsgCCAFIAYQDSABIAY2QgEIIAEgBzZCAQwMAQsgAUEEOkABBCAEKAIIIAQoAgwhByEGAkACQD8ArUIQhiAGrSAHrXxaDQELQR4QAgALIAdB/////wdLBEBBHhACAAsgByIFIQhBAEEAQQEgCBAIIQkCQAJAPwGtQhCGIAmtIAitfFoNAQtBHhACAAsgBiAHIAkQDSABIAk2QgEIIAEgBTZCAQwLCyACJAEgBBAMIAMkAgsMAQtBMRACAAsLGwEBfyMAIQJBACQAIABBywBBGhAEIAEgAiQAC90GAQd/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAAkACQAJAAkAgAQ4CAQIAC0EgEAIACyAEQQA6QAEEDAELIARBATpAAQQgAiADIQYhByAGIQggCCEJAkACQD8ArUIQhiAHrSAIrXxaDQELQR8QAgALQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR8QAgALAkAgBiIJRQ0AIAchCCAKIQsDQCALIAgtAAA6QAEAIAhBAWohCCALQQFqIQsgCUF/aiIJDQALCyAEIAo2QgEIIAQgBjZCAQwLDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhCiEHAkACQD8ArUIQhiAHrSAKrXxaDQELQR4QAgALIApB/////wdLBEBBHhACAAsgCiIGIQlBAEEAQQEgCRAIIQgCQAJAPwGtQhCGIAitIAmtfFoNAQtBHhACAAsgByAKIAgQDSAEIAg2QgEIIAQgBjZCAQwMAwsgBEECOkABBCACIAMhBiEIAkACQD8ArUIQhiAIrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIKIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCCAGIAkQDSAEIAk2QgEIIAQgCjZCAQwMAgsgBEEDOkABBCACIAMhCiEJAkACQD8ArUIQhiAJrSAKrXxaDQELQR4QAgALIApB/////wdLBEBBHhACAAsgCiIGIQhBAEEAQQEgCBAIIQcCQAJAPwGtQhCGIAetIAitfFoNAQtBHhACAAsgCSAKIAcQDSAEIAc2QgEIIAQgBjZCAQwMAQsgBEEEOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIKIQlBAEEAQQEgCRAIIQgCQAJAPwGtQhCGIAitIAmtfFoNAQtBHhACAAsgByAGIAgQDSAEIAg2QgEIIAQgCjZCAQwLCyAFJAELJQDSLNItQQhBAUH/AEEBQQBBfiAAIAEgAhAR0g9BAkEBQQEQEAsZAQF/IwAhAUEAJAAgAEHIAEEbEBMgASQAC6kFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUEcQc0AEBM2QgEEDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELIwDSL9IwQQhBAUH9AEEBQQBBfiAAIAEQFNISQQFBAUEBEBALngkDB38BfgZ/IwAhAUEAJAAgAEEDcQRAQSEQAgALAkACQD8BrUIQhiAArUEcrXxaDQELQQEQAgALIAAoQgEAQc0AQRwQBCAAKEIBBCAAKEIBCCECIQMgAiEEIAQhBQJAAkA/Aa1CEIYgA60gBK18Wg0BC0EfEAIAC0EAQQBBASAFEAAhBgJAAkA/AK1CEIYgBq0gBa18Wg0BC0EfEAIACwJAIAIiBUUNACADIQQgBiEHA0AgByAELUABADoAACAEQQFqIQQgB0EBaiEHIAVBf2oiBQ0ACwsgBiACIAAoQgEMIAAoQgEQIQYhAwJAAkAgBq1CGH4iCEIgiFANAQtBHxACAAsgCKchAiACIQUgA0EHcQRAQSEQAgALAkACQD8BrUIQhiADrSACrXxaDQELQR8QAgALQQBBAEEIIAUQACEEIARBB3EEQEEhEAIACwJAAkA/AK1CEIYgBK0gBa18Wg0BC0EfEAIACwJAIAYiBUUNACADIQIgBCEHA0ACQAJAAkACQAJAAkAgAi1AAQAOBAECAwQAC0EgEAIACyAHQQA6AAAgAihCAQggAihCAQwhCSEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAlB/////wdLBEBBHhACAAsgCSILIQxBAEEAQQEgDBAAIQ0CQAJAPwCtQhCGIA2tIAytfFoNAQtBHhACAAsgCiAJIA0QByAHIA02AgggByALNgIMDAMLIAdBAToAACACKEIBCCACKEIBDCELIQ0CQAJAPwGtQhCGIA2tIAutfFoNAQtBHhACAAsgC0H/////B0sEQEEeEAIACyALIgkhCkEAQQBBASAKEAAhDAJAAkA/AK1CEIYgDK0gCq18Wg0BC0EeEAIACyANIAsgDBAHIAcgDDYCCCAHIAk2AgwMAgsgB0ECOgAAIAIoQgEIIAIoQgEMIQkhDAJAAkA/Aa1CEIYgDK0gCa18Wg0BC0EeEAIACyAJQf////8HSwRAQR4QAgALIAkiCyENQQBBAEEBIA0QACEKAkACQD8ArUIQhiAKrSANrXxaDQELQR4QAgALIAwgCSAKEAcgByAKNgIIIAcgCzYCDAwBCyAHQQM6AAAgByACKUMBCDcDCCACKEIBECACKEIBFCELIQogCyEJIAkhDAJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EfEAIAC0EAQQBBASAMEAAhDQJAAkA/AK1CEIYgDa0gDK18Wg0BC0EfEAIACwJAIAsiDEUNACAKIQkgDSEOA0AgDiAJLUABADoAACAJQQFqIQkgDkEBaiEOIAxBf2oiDA0ACwsgByANNgIQIAcgCzYCFAsgAkEYaiECIAdBGGohByAFQX9qIgUNAAsLIAQgBiAAKEIBFCAAKEIBGCEEIQMgBCEGIAYhBQJAAkA/Aa1CEIYgA60gBq18Wg0BC0EfEAIAC0EAQQBBASAFEAAhAgJAAkA/AK1CEIYgAq0gBa18Wg0BC0EfEAIACwJAIAQiBUUNACADIQYgAiEHA0AgByAGLUABADoAACAGQQFqIQYgB0EBaiEHIAVBf2oiBQ0ACwsgAiAEIAEkAAupBQEGfyMBIQVBACQBIARBA3EEQEEhEAIACwJAAkA/Aa1CEIYgBK1BEK18Wg0BC0EBEAIACwJAAkACQAJAIAAOAgECAAtBIBACAAsgBEEAOkABACAEIAFBGEHMABATNkIBBAwBCyAEQQE6QAEAAkACQAJAAkACQAJAAkAgAQ4FAQIDBAUAC0EgEAIACyAEQQA6QAEEDAQLIARBATpAAQQgAiADIQYhBwJAAkA/AK1CEIYgB60gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgBiAKEA0gBCAKNkIBCCAEIAg2QgEMDAMLIARBAjpAAQQgAiADIQghCgJAAkA/AK1CEIYgCq0gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEHQQBBAEEBIAcQCCEJAkACQD8BrUIQhiAJrSAHrXxaDQELQR4QAgALIAogCCAJEA0gBCAJNkIBCCAEIAY2QgEMDAILIARBAzpAAQQgAiADIQYhCQJAAkA/AK1CEIYgCa0gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEKQQBBAEEBIAoQCCEHAkACQD8BrUIQhiAHrSAKrXxaDQELQR4QAgALIAkgBiAHEA0gBCAHNkIBCCAEIAg2QgEMDAELIARBBDpAAQQgAiADIQghBwJAAkA/AK1CEIYgB60gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgCCAKEA0gBCAKNkIBCCAEIAY2QgEMCwsgBSQBCyMA0jLSM0EIQQFB/gBBAUEAQX4gACABEBbSFUEHQQFBARAQCxkBAX8jACEBQQAkACAAQc0AQRwQBCABJAALqQUBBn8jASEFQQAkASAEQQNxBEBBIRACAAsCQAJAPwGtQhCGIAStQRCtfFoNAQtBARACAAsCQAJAAkACQCAADgIBAgALQSAQAgALIARBADpAAQAgBCABQRhBzAAQEzZCAQQMAQsgBEEBOkABAAJAAkACQAJAAkACQAJAIAEOBQECAwQFAAtBIBACAAsgBEEAOkABBAwECyAEQQE6QAEEIAIgAyEGIQcCQAJAPwCtQhCGIAetIAatfFoNAQtBHhACAAsgBkH/////B0sEQEEeEAIACyAGIgghCUEAQQBBASAJEAghCgJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EeEAIACyAHIAYgChANIAQgCjZCAQggBCAINkIBDAwDCyAEQQI6QAEEIAIgAyEIIQoCQAJAPwCtQhCGIAqtIAitfFoNAQtBHhACAAsgCEH/////B0sEQEEeEAIACyAIIgYhB0EAQQBBASAHEAghCQJAAkA/Aa1CEIYgCa0gB618Wg0BC0EeEAIACyAKIAggCRANIAQgCTZCAQggBCAGNkIBDAwCCyAEQQM6QAEEIAIgAyEGIQkCQAJAPwCtQhCGIAmtIAatfFoNAQtBHhACAAsgBkH/////B0sEQEEeEAIACyAGIgghCkEAQQBBASAKEAghBwJAAkA/Aa1CEIYgB60gCq18Wg0BC0EeEAIACyAJIAYgBxANIAQgBzZCAQggBCAINkIBDAwBCyAEQQQ6QAEEIAIgAyEIIQcCQAJAPwCtQhCGIAetIAitfFoNAQtBHhACAAsgCEH/////B0sEQEEeEAIACyAIIgYhCUEAQQBBASAJEAghCgJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EeEAIACyAHIAggChANIAQgCjZCAQggBCAGNkIBDAsLIAUkAQsjANI10jZBCEEBQf4AQQFBAEF+IAAgARAY0hdBAUEBQQEQEAsZAQF/IwAhAUEAJAAgAEHMAEEYEAQgASQAC7gFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUEZQcoAEBM2QgEEIAQgAkEaQcsAEBM2QgEIDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELIwDSONI5QQhBAUGCAUEBQQBBfiAAIAEQGtIZQQFBAUEBEBALGQEBfyMAIQFBACQAIABBzABBGBAEIAEkAAu4BQEGfyMBIQVBACQBIARBA3EEQEEhEAIACwJAAkA/Aa1CEIYgBK1BEK18Wg0BC0EBEAIACwJAAkACQAJAIAAOAgECAAtBIBACAAsgBEEAOkABACAEIAFBGUHKABATNkIBBCAEIAJBGkHLABATNkIBCAwBCyAEQQE6QAEAAkACQAJAAkACQAJAAkAgAQ4FAQIDBAUAC0EgEAIACyAEQQA6QAEEDAQLIARBATpAAQQgAiADIQYhBwJAAkA/AK1CEIYgB60gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgBiAKEA0gBCAKNkIBCCAEIAg2QgEMDAMLIARBAjpAAQQgAiADIQghCgJAAkA/AK1CEIYgCq0gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEHQQBBAEEBIAcQCCEJAkACQD8BrUIQhiAJrSAHrXxaDQELQR4QAgALIAogCCAJEA0gBCAJNkIBCCAEIAY2QgEMDAILIARBAzpAAQQgAiADIQYhCQJAAkA/AK1CEIYgCa0gBq18Wg0BC0EeEAIACyAGQf////8HSwRAQR4QAgALIAYiCCEKQQBBAEEBIAoQCCEHAkACQD8BrUIQhiAHrSAKrXxaDQELQR4QAgALIAkgBiAHEA0gBCAHNkIBCCAEIAg2QgEMDAELIARBBDpAAQQgAiADIQghBwJAAkA/AK1CEIYgB60gCK18Wg0BC0EeEAIACyAIQf////8HSwRAQR4QAgALIAgiBiEJQQBBAEEBIAkQCCEKAkACQD8BrUIQhiAKrSAJrXxaDQELQR4QAgALIAcgCCAKEA0gBCAKNkIBCCAEIAY2QgEMCwsgBSQBCyMA0jvSPEEIQQFBggFBAUEAQX4gACABEBzSG0EBQQFBARAQC6YBAQd/IwAhA0EAJAAgAEHKAEEZEAQgASACIQQhBSAEIQYgBiEHAkACQD8BrUIQhiAFrSAGrXxaDQELQR8QAgALQQBBAEEBIAcQACEIAkACQD8ArUIQhiAIrSAHrXxaDQELQR8QAgALAkAgBCIHRQ0AIAUhBiAIIQkDQCAJIAYtQAEAOgAAIAZBAWohBiAJQQFqIQkgB0F/aiIHDQALCyAIIAQgAyQAC5oFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEADAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELJwDSPtI/QQhBAUGAAUEBQQBBfiAAIAEgAiADEB7SHUEDQQFBARAQC/wGAwZ/AX4GfyMDIQFBACQDIABBA3EEQEEhEAIACwJAAkA/Aa1CEIYgAK1BIK18Wg0BC0EBEAIACyAAKEIBACAAKEIBBCECIQMCQAJAPwGtQhCGIAOtIAKtfFoNAQtBHhACAAsgAkH/////B0sEQEEeEAIACyACIgQhBUEAQQBBASAFEB8hBgJAAkA/Aq1CEIYgBq0gBa18Wg0BC0EeEAIACyADIAIgBhAiIAYgBCAAKEIBCCAAKEIBDCEEIQYCQAJAPwGtQhCGIAatIAStfFoNAQtBHhACAAsgBEH/////B0sEQEEeEAIACyAEIgIhA0EAQQBBASADEB8hBQJAAkA/Aq1CEIYgBa0gA618Wg0BC0EeEAIACyAGIAQgBRAiIAUgAiAAKEIBECAAKEIBFCECIQUCQAJAIAKtQhB+IgdCIIhQDQELQR8QAgALIAenIQQgBCEGIAVBA3EEQEEhEAIACwJAAkA/Aa1CEIYgBa0gBK18Wg0BC0EfEAIAC0EAQQBBBCAGEB8hAyADQQNxBEBBIRACAAsCQAJAPwKtQhCGIAOtIAatfFoNAQtBHxACAAsCQCACIgZFDQAgBSEEIAMhCANAIAQoQgEAIAQoQgEEIQkhCgJAAkA/Aa1CEIYgCq0gCa18Wg0BC0EeEAIACyAJQf////8HSwRAQR4QAgALIAkiCyEMQQBBAEEBIAwQHyENAkACQD8CrUIQhiANrSAMrXxaDQELQR4QAgALIAogCSANECIgCCANNkICACAIIAs2QgIEIAQoQgEIIAQoQgEMIQshDQJAAkA/Aa1CEIYgDa0gC618Wg0BC0EeEAIACyALQf////8HSwRAQR4QAgALIAsiCSEKQQBBAEEBIAoQHyEMAkACQD8CrUIQhiAMrSAKrXxaDQELQR4QAgALIA0gCyAMECIgCCAMNkICCCAIIAk2QgIMIARBEGohBCAIQRBqIQggBkF/aiIGDQALCyADIAIgAChCARggAChCARwhAyEFIAMhAiACIQYCQAJAPwGtQhCGIAWtIAKtfFoNAQtBHxACAAtBAEEAQQEgBhAfIQQCQAJAPwKtQhCGIAStIAatfFoNAQtBHxACAAsCQCADIgZFDQAgBSECIAQhCANAIAggAi1AAQA6QAIAIAJBAWohAiAIQQFqIQggBkF/aiIGDQALCyAEIAMgASQDC4IDAQd/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUH//wNxO0EBBCACIAMhBiEHIAYhCCAIIQkCQAJAPwKtQhCGIAetIAitfFoNAQtBHxACAAtBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHxACAAsCQCAGIglFDQAgByEIIAohCwNAIAsgCC1AAgA6QAEAIAhBAWohCCALQQFqIQsgCUF/aiIJDQALCyAEIAo2QgEIIAQgBjZCAQwMAQsgBEEBOkABACABIAIhCiEHAkACQD8CrUIQhiAHrSAKrXxaDQELQR4QAgALIApB/////wdLBEBBHhACAAsgCiIGIQlBAEEAQQEgCRAIIQgCQAJAPwGtQhCGIAitIAmtfFoNAQtBHhACAAsgByAKIAgQIyAEIAg2QgEEIAQgBjZCAQgLIAUkAQsjANJB0kJBCEEGQeIBQQFBAEF+IAAgARAl0iFBCEEBQQEQJAsQAQF/IwAhAEEAJAAgACQAC6kFAQZ/IwEhBUEAJAEgBEEDcQRAQSEQAgALAkACQD8BrUIQhiAErUEQrXxaDQELQQEQAgALAkACQAJAAkAgAA4CAQIAC0EgEAIACyAEQQA6QAEAIAQgAUEdQckAEBM2QgEEDAELIARBATpAAQACQAJAAkACQAJAAkACQCABDgUBAgMEBQALQSAQAgALIARBADpAAQQMBAsgBEEBOkABBCACIAMhBiEHAkACQD8ArUIQhiAHrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAGIAoQDSAEIAo2QgEIIAQgCDZCAQwMAwsgBEECOkABBCACIAMhCCEKAkACQD8ArUIQhiAKrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQdBAEEAQQEgBxAIIQkCQAJAPwGtQhCGIAmtIAetfFoNAQtBHhACAAsgCiAIIAkQDSAEIAk2QgEIIAQgBjZCAQwMAgsgBEEDOkABBCACIAMhBiEJAkACQD8ArUIQhiAJrSAGrXxaDQELQR4QAgALIAZB/////wdLBEBBHhACAAsgBiIIIQpBAEEAQQEgChAIIQcCQAJAPwGtQhCGIAetIAqtfFoNAQtBHhACAAsgCSAGIAcQDSAEIAc2QgEIIAQgCDZCAQwMAQsgBEEEOkABBCACIAMhCCEHAkACQD8ArUIQhiAHrSAIrXxaDQELQR4QAgALIAhB/////wdLBEBBHhACAAsgCCIGIQlBAEEAQQEgCRAIIQoCQAJAPwGtQhCGIAqtIAmtfFoNAQtBHhACAAsgByAIIAoQDSAEIAo2QgEIIAQgBjZCAQwLCyAFJAELIQDSRNJFQQhBAUGPAUEBQQBBfiAAECfSJkEAQQFBARAQCw=="}]} \ No newline at end of file diff --git a/docs/spike-demo/index.html b/docs/spike-demo/index.html index 3a54967..676274f 100644 --- a/docs/spike-demo/index.html +++ b/docs/spike-demo/index.html @@ -101,6 +101,11 @@

Alice — tablet no connections, your bucket only

- + + + diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..036b899 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# Sibling checkouts and pinned tools for building the demo site — the +# single source of truth shared by local developers and CI (the same +# shape as polymorph-iroh's scripts/setup.sh). +# +# The demo's deno.json resolves the deltic ports through SIBLING paths +# (../../../polymorph-*), so the checkouts must sit next to this repo. +# Idempotent: existing checkouts are fetched and pinned, never clobbered. +# +# Environment: +# SIBLINGS_DIR where sibling repos live (default: the parent dir) +# WASM_TOOLS_VERSION wasm-tools version (default below) +# WAC_VERSION wac-cli version (default below) +# JUST_VERSION just version (default below) +# SKIP_TOOLS=1 skip tool installation (they are already present) +set -euo pipefail +cd "$(dirname "$0")/.." +REPO_ROOT="$(pwd)" + +SIBLINGS_DIR="${SIBLINGS_DIR:-$(cd .. && pwd)}" +WASM_TOOLS_VERSION="${WASM_TOOLS_VERSION:-1.247.0}" +WAC_VERSION="${WAC_VERSION:-0.10.1}" +JUST_VERSION="${JUST_VERSION:-1.54.0}" + +# Pinned to the revisions the demo was last verified against. Bumping one +# is a deliberate act: the deltic ports carry embedder conventions that +# have already broken this demo once (see spikes/demo/README.md). +IROH_REPO=https://github.com/polymorph-components/polymorph-iroh.git +IROH_PIN=1808cccc437fd2eafe66003e3c0b00518fb94f78 +WEBCRYPTO_REPO=https://github.com/polymorph-components/polymorph-webcrypto.git +WEBCRYPTO_PIN=b13d25230d34bbb65ba657be906fd59151a201f7 +WEBRTC_REPO=https://github.com/polymorph-components/polymorph-webrtc-datachannels.git +WEBRTC_PIN=8a8347766df9035747fb87f85f13eee16c14c1f4 + +log() { printf '\n==> %s\n' "$1"; } + +pin_repo() { # url pin dir + local url="$1" pin="$2" dir="$3" + if [ ! -d "$dir/.git" ]; then + log "Cloning $(basename "$dir")" + git clone --filter=blob:none "$url" "$dir" + fi + if ! git -C "$dir" cat-file -e "$pin^{commit}" 2>/dev/null; then + git -C "$dir" fetch --filter=blob:none origin + fi + log "Pinning $(basename "$dir") at ${pin:0:12}" + git -C "$dir" checkout --quiet --detach "$pin" +} + +mkdir -p "$SIBLINGS_DIR" +pin_repo "$IROH_REPO" "$IROH_PIN" "$SIBLINGS_DIR/polymorph-iroh" +pin_repo "$WEBCRYPTO_REPO" "$WEBCRYPTO_PIN" "$SIBLINGS_DIR/polymorph-webcrypto" +pin_repo "$WEBRTC_REPO" "$WEBRTC_PIN" "$SIBLINGS_DIR/polymorph-webrtc-datachannels" + +if [ "${SKIP_TOOLS:-0}" != "1" ]; then + log "Installing pinned Rust toolchain (rust-toolchain.toml) and wasm targets" + (cd "$REPO_ROOT/spikes/tasks-engine" && (rustup show active-toolchain >/dev/null 2>&1 || rustup toolchain install)) + # The engine + fetcher are wasip2 (pinned by rust-toolchain.toml); the + # app and panel guests are plain wasm32-unknown-unknown and carry no + # toolchain file, so that target is added explicitly. + rustup target add wasm32-unknown-unknown + + for tool in "wasm-tools@$WASM_TOOLS_VERSION" "wac-cli@$WAC_VERSION" "just@$JUST_VERSION"; do + name="${tool%@*}" + if command -v "${name/wac-cli/wac}" >/dev/null 2>&1; then + log "${name} already present" + else + log "Installing ${tool}" + cargo install --locked "${name}" --version "${tool#*@}" + fi + done +fi + +# polymorph-iroh vendors its own dependencies (a TLS profile crate among +# them) through its setup script, so a fresh clone cannot build the +# endpoint until that has run. Defer to its contract rather than +# reimplementing it here; it is idempotent. +log "Running polymorph-iroh's own setup (its vendored deps)" +(cd "$SIBLINGS_DIR/polymorph-iroh" && ./scripts/setup.sh) + +log "Building the iroh endpoint component (the demo composite plugs it)" +(cd "$SIBLINGS_DIR/polymorph-iroh" && cargo build -p iroh-endpoint --target wasm32-wasip2 --release) + +log "Setup complete. Siblings in $SIBLINGS_DIR" diff --git a/spikes/demo/README.md b/spikes/demo/README.md index 6163895..16d9870 100644 --- a/spikes/demo/README.md +++ b/spikes/demo/README.md @@ -92,6 +92,24 @@ per pane (×3, one browser page): `kh-knows-agent(doc)` → subscriptions → bucket grant/flush → tablet cold boot → apps mounted. +## Deployment + +The hosted build is **continuously deployed**: `.github/workflows/pages.yml` +runs `scripts/setup.sh` (sibling ports pinned by commit, toolchain from +`rust-toolchain.toml`, `wasm-tools`/`wac`/`just` pinned), builds the site +from source on every push, and deploys `docs/` to Pages from `main`. PRs +build the site too but do not deploy — a broken demo fails the PR +instead of the site. + +`docs/spike-demo/` is **still committed for now** — the cutover order is +in the workflow header: prove the Actions build, switch the Pages source +to GitHub Actions, and only then stop committing the artifacts (four +rebuilds of an ~11 MB engine composite are already in history). Deleting +them first would take the live demo offline for the length of the gap. +`just pages` writes the same tree locally for preview. Bumping a sibling +pin in `scripts/setup.sh` is deliberate: those ports carry embedder +conventions that have broken this demo before. + ## Run it ``` @@ -119,6 +137,19 @@ Headless bring-up phases (`just bringup solo|wire|bucket`) retire the platform layers one at a time under Deno; `wire soak` runs a 30 s post-revocation stress loop. +Memory/backpressure probes (added while chasing a reported lockup): + +```sh +deno run -A host/leak-probe.ts 90 pulls # engines + live subscriptions, RSS +deno run -A host/table-probe.ts # 400 pulls, guest table sizes + RSS +deno run -A host/cdp-heap.ts 300 # real headless Chromium heap via CDP +``` + +`cdp-heap.ts` needs a Chromium binary (`CHROME=…`, or the Playwright +cache default) and forces a GC at the end — the only reading that +separates retention from uncollected garbage. In-page, `__demo.health()` +reports background queue depth and per-timer skip counts. + ## Findings - **deltic 0.1.0 renamed the embedder conventions** (`WitError` → @@ -169,6 +200,76 @@ post-revocation stress loop. (stats stand down). Worth carrying into the framework's chrome: a status surface that mixes ambient telemetry with consequential one-shot messages needs priority, not last-writer-wins. +- **A bare transport error is undiagnosable, and one of them killed the + whole setup.** A live run failed with + `fetch: send: ErrorCode::InternalError(Some("NetworkError…"))` — no + method, no host, no operation — after ~20 s of a single + "configuring storage…" line. Three fixes, all in this commit: every + provider request **names itself** in transport errors + (`PUT host/path: transport failed after 3 attempts: …`); transport + failures (never statuses — 429/5xx go to the caller untouched) **retry + up to 3×**, which is safe because every provider call here is + idempotent by construction; and setup **announces each step** + (`configuring storage: grant: bob (pickup link)…`), so a failure says + *which* of the ~20 sequential calls died and the remaining message is + actionable advice rather than "check endpoint + CORS". +- **A duplicate "Save & connect" re-ran the entire setup**, re-minting + container links and republishing pickups under the first run. The + guard's placement is the subtle part: the background chain serializes + work, so a flag checked *inside* the job always finds the previous run + finished — it has to be claimed **synchronously at call time**. + (Verified by driving two calls in one tick; the second is refused.) +- **Unversioned assets served returning visitors a stale bundle.** The + page loaded `demo.js` by bare name, so a rebuilt demo kept running the + cached script against fresh components — it cost an hour of chasing a + fix that was already deployed. The build now stamps a mutable root + (`` + `demo.js?v=…`) and artifacts inherit the + stamp: NOTES §Release integrity's bootloader shape in miniature, and + the thing that makes a Pages republish actually take effect. +- **Console-generated Dropbox tokens expire in ~4 h**, and the failure + is now legible (`create_folder_v2 …: 401 expired_access_token`). The + OAuth path is the real fix: PKCE with `token_access_type=offline` + returns a refresh token, and the engine refreshes on 401 and retries + once. Paste-a-token remains the dev fallback with a stated cliff. +- **Fixed-rate timers with no in-flight guard were the lockup.** Every + periodic driver — app `poll` (400 ms x 3 panes), reconciliation pulls + (2.5 s), auto bucket-sync (4 s), stats (4 s) — appended to an + unbounded promise chain unconditionally, while the work behind them + routinely outlives the period (consumer-API storage runs 1-3 s/op). + Fixed-rate scheduling + slower-than-period work diverges: the queue + *is* the leak, and user input ends up behind hundreds of pending jobs + (sluggish, then wedged, then dead). All periodic work now **skips a + tick whose predecessor is still running** — correct semantics anyway: + a reconciliation pull is a refresh, not a transaction. Measured with a + 1.5 s/op delay proxy in front of MinIO: **180 ticks skipped in 3 + minutes** (jobs the old code would have queued), background depth + bounded at 3-4, and a UI-path task add still completing in **3 ms** + while storage churns. `__demo.health()` exposes depth + per-timer skip + counts. +- **The "leak" was the queue, plus a measurement artifact — chased to + ground.** After the backpressure fix, growth persisted in the paseo + webview (~1 MB/s, monotonic over 5 minutes), so it was bisected: + 500 driver/tasks calls leak nothing; app polls at 400 ms x 3 for 75 s + are flat; **reconciliation pulls leak** (35 MB / 75 s). Two independent + checks then cleared the engine: `host/table-probe.ts` runs 400 pulls + headless and shows every guest table flat with **RSS plateauing at + ~300 MB**, and a real headless **Chromium via CDP** (`cdp-heap.ts`) + runs the identical page for 150 s — heap sawtooths normally and + **returns to 7.5 MB after a forced GC, net -1.5 MB**. So there is no + leak in the engine, in subduction, or in the deltic browser ports; the + unbounded growth was (a) the queue divergence above, which retains one + closure per queued job, and (b) the paseo webview's own instrumentation + retaining objects (and/or never idling long enough to GC). **Measure + memory in a real browser, not in the automation webview** — the + earlier version of this section blamed the port layer on the strength + of webview numbers, and was wrong. +- **One real leak was found and fixed on the way**: the engine's `syncs` + table inserted a result per sync and never removed it, while + `sync-status` only read it — unbounded by construction at ~48 syncs a + minute. Statuses are one-shot by contract, so the entry is now removed + as it is read, and `stats()` publishes the guest's table sizes + (`tables syncs=… conns=… parts=…`) precisely because a growth bug in + them is invisible from outside the component. - **Panel teardown is a deltic open question** (same one #22 lists for app kill): switching provider tabs clears the region and drops the references, but there is no explicit instance-terminate API — the diff --git a/spikes/demo/host/cdp-heap.ts b/spikes/demo/host/cdp-heap.ts new file mode 100644 index 0000000..a8bf5fe --- /dev/null +++ b/spikes/demo/host/cdp-heap.ts @@ -0,0 +1,102 @@ +// Heap growth in a REAL Chromium (outside paseo's instrumented webview), +// driven over CDP: load the demo, let it boot, then sample +// Runtime.getHeapUsage while the page's own loops run. +// +// deno run -A cdp-heap.ts [--kill-timers] + +const CHROME = Deno.env.get("CHROME") ?? + "/home/lmartin/.cache/ms-playwright/chromium-1234/chrome-linux/chrome"; +const url = Deno.args[0] ?? "http://localhost:8641/control.html"; +const seconds = Number(Deno.args[1] ?? 120); +const killTimers = Deno.args.includes("--kill-timers"); + +const profile = await Deno.makeTempDir({ prefix: "cdp-heap-" }); +const proc = new Deno.Command(CHROME, { + args: [ + "--headless=new", + "--remote-debugging-port=9222", + `--user-data-dir=${profile}`, + "--no-sandbox", + "--disable-dev-shm-usage", + "about:blank", + ], + stdout: "null", + stderr: "null", +}).spawn(); + +const targets = async () => { + for (let i = 0; i < 40; i++) { + try { + const r = await fetch("http://127.0.0.1:9222/json/list"); + if (r.ok) return await r.json(); + } catch { /* not up yet */ } + await new Promise((r) => setTimeout(r, 250)); + } + throw new Error("chromium devtools never came up"); +}; + +const list = await targets(); +const page = list.find((t: { type: string }) => t.type === "page"); +const ws = new WebSocket(page.webSocketDebuggerUrl); +await new Promise((res) => ws.onopen = () => res(null)); + +let id = 0; +const pending = new Map void>(); +ws.onmessage = (ev) => { + const msg = JSON.parse(ev.data); + if (msg.id && pending.has(msg.id)) { + pending.get(msg.id)!(msg.result); + pending.delete(msg.id); + } +}; +const send = (method: string, params: Record = {}) => + new Promise((res) => { + const myId = ++id; + pending.set(myId, res); + ws.send(JSON.stringify({ id: myId, method, params })); + }); + +await send("Runtime.enable"); +await send("Page.enable"); +await send("Page.navigate", { url }); + +const evaluate = async (expr: string) => { + const r = await send("Runtime.evaluate", { + expression: expr, + awaitPromise: true, + returnByValue: true, + }); + return r?.result?.value; +}; + +// Wait for boot. +for (let i = 0; i < 80; i++) { + const banner = await evaluate(`document.getElementById('banner')?.textContent ?? ''`); + if (typeof banner === "string" && banner.includes("ready")) break; + await new Promise((r) => setTimeout(r, 1000)); +} +console.log("booted:", await evaluate(`document.getElementById('banner').textContent`)); + +if (killTimers) { + await evaluate(`(() => { for (let i = 1; i < 20000; i++) clearInterval(i); return 'timers cleared'; })()`); + console.log("page timers cleared"); +} + +const usage = async () => (await send("Runtime.getHeapUsage")).usedSize / 1048576; +const start = await usage(); +console.log(`t=0s used=${start.toFixed(1)}MB`); +for (let t = 15; t <= seconds; t += 15) { + await new Promise((r) => setTimeout(r, 15000)); + const u = await usage(); + console.log(`t=${t}s used=${u.toFixed(1)}MB (${(u - start >= 0 ? "+" : "")}${(u - start).toFixed(1)})`); +} +// Force GC, then read again: separates retention from uncollected garbage. +await send("HeapProfiler.enable"); +await send("HeapProfiler.collectGarbage"); +const afterGc = await usage(); +console.log(`after forced GC: ${afterGc.toFixed(1)}MB (net ${(afterGc - start).toFixed(1)}MB over ${seconds}s)`); + +ws.close(); +proc.kill(); +await proc.status; +await Deno.remove(profile, { recursive: true }).catch(() => {}); diff --git a/spikes/demo/host/demo.ts b/spikes/demo/host/demo.ts index 7344a9b..fa743f5 100644 --- a/spikes/demo/host/demo.ts +++ b/spikes/demo/host/demo.ts @@ -107,13 +107,21 @@ Storage… dialog and is optional for boot.`; // --- artifacts ----------------------------------------------------------------- +/** Build stamp from the page's tiny mutable root; artifacts carry it so a + * cached bundle can never be paired with fresh components (or vice + * versa). Empty in a dev tree that skipped the rewrite. */ +const BUILD = + (document.querySelector('meta[name="pm-build"]') as HTMLMetaElement | null) + ?.content ?? ""; +const stamp = (path: string) => (BUILD && BUILD !== "__BUILD__" ? `${path}?v=${BUILD}` : path); + async function fetchArtifacts(name: string): Promise { const [envelope, bytes] = await Promise.all([ - fetch(`./${name}.plan.json`).then((r) => { + fetch(stamp(`./${name}.plan.json`)).then((r) => { if (!r.ok) throw new Error(`${name} plan: HTTP ${r.status}`); return r.text(); }), - fetch(`./${name}.component.wasm`).then((r) => { + fetch(stamp(`./${name}.component.wasm`)).then((r) => { if (!r.ok) throw new Error(`${name} wasm: HTTP ${r.status}`); return r.arrayBuffer(); }), @@ -287,6 +295,8 @@ interface Pane { id: Uint8Array; runner?: Runner; app?: AppExports; + /** Polls dropped because the previous one was still in flight. */ + pollSkips?: number; status: (line: string, sticky?: boolean) => void; } @@ -341,9 +351,25 @@ async function mountApp(pane: Pane, appArtifacts: EngineArtifacts) { await runner.call(() => app.run()); pane.app = app; pane.runner = runner; - // Remote changes surface as revision bumps; poll on a UI cadence. + // Remote changes surface as revision bumps; poll on a UI cadence — + // but SKIP a tick whose predecessor is still running. `runner.call` + // is an unbounded promise chain, so a poll that outlives its 400 ms + // period (routine while the engine is busy syncing) would otherwise + // append forever: the queue grows, latency grows with it, and the + // page ends up wedged with every tick's closure still retained. + let polling = false; + pane.pollSkips = 0; setInterval(() => { - runner.call(() => app.poll()).catch(() => {}); + if (polling) { + pane.pollSkips!++; + return; + } + polling = true; + runner.call(() => app.poll()) + .catch(() => {}) + .finally(() => { + polling = false; + }); }, 400); } @@ -421,21 +447,46 @@ async function boot() { // itself (a wedged overlap of interval-driven driver calls froze the // page once; recorded). let bg: Promise = Promise.resolve(); + let bgDepth = 0; const enqueue = (f: () => Promise) => { - const next = bg.then(f).catch(() => {}); + bgDepth++; + const next = bg.then(f).catch(() => {}).finally(() => { + bgDepth--; + }); bg = next; return next; }; + /** Periodic work must never QUEUE: if the previous tick is still + * running (consumer-API syncs take seconds, well past these periods), + * appending another job grows the chain without bound — the queue + * itself becomes the leak, and the page dies sluggish-then-locked. + * Ticks are skipped instead, which is the correct semantics anyway: + * a reconciliation pull is a refresh, not a transaction. */ + const periodic = (name: string, everyMs: number, f: () => Promise) => { + let running = false; + let skipped = 0; + setInterval(() => { + if (running) { + skipped++; + return; + } + running = true; + enqueue(f).finally(() => { + running = false; + }); + }, everyMs); + return { name, skips: () => skipped }; + }; // --- controls ------------------------------------------------------------- // Subscriptions carry the realtime path; a background reconciliation // pull bounds any missed push (one in-browser push miss was observed; // recorded as a finding). - setInterval(() => { - enqueue(() => pull(bob.engine, alice.id)); - enqueue(() => pull(alice.engine, bob.id)); - }, 2500); + const reconcile = periodic("reconcile", 2500, async () => { + await pull(bob.engine, alice.id); + await pull(alice.engine, bob.id); + }); // --- the bucket leg: user-configured, activates the tablet --------------- @@ -457,10 +508,36 @@ async function boot() { * collide with a fresh one's. */ const sessionSuffix = () => `/run-${randomHex(4)}`; - const setupBucket = (cfg: StorageConfig) => - enqueue(async () => { + // Storage setup is ~20 sequential provider calls (consumer APIs run + // ~0.5-1.5 s each), so a single "configuring…" line looks wedged for + // half a minute. Each step announces itself instead, and a failure + // says WHICH step died — the engine's transport errors now name the + // request, so the two compose into an actionable message. + // Guard against a SECOND setup while one is in flight. The 20 s + // configure window makes "click Save again" the natural user response, + // and a duplicate run re-mints container links and republishes pickup + // objects underneath the first one — the failure mode is confusing + // rather than harmless, so it is refused rather than queued. + let setupInFlight = false; + + const setupBucket = (cfg: StorageConfig) => { + // The flag is claimed SYNCHRONOUSLY, not inside the job: the + // background chain serializes work, so a guard checked inside it + // would always find the previous run finished and would happily + // redo the whole thing. Verified by driving two calls in a row. + if (setupInFlight) { + tablet.status("storage setup already running — wait for it", true); + return Promise.resolve(); + } + setupInFlight = true; + return enqueue(async () => { + let step = "init"; + const at = (s: string) => { + step = s; + tablet.status(`configuring storage: ${s}…`, true); + }; try { - tablet.status("configuring storage…"); + at("provider config"); currentProvider = cfg.provider; bobPickup = undefined; if (cfg.provider === "s3") { @@ -481,7 +558,9 @@ async function boot() { await alice.engine.driver.initStore(owner); await tablet.engine.driver.initStore(owner); await bob.engine.driver.initStore(reader); + at("bucket + policy"); await alice.engine.driver.ensureBucket(); + at("grants"); for (const m of [alice.id, bob.id, tablet.id]) { await alice.engine.driver.storeGrant(part, m); // S3: none } @@ -504,40 +583,59 @@ async function boot() { await alice.engine.driver.initStore(owner); await tablet.engine.driver.initStore(owner); await bob.engine.driver.initStore(reader); + at("folders"); await alice.engine.driver.ensureBucket(); + at("grant: alice"); await alice.engine.driver.storeGrant(part, alice.id); + at("grant: tablet"); await alice.engine.driver.storeGrant(part, tablet.id); + at("grant: bob (pickup link)"); bobPickup = await alice.engine.driver.storeGrant(part, bob.id); } + at("flush"); await alice.engine.driver.bucketFlush(part); - tablet.status(await tablet.engine.driver.bucketPull(part, alice.id, undefined)); + at("tablet cold pull"); + tablet.status( + await tablet.engine.driver.bucketPull(part, alice.id, undefined), + true, + ); bucketReady = true; syncBtn.disabled = false; autoBox.disabled = false; pullBtn.disabled = false; } catch (e) { - tablet.status(`storage setup failed: ${err(e)} — check endpoint + CORS`); + // Name the step: a half-configured store is recoverable (every + // provider call is idempotent), so "retry Save & connect" is + // honest advice rather than a shrug. + tablet.status( + `storage setup failed at ${step}: ${err(e)} — check the endpoint/token and CORS, then Save & connect again`, + true, + ); + } finally { + setupInFlight = false; } }); + }; - const bucketSync = () => - enqueue(async () => { - if (!bucketReady) return; - try { - await alice.engine.driver.bucketFlush(part); - await tablet.engine.driver.bucketFlush(part); - tablet.status(await tablet.engine.driver.bucketPull(part, alice.id, undefined)); - alice.status(await alice.engine.driver.bucketPull(part, alice.id, undefined)); - } catch (e) { - tablet.status(`bucket: ${err(e)}`); - } - }); + // The body, callable both from the button (queued once) and from the + // periodic driver (which skips rather than queues). + const bucketSyncOnce = async () => { + if (!bucketReady) return; + try { + await alice.engine.driver.bucketFlush(part); + await tablet.engine.driver.bucketFlush(part); + tablet.status(await tablet.engine.driver.bucketPull(part, alice.id, undefined), true); + alice.status(await alice.engine.driver.bucketPull(part, alice.id, undefined), true); + } catch (e) { + tablet.status(`bucket: ${err(e)}`, true); + } + }; syncBtn.onclick = () => { - bucketSync(); + enqueue(bucketSyncOnce); }; - setInterval(() => { - if (autoBox.checked) bucketSync(); - }, 4000); + const autoSync = periodic("auto-sync", 4000, async () => { + if (autoBox.checked) await bucketSyncOnce(); + }); // Bob pulling from the bucket is the revocation beat: S3 shows the // cooperative darkness (his K_p is gone), Dropbox the hard server-side @@ -693,16 +791,14 @@ async function boot() { // Live stats footer per pane (the tablet keeps its setup hint until // storage is configured). - setInterval(() => { - enqueue(async () => { - for (const p of panes) { - if (p === tablet && !bucketReady) continue; - try { - p.status(await p.engine.driver.stats()); - } catch { /* pane dead */ } - } - }); - }, 4000); + const statsTick = periodic("stats", 4000, async () => { + for (const p of panes) { + if (p === tablet && !bucketReady) continue; + try { + p.status(await p.engine.driver.stats()); + } catch { /* pane dead */ } + } + }); // Debug/validation handles (the paseo browser driver uses these). (globalThis as unknown as Record).__demo = { @@ -713,6 +809,20 @@ async function boot() { pull, bobPull: () => bobPull(), openStorage: () => openStorage(), + // Exposed for driving: re-running setup is also how the in-flight + // guard is exercised without racing a 20 s consumer-API window. + setupBucket: (cfg: StorageConfig) => setupBucket(cfg), + // Backpressure telemetry: queue depth plus per-timer skip counts. + // If depth climbs monotonically, a periodic driver is queueing. + health: () => ({ + bgDepth, + skips: { + reconcile: reconcile.skips(), + autoSync: autoSync.skips(), + stats: statsTick.skips(), + poll: Object.fromEntries(panes.map((p) => [p.name, p.pollSkips ?? 0])), + }, + }), authorize, // The panel's granted fetch, exposed so the DENIAL side of the // per-destination grant is demonstrable and not merely asserted. diff --git a/spikes/demo/host/leak-probe.ts b/spikes/demo/host/leak-probe.ts new file mode 100644 index 0000000..71ea906 --- /dev/null +++ b/spikes/demo/host/leak-probe.ts @@ -0,0 +1,86 @@ +// Idle-leak probe: two engines over the relay with live subscriptions, +// then DO NOTHING for two minutes while sampling memory. The browser run +// grows ~2.4 MB/s with all page timers cleared; this asks whether that +// belongs to the engine/guest stack (reproduces here) or to the browser +// port layer (does not). +// +// deno run -A host/leak-probe.ts [idleSeconds] + +import { type Engine, newEngine, unhex, until } from "./engine.ts"; + +const RELAY = "http://127.0.0.1:3340"; +const IDLE_S = Number(Deno.args[0] ?? 120); + +const artifacts = { + envelope: await Deno.readTextFile(new URL("../build/engine.plan.json", import.meta.url)), + bytes: await Deno.readFile(new URL("../../tasks-engine/target/composed.wasm", import.meta.url)), +}; + +const sample = (tag: string) => { + const m = Deno.memoryUsage(); + console.log( + `${tag.padEnd(16)} rss=${(m.rss / 1048576).toFixed(1)}MB ` + + `heap=${(m.heapUsed / 1048576).toFixed(1)}MB ` + + `ext=${(m.external / 1048576).toFixed(1)}MB`, + ); + return m; +}; + +const alice: Engine = await newEngine("alice", artifacts); +const bob: Engine = await newEngine("bob", artifacts); +const aliceId = unhex(await alice.driver.init(false)); +const bobId = unhex(await bob.driver.init(false)); + +await alice.driver.irohBind(RELAY); +const bobEp = unhex(await bob.driver.irohBind(RELAY)); +const cb = await bob.driver.irohStart(false, new Uint8Array(), RELAY, new Uint8Array()); +const ca = await alice.driver.irohStart(true, bobEp, RELAY, bobId); +await until("handshake", async () => + (await alice.driver.connStatus(ca)) && (await bob.driver.connStatus(cb))); +await until("cards", () => alice.driver.khKnowsAgent(bobId)); + +const part = await alice.driver.createPartition(); +await alice.driver.khAddMember(part, bobId, "edit"); +await alice.driver.sealPartition(part); +await bob.driver.adoptPartition(part); +await until("bob knows doc", () => bob.driver.khKnowsAgent(part)); + +const pull = async (e: Engine, from: Uint8Array) => { + const h = await e.driver.syncStart(from, part, false); + return await until("pull", () => e.driver.syncStatus(h)); +}; +await pull(bob, aliceId); +// The subscriptions the browser demo holds open — the suspected source. +const hs = await bob.driver.syncStart(aliceId, part, true); +await until("bob subscribe", () => bob.driver.syncStatus(hs)); +await pull(alice, bobId); +const ha = await alice.driver.syncStart(bobId, part, true); +await until("alice subscribe", () => alice.driver.syncStatus(ha)); + +await alice.tasks.add("one task, then silence"); + +// Mode: "idle" holds subscriptions open and does nothing; "pulls" runs the +// demo's reconciliation loop (a pull pair every 2.5 s), which is what the +// browser does and what the first version of this probe failed to model. +const MODE = Deno.args[1] ?? "idle"; +if (MODE === "pulls") { + setInterval(async () => { + try { + await pull(bob, aliceId); + await pull(alice, bobId); + } catch { /* ignore */ } + }, 2500); +} + +console.log(`\nsubscriptions live; ${MODE} for ${IDLE_S}s\n`); +const first = sample("idle t=0"); +for (let t = 10; t <= IDLE_S; t += 10) { + await new Promise((r) => setTimeout(r, 10_000)); + sample(`idle t=${t}`); +} +const last = sample("idle end"); +const dRss = (last.rss - first.rss) / 1048576; +console.log( + `\nRSS delta over ${IDLE_S}s idle: ${dRss.toFixed(1)}MB ` + + `(${(dRss / IDLE_S * 1000).toFixed(0)} KB/s)`, +); diff --git a/spikes/demo/host/table-probe.ts b/spikes/demo/host/table-probe.ts new file mode 100644 index 0000000..c90b252 --- /dev/null +++ b/spikes/demo/host/table-probe.ts @@ -0,0 +1,35 @@ +// Which guest table grows under a pull loop? Prints the engine's own +// table sizes alongside process RSS. +import { type Engine, newEngine, unhex, until } from "./engine.ts"; +const RELAY = "http://127.0.0.1:3340"; +const artifacts = { + envelope: await Deno.readTextFile(new URL("../build/engine.plan.json", import.meta.url)), + bytes: await Deno.readFile(new URL("../../tasks-engine/target/composed.wasm", import.meta.url)), +}; +const alice: Engine = await newEngine("alice", artifacts); +const bob: Engine = await newEngine("bob", artifacts); +const aliceId = unhex(await alice.driver.init(false)); +const bobId = unhex(await bob.driver.init(false)); +await alice.driver.irohBind(RELAY); +const bobEp = unhex(await bob.driver.irohBind(RELAY)); +const cb = await bob.driver.irohStart(false, new Uint8Array(), RELAY, new Uint8Array()); +const ca = await alice.driver.irohStart(true, bobEp, RELAY, bobId); +await until("handshake", async () => (await alice.driver.connStatus(ca)) && (await bob.driver.connStatus(cb))); +await until("cards", () => alice.driver.khKnowsAgent(bobId)); +const part = await alice.driver.createPartition(); +await alice.driver.khAddMember(part, bobId, "edit"); +await alice.driver.sealPartition(part); +await bob.driver.adoptPartition(part); +await until("bob knows doc", () => bob.driver.khKnowsAgent(part)); +const pull = async (e: Engine, from: Uint8Array) => { + const h = await e.driver.syncStart(from, part, false); + return await until("pull", () => e.driver.syncStatus(h)); +}; +await pull(bob, aliceId); +await alice.tasks.add("seed"); +let n = 0; +for (let round = 0; round < 10; round++) { + for (let i = 0; i < 20; i++) { await pull(bob, aliceId); await pull(alice, bobId); n += 2; } + const rss = (Deno.memoryUsage().rss / 1048576).toFixed(0); + console.log(`pulls=${String(n).padStart(4)} rss=${rss}MB | bob: ${await bob.driver.stats()}`); +} diff --git a/spikes/demo/justfile b/spikes/demo/justfile index cef548e..866a260 100644 --- a/spikes/demo/justfile +++ b/spikes/demo/justfile @@ -74,7 +74,7 @@ site: translate app panels cp build/panel-dropbox.component.wasm build/panel-dropbox.plan.json serve/ cp ../tasks-engine/target/composed.wasm serve/engine.component.wasm cp build/engine.plan.json serve/engine.plan.json - cp web/index.html serve/ + sed "s/__BUILD__/$(git rev-parse --short HEAD)-$(date +%s)/g" web/index.html > serve/index.html cp ../todomvc/web/todomvc-app.css serve/ # Serve the demo (needs `just infra` in another terminal). @@ -94,5 +94,5 @@ pages: translate app panels cp build/panel-dropbox.component.wasm build/panel-dropbox.plan.json ../../docs/spike-demo/ cp ../tasks-engine/target/composed.wasm ../../docs/spike-demo/engine.component.wasm cp build/engine.plan.json ../../docs/spike-demo/ - cp web/index.html ../../docs/spike-demo/ + sed "s/__BUILD__/$(git rev-parse --short HEAD)-$(date +%s)/g" web/index.html > ../../docs/spike-demo/index.html cp ../todomvc/web/todomvc-app.css ../../docs/spike-demo/ diff --git a/spikes/demo/web/index.html b/spikes/demo/web/index.html index 3a54967..1308ea6 100644 --- a/spikes/demo/web/index.html +++ b/spikes/demo/web/index.html @@ -101,6 +101,11 @@

Alice — tablet no connections, your bucket only

- + + + diff --git a/spikes/tasks-engine/guest/src/lib.rs b/spikes/tasks-engine/guest/src/lib.rs index 294d182..b136be0 100644 --- a/spikes/tasks-engine/guest/src/lib.rs +++ b/spikes/tasks-engine/guest/src/lib.rs @@ -897,17 +897,64 @@ fn host_of(endpoint: &str) -> String { .to_string() } +/// A short, non-secret label for a request: method plus host and path. +/// Query strings are dropped — on the S3 path they can carry signing +/// material, and no diagnostic needs them. +fn request_label(method: &str, url: &str) -> String { + let rest = url + .split_once("://") + .map(|(_, r)| r) + .unwrap_or(url) + .split('?') + .next() + .unwrap_or(url); + format!("{method} {rest}") +} + +/// One HTTP request, with **transient-failure retry and named errors**. +/// +/// Both properties were bought by a live browser failure: a storage +/// setup makes ~23 sequential requests, and a single dropped connection +/// aborted the whole thing, leaving a half-configured store behind an +/// error message (`fetch: send: NetworkError…`) that named neither the +/// operation nor the host. Every provider call in this file is idempotent +/// by construction (overwrite uploads, tolerated-conflict folder +/// creation, adopted-if-exists link minting, reads), so retrying a +/// transport failure is safe; a response — any status — is never retried +/// here, because status handling belongs to the caller. async fn do_fetch( method: &str, url: String, headers: Vec<(String, String)>, body: Vec, ) -> Result<(u16, Vec), String> { - let _ = with_state(|s| s.fetches += 1); - let resp = fetch::request(method.to_string(), url, headers, body) + const ATTEMPTS: u32 = 3; + let label = request_label(method, &url); + let mut last = String::new(); + for attempt in 1..=ATTEMPTS { + let _ = with_state(|s| s.fetches += 1); + match fetch::request( + method.to_string(), + url.clone(), + headers.clone(), + body.clone(), + ) .await - .map_err(|e| format!("fetch: {e}"))?; - Ok((resp.status, resp.body)) + { + Ok(resp) => return Ok((resp.status, resp.body)), + Err(e) => { + last = e.to_string(); + // No backoff, deliberately: only TRANSPORT failures retry + // here (a status — including 429/5xx — returns to the + // caller untouched), so there is no rate limiter to + // hammer, and the attempt count is bounded at 3. + let _ = attempt; + } + } + } + Err(format!( + "{label}: transport failed after {ATTEMPTS} attempts: {last}" + )) } async fn s3_signed( @@ -3143,7 +3190,11 @@ impl DriverGuest for Component { async fn sync_status(handle: u32) -> Result, String> { breathe().await; - match with_state(|s| s.syncs.get(&handle).cloned())? { + // One-shot by contract (see the note on `syncs`): the outcome is + // REMOVED as it is read, so the table holds only in-flight syncs. + // Leaving completed entries in made the map grow without bound — + // the demo starts ~48 syncs/minute, forever. + match with_state(|s| s.syncs.remove(&handle))? { Some(Ok(summary)) => Ok(Some(summary)), Some(Err(e)) => Err(e), None => Ok(None), @@ -3231,10 +3282,20 @@ impl DriverGuest for Component { .and_then(|id| s.partitions.get(id)) .map(|p| (p.revision, p.undecryptable)) .unwrap_or((0, 0)); + // Table sizes are part of the line on purpose: a growth bug + // in any of these is invisible from outside the guest, and + // one (the syncs map) already shipped. format!( - "webcrypto sign calls: {}; iroh conns: {}; revision: {rev}; undecryptable: {undec}", + "webcrypto sign calls: {}; iroh conns: {}; revision: {rev}; undecryptable: {undec}; \ + tables syncs={} conns={} parts={} pending={} buckets={} fetches={}", s.signer.0.sign_count.get(), s.iroh_conns.len(), + s.syncs.len(), + s.conn_results.len(), + s.partitions.len(), + s.pending.len(), + s.buckets.len(), + s.fetches, ) }) .unwrap_or_else(|e| e)