@fkn/lib 0.9.34 → 0.9.35

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 (89) hide show
  1. package/account.cjs +1 -1
  2. package/account.d.ts +6 -6
  3. package/account.js +3 -3
  4. package/{api-Bgsg9t9D.d.ts → api-CfmRAze5.d.ts} +1 -1
  5. package/{api-BdTgLphT.js → api-CtiKFcK3.js} +2 -2
  6. package/{api-MW-Lm0u8.cjs → api-Djf-XdZ4.cjs} +2 -2
  7. package/api.cjs +1 -1
  8. package/api.d.ts +2 -2
  9. package/api.js +1 -1
  10. package/attach-policy.d.ts +5 -5
  11. package/cloud/dns.d.ts +1 -1
  12. package/cloud/fetch.cjs +1 -1
  13. package/cloud/fetch.d.ts +1 -1
  14. package/cloud/fetch.js +1 -1
  15. package/cloud/fs/promises.d.ts +3 -4
  16. package/cloud/fs.cjs +1 -1
  17. package/cloud/fs.d.ts +2 -2
  18. package/cloud/fs.js +2 -2
  19. package/cloud/net.d.ts +1 -1
  20. package/cloud-B9Sd7V1g.js +422 -0
  21. package/cloud-DCWD_0sd.cjs +1 -0
  22. package/{cloud-C40YCPuv.d.ts → cloud-DxitkM7z.d.ts} +9 -5
  23. package/cloud.cjs +1 -1
  24. package/cloud.d.ts +4 -4
  25. package/cloud.js +2 -2
  26. package/{contract-Gd543I6m.d.ts → contract-D37GGkou.d.ts} +126 -1
  27. package/contract.cjs +1 -0
  28. package/contract.d.ts +2 -2
  29. package/contract.js +28 -0
  30. package/desktop.d.ts +7 -7
  31. package/dgram.cjs +1 -1
  32. package/dgram.d.ts +5 -5
  33. package/dgram.js +1 -1
  34. package/dns.cjs +1 -1
  35. package/dns.d.ts +3 -3
  36. package/dns.js +1 -1
  37. package/extension-DJQ0oYdk.js +89 -0
  38. package/extension-DSrUjoLw.cjs +1 -0
  39. package/{extension-Bm-PwsD6.d.ts → extension-TRYu_aG-.d.ts} +16 -13
  40. package/extension.cjs +1 -1
  41. package/extension.d.ts +3 -3
  42. package/extension.js +3 -3
  43. package/fs/promises.cjs +1 -1
  44. package/fs/promises.d.ts +3 -3
  45. package/fs/promises.js +1 -1
  46. package/{fs-CYcErwc4.d.ts → fs--NhtUyYa.d.ts} +1 -1
  47. package/{fs-O2bp9J0x.js → fs-BvNZePtN.js} +4 -4
  48. package/{fs-Bv3aFjqA.cjs → fs-D8RCGFNc.cjs} +1 -1
  49. package/fs.cjs +1 -1
  50. package/fs.d.ts +2 -2
  51. package/fs.js +1 -1
  52. package/http.d.ts +20 -20
  53. package/{index-DIK21kfh.d.ts → index-C_Lqta5o.d.ts} +110 -5
  54. package/{index-Cg6y_FTi.d.ts → index-kuPqkS_-.d.ts} +26 -3
  55. package/index.cjs +1 -1
  56. package/index.d.ts +25 -10
  57. package/index.js +51 -45
  58. package/{lib-C3f3XmGZ.js → lib-B-jGWfsv.js} +110 -60
  59. package/lib-Cjd91q7g.cjs +53 -0
  60. package/{net-BBtYFEzu.d.ts → net-0SlODFSM.d.ts} +2 -2
  61. package/net.cjs +1 -1
  62. package/net.d.ts +1 -1
  63. package/net.js +1 -1
  64. package/node-fs-BNTPsX5c.cjs +1 -0
  65. package/{node-fs-C9ECR_9H.js → node-fs-BZy9bzKd.js} +2 -2
  66. package/opfs/promises.d.ts +2 -2
  67. package/opfs.cjs +1 -1
  68. package/opfs.d.ts +2 -2
  69. package/opfs.js +1 -1
  70. package/package.json +1 -1
  71. package/packages.cjs +1 -1
  72. package/packages.d.ts +27 -27
  73. package/packages.js +1 -1
  74. package/{proxy-XeHtHIdZ.d.ts → proxy-Bmb2wxG1.d.ts} +2 -2
  75. package/{proxy-_m6Sqcr6.cjs → proxy-CYcaW5ew.cjs} +1 -1
  76. package/{proxy-fXckOcRn.js → proxy-DDwY3AVG.js} +1 -1
  77. package/react.d.ts +3 -3
  78. package/rooms.cjs +1 -1
  79. package/rooms.d.ts +8 -8
  80. package/rooms.js +1 -1
  81. package/{storage-C6Cd4J5E.js → storage-BbcnDCnc.js} +1 -1
  82. package/{storage-WZEvw3KN.d.ts → storage-ZrY4Y4L5.d.ts} +21 -2
  83. package/{storage-D2eBifiu.cjs → storage-dSi2dUKx.cjs} +1 -1
  84. package/cloud-DBNeXS9R.js +0 -272
  85. package/cloud-DHuqVKrl.cjs +0 -1
  86. package/extension-DALH11b4.js +0 -87
  87. package/extension-lR-cSs2P.cjs +0 -1
  88. package/lib-WiHTYaNP.cjs +0 -53
  89. package/node-fs-DZPGCYWg.cjs +0 -1
package/http.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { n as Socket, t as Server$1 } from "./net-BBtYFEzu.js";
1
+ import { n as Socket, t as Server$1 } from "./net-0SlODFSM.js";
2
2
  import { Buffer } from "buffer";
