@fkn/lib 0.9.46 → 0.9.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/{account-generation-B-6Pn0b5.cjs → 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-Cpi-qz1j.d.ts} +108 -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-B4_qsdaE.js} +14 -18
  25. package/{cloud-CUzZFzG3.cjs → cloud-BmwojOb5.cjs} +1 -1
  26. package/{cloud-DSx-jDFk.d.ts → cloud-DK3DtdsU.d.ts} +4 -4
  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-XlEPwc7b.d.ts} +127 -46
  31. package/contract.cjs +1 -1
  32. package/contract.d.ts +4 -4
  33. package/contract.js +6 -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-C2tBRE9i.d.ts → extension-C4Don9vi.d.ts} +6 -6
  41. package/{extension-BnVG0YL4.js → extension-hOZN6A1U.js} +4 -4
  42. package/{extension-3bxlAW8M.cjs → extension-uAlpUogG.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-DlBWSKwV.d.ts} +92 -32
  58. package/index.cjs +1 -1
  59. package/index.d.ts +12 -9
  60. package/index.js +60 -60
  61. package/lib-5z-jA7ND.cjs +53 -0
  62. package/{lib-BFwrzgpu.js → lib-Dhq4W2V8.js} +662 -491
  63. package/links.cjs +1 -0
  64. package/links.d.ts +65 -0
  65. package/links.js +187 -0
  66. package/{net-BFjtzAK0.d.ts → net-C2Yz0job.d.ts} +5 -5
  67. package/net.cjs +1 -1
  68. package/net.d.ts +1 -1
  69. package/net.js +11 -12
  70. package/{node-fs-CK2wWIYS.js → node-fs-DY2fO5zd.js} +1 -1
  71. package/{node-fs-nfX7wisL.cjs → node-fs-vsWuoMGa.cjs} +1 -1
  72. package/opfs.cjs +1 -1
  73. package/opfs.js +1 -1
  74. package/package.json +6 -1
  75. package/packages.cjs +1 -1
  76. package/packages.d.ts +1 -1
  77. package/packages.js +2 -2
  78. package/{proxy-Dixbk1WL.js → proxy-BXkxwBxK.js} +2 -2
  79. package/{proxy-BrsMJmiK.d.ts → proxy-BZ-YFeXe.d.ts} +2 -2
  80. package/{proxy-CFK-KiwE.cjs → proxy-BfkfFsNI.cjs} +1 -1
  81. package/rooms.cjs +1 -1
  82. package/rooms.d.ts +1 -1
  83. package/rooms.js +13 -21
  84. package/{storage-BLBsmkmp.d.ts → storage-B_mXNAdB.d.ts} +4 -5
  85. package/{storage-Dn1gTLSZ.js → storage-C6F9SnDM.js} +2 -2
  86. package/{storage-D2cUJlVH.cjs → storage-DmRIhg1P.cjs} +1 -1
  87. package/utils-BpHmMkIR.cjs +1 -0
  88. package/{utils-C-cAd4r4.js → utils-Cyq8uJiy.js} +7 -9
  89. package/{wire-BwA4JjZH.d.ts → wire-Fk5pJaoy.d.ts} +8 -1
  90. package/wire.cjs +1 -1
  91. package/wire.d.ts +2 -2
  92. package/wire.js +2 -2
  93. package/api--LOXTOpv.cjs +0 -3
  94. package/busy-Dv8wzE5M.cjs +0 -1
  95. package/fs-CVnmXRf7.js +0 -513
  96. package/fs-p0bOOj5n.cjs +0 -1
  97. package/lib-47LPHYgB.cjs +0 -53
  98. package/utils-BvgGdrgN.cjs +0 -1
