@fkn/lib 0.9.46 → 0.9.47

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 (95) hide show
  1. package/{account-generation-B-6Pn0b5.cjs → account-generation-9VhfEDoW.cjs} +1 -1
  2. package/{account-generation-XNWOvLea.js → account-generation-hUekEHGW.js} +1 -1
  3. package/account.cjs +1 -1
  4. package/account.js +2 -2
  5. package/{api-DOXb_WrB.d.ts → api-DIBhBtcU.d.ts} +2 -24
  6. package/api-DMnVye0K.cjs +3 -0
  7. package/{api-DIgTslNb.js → api-ySazPAwN.js} +97 -59
  8. package/api.cjs +1 -1
  9. package/api.d.ts +2 -2
  10. package/api.js +1 -1
  11. package/busy-BXbVH595.cjs +1 -0
  12. package/{busy-B189uX--.js → busy-DsMWrSzc.js} +6 -3
  13. package/cloud/dns.d.ts +1 -1
  14. package/cloud/fetch.cjs +1 -1
  15. package/cloud/fetch.d.ts +1 -1
  16. package/cloud/fetch.js +1 -1
  17. package/cloud/fs/promises.d.ts +1 -1
  18. package/cloud/fs.cjs +1 -1
  19. package/cloud/fs.d.ts +2 -2
  20. package/cloud/fs.js +2 -2
  21. package/cloud/net.cjs +1 -1
  22. package/cloud/net.d.ts +1 -1
  23. package/cloud/net.js +2 -2
  24. package/{cloud-v5x4uhDC.js → cloud-BD7uzz5h.js} +14 -18
  25. package/{cloud-DSx-jDFk.d.ts → cloud-Bdw5nX-B.d.ts} +4 -4
  26. package/{cloud-CUzZFzG3.cjs → cloud-DL4i8kvf.cjs} +1 -1
  27. package/cloud.cjs +1 -1
  28. package/cloud.d.ts +4 -4
  29. package/cloud.js +2 -2
  30. package/{contract-BmLpSueo.d.ts → contract-LOcbTDjP.d.ts} +6 -46
  31. package/contract.cjs +1 -1
  32. package/contract.d.ts +4 -4
  33. package/contract.js +3 -9
  34. package/dgram.cjs +1 -1
  35. package/dgram.d.ts +3 -3
  36. package/dgram.js +19 -19
  37. package/dns.cjs +1 -1
  38. package/dns.d.ts +1 -1
  39. package/dns.js +1 -1
  40. package/{extension-BnVG0YL4.js → extension-BeIkBEi3.js} +4 -4
  41. package/{extension-C2tBRE9i.d.ts → extension-Bsvr9OaV.d.ts} +6 -6
  42. package/{extension-3bxlAW8M.cjs → extension-eG1RMTDc.cjs} +1 -1
  43. package/extension.cjs +1 -1
  44. package/extension.d.ts +2 -2
  45. package/extension.js +2 -2
  46. package/fs/promises.cjs +1 -1
  47. package/fs/promises.d.ts +1 -1
  48. package/fs/promises.js +1 -1
  49. package/fs-BY0Csn2V.js +515 -0
  50. package/fs-DnF1cQuE.cjs +1 -0
  51. package/{fs-KA1Mgisv.d.ts → fs-lKZe5xIo.d.ts} +1 -1
  52. package/fs.cjs +1 -1
  53. package/fs.d.ts +2 -2
  54. package/fs.js +2 -2
  55. package/http.d.ts +1 -1
  56. package/{index-DKr9L2RI.d.ts → index-D9x6A-Gx.d.ts} +1 -1
  57. package/{index-B98wvTaI.d.ts → index-iawzrUiB.d.ts} +86 -32
  58. package/index.cjs +1 -1
  59. package/index.d.ts +9 -8
  60. package/index.js +30 -32
  61. package/lib-CK2F5cc1.cjs +53 -0
  62. package/{lib-BFwrzgpu.js → lib-zMHWCUXz.js} +663 -486
  63. package/{net-BFjtzAK0.d.ts → net-taIhsmvu.d.ts} +5 -5
  64. package/net.cjs +1 -1
  65. package/net.d.ts +1 -1
  66. package/net.js +11 -12
  67. package/{node-fs-CK2wWIYS.js → node-fs-DY2fO5zd.js} +1 -1
  68. package/{node-fs-nfX7wisL.cjs → node-fs-vsWuoMGa.cjs} +1 -1
  69. package/opfs.cjs +1 -1
  70. package/opfs.js +1 -1
  71. package/package.json +1 -1
  72. package/packages.cjs +1 -1
  73. package/packages.d.ts +1 -1
  74. package/packages.js +2 -2
  75. package/{proxy-Dixbk1WL.js → proxy-BXkxwBxK.js} +2 -2
  76. package/{proxy-CFK-KiwE.cjs → proxy-BfkfFsNI.cjs} +1 -1
  77. package/{proxy-BrsMJmiK.d.ts → proxy-CSKLtRTm.d.ts} +2 -2
  78. package/rooms.cjs +1 -1
  79. package/rooms.d.ts +1 -1
  80. package/rooms.js +13 -21
  81. package/{storage-BLBsmkmp.d.ts → storage-B_mXNAdB.d.ts} +4 -5
  82. package/{storage-Dn1gTLSZ.js → storage-C6F9SnDM.js} +2 -2
  83. package/{storage-D2cUJlVH.cjs → storage-DmRIhg1P.cjs} +1 -1
  84. package/utils-BpHmMkIR.cjs +1 -0
  85. package/{utils-C-cAd4r4.js → utils-Cyq8uJiy.js} +7 -9
  86. package/{wire-BwA4JjZH.d.ts → wire-Fk5pJaoy.d.ts} +8 -1
  87. package/wire.cjs +1 -1
  88. package/wire.d.ts +2 -2
  89. package/wire.js +2 -2
  90. package/api--LOXTOpv.cjs +0 -3
  91. package/busy-Dv8wzE5M.cjs +0 -1
  92. package/fs-CVnmXRf7.js +0 -513
  93. package/fs-p0bOOj5n.cjs +0 -1
  94. package/lib-47LPHYgB.cjs +0 -53
  95. package/utils-BvgGdrgN.cjs +0 -1
