@fkn/lib 0.9.36 → 0.9.38
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.
- package/{api-CaFuvyyV.d.ts → api-DF4nHz2Q.d.ts} +7 -7
- package/api.d.ts +2 -2
- package/attach-policy.cjs +1 -1
- package/attach-policy.js +1 -1
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud-Beg4iCRU.cjs +1 -0
- package/{cloud-Cqdq7Ujd.d.ts → cloud-Bfc6rkF2.d.ts} +3 -3
- package/cloud-EfyYfgVT.js +476 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +1 -1
- package/{contract-BIHGp6cz.d.ts → contract-InuLU8bI.d.ts} +85 -7
- package/contract.cjs +1 -1
- package/contract.d.ts +2 -2
- package/contract.js +6 -6
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/extension-B7jDaJVp.cjs +1 -0
- package/{extension-C9BRlqEY.d.ts → extension-Bm5x5R4R.d.ts} +2 -2
- package/extension-sNRjVbET.js +89 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/hosts-9dYv63ud.cjs +1 -0
- package/{hosts-77UAJbm1.js → hosts-BzbzOhG8.js} +31 -19
- package/http.d.ts +1 -1
- package/{index-BWJSnpRB.d.ts → index-DiOxvYoa.d.ts} +170 -1
- package/index.cjs +1 -1
- package/index.d.ts +5 -5
- package/index.js +12 -12
- package/lib-DYKLnpWs.cjs +53 -0
- package/{lib-hd9k5xOX.js → lib-FD1Ssqjt.js} +461 -332
- package/{net-BWFTx3k_.d.ts → net-DnXxFGm8.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-DaljzPSa.d.ts → proxy-BkaVTZAf.d.ts} +2 -2
- package/rooms.cjs +1 -1
- package/rooms.d.ts +26 -8
- package/rooms.js +9 -1
- package/cloud-CDRoRstb.js +0 -428
- package/cloud-DG_-Rt-L.cjs +0 -1
- package/extension-DisWHU7m.cjs +0 -1
- package/extension-jDvl0U_P.js +0 -89
- package/hosts-COiOMjp-.cjs +0 -1
- package/lib-DCPdYk-N.cjs +0 -53
|
@@ -745,6 +745,14 @@ declare const PERMISSIONS: readonly [{
|
|
|
745
745
|
readonly unsafe: true;
|
|
746
746
|
readonly title: 'Run the app’s code on this site';
|
|
747
747
|
readonly description: 'Lets the app run its own script inside this site, with full access to the page and the data it shows.';
|
|
748
|
+
}, {
|
|
749
|
+
readonly scope: 'frame.message';
|
|
750
|
+
readonly category: 'evaluation';
|
|
751
|
+
readonly severity: 3;
|
|
752
|
+
readonly chip: 'message the page';
|
|
753
|
+
readonly unsafe: true;
|
|
754
|
+
readonly title: 'Send messages to this site';
|
|
755
|
+
readonly description: 'Lets the app send messages and open channels into this site, which its scripts receive as their own.';
|
|
748
756
|
}, {
|
|
749
757
|
readonly scope: 'embed.iframe';
|
|
750
758
|
readonly category: 'interaction';
|
|
@@ -896,11 +904,81 @@ declare const gotoPermission: {
|
|
|
896
904
|
readonly description: 'Lets the app navigate to another site without leaving its window.';
|
|
897
905
|
};
|
|
898
906
|
type GotoOptions = {
|
|
907
|
+
/**
|
|
908
|
+
* When `goto` resolves: `'load'`, the default, once the document it brings fired load;
|
|
909
|
+
* `'documentstart'` once that document has started, possibly before the page's own scripts ran.
|
|
910
|
+
* Either way a call made after it runs on the document the goto brought, never on the one it
|
|
911
|
+
* replaced. On the cloud backend a `'documentstart'` goto resolves before its document commits: an
|
|
912
|
+
* `evaluate` or `postMessage` made after it waits for that document, and a locator call retries
|
|
913
|
+
* until it comes, each within its own timeout. If that document has not come by the goto's deadline,
|
|
914
|
+
* `evaluate` and `postMessage` reject, and a locator call runs on whatever document the frame holds,
|
|
915
|
+
* since the goto itself already resolved; on the extension the goto rejects instead.
|
|
916
|
+
*
|
|
917
|
+
* A goto that changes only the fragment of the url the page is at keeps its document. On the cloud
|
|
918
|
+
* backend one awaited to `'load'` resolves once the page reports the new fragment, and a call made
|
|
919
|
+
* after one awaited to `'documentstart'` waits only until then. Two pages are the exception there,
|
|
920
|
+
* where such a goto brings a new document like any other: one reached through a redirect, and one
|
|
921
|
+
* that followed a link onto another origin. On the extension (measured on Chromium) one awaited to
|
|
922
|
+
* `'load'` resolves, since the frame fires load for it, and one awaited to `'documentstart'` runs
|
|
923
|
+
* out at its timeout, since no new document starts.
|
|
924
|
+
*/
|
|
899
925
|
waitUntil?: 'documentstart' | 'load';
|
|
900
926
|
domains?: string[];
|
|
901
927
|
};
|
|
928
|
+
/** `frame.postMessage`'s options form, as `Window.postMessage` takes it. */
|
|
929
|
+
type FramePostMessageOptions = {
|
|
930
|
+
/** The page's origin as the site knows it, or `'*'`, the default. */
|
|
931
|
+
targetOrigin?: string;
|
|
932
|
+
/** What the message moves rather than copies: MessagePorts, ArrayBuffers, streams. */
|
|
933
|
+
transfer?: Transferable[];
|
|
934
|
+
};
|
|
935
|
+
/** What the page in the frame posted to the app. */
|
|
936
|
+
type FrameMessageEvent = {
|
|
937
|
+
readonly type: 'message';
|
|
938
|
+
readonly data: unknown;
|
|
939
|
+
/** The page's origin as the site knows it (`https://anilist.co`), never FKN's own. */
|
|
940
|
+
readonly origin: string;
|
|
941
|
+
readonly ports: readonly MessagePort[];
|
|
942
|
+
/** The Frame the message came through, so a reply is `event.source.postMessage(reply, event.origin)`. */
|
|
943
|
+
readonly source: Frame;
|
|
944
|
+
};
|
|
945
|
+
/** A new document arrived in the frame. */
|
|
946
|
+
type FrameDocumentEvent = {
|
|
947
|
+
readonly type: 'document';
|
|
948
|
+
/** The document's origin as the site knows it; `''` on the extension, which does not report it yet. */
|
|
949
|
+
readonly origin: string;
|
|
950
|
+
};
|
|
951
|
+
type FrameEventMap = {
|
|
952
|
+
message: FrameMessageEvent;
|
|
953
|
+
document: FrameDocumentEvent;
|
|
954
|
+
};
|
|
955
|
+
type FrameEventListener<K extends keyof FrameEventMap> = (event: FrameEventMap[K]) => void;
|
|
956
|
+
/**
|
|
957
|
+
* An attached frame. What it promises across navigations is the same on both backends.
|
|
958
|
+
*
|
|
959
|
+
* A Frame follows its FRAME, not a document. The page in it may move itself (a link, a form, a
|
|
960
|
+
* redirect, a script), and every call runs against the document the frame holds when the call
|
|
961
|
+
* arrives. A call made while the next document commits waits for it, within the call's own timeout.
|
|
962
|
+
*
|
|
963
|
+
* It reads a document only while that document's host is inside the attachment: the attach url's
|
|
964
|
+
* host, each `goto` target's host, and `domains`, each matched exactly. A document on any other host
|
|
965
|
+
* is refused with a `LocatorDeniedError` ("frame: this frame no longer holds the document the app
|
|
966
|
+
* attached it to"), which names nothing about where the frame went. The Frame stays attached, and
|
|
967
|
+
* answers again once the frame is back inside, by the page's own move or by a `goto`.
|
|
968
|
+
*
|
|
969
|
+
* What belongs to a document ends with it. A style `addStyleTag` added is gone after a navigation. A
|
|
970
|
+
* `videoElement` handle from a document that left rejects every call that answers (`play`, the
|
|
971
|
+
* picture-in-picture calls), and its fire-and-forget ones (`pause`, `load`, the setters) do nothing.
|
|
972
|
+
* On the cloud backend an `evaluate` whose document leaves before it settles rejects, and is not run
|
|
973
|
+
* again.
|
|
974
|
+
*
|
|
975
|
+
* Not followed: a navigation the page aims out of its frame (a link or a form targeting the top
|
|
976
|
+
* window or a new one, a popup). A document with nothing of the page's own to run it in, such as an
|
|
977
|
+
* error page or a file that is not HTML, cannot be read, and a call on it waits to its deadline.
|
|
978
|
+
*/
|
|
902
979
|
type Frame = Omit<FrameLocator<LocatorModules>, 'evaluate'> & {
|
|
903
980
|
goto(url: string, options?: GotoOptions): Promise<void>;
|
|
981
|
+
/** The url last given to `attachFrame` or `goto`, never the frame's live location: a page that moves itself does not change it. */
|
|
904
982
|
url(): string;
|
|
905
983
|
/**
|
|
906
984
|
* Asks for whole categories on this attachment's hosts, before any call. Resolves per request, in
|
|
@@ -932,6 +1010,12 @@ type Frame = Omit<FrameLocator<LocatorModules>, 'evaluate'> & {
|
|
|
932
1010
|
* Needs the Evaluation grant on both backends; an app without it is refused by name. It runs on the
|
|
933
1011
|
* attached frame only: a chain into a nested frame (`frameLocator(...).evaluate`) is refused.
|
|
934
1012
|
*
|
|
1013
|
+
* Called after `goto` resolved, whichever `waitUntil`, it runs once on the document that goto
|
|
1014
|
+
* brought, never on the one it replaced. On the cloud backend the call waits for that document when
|
|
1015
|
+
* it has not committed yet, and the wait counts toward the 30 seconds; if it has not come by the
|
|
1016
|
+
* goto's own deadline (the goto failed, or loaded something that is not a page), or the app started
|
|
1017
|
+
* another goto first, the call rejects with a `LocatorError` saying the code was not run.
|
|
1018
|
+
*
|
|
935
1019
|
* On the extension it also needs an extension new enough to run code (ABI 3, older ones are refused
|
|
936
1020
|
* with `ExtensionOperationUnsupportedError`), and it runs where the page's content security policy
|
|
937
1021
|
* allows it: a frame whose host the app declared has its CSP replaced, so code runs; an undeclared
|
|
@@ -940,6 +1024,70 @@ type Frame = Omit<FrameLocator<LocatorModules>, 'evaluate'> & {
|
|
|
940
1024
|
* such limit.
|
|
941
1025
|
*/
|
|
942
1026
|
evaluate<R = unknown, A = undefined>(pageFunction: ((arg: A) => R | Promise<R>) | string, arg?: A): Promise<Awaited<R>>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Delivers `message` to the page in the frame as a real `message` event, the way
|
|
1029
|
+
* `iframe.contentWindow.postMessage` would. The page sees a trusted event: `data` is the message,
|
|
1030
|
+
* `ports` are the MessagePorts `transfer` moved, `source` is the page's own `parent`, and `origin`
|
|
1031
|
+
* is this app's origin. So a page script that `evaluate` installed can take `event.ports[0]` and run
|
|
1032
|
+
* any port protocol (osra included) over it, and no FKN code sits on that port afterwards.
|
|
1033
|
+
*
|
|
1034
|
+
* `targetOrigin` is the page's origin as the site knows it (`https://anilist.co`), parsed as the
|
|
1035
|
+
* platform parses it, so a trailing slash or a path is fine. The message is delivered only if the
|
|
1036
|
+
* frame's document is on that origin, and otherwise dropped silently, as `Window.postMessage` does.
|
|
1037
|
+
* `'*'`, the default, means whatever document the frame holds; the extension refuses it for now.
|
|
1038
|
+
*
|
|
1039
|
+
* It resolves once the message was handed to the browser for the document the frame holds, in the
|
|
1040
|
+
* order the calls were made. That says nothing about whether the page listened, and a message
|
|
1041
|
+
* dropped for its origin resolves the same way. Sent after `goto` resolved, it goes to the document
|
|
1042
|
+
* that goto brought, as `evaluate` runs there.
|
|
1043
|
+
*
|
|
1044
|
+
* Refused, and never sent again. On the cloud backend a refusal that depends on the grant or on the
|
|
1045
|
+
* frame's document comes after `transfer` was detached, and loses what it moved with the message;
|
|
1046
|
+
* every other refusal comes before anything is detached.
|
|
1047
|
+
* - `TypeError`, before anything is sent or detached: a `targetOrigin` that is not `'*'` or an
|
|
1048
|
+
* origin (`'/'` included), or a `transfer` that is not an array. A message that cannot be cloned
|
|
1049
|
+
* is the platform's own `DataCloneError`.
|
|
1050
|
+
* - `LocatorDeniedError` naming nothing: `targetOrigin` names a host outside the attachment, or
|
|
1051
|
+
* the frame's document is outside it.
|
|
1052
|
+
* - `LocatorDeniedError` "frame: navigate the frame before postMessage": the frame holds no page.
|
|
1053
|
+
* - cloud, `LocatorDeniedError`: the app has no Evaluation grant, which is asked for on first use
|
|
1054
|
+
* as `evaluate` asks. Messaging sits under Evaluation because the message arrives as the page's
|
|
1055
|
+
* own traffic and a port handed over is a live channel into the page.
|
|
1056
|
+
* - cloud, `LocatorUnsupportedError`: an FKN page or render proxy that predates messaging.
|
|
1057
|
+
* - cloud, `LocatorError`: the document changed during the call, so the message may or may not have
|
|
1058
|
+
* reached it and is not sent to the next one; or the document of the goto before it had not come
|
|
1059
|
+
* by that goto's deadline (the goto failed, or loaded something that is not a page) or before the
|
|
1060
|
+
* app started another goto, so nothing was sent.
|
|
1061
|
+
* - extension, `LocatorUnsupportedError`: `'*'`, which needs an extension release that reports the
|
|
1062
|
+
* frame's origin. Pass the origin.
|
|
1063
|
+
* - the terminal detach error once the attachment ended.
|
|
1064
|
+
*/
|
|
1065
|
+
postMessage(message: unknown, targetOrigin: string, transfer?: Transferable[]): Promise<void>;
|
|
1066
|
+
postMessage(message: unknown, options?: FramePostMessageOptions): Promise<void>;
|
|
1067
|
+
/**
|
|
1068
|
+
* `message`: what the page posted to the app, with its `origin` and `ports`, and this Frame as
|
|
1069
|
+
* `source`. The page reaches the app with `parent.postMessage(x, appOrigin)`,
|
|
1070
|
+
* `top.postMessage(x, appOrigin)`, or `event.source.postMessage(x, event.origin)` on a message the
|
|
1071
|
+
* app sent it. A document outside the attachment is dropped, never masked. On the cloud backend a
|
|
1072
|
+
* post to `'*'` does not reach the app: there the page is its own parent, so it cannot be told apart
|
|
1073
|
+
* from the page messaging itself, and it stays with the page. The extension delivers it, as a real
|
|
1074
|
+
* parent would receive it.
|
|
1075
|
+
*
|
|
1076
|
+
* `document`: a new document arrived in the frame. What `evaluate` installed in the one before is
|
|
1077
|
+
* gone, with every port it held, and nothing is reinstalled for the app: this is the signal to
|
|
1078
|
+
* install again. It can fire twice for one document (a return from the back/forward cache), so an
|
|
1079
|
+
* install should be idempotent. Cloud: fires for a document inside the attachment, with its origin,
|
|
1080
|
+
* and not for the document the frame already held when the first listener was added. Extension:
|
|
1081
|
+
* fires on every load of the frame, with `origin` `''`.
|
|
1082
|
+
*
|
|
1083
|
+
* Listeners stay on the Frame across navigations and end with the attachment. A listener that throws
|
|
1084
|
+
* is reported and does not stop the others. An unknown `type` is a `TypeError`. On the cloud backend,
|
|
1085
|
+
* against an FKN page that predates messaging, nothing arrives and the console says so once.
|
|
1086
|
+
*/
|
|
1087
|
+
addEventListener<K extends keyof FrameEventMap>(type: K, listener: FrameEventListener<K>, options?: {
|
|
1088
|
+
signal?: AbortSignal;
|
|
1089
|
+
}): void;
|
|
1090
|
+
removeEventListener<K extends keyof FrameEventMap>(type: K, listener: FrameEventListener<K>): void;
|
|
943
1091
|
};
|
|
944
1092
|
type AttachFrameOptions = {
|
|
945
1093
|
iframe: HTMLIFrameElement;
|
|
@@ -1037,6 +1185,27 @@ type FrameBackend = {
|
|
|
1037
1185
|
* backend that cannot run code refuses `Frame.evaluate` by name rather than answering as if it had.
|
|
1038
1186
|
*/
|
|
1039
1187
|
evaluate?(source: string, arg: unknown): Promise<unknown>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Delivers a message to the page, `targetOrigin` already normalized (`'*'` or a serialized origin)
|
|
1190
|
+
* and `transfer` an array. Called synchronously by `Frame.postMessage`, so transfers detach at the
|
|
1191
|
+
* call and calls keep their order. Optional so a backend that cannot message refuses by name.
|
|
1192
|
+
*/
|
|
1193
|
+
postMessage?(message: unknown, targetOrigin: string, transfer: Transferable[]): Promise<void>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Starts relaying the page's messages and document arrivals to `sink`, and answers the function
|
|
1196
|
+
* that stops it. Called when the Frame's first listener is added, stopped when its last one goes.
|
|
1197
|
+
*/
|
|
1198
|
+
listen?(sink: (event: FrameBackendEvent) => void): () => void;
|
|
1199
|
+
};
|
|
1200
|
+
/** A Frame event as a backend reports it: the Frame adds itself as a message's `source`. */
|
|
1201
|
+
type FrameBackendEvent = {
|
|
1202
|
+
type: 'message';
|
|
1203
|
+
data: unknown;
|
|
1204
|
+
origin: string;
|
|
1205
|
+
ports: readonly MessagePort[];
|
|
1206
|
+
} | {
|
|
1207
|
+
type: 'document';
|
|
1208
|
+
origin: string;
|
|
1040
1209
|
};
|
|
1041
1210
|
declare const createFrame: (backend: FrameBackend) => Frame;
|
|
1042
1211
|
//#endregion
|
|
@@ -1051,4 +1220,4 @@ type AttachFrameFunction = {
|
|
|
1051
1220
|
declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY";
|
|
1052
1221
|
declare const attachFrame: AttachFrameFunction;
|
|
1053
1222
|
//#endregion
|
|
1054
|
-
export {
|
|
1223
|
+
export { CATEGORIES as A, revive as B, gotoPermission as C, PermissionGrant as D, LegacyPermissionRequest as E, RemoteVideoElement as F, OperationRequest as G, Executor as H, VideoElementState as I, SelectorPart as K, box as L, PermissionCategory as M, handleRevivableModules as N, PermissionRequest as O, BoxedVideoElement as P, createVideoElementHandle as R, createFrame as S, CategoryRequest as T, Gate as U, type as V, GateTools as W, FrameWindowRefusedError as _, AttachWindowOptions as a, WindowFrame as b, FrameBackendEvent as c, FrameEventMap as d, FrameMessageEvent as f, FrameWindowRefusal as g, FrameWindowOptions as h, AttachFrameOptions as i, CategoryMeta as j, permissions as k, FrameDocumentEvent as l, FrameWindowBlockedError as m, attachFrame as n, Frame as o, FramePostMessageOptions as p, AttachFrameFunction as r, FrameBackend as s, ATTACH_FRAME_EVENT_KEY as t, FrameEventListener as u, GotoOptions as v, CategoryGrant as w, attachFramePermission as x, Locator as y, isType as z };
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DYKLnpWs.cjs"),n=require("./api-Djf-XdZ4.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-Beg4iCRU.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-B7jDaJVp.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.q())return e(!0);let n,r=setTimeout(()=>i(t.q()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.q()),y)},o=new MutationObserver(()=>{t.q()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.q()&&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.y,exports.EXTENSION_ABI=t.Z,exports.ExtensionOperationUnsupportedError=t.Q,exports.ExtensionOutdatedError=t.$,exports.FORGEABLE_HEADERS=t.H,exports.FrameWindowBlockedError=t.d,exports.FrameWindowRefusedError=t.f,exports.LOCATOR_DENIED=t.w,exports.LOCATOR_ERROR=t.O,exports.LOCATOR_UNSUPPORTED=t.b,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.et,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.g,exports.assertFetchableUrl=t.F,exports.assertForgeableHeaders=t.U,exports.assertLockdownApplicable=t._,exports.assertOneCookieIdentity=t.W,exports.attachFrame=x,exports.attachFramePermission=t.p,exports.box=t.rt,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.N,exports.createFrame=t.m,exports.createVideoElementHandle=t.it,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.L,exports.fetchLocalPermission=t.R,exports.fetchPermission=t.z,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.h,exports.handleRevivableModules=t.nt,exports.hasForgedCookie=t.G,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.B,exports.isBlockedFrameUrl=t.v,exports.isExtensionExposed=t.q,exports.isLocalNetworkUrl=t.V,exports.isLocatorDenied=t.k,exports.isLocatorUnsupported=t.x,exports.isPermissionDenied=t.n,exports.isTerminalError=t.D,exports.isType=t.at,exports.modifyRequestHeadersPermission=t.A,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.P,exports.readExtensionHandshake=t.J,exports.relayWorker=w,exports.removeRequestHeaderRule=t.j,exports.revive=t.ot,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.Y,exports.setRequestHeaderRule=t.M,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.tt,exports.type=t.st,exports.waitForExtensionExposure=t.X;
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as account_d_exports } from "./account.js";
|
|
2
|
-
import { A as
|
|
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-
|
|
4
|
-
import { n as cloud_d_exports } from "./cloud-
|
|
2
|
+
import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, o as Frame, p as FramePostMessageOptions, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-DiOxvYoa.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-Bm5x5R4R.js";
|
|
4
|
+
import { n as cloud_d_exports } from "./cloud-Bfc6rkF2.js";
|
|
5
5
|
import { t as dns_d_exports } from "./dns.js";
|
|
6
6
|
import { u as index_d_exports } from "./index-kuPqkS_-.js";
|
|
7
|
-
import { s as net_d_exports } from "./net-
|
|
7
|
+
import { s as net_d_exports } from "./net-DnXxFGm8.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";
|
|
@@ -129,4 +129,4 @@ declare const busyReasons: () => string[];
|
|
|
129
129
|
*/
|
|
130
130
|
declare const applyUpdate: () => Promise<boolean>;
|
|
131
131
|
//#endregion
|
|
132
|
-
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
|
|
132
|
+
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { $ as t, A as n, B as r, D as i,
|
|
2
|
+
import { $ as t, A as n, B as r, D as i, F as a, G as o, H as ee, J as s, L as c, M as te, N as ne, O as re, P as ie, Q as ae, R as oe, U as se, V as ce, W as l, X as u, Y as le, Z as ue, _ as de, a as d, at as f, b as p, d as m, et as h, f as g, g as _, h as v, i as y, it as b, j as x, k as S, m as C, n as w, nt as T, o as E, ot as D, p as O, q as k, r as A, rt as j, st as M, t as N, tt as P, v as F, w as I, x as L, y as R, z } from "./lib-FD1Ssqjt.js";
|
|
3
3
|
import { a as B, l as V, s as H, u as fe } from "./api-CtiKFcK3.js";
|
|
4
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-
|
|
5
|
+
import { a as U, i as W, n as he } from "./cloud-EfyYfgVT.js";
|
|
6
6
|
import { t as ge } from "./dns.js";
|
|
7
7
|
import { t as _e } from "./net.js";
|
|
8
8
|
import { t as ve } from "./dgram.js";
|
|
9
9
|
import { t as G } from "./http.js";
|
|
10
|
-
import { i as ye, n as be, r as K, t as xe } from "./extension-
|
|
10
|
+
import { i as ye, n as be, r as K, t as xe } from "./extension-sNRjVbET.js";
|
|
11
11
|
import { t as Se } from "./desktop.js";
|
|
12
12
|
import { u as Ce } from "./fs-BvNZePtN.js";
|
|
13
13
|
import { t as we } from "./opfs.js";
|
|
@@ -18,27 +18,27 @@ import { t as Oe } from "./connect-button-DtsN3X1J.js";
|
|
|
18
18
|
import { relay as ke } from "osra";
|
|
19
19
|
//#region src/frame.ts
|
|
20
20
|
var Ae = 1e4, je = 150, Me = () => new Promise((e) => {
|
|
21
|
-
if (
|
|
22
|
-
let t, n = setTimeout(() => r(
|
|
21
|
+
if (k()) return e(!0);
|
|
22
|
+
let t, n = setTimeout(() => r(k()), 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(
|
|
25
|
+
clearTimeout(t), t = setTimeout(() => r(k()), je);
|
|
26
26
|
}, a = new MutationObserver(() => {
|
|
27
|
-
|
|
27
|
+
k() && r(!0);
|
|
28
28
|
}), o = () => {
|
|
29
|
-
document.readyState === "complete" && !
|
|
29
|
+
document.readyState === "complete" && !k() && i();
|
|
30
30
|
};
|
|
31
31
|
a.observe(document.documentElement, {
|
|
32
32
|
attributes: !0,
|
|
33
33
|
attributeFilter: ["data-fkn-extension"]
|
|
34
34
|
}), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
|
|
35
35
|
}), Ne = (async (e) => {
|
|
36
|
-
if (
|
|
36
|
+
if (E(e) === "window") {
|
|
37
37
|
let t = e;
|
|
38
|
-
return K() ?
|
|
38
|
+
return K() ? d(t) : U() ? W(t) : d(t);
|
|
39
39
|
}
|
|
40
40
|
return Pe(e);
|
|
41
|
-
}), Pe = async (e) => K() || e.lockdown || !U() || await Me() ?
|
|
41
|
+
}), Pe = async (e) => K() || e.lockdown || !U() || await Me() ? d(e) : W(e), Fe = "https://fkn.app", Ie = async (e, t) => {
|
|
42
42
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
43
43
|
let n = await fe;
|
|
44
44
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
@@ -112,4 +112,4 @@ typeof window < "u" && V(() => {
|
|
|
112
112
|
});
|
|
113
113
|
var Je = () => pe(), Ye = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
114
114
|
//#endregion
|
|
115
|
-
export {
|
|
115
|
+
export { y as ATTACH_FRAME_EVENT_KEY, R as CATEGORIES, ue as EXTENSION_ABI, ae as ExtensionOperationUnsupportedError, t as ExtensionOutdatedError, ee as FORGEABLE_HEADERS, m as FrameWindowBlockedError, g as FrameWindowRefusedError, I as LOCATOR_DENIED, re as LOCATOR_ERROR, p as LOCATOR_UNSUPPORTED, N as PERMISSION_DENIED, h as REQUIRED_EXTENSION_ABI, De as account, _ as assertAttachableFrameUrl, a as assertFetchableUrl, se as assertForgeableHeaders, de as assertLockdownApplicable, l as assertOneCookieIdentity, Ne as attachFrame, O as attachFramePermission, j as box, he as cloud, Le as connect, Oe as connectButtonUrl, ne as cookies, C as createFrame, b as createVideoElementHandle, Se as desktop, ve as dgram, ge as dns, xe as extension, be as fetch, c as fetchCredentialedPermission, oe as fetchLocalPermission, z as fetchPermission, Ce as fs, v as gotoPermission, T as handleRevivableModules, o as hasForgedCookie, G as http, r as isBlockedFetchUrl, F as isBlockedFrameUrl, k as isExtensionExposed, ce as isLocalNetworkUrl, S as isLocatorDenied, L as isLocatorUnsupported, w as isPermissionDenied, i as isTerminalError, f as isType, n as modifyRequestHeadersPermission, _e as net, we as opfs, Te as packages, A as permissions, ye as promptInstall, Re as promptRelay, ie as readCookiePermission, s as readExtensionHandshake, Ie as relayWorker, x as removeRequestHeaderRule, D as revive, Ee as rooms, le as setMissingExtensionHandler, te as setRequestHeaderRule, He as shell, P as supportsOperation, M as type, u as waitForExtensionExposure };
|
package/lib-DYKLnpWs.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-9dYv63ud.cjs");let n=require("osra");var r=(e,t)=>{let n=new EventTarget,r=new Map,i=EventTarget.prototype.addEventListener.bind(n),a=EventTarget.prototype.removeEventListener.bind(n);return Object.defineProperty(n,"addEventListener",{configurable:!0,value:(a,o,s)=>{if(o!==null){if(!r.has(a)){let i=r=>{n.dispatchEvent(new CustomEvent(a,{detail:t(r,e),bubbles:r.bubbles,cancelable:r.cancelable,composed:r.composed}))};e.addEventListener(a,i),r.set(a,i)}i(a,o,s)}}}),Object.defineProperty(n,"removeEventListener",{configurable:!0,value:(t,n,i)=>{if(n===null)return;a(t,n,i);let o=r.get(t);o&&(e.removeEventListener(t,o),r.delete(t))}}),n},i=e=>typeof e==`boolean`?+!!e:+!!e?.capture,a=e=>{let t=new WeakMap;return{addEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r);if(s||(s=new Map,t.set(r,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let i=e.unenrich(t,n);typeof r==`function`?r.call(e.target,i):r.handleEvent(i)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},o=e.t({box:()=>x,createVideoElementHandle:()=>b,isType:()=>ne,revive:()=>S,type:()=>s}),s=`videoElement`,c=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],l=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],u=[`buffered`,`seekable`],d=Symbol.for(`fkn.remoteVideoElement`),f=Symbol.for(`fkn.remoteVideoElement.state`),p=Symbol.for(`fkn.remoteVideoElement.controller`),m=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],h=e=>{let t={};for(let n of[...c,...l])t[n]=e[n];for(let n of u)t[n]=m(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},g=e=>{let t=t=>{if(!Number.isInteger(t)||t<0||t>=e.length)throw new DOMException(`Index or size is negative or greater than the allowed amount`,`IndexSizeError`)};return{get length(){return e.length},start(n){return t(n),e[n][0]},end(n){return t(n),e[n][1]}}},ee=e=>e?{code:e.code,message:e.message,MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4}:null,_=e=>r(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:h(t)})),v=async(e,t)=>{switch(t){case`play`:return await e.play(),null;case`pause`:return e.pause(),null;case`load`:return e.load(),null;case`requestPictureInPicture`:if(typeof e.requestPictureInPicture!=`function`)throw Error(`requestPictureInPicture is not supported in this environment`);return await e.requestPictureInPicture(),null;case`exitPictureInPicture`:{let t=e.ownerDocument;if(typeof t?.exitPictureInPicture!=`function`)throw Error(`exitPictureInPicture is not supported in this environment`);return await t.exitPictureInPicture(),null}default:throw Error(`videoElement: unknown method "${t}"`)}},te=e=>({call:async t=>v(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return h(e)},events:_(e)}),y=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,d,{value:!0}),Object.defineProperty(n,f,{value:e}),Object.defineProperty(n,p,{value:t});let r=a({target:n,remoteEvents:t.events,unenrich:(t,n)=>{if(!(t instanceof CustomEvent))return t;let r=t.detail;if(!r||!(`snapshot`in r))return t;Object.assign(e,r.snapshot);let i={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed};return r.originalDetail===null?new Event(n,i):new CustomEvent(n,{...i,detail:r.originalDetail})}}),i={addEventListener:{configurable:!0,value:r.addEventListener},removeEventListener:{configurable:!0,value:r.removeEventListener},dispatchEvent:{configurable:!0,value:r.dispatchEvent},error:{configurable:!0,enumerable:!0,get(){return ee(e.error)}},play:{configurable:!0,value:()=>t.call(`play`,[])},pause:{configurable:!0,value:()=>{t.call(`pause`,[]).catch(()=>{})}},load:{configurable:!0,value:()=>{t.call(`load`,[]).catch(()=>{})}},requestPictureInPicture:{configurable:!0,value:()=>t.call(`requestPictureInPicture`,[])},exitPictureInPicture:{configurable:!0,value:()=>t.call(`exitPictureInPicture`,[])},HAVE_FUTURE_DATA:{enumerable:!0,value:3},HAVE_ENOUGH_DATA:{enumerable:!0,value:4}};for(let n of c)i[n]={configurable:!0,enumerable:!0,get(){return e[n]},set(r){e[n]=r,t.set(n,r).then(t=>{Object.assign(e,t)},()=>{})}};for(let t of l)i[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of u)i[t]={configurable:!0,enumerable:!0,get(){return g(e[t])}};return Object.defineProperties(n,i),n},b=e=>y(h(e),te(e)),ne=e=>typeof e==`object`&&!!e&&e[d]===!0,x=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},S=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return y({...e.initialState},r)},C=e=>[o,...e],re=3,ie=0,ae=`fknExtension`,oe=`fknExtensionAbi`,se=`fknExtensionOps`,ce=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],le=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},ue=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),de=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=le(e[oe]),r=ue(e[se]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},fe=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,pe=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),w=class extends Error{abi;required;name=`ExtensionOutdatedError`;constructor(e,t){super(`The FKN WebExtension is installed but too old for this page: it speaks ABI ${e} and this page needs at least ${t}. Updating the extension fixes this.`),this.abi=e,this.required=t}},T=class extends Error{operation;abi;name=`ExtensionOperationUnsupportedError`;constructor(e,t,n){super(n??`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`),this.operation=e,this.abi=t}},me=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,he=ae,ge=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(me,()=>{ge.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:_e()}}))});var _e=()=>typeof document>`u`?!1:document.documentElement.dataset[he]===`true`,E=()=>typeof document>`u`?{status:`absent`}:de(document.documentElement.dataset),D=null,ve=e=>{D=e},ye=150,O=(e=1e3)=>new Promise((t,n)=>{let r=()=>E().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=E();if(e.status===`outdated`)return n(new w(e.abi,e.required));if(D){if(await D().catch(()=>{}),r())return t();let e=E();if(e.status===`outdated`)return n(new w(e.abi,e.required))}n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),s=()=>{clearTimeout(i),i=setTimeout(()=>r()?a(t):o(),ye)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...ce]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),be,k=new Proxy({},{get:(e,t)=>async(...e)=>{await O(),be??=(0,n.expose)({},{transport:window,revivableModules:C});let r=(await be)[t];return r(...e)}}),xe=[`origin`,`referer`,`cookie`],Se=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),Ce=e=>Se(e,`cookie`),we=(e,t)=>{if(t===`include`&&Ce(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Te=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!xe.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},Ee=[`fkn.app`,`fkn.dev`,`sdbx.app`],De=e=>e.replace(/\.+$/,``),Oe=e=>{let t=De(e);return Ee.some(e=>t===e||t.endsWith(`.${e}`))},ke={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},Ae={scope:`network.fetchCredentialed`,category:`network`,severity:3,chip:`load as you`,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},je={scope:`network.fetchLocal`,category:`network`,severity:3,chip:`local network`,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},Me=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},Ne=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n.endsWith(`.local`)||n.endsWith(`.internal`)||n.endsWith(`.home.arpa`)?!0:n.includes(`:`)?n===`::`||n===`::1`||n.startsWith(`fc`)||n.startsWith(`fd`)||/^fe[89ab]/.test(n)||n.startsWith(`::ffff:`):Me(n)},Pe=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Oe(t.hostname)},Fe=e=>{if(Pe(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Ie=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=xe.map(e=>{let n=t.get(e);return n===null||n===``?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},Le=async(e,t)=>{let n=new Request(e,t);Fe(n.url);let r=n.body?await n.arrayBuffer():null;return k.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:Ie(t),reason:t?.reason,signal:t?.signal??void 0})},Re={scope:`network.readCookie`,category:`network`,severity:3,chip:`read cookie`,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},ze={get:e=>k.getCookie(e)},Be={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,chip:`rewrite headers`,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},Ve=e=>k.setRequestHeaderRule(e),He=e=>k.removeRequestHeaderRule({ruleId:e}),Ue=class extends Error{reason;filename;line;column;source;constructor(e,t,n,r,i){super(`${e}:${n}:${r}: ${t}`),this.reason=t,this.filename=e,this.line=n,this.column=r,this.source=i}},We=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},A;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(A||={});var Ge=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},j=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=j(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=Ge(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=Ge(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},M=/\/\*[^]*?(?:\*\/|$)/g;function N(e){return e?e.trim():``}function P(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{P(e,r)}):n&&typeof n==`object`&&P(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Ke=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case A.stylesheet:return this.stylesheet(e);case A.rule:return this.rule(e);case A.declaration:return this.declaration(e);case A.comment:return this.comment(e);case A.container:return this.container(e);case A.charset:return this.charset(e);case A.counterStyle:return this.counterStyle(e);case A.document:return this.document(e);case A.customMedia:return this.customMedia(e);case A.fontFace:return this.fontFace(e);case A.fontFeatureValues:return this.fontFeatureValues(e);case A.host:return this.host(e);case A.import:return this.import(e);case A.keyframes:return this.keyframes(e);case A.keyframe:return this.keyframe(e);case A.layer:return this.layer(e);case A.media:return this.media(e);case A.namespace:return this.namespace(e);case A.page:return this.page(e);case A.pageMarginBox:return this.pageMarginBox(e);case A.positionTry:return this.positionTry(e);case A.property:return this.property(e);case A.scope:return this.scope(e);case A.startingStyle:return this.startingStyle(e);case A.supports:return this.supports(e);case A.viewTransition:return this.viewTransition(e);case A.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
|
|
2
|
+
|
|
3
|
+
`)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
4
|
+
|
|
5
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
6
|
+
|
|
7
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
8
|
+
|
|
9
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
10
|
+
|
|
11
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
12
|
+
|
|
13
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
14
|
+
|
|
15
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
|
|
16
|
+
`)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
|
|
17
|
+
`)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
|
|
18
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
19
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
20
|
+
}`)}pageMarginBox(e){return this.compress?this.emit(`@${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`${this.indent()}@${e.name} `,e.position)+this.emit(`{
|
|
21
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
22
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){return this.compress?this.emit(`@font-face`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@font-face `,e.position)+this.emit(`{
|
|
23
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
24
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
25
|
+
}`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
26
|
+
|
|
27
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){return this.compress?this.emit(`@property ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@property ${e.name} `,e.position)+this.emit(`{
|
|
28
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
29
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
30
|
+
}`)}counterStyle(e){return this.compress?this.emit(`@counter-style ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@counter-style ${e.name} `,e.position)+this.emit(`{
|
|
31
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
32
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
33
|
+
}`)}fontFeatureValues(e){return this.compress?this.emit(`@font-feature-values ${e.fontFamily}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
34
|
+
|
|
35
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;return this.compress?this.emit(`@scope${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@scope${t}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
36
|
+
|
|
37
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){return this.compress?this.emit(`@view-transition`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@view-transition `,e.position)+this.emit(`{
|
|
38
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
39
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
40
|
+
}`)}positionTry(e){return this.compress?this.emit(`@position-try ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@position-try ${e.name} `,e.position)+this.emit(`{
|
|
41
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
42
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
43
|
+
}`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==A.declaration&&e.type!==A.comment),r=n?`
|
|
44
|
+
|
|
45
|
+
`:`
|
|
46
|
+
`;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
|
|
47
|
+
`)+this.emit(n?``:this.indent(1))+this.mapVisit(e.rules,r)+this.emit(n?`\n${this.indent(-1)}${this.indent()}}`:`${this.indent(-1)}\n${this.indent()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
|
|
48
|
+
`),e.position)+this.emit(` {
|
|
49
|
+
`)+this.emit(this.indent(1))+this.mapVisit(t,`
|
|
50
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(`;`):e.property===`grid-template-areas`?this.emit(this.indent())+this.emit(e.property+`: `+e.value.split(`
|
|
51
|
+
`).join(`
|
|
52
|
+
`.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},qe=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new We(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ue(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
|
|
53
|
+
`);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:A.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=j(e,[`{`]);if(t===-1||t===0)return;let n=e.substring(0,t);return l([n]),((e,t)=>{let n=[],r=0;for(;r<e.length;){let i=j(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(N(n).replace(M,``),[`,`]).map(e=>N(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=N(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=j(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=N(s).replace(M,``));let u=t({type:A.declaration,property:r.replace(M,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function h(){let n=[];if(!s())return o(`missing '{'`);d(n);let r=m();for(;r;)n.push(r),d(n),r=m();for(;t?.silent&&e.length&&e.charAt(0)!==`}`;){let t=e.indexOf(`;`),i=e.indexOf(`}`);if(t===-1||!(i===-1||t<i))break;for(l([e.substring(0,t+1)]),u(),d(n),r=m();r;)n.push(r),d(n),r=m()}return c()?n:o(`missing '}'`)}function g(){let t=j(e,[`{`]);if(t===-1)return!1;let n=j(e,[`;`]),r=j(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function ee(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){n.push(e),d(n);continue}}if(g()){let e=C();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return c()?n:o(`missing '}'`)}function _(){let n=[];for(u(),d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){n.push(e),d(n);continue}}if(g()){let e=C();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return n}function v(){let t=[],n=i(),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);for(;r;){let n=l(r);t.push(n[1]);let i=/^,\s*/.exec(e);i&&l(i),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e)}if(t.length)return n({type:A.keyframe,values:t,declarations:h()||[]})}let te=RegExp(`^@(${[`top-left-corner`,`top-left`,`top-center`,`top-right`,`top-right-corner`,`bottom-left-corner`,`bottom-left`,`bottom-center`,`bottom-right`,`bottom-right-corner`,`left-top`,`left-middle`,`left-bottom`,`right-top`,`right-middle`,`right-bottom`].join(`|`)})(?![\\w-])\\s*`),y=x(`import`),b=x(`charset`),ne=x(`namespace`);function x(t){let n=RegExp(`^@`+t+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{let r=i(),a=n.exec(e);if(!a)return;let o=l(a),s={type:t};return s[t]=o[1].trim(),r(s)}}function S(){if(e[0]===`@`)return function(){let t=i(),n=/^@([-\w]+)?keyframes\s*/.exec(e);if(!n)return;let r=l(n)[1],a=/^([-\w]+)\s*/.exec(e);if(!a)return o(`@keyframes missing name`);let u=l(a)[1];if(!s())return o(`@keyframes missing '{'`);let f=d(),p=v();for(;p;)f.push(p),f=f.concat(d()),p=v();return c()?t({type:A.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=_();return c()?t({type:A.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:A.customMedia,name:N(r[1]),media:N(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=_();return c()?t({type:A.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||y()||b()||ne()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=N(r[1]),u=N(r[2]);if(!s())return o(`@document missing '{'`);let d=_();return c()?t({type:A.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:A.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=_();return c()?t({type:A.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:A.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=_();return c()?t({type:A.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=_();return c()?t({type:A.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=_();return c()?t({type:A.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:A.layer,layer:r})}let a=_();return c()?t({type:A.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=_();return c()?t({type:A.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:A.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=te.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=j(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=N(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=_();return c()?t({type:A.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:A.atRule,name:r,prelude:a})}()}function C(){let e=i(),t=p();return t?(d(),e({type:A.rule,selectors:t,declarations:ee()||[]})):o(`selector missing`)}return P(function(){let n=function(){let n,r=[];for(u(),d(r);e.length;){if(e.charAt(0)===`}`){if(t?.silent){o(`extra '}'`),l([`}`]),u(),d(r);continue}break}if(n=S()||C(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:A.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Je=(e,t)=>new Ke(t||{}).compile(e),Ye=Object.defineProperty,Xe=(e,t)=>{let n={};for(var r in e)Ye(n,r,{get:e[r],enumerable:!0});return t||Ye(n,Symbol.toStringTag,{value:`Module`}),n},Ze=`LocatorError`,F=`LocatorUnsupportedError`,I=`LocatorDeniedError`,Qe=`LocatorInvalidError`,L=e=>typeof e==`object`&&e?e.name:void 0,R=e=>Object.assign(Error(e),{name:Ze}),z=(e,t=``,n)=>Object.assign(Error(e),{name:F,operation:t,backend:n}),$e=(e,t)=>z(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),B=(e,t)=>Object.assign(Error(e),{name:I,operation:t}),V=(e,t)=>Object.assign(Error(e),{name:Qe,operation:t}),et=e=>L(e)===F,tt=e=>L(e)===I,nt=e=>L(e)===Qe,rt=e=>tt(e)||et(e)||nt(e),H=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw R(`the resolved element belongs to a document with no window`);return t},it=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},U=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return it(H(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=it(globalThis,t);return r&&e instanceof r?r:null},W=(e,t)=>U(e,t)!==null,G=e=>{if(e.length===0)throw R(`No elements found`);if(e.length>1)throw R(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},at=(e,t)=>{if(!W(e,t))throw R(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},ot=e=>e.tagName.toLowerCase(),st=new Set,ct=e=>{st.add(e)},lt=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ut=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),dt=e=>!lt.test(ut(e.value)),ft=new Set([A.import,A.fontFace,A.namespace,A.charset,A.document,A.comment]),pt=e=>{if(ft.has(e.type))return null;if(e.type===A.declaration)return dt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=mt(r))}return n},mt=e=>e.map(e=>pt(e)).filter(e=>e!==null),ht=e=>{let t;try{t=qe(e,{silent:!0})}catch{return``}return t.stylesheet.rules=mt(t.stylesheet.rules),Je(t)},gt=(e,t)=>{let n=()=>{t.parentNode||(e.head??e.documentElement).appendChild(t)};if(n(),e.readyState===`complete`)return;let r=new MutationObserver(e=>{for(let r of e)for(let e of r.removedNodes)if(e===t||e.contains?.(t)){n();return}});r.observe(e.documentElement,{childList:!0,subtree:!0});let i=()=>r.disconnect(),a=e.defaultView;a?a.addEventListener(`load`,i,{once:!0}):setTimeout(i,3e4)},_t={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:ht(t.content);try{gt(e.document,n)}catch(e){console.error(e)}ct(n)}},vt=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},K={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw V(`fetch: url must be a string`,`fetch`);let r=H(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw V(`fetch: not a valid url: ${t}`,`fetch`)}let a=await r.fetch(i,{method:n.method??`GET`,headers:n.headers,body:n.body??null,redirect:n.redirect??`follow`,credentials:n.credentials??`include`});return{status:a.status,statusText:a.statusText,ok:a.ok,url:a.url,redirected:a.redirected,type:a.type,headers:vt(a.headers),body:await a.arrayBuffer()}}},q=Xe({click:()=>bt,count:()=>Ot,exists:()=>kt,fill:()=>wt,getAttribute:()=>Et,hover:()=>xt,isVisible:()=>Dt,textContent:()=>Tt}),yt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},bt={resolve:(e,t={})=>{let n=G(e.elements),r=H(n),i={bubbles:!0,cancelable:!0,composed:!0,...yt(n,t.position),button:0},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerdown`,{...a,buttons:1})),n.dispatchEvent(new r.MouseEvent(`mousedown`,{...i,buttons:1})),n.dispatchEvent(new r.PointerEvent(`pointerup`,{...a,buttons:0})),n.dispatchEvent(new r.MouseEvent(`mouseup`,{...i,buttons:0})),n.dispatchEvent(new r.MouseEvent(`click`,{...i,buttons:0}))}},xt={resolve:(e,t={})=>{let n=G(e.elements),r=H(n),i={bubbles:!0,cancelable:!0,composed:!0,...yt(n,t.position)},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerover`,a)),n.dispatchEvent(new r.PointerEvent(`pointerenter`,{...a,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseenter`,{...i,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseover`,i)),n.dispatchEvent(new r.PointerEvent(`pointermove`,a)),n.dispatchEvent(new r.MouseEvent(`mousemove`,i))}},St=(e,t)=>{e._valueTracker?.setValue(``);let n=(U(e,`HTMLTextAreaElement`)??U(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Ct=(e,t)=>{if(e.type!==`range`)return null;let n=Number(e.min||0),r=Number(e.max||100);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)return null;let i=Number(t);if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(1,(i-n)/(r-n))),o=e.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width*a,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};return{pointerDown:{...c,buttons:1},pointerUp:{...c,buttons:0},mouseDown:{...s,buttons:1},mouseUp:{...s,buttons:0}}},wt={resolve:(e,t,n={})=>{let r=G(e.elements),i=H(r),a=W(r,`HTMLInputElement`);if(a||W(r,`HTMLTextAreaElement`)){let e=r,n=a?Ct(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),St(e,t),r.dispatchEvent(new i.Event(`input`,{bubbles:!0})),n&&(r.dispatchEvent(new i.PointerEvent(`pointerup`,n.pointerUp)),r.dispatchEvent(new i.MouseEvent(`mouseup`,n.mouseUp))),r.dispatchEvent(new i.Event(`change`,{bubbles:!0}));return}if(W(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${ot(r)}> is not fillable`)}},Tt={resolve:(e,t={})=>G(e.elements).textContent},Et={resolve:(e,t,n={})=>G(e.elements).getAttribute(t)},Dt={resolve:(e,t={})=>{let n=G(e.elements);if(!W(n,`HTMLElement`))return!0;let r=H(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Ot={resolve:(e,t={})=>e.elements.length},kt={resolve:(e,t={})=>e.elements.length>0},J=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),Y=e=>e.replaceAll(`"`,`\\"`),At={to:`element`,css:!0,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},jt={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Mt={element:{selectors:{locator:At,frameLocator:jt,getByRole:{to:`element`,resolve:(e,t)=>J(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${Y(e)}"]`:`[role]`})},getByText:{to:`element`,resolve:(e,t)=>e.elements.flatMap(e=>[e,...e.querySelectorAll(`*`)]).filter(e=>e.textContent?.includes(t)),render:e=>({fragment:typeof e==`string`?`:has-text("${Y(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>J(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${Y(e)}"]`:`[data-testid]`})},first:{to:`element`,resolve:e=>e.elements.slice(0,1),render:()=>({fragment:`:first`})},nth:{to:`element`,resolve:(e,t)=>{let n=e.elements.at(t);return n?[n]:[]},render:e=>({fragment:typeof e==`number`?`:nth(${e})`:`:nth(?)`})}},operations:{click:bt,fill:wt,hover:xt,textContent:Tt,getAttribute:Et,isVisible:Dt,count:Ot,exists:kt}},frame:{selectors:{locator:At,frameLocator:jt,owner:{to:`frame`,barrier:`up`,resolve:e=>{throw Error(`owner: must be processed by the executor as an upward pivot`)},render:()=>({fragment:``,separator:`up`})}},operations:{addStyleTag:_t,fetch:K}}},Nt=(e,t=Mt)=>({element:{selectors:{...t.element.selectors,...e.element?.selectors},operations:{...t.element.operations,...e.element?.operations}},frame:{selectors:{...t.frame.selectors,...e.frame?.selectors},operations:{...t.frame.operations,...e.frame?.operations}}}),Pt=3e4,Ft=50,It=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Lt=e=>{let t=It(e)?.timeout;return typeof t==`number`?t:Pt},Rt=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),zt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Rt(e))},Bt=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;n&&await n({parts:r,operation:i,args:a,phase:`execute`},Rt(e));let o=Lt(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{for(;Date.now()<s;)try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(rt(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Ft,t)))}}finally{clearTimeout(d)}throw f},Vt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>Vt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>Bt({...e,parts:r,operation:a,args:t});return i.ensure=(i,a={})=>{let o=t[n].operations[i]?.ensureArgs;return zt({...e,parts:r,operation:i,args:o?.(a)??[a]})},i},Ht=e=>Vt(e,e.modules??Mt,`frame`,[]),Ut=()=>{let e=E();return e.status===`ok`&&e.abi>=2},Wt=async()=>{await O();let e=E();if(e.status===`ok`&&e.abi<2)throw new w(e.abi,2)},Gt=e=>`Read the text, links and details ${e} shows.`,Kt=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,qt=[{id:`interaction`,heading:`Interaction`,summary:`Allow the app to interact with the website (clicks, type in text, etc.)`,title:e=>`Interact with ${e}`,description:(e,t)=>t?`Click, type and hover on ${e} for you. If you are signed in there, this happens as you.`:`Click, type and hover on ${e} for you, in a signed-out view.`,cloudTitle:e=>`Click and type on ${e}`,cloudDescription:e=>`Clicks, types and scrolls on ${e} for you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:Gt,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:Gt},{id:`network`,heading:`Network`,summary:`Make requests on behalf of the website (using your cookies, etc.)`,title:e=>`Make requests to ${e} as you`,description:e=>`Load pages and data from ${e} and send changes there with your signed-in session.`,cloudTitle:e=>`Load and send data on ${e}`,cloudDescription:e=>`Loads pages and data from ${e} and sends changes there.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:Kt,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:Kt}],Jt=Nt({element:{operations:{click:{resolve:(e,t={})=>q.click.resolve(e,t)},hover:{resolve:(e,t={})=>q.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>q.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>q.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>q.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>q.isVisible.resolve(e)},count:{resolve:(e,t={})=>q.count.resolve(e)},exists:{resolve:(e,t={})=>q.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(at(G(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>_t.resolve(e,t)},fetch:{resolve:(e,t,n={})=>K.resolve(e,t,n),kind:K.kind,ensureArgs:K.ensureArgs},evaluate:{kind:`frame`,resolve:(e,t,n)=>{throw $e(`evaluate`,`this realm`)}}}}}),Yt=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||t.protocol!==`about:`&&Oe(t.hostname)},X=e=>{if(Yt(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},Xt=({src:e,domains:t,lockdown:n})=>{if(n&&!t.length&&e&&e!==`about:blank`)throw Error(`attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto`)},Zt={scope:`embed.iframe`,category:`interaction`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},Qt={scope:`embed.open`,category:`interaction`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},$t=class extends Error{name=`FrameWindowBlockedError`;constructor(){super(`attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page`)}},en=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),tn=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=en.has(e)?e:`unknown`;super(t===`opaque-opener`?`attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened`:`attachFrame: the window refused to attach (${t}), and loaded nothing`),this.reason=t}},nn=[`message`,`document`],rn=e=>{if(e===`*`)return`*`;let t=()=>TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);if(typeof e!=`string`)throw t();let n;try{n=new URL(e).origin}catch{throw t()}if(n===`null`)throw t();return n},an=(e,t)=>{let n=typeof e==`object`&&!!e;if(n&&t!==void 0)throw TypeError(`frame.postMessage: pass transfer inside the options object, not after it`);let r=n?e.targetOrigin??`*`:e??`*`,i=n?e.transfer:t;if(i!==void 0&&!Array.isArray(i))throw TypeError(`frame.postMessage: transfer must be an array`);return{targetOrigin:rn(r),transfer:i===void 0?[]:[...i]}},on=e=>{typeof globalThis.reportError==`function`?globalThis.reportError(e):console.error(e)},sn=e=>{let t=Ht({executor:e.executor,modules:Jt,gate:e.gate}),n=(t,n={})=>(X(t),e.goto(t,n)),r=()=>e.url(),i=async t=>{let n=e.request;if(!n)throw Error(`frame.request: this backend cannot ask for permission categories`);return n(t)},a=async(t,n)=>{let r=e.evaluate;if(!r)throw Error(`frame.evaluate: this backend cannot run code in the attached frame`);let i=typeof t==`function`?t.toString():t;if(typeof i!=`string`)throw TypeError(`frame.evaluate: pass a function or a source string`);return r(i,n)},o=((t,n,r)=>{try{let i=e.postMessage;if(!i)throw Error(`frame.postMessage: this backend cannot message the attached frame`);let a=an(n,r);return i(t,a.targetOrigin,a.transfer)}catch(e){return Promise.reject(e)}}),s={message:new Set,document:new Set},c=null,l=(e,t)=>{if(!nn.includes(e))throw TypeError(`frame.${t}: the event type must be ${nn.map(e=>`'${e}'`).join(` or `)}, not ${JSON.stringify(e)}`);return s[e]},u=e=>{let t=e.type===`message`?Object.freeze({type:`message`,data:e.data,origin:e.origin,ports:Object.freeze([...e.ports]),source:p}):Object.freeze({type:`document`,origin:e.origin});for(let n of[...s[e.type]])try{n(t)}catch(e){on(e)}},d=(e,t)=>{if(l(e,`removeEventListener`).delete(t),c!==null&&!s.message.size&&!s.document.size){let e=c;c=null,e()}},f=(t,n,r={})=>{let i=l(t,`addEventListener`);if(typeof n!=`function`)throw TypeError(`frame.addEventListener: the listener must be a function`);let{signal:a}=r;if(!(a?.aborted||i.has(n))){if(c===null){let t=e.listen;if(!t)throw Error(`frame.addEventListener: this backend cannot relay the page's messages`);c=t(u)}i.add(n),a?.addEventListener(`abort`,()=>d(t,n),{once:!0})}},p={...t,goto:n,url:r,request:i,evaluate:a,postMessage:o,addEventListener:f,removeEventListener:d};return p},cn=[t.v,t._,t.y,t.h,t.g,t.n,t.i,t.r,t.f,t.a,t.o,t.s,t.p,Zt,Qt,t.u,t.d,ke,Ae,je,Re,Be],ln=qt.map(e=>e.id),un={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},Z=e=>e===0?`auto`:e===4?`critical`:`bundled`,Q=cn,$=new Map,dn={};(()=>{$=new Map(Q.map(e=>[e.scope,e])),dn=Object.fromEntries($),Q.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>Q.filter(t=>t.category===e&&Z(t.severity)===`bundled`);Object.fromEntries(ln.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(ln.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var fn=e=>$.get(e)?.category,pn=e=>{let t=$.get(e);return t&&Z(t.severity)},mn=e=>{let t=$.get(e);if(t)return Z(t.severity)===`critical`?t.scope:t.category},hn=e=>un[e],gn=({category:e,key:t})=>{let n=t??(e&&hn(e));return n!==void 0&&fn(n)!==void 0?n:void 0},_n=(e,t)=>{for(let{category:n,key:r}of t)if(gn({category:n,key:r})===void 0)throw TypeError(r===void 0?n===void 0?`${e}: name a category or a permission key`:`${e}: unknown permission category "${n}"`:`${e}: unknown permission key "${r}"`)},vn=(e,t={})=>{let n=[],r=e.map(e=>{let r=gn(e),i=[];if(r!==void 0)for(let a of e.hosts)i.push(n.length),n.push({...t,key:r,scope:``,site:a,hosts:e.hosts,reason:e.reason});return{key:r!==void 0&&pn(r)===`critical`?r:void 0,category:e.category??(r===void 0?`interaction`:dn[r].category),hosts:e.hosts,indexes:i}});return{items:n,answer:e=>r.map(({key:t,category:n,hosts:r,indexes:i})=>({category:n,...t===void 0?{}:{key:t},hosts:r,allow:i.length>0&&i.every(t=>e[t]?.allow===!0)}))}},yn=e=>typeof e==`object`&&!!e,bn=typeof chrome<`u`&&!!chrome.runtime?.id,xn=e=>yn(e)&&e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY===!0&&typeof e.frameId==`string`&&typeof e.document==`string`,Sn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,Tn=new Set;typeof window<`u`&&bn&&window.addEventListener(`message`,e=>{if(!xn(e.data))return;e.stopImmediatePropagation();let t=e.source;if(!t||typeof t!=`object`)return;let n=t,r=Sn.get(n),i=e.data.frameId,a=e.data.document;if(Sn.set(n,i),Cn.set(n,a),r)for(let e of Tn)e(r);let o=wn.get(n);if(o){for(let e of[...o])(e.notDocument===void 0||e.notDocument!==a)&&(o.delete(e),e.resolve(i));o.size||wn.delete(n)}},{capture:!0});var En=e=>{let t=e;if(t.window===void 0)return`iframe`;if(t.iframe!==void 0)throw TypeError(`attachFrame: pass either iframe or window, not both`);if(t.lockdown)throw TypeError(`attachFrame: lockdown applies to an iframe, never to a window`);if(typeof t.window!=`object`||t.window===null)throw TypeError(`attachFrame: window must be an object`);return`window`},Dn=(e,t,n)=>{if(e===void 0)return t;if(typeof e!=`number`||!Number.isFinite(e)||e<=0)throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);return Math.round(e)},On=({url:e,width:t,height:n})=>{let r=(()=>{if(e===void 0||e===``||e===`about:blank`)return``;if(typeof e!=`string`)throw TypeError(`attachFrame: window.url must be a string`);let t=(()=>{try{return new URL(e,location.href)}catch{throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`)}})();if(t.protocol!==`http:`&&t.protocol!==`https:`)throw TypeError(`attachFrame: window.url must be an http or https address`);return t.href})();return r&&X(r),{url:r,width:Dn(t,500,`width`),height:Dn(n,700,`height`)}},kn=e=>{try{return new URL(e).hostname}catch{return``}},An=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,jn=!1,Mn=()=>{jn||(jn=!0,console.warn(`[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this.`))},Nn=`frame: this frame no longer holds the document the app attached it to`,Pn=`frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin`,Fn=e=>{try{return new URL(e,location.href).hostname}catch{return``}},In=async({iframe:e,domains:n=[],syncCookies:r=!0,lockdown:i=!1,permissions:a})=>{let o=crypto.randomUUID();if(X(e.src),Xt({src:e.src,domains:n,lockdown:i}),await O(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(An,{detail:o}));let{executeLocator:s,highlightLocator:c,ensureLocatorPermission:l,requestCategories:u,evaluateFrame:d,goto:f}=await k.attachFrame({marker:o,domains:n,syncCookies:r,lockdown:i}),p=new Set(t.t([...n,Fn(e.src)],{ipv6:!0})),m=e=>p.has(t.t([kn(e)],{ipv6:!0})[0]??``),h=sn({executor:{execute:s,highlight:c},gate:e=>l(e.parts,e.operation,e.args),request:async e=>(_n(`frame.request`,e),await Wt(),u(e)),evaluate:async(e,t)=>{if(!pe(E(),`evaluate`)){let e=E();throw new T(`evaluate`,e.status===`ok`?e.abi:0)}return d({source:e,arg:t})},postMessage:(t,n,r)=>{if(n===`*`)throw z(Pn,`postMessage`,`extension`);if(!m(n))throw B(Nn,`postMessage`);let i=e.contentWindow;if(i===null)throw B(`frame: navigate the frame before postMessage`,`postMessage`);return i.postMessage(t,n,r),Promise.resolve()},listen:t=>{let n=n=>{n.source!==null&&n.source===e.contentWindow&&!xn(n.data)&&m(n.origin)&&t({type:`message`,data:n.data,origin:n.origin,ports:n.ports})},r=()=>t({type:`document`,origin:``});return window.addEventListener(`message`,n),e.addEventListener(`load`,r),()=>{window.removeEventListener(`message`,n),e.removeEventListener(`load`,r)}},goto:(e,n={})=>{for(let n of t.t([Fn(e)],{ipv6:!0}))p.add(n);return f({url:e,...n})},url:()=>e.src});return a?.length&&(Ut()?await h.request(a):Mn()),h},Ln=`attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })`,Rn=async e=>{if(On(e.window),e.syncCookies===!1)throw TypeError(`attachFrame: syncCookies false does not apply to an extension window, which is the site's own first-party tab`);let t=E();throw new T(`attachWindow`,t.status===`absent`?0:t.abi,Ln)},zn=(async e=>En(e)===`window`?Rn(e):In(e)),Bn=`permissions.request: pass hosts, the sites the grant applies to`,Vn={request:async e=>{let n=e.map(e=>{let{category:n,key:r,scope:i,reason:a,hosts:o}=e;if(!(`hosts`in e)&&!(`category`in e))return{legacy:{key:r,scope:i??``,reason:a}};let s=t.t(o??[],{ipv6:!0});if(!s.length)throw TypeError(Bn);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);_n(`permissions.request`,r),r.length&&await Wt();let{items:i,answer:a}=vn(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await k.requestPermissions(s):[],l=a(c.slice(0,i.length)),u=c.slice(i.length),d=0,f=0;return n.map(e=>`ask`in e?l[d++]:u[f++])}},Hn=`PermissionDeniedError`,Un=e=>e instanceof Error?e.name===Hn:yn(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return An}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return En}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Vn}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return ke}});
|