@fkn/lib 0.9.40 → 0.9.42

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 (98) hide show
  1. package/account-generation-B-6Pn0b5.cjs +1 -0
  2. package/account-generation-XNWOvLea.js +28 -0
  3. package/account.cjs +1 -1
  4. package/account.d.ts +11 -0
  5. package/account.js +8 -20
  6. package/api--LOXTOpv.cjs +3 -0
  7. package/{api-Dp-2AT3u.js → api-DIgTslNb.js} +154 -114
  8. package/{api-BE5zPvFZ.d.ts → api-SwxtiYVU.d.ts} +38 -14
  9. package/api.cjs +1 -1
  10. package/api.d.ts +3 -3
  11. package/api.js +2 -2
  12. package/attach-policy.cjs +1 -1
  13. package/attach-policy.js +2 -2
  14. package/cloud/dns.d.ts +1 -1
  15. package/cloud/fetch.cjs +1 -1
  16. package/cloud/fetch.d.ts +1 -1
  17. package/cloud/fetch.js +1 -1
  18. package/cloud/fs/promises.d.ts +1 -1
  19. package/cloud/fs.cjs +1 -1
  20. package/cloud/fs.d.ts +4 -4
  21. package/cloud/fs.js +31 -24
  22. package/cloud/net.d.ts +1 -1
  23. package/cloud-868OlBKn.cjs +1 -0
  24. package/{cloud-5eldoFxK.d.ts → cloud-DUH-v10C.d.ts} +6 -4
  25. package/cloud-f3j4s8yZ.js +545 -0
  26. package/cloud.cjs +1 -1
  27. package/cloud.d.ts +4 -4
  28. package/cloud.js +2 -2
  29. package/{contract-Cvr_8gCL.d.ts → contract-CCxPKIC7.d.ts} +105 -13
  30. package/contract.d.ts +3 -2
  31. package/dgram.cjs +1 -1
  32. package/dgram.d.ts +2 -2
  33. package/dgram.js +1 -1
  34. package/dns.cjs +1 -1
  35. package/dns.d.ts +1 -1
  36. package/dns.js +1 -1
  37. package/extension-BOBuYwZc.js +92 -0
  38. package/extension-hoUs5yJ7.cjs +1 -0
  39. package/{extension-DMU-CwMw.d.ts → extension-yhwDSIiD.d.ts} +22 -3
  40. package/extension.cjs +1 -1
  41. package/extension.d.ts +3 -3
  42. package/extension.js +3 -3
  43. package/fs/promises.cjs +1 -1
  44. package/fs/promises.d.ts +1 -1
  45. package/fs/promises.js +1 -1
  46. package/fs-CVnmXRf7.js +513 -0
  47. package/{fs--NhtUyYa.d.ts → fs-D0MMRnHC.d.ts} +8 -4
  48. package/fs-p0bOOj5n.cjs +1 -0
  49. package/fs.cjs +1 -1
  50. package/fs.d.ts +4 -3
  51. package/fs.js +4 -2
  52. package/{hosts-9dYv63ud.cjs → hosts-GNBhZO3-.cjs} +1 -1
  53. package/{hosts-BzbzOhG8.js → hosts-t7CKGTRz.js} +4 -1
  54. package/http.d.ts +1 -1
  55. package/{index-D2CA-NX5.d.ts → index-BtFiGoVQ.d.ts} +465 -51
  56. package/{index-kuPqkS_-.d.ts → index-D2lvaQDs.d.ts} +28 -38
  57. package/index.cjs +1 -1
  58. package/index.d.ts +17 -17
  59. package/index.js +62 -59
  60. package/lib-CfdmsLoI.cjs +53 -0
  61. package/{lib-C4Eeg9eM.js → lib-DppqX10G.js} +470 -302
  62. package/{messages-C66ghz_A.d.ts → messages-CRcziTuC.d.ts} +17 -1
  63. package/messages.cjs +1 -1
  64. package/messages.d.ts +2 -2
  65. package/messages.js +2 -2
  66. package/{net-zThwNoA8.d.ts → net-DcLF-6E-.d.ts} +2 -2
  67. package/net.cjs +1 -1
  68. package/net.d.ts +1 -1
  69. package/net.js +1 -1
  70. package/{node-fs-BZy9bzKd.js → node-fs-CK2wWIYS.js} +140 -137
  71. package/node-fs-nfX7wisL.cjs +1 -0
  72. package/opfs.cjs +1 -1
  73. package/opfs.js +1 -1
  74. package/package.json +1 -1
  75. package/packages.cjs +1 -1
  76. package/packages.d.ts +1 -1
  77. package/packages.js +14 -14
  78. package/{proxy-Dc0gDOxz.d.ts → proxy-CE46SkyA.d.ts} +2 -2
  79. package/{proxy-DjoPtJH9.cjs → proxy-CFK-KiwE.cjs} +1 -1
  80. package/{proxy-DMTdQ4dN.js → proxy-Dixbk1WL.js} +1 -1
  81. package/rooms.cjs +1 -1
  82. package/rooms.d.ts +1 -1
  83. package/rooms.js +11 -11
  84. package/storage-BVr2Rb-d.d.ts +167 -0
  85. package/storage-D2cUJlVH.cjs +1 -0
  86. package/storage-Dn1gTLSZ.js +123 -0
  87. package/api-jOTOA-5n.cjs +0 -3
  88. package/cloud-BLv19j-W.js +0 -480
  89. package/cloud-D7aQY4GH.cjs +0 -1
  90. package/extension-B9v933cT.js +0 -89
  91. package/extension-D2zMdc2f.cjs +0 -1
  92. package/fs-CaQFRiIT.cjs +0 -1
  93. package/fs-D3IsGdnN.js +0 -360
  94. package/lib-BfAg9mHD.cjs +0 -53
  95. package/node-fs-BNTPsX5c.cjs +0 -1
  96. package/storage-BJd-mWHE.cjs +0 -1
  97. package/storage-DSvL-t80.js +0 -67
  98. package/storage-ZrY4Y4L5.d.ts +0 -88