package/fs.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { STORAGE_ACCOUNT_CHANGED as e, STORAGE_ACCOUNT_PIN_UNSUPPORTED as t } from "./messages.js";
2
- import { c as n, n as r, t as i } from "./storage-Dn1gTLSZ.js";
3
- import { A as a, C as o, D as s, E as c, F as l, I as u, L as d, M as f, N as p, O as m, P as h, S as g, T as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, v as L, w as R, x as z, y as B } from "./fs-CVnmXRf7.js";
2
+ import { c as n, n as r, t as i } from "./storage-C6F9SnDM.js";
3
+ import { A as a, C as o, D as s, E as c, F as l, I as u, L as d, M as f, N as p, O as m, P as h, S as g, T as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, v as L, w as R, x as z, y as B } from "./fs-BY0Csn2V.js";
4
4
  export { e as STORAGE_ACCOUNT_CHANGED, t as STORAGE_ACCOUNT_PIN_UNSUPPORTED, i as StorageAccountChangedError, r as StorageAccountPinUnsupportedError, I as adopt, j as adoptable, P as appendFile, E as appendFileSync, y as available, k as default, M as exists, F as existsSync, x as flush, n as isAccountChanged, S as lstatSync, C as mkdir, N as mkdirSync, A as mount, T as onConflict, w as pending, v as pendingDeletes, L as promises, B as pull, b as readFile, z as readFileSealed, g as readFileSync, o as readdir, R as readdirSync, _ as remount, c as rename, s as renameSync, m as replicating, O as rm, a as rmSync, D as rmdirSync, f as stat, p as statSync, h as unlink, l as unlinkSync, u as writeFile, d as writeFileSync };
package/http.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Socket, t as Server$1 } from "./net-BFjtzAK0.js";
1
+ import { n as Socket, t as Server$1 } from "./net-taIhsmvu.js";
2
2
  import { Buffer } from "buffer";
3
3
  import { Stream } from "stream";
4
4
  import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
@@ -1,5 +1,5 @@
1
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-BLBsmkmp.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-B_mXNAdB.js";
3
3
  import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-d7pvCXPn.js";
4
4
  declare namespace hybrid_d_exports {
5
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 };
@@ -354,6 +354,22 @@ type Chain<M extends Modules, K extends ChainKind, R extends Rewrites = {}> = {
354
354
  };
355
355
  type Locator$1<M extends Modules = DefaultModules, R extends Rewrites = {}> = Chain<M, 'element', R>;
356
356
  type FrameLocator$1<M extends Modules = DefaultModules, R extends Rewrites = {}> = Chain<M, 'frame', R>;
357
+ //#endregion
358
+ //#region ../web-extension/lib/lib/revivables/fetch-compat.d.ts
359
+ type HeaderEntries = [string, string][];
360
+ declare const headersType: 'headers';
361
+ type BoxedHeaders = BoxBase<typeof headersType> & {
362
+ entries: HeaderEntries;
363
+ };
364
+ declare const responseType: 'response';
365
+ type BoxedResponse = BoxBase<typeof responseType> & {
366
+ status: number;
367
+ statusText: string;
368
+ headers: BoxedHeaders;
369
+ body: unknown;
370
+ url: string;
371
+ redirected: boolean;
372
+ };
357
373
  declare namespace video_d_exports {
358
374
  export { BoxedVideoElement, RemoteVideoElement, VideoElementState, box, createVideoElementHandle, isType, revive, type };
359
375
  }