@@ -9,6 +9,12 @@ type SelectorPart = {
9
9
  type LocatorContext = {
10
10
  document: Document;
11
11
  elements: Element[];
12
+ /**
13
+ * Set on a chain's first step, whose `elements` is the document element: that step searches the
14
+ * whole document, so it can match the root element itself, as Playwright's first step does. A later
15
+ * step searches below what the step before it matched.
16
+ */
17
+ topLevel?: boolean;
12
18
  };
13
19
  type SelectorRender = {
14
20
  fragment: string;
@@ -354,6 +360,22 @@ type Chain<M extends Modules, K extends ChainKind, R extends Rewrites = {}> = {
354
360
  };
355
361
  type Locator$1<M extends Modules = DefaultModules, R extends Rewrites = {}> = Chain<M, 'element', R>;
356
362
  type FrameLocator$1<M extends Modules = DefaultModules, R extends Rewrites = {}> = Chain<M, 'frame', R>;
363
+ //#endregion
364
+ //#region ../web-extension/lib/lib/revivables/fetch-compat.d.ts
365
+ type HeaderEntries = [string, string][];
366
+ declare const headersType: 'headers';
367
+ type BoxedHeaders = BoxBase<typeof headersType> & {
368
+ entries: HeaderEntries;
369
+ };
370
+ declare const responseType: 'response';
371
+ type BoxedResponse = BoxBase<typeof responseType> & {
372
+ status: number;
373
+ statusText: string;
374
+ headers: BoxedHeaders;
375
+ body: unknown;
376
+ url: string;
377
+ redirected: boolean;
378
+ };
357
379
  declare namespace video_d_exports {
358
380
  export { BoxedVideoElement, RemoteVideoElement, VideoElementState, box, createVideoElementHandle, isType, revive, type };
359
381
  }
@@ -423,7 +445,17 @@ declare const box: <T extends RemoteVideoElement, T2 extends RevivableContext>(v
423
445
  declare const revive: <T extends BoxedVideoElement, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
424
446
  //#endregion
425
447
  //#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"), {
448
+ declare const handleRevivableModules: (defaults: DefaultRevivableModules) => readonly [typeof video_d_exports, {
449
+ type: "headers";
450
+ isType: (value: unknown) => value is Headers;
451
+ box: (value: Headers) => BoxedHeaders;
452
+ revive: (value: BoxedHeaders) => Headers;
453
+ }, {
454
+ type: "response";
455
+ isType: (value: unknown) => value is Response;
456
+ box: (value: Response, context: import("osra").RevivableContext) => BoxedResponse;
457
+ revive: (value: BoxedResponse, context: import("osra").RevivableContext) => Response;
458
+ }, 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
459
  readonly type: 'nonFiniteNumber';
428
460
  readonly isType: (value: unknown) => value is number;
429
461
  readonly box: (value: number, context: import("osra").RevivableContext<any>) => import("osra/build/revivables/json-primitives").BoxedNonFiniteNumber | number;
@@ -1162,7 +1194,8 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1162
1194
  * On the extension it also needs an extension new enough to run code (ABI 3, older ones are refused
1163
1195
  * with `ExtensionOperationUnsupportedError`), and it runs where the page's content security policy
1164
1196
  * 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
1197
+ * frame, and every attached window, keeps its CSP, and a page that forbids `eval` refuses with a
1198
+ * named error. On the cloud
1166
1199
  * backend the code runs in the proxied document's realm, which mirage virtualizes: the page's own
1167
1200
  * eval refusal and Trusted Types requirement do not refuse the source `evaluate` compiles, and every
1168
1201
  * string that code compiles itself (`eval`, `Function`, a string timer) is held to them, as the
@@ -1266,10 +1299,6 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1266
1299
  * reload the app`.
1267
1300
  * - cloud, `Error` `frame.clearCookies: the cookies are gone from this attachment, but its jar did
1268
1301
  * 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
1302
  * - cloud, `TimeoutError` `frame.clearCookies: the render proxy did not answer within 30000ms; the
1274
1303
  * cookies may or may not be gone, and calling it again is safe`.
1275
1304
  * - extension, `ExtensionOperationUnsupportedError` (operation `'clearCookies'`)
@@ -1315,6 +1344,8 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1315
1344
  * app started another goto, so nothing was sent.
1316
1345
  * - extension, `LocatorUnsupportedError`: `'*'`, which needs an extension release that reports the
1317
1346
  * frame's origin. Pass the origin.
1347
+ * - extension, `LocatorDeniedError`: a window whose page cut its link to the app's page
1348
+ * (`WindowFrame`).
1318
1349
  * - the terminal detach error once the attachment ended.
1319
1350
  */
1320
1351
  postMessage(message: unknown, targetOrigin: string, transfer?: Transferable[]): Promise<void>;
@@ -1323,17 +1354,17 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1323
1354
  * `message`: what the page posted to the app, with its `origin` and `ports`, and this Frame as
1324
1355
  * `source`. The page reaches the app with `parent.postMessage(x, appOrigin)`,
1325
1356
  * `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.
1357
+ * app sent it; in an extension window, with `opener.postMessage(x, appOrigin)`. A document outside
1358
+ * the attachment is dropped, never masked. On the cloud backend a post to `'*'` does not reach the
1359
+ * app: there the page is its own parent, so it cannot be told apart from the page messaging itself,
1360
+ * and it stays with the page. The extension delivers it, as a real parent would receive it.
1330
1361
  *
1331
1362
  * `document`: a new document arrived in the frame. What `evaluate` installed in the one before is
1332
1363
  * gone, with every port it held, and nothing is reinstalled for the app: this is the signal to
1333
1364
  * install again. It can fire twice for one document (a return from the back/forward cache), so an
1334
1365
  * install should be idempotent. Cloud: fires for a document inside the attachment, with its origin,
1335
1366
  * 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` `''`.
1367
+ * fires on every load of an iframe and every new document of a window, with `origin` `''`.
1337
1368
  *
1338
1369
  * Listeners stay on the Frame across navigations and end with the attachment, or when `signal`
1339
1370
  * aborts, FKN's addition to Playwright's `on`. A listener added twice is called once, and one whose
@@ -1354,13 +1385,13 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1354
1385
  *
1355
1386
  * - `'persistent'`, the default: the cloud render proxy's jar of the app's top-level site
1356
1387
  * (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.
1388
+ * inline frames and its windows use, kept across visits on this device, signed in to FKN or not.
1389
+ * It is written sealed under a key the render proxy generates for that site's jar and keeps beside
1390
+ * it on the device, so no cookie of it is on disk in the clear, while a copy of the device's files
1391
+ * holds what opens it. Where an earlier build kept that jar in the clear, Chrome can keep the old
1392
+ * text in its files for a time after the seal. Always the cloud backend, whatever is installed, so
1393
+ * `frame.backend()` answers `'cloud'`. Its requests leave through WebVPN, which keeps the cookies
1394
+ * their answers set.
1364
1395
  * - `'ephemeral'`: a fresh jar of the attachment's own, with site storage under a namespace of its
1365
1396
  * own, both gone with it, seeded from `storageState` when one is given. Always the cloud backend:
1366
1397
  * the browser keeps a partition's cookies after its frame goes, so no extension jar ends with the
@@ -1393,11 +1424,12 @@ type Frame = Omit<FrameLocator, 'owner'> & {
1393
1424
  * - `extension.attachFrame` with `'persistent'` or `'ephemeral'`, so also with no `cookies` at all:
1394
1425
  * `ExtensionOperationUnsupportedError` (operation `'cookies'`) `attachFrame: cookies: '<value>'
1395
1426
  * 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
1427
+ * - a window on `'native'`, through the top-level `attachFrame` or `extension.attachFrame`, when
1428
+ * the extension does not announce `attachWindow` (one before ABI 5):
1429
+ * `ExtensionOperationUnsupportedError` (operation `'attachWindow'`) with the advice to update it,
1430
+ * and with no extension on the page at all `attachFrame: a window on cookies: 'native' needs the
1431
+ * FKN WebExtension, which is not on this page`. Neither waits or shows the install prompt, so the
1432
+ * click's activation is left for the app's fallback.
1401
1433
  */
1402
1434
  type AttachCookies = 'persistent' | 'ephemeral' | 'native';
1403
1435
  /**
@@ -1561,8 +1593,9 @@ type AttachWindowOptions = {
1561
1593
  * jar of the app that opened it, the same as that app's inline frames; a window whose app is on
1562
1594
  * another site shares cookies only with those frames, and its site storage stays its own.
1563
1595
  * `'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.
1596
+ * run on the cloud backend whatever is installed. `'native'`: a real browser window on the
1597
+ * extension, on the person's own browser session for every site it shows, as a window they opened
1598
+ * themselves would be (`WindowFrame` says what differs there).
1566
1599
  */
1567
1600
  cookies?: AttachCookies;
1568
1601
  /**
@@ -1570,22 +1603,49 @@ type AttachWindowOptions = {
1570
1603
  * activation, and goes to `window.url` once the seed is in place.
1571
1604
  */
1572
1605
  storageState?: StorageState;
1573
- /** Whole categories asked for once the window has connected, drawn in the window on the cloud backend. */
1606
+ /**
1607
+ * Whole categories asked for once the window has connected: the card is drawn in the window on the
1608
+ * cloud backend, and the sheet on the app's page on the extension, as every extension sheet is.
1609
+ */
1574
1610
  permissions?: CategoryRequest[];
1575
1611
  };
1576
- /** The Frame of an attachment that lives in its own window. */
1612
+ /**
1613
+ * The Frame of an attachment that lives in its own window.
1614
+ *
1615
+ * On the extension (`cookies: 'native'`) the window is a real browser popup the app's page opens with
1616
+ * `window.open`, whose page is the site itself: there is no FKN page in it. Where that differs:
1617
+ * - The Frame follows the window's page wherever it goes, as it follows an iframe's, and its reads
1618
+ * answer only inside the attachment. A page that goes to an FKN host ends the attachment (`closed`).
1619
+ * - `postMessage` and the `message` event need the window to keep its link to the app's page. A page
1620
+ * served with Cross-Origin-Opener-Policy (`same-origin`, `same-origin-allow-popups`) cuts it as it
1621
+ * loads, and `postMessage` is then the `LocatorDeniedError` `frame.postMessage: this window's page
1622
+ * no longer keeps a link to the app's page, so a message cannot reach it`. Everything else still
1623
+ * answers: the extension knows the window by its tab, never by that link. The page reaches the app
1624
+ * with `opener.postMessage(x, appOrigin)` while the link holds.
1625
+ * - Its consent sheets are drawn on the app's page, not in the window.
1626
+ * - `evaluate` keeps the window page's content security policy (an attached iframe on a declared host
1627
+ * has it replaced), so a page that forbids `eval` refuses with a named error.
1628
+ * - Calls after `closed` reject with the terminal `LocatorUnsupportedError` `extension.attachFrame:
1629
+ * the attached window closed; attach a fresh window`.
1630
+ * - The extension never throws `FrameWindowRefusedError`, which is the cloud's.
1631
+ */
1577
1632
  type WindowFrame = Frame & {
1578
1633
  /**
1579
1634
  * Ends the attachment and closes the window. On the cloud backend it first waits, at most 2
1580
1635
  * 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.
1636
+ * inline frame right after sees the session. On the extension the window ran on the person's own
1637
+ * browser cookies, which are already written, so an inline `'native'` frame sees a sign-in on its
1638
+ * next `goto`. Idempotent, and never rejects.
1582
1639
  */
1583
1640
  close(): Promise<void>;
1584
1641
  /**
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.
1642
+ * Resolves once the attachment has ended, and never rejects. Calls made after it resolved reject
1643
+ * with the terminal detach error. On the cloud backend: the window was closed by anyone, reloaded,
1644
+ * or left the page FKN attached; it stopped answering (a crash, a frozen page); it lost the app's
1645
+ * cookie jar mid-session; or the app page went away. On the extension: the window was closed by
1646
+ * anyone, `close()` ran, its page went to an FKN host (a `goto` redirected there rejects with the
1647
+ * detach error), or the app page went away; the last two leave the window open for the person. Any
1648
+ * other reload or navigation in the window does not end it, since the Frame follows the window's page.
1589
1649
  */
1590
1650
  closed: Promise<void>;
1591
1651
  };
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-5z-jA7ND.cjs"),n=require("./extension-uAlpUogG.cjs"),r=require("./api-DMnVye0K.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./contract.cjs"),o=require("./cloud-BmwojOb5.cjs"),s=require("./dns.cjs"),c=require("./net.cjs"),l=require("./dgram.cjs"),u=require("./http.cjs"),d=require("./desktop.cjs"),f=require("./account.cjs"),p=require("./fs-DnF1cQuE.cjs"),m=require("./opfs.cjs"),h=require("./packages.cjs"),g=require("./rooms.cjs"),_=require("./links.cjs"),v=require("./connect-button-BpXDs7tw.cjs");let y=require("osra");var b=1e4,x=150,S=()=>new Promise(e=>{if(t.et())return e(!0);let n,r=setTimeout(()=>i(t.et()),b),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.et()),x)},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()}),C=(async e=>{let{kind:n,cookies:r}=t.o(e);if(n===`window`){let n=e;return r===`native`?t.a(n):o.i(n)}let i=e;return r===`native`?w(i):o.i(i)}),w=async e=>(o.a(e),await S(),t.a(e)),T=`https://fkn.app`,E=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??T,originB:t?.originB??`*`};(0,y.relay)(n,e,{key:`fkn-api`,...a,unregisterSignal:t?.unregisterSignal})},D=async()=>typeof window>`u`?!1:(await r.o).connect.prompt(location.origin).catch(()=>!1),O=async()=>typeof window>`u`?null:(await r.o).relay.prompt().catch(()=>null),k=new Set,A=e=>(k.add(e),()=>{k.delete(e)}),j=()=>{if(k.size===0)return!1;for(let e of[...k])try{e()}catch{}return!0},M=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},N=e.t({applyUpdate:()=>K,busyReasons:()=>G,onUpdate:()=>B,onUpdateTaken:()=>V,updateReady:()=>P}),P=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),F=new Set,I=!1,L=()=>{I=!0;for(let e of[...F])try{e()}catch{}},R=0,z=()=>{let e=r.c();e&&F.size!==0&&R!==e.epoch&&(R=e.epoch,I=!1,Promise.resolve(e.remote.shell?.onUpdate(L)).catch(()=>{R===e.epoch&&(R=0)}))};typeof window<`u`&&r.u(z);var B=async e=>{if(typeof window>`u`)return()=>{};if(F.add(e),I)try{e()}catch{}return z(),()=>{F.delete(e)}},V=e=>typeof window>`u`?()=>{}:A(e),H=0,U=!1,W=()=>{if(!j()&&!U){U=!0;try{location.reload()}catch{}}};typeof window<`u`&&r.u(()=>{let e=r.c();if(!e||H===e.epoch)return;H=e.epoch;let t=M(e.remote.shell,W);if(!t){H=0;return}t.catch(()=>{H===e.epoch&&(H=0)})});var G=()=>i.n(),K=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.LINK_EXPIRES_MS=a.LINK_EXPIRES_MS,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 f.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.H,exports.assertForgeableHeaders=t.X,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.Z,exports.attachFrame=C,exports.attachFramePermission=t.v,exports.box=t.ut,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return o.n}}),exports.connect=D,exports.connectButtonUrl=v.t,exports.cookies=t.B,exports.createFrame=t.y,exports.createVideoElementHandle=t.dt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return d.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return l.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return s.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 p.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.lt,exports.hasForgedCookie=t.Q,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return u.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,Object.defineProperty(exports,"links",{enumerable:!0,get:function(){return _.t}}),exports.modifyRequestHeadersPermission=t.L,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return m.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return h.t}}),exports.permissions=t.r,exports.promptInstall=n.i,exports.promptRelay=O,exports.readCookiePermission=t.V,exports.readExtensionHandshake=t.tt,exports.relayWorker=E,exports.removeRequestHeaderRule=t.R,exports.revive=t.pt,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return g.t}}),exports.setMissingExtensionHandler=t.nt,exports.setRequestHeaderRule=t.z,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return N}}),exports.supportsOperation=t.ct,exports.type=t.mt,exports.waitForExtensionExposure=t.rt;
package/index.d.ts CHANGED
@@ -1,16 +1,18 @@
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-DlBWSKwV.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-C4Don9vi.js";
4
+ import { k as LINK_EXPIRES_MS } from "./contract-XlEPwc7b.js";
5
+ import { n as cloud_d_exports } from "./cloud-DK3DtdsU.js";
5
6
  import { t as dns_d_exports } from "./dns.js";
6
- import { s as net_d_exports } from "./net-BFjtzAK0.js";
7
+ import { s as net_d_exports } from "./net-C2Yz0job.js";
7
8
  import { t as dgram_d_exports } from "./dgram.js";
8
9
  import { t as http_d_exports } from "./http.js";
9
10
  import { t as desktop_d_exports } from "./desktop.js";
10
- import { u as index_d_exports } from "./index-DKr9L2RI.js";
11
+ import { u as index_d_exports } from "./index-D9x6A-Gx.js";
11
12
  import { t as index_d_exports$1 } from "./opfs.js";
12
13
  import { t as packages_d_exports } from "./packages.js";
13
14
  import { t as rooms_d_exports } from "./rooms.js";
15
+ import { t as links_d_exports } from "./links.js";
14
16
  import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
15
17
  //#region src/frame.d.ts
16
18
  /**
@@ -24,9 +26,10 @@ import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
24
26
  *
25
27
  * A window opens before the first await, so call this directly in the click or key handler whose
26
28
  * 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.
29
+ * `'native'` it opens as a real browser window on the extension, with no exposure wait; an extension
30
+ * that does not announce `attachWindow`, or none at all, is refused at once with
31
+ * `ExtensionOperationUnsupportedError` (operation `'attachWindow'`), before anything opens or is
32
+ * waited for, so the same click can still open one on another value.
30
33
  */
31
34
  export declare const attachFrame: AttachFrameFunction;
32
35
  //#endregion
@@ -126,4 +129,4 @@ declare const busyReasons: () => string[];
126
129
  */
127
130
  declare const applyUpdate: () => Promise<boolean>;
128
131
  //#endregion
129
- export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, StorageState, StorageStateCookie, TimeoutError, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBackgroundStopped, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
132
+ export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LINK_EXPIRES_MS, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, StorageState, StorageStateCookie, TimeoutError, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBackgroundStopped, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, links_d_exports as links, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
package/index.js CHANGED
@@ -1,90 +1,90 @@
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";
7
- import { t as Ce } from "./dns.js";
8
- import { t as we } from "./net.js";
9
- import { t as Te } from "./dgram.js";
10
- import { t as Ee } from "./http.js";
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";
17
- import { t as Ne } from "./connect-button-DtsN3X1J.js";
18
- import { relay as Pe } from "osra";
2
+ import { B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as ee, K as te, L as ne, N as re, P as ie, Q as ae, 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-Dhq4W2V8.js";
3
+ import { a as pe, i as me, n as he, o as ge, t as _e } from "./extension-hOZN6A1U.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 xe } from "./busy-DsMWrSzc.js";
6
+ import { LINK_EXPIRES_MS as Se } from "./contract.js";
7
+ import { a as Ce, i as G, n as we } from "./cloud-B4_qsdaE.js";
8
+ import { t as Te } from "./dns.js";
9
+ import { t as Ee } from "./net.js";
10
+ import { t as De } from "./dgram.js";
11
+ import { t as Oe } from "./http.js";
12
+ import { t as ke } from "./desktop.js";
13
+ import { t as Ae } from "./account.js";
14
+ import { u as je } from "./fs-BY0Csn2V.js";
15
+ import { t as Me } from "./opfs.js";
16
+ import { t as Ne } from "./packages.js";
17
+ import { t as Pe } from "./rooms.js";
18
+ import { t as Fe } from "./links.js";
19
+ import { t as Ie } from "./connect-button-DtsN3X1J.js";
20
+ import { relay as Le } from "osra";
19
21
  //#region src/frame.ts
20
- var Fe = 1e4, Ie = 150, Le = () => new Promise((e) => {
21
- if (_()) return e(!0);
22
- let t, n = setTimeout(() => r(_()), Fe), r = (r) => {
22
+ var Re = 1e4, ze = 150, Be = () => new Promise((e) => {
23
+ if (g()) return e(!0);
24
+ let t, n = setTimeout(() => r(g()), Re), r = (r) => {
23
25
  clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
24
26
  }, i = () => {
25
- clearTimeout(t), t = setTimeout(() => r(_()), Ie);
27
+ clearTimeout(t), t = setTimeout(() => r(g()), ze);
26
28
  }, a = new MutationObserver(() => {
27
- _() && r(!0);
29
+ g() && r(!0);
28
30
  }), o = () => {
29
- document.readyState === "complete" && !_() && i();
31
+ document.readyState === "complete" && !g() && i();
30
32
  };
31
33
  a.observe(document.documentElement, {
32
34
  attributes: !0,
33
35
  attributeFilter: ["data-fkn-extension"]
34
36
  }), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
35
- }), Re = (async (e) => {
36
- let { kind: t, cookies: n } = O(e);
37
+ }), Ve = (async (e) => {
38
+ let { kind: t, cookies: n } = D(e);
37
39
  if (t === "window") {
38
40
  let t = e;
39
- return n === "native" ? f(t) : K(t);
41
+ return n === "native" ? d(t) : G(t);
40
42
  }
41
43
  let r = e;
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) => {
44
+ return n === "native" ? He(r) : G(r);
45
+ }), He = async (e) => (Ce(e), await Be(), d(e)), Ue = "https://fkn.app", We = async (e, t) => {
44
46
  if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
45
- let n = await ve;
47
+ let n = await ye;
46
48
  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 ? {} : {
51
- originA: t?.originA ?? Be,
49
+ ve(), xe("relayed worker", t?.unregisterSignal);
50
+ let r = n.emit instanceof MessagePort ? {} : {
51
+ originA: t?.originA ?? Ue,
52
52
  originB: t?.originB ?? "*"
53
53
  };
54
- Pe(n, e, {
54
+ Le(n, e, {
55
55
  key: "fkn-api",
56
- ...i,
56
+ ...r,
57
57
  unregisterSignal: t?.unregisterSignal
58
58
  });
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), () => {
60
- q.delete(e);
61
- }), Ge = () => {
62
- if (q.size === 0) return !1;
63
- for (let e of [...q]) try {
59
+ }, Ge = async () => typeof window > "u" ? !1 : (await U).connect.prompt(location.origin).catch(() => !1), Ke = async () => typeof window > "u" ? null : (await U).relay.prompt().catch(() => null), K = /* @__PURE__ */ new Set(), qe = (e) => (K.add(e), () => {
60
+ K.delete(e);
61
+ }), q = () => {
62
+ if (K.size === 0) return !1;
63
+ for (let e of [...K]) try {
64
64
  e();
65
65
  } catch {}
66
66
  return !0;
67
- }, Ke = (e, t) => {
67
+ }, Je = (e, t) => {
68
68
  if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
69
- }, qe = /* @__PURE__ */ e({
70
- applyUpdate: () => et,
71
- busyReasons: () => $e,
72
- onUpdate: () => Xe,
73
- onUpdateTaken: () => Ze,
74
- 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 = () => {
69
+ }, Ye = /* @__PURE__ */ e({
70
+ applyUpdate: () => nt,
71
+ busyReasons: () => tt,
72
+ onUpdate: () => Qe,
73
+ onUpdateTaken: () => $e,
74
+ updateReady: () => Xe
75
+ }), Xe = async () => typeof window > "u" ? !1 : U.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Ze = () => {
76
76
  Y = !0;
77
77
  for (let e of [...J]) try {
78
78
  e();
79
79
  } catch {}
80
80
  }, X = 0, Z = () => {
81
- let e = U();
82
- e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Ye)).catch(() => {
81
+ let e = H();
82
+ e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Ze)).catch(() => {
83
83
  X === e.epoch && (X = 0);
84
84
  }));
85
85
  };
86
- typeof window < "u" && G(Z);
87
- var Xe = async (e) => {
86
+ typeof window < "u" && W(Z);
87
+ var Qe = async (e) => {
88
88
  if (typeof window > "u") return () => {};
89
89
  if (J.add(e), Y) try {
90
90
  e();
@@ -92,19 +92,19 @@ var Xe = async (e) => {
92
92
  return Z(), () => {
93
93
  J.delete(e);
94
94
  };
95
- }, Ze = (e) => typeof window > "u" ? () => {} : We(e), Q = 0, $ = !1, Qe = () => {
96
- if (!Ge() && !$) {
95
+ }, $e = (e) => typeof window > "u" ? () => {} : qe(e), Q = 0, $ = !1, et = () => {
96
+ if (!q() && !$) {
97
97
  $ = !0;
98
98
  try {
99
99
  location.reload();
100
100
  } catch {}
101
101
  }
102
102
  };
103
- typeof window < "u" && G(() => {
104
- let e = U();
103
+ typeof window < "u" && W(() => {
104
+ let e = H();
105
105
  if (!e || Q === e.epoch) return;
106
106
  Q = e.epoch;
107
- let t = Ke(e.remote.shell, Qe);
107
+ let t = Je(e.remote.shell, et);
108
108
  if (!t) {
109
109
  Q = 0;
110
110
  return;
@@ -113,6 +113,6 @@ typeof window < "u" && G(() => {
113
113
  Q === e.epoch && (Q = 0);
114
114
  });
115
115
  });
116
- var $e = () => ye(), et = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
116
+ var tt = () => be(), nt = async () => typeof window > "u" ? !1 : U.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
117
117
  //#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 };
118
+ 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, Se as LINK_EXPIRES_MS, S as LOCATOR_DENIED, ie as LOCATOR_ERROR, c as LOCATOR_INVALID, i as LOCATOR_UNSUPPORTED, P as PERMISSION_DENIED, N as REQUIRED_EXTENSION_ABI, ce as TimeoutError, Ae as account, z as assertAttachableFrameUrl, s as assertFetchableUrl, de as assertForgeableHeaders, se as assertLockdownApplicable, l as assertOneCookieIdentity, Ve as attachFrame, L as attachFramePermission, I as box, we as cloud, Ge as connect, Ie as connectButtonUrl, t as cookies, B as createFrame, h as createVideoElementHandle, ke as desktop, De as dgram, Te as dns, _e as extension, he as fetch, ue as fetchCredentialedPermission, o as fetchLocalPermission, te as fetchPermission, je as fs, p as gotoPermission, C as handleRevivableModules, ae as hasForgedCookie, Oe as http, ge as isBackgroundStopped, A as isBlockedFetchUrl, n as isBlockedFrameUrl, g as isExtensionExposed, ee as isLocalNetworkUrl, a as isLocatorDenied, x as isLocatorInvalid, r as isLocatorUnsupported, T as isPermissionDenied, re as isTerminalError, _ as isType, Fe as links, ne as modifyRequestHeadersPermission, Ee as net, Me as opfs, Ne as packages, j as permissions, me as promptInstall, Ke as promptRelay, le as readCookiePermission, F as readExtensionHandshake, We as relayWorker, oe as removeRequestHeaderRule, k as revive, Pe as rooms, E as setMissingExtensionHandler, V as setRequestHeaderRule, Ye as shell, m as supportsOperation, w as type, M as waitForExtensionExposure };