pikibun 0.22.0 → 0.24.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.
Files changed (115) hide show
  1. package/README.md +2 -8
  2. package/dist/chunks/{chunk-KOZ2NZL7.js → chunk-XNVA5UWA.js} +7328 -1796
  3. package/dist/chunks/{cli-OGQRYOKN.js → cli-L6ODIDYQ.js} +13272 -13060
  4. package/dist/cli.js +10 -9
  5. package/dist/migrations/postgres/0044_host_browser.sql +6 -0
  6. package/dist/migrations/postgres/0045_connector_version.sql +6 -0
  7. package/dist/migrations/postgres/0046_session_tunnels.sql +12 -0
  8. package/dist/migrations/postgres/0047_native_page_callback.sql +4 -0
  9. package/dist/migrations/sqlite/0051_host_browser.sql +4 -0
  10. package/dist/migrations/sqlite/0052_connector_version.sql +4 -0
  11. package/dist/migrations/sqlite/0053_session_tunnels.sql +10 -0
  12. package/dist/migrations/sqlite/0054_native_page_callback.sql +4 -0
  13. package/dist/web/app.1d48db9d4c.js +12 -0
  14. package/dist/web/app.1d48db9d4c.js.br +0 -0
  15. package/dist/web/app.1d48db9d4c.js.gz +0 -0
  16. package/dist/web/browser.991ab24c49/LICENSES.txt +83 -0
  17. package/dist/web/browser.991ab24c49/LICENSES.txt.br +0 -0
  18. package/dist/web/browser.991ab24c49/LICENSES.txt.gz +0 -0
  19. package/dist/web/browser.991ab24c49/animation.js +1 -0
  20. package/dist/web/browser.991ab24c49/animation.js.br +0 -0
  21. package/dist/web/browser.991ab24c49/animation.js.gz +0 -0
  22. package/dist/web/browser.991ab24c49/bootstrap.js +1 -0
  23. package/dist/web/browser.991ab24c49/buffer.js +1 -0
  24. package/dist/web/browser.991ab24c49/buffer.js.br +0 -0
  25. package/dist/web/browser.991ab24c49/buffer.js.gz +0 -0
  26. package/dist/web/browser.991ab24c49/canvas.js +1 -0
  27. package/dist/web/browser.991ab24c49/canvas.js.br +0 -0
  28. package/dist/web/browser.991ab24c49/canvas.js.gz +0 -0
  29. package/dist/web/browser.991ab24c49/components.js +1 -0
  30. package/dist/web/browser.991ab24c49/components.js.br +0 -0
  31. package/dist/web/browser.991ab24c49/components.js.gz +0 -0
  32. package/dist/web/browser.991ab24c49/dom.js +1 -0
  33. package/dist/web/browser.991ab24c49/dom.js.br +0 -0
  34. package/dist/web/browser.991ab24c49/dom.js.gz +0 -0
  35. package/dist/web/browser.991ab24c49/environment.js +1 -0
  36. package/dist/web/browser.991ab24c49/environment.js.br +0 -0
  37. package/dist/web/browser.991ab24c49/environment.js.gz +0 -0
  38. package/dist/web/browser.991ab24c49/gesture.js +1 -0
  39. package/dist/web/browser.991ab24c49/gesture.js.br +0 -0
  40. package/dist/web/browser.991ab24c49/gesture.js.gz +0 -0
  41. package/dist/web/browser.991ab24c49/host.js +1 -0
  42. package/dist/web/browser.991ab24c49/host.js.br +0 -0
  43. package/dist/web/browser.991ab24c49/host.js.gz +0 -0
  44. package/dist/web/browser.991ab24c49/hot.js +1 -0
  45. package/dist/web/browser.991ab24c49/hot.js.br +0 -0
  46. package/dist/web/browser.991ab24c49/hot.js.gz +0 -0
  47. package/dist/web/browser.991ab24c49/keymap.js +1 -0
  48. package/dist/web/browser.991ab24c49/keymap.js.br +0 -0
  49. package/dist/web/browser.991ab24c49/keymap.js.gz +0 -0
  50. package/dist/web/browser.991ab24c49/list.js +1 -0
  51. package/dist/web/browser.991ab24c49/list.js.br +0 -0
  52. package/dist/web/browser.991ab24c49/list.js.gz +0 -0
  53. package/dist/web/browser.991ab24c49/loader.js +1 -0
  54. package/dist/web/browser.991ab24c49/modules.js +1 -0
  55. package/dist/web/browser.991ab24c49/modules.js.br +0 -0
  56. package/dist/web/browser.991ab24c49/modules.js.gz +0 -0
  57. package/dist/web/browser.991ab24c49/navigation.js +1 -0
  58. package/dist/web/browser.991ab24c49/navigation.js.br +0 -0
  59. package/dist/web/browser.991ab24c49/navigation.js.gz +0 -0
  60. package/dist/web/browser.991ab24c49/path.js +1 -0
  61. package/dist/web/browser.991ab24c49/path.js.br +0 -0
  62. package/dist/web/browser.991ab24c49/path.js.gz +0 -0
  63. package/dist/web/browser.991ab24c49/reactive.js +1 -0
  64. package/dist/web/browser.991ab24c49/reactive.js.br +0 -0
  65. package/dist/web/browser.991ab24c49/reactive.js.gz +0 -0
  66. package/dist/web/browser.991ab24c49/realm.js +1 -0
  67. package/dist/web/browser.991ab24c49/resource.js +1 -0
  68. package/dist/web/browser.991ab24c49/resource.js.br +0 -0
  69. package/dist/web/browser.991ab24c49/resource.js.gz +0 -0
  70. package/dist/web/browser.991ab24c49/runtime.js +2 -0
  71. package/dist/web/browser.991ab24c49/runtime.js.br +0 -0
  72. package/dist/web/browser.991ab24c49/runtime.js.gz +0 -0
  73. package/dist/web/browser.991ab24c49/scope.js +1 -0
  74. package/dist/web/browser.991ab24c49/scope.js.br +0 -0
  75. package/dist/web/browser.991ab24c49/scope.js.gz +0 -0
  76. package/dist/web/browser.991ab24c49/standard.js +1 -0
  77. package/dist/web/browser.991ab24c49/standard.js.br +0 -0
  78. package/dist/web/browser.991ab24c49/standard.js.gz +0 -0
  79. package/dist/web/browser.991ab24c49/testing.js +1 -0
  80. package/dist/web/browser.991ab24c49/testing.js.br +0 -0
  81. package/dist/web/browser.991ab24c49/testing.js.gz +0 -0
  82. package/dist/web/browser.991ab24c49/values.js +1 -0
  83. package/dist/web/browser.991ab24c49/values.js.br +0 -0
  84. package/dist/web/browser.991ab24c49/values.js.gz +0 -0
  85. package/dist/web/host.a102cc9754.js +38 -0
  86. package/dist/web/host.a102cc9754.js.br +0 -0
  87. package/dist/web/host.a102cc9754.js.gz +0 -0
  88. package/dist/web/icons/180.c8c643a608.png +0 -0
  89. package/dist/web/icons/192.c099d3e1ed.png +0 -0
  90. package/dist/web/icons/32.caf706bbd1.png +0 -0
  91. package/dist/web/icons/512.e2c2dd9ba7.png +0 -0
  92. package/dist/web/index.html +129 -14
  93. package/dist/web/index.html.br +0 -0
  94. package/dist/web/index.html.gz +0 -0
  95. package/dist/web/manifest.webmanifest +22 -0
  96. package/dist/web/nsh-math.7ad3060fbc.wasm +0 -0
  97. package/dist/web/nsh-math.7ad3060fbc.wasm.br +0 -0
  98. package/dist/web/nsh-math.7ad3060fbc.wasm.gz +0 -0
  99. package/dist/web/nsh-math.cc869361ca.bin +0 -0
  100. package/dist/web/nsh-syntaxes.ea0da56d04.bin +0 -0
  101. package/dist/web/nsh-syntaxes.ea0da56d04.bin.br +0 -0
  102. package/dist/web/nsh-syntaxes.ea0da56d04.bin.gz +0 -0
  103. package/dist/web/nsh.5be0579ad8.wasm +0 -0
  104. package/dist/web/nsh.5be0579ad8.wasm.br +0 -0
  105. package/dist/web/nsh.5be0579ad8.wasm.gz +0 -0
  106. package/dist/web/nsh.89070fe10a.js +259 -0
  107. package/dist/web/nsh.89070fe10a.js.br +0 -0
  108. package/dist/web/nsh.89070fe10a.js.gz +0 -0
  109. package/npm-shrinkwrap.json +251 -220
  110. package/package.json +8 -7
  111. package/dist/web/assets/index-BdJ_-50H.js +0 -62
  112. package/dist/web/assets/index-ClW_3YVo.js +0 -5
  113. package/dist/web/assets/index-DR-JFaOB.css +0 -1
  114. package/dist/web/favicon.svg +0 -1
  115. package/dist/web/sw.js +0 -61