@@ -423,7 +439,17 @@ declare const box: <T extends RemoteVideoElement, T2 extends RevivableContext>(v
423
439
  declare const revive: <T extends BoxedVideoElement, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
424
440
  //#endregion
425
441
  //#region ../web-extension/lib/lib/revivables/index.d.ts
426
- declare const handleRevivableModules: (defaults: DefaultRevivableModules) => readonly [typeof video_d_exports, typeof import("osra/build/revivables/transfer"), typeof import("osra/build/revivables/identity"), typeof import("osra/build/revivables/array-buffer"), typeof import("osra/build/revivables/date"), typeof import("osra/build/revivables/headers"), typeof import("osra/build/revivables/error"), typeof import("osra/build/revivables/typed-array"), typeof import("osra/build/revivables/promise"), typeof import("osra/build/revivables/function"), typeof import("osra/build/revivables/message-port"), typeof import("osra/build/revivables/readable-stream"), typeof import("osra/build/revivables/writable-stream"), typeof import("osra/build/revivables/abort-signal"), typeof import("osra/build/revivables/response"), typeof import("osra/build/revivables/request"), typeof import("osra/build/revivables/map"), typeof import("osra/build/revivables/set"), typeof import("osra/build/revivables/bigint"), typeof import("osra/build/revivables/symbol"), typeof import("osra/build/revivables/event"), typeof import("osra/build/revivables/async-iterator"), {
442
+ declare const handleRevivableModules: (defaults: DefaultRevivableModules) => readonly [typeof video_d_exports, {
443
+ type: "headers";
444
+ isType: (value: unknown) => value is Headers;
445
+ box: (value: Headers) => BoxedHeaders;
446
+ revive: (value: BoxedHeaders) => Headers;
447
+ }, {
448
+ type: "response";
449
+ isType: (value: unknown) => value is Response;
450
+ box: (value: Response, context: import("osra").RevivableContext) => BoxedResponse;
451
+ revive: (value: BoxedResponse, context: import("osra").RevivableContext) => Response;
452
+ }, typeof import("osra/build/revivables/transfer"), typeof import("osra/build/revivables/identity"), typeof import("osra/build/revivables/array-buffer"), typeof import("osra/build/revivables/date"), typeof import("osra/build/revivables/headers"), typeof import("osra/build/revivables/error"), typeof import("osra/build/revivables/typed-array"), typeof import("osra/build/revivables/promise"), typeof import("osra/build/revivables/function"), typeof import("osra/build/revivables/message-port"), typeof import("osra/build/revivables/readable-stream"), typeof import("osra/build/revivables/writable-stream"), typeof import("osra/build/revivables/abort-signal"), typeof import("osra/build/revivables/response"), typeof import("osra/build/revivables/request"), typeof import("osra/build/revivables/map"), typeof import("osra/build/revivables/set"), typeof import("osra/build/revivables/bigint"), typeof import("osra/build/revivables/symbol"), typeof import("osra/build/revivables/event"), typeof import("osra/build/revivables/async-iterator"), {
427
453
  readonly type: 'nonFiniteNumber';
428
454
  readonly isType: (value: unknown) => value is number;
429
455
  readonly box: (value: number, context: import("osra").RevivableContext<any>) => import("osra/build/revivables/json-primitives").BoxedNonFiniteNumber | number;
@@ -1162,7 +1188,8 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1162
1188
  * On the extension it also needs an extension new enough to run code (ABI 3, older ones are refused
1163
1189
  * with `ExtensionOperationUnsupportedError`), and it runs where the page's content security policy
1164
1190
  * allows it: a frame whose host the app declared has its CSP replaced, so code runs; an undeclared
1165
- * frame keeps its CSP, and a page that forbids `eval` refuses with a named error. On the cloud
1191
+ * frame, and every attached window, keeps its CSP, and a page that forbids `eval` refuses with a
1192
+ * named error. On the cloud
1166
1193
  * backend the code runs in the proxied document's realm, which mirage virtualizes: the page's own
1167
1194
  * eval refusal and Trusted Types requirement do not refuse the source `evaluate` compiles, and every
1168
1195
  * string that code compiles itself (`eval`, `Function`, a string timer) is held to them, as the
@@ -1266,10 +1293,6 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1266
1293
  * reload the app`.
1267
1294
  * - cloud, `Error` `frame.clearCookies: the cookies are gone from this attachment, but its jar did
1268
1295
  * not take the removal, so other attachments may still send them; call it again`.
1269
- * - cloud, `Error` `frame.clearCookies: this attachment's jar is sealed under the FKN account's key,
1270
- * which this device does not hold yet; unlock it and call it again`, with nothing removed: the
1271
- * jar runs without the sealed cookies until the key card is answered, so a removal then would
1272
- * only look done.
1273
1296
  * - cloud, `TimeoutError` `frame.clearCookies: the render proxy did not answer within 30000ms; the
1274
1297
  * cookies may or may not be gone, and calling it again is safe`.
1275
1298
  * - extension, `ExtensionOperationUnsupportedError` (operation `'clearCookies'`)
@@ -1315,6 +1338,8 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1315
1338
  * app started another goto, so nothing was sent.
1316
1339
  * - extension, `LocatorUnsupportedError`: `'*'`, which needs an extension release that reports the
1317
1340
  * frame's origin. Pass the origin.
1341
+ * - extension, `LocatorDeniedError`: a window whose page cut its link to the app's page
1342
+ * (`WindowFrame`).
1318
1343
  * - the terminal detach error once the attachment ended.
1319
1344
  */
1320
1345
  postMessage(message: unknown, targetOrigin: string, transfer?: Transferable[]): Promise<void>;
@@ -1323,17 +1348,17 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1323
1348
  * `message`: what the page posted to the app, with its `origin` and `ports`, and this Frame as
1324
1349
  * `source`. The page reaches the app with `parent.postMessage(x, appOrigin)`,
1325
1350
  * `top.postMessage(x, appOrigin)`, or `event.source.postMessage(x, event.origin)` on a message the
1326
- * app sent it. A document outside the attachment is dropped, never masked. On the cloud backend a
1327
- * post to `'*'` does not reach the app: there the page is its own parent, so it cannot be told apart
1328
- * from the page messaging itself, and it stays with the page. The extension delivers it, as a real
1329
- * parent would receive it.
1351
+ * app sent it; in an extension window, with `opener.postMessage(x, appOrigin)`. A document outside
1352
+ * the attachment is dropped, never masked. On the cloud backend a post to `'*'` does not reach the
1353
+ * app: there the page is its own parent, so it cannot be told apart from the page messaging itself,
1354
+ * and it stays with the page. The extension delivers it, as a real parent would receive it.
1330
1355
  *
1331
1356
  * `document`: a new document arrived in the frame. What `evaluate` installed in the one before is
1332
1357
  * gone, with every port it held, and nothing is reinstalled for the app: this is the signal to
1333
1358
  * install again. It can fire twice for one document (a return from the back/forward cache), so an
1334
1359
  * install should be idempotent. Cloud: fires for a document inside the attachment, with its origin,
1335
1360
  * and not for the document the frame already held when the first listener was added. Extension:
1336
- * fires on every load of the frame, with `origin` `''`.
1361
+ * fires on every load of an iframe and every new document of a window, with `origin` `''`.
1337
1362
  *
1338
1363
  * Listeners stay on the Frame across navigations and end with the attachment, or when `signal`
1339
1364
  * aborts, FKN's addition to Playwright's `on`. A listener added twice is called once, and one whose
@@ -1354,13 +1379,13 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1354
1379
  *
1355
1380
  * - `'persistent'`, the default: the cloud render proxy's jar of the app's top-level site
1356
1381
  * (https://fkn.app for every fkn.app app), which every app of that site shares, the same jar its
1357
- * inline frames and its windows use, kept across visits on this device. Once a key the FKN api
1358
- * vouched for reaches it, the jar is written sealed under a key derived from the account's for that
1359
- * site: a copy of the browser's files without that key shows none of its cookies, and a device that
1360
- * remembers the account's key holds what opens them. Without an account it is kept in the clear,
1361
- * and once an account's jar on that site is sealed, as a jar of its own that the account's never
1362
- * takes in. Always the cloud backend, whatever is installed, so `frame.backend()` answers
1363
- * `'cloud'`. Its requests leave through WebVPN, which keeps the cookies their answers set.
1382
+ * inline frames and its windows use, kept across visits on this device, signed in to FKN or not.
1383
+ * It is written sealed under a key the render proxy generates for that site's jar and keeps beside
1384
+ * it on the device, so no cookie of it is on disk in the clear, while a copy of the device's files
1385
+ * holds what opens it. Where an earlier build kept that jar in the clear, Chrome can keep the old
1386
+ * text in its files for a time after the seal. Always the cloud backend, whatever is installed, so
1387
+ * `frame.backend()` answers `'cloud'`. Its requests leave through WebVPN, which keeps the cookies
1388
+ * their answers set.
1364
1389
  * - `'ephemeral'`: a fresh jar of the attachment's own, with site storage under a namespace of its
1365
1390
  * own, both gone with it, seeded from `storageState` when one is given. Always the cloud backend:
1366
1391
  * the browser keeps a partition's cookies after its frame goes, so no extension jar ends with the
@@ -1393,11 +1418,12 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1393
1418
  * - `extension.attachFrame` with `'persistent'` or `'ephemeral'`, so also with no `cookies` at all:
1394
1419
  * `ExtensionOperationUnsupportedError` (operation `'cookies'`) `attachFrame: cookies: '<value>'
1395
1420
  * runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`
1396
- * - a window on `'native'`, through the top-level `attachFrame` or `extension.attachFrame`:
1397
- * `ExtensionOperationUnsupportedError` (operation `'attachWindow'`) `attachFrame: a window on
1398
- * cookies: 'native' is not served yet; a window runs on the cloud render proxy, which has no
1399
- * browser cookies`, with no install prompt, so the click's activation is left for the app's
1400
- * fallback
1421
+ * - a window on `'native'`, through the top-level `attachFrame` or `extension.attachFrame`, when
1422
+ * the extension does not announce `attachWindow` (one before ABI 5):
1423
+ * `ExtensionOperationUnsupportedError` (operation `'attachWindow'`) with the advice to update it,
1424
+ * and with no extension on the page at all `attachFrame: a window on cookies: 'native' needs the
1425
+ * FKN WebExtension, which is not on this page`. Neither waits or shows the install prompt, so the
1426
+ * click's activation is left for the app's fallback.
1401
1427
  */
1402
1428
  type AttachCookies = 'persistent' | 'ephemeral' | 'native';
1403
1429
  /**
@@ -1561,8 +1587,9 @@ type AttachWindowOptions = {
1561
1587
  * jar of the app that opened it, the same as that app's inline frames; a window whose app is on
1562
1588
  * another site shares cookies only with those frames, and its site storage stays its own.
1563
1589
  * `'ephemeral'`: a jar of the window's own that ends with it, seeded from `storageState`. Both
1564
- * run on the cloud backend whatever is installed. `'native'` is refused by name: a window runs on
1565
- * the cloud render proxy, and no backend serves a window on the browser's own cookies yet.
1590
+ * run on the cloud backend whatever is installed. `'native'`: a real browser window on the
1591
+ * extension, on the person's own browser session for every site it shows, as a window they opened
1592
+ * themselves would be (`WindowFrame` says what differs there).
1566
1593
  */
1567
1594
  cookies?: AttachCookies;
1568
1595
  /**
@@ -1570,22 +1597,49 @@ type AttachWindowOptions = {
1570
1597
  * activation, and goes to `window.url` once the seed is in place.
1571
1598
  */
1572
1599
  storageState?: StorageState;
1573
- /** Whole categories asked for once the window has connected, drawn in the window on the cloud backend. */
1600
+ /**
1601
+ * Whole categories asked for once the window has connected: the card is drawn in the window on the
1602
+ * cloud backend, and the sheet on the app's page on the extension, as every extension sheet is.
1603
+ */
1574
1604
  permissions?: CategoryRequest[];
1575
1605
  };
1576
- /** The Frame of an attachment that lives in its own window. */
1606
+ /**
1607
+ * The Frame of an attachment that lives in its own window.
1608
+ *
1609
+ * On the extension (`cookies: 'native'`) the window is a real browser popup the app's page opens with
1610
+ * `window.open`, whose page is the site itself: there is no FKN page in it. Where that differs:
1611
+ * - The Frame follows the window's page wherever it goes, as it follows an iframe's, and its reads
1612
+ * answer only inside the attachment. A page that goes to an FKN host ends the attachment (`closed`).
1613
+ * - `postMessage` and the `message` event need the window to keep its link to the app's page. A page
1614
+ * served with Cross-Origin-Opener-Policy (`same-origin`, `same-origin-allow-popups`) cuts it as it
1615
+ * loads, and `postMessage` is then the `LocatorDeniedError` `frame.postMessage: this window's page
1616
+ * no longer keeps a link to the app's page, so a message cannot reach it`. Everything else still
1617
+ * answers: the extension knows the window by its tab, never by that link. The page reaches the app
1618
+ * with `opener.postMessage(x, appOrigin)` while the link holds.
1619
+ * - Its consent sheets are drawn on the app's page, not in the window.
1620
+ * - `evaluate` keeps the window page's content security policy (an attached iframe on a declared host
1621
+ * has it replaced), so a page that forbids `eval` refuses with a named error.
1622
+ * - Calls after `closed` reject with the terminal `LocatorUnsupportedError` `extension.attachFrame:
1623
+ * the attached window closed; attach a fresh window`.
1624
+ * - The extension never throws `FrameWindowRefusedError`, which is the cloud's.
1625
+ */
1577
1626
  type WindowFrame = Frame & {
1578
1627
  /**
1579
1628
  * Ends the attachment and closes the window. On the cloud backend it first waits, at most 2
1580
1629
  * seconds, for the window's cookie changes to be committed to its jar, so a `goto` on the app's
1581
- * inline frame right after sees the session. Idempotent, and never rejects.
1630
+ * inline frame right after sees the session. On the extension the window ran on the person's own
1631
+ * browser cookies, which are already written, so an inline `'native'` frame sees a sign-in on its
1632
+ * next `goto`. Idempotent, and never rejects.
1582
1633
  */
1583
1634
  close(): Promise<void>;
1584
1635
  /**
1585
- * Resolves once the attachment has ended: the window was closed by anyone, reloaded, or left the
1586
- * page FKN attached; it stopped answering (a crash, a frozen page); it lost the app's cookie jar
1587
- * mid-session; or the app page went away. Never rejects. Calls made after it resolved reject with
1588
- * the terminal detach error.
1636
+ * Resolves once the attachment has ended, and never rejects. Calls made after it resolved reject
1637
+ * with the terminal detach error. On the cloud backend: the window was closed by anyone, reloaded,
1638
+ * or left the page FKN attached; it stopped answering (a crash, a frozen page); it lost the app's
1639
+ * cookie jar mid-session; or the app page went away. On the extension: the window was closed by
1640
+ * anyone, `close()` ran, its page went to an FKN host (a `goto` redirected there rejects with the
1641
+ * detach error), or the app page went away; the last two leave the window open for the person. Any
1642
+ * other reload or navigation in the window does not end it, since the Frame follows the window's page.
1589
1643
  */
1590
1644
  closed: Promise<void>;
1591
1645
  };
package/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-47LPHYgB.cjs"),n=require("./extension-3bxlAW8M.cjs"),r=require("./api--LOXTOpv.cjs"),i=require("./busy-Dv8wzE5M.cjs"),a=require("./cloud-CUzZFzG3.cjs"),o=require("./dns.cjs"),s=require("./net.cjs"),c=require("./dgram.cjs"),l=require("./http.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.et())return e(!0);let n,r=setTimeout(()=>i(t.et()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.et()),y)},o=new MutationObserver(()=>{t.et()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.et()&&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):a.i(n)}let i=e;return r===`native`?S(i):a.i(i)}),S=async e=>(a.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 n=await r.f;if(!n)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);r.d();let a=i.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=n.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(n,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await r.o).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await r.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:r.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=r.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`&&r.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`&&r.u(()=>{let e=r.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=()=>i.n(),W=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.BACKGROUND_STOPPED=n.a,exports.CATEGORIES=t.w,exports.EXTENSION_ABI=t.it,exports.ExtensionOperationUnsupportedError=t.at,exports.ExtensionOutdatedError=t.ot,exports.FORGEABLE_HEADERS=t.Y,exports.FrameWindowBlockedError=t.g,exports.FrameWindowRefusedError=t._,exports.LOCATOR_DENIED=t.k,exports.LOCATOR_ERROR=t.P,exports.LOCATOR_INVALID=t.I,exports.LOCATOR_UNSUPPORTED=t.E,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.st,exports.TimeoutError=t.T,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.H,exports.assertForgeableHeaders=t.X,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.Z,exports.attachFrame=x,exports.attachFramePermission=t.v,exports.box=t.ut,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return a.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.B,exports.createFrame=t.y,exports.createVideoElementHandle=t.dt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return n.t}}),exports.fetch=n.n,exports.fetchCredentialedPermission=t.W,exports.fetchLocalPermission=t.G,exports.fetchPermission=t.K,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.lt,exports.hasForgedCookie=t.Q,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return l.t}}),exports.isBackgroundStopped=n.o,exports.isBlockedFetchUrl=t.q,exports.isBlockedFrameUrl=t.C,exports.isExtensionExposed=t.et,exports.isLocalNetworkUrl=t.J,exports.isLocatorDenied=t.F,exports.isLocatorInvalid=t.j,exports.isLocatorUnsupported=t.D,exports.isPermissionDenied=t.n,exports.isTerminalError=t.N,exports.isType=t.ft,exports.modifyRequestHeadersPermission=t.L,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return s.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=n.i,exports.promptRelay=E,exports.readCookiePermission=t.V,exports.readExtensionHandshake=t.tt,exports.relayWorker=w,exports.removeRequestHeaderRule=t.R,exports.revive=t.pt,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.nt,exports.setRequestHeaderRule=t.z,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.ct,exports.type=t.mt,exports.waitForExtensionExposure=t.rt;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-CK2F5cc1.cjs"),n=require("./extension-eG1RMTDc.cjs"),r=require("./api-DMnVye0K.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./cloud-DL4i8kvf.cjs"),o=require("./dns.cjs"),s=require("./net.cjs"),c=require("./dgram.cjs"),l=require("./http.cjs"),u=require("./desktop.cjs"),d=require("./account.cjs"),f=require("./fs-DnF1cQuE.cjs"),p=require("./opfs.cjs"),m=require("./packages.cjs"),h=require("./rooms.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.et())return e(!0);let n,r=setTimeout(()=>i(t.et()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.et()),y)},o=new MutationObserver(()=>{t.et()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.et()&&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):a.i(n)}let i=e;return r===`native`?S(i):a.i(i)}),S=async e=>(a.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 n=await r.f;if(!n)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);r.d(),i.r(`relayed worker`,t?.unregisterSignal);let a=n.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(n,e,{key:`fkn-api`,...a,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await r.o).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await r.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:r.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=r.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`&&r.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`&&r.u(()=>{let e=r.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=()=>i.n(),W=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.BACKGROUND_STOPPED=n.a,exports.CATEGORIES=t.w,exports.EXTENSION_ABI=t.it,exports.ExtensionOperationUnsupportedError=t.at,exports.ExtensionOutdatedError=t.ot,exports.FORGEABLE_HEADERS=t.Y,exports.FrameWindowBlockedError=t.g,exports.FrameWindowRefusedError=t._,exports.LOCATOR_DENIED=t.k,exports.LOCATOR_ERROR=t.P,exports.LOCATOR_INVALID=t.I,exports.LOCATOR_UNSUPPORTED=t.E,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.st,exports.TimeoutError=t.T,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return d.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.H,exports.assertForgeableHeaders=t.X,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.Z,exports.attachFrame=x,exports.attachFramePermission=t.v,exports.box=t.ut,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return a.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.B,exports.createFrame=t.y,exports.createVideoElementHandle=t.dt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return n.t}}),exports.fetch=n.n,exports.fetchCredentialedPermission=t.W,exports.fetchLocalPermission=t.G,exports.fetchPermission=t.K,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return f.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.lt,exports.hasForgedCookie=t.Q,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return l.t}}),exports.isBackgroundStopped=n.o,exports.isBlockedFetchUrl=t.q,exports.isBlockedFrameUrl=t.C,exports.isExtensionExposed=t.et,exports.isLocalNetworkUrl=t.J,exports.isLocatorDenied=t.F,exports.isLocatorInvalid=t.j,exports.isLocatorUnsupported=t.D,exports.isPermissionDenied=t.n,exports.isTerminalError=t.N,exports.isType=t.ft,exports.modifyRequestHeadersPermission=t.L,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return p.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return m.t}}),exports.permissions=t.r,exports.promptInstall=n.i,exports.promptRelay=E,exports.readCookiePermission=t.V,exports.readExtensionHandshake=t.tt,exports.relayWorker=w,exports.removeRequestHeaderRule=t.R,exports.revive=t.pt,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return h.t}}),exports.setMissingExtensionHandler=t.nt,exports.setRequestHeaderRule=t.z,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.ct,exports.type=t.mt,exports.waitForExtensionExposure=t.rt;
package/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as account_d_exports } from "./account.js";
2
- import { $ as GateTools, A as attachFramePermission, B as CategoryMeta, C as FrameWindowRefusal, D as StorageState, E as Locator, F as LegacyPermissionRequest, G as VideoElementState, H as handleRevivableModules, I as PermissionGrant, J as isType, K as box, L as PermissionRequest, M as gotoPermission, N as CategoryGrant, O as StorageStateCookie, P as CategoryRequest, Q as Gate, R as permissions, S as FrameWindowOptions, T as GotoOptions, U as BoxedVideoElement, V as PermissionCategory, W as RemoteVideoElement, X as type, Y as revive, Z as Executor, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, et as OperationRequest, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as createFrame, k as WindowFrame, l as ClearCookiesOptions, m as FrameBackendEvent, o as AttachFrameOptions, p as FrameBackend, q as createVideoElementHandle, r as AttachFrameFunction, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, tt as SelectorPart, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as CATEGORIES } from "./index-B98wvTaI.js";
3
- import { $ as isLocatorInvalid, A as CookieDetails, B as fetchPermission, C as assertLockdownApplicable, D as modifyRequestHeadersPermission, E as RequestHeaderRule, F as ProxyFetchRequest, G as assertOneCookieIdentity, H as isLocalNetworkUrl, I as assertFetchableUrl, J as LOCATOR_ERROR, K as hasForgedCookie, M as cookies, N as readCookiePermission, O as removeRequestHeaderRule, P as FetchInit, Q as isLocatorDenied, R as fetchCredentialedPermission, S as assertAttachableFrameUrl, T as HeaderOperation, U as FORGEABLE_HEADERS, V as isBlockedFetchUrl, W as assertForgeableHeaders, X as LOCATOR_UNSUPPORTED, Y as LOCATOR_INVALID, Z as TimeoutError, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorUnsupported, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as SiteCookie, k as setRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as LOCATOR_DENIED, s as readExtensionHandshake, t as extension_d_exports, tt as isTerminalError, u as EXTENSION_ABI, v as isBackgroundStopped, w as isBlockedFrameUrl, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchLocalPermission } from "./extension-C2tBRE9i.js";
4
- import { n as cloud_d_exports } from "./cloud-DSx-jDFk.js";
2
+ import { $ as GateTools, A as attachFramePermission, B as CategoryMeta, C as FrameWindowRefusal, D as StorageState, E as Locator, F as LegacyPermissionRequest, G as VideoElementState, H as handleRevivableModules, I as PermissionGrant, J as isType, K as box, L as PermissionRequest, M as gotoPermission, N as CategoryGrant, O as StorageStateCookie, P as CategoryRequest, Q as Gate, R as permissions, S as FrameWindowOptions, T as GotoOptions, U as BoxedVideoElement, V as PermissionCategory, W as RemoteVideoElement, X as type, Y as revive, Z as Executor, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, et as OperationRequest, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as createFrame, k as WindowFrame, l as ClearCookiesOptions, m as FrameBackendEvent, o as AttachFrameOptions, p as FrameBackend, q as createVideoElementHandle, r as AttachFrameFunction, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, tt as SelectorPart, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as CATEGORIES } from "./index-iawzrUiB.js";
3
+ import { $ as isLocatorInvalid, A as CookieDetails, B as fetchPermission, C as assertLockdownApplicable, D as modifyRequestHeadersPermission, E as RequestHeaderRule, F as ProxyFetchRequest, G as assertOneCookieIdentity, H as isLocalNetworkUrl, I as assertFetchableUrl, J as LOCATOR_ERROR, K as hasForgedCookie, M as cookies, N as readCookiePermission, O as removeRequestHeaderRule, P as FetchInit, Q as isLocatorDenied, R as fetchCredentialedPermission, S as assertAttachableFrameUrl, T as HeaderOperation, U as FORGEABLE_HEADERS, V as isBlockedFetchUrl, W as assertForgeableHeaders, X as LOCATOR_UNSUPPORTED, Y as LOCATOR_INVALID, Z as TimeoutError, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorUnsupported, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as SiteCookie, k as setRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as LOCATOR_DENIED, s as readExtensionHandshake, t as extension_d_exports, tt as isTerminalError, u as EXTENSION_ABI, v as isBackgroundStopped, w as isBlockedFrameUrl, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchLocalPermission } from "./extension-Bsvr9OaV.js";
4
+ import { n as cloud_d_exports } from "./cloud-Bdw5nX-B.js";
5
5
  import { t as dns_d_exports } from "./dns.js";
