@tktb-tess/util-fns 0.13.4 → 0.13.5

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.
@@ -1,18 +1,15 @@
1
1
  //#region lib/async_worker.ts
2
- var e = "AsyncWorker", t = 1n << 128n, n = 0n, r = () => {
3
- let e = `${n++}`;
4
- return n === t && (n = 0n), e;
5
- }, i = class {
2
+ var e = "AsyncWorker", t = 0n, n = () => `${t++}`, r = class {
6
3
  static name = e;
7
4
  #e;
8
5
  constructor(e) {
9
6
  this.#e = e;
10
7
  }
11
- postMessage = (e, t) => new Promise((n, i) => {
12
- let a = r(), o = new AbortController(), { signal: s } = o;
8
+ postMessage = (e, t) => new Promise((r, i) => {
9
+ let a = n(), o = new AbortController(), { signal: s } = o;
13
10
  this.#e.addEventListener("message", (e) => {
14
11
  let t = e.data;
15
- t.id === a && (o.abort(), t.success ? n(t.value) : i(t.error));
12
+ t.id === a && (o.abort(), t.success ? r(t.value) : i(t.error));
16
13
  }, { signal: s }), this.#e.addEventListener("error", (e) => {
17
14
  o.abort(), i(e.error);
18
15
  }, { signal: s });
@@ -23,9 +20,9 @@ var e = "AsyncWorker", t = 1n << 128n, n = 0n, r = () => {
23
20
  this.#e.postMessage(c, t);
24
21
  });
25
22
  };
