@wasm-oj/browser 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/THIRD_PARTY_NOTICES.md +302 -0
- package/dist/assets/compiler.worker-DU-Lr3eI.js +180 -0
- package/dist/assets/go-stage.worker-vdeY8dkX.js +2 -0
- package/dist/assets/index-CMYYN-aK.mjs +11 -0
- package/dist/assets/java-stage.worker-DhjZdteI.js +21 -0
- package/dist/assets/python-stage.worker-Ow1WQHJQ.js +22 -0
- package/dist/assets/runner.worker-C3ED68L7.js +281 -0
- package/dist/assets/runtime-core_bg-CRl4ulxe.wasm +0 -0
- package/dist/assets/rustc-stage.worker-CBlcwm7K.js +22 -0
- package/dist/assets/wasmer-thread.worker-DKlJE3cb.js +17 -0
- package/dist/assets/wasmer_js_bg-lccPpAdN.wasm +0 -0
- package/dist/index.d.ts +230 -0
- package/dist/index.js +52 -0
- package/licenses/es-module-lexer-MIT.txt +10 -0
- package/licenses/fflate-MIT.txt +21 -0
- package/licenses/runtime-core-dependencies.html +6253 -0
- package/licenses/runtime-core-dependencies.json +3041 -0
- package/licenses/wasmer-sdk-MIT.txt +21 -0
- package/licenses/wasmer-sdk-dependencies.html +6901 -0
- package/licenses/wasmer-sdk-dependencies.json +3013 -0
- package/package.json +56 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import{Engine as e,WASM_OJ_STORAGE as t,WEIGHTED_METER_MODEL as n,assertCompilerCacheKey as r,assertValidProject as i,createDefaultDependencyManager as a,createExtendedCostBaselineRegistry as o,resolveArtifactCostBudget as s,snapshotBrowserToolchainSources as c,toolchainCacheIdentity as l,toolchainProfileSource as ee,unavailableExecutionMetrics as u}from"@wasm-oj/core";import{WASM_OJ_CONTRACT_VERSION as d,WASM_OJ_SCHEMAS as f,WASM_OJ_STORAGE as p,assertLanguageIdentifier as m,isBuiltinLanguage as h}from"@wasm-oj/contracts";import"es-module-lexer";export*from"@wasm-oj/core";var g=`22.0.0-git20542-10`,te=`wasm-oj/clang@${g}`,ne=`/toolchains/clang-${g}.webc.gz.bin`,re=`/toolchains/clang-${g}.cc1-pins.json`,ie=`/toolchains/clang-${g}.manifest.json`,ae=`/toolchains/clang-${g}.libcxx-pch.json`,oe=`/toolchains/clang-${g}.cpp-debug.pch.gz.bin`,se=`/toolchains/clang-${g}.cpp-release.pch.gz.bin`,_=`7f10d90b8e52b270f04874641a1d0bf9e94e85b4f6c7573a774cebbc6d32552a`,ce=`21ded33b9c6d4e1aaad5528c940bdaf6c3e84be77ea8f522f018ca7289a2a224`,le=`66c4604dccd3f89d8e1472bf4432367d7396cce4a01279b1a1db445f229dba72`,ue=`6382dcdfb6a2da49032a0e08da3b1fb490eb24432be85c3c12e3e871a5065273`,de=`d126c99e951a7302d4ea2b66da4ed64d3d74e9d319d562518867c8d8c97a06b8`,fe=Object.freeze({"cpp-debug":Object.freeze({path:oe,sha256:`05a4db721448ba33e65977cb4ac366908ea215ab377e3b6d09f1fd224d515b68`,compressedSha256:`a4152027d248412eca8aec3e7e23f6f7c81f95170cae9fd385bcf02e57e91fc9`}),"cpp-release":Object.freeze({path:se,sha256:`aec9e778ac527c120ba369b9b0e142cf8206d11365801208847ba0e1c39daa1a`,compressedSha256:`18f4ca8ab8ca7888db572ba34146fc1acb213a7e7305000ea6285188f52f99f4`})}),v=`3.14.6`,pe=`454ffc53936aa13a0d7f4afbb5bd50ada339c8ebd04bbf27ea19e4104cf43207`,me=`${`wasm-oj/cpython@${v}`}#sha256:${pe}`,he=`/toolchains/python-${v}-wasip1.webc.gz.bin`,ge=`/toolchains/python-${v}-wasip1.manifest.json`,_e=`218cd20ac4abb443e0700816010a615a345a43eae623a0232da2227135a6c7a6`,ve=`054eccad04a7cee7ba1661062142ef0d639976850981eab8fc785f48eb26129e`,ye=`44d894f91487f20c2bb04fe496a9343db37d8720fb706472c2b4a7f3300db039`,y=`0.15.1`,be=`wasm-oj/quickjs-ng@${y}`,xe=`/toolchains/quickjs-${y}.wasm.gz.bin`,b=`8c7f0588210490e7d77f198fc91f72c1b94787ab4c359c4786ca59a363c4f5e8`,x=`7.0.2`,Se=`/toolchains/typescript-${x}.wasm.gz.bin`,S=`06e58ce887d95d1895055699b8dc96a1cde7d1f2baa48de40f9b790e3271dc16`,C=`1.91.1-dev`,Ce=`/toolchains/rust-${C}.webc.gz.bin`,we=`/toolchains/rust-${C}.manifest.json`,w=`cfbdadc67be1315e735aa55bdf8a5a0d00171982a023fefcf7ba586127753887`,T=`765de8d68d03078e79f69f49dec0dcab1ff96fe3bbe5e9eafebb2ce61a39d3ee`,E=`d5bbdca994e61888679c5738cb9420649c0854ed0eb5d65468bc67d5d550bce1`,D=`1.26.5`,Te=`/toolchains/go-${D}-wasip1.webc.gz.bin`,Ee=`/toolchains/go-${D}-wasip1.manifest.json`,De=`/toolchains/go-${D}-wasip1.stdlib.gz.bin`,O=`70a7e359884b09b2e1a622d6ac5cd6e31c334aab519e6dd80dff5e040a9e09e4`,k=`c3a97934b6a83fefdea5c31f99141f70f76189eedc9ec0fa9ccd41302e50963b`,A=`5d784e9ca640b9525e84b598c0beb97ca110ae908568ca45f6441a441d99a262`,j=`aeffc384fdc624544f174ba5fc3c22395717fdbc3c4387d677d20855b6be80d8`,Oe=`e1ec64b08efd02b35b7ffdaf3970875aaae98325fa4795eafca94ebae2d0d192`,ke=`9e557f5b86961fd604217d7521461c5d2b7322e383fa30dead5669b77db12201`,Ae=`2eefca10af935a307ab7946447146bd30e0ea0fb5460be54dc1c55844d155580`,je=`wasm-oj/java-teavm@teavm-0.13.1-wasi`,Me=`/toolchains/java-teavm-0.13.1.wasi.compiler.webc.gz.bin`,Ne=`/toolchains/java-teavm-0.13.1.compile-classlib.bin`,Pe=`/toolchains/java-teavm-0.13.1.runtime-classlib.bin`,Fe=`129f1f51d591e58954f88787d36396b856a9a68ba3ae9c9d14f20bd67c2c7722`,Ie=`f8f86761cf31062565187e4a66f73b6903f257fe84c0ce70ea1cd28441b6c2e9`,Le=`33a0d662395256f10a5d02ea305fc7b18007b2b8fe8996859017b084d3d19735`,Re=`acfe3fb09e5f2c0c7c8dc2339c66fcdadc1f8e1bf1c74be446926175ef770868`,ze=`21a9394586e416af2fca4eb0ed08521cbc8924e1d1afaa07863a59a3cfae54ab`;Object.freeze({[ne]:_,[re]:le,[ie]:ue,[ae]:de,[oe]:fe[`cpp-debug`].compressedSha256,[se]:fe[`cpp-release`].compressedSha256,[he]:_e,[ge]:ve,[xe]:b,[Se]:S,[Ce]:w,[we]:E,[Te]:O,[Ee]:A,[De]:j,[Me]:Fe,[Ne]:Re,[Pe]:ze});var Be=Object.freeze({c:Object.freeze([_,ce,le,ue]),cpp:Object.freeze([_,ce,le,ue]),rust:Object.freeze([w,T,E]),python:Object.freeze([_e,pe,ve,ye]),javascript:Object.freeze([S,b]),typescript:Object.freeze([S,b]),go:Object.freeze([O,k,A,j,Oe,ke,Ae])});function Ve(e){if(e===`java`)return[Fe,Ie,Le,Re,ze].join(`.`);if(!h(e))throw Error(`WASM-OJ has no built-in toolchain for '${e}'.`);return Be[e].join(`.`)}function M(e){return Object.freeze({...e,compilerPackages:Object.freeze([...e.compilerPackages]),targets:Object.freeze([...e.targets])})}var He=Object.freeze({c:M({language:`c`,label:`Clang 22`,artifact:`wasm`,compilerPackages:[te],targets:[`wasip1`,`wasix`],version:g,note:`Native wasip1 module via Clang and LLD; directly executable by WASI and WASIX runtimes.`}),cpp:M({language:`cpp`,label:`Clang++ 22 (C++20)`,artifact:`wasm`,compilerPackages:[te],targets:[`wasip1`,`wasix`],version:g,note:`C++20/libc++ wasip1 module; directly executable by WASI and WASIX runtimes.`}),rust:M({language:`rust`,label:`Rust ${C}`,artifact:`wasm`,compilerPackages:[`rustc@${C}#sha256:${T}`],targets:[`wasip1`],version:C,note:`Real rustc, its matching standard library, and a fresh deterministic wasm-ld stage execute as one pinned WebC under Wasmer.`}),python:M({language:`python`,label:`CPython ${v}`,artifact:`runtime-bundle`,compilerPackages:[me],runtimePackage:me,targets:[`wasip1`],version:v,note:`Byte-compiled project bundled with the source-built CPython wasm32-wasip1 interpreter and standard library.`}),javascript:M({language:`javascript`,label:`QuickJS-ng`,artifact:`runtime-bundle`,compilerPackages:[`typescript@${x}-wasi`],runtimePackage:be,targets:[`wasip1`],version:y,note:`JavaScript checked by TypeScript/WASI, then executed by the bundled QuickJS-ng/WASI runtime.`}),typescript:M({language:`typescript`,label:`TypeScript + QuickJS-ng`,artifact:`runtime-bundle`,compilerPackages:[`typescript@${x}-wasi`],runtimePackage:be,targets:[`wasip1`],version:x,note:`The native TypeScript compiler and QuickJS-ng runtime both execute as local WASI modules.`}),go:M({language:`go`,label:`Go ${D}`,artifact:`wasm`,compilerPackages:[`go@${D}#sha256:${k}`],targets:[`wasip1`],version:D,note:`The standard Go compiler, linker, and pinned wasip1 standard library execute locally as one WebC under Wasmer.`})});function Ue(e){if(e===`java`)return[je];if(!h(e))throw Error(`WASM-OJ has no built-in toolchain for '${e}'.`);let t=He[e];return[...new Set([...t.compilerPackages,...t.runtimePackage?[t.runtimePackage]:[]])]}var N=Object.freeze({files:256,bytesPerFile:4194304,totalBytes:16777216}),We=new TextEncoder;function Ge(e,t){return e<t?-1:+(e>t)}function P(e,t=`Project path`){if(typeof e!=`string`||!e||e!==e.trim()||e.length>4096)throw Error(`${t} must be a non-empty, trimmed string of at most 4096 characters.`);if(e.startsWith(`/`)||e.includes(`\\`)||e.includes(`\0`)||e.split(`/`).some(e=>!e||e===`.`||e===`..`))throw Error(`${t} '${e}' must be a normalized relative path that cannot escape the project.`)}function Ke(e){if(!Array.isArray(e)||e.length===0)throw Error(`A project must contain at least one source file.`);if(e.length>N.files)throw Error(`A project cannot contain more than ${N.files} source files.`);let t=new Set,n=0;return e.map((e,r)=>{if(!e||typeof e!=`object`)throw Error(`Project file ${r} is invalid.`);if(P(e.path,`Project file ${r} path`),m(e.language),typeof e.content!=`string`)throw Error(`Project file '${e.path}' content must be a string.`);if(e.content.length>N.bytesPerFile)throw Error(`Project file '${e.path}' exceeds the ${N.bytesPerFile} byte source limit.`);let i=We.encode(e.content).byteLength;if(i>N.bytesPerFile)throw Error(`Project file '${e.path}' exceeds the ${N.bytesPerFile} byte source limit.`);if(n+=i,n>N.totalBytes)throw Error(`Project sources exceed the ${N.totalBytes} byte total limit.`);if(t.has(e.path))throw Error(`Duplicate project path '${e.path}'.`);return t.add(e.path),{path:e.path,language:e.language,content:e.content}}).sort((e,t)=>Ge(e.path,t.path))}function F(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Runtime bundle files must be a record.`);return Object.entries(e).map(([e,t])=>(P(e,`Runtime bundle path`),[e,t])).sort(([e],[t])=>Ge(e,t))}async function I(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=new Uint8Array(t.byteLength);n.set(t);let r=await crypto.subtle.digest(`SHA-256`,n);return Array.from(new Uint8Array(r),e=>e.toString(16).padStart(2,`0`)).join(``)}var L=1048576,R=Object.freeze({requirements:128,sourceFiles:128,sourceTextBytes:8*L,hosts:32,roots:512,packages:512,referencesPerPackage:512,concurrency:16,metadataBytes:8*L,packageBytes:256*L,totalDownloadBytes:512*L,archiveFiles:16384,unpackedBytes:512*L});Object.freeze({packages:R.packages,filesPerPackage:R.archiveFiles,bytesPerFile:64*L,totalBytes:R.unpackedBytes});var z=`payloads`,qe=/^[0-9a-f]{64}$/,B=class{database;async load(e){Je(e);let t=(await this.open()).transaction(z,`readonly`),n=await V(t.objectStore(z).get(e));if(await H(t),n!==void 0){if(!U(n)||n.digest!==e||!(n.payload instanceof Uint8Array)||await I(n.payload)!==e)throw await this.delete(e),Error(`Cached dependency '${e}' failed integrity verification.`);return await this.touch(e),n.payload.slice()}}async save(e,t){if(Je(e),!(t instanceof Uint8Array)||await I(t)!==e)throw Error(`Dependency cache payload digest mismatch.`);let n=(await this.open()).transaction(z,`readwrite`);n.objectStore(z).put({byteLength:t.byteLength,digest:e,lastAccessedAt:Date.now(),payload:t.slice()}),await H(n)}async delete(e){Je(e);let t=(await this.open()).transaction(z,`readwrite`);t.objectStore(z).delete(e),await H(t)}async clear(){let e=(await this.open()).transaction(z,`readwrite`);e.objectStore(z).clear(),await H(e)}async listStorageEntries(){let e=(await this.open()).transaction(z,`readonly`),t=await V(e.objectStore(z).getAll());return await H(e),t.map(e=>{if(!U(e))throw Error(`Dependency cache contains an invalid storage record.`);return{key:e.digest,byteLength:e.byteLength,lastAccessedAt:e.lastAccessedAt}})}storageParticipant(){return{id:`dependencies`,retentionPriority:40,list:()=>this.listStorageEntries(),delete:e=>this.delete(e),clear:()=>this.clear()}}close(){let e=this.database;this.database=void 0,e?.then(e=>e.close()).catch(()=>void 0)}open(){return this.database??=new Promise((e,t)=>{let n=indexedDB.open(p.dependencyCache,1);n.addEventListener(`upgradeneeded`,()=>{n.result.objectStoreNames.contains(z)||n.result.createObjectStore(z,{keyPath:`digest`})}),n.addEventListener(`success`,()=>e(n.result),{once:!0}),n.addEventListener(`error`,()=>t(n.error??Error(`Unable to open dependency cache.`)),{once:!0}),n.addEventListener(`blocked`,()=>t(Error(`Dependency cache upgrade is blocked by another tab.`)),{once:!0})}),this.database.catch(()=>{this.database=void 0}),this.database}async touch(e){let t=(await this.open()).transaction(z,`readwrite`),n=t.objectStore(z),r=await V(n.get(e));if(r!==void 0){if(!U(r))throw Error(`Dependency cache contains an invalid storage record.`);n.put({...r,lastAccessedAt:Date.now()})}await H(t)}};function V(e){return new Promise((t,n)=>{e.addEventListener(`success`,()=>t(e.result),{once:!0}),e.addEventListener(`error`,()=>n(e.error??Error(`IndexedDB request failed.`)),{once:!0})})}function H(e){return new Promise((t,n)=>{e.addEventListener(`complete`,()=>t(),{once:!0}),e.addEventListener(`abort`,()=>n(e.error??Error(`IndexedDB transaction aborted.`)),{once:!0}),e.addEventListener(`error`,()=>n(e.error??Error(`IndexedDB transaction failed.`)),{once:!0})})}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).sort().join(`,`)===`byteLength,digest,lastAccessedAt,payload`&&typeof e.digest==`string`&&e.payload instanceof Uint8Array&&Number.isSafeInteger(e.byteLength)&&e.byteLength===e.payload.byteLength&&Number.isSafeInteger(e.lastAccessedAt)&&e.lastAccessedAt>=0}function Je(e){if(!qe.test(e))throw Error(`Dependency integrity must be lowercase SHA-256 hexadecimal.`)}var Ye=`#pragma once
|
|
2
|
+
#include <algorithm>
|
|
3
|
+
#include <array>
|
|
4
|
+
#include <bitset>
|
|
5
|
+
#include <cassert>
|
|
6
|
+
#include <cctype>
|
|
7
|
+
#include <cerrno>
|
|
8
|
+
#include <cfloat>
|
|
9
|
+
#include <charconv>
|
|
10
|
+
#include <chrono>
|
|
11
|
+
#include <climits>
|
|
12
|
+
#include <cmath>
|
|
13
|
+
#include <compare>
|
|
14
|
+
#include <concepts>
|
|
15
|
+
#include <cstddef>
|
|
16
|
+
#include <cstdint>
|
|
17
|
+
#include <cstdio>
|
|
18
|
+
#include <cstdlib>
|
|
19
|
+
#include <cstring>
|
|
20
|
+
#include <deque>
|
|
21
|
+
#include <exception>
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <iomanip>
|
|
24
|
+
#include <ios>
|
|
25
|
+
#include <iostream>
|
|
26
|
+
#include <iterator>
|
|
27
|
+
#include <limits>
|
|
28
|
+
#include <map>
|
|
29
|
+
#include <memory>
|
|
30
|
+
#include <numeric>
|
|
31
|
+
#include <optional>
|
|
32
|
+
#include <queue>
|
|
33
|
+
#include <random>
|
|
34
|
+
#include <ranges>
|
|
35
|
+
#include <set>
|
|
36
|
+
#include <span>
|
|
37
|
+
#include <sstream>
|
|
38
|
+
#include <stack>
|
|
39
|
+
#include <string>
|
|
40
|
+
#include <string_view>
|
|
41
|
+
#include <tuple>
|
|
42
|
+
#include <type_traits>
|
|
43
|
+
#include <unordered_map>
|
|
44
|
+
#include <unordered_set>
|
|
45
|
+
#include <utility>
|
|
46
|
+
#include <variant>
|
|
47
|
+
#include <vector>
|
|
48
|
+
`;new TextDecoder;function Xe(e){return e===Ye}function Ze(e){return(e.config.target===`wasip1`||e.config.target===`wasix`)&&(e.config.language===`c`||e.config.language===`cpp`)}function Qe(e){if(!Ze(e))return 0;let t=e.config.language===`cpp`?/\.(?:cc|cpp|cxx)$/:/\.c$/,n=new Set(e.files.filter(e=>t.test(e.path)).map(e=>e.path));n.add(e.config.entry);let r=e.config.language===`cpp`?e.files.find(e=>e.path.split(`/`).at(-1)===`wasm-oj.pch.hpp`):void 0,i=r&&!Xe(r.content)?1:0;return n.size+i+2}function $e(e){let t=Qe(e);if(t>8)throw Error(`The browser Clang project requires ${t} compiler stages; the verified per-Worker limit is 8.`);return t}function et(e,t){return!e.success||!e.artifact||!e.buildGraph?t:(e.buildGraph.misses.pch??0)+(e.buildGraph.misses.object??0)+(e.buildGraph.misses[`link-result`]??0)}Object.freeze({c:`cpp`,cpp:`cpp`,rust:`cargo`,python:`pypi`,javascript:`npm`,typescript:`npm`,go:`go`}),`${D.split(`.`).slice(0,2).join(`.`)}`;var tt=18e4;Object.freeze({version:D,target:`wasip1/wasm`,packageAsset:Te,packageCompressedSha256:O,packageSha256:k,manifestAsset:Ee,manifestSha256:A,standardLibraryAsset:De,standardLibraryCompressedSha256:j,standardLibrarySha256:Oe,compilerSha256:ke,linkerSha256:Ae});var nt=`wasm32-wasip1-threads`,rt=`2024`,it=18e4;Object.freeze([`wasi_snapshot_preview1.random_get`,`wasi_snapshot_preview1.clock_time_get`]),Object.freeze({version:C,packageAsset:Ce,packageCompressedSha256:w,packageSha256:T,manifestAsset:we,manifestSha256:E,target:nt,edition:rt});var at=6e4,ot=12e4,st=tt+1e4,ct=it+1e4;function lt(e){if(e===`java`)return 19e4;if(!h(e))throw Error(`The built-in WASM-OJ compiler does not support language '${e}'.`);return e===`c`||e===`cpp`?at:e===`rust`?ct:e===`go`?st:ot}function ut(e){return e.config.language===`rust`}function dt(e){return ut(e)?2:0}var ft=``+new URL(`assets/compiler.worker-DU-Lr3eI.js`,import.meta.url).href;function pt(e,t={}){let n=mt(e);try{return new Worker(n.url,{...t,type:`module`})}finally{n.revoke()}}function mt(e){let t=ht(),n=gt(e),r=new Blob([`const pendingMessages = [];
|
|
49
|
+
`,`const queueMessage = (event) => { event.stopImmediatePropagation(); pendingMessages.push(event.data); };
|
|
50
|
+
`,`globalThis.addEventListener("message", queueMessage);
|
|
51
|
+
`,`Object.defineProperty(globalThis, "__wasmOjModuleWorkerBaseUrl", { value: ${JSON.stringify(t.href)} });\n`,`try { await import(${JSON.stringify(n)}); } finally { globalThis.removeEventListener("message", queueMessage); }\n`,`for (const data of pendingMessages) globalThis.dispatchEvent(new MessageEvent("message", { data }));
|
|
52
|
+
`],{type:`text/javascript`}),i=URL.createObjectURL(r),a=!0;return{url:i,revoke(){a&&(a=!1,URL.revokeObjectURL(i))}}}function ht(){let e=globalThis.location?.href;if(e){let t=new URL(e);if(t.protocol===`http:`||t.protocol===`https:`)return t;if(t.protocol!==`blob:`)throw Error(`A module Worker requires an HTTP(S) browser base URL.`)}let t=globalThis.__wasmOjModuleWorkerBaseUrl;if(typeof t!=`string`)throw Error(`A module Worker requires a browser base URL.`);let n=new URL(t);if(n.origin===`null`||n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`A module Worker requires an HTTP(S) browser base URL.`);return n}function gt(e){let t=ht(),n;try{n=new URL(e instanceof URL?e.href:e,t)}catch{throw Error(`A module Worker URL must be a valid same-origin HTTP(S) URL.`)}if(n.origin!==t.origin||n.username||n.password||n.search||n.hash)throw Error(`A module Worker URL must be same-origin and contain no credentials, query, or fragment.`);return n.href}var _t=2,vt=`manifests`,yt=`metadata`,bt=`blobs`,W=`clang`;new TextEncoder;function xt(){return new Promise((e,t)=>{let n=indexedDB.deleteDatabase(p.incrementalBuildCache);n.addEventListener(`success`,()=>e(),{once:!0}),n.addEventListener(`error`,()=>{t(n.error??Error(`Unable to delete the incremental build cache.`))},{once:!0}),n.addEventListener(`blocked`,()=>{t(Error(`Incremental build cache deletion is blocked by another open tab.`))},{once:!0})})}async function St(){let e=await wt();try{let t=e.transaction(yt,`readonly`),n=await Tt(t.objectStore(yt).get(W));if(await Et(t),n===void 0)return[];let r=Dt(n);return[{key:W,byteLength:r.byteLength,lastAccessedAt:r.lastAccessedAt}]}finally{e.close()}}function Ct(){return{id:`incremental-build-graph`,retentionPriority:10,list:St,delete:async e=>{if(e!==W)throw Error(`Unknown build graph storage key '${e}'.`);await xt()},clear:xt}}function wt(){return new Promise((e,t)=>{let n=indexedDB.open(p.incrementalBuildCache,_t);n.addEventListener(`upgradeneeded`,()=>{let e=n.result;for(let t of[...e.objectStoreNames])e.deleteObjectStore(t);e.createObjectStore(vt,{keyPath:`id`}),e.createObjectStore(yt,{keyPath:`id`}),e.createObjectStore(bt,{keyPath:`digest`})}),n.addEventListener(`success`,()=>e(n.result),{once:!0}),n.addEventListener(`error`,()=>{t(n.error??Error(`Unable to open the incremental build cache.`))},{once:!0}),n.addEventListener(`blocked`,()=>{t(Error(`Incremental build cache open is blocked by another tab.`))},{once:!0})})}function Tt(e){return new Promise((t,n)=>{e.addEventListener(`success`,()=>t(e.result),{once:!0}),e.addEventListener(`error`,()=>n(e.error??Error(`IndexedDB request failed.`)),{once:!0})})}function Et(e){return new Promise((t,n)=>{e.addEventListener(`complete`,()=>t(),{once:!0}),e.addEventListener(`abort`,()=>n(e.error??Error(`IndexedDB transaction aborted.`)),{once:!0}),e.addEventListener(`error`,()=>n(e.error??Error(`IndexedDB transaction failed.`)),{once:!0})})}function Dt(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Persisted Clang build graph metadata has an invalid shape.`);let t=e;if(Object.keys(t).sort().join(`,`)!==`blobBytes,byteLength,generation,id,lastAccessedAt,manifestBytes`||t.id!==W||!G(t.generation)||!G(t.blobBytes)||!G(t.manifestBytes)||!G(t.byteLength)||!G(t.lastAccessedAt)||Ot(t.blobBytes,t.manifestBytes)!==t.byteLength)throw Error(`Persisted Clang build graph metadata has invalid storage accounting.`);return t}function Ot(e,t){let n=e+t;if(!Number.isSafeInteger(n)||n<0)throw Error(`Incremental build graph byte length exceeds the safe integer range.`);return n}function G(e){return Number.isSafeInteger(e)&&e>=0}var kt=12e4,At=1e4,jt=class{worker;pending=new Map;progressListeners=new Set;traceListeners=new Set;readyPromise;toolchains;activeOperation;disposed=!1;generation=0;workerDormant=!1;workerInitialized=!1;outputReadyClangStages=0;outputReadyRustStages=0;retainedGoStage=!1;constructor(e){if(!e||typeof e!=`object`)throw TypeError(`BrowserCompiler requires explicit toolchain options.`);this.toolchains=c(e.toolchains),this.worker=this.createWorker(),this.readyPromise=this.initializeWorker()}cacheIdentity(e){this.assertActive();let{descriptor:t}=ee(this.toolchains,e.config.language,e.config.target,e.config.optimization).source;return JSON.stringify({...l(e.config.language),source:{id:t.id,version:t.version,assets:t.assets.map(({path:e,bytes:t,sha256:n})=>({path:e,bytes:t,sha256:n}))}})}initializeWorker(){let e=this.request({type:`initialize`,toolchains:this.toolchains},kt);return e.catch(()=>void 0),e}onProgress(e){return this.assertActive(),this.progressListeners.add(e),()=>this.progressListeners.delete(e)}onTrace(e){return this.assertActive(),this.traceListeners.add(e),()=>this.traceListeners.delete(e)}ready(){return this.assertActive(),this.readyPromise}async build(e,t){if(this.assertActive(),i(e),r(t),ee(this.toolchains,e.config.language,e.config.target,e.config.optimization),this.activeOperation)throw Error(`BrowserCompiler accepts one active operation at a time.`);let n=Ze(e),a=$e(e),o=dt(e),s=o>0,c=e.config.language===`go`,l={kind:`build`};this.activeOperation=l;let u=this.outputReadyClangStages>0&&(!n||this.outputReadyClangStages+a>8),d=this.outputReadyRustStages>0&&(!s||this.outputReadyRustStages+o>4),f=this.retainedGoStage&&!c,p,m=!1;try{(u||d||f)&&(await this.quiesceAndReplaceWorker(Error(`Compiler Worker recycled at the output-ready stage boundary.`)),this.activeOperation=l);let r=this.generation;if(await this.readyPromise,this.assertActive(),r!==this.generation)throw Error(`Browser compilation was superseded by a Worker replacement.`);p=this.worker;let i=await this.request({type:`build`,project:e,cacheKey:t},lt(e.config.language));return n?(this.outputReadyClangStages+=et(i,a),m=!0):s?(this.outputReadyRustStages+=o,m=!0):c&&(this.retainedGoStage=!0,m=!0),i}finally{this.activeOperation===l&&(this.activeOperation=void 0),!this.disposed&&p&&this.worker===p&&!m&&this.replaceWorker(Error(`Compiler Worker recycled after isolated build.`))}}async clearToolchainCache(){if(this.assertActive(),this.activeOperation)throw Error(`BrowserCompiler accepts one active operation at a time.`);let e={kind:`cache-clear`};this.activeOperation=e,this.stopWorker(Error(`Compiler Worker recycled before clearing caches.`));let n=this.generation;try{let e=await caches.keys();if(await Promise.all([...e.filter(e=>e===t.toolchainCache).map(e=>caches.delete(e)),xt()]),this.assertActive(),n!==this.generation||(this.installWorker(),await this.readyPromise,this.assertActive(),n!==this.generation))throw Error(`Compiler cache clearing was superseded by a lifecycle change.`)}finally{!this.disposed&&n===this.generation&&this.workerDormant&&this.installWorker(),this.activeOperation===e&&(this.activeOperation=void 0)}}cancel(){this.disposed||this.activeOperation?.kind!==`cache-clear`&&this.replaceWorker(Error(`Compilation cancelled.`))}restart(){if(this.assertActive(),this.activeOperation?.kind===`cache-clear`)throw Error(`Cannot restart BrowserCompiler while clearing its cache.`);this.replaceWorker(Error(`Compiler worker restarted.`))}dispose(){if(this.disposed)return;this.disposed=!0,this.generation+=1,this.workerDormant=!0,this.activeOperation=void 0,this.worker.terminate();let e=Error(`Compiler client disposed.`);for(let t of this.pending.values())t.timer&&clearTimeout(t.timer),t.reject(e);this.pending.clear(),this.progressListeners.clear(),this.traceListeners.clear()}createWorker(){let e=pt(ft,{name:`wasm-oj-compiler`});return e.addEventListener(`message`,t=>{!this.disposed&&!this.workerDormant&&this.worker===e&&this.handleMessage(t.data)}),e.addEventListener(`error`,t=>{let n=Error(t.message||`The compiler worker crashed.`);if(this.disposed||this.workerDormant||this.worker!==e)return;let r=this.workerInitialized;this.stopWorker(n),r&&this.installWorker()}),e}replaceWorker(e){this.stopWorker(e),this.installWorker()}async quiesceAndReplaceWorker(e){let t=this.generation;try{await this.request({type:`quiesce`},At)}catch(e){let n=e instanceof Error?e:Error(String(e));throw!this.disposed&&t===this.generation&&this.replaceWorker(n),Error(`Compiler could not establish a quiescent Worker boundary.`,{cause:n})}if(this.assertActive(),t!==this.generation)throw Error(`Compiler quiescence was superseded by a lifecycle change.`);this.stopWorker(e),this.installWorker()}stopWorker(e){this.generation+=1,this.workerDormant=!0,this.activeOperation?.kind===`build`&&(this.activeOperation=void 0),this.worker.terminate();for(let t of this.pending.values())t.timer&&clearTimeout(t.timer),t.reject(e);this.pending.clear(),this.outputReadyClangStages=0,this.outputReadyRustStages=0,this.retainedGoStage=!1,this.workerInitialized=!1}installWorker(){this.worker=this.createWorker(),this.workerDormant=!1,this.readyPromise=this.initializeWorker()}assertActive(){if(this.disposed)throw Error(`BrowserCompiler is disposed.`)}request(e,t){this.assertActive();let n=crypto.randomUUID();return new Promise((r,i)=>{let a={resolve:r,reject:i};a.timer=setTimeout(()=>{if(!this.pending.delete(n))return;let e=Error(`Compiler request exceeded the ${t} ms browser boundary.`);i(e),this.disposed||this.replaceWorker(e)},t),this.pending.set(n,a);try{this.worker.postMessage({...e,requestId:n})}catch(e){this.pending.delete(n),a.timer&&clearTimeout(a.timer),i(e instanceof Error?e:Error(String(e)))}})}handleMessage(e){if(e.type===`progress`){for(let t of this.progressListeners)t(e.progress);return}if(e.type===`compile-trace`){for(let t of this.traceListeners)t(e.requestId,e.event);return}let t=this.pending.get(e.requestId);if(t)switch(this.pending.delete(e.requestId),t.timer&&clearTimeout(t.timer),e.type){case`ready`:this.workerInitialized=!0,t.resolve(void 0);break;case`quiesced`:t.resolve(void 0);break;case`build-result`:t.resolve(e.result);break;case`error`:t.reject(Object.assign(Error(e.message),{code:e.code,stack:e.stack}))}}},Mt=``+new URL(`assets/runner.worker-C3ED68L7.js`,import.meta.url).href,Nt=Object.freeze({count:16,sourceBytes:1048576}),Pt=`createRuntimeDriver`,Ft=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function It(e,t){if(!Array.isArray(e))throw TypeError(`Browser runtime-driver plug-ins must be an array.`);if(e.length>Nt.count)throw RangeError(`At most ${Nt.count} browser runtime-driver plug-ins are allowed.`);if(e.length===0)return[];let n=zt(t,`Browser runtime-driver plug-in base URL`),r=new Set;return e.map((e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`Browser runtime-driver plug-in ${t} must be an object.`);let i=Lt(e.id,`Browser runtime-driver plug-in ${t} ID`);if(r.has(i))throw Error(`Browser runtime-driver plug-in '${i}' is declared more than once.`);if(r.add(i),typeof e.moduleUrl!=`string`||!e.moduleUrl||e.moduleUrl!==e.moduleUrl.trim())throw TypeError(`Browser runtime-driver plug-in '${i}' moduleUrl must be a non-empty trimmed string.`);let a=zt(new URL(e.moduleUrl,n).href,`Browser runtime-driver plug-in '${i}' module URL`);if(a.origin!==n.origin)throw Error(`Browser runtime-driver plug-in '${i}' must be loaded from ${n.origin}.`);if(a.username||a.password||a.hash)throw Error(`Browser runtime-driver plug-in '${i}' URL cannot contain credentials or a fragment.`);if(typeof e.sha256!=`string`||!/^[0-9a-f]{64}$/.test(e.sha256))throw Error(`Browser runtime-driver plug-in '${i}' SHA-256 must be lowercase hexadecimal.`);let o=Rt(e.exportName??Pt,i);return Object.freeze({id:i,moduleUrl:a.href,sha256:e.sha256,...o===Pt?{}:{exportName:o}})})}function Lt(e,t){if(typeof e!=`string`||!e||e!==e.trim()||e.length>128)throw Error(`${t} must be non-empty, trimmed, and at most 128 characters.`);return e}function Rt(e,t){if(typeof e!=`string`||!Ft.test(e)||e.length>128)throw Error(`Browser runtime-driver plug-in '${t}' exportName must be an ASCII JavaScript identifier.`);return e}function zt(e,t){let n;try{n=new URL(e)}catch{throw Error(`${t} must be a valid absolute URL.`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`${t} must use HTTP or HTTPS.`);return n}var Bt=12e4,Vt=3e5;function Ht(e){return e.language===`python`?Vt:Bt}var Ut=12e4,Wt=class{worker;pending=new Map;progressListeners=new Set;streamListeners=new Set;readyPromise;toolchains;additionalCostBaselines;runtimeDriverPlugins;costBaselines;disposed=!1;activeOperation;inFlightOperations=new Set;generation=0;workerInitialized=!1;constructor(e){if(!e||typeof e!=`object`)throw TypeError(`BrowserRunner requires explicit toolchain options.`);this.toolchains=c(e.toolchains),this.additionalCostBaselines=Object.freeze({...e.additionalCostBaselines}),this.runtimeDriverPlugins=e.runtimeDriverPlugins?.length?It(e.runtimeDriverPlugins,location.href):[],this.costBaselines=o(this.additionalCostBaselines),this.worker=this.createWorker(),this.readyPromise=this.initializeWorker()}initializeWorker(){let e=this.request({type:`initialize`,toolchains:this.toolchains,additionalCostBaselines:this.additionalCostBaselines,runtimeDriverPlugins:this.runtimeDriverPlugins},Ut);return e.catch(()=>void 0),e}onProgress(e){return this.assertActive(),this.progressListeners.add(e),()=>this.progressListeners.delete(e)}onStream(e){return this.assertActive(),this.streamListeners.add(e),()=>this.streamListeners.delete(e)}ready(){return this.assertActive(),this.readyPromise}run(e,t){return this.track(this.runOperation(e,t))}interact(e,t,n){return this.track(this.interactOperation(e,t,n))}async interactOperation(e,t,r){if(this.assertActive(),this.activeOperation)throw Error(`BrowserRunner accepts one active operation at a time.`);let i={kind:`interact`};this.activeOperation=i;let a=this.generation;try{if(await this.readyPromise,this.assertActive(),a!==this.generation)throw Error(`Browser interaction was superseded by a Worker replacement.`);let i=performance.now(),o=s(e,r.contestant.resources.instructionBudget,this.costBaselines),c=s(t,r.interactor.resources.instructionBudget,this.costBaselines),l=Math.min(r.contestant.resources.wallTimeLimitMs,r.interactor.resources.wallTimeLimitMs);return await this.request({type:`interact`,contestant:e,interactor:t,config:r},l,()=>({contestant:{code:137,stderr:`Interactive wall-time limit ${l} ms exceeded.`,termination:`wall-time-limit`,metrics:u(o,n)},interactor:{code:137,stderr:`Interactive wall-time limit ${l} ms exceeded.`,termination:`wall-time-limit`,metrics:u(c,n)},contestantToInteractor:``,interactorToContestant:``,durationMs:performance.now()-i,determinism:{...r.determinism}}),Math.max(Ht(e),Ht(t)))}finally{this.activeOperation===i&&(this.activeOperation=void 0)}}async runOperation(e,t){if(this.assertActive(),this.activeOperation)throw Error(`BrowserRunner accepts one active operation at a time.`);let r={kind:`run`};this.activeOperation=r;let i=this.generation;try{if(await this.readyPromise,this.assertActive(),i!==this.generation)throw Error(`Browser execution was superseded by a Worker replacement.`);let r=performance.now(),a=s(e,t.resources.instructionBudget,this.costBaselines);return await this.request({type:`run`,artifact:e,config:t},t.resources.wallTimeLimitMs,()=>({code:137,stdout:``,stderr:`Wall-time limit ${t.resources.wallTimeLimitMs} ms exceeded.`,files:{},durationMs:performance.now()-r,determinism:{...t.determinism},resources:{...t.resources},termination:`wall-time-limit`,metrics:u(a,n)}),Ht(e))}finally{this.activeOperation===r&&(this.activeOperation=void 0)}}clearRuntimeCache(){return this.track(this.clearRuntimeCacheOperation())}async clearRuntimeCacheOperation(){if(this.assertActive(),this.activeOperation)throw Error(`BrowserRunner accepts one active operation at a time.`);let e={kind:`cache-clear`};this.activeOperation=e;let t=this.generation;try{if(await this.readyPromise,this.assertActive(),t!==this.generation)throw Error(`Runtime cache clearing was superseded by a Worker replacement.`);await this.request({type:`clear-runtime-cache`},Ut)}finally{this.activeOperation===e&&(this.activeOperation=void 0)}}cancel(){this.disposed||this.activeOperation?.kind!==`cache-clear`&&this.replaceWorker(Error(`Execution cancelled.`))}async cancelAndWait(){for(this.cancel();this.inFlightOperations.size>0;)await Promise.allSettled([...this.inFlightOperations])}restart(){if(this.assertActive(),this.activeOperation?.kind===`cache-clear`)throw Error(`Cannot restart BrowserRunner while clearing its cache.`);this.replaceWorker(Error(`Runner worker restarted.`))}dispose(){this.disposed||(this.disposed=!0,this.generation+=1,this.activeOperation=void 0,this.worker.terminate(),this.rejectAll(Error(`Runner client disposed.`)),this.progressListeners.clear(),this.streamListeners.clear())}createWorker(){let e=pt(Mt,{name:`wasm-oj-runner`});return e.addEventListener(`message`,t=>{!this.disposed&&this.worker===e&&this.handleMessage(t.data)}),e.addEventListener(`error`,t=>{let n=Error(t.message||`The runner worker crashed.`);if(this.disposed||this.worker!==e)return;let r=this.workerInitialized;this.stopWorker(n),r&&this.installWorker()}),e}rejectAll(e){for(let t of this.pending.values())Gt(t),t.reject(e);this.pending.clear()}replaceWorker(e){this.stopWorker(e),this.installWorker()}stopWorker(e){this.generation+=1,(this.activeOperation?.kind===`run`||this.activeOperation?.kind===`interact`)&&(this.activeOperation=void 0),this.worker.terminate(),this.rejectAll(e),this.workerInitialized=!1}installWorker(){this.worker=this.createWorker(),this.readyPromise=this.initializeWorker()}assertActive(){if(this.disposed)throw Error(`BrowserRunner is disposed.`)}track(e){return this.inFlightOperations.add(e),e.then(()=>this.inFlightOperations.delete(e),()=>this.inFlightOperations.delete(e)),e}request(e,t,n,r=Ut){this.assertActive();let i=crypto.randomUUID();return new Promise((a,o)=>{let s={resolve:a,reject:o,timeoutMs:t,timeoutResult:n};this.pending.set(i,s),n?s.boundaryTimer=setTimeout(()=>{if(!this.pending.delete(i))return;let e=Error(`Runner runtime preparation exceeded the ${r} ms browser boundary.`);o(e),this.disposed||this.replaceWorker(e)},r):t!==void 0&&(s.boundaryTimer=setTimeout(()=>{if(!this.pending.delete(i))return;let e=Error(`Runner request exceeded the ${t} ms browser boundary.`);o(e),this.disposed||this.replaceWorker(e)},t));try{this.worker.postMessage({...e,requestId:i})}catch(e){this.pending.delete(i),Gt(s),o(e instanceof Error?e:Error(String(e)))}})}handleMessage(e){if(e.type===`progress`){for(let t of this.progressListeners)t(e.progress);e.progress.phase===`running`&&this.startWallTimer(e.requestId);return}if(e.type===`stream`){for(let t of this.streamListeners)t(e.stream,e.chunk);return}let t=this.pending.get(e.requestId);if(t)switch(this.pending.delete(e.requestId),Gt(t),e.type){case`ready`:this.workerInitialized=!0,t.resolve(void 0);break;case`run-result`:t.resolve(e.result);break;case`interactive-result`:t.resolve(e.result);break;case`runtime-cache-cleared`:t.resolve(void 0);break;case`error`:t.reject(Object.assign(Error(e.message),{code:e.code,stack:e.stack}))}}startWallTimer(e){let t=this.pending.get(e);!t||t.executionTimer||t.timeoutMs===void 0||!t.timeoutResult||(t.boundaryTimer&&=(clearTimeout(t.boundaryTimer),void 0),t.executionTimer=setTimeout(()=>{let t=this.pending.get(e);if(!t||!t.timeoutResult)return;this.pending.delete(e);let n=t.timeoutResult();this.replaceWorker(Error(`Runner worker replaced after wall-time termination.`)),t.resolve(n)},t.timeoutMs))}};function Gt(e){e.boundaryTimer&&clearTimeout(e.boundaryTimer),e.executionTimer&&clearTimeout(e.executionTimer),e.boundaryTimer=void 0,e.executionTimer=void 0}var Kt=new TextEncoder,qt=Kt.encode(`wasm-oj/runtime-bundle-payload\0`),Jt=1,Yt=2,Xt=8;function Zt(e){if(e.kind===`wasm`)return e.bytes;if(e.kind!==`runtime-bundle`)throw Error(`Unsupported artifact payload kind '${String(e.kind)}'.`);let t=F(e.files),n=[qt,$t(t.length,`Runtime bundle file count`)];for(let[e,r]of t){let t=Kt.encode(e),i,a;if(typeof r==`string`)i=Jt,a=Kt.encode(r);else if(r instanceof Uint8Array)i=Yt,a=r;else throw Error(`Runtime bundle file '${e}' must contain text or Uint8Array bytes.`);n.push($t(t.byteLength,`Runtime bundle path '${e}' byte length`),t,Uint8Array.of(i),$t(a.byteLength,`Runtime bundle file '${e}' byte length`),a)}return en(n)}function Qt(e){return I(Zt(e))}function $t(e,t){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`${t} must be a non-negative safe integer.`);let n=new Uint8Array(Xt);return new DataView(n.buffer).setBigUint64(0,BigInt(e),!1),n}function en(e){let t=e.reduce((e,t)=>{let n=e+t.byteLength;if(!Number.isSafeInteger(n))throw RangeError(`Artifact payload framing exceeds the safe integer range.`);return n},0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}var tn=`weighted`;Object.freeze({instructionBudget:1e10,logicalTimeLimitMs:6e4,memoryLimitBytes:268435456,outputLimitBytes:4194304,filesystemWriteLimitBytes:67108864,filesystemEntryLimit:4096,wallTimeLimitMs:6e4}),new TextEncoder,Object.freeze({runtimeCoreWasmSha256:`92500f3a2e65fe6979e893179d8000e12d66822c160eeb779b0d4fe0a6b55603`,runtimeSourceRootSha256:`3ef42cb2c70e7013e4a6f9d4d7457a7071101795fbd3753efcd20c1ac338ebd5`,wasmerNativeVersion:`7.2.1`,wasmerSdkVersion:`0.10.0`,wasmerSdkWasmSha256:`49a6646209f5ab5e7c737eac33407d87d9a9959ac83e5ecaaab9261b2323589e`,wasmerWasixVersion:`0.702.1`});var nn=`24c0bcff9820fbfd1fd4db1c57e2a866b83041409dd22b5b725688739bd3e223`;function rn(e,t,n){return m(e),[`wasm-oj-cost`,`contract-${d}`,encodeURIComponent(e),t,n]}function an(e,t,n,r){let i=h(e)?Ve(e):r;if(!i||!/^[A-Za-z0-9._-]+$/.test(i))throw Error(h(e)?`WASM-OJ toolchain content identity is invalid for '${e}'.`:`Downstream language '${e}' requires an explicit content identity using letters, digits, '.', '_' or '-'.`);return[...rn(e,t,n),`content-${i}`,`runtime-${nn}`,tn].join(`:`)}function on(e,t,n,r){let i=`${rn(t,n,r).join(`:`)}:content-`,a=`:runtime-${nn}:${tn}`;if(!e.startsWith(i)||!e.endsWith(a))return!1;let o=e.slice(i.length,-a.length);return!!o&&/^[A-Za-z0-9._-]+$/.test(o)}var sn=new TextEncoder,cn=Object.freeze({python:`python`,javascript:`qjs`,typescript:`qjs`});function K(e,t,n=16384){if(typeof e!=`string`||!e||e!==e.trim()||e.length>n)throw Error(`${t} must be a non-empty, trimmed string of at most ${n} characters.`)}function ln(e){return JSON.stringify({schema:f.runtimeBundle,version:d,name:e.name,target:e.target,language:e.language,runtime:{package:e.runtimePackage,command:e.command},execution:{deterministic:!0,contractVersion:d},entry:e.entry,files:[...e.files]},null,2)}function un(e,t,n,r){return K(e.name,`Project name`),K(t,`Runtime package`),K(n,`Runtime command`,128),m(e.config.language),P(r,`Runtime bundle entry`),ln({name:e.name,target:e.config.target,language:e.config.language,runtimePackage:t,command:n,entry:r,files:Ke(e.files).map(e=>e.path)})}function dn(e){let t;try{t=JSON.parse(e.manifest)}catch(e){throw Error(`Runtime bundle manifest is not valid JSON.`,{cause:e})}if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Runtime bundle manifest must be a JSON object.`);let n=t,r=n.runtime,i=n.execution;if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`Runtime bundle manifest runtime must be an object.`);if(!i||typeof i!=`object`||Array.isArray(i))throw Error(`Runtime bundle manifest execution must be an object.`);let a=r,o=i;if(K(n.name,`Runtime bundle manifest name`),K(a.package,`Runtime bundle manifest package`),K(a.command,`Runtime bundle manifest command`,128),n.target!==`wasip1`&&n.target!==`wasix`)throw Error(`Runtime bundle manifest has an invalid target.`);if(typeof n.language!=`string`)throw Error(`Runtime bundle manifest has an invalid language.`);if(m(n.language),typeof n.entry!=`string`)throw Error(`Runtime bundle manifest has an invalid entry.`);if(P(n.entry,`Runtime bundle manifest entry`),!Array.isArray(n.files))throw Error(`Runtime bundle manifest files must be an array.`);let s=n.files.map((e,t)=>(P(e,`Runtime bundle manifest file ${t}`),e)),c=[...s].sort((e,t)=>e<t?-1:+(e>t));if(new Set(s).size!==s.length||JSON.stringify(s)!==JSON.stringify(c))throw Error(`Runtime bundle manifest files must be unique and canonically sorted.`);if(n.schema!==f.runtimeBundle||n.version!==d||o.deterministic!==!0||o.contractVersion!==d)throw Error(`Runtime bundle manifest does not match the current WASM-OJ contract.`);let l={name:n.name,target:n.target,language:n.language,runtimePackage:a.package,command:a.command,entry:n.entry,files:s};if(e.manifest!==ln(l))throw Error(`Runtime bundle manifest must use the canonical WASM-OJ representation without extra fields.`);return l}function fn(e){switch(e.config.language){case`c`:case`cpp`:case`go`:case`rust`:return`${e.name}.wasm`;case`python`:return`${e.name}.python-${e.config.target}.json`;case`javascript`:case`typescript`:return`${e.name}.${e.config.language}-${e.config.target}.json`;default:throw Error(`WASM-OJ has no built-in artifact name for '${e.config.language}'.`)}}function pn(e){if(e.config.language===`python`){if(!e.config.entry.endsWith(`.py`))throw Error(`Python entry files must end in '.py'.`);return`build/${e.config.entry.slice(0,-3)}.pyc`}if(e.config.language===`typescript`){if(!e.config.entry.endsWith(`.ts`))throw Error(`TypeScript entry files must end in '.ts'.`);return`${e.config.entry.slice(0,-3)}.js`}return e.config.entry}function mn(e){if(e.wasmOjContract!==d)throw Error(`Artifact WASM-OJ contract '${String(e.wasmOjContract)}' is unsupported; expected '${d}'.`);if(K(e.id,`Artifact id`),K(e.projectId,`Artifact projectId`),K(e.cacheKey,`Artifact cacheKey`),K(e.name,`Artifact name`),typeof e.language!=`string`)throw Error(`Artifact language must be a string.`);if(m(e.language),e.target!==`wasip1`&&e.target!==`wasix`)throw Error(`Artifact target is invalid.`);if(e.optimization!==`debug`&&e.optimization!==`release`)throw Error(`Artifact optimization is invalid.`);if(typeof e.createdAt!=`number`||!Number.isFinite(e.createdAt)||e.createdAt<0)throw Error(`Artifact createdAt must be a non-negative finite number.`);if(typeof e.durationMs!=`number`||!Number.isFinite(e.durationMs)||e.durationMs<0)throw Error(`Artifact durationMs must be a non-negative finite number.`);if(!Number.isSafeInteger(e.size)||e.size<0)throw Error(`Artifact size must be a non-negative safe integer.`);if(!Array.isArray(e.toolchains))throw Error(`Artifact toolchains must be an array.`);let t=e.toolchains;if(t.length===0||t.some(e=>typeof e!=`string`||!e||e!==e.trim())||new Set(t).size!==t.length)throw Error(`Artifact toolchains must be non-empty, unique, trimmed identities.`);if(K(e.costProfile,`Artifact costProfile`),e.dependencyLockSha256!==void 0&&(typeof e.dependencyLockSha256!=`string`||!/^[0-9a-f]{64}$/.test(e.dependencyLockSha256)))throw Error(`Artifact dependencyLockSha256 must be lowercase SHA-256 hexadecimal.`)}function hn(e){if(!h(e.language))return;let t=He[e.language];if(!t.targets.includes(e.target))throw Error(`Artifact target '${e.target}' is unsupported for built-in language '${e.language}'.`);if(e.kind!==t.artifact)throw Error(`Built-in '${e.language}' artifacts must use kind '${t.artifact}', not '${e.kind}'.`);let n=Ue(e.language);if(JSON.stringify(e.toolchains)!==JSON.stringify(n))throw Error(`Artifact toolchains do not match the canonical '${e.language}' toolchain identities.`);let r=an(e.language,e.target,e.optimization);if(e.costProfile!==r)throw Error(`Artifact cost profile '${e.costProfile}' does not match ${e.language}/${e.target}/${e.optimization}.`);if(e.kind===`runtime-bundle`){let n=cn[e.language];if(e.runtimePackage!==t.runtimePackage||e.command!==n)throw Error(`Built-in '${e.language}' artifact runtime package or command is not canonical.`)}}function gn(e){K(e.runtimePackage,`Runtime bundle package`),K(e.command,`Runtime bundle command`,128),P(e.entry,`Runtime bundle entry`),K(e.manifest,`Runtime bundle manifest`,1048576);let t=F(e.files);for(let[e,n]of t)if(typeof n!=`string`&&!(n instanceof Uint8Array))throw Error(`Runtime bundle file '${e}' must contain text or Uint8Array bytes.`);if(!Object.hasOwn(e.files,e.entry))throw Error(`Runtime bundle entry '${e.entry}' is not present in its files.`);if(e.files[`wasm-oj.manifest.json`]!==e.manifest)throw Error(`Runtime bundle must contain its exact manifest at 'wasm-oj.manifest.json'.`);let n=dn(e);if(n.target!==e.target||n.language!==e.language||n.runtimePackage!==e.runtimePackage||n.command!==e.command||n.entry!==e.entry)throw Error(`Runtime bundle manifest metadata does not match its artifact metadata.`);return n}function _n(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Build artifact must be an object.`);let n=e;if(mn(n),n.kind!==`wasm`&&n.kind!==`runtime-bundle`)throw Error(`Artifact kind must be 'wasm' or 'runtime-bundle'.`);let r=e,i,a;if(r.kind===`wasm`){if(!(r.bytes instanceof Uint8Array))throw Error(`Wasm artifact bytes must be a Uint8Array.`);a=r.bytes.byteLength}else i=gn(r),a=F(r.files).reduce((e,[,t])=>e+(typeof t==`string`?sn.encode(t).byteLength:t.byteLength),0);if(r.size!==a)throw Error(`Artifact size ${r.size} does not match payload size ${a}.`);if(hn(r),!h(r.language)&&!on(r.costProfile,r.language,r.target,r.optimization))throw Error(`Artifact cost profile '${r.costProfile}' does not match ${r.language}/${r.target}/${r.optimization}.`);if(!t)return;let{project:o,cacheKey:s}=t;Ke(o.files);let c={cacheKey:s,projectId:o.id,language:o.config.language,target:o.config.target,optimization:o.config.optimization,dependencyLockSha256:o.dependencies?.lockSha256};for(let e of[`cacheKey`,`projectId`,`language`,`target`,`optimization`,`dependencyLockSha256`])if(r[e]!==c[e])throw Error(`Artifact ${e} '${String(r[e])}' does not match build identity '${String(c[e])}'.`);if(!h(o.config.language))return;let l=fn(o);if(r.name!==l)throw Error(`Artifact name '${r.name}' does not match build identity '${l}'.`);if(r.kind===`runtime-bundle`){let e=pn(o);if(r.entry!==e)throw Error(`Artifact entry '${r.entry}' does not match build identity '${e}'.`);let t=un(o,r.runtimePackage,r.command,e);if(r.manifest!==t||i?.name!==o.name)throw Error(`Runtime bundle manifest does not match the canonical project build identity.`)}}Object.freeze({randomSeed:1592594996,realtimeEpochMs:Date.UTC(2e3,0,1),clockStepNs:1e6});var vn=Object.freeze([`id`,`name`,`files`,`config`,`activeFile`,`updatedAt`]);Object.freeze([...vn,`dependencies`]),Object.freeze([`path`,`language`,`content`]),Object.freeze([`language`,`target`,`optimization`,`entry`,`args`,`stdin`,`env`,`determinism`,`resources`]),Object.freeze([`randomSeed`,`realtimeEpochMs`,`clockStepNs`]),Object.freeze([`instructionBudget`,`logicalTimeLimitMs`,`memoryLimitBytes`,`outputLimitBytes`,`filesystemWriteLimitBytes`,`filesystemEntryLimit`,`wallTimeLimitMs`]);var yn=`projects`,q=`artifacts`,bn=/^[0-9a-f]{64}$/u;function J(e){return new Promise((t,n)=>{e.addEventListener(`success`,()=>t(e.result),{once:!0}),e.addEventListener(`error`,()=>{n(e.error??Error(`IndexedDB request failed without an error.`))},{once:!0})})}function Y(e){return new Promise((t,n)=>{e.addEventListener(`complete`,()=>t(),{once:!0}),e.addEventListener(`abort`,()=>{n(e.error??Error(`IndexedDB transaction aborted without an error.`))},{once:!0}),e.addEventListener(`error`,()=>{n(e.error??Error(`IndexedDB transaction failed without an error.`))},{once:!0})})}var X;function Z(){if(X)return X;let e=new Promise((t,n)=>{let r=indexedDB.open(p.database,p.databaseVersion),i=!1,a=e=>{i||(i=!0,n(e))};r.addEventListener(`upgradeneeded`,()=>{let e=r.result;e.objectStoreNames.contains(yn)||e.createObjectStore(yn,{keyPath:`id`}).createIndex(`updatedAt`,`updatedAt`),e.objectStoreNames.contains(q)||e.createObjectStore(q,{keyPath:`cacheKey`}).createIndex(`createdAt`,`createdAt`)}),r.addEventListener(`success`,()=>{let n=r.result;if(i){n.close();return}i=!0;let a=()=>{X===e&&(X=void 0)};n.addEventListener(`versionchange`,()=>{n.close(),a()},{once:!0}),n.addEventListener(`close`,a,{once:!0}),t(n)},{once:!0}),r.addEventListener(`error`,()=>{a(r.error??Error(`Unable to open WASM-OJ storage.`))},{once:!0}),r.addEventListener(`blocked`,()=>{a(Error(`WASM-OJ storage upgrade is blocked by another open tab.`))},{once:!0})});return X=e,e.catch(()=>{X===e&&(X=void 0)}),e}async function xn(e){let t=structuredClone(e);_n(t);let n=Zt(t),r={artifact:t,byteLength:n.byteLength,cacheKey:t.cacheKey,createdAt:t.createdAt,lastAccessedAt:Date.now(),payloadSha256:await I(n)},i=(await Z()).transaction(q,`readwrite`);i.objectStore(q).put(r),await Y(i),await Cn(20)}async function Sn(e){let t=(await Z()).transaction(q,`readonly`),n=await J(t.objectStore(q).get(e));if(await Y(t),n===void 0)return;let r;try{r=Dn(n,e)}catch(t){await kn(e,t);return}if(await Qt(r.artifact)!==r.payloadSha256){await kn(e,Error(`Artifact payload SHA-256 does not match its stored digest.`));return}return await On(e),r.artifact}async function Q(e){let t=(await Z()).transaction(q,`readwrite`);t.objectStore(q).delete(e),await Y(t)}async function Cn(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`Artifact retention count must be a non-negative safe integer.`);let t=(await Z()).transaction(q,`readwrite`),n=t.objectStore(q);(await J(n.getAll())).sort((e,t)=>t.createdAt-e.createdAt).slice(e).forEach(e=>n.delete(e.cacheKey)),await Y(t)}async function wn(){let e=(await Z()).transaction(q,`readwrite`);e.objectStore(q).clear(),await Y(e)}async function Tn(){let e=(await Z()).transaction(q,`readonly`),t=await J(e.objectStore(q).getAll());return await Y(e),t.map(e=>{let t=Dn(e);return{key:t.cacheKey,byteLength:t.byteLength,lastAccessedAt:t.lastAccessedAt}})}function En(){return{id:`artifacts`,retentionPriority:20,list:Tn,delete:Q,clear:wn}}function Dn(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Persisted artifact record must be an object.`);let n=e,r=Object.keys(n).sort();if(JSON.stringify(r)!==JSON.stringify([`artifact`,`byteLength`,`cacheKey`,`createdAt`,`lastAccessedAt`,`payloadSha256`]))throw Error(`Persisted artifact record has an invalid shape.`);if(t!==void 0&&n.cacheKey!==t)throw Error(`Persisted artifact record cache key does not match its IndexedDB key.`);if(typeof n.payloadSha256!=`string`||!bn.test(n.payloadSha256))throw Error(`Persisted artifact payload digest must be a lowercase SHA-256 hexadecimal string.`);if(!Number.isSafeInteger(n.byteLength)||n.byteLength<0||!Number.isSafeInteger(n.lastAccessedAt)||n.lastAccessedAt<0)throw Error(`Persisted artifact storage metadata is invalid.`);let i=n.artifact;if(_n(i),i.cacheKey!==n.cacheKey||i.createdAt!==n.createdAt)throw Error(`Persisted artifact index fields do not match the artifact metadata.`);return n}async function On(e){let t=(await Z()).transaction(q,`readwrite`),n=t.objectStore(q),r=await J(n.get(e));if(r!==void 0){let t=Dn(r,e);n.put({...t,lastAccessedAt:Date.now()})}await Y(t)}async function kn(e,t){console.warn(`Ignoring invalid cached artifact '${e}'.`,t);try{await Q(e)}catch(t){console.warn(`Unable to evict invalid cached artifact '${e}'.`,t)}}var An=class extends e{dependencyCache;constructor(e,t,n,r,i){super({compiler:e,runner:t,artifactStore:r?{load:Sn,save:xn,delete:Q,clear:wn}:void 0,dependencyManager:a(n,{networkAuthorizer:i})}),this.dependencyCache=n}dispose(){super.dispose(),this.dependencyCache.close()}};async function jn(e){if(!e||typeof e!=`object`)throw TypeError(`createBrowserEngine requires explicit toolchain options.`);let t=c(e.toolchains),n,r,i,a;try{return i=new B,n=new jt({toolchains:t}),r=new Wt({toolchains:t,additionalCostBaselines:e.additionalCostBaselines,runtimeDriverPlugins:e.runtimeDriverPlugins}),a=new An(n,r,i,e.artifactCache!==!1,e.dependencyNetworkAuthorizer),await a.ready(),a}catch(e){throw a?a.dispose():(r?.dispose(),n?.dispose(),i?.close()),e}}async function Mn(e={}){if(typeof navigator>`u`||!(`serviceWorker`in navigator))return;let t=e.scriptUrl??`/toolchain-cache-sw.js`,n=e.scope??`/`;if(typeof n!=`string`||!n)throw TypeError(`WASM-OJ toolchain cache service-worker scope must be a non-empty string.`);let r=await navigator.serviceWorker.register(t,{scope:n,updateViaCache:`none`});return await Nn(await Pn(r),e.chunkManifestUrl),r}async function Nn(e,t){let n=null;if(t!==void 0){let e=new URL(t,location.href);if(e.origin!==location.origin||e.search||e.hash||e.pathname!==`/toolchains/wasm-oj-sites-chunks.json`)throw Error(`WASM-OJ toolchain chunk manifest must use the canonical same-origin deployment path.`);n=e.pathname}let r=new MessageChannel,i=new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`WASM-OJ toolchain chunk configuration timed out.`)),5e3);r.port1.onmessage=i=>{clearTimeout(n),r.port1.close(),i.data&&typeof i.data==`object`&&`ok`in i.data&&i.data.ok===!0?e():t(Error(`WASM-OJ toolchain cache service worker rejected its chunk manifest configuration.`))}});e.postMessage({type:`configure-toolchain-chunks`,path:n},[r.port2]),await i}function Pn(e){let t=e.installing??e.waiting??e.active;return t?t.state===`activated`?Promise.resolve(t):new Promise((e,n)=>{let r=()=>{t.state===`activated`?(t.removeEventListener(`statechange`,r),e(t)):t.state===`redundant`&&(t.removeEventListener(`statechange`,r),n(Error(`WASM-OJ toolchain cache service worker became redundant before activation.`)))};t.addEventListener(`statechange`,r),r()}):Promise.reject(Error(`WASM-OJ toolchain cache registration has no service-worker instance.`))}var Fn=2147483648,In=268435456,Ln=.7,Rn=`X-WASM-OJ-Byte-Length`,zn=`X-WASM-OJ-Cached-At`,Bn=class{storageManager;lockManager;participants;maxCacheBytes;minimumFreeBytes;quotaFraction;constructor(e={}){let t=e.storageManager??navigator.storage,n=e.lockManager??navigator.locks;if(!t||typeof t.estimate!=`function`||typeof t.persist!=`function`)throw Error(`WASM-OJ storage coordination requires the StorageManager API.`);if(!n||typeof n.request!=`function`)throw Error(`WASM-OJ storage coordination requires the Web Locks API for cross-tab safety.`);this.storageManager=t,this.lockManager=n,this.participants=Gn(e.participants??[]),this.maxCacheBytes=$(e.maxCacheBytes??Fn,`maximum cache bytes`),this.minimumFreeBytes=$(e.minimumFreeBytes??In,`minimum free bytes`),this.quotaFraction=Xn(e.quotaFraction??Ln)}async estimate(){let[e,t]=await Promise.all([this.storageManager.estimate(),this.snapshotParticipants()]);return Un(e,t,this.maxCacheBytes,this.minimumFreeBytes,this.quotaFraction)}async maintain(e=0){return e=$(e,`incoming bytes`),this.exclusive(async()=>{let[t,n]=await Promise.all([this.storageManager.estimate(),this.snapshotParticipants()]),r=Un(t,n,this.maxCacheBytes,this.minimumFreeBytes,this.quotaFraction),i=Wn(r,e),a=n.flatMap(({participant:e,entries:t})=>t.map(t=>({participant:e,entry:t}))).sort((e,t)=>e.participant.retentionPriority-t.participant.retentionPriority||e.entry.lastAccessedAt-t.entry.lastAccessedAt||e.participant.id.localeCompare(t.participant.id)||e.entry.key.localeCompare(t.entry.key)),o=[],s=0;for(let e of a){if(s>=i)break;await e.participant.delete(e.entry.key),s+=e.entry.byteLength,o.push({participantId:e.participant.id,key:e.entry.key,byteLength:e.entry.byteLength})}return{before:r,after:await this.estimateUnlocked(),evicted:o}})}async admit(e){let t=await this.maintain(e);if(t.evicted.reduce((e,t)=>e+t.byteLength,0)<Wn(t.before,e))throw new DOMException(`WASM-OJ browser storage cannot admit the requested payload within its configured budget.`,`QuotaExceededError`);return t}async clear(){await this.exclusive(async()=>{for(let e of this.participants)await e.clear()})}requestPersistence(){return this.storageManager.persist()}async estimateUnlocked(){let[e,t]=await Promise.all([this.storageManager.estimate(),this.snapshotParticipants()]);return Un(e,t,this.maxCacheBytes,this.minimumFreeBytes,this.quotaFraction)}async snapshotParticipants(){return Promise.all(this.participants.map(async e=>{let t=[...await e.list()].map(qn),n=t.map(e=>e.key);if(new Set(n).size!==n.length)throw Error(`Storage participant '${e.id}' returned duplicate keys.`);return{participant:e,entries:t}}))}async exclusive(e){return await this.lockManager.request(`${p.database}:coordinator`,{mode:`exclusive`},async()=>await e())}};function Vn(e={}){let t=e.cacheStorage??caches,n=new B;return new Bn({...e,cacheStorage:t,participants:[Ct(),En(),n.storageParticipant(),Hn(t,p.runtimeFilesCache,`runtime-files`,50),Hn(t,p.toolchainCache,`toolchains`,100)]})}function Hn(e,t,n,r){return Kn(n,r),{id:n,retentionPriority:r,async list(){let n=await e.open(t),r=await n.keys(),i=[];for(let e of r){let t=await n.match(e);if(!t)continue;let r=Yn(t.headers.get(Rn)),a=Yn(t.headers.get(zn));if(r===void 0||a===void 0){await n.delete(e);continue}i.push({key:e.url,byteLength:r,lastAccessedAt:a})}return i},async delete(n){await(await e.open(t)).delete(n)},async clear(){await e.delete(t)}}}function Un(e,t,n,r,i){let a=$(e.usage??0,`browser storage usage`),o=$(e.quota??0,`browser storage quota`),s=t.map(({participant:e,entries:t})=>({id:e.id,byteLength:t.reduce(Jn,0),entryCount:t.length,retentionPriority:e.retentionPriority})),c=o>0?Math.floor(o*i):n;return{usage:a,quota:o,logicalCacheBytes:s.reduce((e,t)=>e+t.byteLength,0),logicalCacheBudget:Math.min(n,c),minimumFreeBytes:r,participants:s}}function Wn(e,t){let n=Math.max(0,e.logicalCacheBytes+t-e.logicalCacheBudget),r=e.quota>0?Math.max(0,e.usage+t+e.minimumFreeBytes-e.quota):0;return Math.max(n,r)}function Gn(e){let t=e.map(e=>{if(!e||typeof e.list!=`function`||typeof e.delete!=`function`||typeof e.clear!=`function`)throw Error(`Storage participants must implement list(), delete(), and clear().`);return Kn(e.id,e.retentionPriority),e}),n=t.map(e=>e.id);if(new Set(n).size!==n.length)throw Error(`Storage participant IDs must be unique.`);return t.sort((e,t)=>e.id.localeCompare(t.id))}function Kn(e,t){if(!e||e!==e.trim()||e.includes(`\0`))throw Error(`Storage participant IDs must be non-empty and canonical.`);$(t,`storage participant '${e}' retention priority`)}function qn(e){if(!e||typeof e.key!=`string`||!e.key||e.key!==e.key.trim()||e.key.includes(`\0`))throw Error(`Storage entry keys must be non-empty and canonical.`);return{key:e.key,byteLength:$(e.byteLength,`storage entry '${e.key}' byte length`),lastAccessedAt:$(e.lastAccessedAt,`storage entry '${e.key}' access time`)}}function Jn(e,t){let n=e+t.byteLength;if(!Number.isSafeInteger(n))throw Error(`Coordinated storage size exceeds the safe integer range.`);return n}function Yn(e){if(e===null||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0}function $(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer.`);return e}function Xn(e){if(!Number.isFinite(e)||e<=0||e>1)throw Error(`Storage quota fraction must be in (0, 1].`);return e}export{Nt as BROWSER_RUNTIME_PLUGIN_LIMITS,jt as BrowserCompiler,Wt as BrowserRunner,B as IndexedDbDependencyCache,Bn as StorageCoordinator,Hn as cacheStorageParticipant,jn as createBrowserEngine,Vn as createDefaultBrowserStorageCoordinator,Mn as registerToolchainCache,It as validateBrowserRuntimeDriverPlugins};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
-----------
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2018-2022 Guy Bedford
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arjun Barrett
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|