Back to Large single-file napplet compatibility test
SOURCE / PINNED RELEASE

Made of little things.

Large single-file napplet compatibility test

Release
cabbc38f1b66…
Author-recorded commit
Not provided
License
Check the original source

The hash-verified playable HTML, which may contain bundled or minified code. This view does not execute it.

index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Large single-file napplet compatibility test</title>
    <script type="module" crossorigin>(function polyfill() {
  const relList = document.createElement("link").relList;
  if (relList && relList.supports && relList.supports("modulepreload")) {
    return;
  }
  for (const link of document.querySelectorAll('link[rel="modulepreload"]')) {
    processPreload(link);
  }
  new MutationObserver((mutations) => {
    for (const mutation of mutations) {
      if (mutation.type !== "childList") {
        continue;
      }
      for (const node of mutation.addedNodes) {
        if (node.tagName === "LINK" && node.rel === "modulepreload")
          processPreload(node);
      }
    }
  }).observe(document, { childList: true, subtree: true });
  function getFetchOpts(link) {
    const fetchOpts = {};
    if (link.integrity) fetchOpts.integrity = link.integrity;
    if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy;
    if (link.crossOrigin === "use-credentials")
      fetchOpts.credentials = "include";
    else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit";
    else fetchOpts.credentials = "same-origin";
    return fetchOpts;
  }
  function processPreload(link) {
    if (link.ep)
      return;
    link.ep = true;
    const fetchOpts = getFetchOpts(link);
    fetch(link.href, fetchOpts);
  }
})();
void (async () => {
  const parts = await Promise.all([
    window.__nappletPrivateResourceLoader.response("chunks/part-00.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-00.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-01.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-01.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-02.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-02.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-03.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-03.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-04.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-04.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-05.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-05.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-06.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-06.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-07.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-07.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-08.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-08.bin failed: ${response.status}`);
      return response.arrayBuffer();
    }),
    window.__nappletPrivateResourceLoader.response("chunks/part-09.bin").then((response) => {
      if (!response.ok) throw new Error(`resource chunks/part-09.bin failed: ${response.status}`);
      return response.arrayBuffer();
    })
  ]);
  const total = parts.reduce((sum, part) => sum + part.byteLength, 0);
  const joined = new Uint8Array(total);
  let offset = 0;
  for (const part of parts) {
    joined.set(new Uint8Array(part), offset);
    offset += part.byteLength;
  }
  const html = new TextDecoder().decode(joined);
  document.open();
  document.write(html);
  document.close();
})();
</script>
  <script type="application/json" data-napplet-private-resource-table>[{"source":"chunks/part-00.bin","uri":"blossom:sha256:4220f12a75d704d2467a91c7598b934e042f83e6f3222f1948578745bddab8e0","sha256":"4220f12a75d704d2467a91c7598b934e042f83e6f3222f1948578745bddab8e0","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-01.bin","uri":"blossom:sha256:e8e33f3a98150ca3bcdf48626d2c7c90257bb25f3cb683e763ff7dd9686648df","sha256":"e8e33f3a98150ca3bcdf48626d2c7c90257bb25f3cb683e763ff7dd9686648df","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-02.bin","uri":"blossom:sha256:c91ad8e9aaf4d8dbce836eec36c79419bbb5d281c712e0406851e052ae6967da","sha256":"c91ad8e9aaf4d8dbce836eec36c79419bbb5d281c712e0406851e052ae6967da","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-03.bin","uri":"blossom:sha256:55134aa4cb4c34525252593853748d44eae4be06b08b9b820f475954afaf55bd","sha256":"55134aa4cb4c34525252593853748d44eae4be06b08b9b820f475954afaf55bd","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-04.bin","uri":"blossom:sha256:7322f9f7be2364c13f75db2a38e3132ad920b74b3f06fb7de010364af879caa5","sha256":"7322f9f7be2364c13f75db2a38e3132ad920b74b3f06fb7de010364af879caa5","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-05.bin","uri":"blossom:sha256:2a36866a18f4af4c1909d9a6f92031922f3996fb39af656a6005a28048bda199","sha256":"2a36866a18f4af4c1909d9a6f92031922f3996fb39af656a6005a28048bda199","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-06.bin","uri":"blossom:sha256:821da6ce914a766b9f23cac67dda371164623060ddfcafebe6804a2892f21b26","sha256":"821da6ce914a766b9f23cac67dda371164623060ddfcafebe6804a2892f21b26","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-07.bin","uri":"blossom:sha256:9276b330dff7614a85b540640a9d7ea0884792b8bafc526caefb5a2f75a69faf","sha256":"9276b330dff7614a85b540640a9d7ea0884792b8bafc526caefb5a2f75a69faf","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-08.bin","uri":"blossom:sha256:f40a1ffa64180444e08f4ea79f129fc9fc33126777baa11bbe62c7c35e67b8f9","sha256":"f40a1ffa64180444e08f4ea79f129fc9fc33126777baa11bbe62c7c35e67b8f9","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-09.bin","uri":"blossom:sha256:bd71eb83c3433803d6655e6e28671b3aeb9949ec4153d742bdc1ffeae915417b","sha256":"bd71eb83c3433803d6655e6e28671b3aeb9949ec4153d742bdc1ffeae915417b","bytes":7455931,"mime":"application/octet-stream"}]</script><script>(() => {
const table = new Map([{"source":"chunks/part-00.bin","uri":"blossom:sha256:4220f12a75d704d2467a91c7598b934e042f83e6f3222f1948578745bddab8e0","sha256":"4220f12a75d704d2467a91c7598b934e042f83e6f3222f1948578745bddab8e0","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-01.bin","uri":"blossom:sha256:e8e33f3a98150ca3bcdf48626d2c7c90257bb25f3cb683e763ff7dd9686648df","sha256":"e8e33f3a98150ca3bcdf48626d2c7c90257bb25f3cb683e763ff7dd9686648df","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-02.bin","uri":"blossom:sha256:c91ad8e9aaf4d8dbce836eec36c79419bbb5d281c712e0406851e052ae6967da","sha256":"c91ad8e9aaf4d8dbce836eec36c79419bbb5d281c712e0406851e052ae6967da","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-03.bin","uri":"blossom:sha256:55134aa4cb4c34525252593853748d44eae4be06b08b9b820f475954afaf55bd","sha256":"55134aa4cb4c34525252593853748d44eae4be06b08b9b820f475954afaf55bd","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-04.bin","uri":"blossom:sha256:7322f9f7be2364c13f75db2a38e3132ad920b74b3f06fb7de010364af879caa5","sha256":"7322f9f7be2364c13f75db2a38e3132ad920b74b3f06fb7de010364af879caa5","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-05.bin","uri":"blossom:sha256:2a36866a18f4af4c1909d9a6f92031922f3996fb39af656a6005a28048bda199","sha256":"2a36866a18f4af4c1909d9a6f92031922f3996fb39af656a6005a28048bda199","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-06.bin","uri":"blossom:sha256:821da6ce914a766b9f23cac67dda371164623060ddfcafebe6804a2892f21b26","sha256":"821da6ce914a766b9f23cac67dda371164623060ddfcafebe6804a2892f21b26","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-07.bin","uri":"blossom:sha256:9276b330dff7614a85b540640a9d7ea0884792b8bafc526caefb5a2f75a69faf","sha256":"9276b330dff7614a85b540640a9d7ea0884792b8bafc526caefb5a2f75a69faf","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-08.bin","uri":"blossom:sha256:f40a1ffa64180444e08f4ea79f129fc9fc33126777baa11bbe62c7c35e67b8f9","sha256":"f40a1ffa64180444e08f4ea79f129fc9fc33126777baa11bbe62c7c35e67b8f9","bytes":8388608,"mime":"application/octet-stream"},{"source":"chunks/part-09.bin","uri":"blossom:sha256:bd71eb83c3433803d6655e6e28671b3aeb9949ec4153d742bdc1ffeae915417b","sha256":"bd71eb83c3433803d6655e6e28671b3aeb9949ec4153d742bdc1ffeae915417b","bytes":7455931,"mime":"application/octet-stream"}].map((entry) => [entry.source, entry]));
const cache = new Map();
const urls = new Map();
let liveBytes = 0;
const MAX_ASSET_BYTES = 10485760;
const MAX_LIVE_BYTES = 52428800;
function resource() {
  if (!window.napplet || !window.napplet.resource) throw new Error('window.napplet.resource is unavailable; this optimized artifact requires the existing resource capability');
  return window.napplet.resource;
}
function resourceBytes(uri) { resource(); return window.napplet.resource.bytes(uri); }
function resourceBytesMany(requests) { resource(); return window.napplet.resource.bytesMany(requests); }
function entryFor(source) {
  const entry = table.get(source);
  if (!entry || !/^blossom:sha256:[a-f0-9]{64}$/.test(entry.uri) || entry.uri !== 'blossom:sha256:' + entry.sha256 || entry.bytes > MAX_ASSET_BYTES) throw new Error('invalid optimized resource mapping: ' + source);
  return entry;
}
async function verify(entry, blob) {
  if (blob.size !== entry.bytes) throw new Error('optimized resource length mismatch');
  const digest = Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', await blob.arrayBuffer()))).map((byte) => byte.toString(16).padStart(2, '0')).join('');
  if (digest !== entry.sha256) throw new Error('optimized resource digest mismatch');
  if (!cache.has(entry.source)) { if (liveBytes + blob.size > MAX_LIVE_BYTES) throw new Error('optimized resource live-byte limit exceeded'); cache.set(entry.source, blob); liveBytes += blob.size; }
  return blob;
}
async function resolve(source) {
  if (cache.has(source)) return cache.get(source);
  const entry = entryFor(source);
  return verify(entry, await resourceBytes(entry.uri));
}
async function resolveMany(sources) {
  const entries = sources.map(entryFor);
  const missing = entries.filter((entry) => !cache.has(entry.source));
  if (missing.length) { const items = await resourceBytesMany(missing.map((entry) => ({ url: entry.uri }))); if (items.length !== missing.length || items.some((item, index) => !item.ok || !item.blob || item.url !== missing[index].uri)) throw new Error('optimized resource batch recovery failed'); await Promise.all(missing.map((entry, index) => verify(entry, items[index].blob))); }
  return sources.map((source) => cache.get(source));
}
async function response(source) { const entry = entryFor(source); const value = new Response(await resolve(source), { headers: { 'content-type': entry.mime } }); release(source); return value; }
async function objectUrl(source) { const current = urls.get(source); if (current) { current.references += 1; return current.url; } const url = URL.createObjectURL(await resolve(source)); urls.set(source, { url, references: 1 }); return url; }
function release(source) { if (source === undefined) { for (const handle of urls.values()) URL.revokeObjectURL(handle.url); urls.clear(); cache.clear(); liveBytes = 0; return; } const handle = urls.get(source); if (handle && --handle.references <= 0) { URL.revokeObjectURL(handle.url); urls.delete(source); } if (!urls.has(source) && cache.has(source)) { liveBytes -= cache.get(source).size; cache.delete(source); } }
window.__nappletPrivateResourceLoader = { resolve, resolveMany, response, objectUrl, release, teardown: () => release() };
})();</script></head>
  <body>
    <p>Loading packaged application…</p>
  </body>
</html>