26
- Object.defineProperty(i.prototype, Symbol.toStringTag, {
23
+ Object.defineProperty(r.prototype, Symbol.toStringTag, {
27
24
  value: e,
28
25
  enumerable: !0
29
26
  });
30
27
  //#endregion
31
- export { i as AsyncWorker };
28
+ export { r as AsyncWorker };
@@ -1,7 +1,7 @@
1
1
  //#region lib/async_worker_post.ts
2
2
  var e = () => typeof window > "u" && typeof self < "u" && "importScripts" in self;
3
3
  function t(t, n) {
4
- if (!e()) throw Error("this function must be used in Worker");
4
+ if (!e()) throw Error("This function must be used in Worker");
5
5
  let r = {
6
6
  success: !0,
7
7
  value: t,
@@ -10,7 +10,7 @@ function t(t, n) {
10
10
  self.postMessage(r);
11
11
  }
12
12
  function n(t, n) {
13
- if (!e()) throw Error("this function must be used in Worker");
13
+ if (!e()) throw Error("This function must be used in Worker");
14
14
  let r = {
15
15
  success: !1,
16
16
  error: t,
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./mod_pow--lOK7jfy.js";
1
+ import { n as e, t } from "./mod_pow-C5090m6u.js";
2
2
  import { isSquare as n, jacobiSymbol as r } from "./math.js";
3
3
  import { getRandBIByBitLength as i, getRandBIByRange as a } from "./random.js";
4
4
  //#region lib/baillie_psw.ts
@@ -125,7 +125,7 @@ function p(e, t = !1) {
125
125
  throw Error("no primes were found");
126
126
  }
127
127
  async function m(e) {
128
- let { getWorker: t } = await import("./bpsw_worker_wrap-BtWQ4Gha.js");
128
+ let { getWorker: t } = await import("./bpsw_worker_wrap-iIZQPlow.js");
129
129
  return t().postMessage(e);
130
130
  }
131
131
  //#endregion
@@ -0,0 +1,54 @@
1
+ //#region lib/base32768_table.ts
2
+ var e;
3
+ function t() {
4
+ let e = Array.from("ƀƟȴʓҊҩӺԙԱՐՠտऄणഒറกภကဟ႞ႽაჯሃቂጘፗᎠᏟᐁᙠᚠᛟកសᠠᡟᢇᢦᢰᣯ⌫⏪⓫❊❶➵⟰⥯⨍⩬⩷⫖⫝⭜⮗ⱶⱾⳝㄅㄤㆠ㇟㐀ꑿꔀꗿꚠꛟ꜀ꝟꝱꞰ".matchAll(/../g)).flatMap((e) => {
5
+ let t = e[0].charCodeAt(0), n = e[0].charCodeAt(1), r = [...Array(n - t + 1)].map((e, n) => t + n);
6
+ return [...String.fromCharCode(...r)];
7
+ }), t = Object.fromEntries(e.map((e, t) => [e, t]));
8
+ return Object.setPrototypeOf(t, null), [Object.freeze(e), Object.freeze(t)];
9
+ }
10
+ function n() {
11
+ return e ??= t(), e[0];
12
+ }
13
+ function r() {
14
+ return e ??= t(), e[1];
15
+ }
16
+ //#endregion
17
+ //#region lib/base32768.ts
18
+ var i = 15, a = 8, o = "X";
19
+ function s(e) {
20
+ let t = n(), r = 0, s = 0, c = "";
21
+ for (let n of e) for (let e = 0; e < a; e++) {
22
+ let o = n >>> a - 1 - e & 1;
23
+ if (r = r << 1 | o, s++, s === i) {
24
+ let e = t[r];
25
+ if (e == null) throw TypeError("unexpected");
26
+ c += e, r = 0, s = 0;
27
+ }
28
+ }
29
+ if (s > 0) {
30
+ r <<= 15 - s;
31
+ let e = t[r];
32
+ if (e == null) throw TypeError("unexpected");
33
+ c += e, s < a && (c += o);
34
+ }
35
+ return c;
36
+ }
37
+ function c(e) {
38
+ let t = r(), n = 0, s = 0, c = [];
39
+ for (let r of e) {
40
+ if (r === o) {
41
+ c.pop();
42
+ continue;
43
+ }
44
+ let e = t[r];
45
+ if (e == null) throw TypeError("unexpected");
46
+ for (let t = 0; t < i; t++) {
47
+ let r = e >>> i - 1 - t & 1;
48
+ n = n << 1 | r, s++, s === a && (c.push(n), n = 0, s = 0);
49
+ }
50
+ }
51
+ return Uint8Array.from(c);
52
+ }
53
+ //#endregion
54
+ export { s as n, c as t };
@@ -0,0 +1,2 @@
1
+ export declare function toBase32768(bin: Uint8Array): string;
2
+ export declare function fromBase32768(base32768: string): Uint8Array<ArrayBuffer>;
@@ -0,0 +1,2 @@
1
+ import { n as e, t } from "./base32768-BqNkkJ-a.js";
2
+ export { t as fromBase32768, e as toBase32768 };
@@ -0,0 +1,2 @@
1
+ export declare function getETable(): readonly string[];
2
+ export declare function getDTable(): Readonly<Record<string, number>>;
@@ -1,4 +1,22 @@
1
- export declare function toBase64(bin: Uint8Array): string;
2
- export declare function fromBase64(base64: string): Uint8Array<ArrayBuffer>;
3
- export declare function toBase64URL(bin: Uint8Array): string;
4
- export declare function fromBase64URL(base64URL: string): Uint8Array<ArrayBuffer>;
1
+ export interface ToBase64Options {
2
+ alphabet?: 'base64' | 'base64url';
3
+ omitPadding?: boolean;
4
+ }
5
+ export interface FromBase64Options {
6
+ alphabet?: 'base64' | 'base64url';
7
+ lastChunkHandling?: 'loose' | 'strict' | 'stop-before-partial';
8
+ }
9
+ /**
10
+ * Polyfill of `Uint8Array.prototype.toBase64()`
11
+ * @param bin
12
+ * @param options
13
+ * @returns
14
+ */
15
+ export declare function toBase64(bin: Uint8Array, options?: ToBase64Options): string;
16
+ /**
17
+ * Polyfill of `Uint8Array.fromBase64()`
18
+ * @param base64
19
+ * @param options
20
+ * @returns
21
+ */
22
+ export declare function fromBase64(base64: string, options?: FromBase64Options): Uint8Array<ArrayBuffer>;
@@ -1,16 +1,44 @@
1
1
  //#region lib/base64.ts
2
- function e(e) {
3
- return btoa(e.reduce((e, t) => e + String.fromCharCode(t), ""));
2
+ function e(e, t = {}) {
3
+ let { alphabet: n = "base64", omitPadding: r = !1 } = t, i = btoa(e.reduce((e, t) => e + String.fromCharCode(t), ""));
4
+ return n === "base64url" && (i = i.replaceAll("+", "-").replaceAll("/", "_")), r && (i = i.replace(/=+$/, "")), i;
4
5
  }
5
- function t(e) {
6
- return Uint8Array.from(atob(e), (e) => e.charCodeAt(0));
7
- }
8
- function n(t) {
9
- return e(t).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
10
- }
11
- function r(e) {
12
- for (; e.length & 3;) e += "=";
13
- return t(e.replaceAll("-", "+").replaceAll("_", "/"));
6
+ function t(e, t = {}) {
7
+ if (e = e.replace(/\s+/g, ""), e === "") return new Uint8Array();
8
+ let { alphabet: n = "base64", lastChunkHandling: r = "loose" } = t, i = e.match(/=+$/)?.[0].length ?? 0, a = [..."AQgw"], o = a.concat([..."EUk0IYo4Mcs8"]);
9
+ if (i !== 0 && i !== 1 && i !== 2) throw SyntaxError("Invalid padding letter length");
10
+ let s = Array.from(e.matchAll(/.{1,4}/gu), (e) => e[0]).at(-1);
11
+ if (s == null) throw TypeError("unexpected");
12
+ let c = s.length;
13
+ if (c === 1) throw SyntaxError("Invalid last chunk length");
14
+ if (c !== 2 && c !== 3 && c !== 4) throw SyntaxError("unexpected");
15
+ switch (r) {
16
+ case "loose":
17
+ if (i === 0) {
18
+ for (; e.length & 3;) e += "=";
19
+ break;
20
+ }
21
+ if (c !== 4) throw SyntaxError("Invalid padding letter length");
22
+ break;
23
+ case "strict": {
24
+ if (c !== 4) throw SyntaxError("Invalid last chunk length");
25
+ if (i === 0) break;
26
+ if (i === 1) {
27
+ let e = s.at(-2);
28
+ if (!e || !o.includes(e)) throw SyntaxError("2 padding bits must be 0");
29
+ break;
30
+ }
31
+ let e = s.at(-3);
32
+ if (!e || !a.includes(e)) throw SyntaxError("4 padding bits must be 0");
33
+ break;
34
+ }
35
+ case "stop-before-partial": {
36
+ let t = -(c & 3);
37
+ e = e.slice(0, t);
38
+ break;
39
+ }
40
+ }
41
+ return n === "base64url" && (e = e.replaceAll("-", "+").replaceAll("_", "/")), Uint8Array.from(atob(e), (e) => e.charCodeAt(0));
14
42
  }
15
43
  //#endregion
16
- export { t as fromBase64, r as fromBase64URL, e as toBase64, n as toBase64URL };
44
+ export { t as fromBase64, e as toBase64 };
@@ -0,0 +1,54 @@
1
+ //#region lib/basejuso_table.ts
2
+ var e;
3
+ function t() {
4
+ let e = Array.from("刓劚加勸厍厵吗囖囜圞圽壪夷奲妏孏孕孿宇寷尼屭岆巚帄幱庅廳弗彏彸忂忥戇戋戵扷攮攸斆斻旟旴曯有朧杤欟欣歡歼殲毞氎氕氳汴灪炅爩牟犫犸玃玝瓛瓨甗电疊疟癵癿皭盁盭盼矚砆礹祁禷秈穳穹竊竍竸笏籲籺糷紑纞罔羉羍羼翁耀耓耲耷聾肝臢舣艭芲虌蚇蠿衳襽覎觀觔觿記讟豗豷豺貜貤贜赴趲跁躪躬軉軓轥迂邐邛酈酐釅釺钄閆闧阥隵隻雧雮靐靮韊韍韬頇顴颪飍飦饢馷驫骪髗髣鬤魫鱻鳷鸞麁麤黓黸齔齾".matchAll(/../g)).flatMap((e) => {
5
+ let t = e[0].charCodeAt(0), n = e[0].charCodeAt(1), r = [...Array(n - t + 1)].map((e, n) => t + n);
6
+ return [...String.fromCharCode(...r)];
7
+ }), t = Object.fromEntries(e.map((e, t) => [e, t]));
8
+ return Object.setPrototypeOf(t, null), [Object.freeze(e), Object.freeze(t)];
9
+ }
10
+ function n() {
11
+ return e ??= t(), e[0];
12
+ }
13
+ function r() {
14
+ return e ??= t(), e[1];
15
+ }
16
+ //#endregion
17
+ //#region lib/basejuso.ts
18
+ var i = 14, a = 8, o = "乙";
19
+ function s(e) {
20
+ let t = 0, r = 0, s = "", c = n();
21
+ for (let n of e) for (let e = 0; e < a; e++) {
22
+ let o = n >>> a - 1 - e & 1;
23
+ if (t = t << 1 | o, r++, r === i) {
24
+ let e = c.at(t);
25
+ if (e == null) throw TypeError("unexpected");
26
+ s += e, t = 0, r = 0;
27
+ }
28
+ }
29
+ if (r > 0) {
30
+ t <<= i - r;
31
+ let e = c.at(t);
32
+ if (e == null) throw TypeError("unexpected");
33
+ s += e, r < a && (s += o);
34
+ }
35
+ return s;
36
+ }
37
+ function c(e) {
38
+ let t = r(), n = 0, s = 0, c = [];
39
+ for (let r of e) {
40
+ if (r === o) {
41
+ c.pop();
42
+ continue;
43
+ }
44
+ let e = t[r];
45
+ if (e == null) throw TypeError("unexpected");
46
+ for (let t = 0; t < i; t++) {
47
+ let r = e >>> i - 1 - t & 1;
48
+ n = n << 1 | r, s++, s === a && (c.push(n), n = 0, s = 0);
49
+ }
50
+ }
51
+ return Uint8Array.from(c);
52
+ }
53
+ //#endregion
54
+ export { s as n, c as t };
@@ -0,0 +1,2 @@
1
+ export declare function toBaseJuso(bin: Uint8Array): string;
2
+ export declare function fromBaseJuso(baseJuso: string): Uint8Array<ArrayBuffer>;
@@ -0,0 +1,2 @@
1
+ import { n as e, t } from "./basejuso-BYqhXFJC.js";
2
+ export { t as fromBaseJuso, e as toBaseJuso };
@@ -0,0 +1,2 @@
1
+ export declare function getETable(): readonly string[];
2
+ export declare function getDTable(): Readonly<Record<string, number>>;
@@ -1,6 +1,6 @@
1
1
  import { AsyncWorker as e } from "./async_worker.js";
2
2
  //#region lib/bpsw_worker.ts?worker&inline
3
- var t = "(function(){function e(e,t){t<0n&&(t*=-1n);let n=e%t;return n<0n?n+t:n}function t(t,n,r){if(r<1n)throw RangeError(\"`mod` must be positive\");if(n<0n)throw RangeError(\"`power` must not be negative\");if(t=e(t,r),r===1n)return 0n;if(t%r===1n||t%r===0n)return t;if(t===r-1n)return n&1n?r-1n:1n;let i=1n;for(;n>0n;)n&1n&&(i=i*t%r),t=t*t%r,n>>=1n;return i}function n(e,t){if(t<1n||t%2n==0n)throw RangeError(\"`n` is out of range\");for(;e<0n;)e+=t;e%=t;let n=1n;for(;e!==0n;){for(;e%2n==0n;){e/=2n;let r=t%8n;(r===3n||r===5n)&&(n*=-1n)}[e,t]=[t,e],e%4n==3n&&t%4n==3n&&(n*=-1n),e%=t}return t===1n?n:0n}function r(e){if(e<0n)return!1;if(e===0n)return!0;let t=1n,n=e;for(;t+1n<n;){let r=(t+n)/2n;r*r<e?t=r:n=r}return e===t**2n||e===(t+1n)**2n}function i(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;let n=e-1n,r=0n;for(;n%2n==0n;)n>>=1n,r+=1n;let[i,a]=[n,r],o=t(2n,i,e);if(o===1n)return!0;for(let t=0n;t<a;t++){if(o===e-1n)return!0;o=o*o%e}return!1}function a(e){let t=5n;for(;;){let i=n(t,e);if(i===-1n)return t;if(i===0n||(t=t>0n?-(t+2n):-(t-2n),t===-15n&&r(e)))return null}}function o(t,n){if((n&1n)==0n)throw Error(\"`n` is not odd\");return(t&1n)==1n?e(t+n>>1n,n):e(t>>1n,n)}function s(t,n,r,i){let a=1n,s=r,c=t.toString(2).slice(1);for(let t of c)[a,s]=[e(a*s,n),o(s*s+i*a*a,n)],t===`1`&&([a,s]=[o(r*a+s,n),o(i*a+r*s,n)]);return[a,s]}function c(n,r,i,a){if(n%2n!=1n)throw RangeError(\"`n` must be odd\");let o=n+1n,c=0n;for(;o%2n==0n;)o>>=1n,c+=1n;let[l,u]=s(o,n,i,r),d=u;if(l===0n)return!0;a=t(a,o,n);for(let r=0n;r<c;r++){if(d===0n)return!0;d=e(d*d-2n*a,n),a=t(a,2n,n)}return!1}function l(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;for(let t of[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n])if(e%t===0n)return e===t;if(!i(e))return!1;let t=a(e);return t==null?!1:c(e,t,1n,(1n-t)/4n)}let u=()=>typeof window>`u`&&typeof self<`u`&&`importScripts`in self;function d(e,t){if(!u())throw Error(`this function must be used in Worker`);let n={success:!0,value:e,id:t};self.postMessage(n)}function f(e,t){if(!u())throw Error(`this function must be used in Worker`);let n={success:!1,error:e,id:t};self.postMessage(n)}let p=e=>{if(e==null)return;let t=`${e}`;return t===`[object Object]`?JSON.stringify(e):t};globalThis.onmessage=e=>{let{value:t,id:n}=e.data;try{d(l(t),n)}catch(e){if(e instanceof Error){let{name:t,message:r,stack:i,cause:a}=e;f({name:t,message:r,stack:i,cause:p(a)},n)}else f({name:`BPSWError`,message:`unidentified error`,cause:p(e)},n)}}})();", n = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", t], { type: "text/javascript;charset=utf-8" });
3
+ var t = "(function(){function e(e,t){t<0n&&(t*=-1n);let n=e%t;return n<0n?n+t:n}function t(t,n,r){if(r<1n)throw RangeError(\"`mod` must be positive\");if(n<0n)throw RangeError(\"`power` must not be negative\");if(t=e(t,r),r===1n)return 0n;if(t%r===1n||t%r===0n)return t;if(t===r-1n)return n&1n?r-1n:1n;let i=1n;for(;n>0n;)n&1n&&(i=i*t%r),t=t*t%r,n>>=1n;return i}function n(e,t){if(t<1n||t%2n==0n)throw RangeError(\"`n` is out of range\");for(;e<0n;)e+=t;e%=t;let n=1n;for(;e!==0n;){for(;e%2n==0n;){e/=2n;let r=t%8n;(r===3n||r===5n)&&(n*=-1n)}[e,t]=[t,e],e%4n==3n&&t%4n==3n&&(n*=-1n),e%=t}return t===1n?n:0n}function r(e){if(e<0n)return!1;if(e===0n)return!0;let t=1n,n=e;for(;t+1n<n;){let r=(t+n)/2n;r*r<e?t=r:n=r}return e===t**2n||e===(t+1n)**2n}function i(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;let n=e-1n,r=0n;for(;n%2n==0n;)n>>=1n,r+=1n;let[i,a]=[n,r],o=t(2n,i,e);if(o===1n)return!0;for(let t=0n;t<a;t++){if(o===e-1n)return!0;o=o*o%e}return!1}function a(e){let t=5n;for(;;){let i=n(t,e);if(i===-1n)return t;if(i===0n||(t=t>0n?-(t+2n):-(t-2n),t===-15n&&r(e)))return null}}function o(t,n){if((n&1n)==0n)throw Error(\"`n` is not odd\");return(t&1n)==1n?e(t+n>>1n,n):e(t>>1n,n)}function s(t,n,r,i){let a=1n,s=r,c=t.toString(2).slice(1);for(let t of c)[a,s]=[e(a*s,n),o(s*s+i*a*a,n)],t===`1`&&([a,s]=[o(r*a+s,n),o(i*a+r*s,n)]);return[a,s]}function c(n,r,i,a){if(n%2n!=1n)throw RangeError(\"`n` must be odd\");let o=n+1n,c=0n;for(;o%2n==0n;)o>>=1n,c+=1n;let[l,u]=s(o,n,i,r),d=u;if(l===0n)return!0;a=t(a,o,n);for(let r=0n;r<c;r++){if(d===0n)return!0;d=e(d*d-2n*a,n),a=t(a,2n,n)}return!1}function l(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;for(let t of[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n])if(e%t===0n)return e===t;if(!i(e))return!1;let t=a(e);return t==null?!1:c(e,t,1n,(1n-t)/4n)}let u=()=>typeof window>`u`&&typeof self<`u`&&`importScripts`in self;function d(e,t){if(!u())throw Error(`This function must be used in Worker`);let n={success:!0,value:e,id:t};self.postMessage(n)}function f(e,t){if(!u())throw Error(`This function must be used in Worker`);let n={success:!1,error:e,id:t};self.postMessage(n)}let p=e=>{if(e==null)return;let t=`${e}`;return t===`[object Object]`?JSON.stringify(e):t};globalThis.onmessage=e=>{let{value:t,id:n}=e.data;try{d(l(t),n)}catch(e){if(e instanceof Error){let{name:t,message:r,stack:i,cause:a}=e;f({name:t,message:r,stack:i,cause:p(a)},n)}else f({name:`BPSWError`,message:`unidentified error`,cause:p(e)},n)}}})();", n = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", t], { type: "text/javascript;charset=utf-8" });
4
4
  function r(e) {
5
5
  let r;
6
6
  try {
@@ -17,7 +17,7 @@ function r(e) {
17
17
  //#region lib/bpsw_worker_wrap.ts
18
18
  var i = null;
19
19
  function a() {
20
- return i ||= new e(new r({ name: "bpsw_worker" })), i;
20
+ return i ??= new e(new r({ name: "bpsw_worker" })), i;
21
21
  }
22
22
  //#endregion
23
23
  export { a as getWorker };
@@ -15,7 +15,7 @@ export declare function decompress(compressed: Uint8Array<ArrayBuffer>, format:
15
15
  /**
16
16
  * Compress string into Base64(URL)-encoded string
17
17
  * @param str
18
- * @param format
18
+ * @param format default: `deflate-raw`
19
19
  * @param encoding default: `base64url`
20
20
  * @returns
21
21
  */
@@ -23,7 +23,7 @@ export declare function compressString(str: string, format?: CompressionFormat,
23
23
  /**
24
24
  * Decompress Base64(URL)-encoded data
25
25
  * @param compressedString
26
- * @param format
26
+ * @param format default: `deflate-raw`
27
27
  * @param encoding default: `base64url`
28
28
  * @returns
29
29
  */
@@ -1,20 +1,23 @@
1
- import { fromBase64 as e, fromBase64URL as t, toBase64 as n, toBase64URL as r } from "./base64.js";
1
+ import { fromBase64 as e, toBase64 as t } from "./base64.js";
2
2
  //#region lib/compression.ts
3
- function i(e, t) {
3
+ function n(e, t) {
4
4
  let n = new Blob([e]).stream().pipeThrough(new CompressionStream(t));
5
5
  return new Response(n).bytes();
6
6
  }
7
- function a(e, t) {
7
+ function r(e, t) {
8
8
  let n = new Blob([e]).stream().pipeThrough(new DecompressionStream(t));
9
9
  return new Response(n).bytes();
10
10
  }
11
- async function o(e, t = "deflate-raw", i = "base64url") {
12
- let a = new Blob([e]).stream().pipeThrough(new CompressionStream(t)), o = await new Response(a).bytes();
13
- return i === "base64" ? n(o) : r(o);
11
+ async function i(e, n = "deflate-raw", r = "base64url") {
12
+ let i = new Blob([e]).stream().pipeThrough(new CompressionStream(n));
13
+ return t(await new Response(i).bytes(), {
14
+ alphabet: r,
15
+ omitPadding: r === "base64url"
16
+ });
14
17
  }
15
- function s(n, r = "deflate-raw", i = "base64url") {
16
- let a = i === "base64" ? e(n) : t(n), o = new Blob([a]).stream().pipeThrough(new DecompressionStream(r));
17
- return new Response(o).text();
18
+ function a(t, n = "deflate-raw", r = "base64url") {
19
+ let i = e(t, { alphabet: r }), a = new Blob([i]).stream().pipeThrough(new DecompressionStream(n));
20
+ return new Response(a).text();
18
21
  }
19
22
  //#endregion
20
- export { i as compress, o as compressString, a as decompress, s as decompressString };
23
+ export { n as compress, i as compressString, r as decompress, a as decompressString };
@@ -2,6 +2,7 @@ export * from './util';
2
2
  export * from './math';
3
3
  export * from './baillie_psw';
4
4
  export * from './base64';
5
+ export * from './base32768';
5
6
  export * from './compression';
6
7
  export * from './equality';
7
8
  export * from './fraction';
@@ -14,3 +15,4 @@ export * from './xoshiro_minimal';
14
15
  export * from './async_worker';
15
16
  export * from './async_worker_post';
16
17
  export * from './leb128';
18
+ export * from './basejuso';
package/dist/esm/index.js CHANGED
@@ -1,18 +1,20 @@
1
1
  import { AsyncWorker as e } from "./async_worker.js";
2
2
  import { postFailed as t, postSuccess as n } from "./async_worker_post.js";
3
- import { n as r, t as i } from "./mod_pow--lOK7jfy.js";
3
+ import { n as r, t as i } from "./mod_pow-C5090m6u.js";
4
4
  import { exEuclidean as a, factorial as o, isSquare as s, jacobiSymbol as c, rot32 as l, rot64 as u } from "./math.js";
5
5
  import { floatRng as d, getRandBIByBitLength as f, getRandBIByRange as p, getRndInt as m } from "./random.js";
6
6
  import { bailliePSW as h, bailliePSWAsync as g, getRandPrimeByBitLength as _, getRandPrimeByRange as v } from "./baillie_psw.js";
7
- import { fromBase64 as y, fromBase64URL as b, toBase64 as x, toBase64URL as S } from "./base64.js";
8
- import { compress as C, compressString as w, decompress as T, decompressString as E } from "./compression.js";
9
- import { isDeepStrictEqual as D, sameValueZero as O } from "./equality.js";
10
- import { Rational as k } from "./fraction.js";
11
- import { FixedUint8Array as A } from "./fixed_array.js";
12
- import { decodeLEB128 as j, encodeLEB128 as M } from "./leb128.js";
13
- import { NamedError as N } from "./named_error.js";
14
- import { fromOct as P, toOct as F } from "./oct.js";
15
- import { PCGMinimal as I } from "./pcg_minimal.js";
16
- import { a as L, c as R, d as z, i as B, l as V, n as H, o as U, r as W, s as G, t as K, u as q } from "./util-f4z6xA0b.js";
17
- import { XoshiroMinimal as J } from "./xoshiro_minimal.js";
18
- export { e as AsyncWorker, A as FixedUint8Array, N as NamedError, I as PCGMinimal, k as Rational, J as XoshiroMinimal, h as bailliePSW, g as bailliePSWAsync, C as compress, w as compressString, K as createWorker, j as decodeLEB128, H as decodeRFC3986URIComponent, T as decompress, E as decompressString, M as encodeLEB128, W as encodeRFC3986URIComponent, a as exEuclidean, o as factorial, d as floatRng, y as fromBase64, b as fromBase64URL, P as fromOct, B as getHash, f as getRandBIByBitLength, p as getRandBIByRange, _ as getRandPrimeByBitLength, v as getRandPrimeByRange, m as getRndInt, L as getStringTag, D as isDeepStrictEqual, s as isSquare, c as jacobiSymbol, U as lazify, i as modPow, G as nullableStrictAt, t as postFailed, n as postSuccess, r as residue, l as rot32, u as rot64, O as sameValueZero, R as setTimeoutPromise, V as sleepSort, q as strictAt, x as toBase64, S as toBase64URL, F as toOct, z as withResolvers };
7
+ import { fromBase64 as y, toBase64 as b } from "./base64.js";
8
+ import { n as x, t as S } from "./base32768-BqNkkJ-a.js";
9
+ import { n as C, t as w } from "./basejuso-BYqhXFJC.js";
10
+ import { compress as T, compressString as E, decompress as D, decompressString as O } from "./compression.js";
11
+ import { isDeepStrictEqual as k, sameValueZero as A } from "./equality.js";
12
+ import { Rational as j } from "./fraction.js";
13
+ import { FixedUint8Array as M } from "./fixed_array.js";
14
+ import { decodeLEB128 as N, encodeLEB128 as P } from "./leb128.js";
15
+ import { NamedError as F } from "./named_error.js";
16
+ import { fromOct as I, toOct as L } from "./oct.js";
17
+ import { PCGMinimal as R } from "./pcg_minimal.js";
18
+ import { a as z, c as B, i as V, l as H, n as U, o as W, r as G, s as K, t as q, u as J } from "./util-Cv7ElkC6.js";
19
+ import { XoshiroMinimal as Y } from "./xoshiro_minimal.js";
20
+ export { e as AsyncWorker, M as FixedUint8Array, F as NamedError, R as PCGMinimal, j as Rational, Y as XoshiroMinimal, h as bailliePSW, g as bailliePSWAsync, T as compress, E as compressString, q as createWorker, N as decodeLEB128, U as decodeRFC3986URIComponent, D as decompress, O as decompressString, P as encodeLEB128, G as encodeRFC3986URIComponent, a as exEuclidean, o as factorial, d as floatRng, S as fromBase32768, y as fromBase64, w as fromBaseJuso, I as fromOct, V as getHash, f as getRandBIByBitLength, p as getRandBIByRange, _ as getRandPrimeByBitLength, v as getRandPrimeByRange, m as getRndInt, z as getStringTag, k as isDeepStrictEqual, s as isSquare, c as jacobiSymbol, i as modPow, W as nullableStrictAt, t as postFailed, n as postSuccess, r as residue, l as rot32, u as rot64, A as sameValueZero, K as setTimeoutPromise, B as sleepSort, H as strictAt, x as toBase32768, b as toBase64, C as toBaseJuso, L as toOct, J as withResolvers };
package/dist/esm/math.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./mod_pow--lOK7jfy.js";
1
+ import { n as e, t } from "./mod_pow-C5090m6u.js";
2
2
  //#region lib/math.ts
3
3
  function n(e, t) {
4
4
  if (e === 0n && t === 0n) return {
package/dist/esm/oct.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Converts `Uint8Array` into an octal string \
3
- * An array length of input must be multiples of 3
3
+ * Array length of input must be multiples of 3
4
4
  * @param bin a binary array
5
5
  * @returns
6
6
  */
7
7
  export declare function toOct(bin: Uint8Array): string;
8
8
  /**
9
9
  * Constructs `Uint8Array` from octal string \
10
- * A string length must be multiples of 8
10
+ * String length must be multiples of 8
11
11
  * @param oct octal string
12
12
  */
13
13
  export declare function fromOct(oct: string): Uint8Array<ArrayBuffer>;
package/dist/esm/oct.js CHANGED
@@ -1,25 +1,25 @@
1
1
  //#region lib/oct.ts
2
2
  function e(e) {
3
- if (e.length % 3 != 0) throw Error("The array length of input must be multiples of 3");
4
- let t = e.length / 3;
5
- return Array.from({ length: t }, (t, n) => [
3
+ if (e.length % 3 != 0) throw SyntaxError("The array length of input must be multiples of 3");
4
+ return Uint32Array.from({ length: e.length / 3 }, (t, n) => [
6
5
  0,
7
6
  1,
8
7
  2
9
8
  ].reduce((t, r) => t | (e[3 * n + r] ?? 0) << 16 - 8 * r, 0)).reduce((e, t) => e + t.toString(8).padStart(8, "0"), "");
10
9
  }
11
10
  function t(e) {
12
- if (e.length & 7) throw Error("A string length must be multiples of 8");
13
- let t = e.matchAll(/.{8}/g), n = Array.from(t, (e) => {
14
- let t = Number.parseInt(e[0], 8);
15
- if (Number.isNaN(t)) throw TypeError("Invalid input");
16
- return [
11
+ if (e.length & 7) throw SyntaxError("A string length must be multiples of 8");
12
+ let t = e.length >>> 3, n = new Uint8Array(3 * t);
13
+ return Array.from(e.matchAll(/.{8}/g)).forEach((e, t) => {
14
+ let r = Number.parseInt(e[0], 8);
15
+ if (!Number.isFinite(r)) throw SyntaxError(`Invalid input: ${e[0]}`);
16
+ let i = [
17
17
  0,
18
18
  1,
19
19
  2
20
- ].map((e) => t >>> 16 - 8 * e & 255);
21
- }).flat();
22
- return Uint8Array.from(n);
20
+ ].map((e) => r >>> 16 - 8 * e & 255);
21
+ n.set(i, 3 * t);
22
+ }), n;
23
23
  }
24
24
  //#endregion
25
25
  export { t as fromOct, e as toOct };
@@ -44,14 +44,14 @@ var t = [9600629759793949339n, 15726070495360670683n], n = 6364136223846793005n,
44
44
  return;
45
45
  }
46
46
  let i = Uint32Array.from([this.getRandU32()]), a = Math.min(n, 4);
47
- e.enqueue(new Uint8Array(i.buffer, 0, a)), n -= a, t = setTimeout(r, 20);
47
+ e.enqueue(new Uint8Array(i.buffer, 0, a)), n -= a, t = setTimeout(r, 10);
48
48
  };
49
49
  t = setTimeout(r, 10);
50
50
  },
51
51
  cancel: (e) => {
52
52
  clearTimeout(t), console.log("stream is cancelled: ", e);
53
53
  }
54
- });
54
+ }, new ByteLengthQueuingStrategy({ highWaterMark: 1024 }));
55
55
  };
56
56
  };
57
57
  Object.defineProperty(i.prototype, Symbol.toStringTag, { value: r });
@@ -1,4 +1,4 @@
1
- import { t as e } from "./mod_pow--lOK7jfy.js";
1
+ import { t as e } from "./mod_pow-C5090m6u.js";
2
2
  //#region lib/random.ts
3
3
  function t(e) {
4
4
  if (e === 0n) return 64n;
@@ -1,13 +1,11 @@
1
1
  //#region lib/encoder.ts
2
- var e = null, t = null, n = 1e3 * 30;
3
- function r() {
4
- return e ||= new TextEncoder(), t != null && clearTimeout(t), t = setTimeout(() => {
5
- e = null, t = null;
6
- }, n), e;
2
+ var e;
3
+ function t() {
4
+ return e ??= new TextEncoder(), e;
7
5
  }
8
6
  //#endregion
9
7
  //#region lib/util.ts
10
- function i() {
8
+ function n() {
11
9
  let e, t;
12
10
  return {
13
11
  promise: new Promise((n, r) => {
@@ -17,24 +15,21 @@ function i() {
17
15
  reject: t
18
16
  };
19
17
  }
20
- function a(e) {
18
+ function r(e) {
21
19
  return Object.prototype.toString.call(e).slice(8, -1);
22
20
  }
23
- function o(e) {
24
- return (...t) => () => e(...t);
25
- }
26
- async function s(e, t) {
27
- let n = r().encode(e), i = await crypto.subtle.digest(t, n);
21
+ async function i(e, n) {
22
+ let r = t().encode(e), i = await crypto.subtle.digest(n, r);
28
23
  return new Uint8Array(i);
29
24
  }
30
- function c(e) {
25
+ function a(e) {
31
26
  return encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`);
32
27
  }
33
- function l(e) {
28
+ function o(e) {
34
29
  if (e.includes("+")) throw URIError("an input string must not include `+`");
35
30
  return decodeURIComponent(e);
36
31
  }
37
- function u(e, t) {
32
+ function s(e, t) {
38
33
  return new Promise((n, r) => {
39
34
  setTimeout(async () => {
40
35
  try {
@@ -45,16 +40,16 @@ function u(e, t) {
45
40
  }, t);
46
41
  });
47
42
  }
48
- function d(e, t) {
43
+ function c(e, t) {
49
44
  if (t < -e.length || t >= e.length) throw RangeError("`index` is out of range");
50
45
  return e.at(t);
51
46
  }
52
- function f(e, t) {
53
- let n = d(e, t);
47
+ function l(e, t) {
48
+ let n = c(e, t);
54
49
  if (n == null) throw TypeError("value is nullable");
55
50
  return n;
56
51
  }
57
- async function p(e) {
52
+ async function u(e) {
58
53
  let t = [], n = [];
59
54
  return e.forEach((e) => {
60
55
  let r = new Promise((n) => {
@@ -65,9 +60,9 @@ async function p(e) {
65
60
  n.push(r);
66
61
  }), await Promise.all(n), t;
67
62
  }
68
- function m(e, t) {
63
+ function d(e, t) {
69
64
  let n = `(()=>{${`self.onmessage=${e};`}${t ? `self.onerror=${t};` : ""}})();`.replace(/\s+/g, " "), r = new Blob([n], { type: "text/javascript;charset=UTF-8" }), i = URL.createObjectURL(r);
70
65
  return setTimeout(() => URL.revokeObjectURL(i), 1e3 * 60), new Worker(i);
71
66
  }
72
67
  //#endregion
73
- export { a, u as c, i as d, s as i, p as l, l as n, o, c as r, d as s, m as t, f as u };
68
+ export { r as a, u as c, i, l, o as n, c as o, a as r, s, d as t, n as u };
@@ -12,12 +12,6 @@ export declare function withResolvers<T>(): {
12
12
  * @returns
13
13
  */
14
14
  export declare function getStringTag(obj: unknown): string;
15
- /**
16
- * Makes a function lazy
17
- * @param func function
18
- * @returns lazified function
19
- */
20
- export declare function lazify<TArgs extends unknown[], TRet>(func: (...args: TArgs) => TRet): (...args: TArgs) => () => TRet;
21
15
  /**
22
16
  * Returns hash of a string
23
17
  * @param str string
package/dist/esm/util.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./util-f4z6xA0b.js";
2
- export { l as createWorker, a as decodeRFC3986URIComponent, s as encodeRFC3986URIComponent, r as getHash, e as getStringTag, o as lazify, c as nullableStrictAt, t as setTimeoutPromise, i as sleepSort, u as strictAt, n as withResolvers };
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./util-Cv7ElkC6.js";
2
+ export { c as createWorker, i as decodeRFC3986URIComponent, o as encodeRFC3986URIComponent, n as getHash, e as getStringTag, a as nullableStrictAt, s as setTimeoutPromise, t as sleepSort, r as strictAt, l as withResolvers };
@@ -1 +1 @@
1
- var UtilFns=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i=null,a=null,o=1e3*30;function s(){return i||=new TextEncoder,a!=null&&clearTimeout(a),a=setTimeout(()=>{i=null,a=null},o),i}function c(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function l(e){return Object.prototype.toString.call(e).slice(8,-1)}function ee(e){return(...t)=>()=>e(...t)}async function te(e,t){let n=s().encode(e),r=await crypto.subtle.digest(t,n);return new Uint8Array(r)}function u(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function ne(e){if(e.includes(`+`))throw URIError("an input string must not include `+`");return decodeURIComponent(e)}function re(e,t){return new Promise((n,r)=>{setTimeout(async()=>{try{n(await e())}catch(e){r(e)}},t)})}function d(e,t){if(t<-e.length||t>=e.length)throw RangeError("`index` is out of range");return e.at(t)}function ie(e,t){let n=d(e,t);if(n==null)throw TypeError(`value is nullable`);return n}async function ae(e){let t=[],n=[];return e.forEach(e=>{let r=new Promise(n=>{setTimeout(()=>{t.push(e),n()},e)});n.push(r)}),await Promise.all(n),t}function oe(e,t){let n=`(()=>{${`self.onmessage=${e};`}${t?`self.onerror=${t};`:``}})();`.replace(/\s+/g,` `),r=new Blob([n],{type:`text/javascript;charset=UTF-8`}),i=URL.createObjectURL(r);return setTimeout(()=>URL.revokeObjectURL(i),1e3*60),new Worker(i)}function f(e,t){t<0n&&(t*=-1n);let n=e%t;return n<0n?n+t:n}function p(e,t,n){if(n<1n)throw RangeError("`mod` must be positive");if(t<0n)throw RangeError("`power` must not be negative");if(e=f(e,n),n===1n)return 0n;if(e%n===1n||e%n===0n)return e;if(e===n-1n)return t&1n?n-1n:1n;let r=1n;for(;t>0n;)t&1n&&(r=r*e%n),e=e*e%n,t>>=1n;return r}function m(e,t){if(e===0n&&t===0n)return{x:0n,y:0n,gcd:0n};if(e===0n)return t>0n?{x:0n,y:-1n,gcd:t}:{x:0n,y:1n,gcd:-t};if(t===0n)return e>0n?{x:1n,y:0n,gcd:e}:{x:-1n,y:0n,gcd:-e};let[n,r,i]=[1n,0n,e],[a,o,s]=[0n,-1n,t];for(;;){let e=i/s,t=i-e*s;if(t===0n)break;[n,a]=[a,n-e*a],[r,o]=[o,r-e*o],[i,s]=[s,t]}return s<0n&&(a*=-1n,o*=-1n,s*=-1n),{x:a,y:o,gcd:s}}function h(e,t){if(e>=t)return 1n;let n=BigInt((t-2n).toString(2).length),r=(t-e)/2n;if(n*r<63n){let n=e;for(let r=e+2n;r<t;r+=2n)n*=r;return n}let i=e+r|1n;return h(e,i)*h(i,t)}function g(e){let t=3n,n=1n,r=1n,i=BigInt(e.toString(2).length)-1n;for(let a=i-1n;a>-1n;--a){let i=(e>>a)+1n|1n;r*=h(t,i),t=i,n*=r}return n}function se(e){if(e<0n)throw RangeError(`'n' must be non-negative`);if(e===0n)return 1n;let t=e-BigInt(e.toString(2).match(/1/g)?.length??0);return g(e)<<t}function _(e,t){return(e>>>(t&31)|e<<(-t&31))>>>0}function v(e,t){return BigInt.asUintN(64,e>>(t&63n)|e<<(-t&63n))}function y(e,t){if(t<1n||t%2n==0n)throw RangeError("`n` is out of range");for(;e<0n;)e+=t;e%=t;let n=1n;for(;e!==0n;){for(;e%2n==0n;){e/=2n;let r=t%8n;(r===3n||r===5n)&&(n*=-1n)}[e,t]=[t,e],e%4n==3n&&t%4n==3n&&(n*=-1n),e%=t}return t===1n?n:0n}function b(e){if(e<0n)return!1;if(e===0n)return!0;let t=1n,n=e;for(;t+1n<n;){let r=(t+n)/2n;r*r<e?t=r:n=r}return e===t**2n||e===(t+1n)**2n}function x(e){if(e===0n)return 64n;let t=0n;for(;e>0n&&!(e&1n);)++t,e>>=1n;return BigInt.asUintN(64,t)}function S(e,t){let n=0n,r=e&2047n,i=1023n-1n;if(r>0n)return i-=x(r),i;i-=11n;for(let e=0;e<1e5;++e){let e=t();if(e>0n)return i-=x(e),i;if(i-=64n,i<n)return n}throw Error(`loop exceeded limit`)}function ce(e){let t=()=>BigInt.asUintN(64,e()),n=()=>{let e=t(),n=BigInt.asUintN(52,e>>11n),r=n===0n&&e>>63n==1n?S(e,t)+1n:S(e,t),{buffer:i}=BigUint64Array.from([r<<52n|n]),a=new Float64Array(i)[0];if(a==null)throw Error(`unexpected`);return a};return()=>{for(let e=0;e<1e5;++e){let e=n();if(e<1)return e}throw Error(`Loop limit exceeded`)}}function C(e,t=!1){if(!Number.isFinite(e))throw RangeError("`length` is not a valid number");if(e<=0)throw RangeError("`length` must be positive");let n=Math.ceil(e/8),r=crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>e+t.toString(2).padStart(8,`0`),``).slice(0,e);return t&&(r=r.replace(/^\d/,`1`)),BigInt(`0b`+r)}function w(e,t){if(e>=t)throw RangeError("`min` must be smaller than `max`");let n=t-e,r=n.toString(2).length;return e+(()=>{for(let e=0;e<1e5;e++){let e=C(r);if(e>=p(2n,BigInt(r),n))return e%n}throw Error(`Failed to generate a random bigint`)})()}function le(e,t){return Math.floor(Math.random()*(t-e)+e)}var T,E,D,O,k,A=n((()=>{T=`AsyncWorker`,E=1n<<128n,D=0n,O=()=>{let e=`${D++}`;return D===E&&(D=0n),e},k=class{static name=T;#e;constructor(e){this.#e=e}postMessage=(e,t)=>new Promise((n,r)=>{let i=O(),a=new AbortController,{signal:o}=a;this.#e.addEventListener(`message`,e=>{let t=e.data;t.id===i&&(a.abort(),t.success?n(t.value):r(t.error))},{signal:o}),this.#e.addEventListener(`error`,e=>{a.abort(),r(e.error)},{signal:o});let s={value:e,id:i};this.#e.postMessage(s,t)})},Object.defineProperty(k.prototype,Symbol.toStringTag,{value:T,enumerable:!0})}));function ue(e){let t;try{if(t=M&&(self.URL||self.webkitURL).createObjectURL(M),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(j),{name:e?.name})}}var j,M,de=n((()=>{j='(function(){function e(e,t){t<0n&&(t*=-1n);let n=e%t;return n<0n?n+t:n}function t(t,n,r){if(r<1n)throw RangeError("`mod` must be positive");if(n<0n)throw RangeError("`power` must not be negative");if(t=e(t,r),r===1n)return 0n;if(t%r===1n||t%r===0n)return t;if(t===r-1n)return n&1n?r-1n:1n;let i=1n;for(;n>0n;)n&1n&&(i=i*t%r),t=t*t%r,n>>=1n;return i}function n(e,t){if(t<1n||t%2n==0n)throw RangeError("`n` is out of range");for(;e<0n;)e+=t;e%=t;let n=1n;for(;e!==0n;){for(;e%2n==0n;){e/=2n;let r=t%8n;(r===3n||r===5n)&&(n*=-1n)}[e,t]=[t,e],e%4n==3n&&t%4n==3n&&(n*=-1n),e%=t}return t===1n?n:0n}function r(e){if(e<0n)return!1;if(e===0n)return!0;let t=1n,n=e;for(;t+1n<n;){let r=(t+n)/2n;r*r<e?t=r:n=r}return e===t**2n||e===(t+1n)**2n}function i(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;let n=e-1n,r=0n;for(;n%2n==0n;)n>>=1n,r+=1n;let[i,a]=[n,r],o=t(2n,i,e);if(o===1n)return!0;for(let t=0n;t<a;t++){if(o===e-1n)return!0;o=o*o%e}return!1}function a(e){let t=5n;for(;;){let i=n(t,e);if(i===-1n)return t;if(i===0n||(t=t>0n?-(t+2n):-(t-2n),t===-15n&&r(e)))return null}}function o(t,n){if((n&1n)==0n)throw Error("`n` is not odd");return(t&1n)==1n?e(t+n>>1n,n):e(t>>1n,n)}function s(t,n,r,i){let a=1n,s=r,c=t.toString(2).slice(1);for(let t of c)[a,s]=[e(a*s,n),o(s*s+i*a*a,n)],t===`1`&&([a,s]=[o(r*a+s,n),o(i*a+r*s,n)]);return[a,s]}function c(n,r,i,a){if(n%2n!=1n)throw RangeError("`n` must be odd");let o=n+1n,c=0n;for(;o%2n==0n;)o>>=1n,c+=1n;let[l,u]=s(o,n,i,r),d=u;if(l===0n)return!0;a=t(a,o,n);for(let r=0n;r<c;r++){if(d===0n)return!0;d=e(d*d-2n*a,n),a=t(a,2n,n)}return!1}function l(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;for(let t of[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n])if(e%t===0n)return e===t;if(!i(e))return!1;let t=a(e);return t==null?!1:c(e,t,1n,(1n-t)/4n)}let u=()=>typeof window>`u`&&typeof self<`u`&&`importScripts`in self;function d(e,t){if(!u())throw Error(`this function must be used in Worker`);let n={success:!0,value:e,id:t};self.postMessage(n)}function f(e,t){if(!u())throw Error(`this function must be used in Worker`);let n={success:!1,error:e,id:t};self.postMessage(n)}let p=e=>{if(e==null)return;let t=`${e}`;return t===`[object Object]`?JSON.stringify(e):t};globalThis.onmessage=e=>{let{value:t,id:n}=e.data;try{d(l(t),n)}catch(e){if(e instanceof Error){let{name:t,message:r,stack:i,cause:a}=e;f({name:t,message:r,stack:i,cause:p(a)},n)}else f({name:`BPSWError`,message:`unidentified error`,cause:p(e)},n)}}})();',M=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,j],{type:`text/javascript;charset=utf-8`})})),fe=r({getWorker:()=>pe});function pe(){return N||=new k(new ue({name:`bpsw_worker`})),N}var N,me=n((()=>{A(),de(),N=null}));function he(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;let t=e-1n,n=0n;for(;t%2n==0n;)t>>=1n,n+=1n;let[r,i]=[t,n],a=p(2n,r,e);if(a===1n)return!0;for(let t=0n;t<i;t++){if(a===e-1n)return!0;a=a*a%e}return!1}function P(e){let t=5n;for(;;){let n=y(t,e);if(n===-1n)return t;if(n===0n||(t=t>0n?-(t+2n):-(t-2n),t===-15n&&b(e)))return null}}function F(e,t){if((t&1n)==0n)throw Error("`n` is not odd");return(e&1n)==1n?f(e+t>>1n,t):f(e>>1n,t)}function I(e,t,n,r){let i=1n,a=n,o=e.toString(2).slice(1);for(let e of o)[i,a]=[f(i*a,t),F(a*a+r*i*i,t)],e===`1`&&([i,a]=[F(n*i+a,t),F(r*i+n*a,t)]);return[i,a]}function L(e,t,n,r){if(e%2n!=1n)throw RangeError("`n` must be odd");let i=e+1n,a=0n;for(;i%2n==0n;)i>>=1n,a+=1n;let[o,s]=I(i,e,n,t),c=s;if(o===0n)return!0;r=p(r,i,e);for(let t=0n;t<a;t++){if(c===0n)return!0;c=f(c*c-2n*r,e),r=p(r,2n,e)}return!1}function R(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;for(let t of[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n])if(e%t===0n)return e===t;if(!he(e))return!1;let t=P(e);return t==null?!1:L(e,t,1n,(1n-t)/4n)}function ge(e,t){if(t<2n)throw RangeError("`max` must be 2 or larger");for(let n=0;n<1e5;n++){let n=w(e,t);if(R(n))return n}throw Error(`no primes were found`)}function _e(e,t=!1){if(e<2)throw RangeError("`bitLength` must be 2 or larger");for(let n=0;n<1e5;n++){let n=C(e,t);if(R(n))return n}throw Error(`no primes were found`)}async function ve(e){let{getWorker:t}=await Promise.resolve().then(()=>(me(),fe));return t().postMessage(e)}function z(e){return btoa(e.reduce((e,t)=>e+String.fromCharCode(t),``))}function B(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function V(e){return z(e).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}function H(e){for(;e.length&3;)e+=`=`;return B(e.replaceAll(`-`,`+`).replaceAll(`_`,`/`))}function ye(e,t){let n=new Blob([e]).stream().pipeThrough(new CompressionStream(t));return new Response(n).bytes()}function be(e,t){let n=new Blob([e]).stream().pipeThrough(new DecompressionStream(t));return new Response(n).bytes()}async function xe(e,t=`deflate-raw`,n=`base64url`){let r=new Blob([e]).stream().pipeThrough(new CompressionStream(t)),i=await new Response(r).bytes();return n===`base64`?z(i):V(i)}function Se(e,t=`deflate-raw`,n=`base64url`){let r=n===`base64`?B(e):H(e),i=new Blob([r]).stream().pipeThrough(new DecompressionStream(t));return new Response(i).text()}function Ce(e,t){return[e].includes(t)}function U(e,t){if(typeof e!=typeof t)return!1;let n=Object.prototype.toString.call(e);if(n!==Object.prototype.toString.call(t))return!1;if(typeof e==`string`||typeof e==`bigint`||typeof e==`boolean`||typeof e==`symbol`||e==null)return e===t;if(typeof e==`number`)return e===t||e!==e&&t!==t;if(typeof e==`function`)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!U(e[n],t[n]))return!1;return!0}if(e instanceof Set&&t instanceof Set)return!!U([...e.values()],[...t.values()]);if(e instanceof Map&&t instanceof Map)return!(!U([...e.keys()],[...t.keys()])||!U([...e.values()],[...t.values()]));if(n===`[object Object]`){let n=e,r=t,i=Object.keys(n),a=Object.keys(r);for(let e of i){let t=a.find(t=>t===e);if(t==null)return!1;let[i,o]=[n[e],r[t]];if(!U(i,o))return!1}return!0}throw TypeError(`comparing these objects is unavailable: ${e}, ${t}`,{cause:[e,t]})}var W=`Rational`,G=class e{#e;#t;static name=W;constructor(e,t){t===0n?(this.#t=0n,this.#e=e===0n?0n:e>0n?1n:-1n):t>0n?(this.#e=e,this.#t=t):(this.#e=-e,this.#t=-t),this.#n()}static fromDecimal(t,n=5){if(Number.isNaN(t))return new e(0n,0n);if(Math.abs(t)===1/0)return new e(t>0?1n:-1n,0n);let r=t<0;r&&(t*=-1);let i=BigInt(Math.floor(t)),a=t-Number(i);if(a===0)return new e(r?-i:i,1n);t=1/a;let[o,s]=[1n,i],[c,l]=[0n,1n];for(;`${l}`.length<=n;){let n=BigInt(Math.floor(t)),i=t-Number(n);if([o,s]=[s,n*s+o],[c,l]=[l,n*l+c],i===0)return new e(r?-s:s,l);t=1/i}return new e(r?-o:o,c)}#n=()=>{let{gcd:e}=m(this.#e,this.#t);e!==0n&&(this.#e/=e,this.#t/=e)};minus=()=>new e(-this.#e,this.#t);inverse=()=>new e(this.#t,this.#e);add=t=>{let n=this.#t*t.#t;return new e(this.#e*t.#t+t.#e*this.#t,n)};substr=e=>this.add(e.minus());multiply=t=>{let n=this.#t*t.#t;return new e(this.#e*t.#e,n)};divide=e=>this.multiply(e.inverse());mediant=t=>{let n=this.#t+t.#t;return new e(this.#e+t.#e,n)};toDecimal=()=>Number(this.#e)/Number(this.#t);toString=()=>this.#e===0n&&this.#t===0n?`NaN`:this.#e===0n?`0`:this.#t===0n?this.#e<0n?`-Infinity`:`Infinity`:this.#t===1n?`${this.#e}`:`${this.#e}/${this.#t}`;valueOf=()=>this.toDecimal();toJSON=()=>({type:`Rational`,value:[`0x`+this.#e.toString(16),`0x`+this.#t.toString(16)]});static fromData(t){return new e(BigInt(t.value[0]),BigInt(t.value[1]))}static parse(t){let n=/^\s*(\d+)\s*\/\s*(\d+)\s*$/.exec(t);if(!n)throw Error(`cannot parse`);let r=n.at(1),i=n.at(2);if(!r||!i)throw Error(`cannot parse`);return new e(BigInt(r),BigInt(i))}};Object.defineProperty(G.prototype,Symbol.toStringTag,{value:W});var we={new:e=>new Uint8Array(e),fromBuffer:(e,t,n)=>new Uint8Array(e,t,n)},K=`NamedError`,q=class extends Error{static name=K;errName;name;constructor(e,t,n){super(t,n),this.errName=e,this.name=e}toJSON=()=>{let e=(()=>{let e=this.cause;if(e==null)return;let t=`${e}`;return t===`[object Object]`?JSON.stringify(e):t})(),{errName:t,message:n,stack:r}=this;return{name:t,message:n,stack:r,cause:e}}};Object.defineProperty(q.prototype,Symbol.toStringTag,{value:K});function Te(e){if(e.length%3!=0)throw Error(`The array length of input must be multiples of 3`);let t=e.length/3;return Array.from({length:t},(t,n)=>[0,1,2].reduce((t,r)=>t|(e[3*n+r]??0)<<16-8*r,0)).reduce((e,t)=>e+t.toString(8).padStart(8,`0`),``)}function Ee(e){if(e.length&7)throw Error(`A string length must be multiples of 8`);let t=e.matchAll(/.{8}/g),n=Array.from(t,e=>{let t=Number.parseInt(e[0],8);if(Number.isNaN(t))throw TypeError(`Invalid input`);return[0,1,2].map(e=>t>>>16-8*e&255)}).flat();return Uint8Array.from(n)}var De=[9600629759793949339n,15726070495360670683n],J=6364136223846793005n,Y=`PCGMinimal`,X=class{#e;static name=Y;constructor(e){if(e&&e[0]!=null&&e[1]!=null){let t=e[1]<<1n|1n;this.#e=BigUint64Array.from([e[0]+t,t]),this.#t()}else this.#e=BigUint64Array.from(De)}#t(){if(this.#e[0]==null||this.#e[1]==null)throw TypeError(`unexpected`);this.#e[0]=this.#e[0]*J+this.#e[1]}get#n(){if(this.#e[0]==null||this.#e[1]==null)throw TypeError(`unexpected`);let e=this.#e[0],t=Number(e>>59n);return _(Number(BigInt.asUintN(32,(e^e>>18n)>>27n)),t)}getRandU32=()=>(this.#t(),this.#n);getBoundedRandU32=e=>{let t=4294967296;if(e>t)throw RangeError("`bound` exceeded limit (2^32)");if(e<=0)throw RangeError(`'bound' must be positive`);let n=t%e;for(let t=0;t<1e5;++t){let t=this.getRandU32();if(t>=n)return t%e}throw Error(`exceeded loop limit`)};*genRandU32s(e,t){if(e<=0)throw RangeError(`'step' must be positive`);for(let n=0;n<e;n++)yield typeof t==`number`?this.getBoundedRandU32(t):this.getRandU32()}stream=e=>{let t,n=e;return new ReadableStream({start:e=>{let r=()=>{if(n<=0){e.close();return}let i=Uint32Array.from([this.getRandU32()]),a=Math.min(n,4);e.enqueue(new Uint8Array(i.buffer,0,a)),n-=a,t=setTimeout(r,20)};t=setTimeout(r,10)},cancel:e=>{clearTimeout(t),console.log(`stream is cancelled: `,e)}})}};Object.defineProperty(X.prototype,Symbol.toStringTag,{value:Y});var Oe=[13715198867125970446n,3333371893450545919n,5627726498316411518n,8467276975966080893n],Z=`XoshiroMinimal`,Q=class{bits=64;#e;static name=Z;constructor(e){if(e&&e[0]!=null&&e[1]!=null&&e[2]!=null&&e[3]!=null){if(this.#e=new BigUint64Array(4),this.#e[0]=e[0],this.#e[1]=e[1],this.#t(),this.#e[2]==null||this.#e[3]==null)throw TypeError(`unexpected`);this.#e[2]+=e[2],this.#e[3]+=e[3]}else this.#e=BigUint64Array.from(Oe)}#t(){if(this.#e[0]==null||this.#e[1]==null||this.#e[2]==null||this.#e[3]==null)throw TypeError(`unexpected`);let e=this.#e[1]<<17n;this.#e[2]^=this.#e[0],this.#e[3]^=this.#e[1],this.#e[1]^=this.#e[2],this.#e[0]^=this.#e[3],this.#e[2]^=e,this.#e[3]=v(this.#e[3],45n)}get value(){if(this.#e[0]==null||this.#e[3]==null)throw TypeError(`unexpected`);let e=v(this.#e[0]+this.#e[3],23n)+this.#e[0];return BigInt.asUintN(64,e)}getRandU64=()=>{let e=this.value;return this.#t(),e};getRandU32=()=>{let e=BigInt.asUintN(32,this.getRandU64());return Number(e)};getBoundedRandU64=e=>{let t=1n<<64n;if(e>t)throw RangeError("`bound` exceeded limit");if(e<=0n)throw RangeError("`bound` must be positive");let n=t%e;for(let t=0;t<1e5;++t){let t=this.getRandU64();if(t>=n)return t%e}throw Error(`exceeded loop limit`)};getBoundedRandU32=e=>{if(e>2**32)throw RangeError("`bound` exceeded limit");if(e<=0n)throw RangeError("`bound` must be positive");let t=this.getBoundedRandU64(BigInt(e));return Number(t)};*genRandU64s(e,t){if(e<=0)throw RangeError("`step` must be positive");for(let n=0;n<e;++n)yield t===void 0?this.getRandU64():this.getBoundedRandU64(t)}*genRandU32s(e,t){if(e<=0)throw RangeError("`step` must be positive");for(let n=0;n<e;++n)yield t===void 0?this.getRandU32():this.getBoundedRandU32(t)}};Object.defineProperty(Q.prototype,Symbol.toStringTag,{value:Z});var $=()=>typeof window>`u`&&typeof self<`u`&&`importScripts`in self;function ke(e,t){if(!$())throw Error(`this function must be used in Worker`);let n={success:!0,value:e,id:t};self.postMessage(n)}function Ae(e,t){if(!$())throw Error(`this function must be used in Worker`);let n={success:!1,error:e,id:t};self.postMessage(n)}function je(e){let t=[];for(;;){let n=Number(e&127n);e>>=7n;let r=n&64;if(e===0n&&r===0||e===-1n&&r!==0)return t.push(n),Uint8Array.from(t);t.push(n|128)}}function Me(e){let t=0n,n=0;for(let r of e)if(t|=BigInt(r&127)<<BigInt(n),n+=7,!(r&128))return BigInt.asIntN(n,t);return n+=7,BigInt.asIntN(n,t)}return A(),e.AsyncWorker=k,e.FixedUint8Array=we,e.NamedError=q,e.PCGMinimal=X,e.Rational=G,e.XoshiroMinimal=Q,e.bailliePSW=R,e.bailliePSWAsync=ve,e.compress=ye,e.compressString=xe,e.createWorker=oe,e.decodeLEB128=Me,e.decodeRFC3986URIComponent=ne,e.decompress=be,e.decompressString=Se,e.encodeLEB128=je,e.encodeRFC3986URIComponent=u,e.exEuclidean=m,e.factorial=se,e.floatRng=ce,e.fromBase64=B,e.fromBase64URL=H,e.fromOct=Ee,e.getHash=te,e.getRandBIByBitLength=C,e.getRandBIByRange=w,e.getRandPrimeByBitLength=_e,e.getRandPrimeByRange=ge,e.getRndInt=le,e.getStringTag=l,e.isDeepStrictEqual=U,e.isSquare=b,e.jacobiSymbol=y,e.lazify=ee,e.modPow=p,e.nullableStrictAt=d,e.postFailed=Ae,e.postSuccess=ke,e.residue=f,e.rot32=_,e.rot64=v,e.sameValueZero=Ce,e.setTimeoutPromise=re,e.sleepSort=ae,e.strictAt=ie,e.toBase64=z,e.toBase64URL=V,e.toOct=Te,e.withResolvers=c,e})({});
1
+ var UtilFns=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i;function a(){return i??=new TextEncoder,i}function o(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function s(e){return Object.prototype.toString.call(e).slice(8,-1)}async function c(e,t){let n=a().encode(e),r=await crypto.subtle.digest(t,n);return new Uint8Array(r)}function l(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function ee(e){if(e.includes(`+`))throw URIError("an input string must not include `+`");return decodeURIComponent(e)}function te(e,t){return new Promise((n,r)=>{setTimeout(async()=>{try{n(await e())}catch(e){r(e)}},t)})}function u(e,t){if(t<-e.length||t>=e.length)throw RangeError("`index` is out of range");return e.at(t)}function ne(e,t){let n=u(e,t);if(n==null)throw TypeError(`value is nullable`);return n}async function re(e){let t=[],n=[];return e.forEach(e=>{let r=new Promise(n=>{setTimeout(()=>{t.push(e),n()},e)});n.push(r)}),await Promise.all(n),t}function ie(e,t){let n=`(()=>{${`self.onmessage=${e};`}${t?`self.onerror=${t};`:``}})();`.replace(/\s+/g,` `),r=new Blob([n],{type:`text/javascript;charset=UTF-8`}),i=URL.createObjectURL(r);return setTimeout(()=>URL.revokeObjectURL(i),1e3*60),new Worker(i)}function d(e,t){t<0n&&(t*=-1n);let n=e%t;return n<0n?n+t:n}function f(e,t,n){if(n<1n)throw RangeError("`mod` must be positive");if(t<0n)throw RangeError("`power` must not be negative");if(e=d(e,n),n===1n)return 0n;if(e%n===1n||e%n===0n)return e;if(e===n-1n)return t&1n?n-1n:1n;let r=1n;for(;t>0n;)t&1n&&(r=r*e%n),e=e*e%n,t>>=1n;return r}function p(e,t){if(e===0n&&t===0n)return{x:0n,y:0n,gcd:0n};if(e===0n)return t>0n?{x:0n,y:-1n,gcd:t}:{x:0n,y:1n,gcd:-t};if(t===0n)return e>0n?{x:1n,y:0n,gcd:e}:{x:-1n,y:0n,gcd:-e};let[n,r,i]=[1n,0n,e],[a,o,s]=[0n,-1n,t];for(;;){let e=i/s,t=i-e*s;if(t===0n)break;[n,a]=[a,n-e*a],[r,o]=[o,r-e*o],[i,s]=[s,t]}return s<0n&&(a*=-1n,o*=-1n,s*=-1n),{x:a,y:o,gcd:s}}function m(e,t){if(e>=t)return 1n;let n=BigInt((t-2n).toString(2).length),r=(t-e)/2n;if(n*r<63n){let n=e;for(let r=e+2n;r<t;r+=2n)n*=r;return n}let i=e+r|1n;return m(e,i)*m(i,t)}function ae(e){let t=3n,n=1n,r=1n,i=BigInt(e.toString(2).length)-1n;for(let a=i-1n;a>-1n;--a){let i=(e>>a)+1n|1n;r*=m(t,i),t=i,n*=r}return n}function oe(e){if(e<0n)throw RangeError(`'n' must be non-negative`);if(e===0n)return 1n;let t=e-BigInt(e.toString(2).match(/1/g)?.length??0);return ae(e)<<t}function h(e,t){return(e>>>(t&31)|e<<(-t&31))>>>0}function g(e,t){return BigInt.asUintN(64,e>>(t&63n)|e<<(-t&63n))}function _(e,t){if(t<1n||t%2n==0n)throw RangeError("`n` is out of range");for(;e<0n;)e+=t;e%=t;let n=1n;for(;e!==0n;){for(;e%2n==0n;){e/=2n;let r=t%8n;(r===3n||r===5n)&&(n*=-1n)}[e,t]=[t,e],e%4n==3n&&t%4n==3n&&(n*=-1n),e%=t}return t===1n?n:0n}function v(e){if(e<0n)return!1;if(e===0n)return!0;let t=1n,n=e;for(;t+1n<n;){let r=(t+n)/2n;r*r<e?t=r:n=r}return e===t**2n||e===(t+1n)**2n}function y(e){if(e===0n)return 64n;let t=0n;for(;e>0n&&!(e&1n);)++t,e>>=1n;return BigInt.asUintN(64,t)}function b(e,t){let n=0n,r=e&2047n,i=1023n-1n;if(r>0n)return i-=y(r),i;i-=11n;for(let e=0;e<1e5;++e){let e=t();if(e>0n)return i-=y(e),i;if(i-=64n,i<n)return n}throw Error(`loop exceeded limit`)}function se(e){let t=()=>BigInt.asUintN(64,e()),n=()=>{let e=t(),n=BigInt.asUintN(52,e>>11n),r=n===0n&&e>>63n==1n?b(e,t)+1n:b(e,t),{buffer:i}=BigUint64Array.from([r<<52n|n]),a=new Float64Array(i)[0];if(a==null)throw Error(`unexpected`);return a};return()=>{for(let e=0;e<1e5;++e){let e=n();if(e<1)return e}throw Error(`Loop limit exceeded`)}}function x(e,t=!1){if(!Number.isFinite(e))throw RangeError("`length` is not a valid number");if(e<=0)throw RangeError("`length` must be positive");let n=Math.ceil(e/8),r=crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>e+t.toString(2).padStart(8,`0`),``).slice(0,e);return t&&(r=r.replace(/^\d/,`1`)),BigInt(`0b`+r)}function ce(e,t){if(e>=t)throw RangeError("`min` must be smaller than `max`");let n=t-e,r=n.toString(2).length;return e+(()=>{for(let e=0;e<1e5;e++){let e=x(r);if(e>=f(2n,BigInt(r),n))return e%n}throw Error(`Failed to generate a random bigint`)})()}function le(e,t){return Math.floor(Math.random()*(t-e)+e)}var S,C,w,T,E=n((()=>{S=`AsyncWorker`,C=0n,w=()=>`${C++}`,T=class{static name=S;#e;constructor(e){this.#e=e}postMessage=(e,t)=>new Promise((n,r)=>{let i=w(),a=new AbortController,{signal:o}=a;this.#e.addEventListener(`message`,e=>{let t=e.data;t.id===i&&(a.abort(),t.success?n(t.value):r(t.error))},{signal:o}),this.#e.addEventListener(`error`,e=>{a.abort(),r(e.error)},{signal:o});let s={value:e,id:i};this.#e.postMessage(s,t)})},Object.defineProperty(T.prototype,Symbol.toStringTag,{value:S,enumerable:!0})}));function ue(e){let t;try{if(t=O&&(self.URL||self.webkitURL).createObjectURL(O),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(D),{name:e?.name})}}var D,O,de=n((()=>{D='(function(){function e(e,t){t<0n&&(t*=-1n);let n=e%t;return n<0n?n+t:n}function t(t,n,r){if(r<1n)throw RangeError("`mod` must be positive");if(n<0n)throw RangeError("`power` must not be negative");if(t=e(t,r),r===1n)return 0n;if(t%r===1n||t%r===0n)return t;if(t===r-1n)return n&1n?r-1n:1n;let i=1n;for(;n>0n;)n&1n&&(i=i*t%r),t=t*t%r,n>>=1n;return i}function n(e,t){if(t<1n||t%2n==0n)throw RangeError("`n` is out of range");for(;e<0n;)e+=t;e%=t;let n=1n;for(;e!==0n;){for(;e%2n==0n;){e/=2n;let r=t%8n;(r===3n||r===5n)&&(n*=-1n)}[e,t]=[t,e],e%4n==3n&&t%4n==3n&&(n*=-1n),e%=t}return t===1n?n:0n}function r(e){if(e<0n)return!1;if(e===0n)return!0;let t=1n,n=e;for(;t+1n<n;){let r=(t+n)/2n;r*r<e?t=r:n=r}return e===t**2n||e===(t+1n)**2n}function i(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;let n=e-1n,r=0n;for(;n%2n==0n;)n>>=1n,r+=1n;let[i,a]=[n,r],o=t(2n,i,e);if(o===1n)return!0;for(let t=0n;t<a;t++){if(o===e-1n)return!0;o=o*o%e}return!1}function a(e){let t=5n;for(;;){let i=n(t,e);if(i===-1n)return t;if(i===0n||(t=t>0n?-(t+2n):-(t-2n),t===-15n&&r(e)))return null}}function o(t,n){if((n&1n)==0n)throw Error("`n` is not odd");return(t&1n)==1n?e(t+n>>1n,n):e(t>>1n,n)}function s(t,n,r,i){let a=1n,s=r,c=t.toString(2).slice(1);for(let t of c)[a,s]=[e(a*s,n),o(s*s+i*a*a,n)],t===`1`&&([a,s]=[o(r*a+s,n),o(i*a+r*s,n)]);return[a,s]}function c(n,r,i,a){if(n%2n!=1n)throw RangeError("`n` must be odd");let o=n+1n,c=0n;for(;o%2n==0n;)o>>=1n,c+=1n;let[l,u]=s(o,n,i,r),d=u;if(l===0n)return!0;a=t(a,o,n);for(let r=0n;r<c;r++){if(d===0n)return!0;d=e(d*d-2n*a,n),a=t(a,2n,n)}return!1}function l(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;for(let t of[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n])if(e%t===0n)return e===t;if(!i(e))return!1;let t=a(e);return t==null?!1:c(e,t,1n,(1n-t)/4n)}let u=()=>typeof window>`u`&&typeof self<`u`&&`importScripts`in self;function d(e,t){if(!u())throw Error(`This function must be used in Worker`);let n={success:!0,value:e,id:t};self.postMessage(n)}function f(e,t){if(!u())throw Error(`This function must be used in Worker`);let n={success:!1,error:e,id:t};self.postMessage(n)}let p=e=>{if(e==null)return;let t=`${e}`;return t===`[object Object]`?JSON.stringify(e):t};globalThis.onmessage=e=>{let{value:t,id:n}=e.data;try{d(l(t),n)}catch(e){if(e instanceof Error){let{name:t,message:r,stack:i,cause:a}=e;f({name:t,message:r,stack:i,cause:p(a)},n)}else f({name:`BPSWError`,message:`unidentified error`,cause:p(e)},n)}}})();',O=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,D],{type:`text/javascript;charset=utf-8`})})),fe=r({getWorker:()=>pe});function pe(){return k??=new T(new ue({name:`bpsw_worker`})),k}var k,me=n((()=>{E(),de(),k=null}));function he(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;let t=e-1n,n=0n;for(;t%2n==0n;)t>>=1n,n+=1n;let[r,i]=[t,n],a=f(2n,r,e);if(a===1n)return!0;for(let t=0n;t<i;t++){if(a===e-1n)return!0;a=a*a%e}return!1}function ge(e){let t=5n;for(;;){let n=_(t,e);if(n===-1n)return t;if(n===0n||(t=t>0n?-(t+2n):-(t-2n),t===-15n&&v(e)))return null}}function A(e,t){if((t&1n)==0n)throw Error("`n` is not odd");return(e&1n)==1n?d(e+t>>1n,t):d(e>>1n,t)}function _e(e,t,n,r){let i=1n,a=n,o=e.toString(2).slice(1);for(let e of o)[i,a]=[d(i*a,t),A(a*a+r*i*i,t)],e===`1`&&([i,a]=[A(n*i+a,t),A(r*i+n*a,t)]);return[i,a]}function ve(e,t,n,r){if(e%2n!=1n)throw RangeError("`n` must be odd");let i=e+1n,a=0n;for(;i%2n==0n;)i>>=1n,a+=1n;let[o,s]=_e(i,e,n,t),c=s;if(o===0n)return!0;r=f(r,i,e);for(let t=0n;t<a;t++){if(c===0n)return!0;c=d(c*c-2n*r,e),r=f(r,2n,e)}return!1}function j(e){if(e<=1n)return!1;if(e%2n==0n)return e===2n;for(let t of[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n])if(e%t===0n)return e===t;if(!he(e))return!1;let t=ge(e);return t==null?!1:ve(e,t,1n,(1n-t)/4n)}function ye(e,t){if(t<2n)throw RangeError("`max` must be 2 or larger");for(let n=0;n<1e5;n++){let n=ce(e,t);if(j(n))return n}throw Error(`no primes were found`)}function be(e,t=!1){if(e<2)throw RangeError("`bitLength` must be 2 or larger");for(let n=0;n<1e5;n++){let n=x(e,t);if(j(n))return n}throw Error(`no primes were found`)}async function xe(e){let{getWorker:t}=await Promise.resolve().then(()=>(me(),fe));return t().postMessage(e)}function M(e,t={}){let{alphabet:n=`base64`,omitPadding:r=!1}=t,i=btoa(e.reduce((e,t)=>e+String.fromCharCode(t),``));return n===`base64url`&&(i=i.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),r&&(i=i.replace(/=+$/,``)),i}function N(e,t={}){if(e=e.replace(/\s+/g,``),e===``)return new Uint8Array;let{alphabet:n=`base64`,lastChunkHandling:r=`loose`}=t,i=e.match(/=+$/)?.[0].length??0,a=[...`AQgw`],o=a.concat([...`EUk0IYo4Mcs8`]);if(i!==0&&i!==1&&i!==2)throw SyntaxError(`Invalid padding letter length`);let s=Array.from(e.matchAll(/.{1,4}/gu),e=>e[0]).at(-1);if(s==null)throw TypeError(`unexpected`);let c=s.length;if(c===1)throw SyntaxError(`Invalid last chunk length`);if(c!==2&&c!==3&&c!==4)throw SyntaxError(`unexpected`);switch(r){case`loose`:if(i===0){for(;e.length&3;)e+=`=`;break}if(c!==4)throw SyntaxError(`Invalid padding letter length`);break;case`strict`:{if(c!==4)throw SyntaxError(`Invalid last chunk length`);if(i===0)break;if(i===1){let e=s.at(-2);if(!e||!o.includes(e))throw SyntaxError(`2 padding bits must be 0`);break}let e=s.at(-3);if(!e||!a.includes(e))throw SyntaxError(`4 padding bits must be 0`);break}case`stop-before-partial`:{let t=-(c&3);e=e.slice(0,t);break}}return n===`base64url`&&(e=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)),Uint8Array.from(atob(e),e=>e.charCodeAt(0))}var P;function F(){let e=Array.from(`ƀƟȴʓҊҩӺԙԱՐՠտऄणഒറกภကဟ႞ႽაჯሃቂጘፗᎠᏟᐁᙠᚠᛟកសᠠᡟᢇᢦᢰᣯ⌫⏪⓫❊❶➵⟰⥯⨍⩬⩷⫖⫝⭜⮗ⱶⱾⳝㄅㄤㆠ㇟㐀ꑿꔀꗿꚠꛟ꜀ꝟꝱꞰ`.matchAll(/../g)).flatMap(e=>{let t=e[0].charCodeAt(0),n=e[0].charCodeAt(1),r=[...Array(n-t+1)].map((e,n)=>t+n);return[...String.fromCharCode(...r)]}),t=Object.fromEntries(e.map((e,t)=>[e,t]));return Object.setPrototypeOf(t,null),[Object.freeze(e),Object.freeze(t)]}function Se(){return P??=F(),P[0]}function Ce(){return P??=F(),P[1]}var I=15,L=8,R=`X`;function we(e){let t=Se(),n=0,r=0,i=``;for(let a of e)for(let e=0;e<L;e++){let o=a>>>L-1-e&1;if(n=n<<1|o,r++,r===I){let e=t[n];if(e==null)throw TypeError(`unexpected`);i+=e,n=0,r=0}}if(r>0){n<<=15-r;let e=t[n];if(e==null)throw TypeError(`unexpected`);i+=e,r<L&&(i+=R)}return i}function Te(e){let t=Ce(),n=0,r=0,i=[];for(let a of e){if(a===R){i.pop();continue}let e=t[a];if(e==null)throw TypeError(`unexpected`);for(let t=0;t<I;t++){let a=e>>>I-1-t&1;n=n<<1|a,r++,r===L&&(i.push(n),n=0,r=0)}}return Uint8Array.from(i)}function Ee(e,t){let n=new Blob([e]).stream().pipeThrough(new CompressionStream(t));return new Response(n).bytes()}function De(e,t){let n=new Blob([e]).stream().pipeThrough(new DecompressionStream(t));return new Response(n).bytes()}async function Oe(e,t=`deflate-raw`,n=`base64url`){let r=new Blob([e]).stream().pipeThrough(new CompressionStream(t));return M(await new Response(r).bytes(),{alphabet:n,omitPadding:n===`base64url`})}function ke(e,t=`deflate-raw`,n=`base64url`){let r=N(e,{alphabet:n}),i=new Blob([r]).stream().pipeThrough(new DecompressionStream(t));return new Response(i).text()}function Ae(e,t){return[e].includes(t)}function z(e,t){if(typeof e!=typeof t)return!1;let n=Object.prototype.toString.call(e);if(n!==Object.prototype.toString.call(t))return!1;if(typeof e==`string`||typeof e==`bigint`||typeof e==`boolean`||typeof e==`symbol`||e==null)return e===t;if(typeof e==`number`)return e===t||e!==e&&t!==t;if(typeof e==`function`)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!z(e[n],t[n]))return!1;return!0}if(e instanceof Set&&t instanceof Set)return!!z([...e.values()],[...t.values()]);if(e instanceof Map&&t instanceof Map)return!(!z([...e.keys()],[...t.keys()])||!z([...e.values()],[...t.values()]));if(n===`[object Object]`){let n=e,r=t,i=Object.keys(n),a=Object.keys(r);for(let e of i){let t=a.find(t=>t===e);if(t==null)return!1;let[i,o]=[n[e],r[t]];if(!z(i,o))return!1}return!0}throw TypeError(`comparing these objects is unavailable: ${e}, ${t}`,{cause:[e,t]})}var B=`Rational`,V=class e{#e;#t;static name=B;constructor(e,t){t===0n?(this.#t=0n,this.#e=e===0n?0n:e>0n?1n:-1n):t>0n?(this.#e=e,this.#t=t):(this.#e=-e,this.#t=-t),this.#n()}static fromDecimal(t,n=5){if(Number.isNaN(t))return new e(0n,0n);if(Math.abs(t)===1/0)return new e(t>0?1n:-1n,0n);let r=t<0;r&&(t*=-1);let i=BigInt(Math.floor(t)),a=t-Number(i);if(a===0)return new e(r?-i:i,1n);t=1/a;let[o,s]=[1n,i],[c,l]=[0n,1n];for(;`${l}`.length<=n;){let n=BigInt(Math.floor(t)),i=t-Number(n);if([o,s]=[s,n*s+o],[c,l]=[l,n*l+c],i===0)return new e(r?-s:s,l);t=1/i}return new e(r?-o:o,c)}#n=()=>{let{gcd:e}=p(this.#e,this.#t);e!==0n&&(this.#e/=e,this.#t/=e)};minus=()=>new e(-this.#e,this.#t);inverse=()=>new e(this.#t,this.#e);add=t=>{let n=this.#t*t.#t;return new e(this.#e*t.#t+t.#e*this.#t,n)};substr=e=>this.add(e.minus());multiply=t=>{let n=this.#t*t.#t;return new e(this.#e*t.#e,n)};divide=e=>this.multiply(e.inverse());mediant=t=>{let n=this.#t+t.#t;return new e(this.#e+t.#e,n)};toDecimal=()=>Number(this.#e)/Number(this.#t);toString=()=>this.#e===0n&&this.#t===0n?`NaN`:this.#e===0n?`0`:this.#t===0n?this.#e<0n?`-Infinity`:`Infinity`:this.#t===1n?`${this.#e}`:`${this.#e}/${this.#t}`;valueOf=()=>this.toDecimal();toJSON=()=>({type:`Rational`,value:[`0x`+this.#e.toString(16),`0x`+this.#t.toString(16)]});static fromData(t){return new e(BigInt(t.value[0]),BigInt(t.value[1]))}static parse(t){let n=/^\s*(\d+)\s*\/\s*(\d+)\s*$/.exec(t);if(!n)throw Error(`cannot parse`);let r=n.at(1),i=n.at(2);if(!r||!i)throw Error(`cannot parse`);return new e(BigInt(r),BigInt(i))}};Object.defineProperty(V.prototype,Symbol.toStringTag,{value:B});var je={new:e=>new Uint8Array(e),fromBuffer:(e,t,n)=>new Uint8Array(e,t,n)},H=`NamedError`,U=class extends Error{static name=H;errName;name;constructor(e,t,n){super(t,n),this.errName=e,this.name=e}toJSON=()=>{let e=(()=>{let e=this.cause;if(e==null)return;let t=`${e}`;return t===`[object Object]`?JSON.stringify(e):t})(),{errName:t,message:n,stack:r}=this;return{name:t,message:n,stack:r,cause:e}}};Object.defineProperty(U.prototype,Symbol.toStringTag,{value:H});function Me(e){if(e.length%3!=0)throw SyntaxError(`The array length of input must be multiples of 3`);return Uint32Array.from({length:e.length/3},(t,n)=>[0,1,2].reduce((t,r)=>t|(e[3*n+r]??0)<<16-8*r,0)).reduce((e,t)=>e+t.toString(8).padStart(8,`0`),``)}function Ne(e){if(e.length&7)throw SyntaxError(`A string length must be multiples of 8`);let t=e.length>>>3,n=new Uint8Array(3*t);return Array.from(e.matchAll(/.{8}/g)).forEach((e,t)=>{let r=Number.parseInt(e[0],8);if(!Number.isFinite(r))throw SyntaxError(`Invalid input: ${e[0]}`);let i=[0,1,2].map(e=>r>>>16-8*e&255);n.set(i,3*t)}),n}var Pe=[9600629759793949339n,15726070495360670683n],Fe=6364136223846793005n,W=`PCGMinimal`,G=class{#e;static name=W;constructor(e){if(e&&e[0]!=null&&e[1]!=null){let t=e[1]<<1n|1n;this.#e=BigUint64Array.from([e[0]+t,t]),this.#t()}else this.#e=BigUint64Array.from(Pe)}#t(){if(this.#e[0]==null||this.#e[1]==null)throw TypeError(`unexpected`);this.#e[0]=this.#e[0]*Fe+this.#e[1]}get#n(){if(this.#e[0]==null||this.#e[1]==null)throw TypeError(`unexpected`);let e=this.#e[0],t=Number(e>>59n);return h(Number(BigInt.asUintN(32,(e^e>>18n)>>27n)),t)}getRandU32=()=>(this.#t(),this.#n);getBoundedRandU32=e=>{let t=4294967296;if(e>t)throw RangeError("`bound` exceeded limit (2^32)");if(e<=0)throw RangeError(`'bound' must be positive`);let n=t%e;for(let t=0;t<1e5;++t){let t=this.getRandU32();if(t>=n)return t%e}throw Error(`exceeded loop limit`)};*genRandU32s(e,t){if(e<=0)throw RangeError(`'step' must be positive`);for(let n=0;n<e;n++)yield typeof t==`number`?this.getBoundedRandU32(t):this.getRandU32()}stream=e=>{let t,n=e;return new ReadableStream({start:e=>{let r=()=>{if(n<=0){e.close();return}let i=Uint32Array.from([this.getRandU32()]),a=Math.min(n,4);e.enqueue(new Uint8Array(i.buffer,0,a)),n-=a,t=setTimeout(r,10)};t=setTimeout(r,10)},cancel:e=>{clearTimeout(t),console.log(`stream is cancelled: `,e)}},new ByteLengthQueuingStrategy({highWaterMark:1024}))}};Object.defineProperty(G.prototype,Symbol.toStringTag,{value:W});var Ie=[13715198867125970446n,3333371893450545919n,5627726498316411518n,8467276975966080893n],K=`XoshiroMinimal`,q=class{bits=64;#e;static name=K;constructor(e){if(e&&e[0]!=null&&e[1]!=null&&e[2]!=null&&e[3]!=null){if(this.#e=new BigUint64Array(4),this.#e[0]=e[0],this.#e[1]=e[1],this.#t(),this.#e[2]==null||this.#e[3]==null)throw TypeError(`unexpected`);this.#e[2]+=e[2],this.#e[3]+=e[3]}else this.#e=BigUint64Array.from(Ie)}#t(){if(this.#e[0]==null||this.#e[1]==null||this.#e[2]==null||this.#e[3]==null)throw TypeError(`unexpected`);let e=this.#e[1]<<17n;this.#e[2]^=this.#e[0],this.#e[3]^=this.#e[1],this.#e[1]^=this.#e[2],this.#e[0]^=this.#e[3],this.#e[2]^=e,this.#e[3]=g(this.#e[3],45n)}get value(){if(this.#e[0]==null||this.#e[3]==null)throw TypeError(`unexpected`);let e=g(this.#e[0]+this.#e[3],23n)+this.#e[0];return BigInt.asUintN(64,e)}getRandU64=()=>{let e=this.value;return this.#t(),e};getRandU32=()=>{let e=BigInt.asUintN(32,this.getRandU64());return Number(e)};getBoundedRandU64=e=>{let t=1n<<64n;if(e>t)throw RangeError("`bound` exceeded limit");if(e<=0n)throw RangeError("`bound` must be positive");let n=t%e;for(let t=0;t<1e5;++t){let t=this.getRandU64();if(t>=n)return t%e}throw Error(`exceeded loop limit`)};getBoundedRandU32=e=>{if(e>2**32)throw RangeError("`bound` exceeded limit");if(e<=0n)throw RangeError("`bound` must be positive");let t=this.getBoundedRandU64(BigInt(e));return Number(t)};*genRandU64s(e,t){if(e<=0)throw RangeError("`step` must be positive");for(let n=0;n<e;++n)yield t===void 0?this.getRandU64():this.getBoundedRandU64(t)}*genRandU32s(e,t){if(e<=0)throw RangeError("`step` must be positive");for(let n=0;n<e;++n)yield t===void 0?this.getRandU32():this.getBoundedRandU32(t)}};Object.defineProperty(q.prototype,Symbol.toStringTag,{value:K});var J=()=>typeof window>`u`&&typeof self<`u`&&`importScripts`in self;function Le(e,t){if(!J())throw Error(`This function must be used in Worker`);let n={success:!0,value:e,id:t};self.postMessage(n)}function Re(e,t){if(!J())throw Error(`This function must be used in Worker`);let n={success:!1,error:e,id:t};self.postMessage(n)}function ze(e){let t=[];for(;;){let n=Number(e&127n);e>>=7n;let r=n&64;if(e===0n&&r===0||e===-1n&&r!==0)return t.push(n),Uint8Array.from(t);t.push(n|128)}}function Be(e){let t=0n,n=0;for(let r of e)if(t|=BigInt(r&127)<<BigInt(n),n+=7,!(r&128))return BigInt.asIntN(n,t);return n+=7,BigInt.asIntN(n,t)}var Y;function X(){let e=Array.from(`刓劚加勸厍厵吗囖囜圞圽壪夷奲妏孏孕孿宇寷尼屭岆巚帄幱庅廳弗彏彸忂忥戇戋戵扷攮攸斆斻旟旴曯有朧杤欟欣歡歼殲毞氎氕氳汴灪炅爩牟犫犸玃玝瓛瓨甗电疊疟癵癿皭盁盭盼矚砆礹祁禷秈穳穹竊竍竸笏籲籺糷紑纞罔羉羍羼翁耀耓耲耷聾肝臢舣艭芲虌蚇蠿衳襽覎觀觔觿記讟豗豷豺貜貤贜赴趲跁躪躬軉軓轥迂邐邛酈酐釅釺钄閆闧阥隵隻雧雮靐靮韊韍韬頇顴颪飍飦饢馷驫骪髗髣鬤魫鱻鳷鸞麁麤黓黸齔齾`.matchAll(/../g)).flatMap(e=>{let t=e[0].charCodeAt(0),n=e[0].charCodeAt(1),r=[...Array(n-t+1)].map((e,n)=>t+n);return[...String.fromCharCode(...r)]}),t=Object.fromEntries(e.map((e,t)=>[e,t]));return Object.setPrototypeOf(t,null),[Object.freeze(e),Object.freeze(t)]}function Ve(){return Y??=X(),Y[0]}function He(){return Y??=X(),Y[1]}var Z=14,Q=8,$=`乙`;function Ue(e){let t=0,n=0,r=``,i=Ve();for(let a of e)for(let e=0;e<Q;e++){let o=a>>>Q-1-e&1;if(t=t<<1|o,n++,n===Z){let e=i.at(t);if(e==null)throw TypeError(`unexpected`);r+=e,t=0,n=0}}if(n>0){t<<=Z-n;let e=i.at(t);if(e==null)throw TypeError(`unexpected`);r+=e,n<Q&&(r+=$)}return r}function We(e){let t=He(),n=0,r=0,i=[];for(let a of e){if(a===$){i.pop();continue}let e=t[a];if(e==null)throw TypeError(`unexpected`);for(let t=0;t<Z;t++){let a=e>>>Z-1-t&1;n=n<<1|a,r++,r===Q&&(i.push(n),n=0,r=0)}}return Uint8Array.from(i)}return E(),e.AsyncWorker=T,e.FixedUint8Array=je,e.NamedError=U,e.PCGMinimal=G,e.Rational=V,e.XoshiroMinimal=q,e.bailliePSW=j,e.bailliePSWAsync=xe,e.compress=Ee,e.compressString=Oe,e.createWorker=ie,e.decodeLEB128=Be,e.decodeRFC3986URIComponent=ee,e.decompress=De,e.decompressString=ke,e.encodeLEB128=ze,e.encodeRFC3986URIComponent=l,e.exEuclidean=p,e.factorial=oe,e.floatRng=se,e.fromBase32768=Te,e.fromBase64=N,e.fromBaseJuso=We,e.fromOct=Ne,e.getHash=c,e.getRandBIByBitLength=x,e.getRandBIByRange=ce,e.getRandPrimeByBitLength=be,e.getRandPrimeByRange=ye,e.getRndInt=le,e.getStringTag=s,e.isDeepStrictEqual=z,e.isSquare=v,e.jacobiSymbol=_,e.modPow=f,e.nullableStrictAt=u,e.postFailed=Re,e.postSuccess=Le,e.residue=d,e.rot32=h,e.rot64=g,e.sameValueZero=Ae,e.setTimeoutPromise=te,e.sleepSort=re,e.strictAt=ne,e.toBase32768=we,e.toBase64=M,e.toBaseJuso=Ue,e.toOct=Me,e.withResolvers=o,e})({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tktb-tess/util-fns",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
4
4
  "description": "Utility functions for personal use",
5
5
  "files": [
6
6
  "dist"
@@ -30,6 +30,14 @@
30
30
  "types": "./dist/esm/base64.d.ts",
31
31
  "import": "./dist/esm/base64.js"
32
32
  },
33
+ "./base32768": {
34
+ "types": "./dist/esm/base32768.d.ts",
35
+ "import": "./dist/esm/base32768.js"
36
+ },
37
+ "./basejuso": {
38
+ "types": "./dist/esm/basejuso.d.ts",
39
+ "import": "./dist/esm/basejuso.js"
40
+ },
33
41
  "./compression": {
34
42
  "types": "./dist/esm/compression.d.ts",
35
43
  "import": "./dist/esm/compression.js"
@@ -91,9 +99,16 @@
91
99
  "devDependencies": {
92
100
  "@types/node": "^24.12.4",
93
101
  "typescript": "^6.0.3",
94
- "unplugin-dts": "1.0.0-beta.6",
95
- "vite": "^8.0.13",
96
- "vitest": "^4.1.6"
102
+ "unplugin-dts": "1.0.0",
103
+ "vite": "^8.0.14",
104
+ "vitest": "^4.1.7"
105
+ },
106
+ "devEngines": {
107
+ "packageManager": {
108
+ "name": "pnpm",
109
+ "version": "11.5.0",
110
+ "onFail": "download"
111
+ }
97
112
  },
98
113
  "scripts": {
99
114
  "dev": "vite",
@@ -101,6 +116,7 @@
101
116
  "build:iife": "vite build --config vite.config.iife.ts",
102
117
  "build": "pnpm run build:esm && pnpm run build:iife",
103
118
  "test": "vitest --run",
104
- "typecheck": "tsc --noEmit"
119
+ "typecheck": "tsc --noEmit",
120
+ "pack-lib": "pnpm run build && pnpm pack --out pkg/%s.tgz"
105
121
  }
106
122
  }