@@ -1,36 +1,21 @@
1
- import { a as WriteData$1, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-BQgZVQl7.js";
2
- import { d as storage_d_exports, r as SealedRead } from "./storage-ZrY4Y4L5.js";
3
- //#region src/fs/types.d.ts
4
- type FileEntry = {
5
- path: string;
6
- size: number;
7
- contentType: string | null;
8
- updatedAt: string | null;
9
- };
10
- type WriteData = Blob | ArrayBuffer | Uint8Array | string;
11
- type FileSystem = {
12
- available: () => Promise<boolean>;
13
- list: () => Promise<FileEntry[]>;
14
- readFile: (path: string) => Promise<Blob>;
15
- writeFile: (path: string, data: WriteData, opts?: {
16
- contentType?: string;
17
- }) => Promise<void>;
18
- remove: (path: string) => Promise<void>;
19
- };
1
+ import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-BQgZVQl7.js";
2
+ import { a as StorageAccountChangedError, b as PinOptions, d as captureAccount$1, g as storage_d_exports, i as SealedRead, o as StorageAccountPinUnsupportedError, p as isAccountChanged, v as FileEntry, x as WriteData$1, y as FileSystem } from "./storage-BVr2Rb-d.js";
3
+ import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-CRcziTuC.js";
20
4
  declare namespace hybrid_d_exports {
21
- export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, FileEntry, FileSystem, WriteData, adopt$1 as adopt, adoptable$1 as adoptable, available$1 as available, list, onConflict$1 as onConflict, pending$1 as pending, pendingDeletes$1 as pendingDeletes, pull$1 as pull, readFile$1 as readFile, readFileSealed$1 as readFileSealed, remove, replicating$1 as replicating, writeFile$1 as writeFile };
5
+ export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, FileEntry, FileSystem, WriteData$1 as WriteData, adopt$1 as adopt, adoptable$1 as adoptable, available$1 as available, captureAccount, list, onConflict$1 as onConflict, pending$1 as pending, pendingDeletes$1 as pendingDeletes, pull$1 as pull, readFile$1 as readFile, readFileSealed$1 as readFileSealed, remove, replicating$1 as replicating, writeFile$1 as writeFile };
22
6
  }
7
+ declare const captureAccount: typeof captureAccount$1;
23
8
  declare const available$1: () => Promise<boolean>;
24
9
  declare const pending$1: () => string[];
25
10
  declare const pendingDeletes$1: () => string[];
26
11
  declare const replicating$1: () => boolean;
27
- declare const list: () => Promise<FileEntry[]>;
28
- declare const readFile$1: (path: string) => Promise<Blob>;
29
- declare const readFileSealed$1: (path: string) => Promise<SealedRead>;
30
- declare const writeFile$1: (path: string, data: WriteData, opts?: {
12
+ declare const list: (opts?: PinOptions) => Promise<FileEntry[]>;
13
+ declare const readFile$1: (path: string, opts?: PinOptions) => Promise<Blob>;
14
+ declare const readFileSealed$1: (path: string, opts?: PinOptions) => Promise<SealedRead>;
15
+ declare const writeFile$1: (path: string, data: WriteData$1, opts?: {
31
16
  contentType?: string;
32
- }) => Promise<void>;
33
- declare const remove: (path: string) => Promise<void>;
17
+ } & PinOptions) => Promise<void>;
18
+ declare const remove: (path: string, opts?: PinOptions) => Promise<void>;
34
19
  declare const pull$1: (path: string) => Promise<Blob>;
