@fkn/lib 0.9.15 → 0.9.17
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/account.cjs +1 -1
- package/account.js +1 -1
- package/api-DLGGoSnx.cjs +3 -0
- package/{api-B6FNNKl0.d.ts → api-Dhc2hNCz.d.ts} +1 -26
- package/{api-DAQQBty8.js → api-X8SBbrBZ.js} +97 -72
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -2
- package/cloud/fs.js +21 -18
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +1 -1
- package/{cloud-9cCFUQiG.cjs → cloud-CcKsidlt.cjs} +1 -1
- package/{cloud--8SYg1so.d.ts → cloud-CvEqxYM6.d.ts} +3 -3
- package/{cloud-DWnpupeb.js → cloud-DohLHbg2.js} +4 -4
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +4 -4
- package/dgram-CW53Betg.cjs +1 -0
- package/{dgram-BDXvc69t.js → dgram-qpKjZosS.js} +15 -8
- package/dgram.cjs +1 -1
- package/dgram.d.ts +56 -1
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.js +1 -1
- package/{extension-DPlyfEPO.cjs → extension-1l_UXQsi.cjs} +1 -1
- package/{extension-xVdvgkZL.js → extension-DQcp_LKK.js} +2 -2
- package/extension.cjs +1 -1
- package/extension.js +1 -1
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-MJ2u5qvV.js → fs-B-NZzzSX.js} +58 -58
- package/{fs-DKseuFE2.cjs → fs-C5L6CqmF.cjs} +1 -1
- package/{fs-DTmSCXwa.d.ts → fs-D5LFP4_n.d.ts} +23 -2
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.cjs +1 -1
- package/http.d.ts +1 -1
- package/http.js +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +2 -2
- package/index.js +6 -6
- package/{net-BDAN5Mvc.js → net-B-LNnKps.js} +1 -1
- package/{net-BnGcJpUb.d.ts → net-BtdN07IP.d.ts} +1 -1
- package/{net-kma1sFhK.cjs → net-luhw3yr7.cjs} +1 -1
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.js +1 -1
- package/{proxy-BsimoT14.cjs → proxy-B0W1qzCo.cjs} +1 -1
- package/{proxy-BthoIRuv.js → proxy-CtS_JiZL.js} +1 -1
- package/{proxy-BihVUSnB.d.ts → proxy-etZJARWe.d.ts} +1 -1
- package/storage-CXIXrIxB.d.ts +38 -0
- package/storage-D2a8SsY5.cjs +1 -0
- package/storage-XKGhInxm.js +37 -0
- package/api-D5ioM3pa.cjs +0 -3
- package/dgram-C1E6TUWN.cjs +0 -1
- package/storage-DRhPPtAl.js +0 -30
- package/storage-Di1ZseFg.cjs +0 -1
package/account.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DLGGoSnx.cjs");var n=e.t({info:()=>a,login:()=>r,logout:()=>i,onChange:()=>o}),r=async()=>typeof window>`u`?!1:(await t.t).account.login(location.origin).catch(()=>!1),i=async()=>{typeof window>`u`||await(await t.t).account.logout().catch(()=>{})},a=async()=>{if(typeof window>`u`)return null;let e=await t.t.then(e=>e.account.info()).catch(()=>null);return e?{name:e.name,image:e.image,premium:e.premium,premiumUntil:e.premiumUntil?Date.parse(e.premiumUntil):null}:null},o=async e=>{if(typeof window>`u`)return()=>{};let n=await t.t.catch(()=>null);if(!n)return()=>{};let r=await n.account.onChange(e).catch(()=>null);return typeof r==`function`?r:()=>{}};exports.info=a,exports.login=r,exports.logout=i,exports.onChange=o,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
package/account.js
CHANGED
package/api-DLGGoSnx.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs");let t=require("osra");var n=1e4,r=16,i=e=>{let t;try{t=e.contentWindow}catch{return!0}if(!t)return!0;try{let e=t.location.href;return e!==``&&e!==`about:blank`}catch{return!0}},a=(e,t=n)=>new Promise(n=>{if(i(e))return n();let a=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,a),n()},o=setInterval(()=>{i(e)&&a()},r),s=setTimeout(a,t);e.addEventListener(`load`,a)}),o=32,s=8,c=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),l=typeof CSS<`u`&&CSS.supports(`clip-path`,`polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)`),u=e=>{let t=e.style;t.setProperty(`display`,`block`,`important`),t.setProperty(`position`,`fixed`,`important`),t.setProperty(`top`,`0`,`important`),t.setProperty(`left`,`0`,`important`),t.setProperty(`width`,`100%`,`important`),t.setProperty(`height`,`100%`,`important`),t.setProperty(`border`,`none`,`important`),t.setProperty(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},d=({x:e,y:t,width:n,height:r,radius:i})=>{if(!i)return`M${e} ${t}h${n}v${r}h${-n}Z`;let a=Math.min(n,r)/2,[o,s,c,l]=i.map(e=>Math.max(0,Math.min(e,a)));return`M${e+o} ${t}h${n-o-s}a${s} ${s} 0 0 1 ${s} ${s}v${r-s-c}a${c} ${c} 0 0 1 ${-c} ${c}h${-(n-c-l)}a${l} ${l} 0 0 1 ${-l} ${-l}v${-(r-l-o)}a${o} ${o} 0 0 1 ${o} ${-o}Z`},f=()=>c&&l,p=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],m=e=>{let t=e[0];if(!t)return[];let n=p(t)[0],r=[];return e.forEach((t,i)=>{r.push(...p(t)),i>0&&i<e.length-1&&r.push(n)}),r},h=e=>`polygon(nonzero, ${m(e).map(([e,t])=>`${e}px ${t}px`).join(`, `)})`,g=({x:e,y:t,width:n,height:r,radius:i},a)=>{let o=`${t}px ${a.width-e-n}px ${a.height-t-r}px ${e}px`;return i?`inset(${o} round ${i.map(e=>`${e}px`).join(` `)})`:`inset(${o})`},_=(e,t,n)=>{if(t)return`none`;if(e.length===0)return`inset(100%)`;let r=e.length===1?e[0]:void 0;return r?g(r,n):l&&e.length<=5&&!e.some(e=>e.radius)?h(e):`path('${e.map(d).join(``)}')`},v=e=>{if(e.length<2)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},y=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,b=16,x=(e,t,n)=>t===1?e*b:t===2?e*n:e,S=(e,t,n)=>{let r=getComputedStyle(e);return n!==0&&/auto|scroll/.test(r.overflowY)&&e.scrollHeight>e.clientHeight?!0:t!==0&&/auto|scroll/.test(r.overflowX)&&e.scrollWidth>e.clientWidth},C=(e,t,n)=>{for(let r=e;r;r=r.parentElement)if(S(r,t,n))return r;return document.scrollingElement},w=null,T=null,E=e=>{if(!T||!w||!y(T,e.clientX,e.clientY))return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t||t===w)return;let n=x(e.deltaX,e.deltaMode,window.innerWidth),r=x(e.deltaY,e.deltaMode,window.innerHeight),i=C(t,n,r);i&&(i.scrollBy({left:n,top:r,behavior:`instant`}),e.cancelable&&e.preventDefault())},D=e=>{let t=T!==null;T=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,E,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,E,{capture:!0}))},O=(e,{modal:t,rects:n})=>{if(!c){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let r=_(n,t,{width:window.innerWidth,height:window.innerHeight}),i=r===`none`||CSS.supports(`clip-path`,r)?r:`inset(100%)`;e.style.setProperty(`clip-path`,i,`important`),D(t||i!==r?null:v(n))},k=e=>{if(!(!Array.isArray(e)||e.length!==4)&&e.every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0))return e.some(e=>e>0)?e:void 0},A=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o)),d=k(e.radius);return{x:s,y:c,width:l-s,height:u-c,...d?{radius:d}:{}}},j={"not-rendered":`this page is not painting it at all, so it or an ancestor is display:none, or the frame was moved out of the layout`,clipped:`it is clipped away or positioned outside the viewport`,"not-shown":`it is rendered but would not be seen, so either something is drawn over it, or it or an ancestor has opacity below 1, visibility:hidden, or a filter`},M=e=>Array.isArray(e)?e.slice(0,s).flatMap(e=>{if(typeof e!=`object`||!e)return[];let{kind:t,cause:n,level:r}=e;return typeof t!=`string`||t.length>40||typeof n!=`string`||!(n in j)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],N=new Set,P=e=>{for(let{kind:t,cause:n,level:r}of e)N.has(t)||(N.add(t),console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${j[n]}. Nobody using this page can see or answer it.
|
|
2
|
+
@fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, clip-path and z-index on that element. Leave those as they are, then check for an ancestor with opacity, visibility, display or a clipping transform, and for an element stacked above it.`+(r===`liveness`?`
|
|
3
|
+
This browser reports limited detail, so the cause above is a best guess.`:``)))},F=e=>{if(typeof e!=`object`||!e)return null;let t=e,n=(Array.isArray(t.rects)?t.rects.slice(0,o):[]).map(A).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:n,hidden:M(t.hidden)}},I=()=>w!==null,L=e=>{u(e),O(e,{modal:!1,rects:[],hidden:[]}),w=e},R=e=>{if(!w)return;let t=F(e);t&&(O(w,t),P(t.hidden))},z=`https://fkn.app`,B=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,V=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,H=`${z}/api${V?`?coi=1`:``}`,U=`fkn-api-port`,W=`fkn-api-port-ack`,G=2e3,K=()=>{if(!B||typeof window>`u`||window.parent===window)return Promise.resolve(void 0);let e;try{e=window.parent}catch{return Promise.resolve(void 0)}let t=new MessageChannel;return new Promise(n=>{let r=e=>{if(clearTimeout(a),t.port1.removeEventListener(`message`,i),!e)try{t.port1.close()}catch{}n(e)},i=e=>{e.data?.type===W&&r(t.port1)},a=setTimeout(()=>r(void 0),G);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:U},z,[t.port2])}catch{r(void 0)}})},q,J=()=>{if(q||!B)return q;let e=B.querySelector(`iframe[src="${H}"]`);if(e)q=e;else{let e=B.createElement(`iframe`);V&&e.setAttribute(`allow`,`cross-origin-isolated`),e.src=H,B.body.appendChild(e),q=e}return L(q),q},Y=(async()=>{if(!B)return;let e=await K();if(e)return{receive:e,emit:e};let t=J();if(!t)return;await a(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),X=e.t({apiPromise:()=>Q,hasTransport:()=>Z}),Z=typeof window<`u`||typeof self<`u`,Q=(async()=>{if(typeof window<`u`)return Y;if(typeof self<`u`)return{receive:self,emit:self}})().then(e=>e?(0,t.expose)({},{key:`fkn-api`,transport:e}):new Promise(()=>{}));Q.then(e=>{I()&&e.overlay.setHost(R,{exactClips:f()})},()=>{}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Q}});
|
|
@@ -1,31 +1,6 @@
|
|
|
1
|
+
import { a as StorageReadResult, i as StorageQuota, o as WriteData, r as StorageEntry, t as KeyState } from "./storage-CXIXrIxB.js";
|
|
1
2
|
import { A as InstallOptions, D as MountDescriptor, F as PackagesFail, I as PickOptions, L as Placement, M as PackageQuery, N as PackageResult, O as Caller, j as InstalledPackage, k as ConnectOptions } from "./packages-vX-1yfRK.js";
|
|
2
3
|
import { t as AddressLookupResult } from "./lookup-BtwWaCZJ.js";
|
|
3
|
-
//#region src/api/storage.d.ts
|
|
4
|
-
type StorageEntry = {
|
|
5
|
-
path: string;
|
|
6
|
-
size: number;
|
|
7
|
-
contentType: string | null;
|
|
8
|
-
updatedAt: string;
|
|
9
|
-
encryption: string | null;
|
|
10
|
-
};
|
|
11
|
-
type StorageQuota = {
|
|
12
|
-
usedBytes: number;
|
|
13
|
-
limitBytes: number;
|
|
14
|
-
remaining: number;
|
|
15
|
-
objects: number;
|
|
16
|
-
maxObjects: number;
|
|
17
|
-
};
|
|
18
|
-
type WriteData = ArrayBuffer | Uint8Array | string;
|
|
19
|
-
type StorageReadResult = {
|
|
20
|
-
bytes: Uint8Array;
|
|
21
|
-
encryption: string | null;
|
|
22
|
-
appOrigin: string;
|
|
23
|
-
};
|
|
24
|
-
type KeyState = {
|
|
25
|
-
keyEpoch: number | null;
|
|
26
|
-
keyFingerprint: string | null;
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
4
|
//#region src/api/storage-prompt.d.ts
|
|
30
5
|
type AdoptRequest = {
|
|
31
6
|
files: number;
|
|
@@ -1,35 +1,57 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
2
|
import { expose as t } from "osra";
|
|
3
|
-
//#region src/lib/
|
|
4
|
-
var n =
|
|
3
|
+
//#region src/lib/frame-ready.ts
|
|
4
|
+
var n = 1e4, r = 16, i = (e) => {
|
|
5
|
+
let t;
|
|
6
|
+
try {
|
|
7
|
+
t = e.contentWindow;
|
|
8
|
+
} catch {
|
|
9
|
+
return !0;
|
|
10
|
+
}
|
|
11
|
+
if (!t) return !0;
|
|
12
|
+
try {
|
|
13
|
+
let e = t.location.href;
|
|
14
|
+
return e !== "" && e !== "about:blank";
|
|
15
|
+
} catch {
|
|
16
|
+
return !0;
|
|
17
|
+
}
|
|
18
|
+
}, a = (e, t = n) => new Promise((n) => {
|
|
19
|
+
if (i(e)) return n();
|
|
20
|
+
let a = () => {
|
|
21
|
+
clearInterval(o), clearTimeout(s), e.removeEventListener("load", a), n();
|
|
22
|
+
}, o = setInterval(() => {
|
|
23
|
+
i(e) && a();
|
|
24
|
+
}, r), s = setTimeout(a, t);
|
|
25
|
+
e.addEventListener("load", a);
|
|
26
|
+
}), o = 32, s = 8, c = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), l = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), u = (e) => {
|
|
5
27
|
let t = e.style;
|
|
6
28
|
t.setProperty("display", "block", "important"), t.setProperty("position", "fixed", "important"), t.setProperty("top", "0", "important"), t.setProperty("left", "0", "important"), t.setProperty("width", "100%", "important"), t.setProperty("height", "100%", "important"), t.setProperty("border", "none", "important"), t.setProperty("clip-path", "inset(100%)", "important"), t.setProperty("background", "transparent"), t.setProperty("color-scheme", "normal"), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
|
|
7
|
-
},
|
|
29
|
+
}, d = ({ x: e, y: t, width: n, height: r, radius: i }) => {
|
|
8
30
|
if (!i) return `M${e} ${t}h${n}v${r}h${-n}Z`;
|
|
9
31
|
let a = Math.min(n, r) / 2, [o, s, c, l] = i.map((e) => Math.max(0, Math.min(e, a)));
|
|
10
32
|
return `M${e + o} ${t}h${n - o - s}a${s} ${s} 0 0 1 ${s} ${s}v${r - s - c}a${c} ${c} 0 0 1 ${-c} ${c}h${-(n - c - l)}a${l} ${l} 0 0 1 ${-l} ${-l}v${-(r - l - o)}a${o} ${o} 0 0 1 ${o} ${-o}Z`;
|
|
11
|
-
},
|
|
33
|
+
}, f = () => c && l, p = ({ x: e, y: t, width: n, height: r }) => [
|
|
12
34
|
[e, t],
|
|
13
35
|
[e + n, t],
|
|
14
36
|
[e + n, t + r],
|
|
15
37
|
[e, t + r],
|
|
16
38
|
[e, t]
|
|
17
|
-
],
|
|
39
|
+
], m = (e) => {
|
|
18
40
|
let t = e[0];
|
|
19
41
|
if (!t) return [];
|
|
20
|
-
let n =
|
|
42
|
+
let n = p(t)[0], r = [];
|
|
21
43
|
return e.forEach((t, i) => {
|
|
22
|
-
r.push(...
|
|
44
|
+
r.push(...p(t)), i > 0 && i < e.length - 1 && r.push(n);
|
|
23
45
|
}), r;
|
|
24
|
-
},
|
|
46
|
+
}, h = (e) => `polygon(nonzero, ${m(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, g = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
|
|
25
47
|
let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
|
|
26
48
|
return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
|
|
27
|
-
},
|
|
49
|
+
}, _ = (e, t, n) => {
|
|
28
50
|
if (t) return "none";
|
|
29
51
|
if (e.length === 0) return "inset(100%)";
|
|
30
52
|
let r = e.length === 1 ? e[0] : void 0;
|
|
31
|
-
return r ?
|
|
32
|
-
},
|
|
53
|
+
return r ? g(r, n) : l && e.length <= 5 && !e.some((e) => e.radius) ? h(e) : `path('${e.map(d).join("")}')`;
|
|
54
|
+
}, v = (e) => {
|
|
33
55
|
if (e.length < 2) return null;
|
|
34
56
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
|
|
35
57
|
return {
|
|
@@ -38,42 +60,42 @@ var n = 32, r = 8, i = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0
|
|
|
38
60
|
width: Math.max(...e.map((e) => e.x + e.width)) - t,
|
|
39
61
|
height: Math.max(...e.map((e) => e.y + e.height)) - n
|
|
40
62
|
};
|
|
41
|
-
},
|
|
63
|
+
}, y = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, b = 16, x = (e, t, n) => t === 1 ? e * b : t === 2 ? e * n : e, S = (e, t, n) => {
|
|
42
64
|
let r = getComputedStyle(e);
|
|
43
65
|
return n !== 0 && /auto|scroll/.test(r.overflowY) && e.scrollHeight > e.clientHeight ? !0 : t !== 0 && /auto|scroll/.test(r.overflowX) && e.scrollWidth > e.clientWidth;
|
|
44
|
-
},
|
|
45
|
-
for (let r = e; r; r = r.parentElement) if (
|
|
66
|
+
}, C = (e, t, n) => {
|
|
67
|
+
for (let r = e; r; r = r.parentElement) if (S(r, t, n)) return r;
|
|
46
68
|
return document.scrollingElement;
|
|
47
|
-
},
|
|
48
|
-
if (!
|
|
69
|
+
}, w = null, T = null, E = (e) => {
|
|
70
|
+
if (!T || !w || !y(T, e.clientX, e.clientY)) return;
|
|
49
71
|
let t = document.elementFromPoint(e.clientX, e.clientY);
|
|
50
|
-
if (!t || t ===
|
|
51
|
-
let n =
|
|
72
|
+
if (!t || t === w) return;
|
|
73
|
+
let n = x(e.deltaX, e.deltaMode, window.innerWidth), r = x(e.deltaY, e.deltaMode, window.innerHeight), i = C(t, n, r);
|
|
52
74
|
i && (i.scrollBy({
|
|
53
75
|
left: n,
|
|
54
76
|
top: r,
|
|
55
77
|
behavior: "instant"
|
|
56
78
|
}), e.cancelable && e.preventDefault());
|
|
57
|
-
},
|
|
58
|
-
let t =
|
|
59
|
-
|
|
79
|
+
}, D = (e) => {
|
|
80
|
+
let t = T !== null;
|
|
81
|
+
T = e, t !== (e !== null) && (e ? window.addEventListener("wheel", E, {
|
|
60
82
|
capture: !0,
|
|
61
83
|
passive: !1
|
|
62
|
-
}) : window.removeEventListener("wheel",
|
|
63
|
-
},
|
|
64
|
-
if (!
|
|
84
|
+
}) : window.removeEventListener("wheel", E, { capture: !0 }));
|
|
85
|
+
}, O = (e, { modal: t, rects: n }) => {
|
|
86
|
+
if (!c) {
|
|
65
87
|
let r = t || n.length > 0;
|
|
66
88
|
e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
|
|
67
89
|
return;
|
|
68
90
|
}
|
|
69
|
-
let r =
|
|
91
|
+
let r = _(n, t, {
|
|
70
92
|
width: window.innerWidth,
|
|
71
93
|
height: window.innerHeight
|
|
72
|
-
}),
|
|
73
|
-
e.style.setProperty("clip-path",
|
|
74
|
-
},
|
|
94
|
+
}), i = r === "none" || CSS.supports("clip-path", r) ? r : "inset(100%)";
|
|
95
|
+
e.style.setProperty("clip-path", i, "important"), D(t || i !== r ? null : v(n));
|
|
96
|
+
}, k = (e) => {
|
|
75
97
|
if (!(!Array.isArray(e) || e.length !== 4) && e.every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0)) return e.some((e) => e > 0) ? e : void 0;
|
|
76
|
-
},
|
|
98
|
+
}, A = (e) => {
|
|
77
99
|
if (typeof e != "object" || !e) return null;
|
|
78
100
|
let { x: t, y: n, width: r, height: i } = e;
|
|
79
101
|
if (![
|
|
@@ -82,7 +104,7 @@ var n = 32, r = 8, i = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0
|
|
|
82
104
|
r,
|
|
83
105
|
i
|
|
84
106
|
].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
|
|
85
|
-
let a = window.innerWidth, o = window.innerHeight, s = Math.max(0, Math.min(Math.round(t), a)), c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(s, Math.min(Math.round(t + r), a)), u = Math.max(c, Math.min(Math.round(n + i), o)), d =
|
|
107
|
+
let a = window.innerWidth, o = window.innerHeight, s = Math.max(0, Math.min(Math.round(t), a)), c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(s, Math.min(Math.round(t + r), a)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = k(e.radius);
|
|
86
108
|
return {
|
|
87
109
|
x: s,
|
|
88
110
|
y: c,
|
|
@@ -90,41 +112,41 @@ var n = 32, r = 8, i = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0
|
|
|
90
112
|
height: u - c,
|
|
91
113
|
...d ? { radius: d } : {}
|
|
92
114
|
};
|
|
93
|
-
},
|
|
115
|
+
}, j = {
|
|
94
116
|
"not-rendered": "this page is not painting it at all, so it or an ancestor is display:none, or the frame was moved out of the layout",
|
|
95
117
|
clipped: "it is clipped away or positioned outside the viewport",
|
|
96
118
|
"not-shown": "it is rendered but would not be seen, so either something is drawn over it, or it or an ancestor has opacity below 1, visibility:hidden, or a filter"
|
|
97
|
-
},
|
|
119
|
+
}, M = (e) => Array.isArray(e) ? e.slice(0, s).flatMap((e) => {
|
|
98
120
|
if (typeof e != "object" || !e) return [];
|
|
99
121
|
let { kind: t, cause: n, level: r } = e;
|
|
100
|
-
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in
|
|
122
|
+
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in j) || r !== "full" && r !== "liveness" ? [] : [{
|
|
101
123
|
kind: t,
|
|
102
124
|
cause: n,
|
|
103
125
|
level: r
|
|
104
126
|
}];
|
|
105
|
-
}) : [],
|
|
106
|
-
for (let { kind: t, cause: n, level: r } of e)
|
|
127
|
+
}) : [], N = /* @__PURE__ */ new Set(), P = (e) => {
|
|
128
|
+
for (let { kind: t, cause: n, level: r } of e) N.has(t) || (N.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${j[n]}. Nobody using this page can see or answer it.
|
|
107
129
|
@fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, clip-path and z-index on that element. Leave those as they are, then check for an ancestor with opacity, visibility, display or a clipping transform, and for an element stacked above it.` + (r === "liveness" ? "\nThis browser reports limited detail, so the cause above is a best guess." : "")));
|
|
108
|
-
},
|
|
130
|
+
}, F = (e) => {
|
|
109
131
|
if (typeof e != "object" || !e) return null;
|
|
110
|
-
let t = e,
|
|
132
|
+
let t = e, n = (Array.isArray(t.rects) ? t.rects.slice(0, o) : []).map(A).filter((e) => e !== null && e.width > 0 && e.height > 0);
|
|
111
133
|
return {
|
|
112
134
|
modal: t.modal === !0,
|
|
113
|
-
rects:
|
|
114
|
-
hidden:
|
|
135
|
+
rects: n,
|
|
136
|
+
hidden: M(t.hidden)
|
|
115
137
|
};
|
|
116
|
-
},
|
|
117
|
-
|
|
138
|
+
}, I = () => w !== null, L = (e) => {
|
|
139
|
+
u(e), O(e, {
|
|
118
140
|
modal: !1,
|
|
119
141
|
rects: [],
|
|
120
142
|
hidden: []
|
|
121
|
-
}),
|
|
122
|
-
},
|
|
123
|
-
if (!
|
|
124
|
-
let t =
|
|
125
|
-
t && (w
|
|
126
|
-
},
|
|
127
|
-
if (!
|
|
143
|
+
}), w = e;
|
|
144
|
+
}, R = (e) => {
|
|
145
|
+
if (!w) return;
|
|
146
|
+
let t = F(e);
|
|
147
|
+
t && (O(w, t), P(t.hidden));
|
|
148
|
+
}, z = "https://fkn.app", B = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, V = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, H = `${z}/api${V ? "?coi=1" : ""}`, U = "fkn-api-port", W = "fkn-api-port-ack", G = 2e3, K = () => {
|
|
149
|
+
if (!B || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
|
|
128
150
|
let e;
|
|
129
151
|
try {
|
|
130
152
|
e = window.parent;
|
|
@@ -139,41 +161,44 @@ var n = 32, r = 8, i = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0
|
|
|
139
161
|
} catch {}
|
|
140
162
|
n(e);
|
|
141
163
|
}, i = (e) => {
|
|
142
|
-
e.data?.type ===
|
|
143
|
-
}, a = setTimeout(() => r(void 0),
|
|
164
|
+
e.data?.type === W && r(t.port1);
|
|
165
|
+
}, a = setTimeout(() => r(void 0), G);
|
|
144
166
|
t.port1.addEventListener("message", i), t.port1.start();
|
|
145
167
|
try {
|
|
146
|
-
e.postMessage({ type:
|
|
168
|
+
e.postMessage({ type: U }, z, [t.port2]);
|
|
147
169
|
} catch {
|
|
148
170
|
r(void 0);
|
|
149
171
|
}
|
|
150
172
|
});
|
|
151
|
-
},
|
|
152
|
-
if (
|
|
153
|
-
let e =
|
|
154
|
-
if (e)
|
|
173
|
+
}, q, J = () => {
|
|
174
|
+
if (q || !B) return q;
|
|
175
|
+
let e = B.querySelector(`iframe[src="${H}"]`);
|
|
176
|
+
if (e) q = e;
|
|
155
177
|
else {
|
|
156
|
-
let e =
|
|
157
|
-
|
|
178
|
+
let e = B.createElement("iframe");
|
|
179
|
+
V && e.setAttribute("allow", "cross-origin-isolated"), e.src = H, B.body.appendChild(e), q = e;
|
|
158
180
|
}
|
|
159
|
-
return
|
|
160
|
-
},
|
|
161
|
-
if (!
|
|
162
|
-
let e = await
|
|
181
|
+
return L(q), q;
|
|
182
|
+
}, Y = (async () => {
|
|
183
|
+
if (!B) return;
|
|
184
|
+
let e = await K();
|
|
163
185
|
if (e) return {
|
|
164
186
|
receive: e,
|
|
165
187
|
emit: e
|
|
166
188
|
};
|
|
167
|
-
let t =
|
|
168
|
-
|
|
189
|
+
let t = J();
|
|
190
|
+
if (!t) return;
|
|
191
|
+
await a(t);
|
|
192
|
+
let n = t.contentWindow;
|
|
193
|
+
return n ? {
|
|
169
194
|
receive: window,
|
|
170
|
-
emit:
|
|
195
|
+
emit: n
|
|
171
196
|
} : void 0;
|
|
172
|
-
})(),
|
|
173
|
-
apiPromise: () =>
|
|
174
|
-
hasTransport: () =>
|
|
175
|
-
}),
|
|
176
|
-
if (typeof window < "u") return
|
|
197
|
+
})(), X = /* @__PURE__ */ e({
|
|
198
|
+
apiPromise: () => Q,
|
|
199
|
+
hasTransport: () => Z
|
|
200
|
+
}), Z = typeof window < "u" || typeof self < "u", Q = (async () => {
|
|
201
|
+
if (typeof window < "u") return Y;
|
|
177
202
|
if (typeof self < "u") return {
|
|
178
203
|
receive: self,
|
|
179
204
|
emit: self
|
|
@@ -182,8 +207,8 @@ var n = 32, r = 8, i = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0
|
|
|
182
207
|
key: "fkn-api",
|
|
183
208
|
transport: e
|
|
184
209
|
}) : new Promise(() => {}));
|
|
185
|
-
|
|
186
|
-
|
|
210
|
+
Q.then((e) => {
|
|
211
|
+
I() && e.overlay.setHost(R, { exactClips: f() });
|
|
187
212
|
}, () => {});
|
|
188
213
|
//#endregion
|
|
189
|
-
export {
|
|
214
|
+
export { Y as i, X as n, Z as r, Q as t };
|
package/cloud/dgram.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram-CW53Betg.cjs");exports.Socket=e.t,exports.createSocket=e.n,exports.default=e.r;
|
package/cloud/dgram.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../dgram-
|
|
1
|
+
import { n as e, r as t, t as n } from "../dgram-qpKjZosS.js";
|
|
2
2
|
export { n as Socket, e as createSocket, t as default };
|
package/cloud/fetch.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-B0W1qzCo.cjs");exports.fetch=e.t;
|
package/cloud/fetch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as cloudFetch } from "../proxy-
|
|
1
|
+
import { t as cloudFetch } from "../proxy-etZJARWe.js";
|
|
2
2
|
export { cloudFetch as fetch };
|
package/cloud/fetch.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../proxy-
|
|
1
|
+
import { t as e } from "../proxy-CtS_JiZL.js";
|
|
2
2
|
export { e as fetch };
|
package/cloud/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-BMR2yCEt.cjs"),n=require("../storage-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-BMR2yCEt.cjs"),n=require("../storage-D2a8SsY5.cjs");var r=e.t({STORAGE_NOT_FOUND:()=>n.p,StorageLockedError:()=>n.t,StorageNotFoundError:()=>n.n,available:()=>i,encryption:()=>n.i,isNotFound:()=>n.a,mkdir:()=>u,promises:()=>p,quota:()=>n.s,readFile:()=>a,readdir:()=>l,rename:()=>c,rm:()=>d,stat:()=>f,unlink:()=>s,unlock:()=>n.d,writeFile:()=>o}),{available:i,readFile:a,writeFile:o,unlink:s,rename:c,readdir:l,mkdir:u,rm:d,stat:f,promises:p}=t.t(n.u,{memfs:!1});exports.STORAGE_NOT_FOUND=n.p,exports.StorageLockedError=n.t,exports.StorageNotFoundError=n.n,exports.available=i,exports.encryption=n.i,exports.isNotFound=n.a,exports.mkdir=u,exports.promises=p,exports.quota=n.s,exports.readFile=a,exports.readdir=l,exports.rename=c,exports.rm=d,exports.stat=f,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}}),exports.unlink=s,exports.unlock=n.d,exports.writeFile=o;
|
package/cloud/fs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as STORAGE_NOT_FOUND } from "../storage-CXIXrIxB.js";
|
|
1
2
|
import { a as Stats } from "../index-CJ0vHTcS.js";
|
|
2
|
-
import { _ as
|
|
3
|
-
export { type EncryptionStatus, type FileEntry, type Stats, StorageLockedError, type StorageQuota, available, encryption, mkdir, promises, quota, readFile, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
|
3
|
+
import { _ as encryption, a as readFile, b as unlock, c as rm, d as writeFile, f as EncryptionStatus, g as StorageQuota, h as StorageNotFoundError, i as promises, l as stat, m as StorageLockedError, o as readdir, p as FileEntry, r as mkdir, s as rename, t as available, u as unlink, v as isNotFound, y as quota } from "../fs-D5LFP4_n.js";
|
|
4
|
+
export { type EncryptionStatus, type FileEntry, STORAGE_NOT_FOUND, type Stats, StorageLockedError, StorageNotFoundError, type StorageQuota, available, encryption, isNotFound, mkdir, promises, quota, readFile, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
package/cloud/fs.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { t as e } from "../rolldown-runtime-Dy4uBu1J.js";
|
|
2
2
|
import { t } from "../node-fs-DKfokOlh.js";
|
|
3
|
-
import { a as n,
|
|
3
|
+
import { a as n, d as r, i, n as a, p as o, s, t as c, u as l } from "../storage-XKGhInxm.js";
|
|
4
4
|
//#region src/lib/cloud/fs.ts
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
var u = /* @__PURE__ */ e({
|
|
6
|
+
STORAGE_NOT_FOUND: () => o,
|
|
7
|
+
StorageLockedError: () => c,
|
|
8
|
+
StorageNotFoundError: () => a,
|
|
9
|
+
available: () => d,
|
|
10
|
+
encryption: () => i,
|
|
11
|
+
isNotFound: () => n,
|
|
12
|
+
mkdir: () => _,
|
|
13
|
+
promises: () => b,
|
|
14
|
+
quota: () => s,
|
|
15
|
+
readFile: () => f,
|
|
16
|
+
readdir: () => g,
|
|
17
|
+
rename: () => h,
|
|
18
|
+
rm: () => v,
|
|
19
|
+
stat: () => y,
|
|
20
|
+
unlink: () => m,
|
|
21
|
+
unlock: () => r,
|
|
22
|
+
writeFile: () => p
|
|
23
|
+
}), { available: d, readFile: f, writeFile: p, unlink: m, rename: h, readdir: g, mkdir: _, rm: v, stat: y, promises: b } = t(l, { memfs: !1 });
|
|
21
24
|
//#endregion
|
|
22
|
-
export { o as
|
|
25
|
+
export { o as STORAGE_NOT_FOUND, c as StorageLockedError, a as StorageNotFoundError, d as available, i as encryption, n as isNotFound, _ as mkdir, b as promises, s as quota, f as readFile, g as readdir, h as rename, v as rm, y as stat, u as t, m as unlink, r as unlock, p as writeFile };
|
package/cloud/net.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils-QfNXtEhb.cjs"),t=require("../net-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils-QfNXtEhb.cjs"),t=require("../net-luhw3yr7.cjs");exports.Server=t.t,exports.Socket=t.n,exports._default=t.r,exports.default=t.r,exports.connect=t.i,exports.createConnection=t.a,exports.createServer=t.o,exports.isIP=e.r,exports.isIPv4=e.i,exports.isIPv6=e.a;
|
package/cloud/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-BtdN07IP.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/cloud/net.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as e, i as t, r as n } from "../utils-DVlbuXmW.js";
|
|
2
|
-
import { a as r, i, n as a, o, r as s, t as c } from "../net-
|
|
2
|
+
import { a as r, i, n as a, o, r as s, t as c } from "../net-B-LNnKps.js";
|
|
3
3
|
export { c as Server, a as Socket, s as _default, s as default, i as connect, r as createConnection, o as createServer, n as isIP, t as isIPv4, e as isIPv6 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-ulyxIbTr.cjs"),n=require("./api-
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-ulyxIbTr.cjs"),n=require("./api-DLGGoSnx.cjs"),r=require("./proxy-B0W1qzCo.cjs"),i=require("./dns.cjs"),a=require("./cloud/fs.cjs"),o=require("./net-luhw3yr7.cjs"),s=require("./dgram-CW53Betg.cjs"),c=require("./http.cjs");let l=require("osra");var u=e=>e,d=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,f=2e4,p=65e3,m=3e4,h=5e3,g=new Set,_=()=>`https://fkn.app`,v=e=>!e||e===`about:blank`,y=e=>e?``:`incognito-${crypto.randomUUID()}`,b=({target:e,session:t})=>{let n=new URL(`/attach-frame`,_());return e&&n.searchParams.set(`url`,e),t&&n.searchParams.set(`session`,t),n.href},x=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},S=(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())},C=()=>Object.assign(Error(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),{name:t.h}),w=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},T=[300,1200,4e3],E=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 T)setTimeout(t,e)},D=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`)},O=async({iframe:e,domains:n=[],syncCookies:r=!0,lockdown:i=!1})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(i)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`);D(e);let a=e.getAttribute(`src`)??``,o=(()=>{if(v(a))return null;try{return new URL(e.src||a,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${a}`)}})();if(o){let e=new URL(`/attach-frame`,_());if(o.origin===e.origin&&o.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 s=o?.href??``;s&&t.s(s);let c=s,T=y(r),O=new AbortController,k=e.referrerPolicy,A=e.allow;if(e.referrerPolicy=`origin`,e.allow=w(d,e.allow),e.src=b({target:s,session:T}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let n=await x((0,l.expose)({},{key:`fkn-attach-frame`,origin:_(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:O.signal,revivableModules:u(t.L)}),f,`cloud.attachFrame: timed out connecting to the render proxy page`);await x(n.ready(),p,`cloud.attachFrame: the render proxy never became ready`),s&&E(e),S(e,()=>O.abort());let r=e.contentWindow,i=()=>{if(!(!O.signal.aborted&&e.isConnected&&e.contentWindow===r))throw O.abort(),C()};return t.a({executor:{execute:(e,r,a)=>g.has(r)?Promise.reject(t.f(r,`cloud`)):(i(),n.executeLocator(e,r,a)),highlight:async()=>{}},goto:async(t,r={})=>{let a=new URL(t,location.href).href;i();let{timeoutMs:o}=r;await x(n.goto(a,r),(o??m)+h,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`),c=a,E(e)},url:()=>c})}catch(t){throw O.abort(),e.referrerPolicy=k,e.allow=A,e.src=s||`about:blank`,t}},k=()=>typeof window<`u`&&!0,A=async()=>{let e=await n.t.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}},j=e.t({attachFrame:()=>O,available:()=>M,dgram:()=>s.i,dns:()=>i.t,fetch:()=>r.t,fs:()=>a.t,http:()=>c.t,net:()=>o.s,quota:()=>A}),M=()=>n.r;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return M}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-etZJARWe.js";
|
|
2
2
|
import { d as Frame, u as AttachFrameOptions } from "./index-DLaonjpx.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
|
-
import { n as fs_d_exports } from "./fs-
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
4
|
+
import { n as fs_d_exports } from "./fs-D5LFP4_n.js";
|
|
5
|
+
import { s as net_d_exports } from "./net-BtdN07IP.js";
|
|
6
6
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
7
|
import { t as http_d_exports } from "./http.js";
|
|
8
8
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
2
|
import { L as t, a as n, f as r, h as i, s as a } from "./lib-CegQxwDI.js";
|
|
3
|
-
import { r as o, t as s } from "./api-
|
|
4
|
-
import { t as c } from "./proxy-
|
|
3
|
+
import { r as o, t as s } from "./api-X8SBbrBZ.js";
|
|
4
|
+
import { t as c } from "./proxy-CtS_JiZL.js";
|
|
5
5
|
import { t as l } from "./dns.js";
|
|
6
6
|
import { t as u } from "./cloud/fs.js";
|
|
7
|
-
import { s as d } from "./net-
|
|
8
|
-
import { i as f } from "./dgram-
|
|
7
|
+
import { s as d } from "./net-B-LNnKps.js";
|
|
8
|
+
import { i as f } from "./dgram-qpKjZosS.js";
|
|
9
9
|
import { t as p } from "./http.js";
|
|
10
10
|
import { expose as m } from "osra";
|
|
11
11
|
//#region src/lib/cloud/frame.ts
|
package/cloud.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-B0W1qzCo.cjs"),t=require("./cloud-CcKsidlt.cjs"),n=require("./dns.cjs"),r=require("./cloud/fs.cjs"),i=require("./net-luhw3yr7.cjs"),a=require("./dgram-CW53Betg.cjs"),o=require("./http.cjs");exports.attachFrame=t.i,exports.available=t.t,Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.i}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return n.t}}),exports.fetch=e.t,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return r.t}}),Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.s}}),exports.quota=t.r;
|
package/cloud.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
-
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud
|
|
1
|
+
import { t as cloudFetch } from "./proxy-etZJARWe.js";
|
|
2
|
+
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-CvEqxYM6.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
|
-
import { n as fs_d_exports } from "./fs-
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
4
|
+
import { n as fs_d_exports } from "./fs-D5LFP4_n.js";
|
|
5
|
+
import { s as net_d_exports } from "./net-BtdN07IP.js";
|
|
6
6
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
7
|
import { t as http_d_exports } from "./http.js";
|
|
8
8
|
export { type QuotaStatus, attachFrame, available, dgram_d_exports as dgram, dns_d_exports as dns, cloudFetch as fetch, fs_d_exports as fs, http_d_exports as http, net_d_exports as net, quota };
|
package/cloud.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./proxy-
|
|
2
|
-
import { i as t, r as n, t as r } from "./cloud-
|
|
1
|
+
import { t as e } from "./proxy-CtS_JiZL.js";
|
|
2
|
+
import { i as t, r as n, t as r } from "./cloud-DohLHbg2.js";
|
|
3
3
|
import { t as i } from "./dns.js";
|
|
4
4
|
import { t as a } from "./cloud/fs.js";
|
|
5
|
-
import { s as o } from "./net-
|
|
6
|
-
import { i as s } from "./dgram-
|
|
5
|
+
import { s as o } from "./net-B-LNnKps.js";
|
|
6
|
+
import { i as s } from "./dgram-qpKjZosS.js";
|
|
7
7
|
import { t as c } from "./http.js";
|
|
8
8
|
export { t as attachFrame, r as available, s as dgram, i as dns, e as fetch, a as fs, c as http, o as net, n as quota };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DLGGoSnx.cjs"),n=require("./utils-QfNXtEhb.cjs");let r=require("buffer"),i=require("events"),a=require("ip-address");var o=e.t({Socket:()=>s,createSocket:()=>p,default:()=>m}),s=class extends i.EventEmitter{_type;_localAddress;_remoteAddress;_connectedLocally;_connectGeneration=0;_destroyed=!1;_webVPNUdpSocketPromise;_dataPort;_socketId;_sendQueue=[];_sendQueueBytes=0;_sendFlushScheduled=!1;_peerTailCache=new Map;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type,e.connection&&this.__webvpn_udp_socket_init__(e.connection)}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}_dataPortAcks=!1;_dataPortConsumedBytes=0;_dataPortAckedBytes=0;_ackDataPortBatch(e){if(!this._dataPortAcks||!this._dataPort||(this._dataPortConsumedBytes+=e,this._dataPortAckedBytes!==0&&this._dataPortConsumedBytes-this._dataPortAckedBytes<524288))return;this._dataPortAckedBytes=this._dataPortConsumedBytes;let t={type:n.n,consumedBytes:this._dataPortConsumedBytes};this._dataPort.postMessage(t)}_onTransportClosed(e){this._destroyed||(this._destroyed=!0,this._dataPort?.close(),this._dataPort=void 0,this.listenerCount(`error`)>0&&this.emit(`error`,Error(e||`WebVPN session closed`)),this.emit(`close`))}_onDataPortBatch(e){let t=new DataView(e),n=!1,i,a=0;for(;a+4<=e.byteLength;){let o=t.getUint32(a);a+=4;let s=a+o;if(s>e.byteLength)break;let c=a+4,l=t.getUint8(c);c+=1;let u,f,p;if(l===2){if(!this._remoteAddress){a=s;continue}u=this._remoteAddress.address,f=this._remoteAddress.family,p=this._remoteAddress.port}else{let n=new Uint8Array(e,c,l===0?4:16);l===0?(f=`IPv4`,u=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`):(f=`IPv6`,u=d(n)),c+=n.byteLength,p=t.getUint16(c),c+=2}let m=t.getUint32(c);c+=4;try{this.emit(`message`,r.Buffer.from(e.slice(c,c+m)),{address:u,family:f,port:p,size:m})}catch(e){n||(n=!0,i=e)}a=s}if(n)throw i}_peerTail(e,t){if(e===void 0||t===void 0)return c;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=a.Address4.isValid(e)?u(e):f(e),o=new Uint8Array(1+i.byteLength+2);return o[0]=i.byteLength===4?0:1,o.set(i,1),new DataView(o.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.size>=4096&&this._peerTailCache.clear(),this._peerTailCache.set(n,o),o}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(a.Address4.isValid(e)){let n=u(e),r=t&&a.Address4.isValid(t)?u(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(a.Address6.isValid(e)){let t=f(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let r=n.o(...e),i=this._type===`udp6`?`::`:`0.0.0.0`,a=this.__webvpn_udp_socket_init__(t.t.then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:r.address??i,port:r.port,dataPort:!0})));return r.callback&&a.then(e=>{e&&r.callback.call(this)}),this}__webvpn_udp_socket_init__(e,t){return t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort}),this._webVPNUdpSocketPromise=e.then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPortAcks=e.dataPortAcks===!0,this._dataPort.onmessage=e=>{try{this._onDataPortBatch(e.data)}finally{this._ackDataPortBatch(e.data.byteLength)}};else{let t=e.dataReadableStream.getReader();(async()=>{for(;;){let{value:e,done:n}=await t.read();if(n)return;this.emit(`message`,r.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size})}})().catch(e=>this._onTransportClosed(e instanceof Error?e.message:void 0))}return e.closed?.then(e=>this._onTransportClosed(e?.reason)).catch(()=>{}),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{e&&this.emit(`listening`)}),this._webVPNUdpSocketPromise}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=this._destroyed;this._destroyed=!0,this._dataPort?.close(),this._dataPort=void 0;try{await t.close()}finally{try{e&&e()}finally{n||this.emit(`close`)}}}).catch(()=>{}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0,o=await t.connect({remotePort:n,remoteAddress:i});this._connectedLocally=o?.local===!0,this._remoteAddress=o?.address?{address:o.address,family:o.family,port:o.port}:{address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},this._connectGeneration+=1,a&&a()}).catch(e=>{this.emit(`error`,e)})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);let e=this._remoteAddress,t=this._connectedLocally,n=this._connectGeneration;this._remoteAddress=void 0,this._connectedLocally=void 0,this._webVPNUdpSocketPromise.then(e=>e?.disconnect?.()).catch(r=>{this._connectGeneration===n&&(this._remoteAddress=e,this._connectedLocally=t),this.emit(`error`,r)})}dropMembership(e,t){if(a.Address4.isValid(e)){let n=u(e),r=t&&a.Address4.isValid(t)?u(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(a.Address6.isValid(e)){let t=f(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=n.s(...e),r=l(t.message),i=r;if(t.hasRange){let{offset:e,length:n}=t;if(!Number.isInteger(e)||e<0||e>r.byteLength)throw Object.assign(RangeError(`"offset" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});if(!Number.isInteger(n)||n<0||n>r.byteLength-e)throw Object.assign(RangeError(`"length" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});i=r.subarray(e,e+n)}let o=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let n=t.callback,r=t.address??o,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||a.Address4.isValid(r)||a.Address6.isValid(r))){this._portSend(i,s?void 0:r,s?void 0:t.port),n?.call(this,null,i.byteLength);return}e.send({port:t.port,address:r,message:i.byteOffset===0&&i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}).then(()=>n?.call(this,null,i.byteLength),e=>n?n.call(this,e,0):this.emit(`error`,e))})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},c=new Uint8Array([2]),l=e=>{if(typeof e==`string`)return n.l.encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e)){let t=e.map(l),n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}return new Uint8Array(e)},u=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},d=e=>{let t=[];for(let n=0;n<16;n+=2)t.push(e[n]<<8|e[n+1]);let n=-1,r=1;for(let e=0;e<8;){if(t[e]!==0){e++;continue}let i=e;for(;i<8&&t[i]===0;)i++;i-e>r&&(n=e,r=i-e),e=i}return n===-1?t.map(e=>e.toString(16)).join(`:`):`${t.slice(0,n).map(e=>e.toString(16)).join(`:`)}::${t.slice(n+r).map(e=>e.toString(16)).join(`:`)}`},f=e=>{let t=new a.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},p=(e,t)=>{let n=new s(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},m={Socket:s,createSocket:p};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|