@fkn/lib 0.9.35 → 0.9.36
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-CfmRAze5.d.ts → api-CaFuvyyV.d.ts} +1 -1
- 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-B9Sd7V1g.js → cloud-CDRoRstb.js} +189 -183
- package/{cloud-DxitkM7z.d.ts → cloud-Cqdq7Ujd.d.ts} +3 -3
- package/cloud-DG_-Rt-L.cjs +1 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +1 -1
- package/{contract-D37GGkou.d.ts → contract-BIHGp6cz.d.ts} +2 -2
- package/contract.d.ts +1 -1
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/{extension-TRYu_aG-.d.ts → extension-C9BRlqEY.d.ts} +2 -2
- package/extension-DisWHU7m.cjs +1 -0
- package/extension-jDvl0U_P.js +89 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +2 -2
- package/extension.js +3 -3
- package/{hosts-C4-8lWwz.js → hosts-77UAJbm1.js} +28 -18
- package/hosts-COiOMjp-.cjs +1 -0
- package/http.d.ts +1 -1
- package/{index-C_Lqta5o.d.ts → index-BWJSnpRB.d.ts} +56 -5
- package/index.cjs +1 -1
- package/index.d.ts +8 -5
- package/index.js +12 -12
- package/lib-DCPdYk-N.cjs +53 -0
- package/{lib-B-jGWfsv.js → lib-hd9k5xOX.js} +389 -365
- package/{net-0SlODFSM.d.ts → net-BWFTx3k_.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-Bmb2wxG1.d.ts → proxy-DaljzPSa.d.ts} +2 -2
- package/rooms.d.ts +1 -1
- package/cloud-DCWD_0sd.cjs +0 -1
- package/extension-DJQ0oYdk.js +0 -89
- package/extension-DSrUjoLw.cjs +0 -1
- package/hosts-DD4rDeQH.cjs +0 -1
- package/lib-Cjd91q7g.cjs +0 -53
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as TcpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import { B as Resolvers, gt as TcpSocketResult, mt as TcpSocketListenerResult } from "./contract-
|
|
3
|
-
import "./api-
|
|
2
|
+
import { B as Resolvers, gt as TcpSocketResult, mt as TcpSocketListenerResult } from "./contract-BIHGp6cz.js";
|
|
3
|
+
import "./api-CaFuvyyV.js";
|
|
4
4
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
5
5
|
import { DuplexOptions, Stream } from "stream";
|
|
6
6
|
import { EventEmitter } from "events";
|
package/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-BWFTx3k_.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/package.json
CHANGED
package/packages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PackageResult, N as PickOptions, P as Placement, S as InstalledPackage, f as ConnectOptions, ft as SurfaceRect, j as PackagesErrorCode, k as PackageQuery, x as InstallOptions, z as Radii } from "./contract-
|
|
1
|
+
import { A as PackageResult, N as PickOptions, P as Placement, S as InstalledPackage, f as ConnectOptions, ft as SurfaceRect, j as PackagesErrorCode, k as PackageQuery, x as InstallOptions, z as Radii } from "./contract-BIHGp6cz.js";
|
|
2
2
|
import { Remote } from "osra";
|
|
3
3
|
declare namespace packages_d_exports {
|
|
4
4
|
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as Resolvers } from "./contract-
|
|
2
|
-
import "./api-
|
|
1
|
+
import { B as Resolvers } from "./contract-BIHGp6cz.js";
|
|
2
|
+
import "./api-CaFuvyyV.js";
|
|
3
3
|
//#region src/proxy.d.ts
|
|
4
4
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
5
|
type FetchParameters = Parameters<ProxyFetch>;
|
package/rooms.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as RoomPermissions, G as RoomEvent, H as RoomCreateOptions, J as RoomMailbox, Q as RoomPermission, U as RoomDefaults, V as RoomBacklog, W as RoomEnd, X as RoomMessage, Y as RoomMember, Z as RoomOpenOptions, et as RoomsErrorCode, q as RoomJoinOptions } from "./contract-
|
|
1
|
+
import { $ as RoomPermissions, G as RoomEvent, H as RoomCreateOptions, J as RoomMailbox, Q as RoomPermission, U as RoomDefaults, V as RoomBacklog, W as RoomEnd, X as RoomMessage, Y as RoomMember, Z as RoomOpenOptions, et as RoomsErrorCode, q as RoomJoinOptions } from "./contract-BIHGp6cz.js";
|
|
2
2
|
declare namespace rooms_d_exports {
|
|
3
3
|
export { RoomCreateOptions as CreateOptions, RoomJoinOptions as JoinOptions, RoomOpenOptions as OpenOptions, Room, RoomBacklog, RoomDefaults, RoomEnd, RoomEvent, RoomMailbox, RoomMember, RoomMessage, RoomPermission, RoomPermissions, RoomsError, RoomsErrorCode, available, create, join, open };
|
|
4
4
|
}
|
package/cloud-DCWD_0sd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-Cjd91q7g.cjs"),n=require("./hosts-DD4rDeQH.cjs"),r=require("./api-Djf-XdZ4.cjs"),i=require("./busy-Dv8wzE5M.cjs"),a=require("./proxy-CYcaW5ew.cjs"),o=require("./attach-policy.cjs"),s=require("./contract.cjs"),c=require("./dns.cjs"),l=require("./cloud/fs.cjs"),u=require("./net.cjs"),d=require("./dgram.cjs"),f=require("./http.cjs");let p=require("osra");var m=async()=>{let e=()=>r.o(`frame consent`);try{let t=await e();return{request:typeof t.frameConsent.request==`function`?t.frameConsent.request:void 0,ensure:t.frameConsent.ensure}}catch(t){if(!(t instanceof r.n))throw t;return{request:void 0,ensure:t=>e().then(e=>e.frameConsent.ensure(t))}}},h=`frame: this frame no longer holds the document the app attached it to`,g=!1,_=()=>{g||(g=!0,console.warn(`[fkn-frame] this FKN broker is too old to ask for permission categories, so nothing was asked for upfront and each capability is asked for as it is first used. Reloading the page picks up the current broker.`))},v=e=>[...e].flatMap(e=>{try{return[new URL(e).hostname]}catch{return[]}}),y=(e,t,n)=>n===null?`frame.${e}: the user did not grant ${t} here`:`frame.${e}: the user did not grant ${t} on ${n}`,b=e=>{let{assertLive:r,attach:i,current:a,declaredHosts:s,documentHost:c,ensure:l,request:u,session:d,approvedOrigins:f}=e,p=new Set,m=async()=>c?await c():(()=>{try{return new URL(a()).hostname}catch{return``}})(),g=()=>n.t([...s,...v(f)]),b=async e=>(await u([e]))[0]??!1;return{gate:async({operation:e,args:a,phase:c})=>{r();let _=n.f(e,a);if(_===null)return;let v=t.u(_);if(v===void 0||v===`auto`)return;if(e===`fetch`){let e=o.frameFetchVerdict({session:d,declaredHosts:s,approvedOrigins:f},c===`ensure`?void 0:a[0],{classifier:`fetchTarget`});if(c===`ensure`&&!d)throw t.w(e.kind===`refuse`?e.reason:``,`fetch`);if(c!==`ensure`&&e.kind===`refuse`)throw t.w(e.reason,`fetch`);if(!u){if(e.kind===`refuse`)throw t.w(e.reason,`fetch`);if(!await l({scope:n.s(a[0],a[1]).scope,hosts:e.promptHosts}))throw t.w(`frame.fetch: the user did not grant this`,`fetch`);return}let r=e.kind===`consent`?e.targetHost:await m(),i=n.t([r,...s]);if(!i.length)throw t.w(`frame: navigate the frame before fetch`,`fetch`);if(await b({category:`network`,hosts:i})===!1)throw t.w(y(`fetch`,`network`,r||null),`fetch`);return}let x=await m();if(!x)throw t.w(`frame: navigate the frame before ${e}`,e);if(!g().includes(x))throw t.w(h,e);if(!u)return;let S=t.l(_);if(S===void 0||v===`critical`&&p.has(`${_} ${x}`))return;let C=n.t([x,...s]),w=await b(v===`critical`?{key:_,hosts:C,attach:i}:{category:S,hosts:C});if(w===!1)throw t.w(y(e,S,null),e);if(w===`once`&&c!==`ensure`)for(let e of C)p.add(`${_} ${e}`)},requestCategories:async e=>{r();let a=await m(),o=n.t(a?[a,...s]:s);if(!o.length)throw TypeError(`frame.request: navigate the frame or declare domains first`);let c=e.map(e=>{let n=e.key;return{named:n,critical:n!==void 0&&t.u(n)===`critical`,category:e.category??(n===void 0?void 0:t.c(n))??`interaction`}}),l=({named:e,critical:t,category:n},r)=>({category:n,...t?{key:e}:{},hosts:o,allow:r});if(!u)return _(),c.map(e=>l(e,!1));let d=await u(c.map(({named:e,critical:t,category:n})=>t?{key:e,hosts:o,attach:i}:{category:n,hosts:o}));return c.map((e,t)=>l(e,d[t]!==void 0&&d[t]!==!1))}}},x=e=>e,S=5e3,C=new Set([]),w=()=>`https://fkn.app`,T=e=>e?``:`incognito-${crypto.randomUUID()}`,E=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},D=e=>Object.assign(Error(e),{name:t.b}),O=({control:e,target:n,session:r,declaredHosts:i,approvedOrigins:a,attach:o,assertLive:s,guard:c,consent:l,onNavigated:u})=>{let d=n,{gate:f,requestCategories:p}=b({session:r,declaredHosts:i,approvedOrigins:a,attach:o,assertLive:s,documentHost:typeof e.documentHost==`function`?()=>c(()=>e.documentHost()):void 0,current:()=>d,...l});return t.m({executor:{execute:(n,r,i)=>C.has(r)?Promise.reject(t.x(r,`cloud`)):(s(),c(()=>e.executeLocator(n,r,i))),highlight:async()=>{}},gate:f,request:p,goto:async(t,n={})=>{let r=new URL(t,location.href).href;s();let{timeoutMs:i}=n,o=(()=>{try{return new URL(r).origin}catch{return``}})(),l=o!==``&&!a.has(o);l&&a.add(o);try{await E(c(()=>e.goto(r,n)),(i??3e4)+S,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`)}catch(e){throw l&&a.delete(o),e}d=r,u()},url:()=>d})},ee=250,te=500,k=65e3,A=2e3,j=2e3,M=2,N=2e3,P=2e3,F=({origin:e,target:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-window`,e);return a.searchParams.set(`attach`,i),t&&a.searchParams.set(`url`,t),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.href},I=(e,t)=>{let n=document.createElement(`iframe`),r=new URL(`/attach-jar`,e);return r.searchParams.set(`attach`,t),n.src=r.href,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`style`,`display:none`),(document.body??document.documentElement).appendChild(n),n},L=(e,t)=>{let n=new MutationObserver(()=>{e.isConnected||t.aborted||(n.disconnect(),console.warn(`cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar`))});e.parentNode&&n.observe(e.parentNode,{childList:!0}),n.observe(document.documentElement,{childList:!0}),t.addEventListener(`abort`,()=>n.disconnect(),{once:!0})},R=()=>D(`cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window`),z=()=>D(`cloud.attachFrame: the attached window stopped answering; attach a fresh window`),B=()=>D(`cloud.attachFrame: the window went away before it connected; attach a fresh window`),V=()=>D(`cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window`),H=async e=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);let{domains:r=[],syncCookies:a=!0,permissions:o}=e,{url:c,width:l,height:u}=t.s(e.window);if(window.origin===`null`)throw new t.f(`opaque-opener`);let d=w(),f=crypto.randomUUID(),m=T(a),h=n.t(r),g=new Set;c&&g.add(new URL(c).origin);let _=a?I(d,f):null,v=window.open(F({origin:d,target:c,session:m,domains:h,attach:f}),`_blank`,`popup,width=${l},height=${u}`);if(!v)throw _?.remove(),new t.d;let y=new AbortController,b=!1,S=null,C=(e,t=!1)=>{if(S===null){S=e,y.abort(t?z():R());try{v.closed||v.postMessage({type:s.ATTACH_WINDOW_MESSAGE.detach,attach:f,...t?{unanswered:t}:{}},d)}catch{}_&&setTimeout(()=>_.remove(),P)}};_&&L(_,y.signal);let D=new Promise((e,t)=>{y.signal.addEventListener(`abort`,()=>t(y.signal.reason),{once:!0})});D.catch(()=>{});let H=D.then(()=>{},()=>{}),U=()=>{if(y.signal.aborted)throw y.signal.reason},W=e=>y.signal.aborted?Promise.reject(y.signal.reason):Promise.race([e(),D]),G=e=>e.source===v&&e.origin===d;window.addEventListener(`message`,e=>{if(!G(e))return;let n=e.data;typeof n==`object`&&n&&n.attach===f&&(n.type===s.ATTACH_WINDOW_MESSAGE.refused?C(new t.f(n.reason)):n.type===s.ATTACH_WINDOW_MESSAGE.gone&&C(b?R():B()))},{signal:y.signal}),window.addEventListener(`pagehide`,()=>C(R()),{signal:y.signal});let K=()=>{try{v.postMessage({type:s.ATTACH_WINDOW_MESSAGE.hello,attach:f},d)}catch{}};K();let q=setInterval(K,ee),J=setInterval(()=>{v.closed&&C(b?R():V())},te);y.signal.addEventListener(`abort`,()=>{clearInterval(q),clearInterval(J)},{once:!0});let Y=async e=>{try{return await Promise.race([e,D])}catch(e){throw S??e}};try{let e=await Y(E((0,p.expose)({},{key:s.ATTACH_WINDOW_KEY,transport:{emit:(e,t)=>v.postMessage(e,d,t??[]),receive:e=>{let t=t=>{G(t)&&e(t.data,{source:t.source,origin:t.origin})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}},unregisterSignal:y.signal,revivableModules:x(t.et)}),s.WINDOW_HANDSHAKE_TIMEOUT_MS,`cloud.attachFrame: timed out connecting to the window`));b=!0,clearInterval(q);let n=0,r=setInterval(()=>{E(W(()=>e.ping()),j,`ping`).then(()=>{n=0},()=>{y.signal.aborted||(document.visibilityState===`hidden`?n=0:++n>=M&&C(z(),!0))})},A);y.signal.addEventListener(`abort`,()=>clearInterval(r),{once:!0}),await Y(E(e.ready(),k,`cloud.attachFrame: the window never became ready`));let a=i.t(`attached frame`);y.signal.aborted?a():y.signal.addEventListener(`abort`,a,{once:!0});let l=O({control:e,target:c,session:m,declaredHosts:h,approvedOrigins:g,attach:f,assertLive:U,guard:W,consent:{request:t=>W(()=>e.requestConsent(t)),ensure:t=>W(()=>e.requestConsent([t])).then(([e])=>e!==void 0&&e!==!1)},onNavigated:()=>{}}),u=null,_=()=>u??=(async()=>{y.signal.aborted||await E(Promise.allSettled([W(()=>e.flushCookies()),W(()=>e.sweepStorage())]),N,`close`).catch(()=>{});try{v.close()}catch{}C(R())})(),S={...l,close:_,closed:H};return o?.length&&await Y(S.request(o)),S}catch(e){let n=S??e;if(!(n instanceof t.f))try{v.close()}catch{}throw C(n),n}},U=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,W=2e4,G=65e3,K=e=>!e||e===`about:blank`,q=({target:e,session:t,domains:n,attach:r})=>{let i=new URL(`/attach-frame`,w());return e&&i.searchParams.set(`url`,e),t&&i.searchParams.set(`session`,t),n.length&&i.searchParams.set(`domains`,n.join(`,`)),i.searchParams.set(`attach`,r),i.href},J=(e,t)=>{let n=()=>{a(),t()},r=e.parentNode,i=new MutationObserver(()=>{(!e.isConnected||e.parentNode!==r)&&(a(),t())}),a=()=>{window.removeEventListener(`pagehide`,n),i.disconnect()};window.addEventListener(`pagehide`,n,{once:!0}),r&&i.observe(r,{childList:!0}),e.isConnected||(a(),t())},Y=()=>D(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),ne=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},re=[300,1200,4e3],X=e=>{let t=()=>{if(!e.isConnected)return;let t=e.style.height,n=e.getBoundingClientRect();n.height&&(e.style.height=`${n.height-1}px`,setTimeout(()=>{e.style.height=t},50))};t();for(let e of re)setTimeout(t,e)},ie=e=>{let t=e.getAttribute(`sandbox`);if(t===null)return;let n=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),r=[`allow-scripts`,`allow-same-origin`].filter(e=>!n.has(e));if(r.length)throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(` and `)} for the render proxy to load`)},ae=async({iframe:e,domains:r=[],syncCookies:a=!0,lockdown:o=!1,permissions:c})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(o)throw Error(`cloud.attachFrame does not support lockdown; use the extension backend for a sealed frame`);if(!e.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);ie(e);let l=e.getAttribute(`src`)??``,u=(()=>{if(K(l))return null;try{return new URL(e.src||l,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${l}`)}})();if(u){let e=new URL(`/attach-frame`,w());if(u.origin===e.origin&&u.pathname===e.pathname)throw Error(`cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe`)}let d=u?.href??``;d&&t.g(d);let f=T(a),h=n.t(r),g=new Set;try{g.add(new URL(d).origin)}catch{}let _=new AbortController,v=e.referrerPolicy,y=e.allow,b=crypto.randomUUID();if(e.referrerPolicy=`origin`,e.allow=ne(U,e.allow),e.src=q({target:d,session:f,domains:h,attach:b}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let n=await E((0,p.expose)({},{key:s.ATTACH_FRAME_KEY,origin:w(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:_.signal,revivableModules:x(t.et)}),W,`cloud.attachFrame: timed out connecting to the render proxy page`);await E(n.ready(),G,`cloud.attachFrame: the render proxy never became ready`),d&&X(e),J(e,()=>_.abort());let r=i.t(`attached frame`);_.signal.aborted?r():_.signal.addEventListener(`abort`,r,{once:!0});let a=e.contentWindow,o=O({control:n,target:d,session:f,declaredHosts:h,approvedOrigins:g,attach:b,assertLive:()=>{if(_.signal.aborted||!e.isConnected||e.contentWindow!==a)throw _.abort(),Y()},guard:e=>e(),consent:await m(),onNavigated:()=>X(e)});return c?.length&&await o.request(c),o}catch(t){throw _.abort(),e.referrerPolicy=v,e.allow=y,e.src=d||`about:blank`,t}},Z=(async e=>t.o(e)===`window`?H(e):ae(e)),oe=()=>typeof window<`u`&&!0,Q=async()=>{let e=await r.a.then(e=>e.cloud.quota());return{premium:e.premium,overQuota:e.overQuota,throttled:e.overQuota&&!e.premium,usedBytes:e.usedBytes,limitBytes:e.limitBytes,remainingBytes:e.remaining,bytesPerSecond:e.bytesPerSecond,bitsPerSecond:e.bytesPerSecond*8}},se=e.t({attachFrame:()=>Z,available:()=>$,dgram:()=>d.t,dns:()=>c.t,fetch:()=>a.t,fs:()=>l.t,http:()=>f.t,net:()=>u.t,quota:()=>Q}),$=()=>r.c;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
package/extension-DJQ0oYdk.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { $ as t, A as n, B as r, C as i, D as a, E as o, F as s, G as c, H as l, I as u, J as ee, K as te, L as ne, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, W as b, X as x, Z as S, _ as C, a as w, at as T, b as E, d as D, et as O, f as k, g as A, h as re, i as j, it as M, j as N, k as P, m as F, n as I, nt as L, p as R, q as z, r as B, rt as V, t as H, tt as U, v as W, y as G, z as K } from "./lib-B-jGWfsv.js";
|
|
3
|
-
import { a as q, d as J } from "./api-CtiKFcK3.js";
|
|
4
|
-
import { t as Y } from "./proxy-DDwY3AVG.js";
|
|
5
|
-
import { available as X, fetch as ie } from "./desktop.js";
|
|
6
|
-
//#region src/extension-prompt.ts
|
|
7
|
-
var Z = async (e) => {
|
|
8
|
-
if (typeof window > "u") return !1;
|
|
9
|
-
if (c()) return !0;
|
|
10
|
-
let t = await q, n = null, r = new Promise((e) => {
|
|
11
|
-
n = () => {
|
|
12
|
-
c() && e(!0);
|
|
13
|
-
}, b.addEventListener("statuschange", n);
|
|
14
|
-
}), i = t.installPrompt.show(e).then(() => !1), a = await Promise.race([r, i]);
|
|
15
|
-
return n && b.removeEventListener("statuschange", n), await t.installPrompt.hide().catch(() => {}), a;
|
|
16
|
-
}, Q = null;
|
|
17
|
-
z(() => (Q ||= Z().then(() => void 0).finally(() => {
|
|
18
|
-
Q = null;
|
|
19
|
-
}), Q));
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/auto.ts
|
|
22
|
-
var $ = () => typeof document < "u" && c(), ae = async (e, t) => {
|
|
23
|
-
if (J(e), t?.credentials === "include") {
|
|
24
|
-
if (typeof document > "u") throw Error("fetch with credentials needs the FKN extension, which only exists in window realms");
|
|
25
|
-
return m(e, t);
|
|
26
|
-
}
|
|
27
|
-
return $() ? m(e, {
|
|
28
|
-
...t,
|
|
29
|
-
credentials: "omit"
|
|
30
|
-
}) : X() ? ie(e, t) : Y(e, t);
|
|
31
|
-
}, oe = /* @__PURE__ */ e({
|
|
32
|
-
ATTACH_FRAME_EVENT_KEY: () => j,
|
|
33
|
-
CATEGORIES: () => a,
|
|
34
|
-
EXTENSION_ABI: () => 2,
|
|
35
|
-
ExtensionOperationUnsupportedError: () => x,
|
|
36
|
-
ExtensionOutdatedError: () => S,
|
|
37
|
-
FORGEABLE_HEADERS: () => r,
|
|
38
|
-
FrameWindowBlockedError: () => D,
|
|
39
|
-
FrameWindowRefusedError: () => k,
|
|
40
|
-
LOCATOR_DENIED: () => i,
|
|
41
|
-
LOCATOR_ERROR: () => o,
|
|
42
|
-
LOCATOR_UNSUPPORTED: () => E,
|
|
43
|
-
PERMISSION_DENIED: () => H,
|
|
44
|
-
REQUIRED_EXTENSION_ABI: () => 0,
|
|
45
|
-
assertAttachableFrameUrl: () => A,
|
|
46
|
-
assertFetchableUrl: () => f,
|
|
47
|
-
assertForgeableHeaders: () => y,
|
|
48
|
-
assertLockdownApplicable: () => C,
|
|
49
|
-
assertOneCookieIdentity: () => l,
|
|
50
|
-
attachFrame: () => w,
|
|
51
|
-
attachFramePermission: () => R,
|
|
52
|
-
available: () => $,
|
|
53
|
-
box: () => U,
|
|
54
|
-
cookies: () => N,
|
|
55
|
-
createFrame: () => F,
|
|
56
|
-
createVideoElementHandle: () => L,
|
|
57
|
-
events: () => b,
|
|
58
|
-
extension: () => b,
|
|
59
|
-
fetch: () => m,
|
|
60
|
-
fetchCredentialedPermission: () => s,
|
|
61
|
-
fetchLocalPermission: () => u,
|
|
62
|
-
fetchPermission: () => ne,
|
|
63
|
-
gotoPermission: () => re,
|
|
64
|
-
handleRevivableModules: () => O,
|
|
65
|
-
hasForgedCookie: () => v,
|
|
66
|
-
isBlockedFetchUrl: () => h,
|
|
67
|
-
isBlockedFrameUrl: () => W,
|
|
68
|
-
isExtensionExposed: () => c,
|
|
69
|
-
isLocalNetworkUrl: () => K,
|
|
70
|
-
isLocatorDenied: () => G,
|
|
71
|
-
isLocatorUnsupported: () => g,
|
|
72
|
-
isPermissionDenied: () => I,
|
|
73
|
-
isTerminalError: () => _,
|
|
74
|
-
isType: () => V,
|
|
75
|
-
modifyRequestHeadersPermission: () => p,
|
|
76
|
-
permissions: () => B,
|
|
77
|
-
promptInstall: () => Z,
|
|
78
|
-
readCookiePermission: () => d,
|
|
79
|
-
readExtensionHandshake: () => te,
|
|
80
|
-
removeRequestHeaderRule: () => P,
|
|
81
|
-
revive: () => M,
|
|
82
|
-
setMissingExtensionHandler: () => z,
|
|
83
|
-
setRequestHeaderRule: () => n,
|
|
84
|
-
supportsOperation: () => t,
|
|
85
|
-
type: () => T,
|
|
86
|
-
waitForExtensionExposure: () => ee
|
|
87
|
-
});
|
|
88
|
-
//#endregion
|
|
89
|
-
export { Z as i, ae as n, $ as r, oe as t };
|
package/extension-DSrUjoLw.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-Cjd91q7g.cjs"),n=require("./api-Djf-XdZ4.cjs"),r=require("./proxy-CYcaW5ew.cjs"),i=require("./desktop.cjs");var a=async e=>{if(typeof window>`u`)return!1;if(t.G())return!0;let r=await n.a,i=null,a=new Promise(e=>{i=()=>{t.G()&&e(!0)},t.W.addEventListener(`statuschange`,i)}),o=r.installPrompt.show(e).then(()=>!1),s=await Promise.race([a,o]);return i&&t.W.removeEventListener(`statuschange`,i),await r.installPrompt.hide().catch(()=>{}),s},o=null;t.q(()=>(o||=a().then(()=>void 0).finally(()=>{o=null}),o));var s=()=>typeof document<`u`&&t.G(),c=async(e,a)=>{if(n.d(e),a?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return t.P(e,a)}return s()?t.P(e,{...a,credentials:`omit`}):i.available()?i.fetch(e,a):r.t(e,a)},l=e.t({ATTACH_FRAME_EVENT_KEY:()=>t.i,CATEGORIES:()=>t.D,EXTENSION_ABI:()=>2,ExtensionOperationUnsupportedError:()=>t.X,ExtensionOutdatedError:()=>t.Z,FORGEABLE_HEADERS:()=>t.B,FrameWindowBlockedError:()=>t.d,FrameWindowRefusedError:()=>t.f,LOCATOR_DENIED:()=>t.C,LOCATOR_ERROR:()=>t.E,LOCATOR_UNSUPPORTED:()=>t.b,PERMISSION_DENIED:()=>t.t,REQUIRED_EXTENSION_ABI:()=>0,assertAttachableFrameUrl:()=>t.g,assertFetchableUrl:()=>t.N,assertForgeableHeaders:()=>t.V,assertLockdownApplicable:()=>t._,assertOneCookieIdentity:()=>t.H,attachFrame:()=>t.a,attachFramePermission:()=>t.p,available:()=>s,box:()=>t.tt,cookies:()=>t.j,createFrame:()=>t.m,createVideoElementHandle:()=>t.nt,events:()=>t.W,extension:()=>t.W,fetch:()=>t.P,fetchCredentialedPermission:()=>t.F,fetchLocalPermission:()=>t.I,fetchPermission:()=>t.L,gotoPermission:()=>t.h,handleRevivableModules:()=>t.et,hasForgedCookie:()=>t.U,isBlockedFetchUrl:()=>t.R,isBlockedFrameUrl:()=>t.v,isExtensionExposed:()=>t.G,isLocalNetworkUrl:()=>t.z,isLocatorDenied:()=>t.y,isLocatorUnsupported:()=>t.S,isPermissionDenied:()=>t.n,isTerminalError:()=>t.T,isType:()=>t.rt,modifyRequestHeadersPermission:()=>t.O,permissions:()=>t.r,promptInstall:()=>a,readCookiePermission:()=>t.M,readExtensionHandshake:()=>t.K,removeRequestHeaderRule:()=>t.k,revive:()=>t.it,setMissingExtensionHandler:()=>t.q,setRequestHeaderRule:()=>t.A,supportsOperation:()=>t.$,type:()=>t.at,waitForExtensionExposure:()=>t.J});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
package/hosts-DD4rDeQH.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={scope:`read.text`,category:`storage`,severity:1,chip:`read text`,title:`Read text from the page`,description:`Lets the app see the text shown on this page.`},t={scope:`read.info`,category:`storage`,severity:1,chip:`read details`,title:`Read info from the page`,description:`Lets the app read a detail of a part of the page.`},n={scope:`read.visible`,category:`storage`,severity:0,title:`See what’s visible on the page`,description:`Lets the app check which elements are currently on screen.`},r={scope:`read.check`,category:`storage`,severity:0,title:`Check if something is on the page`,description:`Lets the app test whether a specific element exists.`},i={scope:`read.count`,category:`storage`,severity:0,title:`Count items on the page`,description:`Lets the app count how many matching elements are present.`},a={scope:`act.click`,category:`interaction`,severity:3,chip:`click`,title:`Click on the page`,description:`Lets the app press buttons or links for you.`},o={scope:`act.type`,category:`interaction`,severity:1,chip:`type`,title:`Type into a text field`,description:`Lets the app fill in form fields on your behalf.`},s={scope:`act.hover`,category:`interaction`,severity:1,chip:`hover`,title:`Hover over the page`,description:`Lets the app point at things to reveal menus or tooltips.`},c={scope:`media.video`,category:`interaction`,severity:0,title:`Control video playback`,description:`Lets the app play, pause, seek, and read the video on the page.`},l={scope:`media.appear`,category:`interaction`,severity:0,title:`Change page appearance`,description:`Lets the app restyle parts of the page (safely filtered).`},u={scope:`media.appearU`,category:`evaluation`,severity:2,chip:`unfiltered styles`,unsafe:!0,title:`Change page appearance (unsafe)`,description:`Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.`},d=e=>e?.noSanitize?u:l,f={scope:`frame.fetchRead`,category:`network`,severity:3,chip:`load`,unsafe:!0,title:`Read your account data on this site`,description:`Lets the app read pages and data from this site as you, using the session in the frame.`},p={scope:`frame.fetchWrite`,category:`network`,severity:3,chip:`send`,unsafe:!0,title:`Change your account data on this site`,description:`Lets the app send changes to this site as you, using the session in the frame.`},m=new Set([`GET`,`HEAD`,`OPTIONS`]),h=(e,t)=>m.has((t?.method??`GET`).toUpperCase())?f:p,g={click:a,fill:o,hover:s,textContent:e,getAttribute:t,isVisible:n,count:i,exists:r,videoElement:c,addStyleTag:d,fetch:h};[e,t,n,r,i,a,o,s,c,l,u,f,p].map(e=>e.scope);var _=g,v=(e,t)=>{let n=_[e];return n?(typeof n==`function`?n(...t):n).scope:null},y=(e,t)=>{try{return new URL(e,t)}catch{return}},b=e=>{let t=y(e,`https://s.invalid/`),n=y(e,`http://s.invalid/`);if(!t||!n)return{kind:`invalid`};let r=y(e);return!r||r.href!==t.href||r.href!==n.href?{kind:`relative`}:r.protocol!==`https:`&&r.protocol!==`http:`?{kind:`unsupported`,protocol:r.protocol}:{kind:`absolute`,host:r.hostname,protocol:r.protocol}},x=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/,S=/^\[[0-9a-f:.]+\]$/,C=e=>{try{return new URL(`http://${e}/`).hostname}catch{return}},w=(e,{ipv6:t=!1}={})=>{let n=[];for(let r of e){let e=r.trim().toLowerCase();if(!e||e.length>253)continue;let i=x.test(e)?e:t&&S.test(e)?C(e):void 0;i&&!n.includes(i)&&n.push(i)}return n};Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return p}});
|
package/lib-Cjd91q7g.cjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-DD4rDeQH.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:()=>S,createVideoElementHandle:()=>b,isType:()=>x,revive:()=>C,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)),x=e=>typeof e==`object`&&!!e&&e[d]===!0,S=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},C=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return y({...e.initialState},r)},w=e=>[o,...e],ne=2,re=0,ie=`fknExtension`,ae=`fknExtensionAbi`,oe=`fknExtensionOps`,se=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],ce=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},le=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),ue=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=ce(e[ae]),r=le(e[oe]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},de=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,T=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}},fe=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}},pe=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,me=ie,he=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(pe,()=>{he.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:ge()}}))});var ge=()=>typeof document>`u`?!1:document.documentElement.dataset[me]===`true`,E=()=>typeof document>`u`?{status:`absent`}:ue(document.documentElement.dataset),D=null,_e=e=>{D=e},ve=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 T(e.abi,e.required));if(D){if(await D().catch(()=>{}),r())return t();let e=E();if(e.status===`outdated`)return n(new T(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(),ve)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...se]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),ye,k=new Proxy({},{get:(e,t)=>async(...e)=>{await O(),ye??=(0,n.expose)({},{transport:window,revivableModules:w});let r=(await ye)[t];return r(...e)}}),A=[`origin`,`referer`,`cookie`],be=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),xe=e=>be(e,`cookie`),Se=(e,t)=>{if(t===`include`&&xe(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Ce=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!A.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},we=[`fkn.app`,`fkn.dev`,`sdbx.app`],Te=e=>e.replace(/\.+$/,``),Ee=e=>{let t=Te(e);return we.some(e=>t===e||t.endsWith(`.${e}`))},De={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.`},Oe={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.`},ke={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.`},Ae=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},je=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:`):Ae(n)},Me=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Ee(t.hostname)},Ne=e=>{if(Me(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Pe=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=A.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},Fe=async(e,t)=>{let n=new Request(e,t);Ne(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:Pe(t),reason:t?.reason,signal:t?.signal??void 0})},j={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.`},Ie={get:e=>k.getCookie(e)},Le={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.`},Re=e=>k.setRequestHeaderRule(e),ze=e=>k.removeRequestHeaderRule({ruleId:e}),Be=()=>{let e=E();return e.status===`ok`&&e.abi>=2},Ve=async()=>{await O();let e=E();if(e.status===`ok`&&e.abi<2)throw new T(e.abi,2)},He=e=>`Read the text, links and details ${e} shows.`,Ue=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,We=[{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=>`Interact with ${e}`,cloudDescription:e=>`Click, type and hover on ${e} for you, through the session in this frame. If you signed in there, this happens as you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:He,cloudTitle:e=>`Read data from ${e}`,cloudDescription:He},{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=>`Make requests to ${e}`,cloudDescription:e=>`Load pages and data from ${e} and send changes there through the session in this frame. If you signed in there, this happens as you.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:Ue,cloudTitle:e=>`Run code on ${e}`,cloudDescription:Ue}],Ge=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}},Ke=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},M;(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`})(M||={});var qe=(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`)},N=(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=N(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=qe(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=qe(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},P=/\/\*[^]*?(?:\*\/|$)/g;function F(e){return e?e.trim():``}function I(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=>{I(e,r)}):n&&typeof n==`object`&&I(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Je=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 M.stylesheet:return this.stylesheet(e);case M.rule:return this.rule(e);case M.declaration:return this.declaration(e);case M.comment:return this.comment(e);case M.container:return this.container(e);case M.charset:return this.charset(e);case M.counterStyle:return this.counterStyle(e);case M.document:return this.document(e);case M.customMedia:return this.customMedia(e);case M.fontFace:return this.fontFace(e);case M.fontFeatureValues:return this.fontFeatureValues(e);case M.host:return this.host(e);case M.import:return this.import(e);case M.keyframes:return this.keyframes(e);case M.keyframe:return this.keyframe(e);case M.layer:return this.layer(e);case M.media:return this.media(e);case M.namespace:return this.namespace(e);case M.page:return this.page(e);case M.pageMarginBox:return this.pageMarginBox(e);case M.positionTry:return this.positionTry(e);case M.property:return this.property(e);case M.scope:return this.scope(e);case M.startingStyle:return this.startingStyle(e);case M.supports:return this.supports(e);case M.viewTransition:return this.viewTransition(e);case M.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!==M.declaration&&e.type!==M.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(`;`)}},Ye=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new Ke(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ge(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:M.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=N(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=N(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(F(n).replace(P,``),[`,`]).map(e=>F(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=F(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=N(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=F(s).replace(P,``));let u=t({type:M.declaration,property:r.replace(P,``),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=N(e,[`{`]);if(t===-1)return!1;let n=N(e,[`;`]),r=N(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=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();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=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();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:M.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=S(`import`),b=S(`charset`),x=S(`namespace`);function S(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 C(){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:M.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=_();return c()?t({type:M.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:M.customMedia,name:F(r[1]),media:F(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=_();return c()?t({type:M.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||y()||b()||x()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=F(r[1]),u=F(r[2]);if(!s())return o(`@document missing '{'`);let d=_();return c()?t({type:M.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=C();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:M.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:M.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:M.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=_();return c()?t({type:M.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=_();return c()?t({type:M.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:M.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:M.layer,layer:r})}let a=_();return c()?t({type:M.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:M.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:M.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=_();return c()?t({type:M.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:M.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:M.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:M.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=N(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=F(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=_();return c()?t({type:M.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:M.atRule,name:r,prelude:a})}()}function w(){let e=i(),t=p();return t?(d(),e({type:M.rule,selectors:t,declarations:ee()||[]})):o(`selector missing`)}return I(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=C()||w(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:M.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Xe=(e,t)=>new Je(t||{}).compile(e),Ze=Object.defineProperty,Qe=(e,t)=>{let n={};for(var r in e)Ze(n,r,{get:e[r],enumerable:!0});return t||Ze(n,Symbol.toStringTag,{value:`Module`}),n},$e=`LocatorError`,L=`LocatorUnsupportedError`,R=`LocatorDeniedError`,et=`LocatorInvalidError`,z=e=>typeof e==`object`&&e?e.name:void 0,B=e=>Object.assign(Error(e),{name:$e}),tt=(e,t=``,n)=>Object.assign(Error(e),{name:L,operation:t,backend:n}),nt=(e,t)=>tt(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),rt=(e,t)=>Object.assign(Error(e),{name:R,operation:t}),it=(e,t)=>Object.assign(Error(e),{name:et,operation:t}),at=e=>z(e)===L,ot=e=>z(e)===R,st=e=>z(e)===et,ct=e=>ot(e)||at(e)||st(e),V=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw B(`the resolved element belongs to a document with no window`);return t},lt=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},H=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return lt(V(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=lt(globalThis,t);return r&&e instanceof r?r:null},U=(e,t)=>H(e,t)!==null,W=e=>{if(e.length===0)throw B(`No elements found`);if(e.length>1)throw B(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},ut=(e,t)=>{if(!U(e,t))throw B(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},dt=e=>e.tagName.toLowerCase(),ft=new Set,pt=e=>{ft.add(e)},mt=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ht=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),gt=e=>!mt.test(ht(e.value)),_t=new Set([M.import,M.fontFace,M.namespace,M.charset,M.document,M.comment]),vt=e=>{if(_t.has(e.type))return null;if(e.type===M.declaration)return gt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=yt(r))}return n},yt=e=>e.map(e=>vt(e)).filter(e=>e!==null),bt=e=>{let t;try{t=Ye(e,{silent:!0})}catch{return``}return t.stylesheet.rules=yt(t.stylesheet.rules),Xe(t)},xt=(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)},St={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:bt(t.content);try{xt(e.document,n)}catch(e){console.error(e)}pt(n)}},Ct=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},G={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw it(`fetch: url must be a string`,`fetch`);let r=V(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw it(`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:Ct(a.headers),body:await a.arrayBuffer()}}},K=Qe({click:()=>Tt,count:()=>Nt,exists:()=>Pt,fill:()=>kt,getAttribute:()=>jt,hover:()=>Et,isVisible:()=>Mt,textContent:()=>At}),wt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},Tt={resolve:(e,t={})=>{let n=W(e.elements),r=V(n),i={bubbles:!0,cancelable:!0,composed:!0,...wt(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}))}},Et={resolve:(e,t={})=>{let n=W(e.elements),r=V(n),i={bubbles:!0,cancelable:!0,composed:!0,...wt(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))}},Dt=(e,t)=>{e._valueTracker?.setValue(``);let n=(H(e,`HTMLTextAreaElement`)??H(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Ot=(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}}},kt={resolve:(e,t,n={})=>{let r=W(e.elements),i=V(r),a=U(r,`HTMLInputElement`);if(a||U(r,`HTMLTextAreaElement`)){let e=r,n=a?Ot(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),Dt(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(U(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${dt(r)}> is not fillable`)}},At={resolve:(e,t={})=>W(e.elements).textContent},jt={resolve:(e,t,n={})=>W(e.elements).getAttribute(t)},Mt={resolve:(e,t={})=>{let n=W(e.elements);if(!U(n,`HTMLElement`))return!0;let r=V(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Nt={resolve:(e,t={})=>e.elements.length},Pt={resolve:(e,t={})=>e.elements.length>0},q=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),J=e=>e.replaceAll(`"`,`\\"`),Ft={to:`element`,css:!0,resolve:(e,t)=>q(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},It={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>q(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Lt={element:{selectors:{locator:Ft,frameLocator:It,getByRole:{to:`element`,resolve:(e,t)=>q(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${J(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("${J(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>q(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${J(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:Tt,fill:kt,hover:Et,textContent:At,getAttribute:jt,isVisible:Mt,count:Nt,exists:Pt}},frame:{selectors:{locator:Ft,frameLocator:It,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:St,fetch:G}}},Rt=(e,t=Lt)=>({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}}}),zt=3e4,Bt=50,Vt=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Ht=e=>{let t=Vt(e)?.timeout;return typeof t==`number`?t:zt},Ut=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),Wt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Ut(e))},Gt=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`},Ut(e));let o=Ht(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(ct(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Bt,t)))}}finally{clearTimeout(d)}throw f},Kt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>Kt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>Gt({...e,parts:r,operation:a,args:t});return i.ensure=(i,a={})=>{let o=t[n].operations[i]?.ensureArgs;return Wt({...e,parts:r,operation:i,args:o?.(a)??[a]})},i},qt=e=>Kt(e,e.modules??Lt,`frame`,[]),Jt=Rt({element:{operations:{click:{resolve:(e,t={})=>K.click.resolve(e,t)},hover:{resolve:(e,t={})=>K.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>K.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>K.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>K.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>K.isVisible.resolve(e)},count:{resolve:(e,t={})=>K.count.resolve(e)},exists:{resolve:(e,t={})=>K.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(ut(W(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>St.resolve(e,t)},fetch:{resolve:(e,t,n={})=>G.resolve(e,t,n),kind:G.kind,ensureArgs:G.ensureArgs}}}}),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:`&&Ee(t.hostname)},Y=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=e=>{let t=qt({executor:e.executor,modules:Jt,gate:e.gate}),n=(t,n={})=>(Y(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)};return{...t,goto:n,url:r,request:i}},rn=[t.g,t.h,t._,t.p,t.m,t.n,t.i,t.r,t.d,t.a,t.o,Zt,Qt,t.l,t.u,De,Oe,ke,j,Le],an=We.map(e=>e.id),on={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},X=e=>e===0?`auto`:e===4?`critical`:`bundled`,Z=rn,Q=new Map,sn={};(()=>{Q=new Map(Z.map(e=>[e.scope,e])),sn=Object.fromEntries(Q),Z.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>Z.filter(t=>t.category===e&&X(t.severity)===`bundled`);Object.fromEntries(an.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(an.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var cn=e=>Q.get(e)?.category,ln=e=>{let t=Q.get(e);return t&&X(t.severity)},un=e=>{let t=Q.get(e);if(t)return X(t.severity)===`critical`?t.scope:t.category},dn=e=>on[e],fn=({category:e,key:t})=>{let n=t??(e&&dn(e));return n!==void 0&&cn(n)!==void 0?n:void 0},pn=(e,t)=>{for(let{category:n,key:r}of t)if(fn({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}"`)},mn=(e,t={})=>{let n=[],r=e.map(e=>{let r=fn(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&&ln(r)===`critical`?r:void 0,category:e.category??(r===void 0?`interaction`:sn[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)}))}},hn=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`},$=(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)},gn=({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&&Y(r),{url:r,width:$(t,500,`width`),height:$(n,700,`height`)}},_n=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,vn=!1,yn=()=>{vn||(vn=!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.`))},bn=async({iframe:e,domains:t=[],syncCookies:n=!0,lockdown:r=!1,permissions:i})=>{let a=crypto.randomUUID();if(Y(e.src),Xt({src:e.src,domains:t,lockdown:r}),await O(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(_n,{detail:a}));let{executeLocator:o,highlightLocator:s,ensureLocatorPermission:c,requestCategories:l,goto:u}=await k.attachFrame({marker:a,domains:t,syncCookies:n,lockdown:r}),d=nn({executor:{execute:o,highlight:s},gate:e=>c(e.parts,e.operation,e.args),request:async e=>(pn(`frame.request`,e),await Ve(),l(e)),goto:(e,t={})=>u({url:e,...t}),url:()=>e.src});return i?.length&&(Be()?await d.request(i):yn()),d},xn=`attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })`,Sn=async e=>{if(gn(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 fe(`attachWindow`,t.status===`absent`?0:t.abi,xn)},Cn=(async e=>hn(e)===`window`?Sn(e):bn(e)),wn=`permissions.request: pass hosts, the sites the grant applies to`,Tn={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(wn);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);pn(`permissions.request`,r),r.length&&await Ve();let{items:i,answer:a}=mn(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++])}},En=e=>typeof e==`object`&&!!e,Dn=`PermissionDeniedError`,On=e=>e instanceof Error?e.name===Dn:En(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return un}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return hn}}),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 Tn}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return je}});
|