35
20
  type AdoptSummary = {
36
21
  uploaded: string[];
@@ -71,29 +56,34 @@ type FileConflict = {
71
56
  * pins against a real channel. So a resolver whose answer ever crossed a realm would simply read as a
72
57
  * merge: one redundant write, never a wrong file.
73
58
  */
74
- type ConflictResolution = WriteData | null;
59
+ type ConflictResolution = WriteData$1 | null;
75
60
  type ConflictResolver = (conflict: FileConflict) => Promise<ConflictResolution> | ConflictResolution;
76
61
  declare const onConflict$1: (next: ConflictResolver) => (() => void);
62
+ /**
63
+ * Pushes the local files the account lacks, after what replication owes. It acts for the account
64
+ * this page is on when it is called: an entry queued for another account is skipped and stays queued
65
+ * for it, and a switch while it runs refuses the rest with `StorageAccountChangedError`.
66
+ */
77
67
  declare const adopt$1: () => Promise<AdoptSummary>;
78
68
  declare const adoptable$1: () => Promise<{
79
69
  paths: string[];
80
70
  bytes: number;
81
71
  }>;
82
72
  declare namespace index_d_exports {
83
- export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, SealedRead, Stats, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSealed, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
73
+ export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, SealedRead, Stats, StorageAccountChangedError, StorageAccountPinUnsupportedError, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, isAccountChanged, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSealed, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
84
74
  }
85
- declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
75
+ declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
86
76
  recursive?: boolean;
87
77
  force?: boolean;
88
78
  }) => void, rmdirSync: (path: import("node:fs").PathLike, options?: {
89
79
  recursive?: boolean;
90
- }) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, appendFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void, readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void, mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void, rm: (path: import("node:fs").PathLike, a: {
80
+ }) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void, readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void, mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void, rm: (path: import("node:fs").PathLike, a: {
91
81
  recursive?: boolean;
92
82
  force?: boolean;
93
83
  } | Callback<void>, b?: Callback<void>) => void, unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void, exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void, promises: {
94
84
  readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
95
- writeFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
96
- appendFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
85
+ writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
86
+ appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
97
87
  stat: (path: import("node:fs").PathLike) => Promise<Stats>;
98
88
  lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
99
89
  readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
@@ -120,8 +110,8 @@ declare const onConflict: typeof onConflict$1;
120
110
  declare const _default: {
121
111
  available: () => Promise<boolean>;
122
112
  readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string;
123
- writeFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void;
124
- appendFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void;
113
+ writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
114
+ appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
125
115
  existsSync: (path: import("node:fs").PathLike) => boolean;
126
116
  statSync: (path: import("node:fs").PathLike) => Stats;
127
117
  lstatSync: (path: import("node:fs").PathLike) => Stats;
@@ -137,8 +127,8 @@ declare const _default: {
137
127
  unlinkSync: (path: import("node:fs").PathLike) => void;
138
128
  renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void;
139
129
  readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void;
140
- writeFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
141
- appendFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
130
+ writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
131
+ appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
142
132
  stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void;
143
133
  readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void;
144
134
  mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void;
@@ -151,8 +141,8 @@ declare const _default: {
151
141
  exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void;
152
142
  promises: {
153
143
  readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
154
- writeFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
155
- appendFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
144
+ writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
145
+ appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
156
146
  stat: (path: import("node:fs").PathLike) => Promise<Stats>;
157
147
  lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
158
148
  readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
package/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BfAg9mHD.cjs"),n=require("./api-jOTOA-5n.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-D7aQY4GH.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-D2zMdc2f.cjs"),u=require("./desktop.cjs"),d=require("./fs-CaQFRiIT.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./rooms.cjs"),h=require("./account.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.J())return e(!0);let n,r=setTimeout(()=>i(t.J()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.J()),y)},o=new MutationObserver(()=>{t.J()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.J()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=(async e=>{if(t.o(e)===`window`){let n=e;return l.r()?t.a(n):i.a()?i.i(n):t.a(n)}return S(e)}),S=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=n.s();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&n.l(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>r.n(),W=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.b,exports.EXTENSION_ABI=t.Q,exports.ExtensionOperationUnsupportedError=t.$,exports.ExtensionOutdatedError=t.et,exports.FORGEABLE_HEADERS=t.U,exports.FrameWindowBlockedError=t.f,exports.FrameWindowRefusedError=t.p,exports.LOCATOR_DENIED=t.T,exports.LOCATOR_ERROR=t.k,exports.LOCATOR_UNSUPPORTED=t.x,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.tt,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t._,exports.assertFetchableUrl=t.I,exports.assertForgeableHeaders=t.W,exports.assertLockdownApplicable=t.v,exports.assertOneCookieIdentity=t.G,exports.attachFrame=x,exports.attachFramePermission=t.m,exports.box=t.it,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.P,exports.createFrame=t.h,exports.createVideoElementHandle=t.at,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.R,exports.fetchLocalPermission=t.z,exports.fetchPermission=t.B,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.g,exports.handleRevivableModules=t.rt,exports.hasForgedCookie=t.K,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.V,exports.isBlockedFrameUrl=t.y,exports.isExtensionExposed=t.J,exports.isLocalNetworkUrl=t.H,exports.isLocatorDenied=t.A,exports.isLocatorUnsupported=t.S,exports.isPermissionDenied=t.n,exports.isTerminalError=t.O,exports.isType=t.ot,exports.modifyRequestHeadersPermission=t.j,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=E,exports.readCookiePermission=t.F,exports.readExtensionHandshake=t.Y,exports.relayWorker=w,exports.removeRequestHeaderRule=t.M,exports.revive=t.st,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.X,exports.setRequestHeaderRule=t.N,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.nt,exports.type=t.ct,exports.waitForExtensionExposure=t.Z;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-CfdmsLoI.cjs"),n=require("./api--LOXTOpv.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-868OlBKn.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-hoUs5yJ7.cjs"),u=require("./desktop.cjs"),d=require("./fs-p0bOOj5n.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./rooms.cjs"),h=require("./account.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.$())return e(!0);let n,r=setTimeout(()=>i(t.$()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.$()),y)},o=new MutationObserver(()=>{t.$()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.$()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=(async e=>{let{kind:n,cookies:r}=t.o(e);if(n===`window`){let n=e;return r===`native`?t.a(n):i.i(n)}let a=e;return r===`native`?S(a):i.i(a)}),S=async e=>(i.a(e),await b(),t.a(e)),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.f;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);n.d();let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await n.o).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await n.o).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:n.o.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=n.c();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&n.u(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.u(()=>{let e=n.c();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>r.n(),W=async()=>typeof window>`u`?!1:n.o.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.C,exports.EXTENSION_ABI=t.rt,exports.ExtensionOperationUnsupportedError=t.it,exports.ExtensionOutdatedError=t.at,exports.FORGEABLE_HEADERS=t.J,exports.FrameWindowBlockedError=t.h,exports.FrameWindowRefusedError=t.g,exports.LOCATOR_DENIED=t.O,exports.LOCATOR_ERROR=t.N,exports.LOCATOR_INVALID=t.F,exports.LOCATOR_UNSUPPORTED=t.T,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.ot,exports.TimeoutError=t.w,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.b,exports.assertFetchableUrl=t.V,exports.assertForgeableHeaders=t.Y,exports.assertLockdownApplicable=t.x,exports.assertOneCookieIdentity=t.X,exports.attachFrame=x,exports.attachFramePermission=t._,exports.box=t.lt,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.z,exports.createFrame=t.v,exports.createVideoElementHandle=t.ut,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.U,exports.fetchLocalPermission=t.W,exports.fetchPermission=t.G,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.y,exports.handleRevivableModules=t.ct,exports.hasForgedCookie=t.Z,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.K,exports.isBlockedFrameUrl=t.S,exports.isExtensionExposed=t.$,exports.isLocalNetworkUrl=t.q,exports.isLocatorDenied=t.P,exports.isLocatorInvalid=t.A,exports.isLocatorUnsupported=t.E,exports.isPermissionDenied=t.n,exports.isTerminalError=t.M,exports.isType=t.dt,exports.modifyRequestHeadersPermission=t.I,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=E,exports.readCookiePermission=t.B,exports.readExtensionHandshake=t.et,exports.relayWorker=w,exports.removeRequestHeaderRule=t.L,exports.revive=t.ft,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.tt,exports.setRequestHeaderRule=t.R,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.st,exports.type=t.pt,exports.waitForExtensionExposure=t.nt;
package/index.d.ts CHANGED
@@ -1,32 +1,32 @@
1
1
  import { t as account_d_exports } from "./account.js";
2
- import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, o as Frame, p as FramePostMessageOptions, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-D2CA-NX5.js";
3
- import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as isLocatorUnsupported, K as LOCATOR_UNSUPPORTED, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, Y as isTerminalError, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as isLocatorDenied, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-DMU-CwMw.js";
4
- import { n as cloud_d_exports } from "./cloud-5eldoFxK.js";
2
+ import { $ as SelectorPart, A as gotoPermission, B as handleRevivableModules, C as FrameWindowRefusal, D as WindowFrame, E as Locator, F as PermissionRequest, G as createVideoElementHandle, H as RemoteVideoElement, I as permissions, J as type, K as isType, L as CATEGORIES, M as CategoryRequest, N as LegacyPermissionRequest, O as attachFramePermission, P as PermissionGrant, Q as OperationRequest, R as CategoryMeta, S as FrameWindowOptions, T as GotoOptions, U as VideoElementState, V as BoxedVideoElement, W as box, X as Gate, Y as Executor, Z as GateTools, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as CategoryGrant, k as createFrame, l as ClearCookiesOptions, m as FrameBackendEvent, o as AttachFrameOptions, p as FrameBackend, q as revive, r as AttachFrameFunction, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as PermissionCategory } from "./index-BtFiGoVQ.js";
3
+ import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as TimeoutError, K as LOCATOR_INVALID, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, Q as isTerminalError, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, X as isLocatorInvalid, Y as isLocatorDenied, Z as isLocatorUnsupported, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as LOCATOR_UNSUPPORTED, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-yhwDSIiD.js";
4
+ import { n as cloud_d_exports } from "./cloud-DUH-v10C.js";
5
5
  import { t as dns_d_exports } from "./dns.js";
6
- import { u as index_d_exports } from "./index-kuPqkS_-.js";
7
- import { s as net_d_exports } from "./net-zThwNoA8.js";
6
+ import { s as net_d_exports } from "./net-DcLF-6E-.js";
8
7
  import { t as dgram_d_exports } from "./dgram.js";
9
8
  import { t as http_d_exports } from "./http.js";
10
9
  import { t as desktop_d_exports } from "./desktop.js";
10
+ import { u as index_d_exports } from "./index-D2lvaQDs.js";
11
11
  import { t as index_d_exports$1 } from "./opfs.js";
12
12
  import { t as packages_d_exports } from "./packages.js";
13
13
  import { t as rooms_d_exports } from "./rooms.js";
14
14
  import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
15
15
  //#region src/frame.d.ts
16
16
  /**
17
- * Attaches FKN to an iframe the app mounted, on the extension when it is installed and on the cloud
18
- * render proxy otherwise, or with `{ window }` opens the attachment in a window of its own.
17
+ * Attaches FKN to an iframe the app mounted, or with `{ window }` opens the attachment in a window
18
+ * of its own. `cookies` picks the jar and with it the backend (`AttachCookies`): `'persistent'`, the
19
+ * default, and `'ephemeral'` run on the cloud render proxy whatever is installed, and never wait for
20
+ * the extension; `'native'` runs on the extension, waiting for it to expose itself while the page
21
+ * loads (at most 10000 ms) and showing the install prompt when it does not. A `blank` attach is the
22
+ * cloud render proxy's alone, so beside `'native'` it is a TypeError. `frame.backend()` says which
23
+ * backend serves an attachment.
19
24
  *
20
25
  * A window opens before the first await, so call this directly in the click or key handler whose
21
- * activation opens it. It never waits for the extension to expose itself: a click lands on a loaded
22
- * page, where the extension has exposed itself or never will.
23
- *
24
- * In this release only the cloud backend serves a window. With the extension installed, a window
25
- * is refused at once with `ExtensionOperationUnsupportedError` (operation `'attachWindow'`), before
26
- * anything opens or is waited for, so the same click can still open one with
27
- * `cloud.attachFrame({ window })`. That window runs on this app's cloud cookie jar, not on the
28
- * extension's: a sign-in made in it reaches this app's cloud frames, never an iframe attached
29
- * through the extension.
26
+ * activation opens it. On `'persistent'` or `'ephemeral'` it opens on the cloud, extension or not. On
27
+ * `'native'` it is refused at once with `ExtensionOperationUnsupportedError` (operation
28
+ * `'attachWindow'`), before anything opens or is waited for, so the same click can still open one on
29
+ * another value.
30
30
  */
31
31
  export declare const attachFrame: AttachFrameFunction;
32
32
  //#endregion
@@ -129,4 +129,4 @@ declare const busyReasons: () => string[];
129
129
  */
130
130
  declare const applyUpdate: () => Promise<boolean>;
131
131
  //#endregion
132
- export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
132
+ export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, TimeoutError, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
package/index.js CHANGED
@@ -1,87 +1,90 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { $ as t, A as n, B as r, F as i, G as a, H as o, I as s, J as c, K as l, M as ee, N as te, O as ne, P as re, Q as ie, R as ae, S as oe, T as se, U as u, V as d, W as ce, X as le, Y as ue, Z as de, _ as f, a as p, at as m, b as h, ct as g, et as _, f as v, g as y, h as b, i as x, it as S, j as C, k as w, m as T, n as E, nt as D, o as O, ot as k, p as A, r as j, rt as M, st as N, t as P, tt as F, v as I, x as L, y as R, z } from "./lib-C4Eeg9eM.js";
3
- import { a as B, l as V, s as H, u as fe } from "./api-Dp-2AT3u.js";
4
- import { n as pe, t as me } from "./busy-B189uX--.js";
5
- import { a as U, i as W, n as he } from "./cloud-BLv19j-W.js";
6
- import { t as ge } from "./dns.js";
7
- import { t as _e } from "./net.js";
8
- import { t as ve } from "./dgram.js";
9
- import { t as G } from "./http.js";
10
- import { i as ye, n as be, r as K, t as xe } from "./extension-B9v933cT.js";
11
- import { t as Se } from "./desktop.js";
12
- import { u as Ce } from "./fs-D3IsGdnN.js";
13
- import { t as we } from "./opfs.js";
14
- import { t as Te } from "./packages.js";
15
- import { t as Ee } from "./rooms.js";
16
- import { t as De } from "./account.js";
17
- import { t as Oe } from "./connect-button-DtsN3X1J.js";
18
- import { relay as ke } from "osra";
2
+ import { $ as t, A as n, B as r, C as i, E as a, F as o, G as s, I as ee, J as te, K as ne, L as re, M as ie, N as c, O as ae, P as oe, R as se, S as l, T as ce, U as le, V as ue, W as de, X as u, Y as d, Z as f, _ as p, a as m, at as h, b as g, ct as _, dt as v, et as y, ft as b, g as x, h as S, i as C, it as w, lt as T, n as E, nt as D, o as O, ot as k, pt as A, q as j, r as M, rt as N, st as P, t as F, tt as I, ut as L, v as R, w as z, x as B, y as V, z as H } from "./lib-DppqX10G.js";
3
+ import { c as U, d as fe, f as pe, o as W, u as G } from "./api-DIgTslNb.js";
4
+ import { n as me, t as he } from "./busy-B189uX--.js";
5
+ import { a as ge, i as K, n as _e } from "./cloud-f3j4s8yZ.js";
6
+ import { t as ve } from "./dns.js";
7
+ import { t as ye } from "./net.js";
8
+ import { t as be } from "./dgram.js";
9
+ import { t as xe } from "./http.js";
10
+ import { i as Se, n as Ce, t as we } from "./extension-BOBuYwZc.js";
11
+ import { t as Te } from "./desktop.js";
12
+ import { u as Ee } from "./fs-CVnmXRf7.js";
13
+ import { t as De } from "./opfs.js";
14
+ import { t as Oe } from "./packages.js";
15
+ import { t as ke } from "./rooms.js";
16
+ import { t as Ae } from "./account.js";
17
+ import { t as je } from "./connect-button-DtsN3X1J.js";
18
+ import { relay as Me } from "osra";
19
19
  //#region src/frame.ts
20
- var Ae = 1e4, je = 150, Me = () => new Promise((e) => {
21
- if (c()) return e(!0);
22
- let t, n = setTimeout(() => r(c()), Ae), r = (r) => {
23
- clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
24
- }, i = () => {
25
- clearTimeout(t), t = setTimeout(() => r(c()), je);
26
- }, a = new MutationObserver(() => {
27
- c() && r(!0);
28
- }), o = () => {
29
- document.readyState === "complete" && !c() && i();
20
+ var Ne = 1e4, Pe = 150, Fe = () => new Promise((e) => {
21
+ if (t()) return e(!0);
22
+ let n, r = setTimeout(() => i(t()), Ne), i = (t) => {
23
+ clearTimeout(n), clearTimeout(r), o.disconnect(), document.removeEventListener("readystatechange", s), e(t);
24
+ }, a = () => {
25
+ clearTimeout(n), n = setTimeout(() => i(t()), Pe);
26
+ }, o = new MutationObserver(() => {
27
+ t() && i(!0);
28
+ }), s = () => {
29
+ document.readyState === "complete" && !t() && a();
30
30
  };
31
- a.observe(document.documentElement, {
31
+ o.observe(document.documentElement, {
32
32
  attributes: !0,
33
33
  attributeFilter: ["data-fkn-extension"]
34
- }), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
35
- }), Ne = (async (e) => {
36
- if (O(e) === "window") {
34
+ }), document.addEventListener("readystatechange", s), document.readyState === "complete" && a();
35
+ }), Ie = (async (e) => {
36
+ let { kind: t, cookies: n } = O(e);
37
+ if (t === "window") {
37
38
  let t = e;
38
- return K() ? p(t) : U() ? W(t) : p(t);
39
+ return n === "native" ? m(t) : K(t);
39
40
  }
40
- return Pe(e);
41
- }), Pe = async (e) => K() || e.lockdown || !U() || await Me() ? p(e) : W(e), Fe = "https://fkn.app", Ie = async (e, t) => {
41
+ let r = e;
42
+ return n === "native" ? Le(r) : K(r);
43
+ }), Le = async (e) => (ge(e), await Fe(), m(e)), Re = "https://fkn.app", ze = async (e, t) => {
42
44
  if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
43
- let n = await fe;
45
+ let n = await pe;
44
46
  if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
45
- let r = me("relayed worker");
47
+ fe();
48
+ let r = he("relayed worker");
46
49
  t?.unregisterSignal?.aborted ? r() : t?.unregisterSignal?.addEventListener("abort", r, { once: !0 });
47
50
  let i = n.emit instanceof MessagePort ? {} : {
48
- originA: t?.originA ?? Fe,
51
+ originA: t?.originA ?? Re,
49
52
  originB: t?.originB ?? "*"
50
53
  };
51
- ke(n, e, {
54
+ Me(n, e, {
52
55
  key: "fkn-api",
53
56
  ...i,
54
57
  unregisterSignal: t?.unregisterSignal
55
58
  });
56
- }, Le = async () => typeof window > "u" ? !1 : (await B).connect.prompt(location.origin).catch(() => !1), Re = async () => typeof window > "u" ? null : (await B).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), ze = (e) => (q.add(e), () => {
59
+ }, Be = async () => typeof window > "u" ? !1 : (await W).connect.prompt(location.origin).catch(() => !1), Ve = async () => typeof window > "u" ? null : (await W).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), He = (e) => (q.add(e), () => {
57
60
  q.delete(e);
58
- }), Be = () => {
61
+ }), Ue = () => {
59
62
  if (q.size === 0) return !1;
60
63
  for (let e of [...q]) try {
61
64
  e();
62
65
  } catch {}
63
66
  return !0;
64
- }, Ve = (e, t) => {
67
+ }, We = (e, t) => {
65
68
  if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
66
- }, He = /* @__PURE__ */ e({
67
- applyUpdate: () => Ye,
68
- busyReasons: () => Je,
69
- onUpdate: () => Ge,
70
- onUpdateTaken: () => Ke,
71
- updateReady: () => Ue
72
- }), Ue = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, We = () => {
69
+ }, Ge = /* @__PURE__ */ e({
70
+ applyUpdate: () => Qe,
71
+ busyReasons: () => Ze,
72
+ onUpdate: () => Je,
73
+ onUpdateTaken: () => Ye,
74
+ updateReady: () => Ke
75
+ }), Ke = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, qe = () => {
73
76
  Y = !0;
74
77
  for (let e of [...J]) try {
75
78
  e();
76
79
  } catch {}
77
80
  }, X = 0, Z = () => {
78
- let e = H();
79
- e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(We)).catch(() => {
81
+ let e = U();
82
+ e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(qe)).catch(() => {
80
83
  X === e.epoch && (X = 0);
81
84
  }));
82
85
  };
83
- typeof window < "u" && V(Z);
84
- var Ge = async (e) => {
86
+ typeof window < "u" && G(Z);
87
+ var Je = async (e) => {
85
88
  if (typeof window > "u") return () => {};
86
89
  if (J.add(e), Y) try {
87
90
  e();
@@ -89,19 +92,19 @@ var Ge = async (e) => {
89
92
  return Z(), () => {
90
93
  J.delete(e);
91
94
  };
92
- }, Ke = (e) => typeof window > "u" ? () => {} : ze(e), Q = 0, $ = !1, qe = () => {
93
- if (!Be() && !$) {
95
+ }, Ye = (e) => typeof window > "u" ? () => {} : He(e), Q = 0, $ = !1, Xe = () => {
96
+ if (!Ue() && !$) {
94
97
  $ = !0;
95
98
  try {
96
99
  location.reload();
97
100
  } catch {}
98
101
  }
99
102
  };
100
- typeof window < "u" && V(() => {
101
- let e = H();
103
+ typeof window < "u" && G(() => {
104
+ let e = U();
102
105
  if (!e || Q === e.epoch) return;
103
106
  Q = e.epoch;
104
- let t = Ve(e.remote.shell, qe);
107
+ let t = We(e.remote.shell, Xe);
105
108
  if (!t) {
106
109
  Q = 0;
107
110
  return;
@@ -110,6 +113,6 @@ typeof window < "u" && V(() => {
110
113
  Q === e.epoch && (Q = 0);
111
114
  });
112
115
  });
113
- var Je = () => pe(), Ye = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
116
+ var Ze = () => me(), Qe = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
114
117
  //#endregion
115
- export { x as ATTACH_FRAME_EVENT_KEY, h as CATEGORIES, ie as EXTENSION_ABI, t as ExtensionOperationUnsupportedError, _ as ExtensionOutdatedError, u as FORGEABLE_HEADERS, v as FrameWindowBlockedError, A as FrameWindowRefusedError, se as LOCATOR_DENIED, w as LOCATOR_ERROR, L as LOCATOR_UNSUPPORTED, P as PERMISSION_DENIED, F as REQUIRED_EXTENSION_ABI, De as account, f as assertAttachableFrameUrl, s as assertFetchableUrl, ce as assertForgeableHeaders, I as assertLockdownApplicable, a as assertOneCookieIdentity, Ne as attachFrame, T as attachFramePermission, S as box, he as cloud, Le as connect, Oe as connectButtonUrl, re as cookies, b as createFrame, m as createVideoElementHandle, Se as desktop, ve as dgram, ge as dns, xe as extension, be as fetch, ae as fetchCredentialedPermission, z as fetchLocalPermission, r as fetchPermission, Ce as fs, y as gotoPermission, M as handleRevivableModules, l as hasForgedCookie, G as http, d as isBlockedFetchUrl, R as isBlockedFrameUrl, c as isExtensionExposed, o as isLocalNetworkUrl, n as isLocatorDenied, oe as isLocatorUnsupported, E as isPermissionDenied, ne as isTerminalError, k as isType, C as modifyRequestHeadersPermission, _e as net, we as opfs, Te as packages, j as permissions, ye as promptInstall, Re as promptRelay, i as readCookiePermission, ue as readExtensionHandshake, Ie as relayWorker, ee as removeRequestHeaderRule, N as revive, Ee as rooms, le as setMissingExtensionHandler, te as setRequestHeaderRule, He as shell, D as supportsOperation, g as type, de as waitForExtensionExposure };
118
+ export { C as ATTACH_FRAME_EVENT_KEY, i as CATEGORIES, N as EXTENSION_ABI, w as ExtensionOperationUnsupportedError, h as ExtensionOutdatedError, te as FORGEABLE_HEADERS, S as FrameWindowBlockedError, x as FrameWindowRefusedError, ae as LOCATOR_DENIED, c as LOCATOR_ERROR, o as LOCATOR_INVALID, ce as LOCATOR_UNSUPPORTED, F as PERMISSION_DENIED, k as REQUIRED_EXTENSION_ABI, z as TimeoutError, Ae as account, g as assertAttachableFrameUrl, ue as assertFetchableUrl, d as assertForgeableHeaders, B as assertLockdownApplicable, u as assertOneCookieIdentity, Ie as attachFrame, p as attachFramePermission, T as box, _e as cloud, Be as connect, je as connectButtonUrl, H as cookies, R as createFrame, L as createVideoElementHandle, Te as desktop, be as dgram, ve as dns, we as extension, Ce as fetch, le as fetchCredentialedPermission, de as fetchLocalPermission, s as fetchPermission, Ee as fs, V as gotoPermission, _ as handleRevivableModules, f as hasForgedCookie, xe as http, ne as isBlockedFetchUrl, l as isBlockedFrameUrl, t as isExtensionExposed, j as isLocalNetworkUrl, oe as isLocatorDenied, n as isLocatorInvalid, a as isLocatorUnsupported, E as isPermissionDenied, ie as isTerminalError, v as isType, ee as modifyRequestHeadersPermission, ye as net, De as opfs, Oe as packages, M as permissions, Se as promptInstall, Ve as promptRelay, r as readCookiePermission, y as readExtensionHandshake, ze as relayWorker, re as removeRequestHeaderRule, b as revive, ke as rooms, I as setMissingExtensionHandler, se as setRequestHeaderRule, Ge as shell, P as supportsOperation, A as type, D as waitForExtensionExposure };