3
3
  import { Stream } from "stream";
4
4
  import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
5
5
  declare namespace http_d_exports {
6
6
  export { Agent, ClientRequest, ClientRequestArgs, HTTPParser, IncomingMessage, METHODS, ParsedHead, RequestListener, STATUS_CODES, Server, ServerResponse, ServerResponseOptions, _default, createServer, _default as default, get, globalAgent, request };
7
7
  }
8
- declare const METHODS: string[];
9
- declare const STATUS_CODES: Record<number, string>;
10
- interface ParsedHead {
8
+ export declare const METHODS: string[];
9
+ export declare const STATUS_CODES: Record<number, string>;
10
+ export interface ParsedHead {
11
11
  /** request only */
12
12
  method?: string;
13
13
  /** request only */
@@ -27,7 +27,7 @@ interface ParserHandlers {
27
27
  onBody: (chunk: Uint8Array) => void;
28
28
  onComplete: () => void;
29
29
  }
30
- declare class HTTPParser {
30
+ export declare class HTTPParser {
31
31
  private readonly mode;
32
32
  private readonly handlers;
33
33
  private buf;
@@ -47,7 +47,7 @@ declare class HTTPParser {
47
47
  private consumeBody;
48
48
  private consumeChunked;
49
49
  }
50
- declare class IncomingMessage extends Stream.Readable {
50
+ export declare class IncomingMessage extends Stream.Readable {
51
51
  httpVersion: string;
52
52
  httpVersionMajor: number;
53
53
  httpVersionMinor: number;
@@ -95,10 +95,10 @@ declare abstract class OutgoingMessage extends Stream.Writable {
95
95
  end(chunk?: unknown, encoding?: BufferEncoding | (() => void), callback?: () => void): this;
96
96
  protected _headBlock?: string;
97
97
  }
98
- interface ServerResponseOptions {
98
+ export interface ServerResponseOptions {
99
99
  req: IncomingMessage;
100
100
  }
101
- declare class ServerResponse extends OutgoingMessage {
101
+ export declare class ServerResponse extends OutgoingMessage {
102
102
  statusCode: number;
103
103
  statusMessage?: string;
104
104
  private _writeHeadCalled;
@@ -114,13 +114,13 @@ declare class ServerResponse extends OutgoingMessage {
114
114
  writeContinue(): void;
115
115
  setTimeout(msecs: number, callback?: () => void): this;
116
116
  }
117
- interface ClientRequestArgs extends RequestOptions {
117
+ export interface ClientRequestArgs extends RequestOptions {
118
118
  host?: string;
119
119
  hostname?: string;
120
120
  port?: number | string;
121
121
  path?: string;
122
122
  }
123
- declare class ClientRequest extends OutgoingMessage {
123
+ export declare class ClientRequest extends OutgoingMessage {
124
124
  method: string;
125
125
  path: string;
126
126
  host: string;
@@ -143,14 +143,14 @@ declare class ClientRequest extends OutgoingMessage {
143
143
  setNoDelay(noDelay?: boolean): void;
144
144
  setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
145
145
  }
146
- type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
146
+ export type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
147
147
  declare class ServerImpl extends Server$1 {
148
148
  constructor(options?: object | RequestListener, requestListener?: RequestListener);
149
149
  private _handleConnection;
150
150
  }
151
- declare const Server: typeof ServerImpl;
152
- type Server = ServerImpl;
153
- declare class Agent {
151
+ export declare const Server: typeof ServerImpl;
152
+ export type Server = ServerImpl;
153
+ export declare class Agent {
154
154
  maxSockets: number;
155
155
  maxFreeSockets: number;
156
156
  keepAlive: boolean;
@@ -163,11 +163,11 @@ declare class Agent {
163
163
  }): string;
164
164
  destroy(): void;
165
165
  }
166
- declare const globalAgent: Agent;
167
- declare const request: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
168
- declare const get: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
169
- declare const createServer: (options?: object | RequestListener, requestListener?: RequestListener) => Server;
170
- declare const _default: {
166
+ export declare const globalAgent: Agent;
167
+ export declare const request: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
168
+ export declare const get: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
169
+ export declare const createServer: (options?: object | RequestListener, requestListener?: RequestListener) => Server;
170
+ export declare const _default: {
171
171
  METHODS: string[];
172
172
  STATUS_CODES: Record<number, string>;
173
173
  Agent: typeof Agent;
@@ -182,4 +182,4 @@ declare const _default: {
182
182
  get: typeof get;
183
183
  };
184
184
  //#endregion
185
- export { Agent, ClientRequest, ClientRequestArgs, HTTPParser, IncomingMessage, METHODS, ParsedHead, RequestListener, STATUS_CODES, Server, ServerResponse, ServerResponseOptions, _default, _default as default, createServer, get, globalAgent, request, http_d_exports as t };
185
+ export { _default as default, http_d_exports as t };
@@ -130,14 +130,39 @@ type FrameFetchResult = {
130
130
  headers: [string, string][];
131
131
  body: ArrayBuffer;
132
132
  };
133
- //#endregion
134
- //#region ../frame-locator/lib/operations.d.ts
133
+ declare namespace operations_d_exports {
134
+ export { PositionOptions$1 as PositionOptions, click, count, exists, fill, getAttribute, hover, isVisible, textContent };
135
+ }
135
136
  type PositionOptions$1 = OperationOptions & {
136
137
  position?: {
137
138
  x?: number;
138
139
  y?: number;
139
140
  };
140
141
  };
142
+ declare const click: {
143
+ readonly resolve: (context: LocatorContext, options?: PositionOptions$1) => void;
144
+ };
145
+ declare const hover: {
146
+ readonly resolve: (context: LocatorContext, options?: PositionOptions$1) => void;
147
+ };
148
+ declare const fill: {
149
+ readonly resolve: (context: LocatorContext, value: string, _options?: OperationOptions) => void;
150
+ };
151
+ declare const textContent: {
152
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => string;
153
+ };
154
+ declare const getAttribute: {
155
+ readonly resolve: (context: LocatorContext, name: string, _options?: OperationOptions) => string | null;
156
+ };
157
+ declare const isVisible: {
158
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => boolean;
159
+ };
160
+ declare const count: {
161
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => number;
162
+ };
163
+ declare const exists: {
164
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => boolean;
165
+ };
141
166
  //#endregion
142
167
  //#region ../frame-locator/lib/modules.d.ts
143
168
  declare const defaultModules: {
@@ -826,7 +851,7 @@ type PermissionGrant = CategoryGrant | {
826
851
  site: string;
827
852
  allow: boolean;
828
853
  };
829
- declare const permissions$1: {
854
+ declare const permissions: {
830
855
  /**
831
856
  * Asks for permissions on one sheet (extension) or card (cloud), in the order given, and answers
832
857
  * one grant per request.
@@ -882,6 +907,79 @@ type AttachFrameOptions = {
882
907
  */
883
908
  permissions?: CategoryRequest[];
884
909
  };
910
+ /** Where an attachment's window opens and how big it asks to be. */
911
+ type FrameWindowOptions = {
912
+ /**
913
+ * Where the window opens: an http or https address, which must also pass the rules an iframe src
914
+ * does. Omitted, the window opens blank and the app navigates it with `goto`, which is how an app
915
+ * keeps the click's activation when the url needs an await first.
916
+ */
917
+ url?: string;
918
+ /** Inner width in CSS pixels, 500 by default. The browser may clamp it. */
919
+ width?: number;
920
+ /** Inner height in CSS pixels, 700 by default. The browser may clamp it. */
921
+ height?: number;
922
+ };
923
+ /**
924
+ * `attachFrame`'s options when the attachment is a new window rather than an iframe.
925
+ *
926
+ * Call `attachFrame` directly in the click or key handler: the window opens before the first await,
927
+ * with the activation of that event, and the browser's popup rules apply to it as to any page's own
928
+ * `window.open`. `iframe` and `lockdown` do not apply to a window, and passing either is a TypeError.
929
+ */
930
+ type AttachWindowOptions = {
931
+ window: FrameWindowOptions;
932
+ domains?: string[];
933
+ /**
934
+ * Cloud, true by default: the window uses the cookie jar of the app that opened it, the same jar
935
+ * as that app's inline frames. A window whose app is on another site shares cookies only with
936
+ * those frames; its site storage stays its own. False: a jar of the window's own that ends with
937
+ * it. Extension: false is a TypeError, since the window is the site's own first-party tab.
938
+ */
939
+ syncCookies?: boolean;
940
+ /** Whole categories asked for once the window has connected, drawn in the window on the cloud backend. */
941
+ permissions?: CategoryRequest[];
942
+ };
943
+ /** The Frame of an attachment that lives in its own window. */
944
+ type WindowFrame = Frame & {
945
+ /**
946
+ * Ends the attachment and closes the window. On the cloud backend it first waits, at most 2
947
+ * seconds, for the window's cookie changes to be committed to its jar, so a `goto` on the app's
948
+ * inline frame right after sees the session. Idempotent, and never rejects.
949
+ */
950
+ close(): Promise<void>;
951
+ /**
952
+ * Resolves once the attachment has ended: the window was closed by anyone, reloaded, or left the
953
+ * page FKN attached; it stopped answering (a crash, a frozen page); it lost the app's cookie jar
954
+ * mid-session; or the app page went away. Never rejects. Calls made after it resolved reject with
955
+ * the terminal detach error.
956
+ */
957
+ closed: Promise<void>;
958
+ };
959
+ /**
960
+ * `window.open` returned null, so nothing was opened: the call ran without user activation, the
961
+ * popup blocker refused it, or the calling frame is sandboxed without `allow-popups`.
962
+ */
963
+ declare class FrameWindowBlockedError extends Error {
964
+ readonly name = "FrameWindowBlockedError";
965
+ constructor();
966
+ }
967
+ /**
968
+ * Why a window refused to attach.
969
+ * `'jar-unreachable'`: the cookie jar of the app that opened it could not be reached.
970
+ * `'bad-url'`: the window would not open that address.
971
+ * `'opaque-opener'`: this page's origin is opaque (a sandboxed frame without `allow-same-origin`,
972
+ * or a `file:` page). A window can never address such a page, so none is opened.
973
+ * `'unknown'`: a reason this library does not know, sent by a newer window.
974
+ */
975
+ type FrameWindowRefusal = 'jar-unreachable' | 'bad-url' | 'opaque-opener' | 'unknown';
976
+ /** The window refused to attach, by `reason`, after loading nothing. */
977
+ declare class FrameWindowRefusedError extends Error {
978
+ readonly name = "FrameWindowRefusedError";
979
+ readonly reason: FrameWindowRefusal;
980
+ /** `reason` is what the window said; anything this library does not know becomes `'unknown'`. */
981
+ constructor(reason: unknown);
982
+ }
885
983
  type FrameBackend = {
886
984
  executor: Executor;
887
985
  gate?: Gate;
@@ -891,8 +989,15 @@ type FrameBackend = {
891
989
  };
892
990
  declare const createFrame: (backend: FrameBackend) => Frame;
893
991
  //#endregion
992
+ //#region ../web-extension/lib/lib/frame-window.d.ts
993
+ /** `attachFrame` in both of its shapes: an iframe the app mounted, or a window it opens. */
994
+ type AttachFrameFunction = {
995
+ (options: AttachWindowOptions): Promise<WindowFrame>;
996
+ (options: AttachFrameOptions): Promise<Frame>;
997
+ };
998
+ //#endregion
894
999
  //#region ../web-extension/lib/lib/frame.d.ts
895
1000
  declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY";
896
- declare const attachFrame: ({ iframe, domains, syncCookies, lockdown, permissions }: AttachFrameOptions) => Promise<Frame>;
1001
+ declare const attachFrame: AttachFrameFunction;
897
1002
  //#endregion
898
- export { Gate as A, VideoElementState as C, revive as D, isType as E, OperationRequest as M, SelectorPart as N, type as O, RemoteVideoElement as S, createVideoElementHandle as T, CATEGORIES as _, FrameBackend as a, handleRevivableModules as b, attachFramePermission as c, CategoryGrant as d, CategoryRequest as f, permissions$1 as g, PermissionRequest as h, Frame as i, GateTools as j, Executor as k, createFrame as l, PermissionGrant as m, attachFrame as n, GotoOptions as o, LegacyPermissionRequest as p, AttachFrameOptions as r, Locator as s, ATTACH_FRAME_EVENT_KEY as t, gotoPermission as u, CategoryMeta as v, box as w, BoxedVideoElement as x, PermissionCategory as y };
1003
+ export { VideoElementState as A, SelectorPart as B, permissions as C, handleRevivableModules as D, PermissionCategory as E, type as F, Executor as I, Gate as L, createVideoElementHandle as M, isType as N, BoxedVideoElement as O, revive as P, GateTools as R, PermissionRequest as S, CategoryMeta as T, gotoPermission as _, AttachWindowOptions as a, LegacyPermissionRequest as b, FrameWindowBlockedError as c, FrameWindowRefusedError as d, GotoOptions as f, createFrame as g, attachFramePermission as h, AttachFrameOptions as i, box as j, RemoteVideoElement as k, FrameWindowOptions as l, WindowFrame as m, attachFrame as n, Frame as o, Locator as p, AttachFrameFunction as r, FrameBackend as s, ATTACH_FRAME_EVENT_KEY as t, FrameWindowRefusal as u, CategoryGrant as v, CATEGORIES as w, PermissionGrant as x, CategoryRequest as y, OperationRequest as z };
@@ -1,13 +1,36 @@
1
1
  import { a as WriteData$1, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-BQgZVQl7.js";
2
- import { r as SealedRead } from "./storage-WZEvw3KN.js";
2
+ import { d as storage_d_exports, r as SealedRead } from "./storage-ZrY4Y4L5.js";
3
3
  //#region src/fs/types.d.ts
4
+ type FileEntry = {
5
+ path: string;
6
+ size: number;
7
+ contentType: string | null;
8
+ updatedAt: string | null;
9
+ };
4
10
  type WriteData = Blob | ArrayBuffer | Uint8Array | string;
5
- //#endregion
6
- //#region src/fs/hybrid.d.ts
11
+ type FileSystem = {
12
+ available: () => Promise<boolean>;
13
+ list: () => Promise<FileEntry[]>;
14
+ readFile: (path: string) => Promise<Blob>;
15
+ writeFile: (path: string, data: WriteData, opts?: {
16
+ contentType?: string;
17
+ }) => Promise<void>;
18
+ remove: (path: string) => Promise<void>;
19
+ };
20
+ declare namespace hybrid_d_exports {
21
+ export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, FileEntry, FileSystem, WriteData, adopt$1 as adopt, adoptable$1 as adoptable, available$1 as available, list, onConflict$1 as onConflict, pending$1 as pending, pendingDeletes$1 as pendingDeletes, pull$1 as pull, readFile$1 as readFile, readFileSealed$1 as readFileSealed, remove, replicating$1 as replicating, writeFile$1 as writeFile };
22
+ }
23
+ declare const available$1: () => Promise<boolean>;
7
24
  declare const pending$1: () => string[];
8
25
  declare const pendingDeletes$1: () => string[];
9
26
  declare const replicating$1: () => boolean;
27
+ declare const list: () => Promise<FileEntry[]>;
28
+ declare const readFile$1: (path: string) => Promise<Blob>;
10
29
  declare const readFileSealed$1: (path: string) => Promise<SealedRead>;
30
+ declare const writeFile$1: (path: string, data: WriteData, opts?: {
31
+ contentType?: string;
32
+ }) => Promise<void>;
33
+ declare const remove: (path: string) => Promise<void>;
11
34
  declare const pull$1: (path: string) => Promise<Blob>;
12
35
  type AdoptSummary = {
13
36
  uploaded: string[];
package/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-WiHTYaNP.cjs"),n=require("./api-MW-Lm0u8.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-DHuqVKrl.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-lR-cSs2P.cjs"),u=require("./desktop.cjs"),d=require("./fs-Bv3aFjqA.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.V())return e(!0);let n,r=setTimeout(()=>i(t.V()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.V()),y)},o=new MutationObserver(()=>{t.V()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.V()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),S=`https://fkn.app`,C=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??S,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},w=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),T=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),E=new Set,D=e=>(E.add(e),()=>{E.delete(e)}),O=()=>{if(E.size===0)return!1;for(let e of[...E])try{e()}catch{}return!0},k=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},A=e.t({applyUpdate:()=>U,busyReasons:()=>H,onUpdate:()=>L,onUpdateTaken:()=>R,updateReady:()=>j}),j=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),M=new Set,N=!1,P=()=>{N=!0;for(let e of[...M])try{e()}catch{}},F=0,I=()=>{let e=n.s();!e||M.size===0||F===e.epoch||(F=e.epoch,N=!1,Promise.resolve(e.remote.shell?.onUpdate(P)).catch(()=>{F===e.epoch&&(F=0)}))};typeof window<`u`&&n.l(I);var L=async e=>{if(typeof window>`u`)return()=>{};if(M.add(e),N)try{e()}catch{}return I(),()=>{M.delete(e)}},R=e=>typeof window>`u`?()=>{}:D(e),z=0,B=!1,V=()=>{if(!O()&&!B){B=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||z===e.epoch)return;z=e.epoch;let t=k(e.remote.shell,V);if(!t){z=0;return}t.catch(()=>{z===e.epoch&&(z=0)})});var H=()=>r.n(),U=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.C,exports.EXTENSION_ABI=t.G,exports.ExtensionOperationUnsupportedError=t.K,exports.ExtensionOutdatedError=t.q,exports.FORGEABLE_HEADERS=t.I,exports.LOCATOR_DENIED=t.y,exports.LOCATOR_ERROR=t.S,exports.LOCATOR_UNSUPPORTED=t.g,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.J,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.f,exports.assertFetchableUrl=t.k,exports.assertForgeableHeaders=t.L,exports.assertLockdownApplicable=t.p,exports.assertOneCookieIdentity=t.R,exports.attachFrame=x,exports.attachFramePermission=t.l,exports.box=t.Z,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=w,exports.connectButtonUrl=g.t,exports.cookies=t.D,exports.createFrame=t.u,exports.createVideoElementHandle=t.Q,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.j,exports.fetchLocalPermission=t.M,exports.fetchPermission=t.N,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.d,exports.handleRevivableModules=t.X,exports.hasForgedCookie=t.z,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.P,exports.isBlockedFrameUrl=t.m,exports.isExtensionExposed=t.V,exports.isLocalNetworkUrl=t.F,exports.isLocatorDenied=t.h,exports.isLocatorUnsupported=t.v,exports.isPermissionDenied=t.n,exports.isTerminalError=t.x,exports.isType=t.$,exports.modifyRequestHeadersPermission=t.w,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=T,exports.readCookiePermission=t.O,exports.readExtensionHandshake=t.H,exports.relayWorker=C,exports.removeRequestHeaderRule=t.T,exports.revive=t.et,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.U,exports.setRequestHeaderRule=t.E,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return A}}),exports.supportsOperation=t.Y,exports.type=t.tt,exports.waitForExtensionExposure=t.W;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-Cjd91q7g.cjs"),n=require("./api-Djf-XdZ4.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-DCWD_0sd.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-DSrUjoLw.cjs"),u=require("./desktop.cjs"),d=require("./fs-D8RCGFNc.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.G())return e(!0);let n,r=setTimeout(()=>i(t.G()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.G()),y)},o=new MutationObserver(()=>{t.G()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.G()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=(async e=>{if(t.o(e)===`window`){let n=e;return l.r()?t.a(n):i.a()?i.i(n):t.a(n)}return S(e)}),S=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=n.s();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&n.l(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>r.n(),W=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.D,exports.EXTENSION_ABI=t.Y,exports.ExtensionOperationUnsupportedError=t.X,exports.ExtensionOutdatedError=t.Z,exports.FORGEABLE_HEADERS=t.B,exports.FrameWindowBlockedError=t.d,exports.FrameWindowRefusedError=t.f,exports.LOCATOR_DENIED=t.C,exports.LOCATOR_ERROR=t.E,exports.LOCATOR_UNSUPPORTED=t.b,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.Q,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.g,exports.assertFetchableUrl=t.N,exports.assertForgeableHeaders=t.V,exports.assertLockdownApplicable=t._,exports.assertOneCookieIdentity=t.H,exports.attachFrame=x,exports.attachFramePermission=t.p,exports.box=t.tt,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.j,exports.createFrame=t.m,exports.createVideoElementHandle=t.nt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.F,exports.fetchLocalPermission=t.I,exports.fetchPermission=t.L,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.h,exports.handleRevivableModules=t.et,exports.hasForgedCookie=t.U,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.R,exports.isBlockedFrameUrl=t.v,exports.isExtensionExposed=t.G,exports.isLocalNetworkUrl=t.z,exports.isLocatorDenied=t.y,exports.isLocatorUnsupported=t.S,exports.isPermissionDenied=t.n,exports.isTerminalError=t.T,exports.isType=t.rt,exports.modifyRequestHeadersPermission=t.O,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=E,exports.readCookiePermission=t.M,exports.readExtensionHandshake=t.K,exports.relayWorker=w,exports.removeRequestHeaderRule=t.k,exports.revive=t.it,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.q,exports.setRequestHeaderRule=t.A,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.$,exports.type=t.at,exports.waitForExtensionExposure=t.J;
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { t as account_d_exports } from "./account.js";
2
- import { A as modifyRequestHeadersPermission, C as LOCATOR_ERROR, D as isTerminalError, E as isLocatorUnsupported, F as cookies, G as isLocalNetworkUrl, H as fetchLocalPermission, I as readCookiePermission, J as assertOneCookieIdentity, K as FORGEABLE_HEADERS, L as FetchInit, M as setRequestHeaderRule, N as CookieDetails, O as HeaderOperation, P as SiteCookie, R as ProxyFetchRequest, S as LOCATOR_DENIED, T as isLocatorDenied, U as fetchPermission, V as fetchCredentialedPermission, W as isBlockedFetchUrl, Y as hasForgedCookie, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as removeRequestHeaderRule, k as RequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as assertForgeableHeaders, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as LOCATOR_UNSUPPORTED, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as assertFetchableUrl } from "./extension-Bm-PwsD6.js";
3
- import { A as Gate, C as VideoElementState, D as revive, E as isType, M as OperationRequest, N as SelectorPart, O as type, S as RemoteVideoElement, T as createVideoElementHandle, _ as CATEGORIES, a as FrameBackend, b as handleRevivableModules, c as attachFramePermission, d as CategoryGrant, f as CategoryRequest, g as permissions, h as PermissionRequest, i as Frame, j as GateTools, k as Executor, l as createFrame, m as PermissionGrant, o as GotoOptions, p as LegacyPermissionRequest, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as CategoryMeta, w as box, x as BoxedVideoElement, y as PermissionCategory } from "./index-DIK21kfh.js";
4
- import { n as cloud_d_exports } from "./cloud-C40YCPuv.js";
2
+ import { A as VideoElementState, B as SelectorPart, C as permissions, D as handleRevivableModules, E as PermissionCategory, F as type, I as Executor, L as Gate, M as createVideoElementHandle, N as isType, O as BoxedVideoElement, P as revive, R as GateTools, S as PermissionRequest, T as CategoryMeta, _ as gotoPermission, a as AttachWindowOptions, b as LegacyPermissionRequest, c as FrameWindowBlockedError, d as FrameWindowRefusedError, f as GotoOptions, g as createFrame, h as attachFramePermission, i as AttachFrameOptions, j as box, k as RemoteVideoElement, l as FrameWindowOptions, m as WindowFrame, o as Frame, p as Locator, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameWindowRefusal, v as CategoryGrant, w as CATEGORIES, x as PermissionGrant, y as CategoryRequest, z as OperationRequest } from "./index-C_Lqta5o.js";
3
+ import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as isLocatorUnsupported, K as LOCATOR_UNSUPPORTED, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, Y as isTerminalError, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as isLocatorDenied, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-TRYu_aG-.js";
4
+ import { n as cloud_d_exports } from "./cloud-DxitkM7z.js";
5
5
  import { t as dns_d_exports } from "./dns.js";
6
- import { u as index_d_exports } from "./index-Cg6y_FTi.js";
7
- import { s as net_d_exports } from "./net-BBtYFEzu.js";
6
+ import { u as index_d_exports } from "./index-kuPqkS_-.js";
7
+ import { s as net_d_exports } from "./net-0SlODFSM.js";
8
8
  import { t as dgram_d_exports } from "./dgram.js";
9
9
  import { t as http_d_exports } from "./http.js";
10
10
  import { t as desktop_d_exports } from "./desktop.js";
@@ -13,20 +13,35 @@ import { t as packages_d_exports } from "./packages.js";
13
13
  import { t as rooms_d_exports } from "./rooms.js";
14
14
  import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
15
15
  //#region src/frame.d.ts
16
- declare const attachFrame: (options: AttachFrameOptions) => Promise<Frame>;
16
+ /**
17
+ * Attaches FKN to an iframe the app mounted, on the extension when it is installed and on the cloud
18
+ * render proxy otherwise, or with `{ window }` opens the attachment in a window of its own.
19
+ *
20
+ * A window opens before the first await, so call this directly in the click or key handler whose
21
+ * activation opens it. It never waits for the extension to expose itself: a click lands on a loaded
22
+ * page, where the extension has exposed itself or never will.
23
+ *
24
+ * In this release only the cloud backend serves a window. With the extension installed, a window
25
+ * is refused at once with `ExtensionOperationUnsupportedError` (operation `'attachWindow'`), before
26
+ * anything opens or is waited for, so the same click can still open one with
27
+ * `cloud.attachFrame({ window })`. That window runs on this app's cloud cookie jar, not on the
28
+ * extension's: a sign-in made in it reaches this app's cloud frames, never an iframe attached
29
+ * through the extension.
30
+ */
31
+ export declare const attachFrame: AttachFrameFunction;
17
32
  //#endregion
18
33
  //#region src/relay.d.ts
19
- declare const relayWorker: (worker: Worker, options?: {
34
+ export declare const relayWorker: (worker: Worker, options?: {
20
35
  unregisterSignal?: AbortSignal;
21
36
  originA?: string;
22
37
  originB?: string;
23
38
  }) => Promise<void>;
24
39
  //#endregion
25
40
  //#region src/connect.d.ts
26
- declare const connect: () => Promise<boolean>;
41
+ export declare const connect: () => Promise<boolean>;
27
42
  //#endregion
28
43
  //#region src/relay-prompt.d.ts
29
- declare const promptRelay: () => Promise<string | null>;
44
+ export declare const promptRelay: () => Promise<string | null>;
30
45
  declare namespace shell_d_exports {
31
46
  export { applyUpdate, busyReasons, onUpdate, onUpdateTaken, updateReady };
32
47
  }
@@ -111,4 +126,4 @@ declare const busyReasons: () => string[];
111
126
  */
112
127
  declare const applyUpdate: () => Promise<boolean>;
113
128
  //#endregion
114
- export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, box, cloud_d_exports as cloud, connect, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, promptRelay, readCookiePermission, readExtensionHandshake, relayWorker, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
129
+ export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
package/index.js CHANGED
@@ -1,81 +1,87 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { $ 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 s, K as c, L as l, M as u, N as ne, O as re, P as ie, Q as ae, R as oe, S as se, T as ce, U as d, V as f, W as p, X as m, Y as h, Z as g, a as _, d as v, et as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, p as k, q as A, r as j, t as M, tt as N, u as P, v as F, w as I, x as L, y as R, z } from "./lib-C3f3XmGZ.js";
3
- import { a as B, l as V, s as H, u as U } from "./api-BdTgLphT.js";
4
- import { n as W, t as G } from "./busy-B189uX--.js";
5
- import { a as le, i as ue, n as de } from "./cloud-DBNeXS9R.js";
6
- import { t as K } from "./dns.js";
7
- import { t as fe } from "./net.js";
8
- import { t as pe } from "./dgram.js";
9
- import { t as me } from "./http.js";
10
- import { i as he, n as ge, r as _e, t as ve } from "./extension-DALH11b4.js";
11
- import { t as ye } from "./desktop.js";
12
- import { u as be } from "./fs-O2bp9J0x.js";
13
- import { t as xe } from "./opfs.js";
14
- import { t as Se } from "./packages.js";
15
- import { t as Ce } from "./rooms.js";
16
- import { t as we } from "./account.js";
17
- import { t as Te } from "./connect-button-DtsN3X1J.js";
18
- import { relay as Ee } from "osra";
2
+ import { $ as t, A as n, B as r, C as i, D as a, E as o, F as s, G as c, H as l, I as ee, J as te, K as ne, L as re, M as ie, N as ae, O as oe, Q as se, R as u, S as d, T as ce, U as le, V as ue, X as de, Y as f, Z as p, _ as m, a as h, at as g, b as _, d as v, et as y, f as b, g as x, h as S, i as C, it as w, j as T, k as E, m as D, n as O, nt as k, o as A, p as j, q as M, r as N, rt as P, t as F, tt as I, v as L, y as R, z } from "./lib-B-jGWfsv.js";
3
+ import { a as B, l as V, s as H, u as fe } from "./api-CtiKFcK3.js";
4
+ import { n as pe, t as me } from "./busy-B189uX--.js";
5
+ import { a as U, i as W, n as he } from "./cloud-B9Sd7V1g.js";
6
+ import { t as ge } from "./dns.js";
7
+ import { t as _e } from "./net.js";
8
+ import { t as ve } from "./dgram.js";
9
+ import { t as G } from "./http.js";
10
+ import { i as ye, n as be, r as K, t as xe } from "./extension-DJQ0oYdk.js";
11
+ import { t as Se } from "./desktop.js";
12
+ import { u as Ce } from "./fs-BvNZePtN.js";
13
+ import { t as we } from "./opfs.js";
14
+ import { t as Te } from "./packages.js";
15
+ import { t as Ee } from "./rooms.js";
16
+ import { t as De } from "./account.js";
17
+ import { t as Oe } from "./connect-button-DtsN3X1J.js";
18
+ import { relay as ke } from "osra";
19
19
  //#region src/frame.ts
20
- var De = 1e4, Oe = 150, ke = () => new Promise((e) => {
21
- if (f()) return e(!0);
22
- let t, n = setTimeout(() => r(f()), De), r = (r) => {
20
+ var Ae = 1e4, je = 150, Me = () => new Promise((e) => {
21
+ if (c()) return e(!0);
22
+ let t, n = setTimeout(() => r(c()), Ae), r = (r) => {
23
23
  clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
24
24
  }, i = () => {
25
- clearTimeout(t), t = setTimeout(() => r(f()), Oe);
25
+ clearTimeout(t), t = setTimeout(() => r(c()), je);
26
26
  }, a = new MutationObserver(() => {
27
- f() && r(!0);
27
+ c() && r(!0);
28
28
  }), o = () => {
29
- document.readyState === "complete" && !f() && i();
29
+ document.readyState === "complete" && !c() && 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
- }), Ae = async (e) => _e() || e.lockdown || !le() || await ke() ? _(e) : ue(e), je = "https://fkn.app", Me = async (e, t) => {
35
+ }), Ne = (async (e) => {
36
+ if (A(e) === "window") {
37
+ let t = e;
38
+ return K() ? h(t) : U() ? W(t) : h(t);
39
+ }
40
+ return Pe(e);
41
+ }), Pe = async (e) => K() || e.lockdown || !U() || await Me() ? h(e) : W(e), Fe = "https://fkn.app", Ie = async (e, t) => {
36
42
  if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
37
- let n = await U;
43
+ let n = await fe;
38
44
  if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
39
- let r = G("relayed worker");
45
+ let r = me("relayed worker");
40
46
  t?.unregisterSignal?.aborted ? r() : t?.unregisterSignal?.addEventListener("abort", r, { once: !0 });
41
47
  let i = n.emit instanceof MessagePort ? {} : {
42
- originA: t?.originA ?? je,
48
+ originA: t?.originA ?? Fe,
43
49
  originB: t?.originB ?? "*"
44
50
  };
45
- Ee(n, e, {
51
+ ke(n, e, {
46
52
  key: "fkn-api",
47
53
  ...i,
48
54
  unregisterSignal: t?.unregisterSignal
49
55
  });
50
- }, Ne = async () => typeof window > "u" ? !1 : (await B).connect.prompt(location.origin).catch(() => !1), Pe = async () => typeof window > "u" ? null : (await B).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), Fe = (e) => (q.add(e), () => {
56
+ }, Le = async () => typeof window > "u" ? !1 : (await B).connect.prompt(location.origin).catch(() => !1), Re = async () => typeof window > "u" ? null : (await B).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), ze = (e) => (q.add(e), () => {
51
57
  q.delete(e);
52
- }), Ie = () => {
58
+ }), Be = () => {
53
59
  if (q.size === 0) return !1;
54
60
  for (let e of [...q]) try {
55
61
  e();
56
62
  } catch {}
57
63
  return !0;
58
- }, Le = (e, t) => {
64
+ }, Ve = (e, t) => {
59
65
  if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
60
- }, Re = /* @__PURE__ */ e({
61
- applyUpdate: () => Ge,
62
- busyReasons: () => We,
63
- onUpdate: () => Ve,
64
- onUpdateTaken: () => He,
65
- updateReady: () => ze
66
- }), ze = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Be = () => {
66
+ }, He = /* @__PURE__ */ e({
67
+ applyUpdate: () => Ye,
68
+ busyReasons: () => Je,
69
+ onUpdate: () => Ge,
70
+ onUpdateTaken: () => Ke,
71
+ updateReady: () => Ue
72
+ }), Ue = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, We = () => {
67
73
  Y = !0;
68
74
  for (let e of [...J]) try {
69
75
  e();
70
76
  } catch {}
71
77
  }, X = 0, Z = () => {
72
78
  let e = H();
73
- !e || J.size === 0 || X === e.epoch || (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Be)).catch(() => {
79
+ e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(We)).catch(() => {
74
80
  X === e.epoch && (X = 0);
75
81
  }));
76
82
  };
77
83
  typeof window < "u" && V(Z);
78
- var Ve = async (e) => {
84
+ var Ge = async (e) => {
79
85
  if (typeof window > "u") return () => {};
80
86
  if (J.add(e), Y) try {
81
87
  e();
@@ -83,8 +89,8 @@ var Ve = async (e) => {
83
89
  return Z(), () => {
84
90
  J.delete(e);
85
91
  };
86
- }, He = (e) => typeof window > "u" ? () => {} : Fe(e), Q = 0, $ = !1, Ue = () => {
87
- if (!Ie() && !$) {
92
+ }, Ke = (e) => typeof window > "u" ? () => {} : ze(e), Q = 0, $ = !1, qe = () => {
93
+ if (!Be() && !$) {
88
94
  $ = !0;
89
95
  try {
90
96
  location.reload();
@@ -95,7 +101,7 @@ typeof window < "u" && V(() => {
95
101
  let e = H();
96
102
  if (!e || Q === e.epoch) return;
97
103
  Q = e.epoch;
98
- let t = Le(e.remote.shell, Ue);
104
+ let t = Ve(e.remote.shell, qe);
99
105
  if (!t) {
100
106
  Q = 0;
101
107
  return;
@@ -104,6 +110,6 @@ typeof window < "u" && V(() => {
104
110
  Q === e.epoch && (Q = 0);
105
111
  });
106
112
  });
107
- var We = () => W(), Ge = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
113
+ var Je = () => pe(), Ye = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
108
114
  //#endregion
109
- export { C as ATTACH_FRAME_EVENT_KEY, n as CATEGORIES, o as EXTENSION_ABI, c as ExtensionOperationUnsupportedError, A as ExtensionOutdatedError, te as FORGEABLE_HEADERS, R as LOCATOR_DENIED, se as LOCATOR_ERROR, x as LOCATOR_UNSUPPORTED, M as PERMISSION_DENIED, s as REQUIRED_EXTENSION_ABI, we as account, b as assertAttachableFrameUrl, T as assertFetchableUrl, l as assertForgeableHeaders, k as assertLockdownApplicable, oe as assertOneCookieIdentity, Ae as attachFrame, E as attachFramePermission, g as box, de as cloud, Ne as connect, Te as connectButtonUrl, r as cookies, P as createFrame, ae as createVideoElementHandle, ye as desktop, pe as dgram, K as dns, ve as extension, ge as fetch, w as fetchCredentialedPermission, u as fetchLocalPermission, ne as fetchPermission, be as fs, v as gotoPermission, m as handleRevivableModules, z as hasForgedCookie, me as http, ie as isBlockedFetchUrl, D as isBlockedFrameUrl, f as isExtensionExposed, a as isLocalNetworkUrl, S as isLocatorDenied, F as isLocatorUnsupported, O as isPermissionDenied, L as isTerminalError, t as isType, I as modifyRequestHeadersPermission, fe as net, xe as opfs, Se as packages, j as permissions, he as promptInstall, Pe as promptRelay, re as readCookiePermission, ee as readExtensionHandshake, Me as relayWorker, ce as removeRequestHeaderRule, y as revive, Ce as rooms, d as setMissingExtensionHandler, i as setRequestHeaderRule, Re as shell, h as supportsOperation, N as type, p as waitForExtensionExposure };
115
+ export { C as ATTACH_FRAME_EVENT_KEY, a as CATEGORIES, f as EXTENSION_ABI, de as ExtensionOperationUnsupportedError, p as ExtensionOutdatedError, r as FORGEABLE_HEADERS, v as FrameWindowBlockedError, b as FrameWindowRefusedError, i as LOCATOR_DENIED, o as LOCATOR_ERROR, _ as LOCATOR_UNSUPPORTED, F as PERMISSION_DENIED, se as REQUIRED_EXTENSION_ABI, De as account, x as assertAttachableFrameUrl, ae as assertFetchableUrl, ue as assertForgeableHeaders, m as assertLockdownApplicable, l as assertOneCookieIdentity, Ne as attachFrame, j as attachFramePermission, I as box, he as cloud, Le as connect, Oe as connectButtonUrl, T as cookies, D as createFrame, k as createVideoElementHandle, Se as desktop, ve as dgram, ge as dns, xe as extension, be as fetch, s as fetchCredentialedPermission, ee as fetchLocalPermission, re as fetchPermission, Ce as fs, S as gotoPermission, y as handleRevivableModules, le as hasForgedCookie, G as http, u as isBlockedFetchUrl, L as isBlockedFrameUrl, c as isExtensionExposed, z as isLocalNetworkUrl, R as isLocatorDenied, d as isLocatorUnsupported, O as isPermissionDenied, ce as isTerminalError, P as isType, oe as modifyRequestHeadersPermission, _e as net, we as opfs, Te as packages, N as permissions, ye as promptInstall, Re as promptRelay, ie as readCookiePermission, ne as readExtensionHandshake, Ie as relayWorker, E as removeRequestHeaderRule, w as revive, Ee as rooms, M as setMissingExtensionHandler, n as setRequestHeaderRule, He as shell, t as supportsOperation, g as type, te as waitForExtensionExposure };