@fkn/lib 0.9.45 → 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 (99) 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-Cuf3ynZX.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-BD7uzz5h.js +548 -0
  25. package/{cloud-KBzjWzt1.d.ts → cloud-Bdw5nX-B.d.ts} +4 -4
  26. package/cloud-DL4i8kvf.cjs +1 -0
  27. package/cloud.cjs +1 -1
  28. package/cloud.d.ts +4 -4
  29. package/cloud.js +2 -2
  30. package/{contract-DP_jc5pZ.d.ts → contract-LOcbTDjP.d.ts} +8 -55
  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-BeIkBEi3.js +94 -0
  41. package/{extension-X8cnvZej.d.ts → extension-Bsvr9OaV.d.ts} +21 -3
  42. package/extension-eG1RMTDc.cjs +1 -0
  43. package/extension.cjs +1 -1
  44. package/extension.d.ts +2 -2
  45. package/extension.js +3 -3
  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-C8Y-YHrU.d.ts → index-iawzrUiB.d.ts} +92 -33
  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-H5-e2A1h.js → lib-zMHWCUXz.js} +677 -497
  63. package/{net-eyWUIVn2.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-8Zp-G5da.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/cloud-CKCrMMB_.cjs +0 -1
  93. package/cloud-CVWGyZRT.js +0 -559
  94. package/extension-Dmnh5pcs.js +0 -94
  95. package/extension-YBe6Q6r_.cjs +0 -1
  96. package/fs-CVnmXRf7.js +0 -513
  97. package/fs-p0bOOj5n.cjs +0 -1
  98. package/lib-D4uqe_rb.cjs +0 -53
  99. package/utils-BvgGdrgN.cjs +0 -1
@@ -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;
@@ -940,6 +966,8 @@ declare const permissions: {
940
966
  *
941
967
  * An ask naming a category or key the registry cannot place on a row is a `TypeError`, thrown
942
968
  * before anything is sent: its answer would have to name a category the caller never asked for.
969
+ * A category ask naming an FKN platform host is an Error, also before anything is sent; the
970
+ * extension answers `allow: false` for any item, legacy ones included, that names one.
943
971
  */
944
972
  request: (requests: PermissionRequest[]) => Promise<PermissionGrant[]>;
945
973
  };
@@ -1160,7 +1188,8 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1160
1188
  * On the extension it also needs an extension new enough to run code (ABI 3, older ones are refused
1161
1189
  * with `ExtensionOperationUnsupportedError`), and it runs where the page's content security policy
1162
1190
  * allows it: a frame whose host the app declared has its CSP replaced, so code runs; an undeclared
1163
- * 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
1164
1193
  * backend the code runs in the proxied document's realm, which mirage virtualizes: the page's own
1165
1194
  * eval refusal and Trusted Types requirement do not refuse the source `evaluate` compiles, and every
1166
1195
  * string that code compiles itself (`eval`, `Function`, a string timer) is held to them, as the
@@ -1264,10 +1293,6 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1264
1293
  * reload the app`.
1265
1294
  * - cloud, `Error` `frame.clearCookies: the cookies are gone from this attachment, but its jar did
1266
1295
  * not take the removal, so other attachments may still send them; call it again`.
1267
- * - cloud, `Error` `frame.clearCookies: this attachment's jar is sealed under the FKN account's key,
1268
- * which this device does not hold yet; unlock it and call it again`, with nothing removed: the
1269
- * jar runs without the sealed cookies until the key card is answered, so a removal then would
1270
- * only look done.
1271
1296
  * - cloud, `TimeoutError` `frame.clearCookies: the render proxy did not answer within 30000ms; the
1272
1297
  * cookies may or may not be gone, and calling it again is safe`.
1273
1298
  * - extension, `ExtensionOperationUnsupportedError` (operation `'clearCookies'`)
@@ -1313,6 +1338,8 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1313
1338
  * app started another goto, so nothing was sent.
1314
1339
  * - extension, `LocatorUnsupportedError`: `'*'`, which needs an extension release that reports the
1315
1340
  * frame's origin. Pass the origin.
1341
+ * - extension, `LocatorDeniedError`: a window whose page cut its link to the app's page
1342
+ * (`WindowFrame`).
1316
1343
  * - the terminal detach error once the attachment ended.
1317
1344
  */
1318
1345
  postMessage(message: unknown, targetOrigin: string, transfer?: Transferable[]): Promise<void>;
@@ -1321,17 +1348,17 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1321
1348
  * `message`: what the page posted to the app, with its `origin` and `ports`, and this Frame as
1322
1349
  * `source`. The page reaches the app with `parent.postMessage(x, appOrigin)`,
1323
1350
  * `top.postMessage(x, appOrigin)`, or `event.source.postMessage(x, event.origin)` on a message the
1324
- * app sent it. A document outside the attachment is dropped, never masked. On the cloud backend a
1325
- * post to `'*'` does not reach the app: there the page is its own parent, so it cannot be told apart
1326
- * from the page messaging itself, and it stays with the page. The extension delivers it, as a real
1327
- * 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.
1328
1355
  *
1329
1356
  * `document`: a new document arrived in the frame. What `evaluate` installed in the one before is
1330
1357
  * gone, with every port it held, and nothing is reinstalled for the app: this is the signal to
1331
1358
  * install again. It can fire twice for one document (a return from the back/forward cache), so an
1332
1359
  * install should be idempotent. Cloud: fires for a document inside the attachment, with its origin,
1333
1360
  * and not for the document the frame already held when the first listener was added. Extension:
1334
- * 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` `''`.
1335
1362
  *
1336
1363
  * Listeners stay on the Frame across navigations and end with the attachment, or when `signal`
1337
1364
  * aborts, FKN's addition to Playwright's `on`. A listener added twice is called once, and one whose
@@ -1352,13 +1379,13 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1352
1379
  *
1353
1380
  * - `'persistent'`, the default: the cloud render proxy's jar of the app's top-level site
1354
1381
  * (https://fkn.app for every fkn.app app), which every app of that site shares, the same jar its
1355
- * inline frames and its windows use, kept across visits on this device. Once a key the FKN api
1356
- * vouched for reaches it, the jar is written sealed under a key derived from the account's for that
1357
- * site: a copy of the browser's files without that key shows none of its cookies, and a device that
1358
- * remembers the account's key holds what opens them. Without an account it is kept in the clear,
1359
- * and once an account's jar on that site is sealed, as a jar of its own that the account's never
1360
- * takes in. Always the cloud backend, whatever is installed, so `frame.backend()` answers
1361
- * `'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.
1362
1389
  * - `'ephemeral'`: a fresh jar of the attachment's own, with site storage under a namespace of its
1363
1390
  * own, both gone with it, seeded from `storageState` when one is given. Always the cloud backend:
1364
1391
  * the browser keeps a partition's cookies after its frame goes, so no extension jar ends with the
@@ -1391,11 +1418,12 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1391
1418
  * - `extension.attachFrame` with `'persistent'` or `'ephemeral'`, so also with no `cookies` at all:
1392
1419
  * `ExtensionOperationUnsupportedError` (operation `'cookies'`) `attachFrame: cookies: '<value>'
1393
1420
  * runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`
1394
- * - a window on `'native'`, through the top-level `attachFrame` or `extension.attachFrame`:
1395
- * `ExtensionOperationUnsupportedError` (operation `'attachWindow'`) `attachFrame: a window on
1396
- * cookies: 'native' is not served yet; a window runs on the cloud render proxy, which has no
1397
- * browser cookies`, with no install prompt, so the click's activation is left for the app's
1398
- * 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.
1399
1427
  */
1400
1428
  type AttachCookies = 'persistent' | 'ephemeral' | 'native';
1401
1429
  /**
@@ -1559,8 +1587,9 @@ type AttachWindowOptions = {
1559
1587
  * jar of the app that opened it, the same as that app's inline frames; a window whose app is on
1560
1588
  * another site shares cookies only with those frames, and its site storage stays its own.
1561
1589
  * `'ephemeral'`: a jar of the window's own that ends with it, seeded from `storageState`. Both
1562
- * run on the cloud backend whatever is installed. `'native'` is refused by name: a window runs on
1563
- * 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).
1564
1593
  */
1565
1594
  cookies?: AttachCookies;
1566
1595
  /**
@@ -1568,22 +1597,49 @@ type AttachWindowOptions = {
1568
1597
  * activation, and goes to `window.url` once the seed is in place.
1569
1598
  */
1570
1599
  storageState?: StorageState;
1571
- /** 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
+ */
1572
1604
  permissions?: CategoryRequest[];
1573
1605
  };
1574
- /** 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
+ */
1575
1626
  type WindowFrame = Frame & {
1576
1627
  /**
1577
1628
  * Ends the attachment and closes the window. On the cloud backend it first waits, at most 2
1578
1629
  * seconds, for the window's cookie changes to be committed to its jar, so a `goto` on the app's
1579
- * 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.
1580
1633
  */
1581
1634
  close(): Promise<void>;
1582
1635
  /**
1583
- * Resolves once the attachment has ended: the window was closed by anyone, reloaded, or left the
1584
- * page FKN attached; it stopped answering (a crash, a frozen page); it lost the app's cookie jar
1585
- * mid-session; or the app page went away. Never rejects. Calls made after it resolved reject with
1586
- * 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.
1587
1643
  */
1588
1644
  closed: Promise<void>;
1589
1645
  };
@@ -1685,7 +1741,10 @@ declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY
1685
1741
  /**
1686
1742
  * Attaches through the extension, on `cookies: 'native'` only: the other values, the default
1687
1743
  * among them, are the cloud render proxy's, refused here with `ExtensionOperationUnsupportedError`
1688
- * (operation `'cookies'`) before any exposure wait (`AttachCookies`).
1744
+ * (operation `'cookies'`) before any exposure wait (`AttachCookies`). A `domains` entry, of the
1745
+ * attach or of a `goto`, or a `goto` target's host, that the frame's header rule would carry onto an
1746
+ * FKN platform host (one of them, one under one, or a parent such as `app`) is refused with an Error
1747
+ * before anything is armed.
1689
1748
  */
1690
1749
  declare const attachFrame: AttachFrameFunction;
1691
1750
  //#endregion
package/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-D4uqe_rb.cjs"),n=require("./extension-YBe6Q6r_.cjs"),r=require("./api--LOXTOpv.cjs"),i=require("./busy-Dv8wzE5M.cjs"),a=require("./cloud-CKCrMMB_.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.nt())return e(!0);let n,r=setTimeout(()=>i(t.nt()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.nt()),y)},o=new MutationObserver(()=>{t.nt()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.nt()&&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.ot,exports.ExtensionOperationUnsupportedError=t.st,exports.ExtensionOutdatedError=t.ct,exports.FORGEABLE_HEADERS=t.Z,exports.FrameWindowBlockedError=t.g,exports.FrameWindowRefusedError=t._,exports.LOCATOR_DENIED=t.A,exports.LOCATOR_ERROR=t.I,exports.LOCATOR_INVALID=t.R,exports.LOCATOR_UNSUPPORTED=t.D,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.lt,exports.TimeoutError=t.E,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.W,exports.assertForgeableHeaders=t.Q,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.$,exports.attachFrame=x,exports.attachFramePermission=t.v,exports.box=t.ft,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return a.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.H,exports.createFrame=t.y,exports.createVideoElementHandle=t.pt,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.K,exports.fetchLocalPermission=t.q,exports.fetchPermission=t.J,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.dt,exports.hasForgedCookie=t.et,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return l.t}}),exports.isBackgroundStopped=n.o,exports.isBlockedFetchUrl=t.Y,exports.isBlockedFrameUrl=t.C,exports.isExtensionExposed=t.nt,exports.isLocalNetworkUrl=t.X,exports.isLocatorDenied=t.L,exports.isLocatorInvalid=t.M,exports.isLocatorUnsupported=t.O,exports.isPermissionDenied=t.n,exports.isTerminalError=t.F,exports.isType=t.mt,exports.modifyRequestHeadersPermission=t.z,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.U,exports.readExtensionHandshake=t.rt,exports.relayWorker=w,exports.removeRequestHeaderRule=t.B,exports.revive=t.ht,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.it,exports.setRequestHeaderRule=t.V,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.ut,exports.type=t.gt,exports.waitForExtensionExposure=t.at;
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-C8Y-YHrU.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-X8cnvZej.js";
4
- import { n as cloud_d_exports } from "./cloud-KBzjWzt1.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-eyWUIVn2.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 { $ as t, A as n, B as r, C as i, D as a, E as o, F as ee, H as te, I as ne, J as s, K as re, L as ie, M as ae, O as c, Q as l, R as oe, S as se, U as ce, V as le, W as ue, X as de, Y as u, Z as d, _ as f, a as p, at as m, b as h, ct as g, dt as _, et as v, ft as y, g as b, gt as x, ht as S, i as C, it as w, lt as T, mt as E, n as D, nt as O, o as k, ot as A, pt as j, q as M, r as N, rt as P, st as F, t as I, ut as L, v as R, w as z, x as B, y as V, z as H } from "./lib-H5-e2A1h.js";
3
- import { a as fe, i as pe, n as me, o as he, t as ge } from "./extension-Dmnh5pcs.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-CVWGyZRT.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 (O()) return e(!0);
22
- let t, n = setTimeout(() => r(O()), 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(O()), Ie);
25
+ clearTimeout(t), t = setTimeout(() => r(g()), Ie);
26
26
  }, a = new MutationObserver(() => {
27
- O() && r(!0);
27
+ g() && r(!0);
28
28
  }), o = () => {
29
- document.readyState === "complete" && !O() && 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 } = k(e);
36
+ let { kind: t, cookies: n } = D(e);
37
37
  if (t === "window") {
38
38
  let t = e;
39
- return n === "native" ? p(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(), p(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 { C as ATTACH_FRAME_EVENT_KEY, fe as BACKGROUND_STOPPED, z as CATEGORIES, A as EXTENSION_ABI, F as ExtensionOperationUnsupportedError, g as ExtensionOutdatedError, d as FORGEABLE_HEADERS, b as FrameWindowBlockedError, f as FrameWindowRefusedError, n as LOCATOR_DENIED, ne as LOCATOR_ERROR, oe as LOCATOR_INVALID, a as LOCATOR_UNSUPPORTED, I as PERMISSION_DENIED, T as REQUIRED_EXTENSION_ABI, o as TimeoutError, Me as account, B as assertAttachableFrameUrl, ue as assertFetchableUrl, l as assertForgeableHeaders, se as assertLockdownApplicable, t as assertOneCookieIdentity, Re as attachFrame, R as attachFramePermission, y as box, Se as cloud, He as connect, Ne as connectButtonUrl, te as cookies, V as createFrame, j as createVideoElementHandle, De as desktop, Te as dgram, Ce as dns, ge as extension, me as fetch, re as fetchCredentialedPermission, M as fetchLocalPermission, s as fetchPermission, Oe as fs, h as gotoPermission, _ as handleRevivableModules, v as hasForgedCookie, Ee as http, he as isBackgroundStopped, u as isBlockedFetchUrl, i as isBlockedFrameUrl, O as isExtensionExposed, de as isLocalNetworkUrl, ie as isLocatorDenied, ae as isLocatorInvalid, c as isLocatorUnsupported, D as isPermissionDenied, ee as isTerminalError, E as isType, H as modifyRequestHeadersPermission, we as net, ke as opfs, Ae as packages, N as permissions, pe as promptInstall, Ue as promptRelay, ce as readCookiePermission, P as readExtensionHandshake, Ve as relayWorker, r as removeRequestHeaderRule, S as revive, je as rooms, w as setMissingExtensionHandler, le as setRequestHeaderRule, qe as shell, L as supportsOperation, x as type, m 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 };