@fkn/lib 0.9.23 → 0.9.25
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.d.ts +7 -3
- package/account.js +7 -7
- package/api-BCJO3EWi.cjs +3 -0
- package/api-CesI0aMl.d.ts +677 -0
- package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
- package/api.cjs +1 -0
- package/api.d.ts +3 -0
- package/api.js +2 -0
- package/attach-policy.cjs +1 -0
- package/attach-policy.d.ts +35 -0
- package/attach-policy.js +43 -0
- package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.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/promises.d.ts +7 -6
- package/cloud/fs/promises.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -3
- package/cloud/fs.js +10 -9
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/cloud-B2ZG-0MF.cjs +1 -0
- package/cloud-B7pI3pp1.d.ts +37 -0
- package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +4 -4
- package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
- package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
- package/contract-D6ksmIm6.d.ts +394 -0
- package/contract.cjs +0 -0
- package/contract.d.ts +3 -0
- package/contract.js +0 -0
- package/desktop.js +1 -1
- package/dgram.cjs +1 -1
- package/dgram.d.ts +6 -47
- package/dgram.js +406 -2
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -3
- package/dns.js +2 -2
- package/extension-CJUeVRXf.d.ts +361 -0
- package/extension-DBazc3ff.cjs +1 -0
- package/extension-Dw9gzvei.js +84 -0
- 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.d.ts +8 -9
- package/fs/promises.js +2 -2
- package/fs-DYP7utdw.cjs +1 -0
- package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
- package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/http.cjs +3 -3
- package/http.d.ts +4 -6
- package/http.js +8 -8
- package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
- package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
- package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
- package/index.cjs +1 -1
- package/index.d.ts +12 -13
- package/index.js +60 -49
- package/lib-DLM2M3_i.cjs +53 -0
- package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
- package/messages-DvpKMTsY.d.ts +28 -0
- package/messages.cjs +1 -0
- package/messages.d.ts +2 -0
- package/messages.js +4 -0
- package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +318 -3
- package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
- package/opfs/promises.d.ts +7 -8
- package/opfs/promises.js +1 -1
- package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
- package/opfs.d.ts +24 -26
- package/opfs.js +3 -3
- package/package.json +27 -2
- package/packages.cjs +1 -1
- package/packages.d.ts +143 -2
- package/packages.js +15 -15
- package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
- package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
- package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
- package/react.d.ts +3 -7
- package/react.js +2 -2
- package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
- package/storage-DLB4ciMf.cjs +1 -0
- package/utils-BvgGdrgN.cjs +1 -0
- package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
- package/wire-Gbo-D74t.d.ts +91 -0
- package/wire.cjs +1 -0
- package/wire.d.ts +2 -0
- package/wire.js +4 -0
- package/api-BGYSJVvR.d.ts +0 -789
- package/api-C-TpWHAU.cjs +0 -3
- package/cloud-BqjwL5KM.cjs +0 -1
- package/cloud-DMTkzfcf.d.ts +0 -36
- package/dgram-BLN-mfgq.cjs +0 -1
- package/dgram-DHQcHefn.js +0 -405
- package/extension-B8Y0sUwC.js +0 -78
- package/extension-CMPZjuaV.d.ts +0 -16
- package/extension-CgSGjcSl.cjs +0 -1
- package/fs-BNnozBMU.cjs +0 -1
- package/lib-DbiVHPXE.cjs +0 -53
- package/lookup-BtwWaCZJ.d.ts +0 -7
- package/net-B6RHtWwe.cjs +0 -1
- package/net-yBkobZqK.js +0 -317
- package/packages-Cn8S-Hkn.d.ts +0 -217
- package/storage-qxXFLgTM.d.ts +0 -44
- package/storage-xAeRQQiz.cjs +0 -1
- package/utils-QfNXtEhb.cjs +0 -1
package/api-C-TpWHAU.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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=120,l=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),u=typeof CSS<`u`&&CSS.supports(`clip-path`,`polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)`),d=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`)},f=({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`},p=()=>l&&u,m=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],ee=e=>{let t=e[0];if(!t)return[];let n=m(t)[0],r=[];return e.forEach((t,i)=>{r.push(...m(t)),i>0&&i<e.length-1&&r.push(n)}),r},h=e=>`polygon(nonzero, ${ee(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})`},te=(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):u&&e.length<=5&&!e.some(e=>e.radius)?h(e):`path('${e.map(f).join(``)}')`},_=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}},v=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,y=16,b=(e,t,n)=>t===1?e*y:t===2?e*n:e,ne=(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},x=(e,t,n)=>{for(let r=e;r;r=r.parentElement)if(ne(r,t,n))return r;return document.scrollingElement},S=null,C=null,w=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),T=e=>{if(!C||!S||!v(C,e.clientX,e.clientY))return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t||t===S)return;let n=b(e.deltaX,e.deltaMode,window.innerWidth),r=b(e.deltaY,e.deltaMode,window.innerHeight),i=x(t,n,r);i&&(i.scrollBy({left:n,top:r,behavior:`instant`}),e.cancelable&&e.preventDefault())},E=e=>{let t=C!==null;C=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,T,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,T,{capture:!0}))},D=0,O=e=>{if(e===D)return;D=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`))},k=(e,{modal:t,rects:n,inset:r},i)=>{if(O(r),!l){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=te(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),E(t||o!==a?null:_(n))},re=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),c)},ie=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},ae=(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=ie(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},A={"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`},oe=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 A)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],j=new Set,M=e=>{for(let{kind:t,cause:n,level:r}of e)j.has(t)||(j.add(t),console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${A[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.`:``)))},N=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,o):[]).map(e=>ae(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:oe(n.hidden),inset:re(n.inset)}},P=()=>S!==null,F=null,I=null,L=()=>{if(!S||F===null)return;let e=w(S),t=N(F,e);t&&k(S,t,e)},R=e=>{typeof ResizeObserver>`u`||(I??=new ResizeObserver(L),I.disconnect(),I.observe(e))},z=e=>{d(e),k(e,{modal:!1,rects:[],hidden:[],inset:0},w(e)),S=e,R(e)},B=e=>{if(!S)return;let t=w(S),n=N(e,t);n&&(F=e,k(S,n,t),M(n.hidden))},V=`https://fkn.app`,H=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,U=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,W=`${V}/api${U?`?coi=1`:``}`,G=`fkn-api-port`,K=`fkn-api-port-ack`,se=2e3,ce=()=>{if(!H||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===K&&r(t.port1)},a=setTimeout(()=>r(void 0),se);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:G},V,[t.port2])}catch{r(void 0)}})},q,le=()=>{if(q||!H)return q;let e=H.querySelector(`iframe[src="${W}"]`);if(e)q=e;else{let e=H.createElement(`iframe`);U&&e.setAttribute(`allow`,`cross-origin-isolated`),e.src=W,H.body.appendChild(e),q=e}return z(q),q},J=(async()=>{if(!H)return;let e=await ce();if(e)return{receive:e,emit:e};let t=le();if(!t)return;await a(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),ue=e=>{let t,n=()=>{},r=new Promise(e=>{n=e}),i=new Set,a=new Set,o=0,s=0;(async()=>{for await(let r of e){let e=(t?.epoch??0)+1;t={remote:r,epoch:e},e===1&&n(r);let o=[...a];a.clear();let s=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let e of o)try{e(s)}catch{}for(let t of[...i])try{t(r,e)}catch{}}})().catch(()=>{});let c=async(e,n)=>{let i=t?.remote??await r;for(let t of e.slice(0,-1))i=i[t];let c=i[e[e.length-1]??``];o=Date.now(),s+=1;let l=()=>{},u=new Promise((e,t)=>{l=t});a.add(l);try{return await Promise.race([Promise.resolve(c.apply(i,n)),u])}finally{--s,a.delete(l),o=Date.now()}},l=new Map,u=e=>{let n=e.join(`\0`),r=l.get(n);if(r)return r;let i=new Proxy(function(){},{get:(n,r)=>{if(typeof r!=`string`||r===`then`)return;let i=t;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return u([...e,r])},apply:(t,n,r)=>c(e,r)});return l.set(n,i),i};return{facade:u([]),first:r.then(()=>{}),current:()=>t,onEpoch:e=>{if(i.add(e),t)try{e(t.remote,t.epoch)}catch{}return()=>{i.delete(e)}},lastCall:()=>o,inFlight:()=>s}},de=e.t({apiPromise:()=>Z,currentApiEpoch:()=>$,hasTransport:()=>Y,onApiEpoch:()=>Q}),Y=typeof window<`u`||typeof self<`u`,fe=async()=>{if(typeof window<`u`)return J;if(typeof self<`u`)return{receive:self,emit:self}},X=ue({async*[Symbol.asyncIterator](){let e=await fe();if(!e){await new Promise(()=>{});return}yield*(0,t.expose)({},{key:`fkn-api`,transport:e})}}),Z=X.first.then(()=>X.facade),Q=X.onEpoch,$=X.current;X.lastCall,X.inFlight,Q(e=>{P()&&e.overlay.setHost(B,{exactClips:p()}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Z}});
|
package/cloud-BqjwL5KM.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DbiVHPXE.cjs"),n=require("./api-C-TpWHAU.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./proxy-BNdvRifw.cjs"),a=require("./dns.cjs"),o=require("./cloud/fs.cjs"),s=require("./net-B6RHtWwe.cjs"),c=require("./dgram-BLN-mfgq.cjs"),l=require("./http.cjs");let u=require("osra");var d={scope:`frame.fetchRead`,category:`network`,severity:3,unsafe:!0,title:`Read your account data on this site`,description:`Lets the app read pages and data from this site as you, using the session in the frame.`},f={scope:`frame.fetchWrite`,category:`network`,severity:3,unsafe:!0,title:`Change your account data on this site`,description:`Lets the app send changes to this site as you, using the session in the frame.`},p=new Set([`GET`,`HEAD`,`OPTIONS`]),m=(e,t)=>p.has((t?.method??`GET`).toUpperCase())?d:f,h=e=>{let t=[];for(let n of e){let e=n.trim().toLowerCase();!e||e.length>253||/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/.test(e)&&(t.includes(e)||t.push(e))}return t},g=(e,t)=>{if(!e.session)return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs its own session: attach with syncCookies: false`};if(typeof t!=`string`)return{kind:`refuse`,reason:`frame.fetch: url must be a string`};let n;try{n=new URL(t)}catch{return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs an absolute url`}}if(n.protocol!==`https:`&&n.protocol!==`http:`)return{kind:`refuse`,reason:`frame.fetch: only http(s) urls are supported`};if(!(e.declaredHosts.includes(n.hostname)||e.approvedOrigins.has(n.origin)))return{kind:`refuse`,reason:`frame.fetch: the target is outside the origins this attachment declared`};let r=e.declaredHosts.length?e.declaredHosts:[n.hostname];return{kind:`consent`,targetHost:n.hostname,promptHosts:r}},_=e=>e,v=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,y=2e4,b=65e3,x=3e4,S=5e3,C=new Set([]),w=()=>`https://fkn.app`,T=e=>!e||e===`about:blank`,E=e=>e?``:`incognito-${crypto.randomUUID()}`,D=({target:e,session:t,domains:n})=>{let r=new URL(`/attach-frame`,w());return e&&r.searchParams.set(`url`,e),t&&r.searchParams.set(`session`,t),n.length&&r.searchParams.set(`domains`,n.join(`,`)),r.href},O=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},k=(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())},A=()=>Object.assign(Error(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),{name:t.m}),j=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},M=[300,1200,4e3],N=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 M)setTimeout(t,e)},P=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`)},F=async({iframe:e,domains:i=[],syncCookies:a=!0,lockdown:o=!1})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(o)throw Error(`cloud.attachFrame does not support lockdown; use the extension backend for a sealed frame`);if(!e.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);P(e);let s=e.getAttribute(`src`)??``,c=(()=>{if(T(s))return null;try{return new URL(e.src||s,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${s}`)}})();if(c){let e=new URL(`/attach-frame`,w());if(c.origin===e.origin&&c.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 l=c?.href??``;l&&t.s(l);let d=l,f=E(a),p=h(i),M=new Set;try{M.add(new URL(l).origin)}catch{}let F=new AbortController,I=e.referrerPolicy,L=e.allow;if(e.referrerPolicy=`origin`,e.allow=j(v,e.allow),e.src=D({target:l,session:f,domains:p}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let i=await O((0,u.expose)({},{key:`fkn-attach-frame`,origin:w(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:F.signal,revivableModules:_(t.R)}),y,`cloud.attachFrame: timed out connecting to the render proxy page`);await O(i.ready(),b,`cloud.attachFrame: the render proxy never became ready`),l&&N(e),k(e,()=>F.abort());let a=r.t(`attached frame`);F.signal.aborted?a():F.signal.addEventListener(`abort`,a,{once:!0});let o=e.contentWindow,s=()=>{if(!(!F.signal.aborted&&e.isConnected&&e.contentWindow===o))throw F.abort(),A()};return t.a({executor:{execute:(e,n,r)=>C.has(n)?Promise.reject(t.f(n,`cloud`)):(s(),i.executeLocator(e,n,r)),highlight:async()=>{}},gate:async e=>{if(e.operation!==`fetch`)return;let r=g({session:f,declaredHosts:p,approvedOrigins:M},e.args[0]);if(r.kind===`refuse`)throw t._(r.reason,`fetch`);if(!await(await n.t).frameConsent.ensure({scope:m(e.args[0],e.args[1]).scope,hosts:r.promptHosts}))throw t._(`frame.fetch: the user did not grant this`,`fetch`)},goto:async(t,n={})=>{let r=new URL(t,location.href).href;s();let{timeoutMs:a}=n;await O(i.goto(r,n),(a??x)+S,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`),d=r;try{M.add(new URL(r).origin)}catch{}N(e)},url:()=>d})}catch(t){throw F.abort(),e.referrerPolicy=I,e.allow=L,e.src=l||`about:blank`,t}},I=()=>typeof window<`u`&&!0,L=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}},R=e.t({attachFrame:()=>F,available:()=>z,dgram:()=>c.i,dns:()=>a.t,fetch:()=>i.t,fs:()=>o.t,http:()=>l.t,net:()=>s.s,quota:()=>L}),z=()=>n.i;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return z}});
|
package/cloud-DMTkzfcf.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-DmMu2_1z.js";
|
|
2
|
-
import { d as Frame, u as AttachFrameOptions } from "./index-DY8WjklJ.js";
|
|
3
|
-
import { t as dns_d_exports } from "./dns.js";
|
|
4
|
-
import { n as fs_d_exports } from "./fs-CUmugp10.js";
|
|
5
|
-
import { s as net_d_exports } from "./net-DaWv81tQ.js";
|
|
6
|
-
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
|
-
import { t as http_d_exports } from "./http.js";
|
|
8
|
-
|
|
9
|
-
//#region src/lib/cloud/frame.d.ts
|
|
10
|
-
declare const attachFrame: ({
|
|
11
|
-
iframe,
|
|
12
|
-
domains,
|
|
13
|
-
syncCookies,
|
|
14
|
-
lockdown
|
|
15
|
-
}: AttachFrameOptions) => Promise<Frame>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/lib/quota.d.ts
|
|
18
|
-
type QuotaStatus = {
|
|
19
|
-
/** the user has a paid subscription, throttle never applies */premium: boolean; /** today's free-tier volume is spent (true even for premium, see `throttled`) */
|
|
20
|
-
overQuota: boolean; /** transfers are actually being rate-limited right now (overQuota and not premium) */
|
|
21
|
-
throttled: boolean;
|
|
22
|
-
/** bytes egressed through FKN relays today (per connected account or anonymized IP), saturates at limitBytes:
|
|
23
|
-
* consumption past the free-tier volume is private and never reported */
|
|
24
|
-
usedBytes: number; /** free-tier daily volume before throttling kicks in */
|
|
25
|
-
limitBytes: number; /** bytes of free-tier volume left today */
|
|
26
|
-
remainingBytes: number; /** current effective egress rate cap, bytes per second */
|
|
27
|
-
bytesPerSecond: number; /** current effective egress rate cap, bits per second (for display) */
|
|
28
|
-
bitsPerSecond: number;
|
|
29
|
-
};
|
|
30
|
-
declare const quota: () => Promise<QuotaStatus>;
|
|
31
|
-
declare namespace cloud_d_exports {
|
|
32
|
-
export { 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 };
|
|
33
|
-
}
|
|
34
|
-
declare const available: () => boolean;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { attachFrame as a, quota as i, cloud_d_exports as n, QuotaStatus as r, available as t };
|
package/dgram-BLN-mfgq.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-C-TpWHAU.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./utils-QfNXtEhb.cjs");let i=require("buffer"),a=require("events"),o=require("ip-address");var s=e.t({Socket:()=>c,createSocket:()=>m,default:()=>h}),c=class extends a.EventEmitter{_type;_localAddress;_remoteAddress;_connectedLocally;_connectGeneration=0;_destroyed=!1;_busyRelease;_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:r.n,consumedBytes:this._dataPortConsumedBytes};this._dataPort.postMessage(t)}_onTransportClosed(e){this._destroyed||(this._destroyed=!0,this._busyRelease?.(),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,r,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,d,p;if(l===2){if(!this._remoteAddress){a=s;continue}u=this._remoteAddress.address,d=this._remoteAddress.family,p=this._remoteAddress.port}else{let n=new Uint8Array(e,c,l===0?4:16);l===0?(d=`IPv4`,u=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`):(d=`IPv6`,u=f(n)),c+=n.byteLength,p=t.getUint16(c),c+=2}let m=t.getUint32(c);c+=4;try{this.emit(`message`,i.Buffer.from(e.slice(c,c+m)),{address:u,family:d,port:p,size:m})}catch(e){n||(n=!0,r=e)}a=s}if(n)throw r}_peerTail(e,t){if(e===void 0||t===void 0)return l;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=o.Address4.isValid(e)?d(e):p(e),a=new Uint8Array(1+i.byteLength+2);return a[0]=i.byteLength===4?0:1,a.set(i,1),new DataView(a.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.size>=4096&&this._peerTailCache.clear(),this._peerTailCache.set(n,a),a}_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(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(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 n=r.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:n.address??i,port:n.port,dataPort:!0})));return n.callback&&a.then(e=>{e&&n.callback.call(this)}),this}__webvpn_udp_socket_init__(e,t){return t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort}),this._busyRelease??=n.t(`udp socket`),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`,i.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=>{if(!e){this._busyRelease?.();return}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._busyRelease?.(),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(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(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=r.s(...e),n=u(t.message),i=n;if(t.hasRange){let{offset:e,length:r}=t;if(!Number.isInteger(e)||e<0||e>n.byteLength)throw Object.assign(RangeError(`"offset" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});if(!Number.isInteger(r)||r<0||r>n.byteLength-e)throw Object.assign(RangeError(`"length" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});i=n.subarray(e,e+r)}let a=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??a,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||o.Address4.isValid(r)||o.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)})}},l=new Uint8Array([2]),u=e=>{if(typeof e==`string`)return r.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(u),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)},d=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)},f=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(`:`)}`},p=e=>{let t=new o.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)))},m=(e,t)=>{let n=new c(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},h={Socket:c,createSocket:m};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
package/dgram-DHQcHefn.js
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./api-Jq4OSTp1.js";
|
|
3
|
-
import { t as n } from "./busy-Bp1E3JPT.js";
|
|
4
|
-
import { l as r, n as i, o as a, s as o } from "./utils-DVlbuXmW.js";
|
|
5
|
-
import { Buffer as s } from "buffer";
|
|
6
|
-
import { EventEmitter as c } from "events";
|
|
7
|
-
import { Address4 as l, Address6 as u } from "ip-address";
|
|
8
|
-
//#region src/lib/webvpn/dgram.ts
|
|
9
|
-
var d = /* @__PURE__ */ e({
|
|
10
|
-
Socket: () => f,
|
|
11
|
-
createSocket: () => v,
|
|
12
|
-
default: () => y
|
|
13
|
-
}), f = class extends c {
|
|
14
|
-
_type;
|
|
15
|
-
_localAddress;
|
|
16
|
-
_remoteAddress;
|
|
17
|
-
_connectedLocally;
|
|
18
|
-
_connectGeneration = 0;
|
|
19
|
-
_destroyed = !1;
|
|
20
|
-
_busyRelease;
|
|
21
|
-
_webVPNUdpSocketPromise;
|
|
22
|
-
_dataPort;
|
|
23
|
-
_socketId;
|
|
24
|
-
_sendQueue = [];
|
|
25
|
-
_sendQueueBytes = 0;
|
|
26
|
-
_sendFlushScheduled = !1;
|
|
27
|
-
_peerTailCache = /* @__PURE__ */ new Map();
|
|
28
|
-
constructor(e) {
|
|
29
|
-
if (super(e), !e) throw Error("Missing options");
|
|
30
|
-
this._type = e.type, e.connection && this.__webvpn_udp_socket_init__(e.connection);
|
|
31
|
-
}
|
|
32
|
-
_lastRecvBufferSize = 0;
|
|
33
|
-
_lastSendBufferSize = 0;
|
|
34
|
-
_lastTtl = 64;
|
|
35
|
-
_lastMulticastTtl = 1;
|
|
36
|
-
_lastMulticastLoopback = !0;
|
|
37
|
-
_setUdpOption(e) {
|
|
38
|
-
if (!this._webVPNUdpSocketPromise) {
|
|
39
|
-
this.emit("error", /* @__PURE__ */ Error("Cannot set socket option before bind"));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
this._webVPNUdpSocketPromise.then(async (t) => {
|
|
43
|
-
if (t) try {
|
|
44
|
-
await t.setOption(e);
|
|
45
|
-
} catch (e) {
|
|
46
|
-
this.emit("error", e);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
_dataPortAcks = !1;
|
|
51
|
-
_dataPortConsumedBytes = 0;
|
|
52
|
-
_dataPortAckedBytes = 0;
|
|
53
|
-
_ackDataPortBatch(e) {
|
|
54
|
-
if (!this._dataPortAcks || !this._dataPort || (this._dataPortConsumedBytes += e, this._dataPortAckedBytes !== 0 && this._dataPortConsumedBytes - this._dataPortAckedBytes < 524288)) return;
|
|
55
|
-
this._dataPortAckedBytes = this._dataPortConsumedBytes;
|
|
56
|
-
let t = {
|
|
57
|
-
type: i,
|
|
58
|
-
consumedBytes: this._dataPortConsumedBytes
|
|
59
|
-
};
|
|
60
|
-
this._dataPort.postMessage(t);
|
|
61
|
-
}
|
|
62
|
-
_onTransportClosed(e) {
|
|
63
|
-
this._destroyed || (this._destroyed = !0, this._busyRelease?.(), this._dataPort?.close(), this._dataPort = void 0, this.listenerCount("error") > 0 && this.emit("error", Error(e || "WebVPN session closed")), this.emit("close"));
|
|
64
|
-
}
|
|
65
|
-
_onDataPortBatch(e) {
|
|
66
|
-
let t = new DataView(e), n = !1, r, i = 0;
|
|
67
|
-
for (; i + 4 <= e.byteLength;) {
|
|
68
|
-
let a = t.getUint32(i);
|
|
69
|
-
i += 4;
|
|
70
|
-
let o = i + a;
|
|
71
|
-
if (o > e.byteLength) break;
|
|
72
|
-
let c = i + 4, l = t.getUint8(c);
|
|
73
|
-
c += 1;
|
|
74
|
-
let u, d, f;
|
|
75
|
-
if (l === 2) {
|
|
76
|
-
if (!this._remoteAddress) {
|
|
77
|
-
i = o;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
u = this._remoteAddress.address, d = this._remoteAddress.family, f = this._remoteAddress.port;
|
|
81
|
-
} else {
|
|
82
|
-
let n = new Uint8Array(e, c, l === 0 ? 4 : 16);
|
|
83
|
-
l === 0 ? (d = "IPv4", u = `${n[0]}.${n[1]}.${n[2]}.${n[3]}`) : (d = "IPv6", u = g(n)), c += n.byteLength, f = t.getUint16(c), c += 2;
|
|
84
|
-
}
|
|
85
|
-
let p = t.getUint32(c);
|
|
86
|
-
c += 4;
|
|
87
|
-
try {
|
|
88
|
-
this.emit("message", s.from(e.slice(c, c + p)), {
|
|
89
|
-
address: u,
|
|
90
|
-
family: d,
|
|
91
|
-
port: f,
|
|
92
|
-
size: p
|
|
93
|
-
});
|
|
94
|
-
} catch (e) {
|
|
95
|
-
n || (n = !0, r = e);
|
|
96
|
-
}
|
|
97
|
-
i = o;
|
|
98
|
-
}
|
|
99
|
-
if (n) throw r;
|
|
100
|
-
}
|
|
101
|
-
_peerTail(e, t) {
|
|
102
|
-
if (e === void 0 || t === void 0) return p;
|
|
103
|
-
let n = `${e}|${t}`, r = this._peerTailCache.get(n);
|
|
104
|
-
if (r) return r;
|
|
105
|
-
let i = l.isValid(e) ? h(e) : _(e), a = new Uint8Array(1 + i.byteLength + 2);
|
|
106
|
-
return a[0] = i.byteLength === 4 ? 0 : 1, a.set(i, 1), new DataView(a.buffer).setUint16(1 + i.byteLength, t), this._peerTailCache.size >= 4096 && this._peerTailCache.clear(), this._peerTailCache.set(n, a), a;
|
|
107
|
-
}
|
|
108
|
-
_portSend(e, t, n) {
|
|
109
|
-
let r = this._peerTail(t, n), i = new Uint8Array(8 + r.byteLength + 4 + e.byteLength), a = new DataView(i.buffer);
|
|
110
|
-
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(() => {
|
|
111
|
-
this._sendFlushScheduled = !1;
|
|
112
|
-
let e = this._sendQueue, t = this._sendQueueBytes;
|
|
113
|
-
if (this._sendQueue = [], this._sendQueueBytes = 0, !e.length || !this._dataPort) return;
|
|
114
|
-
let n = new Uint8Array(t), r = 0;
|
|
115
|
-
for (let t of e) n.set(t, r), r += t.byteLength;
|
|
116
|
-
this._dataPort.postMessage(n.buffer, [n.buffer]);
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
addMembership(e, t) {
|
|
120
|
-
if (l.isValid(e)) {
|
|
121
|
-
let n = h(e), r = t && l.isValid(t) ? h(t) : new Uint8Array([
|
|
122
|
-
0,
|
|
123
|
-
0,
|
|
124
|
-
0,
|
|
125
|
-
0
|
|
126
|
-
]);
|
|
127
|
-
this._setUdpOption({
|
|
128
|
-
type: 5,
|
|
129
|
-
group: n,
|
|
130
|
-
interface: r
|
|
131
|
-
});
|
|
132
|
-
} else if (u.isValid(e)) {
|
|
133
|
-
let t = _(e);
|
|
134
|
-
this._setUdpOption({
|
|
135
|
-
type: 7,
|
|
136
|
-
group: t,
|
|
137
|
-
ifIndex: 0
|
|
138
|
-
});
|
|
139
|
-
} else this.emit("error", /* @__PURE__ */ Error(`Invalid multicast address: ${e}`));
|
|
140
|
-
}
|
|
141
|
-
address() {
|
|
142
|
-
if (!this._localAddress) throw Error("EBADF");
|
|
143
|
-
return this._localAddress;
|
|
144
|
-
}
|
|
145
|
-
bind(...e) {
|
|
146
|
-
let n = a(...e), r = this._type === "udp6" ? "::" : "0.0.0.0", i = this.__webvpn_udp_socket_init__(t.then((e) => e.cloud.webvpn.udpSocket({
|
|
147
|
-
type: this._type,
|
|
148
|
-
address: n.address ?? r,
|
|
149
|
-
port: n.port,
|
|
150
|
-
dataPort: !0
|
|
151
|
-
})));
|
|
152
|
-
return n.callback && i.then((e) => {
|
|
153
|
-
e && n.callback.call(this);
|
|
154
|
-
}), this;
|
|
155
|
-
}
|
|
156
|
-
__webvpn_udp_socket_init__(e, t) {
|
|
157
|
-
return t && (this._localAddress = {
|
|
158
|
-
address: t.localAddress,
|
|
159
|
-
family: t.localFamily,
|
|
160
|
-
port: t.localPort
|
|
161
|
-
}), this._busyRelease ??= n("udp socket"), this._webVPNUdpSocketPromise = e.then((e) => {
|
|
162
|
-
if (e.dataPort) this._socketId = e.socketId, this._dataPort = e.dataPort, this._dataPortAcks = e.dataPortAcks === !0, this._dataPort.onmessage = (e) => {
|
|
163
|
-
try {
|
|
164
|
-
this._onDataPortBatch(e.data);
|
|
165
|
-
} finally {
|
|
166
|
-
this._ackDataPortBatch(e.data.byteLength);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
else {
|
|
170
|
-
let t = e.dataReadableStream.getReader();
|
|
171
|
-
(async () => {
|
|
172
|
-
for (;;) {
|
|
173
|
-
let { value: e, done: n } = await t.read();
|
|
174
|
-
if (n) return;
|
|
175
|
-
this.emit("message", s.from(e.data), {
|
|
176
|
-
address: e.address,
|
|
177
|
-
family: e.family,
|
|
178
|
-
port: e.port,
|
|
179
|
-
size: e.size
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
})().catch((e) => this._onTransportClosed(e instanceof Error ? e.message : void 0));
|
|
183
|
-
}
|
|
184
|
-
return e.closed?.then((e) => this._onTransportClosed(e?.reason)).catch(() => {}), this._localAddress = {
|
|
185
|
-
address: e.localAddress,
|
|
186
|
-
family: e.localFamily,
|
|
187
|
-
port: e.localPort
|
|
188
|
-
}, e;
|
|
189
|
-
}).catch((e) => {
|
|
190
|
-
this.emit("error", e);
|
|
191
|
-
}), this._webVPNUdpSocketPromise.then((e) => {
|
|
192
|
-
if (!e) {
|
|
193
|
-
this._busyRelease?.();
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
this.emit("listening");
|
|
197
|
-
}), this._webVPNUdpSocketPromise;
|
|
198
|
-
}
|
|
199
|
-
close(e) {
|
|
200
|
-
if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
|
|
201
|
-
return this._webVPNUdpSocketPromise.then(async (t) => {
|
|
202
|
-
if (!t) throw Error("Socket not bound");
|
|
203
|
-
let n = this._destroyed;
|
|
204
|
-
this._destroyed = !0, this._busyRelease?.(), this._dataPort?.close(), this._dataPort = void 0;
|
|
205
|
-
try {
|
|
206
|
-
await t.close();
|
|
207
|
-
} finally {
|
|
208
|
-
try {
|
|
209
|
-
e && e();
|
|
210
|
-
} finally {
|
|
211
|
-
n || this.emit("close");
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}).catch(() => {}), this;
|
|
215
|
-
}
|
|
216
|
-
connect(...e) {
|
|
217
|
-
if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
|
|
218
|
-
this._webVPNUdpSocketPromise.then(async (t) => {
|
|
219
|
-
if (!t) throw Error("Socket not bound");
|
|
220
|
-
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({
|
|
221
|
-
remotePort: n,
|
|
222
|
-
remoteAddress: i
|
|
223
|
-
});
|
|
224
|
-
this._connectedLocally = o?.local === !0, this._remoteAddress = o?.address ? {
|
|
225
|
-
address: o.address,
|
|
226
|
-
family: o.family,
|
|
227
|
-
port: o.port
|
|
228
|
-
} : {
|
|
229
|
-
address: i,
|
|
230
|
-
family: this._type === "udp6" ? "IPv6" : "IPv4",
|
|
231
|
-
port: n
|
|
232
|
-
}, this._connectGeneration += 1, a && a();
|
|
233
|
-
}).catch((e) => {
|
|
234
|
-
this.emit("error", e);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
disconnect() {
|
|
238
|
-
if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
|
|
239
|
-
if (!this._remoteAddress) throw Error("ERR_SOCKET_DGRAM_NOT_CONNECTED");
|
|
240
|
-
let e = this._remoteAddress, t = this._connectedLocally, n = this._connectGeneration;
|
|
241
|
-
this._remoteAddress = void 0, this._connectedLocally = void 0, this._webVPNUdpSocketPromise.then((e) => e?.disconnect?.()).catch((r) => {
|
|
242
|
-
this._connectGeneration === n && (this._remoteAddress = e, this._connectedLocally = t), this.emit("error", r);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
dropMembership(e, t) {
|
|
246
|
-
if (l.isValid(e)) {
|
|
247
|
-
let n = h(e), r = t && l.isValid(t) ? h(t) : new Uint8Array([
|
|
248
|
-
0,
|
|
249
|
-
0,
|
|
250
|
-
0,
|
|
251
|
-
0
|
|
252
|
-
]);
|
|
253
|
-
this._setUdpOption({
|
|
254
|
-
type: 6,
|
|
255
|
-
group: n,
|
|
256
|
-
interface: r
|
|
257
|
-
});
|
|
258
|
-
} else if (u.isValid(e)) {
|
|
259
|
-
let t = _(e);
|
|
260
|
-
this._setUdpOption({
|
|
261
|
-
type: 8,
|
|
262
|
-
group: t,
|
|
263
|
-
ifIndex: 0
|
|
264
|
-
});
|
|
265
|
-
} else this.emit("error", /* @__PURE__ */ Error(`Invalid multicast address: ${e}`));
|
|
266
|
-
}
|
|
267
|
-
getRecvBufferSize() {
|
|
268
|
-
return this._lastRecvBufferSize;
|
|
269
|
-
}
|
|
270
|
-
getSendBufferSize() {
|
|
271
|
-
return this._lastSendBufferSize;
|
|
272
|
-
}
|
|
273
|
-
getSendQueueSize() {
|
|
274
|
-
return 0;
|
|
275
|
-
}
|
|
276
|
-
getSendQueueCount() {
|
|
277
|
-
return 0;
|
|
278
|
-
}
|
|
279
|
-
ref() {
|
|
280
|
-
return this;
|
|
281
|
-
}
|
|
282
|
-
remoteAddress() {
|
|
283
|
-
if (!this._remoteAddress) throw Error("ERR_SOCKET_DGRAM_NOT_CONNECTED");
|
|
284
|
-
return {
|
|
285
|
-
address: this._remoteAddress.address,
|
|
286
|
-
family: this._remoteAddress.family,
|
|
287
|
-
port: this._remoteAddress.port
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
send(...e) {
|
|
291
|
-
this._webVPNUdpSocketPromise || this.bind();
|
|
292
|
-
let t = o(...e), n = m(t.message), r = n;
|
|
293
|
-
if (t.hasRange) {
|
|
294
|
-
let { offset: e, length: i } = t;
|
|
295
|
-
if (!Number.isInteger(e) || e < 0 || e > n.byteLength) throw Object.assign(/* @__PURE__ */ RangeError("\"offset\" is outside of buffer bounds"), { code: "ERR_BUFFER_OUT_OF_BOUNDS" });
|
|
296
|
-
if (!Number.isInteger(i) || i < 0 || i > n.byteLength - e) throw Object.assign(/* @__PURE__ */ RangeError("\"length\" is outside of buffer bounds"), { code: "ERR_BUFFER_OUT_OF_BOUNDS" });
|
|
297
|
-
r = n.subarray(e, e + i);
|
|
298
|
-
}
|
|
299
|
-
let i = this._type === "udp6" ? "::1" : "127.0.0.1";
|
|
300
|
-
if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
|
|
301
|
-
this._webVPNUdpSocketPromise.then((e) => {
|
|
302
|
-
if (!e) throw Error("Socket not bound");
|
|
303
|
-
let n = t.callback, a = t.address ?? i, o = this._remoteAddress !== void 0 && t.address === void 0;
|
|
304
|
-
if (this._dataPort && (o || l.isValid(a) || u.isValid(a))) {
|
|
305
|
-
this._portSend(r, o ? void 0 : a, o ? void 0 : t.port), n?.call(this, null, r.byteLength);
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
e.send({
|
|
309
|
-
port: t.port,
|
|
310
|
-
address: a,
|
|
311
|
-
message: r.byteOffset === 0 && r.byteLength === r.buffer.byteLength ? r.buffer : r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength)
|
|
312
|
-
}).then(() => n?.call(this, null, r.byteLength), (e) => n ? n.call(this, e, 0) : this.emit("error", e));
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
setBroadcast(e) {
|
|
316
|
-
this._setUdpOption({
|
|
317
|
-
type: 0,
|
|
318
|
-
value: e
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
setMulticastInterface(e) {}
|
|
322
|
-
setMulticastLoopback(e) {
|
|
323
|
-
return this._setUdpOption({
|
|
324
|
-
type: 3,
|
|
325
|
-
value: e
|
|
326
|
-
}), this._setUdpOption({
|
|
327
|
-
type: 4,
|
|
328
|
-
value: e
|
|
329
|
-
}), this._lastMulticastLoopback = e, e;
|
|
330
|
-
}
|
|
331
|
-
setMulticastTTL(e) {
|
|
332
|
-
return this._setUdpOption({
|
|
333
|
-
type: 2,
|
|
334
|
-
value: e
|
|
335
|
-
}), this._lastMulticastTtl = e, e;
|
|
336
|
-
}
|
|
337
|
-
setRecvBufferSize(e) {
|
|
338
|
-
this._setUdpOption({
|
|
339
|
-
type: 10,
|
|
340
|
-
value: e
|
|
341
|
-
}), this._lastRecvBufferSize = e;
|
|
342
|
-
}
|
|
343
|
-
setSendBufferSize(e) {
|
|
344
|
-
this._setUdpOption({
|
|
345
|
-
type: 9,
|
|
346
|
-
value: e
|
|
347
|
-
}), this._lastSendBufferSize = e;
|
|
348
|
-
}
|
|
349
|
-
setTTL(e) {
|
|
350
|
-
return this._setUdpOption({
|
|
351
|
-
type: 1,
|
|
352
|
-
value: e
|
|
353
|
-
}), this._lastTtl = e, e;
|
|
354
|
-
}
|
|
355
|
-
unref() {
|
|
356
|
-
return this;
|
|
357
|
-
}
|
|
358
|
-
addSourceSpecificMembership(e, t, n) {}
|
|
359
|
-
dropSourceSpecificMembership(e, t, n) {}
|
|
360
|
-
async [Symbol.asyncDispose]() {
|
|
361
|
-
await new Promise((e) => {
|
|
362
|
-
this.close(e);
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}, p = new Uint8Array([2]), m = (e) => {
|
|
366
|
-
if (typeof e == "string") return r.encode(e);
|
|
367
|
-
if (e instanceof Uint8Array) return e;
|
|
368
|
-
if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
369
|
-
if (Array.isArray(e)) {
|
|
370
|
-
let t = e.map(m), n = new Uint8Array(t.reduce((e, t) => e + t.byteLength, 0)), r = 0;
|
|
371
|
-
for (let e of t) n.set(e, r), r += e.byteLength;
|
|
372
|
-
return n;
|
|
373
|
-
}
|
|
374
|
-
return new Uint8Array(e);
|
|
375
|
-
}, h = (e) => {
|
|
376
|
-
let t = e.split(".").map((e) => parseInt(e, 10));
|
|
377
|
-
if (t.length !== 4 || t.some((e) => Number.isNaN(e) || e < 0 || e > 255)) throw Error(`Invalid IPv4 address: ${e}`);
|
|
378
|
-
return new Uint8Array(t);
|
|
379
|
-
}, g = (e) => {
|
|
380
|
-
let t = [];
|
|
381
|
-
for (let n = 0; n < 16; n += 2) t.push(e[n] << 8 | e[n + 1]);
|
|
382
|
-
let n = -1, r = 1;
|
|
383
|
-
for (let e = 0; e < 8;) {
|
|
384
|
-
if (t[e] !== 0) {
|
|
385
|
-
e++;
|
|
386
|
-
continue;
|
|
387
|
-
}
|
|
388
|
-
let i = e;
|
|
389
|
-
for (; i < 8 && t[i] === 0;) i++;
|
|
390
|
-
i - e > r && (n = e, r = i - e), e = i;
|
|
391
|
-
}
|
|
392
|
-
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(":")}`;
|
|
393
|
-
}, _ = (e) => {
|
|
394
|
-
let t = new u(e).getBitsBase16(0, 128).match(/.{2}/g);
|
|
395
|
-
if (!t || t.length !== 16) throw Error(`Invalid IPv6 address: ${e}`);
|
|
396
|
-
return new Uint8Array(t.map((e) => parseInt(e, 16)));
|
|
397
|
-
}, v = (e, t) => {
|
|
398
|
-
let n = new f(typeof e == "string" ? { type: e } : e);
|
|
399
|
-
return t && n.on("message", t), n;
|
|
400
|
-
}, y = {
|
|
401
|
-
Socket: f,
|
|
402
|
-
createSocket: v
|
|
403
|
-
};
|
|
404
|
-
//#endregion
|
|
405
|
-
export { d as i, v as n, y as r, f as t };
|
package/extension-B8Y0sUwC.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { A as t, B as n, C as r, D as i, E as a, F as o, H as s, I as c, L as l, M as u, N as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, a as y, b, c as x, d as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./lib-k3lstfa4.js";
|
|
3
|
-
import { t as H } from "./api-Jq4OSTp1.js";
|
|
4
|
-
import { n as U, t as W } from "./proxy-CRbkWS4E.js";
|
|
5
|
-
import { available as G, fetch as K } from "./desktop.js";
|
|
6
|
-
//#region src/lib/extension-prompt.ts
|
|
7
|
-
var q = async (e) => {
|
|
8
|
-
if (typeof window > "u") return !1;
|
|
9
|
-
if (o()) return !0;
|
|
10
|
-
let t = await H, n = null, r = new Promise((e) => {
|
|
11
|
-
n = () => {
|
|
12
|
-
o() && e(!0);
|
|
13
|
-
}, p.addEventListener("statuschange", n);
|
|
14
|
-
}), i = t.installPrompt.show(e).then(() => !1), a = await Promise.race([r, i]);
|
|
15
|
-
return n && p.removeEventListener("statuschange", n), await t.installPrompt.hide().catch(() => {}), a;
|
|
16
|
-
}, J = null;
|
|
17
|
-
c(() => (J ||= q().then(() => void 0).finally(() => {
|
|
18
|
-
J = null;
|
|
19
|
-
}), J));
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/lib/auto.ts
|
|
22
|
-
var Y = () => typeof document < "u" && o(), X = async (e, t) => {
|
|
23
|
-
if (U(e), t?.credentials === "include") {
|
|
24
|
-
if (typeof document > "u") throw Error("fetch with credentials needs the FKN extension, which only exists in window realms");
|
|
25
|
-
return R(e, t);
|
|
26
|
-
}
|
|
27
|
-
return Y() ? R(e, {
|
|
28
|
-
...t,
|
|
29
|
-
credentials: "omit"
|
|
30
|
-
}) : G() ? K(e, t) : W(e, t);
|
|
31
|
-
}, Z = /* @__PURE__ */ e({
|
|
32
|
-
ATTACH_FRAME_EVENT_KEY: () => A,
|
|
33
|
-
FORGEABLE_HEADERS: () => t,
|
|
34
|
-
LOCATOR_DENIED: () => w,
|
|
35
|
-
LOCATOR_ERROR: () => C,
|
|
36
|
-
LOCATOR_UNSUPPORTED: () => k,
|
|
37
|
-
assertAttachableFrameUrl: () => P,
|
|
38
|
-
assertFetchableUrl: () => r,
|
|
39
|
-
assertForgeableHeaders: () => E,
|
|
40
|
-
assertLockdownApplicable: () => x,
|
|
41
|
-
assertOneCookieIdentity: () => u,
|
|
42
|
-
attachFrame: () => N,
|
|
43
|
-
attachFramePermission: () => T,
|
|
44
|
-
available: () => Y,
|
|
45
|
-
box: () => V,
|
|
46
|
-
cookies: () => z,
|
|
47
|
-
createFrame: () => y,
|
|
48
|
-
createVideoElementHandle: () => n,
|
|
49
|
-
events: () => p,
|
|
50
|
-
extension: () => p,
|
|
51
|
-
fetch: () => R,
|
|
52
|
-
fetchCredentialedPermission: () => g,
|
|
53
|
-
fetchLocalPermission: () => a,
|
|
54
|
-
fetchPermission: () => i,
|
|
55
|
-
gotoPermission: () => j,
|
|
56
|
-
handleRevivableModules: () => m,
|
|
57
|
-
hasForgedCookie: () => d,
|
|
58
|
-
isBlockedFetchUrl: () => f,
|
|
59
|
-
isBlockedFrameUrl: () => O,
|
|
60
|
-
isExtensionExposed: () => o,
|
|
61
|
-
isLocalNetworkUrl: () => D,
|
|
62
|
-
isLocatorDenied: () => M,
|
|
63
|
-
isLocatorUnsupported: () => I,
|
|
64
|
-
isTerminalError: () => S,
|
|
65
|
-
isType: () => v,
|
|
66
|
-
modifyRequestHeadersPermission: () => L,
|
|
67
|
-
permissions: () => F,
|
|
68
|
-
promptInstall: () => q,
|
|
69
|
-
readCookiePermission: () => h,
|
|
70
|
-
removeRequestHeaderRule: () => B,
|
|
71
|
-
revive: () => s,
|
|
72
|
-
setMissingExtensionHandler: () => c,
|
|
73
|
-
setRequestHeaderRule: () => b,
|
|
74
|
-
type: () => _,
|
|
75
|
-
waitForExtensionExposure: () => l
|
|
76
|
-
});
|
|
77
|
-
//#endregion
|
|
78
|
-
export { q as i, X as n, Y as r, Z as t };
|
package/extension-CMPZjuaV.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { $ as fetch$1, A as LOCATOR_DENIED, B as SelectorPart, C as RemoteVideoElement, D as isType, E as createVideoElementHandle, F as isTerminalError, G as setRequestHeaderRule, H as RequestHeaderRule, I as Executor, J as cookies, K as CookieDetails, L as Gate, M as LOCATOR_UNSUPPORTED, N as isLocatorDenied, O as revive, P as isLocatorUnsupported, Q as assertFetchableUrl, R as GateTools, S as BoxedVideoElement, T as box, U as modifyRequestHeadersPermission, V as HeaderOperation, W as removeRequestHeaderRule, X as FetchInit, Y as readCookiePermission, Z as ProxyFetchRequest, _ as gotoPermission, a as PermissionGrant, at as FORGEABLE_HEADERS, b as isBlockedFrameUrl, c as ATTACH_FRAME_EVENT_KEY, ct as hasForgedCookie, d as Frame, et as fetchCredentialedPermission, f as FrameBackend, g as createFrame, h as attachFramePermission, i as waitForExtensionExposure, it as isLocalNetworkUrl, j as LOCATOR_ERROR, k as type, l as attachFrame, m as Locator, n as isExtensionExposed, nt as fetchPermission, o as PermissionRequest, ot as assertForgeableHeaders, p as GotoOptions, q as SiteCookie, r as setMissingExtensionHandler, rt as isBlockedFetchUrl, s as permissions, st as assertOneCookieIdentity, t as extension, tt as fetchLocalPermission, u as AttachFrameOptions, v as assertAttachableFrameUrl, w as VideoElementState, x as handleRevivableModules, y as assertLockdownApplicable, z as OperationRequest } from "./index-DY8WjklJ.js";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/extension-prompt.d.ts
|
|
4
|
-
declare const promptInstall: (reason?: string) => Promise<boolean>;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/lib/auto.d.ts
|
|
7
|
-
declare const isExtensionAvailable: () => boolean;
|
|
8
|
-
declare const fetch: (input: RequestInfo | URL, init?: RequestInit & {
|
|
9
|
-
reason?: string;
|
|
10
|
-
render?: boolean;
|
|
11
|
-
}) => Promise<Response>;
|
|
12
|
-
declare namespace extension_d_exports {
|
|
13
|
-
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, Executor, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, Gate, GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, Locator, OperationRequest, PermissionGrant, PermissionRequest, ProxyFetchRequest, RemoteVideoElement, RequestHeaderRule, SelectorPart, SiteCookie, VideoElementState, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch$1 as fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { promptInstall as i, fetch as n, isExtensionAvailable as r, extension_d_exports as t };
|
package/extension-CgSGjcSl.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DbiVHPXE.cjs"),n=require("./api-C-TpWHAU.cjs"),r=require("./proxy-BNdvRifw.cjs"),i=require("./desktop.cjs");var a=async e=>{if(typeof window>`u`)return!1;if(t.F())return!0;let r=await n.t,i=null,a=new Promise(e=>{i=()=>{t.F()&&e(!0)},t.P.addEventListener(`statuschange`,i)}),o=r.installPrompt.show(e).then(()=>!1),s=await Promise.race([a,o]);return i&&t.P.removeEventListener(`statuschange`,i),await r.installPrompt.hide().catch(()=>{}),s},o=null;t.I(()=>(o||=a().then(()=>void 0).finally(()=>{o=null}),o));var s=()=>typeof document<`u`&&t.F(),c=async(e,n)=>{if(r.n(e),n?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return t.w(e,n)}return s()?t.w(e,{...n,credentials:`omit`}):i.available()?i.fetch(e,n):r.t(e,n)},l=e.t({ATTACH_FRAME_EVENT_KEY:()=>t.n,FORGEABLE_HEADERS:()=>t.A,LOCATOR_DENIED:()=>t.h,LOCATOR_ERROR:()=>t.g,LOCATOR_UNSUPPORTED:()=>t.m,assertAttachableFrameUrl:()=>t.s,assertFetchableUrl:()=>t.C,assertForgeableHeaders:()=>t.j,assertLockdownApplicable:()=>t.c,assertOneCookieIdentity:()=>t.M,attachFrame:()=>t.r,attachFramePermission:()=>t.i,available:()=>s,box:()=>t.z,cookies:()=>t.x,createFrame:()=>t.a,createVideoElementHandle:()=>t.B,events:()=>t.P,extension:()=>t.P,fetch:()=>t.w,fetchCredentialedPermission:()=>t.T,fetchLocalPermission:()=>t.E,fetchPermission:()=>t.D,gotoPermission:()=>t.o,handleRevivableModules:()=>t.R,hasForgedCookie:()=>t.N,isBlockedFetchUrl:()=>t.O,isBlockedFrameUrl:()=>t.l,isExtensionExposed:()=>t.F,isLocalNetworkUrl:()=>t.k,isLocatorDenied:()=>t.p,isLocatorUnsupported:()=>t.u,isTerminalError:()=>t.d,isType:()=>t.V,modifyRequestHeadersPermission:()=>t.v,permissions:()=>t.t,promptInstall:()=>a,readCookiePermission:()=>t.S,removeRequestHeaderRule:()=>t.y,revive:()=>t.H,setMissingExtensionHandler:()=>t.I,setRequestHeaderRule:()=>t.b,type:()=>t.U,waitForExtensionExposure:()=>t.L});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
package/fs-BNnozBMU.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./busy-Dv8wzE5M.cjs"),n=require("./node-fs-DZPGCYWg.cjs"),r=require("./storage-xAeRQQiz.cjs"),i=require("./opfs-CXMESVLc.cjs");var a=e.t({adopt:()=>I,adoptable:()=>L,available:()=>u,list:()=>re,onConflict:()=>ce,pending:()=>w,pendingDeletes:()=>ee,pull:()=>se,readFile:()=>ie,remove:()=>oe,replicating:()=>T,writeFile:()=>ae}),o,s=async()=>await(o??=i.t().catch(()=>!1))?!0:(o=void 0,!1),c=()=>r.r().catch(()=>`unknown`),l=async()=>await c()===`connected`,u=async()=>await s()||await l(),d=`fkn:fs:pending`,f=`fkn:fs:pending-delete`,p=`fkn:fs:adopt-declined`,m=!0,h=new Map,g=e=>{try{let t=localStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return Array.isArray(n)?Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,null])):n&&typeof n==`object`?n:{}}catch{return{}}},_=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}catch{}},v=()=>g(d),y=(e,t)=>{let n=v();e in n||(n[e]=t===void 0?h.get(e)??null:t,_(d,n))},b=e=>{let t=v();e in t&&(delete t[e],_(d,t),D()||(k=O))},x=()=>g(f),S=e=>{let t=x();e in t||(t[e]=h.get(e)??null,_(f,t))},C=e=>{let t=x();e in t&&(delete t[e],_(f,t),D()||(k=O))},w=()=>Object.keys(v()),ee=()=>Object.keys(x()),T=()=>m,E=null;t.r(`storage replication`,()=>E!==null||R!==null);var D=()=>Object.keys(v()).length>0||Object.keys(x()).length>0,O=6e4,te=10*6e4,k=O,A=null,j=()=>{A||typeof window>`u`||!D()||(A=setTimeout(()=>{A=null,M()},k),k=Math.min(k*2,te))},M=()=>{E||!D()||(E=F(!1).then(e=>{if(!D()){k=O;return}e.failed.length&&j()}).catch(()=>{j()}).finally(()=>{E=null}))},ne=null,N=()=>ne??=Promise.resolve().then(()=>require("./api-C-TpWHAU.cjs")).then(e=>e.n).then(e=>e.apiPromise),re=async()=>{U();let e=await c(),t=e===`connected`,[n,a]=await Promise.all([s().then(e=>e?i.n():[]).catch(()=>[]),t?r.o().then(e=>({ok:!0,entries:e})).catch(()=>({ok:!1,entries:[]})):Promise.resolve({ok:e===`disconnected`,entries:[]})]);e!==`unknown`&&(m=a.ok),a.ok&&e!==`unknown`&&(h=new Map(a.entries.map(e=>[e.path,e.updatedAt])));let o=new Map,l=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},u=e=>{let t=o.get(e.path);(!t||l(e)>=l(t))&&o.set(e.path,e)};for(let e of n)u(e);for(let e of a.entries)u(e);return a.ok&&t&&(pe(n,a.entries).catch(()=>{}),D()?M():z({local:n,remote:a.entries}).catch(()=>{})),[...o.values()]},ie=async e=>{if(await s())try{return await i.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let t=await r.c(e);return await s()&&i.o(e,t).catch(()=>{}),t},ae=async(e,t,n)=>{let a=t instanceof Blob?t:new Blob([t],n?.contentType?{type:n.contentType}:void 0);if(await s()){await i.o(e,a,n),U();let t=h.get(e)??null,o=await c();if(o===`disconnected`)return;if(o===`unknown`||!m){y(e,t),j();return}r.f(e,a,n).then(()=>b(e)).catch(n=>{y(e,t),j(),console.warn(`fs: cloud replicate failed, queued for adopt()`,n)});return}let o=await c();if(o===`connected`)return r.f(e,a,n);throw Error(o===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`)},oe=async e=>{U();let t=[];await s()&&t.push(i.a(e).catch(()=>{}));let n=await c();if(n===`connected`?t.push(r.l(e).then(()=>C(e)).catch(t=>{S(e),j(),console.warn(`fs: cloud delete failed, queued for retry`,t)})):n===`unknown`&&t.length&&h.has(e)&&(S(e),j()),!t.length)throw Error(n===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`);b(e),await Promise.all(t)},se=async e=>{let t=await r.c(e);return await s()&&await i.o(e,t),t},P=null,ce=e=>(P=e,()=>{P===e&&(P=null)}),le=async e=>(await N()).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null),ue=async e=>{if(P)try{return await P(e)}catch{return null}return le(e)},F=async e=>{let t={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]},n=await c();if(n===`unknown`)throw Error(`fs: cloud unreachable`);if(n!==`connected`)throw Error(`fs: this needs a signed-in account`);let a=await s(),[o,l]=await Promise.all([a?i.n():Promise.resolve([]),r.o()]),u=new Map(l.map(e=>[e.path,e])),d=v();if(a)for(let e of Object.keys(d))o.some(t=>t.path===e)||b(e);for(let[e,n]of Object.entries(x())){let i=u.get(e);if(!i){C(e);continue}if(o.some(t=>t.path===e)){C(e);continue}if(i.updatedAt!==n){C(e);continue}try{await r.l(e),C(e),t.deleted.push(e)}catch(n){t.failed.push({path:e,error:n instanceof Error?n.message:String(n)})}}for(let n of o){let a=u.get(n.path),o=n.path in d;if(!o&&(a||!e)){a&&t.kept.push(n.path);continue}if(o&&a&&a.updatedAt!==d[n.path]){let e=await ue({path:n.path,local:{size:n.size,updatedAt:n.updatedAt},cloud:{size:a.size,updatedAt:a.updatedAt},readLocal:()=>i.i(n.path),readCloud:()=>r.c(n.path)});if(!e){t.unresolved.push(n.path);continue}try{if(e===`cloud`)await i.o(n.path,await r.c(n.path));else{let t=e===`local`?await i.i(n.path):e.merged;await r.f(n.path,t,n.contentType?{contentType:n.contentType}:void 0),e!==`local`&&await i.o(n.path,t)}b(n.path),t.resolved.push({path:n.path,choice:e===`local`||e===`cloud`?e:`merged`})}catch(e){if(e?.code===`FKN_E2E_LOCKED`)throw e;t.failed.push({path:n.path,error:e instanceof Error?e.message:String(e)})}continue}try{let e=await i.i(n.path);await r.f(n.path,e,n.contentType?{contentType:n.contentType}:void 0),b(n.path),t.uploaded.push(n.path)}catch(e){if(y(n.path),e?.code===`FKN_E2E_LOCKED`)throw e;t.failed.push({path:n.path,error:e instanceof Error?e.message:String(e)})}}return t},I=async()=>{for(;E;)await E;let e=F(!0);E=e.then(()=>{},()=>{});try{return await e}finally{E=null}},L=async()=>{if(!await l()||!await s())return{paths:[],bytes:0};let[e,t]=await Promise.all([i.n(),r.o()]),n=new Set(t.map(e=>e.path)),a=e.filter(e=>!n.has(e.path));return{paths:a.map(e=>e.path),bytes:a.reduce((e,t)=>e+t.size,0)}},de=()=>new Set(Object.keys(g(p))),fe=e=>{let t=g(p);for(let n of e)t[n]=null;_(p,t)},R=null,z=e=>R||(R=(async()=>{if(!await l())return;let t=e??(await s()?{local:await i.n(),remote:await r.o()}:null);if(!t)return;let n=new Set(t.remote.map(e=>e.path)),a=de(),o=t.local.filter(e=>!n.has(e.path)&&!a.has(e.path));if(!o.length)return;let c=await N(),u=o.reduce((e,t)=>e+t.size,0);if(!await c.cloud.fs.promptAdopt({files:o.length,bytes:u}).catch(()=>!1)){fe(o.map(e=>e.path));return}await I()})().catch(()=>{}).finally(()=>{R=null}),R),B=null,V=!1,pe=async(e,t)=>{let n=new Set(t.map(e=>e.path)),r=e.filter(e=>!n.has(e.path)),i=await N(),a=async()=>{await I().catch(()=>{});let e=await L().catch(()=>({paths:[],bytes:0}));await i.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},a).catch(()=>{})},o={files:r.length,bytes:r.reduce((e,t)=>e+t.size,0)};B=()=>{i.cloud.fs.setAdoptSource(o,a).catch(()=>{})},V||(V=!0,Promise.resolve().then(()=>require("./api-C-TpWHAU.cjs")).then(e=>e.n).then(e=>e.onApiEpoch((e,t)=>{t>1&&B?.()})).catch(()=>{})),await i.cloud.fs.setAdoptSource(o,a)},H=!1,U=()=>{H||typeof window>`u`||(H=!0,window.addEventListener(`online`,()=>{M()}),Promise.resolve().then(()=>require("./account.cjs")).then(e=>e.onChange(()=>{z().catch(()=>{}),M()})).catch(()=>{}))},me=e.t({adopt:()=>q,adoptable:()=>J,appendFile:()=>ke,appendFileSync:()=>ve,available:()=>he,default:()=>$,exists:()=>Ie,existsSync:()=>ye,flush:()=>ze,lstatSync:()=>xe,mkdir:()=>Me,mkdirSync:()=>Se,mount:()=>Re,onConflict:()=>Q,pending:()=>Y,pendingDeletes:()=>X,promises:()=>Le,pull:()=>K,readFile:()=>De,readFileSync:()=>ge,readdir:()=>je,readdirSync:()=>G,remount:()=>Be,rename:()=>Fe,renameSync:()=>Ee,replicating:()=>Z,rm:()=>Ne,rmSync:()=>Ce,rmdirSync:()=>we,stat:()=>Ae,statSync:()=>be,unlink:()=>Pe,unlinkSync:()=>Te,writeFile:()=>Oe,writeFileSync:()=>_e}),W=n.t(a,{memfs:!0}),{available:he,readFileSync:ge,writeFileSync:_e,appendFileSync:ve,existsSync:ye,statSync:be,lstatSync:xe,readdirSync:G,mkdirSync:Se,rmSync:Ce,rmdirSync:we,unlinkSync:Te,renameSync:Ee,readFile:De,writeFile:Oe,appendFile:ke,stat:Ae,readdir:je,mkdir:Me,rm:Ne,unlink:Pe,rename:Fe,exists:Ie,promises:Le,mount:Re,flush:ze,remount:Be}=W,K=se,q=I,J=L,Y=w,X=ee,Z=T,Q=ce,$={...W,pull:K,adopt:q,adoptable:J,pending:Y,pendingDeletes:X,replicating:Z,onConflict:Q};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return K}});
|