6
- import { s as net_d_exports } from "./net-BFjtzAK0.js";
6
+ import { s as net_d_exports } from "./net-taIhsmvu.js";
7
7
  import { t as dgram_d_exports } from "./dgram.js";
8
8
  import { t as http_d_exports } from "./http.js";
9
9
  import { t as desktop_d_exports } from "./desktop.js";
10
- import { u as index_d_exports } from "./index-DKr9L2RI.js";
10
+ import { u as index_d_exports } from "./index-D9x6A-Gx.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";
@@ -24,9 +24,10 @@ import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
24
24
  *
25
25
  * A window opens before the first await, so call this directly in the click or key handler whose
26
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.
27
+ * `'native'` it opens as a real browser window on the extension, with no exposure wait; an extension
28
+ * that does not announce `attachWindow`, or none at all, is refused at once with
29
+ * `ExtensionOperationUnsupportedError` (operation `'attachWindow'`), before anything opens or is
30
+ * waited for, so the same click can still open one on another value.
30
31
  */
31
32
  export declare const attachFrame: AttachFrameFunction;
32
33
  //#endregion
package/index.js CHANGED
@@ -1,62 +1,60 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { B as t, C as n, D as r, E as i, F as a, G as o, H as ee, I as te, J as ne, K as s, L as re, N as ie, P as ae, Q as c, R as l, S as oe, T as se, V as ce, W as le, X as ue, Y as de, Z as u, _ as d, a as f, at as p, b as m, ct as h, dt as g, et as _, ft as v, g as y, i as b, it as x, j as S, k as C, lt as w, mt 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-BFwrzgpu.js";
3
- import { a as fe, i as pe, n as me, o as he, t as ge } from "./extension-BnVG0YL4.js";
4
- import { c as U, d as _e, f as ve, o as W, u as G } from "./api-DIgTslNb.js";
5
- import { n as ye, t as be } from "./busy-B189uX--.js";
6
- import { a as xe, i as K, n as Se } from "./cloud-v5x4uhDC.js";
2
+ import { B as t, C as n, D as r, E as i, F as a, G as o, H as ee, I as te, J as ne, K as re, L as ie, N as ae, P as s, Q as c, R as oe, S as se, T as ce, V as le, W as ue, X as de, Y as fe, Z as l, _ as u, a as d, at as f, b as p, ct as m, dt as h, et as g, ft as _, g as v, i as y, it as b, j as x, k as S, lt as C, mt as w, n as T, nt as E, o as D, ot as O, pt as k, q as A, r as j, rt as M, st as N, t as P, tt as F, ut as I, v as L, w as R, x as z, y as B, z as V } from "./lib-zMHWCUXz.js";
3
+ import { a as pe, i as me, n as he, o as ge, t as _e } from "./extension-BeIkBEi3.js";
4
+ import { c as H, d as ve, f as ye, o as U, u as W } from "./api-ySazPAwN.js";
5
+ import { n as be, r as G } from "./busy-DsMWrSzc.js";
6
+ import { a as xe, i as K, n as Se } from "./cloud-BD7uzz5h.js";
7
7
  import { t as Ce } from "./dns.js";
8
8
  import { t as we } from "./net.js";
9
9
  import { t as Te } from "./dgram.js";
10
10
  import { t as Ee } from "./http.js";
11
11
  import { t as De } from "./desktop.js";
12
- import { u as Oe } from "./fs-CVnmXRf7.js";
13
- import { t as ke } from "./opfs.js";
14
- import { t as Ae } from "./packages.js";
15
- import { t as je } from "./rooms.js";
16
- import { t as Me } from "./account.js";
12
+ import { t as Oe } from "./account.js";
13
+ import { u as ke } from "./fs-BY0Csn2V.js";
14
+ import { t as Ae } from "./opfs.js";
15
+ import { t as je } from "./packages.js";
16
+ import { t as Me } from "./rooms.js";
17
17
  import { t as Ne } from "./connect-button-DtsN3X1J.js";
18
18
  import { relay as Pe } from "osra";
19
19
  //#region src/frame.ts
20
20
  var Fe = 1e4, Ie = 150, Le = () => new Promise((e) => {
21
- if (_()) return e(!0);
22
- let t, n = setTimeout(() => r(_()), Fe), r = (r) => {
21
+ if (g()) return e(!0);
22
+ let t, n = setTimeout(() => r(g()), Fe), r = (r) => {
23
23
  clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
24
24
  }, i = () => {
25
- clearTimeout(t), t = setTimeout(() => r(_()), Ie);
25
+ clearTimeout(t), t = setTimeout(() => r(g()), Ie);
26
26
  }, a = new MutationObserver(() => {
27
- _() && r(!0);
27
+ g() && r(!0);
28
28
  }), o = () => {
29
- document.readyState === "complete" && !_() && i();
29
+ document.readyState === "complete" && !g() && i();
30
30
  };
31
31
  a.observe(document.documentElement, {
32
32
  attributes: !0,
33
33
  attributeFilter: ["data-fkn-extension"]
34
34
  }), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
35
35
  }), Re = (async (e) => {
36
- let { kind: t, cookies: n } = O(e);
36
+ let { kind: t, cookies: n } = D(e);
37
37
  if (t === "window") {
38
38
  let t = e;
39
- return n === "native" ? f(t) : K(t);
39
+ return n === "native" ? d(t) : K(t);
40
40
  }
41
41
  let r = e;
42
42
  return n === "native" ? ze(r) : K(r);
43
- }), ze = async (e) => (xe(e), await Le(), f(e)), Be = "https://fkn.app", Ve = async (e, t) => {
43
+ }), ze = async (e) => (xe(e), await Le(), d(e)), Be = "https://fkn.app", Ve = async (e, t) => {
44
44
  if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
45
- let n = await ve;
45
+ let n = await ye;
46
46
  if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
47
- _e();
48
- let r = be("relayed worker");
49
- t?.unregisterSignal?.aborted ? r() : t?.unregisterSignal?.addEventListener("abort", r, { once: !0 });
50
- let i = n.emit instanceof MessagePort ? {} : {
47
+ ve(), G("relayed worker", t?.unregisterSignal);
48
+ let r = n.emit instanceof MessagePort ? {} : {
51
49
  originA: t?.originA ?? Be,
52
50
  originB: t?.originB ?? "*"
53
51
  };
54
52
  Pe(n, e, {
55
53
  key: "fkn-api",
56
- ...i,
54
+ ...r,
57
55
  unregisterSignal: t?.unregisterSignal
58
56
  });
59
- }, He = async () => typeof window > "u" ? !1 : (await W).connect.prompt(location.origin).catch(() => !1), Ue = async () => typeof window > "u" ? null : (await W).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), We = (e) => (q.add(e), () => {
57
+ }, He = async () => typeof window > "u" ? !1 : (await U).connect.prompt(location.origin).catch(() => !1), Ue = async () => typeof window > "u" ? null : (await U).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), We = (e) => (q.add(e), () => {
60
58
  q.delete(e);
61
59
  }), Ge = () => {
62
60
  if (q.size === 0) return !1;
@@ -72,18 +70,18 @@ var Fe = 1e4, Ie = 150, Le = () => new Promise((e) => {
72
70
  onUpdate: () => Xe,
73
71
  onUpdateTaken: () => Ze,
74
72
  updateReady: () => Je
75
- }), Je = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Ye = () => {
73
+ }), Je = async () => typeof window > "u" ? !1 : U.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Ye = () => {
76
74
  Y = !0;
77
75
  for (let e of [...J]) try {
78
76
  e();
79
77
  } catch {}
80
78
  }, X = 0, Z = () => {
81
- let e = U();
79
+ let e = H();
82
80
  e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Ye)).catch(() => {
83
81
  X === e.epoch && (X = 0);
84
82
  }));