@@ -0,0 +1 @@
1
+ const e=(()=>{let e={};e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}return e})(),t=(()=>{let e={};return e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},e})(),n=(()=>{let n={},r=e,i=t,a=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;n.Buffer=l,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50;let o=2147483647;n.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=s(),!l.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function c(e){if(e>o)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return u(e,t,n)}l.poolSize=8192;function u(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return ee(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return g(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return l.from(r,t,n);let i=_(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return l.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function d(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return d(e),e<=0||t===void 0?c(e):typeof n==`string`?c(e).fill(t,n):c(e).fill(t)}l.alloc=function(e,t,n){return f(e,t,n)};function p(e){return d(e),c(e<0?0:v(e)|0)}l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!l.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=b(e,t)|0,r=c(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:v(e.length)|0,n=c(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function ee(e){if(Z(e,Uint8Array)){let t=new Uint8Array(e);return g(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function g(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function _(e){if(l.isBuffer(e)){let t=v(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||Q(e.length)?c(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function v(e){if(e>=o)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+o.toString(16)+` bytes`);return e|0}function y(e){return+e!=e&&(e=0),l.alloc(+e)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype},l.compare=function(e,t){if(Z(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},l.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return l.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(l.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function b(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return J(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Y(e).length;default:if(i)return r?-1:J(e).length;t=(``+t).toLowerCase(),i=!0}}l.byteLength=b;function x(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return j(this,t,n);case`utf8`:case`utf-8`:return E(this,t,n);case`ascii`:return k(this,t,n);case`latin1`:case`binary`:return A(this,t,n);case`base64`:return T(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return M(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}l.prototype._isBuffer=!0;function S(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}l.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)S(this,t,t+1);return this},l.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)S(this,t,t+3),S(this,t+1,t+2);return this},l.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)S(this,t,t+7),S(this,t+1,t+6),S(this,t+2,t+5),S(this,t+3,t+4);return this},l.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?E(this,0,e):x.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||l.compare(this,e)===0},l.prototype.inspect=function(){let e=``,t=n.INSPECT_MAX_BYTES;return e=this.toString(`hex`,0,t).replace(/(.{2})/g,`$1 `).trim(),this.length>t&&(e+=` ... `),`<Buffer `+e+`>`},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,i){if(Z(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<s;++e)if(c[e]!==u[e]){a=c[e],o=u[e];break}return a<o?-1:+(o<a)};function C(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Q(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=l.from(t,r)),l.isBuffer(t))return t.length===0?-1:w(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function w(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}l.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},l.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function te(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(Q(r))return o;e[n+o]=r}return o}function ne(e,t,n,r){return X(J(t,e.length-n),e,n,r)}function re(e,t,n,r){return X(se(t),e,n,r)}function ie(e,t,n,r){return X(Y(t),e,n,r)}function ae(e,t,n,r){return X(ce(t,e.length-n),e,n,r)}l.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return te(this,e,t,n);case`utf8`:case`utf-8`:return ne(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return re(this,e,t,n);case`base64`:return ie(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ae(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return O(r)}let D=4096;function O(e){let t=e.length;if(t<=D)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=D));return n}function k(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function A(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function j(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function M(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}l.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r};function N(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=$(function(e){e>>>=0,G(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),l.prototype.readBigUInt64BE=$(function(e){e>>>=0,G(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=$(function(e){e>>>=0,G(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),l.prototype.readBigInt64BE=$(function(e){e>>>=0,G(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),i.read(this,e,!1,52,8)};function P(e,t,n,r,i,a){if(!l.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;P(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;P(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=e&255,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function F(e,t,n,r,i){W(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function I(e,t,n,r,i){W(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}l.prototype.writeBigUInt64LE=$(function(e,t=0){return F(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeBigUInt64BE=$(function(e,t=0){return I(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);P(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);P(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},l.prototype.writeBigInt64LE=$(function(e,t=0){return F(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),l.prototype.writeBigInt64BE=$(function(e,t=0){return I(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function L(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function R(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}l.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)};function z(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}l.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},l.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!l.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=l.isBuffer(e)?e:l.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let B={};function V(e,t,n){B[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}V(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),V(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),V(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=H(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function H(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n){G(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&K(t,e.length-(n+1))}function W(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new B.ERR_OUT_OF_RANGE(`value`,i,e)}U(r,i,a)}function G(e,t){if(typeof e!=`number`)throw new B.ERR_INVALID_ARG_TYPE(t,`number`,e)}function K(e,t,n){throw Math.floor(e)===e?t<0?new B.ERR_BUFFER_OUT_OF_BOUNDS:new B.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(G(e,n),new B.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let q=/[^+/0-9A-Za-z-_]/g;function oe(e){if(e=e.split(`=`)[0],e=e.trim().replace(q,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function J(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function se(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ce(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Y(e){return r.toByteArray(oe(e))}function X(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Q(e){return e!==e}let le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}return n})();export const{Buffer,SlowBuffer,INSPECT_MAX_BYTES,kMaxLength}=n;export default n;
@@ -0,0 +1 @@
1
+ export function createCanvas(e,t,n,r,i){let a=new WeakMap,o=new WeakMap,s=(t,n)=>{if(!r())throw Error(`the app was disposed`);let a=e(t,n);return i(),a},c=s(600,[]),l=e=>{let t=a.get(e);if(!t)throw TypeError(`not a canvas context or path`);return t},u=(e,t=0)=>{if(t>64)return null;let n=a.get(e);return n?n.out.map(e=>u(e,t+1)):e&&typeof e==`object`&&typeof e.__av==`number`?e:Array.isArray(e)?e.map(e=>u(e,t+1)):[`number`,`string`,`boolean`].includes(typeof e)?e:null},d=(e,t,n)=>{let r=l(e);r.closed||r.out.push(t,...n.map(e=>u(e)))},f=(e,t,n)=>{let r=Object.create(e);return a.set(r,{kind:t,out:[],state:{},stack:[],closed:!1,size:n}),r};function p(){throw TypeError(`Illegal constructor`)}function m(){throw TypeError(`Illegal constructor`)}function h(e){if(!new.target)throw TypeError(`Path2D requires new`);let t=f(h.prototype,`path`);return a.get(e)?.kind===`path`?l(t).out=u(e):typeof e==`string`&&(l(t).out=[50,e]),t}let g=(e,t)=>{for(let n of t)Object.defineProperty(e,n.name,{configurable:!0,writable:!0,value:function(...e){d(this,n.code,n.defaults.map((t,n)=>e[n]===void 0?t:e[n]))}})};g(h.prototype,c.path),g(p.prototype,[...c.path,...c.context]);let _=function(e,t,n,r,i=0){let a=Array.isArray(i)?i.slice(0,4):[i],o=e=>a[e]??0,s=a.length===4?[o(0),o(1),o(2),o(3)]:a.length===3?[o(0),o(1),o(2),o(1)]:a.length===2?[o(0),o(1),o(0),o(1)]:[o(0),o(0),o(0),o(0)];d(this,16,[e,t,n,r,...s])};Object.assign(h.prototype,{roundRect:_,addPath(e){a.get(e)?.kind===`path`&&l(this).out.push(...u(e))}});let v=[...c.properties,{name:`fillStyle`,code:24,initial:`#000`},{name:`strokeStyle`,code:25,initial:`#000`},{name:`shadowOffsetX`,initial:0},{name:`shadowOffsetY`,initial:0}];for(let e of v)Object.defineProperty(p.prototype,e.name,{configurable:!0,get(){let t=l(this).state;return Object.hasOwn(t,e.name)?t[e.name]:e.initial},set(t){let n=l(this).state;n[e.name]=t,e.code===void 0?d(this,36,[n.shadowOffsetX??0,n.shadowOffsetY??0]):d(this,e.code,[t])}});Object.defineProperty(p.prototype,"canvas",{get(){return l(this).size}});let y=e=>a.get(e)?.kind===`path`,b=(e,t,n,r)=>d(e,t,y(n)?[n,r??`nonzero`]:[null,n??`nonzero`]),x=(e,t,n)=>{let r=f(m.prototype,`gradient`);return l(r).out=[e,...Array.from({length:n},(e,n)=>Number(t[n])),[]],r};Object.assign(m.prototype,{addColorStop(e,t){l(this).out.at(-1).push(Number(e),String(t))}}),Object.assign(p.prototype,{roundRect:_,save(){let e=l(this);e.stack.push({...e.state}),d(this,0,[])},restore(){let e=l(this);e.stack.length&&(e.state=e.stack.pop(),d(this,1,[]))},resetTransform(){d(this,6,[1,0,0,1,0,0])},setLineDash(e){let t=Array.isArray(e)?e.map(Number):[];l(this).state.lineDash=t,d(this,30,[t])},getLineDash(){return[...l(this).state.lineDash??[]]},fill(e,t){b(this,18,e,t)},clip(e,t){b(this,20,e,t)},stroke(e){d(this,19,[y(e)?e:null])},fillText(e,t,n,r){d(this,40,[String(e),t,n,r??null])},strokeText(e,t,n,r){d(this,41,[String(e),t,n,r??null])},measureText(e){return{width:s(603,[this.font,this.fontVariantNumeric,typeof e==`string`?e:``])}},isPointInPath(...e){let t=y(e[0])?u(e.shift()):null;return s(602,[l(this).out,t,Number(e[0]),Number(e[1]),e[2],!1])},isPointInStroke(...e){let t=y(e[0])?u(e.shift()):null;return s(602,[l(this).out,t,Number(e[0]),Number(e[1]),void 0,!0])},createLinearGradient(...e){return x(0,e,4)},createRadialGradient(...e){return x(1,e,6)},createConicGradient(...e){return x(2,e,3)},drawImage(e,...t){let n=typeof e==`string`?e:e?.url,r=typeof e==`object`?e?.size:null;t.length>=8?d(this,42,[n,t.slice(0,4),...t.slice(4,8)]):t.length>=4?d(this,42,[n,null,...t.slice(0,4)]):d(this,42,[n,null,t[0]??0,t[1]??0,r?.width??NaN,r?.height??NaN])}});function S(e){let r=n.rt.element(`canvas`);n.rt.spread(r,t.split(e,[`draw`,`onLayout`])[1]);let i=t.signal(null,{equals:(e,t)=>e?.width===t?.width&&e?.height===t?.height});return n.rt.prop(r,`onLayout`,t=>{i.set({...t.bounds.size}),e.onLayout?.(t)}),t.renderEffect(()=>{let t=i();if(!t)return;let n=f(p.prototype,`context`,t),a=!1,c;try{e.draw(n,t)}catch(e){a=!0,c=e}let u=l(n);u.closed=!0,o.set(r,u.out);try{s(601,[r,u.out])}catch(e){if(!a)throw e}if(a)throw c}),r}return{Canvas:S,Path2D:h,CanvasRenderingContext2D:p,CanvasGradient:m}}
@@ -0,0 +1 @@
1
+ import{itemsProps as e}from"./list.js";export function createComponents(t,n,r,i){let a=new WeakMap,o=[`class`,`classList`,`style`,`activeStyle`,`hoverStyle`,`focusStyle`,`focusWithinStyle`,`disabledStyle`,`testID`,`onLayout`],s=e=>`on`+e[0].toUpperCase()+e.slice(1),c=(n,s)=>function(c={}){let l=i.rt,u=l.element(`view`);l.prop(u,`component`,n.name);let d={node:u,props:c,owner:r.getOwner(),renders:new Map,lazy:r.signal(!1)};a.set(u,d),(n.events.length||n.lazy||n.props.some(e=>e.kind===`renderer`))&&t(305,[u,`onNativeEvent`,!0]);let f=e=>{t(306,[u,e.holder]),e.dispose()};r.cleanup(()=>{for(let e of d.renders.values())for(let t of e.values())f(t);d.renders.clear()});let p=null;for(let e of n.props){if(e.kind!==`slot`||!(e.name in c))continue;let t=l.element(`view`);l.prop(t,`componentSlot`,e.name),l.insert(t,()=>c[e.name]),l.append(u,t),p??=t}for(let t of n.props.filter(e=>e.kind===`items`)){let n={};for(let t of e)t in c&&Object.defineProperty(n,t,{enumerable:!0,get:()=>c[t]});let r=l.list(n);l.prop(r,`componentSlot`,t.name),l.append(u,r),p??=r}let m=new Map;if(r.renderEffect(()=>{let e,r=(t,n)=>{try{let e=c[t];if(m.get(t)===e)return;n(e),m.set(t,e)}catch(t){e??=t}};for(let e of n.props)(e.kind===`value`||e.kind===`renderer`)&&r(e.name,r=>t(206,[n.id,u,e.name,r]));for(let e of o)r(e,t=>l.prop(u,e,t));if(e)throw e}),typeof c.ref==`function`){let e=n.methods.length?{node:u}:u;for(let t of n.methods)e[t.name]=(...r)=>s(207,[n.id,u,t.id],e,r,t.promise);r.untracked(()=>c.ref(e))}if(n.props.some(e=>e.kind===`children`)&&`children`in c){let e=n.lazy?l.cond(d.lazy,()=>c.children):r.computed(()=>c.children);l.insert(u,e,p)}return u},l=e=>{let t=n.nodes.get(e)?.deref();return t&&a.get(t)};return{make:c,component(e,t,n){let i=l(e);i&&r.batch(()=>r.runWithOwner(i.owner,()=>r.untracked(()=>r.protect(()=>{let e=i.props[s(t)];if(typeof e==`function`)return e(n)}))))},children(e,t){l(e)?.lazy.set(t)},render(e,t,n,a){let o=l(e);o&&r.runWithOwner(o.owner,()=>r.protect(()=>{this.unrender(e,t,n);let s=o.props[t];if(typeof s==`function`)return r.root(e=>{let r=i.rt.element(`view`);i.rt.prop(r,`componentRender`,`${t}\x1f${n}`);try{i.rt.insert(r,s(a)),i.rt.append(o.node,r)}catch(t){throw e(),t}let c=o.renders.get(t);c||o.renders.set(t,c=new Map),c.set(n,{holder:r,dispose:e})})}))},unrender(e,n,r){let i=l(e),a=i?.renders.get(n),o=a?.get(r);o&&(a.delete(r),t(306,[i.node,o.holder]),o.dispose())}}}
@@ -0,0 +1 @@
1
+ const e=new Set([`ios`,`android`,`desktop`,`web`]);export function createDom(t,n,r,i,a){let o=new WeakMap,s=new WeakMap,c=new WeakMap,l,u,d,f,p=Object.create(null);for(let e of[`focus`,`blur`,`scrollTo`,`zoomTo`,`scrollToIndex`,`scrollToEnd`,`reload`,`goBack`,`goForward`,`stopLoading`,`injectJavaScript`,`postMessage`,`sendInput`,`seek`])p[e]=function(t){let r=n.nodeIds.get(this);if(r===void 0)throw TypeError(`nsh: not a node`);return _(314,[r,e,t])};p.setSelection=function(e,t=e){return _(314,[n.nodeIds.get(this),`setSelection`,{start:Number(e),end:Number(t)}])},p.command=function(e,t){return _(314,[n.nodeIds.get(this),`native`,{name:e,args:t}])},p.scrollToOffset=function(e){return this.scrollTo({x:e?.offset,y:e?.offset,animated:e?.animated})},p.measure=function(){return u(this)};let m=new FinalizationRegistry(e=>{i()&&(t(307,[e]),n.nodes.delete(e),a())}),h=(e,t=!1)=>{let i=n.nodes.get(e)?.deref();if(i)return i;let a=Object.create(p);return n.nodeIds.set(a,e),s.set(a,r.getOwner()),n.nodes.set(e,new WeakRef(a)),e!==1&&m.register(a,e),a};n.makeNode=h;let g=h(1),_=(e,n)=>{if(!i())throw Error(`the app was disposed`);let r=t(e,n);return a(),r},v=(e,t,i)=>{if(n.signals.has(e))return e.set(t),!0;if(n.memos.has(e))throw TypeError(`a ref cannot be a memo, which is read-only`);if(typeof e==`function`)return r.untracked(()=>e(t)),!0;if(typeof i==`string`)throw TypeError(`ref={${i}}: binding cannot be assigned and is neither a signal nor a function`);return!1},y=(t,n,r)=>{if(n!==`children`){if(l?.isProp(n))l.set(t,n,r);else if(n===`panActivation`&&l?.gate(t,r),n===`ref`)v(r,t);else if(n===`tooltip`&&typeof r==`function`)D(t,n,r);else if(/^on[A-Z]/.test(n)){let e=o.get(t);e||o.set(t,e=new Map),typeof r==`function`?e.set(n,r):e.delete(n),_(305,[t,n,typeof r==`function`])}else e.has(n)?x(t,n,r):(_(303,[t,n,r]),b(t,n,r))}},b=(e,t,n)=>{let r=c.get(e);r||c.set(e,r=new Map),n==null?r.delete(t):r.set(t,n)},x=(e,t,n)=>{let r=c.get(e)?.get(t);if(b(e,t,n),!(t===`desktop`?f?.desktop:t===f?.os))return;let i=typeof n==`object`&&n?n:{};if(typeof r==`object`&&r)for(let t of Object.keys(r))Object.hasOwn(i,t)||y(e,t,void 0);for(let t of Object.keys(i))y(e,t,i[t])},S=(e,t=0)=>typeof e==`function`||t<64&&Array.isArray(e)&&e.some(e=>S(e,t+1)),C=e=>r.computed(()=>{let t=e();return typeof t==`function`?C(t):t}),w=e=>e.length>1&&e.some(e=>typeof e==`function`)?e.map(e=>typeof e==`function`?C(e):e):e,T=(e,t,n=null)=>{let i=[],a=t=>{i=_(308,[e,t,i,n])},o=e=>{if(typeof e==`function`&&(e=e(),typeof e==`function`))r.renderEffect(()=>o(e));else if(Array.isArray(e)&&S(e)){let t=w(e);r.renderEffect(()=>a(t))}else a(e)};r.renderEffect(()=>o(t))},E=(e,t)=>{n.nodeIds.has(t)?_(302,[e,t,null]):T(e,t)},D=(e,t,n)=>r.renderEffect(()=>y(e,t,n())),O=(e,t)=>r.untracked(()=>e(t)),k=(e,t,n)=>{let i=r.computed(()=>!!e());return r.computed(()=>{let e=i()?t:n;return typeof e==`function`?r.untracked(e):void 0})},A=(e,t,n)=>{let i=_(310,[]);r.cleanup(()=>_(312,[i]));let a=(e,n)=>{let i=r.signal(e),a=r.signal(n);return r.root(e=>{try{return{item:i,index:a,dispose:e,output:t(i,a)}}catch(t){throw e(),t}})};return r.computed(()=>{let t=e();return r.untracked(()=>_(311,[i,t,a,n]))})},j=(...e)=>new Proxy(Object.create(null),{get(t,n){for(let t=e.length-1;t>=0;t--){let r=typeof e[t]==`function`?e[t]():e[t];if(r&&n in r)return r[n]}},has(t,n){return e.some(e=>{let t=typeof e==`function`?e():e;return t!=null&&n in t})},ownKeys(){return[...new Set(e.flatMap(e=>Reflect.ownKeys((typeof e==`function`?e():e)??{})))]},getOwnPropertyDescriptor(e,t){return{enumerable:!0,configurable:!0}}}),M=(e,t)=>{let n=[];r.renderEffect(()=>{let r=Object.keys(t);for(let t of n)r.includes(t)||y(e,t,void 0);for(let n of r)y(e,n,t[n]);n=r})},N;return{setMeasure(e){u=e},setTouches(e){l=e},setPlatform(e){f=e},setHot(e){d=e},rootProp:(e,t)=>y(g,e,t),listen(e,t,n){let r=o.get(e);r||o.set(e,r=new Map),typeof n==`function`?r.set(t,n):r.delete(t),_(309,[e,t,typeof n==`function`])},rt:{element:e=>_(300,[e]),text:e=>_(301,[String(e)]),prop:y,bindProp:D,insert:T,append:E,component:O,cond:k,each:A,merge:j,spread:M,metaUrl:e=>new URL(e,document.baseURI).href,ref:v},mount(e,t){let n=d?.reuse(e,t);if(n)return n;N?.();let i,a=()=>{let e=i;i=null,N===a&&(N=null),e?.()},o=t!==null&&(typeof t==`object`||typeof t==`function`)?t:{};return r.root(t=>{i=t,N=a,T(g,O(e,o))}),d?.rendered(e,a),a},event(e,t,i){if(t===`onTouch`&&l)return l.dispatch(i);let a=n.nodes.get(e)?.deref(),c=a&&o.get(a)?.get(t);c&&r.batch(()=>r.runWithOwner(s.get(a),()=>r.untracked(()=>r.protect(()=>c(i)))))},dispose(){let e=N;N=null,e?.()}}}
@@ -0,0 +1 @@
1
+ export function createEnvironment(e,t,n){let r=Object.fromEntries(Object.entries({window:{width:0,height:0},safeArea:{top:0,right:0,bottom:0,left:0},titleBar:{height:0,left:0,right:0},keyboard:{height:0,duration:.25},colorScheme:`light`,fontScale:1,pixelRatio:1,locale:`en-US`,reduceMotion:!1,screenReader:!1,host:!1}).map(([t,n])=>[t,e.signal(n)])),i=e.signal(0),a=e.context(()=>r.safeArea()),o={os:`web`,version:`0.0`,idiom:`desktop`,desktop:!0,catalyst:!1,select(e){return`web`in e?e.web:this.desktop?e.desktop??e.default:e.mobile??e.default}},s=`system`,c=`light`,l=e=>{if(![`light`,`dark`,`system`].includes(e))throw TypeError(`setColorScheme: expected "light", "dark" or "system"`);s=e,n.rootProp(`appearance`,e),r.colorScheme.set(e===`system`?c:e)};return{api:{windowSize:()=>r.window(),safeArea:()=>r.safeArea(),safeAreaInsets:()=>a(),keyboardFrame:()=>r.keyboard(),colorScheme:()=>r.colorScheme(),setColorScheme:l,fontScale:()=>r.fontScale(),pixelRatio:()=>r.pixelRatio(),locale:()=>r.locale(),reduceMotion:()=>r.reduceMotion(),screenReader:()=>r.screenReader(),screenReaderEnabled:()=>r.screenReader(),platform:o,token(e){return i(),t(402,[e,r.colorScheme()===`dark`])}},insets:a,host:()=>r.host(),titleBar:()=>r.titleBar(),update(t){c=t.colorScheme,Object.assign(o,{...t.platform,version:`0.0`,catalyst:!1}),e.batch(()=>{for(let[n,i]of Object.entries(r)){let r=n===`colorScheme`&&s!==`system`?s:t[n],a=e.untracked(i);(a&&r&&typeof r==`object`?Object.keys(r).every(e=>r[e]===a[e]):r===a)||i.set(r)}}),n.rootProp(`layoutDirectionRtl`,t.rtl)},changedTokens(){i.update(e=>e+1)},setup(e,r,a,o){typeof e==`string`&&n.rootProp(`tailwindTheme`,e),typeof r==`string`&&(n.rootProp(`uiTheme`,r),t(403,[r]),i.update(e=>e+1)),[`light`,`dark`,`system`].includes(a)&&l(a),typeof o==`string`&&t(405,[o])}}}
@@ -0,0 +1 @@
1
+ export function createGestures(e,t,n,r,i,a){let o=[`onTouchStart`,`onTouchMove`,`onTouchEnd`,`onTouchCancel`],s=[`onStartShouldSetResponder`,`onMoveShouldSetResponder`],c=[`onResponderGrant`,`onResponderReject`,`onResponderStart`,`onResponderMove`,`onResponderEnd`,`onResponderRelease`,`onResponderTerminate`,`onResponderTerminationRequest`],l=new Set([...o,...o.map(e=>e+`Capture`),...s,...s.map(e=>e+`Capture`),...c]),u=new WeakMap,d=new WeakSet,f=new Map,p=null,m=!1,h=0,g=(t,n)=>{if(!i())throw Error(`the app was disposed`);let r=e(t,n);return a(),r},_=new FinalizationRegistry(e=>{i()&&g(702,[e])}),v=()=>{let e={id:g(700,[])};return _.register(e,e.id),e},y=v(),b={},x=(e,t,n=!1)=>g(701,[e.id,t,n]),S=e=>t.nodes.get(e)?.deref(),C=(e,t)=>u.get(S(e))?.get(t),w=(e,t,...n)=>C(e,t)?.(...n),T=(e,t,n)=>g(314,[e,t,n]),E=()=>{p=null,m&&(m=!1,T(1,`clearJsResponder`))},D=(e,t)=>{if(p!==null){if(w(p,`onResponderTerminationRequest`,t)===!1){w(e,`onResponderReject`,t);return}w(p,`onResponderTerminate`,t)}p=e;let n=w(e,`onResponderGrant`,t)===!0;n?T(e,`setJsResponder`,!0):m&&T(1,`clearJsResponder`),m=n},O=(e,t,n)=>{let r=0;if(p!==null){for(;r<t.length&&!g(313,[t[r],p]);)r++;t[r]===p&&r++}let i=t.slice(r);for(let[t,r]of[[i.slice().reverse(),e+`Capture`],[i,e]])for(let e of t)if(!d.has(S(e))&&w(e,r,n,b)===!0){e!==p&&D(e,n);return}},k=e=>{let{identifier:t,target:n,pageX:r,pageY:i,locationX:a,locationY:o,timestamp:s}=e;return{identifier:t,target:n,pageX:r,pageY:i,locationX:a,locationY:o,timestamp:s}};return{PanResponder:{create(e={}){let t=v(),n={stateID:++h,moveX:0,moveY:0,x0:0,y0:0,dx:0,dy:0,vx:0,vy:0,numberActiveTouches:0},r=(e,r=!1)=>Object.assign(n,x(t,e,r)),i=(t,r,i)=>typeof e[t]==`function`?e[t](r,n):i;return{panHandlers:{onStartShouldSetResponderCapture(e){return e.touches.length===1&&r(e,!0),n.numberActiveTouches=e.touches.length,i(`onStartShouldSetPanResponderCapture`,e,!1)},onStartShouldSetResponder:e=>i(`onStartShouldSetPanResponder`,e,!1),onMoveShouldSetResponderCapture(e){return r(e),i(`onMoveShouldSetPanResponderCapture`,e,!1)},onMoveShouldSetResponder(e){return r(e),i(`onMoveShouldSetPanResponder`,e,!1)},onResponderGrant(e){return r(e,!0),i(`onPanResponderGrant`,e),i(`onShouldBlockNativeResponder`,e,!0)},onResponderReject:e=>i(`onPanResponderReject`,e),onResponderStart(e){return r(e),i(`onPanResponderStart`,e)},onResponderMove(e){return r(e),i(`onPanResponderMove`,e)},onResponderEnd(e){return r(e),i(`onPanResponderEnd`,e)},onResponderRelease(e){try{return i(`onPanResponderRelease`,e)}finally{n.stateID=++h}},onResponderTerminate(e){try{return i(`onPanResponderTerminate`,e)}finally{n.stateID=++h}},onResponderTerminationRequest:e=>i(`onPanResponderTerminationRequest`,e,!0)}}}},isProp:e=>l.has(e),gate(e,t){t==null?d.delete(e):d.add(e)},set(e,t,n){let i=u.get(e);i||u.set(e,i=new Map),typeof n==`function`?i.set(t,n):i.delete(t),r.listen(e,`onTouch`,i.size?()=>{}:void 0)},dispatch:e=>n.batch(()=>n.untracked(()=>{let t=e.phase===`end`||e.phase===`cancel`;for(let t of e.points)e.phase===`start`&&t.changed&&f.set(t.identifier,t.path.filter(e=>u.get(S(e))?.size));let n=e.points.filter(e=>!t||!e.changed),r=e.points.filter(e=>e.changed);if(!r.length)return;let i={...k(r[0]),touches:n.map(k),changedTouches:r.map(k),stopped:!1,stopPropagation(){this.stopped=!0}};i.nativeEvent=i;let a=f.get(r[0].identifier)??[];(e.phase===`start`||e.phase===`move`)&&(b=x(y,i,e.phase===`start`&&e.points.length===1));try{let t={start:`onTouchStart`,move:`onTouchMove`,end:`onTouchEnd`,cancel:`onTouchCancel`}[e.phase];for(let[e,n]of[[a.slice().reverse(),t+`Capture`],[a,t]])for(let t of e){if(i.stopped)break;w(t,n,i)}if(i.stopped=!1,e.activated!=null&&d.has(S(e.activated))&&u.get(S(e.activated))?.size&&p!==e.activated&&D(e.activated,i),e.phase===`start`?O(s[0],a,i):e.phase===`move`&&O(s[1],a,i),p!==null){let t=p;e.phase===`cancel`?(w(t,`onResponderTerminate`,i),E()):(w(t,{start:`onResponderStart`,move:`onResponderMove`,end:`onResponderEnd`}[e.phase],i),e.phase===`end`&&!n.length&&(E(),w(t,`onResponderRelease`,i)))}}finally{if(t)for(let e of r)f.delete(e.identifier)}}))}}
@@ -0,0 +1 @@
1
+ export function createHost(e,t,n,r,i,a={}){let o=new Map,s=[],c=new Map,l=1,u=e(430,[]),d=e=>{if(typeof e!=`string`||!e.length||new TextEncoder().encode(e).length>256)throw TypeError(`host: expected a nonempty message name of at most 256 bytes`);return e},f=(e,n,r=!0)=>{let i=o.get(e);if(!i?.size){r&&(s.length>=256&&s.shift(),s.push([e,n]));return}let a;for(let e of[...i])if(i.has(e))try{t.runWithOwner(e.owner,()=>t.untracked(()=>t.protect(()=>e.fn(n))))}catch(e){a??={error:e}}if(a)throw a.error},p=(e,t)=>Object.assign(Error(e),{code:t}),m=(e,t,n)=>{let r=c.get(e);r&&(c.delete(e),clearTimeout(r.timer),t?r.resolve(n):r.reject(n instanceof Error?n:p(String(n),`ERR_NSH_HOST_ERROR`)))},h={...a,params:u[1],available:()=>!!(u[0]||r.host()),on(e,n){if(d(e),typeof n!=`function`)throw TypeError(`host.on: a function is required`);let r=o.get(e)??new Set;o.set(e,r);let a={fn:n,owner:t.getOwner()};r.add(a);let c=()=>{r.delete(a),!r.size&&o.get(e)===r&&o.delete(e)};return a.owner&&t.cleanup(c),queueMicrotask(()=>{if(i())for(let t=0;t<s.length&&o.get(e)?.size;){if(s[t][0]!==e){t++;continue}let[,n]=s.splice(t,1)[0];f(e,n)}}),c},call(t,n,r){return u[0]?new Promise((i,a)=>{d(t);let o=r?.timeout===void 0?3e4:Number(r.timeout);if(!Number.isFinite(o)||o<0)throw RangeError(`nsh/host: invalid timeout ${o}`);if(c.size>=1024)throw p(`host.call("${t}"): 1024 calls already wait for the embedding app's answers`,`ERR_NSH_QUOTA_EXCEEDED`);let s=l++,u=o?setTimeout(()=>m(s,!1,p(`nsh/host: ${t} timed out after ${o} ms`,`ETIMEDOUT`)),o):null;c.set(s,{resolve:i,reject:a,timer:u});try{e(431,[t,n,s])}catch(e){m(s,!1,e)}}):a.call(t,n,r)},post(t,n){d(t),u[0]&&e(432,[t,n])}};return n.rootProp(`onHost`,e=>{e.type===`event`&&f(e.event,e.payload,!1)}),{host:h,event:f,reply:m,dispose(){o.clear(),s.length=0;for(let e of c.keys())m(e,!1,Error(`the app was disposed`))}}}
@@ -0,0 +1 @@
1
+ import{adoptContextDefault as e}from"./reactive.js";export function createHot(t,n){let r=new Map,i=new Set,a=new Map,o=new Map,s=new Map,c=new WeakSet,l=new Map,u=new Map,d=new Map,f=new Map,p=new Map,m={},h=null,g=null,_=!1,v=[],y=!0,b=(e,t)=>`${e}:${t}`,x=e=>[...e].sort((e,t)=>e<t?-1:+(e>t)),S=e=>{for(let t of e)try{t.dispose()}catch(e){n(e)}},C=(e,t)=>{let n=e.split(`/`);n.pop();for(let e of t.split(`/`))e===`..`?n.pop():e!==`.`&&n.push(e);return n.join(`/`)},w=(e,t)=>{if(t=String(t),!t.startsWith(`.`)){let e=m?.[t];if(e===void 0)throw TypeError(`nsh hot: no module ${t}`);return e}let n=C(e,t),r=o.get(n);return r||o.set(n,r=new Set),r.add(e),T(n)},T=e=>{let t=a.get(e);if(t)return t.exports;let n={};return a.set(e,{exports:n,components:0,accepts:!1}),O(e),n},E=(e,t)=>{let n=Object.getOwnPropertyNames(t);for(let t of Object.getOwnPropertyNames(e))n.includes(t)||delete e[t];for(let r of n){let{enumerable:n}=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,{configurable:!0,enumerable:n,get:()=>t[r]})}},D=(e,t)=>e.components?Object.keys(t).every(e=>c.has(t[e])):!1,O=e=>{let t=r.get(e),o=a.get(e);if(!t||!o)throw TypeError(`nsh hot: no module ${e}`);o.components=0,p.set(e,f.get(e)??[]),f.delete(e);let s=d.get(e)??[];d.delete(e);for(let e of s)try{e()}catch(e){n(e)}let c=i.has(e)?o.exports:{},l={exports:c},u=g;g=e;let m=null;try{t(l,c,t=>w(e,t))}catch(e){m={error:e}}finally{g=u}let h=p.get(e)??[];if(p.delete(e),S(h),m)throw m.error;l.exports!==o.exports&&E(o.exports,l.exports),o.accepts=D(o,o.exports)},k=e=>{let t=new Set,n=[...e];for(;n.length;){let e=n.pop();if(t.has(e)||(t.add(e),a.get(e)?.accepts||e===h))continue;let r=o.get(e);if(!r?.size)return null;n.push(...x(r))}let r=new Set,i=[],s=e=>{if(!r.has(e)){r.add(e);for(let n of x(o.keys()))t.has(n)&&o.get(n).has(e)&&s(n);i.push(e)}};for(let e of x(t))s(e);return i},A=(e,r,i)=>t.computed(()=>{r();let a=s.get(e)?.fn;if(a)try{return t.untracked(()=>a(i))}catch(e){n(e);return}});return{hot:{define(e,t,n){e=String(e),r.set(e,t),n&&i.add(e)},start(e,t){h=String(e),m=t??{},T(h)},update(e){y=!1;let n=[],i=new Set;for(let[t,o]of Object.entries(e??{}))a.has(t)&&n.push(t),r.set(t,o),i.add(t);let o=k(n);if(!o)return!1;y=!0;let c=null;for(let e of o){_=!i.has(e);try{O(e)}catch(e){c={error:e};break}}_=!1;let l=v.map(e=>s.get(e)?.version).filter(Boolean);if(v=[],c)throw c.error;return t.batch(()=>{for(let e of l)e.update(e=>e+1)}),!0},component(e,n,r,i){let o=b(e,n);i=String(i);let l=g&&a.get(g);l&&l.components++;let u=s.get(o);if(u)return(u.sig!==i||_)&&v.push(o),u.fn=r,u.sig=i,u.proxy;let d=t.signal(0),f=e=>A(o,d,e);return Object.defineProperty(f,"name",{value:String(n),configurable:!0}),c.add(f),s.set(o,{fn:r,sig:i,version:d,proxy:f}),f},context(t,n,r){let i=b(t,n),a=l.get(i);return a?(e(a,r),a):(l.set(i,r),r)},keep(e,t,n,r){let i=b(e,t);n=String(n);let a=u.get(i);return a&&a.sig===n?a.value:(u.set(i,{sig:n,value:r}),r)}},get started(){return h!==null},async apply(e){y=!0;try{await e()}catch(e){n(e)}return y},rendered(e,t){if(g===null)return;let n=f.get(g);n||f.set(g,n=[]),n.push({app:e,dispose:t})},reuse(e,t){if(g===null)return null;let n=p.get(g);if(!n)return null;if((t===null||typeof t!=`object`&&typeof t!=`function`)&&n.length&&n[0].app===e){let e=n.shift(),t=f.get(g);return t||f.set(g,t=[]),t.push(e),e.dispose}return S(n.splice(0)),null},undoOnRerun(e){if(g===null)return!1;let t=d.get(g);return t||d.set(g,t=[]),t.push(e),!0},forgetUndo(e){for(let t of d.values()){let n=t.indexOf(e);if(n>=0){t.splice(n,1);return}}}}}
@@ -0,0 +1 @@
1
+ export function createKeymap(e,t,n,r,i,a){let o=1,s=[],c=(t,n)=>{try{let r=e(t,n);return i(),r}catch(e){throw TypeError(e.message)}},l=e=>c(451,[e.map(e=>[e.text,e.id,e.when,e.repeat]),!!r.appleKeyboard]);return n.rootProp(`onKeyCommand`,e=>{let t=s.find(t=>t.id===e);t&&t.handler({keystroke:t.text})}),{label(e){return c(450,[String(e),!!r.appleKeyboard])},bind(e,n,r){let i;if(typeof e==`object`&&e)i=Object.entries(e),r=n;else{if(e==null)throw TypeError(`keymap.bind: expected a keystroke or object of handlers`);i=[[String(e),n]]}if(r!=null&&typeof r!=`object`)throw TypeError(`keymap.bind: options must be an object`);let c=r?.when,u=!!r?.repeat;if(c!==void 0&&c!==`always`&&c!==`notEditing`)throw TypeError(`keymap.bind: when must be always or notEditing`);let d=i.map(([e,t])=>{if(typeof t!=`function`)throw TypeError(`keymap.bind: the handler of ${JSON.stringify(e)} is not a function`);if(o>=4294967295)throw RangeError(`shortcut IDs exhausted`);return{text:e,handler:t,id:o++,when:c,repeat:u}}),f=[...s,...d];l(f),s=f;let p=!1,m=()=>{if(p)return;let e=s.filter(e=>!d.includes(e));l(e),s=e,p=!0,a?.forgetUndo(m)};return t.getOwner()?t.cleanup(m):a?.undoOnRerun(m),m}}}
@@ -0,0 +1 @@
1
+ export const itemsProps=[`each`,`children`,`keyExtractor`,`stickyHeaderIndices`,`initialScrollIndex`,`onViewableItemsChange`,`viewabilityConfig`,`refreshing`,`onRefresh`,`onLoadMore`,`loadMoreThreshold`,`header`,`footer`,`empty`];const e=new Set([...itemsProps.filter(e=>![`stickyHeaderIndices`,`viewabilityConfig`,`refreshing`,`onRefresh`,`onLoadMore`].includes(e)),`ref`,`estimatedItemSize`,`loadMoreAtStartThreshold`,`separator`]);export function createLists(t,n,r,i,a,o){let s=new Map,c=i.rt,l=e=>typeof e==`function`?r.untracked(()=>e({})):e,u=(e,n)=>{t(306,[e,n.node]),n.dispose()};return{render:(o={})=>{let d=c.element(`list`),f=n.nodeIds.get(d),p={node:d,props:o,owner:r.getOwner(),cells:new Map,extras:[],latest:[-1,-1],reported:[-1,-1],timer:null};s.set(f,p),r.cleanup(()=>{s.delete(f),clearTimeout(p.timer);let e=[...p.cells.values(),...p.extras];p.cells.clear(),p.extras.length=0;let t;for(let n of e)try{n.dispose()}catch(e){t??={error:e}}if(t)throw t.error});let m=[];p.items=r.computed(e=>{let t=o.each??[],n=e??[];if(n.length&&n!==t){let e=0,i=n.length,a=t.length;for(;e<i&&e<a&&n[e]===t[e];)e++;for(;i>e&&a>e&&n[i-1]===t[a-1];)i--,a--;(i!==e||a!==e)&&(m.push([e,i-e,a-e]),r.untracked(()=>{for(let e of p.cells.values()){let t=e.index();t>=i&&e.index.set(t+a-i)}}))}return t}),r.renderEffect(()=>{let e=p.items();for(let e of m.splice(0))c.prop(d,`splice`,e);c.prop(d,`count`,e.length)});let h=new Map;r.renderEffect(()=>{let t=[`viewport`,...Object.keys(o).filter(t=>t!==`viewport`&&!e.has(t))];for(let e of h.keys())t.includes(e)||(c.prop(d,e,void 0),h.delete(e));for(let e of t){let t=o[e];(!h.has(e)||h.get(e)!==t)&&(c.prop(d,e,t),h.set(e,t))}for(let[e,t]of[[`estimatedItemSize`,50],[`loadMoreThreshold`,1],[`loadMoreAtStartThreshold`,1]])c.prop(d,e,o[e]??t)});let g=e=>r.runWithOwner(p.owner,()=>r.root(t=>{let n=c.element(`cell`);try{c.prop(n,`slot`,e),c.append(d,n),c.insert(n,()=>l(o[e]))}catch(e){try{t()}catch{}throw e}return{node:n,dispose:t}}));for(let e of[`header`,`footer`])e in o&&p.extras.push(g(e));if(`empty`in o){let e;r.renderEffect(()=>{o.each?.length?e&&=(u(d,e),p.extras.splice(p.extras.indexOf(e),1),null):e||(e=g(`empty`),p.extras.push(e))})}let _=()=>{p.timer=null,a()&&s.has(f)&&r.untracked(()=>{let[e,t]=p.latest,[n,r]=p.reported;if(e===n&&t===r)return;p.reported=p.latest;let i=o.each??[],a=[],s=[],c=(e,t)=>{let n=i[e];return{item:n,key:typeof o.keyExtractor==`function`?o.keyExtractor(n,e):String(n?.key??n?.id??e),index:e,isViewable:t}};if(e>=0)for(let o=e;o<=Math.min(t,i.length-1);o++)a.push(c(o,!0)),(o<n||o>r)&&s.push(c(o,!0));if(n>=0)for(let a=n;a<=Math.min(r,i.length-1);a++)(a<e||a>t)&&s.push(c(a,!1));typeof o.onViewableItemsChange==`function`&&o.onViewableItemsChange({viewableItems:a,changed:s})})};return`onViewableItemsChange`in o&&i.listen(d,`onViewableItemsChange`,({first:e,last:t})=>{p.latest=[e,t],clearTimeout(p.timer);let n=o.viewabilityConfig?.minimumViewTime??0;n>0?p.timer=setTimeout(_,n):_()}),typeof o.initialScrollIndex==`number`&&t(314,[f,`scrollToIndex`,{index:Math.max(0,o.initialScrollIndex),animated:!1}]),typeof o.ref==`function`&&r.untracked(()=>o.ref(d)),d},bind:(e,n)=>{let i=s.get(e);if(!i)return;let a;try{r.batch(()=>{for(let[o,d]of n){if(s.get(e)!==i)break;try{let n=i.cells.get(o);if(n){n.index.set(d);continue}let a=r.runWithOwner(i.owner,()=>r.root(e=>{let n=r.signal(d),a,s=r.computed(()=>{let e=n(),t=i.items();return e<t.length&&(a=t[e]),a}),u=c.element(`cell`);try{c.prop(u,`slot`,o),c.append(i.node,u);let e=r.untracked(()=>i.props.children(s,n));if(`separator`in i.props){let t,r=!1;c.insert(u,()=>n()>=(i.props.each?.length??0)-1?e:(r||=(t=l(i.props.separator),!0),i.props.inverted?[t,e]:[e,t]))}else c.insert(u,e)}catch(n){try{e()}catch{}try{t(306,[i.node,u])}catch{}throw n}return{node:u,index:n,dispose:e}}));s.get(e)===i?i.cells.set(o,a):u(i.node,a)}catch(e){a??={error:e}}}})}catch(e){a??={error:e}}if(s.get(e)===i)for(let[e,t]of n){let n=i.cells.get(e);n&&c.prop(n.node,`cellIndex`,t)}if(o(),a)throw a.error}}}
@@ -0,0 +1 @@
1
+ export function createChunkLoader(e,t,n=e=>import(e),r=()=>{}){return async(i,a=[])=>{if(!t()||(await Promise.all([i,...a].map(r)),!t()))throw Error(`the app was disposed`);let o=await n(new URL(i,e).href);if(!t())throw Error(`the app was disposed`);return o}}
@@ -0,0 +1 @@
1
+ export function createModules(e,t,n,r,i){let a=new Map,o=new Map,s=new Map,c=1,l=new FinalizationRegistry(r=>{n()&&(s.get(r)?.deref()||(s.delete(r),t.classPeers.delete(r),e(203,[r])))}),u=new FinalizationRegistry(t=>{n()&&e(209,[t])});t.makeFunction=t=>{let i=()=>{n()&&(e(208,[t]),r())};return u.register(i,t),i};let d=(t,i,o,s,l)=>{if(!n())throw Error(`the app was disposed`);let u=0,d;if(l){if(c>4294967295)throw RangeError(`browser call IDs exhausted`);u=c++,d=new Promise((e,t)=>a.set(u,{resolve:e,reject:t}))}try{let n=e(t,[...i,o,s,u]);return r(),l?d:n}catch(e){let t=a.get(u);if(a.delete(u),t)return t.reject(e),d;throw e}},f=(e,n)=>(t.instances.set(e,n),s.set(n,new WeakRef(e)),t.classPeers.set(n,new WeakRef(e)),l.register(e,n),e);t.wrap=(e,t)=>{let n=s.get(e)?.deref();if(n)return n;let r=o.get(t);if(!r)throw TypeError(`unregistered Rust class ${t}`);return f(Object.create(r.prototype),e)},t.attach=f,t.settle=(t,i)=>{Promise.resolve(i).then(i=>{n()&&(e(204,[t,!0,i]),r())},i=>{n()&&(e(204,[t,!1,i]),r())})};let p=new Map,m=t=>{for(let r of t)for(let t of r.classes){if(o.has(t.id))continue;let r=t.members.find(e=>e.kind===`constructor`),i=function(...e){if(!new.target)throw TypeError(`${t.name} requires new`);if(!r)throw TypeError(`${t.name} has no public constructor`);return d(202,[t.id,r.id],this,e,!1)};Object.defineProperty(i,"name",{value:t.name}),o.set(t.id,i);let a=function(){if(!n())throw Error(`the app was disposed`);e(205,[this,t.id])};for(let e of t.members){if(e.kind===`constructor`)continue;let n=function(...n){return d(202,[t.id,e.id],this,n,e.promise)};Object.defineProperty(n,"name",{value:e.name});let r=e.kind===`static`?i:i.prototype,a=Object.getOwnPropertyDescriptor(r,e.name)??{configurable:!0};e.kind===`get`||e.kind===`set`?a[e.kind]=n:(a.value=n,a.writable=!0),Object.defineProperty(r,e.name,a)}Object.defineProperty(i.prototype,"dispose",{value:a,configurable:!0,writable:!0}),Symbol.dispose&&Object.defineProperty(i.prototype,Symbol.dispose,{value:a,configurable:!0,writable:!0})}for(let e of t){let t=p.get(e.specifier)??Object.create(null);p.set(e.specifier,t);for(let n of e.components??[])t[n.export]=i(n,d);for(let n of e.classes)n.interface||(t[n.name]=o.get(n.id));for(let n of e.modules){let e=n.flat?t:t[n.name]??={};Object.assign(e,n.constants);for(let t of n.functions){let n=function(...e){return d(201,[t.id],this,e,t.promise)};Object.defineProperty(n,"name",{value:t.name}),Object.defineProperty(e,t.name,t.getter?{get:n,enumerable:!0,configurable:!0}:{value:n,writable:!0,enumerable:!0,configurable:!0})}n.default&&(t.default=e)}}};return m(e(200,[])),{exports:p,refresh(){n()&&m(e(200,[]))},measure(e){return d(315,[],e,[],!0,!1)},reply(e,t,n){let r=a.get(e);r&&(a.delete(e),t?r.resolve(n):r.reject(n))},dispose(){let e=[...a.values()];a.clear(),s.clear(),t.classPeers.clear(),o.clear(),p.clear();for(let t of e)t.reject(Error(`the app was disposed`))}}}
@@ -0,0 +1 @@
1
+ export function createNavigation(e,t,n,r){let{signal:i,computed:a,untracked:o,split:s,batch:c}=e,l=t.rt,u=new WeakSet,d=new WeakMap,f=(e,t)=>s(e,t)[1];function p(e){if(!Array.isArray(e))throw TypeError(`createNavStack: an array of routes`);let t=i(e.map(e=>({route:e}))),n=e=>{let n=o(t).slice();e(n),t.set(n)},r={routes:a(()=>t().map(e=>e.route)),push(e){n(t=>t.push({route:e}))},pop(e=1){n(t=>t.splice(Math.max(1,t.length-Math.trunc(Math.max(0,Number(e))||0))))},popToRoot(){n(e=>e.splice(1))},replace(e){n(t=>{t.pop(),t.push({route:e})})},setRoutes(e){let n=o(t).slice();t.set((Array.isArray(e)?e:[]).map(e=>{let t=n.findIndex(t=>t&&t.route===e);if(t<0)return{route:e};let r=n[t];return n[t]=null,r}))},remove(e){n(t=>{let n=t.findLastIndex(t=>t.route===e);n>=0&&t.splice(n,1)})}};return Object.defineProperty(r,"__nshEntries",{value:t}),r}function m(e){let t=i(null);return[a(()=>t()??(e?{...n.api.safeArea(),top:0}:n.api.safeArea())),({top:e,right:n,bottom:r,left:i})=>t.set({top:e,right:n,bottom:r,left:i})]}let h=(e,t)=>n.insets.Provider({value:e,get children(){return t()}});function g(e){let n=l.element(`screen`);u.add(n),l.spread(n,f(e,[`children`,`header`,`headerLeft`,`headerRight`,`headerTitle`,`onDismiss`,`onBackPress`,`onInsets`]));let[r,i]=m(!0);l.prop(n,`onInsets`,i),t.listen(n,`onDismiss`,()=>{d.get(n)?.(),e.onDismiss?.()}),e.onBackPress!=null&&l.prop(n,`onBackPress`,()=>e.onBackPress?.());let s=[[`left`,`headerLeft`],[`right`,`headerRight`],[`title`,`headerTitle`],[`header`,`header`]].map(([t,n])=>a(()=>{let r=e[n];return r==null||r===!1?null:o(()=>{let e=l.element(`headeritem`);return l.prop(e,`headerSlot`,t),l.insert(e,r),e})}));return s.push(h(r,()=>e.children)),l.insert(n,s),n}function _(e){let t=l.element(`stack`);l.spread(t,f(e,[`state`,`children`]));let n=e.state.__nshEntries,r=l.each(n,(t,r)=>{let i=o(t),s=o(()=>e.children(i.route,r)),c=e=>{let t=u.has(e)?e:g({children:e});return d.set(t,()=>n.set(o(n).filter(e=>e!==i))),t};return typeof s==`function`?a(()=>{let e=s();return o(()=>c(e))}):c(s)});return l.insert(t,r),t}function v(e){let s=!1,u=i(0),d=t=>{e.onCancel?.(),!(e[{backdropPress:`closeOnBackdropPress`,swipe:`closeOnSwipe`,cancel:`closeOnEscape`}[t]]===!1||s)&&c(()=>{e.onOpenChange?.({open:!1,reason:t}),s=!0,u.update(e=>e+1)})};return a(()=>(u(),e.open===!1?(s=!1,null):s?null:o(()=>{let i=l.element(`modal`);l.spread(i,f(e,[`children`,`style`,`class`,`backdropStyle`,`backdropClass`,`backdropTestID`,`open`,`animation`,`onOpen`,`onClose`,`onCancel`,`onOpenChange`]));let a=()=>e.backdropClass!=null||e.backdropStyle!=null,o=a()&&(e.animation==null||e.animation===`slide`)&&e.style?.translate==null&&!n.api.reduceMotion();o?l.prop(i,`animation`,`fade`):l.bindProp(i,`animation`,()=>e.animation);let[s,c]=m(!1);l.prop(i,`onInsets`,c),t.listen(i,`onShow`,()=>e.onOpen?.()),t.listen(i,`onDismiss`,()=>e.onClose?.()),t.listen(i,`onRequestClose`,e=>d(e.reason===`backdropPress`||e.reason===`swipe`?e.reason:`cancel`));let u=l.cond(a,()=>{let t=l.element(`view`);return l.bindProp(t,`class`,()=>`absolute inset-0 ${typeof e.backdropClass==`string`?e.backdropClass:``}`),l.bindProp(t,`style`,()=>e.backdropStyle),l.bindProp(t,`testID`,()=>e.backdropTestID),l.prop(t,`onPress`,()=>d(`backdropPress`)),t}),p=l.element(`view`);if(l.bindProp(p,`class`,()=>e.class),o){let t=r.createAnimatedValue(Math.max(1,n.api.windowSize().height));l.bindProp(p,`style`,()=>[e.style,{translate:[0,t]}]),r.Animated.timing(t,{toValue:0,duration:320,easing:[.2,.8,.2,1]}).start()}else l.bindProp(p,`style`,()=>e.style);return l.insert(p,h(s,()=>e.children)),l.insert(i,[u,p]),i})))}return{createNavStack:p,NavStack:_,NavPage:g,Dialog:v}}
@@ -0,0 +1 @@
1
+ const e={exports:{}},t={cwd:()=>`/`};function n(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function r(e,t){for(var n=``,r=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(i!==s-1&&a!==1){if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var c=n.lastIndexOf(`/`);if(c!==n.length-1){c===-1?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function i(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}var a={resolve:function(){for(var e=``,i=!1,a,o=arguments.length-1;o>=-1&&!i;o--){var s;o>=0?s=arguments[o]:(a===void 0&&(a=t.cwd()),s=a),n(s),s.length!==0&&(e=s+`/`+e,i=s.charCodeAt(0)===47)}return e=r(e,!i),i?e.length>0?`/`+e:`/`:e.length>0?e:`.`},normalize:function(e){if(n(e),e.length===0)return`.`;var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=r(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&i&&(e+=`/`),t?`/`+e:e},isAbsolute:function(e){return n(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,t=0;t<arguments.length;++t){var r=arguments[t];n(r),r.length>0&&(e===void 0?e=r:e+=`/`+r)}return e===void 0?`.`:a.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t||(e=a.resolve(e),t=a.resolve(t),e===t))return``;for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var i=e.length,o=i-r,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var c=t.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(t.charCodeAt(s+d)===47)return t.slice(s+d+1);if(d===0)return t.slice(s+d)}else o>l&&(e.charCodeAt(r+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(r+d);if(f!==t.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=r+u+1;d<=i;++d)(d===i||e.charCodeAt(d)===47)&&(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),e.length===0)return`.`;for(var t=e.charCodeAt(0),r=t===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);n(e);var r=0,i=-1,a=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;var s=t.length-1,c=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){r=o+1;break}}else c===-1&&(a=!1,c=o+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=c))}return r===i?i=c:i===-1&&(i=e.length),e.slice(r,i)}for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!a){r=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?``:e.slice(r,i)},extname:function(e){n(e);for(var t=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}}else i===-1&&(a=!1,i=s+1),c===46?t===-1?t=s:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return i(`/`,e)},parse:function(e){n(e);var t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;var r=e.charCodeAt(0),i=r===47,a;i?(t.root=`/`,a=1):a=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=a;--u)if(r=e.charCodeAt(u),r===47){if(!l){s=u+1;break}}else c===-1&&(l=!1,c=u+1),r===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1);return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(t.base=t.name=s===0&&i?e.slice(1,c):e.slice(s,c)):(s===0&&i?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir=`/`),t},sep:`/`,delimiter:`:`,win32:null,posix:null};a.posix=a,e.exports=a;export default e.exports;
@@ -0,0 +1 @@
1
+ const e=new WeakMap;export function adoptContextDefault(t,n){let r=e.get(t),i=e.get(n);r&&i&&r!==i&&(r.value=i.value)}export function createReactive(t,n,r){let i=(e,...r)=>{if(!n())throw Error(`the app was disposed`);return t(e,r)},a={},o=new Map,s=!1;r&&(r.after=()=>{if(!s){s=!0;try{for(;o.size;){let e=[...o];o.clear();for(let[t,n]of e)v(t)===void 0&&t.set([n])}}finally{s=!1}}});let c=e=>{try{return e()}catch(e){let t=i(112,a,void 0);if(!t)throw e;o.has(t)||o.set(t,e)}},l=e=>(...t)=>c(()=>e(...t)),u=new FinalizationRegistry(e=>{r?.accessors.delete(`${e[0]}:${e[1]}`),n()&&i(114,e)}),d=e=>{let t=()=>i(101,e);return u.register(t,e),r?.accessors.set(`${e[0]}:${e[1]}`,new WeakRef(t)),r?.reconcile(),t},f=(e,t)=>{let n=i(100,e,t?.equals),a=d(n);return r?.signals.add(a),a.set=e=>i(102,n,e),a.update=e=>v(()=>a.set(e(a()))),a},p=(e,t)=>{let n=d(i(103,l(e),void 0,t?.equals));return r?.memos.add(n),n},m=(e,t)=>i(104,l(e),t,!1),h=e=>i(104,l(()=>{let t=e();typeof t==`function`&&g(t)}),void 0,!0),g=e=>{if(!i(110))return e;let t=i(112,a,void 0);return i(109,()=>{try{return e()}catch(e){if(!t)throw e;o.has(t)||o.set(t,e)}}),e},_=e=>i(107,e),v=e=>i(108,e),y=e=>i(105,t=>e(()=>{t&&n()&&i(106,t)})),b=()=>i(110),x=(e,t)=>i(111,e,t);return{signal:f,computed:p,effect:h,cleanup:g,batch:_,untracked:v,root:y,context:t=>{let n={},r={value:t},a=()=>i(112,n,r.value);return e.set(a,r),a.Provider=e=>{let t=b();return y(r=>(t&&x(t,()=>g(r)),i(113,n,e.value),e.children))},a},split:(e,...t)=>{let n=new Set,r=t.map(t=>{let r={};for(let i of t)n.add(i),Object.defineProperty(r,i,{enumerable:!0,get:()=>e[i]});return r}),i={};for(let t of Object.keys(e))n.has(t)||Object.defineProperty(i,t,{enumerable:!0,get:()=>e[t]});return[...r,i]},getOwner:b,runWithOwner:x,renderEffect:m,ErrorBoundary:e=>{let t=f(void 0),n=e=>typeof e==`function`?p(()=>n(e())):Array.isArray(e)?e.map(n):e;return p(()=>{let r=t();return r?v(()=>typeof e.fallback==`function`?e.fallback(r[0],()=>t.set(void 0)):e.fallback):p(()=>(i(113,a,t),v(()=>n(e.children))))})},protect:c}}
@@ -0,0 +1 @@
1
+ import{createChunkLoader as e}from"./loader.js";const t=globalThis.__nsh_browser_realm;Object.defineProperty(globalThis,"__nsh_import",{value:e(t.base,t.live,e=>import(e),t.prepareChunk)}),t.setImporter(e=>import(e)),t.modules.get(`process`)&&Object.defineProperty(globalThis,"process",{value:t.modules.get(`process`).default,writable:!0,configurable:!0}),Object.defineProperty(globalThis,"Buffer",{value:t.modules.get(`buffer`).Buffer,writable:!0,configurable:!0});for(let e of[`createHash`,`createHmac`,`randomBytes`,`randomInt`,`randomFill`,`randomFillSync`])globalThis.crypto[e]=t.modules.get(`crypto`)[e];try{await import(t.entry),t.ready()}catch(e){t.failed(e)}
@@ -0,0 +1 @@
1
+ export function createResource(e,t,n,r){let i=new FinalizationRegistry(t=>{n()&&e(807,[t])});return function(a,o,s){let c=typeof o==`function`;if(c||(s=o,o=a),typeof o!=`function`)throw TypeError(`resource: the fetcher is not a function`);let l=s!=null&&`initialValue`in Object(s),u=e(800,[l]),d=t.signal(l?s.initialValue:void 0),f=t.signal(void 0),p=t.signal(l?`ready`:`unresolved`),m=t.signal(0),h=()=>d();i.register(h,u);let g=!1,_=(i,a,o)=>{if(!n())return;let s=e(a?804:805,[u,i]);s!==void 0&&(t.batch(()=>{a&&d.set(o),f.set(a?void 0:o),p.set(s)}),r())};return Object.assign(h,{loading:()=>[`pending`,`refreshing`].includes(p()),error:()=>f(),state:()=>p(),refetch(){g=!0,m.update(e=>e+1)},mutate(n){let r=e(806,[u]);return t.batch(()=>{d.set(n),f.set(void 0),p.set(r)}),n}}),t.renderEffect(()=>{m();let n=c?typeof a==`function`?a():a:void 0,r;t.cleanup(()=>{e(803,[u]),r?.abort()}),t.untracked(()=>{let t=g;if(g=!1,c&&(n==null||n===!1)){p.set(e(802,[u]));return}let[i,a]=e(801,[u]);r=new AbortController,p.set(a);try{let e={signal:r.signal,refetching:t},a=c?o(n,e):o(e);typeof(a!=null&&(typeof a==`object`||typeof a==`function`)?a.then:null)==`function`?Promise.resolve(a).then(e=>_(i,!0,e),e=>_(i,!1,e)):_(i,!0,a)}catch(e){_(i,!1,e)}})}),h}}
@@ -0,0 +1,2 @@
1
+ function e(e,t,n){let r=String(e);if(t&&(r+=`\n//# sourceURL=${t}`),n){let e=new TextEncoder().encode(n),t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));r+=`\n//# sourceMappingURL=data:application/json;base64,${btoa(t)}`}return URL.createObjectURL(new Blob([r],{type:`text/javascript`}))}export function createBrowserHost(t){let n,r=!1;return{bind(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,typeof r==`function`&&t!==`nsh_browser_trace`?(...t)=>{let i=n;return i?.values?i.values.boundary(()=>r(...t),()=>e.nsh_browser_trace()):r(...t)}:r]))},imports:{value:(...e)=>{if(!n)throw Error(`the browser host was not initialized`);return n.imports.value(...e)}},async run(e,{appId:i=``,capabilities:a=``,imports:o={},chunks:s={},nativeExports:c={}}={},l=[]){if(n?.stopping)throw Error(`cannot start an app during disposal`);let[u,ee]=t.reset(),d,f=!0,p,m,h,g,_,v,y,b=[],x=[...l],S=()=>f,C=(e,n)=>{if(!S())throw Error(`the app was disposed`);return d.boundary(()=>d.with([n],([n])=>d.result(t.wasm.nsh_browser_call(e,n))),d.trace)},w=()=>{S()&&t.requestPump()},T=e=>{try{t.showError(e?.stack??String(e))}catch{console.error(e)}},E=[],D=n={values:null,imports:null,hot:null,importModule:null,stopping:!1,stop(){if(!f||D.stopping)return;D.stopping=!0,y?.(Error(`the app was disposed`)),y=null;let e=[];for(let t of E)try{t()}catch(t){e.push(t)}f=!1,d?.dispose(),v?.remove();for(let e of x)URL.revokeObjectURL(e);for(let t of e)T(t)}};try{v=document.createElement(`iframe`),v.hidden=!0,v.setAttribute(`aria-hidden`,`true`),t.container.append(v);let l=v.contentWindow,f;try{f=l.document}catch{if(r)throw Error(`this page has an opaque origin and runs one app; reload it to run another`);r=!0,v.remove(),v=null,l=window,f=document}if(v){let e=f.createElement(`base`);e.href=document.baseURI,f.head.append(e)}let O=await new Promise((e,t)=>{y=t,Object.defineProperty(l,"__nsh_browser_bootstrap",{value:e,configurable:!0});let n=f.createElement(`script`);n.type=`module`,n.src=new URL(`./bootstrap.js`,import.meta.url).href,n.onerror=()=>t(Error(`could not load the browser facade`)),f.head.append(n)});if(!S())throw Error(`the app was disposed`);y=null,delete l.__nsh_browser_bootstrap;let{Values:k,createReactive:A,createModules:te,createDom:ne,createComponents:re,createGestures:ie,createCanvas:ae,createAnimation:oe,createNavigation:j,createKeymap:M,createEnvironment:N,createHost:P,createStandard:F,createResource:I,createLists:L,configureAPIs:R,createHot:z}=O;d=new k,d.trace=()=>t.wasm.nsh_browser_trace(),d.report=T,n.values=d,n.imports=d.imports(()=>t.wasm.memory),t.wasm.nsh_browser_initialize();let B=A(C,S,d),V=ne(C,d,B,S,w),H=D.hot=z(B,T);V.setHot(H);let U=N(B,C,V);V.setPlatform(U.api.platform);let W=ie(C,d,B,V,S,w);V.setTouches(W),V.rt.setup=U.setup,V.rt.font=(e,t)=>C(404,[e,t]),E.push(()=>V.dispose(),()=>p?.dispose(),()=>_?.dispose(),()=>h?.dispose(),()=>t.wasm.nsh_stop(),()=>t.wasm.nsh_browser_dispose()),C(400,[(e,t)=>{if(S())switch(e){case`hostEvent`:_?.event(...t);break;case`hostReply`:_?.reply(...t);break;case`bindList`:g?.bind(...t);break;case`event`:V.event(...t);break;case`reply`:p?.reply(...t);break;case`component`:m.component(...t);break;case`children`:m.children(...t);break;case`render`:m.render(...t);break;case`unrender`:m.unrender(...t);break;case`environment`:U.update(t[0]);break;case`tokens`:U.changedTokens();break;case`animationsFinished`:h?.finished(t[0]);break;case`registry`:p?.refresh();for(let e of b)e();break;default:throw Error(`browser host event is not implemented: ${e}`)}}]),C(401,[i,a]),t.begin(u,e=>{t.withStrings([e],(e,n)=>t.wasm.nsh_environment(e,n));let n=t.wasm.nsh_browser_start(u,ee,+!!t.dark,devicePixelRatio||1);if(n===-2)throw Error(`browser engine startup failed`);return n},!0),O.installTesting(l,C,{active:S,wake:w,network:!!t.testing}),g=L(C,d,B,V,S,w),V.rt.list=g.render,m=re(C,d,B,V),p=te(C,d,S,w,m.make);for(let e of Object.keys(c))p.exports.has(e)||p.exports.set(e,Object.create(null));V.setMeasure(e=>p.measure(e)),h=oe(C,S,w,U);let G=p.exports.get(`nsh`)??{},se=ae(C,B,V,S,w);Object.assign(G,h.api,se,{PanResponder:W.PanResponder}),Object.assign(G,B,U.api,{List:g.render,mount:V.mount,resource:I(C,B,S,w),keymap:M(C,B,V,U.api.platform,w,H)}),_=P(C,B,V,U,S,G.host),G.host=_.host,R(G,p,V,S,U);let K=p.exports.get(`nsh/base`);K&&Object.assign(K,j(B,V,U,h.api));let q=new Map([...p.exports,...F(C,S)]),J=q.get(`nsh/mobile`)??{};J.isAvailable=!1,q.set(`nsh/mobile`,J),q.set(`nsh/android`,{...J,isAvailable:!1}),q.set(`nsh/ios`,{...J,isAvailable:!1}),q.set(`nsh`,G),q.set(`nsh:rt`,V.rt),q.set(`nsh:hot`,{get hot(){return Object.hasOwn(l,`__nsh_hot`)||Object.defineProperty(l,"__nsh_hot",{value:H.hot,configurable:!0}),H.hot}}),q.set(`nsh/device`,Object.fromEntries([`windowSize`,`colorScheme`,`setColorScheme`,`fontScale`,`pixelRatio`,`locale`,`platform`].map(e=>[e,G[e]]))),q.set(`nsh/accessibility`,{reduceMotion:G.reduceMotion,screenReaderEnabled:G.screenReaderEnabled}),q.set(`nsh/host`,{host:G.host}),q.set(`nsh/native`,{nativeComponent:G.nativeComponent,nativeModule:G.nativeModule}),q.set(`nsh/keymap`,{keymap:G.keymap}),q.set(`nsh/animated`,h.api),q.set(`nsh/gesture`,{PanResponder:W.PanResponder});let Y={...o},X=new URL(e,document.baseURI),Z=X.protocol===`blob:`?new URL(document.baseURI):X;Z===X&&(Y[new URL(`bundle.js`,X).href]=X.href);for(let[e,t]of Object.entries(s))Y[new URL(e,Z).href]=new URL(t,document.baseURI).href;for(let[e,t]of q){let n=Object.keys(t),r=(c[e]??[]).filter(e=>!Object.hasOwn(t,e)),i=n.map((t,n)=>t==="default"?`export default host.get(${JSON.stringify(e)})["default"];`:`const e${n}=host.get(${JSON.stringify(e)})[${JSON.stringify(t)}];export{e${n} as ${JSON.stringify(t)}};`),a=r.map((t,n)=>(i.push(`let l${n}=host.get(${JSON.stringify(e)})[${JSON.stringify(t)}];export{l${n} as ${JSON.stringify(t)}};`),`l${n}=host.get(${JSON.stringify(e)})[${JSON.stringify(t)}];`));a.length&&i.push(`globalThis.__nsh_browser_realm.watch(()=>{${a.join(``)}});`);let o=`const host=globalThis.__nsh_browser_realm.modules;\n${i.join(`
2
+ `)}`,s=URL.createObjectURL(new Blob([o],{type:`text/javascript`}));x.push(s),Y[e]=s}let Q=f.createElement(`script`);Q.type=`importmap`,Q.textContent=JSON.stringify({imports:Y}),f.head.append(Q);let ce=new Promise((e,n)=>{y=n,Object.defineProperty(l,"__nsh_browser_realm",{value:Object.freeze({entry:X.href,base:Z.href,modules:q,watch:e=>{b.push(e)},setImporter:e=>{D.importModule=e},live:S,prepareChunk:e=>t.options.prepareChunk?.(e),ready:e,failed:n})})}),$=f.createElement(`script`);if($.type=`module`,$.src=new URL(`./realm.js`,import.meta.url).href,$.onerror=()=>y?.(Error(`could not load the app realm`)),f.head.append($),await ce,!S())throw Error(`the app was disposed`);y=null,t.startedApp(),w()}catch(e){throw S()&&(T(e),t.hostEvents=null),D.stop(),n===D&&(n=null),e}},runSource(t,{name:n=``,sourceMap:r=``,...i}={}){let a=e(t,n,r);return this.run(a,i,[a])},async hotUpdate(r,i,a){let o=n;if(!o?.hot?.started||!o.importModule||o.stopping)return!1;let s=e(r,i,a);try{return await o.hot.apply(()=>o.importModule(s))&&n===o&&!o.stopping}finally{URL.revokeObjectURL(s),n===o&&!o.stopping&&t.requestPump()}},stop(){let e=n;e?.stop(),n===e&&(n=null)}}}
@@ -0,0 +1 @@
1
+ export{createHost}from"./host.js";export{createStandard}from"./standard.js";export{createResource}from"./resource.js";export{createLists}from"./list.js";export{Values}from"./values.js";export{createReactive}from"./reactive.js";export{createModules}from"./modules.js";export{createDom}from"./dom.js";export{createComponents}from"./components.js";export{createGestures}from"./gesture.js";export{createCanvas}from"./canvas.js";export{createAnimation}from"./animation.js";export{createNavigation}from"./navigation.js";export{createKeymap}from"./keymap.js";export{createEnvironment}from"./environment.js";export{installTesting}from"./testing.js";export{createHot}from"./hot.js";export function configureAPIs(e,t,n,r,i){e.nextTick=(e,...t)=>{if(typeof e!=`function`)throw TypeError(`nextTick: callback must be a function`);queueMicrotask(()=>{r()&&e(...t)})};let a=t.exports.get(`process`);a&&(a.nextTick=e.nextTick,a.default&&(a.default.nextTick=e.nextTick));let o=t.exports.get(`nsh/desktop`);o&&Object.assign(o,{isAvailable:!1,titleBar:i.titleBar,Menu:{setApplicationMenu(){},popup:()=>Promise.resolve()}});for(let[t,r]of Object.entries({View:`view`,Text:`text`,Scroll:`scroll`,Overlay:`overlay`,Image:`image`,WebView:`webview`,Video:`video`,Shader:`shader`}))e[t]=Object.assign(e=>{let t=n.rt.element(r);return n.rt.spread(t,e),`children`in e&&n.rt.insert(t,()=>e.children),t},e[t]);e.nativeComponent=(e,t={})=>(r={})=>{let i=n.rt.element(`native`);n.rt.prop(i,`component`,e);let a=new Set(t.props??[]),o=new Set((t.events??[]).map(e=>`on`+e[0].toUpperCase()+e.slice(1))),s=new Proxy(r,{ownKeys:e=>Reflect.ownKeys(e).filter(e=>e!==`children`&&!a.has(e)&&!o.has(e)),getOwnPropertyDescriptor:()=>({configurable:!0,enumerable:!0})});n.rt.spread(i,s);for(let e of a)n.rt.bindProp(i,`$`+e,()=>r[e]);return o.size&&n.rt.prop(i,`onNativeEvent`,e=>{let t=r[`on`+e.name[0].toUpperCase()+e.name.slice(1)];typeof t==`function`&&t(e.data)}),i},e.nativeModule=e=>{let n=t.exports.get(e);if(!n)throw Error(`unknown native module ${e}`);return n};let s=t.exports.get(`nsh/mobile`)??{};s.InputAccessoryView=()=>null,t.exports.set(`nsh/mobile`,s);let c=t.exports.get(`nsh/base`);c&&(c.Input=e=>{let t=n.rt.element(`input`);return n.rt.spread(t,e),t})}
@@ -0,0 +1 @@
1
+ import e from"./path.js";import*as t from"./buffer.js";const{Buffer:n}=t,r=(e,t)=>typeof e==`string`?n.from(e,t):n.from(e);export function createStandard(i,a){let o=globalThis.crypto,s=new FinalizationRegistry(e=>{a()&&i(905,[e])}),c=(e,t,a=!1)=>{let o=i(a?906:900,[e,t]),c=!1,l={update(e,t){return c||i(903,[o,r(e,t)]),this},digest(e){if(c)throw Error(`Digest already called`);c=!0;let t=n.from(i(904,[o]));return s.unregister(l),e===void 0?t:t.toString(e)}};return s.register(l,o,l),l},l=e=>{if(!Number.isInteger(e)||e<0||e>1024**3)throw RangeError(`size is out of range`);return e},u=(e,t=0,n=e.byteLength-t)=>{if(l(t),l(n),t+n>e.byteLength)throw RangeError(`random fill exceeds buffer`);let r=new Uint8Array(e.buffer,e.byteOffset+t,n);for(let e=0;e<r.length;e+=65536)o.getRandomValues(r.subarray(e,e+65536));return e},d=(e,t)=>{if(typeof t!=`function`)throw TypeError(`callback is not a function`);queueMicrotask(()=>{if(!a())return;let n;try{n=e()}catch(e){t(e);return}t(null,n)})},f={createHash:e=>c(e),createHmac:(e,t)=>c(e,r(t)),randomUUID:()=>o.randomUUID(),getRandomValues:e=>o.getRandomValues(e),randomBytes(e,t){let r=()=>u(n.alloc(l(e)));return t===void 0?r():d(r,t)},randomFillSync:u,randomFill(e,t,n,r){return typeof t==`function`?(r=t,t=void 0,n=void 0):typeof n==`function`&&(r=n,n=void 0),d(()=>u(e,t,n),r)},randomInt(e,t,n){if(typeof t==`function`&&(n=t,t=void 0),t===void 0&&(t=e,e=0),!Number.isSafeInteger(e)||!Number.isSafeInteger(t)||t<=e||t-e>=2**48)throw RangeError(`randomInt bounds are out of range`);let r=()=>{let n=t-e,r=Math.floor(2**48/n)*n,i=new Uint8Array(6),a;do o.getRandomValues(i),a=i.reduce((e,t)=>e*256+t,0);while(a>=r);return e+a%n};return n===void 0?r():d(r,n)},subtle:o.subtle,webcrypto:o};for(let[e,t]of Object.entries({Md5:`md5`,Sha1:`sha1`,Sha256:`sha256`,Sha384:`sha384`,Sha512:`sha512`,Crc32:`crc32`,Crc32c:`crc32c`}))f[e]=class{constructor(){this.hash=c(t,void 0,e.startsWith(`Crc`))}update(e,t){return this.hash.update(e,t),this}digest(e){return this.hash.digest(e)}};f.crypto=f;let p={};for(let e of[`gzip`,`gunzip`,`deflate`,`inflate`,`deflateRaw`,`inflateRaw`,`brotliCompress`,`brotliDecompress`,`zstdCompress`,`zstdDecompress`]){let t=(t,a={})=>{let o=a.level??(e===`zstdCompress`?3:6),s=a.maxOutputLength??64*1024**2;if(!Number.isInteger(o)||!e.startsWith(`zstd`)&&(o<-1||o>9))throw RangeError(`compression level is out of range`);if(!Number.isInteger(s)||s<0)throw RangeError(`maxOutputLength is out of range`);return n.from(i(901,[e,r(t),o===-1?6:o,s]))};p[e+`Sync`]=t,p[e]=(e,n,r)=>(typeof n==`function`&&(r=n,n=void 0),d(()=>t(e,n),r))}let m={URL,URLSearchParams,domainToASCII:e=>i(902,[`domainToASCII`,String(e)]),domainToUnicode:e=>i(902,[`domainToUnicode`,String(e)]),fileURLToPath:e=>String(e).replace(/^(?:file:\/\/)+/,``),pathToFileURL(e){if(typeof e!=`string`)throw TypeError(`path must be a string`);let t=new URL(`file:///`);return t.pathname=e.replaceAll(`%`,`%25`).replaceAll(`\\`,`%5C`),t},format(e,t={}){let n=new URL(String(e)),r=t.auth!==!1&&n.username?`${n.username}${n.password?`:`+n.password:``}@`:``,i=t.unicode?m.domainToUnicode(n.host):n.host;return`${n.protocol}//${r}${i}${n.pathname}${t.search===!1?``:n.search}${t.fragment===!1?``:n.hash}`},urlToHttpOptions(e){let t=new URL(String(e)),n={protocol:t.protocol,hostname:t.hostname,pathname:t.pathname,path:t.pathname+t.search,href:t.href};return t.hash&&(n.hash=t.hash.slice(1)),t.search&&(n.search=t.search),t.username&&(n.auth=t.username+`:`+t.password),t.port&&(n.port=t.port),n}};return new Map([[`path`,{...e,default:e}],[`buffer`,{...t,Blob,File}],[`crypto`,{...f,default:f}],[`zlib`,{...p,default:p}],[`url`,{...m,default:m}],[`console`,{...console,default:console}]])}
@@ -0,0 +1 @@
1
+ const e=new Set([301,302,303,307,308]),t=new Set([101,103,204,205,304]),n=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!1});function r(e,t,r,i){let a=e.Date,o=()=>t(1001,[]);function s(...e){return new.target===void 0?new a(o()).toString():Reflect.construct(a,e.length?e:[o()],new.target)}Object.defineProperty(s,"name",{value:`Date`,configurable:!0}),Object.defineProperty(s,"length",{value:7,configurable:!0}),Object.defineProperty(s,"prototype",{value:a.prototype,writable:!1}),n(a.prototype,`constructor`,s),n(s,`UTC`,a.UTC),n(s,`parse`,a.parse),n(s,`now`,function(){return t(1001,[])}),n(e,`Date`,s);let c=e.performance;c&&(n(c,`now`,function(){return t(1002,[])}),Object.defineProperty(c,"timeOrigin",{value:t(1001,[])-t(1002,[]),configurable:!0}));let l=(e,t)=>(...n)=>{if(r())try{e.apply(void 0,t??n)}finally{i()}},u=(e,t)=>{if(typeof t!=`function`)throw TypeError(`${e}: the handler is not a function`);return t};n(e,`setTimeout`,function(e,n,...r){return t(1003,[l(u(`setTimeout`,e),r),Number(n),!1])}),n(e,`setInterval`,function(e,n,...r){return t(1003,[l(u(`setInterval`,e),r),Number(n),!0])});let d=e=>{typeof e==`number`&&t(1004,[e])};n(e,`clearTimeout`,function(e){d(e)}),n(e,`clearInterval`,function(e){d(e)}),n(e,`requestAnimationFrame`,function(e){return t(1005,[l(u(`requestAnimationFrame`,e))])}),n(e,`cancelAnimationFrame`,function(e){typeof e==`number`&&t(1006,[e])})}function i(r,i,a,o,s){let{Request:c,Response:l,ReadableStream:u,TypeError:d}=r,f=r.fetch,p=e=>new d(`Network request failed: ${e}`),m=new Map,h=e=>{let t=m.get(e);if(t)return m.delete(e),t.signal.removeEventListener(`abort`,t.abort),t},g=(n,r,[a,o,s,c,d])=>{if(r.redirectError&&e.has(a)){h(n),i(1009,[n]),r.reject(p(`the response was a redirect and redirect is "error"`));return}let f=null;!r.nullBody&&!t.has(a)&&(f=new u({start(e){r.controller=e},cancel(){h(n)&&i(1009,[n])}}));let m;try{m=new l(f,{status:a,statusText:o,headers:d})}catch(e){h(n),i(1009,[n]),r.reject(e);return}Object.defineProperties(m,{url:{value:s,configurable:!0},redirected:{value:c,configurable:!0},type:{value:`basic`,configurable:!0}}),r.resolve(m),r.resolve=r.reject=null};i(1007,[(e,t,...n)=>{let r=m.get(e);if(r&&a())try{switch(t){case 0:r.resolve&&g(e,r,n);break;case 1:r.controller?.enqueue(n[0]);break;case 2:h(e),r.reject?r.reject(p(`the response ended before its head`)):r.controller?.close();break;case 3:{h(e);let t=p(n[0]);r.reject?r.reject(t):r.controller?.error(t);break}case 4:{h(e);let t=Object.assign(p(n[0]),{code:`ERR_ACCESS_DENIED`,permission:`network`,resource:n[1]});r.reject?r.reject(t):r.controller?.error(t);break}}}finally{o()}}]);let _=e=>{try{return new URL(e instanceof c?e.url:String(e),r.location?.href).protocol}catch{return``}};n(r,`fetch`,async function(e,t){let n=_(e);if(n!==`asset:`&&(!s||n!==`http:`&&n!==`https:`))return f.call(r,e,t);let a=new c(e,t),{signal:l}=a;if(l.aborted)throw l.reason;let u=a.body?new Uint8Array(await a.arrayBuffer()):void 0;if(l.aborted)throw l.reason;let d=[...a.headers];a.headers.has(`accept`)||d.push([`accept`,`*/*`]);let p=a.url.split(`#`)[0];return new Promise((e,t)=>{let n=i(1008,[a.method,p,d,u,a.redirect===`follow`]),r={resolve:e,reject:t,signal:l,controller:null,nullBody:a.method===`HEAD`,redirectError:a.redirect===`error`,abort(){if(!h(n))return;i(1009,[n]);let e=l.reason;r.reject?r.reject(e):r.controller?.error(e),o()}};m.set(n,r),l.addEventListener(`abort`,r.abort),o()})})}const a={"ws:":`ws:`,"wss:":`wss:`,"http:":`ws:`,"https:":`wss:`};function o(e,t,r,i){let o=e.WebSocket;if(typeof o!=`function`)return;let{Event:s,CloseEvent:c,EventTarget:l,DOMException:u,URL:d,TypeError:f}=e,p=(e,t,n)=>{let a=Reflect.construct(l,[],e),d=o.CONNECTING,f=`blob`,p={open:null,message:null,error:null,close:null},m=(e,t)=>Object.defineProperty(a,e,{configurable:!0,enumerable:!0,...t});m(`url`,{value:t}),m(`protocol`,{value:``}),m(`extensions`,{value:``}),m(`bufferedAmount`,{value:0}),m(`readyState`,{get:()=>d}),m(`binaryType`,{get:()=>f,set:e=>{(e===`blob`||e===`arraybuffer`)&&(f=e)}});for(let e of Object.keys(p))m(`on${e}`,{get:()=>p[e],set:t=>{p[e]=typeof t==`function`?t:null}}),a.addEventListener(e,t=>p[e]?.call(a,t));return m(`send`,{value:function(){if(d===o.CONNECTING)throw new u(`Still in CONNECTING state.`,`InvalidStateError`)}}),m(`close`,{value:function(){d===o.CONNECTING&&(d=o.CLOSING)}}),Promise.resolve().then(()=>{if(r())try{d=o.CLOSED;let e=new s(`error`);Object.defineProperty(e,"message",{value:n,enumerable:!0}),a.dispatchEvent(e),a.dispatchEvent(new c(`close`,{code:1006,reason:``,wasClean:!1}))}finally{i()}}),a};function m(n,r){if(new.target===void 0)throw new f(`Failed to construct 'WebSocket': Please use the 'new' operator`);let i=r===void 0?[n]:[n,r],s=null;try{s=new d(String(n),e.location?.href)}catch{}let c=s&&!s.hash&&a[s.protocol];if(c){s.protocol=c;let e=t(1010,[s.href]);if(typeof e==`string`)return p(new.target,s.href,e)}return Reflect.construct(o,i,new.target)}Object.setPrototypeOf(m,o),Object.defineProperty(m,"prototype",{value:o.prototype,writable:!1});for(let e of[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`])Object.defineProperty(m,e,{value:o[e],enumerable:!0});n(o.prototype,`constructor`,m),n(e,`WebSocket`,m)}export function installTesting(e,t,{active:n=()=>!0,wake:a=()=>{},network:s=!1}={}){let c=t(1e3,[])===!0;return c&&r(e,t,n,a),i(e,t,n,a,s),s&&o(e,t,n,a),{clock:c,network:s}}
@@ -0,0 +1 @@
1
+ const e=(1<<20)-1;export const EXCEPTION=4294967295;const{setTimeout:t,clearTimeout:n}=globalThis,r=globalThis.performance.now.bind(globalThis.performance);export class Values{constructor(){this.slots=[void 0,null,!1,!0].map(e=>({value:e,refs:1/0,generation:0})),this.freeSlots=[],this.closed=!1,this.error=null,this.hasError=!1,this.nodes=new Map,this.nodeIds=new WeakMap,this.instances=new WeakMap,this.identities=new WeakMap,this.symbols=new Map,this.nextIdentity=1,this.wrap=null,this.makeFunction=null,this.classPeers=new Map,this.accessors=new Map,this.signals=new WeakSet,this.memos=new WeakSet,this.mirrors=new WeakMap,this.depth=0,this.weakened=!1,this.collectTimer=0,this.lastCollect=0}put(t){if(this.closed)throw Error(`the app was disposed`);if(t===void 0)return 0;if(t===null)return 1;if(t===!1)return 2;if(t===!0)return 3;let n=this.freeSlots.pop()??this.slots.length;if(n>=e)throw RangeError(`too many retained browser values`);let r=this.slots[n]?.generation??0,i;return typeof t==`symbol`&&(i=this.symbols.get(t),i||(i={id:this.nextIdentity++,refs:0},this.symbols.set(t,i)),i.refs++),this.slots[n]={value:t,refs:1,generation:r,symbol:i,node:this.nodeIds.get(t)??0},(r<<20|n)>>>0}slot(t){if(this.closed)throw Error(`the app was disposed`);let n=this.slots[t&e];if(!n||n.refs===0||n.generation!==t>>>20)throw ReferenceError(`a browser value was released`);return n}get(e){let t=this.slot(e>>>0),n=t.weak?t.weak.deref():t.value;if(t.weak&&n===void 0)throw ReferenceError(`a browser value was collected`);return n}boundary(e,t){if(this.closed)return e();let n=this.depth++===0;n&&this.promote();try{return e()}finally{try{n&&!this.closed&&(this.after?.(),this.schedule(t))}finally{this.depth--}}}promote(){if(this.weakened){this.weakened=!1;for(let e of this.slots)e?.refs>0&&e.weak&&(e.value=e.weak.deref())}}schedule(e){if(this.trace??=e,this.collectTimer)return;let n=Math.max(0,this.lastCollect+100-r());this.collectTimer=t(()=>{if(this.collectTimer=0,!this.closed){if(this.depth>0)return this.schedule(e);this.collect(e)}},n)}collect(e){this.lastCollect=r(),this.depth++;try{this.promote(),this.edges=[],e();let t=new WeakMap,n=new Map;for(let[e,r,i,a]of this.edges){let o=(e===0?this.classPeers.get(r):e===2?this.nodes.get(r):this.accessors.get(`${r}:${i}`))?.deref();if(!o)continue;let s=this.slot(a);if(s.refs===1/0||s.weak&&s.value===void 0)continue;let c=s.value;if((typeof c!=`object`||!c)&&typeof c!=`function`)continue;let l=t.get(o);l||t.set(o,l=[]),l.push(c),n.set(a,(n.get(a)??0)+1)}for(let e=4;e<this.slots.length;e++){let t=this.slots[e];if(!t||!t.refs)continue;let r=(t.generation<<20|e)>>>0;t.value!==void 0&&n.get(r)===t.refs?(t.weak=new WeakRef(t.value),t.value=void 0,this.weakened=!0):t.value!==void 0&&(t.weak=void 0)}this.mirrors=t,this.edges=null}finally{this.depth--}}reconcile(){this.trace&&!this.closed&&this.schedule(this.trace)}bind(e){return this.trace=()=>e.nsh_browser_trace(),Object.fromEntries(Object.entries(e).map(([t,n])=>[t,typeof n==`function`&&t!==`nsh_browser_trace`?(...t)=>this.boundary(()=>n(...t),()=>e.nsh_browser_trace()):n]))}retain(e){return this.slot(e).refs++,e}release(t){if(this.closed||t<4)return;let n=this.slot(t);--n.refs===0&&(n.symbol&&--n.symbol.refs===0&&this.symbols.delete(n.value),n.symbol=void 0,n.value=void 0,n.weak=void 0,n.generation<4095&&(n.generation++,this.freeSlots.push(t&e)))}with(e,t){let n=[];try{for(let t of e)n.push(this.put(t));return t(n)}finally{for(let e=n.length-1;e>=0;e--)this.release(n[e])}}result(e){if(e>>>0==EXCEPTION){let e=this.error,t=this.hasError;throw this.error=null,this.hasError=!1,t?e:Error(`the browser host failed`)}try{return this.get(e)}finally{this.release(e)}}dispose(){this.closed||(this.closed=!0,n(this.collectTimer),this.collectTimer=0,this.slots.length=0,this.freeSlots.length=0,this.nodes.clear(),this.classPeers.clear(),this.accessors.clear(),this.mirrors=new WeakMap,this.nodeIds=new WeakMap,this.instances=new WeakMap,this.wrap=null,this.makeFunction=null,this.settle=null,this.after=null,this.identities=new WeakMap,this.symbols=new Map,this.error=null,this.hasError=!1)}get retained(){return this.slots.reduce((e,t,n)=>e+ +(n>=4&&t.refs>0),0)}imports(e){let t=new TextEncoder,n=new TextDecoder,r=(t,n)=>new Uint8Array(e().buffer,t,n),i=(e,t)=>n.decode(r(e,t)),a=new Uint8Array(1024),o=new DataView(a.buffer),s=-1,c=0,l=0,u=!1,d=e=>{if(a.length>=e)return;let t=new Uint8Array(Math.max(e,a.length*2));t.set(a),a=t,o=new DataView(t.buffer)},f=(e,n)=>{let r=4,i=0,s=e=>{let n=e.length;d(r+4+n*3);let i=0;for(;i<n;i++){let t=e.charCodeAt(i);if(t>127)break;a[r+4+i]=t}let s=i===n?n:i+t.encodeInto(e.slice(i),a.subarray(r+4+i)).written;o.setUint32(r,s,!0),r+=4+s},c=e=>{d(r+9),typeof e==`boolean`?a[r++]=e?2:1:typeof e==`number`?(a[r]=3,o.setFloat64(r+1,e,!0),r+=9):typeof e==`string`?(a[r++]=4,s(e)):typeof e==`object`&&e&&Object.prototype.toString.call(e)===`[object Date]`?(a[r]=5,o.setFloat64(r+1,Date.prototype.getTime.call(e),!0),r+=9):a[r++]=0,i++};if(!n)for(let t=0;t<e.length;t++)c(e[t]);else if(e!==null&&(typeof e==`object`||typeof e==`function`))for(let t of Object.keys(e))s(t),c(e[t]);return o.setUint32(0,i,!0),r};return{value:(e,n,d,p,m)=>{try{switch(e){case 0:{let e=this.get(n);return e===void 0?0:e===null?1:typeof e==`boolean`?2:typeof e==`number`?3:typeof e==`string`?4:Array.isArray(e)?5:typeof e==`function`?6:typeof e==`object`?7:typeof e==`bigint`?9:8}case 1:return typeof this.get(n)==`boolean`?Number(this.get(n)):NaN;case 2:return typeof this.get(n)==`number`?this.get(n):NaN;case 3:{let e=this.get(n);return typeof e==`string`?e.length:NaN}case 4:{let e=this.get(n),{read:i,written:a}=t.encodeInto(e,r(d,p));return i===e.length?a:-1}case 5:return ArrayBuffer.isView(this.get(n))&&Object.prototype.toString.call(this.get(n))===`[object Uint8Array]`?this.get(n).byteLength:NaN;case 6:return r(d,p).set(this.get(n)),0;case 7:return Array.isArray(this.get(n))?this.get(n).length:NaN;case 8:return this.put(this.get(n)[d]);case 9:return this.put(this.get(n)?.[i(d,p)]);case 10:return this.put(Object.keys(this.get(n)));case 11:try{return Date.prototype.getTime.call(this.get(n))}catch{return NaN}case 12:return this.put(JSON.stringify(this.get(n)));case 13:{let e=this.get(n),t;try{t=JSON.stringify(e)}catch{t=String(e)}return this.put(t??String(e))}case 14:return this.slot(n).node??0;case 15:return this.put(this.nodes.get(n)?.deref()??null);case 16:return this.retain(n);case 17:return this.release(n),0;case 18:return this.put(m);case 19:return this.put(i(d,p));case 20:return this.put(r(d,p).slice());case 21:return this.put([]);case 22:return this.get(n)[d]=this.get(p),0;case 23:return this.put({});case 24:return Object.defineProperty(this.get(n),this.get(d),{value:this.get(p),writable:!0,enumerable:!0,configurable:!0}),0;case 25:return this.put(new Date(m));case 26:return this.put(Reflect.apply(this.get(n),this.get(d),this.get(p)));case 27:{let e=this.error;return this.error=null,this.hasError=!1,this.put(e)}case 28:return this.put(this.wrap(n,d));case 29:return this.instances.get(this.get(n))??0;case 48:return this.put(this.makeFunction(n));case 31:return this.hasError||=(this.error=TypeError(i(d,p)),!0),EXCEPTION;case 32:return Number(this.get(n)===this.get(d));case 33:{let e=this.get(n);if(typeof e==`symbol`)return this.slot(n).symbol.id;if((typeof e!=`object`||!e)&&typeof e!=`function`)return n;let t=this.identities.get(e);return t===void 0&&(t=this.nextIdentity++,this.identities.set(e,t)),t}case 34:return this.attach(this.get(n),d),0;case 35:return this.settle(d,this.get(n)),0;case 36:{let e={Error,TypeError,RangeError}[this.get(n)]??Error;return this.put(new e(this.get(d)))}case 37:return this.error=this.get(n),this.hasError=!0,EXCEPTION;case 38:{let e=`browser value operation failed`;try{let t=this.error;typeof t==`string`?e=t:typeof t?.message==`string`&&(e=t.message)}catch{}return this.put(e)}case 39:return this.put(this.makeNode(n,d!==0));case 42:{let e=this.hasError?this.error:Error(i(d,p));return this.error=null,this.hasError=!1,this.report(e),0}case 41:return this.put(new File([this.get(n)],this.get(d),{type:this.get(p),lastModified:Number.isNaN(m)?Date.now():m}));case 43:return this.put(String(this.get(n)));case 45:return Number(this.hasError);case 46:return this.edges?.push([n,d,p,m>>>0]),0;case 50:{let e=Object.keys(this.get(n));return this.put(e.some(e=>e.includes(`\0`))?null:e.join(`\0`))}case 49:{let e=this.get(n);if(!m&&!Array.isArray(e))return NaN;let t=u?[a,o]:null;t&&(a=new Uint8Array(1024),o=new DataView(a.buffer),s=-1);try{return(s!==n||c!==m)&&(s=-1,u=!0,l=f(e,m),s=n,c=m),l>p?-l:(r(d,l).set(a.subarray(0,l)),s=-1,l)}finally{u=!!t,t&&([a,o]=t,s=-1)}}case 47:{let e=this.slot(n);return Number(!e.weak||e.weak.deref()!==void 0)}default:throw Error(`unknown browser value operation ${e}`)}}catch(e){return this.error=e,this.hasError=!0,EXCEPTION}}}}}
@@ -0,0 +1,38 @@
1
+ // The page's host (nsh.json `web.host`), on the web only: the address the client is opened at and where it goes. Links
2
+ // into the app keep the routes the web app had, in the fragment (#/s/<id>, #/settings/hosts, #/shared/<token>,
3
+ // #/join/<token>), so a share or invite token never reaches the server; sign-in goes to the server's own pages.
4
+ // Native Shell copies this module as it is into the site (host.<digest>.js) and runs createHost before the app starts.
5
+
6
+ const page = typeof location !== "undefined" && typeof history !== "undefined";
7
+
8
+ /** The fragment, or "" where there is no page (nsh test runs this module headless too). */
9
+ const route = () => (page ? location.hash : "");
10
+
11
+ const functions = new Map([
12
+ ["page.route", () => route()],
13
+ // Shows the app's route in the address bar without a history entry of its own: Native Shell keeps the entries of
14
+ // its pages and dialogs, whose state stays as it is.
15
+ ["page.setRoute", args => {
16
+ const hash = typeof args?.hash === "string" && /^#\/[^\s]*$/.test(args.hash) ? args.hash : "#/";
17
+ if (page && location.hash !== hash) history.replaceState(history.state, "", hash);
18
+ return null;
19
+ }],
20
+ // Only this server's own pages (/api/auth/github, say), never another site's.
21
+ ["page.open", args => {
22
+ const path = args?.path;
23
+ if (typeof path !== "string" || !path.startsWith("/") || path.startsWith("//") || path.includes("\\")) throw new Error("Only this server's own paths open.");
24
+ if (page) location.assign(path);
25
+ return null;
26
+ }],
27
+ ]);
28
+
29
+ export async function createHost(player) {
30
+ if (page && typeof addEventListener === "function") addEventListener("hashchange", () => player.hostEvent("page.route", route()));
31
+ return {
32
+ call(name, args) {
33
+ const fn = functions.get(name);
34
+ if (!fn) throw new Error(`No host function ${name}.`);
35
+ return fn(args);
36
+ },
37
+ };
38
+ }
Binary file
Binary file
Binary file