code-playpad 0.14.1 → 0.15.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/README.md +67 -6
- package/dist/THIRD-PARTY-NOTICES.txt +25 -0
- package/dist/{boot-DW1YzgCY.js → boot-BVedZD8N.js} +1 -1
- package/dist/cdn.js +2 -2
- package/dist/clike-C2M2Cbvf.js +6 -0
- package/dist/compiler-cache-XwslsU5H.js +6 -0
- package/dist/compiler-license-manifest.json +11 -8
- package/dist/config-3Z6xX6Jr.js +6 -0
- package/dist/cpp-BxFy0NSM.js +6 -0
- package/dist/cpp-CI2vFLOK.js +1 -0
- package/dist/csharp-B4M3Us-m.js +1 -0
- package/dist/csharp-ByGGaB0V.js +6 -0
- package/dist/{element-BuS9dUwa.js → element-UgFuSGoC.js} +3 -3
- package/dist/element.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{java-DjuG1fCk.js → java-2z8CcJaR.js} +1 -1
- package/dist/{java-DkfYRvpA.js → java-BYlTOHGf.js} +1 -1
- package/dist/{javascript-BSjoEAXh.js → javascript-CNLIMOk1.js} +1 -1
- package/dist/{javascript-BBiCDtZ3.js → javascript-kqyWH6DS.js} +1 -1
- package/dist/{next-9Fyfv6iD.js → next-C9S3EZEz.js} +1 -1
- package/dist/{next-CO6N0Gb9.js → next-xTgh8PXL.js} +1 -1
- package/dist/{pyodide-QurAOd7j.js → pyodide-C5KhmXre.js} +1 -1
- package/dist/{pyodide-ZBchw4qA.js → pyodide-Cr69zEd2.js} +1 -1
- package/dist/{react-DgCTfCMl.js → react-BKPRfjtf.js} +1 -1
- package/dist/{react-DI6SODv8.js → react-DPG8BrcN.js} +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/config.d.ts +12 -0
- package/dist/runtime/csharp/cache.d.ts +2 -0
- package/dist/runtime/csharp/project.d.ts +5 -0
- package/dist/runtime/csharp/worker.d.ts +1 -0
- package/dist/runtime/csharp-worker.generated.d.ts +1 -0
- package/dist/runtime/csharp.d.ts +2 -0
- package/dist/runtime/worker-runtime.d.ts +8 -0
- package/dist/standalone.js +10 -10
- package/dist/worker-runtime-5Ujf07eB.js +4 -0
- package/dist/worker-runtime-Ub9rvLo_.js +9 -0
- package/package.json +9 -3
- package/dist/config-DB58UVsk.js +0 -6
- package/dist/cpp-Bhr_Zgfk.js +0 -6
- package/dist/cpp-C8YnpTSR.js +0 -1
- package/dist/worker-runtime-Dd2eBtq3.js +0 -4
- package/dist/worker-runtime-DvpugeXD.js +0 -9
package/README.md
CHANGED
|
@@ -9,14 +9,14 @@ experimental C and C++, multi-file React, and Next.js App Router projects — en
|
|
|
9
9
|
**[Live demo →](https://code-playpad.swengr.com)**
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.
|
|
12
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.15.0/dist/standalone.js"></script>
|
|
13
13
|
|
|
14
14
|
<code-playpad height="auto">
|
|
15
15
|
print("hello from a static page")
|
|
16
16
|
</code-playpad>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
**Contents** — [Languages](#languages) · [Experimental C/C++](#experimental-cc) · [React](#react) · [Next.js](#nextjs)
|
|
19
|
+
**Contents** — [Languages](#languages) · [Experimental C/C++](#experimental-cc) · [Experimental C#](#experimental-c) · [React](#react) · [Next.js](#nextjs)
|
|
20
20
|
· [Install](#install) · [Attributes](#attributes) · [Sizing](#sizing) · [Several files](#several-files) · [Input](#input)
|
|
21
21
|
· [Controlling it from JavaScript](#controlling-it-from-javascript)
|
|
22
22
|
· [Events and grading](#events-and-grading) · [Saving work](#saving-work)
|
|
@@ -32,6 +32,7 @@ experimental C and C++, multi-file React, and Next.js App Router projects — en
|
|
|
32
32
|
| `typescript` | Same engine, types stripped before running | nothing from another service: a ~47 KB (gzipped) transform chunk of this package, loaded the first time a widget needs it |
|
|
33
33
|
| `java` | A documented subset of Java 25, compiled and interpreted in a Worker by an engine built for this package — see [Java](#java) | nothing: the engine is a ~105 KB (gzipped) chunk of this package, loaded with the first Java widget, and its library a ~75 KB chunk loaded the first time a program uses it |
|
|
34
34
|
| `c`, `cpp` | Experimental: C17 and C++20, compiled by a real Clang compiler in a Worker — see [Experimental C/C++](#experimental-cc) | ~30 MB on the first C/C++ Run, then cached |
|
|
35
|
+
| `csharp`, `cs` | Experimental: C# 14, compiled by the real Roslyn compiler on .NET WebAssembly in a Worker — see [Experimental C#](#experimental-c) | ~14 MB on the first C# Run, then cached |
|
|
35
36
|
| `react` | A multi-file React project, rendered in a sandboxed preview with a console — see [React](#react) | nothing from another service: ~208 KB (gzipped) of this package's chunks, loaded with the first React widget |
|
|
36
37
|
| `next` | A Next.js App Router project, with server components and server actions running in a Worker in the sandboxed preview — see [Next.js](#nextjs) | nothing from another service: part of this package, loaded the first time a widget runs; Tailwind only for projects that use it |
|
|
37
38
|
|
|
@@ -198,6 +199,45 @@ Inside HTML, write `<` as `<`. They are experimental:
|
|
|
198
199
|
browser suite. One physical phone was checked by hand; memory on phones has
|
|
199
200
|
not been measured.
|
|
200
201
|
|
|
202
|
+
## Experimental C#
|
|
203
|
+
|
|
204
|
+
`language="csharp"` (or `cs`) compiles C# 14 with the real Roslyn compiler and runs it on
|
|
205
|
+
the .NET WebAssembly runtime in a worker, with prefilled stdin and Stop. No setup is needed:
|
|
206
|
+
|
|
207
|
+
```html
|
|
208
|
+
<code-playpad language="csharp" height="auto">
|
|
209
|
+
var numbers = new List<int> { 3, 1, 2 };
|
|
210
|
+
numbers.Sort();
|
|
211
|
+
Console.WriteLine(string.Join(" ", numbers));
|
|
212
|
+
</code-playpad>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Inside HTML, write `<` as `<`. It is experimental:
|
|
216
|
+
|
|
217
|
+
- **The compiler loads on the first C# Run.** It is a separate package,
|
|
218
|
+
[`@code-playpad/csharp-toolchain`](https://www.npmjs.com/package/@code-playpad/csharp-toolchain),
|
|
219
|
+
fetched from jsDelivr and checked by SHA-256 on every Run. You don't install it, and
|
|
220
|
+
installing `code-playpad` doesn't download it. A page with a strict
|
|
221
|
+
Content-Security-Policy must allow the host in `connect-src`, `blob:` in
|
|
222
|
+
`script-src` and `worker-src`, and `'wasm-unsafe-eval'`. To host it yourself, see
|
|
223
|
+
[Production](#production).
|
|
224
|
+
- **Every Run starts fresh.** Each Run gets a new worker and starts the compiler again,
|
|
225
|
+
so nothing crosses between Runs. In local tests that took about 1 second on a laptop,
|
|
226
|
+
and a program with hundreds of methods took 9–13 seconds. An earlier prototype took
|
|
227
|
+
about 2 seconds on one iPhone; this runtime, which also checks every file on each Run,
|
|
228
|
+
hasn't been measured on a phone.
|
|
229
|
+
- **Not everything works.** Threads and blocking on an unfinished task throw
|
|
230
|
+
`PlatformNotSupportedException`, though `await` works. Input must be prefilled, and
|
|
231
|
+
tasks still pending when Main returns are ended with the worker. A project is up to 32
|
|
232
|
+
`.cs` files and 2 MB. A run stops after 120 seconds; change that with
|
|
233
|
+
`configureCSharp({ timeoutMs })`.
|
|
234
|
+
- **Lightly tested on phones.** Desktop Chromium, WebKit and Firefox pass the browser
|
|
235
|
+
suite. It has been checked by hand in Chrome on one iPhone. Android and Safari on a
|
|
236
|
+
phone are untested.
|
|
237
|
+
- **Syntax highlighting** needs the optional peer `@codemirror/legacy-modes`.
|
|
238
|
+
|
|
239
|
+
This is an independent project, not affiliated with or endorsed by Microsoft.
|
|
240
|
+
|
|
201
241
|
## React
|
|
202
242
|
|
|
203
243
|
`language="react"` renders a React project next to the editor, in a sandboxed
|
|
@@ -407,6 +447,7 @@ actually sent.
|
|
|
407
447
|
| Java | **288.1 KB** (0.8.0: engine 0.39) | nothing | 216.4 KB |
|
|
408
448
|
| Java, with collections | **373.1 KB** (0.8.0) | nothing | 233.2 KB |
|
|
409
449
|
| C or C++ (experimental) | **187.0 KB** | the compiler, about **29.9 MB**, from the host you configure | — |
|
|
450
|
+
| C# (experimental) | **171.2 KB** (0.15.0) | the compiler, about **13.8 MB**, from jsDelivr or a host you configure | — |
|
|
410
451
|
| All five | 520.0 KB | Pyodide and the C/C++ compiler | 273.9 KB |
|
|
411
452
|
|
|
412
453
|
- **Every row includes a 144.5 KB shared base:** the editor (CodeMirror) and
|
|
@@ -463,7 +504,7 @@ actually sent.
|
|
|
463
504
|
### From a CDN — nothing to install
|
|
464
505
|
|
|
465
506
|
```html
|
|
466
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.
|
|
507
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.15.0/dist/standalone.js"></script>
|
|
467
508
|
```
|
|
468
509
|
|
|
469
510
|
This is the `standalone` build: CodeMirror is bundled in, so a static blog post
|
|
@@ -485,8 +526,9 @@ npm install code-playpad @codemirror/state @codemirror/view @codemirror/commands
|
|
|
485
526
|
CodeMirror is a peer dependency so you never end up with two copies of
|
|
486
527
|
`@codemirror/state`. Language grammars are **optional** — install only what you
|
|
487
528
|
use (`@codemirror/lang-python`, `@codemirror/lang-javascript`,
|
|
488
|
-
`@codemirror/lang-json`, `@codemirror/lang-java`, `@codemirror/lang-cpp`,
|
|
489
|
-
`@codemirror/
|
|
529
|
+
`@codemirror/lang-json`, `@codemirror/lang-java`, `@codemirror/lang-cpp`,
|
|
530
|
+
`@codemirror/legacy-modes` for C#, and for React `@codemirror/lang-css` and
|
|
531
|
+
`@codemirror/lang-html`); a missing one degrades to
|
|
490
532
|
plain text rather than throwing.
|
|
491
533
|
|
|
492
534
|
```js
|
|
@@ -517,7 +559,7 @@ Next.js, Astro and SvelteKit need no dynamic import or `client:only` guard.
|
|
|
517
559
|
|
|
518
560
|
| | |
|
|
519
561
|
| --- | --- |
|
|
520
|
-
| `language` | `python` (default), `javascript`, `typescript`, `java`, `c`, `cpp`, `react` |
|
|
562
|
+
| `language` | `python` (default), `javascript`, `typescript`, `java`, `c`, `cpp`, `csharp` (or `cs`), `react` |
|
|
521
563
|
| `height` | number (px), any CSS length, or `auto` |
|
|
522
564
|
| `min-height` / `max-height` | bounds for `auto` |
|
|
523
565
|
| `preview-height` | `react` only: the preview's height |
|
|
@@ -1134,6 +1176,10 @@ configureCpp({ indexURL: 'https://your-site.example/cpp-toolchain/dist/' }); /
|
|
|
1134
1176
|
Use the toolchain version that your `code-playpad` version pins: every file is
|
|
1135
1177
|
checked by SHA-256, so another version fails. A different origin must allow CORS.
|
|
1136
1178
|
|
|
1179
|
+
C# works the same way, with
|
|
1180
|
+
[`@code-playpad/csharp-toolchain`](https://www.npmjs.com/package/@code-playpad/csharp-toolchain)
|
|
1181
|
+
and `configureCSharp({ indexURL })`.
|
|
1182
|
+
|
|
1137
1183
|
## Worth knowing
|
|
1138
1184
|
|
|
1139
1185
|
- **One runtime per page.** Every widget shares a single Worker per language, so
|
|
@@ -1156,6 +1202,18 @@ checked by SHA-256, so another version fails. A different origin must allow CORS
|
|
|
1156
1202
|
|
|
1157
1203
|
## Version history
|
|
1158
1204
|
|
|
1205
|
+
### 0.15.0
|
|
1206
|
+
|
|
1207
|
+
- **`language="csharp"` (or `cs`), experimental.** C# 14 compiled by the real Roslyn compiler and run on
|
|
1208
|
+
the .NET WebAssembly runtime in a worker, with prefilled stdin and Stop. Each Run gets a fresh worker. See
|
|
1209
|
+
[Experimental C#](#experimental-c) for its limits and CSP needs.
|
|
1210
|
+
- **The compiler has its own package,** `@code-playpad/csharp-toolchain`, loaded from jsDelivr on the first
|
|
1211
|
+
C# Run (about 14 MB) and checked by SHA-256 on every Run. Installing `code-playpad` doesn't download it.
|
|
1212
|
+
`configureCSharp({ indexURL, timeoutMs })` hosts it yourself or changes the time limit.
|
|
1213
|
+
- **New optional peer dependency:** `@codemirror/legacy-modes`, for highlighting C#.
|
|
1214
|
+
- **Shared worker handling:** a worker that has been replaced can no longer deliver messages, in any language.
|
|
1215
|
+
- **The demo site** has a C# page.
|
|
1216
|
+
|
|
1159
1217
|
### 0.14.1
|
|
1160
1218
|
|
|
1161
1219
|
- **No changes to the widget or its runtimes.** This release moves the version in the
|
|
@@ -1603,6 +1661,9 @@ their own MIT licences, reproduced in full in `dist/THIRD-PARTY-NOTICES.txt`.
|
|
|
1603
1661
|
Pyodide (MPL-2.0) is fetched from a CDN at runtime and is not redistributed by
|
|
1604
1662
|
this package.
|
|
1605
1663
|
|
|
1664
|
+
Experimental C# downloads `@code-playpad/csharp-toolchain`, whose files have their own
|
|
1665
|
+
third-party terms, listed in that package's `dist/THIRD-PARTY-NOTICES.txt`.
|
|
1666
|
+
|
|
1606
1667
|
Experimental C/C++ downloads separate compiler assets with additional
|
|
1607
1668
|
third-party terms; those assets are not MIT-only. Their notices ship in
|
|
1608
1669
|
`dist/COMPILER-NOTICES.txt`. The pinned C/C++ rebuild passes its scoped license
|
|
@@ -280,6 +280,31 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
280
280
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
281
281
|
THE SOFTWARE.
|
|
282
282
|
|
|
283
|
+
==============================================================================
|
|
284
|
+
@codemirror/legacy-modes 6.5.5 — MIT
|
|
285
|
+
|
|
286
|
+
MIT License
|
|
287
|
+
|
|
288
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
289
|
+
|
|
290
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
291
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
292
|
+
in the Software without restriction, including without limitation the rights
|
|
293
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
294
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
295
|
+
furnished to do so, subject to the following conditions:
|
|
296
|
+
|
|
297
|
+
The above copyright notice and this permission notice shall be included in
|
|
298
|
+
all copies or substantial portions of the Software.
|
|
299
|
+
|
|
300
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
301
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
302
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
303
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
304
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
305
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
306
|
+
THE SOFTWARE.
|
|
307
|
+
|
|
283
308
|
==============================================================================
|
|
284
309
|
@codemirror/state 6.7.1 — MIT
|
|
285
310
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as e}from"./element-
|
|
1
|
+
import{u as e}from"./element-UgFuSGoC.js";var t=5e3,n=4e3,r=65536,i=class{preview;payload;onRoute;#e=null;#t=null;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=null;#c=``;#l=``;#u;#d=performance.now();#f=!1;#p=null;#m=null;constructor(e,t,n,r,i){this.preview=e,this.payload=t,this.onRoute=i,this.#i=n,this.#s=r}get live(){return this.#e!==null}send(e){this.#e?.contentWindow?.postMessage(e,`*`)}open(e,n=[]){let r=document.createElement(`iframe`);r.setAttribute(`sandbox`,`allow-scripts allow-forms`),r.setAttribute(`allow`,``),r.setAttribute(`referrerpolicy`,`no-referrer`),r.title=`Preview`,r.className=`cp-preview-frame`,r.srcdoc=e,this.#e=r,this.#t=this.preview.host.ownerDocument.defaultView??window,this.#t.addEventListener(`message`,this.#x),this.preview.host.replaceChildren(...n,r),this.#n=setTimeout(()=>{this.fail(`The preview did not start. A Content-Security-Policy on this page probably blocks it: see "Host pages with a CSP" in the README.`)},t)}fail(e,t={},n){this.#n&&clearTimeout(this.#n),this.#n=null,this.#v(e,t),this.#h(!0,n)}#h(e,t,n=e=>e()){let r=this.#i;this.#i=null,this.#s=null;let i={stdout:this.#c,...this.#l?{stderr:this.#l}:{},...t?{hint:t}:{},...e&&this.#u?{problem:this.#u}:{},durationMs:Math.round(performance.now()-this.#d),failed:e};n(()=>r?.(i))}#g=e=>{setTimeout(e,250),this.#o=()=>requestAnimationFrame(()=>requestAnimationFrame(e)),this.#a&&this.#o()};#_(e,t){this.#i&&(e===`warn`||e===`error`?this.#l+=`${t}\n`:this.#c+=`${t}\n`),this.preview.onConsole(e,t)}#v(e,t){let n=(t.file?`${t.file}${t.line?`:${t.line}`:``}${t.column?`:${t.column}`:``}: `:``)+e;this.#_(`error`,n),this.#y(n);let r={message:n,...t};this.#i?this.#u??=r:this.preview.onError(r)}#y(e){this.#p||(this.#p=document.createElement(`pre`),this.#p.className=`cp-preview-banner`,this.#p.setAttribute(`role`,`alert`),this.preview.host.append(this.#p)),this.#p.textContent=e}#b(e){this.#m||(this.#m=document.createElement(`div`),this.#m.className=`cp-preview-notice`,this.#m.setAttribute(`role`,`status`),this.preview.host.append(this.#m)),this.#m.textContent=e,this.#m.hidden=!1,this.#r&&clearTimeout(this.#r),this.#r=setTimeout(()=>{this.#m&&(this.#m.hidden=!0)},n)}showCompileBanner(e){e&&this.#p&&(this.#p.textContent+=`\n${e}`)}#x=e=>{if(!this.#e||e.source!==this.#e.contentWindow)return;let t=e.data;if(typeof t!=`object`||!t||t.__playpad!==1)return;let n=e=>String(e??``).slice(0,r);switch(t.type){case`booted`:if(this.#f)return;this.#f=!0,this.#n&&clearTimeout(this.#n),this.#n=null,this.preview.onStart?.(),e.ports[0]?.postMessage(this.payload);break;case`console`:{let e=t.level===`info`||t.level===`warn`||t.level===`error`?t.level:`log`;this.#_(e,n(t.text));break}case`error`:this.#v(n(t.message),{...typeof t.file==`string`?{file:t.file.slice(0,512)}:{},...typeof t.line==`number`?{line:t.line}:{}});break;case`fatal`:this.fail(n(t.message));break;case`entry-done`:this.#i&&this.#h(t.failed===!0,void 0,this.#g);break;case`drawn`:this.#a=!0,this.#o?.();break;case`render`:this.preview.onRender(n(t.rootText));break;case`route`:this.onRoute?.({url:n(t.url),canBack:t.canBack===!0,canForward:t.canForward===!0});break;case`alert`:this.#_(`info`,`alert: ${n(t.text)}`),this.#b(n(t.text))}};dispose(t){this.#n&&clearTimeout(this.#n),this.#r&&clearTimeout(this.#r),this.#t?.removeEventListener(`message`,this.#x),this.#e=null,this.preview.host.replaceChildren(),this.#s&&t&&this.#s(new e),this.#i=null,this.#s=null}},a=`(function(){var a=function(n,e){n.__playpad=1,parent.postMessage(n,"*",e||[])};function l(n,e){if(typeof n=="string")return n;if(typeof n=="function")return"[Function "+(n.name||"anonymous")+"]";if(typeof n!="object"||n===null)return String(n);if(n instanceof Error)return n.name+": "+n.message;if(n instanceof Node)return"<"+n.nodeName.toLowerCase()+">";try{return JSON.stringify(n)}catch{return String(n)}}function L(n){if(typeof n[0]!="string")return n.map(function(r){return l(r)}).join(" ");var e=1,i=n[0].replace(/%([sdifoOc%])/g,function(r,u){if(u==="%")return"%";if(e>=n.length)return r;var c=n[e++];return u==="c"?"":u==="d"||u==="i"?String(parseInt(c,10)):u==="f"?String(parseFloat(c)):l(c)});return[i].concat(n.slice(e).map(function(r){return l(r)})).join(" ")}["log","info","warn","error","debug"].forEach(function(n){var e=console[n];console[n]=function(){var i=Array.prototype.slice.call(arguments);a({type:"console",level:n==="debug"?"log":n,text:L(i)}),e.apply(console,i)}});function k(n){var e=/playpad-project\\/([^\\s:)]+):(\\d+)/.exec(n&&n.stack||"");return e?{file:e[1],line:Number(e[2])}:{}}function f(n,e){var i=n&&typeof n=="object"&&"message"in n,r=i&&n.name?n.name+": ":"",u=k(n);a({type:"error",message:e+r+(i?n.message:l(n)),file:u.file,line:u.line})}addEventListener("error",function(n){n.error?f(n.error,"Uncaught "):n.message==="Script error."?a({type:"error",message:"An error happened in the preview, but this browser hides its details. Open the browser's developer console to see it."}):f(n.message,"Uncaught ")}),window.reportError=function(n){f(n,"Uncaught ")};function M(n){return function(){try{return n.apply(this,arguments)}catch(e){f(e,"Uncaught ")}}}["setTimeout","setInterval","requestAnimationFrame","queueMicrotask"].forEach(function(n){var e=window[n];window[n]=function(i){var r=Array.prototype.slice.call(arguments);return typeof i=="function"&&(r[0]=M(i)),e.apply(window,r)}}),addEventListener("unhandledrejection",function(n){f(n.reason,"Unhandled promise rejection: ")}),window.alert=function(n){a({type:"alert",text:n===void 0?"":String(n)})},window.confirm=function(){return console.warn("confirm() cannot wait for an answer in this preview, so it returned true."),!0},window.prompt=function(){return console.warn("prompt() cannot wait for an answer in this preview, so it returned null."),null};var N=1e3,y=!1,_=0,v=0,b=new MessageChannel;b.port1.onmessage=function(){y=!1},window.__playpadLoopGuard=function(){if(!y){y=!0,_=performance.now(),v=0,b.port2.postMessage(0);return}if((++v&63)===0&&performance.now()-_>N)throw new Error("This loop ran for more than 1 second. Is it infinite?")};function O(n){var e=n.nonce;function i(o){e&&(o.nonce=e),document.head.appendChild(o)}function r(o){var d=document.createElement("script");d.textContent=o,i(d)}if(n.nextClient){if(window.__webpack_require__=function(o){return window.__playpadLoad(o)},window.__webpack_require__.u=function(){return""},window.__webpack_chunk_load__=function(){return Promise.resolve()},n.tailwind&&r(n.tailwind),r(n.nextClient),!window.__playpadNext){a({type:"fatal",message:"The preview could not run the Next.js runtime. A Content-Security-Policy on this page probably blocks it."});return}n.modules.forEach(function(o){o.kind==="js"&&r("__playpadDefine("+JSON.stringify(o.path)+",function(require,module,exports){"+o.text+\`
|
|
2
2
|
});
|
|
3
3
|
//# sourceURL=playpad-project/\`+o.path)}),window.__playpadNext.start(n,e);return}function u(){if(!window.__vendor){a({type:"fatal",message:"The preview could not run the React runtime. A Content-Security-Policy on this page probably blocks it."});return}var o={};window.__playpadDefine=function(t,s){o[t]=s};var d={};n.modules.forEach(function(t){d[t.path]=t,t.kind==="js"&&r("__playpadDefine("+JSON.stringify(t.path)+",function(require,module,exports){"+t.text+\`
|
|
4
4
|
});
|
package/dist/cdn.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! code-playpad 0.
|
|
2
|
-
export * from "https://cdn.jsdelivr.net/npm/code-playpad@0.
|
|
1
|
+
/*! code-playpad 0.15.0: CDN entry, loads dist/standalone.js of this exact version */
|
|
2
|
+
export * from "https://cdn.jsdelivr.net/npm/code-playpad@0.15.0/dist/standalone.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* code-playpad — MIT © 2026 Seung Hun Lee
|
|
3
|
+
* Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
|
|
4
|
+
* Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
|
|
5
|
+
*/
|
|
6
|
+
function e(e,t,n,r,i,a){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=i,this.prev=a}function t(t,n,r,i){var a=t.indented;return t.context&&t.context.type==`statement`&&r!=`statement`&&(a=t.context.indented),t.context=new e(a,n,r,i,null,t.context)}function n(e){var t=e.context.type;return(t==`)`||t==`]`||t==`}`)&&(e.indented=e.context.indented),e.context=e.context.prev}function r(e,t,n){if(t.prevToken==`variable`||t.prevToken==`type`||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||t.typeAtEndOfLine&&e.column()==e.indentation())return!0}function i(e){for(;;){if(!e||e.type==`top`)return!0;if(e.type==`}`&&e.prev.info!=`namespace`)return!1;e=e.prev}}function a(a){var o=a.statementIndentUnit,c=a.dontAlignCalls,l=a.keywords||{},u=a.types||{},d=a.builtin||{},f=a.blockKeywords||{},p=a.defKeywords||{},m=a.atoms||{},h=a.hooks||{},g=a.multiLineStrings,_=a.indentStatements!==!1,v=a.indentSwitch!==!1,y=a.namespaceSeparator,b=a.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,x=a.numberStart||/[\d\.]/,S=a.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,C=a.isOperatorChar||/[+\-*&%=<>!?|\/]/,w=a.isIdentifierChar||/[\w\$_\xa1-\uffff]/,T=a.isReservedIdentifier||!1,E,D;function O(e,t){var n=e.next();if(h[n]){var r=h[n](e,t);if(r!==!1)return r}if(n==`"`||n==`'`)return t.tokenize=k(n),t.tokenize(e,t);if(x.test(n)){if(e.backUp(1),e.match(S))return`number`;e.next()}if(b.test(n))return E=n,null;if(n==`/`){if(e.eat(`*`))return t.tokenize=A,A(e,t);if(e.eat(`/`))return e.skipToEnd(),`comment`}if(C.test(n)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(C););return`operator`}if(e.eatWhile(w),y)for(;e.match(y);)e.eatWhile(w);var i=e.current();return s(l,i)?(s(f,i)&&(E=`newstatement`),s(p,i)&&(D=!0),`keyword`):s(u,i)?`type`:s(d,i)||T&&T(i)?(s(f,i)&&(E=`newstatement`),`builtin`):s(m,i)?`atom`:`variable`}function k(e){return function(t,n){for(var r=!1,i,a=!1;(i=t.next())!=null;){if(i==e&&!r){a=!0;break}r=!r&&i==`\\`}return(a||!(r||g))&&(n.tokenize=null),`string`}}function A(e,t){for(var n=!1,r;r=e.next();){if(r==`/`&&n){t.tokenize=null;break}n=r==`*`}return`comment`}function j(e,t){a.typeFirstDefinitions&&e.eol()&&i(t.context)&&(t.typeAtEndOfLine=r(e,t,e.pos))}return{name:a.name,startState:function(t){return{tokenize:null,context:new e(-t,0,`top`,null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,o){var s=o.context;if(e.sol()&&(s.align??(s.align=!1),o.indented=e.indentation(),o.startOfLine=!0),e.eatSpace())return j(e,o),null;E=D=null;var c=(o.tokenize||O)(e,o);if(c==`comment`||c==`meta`)return c;if(s.align??(s.align=!0),E==`;`||E==`:`||E==`,`&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;o.context.type==`statement`;)n(o);else if(E==`{`)t(o,e.column(),`}`);else if(E==`[`)t(o,e.column(),`]`);else if(E==`(`)t(o,e.column(),`)`);else if(E==`}`){for(;s.type==`statement`;)s=n(o);for(s.type==`}`&&(s=n(o));s.type==`statement`;)s=n(o)}else E==s.type?n(o):_&&((s.type==`}`||s.type==`top`)&&E!=`;`||s.type==`statement`&&E==`newstatement`)&&t(o,e.column(),`statement`,e.current());if(c==`variable`&&(o.prevToken==`def`||a.typeFirstDefinitions&&r(e,o,e.start)&&i(o.context)&&e.match(/^\s*\(/,!1))&&(c=`def`),h.token){var l=h.token(e,o,c);l!==void 0&&(c=l)}return c==`def`&&a.styleDefs===!1&&(c=`variable`),o.startOfLine=!1,o.prevToken=D?`def`:c||E,j(e,o),c},indent:function(e,t,n){if(e.tokenize!=O&&e.tokenize!=null||e.typeAtEndOfLine&&i(e.context))return null;var r=e.context,s=t&&t.charAt(0),l=s==r.type;if(r.type==`statement`&&s==`}`&&(r=r.prev),a.dontIndentStatements)for(;r.type==`statement`&&a.dontIndentStatements.test(r.info);)r=r.prev;if(h.indent){var u=h.indent(e,r,t,n.unit);if(typeof u==`number`)return u}var d=r.prev&&r.prev.info==`switch`;if(a.allmanIndentation&&/[{(]/.test(s)){for(;r.type!=`top`&&r.type!=`}`;)r=r.prev;return r.indented}return r.type==`statement`?r.indented+(s==`{`?0:o||n.unit):r.align&&(!c||r.type!=`)`)?r.column+ +!l:r.type==`)`&&!l?r.indented+(o||n.unit):r.indented+(l?0:n.unit)+(!l&&d&&!/^(?:case|default)\b/.test(t)?n.unit:0)},languageData:{indentOnInput:v?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},autocomplete:Object.keys(l).concat(Object.keys(u)).concat(Object.keys(d)).concat(Object.keys(m)),...a.languageData}}}function o(e){for(var t={},n=e.split(` `),r=0;r<n.length;++r)t[n[r]]=!0;return t}function s(e,t){return typeof e==`function`?e(t):e.propertyIsEnumerable(t)}var c=`auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran`,l=`alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq`,u=`bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available`,d=`FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT`,f=o(`int long char short double float unsigned signed void bool`),p=o(`SEL instancetype id Class Protocol BOOL`);function m(e){return s(f,e)||/.+_t$/.test(e)}function h(e){return m(e)||s(p,e)}var g=`case do else for if switch while struct enum union`,_=`struct enum union`;function v(e,t){if(!t.startOfLine)return!1;for(var n,r=null;n=e.peek();){if(n==`\\`&&e.match(/^.$/)){r=v;break}if(n==`/`&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=r,`meta`}function y(e,t){return t.prevToken==`type`&&`type`}function b(e){return!e||e.length<2||e[0]!=`_`?!1:e[1]==`_`||e[1]!==e[1].toLowerCase()}function x(e){return e.eatWhile(/[\w\.']/),`number`}function S(e,t){if(e.backUp(1),e.match(/^(?:R|u8R|uR|UR|LR)/)){var n=e.match(/^"([^\s\\()]{0,16})\(/);return n?(t.cpp11RawStringDelim=n[1],t.tokenize=T,T(e,t)):!1}return e.match(/^(?:u8|u|U|L)/)?e.match(/^["']/,!1)?`string`:!1:(e.next(),!1)}function C(e){var t=/(\w+)::~?(\w+)$/.exec(e);return t&&t[1]==t[2]}function w(e,t){for(var n;(n=e.next())!=null;)if(n==`"`&&!e.eat(`"`)){t.tokenize=null;break}return`string`}function T(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,`\\$&`);return e.match(RegExp(`.*?\\)`+n+`"`))?t.tokenize=null:e.skipToEnd(),`string`}var E=a({name:`c`,keywords:o(c),types:m,blockKeywords:o(g),defKeywords:o(_),typeFirstDefinitions:!0,atoms:o(`NULL true false`),isReservedIdentifier:b,hooks:{"#":v,"*":y}}),D=a({name:`cpp`,keywords:o(c+` `+l),types:m,blockKeywords:o(g+` class try catch`),defKeywords:o(_+` class namespace`),typeFirstDefinitions:!0,atoms:o(`true false NULL nullptr`),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:b,hooks:{"#":v,"*":y,u:S,U:S,L:S,R:S,0:x,1:x,2:x,3:x,4:x,5:x,6:x,7:x,8:x,9:x,token:function(e,t,n){if(n==`variable`&&e.peek()==`(`&&(t.prevToken==`;`||t.prevToken==null||t.prevToken==`}`)&&C(e.current()))return`def`}},namespaceSeparator:`::`}),O=a({name:`java`,keywords:o(`abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface`),types:o(`var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void`),blockKeywords:o(`catch class do else finally for if switch try while`),defKeywords:o(`class interface enum @interface`),typeFirstDefinitions:!0,atoms:o(`true false null`),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match(`interface`,!1)&&(e.eatWhile(/[\w\$_]/),`meta`)},'"':function(e,t){return e.match(/""$/)?(t.tokenize=A,t.tokenize(e,t)):!1}}}),k=a({name:`csharp`,keywords:o(`abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in init interface internal is lock namespace new operator out override params private protected public readonly record ref required return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield`),types:o(`Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong`),blockKeywords:o(`catch class do else finally for foreach if struct switch try while`),defKeywords:o(`class interface namespace record struct var`),typeFirstDefinitions:!0,atoms:o(`true false null`),hooks:{"@":function(e,t){return e.eat(`"`)?(t.tokenize=w,w(e,t)):(e.eatWhile(/[\w\$_]/),`meta`)}}});function A(e,t){for(var n=!1;!e.eol();){if(!n&&e.match(`"""`)){t.tokenize=null;break}n=e.next()==`\\`&&!n}return`string`}function j(e){return function(t,n){for(var r;r=t.next();)if(r==`*`&&t.eat(`/`)){if(e==1){n.tokenize=null;break}return n.tokenize=j(e-1),n.tokenize(t,n)}else if(r==`/`&&t.eat(`*`))return n.tokenize=j(e+1),n.tokenize(t,n);return`comment`}}var M=a({name:`scala`,keywords:o(`abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble`),types:o(`AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void`),multiLineStrings:!0,blockKeywords:o(`catch class enum do else finally for forSome if match switch try while`),defKeywords:o(`class enum def object package trait type val var`),atoms:o(`true false null`),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),`meta`},'"':function(e,t){return e.match(`""`)?(t.tokenize=A,t.tokenize(e,t)):!1},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?`character`:(e.eatWhile(/[\w\$_\xa1-\uffff]/),`atom`)},"=":function(t,n){var r=n.context;return r.type==`}`&&r.align&&t.eat(`>`)?(n.context=new e(r.indented,r.column,r.type,r.info,null,r.prev),`operator`):!1},"/":function(e,t){return e.eat(`*`)?(t.tokenize=j(1),t.tokenize(e,t)):!1}},languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,`"""`]}}});function N(e){return function(t,n){for(var r=!1,i,a=!1;!t.eol();){if(!e&&!r&&t.match(`"`)||e&&t.match(`"""`)){a=!0;break}i=t.next(),!r&&i==`$`&&t.match(`{`)&&t.skipTo(`}`),r=!r&&i==`\\`&&!e}return(a||!e)&&(n.tokenize=null),`string`}}var P=a({name:`kotlin`,keywords:o(`package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam`),types:o(`Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit`),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(ul?|l|f)?/i,blockKeywords:o(`catch class do else finally for if where try while enum`),defKeywords:o(`class val var object interface fun`),atoms:o(`true false null this`),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),`meta`},"*":function(e,t){return t.prevToken==`.`?`variable`:`operator`},'"':function(e,t){return t.tokenize=N(e.match(`""`)),t.tokenize(e,t)},"/":function(e,t){return e.eat(`*`)?(t.tokenize=j(1),t.tokenize(e,t)):!1},indent:function(e,t,n,r){var i=n&&n.charAt(0);if((e.prevToken==`}`||e.prevToken==`)`)&&n==``)return e.indented;if(e.prevToken==`operator`&&n!=`}`&&e.context.type!=`}`||e.prevToken==`variable`&&i==`.`||(e.prevToken==`}`||e.prevToken==`)`)&&i==`.`)return r*2+t.indented;if(t.align&&t.type==`}`)return t.indented+(e.context.type==(n||``).charAt(0)?0:r)}},languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,`"""`]}}}),F=a({name:`shader`,keywords:o(`sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout`),types:o(`float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4`),blockKeywords:o(`for while do if else struct`),builtin:o(`radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4`),atoms:o(`true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers`),indentSwitch:!1,hooks:{"#":v}}),I=a({name:`nesc`,keywords:o(c+` as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends`),types:m,blockKeywords:o(g),atoms:o(`null true false`),hooks:{"#":v}}),L=a({name:`objectivec`,keywords:o(c+` `+u),types:h,builtin:o(d),blockKeywords:o(g+` @synthesize @try @catch @finally @autoreleasepool @synchronized`),defKeywords:o(_+` @interface @implementation @protocol @class`),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:o(`YES NO NULL Nil nil true false nullptr`),isReservedIdentifier:b,hooks:{"#":v,"*":y}}),R=a({name:`objectivecpp`,keywords:o(c+` `+u+` `+l),types:h,builtin:o(d),blockKeywords:o(g+` @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch`),defKeywords:o(_+` @interface @implementation @protocol @class class namespace`),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:o(`YES NO NULL Nil nil true false nullptr`),isReservedIdentifier:b,hooks:{"#":v,"*":y,u:S,U:S,L:S,R:S,0:x,1:x,2:x,3:x,4:x,5:x,6:x,7:x,8:x,9:x,token:function(e,t,n){if(n==`variable`&&e.peek()==`(`&&(t.prevToken==`;`||t.prevToken==null||t.prevToken==`}`)&&C(e.current()))return`def`}},namespaceSeparator:`::`}),z=a({name:`squirrel`,keywords:o(`base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static`),types:m,blockKeywords:o(`case catch class else for foreach if switch try while`),defKeywords:o(`function local class`),typeFirstDefinitions:!0,atoms:o(`true false null`),hooks:{"#":v}}),B=null;function V(e){return function(t,n){for(var r=!1,i,a=!1;!t.eol();){if(!r&&t.match(`"`)&&(e==`single`||t.match(`""`))){a=!0;break}if(!r&&t.match("``")){B=V(e),a=!0;break}i=t.next(),r=e==`single`&&!r&&i==`\\`}return a&&(n.tokenize=null),`string`}}var H=a({name:`ceylon`,keywords:o(`abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while`),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:o(`case catch class dynamic else finally for function if interface module new object switch try while`),defKeywords:o(`class dynamic function interface module object package value`),builtin:o(`abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable`),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:o(`true false null larger smaller equal empty finished`),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),`meta`},'"':function(e,t){return t.tokenize=V(e.match(`""`)?`triple`:`single`),t.tokenize(e,t)},"`":function(e,t){return!B||!e.match("`")?!1:(t.tokenize=B,B=null,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?`string.special`:(e.eatWhile(/[\w\$_\xa1-\uffff]/),`atom`)},token:function(e,t,n){if((n==`variable`||n==`type`)&&t.prevToken==`.`)return`variableName.special`}},languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,`"""`]}}});function U(e){(e.interpolationStack||=[]).push(e.tokenize)}function W(e){return(e.interpolationStack||=[]).pop()}function G(e){return e.interpolationStack?e.interpolationStack.length:0}function K(e,t,n,r){var i=!1;if(t.eat(e)){if(t.eat(e))i=!0;else return`string`}function a(t,n){for(var a=!1;!t.eol();){if(!r&&!a&&t.peek()==`$`)return U(n),n.tokenize=q,`string`;var o=t.next();if(o==e&&!a&&(!i||t.match(e+e))){n.tokenize=null;break}a=!r&&!a&&o==`\\`}return`string`}return n.tokenize=a,a(t,n)}function q(e,t){return e.eat(`$`),t.tokenize=e.eat(`{`)?null:J,null}function J(e,t){return e.eatWhile(/[\w_]/),t.tokenize=W(t),`variable`}var Y=a({name:`dart`,keywords:o(`this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline`),blockKeywords:o(`try catch finally do else for if switch while`),builtin:o(`void bool num int double dynamic var String Null Never`),atoms:o(`true false null`),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_\.]/),`meta`},"'":function(e,t){return K(`'`,e,t,!1)},'"':function(e,t){return K(`"`,e,t,!1)},r:function(e,t){var n=e.peek();return n==`'`||n==`"`?K(e.next(),e,t,!0):!1},"}":function(e,t){return G(t)>0&&(t.tokenize=W(t),null)},"/":function(e,t){return e.eat(`*`)?(t.tokenize=j(1),t.tokenize(e,t)):!1},token:function(e,t,n){if(n==`variable`&&RegExp(`^[_$]*[A-Z][a-zA-Z0-9_$]*$`,`g`).test(e.current()))return`type`}}});export{E as c,H as ceylon,a as clike,D as cpp,k as csharp,Y as dart,O as java,P as kotlin,I as nesC,L as objectiveC,R as objectiveCpp,M as scala,F as shader,z as squirrel};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* code-playpad — MIT © 2026 Seung Hun Lee
|
|
3
|
+
* Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
|
|
4
|
+
* Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
|
|
5
|
+
*/
|
|
6
|
+
var e=`code-playpad-cpp-20.1.2-emscripten-4.0.6-r1`,t=/* @__PURE__ */ new Map;async function n(e){t.has(e)||t.set(e,(async()=>{try{return await caches.open(e)}catch{return}})()),await t.get(e)}export{n,e as t};
|
|
@@ -169,15 +169,18 @@
|
|
|
169
169
|
},
|
|
170
170
|
"csharp": {
|
|
171
171
|
"id": "code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1",
|
|
172
|
-
"licenseReviewComplete":
|
|
173
|
-
"blockers": [
|
|
174
|
-
"Codex has not reviewed the notice mapping in third-party/csharp/manifest.json.",
|
|
175
|
-
"The owner has not approved this release.",
|
|
176
|
-
"The package name has not been settled against Microsoft trademark terms.",
|
|
177
|
-
"The runtime is not wired in (step 4), and the phone check and real CDN delivery are untested."
|
|
178
|
-
],
|
|
172
|
+
"licenseReviewComplete": true,
|
|
173
|
+
"blockers": [],
|
|
179
174
|
"scope": "Only the hashes in toolchains/csharp/assets.lock.json, distributed with third-party/csharp notices.",
|
|
180
|
-
"notices": "third-party/csharp/manifest.json"
|
|
175
|
+
"notices": "third-party/csharp/manifest.json",
|
|
176
|
+
"approval": {
|
|
177
|
+
"by": "owner",
|
|
178
|
+
"date": "2026-11-01",
|
|
179
|
+
"scope": "Publishing @code-playpad/csharp-toolchain@0.1.0 under this name. Approved before Codex re-reviewed its fixes; not legal clearance.",
|
|
180
|
+
"inputsLock": "47c4db2791a9ae40ae27e84686a010d303bb0d72c875bffcb5e5ec369fdfa9f0",
|
|
181
|
+
"assetsLock": "42a57a9d238890df93a49cb5cf1278456f964b1567a6dafbd927239dafecd6a5",
|
|
182
|
+
"noticeManifest": "fab06609ef92c3b7c7a5ba8b193631c77d18a6afbc04c428bcea6c306cfc37b2"
|
|
183
|
+
}
|
|
181
184
|
}
|
|
182
185
|
},
|
|
183
186
|
"supersededArtifacts": [
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* code-playpad — MIT © 2026 Seung Hun Lee
|
|
3
|
+
* Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
|
|
4
|
+
* Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
|
|
5
|
+
*/
|
|
6
|
+
var e=`314.0.5`,t=`https://cdn.jsdelivr.net/pyodide/v${e}/full/`,n=null;function r(e){t=e.indexURL.endsWith(`/`)?e.indexURL:e.indexURL+`/`}function i(e){n=e.sucraseURL}function a(){return t}function o(){return n}function s(){return[{url:t+`pyodide.js`,as:`script`},{url:t+`pyodide.asm.wasm`,as:`fetch`},{url:t+`python_stdlib.zip`,as:`fetch`}]}var c={indexURL:`https://cdn.jsdelivr.net/npm/@code-playpad/cpp-toolchain@1.0.0/dist/`,timeoutMs:12e4};function l(e){let t={...c};if(e.indexURL!==void 0){let n=new URL(e.indexURL);if(![`https:`,`http:`].includes(n.protocol))throw Error(`C/C++ asset URL must use HTTP or HTTPS.`);t.indexURL=n.href.endsWith(`/`)?n.href:n.href+`/`}if(e.timeoutMs!==void 0){if(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw Error(`timeoutMs must be a positive finite number.`);t.timeoutMs=e.timeoutMs}c=t}function u(){return{...c}}var d={indexURL:`https://cdn.jsdelivr.net/npm/@code-playpad/csharp-toolchain@0.1.0/dist/`,timeoutMs:12e4};function f(e){let t={...d};if(e.indexURL!==void 0){let n=new URL(e.indexURL);if(![`https:`,`http:`].includes(n.protocol))throw Error(`C# asset URL must use HTTP or HTTPS.`);t.indexURL=n.href.endsWith(`/`)?n.href:n.href+`/`}if(e.timeoutMs!==void 0){if(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw Error(`timeoutMs must be a positive finite number.`);t.timeoutMs=e.timeoutMs}d=t}function p(){return{...d}}var m=null,h=null;function g(e){if(e.runtimeURL!==void 0){let t=new URL(e.runtimeURL,typeof location>`u`?void 0:location.href);if(![`https:`,`http:`].includes(t.protocol))throw Error(`The React runtime URL must use HTTP or HTTPS.`);if(/[;,\s]/.test(t.href))throw Error(`The React runtime URL cannot contain ";" or ",": it goes in a Content-Security-Policy.`);m=t.href}e.nonce!==void 0&&(h=e.nonce)}function _(){let e=typeof document>`u`?null:document.querySelector(`script[nonce]`)?.nonce||null;return{runtimeURL:m,nonce:h??e}}export{g as a,u as c,o as d,s as f,r as i,a as l,f as n,i as o,l as r,p as s,e as t,_ as u};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* code-playpad — MIT © 2026 Seung Hun Lee
|
|
3
|
+
* Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
|
|
4
|
+
* Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
|
|
5
|
+
*/
|
|
6
|
+
import{c as e}from"./config-3Z6xX6Jr.js";import{n as t,t as n}from"./compiler-cache-XwslsU5H.js";import{t as r}from"./worker-runtime-Ub9rvLo_.js";var i='"use strict";(()=>{var it="code-playpad-cpp-20.1.2-emscripten-4.0.6-r1";async function ot(a,e,i,c,E){let t=new URL(a,i).href,r;try{r=await caches.open(c)}catch{}let n;try{n=await r?.match(t)}catch{}let s=async _=>{if(!_.ok)throw new Error(`Toolchain download failed: ${a} (HTTP ${_.status}). Check the asset URL and retry.`);let l=_.body?.getReader();if(!l)return _.arrayBuffer();let u=[],p=0,d=0;for(;;){let S=await l.read();if(S.done)break;if(p+=S.value.length,p>e.bytes)throw await l.cancel(),new Error(`Unexpected toolchain size: ${a}.`);u.push(S.value),performance.now()-d>100&&(E(`${n?"Reading cached":"Downloading"} ${a}: ${(p/1e6).toFixed(1)} / ${(e.bytes/1e6).toFixed(1)} MB (decoded)`),d=performance.now())}let R=new Uint8Array(p),h=0;for(let S of u)R.set(S,h),h+=S.length;return R.buffer},o=async _=>_.byteLength===e.bytes&&[...new Uint8Array(await crypto.subtle.digest("SHA-256",_))].map(l=>l.toString(16).padStart(2,"0")).join("")===e.sha256;if(n){try{let _=await s(n);if(await o(_))return _}catch{}try{await r?.delete(t)}catch{}n=void 0}let f=await s(await fetch(t));if(!await o(f))throw new Error(`Toolchain integrity check failed: ${a}. Use the pinned toolchain assets.`);try{await r?.put(t,new Response(f))}catch{}return f}var C=class a{static read_bytes(e,i){let c=new a;return c.buf=e.getUint32(i,!0),c.buf_len=e.getUint32(i+4,!0),c}static read_bytes_array(e,i,c){let E=[];for(let t=0;t<c;t++)E.push(a.read_bytes(e,i+8*t));return E}},L=class a{static read_bytes(e,i){let c=new a;return c.buf=e.getUint32(i,!0),c.buf_len=e.getUint32(i+4,!0),c}static read_bytes_array(e,i,c){let E=[];for(let t=0;t<c;t++)E.push(a.read_bytes(e,i+8*t));return E}},Q=0,Z=1,V=2;var J=2;var W=4;var q=1;var x=class{write_bytes(e,i){e.setUint8(i,this.fs_filetype),e.setUint16(i+2,this.fs_flags,!0),e.setBigUint64(i+8,this.fs_rights_base,!0),e.setBigUint64(i+16,this.fs_rights_inherited,!0)}constructor(e,i){this.fs_rights_base=0n,this.fs_rights_inherited=0n,this.fs_filetype=e,this.fs_flags=i}};var j=8,A=class{write_bytes(e,i){e.setBigUint64(i,this.dev,!0),e.setBigUint64(i+8,this.ino,!0),e.setUint8(i+16,this.filetype),e.setBigUint64(i+24,this.nlink,!0),e.setBigUint64(i+32,this.size,!0),e.setBigUint64(i+38,this.atim,!0),e.setBigUint64(i+46,this.mtim,!0),e.setBigUint64(i+52,this.ctim,!0)}constructor(e,i,c){this.dev=0n,this.nlink=0n,this.atim=0n,this.mtim=0n,this.ctim=0n,this.ino=e,this.filetype=i,this.size=c}},at=0;var ft=1,k=class a{static read_bytes(e,i){return new a(e.getBigUint64(i,!0),e.getUint8(i+8),e.getUint32(i+16,!0),e.getBigUint64(i+24,!0),e.getUint16(i+36,!0))}constructor(e,i,c,E,t){this.userdata=e,this.eventtype=i,this.clockid=c,this.timeout=E,this.flags=t}},Y=class{write_bytes(e,i){e.setBigUint64(i,this.userdata,!0),e.setUint16(i+8,this.error,!0),e.setUint8(i+10,this.eventtype)}constructor(e,i,c){this.userdata=e,this.error=i,this.eventtype=c}};var wt=class{enable(e){this.log=ht(e===void 0?!0:e,this.prefix)}get enabled(){return this.isEnabled}constructor(e){this.isEnabled=e,this.prefix="wasi:",this.enable(e)}};function ht(a,e){return a?console.log.bind(console,"%c%s","color: #265BA0",e):()=>{}}var y=new wt(!1);var U=class extends Error{constructor(e){super("exit with exit code "+e),this.code=e}},rt=class{start(e){this.inst=e;try{return e.exports._start(),0}catch(i){if(i instanceof U)return i.code;throw i}}initialize(e){this.inst=e,e.exports._initialize&&e.exports._initialize()}constructor(e,i,c,E={}){this.args=[],this.env=[],this.fds=[],y.enable(E.debug),this.args=e,this.env=i,this.fds=c;let t=this;this.wasiImport={args_sizes_get(r,n){let s=new DataView(t.inst.exports.memory.buffer);s.setUint32(r,t.args.length,!0);let o=0;for(let f of t.args)o+=f.length+1;return s.setUint32(n,o,!0),y.log(s.getUint32(r,!0),s.getUint32(n,!0)),0},args_get(r,n){let s=new DataView(t.inst.exports.memory.buffer),o=new Uint8Array(t.inst.exports.memory.buffer),f=n;for(let _=0;_<t.args.length;_++){s.setUint32(r,n,!0),r+=4;let l=new TextEncoder().encode(t.args[_]);o.set(l,n),s.setUint8(n+l.length,0),n+=l.length+1}return y.enabled&&y.log(new TextDecoder("utf-8").decode(o.slice(f,n))),0},environ_sizes_get(r,n){let s=new DataView(t.inst.exports.memory.buffer);s.setUint32(r,t.env.length,!0);let o=0;for(let f of t.env)o+=new TextEncoder().encode(f).length+1;return s.setUint32(n,o,!0),y.log(s.getUint32(r,!0),s.getUint32(n,!0)),0},environ_get(r,n){let s=new DataView(t.inst.exports.memory.buffer),o=new Uint8Array(t.inst.exports.memory.buffer),f=n;for(let _=0;_<t.env.length;_++){s.setUint32(r,n,!0),r+=4;let l=new TextEncoder().encode(t.env[_]);o.set(l,n),s.setUint8(n+l.length,0),n+=l.length+1}return y.enabled&&y.log(new TextDecoder("utf-8").decode(o.slice(f,n))),0},clock_res_get(r,n){let s;switch(r){case 1:{s=5000n;break}case 0:{s=1000000n;break}default:return 52}return new DataView(t.inst.exports.memory.buffer).setBigUint64(n,s,!0),0},clock_time_get(r,n,s){let o=new DataView(t.inst.exports.memory.buffer);if(r===0)o.setBigUint64(s,BigInt(new Date().getTime())*1000000n,!0);else if(r==1){let f;try{f=BigInt(Math.round(performance.now()*1e6))}catch{f=0n}o.setBigUint64(s,f,!0)}else o.setBigUint64(s,0n,!0);return 0},fd_advise(r,n,s,o){return t.fds[r]!=null?0:8},fd_allocate(r,n,s){return t.fds[r]!=null?t.fds[r].fd_allocate(n,s):8},fd_close(r){if(t.fds[r]!=null){let n=t.fds[r].fd_close();return t.fds[r]=void 0,n}else return 8},fd_datasync(r){return t.fds[r]!=null?t.fds[r].fd_sync():8},fd_fdstat_get(r,n){if(t.fds[r]!=null){let{ret:s,fdstat:o}=t.fds[r].fd_fdstat_get();return o?.write_bytes(new DataView(t.inst.exports.memory.buffer),n),s}else return 8},fd_fdstat_set_flags(r,n){return t.fds[r]!=null?t.fds[r].fd_fdstat_set_flags(n):8},fd_fdstat_set_rights(r,n,s){return t.fds[r]!=null?t.fds[r].fd_fdstat_set_rights(n,s):8},fd_filestat_get(r,n){if(t.fds[r]!=null){let{ret:s,filestat:o}=t.fds[r].fd_filestat_get();return o?.write_bytes(new DataView(t.inst.exports.memory.buffer),n),s}else return 8},fd_filestat_set_size(r,n){return t.fds[r]!=null?t.fds[r].fd_filestat_set_size(n):8},fd_filestat_set_times(r,n,s,o){return t.fds[r]!=null?t.fds[r].fd_filestat_set_times(n,s,o):8},fd_pread(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=C.read_bytes_array(_,n,s),p=0;for(let d of u){let{ret:R,data:h}=t.fds[r].fd_pread(d.buf_len,o);if(R!=0)return _.setUint32(f,p,!0),R;if(l.set(h,d.buf),p+=h.length,o+=BigInt(h.length),h.length!=d.buf_len)break}return _.setUint32(f,p,!0),0}else return 8},fd_prestat_get(r,n){let s=new DataView(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let{ret:o,prestat:f}=t.fds[r].fd_prestat_get();return f?.write_bytes(s,n),o}else return 8},fd_prestat_dir_name(r,n,s){if(t.fds[r]!=null){let{ret:o,prestat:f}=t.fds[r].fd_prestat_get();if(f==null)return o;let _=f.inner.pr_name;return new Uint8Array(t.inst.exports.memory.buffer).set(_.slice(0,s),n),_.byteLength>s?37:0}else return 8},fd_pwrite(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=L.read_bytes_array(_,n,s),p=0;for(let d of u){let R=l.slice(d.buf,d.buf+d.buf_len),{ret:h,nwritten:S}=t.fds[r].fd_pwrite(R,o);if(h!=0)return _.setUint32(f,p,!0),h;if(p+=S,o+=BigInt(S),S!=R.byteLength)break}return _.setUint32(f,p,!0),0}else return 8},fd_read(r,n,s,o){let f=new DataView(t.inst.exports.memory.buffer),_=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let l=C.read_bytes_array(f,n,s),u=0;for(let p of l){let{ret:d,data:R}=t.fds[r].fd_read(p.buf_len);if(d!=0)return f.setUint32(o,u,!0),d;if(_.set(R,p.buf),u+=R.length,R.length!=p.buf_len)break}return f.setUint32(o,u,!0),0}else return 8},fd_readdir(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=0;for(;;){let{ret:p,dirent:d}=t.fds[r].fd_readdir_single(o);if(p!=0)return _.setUint32(f,u,!0),p;if(d==null)break;if(s-u<d.head_length()){u=s;break}let R=new ArrayBuffer(d.head_length());if(d.write_head_bytes(new DataView(R),0),l.set(new Uint8Array(R).slice(0,Math.min(R.byteLength,s-u)),n),n+=d.head_length(),u+=d.head_length(),s-u<d.name_length()){u=s;break}d.write_name_bytes(l,n,s-u),n+=d.name_length(),u+=d.name_length(),o=d.d_next}return _.setUint32(f,u,!0),0}else return 8},fd_renumber(r,n){if(t.fds[r]!=null&&t.fds[n]!=null){let s=t.fds[n].fd_close();return s!=0?s:(t.fds[n]=t.fds[r],t.fds[r]=void 0,0)}else return 8},fd_seek(r,n,s,o){let f=new DataView(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let{ret:_,offset:l}=t.fds[r].fd_seek(n,s);return f.setBigInt64(o,l,!0),_}else return 8},fd_sync(r){return t.fds[r]!=null?t.fds[r].fd_sync():8},fd_tell(r,n){let s=new DataView(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let{ret:o,offset:f}=t.fds[r].fd_tell();return s.setBigUint64(n,f,!0),o}else return 8},fd_write(r,n,s,o){let f=new DataView(t.inst.exports.memory.buffer),_=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let l=L.read_bytes_array(f,n,s),u=0;for(let p of l){let d=_.slice(p.buf,p.buf+p.buf_len),{ret:R,nwritten:h}=t.fds[r].fd_write(d);if(R!=0)return f.setUint32(o,u,!0),R;if(u+=h,h!=d.byteLength)break}return f.setUint32(o,u,!0),0}else return 8},path_create_directory(r,n,s){let o=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let f=new TextDecoder("utf-8").decode(o.slice(n,n+s));return t.fds[r].path_create_directory(f)}else return 8},path_filestat_get(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=new TextDecoder("utf-8").decode(l.slice(s,s+o)),{ret:p,filestat:d}=t.fds[r].path_filestat_get(n,u);return d?.write_bytes(_,f),p}else return 8},path_filestat_set_times(r,n,s,o,f,_,l){let u=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let p=new TextDecoder("utf-8").decode(u.slice(s,s+o));return t.fds[r].path_filestat_set_times(n,p,f,_,l)}else return 8},path_link(r,n,s,o,f,_,l){let u=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null&&t.fds[f]!=null){let p=new TextDecoder("utf-8").decode(u.slice(s,s+o)),d=new TextDecoder("utf-8").decode(u.slice(_,_+l)),{ret:R,inode_obj:h}=t.fds[r].path_lookup(p,n);return h==null?R:t.fds[f].path_link(d,h,!1)}else return 8},path_open(r,n,s,o,f,_,l,u,p){let d=new DataView(t.inst.exports.memory.buffer),R=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let h=new TextDecoder("utf-8").decode(R.slice(s,s+o));y.log(h);let{ret:S,fd_obj:X}=t.fds[r].path_open(n,h,f,_,l,u);if(S!=0)return S;t.fds.push(X);let H=t.fds.length-1;return d.setUint32(p,H,!0),0}else return 8},path_readlink(r,n,s,o,f,_){let l=new DataView(t.inst.exports.memory.buffer),u=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let p=new TextDecoder("utf-8").decode(u.slice(n,n+s));y.log(p);let{ret:d,data:R}=t.fds[r].path_readlink(p);if(R!=null){let h=new TextEncoder().encode(R);if(h.length>f)return l.setUint32(_,0,!0),8;u.set(h,o),l.setUint32(_,h.length,!0)}return d}else return 8},path_remove_directory(r,n,s){let o=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let f=new TextDecoder("utf-8").decode(o.slice(n,n+s));return t.fds[r].path_remove_directory(f)}else return 8},path_rename(r,n,s,o,f,_){let l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null&&t.fds[o]!=null){let u=new TextDecoder("utf-8").decode(l.slice(n,n+s)),p=new TextDecoder("utf-8").decode(l.slice(f,f+_)),{ret:d,inode_obj:R}=t.fds[r].path_unlink(u);if(R==null)return d;if(d=t.fds[o].path_link(p,R,!0),d!=0&&t.fds[r].path_link(u,R,!0)!=0)throw"path_link should always return success when relinking an inode back to the original place";return d}else return 8},path_symlink(r,n,s,o,f){let _=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[s]!=null){let l=new TextDecoder("utf-8").decode(_.slice(r,r+n)),u=new TextDecoder("utf-8").decode(_.slice(o,o+f));return 58}else return 8},path_unlink_file(r,n,s){let o=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let f=new TextDecoder("utf-8").decode(o.slice(n,n+s));return t.fds[r].path_unlink_file(f)}else return 8},poll_oneoff(r,n,s){if(s===0)return 28;if(s>1)return y.log("poll_oneoff: only a single subscription is supported"),58;let o=new DataView(t.inst.exports.memory.buffer),f=k.read_bytes(o,r),_=f.eventtype,l=f.clockid,u=f.timeout;if(_!==at)return y.log("poll_oneoff: only clock subscriptions are supported"),58;let p;if(l===1)p=()=>BigInt(Math.round(performance.now()*1e6));else if(l===0)p=()=>BigInt(new Date().getTime())*1000000n;else return 28;let d=(f.flags&ft)!==0?u:p()+u;for(;d>p(););return new Y(f.userdata,0,_).write_bytes(o,n),0},proc_exit(r){throw new U(r)},proc_raise(r){throw"raised signal "+r},sched_yield(){},random_get(r,n){let s=new Uint8Array(t.inst.exports.memory.buffer).subarray(r,r+n);if("crypto"in globalThis&&(typeof SharedArrayBuffer>"u"||!(t.inst.exports.memory.buffer instanceof SharedArrayBuffer)))for(let o=0;o<n;o+=65536)crypto.getRandomValues(s.subarray(o,o+65536));else for(let o=0;o<n;o++)s[o]=Math.random()*256|0},sock_recv(r,n,s){throw"sockets not supported"},sock_send(r,n,s){throw"sockets not supported"},sock_shutdown(r,n){throw"sockets not supported"},sock_accept(r,n){throw"sockets not supported"}}}};var g=class{fd_allocate(e,i){return 58}fd_close(){return 0}fd_fdstat_get(){return{ret:58,fdstat:null}}fd_fdstat_set_flags(e){return 58}fd_fdstat_set_rights(e,i){return 58}fd_filestat_get(){return{ret:58,filestat:null}}fd_filestat_set_size(e){return 58}fd_filestat_set_times(e,i,c){return 58}fd_pread(e,i){return{ret:58,data:new Uint8Array}}fd_prestat_get(){return{ret:58,prestat:null}}fd_pwrite(e,i){return{ret:58,nwritten:0}}fd_read(e){return{ret:58,data:new Uint8Array}}fd_readdir_single(e){return{ret:58,dirent:null}}fd_seek(e,i){return{ret:58,offset:0n}}fd_sync(){return 0}fd_tell(){return{ret:58,offset:0n}}fd_write(e){return{ret:58,nwritten:0}}path_create_directory(e){return 58}path_filestat_get(e,i){return{ret:58,filestat:null}}path_filestat_set_times(e,i,c,E,t){return 58}path_link(e,i,c){return 58}path_unlink(e){return{ret:58,inode_obj:null}}path_lookup(e,i){return{ret:58,inode_obj:null}}path_open(e,i,c,E,t,r){return{ret:54,fd_obj:null}}path_readlink(e){return{ret:58,data:null}}path_remove_directory(e){return 58}path_rename(e,i,c){return 58}path_unlink_file(e){return 58}},m=class a{static issue_ino(){return a.next_ino++}static root_ino(){return 0n}constructor(){this.ino=a.issue_ino()}};m.next_ino=1n;var b=class extends g{fd_allocate(e,i){if(!(this.file.size>e+i)){let c=new Uint8Array(Number(e+i));c.set(this.file.data,0),this.file.data=c}return 0}fd_fdstat_get(){return{ret:0,fdstat:new x(W,0)}}fd_filestat_set_size(e){if(this.file.size>e)this.file.data=new Uint8Array(this.file.data.buffer.slice(0,Number(e)));else{let i=new Uint8Array(Number(e));i.set(this.file.data,0),this.file.data=i}return 0}fd_read(e){let i=this.file.data.slice(Number(this.file_pos),Number(this.file_pos+BigInt(e)));return this.file_pos+=BigInt(i.length),{ret:0,data:i}}fd_pread(e,i){return{ret:0,data:this.file.data.slice(Number(i),Number(i+BigInt(e)))}}fd_seek(e,i){let c;switch(i){case Q:c=e;break;case Z:c=this.file_pos+e;break;case V:c=BigInt(this.file.data.byteLength)+e;break;default:return{ret:28,offset:0n}}return c<0?{ret:28,offset:0n}:(this.file_pos=c,{ret:0,offset:this.file_pos})}fd_tell(){return{ret:0,offset:this.file_pos}}fd_write(e){if(this.file.readonly)return{ret:8,nwritten:0};if(this.file_pos+BigInt(e.byteLength)>this.file.size){let i=this.file.data;this.file.data=new Uint8Array(Number(this.file_pos+BigInt(e.byteLength))),this.file.data.set(i)}return this.file.data.set(e,Number(this.file_pos)),this.file_pos+=BigInt(e.byteLength),{ret:0,nwritten:e.byteLength}}fd_pwrite(e,i){if(this.file.readonly)return{ret:8,nwritten:0};if(i+BigInt(e.byteLength)>this.file.size){let c=this.file.data;this.file.data=new Uint8Array(Number(i+BigInt(e.byteLength))),this.file.data.set(c)}return this.file.data.set(e,Number(i)),{ret:0,nwritten:e.byteLength}}fd_filestat_get(){return{ret:0,filestat:this.file.stat()}}constructor(e){super(),this.file_pos=0n,this.file=e}};var F=class extends m{path_open(e,i,c){if(this.readonly&&(i&BigInt(64))==BigInt(64))return{ret:63,fd_obj:null};if((e&j)==j){if(this.readonly)return{ret:63,fd_obj:null};this.data=new Uint8Array([])}let E=new b(this);return c&q&&E.fd_seek(0n,V),{ret:0,fd_obj:E}}get size(){return BigInt(this.data.byteLength)}stat(){return new A(this.ino,W,this.size)}constructor(e,i){super(),this.data=new Uint8Array(e),this.readonly=!!i?.readonly}};var P=class a extends g{fd_filestat_get(){return{ret:0,filestat:new A(this.ino,J,BigInt(0))}}fd_fdstat_get(){let e=new x(J,0);return e.fs_rights_base=BigInt(64),{ret:0,fdstat:e}}fd_write(e){return this.write(e),{ret:0,nwritten:e.byteLength}}static lineBuffered(e){let i=new TextDecoder("utf-8",{fatal:!1}),c="";return new a(E=>{c+=i.decode(E,{stream:!0});let t=c.split(`\n`);for(let[r,n]of t.entries())r<t.length-1?e(n):c=n})}constructor(e){super(),this.ino=m.issue_ino(),this.write=e}};var ct="code-playpad Clang 20.1.2 / Emscripten 4.0.6 r1",lt={"clang.js":{bytes:74300,sha256:"b437a648812aabd1cc87cba4a7268e2f53ab94a9071a854ba983dd62328dc30c"},"clang.wasm":{bytes:42578038,sha256:"534571fd4f9136c85d3e25a395cc31983ec3cbd41012e3928b45879a518718fa"},"lld.js":{bytes:71711,sha256:"2da4b0a04b6953bdc4869137631abd11ea7eb5a667fbd19c4ff6d68d56f302bb"},"lld.wasm":{bytes:23228304,sha256:"55ffbe1366525c1b55b65140630e0ca00ff47eae7acfdee6a15b46e738800ec7"},"sysroot.tar":{bytes:29009920,sha256:"a0d92a9fc1dccc2c181ae6812b6c169de3dad851ee4d4e796d15940776648ac5"}};function K(a){if(!a||a.startsWith("/")||/[\\\\\\x00-\\x1f:]/.test(a)||a.split("/").some(e=>!e||e==="."||e===".."))throw new Error(`Invalid project path: ${JSON.stringify(a)}. Use relative paths without . or ...`);return a}function ut(a,e,i,c){let E=K(i??(c==="c"?"main.c":"main.cpp")),t=e?{...e}:{[E]:a};if(!Object.hasOwn(t,E))throw new Error(`Entry file ${E} does not exist.`);let r=Object.keys(t).map(K).sort(),n=f=>/\\.c$/.test(f),s=f=>/\\.(cpp|cc|cxx)$/.test(f);if(r.some(c==="c"?s:n))throw new Error("Mixed C/C++ source projects are not supported yet.");let o=r.filter(c==="c"?n:s);if(!o.includes(E))throw new Error(`Entry ${E} must have a ${c==="c"?".c":".cpp, .cc, or .cxx"} extension.`);if(o.length>32||r.length>256)throw new Error("Project limit: 32 source files and 256 files total.");if(Object.values(t).reduce((f,_)=>f+new TextEncoder().encode(_).length,0)>2e6)throw new Error("Project exceeds the 2 MB source limit.");return{files:t,sources:o,entry:E}}var st,v,dt=Promise.resolve(),G=a=>globalThis.postMessage(a),M=(a,e,i)=>G({type:"progress",id:a,phase:e,message:i}),B=(a,e)=>ot(a,lt[a],st,it,i=>M(e,"downloading",i));function St(a){let e=new Uint8Array(a),i=new TextDecoder,c=[],E=(t,r)=>i.decode(e.subarray(t,t+r)).replace(/\\0.*$/,"");for(let t=0;t+512<=e.length;){let r=E(t,100);if(!r)break;let n=E(t+345,155);n&&(r=n+"/"+r);let s=parseInt(E(t+124,12).trim()||"0",8),o=e[t+156];if(!Number.isSafeInteger(s)||s<0||t+512+s>e.length)throw new Error("Invalid sysroot archive.");if(o===48||o===0)c.push({name:"/"+K(r),data:e.subarray(t+512,t+512+s)});else if(o!==53)throw new Error("Unsupported sysroot archive entry.");t+=512+Math.ceil(s/512)*512}return c}async function Rt(a){let e=URL.createObjectURL(new Blob([a],{type:"text/javascript"}));try{return(await import(e)).default}finally{URL.revokeObjectURL(e)}}function yt(a){return st?(v||(v=(async()=>{let e=await Rt(await B("clang.js",a)),i=await Rt(await B("lld.js",a)),c=await WebAssembly.compile(await B("clang.wasm",a)),E=await WebAssembly.compile(await B("lld.wasm",a));M(a,"booting","Preparing C/C++ standard libraries\\u2026");let t=St(await B("sysroot.tar",a));return{clang:e,lld:i,clangModule:c,lldModule:E,sysroot:t}})().catch(e=>{throw v=void 0,e})),v):Promise.reject(new Error("Configure the rebuilt C/C++ assets with configureCpp({ indexURL }) before creating widgets. See docs/CPP-REBUILD.md."))}async function Et(a,e,i,c){let E,t=await a({thisProgram:i,noInitialRun:!0,print:c,printErr:c,instantiateWasm(r,n){let s=new WebAssembly.Instance(e,r);return E=Object.values(s.exports).find(o=>o instanceof WebAssembly.Memory),n(s,e),s.exports}});return t.memory=E,t}function $(a,e,i){a.mkdirTree(e.slice(0,e.lastIndexOf("/"))||"/"),a.writeFile(e,i)}async function mt(a){let e=performance.now(),i=0,c=(E,t)=>{if(i+=t.length,i>1e6)throw new Error("Output limit exceeded (1 MB).");t&&G({type:E,id:a.id,text:t})};try{let E=ut(a.code,a.files,a.entry,a.compilerLanguage),t=await yt(a.id),r=[],n=0;for(let R of E.sources){M(a.id,"compiling",`Compiling ${R}\\u2026`);let h=await Et(t.clang,t.clangModule,"clang",T=>c("stderr",T+`\n`));for(let T of t.sysroot)$(h.FS,T.name,T.data);for(let[T,pt]of Object.entries(E.files))$(h.FS,"/project/"+T,pt);let S=a.compilerLanguage==="cpp",X=["-cc1","-triple","wasm32-unknown-wasi","-emit-obj","-O0","-std="+(S?"c++20":"c17"),"-resource-dir","/lib/clang/20",...S?["-internal-isystem","/include/wasm32-wasi/c++/v1","-internal-isystem","/include/c++/v1"]:[],"-internal-isystem","/lib/clang/20/include","-internal-isystem","/include/wasm32-wasi","-internal-isystem","/include","-I","/project","-ferror-limit","20","-o","/tmp/output.o","-x",S?"c++":"c","/project/"+R],H=h.callMain(X);if(n=Math.max(n,h.memory?.buffer.byteLength??0),H!==0)throw new Error(`Compilation failed (${R}, exit ${H}).`);r.push(h.FS.readFile("/tmp/output.o").slice())}M(a.id,"linking","Linking\\u2026");let s=await Et(t.lld,t.lldModule,"wasm-ld",R=>c("stderr",R+`\n`));for(let R of t.sysroot)R.name.startsWith("/include/")||$(s.FS,R.name,R.data);r.forEach((R,h)=>$(s.FS,"/tmp/"+h+".o",R));let o=s.callMain(["-m","wasm32","-z","stack-size=1048576","--max-memory=268435456","-L/lib/wasm32-wasi","/lib/wasm32-wasi/crt1-command.o",...r.map((R,h)=>"/tmp/"+h+".o"),...a.compilerLanguage==="cpp"?["-lc++","-lc++abi"]:[],"-lc","/lib/clang/20/lib/wasm32-unknown-wasi/libclang_rt.builtins.a","-o","/tmp/program.wasm"]);if(n=Math.max(n,s.memory?.buffer.byteLength??0),o!==0)throw new Error(`Linking failed (exit ${o}).`);let f=await WebAssembly.compile(s.FS.readFile("/tmp/program.wasm").slice().buffer);M(a.id,"running","Running\\u2026");let _={stdout:new TextDecoder,stderr:new TextDecoder},l=R=>new P(h=>c(R,_[R].decode(h,{stream:!0}))),u=new rt([E.entry],[],[new b(new F(new TextEncoder().encode(a.stdin??""))),l("stdout"),l("stderr")]),p=await WebAssembly.instantiate(f,{wasi_snapshot_preview1:u.wasiImport}),d=u.start(p);if(c("stdout",_.stdout.decode()),c("stderr",_.stderr.decode()),d!==0)throw new Error(`Program exited with status ${d}.`);G({type:"result",id:a.id,durationMs:performance.now()-e,memory:{compilerBytes:n,programBytes:p.exports.memory.buffer.byteLength}})}catch(E){G({type:"error",id:a.id,message:E instanceof Error?E.message:String(E),durationMs:performance.now()-e})}}globalThis.onmessage=({data:a})=>{a.type==="init"?(st=a.toolchainURL,G({type:"ready",version:ct,interactiveStdin:!1})):a.type==="run"&&(dt=dt.then(()=>mt(a)))};})();\n',a=new class extends r{id=`cpp`;get label(){return`C/C++ (Clang 20, experimental)`}get source(){return i}async load(e){return await t(n),super.load(e)}initPayload(){return{toolchainURL:e().indexURL}}};function o(t){return{id:t,label:t===`c`?`C17 (experimental)`:`C++20 (experimental)`,statusDecidesFailure:!0,get ready(){return a.ready},interactiveStdin:!1,async editorLanguage(){return(await import(`./dist-3xj9-ylK.js`)).cpp()},load:e=>a.load(e),run:(n,r={})=>a.run(n,{...r,compilerLanguage:t,timeoutMs:r.timeoutMs??e().timeoutMs}),stop:e=>a.stop(e)}}var s=o(`c`),c=o(`cpp`);export{s as cRuntime,c as cppRuntime};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./config-3Z6xX6Jr.js";import{n as t,t as n}from"./compiler-cache-XwslsU5H.js";import{t as r}from"./worker-runtime-5Ujf07eB.js";var i='"use strict";(()=>{var it="code-playpad-cpp-20.1.2-emscripten-4.0.6-r1";async function ot(a,e,i,c,E){let t=new URL(a,i).href,r;try{r=await caches.open(c)}catch{}let n;try{n=await r?.match(t)}catch{}let s=async _=>{if(!_.ok)throw new Error(`Toolchain download failed: ${a} (HTTP ${_.status}). Check the asset URL and retry.`);let l=_.body?.getReader();if(!l)return _.arrayBuffer();let u=[],p=0,d=0;for(;;){let S=await l.read();if(S.done)break;if(p+=S.value.length,p>e.bytes)throw await l.cancel(),new Error(`Unexpected toolchain size: ${a}.`);u.push(S.value),performance.now()-d>100&&(E(`${n?"Reading cached":"Downloading"} ${a}: ${(p/1e6).toFixed(1)} / ${(e.bytes/1e6).toFixed(1)} MB (decoded)`),d=performance.now())}let R=new Uint8Array(p),h=0;for(let S of u)R.set(S,h),h+=S.length;return R.buffer},o=async _=>_.byteLength===e.bytes&&[...new Uint8Array(await crypto.subtle.digest("SHA-256",_))].map(l=>l.toString(16).padStart(2,"0")).join("")===e.sha256;if(n){try{let _=await s(n);if(await o(_))return _}catch{}try{await r?.delete(t)}catch{}n=void 0}let f=await s(await fetch(t));if(!await o(f))throw new Error(`Toolchain integrity check failed: ${a}. Use the pinned toolchain assets.`);try{await r?.put(t,new Response(f))}catch{}return f}var C=class a{static read_bytes(e,i){let c=new a;return c.buf=e.getUint32(i,!0),c.buf_len=e.getUint32(i+4,!0),c}static read_bytes_array(e,i,c){let E=[];for(let t=0;t<c;t++)E.push(a.read_bytes(e,i+8*t));return E}},L=class a{static read_bytes(e,i){let c=new a;return c.buf=e.getUint32(i,!0),c.buf_len=e.getUint32(i+4,!0),c}static read_bytes_array(e,i,c){let E=[];for(let t=0;t<c;t++)E.push(a.read_bytes(e,i+8*t));return E}},Q=0,Z=1,V=2;var J=2;var W=4;var q=1;var x=class{write_bytes(e,i){e.setUint8(i,this.fs_filetype),e.setUint16(i+2,this.fs_flags,!0),e.setBigUint64(i+8,this.fs_rights_base,!0),e.setBigUint64(i+16,this.fs_rights_inherited,!0)}constructor(e,i){this.fs_rights_base=0n,this.fs_rights_inherited=0n,this.fs_filetype=e,this.fs_flags=i}};var j=8,A=class{write_bytes(e,i){e.setBigUint64(i,this.dev,!0),e.setBigUint64(i+8,this.ino,!0),e.setUint8(i+16,this.filetype),e.setBigUint64(i+24,this.nlink,!0),e.setBigUint64(i+32,this.size,!0),e.setBigUint64(i+38,this.atim,!0),e.setBigUint64(i+46,this.mtim,!0),e.setBigUint64(i+52,this.ctim,!0)}constructor(e,i,c){this.dev=0n,this.nlink=0n,this.atim=0n,this.mtim=0n,this.ctim=0n,this.ino=e,this.filetype=i,this.size=c}},at=0;var ft=1,k=class a{static read_bytes(e,i){return new a(e.getBigUint64(i,!0),e.getUint8(i+8),e.getUint32(i+16,!0),e.getBigUint64(i+24,!0),e.getUint16(i+36,!0))}constructor(e,i,c,E,t){this.userdata=e,this.eventtype=i,this.clockid=c,this.timeout=E,this.flags=t}},Y=class{write_bytes(e,i){e.setBigUint64(i,this.userdata,!0),e.setUint16(i+8,this.error,!0),e.setUint8(i+10,this.eventtype)}constructor(e,i,c){this.userdata=e,this.error=i,this.eventtype=c}};var wt=class{enable(e){this.log=ht(e===void 0?!0:e,this.prefix)}get enabled(){return this.isEnabled}constructor(e){this.isEnabled=e,this.prefix="wasi:",this.enable(e)}};function ht(a,e){return a?console.log.bind(console,"%c%s","color: #265BA0",e):()=>{}}var y=new wt(!1);var U=class extends Error{constructor(e){super("exit with exit code "+e),this.code=e}},rt=class{start(e){this.inst=e;try{return e.exports._start(),0}catch(i){if(i instanceof U)return i.code;throw i}}initialize(e){this.inst=e,e.exports._initialize&&e.exports._initialize()}constructor(e,i,c,E={}){this.args=[],this.env=[],this.fds=[],y.enable(E.debug),this.args=e,this.env=i,this.fds=c;let t=this;this.wasiImport={args_sizes_get(r,n){let s=new DataView(t.inst.exports.memory.buffer);s.setUint32(r,t.args.length,!0);let o=0;for(let f of t.args)o+=f.length+1;return s.setUint32(n,o,!0),y.log(s.getUint32(r,!0),s.getUint32(n,!0)),0},args_get(r,n){let s=new DataView(t.inst.exports.memory.buffer),o=new Uint8Array(t.inst.exports.memory.buffer),f=n;for(let _=0;_<t.args.length;_++){s.setUint32(r,n,!0),r+=4;let l=new TextEncoder().encode(t.args[_]);o.set(l,n),s.setUint8(n+l.length,0),n+=l.length+1}return y.enabled&&y.log(new TextDecoder("utf-8").decode(o.slice(f,n))),0},environ_sizes_get(r,n){let s=new DataView(t.inst.exports.memory.buffer);s.setUint32(r,t.env.length,!0);let o=0;for(let f of t.env)o+=new TextEncoder().encode(f).length+1;return s.setUint32(n,o,!0),y.log(s.getUint32(r,!0),s.getUint32(n,!0)),0},environ_get(r,n){let s=new DataView(t.inst.exports.memory.buffer),o=new Uint8Array(t.inst.exports.memory.buffer),f=n;for(let _=0;_<t.env.length;_++){s.setUint32(r,n,!0),r+=4;let l=new TextEncoder().encode(t.env[_]);o.set(l,n),s.setUint8(n+l.length,0),n+=l.length+1}return y.enabled&&y.log(new TextDecoder("utf-8").decode(o.slice(f,n))),0},clock_res_get(r,n){let s;switch(r){case 1:{s=5000n;break}case 0:{s=1000000n;break}default:return 52}return new DataView(t.inst.exports.memory.buffer).setBigUint64(n,s,!0),0},clock_time_get(r,n,s){let o=new DataView(t.inst.exports.memory.buffer);if(r===0)o.setBigUint64(s,BigInt(new Date().getTime())*1000000n,!0);else if(r==1){let f;try{f=BigInt(Math.round(performance.now()*1e6))}catch{f=0n}o.setBigUint64(s,f,!0)}else o.setBigUint64(s,0n,!0);return 0},fd_advise(r,n,s,o){return t.fds[r]!=null?0:8},fd_allocate(r,n,s){return t.fds[r]!=null?t.fds[r].fd_allocate(n,s):8},fd_close(r){if(t.fds[r]!=null){let n=t.fds[r].fd_close();return t.fds[r]=void 0,n}else return 8},fd_datasync(r){return t.fds[r]!=null?t.fds[r].fd_sync():8},fd_fdstat_get(r,n){if(t.fds[r]!=null){let{ret:s,fdstat:o}=t.fds[r].fd_fdstat_get();return o?.write_bytes(new DataView(t.inst.exports.memory.buffer),n),s}else return 8},fd_fdstat_set_flags(r,n){return t.fds[r]!=null?t.fds[r].fd_fdstat_set_flags(n):8},fd_fdstat_set_rights(r,n,s){return t.fds[r]!=null?t.fds[r].fd_fdstat_set_rights(n,s):8},fd_filestat_get(r,n){if(t.fds[r]!=null){let{ret:s,filestat:o}=t.fds[r].fd_filestat_get();return o?.write_bytes(new DataView(t.inst.exports.memory.buffer),n),s}else return 8},fd_filestat_set_size(r,n){return t.fds[r]!=null?t.fds[r].fd_filestat_set_size(n):8},fd_filestat_set_times(r,n,s,o){return t.fds[r]!=null?t.fds[r].fd_filestat_set_times(n,s,o):8},fd_pread(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=C.read_bytes_array(_,n,s),p=0;for(let d of u){let{ret:R,data:h}=t.fds[r].fd_pread(d.buf_len,o);if(R!=0)return _.setUint32(f,p,!0),R;if(l.set(h,d.buf),p+=h.length,o+=BigInt(h.length),h.length!=d.buf_len)break}return _.setUint32(f,p,!0),0}else return 8},fd_prestat_get(r,n){let s=new DataView(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let{ret:o,prestat:f}=t.fds[r].fd_prestat_get();return f?.write_bytes(s,n),o}else return 8},fd_prestat_dir_name(r,n,s){if(t.fds[r]!=null){let{ret:o,prestat:f}=t.fds[r].fd_prestat_get();if(f==null)return o;let _=f.inner.pr_name;return new Uint8Array(t.inst.exports.memory.buffer).set(_.slice(0,s),n),_.byteLength>s?37:0}else return 8},fd_pwrite(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=L.read_bytes_array(_,n,s),p=0;for(let d of u){let R=l.slice(d.buf,d.buf+d.buf_len),{ret:h,nwritten:S}=t.fds[r].fd_pwrite(R,o);if(h!=0)return _.setUint32(f,p,!0),h;if(p+=S,o+=BigInt(S),S!=R.byteLength)break}return _.setUint32(f,p,!0),0}else return 8},fd_read(r,n,s,o){let f=new DataView(t.inst.exports.memory.buffer),_=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let l=C.read_bytes_array(f,n,s),u=0;for(let p of l){let{ret:d,data:R}=t.fds[r].fd_read(p.buf_len);if(d!=0)return f.setUint32(o,u,!0),d;if(_.set(R,p.buf),u+=R.length,R.length!=p.buf_len)break}return f.setUint32(o,u,!0),0}else return 8},fd_readdir(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=0;for(;;){let{ret:p,dirent:d}=t.fds[r].fd_readdir_single(o);if(p!=0)return _.setUint32(f,u,!0),p;if(d==null)break;if(s-u<d.head_length()){u=s;break}let R=new ArrayBuffer(d.head_length());if(d.write_head_bytes(new DataView(R),0),l.set(new Uint8Array(R).slice(0,Math.min(R.byteLength,s-u)),n),n+=d.head_length(),u+=d.head_length(),s-u<d.name_length()){u=s;break}d.write_name_bytes(l,n,s-u),n+=d.name_length(),u+=d.name_length(),o=d.d_next}return _.setUint32(f,u,!0),0}else return 8},fd_renumber(r,n){if(t.fds[r]!=null&&t.fds[n]!=null){let s=t.fds[n].fd_close();return s!=0?s:(t.fds[n]=t.fds[r],t.fds[r]=void 0,0)}else return 8},fd_seek(r,n,s,o){let f=new DataView(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let{ret:_,offset:l}=t.fds[r].fd_seek(n,s);return f.setBigInt64(o,l,!0),_}else return 8},fd_sync(r){return t.fds[r]!=null?t.fds[r].fd_sync():8},fd_tell(r,n){let s=new DataView(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let{ret:o,offset:f}=t.fds[r].fd_tell();return s.setBigUint64(n,f,!0),o}else return 8},fd_write(r,n,s,o){let f=new DataView(t.inst.exports.memory.buffer),_=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let l=L.read_bytes_array(f,n,s),u=0;for(let p of l){let d=_.slice(p.buf,p.buf+p.buf_len),{ret:R,nwritten:h}=t.fds[r].fd_write(d);if(R!=0)return f.setUint32(o,u,!0),R;if(u+=h,h!=d.byteLength)break}return f.setUint32(o,u,!0),0}else return 8},path_create_directory(r,n,s){let o=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let f=new TextDecoder("utf-8").decode(o.slice(n,n+s));return t.fds[r].path_create_directory(f)}else return 8},path_filestat_get(r,n,s,o,f){let _=new DataView(t.inst.exports.memory.buffer),l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let u=new TextDecoder("utf-8").decode(l.slice(s,s+o)),{ret:p,filestat:d}=t.fds[r].path_filestat_get(n,u);return d?.write_bytes(_,f),p}else return 8},path_filestat_set_times(r,n,s,o,f,_,l){let u=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let p=new TextDecoder("utf-8").decode(u.slice(s,s+o));return t.fds[r].path_filestat_set_times(n,p,f,_,l)}else return 8},path_link(r,n,s,o,f,_,l){let u=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null&&t.fds[f]!=null){let p=new TextDecoder("utf-8").decode(u.slice(s,s+o)),d=new TextDecoder("utf-8").decode(u.slice(_,_+l)),{ret:R,inode_obj:h}=t.fds[r].path_lookup(p,n);return h==null?R:t.fds[f].path_link(d,h,!1)}else return 8},path_open(r,n,s,o,f,_,l,u,p){let d=new DataView(t.inst.exports.memory.buffer),R=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let h=new TextDecoder("utf-8").decode(R.slice(s,s+o));y.log(h);let{ret:S,fd_obj:X}=t.fds[r].path_open(n,h,f,_,l,u);if(S!=0)return S;t.fds.push(X);let H=t.fds.length-1;return d.setUint32(p,H,!0),0}else return 8},path_readlink(r,n,s,o,f,_){let l=new DataView(t.inst.exports.memory.buffer),u=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let p=new TextDecoder("utf-8").decode(u.slice(n,n+s));y.log(p);let{ret:d,data:R}=t.fds[r].path_readlink(p);if(R!=null){let h=new TextEncoder().encode(R);if(h.length>f)return l.setUint32(_,0,!0),8;u.set(h,o),l.setUint32(_,h.length,!0)}return d}else return 8},path_remove_directory(r,n,s){let o=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let f=new TextDecoder("utf-8").decode(o.slice(n,n+s));return t.fds[r].path_remove_directory(f)}else return 8},path_rename(r,n,s,o,f,_){let l=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null&&t.fds[o]!=null){let u=new TextDecoder("utf-8").decode(l.slice(n,n+s)),p=new TextDecoder("utf-8").decode(l.slice(f,f+_)),{ret:d,inode_obj:R}=t.fds[r].path_unlink(u);if(R==null)return d;if(d=t.fds[o].path_link(p,R,!0),d!=0&&t.fds[r].path_link(u,R,!0)!=0)throw"path_link should always return success when relinking an inode back to the original place";return d}else return 8},path_symlink(r,n,s,o,f){let _=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[s]!=null){let l=new TextDecoder("utf-8").decode(_.slice(r,r+n)),u=new TextDecoder("utf-8").decode(_.slice(o,o+f));return 58}else return 8},path_unlink_file(r,n,s){let o=new Uint8Array(t.inst.exports.memory.buffer);if(t.fds[r]!=null){let f=new TextDecoder("utf-8").decode(o.slice(n,n+s));return t.fds[r].path_unlink_file(f)}else return 8},poll_oneoff(r,n,s){if(s===0)return 28;if(s>1)return y.log("poll_oneoff: only a single subscription is supported"),58;let o=new DataView(t.inst.exports.memory.buffer),f=k.read_bytes(o,r),_=f.eventtype,l=f.clockid,u=f.timeout;if(_!==at)return y.log("poll_oneoff: only clock subscriptions are supported"),58;let p;if(l===1)p=()=>BigInt(Math.round(performance.now()*1e6));else if(l===0)p=()=>BigInt(new Date().getTime())*1000000n;else return 28;let d=(f.flags&ft)!==0?u:p()+u;for(;d>p(););return new Y(f.userdata,0,_).write_bytes(o,n),0},proc_exit(r){throw new U(r)},proc_raise(r){throw"raised signal "+r},sched_yield(){},random_get(r,n){let s=new Uint8Array(t.inst.exports.memory.buffer).subarray(r,r+n);if("crypto"in globalThis&&(typeof SharedArrayBuffer>"u"||!(t.inst.exports.memory.buffer instanceof SharedArrayBuffer)))for(let o=0;o<n;o+=65536)crypto.getRandomValues(s.subarray(o,o+65536));else for(let o=0;o<n;o++)s[o]=Math.random()*256|0},sock_recv(r,n,s){throw"sockets not supported"},sock_send(r,n,s){throw"sockets not supported"},sock_shutdown(r,n){throw"sockets not supported"},sock_accept(r,n){throw"sockets not supported"}}}};var g=class{fd_allocate(e,i){return 58}fd_close(){return 0}fd_fdstat_get(){return{ret:58,fdstat:null}}fd_fdstat_set_flags(e){return 58}fd_fdstat_set_rights(e,i){return 58}fd_filestat_get(){return{ret:58,filestat:null}}fd_filestat_set_size(e){return 58}fd_filestat_set_times(e,i,c){return 58}fd_pread(e,i){return{ret:58,data:new Uint8Array}}fd_prestat_get(){return{ret:58,prestat:null}}fd_pwrite(e,i){return{ret:58,nwritten:0}}fd_read(e){return{ret:58,data:new Uint8Array}}fd_readdir_single(e){return{ret:58,dirent:null}}fd_seek(e,i){return{ret:58,offset:0n}}fd_sync(){return 0}fd_tell(){return{ret:58,offset:0n}}fd_write(e){return{ret:58,nwritten:0}}path_create_directory(e){return 58}path_filestat_get(e,i){return{ret:58,filestat:null}}path_filestat_set_times(e,i,c,E,t){return 58}path_link(e,i,c){return 58}path_unlink(e){return{ret:58,inode_obj:null}}path_lookup(e,i){return{ret:58,inode_obj:null}}path_open(e,i,c,E,t,r){return{ret:54,fd_obj:null}}path_readlink(e){return{ret:58,data:null}}path_remove_directory(e){return 58}path_rename(e,i,c){return 58}path_unlink_file(e){return 58}},m=class a{static issue_ino(){return a.next_ino++}static root_ino(){return 0n}constructor(){this.ino=a.issue_ino()}};m.next_ino=1n;var b=class extends g{fd_allocate(e,i){if(!(this.file.size>e+i)){let c=new Uint8Array(Number(e+i));c.set(this.file.data,0),this.file.data=c}return 0}fd_fdstat_get(){return{ret:0,fdstat:new x(W,0)}}fd_filestat_set_size(e){if(this.file.size>e)this.file.data=new Uint8Array(this.file.data.buffer.slice(0,Number(e)));else{let i=new Uint8Array(Number(e));i.set(this.file.data,0),this.file.data=i}return 0}fd_read(e){let i=this.file.data.slice(Number(this.file_pos),Number(this.file_pos+BigInt(e)));return this.file_pos+=BigInt(i.length),{ret:0,data:i}}fd_pread(e,i){return{ret:0,data:this.file.data.slice(Number(i),Number(i+BigInt(e)))}}fd_seek(e,i){let c;switch(i){case Q:c=e;break;case Z:c=this.file_pos+e;break;case V:c=BigInt(this.file.data.byteLength)+e;break;default:return{ret:28,offset:0n}}return c<0?{ret:28,offset:0n}:(this.file_pos=c,{ret:0,offset:this.file_pos})}fd_tell(){return{ret:0,offset:this.file_pos}}fd_write(e){if(this.file.readonly)return{ret:8,nwritten:0};if(this.file_pos+BigInt(e.byteLength)>this.file.size){let i=this.file.data;this.file.data=new Uint8Array(Number(this.file_pos+BigInt(e.byteLength))),this.file.data.set(i)}return this.file.data.set(e,Number(this.file_pos)),this.file_pos+=BigInt(e.byteLength),{ret:0,nwritten:e.byteLength}}fd_pwrite(e,i){if(this.file.readonly)return{ret:8,nwritten:0};if(i+BigInt(e.byteLength)>this.file.size){let c=this.file.data;this.file.data=new Uint8Array(Number(i+BigInt(e.byteLength))),this.file.data.set(c)}return this.file.data.set(e,Number(i)),{ret:0,nwritten:e.byteLength}}fd_filestat_get(){return{ret:0,filestat:this.file.stat()}}constructor(e){super(),this.file_pos=0n,this.file=e}};var F=class extends m{path_open(e,i,c){if(this.readonly&&(i&BigInt(64))==BigInt(64))return{ret:63,fd_obj:null};if((e&j)==j){if(this.readonly)return{ret:63,fd_obj:null};this.data=new Uint8Array([])}let E=new b(this);return c&q&&E.fd_seek(0n,V),{ret:0,fd_obj:E}}get size(){return BigInt(this.data.byteLength)}stat(){return new A(this.ino,W,this.size)}constructor(e,i){super(),this.data=new Uint8Array(e),this.readonly=!!i?.readonly}};var P=class a extends g{fd_filestat_get(){return{ret:0,filestat:new A(this.ino,J,BigInt(0))}}fd_fdstat_get(){let e=new x(J,0);return e.fs_rights_base=BigInt(64),{ret:0,fdstat:e}}fd_write(e){return this.write(e),{ret:0,nwritten:e.byteLength}}static lineBuffered(e){let i=new TextDecoder("utf-8",{fatal:!1}),c="";return new a(E=>{c+=i.decode(E,{stream:!0});let t=c.split(`\n`);for(let[r,n]of t.entries())r<t.length-1?e(n):c=n})}constructor(e){super(),this.ino=m.issue_ino(),this.write=e}};var ct="code-playpad Clang 20.1.2 / Emscripten 4.0.6 r1",lt={"clang.js":{bytes:74300,sha256:"b437a648812aabd1cc87cba4a7268e2f53ab94a9071a854ba983dd62328dc30c"},"clang.wasm":{bytes:42578038,sha256:"534571fd4f9136c85d3e25a395cc31983ec3cbd41012e3928b45879a518718fa"},"lld.js":{bytes:71711,sha256:"2da4b0a04b6953bdc4869137631abd11ea7eb5a667fbd19c4ff6d68d56f302bb"},"lld.wasm":{bytes:23228304,sha256:"55ffbe1366525c1b55b65140630e0ca00ff47eae7acfdee6a15b46e738800ec7"},"sysroot.tar":{bytes:29009920,sha256:"a0d92a9fc1dccc2c181ae6812b6c169de3dad851ee4d4e796d15940776648ac5"}};function K(a){if(!a||a.startsWith("/")||/[\\\\\\x00-\\x1f:]/.test(a)||a.split("/").some(e=>!e||e==="."||e===".."))throw new Error(`Invalid project path: ${JSON.stringify(a)}. Use relative paths without . or ...`);return a}function ut(a,e,i,c){let E=K(i??(c==="c"?"main.c":"main.cpp")),t=e?{...e}:{[E]:a};if(!Object.hasOwn(t,E))throw new Error(`Entry file ${E} does not exist.`);let r=Object.keys(t).map(K).sort(),n=f=>/\\.c$/.test(f),s=f=>/\\.(cpp|cc|cxx)$/.test(f);if(r.some(c==="c"?s:n))throw new Error("Mixed C/C++ source projects are not supported yet.");let o=r.filter(c==="c"?n:s);if(!o.includes(E))throw new Error(`Entry ${E} must have a ${c==="c"?".c":".cpp, .cc, or .cxx"} extension.`);if(o.length>32||r.length>256)throw new Error("Project limit: 32 source files and 256 files total.");if(Object.values(t).reduce((f,_)=>f+new TextEncoder().encode(_).length,0)>2e6)throw new Error("Project exceeds the 2 MB source limit.");return{files:t,sources:o,entry:E}}var st,v,dt=Promise.resolve(),G=a=>globalThis.postMessage(a),M=(a,e,i)=>G({type:"progress",id:a,phase:e,message:i}),B=(a,e)=>ot(a,lt[a],st,it,i=>M(e,"downloading",i));function St(a){let e=new Uint8Array(a),i=new TextDecoder,c=[],E=(t,r)=>i.decode(e.subarray(t,t+r)).replace(/\\0.*$/,"");for(let t=0;t+512<=e.length;){let r=E(t,100);if(!r)break;let n=E(t+345,155);n&&(r=n+"/"+r);let s=parseInt(E(t+124,12).trim()||"0",8),o=e[t+156];if(!Number.isSafeInteger(s)||s<0||t+512+s>e.length)throw new Error("Invalid sysroot archive.");if(o===48||o===0)c.push({name:"/"+K(r),data:e.subarray(t+512,t+512+s)});else if(o!==53)throw new Error("Unsupported sysroot archive entry.");t+=512+Math.ceil(s/512)*512}return c}async function Rt(a){let e=URL.createObjectURL(new Blob([a],{type:"text/javascript"}));try{return(await import(e)).default}finally{URL.revokeObjectURL(e)}}function yt(a){return st?(v||(v=(async()=>{let e=await Rt(await B("clang.js",a)),i=await Rt(await B("lld.js",a)),c=await WebAssembly.compile(await B("clang.wasm",a)),E=await WebAssembly.compile(await B("lld.wasm",a));M(a,"booting","Preparing C/C++ standard libraries\\u2026");let t=St(await B("sysroot.tar",a));return{clang:e,lld:i,clangModule:c,lldModule:E,sysroot:t}})().catch(e=>{throw v=void 0,e})),v):Promise.reject(new Error("Configure the rebuilt C/C++ assets with configureCpp({ indexURL }) before creating widgets. See docs/CPP-REBUILD.md."))}async function Et(a,e,i,c){let E,t=await a({thisProgram:i,noInitialRun:!0,print:c,printErr:c,instantiateWasm(r,n){let s=new WebAssembly.Instance(e,r);return E=Object.values(s.exports).find(o=>o instanceof WebAssembly.Memory),n(s,e),s.exports}});return t.memory=E,t}function $(a,e,i){a.mkdirTree(e.slice(0,e.lastIndexOf("/"))||"/"),a.writeFile(e,i)}async function mt(a){let e=performance.now(),i=0,c=(E,t)=>{if(i+=t.length,i>1e6)throw new Error("Output limit exceeded (1 MB).");t&&G({type:E,id:a.id,text:t})};try{let E=ut(a.code,a.files,a.entry,a.compilerLanguage),t=await yt(a.id),r=[],n=0;for(let R of E.sources){M(a.id,"compiling",`Compiling ${R}\\u2026`);let h=await Et(t.clang,t.clangModule,"clang",T=>c("stderr",T+`\n`));for(let T of t.sysroot)$(h.FS,T.name,T.data);for(let[T,pt]of Object.entries(E.files))$(h.FS,"/project/"+T,pt);let S=a.compilerLanguage==="cpp",X=["-cc1","-triple","wasm32-unknown-wasi","-emit-obj","-O0","-std="+(S?"c++20":"c17"),"-resource-dir","/lib/clang/20",...S?["-internal-isystem","/include/wasm32-wasi/c++/v1","-internal-isystem","/include/c++/v1"]:[],"-internal-isystem","/lib/clang/20/include","-internal-isystem","/include/wasm32-wasi","-internal-isystem","/include","-I","/project","-ferror-limit","20","-o","/tmp/output.o","-x",S?"c++":"c","/project/"+R],H=h.callMain(X);if(n=Math.max(n,h.memory?.buffer.byteLength??0),H!==0)throw new Error(`Compilation failed (${R}, exit ${H}).`);r.push(h.FS.readFile("/tmp/output.o").slice())}M(a.id,"linking","Linking\\u2026");let s=await Et(t.lld,t.lldModule,"wasm-ld",R=>c("stderr",R+`\n`));for(let R of t.sysroot)R.name.startsWith("/include/")||$(s.FS,R.name,R.data);r.forEach((R,h)=>$(s.FS,"/tmp/"+h+".o",R));let o=s.callMain(["-m","wasm32","-z","stack-size=1048576","--max-memory=268435456","-L/lib/wasm32-wasi","/lib/wasm32-wasi/crt1-command.o",...r.map((R,h)=>"/tmp/"+h+".o"),...a.compilerLanguage==="cpp"?["-lc++","-lc++abi"]:[],"-lc","/lib/clang/20/lib/wasm32-unknown-wasi/libclang_rt.builtins.a","-o","/tmp/program.wasm"]);if(n=Math.max(n,s.memory?.buffer.byteLength??0),o!==0)throw new Error(`Linking failed (exit ${o}).`);let f=await WebAssembly.compile(s.FS.readFile("/tmp/program.wasm").slice().buffer);M(a.id,"running","Running\\u2026");let _={stdout:new TextDecoder,stderr:new TextDecoder},l=R=>new P(h=>c(R,_[R].decode(h,{stream:!0}))),u=new rt([E.entry],[],[new b(new F(new TextEncoder().encode(a.stdin??""))),l("stdout"),l("stderr")]),p=await WebAssembly.instantiate(f,{wasi_snapshot_preview1:u.wasiImport}),d=u.start(p);if(c("stdout",_.stdout.decode()),c("stderr",_.stderr.decode()),d!==0)throw new Error(`Program exited with status ${d}.`);G({type:"result",id:a.id,durationMs:performance.now()-e,memory:{compilerBytes:n,programBytes:p.exports.memory.buffer.byteLength}})}catch(E){G({type:"error",id:a.id,message:E instanceof Error?E.message:String(E),durationMs:performance.now()-e})}}globalThis.onmessage=({data:a})=>{a.type==="init"?(st=a.toolchainURL,G({type:"ready",version:ct,interactiveStdin:!1})):a.type==="run"&&(dt=dt.then(()=>mt(a)))};})();\n',a=new class extends r{id=`cpp`;get label(){return`C/C++ (Clang 20, experimental)`}get source(){return i}async load(e){return await t(n),super.load(e)}initPayload(){return{toolchainURL:e().indexURL}}};function o(t){return{id:t,label:t===`c`?`C17 (experimental)`:`C++20 (experimental)`,statusDecidesFailure:!0,get ready(){return a.ready},interactiveStdin:!1,async editorLanguage(){return(await import(`@codemirror/lang-cpp`)).cpp()},load:e=>a.load(e),run:(n,r={})=>a.run(n,{...r,compilerLanguage:t,timeoutMs:r.timeoutMs??e().timeoutMs}),stop:e=>a.stop(e)}}var s=o(`c`),c=o(`cpp`);export{s as cRuntime,c as cppRuntime};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./config-3Z6xX6Jr.js";import{n as t}from"./compiler-cache-XwslsU5H.js";import{t as n}from"./worker-runtime-5Ujf07eB.js";var r=`code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1`,i='"use strict";(()=>{var E="code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1";async function T(e,s,b,f,n){let d=new URL(e,b).href,o;try{o=await caches.open(f)}catch{}let c;try{c=await o?.match(d)}catch{}let h=async r=>{if(!r.ok)throw new Error(`Toolchain download failed: ${e} (HTTP ${r.status}). Check the asset URL and retry.`);let l=r.body?.getReader();if(!l)return r.arrayBuffer();let C=[],i=0,u=0;for(;;){let m=await l.read();if(m.done)break;if(i+=m.value.length,i>s.bytes)throw await l.cancel(),new Error(`Unexpected toolchain size: ${e}.`);C.push(m.value),performance.now()-u>100&&(n(`${c?"Reading cached":"Downloading"} ${e}: ${(i/1e6).toFixed(1)} / ${(s.bytes/1e6).toFixed(1)} MB (decoded)`),u=performance.now())}let p=new Uint8Array(i),S=0;for(let m of C)p.set(m,S),S+=m.length;return p.buffer},y=async r=>r.byteLength===s.bytes&&[...new Uint8Array(await crypto.subtle.digest("SHA-256",r))].map(l=>l.toString(16).padStart(2,"0")).join("")===s.sha256;if(c){try{let r=await h(c);if(await y(r))return r}catch{}try{await o?.delete(d)}catch{}c=void 0}let w=await h(await fetch(d));if(!await y(w))throw new Error(`Toolchain integrity check failed: ${e}. Use the pinned toolchain assets.`);try{await o?.put(d,new Response(w))}catch{}return w}var P={id:"code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1",assets:{"_framework/Microsoft.CSharp.45w5ndn4gy.wasm":{bytes:301333,sha256:"0893b8a6e6506cb2dbfa2dd01ac779d4616d013a2fac80e8cc15a64cdf526f0c"},"_framework/Microsoft.CodeAnalysis.CSharp.df8hfd5o8z.wasm":{bytes:6828825,sha256:"17a863076b8e6cdfad78e7e9b739ea6940939880f2916523aaa19e7a2b3b463c"},"_framework/Microsoft.CodeAnalysis.erp1n29u9n.wasm":{bytes:3048217,sha256:"56f8336593d9e41ee553106871e5aa82aadac0ab3f04496c8d1bbe601f619089"},"_framework/Microsoft.VisualBasic.6b1p6yq8b3.wasm":{bytes:6933,sha256:"1eff194716c295748d936659cab92e84a0d13515c34c2f05838c910f0fb9e2d5"},"_framework/Microsoft.VisualBasic.Core.4day4tivbb.wasm":{bytes:418581,sha256:"f860e30addf5a3562ba06fd93984663df5ca52ba9feadf1edc88e249fcb05c5d"},"_framework/Microsoft.Win32.Primitives.4bv2m8ah4f.wasm":{bytes:5397,sha256:"00e133d3bcca6baa47c8389b471441c9d4b89bcea2a308b5b779a70e714e2894"},"_framework/Microsoft.Win32.Registry.o7q57g4y3v.wasm":{bytes:22805,sha256:"0c854e9283334e2be8c837a9e95040ab6a649b45cb0078e0b19f1cd215604788"},"_framework/Playpad.CSharp.bc2sx86ihs.wasm":{bytes:19733,sha256:"25449d8432b31e70aa0109d2244595d3f1becb0493d3b9b9aa21f91a13fbc11f"},"_framework/System.AppContext.7pfnw66j8s.wasm":{bytes:4885,sha256:"3bc775156968db8b138e70f0d6cf919e8eceda801518dc4395a6c1b7029a76a2"},"_framework/System.Buffers.n9eydi1g7o.wasm":{bytes:4885,sha256:"bb413f159d106aa82005001b72d3dbe21702fe5b0729dfb0ad411e3b9ae14933"},"_framework/System.Collections.Concurrent.j651l47s89.wasm":{bytes:78613,sha256:"85fa85329f2778f2d7feeabe96e17150c2529cdee2671227f6adca55511e85ba"},"_framework/System.Collections.Immutable.5srny90eq0.wasm":{bytes:240917,sha256:"659249897525dbdd045be0c365aa78670911e71f082962fab29cb3d92f659523"},"_framework/System.Collections.NonGeneric.0gs0za6wta.wasm":{bytes:37653,sha256:"005b930e461f6d5f28714586e73c030a2d0d7705b93ff701e96465dcec8626de"},"_framework/System.Collections.Specialized.0lamnc2eez.wasm":{bytes:37653,sha256:"14a6ecd2d98964854df3c84e5d28c9e370f8511d88e17e19894bdd5487074534"},"_framework/System.Collections.zkl9zn110m.wasm":{bytes:102677,sha256:"7d1b8e3fb815980cc84b2d67b6894fa6bf936064cb4c0639547f214d3337826e"},"_framework/System.ComponentModel.2dg08nsbgq.wasm":{bytes:5909,sha256:"2a69c31d5b96be96e2dbd84b2eb722f33401245e3c3c18b449fa49d6b35b516c"},"_framework/System.ComponentModel.Annotations.qqu4bynrpj.wasm":{bytes:92437,sha256:"5ea898870e6d334ac03751ca45e941bdc786959862a4604c0b7925ae22365c1c"},"_framework/System.ComponentModel.DataAnnotations.6ljk5kma3w.wasm":{bytes:6421,sha256:"2a75102b3e594a3a5aec02c737c07bb07d67b31d84584a84dc93bd8fceaa44f7"},"_framework/System.ComponentModel.EventBasedAsync.0necwturs4.wasm":{bytes:16149,sha256:"1c2972979910342271b8e94c4455ff86593b6b428dbe29283927fc5038739df9"},"_framework/System.ComponentModel.Primitives.ex1da4zowy.wasm":{bytes:32021,sha256:"feaafe39e5531ccded6bd652b0ecbd1ddc7a3600e3ee89091411dbb113ae6489"},"_framework/System.ComponentModel.TypeConverter.t0513robn6.wasm":{bytes:306453,sha256:"53c1eda4d6b514c881cee8f6c7023ca6aa25304c2560c2a27357d5912b7e9efa"},"_framework/System.Configuration.11exwmwngo.wasm":{bytes:8981,sha256:"45bdaf5a151f8d873e4f3d63924b0b8e4711aa8e53a1a6b49bbaf8722ca07851"},"_framework/System.Console.4o049fyksq.wasm":{bytes:43797,sha256:"9cbe95b0e710127a9dc6fb016d89e3198bf5602e8767b4fe3318de77cc2e4184"},"_framework/System.Core.2bi377k7h6.wasm":{bytes:13077,sha256:"6e627a49290c7337183d58c756ca20ee0c6aef3716c73f748a1f2a040ec13f12"},"_framework/System.Data.Common.zrj82y4hfd.wasm":{bytes:1007893,sha256:"1fa0c46a27e2d1eb30b6ece5431b62a99eb0d3dbfff0ab3b0160d202b1283e62"},"_framework/System.Data.DataSetExtensions.ndyqwckzh5.wasm":{bytes:5397,sha256:"8b005ca671c5224a36cc8fcaee97ebd9fc9c8b44a4f431211c0e279b67605ef4"},"_framework/System.Data.cbzplu1klk.wasm":{bytes:15125,sha256:"08fc7cad424adfa678e5e03e1561fe679db996e8a887b14de7893786bdcfc11c"},"_framework/System.Diagnostics.Contracts.xbykr1nyue.wasm":{bytes:5909,sha256:"33867da04cc7cd4d8de2f10f0490f5488a8c8b83928597d906e86aae59e96c24"},"_framework/System.Diagnostics.Debug.faxnhsagf6.wasm":{bytes:5397,sha256:"b9b6df298d8fc68baec7ecf30ef40095a0810b44033dc2285e6e4d94eacac0cb"},"_framework/System.Diagnostics.DiagnosticSource.o8neuaehsr.wasm":{bytes:192277,sha256:"d82c2d87d4b05f79cded591ec897e75aef9fd5c93a5ec034bb76b8c67c211dd8"},"_framework/System.Diagnostics.FileVersionInfo.3veftfofsy.wasm":{bytes:12565,sha256:"ff1105930376d41151ef2e5c3d79cdb7002dfb3f7923bb3bf5caf3c33e301ce3"},"_framework/System.Diagnostics.Process.m02d4wsk19.wasm":{bytes:46357,sha256:"8af0d33b005cf399b2d983101aabd789b759fce6d53724ab17e4257df275f357"},"_framework/System.Diagnostics.StackTrace.3n0s7h4d43.wasm":{bytes:15637,sha256:"c1428e9f1dd799329b94b73a3a739c726195e78c7e499a7f9fa76abc9711a153"},"_framework/System.Diagnostics.TextWriterTraceListener.eytcvy9k8s.wasm":{bytes:21269,sha256:"a6f9c9665c871e8702c313c72aff56d8678fa2aeef5d58bdbd22895b5d7bb0cc"},"_framework/System.Diagnostics.Tools.fj2fven09q.wasm":{bytes:4885,sha256:"655eda3c94089e2fd9a0eda837027d39fdc8782124027f1ecb5e1627306f3ab2"},"_framework/System.Diagnostics.TraceSource.zdzes0xpw3.wasm":{bytes:48405,sha256:"596906ce63f2a87afc7c0c93ce63b8edd564dbab4cf44cba12e1e1de57cd3989"},"_framework/System.Diagnostics.Tracing.p8zfsagsem.wasm":{bytes:5909,sha256:"29645956735e67930940e0068fdf939e7724ac191aec9af9fc7fad2a5c478b4e"},"_framework/System.Drawing.Primitives.qihgks5s1u.wasm":{bytes:54549,sha256:"4e6f66a93b0178adcba6b52555fe1665e5d5c9f295ede78bb1f88a8ce7cd1730"},"_framework/System.Drawing.yh4pswp3to.wasm":{bytes:10005,sha256:"064f946cd835b5c06b88b5e8d3baafa1b65212fea3f741846530b9c15e8397a8"},"_framework/System.Dynamic.Runtime.qf4wa78w3a.wasm":{bytes:5909,sha256:"76243dbb12aaf714360cd6bb1adff3eac41d019028d45706f9a877fa0b8b4933"},"_framework/System.Formats.Asn1.ei47lr61p0.wasm":{bytes:86805,sha256:"963360faa396a0ac4f0ee1fb6a4de8195c8abc8722cfcb5e3f34c8f8cfa2cc44"},"_framework/System.Formats.Tar.jt7yo4wxzn.wasm":{bytes:28949,sha256:"e9bb9ece17de3bb99b99f9e27d9be6ea25feb824606217a81a581a3defd799e3"},"_framework/System.Globalization.Calendars.vfqjdvj4bj.wasm":{bytes:5397,sha256:"9b458344e441af8a342d90d9756002bd53d3ca81fd2ecec1d9956c09ab738761"},"_framework/System.Globalization.Extensions.fb3tp0zu2j.wasm":{bytes:4885,sha256:"0b1f2e8dd68f450050c6ea5d933b06ffc0133120dff33a87b5ccf1e523439be2"},"_framework/System.Globalization.jpj90sbpo9.wasm":{bytes:5397,sha256:"07ac16899c10c3af6fb0bb4cd1ca976ddf3fe82165fb06b74bb034cab14a0bad"},"_framework/System.IO.Compression.Brotli.fpnvzsxpvo.wasm":{bytes:18197,sha256:"c3cc052fa471c3f25016b7eee90ab7eb3793995aea8f08ba93e3b6d85c9ba0b7"},"_framework/System.IO.Compression.FileSystem.tk5twcs8br.wasm":{bytes:4885,sha256:"7d51272f3b3ec7a32ef1b73e693fc90753705665cc50f98a56a3e7f60970cd31"},"_framework/System.IO.Compression.ZipFile.f6odqd84z5.wasm":{bytes:43285,sha256:"59161959d34a7935b83bc858b589d34cc17ade5912137658ee3d7ca1ec4b090c"},"_framework/System.IO.Compression.zo5nnp1cfl.wasm":{bytes:157461,sha256:"6df8da5437998a60f5afd17b4c0b7145d94171dd2b0dd1bed6ef0d762074062d"},"_framework/System.IO.FileSystem.4xxxdm8fc4.wasm":{bytes:5397,sha256:"f8ae1910ff477fbb38b7a1a689ddb555d5ab9f7b5ec59e183fb7c7aebacbe077"},"_framework/System.IO.FileSystem.AccessControl.3nsp4r0ce1.wasm":{bytes:21781,sha256:"3f2d25968e0dad93040716ef7d97382bd6a5517bd0e3c6d707fa520df255d627"},"_framework/System.IO.FileSystem.DriveInfo.2dz9a3mpco.wasm":{bytes:13589,sha256:"46f152531a56b5a1234b905b5460060a3a76c74a94f575e6444848bb7d15a0fc"},"_framework/System.IO.FileSystem.Primitives.ts09gphu65.wasm":{bytes:4885,sha256:"b3efcf0755c59862ad4893ad4b668d5dab114f3561ae632d1ea7479e65c22180"},"_framework/System.IO.FileSystem.Watcher.zra8jhxo53.wasm":{bytes:22805,sha256:"8fcf89a027896f110eefc2e1e76a86bd91f6537a748afdc2ecc7fbd00d1110a1"},"_framework/System.IO.IsolatedStorage.czh3ilflkw.wasm":{bytes:24853,sha256:"388c1f0e6894454587ae794e210a93feaa23c8932064b68ad76e660a2b3d4fb1"},"_framework/System.IO.MemoryMappedFiles.f0h74bif4r.wasm":{bytes:39701,sha256:"dfc14559b3102cdd3d1155ec7cc198999db5b31439aafcd1775dffa39015d0a7"},"_framework/System.IO.Pipelines.eqtd8a5j6e.wasm":{bytes:67861,sha256:"3aa8165bec8d2b718d927cf0ba7ba9fb2e301544164d62202a578d3e3010d850"},"_framework/System.IO.Pipes.AccessControl.cz75e7snno.wasm":{bytes:13077,sha256:"a881296c9ae2cefe4f57c030f0cd13a0384ae7a82519dd0063d62feab0877a2b"},"_framework/System.IO.Pipes.amk3gre8pn.wasm":{bytes:32021,sha256:"22c795928e765dae50c2632f264efde23032c0225fcff6acb4aa075855543436"},"_framework/System.IO.UnmanagedMemoryStream.pjda8c8goj.wasm":{bytes:5397,sha256:"159b449cef234de1150ea545ce482dadadcffb47cccc4e60038840eb1be87a4c"},"_framework/System.IO.hvb68vhf4w.wasm":{bytes:5397,sha256:"63ca4a239901c3ba9517ab48c5c70e2b2f2f983b8f5c96c6215ffb74efb90d42"},"_framework/System.Linq.AsyncEnumerable.p5kf8px69a.wasm":{bytes:446229,sha256:"cdaf09cf14de62c8172a64d1f1fd540b050edf1a751873b575f1c6dab92f171d"},"_framework/System.Linq.Expressions.rrm2f8e4yg.wasm":{bytes:565013,sha256:"c74ef523be9ae6830a76be0baf9a9a508ce7ca31ac5876bb80dc7d1d777b5cab"},"_framework/System.Linq.Parallel.2c1yb2s745.wasm":{bytes:212757,sha256:"be110713a9092c3594d36dc664441be579d17fbe9b0be0a1bd289bd4fca58ee9"},"_framework/System.Linq.Queryable.trhrf5j8ds.wasm":{bytes:68373,sha256:"b965d6be5e8744b201ab8142f11c57aaf0a95081020880c1ec709fb9654c338c"},"_framework/System.Linq.gvekllsg4c.wasm":{bytes:190741,sha256:"4cf1e524ac3f80887e4c7d723c29f54b676ad76325c8472ecbbd064652881d57"},"_framework/System.Memory.rvge25ilzk.wasm":{bytes:45333,sha256:"09ddaf85e36c7c13ef4d7e32cc5436cfec4984e1c26c989072e499ddde8ae062"},"_framework/System.Net.Http.8ubauysc2i.wasm":{bytes:286485,sha256:"903f936e8d7a67798c76e85d53838ac80c88b1ef3d45ec53ff2ac95a8bbc4c2b"},"_framework/System.Net.Http.Json.cnwprpsgic.wasm":{bytes:45845,sha256:"8830cced672b10f509c317186768b69245fbc9c3695eb870b9a81e31a1dfa086"},"_framework/System.Net.HttpListener.ij8kltpk25.wasm":{bytes:45845,sha256:"c23e07ce4477568bf5687cc8f81f2eb9ce806667398756ab96507671f83a3594"},"_framework/System.Net.Mail.z8qhziwoem.wasm":{bytes:94997,sha256:"ddd584fafc23dc46fd5eca406b6f0edb6fc2af837280fd50b276327c867a41ee"},"_framework/System.Net.NameResolution.ncmdi0kq9p.wasm":{bytes:14101,sha256:"993b5c9ce17363348c5d77766b5ef8ba7cd9e9bf8490f54bf295d600c0318f5d"},"_framework/System.Net.NetworkInformation.es6jl8uhrp.wasm":{bytes:32021,sha256:"e2e10d93298c3e8ba16fc2acfebc314c9e32ad07d28b99a491ad1f215795f216"},"_framework/System.Net.Ping.leo6kko976.wasm":{bytes:17685,sha256:"0de562db7b1035f071863450f7e875892b1705ba696cc11ee3593dda48894fc9"},"_framework/System.Net.Primitives.yzzu57r5h4.wasm":{bytes:97045,sha256:"bea2dfad62c29bbf61a9b34552bb6b28356cc6ce36c56e96c058639c3ee2a3fc"},"_framework/System.Net.Quic.t4x9xorc7c.wasm":{bytes:28949,sha256:"031f5366680b6a4b90cf8ed2ced5d135391b1942a1423e991ebeddfd7b47940a"},"_framework/System.Net.Requests.hvrao969rw.wasm":{bytes:55573,sha256:"9d27640110c78c3c04da4f2f070589ff6857804316f91765cc59d305e45ae9dc"},"_framework/System.Net.Security.z570hyrh50.wasm":{bytes:104213,sha256:"b972545804845422c6b90682ef9585ff07ca24394bc4abcafaa8aab8841476ff"},"_framework/System.Net.ServerSentEvents.b3gkat9xqz.wasm":{bytes:30485,sha256:"89c3d8604b565dd8b5ac18dcd39b73f311c81e20b8d5cdbd3c3a704c958515f3"},"_framework/System.Net.ServicePoint.k1tgr3lkj6.wasm":{bytes:4885,sha256:"082ef4faa63db1a669223b6b892729a426f1017c61a8140167d9a935f65cabd5"},"_framework/System.Net.Sockets.fgcxent7fc.wasm":{bytes:64277,sha256:"b1284556b3eeceed8cee152f19f6a6b32c7d35ab031f64a4b96968cbef84ff90"},"_framework/System.Net.WebClient.kpwi6t40sc.wasm":{bytes:45845,sha256:"18108441da8fd4dc43cd29a42d491c27e23961e0188714ce41deffa5e113b034"},"_framework/System.Net.WebHeaderCollection.fnxrdiu9j1.wasm":{bytes:22805,sha256:"1bb8ab08176b1d4878d9d5732629e730cd863d2e0e458de1914cd71aafcc7a86"},"_framework/System.Net.WebProxy.wtgabypaqs.wasm":{bytes:11541,sha256:"4cc9d37b00460499d38df4cc1bb4a9408fa0996e9cdef5244ad645b550cd87b2"},"_framework/System.Net.WebSockets.4zomq83cjx.wasm":{bytes:99093,sha256:"102e21acf0257c9bd1115dd74f36f0cf1844ea1872ecf3e78f4af2d9038878c9"},"_framework/System.Net.WebSockets.Client.l4ui9wgjyz.wasm":{bytes:42261,sha256:"fbade9ba11569ee8ead57e48bfad3419d4b5800f2a0503de1ea87ddbab5e78d6"},"_framework/System.Net.plchg2cs85.wasm":{bytes:6933,sha256:"f38d34d3e084c72fda1c6182f4fd11644d922dfa7b4efdb83809b6bb6eba4879"},"_framework/System.Numerics.7xa3ygjnjn.wasm":{bytes:4885,sha256:"f513f73d4658cd05b3d587d5dc634450d3d2811ca92b12e0065d111f0fb7fe08"},"_framework/System.Numerics.Vectors.2neq4xg5b1.wasm":{bytes:5397,sha256:"624bf089833a6c91bd2c0e83cf58f9db9b8e702dcc8c9e2b389610f8f3ad9924"},"_framework/System.ObjectModel.0us7g9291u.wasm":{bytes:30997,sha256:"b8c1e66933e2073d4d95b7971ce949d2aee7caacd85a222261200d12368e6305"},"_framework/System.Private.CoreLib.7henw1oe7e.wasm":{bytes:4870425,sha256:"0b6d3f3864053400013921497367c1f9806b10baa069e9e80ea2ba7ff1943d20"},"_framework/System.Private.DataContractSerialization.45rz0h7hbh.wasm":{bytes:849173,sha256:"2808c98580c4009f7850dde898e1f8d81a15e427ddeb122033384dd48a0c1252"},"_framework/System.Private.Uri.c0pesqh6or.wasm":{bytes:95509,sha256:"e4b56986f49b6104f86884d59fd3a4eff4e525fdd2d1f83baee01b752efa337e"},"_framework/System.Private.Xml.Linq.91dmao781k.wasm":{bytes:143637,sha256:"7d05fc1b72e4d16c33f13e7cfd85a6f5a92f5c2ca343c8f78d4425d2afa50d0a"},"_framework/System.Private.Xml.ihpa1sp5u8.wasm":{bytes:3096857,sha256:"86009953171be26f62eab577e33c3502d82ddc74a9d6f27c6b4d07ea6300e498"},"_framework/System.Reflection.DispatchProxy.dotf7d6gov.wasm":{bytes:27925,sha256:"03a1a48a2b900d219650d22288cb1ebb62feb218fef7788daa6aead0e237f14d"},"_framework/System.Reflection.Emit.ILGeneration.0x2k63jlqj.wasm":{bytes:5397,sha256:"c46d97174687a1f77ef95a0c085d632881c1f315d7141b985a673662131235e0"},"_framework/System.Reflection.Emit.Lightweight.5yjn7ykajf.wasm":{bytes:5397,sha256:"bdb328f85330a0991ea097895f5f233c7c185bcc54d115f9f4deb7c02fa7ce83"},"_framework/System.Reflection.Emit.ynxp91g9b8.wasm":{bytes:123157,sha256:"52fc8f0a51bcc2c5da80be2148b8391dc1665768e3aa6e04a0a0a7a2aeee52c8"},"_framework/System.Reflection.Extensions.0ouvp5b0xg.wasm":{bytes:4885,sha256:"00b61c99e5b7930e88707c4614942c0f69e91bd0acadd0e728d3e219f1137a53"},"_framework/System.Reflection.Metadata.vkm0bf1n4h.wasm":{bytes:493333,sha256:"b136c7933bc62da5e4f3e34ad6fea876f5cc7a7e47d35e7b7c64055927fc68f6"},"_framework/System.Reflection.Primitives.cnvk9lkykl.wasm":{bytes:5397,sha256:"c84511d42d21a09fd8818bb0ee4d4423584f19dd9a58a98a8d8631c0435336bb"},"_framework/System.Reflection.TypeExtensions.jnvi38irak.wasm":{bytes:14101,sha256:"bf533973a0a50cba610aac73875d9f8627c173b463311d060f79ea4922a9d64e"},"_framework/System.Reflection.qdi0svky7b.wasm":{bytes:5909,sha256:"0e958c24d437bc1b1e321617c69dda15aba94d0e13b741c39a514108dab87958"},"_framework/System.Resources.Reader.tkyk3pewoj.wasm":{bytes:4885,sha256:"f34cfbeb3f39e7bfa7d0d892e3fdcfeda727e269b2a622d74ca455d41ad740b3"},"_framework/System.Resources.ResourceManager.mxgnwpq6s6.wasm":{bytes:5397,sha256:"7af92fba46216d614859a6466c6a013e936a510d492affb6ee74179d23620998"},"_framework/System.Resources.Writer.u12ln0bq25.wasm":{bytes:16661,sha256:"a2a46ada8be5659c787b4da0494298da0ffc2467a0b02a7eab604dca5c532866"},"_framework/System.Runtime.CompilerServices.Unsafe.mvjra26big.wasm":{bytes:4885,sha256:"624f428a1c8ffd524aa47ced54090373d0f389162b6dfb00689343f2a3ac5803"},"_framework/System.Runtime.CompilerServices.VisualC.0zws5y4za8.wasm":{bytes:6933,sha256:"ec82d7e3669ba41156f4d70d94bf30c47dd28829cf5de4591f18bce80943d1a0"},"_framework/System.Runtime.Extensions.53v9tmujmf.wasm":{bytes:7445,sha256:"5f05d3f29944d5adc9a644a37e1818edc5cb9f4450fe1ed88b600b0d84bda226"},"_framework/System.Runtime.Handles.dtp1f2k1pr.wasm":{bytes:5397,sha256:"f16fe73e38bb80ab6b26486ad193d8766254138bac0524f2861959c7834cbee1"},"_framework/System.Runtime.InteropServices.JavaScript.b9bqw25qxw.wasm":{bytes:79637,sha256:"810c9571d56aae8aabdccec828936d48cb8664b4e2e923d3c49f5c288234a26c"},"_framework/System.Runtime.InteropServices.RuntimeInformation.5dmsm0qrdq.wasm":{bytes:5397,sha256:"c7696a8781fbc588fa126969f0a8b0703c3df1181e9e723631d5a7816636c406"},"_framework/System.Runtime.InteropServices.zc5o5oswy7.wasm":{bytes:54549,sha256:"dd89331d3297a0c4a5aac4e6ed289c59d6c8858f7f85d55a46fb0d80c69ca429"},"_framework/System.Runtime.Intrinsics.uupmanm0z1.wasm":{bytes:6933,sha256:"6692c7b97d8261781b893a91a9bed12a8da493d0ad20d6e2e941ab4b052c6218"},"_framework/System.Runtime.Loader.bmhnwgr24i.wasm":{bytes:5397,sha256:"0db7813efcf24740ffc3121704940e5b39bac5745b05c3cbd23a71bbc13d7800"},"_framework/System.Runtime.Numerics.hnmfmtcdek.wasm":{bytes:134933,sha256:"937500e9e310341dabaee15f5c1f39eccc0214d055b846951547ed19f635659d"},"_framework/System.Runtime.Serialization.890gxgs7km.wasm":{bytes:6933,sha256:"b41917f9c13f891781b2babb541b8d01f8394a51f2e9323922eb94a2816a2d5d"},"_framework/System.Runtime.Serialization.Formatters.k6qqn2m2yp.wasm":{bytes:55573,sha256:"f4592c11ffc0e2a191254f637a0d117e1a09f8d1ff5a1065e5c175310183097b"},"_framework/System.Runtime.Serialization.Json.rmpm3bs9gf.wasm":{bytes:5397,sha256:"bde54b4f956372ced92d5efee2c37314343968505e7146ab269a2e3771a7b38d"},"_framework/System.Runtime.Serialization.Primitives.rhltpkb1qn.wasm":{bytes:13077,sha256:"0f8b94ee594a9fcc5c8506072e13a7d50735d02df44adf5e34a533e3e38d9a9b"},"_framework/System.Runtime.Serialization.Xml.2qu958brox.wasm":{bytes:6421,sha256:"36472147c1166a70a5722cf793fa9abbe1bab93527241979607865df0a2f58be"},"_framework/System.Runtime.q3byyncrvz.wasm":{bytes:34581,sha256:"4af52a715b0a80fca05f4fe3d35e0882a47699e2cc64a8d6dfdb5fbfc5bddedd"},"_framework/System.Security.AccessControl.frpe4iqtxg.wasm":{bytes:47893,sha256:"eb65f6286a07968d12c0b8e5330b6c9dfa314dd224e877a0c4aea82e78028785"},"_framework/System.Security.Claims.1iu8vf654n.wasm":{bytes:44821,sha256:"97f82dc8889938fdcce4e09bea257e9c1b49d991d9458836879150444e5b8b70"},"_framework/System.Security.Cryptography.Algorithms.667n7jcyg1.wasm":{bytes:6933,sha256:"f2a8e4d45f9f2967b51b58bb85319e8852d3a333dbaf9cd2386ca4b00652e373"},"_framework/System.Security.Cryptography.Cng.bd7h0b8iov.wasm":{bytes:5909,sha256:"8f4b9ed85aec8a2564ebe8d7d8a4d1150bb46f2aea851733c26166faddb90fd7"},"_framework/System.Security.Cryptography.Csp.z1odikd5x2.wasm":{bytes:5909,sha256:"f912404d06760570df5a52dd7b64e8af3125dd6f452bd8938faec529f3e02366"},"_framework/System.Security.Cryptography.Encoding.o0gt2d4ysx.wasm":{bytes:5397,sha256:"a8b33cdbba50e569c52acb0fe72e17ad4e278c1209bcc338d41025e38071bc63"},"_framework/System.Security.Cryptography.OpenSsl.90bbqu9909.wasm":{bytes:5397,sha256:"87916287aef8bdf7bb1fb87fdf1e64dc8b715228c129319cc41b17e64dc5b13e"},"_framework/System.Security.Cryptography.Primitives.wc69ogz8hc.wasm":{bytes:5397,sha256:"90efa59ad8a365908c18aff92e86336eb346914ede31bc51e3008aa394c66acd"},"_framework/System.Security.Cryptography.X509Certificates.zdajb5d4ry.wasm":{bytes:6421,sha256:"a95583972db3c698e929f1e9d0bfd5268c20247b39ffebe0e435ced691e01069"},"_framework/System.Security.Cryptography.isqs0vklct.wasm":{bytes:643861,sha256:"5e2d390cae360df7f1a224f866cd4648f896a02bdd8dc8b6dd97f4036a3434a6"},"_framework/System.Security.Principal.8kc2gzptia.wasm":{bytes:4885,sha256:"18f86f82bdc342716c4f4d1ce95cef59f29516c18f4b107e20e4fb2283bf3ca3"},"_framework/System.Security.Principal.Windows.lvinz1flf3.wasm":{bytes:27413,sha256:"af696bc41c787f9d87ae55b4bc5799b1e384083d610340774246b5283f2b5f76"},"_framework/System.Security.SecureString.287gima5tn.wasm":{bytes:5397,sha256:"92d299c328a15eb44a972aaa0142d628d9b35c1a555d5e6b296d14fcf1f31736"},"_framework/System.Security.zwe9caa7de.wasm":{bytes:7957,sha256:"c3076430d76f8d122b73973756f5c601c96444d2e303834fbda2151aa3fb117c"},"_framework/System.ServiceModel.Web.eh14pbj71g.wasm":{bytes:6421,sha256:"7e6a649d68f4543fefcd8add264555779efc37b5986ec96106f1598703eaa247"},"_framework/System.ServiceProcess.thnl06mz62.wasm":{bytes:5397,sha256:"cf9d149513509280a136812038d16f8421e5ced70788b6c9595170242d702530"},"_framework/System.Text.Encoding.CodePages.r4fb0qucdq.wasm":{bytes:732437,sha256:"a556ef19b61455e586137ff454f3120091897dcc43a44c19a71d7ef489a3ddfc"},"_framework/System.Text.Encoding.Extensions.qyio04sfs3.wasm":{bytes:5397,sha256:"fe7930a6f00825e1c4a3f32e0e3bd42117377db151afc127110c70fbb701366a"},"_framework/System.Text.Encoding.x8frxl6434.wasm":{bytes:5397,sha256:"f11aa7fbf9e9a4f86b0a34a5478e6553d314461dcbe69fc8097adf1f9d69808b"},"_framework/System.Text.Encodings.Web.i5h886ktzy.wasm":{bytes:55573,sha256:"2a97377ae59b872eb3d69f1eb9555ba512f577708f951f7a2ef8040292911df0"},"_framework/System.Text.Json.rfs8iutklf.wasm":{bytes:638741,sha256:"f79b95a0e74fb4fb30fb90a704078e0b910c6d9d08cd9a7ab7a589b8fdcc24ef"},"_framework/System.Text.RegularExpressions.3wwgc8ow33.wasm":{bytes:374549,sha256:"8336c54d5413476b6125468549c98d35c0a9e5bd0db682b3795a7351d38e7b4c"},"_framework/System.Threading.5z3yk0hlih.wasm":{bytes:34581,sha256:"a12c2a6463d08e453a9e0dc72152b68692c5e6b2f5d69d8700f0c0bd2c4ba90a"},"_framework/System.Threading.AccessControl.3jdprnrbz3.wasm":{bytes:23317,sha256:"41c872fb18d50bc6d15f2f2c79ca48e825b0de88f0959f1356b02d2df31dc28e"},"_framework/System.Threading.Channels.u6jwukaw3f.wasm":{bytes:56085,sha256:"2677baa60a9cc551734e24a4eb400413c2157d310d8eae8c666a9f428e14df75"},"_framework/System.Threading.Overlapped.906hny6ev5.wasm":{bytes:5397,sha256:"57a8b7621e425edb8bc3c1114daed57774c1dfc75975a3aa12a0e4cfd1e3612b"},"_framework/System.Threading.Tasks.Dataflow.yxumrwtpb9.wasm":{bytes:175381,sha256:"da2eef656f41a87395f3f24935b557e4b054d994e220ae70401a820712cd440f"},"_framework/System.Threading.Tasks.Extensions.c9qgjzqtfp.wasm":{bytes:5397,sha256:"f027df139487b8613d3b6e1271a920c441ff5d7fcae2bc774009b50a3f703a30"},"_framework/System.Threading.Tasks.Parallel.984t0vlw0h.wasm":{bytes:50965,sha256:"a9e66658c76d0aa175b202b59391a313ed841a8ca09fbe80ef88962090b72b6e"},"_framework/System.Threading.Tasks.e8zo3kytn9.wasm":{bytes:6421,sha256:"a224a48edb58b9d097a72b83d5804930357555dee3f8be811827482e827ac544"},"_framework/System.Threading.Thread.0kl8n21ama.wasm":{bytes:5397,sha256:"206e44a32770dab61b10150554dd82dc69e29779609405d2a79da858f1ec5ff1"},"_framework/System.Threading.ThreadPool.uis7d1kkur.wasm":{bytes:5397,sha256:"da628e4a405d14fcf624643d3b9c632d47e4f478b30a21680c142901aec3bfe7"},"_framework/System.Threading.Timer.d0q7n4qone.wasm":{bytes:4885,sha256:"93d9959881dd75ace8b74ecf1307fa1c8bf210bd384e44feb84d203502a23486"},"_framework/System.Transactions.1rh8d3l1yg.wasm":{bytes:6421,sha256:"ddb4bf21d75f14d92cddd44d6d5abb88fc2f6dbabd24e4f692ce8a24c42ba5af"},"_framework/System.Transactions.Local.88eb0ckc89.wasm":{bytes:165653,sha256:"c80cdc0b7339172c58d06b47543bacf5ead18c6fbc50f483e6eee1973eb4102b"},"_framework/System.ValueTuple.dz9n78v09g.wasm":{bytes:5397,sha256:"490935cf3415a01a302a6caf3e404a0c8591bc6a5ad039e1ad4c892cee66edda"},"_framework/System.Web.HttpUtility.zkk9vwuwmx.wasm":{bytes:19733,sha256:"73afab7ffbcfa6e1479aa8ad626e3470e3346a80a2e7574d766e41c61e9df242"},"_framework/System.Web.cpb2jt6aj4.wasm":{bytes:4885,sha256:"c00e79f45b25abca38109c095dfa83a4616f107129ce05badc98ef08ea0ab819"},"_framework/System.Windows.z1cdp2137j.wasm":{bytes:5397,sha256:"474f8c034c878c2877fd38bfcc81a7ca91ec14f465067924def2447f3a0ceb1f"},"_framework/System.Xml.Linq.zfqbqkhg85.wasm":{bytes:5397,sha256:"616bc8b437b614c7e754c5ab40ea583b2075fbefd75684218446ce675a330615"},"_framework/System.Xml.ReaderWriter.j5zd7b3r9j.wasm":{bytes:11541,sha256:"375655970f08782d60c0b7e660a2ed18b100632cd0beccf6072f453461b33537"},"_framework/System.Xml.Serialization.g3ffx007q0.wasm":{bytes:5909,sha256:"d48409f2e83289d8a283e0dac4e15f6daaba7d0d9f1ef0ed0632479fcb670fea"},"_framework/System.Xml.XDocument.d9vqmjsh7t.wasm":{bytes:5397,sha256:"c12264747d6099b7063ae2ecc540848a570d33620fdf5f4815d34ded85c9bc8f"},"_framework/System.Xml.XPath.XDocument.ikh0avvfe3.wasm":{bytes:5909,sha256:"0ed162b5f6ceb1cae414c70bb8cdd960c5f77b1a39b4a9ab87b7703d92c5bce5"},"_framework/System.Xml.XPath.j7e58ql0yh.wasm":{bytes:5397,sha256:"d128d847ee39abbfee50d6e837d5dc953df248de890c894d92c15186f159092d"},"_framework/System.Xml.XmlDocument.2laigo0hd6.wasm":{bytes:5397,sha256:"16b6cd94446e868c5e744b876de60222eb25d1485c9f628fd03e64957d7b8cb0"},"_framework/System.Xml.XmlSerializer.o9fse2o32f.wasm":{bytes:7445,sha256:"4c9262e9ed66c40706ed51ea1dc312138035b44519f57ef97a94a4f323d192f7"},"_framework/System.Xml.ukjc8es4qk.wasm":{bytes:13077,sha256:"1eae6308964b64da01c885edee4c9af89173ec21ef4f99b71fd5350d8000a1ad"},"_framework/System.a2ormnao9q.wasm":{bytes:39701,sha256:"6e1ba6200e75ccd9b5be39467babe2d28067106bdd6ff0a1f292a2411177e27a"},"_framework/WindowsBase.pulybckt2x.wasm":{bytes:5909,sha256:"21be528b1fb2c3451736fb9a49f1f8063a164c6e4d089aec470d1d670ecc6340"},"_framework/dotnet.js":{bytes:80782,sha256:"0c8a1d506ef027d577f0efd776a42cc6639514b2cf1e90eaca8c18d18fae9c5f"},"_framework/dotnet.native.a6k1euv12n.wasm":{bytes:3001771,sha256:"62521652bab002242e009341397f999bdc2958bfac177278e3d885abb247a2e4"},"_framework/dotnet.native.bjoj0wmylw.js":{bytes:145050,sha256:"099d0855990b4c8bde7bb9f5c95bce8ad94958d763fd88da160a4c82588833ae"},"_framework/dotnet.runtime.5nc8i5dl74.js":{bytes:198480,sha256:"ff774183db23d722c3de1d0f0cc1e73545d6b3fdb35b020c133a26d57cf7438d"},"_framework/mscorlib.79r0fdidgd.wasm":{bytes:49429,sha256:"0553f8bd2703ce8aeebac01fc6c0d8fa7cf720fa64911da16e2a0efc9b988f12"},"_framework/netstandard.f948f8b5mo.wasm":{bytes:90389,sha256:"6db9b1e3952428d5958c52e5b36212b0bef4a1c4013fd49d3f5073c39133efcd"},"refs.pack":{bytes:6046672,sha256:"60252255312e28c33fa2bcde9646c7d92c6b2e7c2fb078a813b57de3146d8bed"}}};function j(e){if(!e||e.startsWith("/")||/[\\\\\\x00-\\x1f:]/.test(e)||e.split("/").some(s=>!s||s==="."||s===".."))throw new Error(`Invalid project path: ${JSON.stringify(e)}. Use relative paths without . or ...`);return e}function N(e,s,b){let f=j(b??"Program.cs"),n=s?{...s}:{[f]:e};if(!Object.hasOwn(n,f))throw new Error(`Entry file ${f} does not exist.`);let d=Object.keys(n).map(j).sort(),o=d.find(c=>!c.endsWith(".cs"));if(o)throw new Error(`C# projects can only contain .cs files for now: ${o}.`);if(d.length>32)throw new Error("Project limit: 32 source files.");if(Object.values(n).reduce((c,h)=>c+new TextEncoder().encode(h).length,0)>2e6)throw new Error("Project exceeds the 2 MB source limit.");return{names:d,sources:d.map(c=>n[c])}}var D="Roslyn 5.0.0 / .NET 10.0.14 r1",$=3,X=2e3,U=1e6,A=P.assets,W={wasm:"application/wasm",js:"text/javascript"},g=e=>globalThis.postMessage(e),v=(e,s,b)=>g({type:"progress",id:e,phase:s,message:b}),M=e=>`${e.file}(${e.line},${e.column}): ${e.severity} ${e.id}: ${e.message}`,z;async function F(e){let s=performance.now(),b=f=>g({id:e.id,durationMs:performance.now()-s,...f});try{let f=N(e.code,e.files,e.entry),n=0,d=async a=>{let t=A[a];if(!t)throw new Error(`Not a pinned C# compiler file: ${a}.`);let k=await T(a,t,z,E,()=>{});return v(e.id,"downloading",`Loading the C# compiler: ${++n} files\\u2026`),k},o=async a=>{let t=new TextDecoder().decode(await d(a)).replaceAll("import.meta.url",JSON.stringify(new URL(a,z).href));return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};v(e.id,"downloading","Loading the C# compiler\\u2026");let{dotnet:c}=await import(await o("_framework/dotnet.js")),h=new Map;await Promise.all(Object.keys(A).filter(a=>/^_framework\\/dotnet\\.[^/]*\\.js$/.test(a)).map(async a=>{h.set(a,await o(a))}));let y=[],w=0,r=!1,l=a=>{a.trim()&&(y.length<$?y.push(a.slice(0,X)):w++)},i=await(typeof c.withModuleConfig=="function"?c.withModuleConfig({printErr:l}):c).withResourceLoader((a,t)=>{let k="_framework/"+t;if(a==="dotnetjs"||a.startsWith("js-module")){let x=h.get(k);if(!x)throw new Error(`Not a pinned C# compiler script: ${t}.`);return x}return d(k).then(x=>new Response(x,{headers:{"Content-Type":W[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}}))}).create(),u=0,p=!1;i.setModuleImports("playpad",{write:(a,t)=>{if(!p){if(u+=t.length,u>U){p=!0,b({type:"error",message:"Output limit exceeded (1 MB)."});return}g({type:a?"stderr":"stdout",id:e.id,text:t})}},managedExit:()=>{r=!0}});let{Compiler:S}=await i.getAssemblyExports(i.getConfig().mainAssemblyName);S.LoadReferences(new Uint8Array(await d("refs.pack"))),v(e.id,"compiling","Compiling\\u2026");let m=JSON.parse(S.Compile(f.names,f.sources)),R=()=>i.Module?.HEAPU8?.length??0,O=R(),I=m.diagnostics.filter(a=>a.severity==="error");if(!m.ok){b({type:"error",message:I.map(M).join(`\n`)||"Compilation failed."});return}let q=m.diagnostics.filter(a=>a.origin==="user").map(M);q.length&&g({type:"stderr",id:e.id,text:q.join(`\n`)+`\n`}),v(e.id,"running","Running\\u2026"),y=[],w=0;let _;try{_=await S.Run(e.stdin??"")}catch(a){let t=a.status;if(typeof t!="number")throw a;if(!r){let k=y.length?[...y]:["The .NET runtime ended the program unexpectedly."];w&&k.push(`(${w} more runtime lines not shown)`),b({type:"error",message:k.join(`\n`)});return}_=t}if(p)return;b(_!==0?{type:"error",message:`Program exited with status ${_}.`}:{type:"result",memory:{compilerBytes:O,programBytes:R()}})}catch(f){b({type:"error",message:f instanceof Error?f.message:String(f)})}}globalThis.addEventListener("message",({data:e})=>{e.type==="init"?(z=e.toolchainURL,g({type:"ready",version:D,interactiveStdin:!1})):e.type==="run"&&F(e)});})();\n',a=new class extends n{get label(){return`C# 14 (experimental)`}get source(){return i}get recycleAfterRun(){return!0}get startTimeoutMs(){return 3e4}async load(e){return await t(r),super.load(e)}initPayload(){return{toolchainURL:e().indexURL}}},o={id:`csharp`,label:a.label,statusDecidesFailure:!0,get ready(){return a.ready},interactiveStdin:!1,async editorLanguage(){let[e,t]=await Promise.all([import(`@codemirror/language`),import(`@codemirror/legacy-modes/mode/clike`)]);return e.StreamLanguage.define(t.csharp)},load:e=>a.load(e),run:(t,n={})=>a.run(t,{...n,timeoutMs:n.timeoutMs??e().timeoutMs}),stop:e=>a.stop(e)};export{o as csharpRuntime};
|