85
83
  };
86
- typeof window < "u" && G(Z);
84
+ typeof window < "u" && W(Z);
87
85
  var Xe = async (e) => {
88
86
  if (typeof window > "u") return () => {};
89
87
  if (J.add(e), Y) try {
@@ -100,8 +98,8 @@ var Xe = async (e) => {
100
98
  } catch {}
101
99
  }
102
100
  };
103
- typeof window < "u" && G(() => {
104
- let e = U();
101
+ typeof window < "u" && W(() => {
102
+ let e = H();
105
103
  if (!e || Q === e.epoch) return;
106
104
  Q = e.epoch;
107
105
  let t = Ke(e.remote.shell, Qe);
@@ -113,6 +111,6 @@ typeof window < "u" && G(() => {
113
111
  Q === e.epoch && (Q = 0);
114
112
  });
115
113
  });
116
- var $e = () => ye(), et = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
114
+ var $e = () => be(), et = async () => typeof window > "u" ? !1 : U.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
117
115
  //#endregion
118
- export { b as ATTACH_FRAME_EVENT_KEY, fe as BACKGROUND_STOPPED, z as CATEGORIES, x as EXTENSION_ABI, p as ExtensionOperationUnsupportedError, k as ExtensionOutdatedError, de as FORGEABLE_HEADERS, y as FrameWindowBlockedError, d as FrameWindowRefusedError, C as LOCATOR_DENIED, ae as LOCATOR_ERROR, te as LOCATOR_INVALID, i as LOCATOR_UNSUPPORTED, F as PERMISSION_DENIED, P as REQUIRED_EXTENSION_ABI, se as TimeoutError, Me as account, B as assertAttachableFrameUrl, ee as assertFetchableUrl, ue as assertForgeableHeaders, oe as assertLockdownApplicable, u as assertOneCookieIdentity, Re as attachFrame, R as attachFramePermission, L as box, Se as cloud, He as connect, Ne as connectButtonUrl, t as cookies, V as createFrame, g as createVideoElementHandle, De as desktop, Te as dgram, Ce as dns, ge as extension, me as fetch, le as fetchCredentialedPermission, o as fetchLocalPermission, s as fetchPermission, Oe as fs, m as gotoPermission, w as handleRevivableModules, c as hasForgedCookie, Ee as http, he as isBackgroundStopped, j as isBlockedFetchUrl, n as isBlockedFrameUrl, _ as isExtensionExposed, ne as isLocalNetworkUrl, a as isLocatorDenied, S as isLocatorInvalid, r as isLocatorUnsupported, E as isPermissionDenied, ie as isTerminalError, v as isType, re as modifyRequestHeadersPermission, we as net, ke as opfs, Ae as packages, M as permissions, pe as promptInstall, Ue as promptRelay, ce as readCookiePermission, I as readExtensionHandshake, Ve as relayWorker, l as removeRequestHeaderRule, A as revive, je as rooms, D as setMissingExtensionHandler, H as setRequestHeaderRule, qe as shell, h as supportsOperation, T as type, N as waitForExtensionExposure };
116
+ export { y as ATTACH_FRAME_EVENT_KEY, pe as BACKGROUND_STOPPED, R as CATEGORIES, b as EXTENSION_ABI, f as ExtensionOperationUnsupportedError, O as ExtensionOutdatedError, fe as FORGEABLE_HEADERS, v as FrameWindowBlockedError, u as FrameWindowRefusedError, S as LOCATOR_DENIED, s as LOCATOR_ERROR, te as LOCATOR_INVALID, i as LOCATOR_UNSUPPORTED, P as PERMISSION_DENIED, N as REQUIRED_EXTENSION_ABI, ce as TimeoutError, Oe as account, z as assertAttachableFrameUrl, ee as assertFetchableUrl, de as assertForgeableHeaders, se as assertLockdownApplicable, l as assertOneCookieIdentity, Re as attachFrame, L as attachFramePermission, I as box, Se as cloud, He as connect, Ne as connectButtonUrl, t as cookies, B as createFrame, h as createVideoElementHandle, De as desktop, Te as dgram, Ce as dns, _e as extension, he as fetch, ue as fetchCredentialedPermission, o as fetchLocalPermission, re as fetchPermission, ke as fs, p as gotoPermission, C as handleRevivableModules, c as hasForgedCookie, Ee as http, ge as isBackgroundStopped, A as isBlockedFetchUrl, n as isBlockedFrameUrl, g as isExtensionExposed, ne as isLocalNetworkUrl, a as isLocatorDenied, x as isLocatorInvalid, r as isLocatorUnsupported, T as isPermissionDenied, ae as isTerminalError, _ as isType, ie as modifyRequestHeadersPermission, we as net, Ae as opfs, je as packages, j as permissions, me as promptInstall, Ue as promptRelay, le as readCookiePermission, F as readExtensionHandshake, Ve as relayWorker, oe as removeRequestHeaderRule, k as revive, Me as rooms, E as setMissingExtensionHandler, V as setRequestHeaderRule, qe as shell, m as supportsOperation, w as type, M as waitForExtensionExposure };