@fkn/lib 0.9.41 → 0.9.42
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-generation-CSnZiN18.cjs → account-generation-B-6Pn0b5.cjs} +1 -1
- package/{account-generation-D7TpIoKt.js → account-generation-XNWOvLea.js} +5 -5
- package/account.cjs +1 -1
- package/account.js +6 -6
- package/api--LOXTOpv.cjs +3 -0
- package/{api-Dp-2AT3u.js → api-DIgTslNb.js} +154 -114
- package/{api-Cbty0JUM.d.ts → api-SwxtiYVU.d.ts} +24 -2
- package/api.cjs +1 -1
- package/api.d.ts +3 -3
- package/api.js +2 -2
- package/attach-policy.cjs +1 -1
- package/attach-policy.js +2 -2
- package/cloud/dns.d.ts +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.js +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud-868OlBKn.cjs +1 -0
- package/{cloud-4t1WoEZn.d.ts → cloud-DUH-v10C.d.ts} +5 -3
- package/cloud-f3j4s8yZ.js +545 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +2 -2
- package/{contract-BRc2ptdC.d.ts → contract-CCxPKIC7.d.ts} +77 -7
- package/contract.d.ts +3 -2
- package/dgram.cjs +1 -1
- package/dgram.d.ts +2 -2
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -1
- package/dns.js +1 -1
- package/extension-BOBuYwZc.js +92 -0
- package/extension-hoUs5yJ7.cjs +1 -0
- package/{extension-DMU-CwMw.d.ts → extension-yhwDSIiD.d.ts} +22 -3
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-q7Kg51hq.js → fs-CVnmXRf7.js} +1 -1
- package/{fs-BTyRnUPI.cjs → fs-p0bOOj5n.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.js +2 -2
- package/{hosts-9dYv63ud.cjs → hosts-GNBhZO3-.cjs} +1 -1
- package/{hosts-BzbzOhG8.js → hosts-t7CKGTRz.js} +4 -1
- package/http.d.ts +1 -1
- package/{index-D2CA-NX5.d.ts → index-BtFiGoVQ.d.ts} +465 -51
- package/index.cjs +1 -1
- package/index.d.ts +16 -16
- package/index.js +62 -59
- package/lib-CfdmsLoI.cjs +53 -0
- package/{lib-C4Eeg9eM.js → lib-DppqX10G.js} +470 -302
- package/{net-CcEZP6Bb.d.ts → net-DcLF-6E-.d.ts} +2 -2
- 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.d.ts +1 -1
- package/packages.js +14 -14
- package/{proxy-D6YtsO1g.d.ts → proxy-CE46SkyA.d.ts} +2 -2
- package/{proxy-DjoPtJH9.cjs → proxy-CFK-KiwE.cjs} +1 -1
- package/{proxy-DMTdQ4dN.js → proxy-Dixbk1WL.js} +1 -1
- package/rooms.cjs +1 -1
- package/rooms.d.ts +1 -1
- package/rooms.js +11 -11
- package/{storage-BS5WMO4f.cjs → storage-D2cUJlVH.cjs} +1 -1
- package/{storage-BWmGrO6a.js → storage-Dn1gTLSZ.js} +2 -2
- package/api-jOTOA-5n.cjs +0 -3
- package/cloud-BLv19j-W.js +0 -480
- package/cloud-D7aQY4GH.cjs +0 -1
- package/extension-B9v933cT.js +0 -89
- package/extension-D2zMdc2f.cjs +0 -1
- package/lib-BfAg9mHD.cjs +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./api
|
|
1
|
+
const e=require("./api--LOXTOpv.cjs");var t=0,n=new Set,r=2e3,i=null,a=e=>{e?.switched!==!1&&(t+=1,i&&=(clearTimeout(i.timer),null));for(let e of[...n])try{e()}catch{}},o=!1,s=0,c=()=>{let t=e.c();t&&s!==t.epoch&&(s=t.epoch,Promise.resolve(t.remote.account.onChange(a)).catch(()=>{s===t.epoch&&(s=0)}))},l=()=>{!o&&e.l&&(o=!0,e.u(c))},u=()=>t,d=e=>(n.add(e),l(),()=>{n.delete(e)}),f=e=>{if(e!==t||i?.generation===e)return;let n=setTimeout(()=>{i?.timer===n&&(i=null,t===e&&a({switched:!0}))},r);i={generation:e,timer:n}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t,
|
|
1
|
+
import { c as e, l as t, u as n } from "./api-DIgTslNb.js";
|
|
2
2
|
//#region src/account-generation.ts
|
|
3
3
|
var r = 0, i = /* @__PURE__ */ new Set(), a = 2e3, o = null, s = (e) => {
|
|
4
4
|
e?.switched !== !1 && (r += 1, o &&= (clearTimeout(o.timer), null));
|
|
@@ -6,12 +6,12 @@ var r = 0, i = /* @__PURE__ */ new Set(), a = 2e3, o = null, s = (e) => {
|
|
|
6
6
|
e();
|
|
7
7
|
} catch {}
|
|
8
8
|
}, c = !1, l = 0, u = () => {
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
l ===
|
|
9
|
+
let t = e();
|
|
10
|
+
t && l !== t.epoch && (l = t.epoch, Promise.resolve(t.remote.account.onChange(s)).catch(() => {
|
|
11
|
+
l === t.epoch && (l = 0);
|
|
12
12
|
}));
|
|
13
13
|
}, d = () => {
|
|
14
|
-
!c &&
|
|
14
|
+
!c && t && (c = !0, n(u));
|
|
15
15
|
}, f = () => r, p = (e) => (i.add(e), d(), () => {
|
|
16
16
|
i.delete(e);
|
|
17
17
|
}), m = (e) => {
|
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--LOXTOpv.cjs"),n=require("./account-generation-B-6Pn0b5.cjs");var r=e.t({info:()=>o,login:()=>i,logout:()=>a,onChange:()=>s}),i=async()=>typeof window>`u`?!1:(await t.o).account.login(location.origin).catch(()=>!1),a=async()=>{typeof window<`u`&&await(await t.o).account.logout().catch(()=>{})},o=async()=>{if(typeof window>`u`)return null;let e=await t.o.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},s=async e=>t.l?n.i(e):()=>{};exports.info=o,exports.login=i,exports.logout=a,exports.onChange=s,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/account.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import {
|
|
3
|
-
import { i as r } from "./account-generation-
|
|
2
|
+
import { l as t, o as n } from "./api-DIgTslNb.js";
|
|
3
|
+
import { i as r } from "./account-generation-XNWOvLea.js";
|
|
4
4
|
//#region src/account.ts
|
|
5
5
|
var i = /* @__PURE__ */ e({
|
|
6
6
|
info: () => s,
|
|
7
7
|
login: () => a,
|
|
8
8
|
logout: () => o,
|
|
9
9
|
onChange: () => c
|
|
10
|
-
}), a = async () => typeof window > "u" ? !1 : (await
|
|
11
|
-
typeof window < "u" && await (await
|
|
10
|
+
}), a = async () => typeof window > "u" ? !1 : (await n).account.login(location.origin).catch(() => !1), o = async () => {
|
|
11
|
+
typeof window < "u" && await (await n).account.logout().catch(() => {});
|
|
12
12
|
}, s = async () => {
|
|
13
13
|
if (typeof window > "u") return null;
|
|
14
|
-
let e = await
|
|
14
|
+
let e = await n.then((e) => e.account.info()).catch(() => null);
|
|
15
15
|
return e ? {
|
|
16
16
|
name: e.name,
|
|
17
17
|
image: e.image,
|
|
18
18
|
premium: e.premium,
|
|
19
19
|
premiumUntil: e.premiumUntil ? Date.parse(e.premiumUntil) : null
|
|
20
20
|
} : null;
|
|
21
|
-
}, c = async (e) =>
|
|
21
|
+
}, c = async (e) => t ? r(e) : () => {};
|
|
22
22
|
//#endregion
|
|
23
23
|
export { s as info, a as login, o as logout, c as onChange, i as t };
|
package/api--LOXTOpv.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
let e=require("osra");var t=1e4,n=16,r=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}},i=(e,i=t)=>new Promise(t=>{if(r(e))return t();let a=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,a),t()},o=setInterval(()=>{r(e)&&a()},n),s=setTimeout(a,i);e.addEventListener(`load`,a)}),a=32,o=8,s=120,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(`padding`,`0`,`important`),t.setProperty(`box-sizing`,`border-box`,`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(``)}')`},ee=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}},te=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,ne=16,v=(e,t,n)=>t===1?e*ne:t===2?e*n:e,re=(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},ie=(e,t,n)=>{for(let r=e;r;r=r.parentElement)if(re(r,t,n))return r;return document.scrollingElement},y=null,b=null,x=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),S=e=>{if(!b||!y||!te(b,e.clientX,e.clientY))return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t||t===y)return;let n=v(e.deltaX,e.deltaMode,window.innerWidth),r=v(e.deltaY,e.deltaMode,window.innerHeight),i=ie(t,n,r);i&&(i.scrollBy({left:n,top:r,behavior:`instant`}),e.cancelable&&e.preventDefault())},ae=e=>{let t=b!==null;b=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,S,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,S,{capture:!0}))},C=0,w=e=>{if(e===C)return;C=e;let t=document.documentElement.style;e>0?(t.setProperty(`margin-top`,`${e}px`,`important`),t.setProperty(`--fkn-inset-top`,`${e}px`)):(t.removeProperty(`margin-top`),t.removeProperty(`--fkn-inset-top`))},T=(e,{modal:t,rects:n,inset:r},i)=>{if(w(r),!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 a=_(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),ae(t||o!==a?null:ee(n))},oe=e=>{if(typeof e!=`object`||!e)return 0;let{top:t}=e;return typeof t!=`number`||!Number.isFinite(t)||t<=0?0:Math.min(Math.round(t),s)},se=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},ce=(e,t)=>{if(typeof e!=`object`||!e)return null;let{x:n,y:r,width:i,height:a}=e;if(![n,r,i,a].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let o=t.width,s=t.height,c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(0,Math.min(Math.round(r),s)),u=Math.max(c,Math.min(Math.round(n+i),o)),d=Math.max(l,Math.min(Math.round(r+a),s)),f=se(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},E={"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`},D=e=>Array.isArray(e)?e.slice(0,o).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 E)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],O=new Set,le=e=>{for(let{kind:t,cause:n,level:r}of e)O.has(t)||(O.add(t),console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${E[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, padding, box-sizing, 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.`:``)))},k=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,a):[]).map(e=>ce(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:D(n.hidden),inset:oe(n.inset)}},ue=()=>y!==null,A=null,j=null,de=()=>{if(!y||A===null)return;let e=x(y),t=k(A,e);t&&T(y,t,e)},fe=e=>{typeof ResizeObserver<`u`&&(j??=new ResizeObserver(de),j.disconnect(),j.observe(e))},pe=e=>{u(e),T(e,{modal:!1,rects:[],hidden:[],inset:0},x(e)),y=e,fe(e)},me=e=>{if(!y)return;let t=x(y),n=k(e,t);n&&(A=e,T(y,n,t),le(n.hidden))},he=[`fkn.app`,`fkn.dev`,`sdbx.app`],ge=e=>e.replace(/\.+$/,``),_e=e=>{let t=ge(e);return he.some(e=>t===e||t.endsWith(`.${e}`))},M=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:e.url,n;try{n=new URL(t)}catch{return}if(_e(n.hostname))throw Error(`fetch refuses FKN platform domains (${n.hostname})`)},N=`autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network`.split(`.`),P=()=>{try{let e=globalThis.document?.featurePolicy?.features?.();return e===void 0?void 0:new Set(e)}catch{return}},F=(e=!0,t=P())=>[...N,...e?[`cross-origin-isolated`]:[]].filter(e=>t===void 0||t.has(e)).join(`; `),I=`https://fkn.app`,L=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,R=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,z=`${I}/api${R?`?coi=1`:``}`,ve=`fkn-api-port`,ye=`fkn-api-port-ack`,be=2e3,xe=()=>{if(!L||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===ye&&r(t.port1)},a=setTimeout(()=>r(void 0),be);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:ve},I,[t.port2])}catch{r(void 0)}})},B,Se=()=>{if(B||!L)return B;let e=L.querySelector(`iframe[src="${z}"]`);if(e)B=e;else{let e=L.createElement(`iframe`);e.setAttribute(`allow`,F(R)),e.src=z,L.body.appendChild(e),B=e}return pe(B),B},V=(async()=>{if(!L)return;let e=await xe();if(e)return{receive:e,emit:e};let t=Se();if(!t)return;await i(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),Ce=(e,{boundRetired:t=e=>e}={})=>{let n,r=0,i=!1,a=()=>{},o=()=>new Promise(e=>{a=e}),s=o(),c=s,l=new Set,u=new Set,d=0,f=0,p=()=>{let e=[...u];u.clear();let t=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let n of e)try{n(t)}catch{}};(async()=>{for await(let t of e){let e=++r;n={remote:t,epoch:e};let i=a;s=o(),i(t),p();for(let n of[...l])try{n(t,e)}catch{}}})().catch(()=>{});let m=async(e,r)=>{let a=n?.remote??await(i?t(s):s);for(let t of e.slice(0,-1))a=a[t];let o=a[e[e.length-1]??``];d=Date.now(),f+=1;let c=()=>{},l=new Promise((e,t)=>{c=t});u.add(c);try{return await Promise.race([Promise.resolve(o.apply(a,r)),l])}finally{--f,u.delete(c),d=Date.now()}},h=new Map,g=e=>{let t=e.join(`\0`),r=h.get(t);if(r)return r;let i=new Proxy(function(){},{get:(t,r)=>{if(typeof r!=`string`||r===`then`)return;let i=n;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return g([...e,r])},apply:(t,n,r)=>m(e,r)});return h.set(t,i),i};return{facade:g([]),first:c.then(()=>{}),current:()=>n,onEpoch:e=>{if(l.add(e),n)try{e(n.remote,n.epoch)}catch{}return()=>{l.delete(e)}},lastCall:()=>d,inFlight:()=>f,routable:()=>n?Promise.resolve():s.then(()=>{}),retire:()=>{i=!0,n=void 0,p()}}},H=!1,U=new Set,W=()=>H,we=()=>{if(!H){H=!0;for(let e of[...U])try{e()}catch{}U.clear()}},G=e=>{H?e():U.add(e)},Te=typeof window<`u`||typeof self<`u`,Ee=async()=>{if(typeof window<`u`)return V;if(typeof self<`u`)return{receive:self,emit:self}},De=`fkn-api`,Oe=`fkn-api-window`,K=Ce({async*[Symbol.asyncIterator](){let t=await Ee();if(!t){await new Promise(()=>{});return}if(!W()){let n=new AbortController;G(()=>n.abort());for await(let r of(0,e.expose)({},{key:De,transport:t,unregisterSignal:n.signal})){if(n.signal.aborted)break;yield r}}yield*(0,e.expose)({},{key:Oe,transport:t})}},{boundRetired:e=>Q(e,()=>new Z)});G(()=>K.retire());var q=Promise.race([K.first,new Promise(e=>G(e))]).then(()=>K.facade),J=8e3,ke=1e3,Y=!1,X=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},Z=class extends Error{constructor(){super(`FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload`),this.name=`OwnChannelUnavailableError`}},Q=(e,t)=>{let n=Y?ke:J;return Promise.race([e,new Promise((e,r)=>setTimeout(()=>{Y=!0,r(t(n))},n))])},Ae=e=>W()?Q(K.routable().then(()=>K.facade),()=>new Z):Q(q,t=>new X(e,t));G(()=>{let e=setTimeout(()=>console.error(new Z),J);K.routable().then(()=>clearTimeout(e))});var $=K.onEpoch,je=K.current,Me=K.lastCall,Ne=K.inFlight;$(e=>{ue()&&e.overlay.setHost(me,{exactClips:f()}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return $}});
|
|
@@ -35,22 +35,22 @@ var t = 1e4, n = 16, r = (e) => {
|
|
|
35
35
|
[e + n, t + r],
|
|
36
36
|
[e, t + r],
|
|
37
37
|
[e, t]
|
|
38
|
-
],
|
|
38
|
+
], m = (e) => {
|
|
39
39
|
let t = e[0];
|
|
40
40
|
if (!t) return [];
|
|
41
41
|
let n = p(t)[0], r = [];
|
|
42
42
|
return e.forEach((t, i) => {
|
|
43
43
|
r.push(...p(t)), i > 0 && i < e.length - 1 && r.push(n);
|
|
44
44
|
}), r;
|
|
45
|
-
},
|
|
45
|
+
}, 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) => {
|
|
46
46
|
let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
|
|
47
47
|
return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
|
|
48
|
-
},
|
|
48
|
+
}, _ = (e, t, n) => {
|
|
49
49
|
if (t) return "none";
|
|
50
50
|
if (e.length === 0) return "inset(100%)";
|
|
51
51
|
let r = e.length === 1 ? e[0] : void 0;
|
|
52
|
-
return r ?
|
|
53
|
-
},
|
|
52
|
+
return r ? g(r, n) : l && e.length <= 5 && !e.some((e) => e.radius) ? h(e) : `path('${e.map(d).join("")}')`;
|
|
53
|
+
}, ee = (e) => {
|
|
54
54
|
if (e.length < 2) return null;
|
|
55
55
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
|
|
56
56
|
return {
|
|
@@ -84,26 +84,26 @@ var t = 1e4, n = 16, r = (e) => {
|
|
|
84
84
|
capture: !0,
|
|
85
85
|
passive: !1
|
|
86
86
|
}) : window.removeEventListener("wheel", S, { capture: !0 }));
|
|
87
|
-
}, C = 0,
|
|
87
|
+
}, C = 0, w = (e) => {
|
|
88
88
|
if (e === C) return;
|
|
89
89
|
C = e;
|
|
90
90
|
let t = document.documentElement.style;
|
|
91
91
|
e > 0 ? (t.setProperty("margin-top", `${e}px`, "important"), t.setProperty("--fkn-inset-top", `${e}px`)) : (t.removeProperty("margin-top"), t.removeProperty("--fkn-inset-top"));
|
|
92
|
-
},
|
|
93
|
-
if (
|
|
92
|
+
}, T = (e, { modal: t, rects: n, inset: r }, i) => {
|
|
93
|
+
if (w(r), !c) {
|
|
94
94
|
let r = t || n.length > 0;
|
|
95
95
|
e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
let a =
|
|
99
|
-
e.style.setProperty("clip-path", o, "important"), ae(t || o !== a ? null :
|
|
100
|
-
},
|
|
98
|
+
let a = _(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
|
|
99
|
+
e.style.setProperty("clip-path", o, "important"), ae(t || o !== a ? null : ee(n));
|
|
100
|
+
}, oe = (e) => {
|
|
101
101
|
if (typeof e != "object" || !e) return 0;
|
|
102
102
|
let { top: t } = e;
|
|
103
103
|
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), s);
|
|
104
|
-
},
|
|
104
|
+
}, se = (e) => {
|
|
105
105
|
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;
|
|
106
|
-
},
|
|
106
|
+
}, ce = (e, t) => {
|
|
107
107
|
if (typeof e != "object" || !e) return null;
|
|
108
108
|
let { x: n, y: r, width: i, height: a } = e;
|
|
109
109
|
if (![
|
|
@@ -112,7 +112,7 @@ var t = 1e4, n = 16, r = (e) => {
|
|
|
112
112
|
i,
|
|
113
113
|
a
|
|
114
114
|
].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
|
|
115
|
-
let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f =
|
|
115
|
+
let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f = se(e.radius);
|
|
116
116
|
return {
|
|
117
117
|
x: c,
|
|
118
118
|
y: l,
|
|
@@ -120,71 +120,71 @@ var t = 1e4, n = 16, r = (e) => {
|
|
|
120
120
|
height: d - l,
|
|
121
121
|
...f ? { radius: f } : {}
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, E = {
|
|
124
124
|
"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",
|
|
125
125
|
clipped: "it is clipped away or positioned outside the viewport",
|
|
126
126
|
"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"
|
|
127
|
-
},
|
|
127
|
+
}, D = (e) => Array.isArray(e) ? e.slice(0, o).flatMap((e) => {
|
|
128
128
|
if (typeof e != "object" || !e) return [];
|
|
129
129
|
let { kind: t, cause: n, level: r } = e;
|
|
130
|
-
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in
|
|
130
|
+
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in E) || r !== "full" && r !== "liveness" ? [] : [{
|
|
131
131
|
kind: t,
|
|
132
132
|
cause: n,
|
|
133
133
|
level: r
|
|
134
134
|
}];
|
|
135
|
-
}) : [],
|
|
136
|
-
for (let { kind: t, cause: n, level: r } of e)
|
|
135
|
+
}) : [], O = /* @__PURE__ */ new Set(), le = (e) => {
|
|
136
|
+
for (let { kind: t, cause: n, level: r } of e) O.has(t) || (O.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${E[n]}. Nobody using this page can see or answer it.
|
|
137
137
|
@fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, padding, box-sizing, 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." : "")));
|
|
138
|
-
},
|
|
138
|
+
}, k = (e, t) => {
|
|
139
139
|
if (typeof e != "object" || !e) return null;
|
|
140
|
-
let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, a) : []).map((e) =>
|
|
140
|
+
let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, a) : []).map((e) => ce(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
|
|
141
141
|
return {
|
|
142
142
|
modal: n.modal === !0,
|
|
143
143
|
rects: r,
|
|
144
|
-
hidden:
|
|
145
|
-
inset:
|
|
144
|
+
hidden: D(n.hidden),
|
|
145
|
+
inset: oe(n.inset)
|
|
146
146
|
};
|
|
147
|
-
},
|
|
148
|
-
if (!y ||
|
|
149
|
-
let e = x(y), t =
|
|
150
|
-
t &&
|
|
151
|
-
},
|
|
152
|
-
typeof ResizeObserver < "u" && (
|
|
153
|
-
},
|
|
154
|
-
u(e),
|
|
147
|
+
}, ue = () => y !== null, A = null, j = null, de = () => {
|
|
148
|
+
if (!y || A === null) return;
|
|
149
|
+
let e = x(y), t = k(A, e);
|
|
150
|
+
t && T(y, t, e);
|
|
151
|
+
}, fe = (e) => {
|
|
152
|
+
typeof ResizeObserver < "u" && (j ??= new ResizeObserver(de), j.disconnect(), j.observe(e));
|
|
153
|
+
}, pe = (e) => {
|
|
154
|
+
u(e), T(e, {
|
|
155
155
|
modal: !1,
|
|
156
156
|
rects: [],
|
|
157
157
|
hidden: [],
|
|
158
158
|
inset: 0
|
|
159
|
-
}, x(e)), y = e,
|
|
160
|
-
},
|
|
159
|
+
}, x(e)), y = e, fe(e);
|
|
160
|
+
}, me = (e) => {
|
|
161
161
|
if (!y) return;
|
|
162
|
-
let t = x(y), n =
|
|
163
|
-
n && (
|
|
164
|
-
},
|
|
162
|
+
let t = x(y), n = k(e, t);
|
|
163
|
+
n && (A = e, T(y, n, t), le(n.hidden));
|
|
164
|
+
}, he = [
|
|
165
165
|
"fkn.app",
|
|
166
166
|
"fkn.dev",
|
|
167
167
|
"sdbx.app"
|
|
168
|
-
],
|
|
169
|
-
let t =
|
|
170
|
-
return
|
|
171
|
-
},
|
|
168
|
+
], ge = (e) => e.replace(/\.+$/, ""), _e = (e) => {
|
|
169
|
+
let t = ge(e);
|
|
170
|
+
return he.some((e) => t === e || t.endsWith(`.${e}`));
|
|
171
|
+
}, M = (e) => {
|
|
172
172
|
let t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n;
|
|
173
173
|
try {
|
|
174
174
|
n = new URL(t);
|
|
175
175
|
} catch {
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
179
|
-
},
|
|
178
|
+
if (_e(n.hostname)) throw Error(`fetch refuses FKN platform domains (${n.hostname})`);
|
|
179
|
+
}, N = /* @__PURE__ */ "autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network".split("."), P = () => {
|
|
180
180
|
try {
|
|
181
181
|
let e = globalThis.document?.featurePolicy?.features?.();
|
|
182
182
|
return e === void 0 ? void 0 : new Set(e);
|
|
183
183
|
} catch {
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
},
|
|
187
|
-
if (!
|
|
186
|
+
}, F = (e = !0, t = P()) => [...N, ...e ? ["cross-origin-isolated"] : []].filter((e) => t === void 0 || t.has(e)).join("; "), I = "https://fkn.app", L = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, R = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, z = `${I}/api${R ? "?coi=1" : ""}`, ve = "fkn-api-port", ye = "fkn-api-port-ack", be = 2e3, xe = () => {
|
|
187
|
+
if (!L || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
|
|
188
188
|
let e;
|
|
189
189
|
try {
|
|
190
190
|
e = window.parent;
|
|
@@ -199,32 +199,32 @@ var t = 1e4, n = 16, r = (e) => {
|
|
|
199
199
|
} catch {}
|
|
200
200
|
n(e);
|
|
201
201
|
}, i = (e) => {
|
|
202
|
-
e.data?.type ===
|
|
203
|
-
}, a = setTimeout(() => r(void 0),
|
|
202
|
+
e.data?.type === ye && r(t.port1);
|
|
203
|
+
}, a = setTimeout(() => r(void 0), be);
|
|
204
204
|
t.port1.addEventListener("message", i), t.port1.start();
|
|
205
205
|
try {
|
|
206
|
-
e.postMessage({ type:
|
|
206
|
+
e.postMessage({ type: ve }, I, [t.port2]);
|
|
207
207
|
} catch {
|
|
208
208
|
r(void 0);
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
|
-
},
|
|
212
|
-
if (
|
|
213
|
-
let e =
|
|
214
|
-
if (e)
|
|
211
|
+
}, B, Se = () => {
|
|
212
|
+
if (B || !L) return B;
|
|
213
|
+
let e = L.querySelector(`iframe[src="${z}"]`);
|
|
214
|
+
if (e) B = e;
|
|
215
215
|
else {
|
|
216
|
-
let e =
|
|
217
|
-
e.setAttribute("allow",
|
|
216
|
+
let e = L.createElement("iframe");
|
|
217
|
+
e.setAttribute("allow", F(R)), e.src = z, L.body.appendChild(e), B = e;
|
|
218
218
|
}
|
|
219
|
-
return
|
|
220
|
-
},
|
|
221
|
-
if (!
|
|
222
|
-
let e = await
|
|
219
|
+
return pe(B), B;
|
|
220
|
+
}, V = (async () => {
|
|
221
|
+
if (!L) return;
|
|
222
|
+
let e = await xe();
|
|
223
223
|
if (e) return {
|
|
224
224
|
receive: e,
|
|
225
225
|
emit: e
|
|
226
226
|
};
|
|
227
|
-
let t =
|
|
227
|
+
let t = Se();
|
|
228
228
|
if (!t) return;
|
|
229
229
|
await i(t);
|
|
230
230
|
let n = t.contentWindow;
|
|
@@ -232,103 +232,143 @@ var t = 1e4, n = 16, r = (e) => {
|
|
|
232
232
|
receive: window,
|
|
233
233
|
emit: n
|
|
234
234
|
} : void 0;
|
|
235
|
-
})(),
|
|
236
|
-
let
|
|
237
|
-
|
|
238
|
-
}),
|
|
235
|
+
})(), Ce = (e, { boundRetired: t = (e) => e } = {}) => {
|
|
236
|
+
let n, r = 0, i = !1, a = () => {}, o = () => new Promise((e) => {
|
|
237
|
+
a = e;
|
|
238
|
+
}), s = o(), c = s, l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = 0, f = 0, p = () => {
|
|
239
|
+
let e = [...u];
|
|
240
|
+
u.clear();
|
|
241
|
+
let t = /* @__PURE__ */ Error("FKN: the broker was replaced while this call was pending; retry it");
|
|
242
|
+
for (let n of e) try {
|
|
243
|
+
n(t);
|
|
244
|
+
} catch {}
|
|
245
|
+
};
|
|
239
246
|
(async () => {
|
|
240
|
-
for await (let
|
|
241
|
-
let e =
|
|
242
|
-
|
|
243
|
-
remote:
|
|
247
|
+
for await (let t of e) {
|
|
248
|
+
let e = ++r;
|
|
249
|
+
n = {
|
|
250
|
+
remote: t,
|
|
244
251
|
epoch: e
|
|
245
|
-
}
|
|
246
|
-
let
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
e(s);
|
|
251
|
-
} catch {}
|
|
252
|
-
for (let t of [...i]) try {
|
|
253
|
-
t(r, e);
|
|
252
|
+
};
|
|
253
|
+
let i = a;
|
|
254
|
+
s = o(), i(t), p();
|
|
255
|
+
for (let n of [...l]) try {
|
|
256
|
+
n(t, e);
|
|
254
257
|
} catch {}
|
|
255
258
|
}
|
|
256
259
|
})().catch(() => {});
|
|
257
|
-
let
|
|
258
|
-
let
|
|
259
|
-
for (let t of e.slice(0, -1))
|
|
260
|
-
let
|
|
261
|
-
|
|
262
|
-
let
|
|
263
|
-
|
|
260
|
+
let m = async (e, r) => {
|
|
261
|
+
let a = n?.remote ?? await (i ? t(s) : s);
|
|
262
|
+
for (let t of e.slice(0, -1)) a = a[t];
|
|
263
|
+
let o = a[e[e.length - 1] ?? ""];
|
|
264
|
+
d = Date.now(), f += 1;
|
|
265
|
+
let c = () => {}, l = new Promise((e, t) => {
|
|
266
|
+
c = t;
|
|
264
267
|
});
|
|
265
|
-
|
|
268
|
+
u.add(c);
|
|
266
269
|
try {
|
|
267
|
-
return await Promise.race([Promise.resolve(
|
|
270
|
+
return await Promise.race([Promise.resolve(o.apply(a, r)), l]);
|
|
268
271
|
} finally {
|
|
269
|
-
--
|
|
272
|
+
--f, u.delete(c), d = Date.now();
|
|
270
273
|
}
|
|
271
|
-
},
|
|
272
|
-
let
|
|
274
|
+
}, h = /* @__PURE__ */ new Map(), g = (e) => {
|
|
275
|
+
let t = e.join("\0"), r = h.get(t);
|
|
273
276
|
if (r) return r;
|
|
274
277
|
let i = new Proxy(function() {}, {
|
|
275
|
-
get: (
|
|
278
|
+
get: (t, r) => {
|
|
276
279
|
if (typeof r != "string" || r === "then") return;
|
|
277
|
-
let i =
|
|
280
|
+
let i = n;
|
|
278
281
|
if (i) {
|
|
279
282
|
let t = i.remote;
|
|
280
283
|
for (let n of e) t = t?.[n];
|
|
281
284
|
if (t?.[r] === void 0) return;
|
|
282
285
|
}
|
|
283
|
-
return
|
|
286
|
+
return g([...e, r]);
|
|
284
287
|
},
|
|
285
|
-
apply: (t, n, r) =>
|
|
288
|
+
apply: (t, n, r) => m(e, r)
|
|
286
289
|
});
|
|
287
|
-
return
|
|
290
|
+
return h.set(t, i), i;
|
|
288
291
|
};
|
|
289
292
|
return {
|
|
290
|
-
facade:
|
|
291
|
-
first:
|
|
292
|
-
current: () =>
|
|
293
|
+
facade: g([]),
|
|
294
|
+
first: c.then(() => {}),
|
|
295
|
+
current: () => n,
|
|
293
296
|
onEpoch: (e) => {
|
|
294
|
-
if (
|
|
295
|
-
e(
|
|
297
|
+
if (l.add(e), n) try {
|
|
298
|
+
e(n.remote, n.epoch);
|
|
296
299
|
} catch {}
|
|
297
300
|
return () => {
|
|
298
|
-
|
|
301
|
+
l.delete(e);
|
|
299
302
|
};
|
|
300
303
|
},
|
|
301
|
-
lastCall: () =>
|
|
302
|
-
inFlight: () =>
|
|
304
|
+
lastCall: () => d,
|
|
305
|
+
inFlight: () => f,
|
|
306
|
+
routable: () => n ? Promise.resolve() : s.then(() => {}),
|
|
307
|
+
retire: () => {
|
|
308
|
+
i = !0, n = void 0, p();
|
|
309
|
+
}
|
|
303
310
|
};
|
|
304
|
-
},
|
|
305
|
-
if (
|
|
311
|
+
}, H = !1, U = /* @__PURE__ */ new Set(), W = () => H, we = () => {
|
|
312
|
+
if (!H) {
|
|
313
|
+
H = !0;
|
|
314
|
+
for (let e of [...U]) try {
|
|
315
|
+
e();
|
|
316
|
+
} catch {}
|
|
317
|
+
U.clear();
|
|
318
|
+
}
|
|
319
|
+
}, G = (e) => {
|
|
320
|
+
H ? e() : U.add(e);
|
|
321
|
+
}, Te = typeof window < "u" || typeof self < "u", Ee = async () => {
|
|
322
|
+
if (typeof window < "u") return V;
|
|
306
323
|
if (typeof self < "u") return {
|
|
307
324
|
receive: self,
|
|
308
325
|
emit: self
|
|
309
326
|
};
|
|
310
|
-
},
|
|
311
|
-
let t = await
|
|
327
|
+
}, De = "fkn-api", Oe = "fkn-api-window", K = Ce({ async *[Symbol.asyncIterator]() {
|
|
328
|
+
let t = await Ee();
|
|
312
329
|
if (!t) {
|
|
313
330
|
await new Promise(() => {});
|
|
314
331
|
return;
|
|
315
332
|
}
|
|
333
|
+
if (!W()) {
|
|
334
|
+
let n = new AbortController();
|
|
335
|
+
G(() => n.abort());
|
|
336
|
+
for await (let r of e({}, {
|
|
337
|
+
key: De,
|
|
338
|
+
transport: t,
|
|
339
|
+
unregisterSignal: n.signal
|
|
340
|
+
})) {
|
|
341
|
+
if (n.signal.aborted) break;
|
|
342
|
+
yield r;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
316
345
|
yield* e({}, {
|
|
317
|
-
key:
|
|
346
|
+
key: Oe,
|
|
318
347
|
transport: t
|
|
319
348
|
});
|
|
320
|
-
} }
|
|
349
|
+
} }, { boundRetired: (e) => Q(e, () => new Z()) });
|
|
350
|
+
G(() => K.retire());
|
|
351
|
+
var q = Promise.race([K.first, new Promise((e) => G(e))]).then(() => K.facade), J = 8e3, ke = 1e3, Y = !1, X = class extends Error {
|
|
321
352
|
constructor(e, t) {
|
|
322
353
|
super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`), this.name = "BrokerUnreachableError";
|
|
323
354
|
}
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
355
|
+
}, Z = class extends Error {
|
|
356
|
+
constructor() {
|
|
357
|
+
super("FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload"), this.name = "OwnChannelUnavailableError";
|
|
358
|
+
}
|
|
359
|
+
}, Q = (e, t) => {
|
|
360
|
+
let n = Y ? ke : J;
|
|
361
|
+
return Promise.race([e, new Promise((e, r) => setTimeout(() => {
|
|
362
|
+
Y = !0, r(t(n));
|
|
363
|
+
}, n))]);
|
|
364
|
+
}, Ae = (e) => W() ? Q(K.routable().then(() => K.facade), () => new Z()) : Q(q, (t) => new X(e, t));
|
|
365
|
+
G(() => {
|
|
366
|
+
let e = setTimeout(() => console.error(new Z()), J);
|
|
367
|
+
K.routable().then(() => clearTimeout(e));
|
|
368
|
+
});
|
|
369
|
+
var $ = K.onEpoch, je = K.current, Me = K.lastCall, Ne = K.inFlight;
|
|
330
370
|
$((e) => {
|
|
331
|
-
|
|
371
|
+
ue() && e.overlay.setHost(me, { exactClips: f() }).catch(() => {});
|
|
332
372
|
});
|
|
333
373
|
//#endregion
|
|
334
|
-
export {
|
|
374
|
+
export { Me as a, je as c, we as d, V as f, Ne as i, Te as l, F as m, X as n, q as o, M as p, Z as r, Ae as s, J as t, $ as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
2
|
+
import { D as IpFamily, Dt as UdpSocketOptions, Et as UdpDatagram, H as ProxyFetchInput, I as PackagesErrorCode, J as RoomClaimOptions, K as Resolvers, N as OverlayState, Nt as WriteData, P as PackageQuery, Q as RoomEvent, R as PickOptions, St as TcpSocketListenerOptions, T as InstallOptions, V as ProxyFetchInit, a as AccountChange, at as RoomPermission, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, et as RoomJoinOptions, it as RoomOpenOptions, l as AdoptState, m as ConnectOptions, o as AccountPinOptions, p as ConnectAvailability, st as RoomsErrorCode, tt as RoomMailbox, u as ConflictChoice, wt as TcpSocketOptions, x as FrameConsentRequest, z as Placement } from "./contract-CCxPKIC7.js";
|
|
3
3
|
import { Remote } from "osra";
|
|
4
4
|
//#region src/api-epochs.d.ts
|
|
5
5
|
type EpochListener<T> = (remote: T, epoch: number) => void;
|
|
@@ -12,6 +12,12 @@ type Api = Remote<Resolvers>;
|
|
|
12
12
|
* stable facade that always routes to the NEWEST connection, so holding the resolved value across a
|
|
13
13
|
* broker replacement is safe. A call in flight at the moment of replacement rejects with a named
|
|
14
14
|
* error instead of hanging.
|
|
15
|
+
*
|
|
16
|
+
* A window realm that relays its channel to a worker (`relayWorker`) moves its own calls to a channel
|
|
17
|
+
* of their own, never back to the relayed one. There it also settles once the realm relays, a call in
|
|
18
|
+
* flight on the relayed channel then rejects as on a replacement, and a call waits for the realm's own
|
|
19
|
+
* channel within the deadline below, rejecting with `OwnChannelUnavailableError` when the broker never
|
|
20
|
+
* answers there.
|
|
15
21
|
*/
|
|
16
22
|
declare const apiPromise: Promise<Api>;
|
|
17
23
|
/**
|
|
@@ -37,6 +43,22 @@ declare const API_DEADLINE_MS = 8000;
|
|
|
37
43
|
declare class BrokerUnreachableError extends Error {
|
|
38
44
|
constructor(what: string, ms: number);
|
|
39
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* A page's own call, refused because the page relays its FKN channel to a worker (`relayWorker`) and
|
|
48
|
+
* the broker it reached never answered on the page's own channel within the deadline: a broker
|
|
49
|
+
* document from before that channel, as fkn.app's service worker can still serve from its cache. The
|
|
50
|
+
* page's own calls never fall back to the relayed channel, so this is the answer until a reload
|
|
51
|
+
* reaches a newer broker. The relayed worker's calls are unaffected.
|
|
52
|
+
*
|
|
53
|
+
* What the page registered on the relayed channel went with it, and nothing registers it again until
|
|
54
|
+
* then: FKN's UI on this page (the prompts and header the broker draws over it, those the worker's
|
|
55
|
+
* calls raise included) is no longer placed, and account changes are no longer heard. So the realm also logs this error
|
|
56
|
+
* once with `console.error` when the deadline passes, whether or not the page calls.
|
|
57
|
+
*/
|
|
58
|
+
declare class OwnChannelUnavailableError extends Error {
|
|
59
|
+
constructor();
|
|
60
|
+
}
|
|
61
|
+
/** In a realm that relays, this waits for the realm's own channel and rejects with `OwnChannelUnavailableError` instead. */
|
|
40
62
|
declare const apiWithin: (what: string) => Promise<Api>;
|
|
41
63
|
/**
|
|
42
64
|
* Runs for the current broker connection on subscribe (if one exists) and for every later one.
|
|
@@ -1482,4 +1504,4 @@ declare const currentApiEpoch: () => {
|
|
|
1482
1504
|
declare const apiLastCall: () => number;
|
|
1483
1505
|
declare const apiInFlight: () => number;
|
|
1484
1506
|
//#endregion
|
|
1485
|
-
export {
|
|
1507
|
+
export { apiLastCall as a, currentApiEpoch as c, apiInFlight as i, hasTransport as l, BrokerUnreachableError as n, apiPromise as o, OwnChannelUnavailableError as r, apiWithin as s, API_DEADLINE_MS as t, onApiEpoch as u };
|
package/api.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api--LOXTOpv.cjs");exports.API_DEADLINE_MS=e.t,exports.BrokerUnreachableError=e.n,exports.OwnChannelUnavailableError=e.r,exports.apiInFlight=e.i,exports.apiLastCall=e.a,exports.apiPromise=e.o,exports.apiWithin=e.s,exports.currentApiEpoch=e.c,exports.hasTransport=e.l,exports.onApiEpoch=e.u;
|
package/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
export { API_DEADLINE_MS, BrokerUnreachableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|
|
1
|
+
import { K as Resolvers } from "./contract-CCxPKIC7.js";
|
|
2
|
+
import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-SwxtiYVU.js";
|
|
3
|
+
export { API_DEADLINE_MS, BrokerUnreachableError, OwnChannelUnavailableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|
package/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./api-
|
|
2
|
-
export { c as API_DEADLINE_MS, i as BrokerUnreachableError, o as
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./api-DIgTslNb.js";
|
|
2
|
+
export { c as API_DEADLINE_MS, i as BrokerUnreachableError, o as OwnChannelUnavailableError, n as apiInFlight, e as apiLastCall, a as apiPromise, s as apiWithin, t as currentApiEpoch, r as hasTransport, l as onApiEpoch };
|
package/attach-policy.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./hosts-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./hosts-GNBhZO3-.cjs");var t=(t,n,{classifier:r=`no-base`}={})=>{if(!t.session)return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs its own session: attach with cookies: 'ephemeral'`};if(typeof n!=`string`)return{kind:`refuse`,reason:`frame.fetch: url must be a string`};let i;try{i=new URL(n)}catch{return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs an absolute url`}}if(r===`fetchTarget`&&e.l(n).kind!==`absolute`)return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs an absolute url`};if(i.protocol!==`https:`&&i.protocol!==`http:`)return{kind:`refuse`,reason:`frame.fetch: only http(s) urls are supported`};if(!(t.declaredHosts.includes(i.hostname)||t.approvedOrigins.has(i.origin)))return{kind:`refuse`,reason:`frame.fetch: the target is outside the origins this attachment declared`};let a=t.declaredHosts.length?t.declaredHosts:[i.hostname];return{kind:`consent`,targetHost:i.hostname,promptHosts:a}};exports.frameFetchVerdict=t,exports.normalizeDeclaredHosts=e.t;
|
package/attach-policy.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { l as e, t } from "./hosts-
|
|
1
|
+
import { l as e, t } from "./hosts-t7CKGTRz.js";
|
|
2
2
|
//#region src/attach-policy.ts
|
|
3
3
|
var n = (t, n, { classifier: r = "no-base" } = {}) => {
|
|
4
4
|
if (!t.session) return {
|
|
5
5
|
kind: "refuse",
|
|
6
|
-
reason: "frame.fetch on the cloud backend needs its own session: attach with
|
|
6
|
+
reason: "frame.fetch on the cloud backend needs its own session: attach with cookies: 'ephemeral'"
|
|
7
7
|
};
|
|
8
8
|
if (typeof n != "string") return {
|
|
9
9
|
kind: "refuse",
|
package/cloud/dns.d.ts
CHANGED
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-CFK-KiwE.cjs");exports.fetch=e.t;
|