@fkn/lib 0.4.7 → 0.4.8
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/{background-DLyTYBpc.cjs → background-BqRFQggD.cjs} +1 -1
- package/{background-CaMv-fCT.js → background-CTsVv_a0.js} +52 -27
- package/favicon.svg +5 -0
- package/index.cjs +6 -6
- package/index.d.ts +29 -6
- package/index.js +252 -230
- package/{locator-DpDoiZSP.cjs → locator-Cjl21Nkt.cjs} +1 -1
- package/{locator-CzKO_aEl.js → locator-Q5m8i40Z.js} +1 -1
- package/package.json +2 -7
- package/connect-button-Ng6Rf4-Y.cjs +0 -1
- package/connect-button-yKMuFxR9.js +0 -4
- package/react.cjs +0 -1
- package/react.d.ts +0 -10
- package/react.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./locator-DpDoiZSP.cjs`);let t=require(`osra`);var n=e.h(((e,t)=>{(function(n,r){if(typeof define==`function`&&define.amd)define(`webextension-polyfill`,[`module`],r);else if(e!==void 0)r(t);else{var i={exports:{}};r(i),n.browser=i.exports}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:e,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw Error(`This script should only be loaded in a browser extension.`);globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id?e.exports=globalThis.browser:e.exports=(e=>{let t={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(t).length===0)throw Error(`api-metadata.json has not been included in browser-polyfill`);class n extends WeakMap{constructor(e,t=void 0){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}let r=e=>e&&typeof e==`object`&&typeof e.then==`function`,i=(t,n)=>(...r)=>{e.runtime.lastError?t.reject(Error(e.runtime.lastError.message)):n.singleCallbackArg||r.length<=1&&n.singleCallbackArg!==!1?t.resolve(r[0]):t.resolve(r)},a=e=>e==1?`argument`:`arguments`,o=(e,t)=>function(n,...r){if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((a,o)=>{if(t.fallbackToNoCallback)try{n[e](...r,i({resolve:a,reject:o},t))}catch(i){console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,i),n[e](...r),t.fallbackToNoCallback=!1,t.noCallback=!0,a()}else t.noCallback?(n[e](...r),a()):n[e](...r,i({resolve:a,reject:o},t))})},s=(e,t,n)=>new Proxy(t,{apply(t,r,i){return n.call(r,e,...i)}}),c=Function.call.bind(Object.prototype.hasOwnProperty),l=(e,t={},n={})=>{let r=Object.create(null);return new Proxy(Object.create(e),{has(t,n){return n in e||n in r},get(i,a,u){if(a in r)return r[a];if(!(a in e))return;let d=e[a];if(typeof d==`function`)if(typeof t[a]==`function`)d=s(e,e[a],t[a]);else if(c(n,a)){let t=o(a,n[a]);d=s(e,e[a],t)}else d=d.bind(e);else if(typeof d==`object`&&d&&(c(t,a)||c(n,a)))d=l(d,t[a],n[a]);else if(c(n,`*`))d=l(d,t[a],n[`*`]);else return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return e[a]},set(t){e[a]=t}}),d;return r[a]=d,d},set(t,n,i,a){return n in r?r[n]=i:e[n]=i,!0},defineProperty(e,t,n){return Reflect.defineProperty(r,t,n)},deleteProperty(e,t){return Reflect.deleteProperty(r,t)}})},u=e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener(t,n){return t.hasListener(e.get(n))},removeListener(t,n){t.removeListener(e.get(n))}}),d=new n(e=>typeof e==`function`?function(t){e(l(t,{},{getContent:{minArgs:0,maxArgs:0}}))}:e),f=new n(e=>typeof e==`function`?function(t,n,i){let a=!1,o,s=new Promise(e=>{o=function(t){a=!0,e(t)}}),c;try{c=e(t,n,o)}catch(e){c=Promise.reject(e)}let l=c!==!0&&r(c);return c!==!0&&!l&&!a?!1:((e=>{e.then(e=>{i(e)},e=>{let t;t=e&&(e instanceof Error||typeof e.message==`string`)?e.message:`An unexpected error occurred`,i({__mozWebExtensionPolyfillReject__:!0,message:t})}).catch(e=>{console.error(`Failed to send onMessage rejected reply`,e)})})(l?c:s),!0)}:e),p=({reject:t,resolve:n},r)=>{e.runtime.lastError?e.runtime.lastError.message===`The message port closed before a response was received.`?n():t(Error(e.runtime.lastError.message)):r&&r.__mozWebExtensionPolyfillReject__?t(Error(r.message)):n(r)},m=(e,t,n,...r)=>{if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((e,t)=>{let i=p.bind(null,{resolve:e,reject:t});r.push(i),n.sendMessage(...r)})},h={devtools:{network:{onRequestFinished:u(d)}},runtime:{onMessage:u(f),onMessageExternal:u(f),sendMessage:m.bind(null,`sendMessage`,{minArgs:1,maxArgs:3})},tabs:{sendMessage:m.bind(null,`sendMessage`,{minArgs:2,maxArgs:3})}},g={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return t.privacy={network:{"*":g},services:{"*":g},websites:{"*":g}},l(e,h,t)})(chrome)})}))(),r=`FKN_WEB_EXTENSION_BACKGROUND_COMMUNICATION_OSRA_KEY`,i=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`,a=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY`,o=t=>e.c(t)&&t.FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY===!0&&typeof t.from==`string`&&e.c(t.message),s=new Map,c=r=>{let o=s.get(r);if(o)return o;let{promise:c,resolve:l}=Promise.withResolvers(),{promise:u,resolve:d}=Promise.withResolvers(),f={resolvers:(0,t.expose)(D,{key:i,revivableModules:e.l,transport:{isJson:!0,receive:e=>l(e),emit:e=>{n.runtime.sendMessage({[a]:!0,target:r,message:e}).catch(()=>{})}}}),listener:c,stale:u,markStale:d};return s.set(r,f),f};n.runtime.onMessage.addListener((e,n)=>{o(e)&&(0,t.checkOsraMessageKey)(e.message,`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`)&&c(e.from).listener.then(t=>t(e.message,{sender:n}))}),e.s(e=>{let t=s.get(e);t&&(t.markStale(),s.delete(e))});var l=async e=>{let t=c(e);return{resolvers:await Promise.race([t.resolvers,t.stale.then(()=>{throw Error(`peer ${e} became stale before connect completed`)})]),stale:t.stale}},u=[`position: fixed`,`border: 2px solid oklch(63% 0.24 25)`,`border-radius: 4px`,`background: oklch(63% 0.24 25 / 0.12)`,`box-shadow: 0 0 0 2px oklch(63% 0.24 25 / 0.5), 0 0 0 100vmax oklch(0% 0 0 / 0.5)`,`z-index: 2147483647`,`pointer-events: none`,`box-sizing: border-box`],d=(e,t)=>{let n=t.getBoundingClientRect();e.setAttribute(`style`,[...u,`left: ${n.left}px`,`top: ${n.top}px`,`width: ${n.width}px`,`height: ${n.height}px`].map(e=>`${e} !important`).join(`; `))},f=e=>{let t=e.getBoundingClientRect();return{clientX:t.left+t.width/2,clientY:t.top+t.height/2}},p=0,m=e=>{p^=1;let{clientX:t,clientY:n}=f(e),r={bubbles:!0,cancelable:!0,composed:!0,clientX:t+p,clientY:n};e.dispatchEvent(new PointerEvent(`pointermove`,{...r,pointerType:`mouse`,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent(`mousemove`,r))},h=[[PointerEvent,`pointerover`,!0],[PointerEvent,`pointerenter`,!1],[MouseEvent,`mouseover`,!0],[MouseEvent,`mouseenter`,!1]],g=[[PointerEvent,`pointerout`,!0],[PointerEvent,`pointerleave`,!1],[MouseEvent,`mouseout`,!0],[MouseEvent,`mouseleave`,!1]],_=(e,t)=>t.forEach(([t,n,r])=>e.dispatchEvent(new t(n,{bubbles:r,cancelable:!0,composed:!0,...f(e)}))),v=e=>{_(e,h),m(e)},y=e=>_(e,g),b=null,x=e=>{S();try{e.scrollIntoView({block:`center`,inline:`center`})}catch{}let t=document.createElement(`div`);(document.body??document.documentElement).appendChild(t),v(e);let n=requestAnimationFrame(function r(){d(t,e),n=requestAnimationFrame(r)}),r=window.setInterval(()=>m(e),300);b={stop:()=>{cancelAnimationFrame(n),clearInterval(r),y(e),t.remove()}}},S=()=>{b?.stop(),b=null},C={[e.n]:e.t,[e.a]:e.i},w=e=>{let t=C[e.locatorType];if(!t)throw Error(`Unknown locator kind: "${e.locatorType}"`);let n=t.selectorModules.find(t=>t.type===e.type);if(!n)throw Error(`Unknown selector: "${e.locatorType}.${e.type}"`);return n},T=e=>e.reduce((e,t)=>w(t).resolve({elements:e},...t.args),[document.documentElement]),E=e=>{for(let t=0;t<e.length;t++){let n=w(e[t]);if(n.resolvePeer)return{module:n,index:t}}return null},D={contentScriptDummy:()=>{},executeLocator:async(t,n,r)=>{let i=E(t);if(i){let e=await i.module.resolvePeer({parts:t,selfIndex:i.index,resolveLocal:T}),{resolvers:a,stale:o}=await l(e),s=t.slice(i.index+1);return Promise.race([a.executeLocator(s,n,r),o.then(()=>{throw Error(`peer ${e} became stale during call, retrying`)})])}if(n===`__fkn_highlight`){if(r[0]?.on){let n=T(t)[0];n&&(e.o(!0),x(n))}else S(),e.o(!1);return}let a=[...e.t.operationModules,...e.i.operationModules].find(e=>e.type===n);if(!a)throw Error(`Unknown operation: "${n}"`);return a.resolve({elements:T(t)},...r)}},O=(0,t.expose)(D,{key:r,transport:{isJson:!0,receive:n.runtime.onMessage,emit:n.runtime}});exports.backgroundResolvers=O;
|
|
1
|
+
const e=require(`./locator-Cjl21Nkt.cjs`);let t=require(`osra`);var n=e.h(((e,t)=>{(function(n,r){if(typeof define==`function`&&define.amd)define(`webextension-polyfill`,[`module`],r);else if(e!==void 0)r(t);else{var i={exports:{}};r(i),n.browser=i.exports}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:e,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw Error(`This script should only be loaded in a browser extension.`);globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id?e.exports=globalThis.browser:e.exports=(e=>{let t={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(t).length===0)throw Error(`api-metadata.json has not been included in browser-polyfill`);class n extends WeakMap{constructor(e,t=void 0){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}let r=e=>e&&typeof e==`object`&&typeof e.then==`function`,i=(t,n)=>(...r)=>{e.runtime.lastError?t.reject(Error(e.runtime.lastError.message)):n.singleCallbackArg||r.length<=1&&n.singleCallbackArg!==!1?t.resolve(r[0]):t.resolve(r)},a=e=>e==1?`argument`:`arguments`,o=(e,t)=>function(n,...r){if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((a,o)=>{if(t.fallbackToNoCallback)try{n[e](...r,i({resolve:a,reject:o},t))}catch(i){console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,i),n[e](...r),t.fallbackToNoCallback=!1,t.noCallback=!0,a()}else t.noCallback?(n[e](...r),a()):n[e](...r,i({resolve:a,reject:o},t))})},s=(e,t,n)=>new Proxy(t,{apply(t,r,i){return n.call(r,e,...i)}}),c=Function.call.bind(Object.prototype.hasOwnProperty),l=(e,t={},n={})=>{let r=Object.create(null);return new Proxy(Object.create(e),{has(t,n){return n in e||n in r},get(i,a,u){if(a in r)return r[a];if(!(a in e))return;let d=e[a];if(typeof d==`function`)if(typeof t[a]==`function`)d=s(e,e[a],t[a]);else if(c(n,a)){let t=o(a,n[a]);d=s(e,e[a],t)}else d=d.bind(e);else if(typeof d==`object`&&d&&(c(t,a)||c(n,a)))d=l(d,t[a],n[a]);else if(c(n,`*`))d=l(d,t[a],n[`*`]);else return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return e[a]},set(t){e[a]=t}}),d;return r[a]=d,d},set(t,n,i,a){return n in r?r[n]=i:e[n]=i,!0},defineProperty(e,t,n){return Reflect.defineProperty(r,t,n)},deleteProperty(e,t){return Reflect.deleteProperty(r,t)}})},u=e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener(t,n){return t.hasListener(e.get(n))},removeListener(t,n){t.removeListener(e.get(n))}}),d=new n(e=>typeof e==`function`?function(t){e(l(t,{},{getContent:{minArgs:0,maxArgs:0}}))}:e),f=new n(e=>typeof e==`function`?function(t,n,i){let a=!1,o,s=new Promise(e=>{o=function(t){a=!0,e(t)}}),c;try{c=e(t,n,o)}catch(e){c=Promise.reject(e)}let l=c!==!0&&r(c);return c!==!0&&!l&&!a?!1:((e=>{e.then(e=>{i(e)},e=>{let t;t=e&&(e instanceof Error||typeof e.message==`string`)?e.message:`An unexpected error occurred`,i({__mozWebExtensionPolyfillReject__:!0,message:t})}).catch(e=>{console.error(`Failed to send onMessage rejected reply`,e)})})(l?c:s),!0)}:e),p=({reject:t,resolve:n},r)=>{e.runtime.lastError?e.runtime.lastError.message===`The message port closed before a response was received.`?n():t(Error(e.runtime.lastError.message)):r&&r.__mozWebExtensionPolyfillReject__?t(Error(r.message)):n(r)},m=(e,t,n,...r)=>{if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((e,t)=>{let i=p.bind(null,{resolve:e,reject:t});r.push(i),n.sendMessage(...r)})},h={devtools:{network:{onRequestFinished:u(d)}},runtime:{onMessage:u(f),onMessageExternal:u(f),sendMessage:m.bind(null,`sendMessage`,{minArgs:1,maxArgs:3})},tabs:{sendMessage:m.bind(null,`sendMessage`,{minArgs:2,maxArgs:3})}},g={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return t.privacy={network:{"*":g},services:{"*":g},websites:{"*":g}},l(e,h,t)})(chrome)})}))(),r=`FKN_WEB_EXTENSION_BACKGROUND_COMMUNICATION_OSRA_KEY`,i=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`,a=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY`,o=t=>e.c(t)&&t.FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY===!0&&typeof t.from==`string`&&e.c(t.message),s=new Map,c=r=>{let o=s.get(r);if(o)return o;let{promise:c,resolve:l}=Promise.withResolvers(),{promise:u,resolve:d}=Promise.withResolvers(),f={resolvers:(0,t.expose)(M,{key:i,revivableModules:e.l,transport:{isJson:!0,receive:e=>l(e),emit:e=>{n.runtime.sendMessage({[a]:!0,target:r,message:e}).catch(()=>{})}}}),listener:c,stale:u,markStale:d};return s.set(r,f),f};n.runtime.onMessage.addListener((e,n)=>{o(e)&&(0,t.checkOsraMessageKey)(e.message,`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`)&&c(e.from).listener.then(t=>t(e.message,{sender:n}))}),e.s(e=>{let t=s.get(e);t&&(t.markStale(),s.delete(e))});var l=async e=>{let t=c(e);return{resolvers:await Promise.race([t.resolvers,t.stale.then(()=>{throw Error(`peer ${e} became stale before connect completed`)})]),stale:t.stale}},u=[`position: fixed`,`border: 2px solid oklch(63% 0.24 25)`,`border-radius: 4px`,`background: oklch(63% 0.24 25 / 0.12)`,`box-shadow: 0 0 0 2px oklch(63% 0.24 25 / 0.5), 0 0 0 100vmax oklch(0% 0 0 / 0.5)`,`z-index: 2147483647`,`pointer-events: none`,`box-sizing: border-box`],d=(e,t)=>{let n=t.getBoundingClientRect();e.setAttribute(`style`,[...u,`left: ${n.left}px`,`top: ${n.top}px`,`width: ${n.width}px`,`height: ${n.height}px`].map(e=>`${e} !important`).join(`; `))},f=e=>{let t=e.getBoundingClientRect();return{clientX:t.left+t.width/2,clientY:t.top+t.height/2}},p=0,m=e=>{p^=1;let{clientX:t,clientY:n}=f(e),r={bubbles:!0,cancelable:!0,composed:!0,clientX:t+p,clientY:n};e.dispatchEvent(new PointerEvent(`pointermove`,{...r,pointerType:`mouse`,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent(`mousemove`,r))},h=[[PointerEvent,`pointerover`,!0],[PointerEvent,`pointerenter`,!1],[MouseEvent,`mouseover`,!0],[MouseEvent,`mouseenter`,!1]],g=[[PointerEvent,`pointerout`,!0],[PointerEvent,`pointerleave`,!1],[MouseEvent,`mouseout`,!0],[MouseEvent,`mouseleave`,!1]],_=(e,t)=>t.forEach(([t,n,r])=>e.dispatchEvent(new t(n,{bubbles:r,cancelable:!0,composed:!0,...f(e)}))),v=e=>{_(e,h),m(e)},y=e=>_(e,g),b=null,x=e=>{S();try{e.scrollIntoView({block:`center`,inline:`center`})}catch{}let t=document.createElement(`div`);(document.body??document.documentElement).appendChild(t),v(e);let n=requestAnimationFrame(function r(){d(t,e),n=requestAnimationFrame(r)}),r=window.setInterval(()=>m(e),300);b={stop:()=>{cancelAnimationFrame(n),clearInterval(r),y(e),t.remove()}}},S=()=>{b?.stop(),b=null},C={[e.n]:e.t,[e.a]:e.i},w=e=>{let t=C[e.locatorType];if(!t)throw Error(`Unknown locator kind: "${e.locatorType}"`);let n=t.selectorModules.find(t=>t.type===e.type);if(!n)throw Error(`Unknown selector: "${e.locatorType}.${e.type}"`);return n},T=e=>e.reduce((e,t)=>w(t).resolve({elements:e},...t.args),[document.documentElement]),E=e=>{for(let t=0;t<e.length;t++){let n=w(e[t]);if(n.resolvePeer)return{module:n,index:t}}return null},D=async(t,n,r)=>{let i=E(t);if(i){let e=await i.module.resolvePeer({parts:t,selfIndex:i.index,resolveLocal:T}),{resolvers:a,stale:o}=await l(e),s=t.slice(i.index+1);return Promise.race([a.executeLocator(s,n,r),o.then(()=>{throw Error(`peer ${e} became stale during call, retrying`)})])}if(n===`__fkn_highlight`){if(r[0]?.on){let n=T(t)[0];n&&(e.o(!0),x(n))}else S(),e.o(!1);return}let a=[...e.t.operationModules,...e.i.operationModules].find(e=>e.type===n);if(!a)throw Error(`Unknown operation: "${n}"`);return a.resolve({elements:T(t)},...r)},O=`FKN_EVALUATE`,k,A=()=>(k??=new Promise((e,t)=>{let n=t=>{let r=t.data;!r||r.channel!==O||r.kind!==`ready`||(window.removeEventListener(`message`,n),e())};window.addEventListener(`message`,n);let r=document.createElement(`script`);r.src=chrome.runtime.getURL(`main-world-bridge.js`),r.onload=()=>r.remove(),(document.documentElement??document.head??document.body).appendChild(r),setTimeout(()=>t(Error(`evaluate: main-world bridge did not become ready`)),5e3)}),k),j=0,M={contentScriptDummy:()=>{},executeLocator:D,evaluate:async({code:e,arg:t})=>{await A();let n=`${++j}`;return new Promise((r,i)=>{let a=e=>{let t=e.data;!t||t.channel!==O||t.kind!==`result`||t.id!==n||(window.removeEventListener(`message`,a),t.error?i(Error(String(t.error))):r(t.result))};window.addEventListener(`message`,a),window.postMessage({channel:O,kind:`call`,id:n,code:e,arg:t},`*`)})}},N=(0,t.expose)(M,{key:r,transport:{isJson:!0,receive:n.runtime.onMessage,emit:n.runtime}});exports.backgroundResolvers=N;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, h as n, i as r, l as i, n as a, o, s, t as c } from "./locator-
|
|
1
|
+
import { a as e, c as t, h as n, i as r, l as i, n as a, o, s, t as c } from "./locator-Q5m8i40Z.js";
|
|
2
2
|
import { checkOsraMessageKey as l, expose as u } from "osra";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region node_modules/@mfkn/web-extension/lib/background/constants.js
|
|
@@ -831,7 +831,7 @@ var d = (/* @__PURE__ */ n(((e, t) => {
|
|
|
831
831
|
let t = g.get(e);
|
|
832
832
|
if (t) return t;
|
|
833
833
|
let { promise: n, resolve: r } = Promise.withResolvers(), { promise: a, resolve: o } = Promise.withResolvers(), s = {
|
|
834
|
-
resolvers: u(
|
|
834
|
+
resolvers: u(V, {
|
|
835
835
|
key: p,
|
|
836
836
|
revivableModules: i,
|
|
837
837
|
transport: {
|
|
@@ -990,32 +990,57 @@ var v = async (e) => {
|
|
|
990
990
|
};
|
|
991
991
|
}
|
|
992
992
|
return null;
|
|
993
|
-
}, I = {
|
|
993
|
+
}, I = async (e, t, n) => {
|
|
994
|
+
let i = F(e);
|
|
995
|
+
if (i) {
|
|
996
|
+
let r = await i.module.resolvePeer({
|
|
997
|
+
parts: e,
|
|
998
|
+
selfIndex: i.index,
|
|
999
|
+
resolveLocal: P
|
|
1000
|
+
}), { resolvers: a, stale: o } = await v(r), s = e.slice(i.index + 1);
|
|
1001
|
+
return Promise.race([a.executeLocator(s, t, n), o.then(() => {
|
|
1002
|
+
throw Error(`peer ${r} became stale during call, retrying`);
|
|
1003
|
+
})]);
|
|
1004
|
+
}
|
|
1005
|
+
if (t === "__fkn_highlight") {
|
|
1006
|
+
if (n[0]?.on) {
|
|
1007
|
+
let t = P(e)[0];
|
|
1008
|
+
t && (o(!0), A(t));
|
|
1009
|
+
} else j(), o(!1);
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
let a = [...c.operationModules, ...r.operationModules].find((e) => e.type === t);
|
|
1013
|
+
if (!a) throw Error(`Unknown operation: "${t}"`);
|
|
1014
|
+
return a.resolve({ elements: P(e) }, ...n);
|
|
1015
|
+
}, L = "FKN_EVALUATE", R, z = () => (R ??= new Promise((e, t) => {
|
|
1016
|
+
let n = (t) => {
|
|
1017
|
+
let r = t.data;
|
|
1018
|
+
!r || r.channel !== L || r.kind !== "ready" || (window.removeEventListener("message", n), e());
|
|
1019
|
+
};
|
|
1020
|
+
window.addEventListener("message", n);
|
|
1021
|
+
let r = document.createElement("script");
|
|
1022
|
+
r.src = chrome.runtime.getURL("main-world-bridge.js"), r.onload = () => r.remove(), (document.documentElement ?? document.head ?? document.body).appendChild(r), setTimeout(() => t(/* @__PURE__ */ Error("evaluate: main-world bridge did not become ready")), 5e3);
|
|
1023
|
+
}), R), B = 0, V = {
|
|
994
1024
|
contentScriptDummy: () => {},
|
|
995
|
-
executeLocator:
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
return;
|
|
1013
|
-
}
|
|
1014
|
-
let a = [...c.operationModules, ...r.operationModules].find((e) => e.type === t);
|
|
1015
|
-
if (!a) throw Error(`Unknown operation: "${t}"`);
|
|
1016
|
-
return a.resolve({ elements: P(e) }, ...n);
|
|
1025
|
+
executeLocator: I,
|
|
1026
|
+
evaluate: async ({ code: e, arg: t }) => {
|
|
1027
|
+
await z();
|
|
1028
|
+
let n = `${++B}`;
|
|
1029
|
+
return new Promise((r, i) => {
|
|
1030
|
+
let a = (e) => {
|
|
1031
|
+
let t = e.data;
|
|
1032
|
+
!t || t.channel !== L || t.kind !== "result" || t.id !== n || (window.removeEventListener("message", a), t.error ? i(Error(String(t.error))) : r(t.result));
|
|
1033
|
+
};
|
|
1034
|
+
window.addEventListener("message", a), window.postMessage({
|
|
1035
|
+
channel: L,
|
|
1036
|
+
kind: "call",
|
|
1037
|
+
id: n,
|
|
1038
|
+
code: e,
|
|
1039
|
+
arg: t
|
|
1040
|
+
}, "*");
|
|
1041
|
+
});
|
|
1017
1042
|
}
|
|
1018
|
-
},
|
|
1043
|
+
}, H = u(V, {
|
|
1019
1044
|
key: f,
|
|
1020
1045
|
transport: {
|
|
1021
1046
|
isJson: !0,
|
|
@@ -1024,4 +1049,4 @@ var v = async (e) => {
|
|
|
1024
1049
|
}
|
|
1025
1050
|
});
|
|
1026
1051
|
//#endregion
|
|
1027
|
-
export {
|
|
1052
|
+
export { H as backgroundResolvers };
|
package/favicon.svg
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -30.9 461.9 461.9">
|
|
2
|
+
<path d="M198.4,0.1L365,288.6H162.3l-31.8,55l331.4-0.2L263.6,0L198.4,0.1z" fill="#f9aa40"/>
|
|
3
|
+
<path d="M198.3,0L0,343.6l32.6,56.5l165.1-285.9l100.7,174.4h66.5L198.3,0z" fill="#4572b5"/>
|
|
4
|
+
<path d="M197.7,114.2l32.6,56.5l-99.8,172.9h331.4l-32.6,56.5H32.6L197.7,114.2z" fill="#51bb8d"/>
|
|
5
|
+
</svg>
|
package/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locator-DpDoiZSP.cjs`),t=require(`./connect-button-Ng6Rf4-Y.cjs`);let n=require(`osra`),r=require(`stream`),i=require(`events`),a=require(`ip-address`),o=require(`buffer`);var s=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,c=`fknExtension`,l=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(s,e=>{l.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:e.detail.enabled}}))});var u=()=>typeof document>`u`?!1:document.documentElement.dataset[c]===`true`,d=null,f=e=>{d=e},ee=150,p=(e=1e3)=>new Promise((t,n)=>{if(u())return t();let r,i=e=>{clearTimeout(r),s.disconnect(),document.removeEventListener(`readystatechange`,c),e()},a=()=>i(async()=>{if(d&&(await d().catch(()=>{}),u()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),o=()=>{clearTimeout(r),r=setTimeout(()=>u()?i(t):a(),ee)},s=new MutationObserver(()=>{u()&&i(t)}),c=()=>{document.readyState===`complete`&&!u()&&o()};if(r=setTimeout(a,e),s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,c),document.readyState===`complete`)return o();u()&&i(t)}),m,h=new Proxy({},{get:(t,r)=>async(...t)=>{await p(),m??=(0,n.expose)({},{transport:window,revivableModules:e.l});let i=(await m)[r];return i(...t)}}),te={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},ne={scope:`network.fetchCredentialed`,category:`network`,severity:3,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},re={scope:`network.fetchLocal`,category:`network`,severity:3,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},ie=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},ae=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n.endsWith(`.local`)||n.endsWith(`.internal`)||n.endsWith(`.home.arpa`)?!0:n.includes(`:`)?n===`::`||n===`::1`||n.startsWith(`fc`)||n.startsWith(`fd`)||/^fe[89ab]/.test(n)||n.startsWith(`::ffff:`):ie(n)},oe=[`fkn.app`,`fkn.dev`],g=e=>{let t;try{t=new URL(e)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;let n=t.hostname;return oe.some(e=>n===e||n.endsWith(`.${e}`))},_=e=>{if(g(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},se=[`origin`,`referer`],ce=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=se.map(e=>{let n=t.get(e);return n===null?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},v=async(e,t)=>{let n=new Request(e,t);_(n.url);let r=n.body?await n.arrayBuffer():null;return h.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:ce(t),reason:t?.reason,signal:t?.signal??void 0})},le={scope:`network.readCookie`,category:`network`,severity:3,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},ue={get:e=>h.getCookie(e)},de={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},fe=e=>h.setRequestHeaderRule(e),pe=e=>h.removeRequestHeaderRule({ruleId:e});(()=>{let t={},n=[...e.t.selectorModules,...e.i.selectorModules];for(let e of n)e.render&&!(e.type in t)&&(t[e.type]=e.render);return t})();var y=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,b=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;if(t.protocol===`about:`)return!1;let n=t.hostname;return n===`fkn.app`||n.endsWith(`.fkn.app`)},x=e=>{if(b(e))throw Error(`attachFrame: refusing to target the extension's own pages or fkn.app`)},me={scope:`embed.iframe`,category:`embed`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},he={scope:`embed.open`,category:`embed`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},ge=async({iframe:t,domains:n=[]})=>{let r=crypto.randomUUID();if(x(t.src),await p(),!t.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);t.dispatchEvent(new CustomEvent(y,{detail:r}));let{executeLocator:i,ensureLocatorPermission:a,goto:o}=await h.attachFrame({marker:r,domains:n}),s=e.r(i,a),c=(e,t={})=>(x(e),o({url:e,...t})),l=()=>t.src;return{...s,goto:c,url:l}},_e={request:e=>h.requestPermissions(e.map(e=>({key:e.key,scope:e.scope??``,reason:e.reason})))},ve=32,ye=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),be=e=>{let t=e.style;t.setProperty(`display`,`block`,`important`),t.setProperty(`position`,`fixed`,`important`),t.setProperty(`top`,`0`,`important`),t.setProperty(`left`,`0`,`important`),t.setProperty(`width`,`100%`,`important`),t.setProperty(`height`,`100%`,`important`),t.setProperty(`border`,`none`,`important`),t.setProperty(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},xe=({x:e,y:t,width:n,height:r})=>`M${e} ${t}h${n}v${r}h${-n}Z`,Se=(e,{modal:t,rects:n})=>{if(!ye){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let r=t?`none`:n.length===0?`inset(100%)`:`path('${n.map(xe).join(``)}')`,i=r===`none`||CSS.supports(`clip-path`,r)?r:`inset(100%)`;e.style.setProperty(`clip-path`,i,`important`)},Ce=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o));return{x:s,y:c,width:l-s,height:u-c}},we=e=>{if(typeof e!=`object`||!e)return null;let t=e,n=(Array.isArray(t.rects)?t.rects.slice(0,ve):[]).map(Ce).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:n}},S=null,Te=()=>S!==null,Ee=e=>{be(e),Se(e,{modal:!1,rects:[]}),S=e},De=e=>{if(!S)return;let t=we(e);t&&Se(S,t)},C=`https://fkn.app`,w=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,Oe=w?.querySelector(`iframe[src="${C}/api"]`)??null,T=w?.createElement(`iframe`)??null;!Oe&&T&&w&&(T.src=`${C}/api`,w.body.appendChild(T));var E=Oe??T,D=E?.contentWindow??null;E&&w&&Ee(E);var O=(()=>{if(typeof window<`u`)return D?{receive:window,emit:D}:void 0;if(typeof self<`u`)return{receive:self,emit:self}})(),ke=O!==void 0,k=O?(0,n.expose)({},{key:`fkn-api`,transport:O}):new Promise(()=>{});k.then(e=>{Te()&&e.overlay.setHost(De)},()=>{});var Ae=[`fkn.app`,`fkn.dev`],A=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:e.url,n;try{n=new URL(t)}catch{return}let r=n.hostname;if(Ae.some(e=>r===e||r.endsWith(`.${e}`)))throw Error(`fetch refuses FKN platform domains (${r})`)},je=(e,t)=>(A(e),k.then(n=>n.cloud.fetch(e,t))),Me=async()=>{let e=await k.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}},Ne=e.g({lookup:()=>Pe}),Pe=(e,t)=>k.then(n=>n.cloud.dns.lookup(e,t)),Fe=new TextEncoder;new TextDecoder;var j=e=>a.Address4.isValid(e),M=e=>a.Address6.isValid(e),Ie=e=>j(e)?4:M(e)?6:0,Le=(...e)=>{if(typeof e[0]==`string`)throw Error(`FKN WebVPN does not support IPC connections`);let t=typeof e.at(-1)==`function`?e.at(-1):void 0;return e[0]&&typeof e[0]==`object`?{...e[0],callback:t}:{port:e[0]??0,host:typeof e[1]==`string`?e[1]:void 0,callback:t}},Re=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0]??0,r=typeof e[1]==`string`?e[1]:void 0;return typeof e[0]==`object`?{...e[0],address:e[0].address??r,port:e[0].port??n,callback:t}:{address:r,port:n,callback:t}},ze=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0];if(typeof e[2]==`number`)return{message:n,offset:e[1],length:e[2],port:typeof e[3]==`number`?e[3]:0,address:typeof e[4]==`string`?e[4]:void 0,callback:t};{let r=typeof e[1]==`number`?e[1]:0,i=typeof e[2]==`string`?e[2]:void 0;return{message:n,offset:0,length:n.length,port:r,address:i,callback:t}}};new TextEncoder,new TextDecoder;var Be=e.g({Server:()=>P,Socket:()=>N,_default:()=>Ue,connect:()=>F,createConnection:()=>Ve,createServer:()=>He,default:()=>Ue,isIP:()=>Ie,isIPv4:()=>j,isIPv6:()=>M}),N=class extends r.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super(e),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}__webvpn_tcp_socket_init__(e){if(this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);return this._webVPNTcpSocketPromise.then(e=>{e&&this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e),this._restartTimeoutTimer(),n()}).catch(n)}connect(...e){let t=Le(...e),n=this.__webvpn_tcp_socket_init__(k.then(e=>e.cloud.webvpn.tcpSocket({remoteAddress:t.host??`localhost`,remotePort:t.port})));return t.callback&&n.then(e=>{e&&t.callback.call(this)}),this}_end(...e){return this._webVPNTcpSocketPromise?(e.length!==0&&this.write(e[0],e[1],e[2]),this._webVPNTcpSocketPromise.then(async e=>{e&&await e.end()}),this):this}_destroy(e){return this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroy()}),this}destroySoon(){this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroySoon()})}resetAndDestroy(){return this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.resetAndDestroy()}),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}write(e,t,...n){return super.write(e,t,...n)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},P=class extends i.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;constructor(e,t){super(e),t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}__webvpn_tcp_socket_listener_init__(e){return this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e&&this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let t=Le(...e),n=e=>{let t=new N({connection:Promise.resolve(e)});this.emit(`connection`,t)},r=e=>k.then(r=>r.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:t.port,onConnection:n})),i=t.host?r(t.host):r(`::`).catch(()=>r(`0.0.0.0`)),a=this.__webvpn_tcp_socket_listener_init__(i);return t.callback&&a.then(e=>{e&&t.callback.call(this)}),this}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this.emit(`close`),e&&e()}catch(t){this._localAddress=void 0,this.emit(`close`),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},F=(e,t)=>new N().connect(e,t),Ve=(e,t)=>new N().connect(e,t),He=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new P(e);return t&&n.on(`connection`,t),n},Ue={Socket:N,Server:P,connect:F,createConnection:Ve,createServer:He,isIP:Ie,isIPv4:j,isIPv6:M},We=e.g({Socket:()=>Ge,createSocket:()=>Je}),Ge=class extends i.EventEmitter{_type;_localAddress;_remoteAddress;_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}_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)}})}_onDataPortBatch(e){let t=new DataView(e),n=0;for(;n+4<=e.byteLength;){let r=t.getUint32(n);n+=4;let i=n+r;if(i>e.byteLength)break;let a=n+4,s=t.getUint8(a);a+=1;let c,l,u;if(s===2){if(!this._remoteAddress){n=i;continue}c=this._remoteAddress.address,l=this._remoteAddress.family,u=this._remoteAddress.port}else{let n=new Uint8Array(e,a,s===0?4:16);if(s===0)l=`IPv4`,c=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`;else{l=`IPv6`;let e=[];for(let t=0;t<16;t+=2)e.push(((n[t]<<8|n[t+1])>>>0).toString(16));c=e.join(`:`)}a+=n.byteLength,u=t.getUint16(a),a+=2}let d=t.getUint32(a);a+=4,this.emit(`message`,o.Buffer.from(e.slice(a,a+d)),{address:c,family:l,port:u,size:d}),n=i}}_peerTail(e,t){if(e===void 0||t===void 0)return Ke;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=a.Address4.isValid(e)?I(e):L(e),o=new Uint8Array(1+i.byteLength+2);return o[0]=i.byteLength===4?0:1,o.set(i,1),new DataView(o.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.set(n,o),o}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(a.Address4.isValid(e)){let n=I(e),r=t&&a.Address4.isValid(t)?I(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(a.Address6.isValid(e)){let t=L(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 t=Re(...e),n=this._type===`udp6`?`::`:`0.0.0.0`;return this._webVPNUdpSocketPromise=k.then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:t.address??n,port:t.port,dataPort:!0})).then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPort.onmessage=e=>this._onDataPortBatch(e.data);else{let t=e.dataReadableStream.getReader(),n=async()=>{let{value:e,done:r}=await t.read();r||(this.emit(`message`,o.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size}),n())};n()}return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{e&&this.emit(`listening`)}),t.callback&&this._webVPNUdpSocketPromise.then(e=>{e&&t.callback.call(this)}),this}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);this._dataPort?.close(),this._dataPort=void 0,await t.close(),e&&e(),this.emit(`close`)}),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;await t.connect({remotePort:n,remoteAddress:i}),this._remoteAddress={address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},a&&a()})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async e=>{if(!e)throw Error(`Socket not bound`);await e.connect({remotePort:0,remoteAddress:this._type===`udp4`?`0.0.0.0`:`::`})})}dropMembership(e,t){if(a.Address4.isValid(e)){let n=I(e),r=t&&a.Address4.isValid(t)?I(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(a.Address6.isValid(e)){let t=L(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=ze(...e),n=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 r=qe(t.message),i=t.callback,o=t.address??n,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||a.Address4.isValid(o)||a.Address6.isValid(o))){this._portSend(r,s?void 0:o,s?void 0:t.port),i?.call(this,null,r.byteLength);return}e.send({...t,address:o,message:r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}).then(()=>i?.call(this,null,r.byteLength),e=>i?i.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)})}},Ke=new Uint8Array([2]),qe=e=>{if(typeof e==`string`)return Fe.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(qe),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)},I=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)},L=e=>{let t=new a.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},Je=(e,t)=>{let n=new Ge(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},Ye=e.g({Agent:()=>J,ClientRequest:()=>K,HTTPParser:()=>H,IncomingMessage:()=>U,METHODS:()=>Ze,STATUS_CODES:()=>R,Server:()=>q,ServerResponse:()=>G,_default:()=>ct,createServer:()=>st,default:()=>ct,get:()=>ot,globalAgent:()=>at,request:()=>Y}),Xe=new TextDecoder(`latin1`),Ze=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),R={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},Qe=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),z=13,B=10,$e=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,V=(e,t)=>(e.code=t,e),et=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},tt=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===z&&e[n+1]===B)return n;return-1},nt=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===z&&e[t+1]===B&&e[t+2]===z&&e[t+3]===B)return t;return-1},H=class{buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=et(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=nt(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=Xe.decode(e).split(`\r
|
|
2
|
-
`),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],a={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(a,n,r)}let o={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:a,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);o.method=(e??`GET`).toUpperCase(),o.url=t??`/`,this.applyVersion(o,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);o.statusCode=parseInt(a,10)||0,o.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(o,t)}return o}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:Qe.has(r)||(e[r]=`${i}, ${n}`)}setupBody(e){if(this.skipBody){this.framing=`none`;return}let t=e.headers[`transfer-encoding`];if(typeof t==`string`&&t.toLowerCase().includes(`chunked`)){this.framing=`chunked`,this.chunkState=`size`;return}let n=e.headers[`content-length`];if(typeof n==`string`&&n!==``){let e=parseInt(n,10);e>0?(this.framing=`length`,this.bodyRemaining=e):this.framing=`none`;return}if(this.mode===`response`){let t=e.statusCode??0;t>=100&&t<200||t===204||t===304?this.framing=`none`:this.framing=`eof`}else this.framing=`none`}consumeBody(){if(this.framing===`length`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);return this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0}return this.framing===`eof`?(this.buf.length>0&&(this.handlers.onBody(this.buf),this.buf=new Uint8Array),!1):this.framing===`chunked`?this.consumeChunked():!0}consumeChunked(){for(;;)if(this.chunkState===`size`){let e=tt(this.buf,0);if(e===-1)return!1;let t=Xe.decode(this.buf.subarray(0,e)),n=parseInt(t.split(`;`)[0].trim(),16);if(this.buf=this.buf.subarray(e+2),Number.isNaN(n))return!0;n===0?this.chunkState=`trailer`:(this.bodyRemaining=n,this.chunkState=`data`)}else if(this.chunkState===`data`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0&&(this.chunkState=`dataCRLF`)}else if(this.chunkState===`dataCRLF`){if(this.buf.length<2)return!1;this.buf=this.buf.subarray(2),this.chunkState=`size`}else{let e=tt(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},rt=(e,t)=>
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locator-Cjl21Nkt.cjs`);let t=require(`osra`),n=require(`stream`),r=require(`events`),i=require(`ip-address`),a=require(`buffer`),o=require(`react`);var s=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,c=`fknExtension`,l=(0,t.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(s,()=>{l.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:u()}}))});var u=()=>typeof document>`u`?!1:document.documentElement.dataset[c]===`true`,d=null,f=e=>{d=e},p=150,m=(e=1e3)=>new Promise((t,n)=>{if(u())return t();let r,i=e=>{clearTimeout(r),s.disconnect(),document.removeEventListener(`readystatechange`,c),e()},a=()=>i(async()=>{if(d&&(await d().catch(()=>{}),u()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),o=()=>{clearTimeout(r),r=setTimeout(()=>u()?i(t):a(),p)},s=new MutationObserver(()=>{u()&&i(t)}),c=()=>{document.readyState===`complete`&&!u()&&o()};if(r=setTimeout(a,e),s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,c),document.readyState===`complete`)return o();u()&&i(t)}),h,g=new Proxy({},{get:(n,r)=>async(...n)=>{await m(),h??=(0,t.expose)({},{transport:window,revivableModules:e.l});let i=(await h)[r];return i(...n)}}),ee={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},te={scope:`network.fetchCredentialed`,category:`network`,severity:3,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},ne={scope:`network.fetchLocal`,category:`network`,severity:3,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},re=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},ie=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n.endsWith(`.local`)||n.endsWith(`.internal`)||n.endsWith(`.home.arpa`)?!0:n.includes(`:`)?n===`::`||n===`::1`||n.startsWith(`fc`)||n.startsWith(`fd`)||/^fe[89ab]/.test(n)||n.startsWith(`::ffff:`):re(n)},ae=[`fkn.app`,`fkn.dev`],_=e=>{let t;try{t=new URL(e)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;let n=t.hostname;return ae.some(e=>n===e||n.endsWith(`.${e}`))},v=e=>{if(_(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},oe=[`origin`,`referer`],se=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=oe.map(e=>{let n=t.get(e);return n===null?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},y=async(e,t)=>{let n=new Request(e,t);v(n.url);let r=n.body?await n.arrayBuffer():null;return g.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:se(t),reason:t?.reason,signal:t?.signal??void 0})},ce={scope:`network.readCookie`,category:`network`,severity:3,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},le={get:e=>g.getCookie(e)},ue={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},de=e=>g.setRequestHeaderRule(e),fe=e=>g.removeRequestHeaderRule({ruleId:e});(()=>{let t={},n=[...e.t.selectorModules,...e.i.selectorModules];for(let e of n)e.render&&!(e.type in t)&&(t[e.type]=e.render);return t})();var b=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,x=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;if(t.protocol===`about:`)return!1;let n=t.hostname;return n===`fkn.app`||n.endsWith(`.fkn.app`)},S=e=>{if(x(e))throw Error(`attachFrame: refusing to target the extension's own pages or fkn.app`)},pe={scope:`embed.iframe`,category:`embed`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},me={scope:`embed.open`,category:`embed`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},he={scope:`embed.evaluate`,category:`embed`,severity:0,title:`Run app code inside an embedded frame`,description:`Lets the app execute its own code inside a page it embedded, to read back a computed result.`},ge=async({iframe:t,domains:n=[],syncCookies:r=!0,lockdown:i=!1})=>{let a=crypto.randomUUID();if(S(t.src),await m(),!t.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);t.dispatchEvent(new CustomEvent(b,{detail:a}));let{executeLocator:o,ensureLocatorPermission:s,goto:c,evaluate:l}=await g.attachFrame({marker:a,domains:n,syncCookies:r,lockdown:i}),u=e.r(o,s),d=(e,t={})=>(S(e),c({url:e,...t})),f=((e,t)=>l(e,t)),p=()=>t.src;return{...u,goto:d,evaluate:f,url:p}},_e={request:e=>g.requestPermissions(e.map(e=>({key:e.key,scope:e.scope??``,reason:e.reason})))},ve=32,ye=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),be=e=>{let t=e.style;t.setProperty(`display`,`block`,`important`),t.setProperty(`position`,`fixed`,`important`),t.setProperty(`top`,`0`,`important`),t.setProperty(`left`,`0`,`important`),t.setProperty(`width`,`100%`,`important`),t.setProperty(`height`,`100%`,`important`),t.setProperty(`border`,`none`,`important`),t.setProperty(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},xe=({x:e,y:t,width:n,height:r})=>`M${e} ${t}h${n}v${r}h${-n}Z`,Se=(e,{modal:t,rects:n})=>{if(!ye){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let r=t?`none`:n.length===0?`inset(100%)`:`path('${n.map(xe).join(``)}')`,i=r===`none`||CSS.supports(`clip-path`,r)?r:`inset(100%)`;e.style.setProperty(`clip-path`,i,`important`)},Ce=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o));return{x:s,y:c,width:l-s,height:u-c}},we=e=>{if(typeof e!=`object`||!e)return null;let t=e,n=(Array.isArray(t.rects)?t.rects.slice(0,ve):[]).map(Ce).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:n}},C=null,Te=()=>C!==null,Ee=e=>{be(e),Se(e,{modal:!1,rects:[]}),C=e},De=e=>{if(!C)return;let t=we(e);t&&Se(C,t)},w=`https://fkn.app`,T=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,E=T?.querySelector(`iframe[src="${w}/api"]`)??null,D=T?.createElement(`iframe`)??null;!E&&D&&T&&(D.src=`${w}/api`,T.body.appendChild(D));var O=E??D,k=O?.contentWindow??null;O&&T&&Ee(O);var A=(()=>{if(typeof window<`u`)return k?{receive:window,emit:k}:void 0;if(typeof self<`u`)return{receive:self,emit:self}})(),Oe=A!==void 0,j=A?(0,t.expose)({},{key:`fkn-api`,transport:A}):new Promise(()=>{});j.then(e=>{Te()&&e.overlay.setHost(De)},()=>{});var ke=[`fkn.app`,`fkn.dev`],Ae=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:e.url,n;try{n=new URL(t)}catch{return}let r=n.hostname;if(ke.some(e=>r===e||r.endsWith(`.${e}`)))throw Error(`fetch refuses FKN platform domains (${r})`)},je=(e,t)=>(Ae(e),j.then(n=>n.cloud.fetch(e,t))),Me=async()=>{let e=await j.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}},Ne=e.g({lookup:()=>Pe}),Pe=(e,t)=>j.then(n=>n.cloud.dns.lookup(e,t)),Fe=new TextEncoder;new TextDecoder;var M=e=>i.Address4.isValid(e),N=e=>i.Address6.isValid(e),Ie=e=>M(e)?4:N(e)?6:0,Le=(...e)=>{if(typeof e[0]==`string`)throw Error(`FKN WebVPN does not support IPC connections`);let t=typeof e.at(-1)==`function`?e.at(-1):void 0;return e[0]&&typeof e[0]==`object`?{...e[0],callback:t}:{port:e[0]??0,host:typeof e[1]==`string`?e[1]:void 0,callback:t}},Re=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0]??0,r=typeof e[1]==`string`?e[1]:void 0;return typeof e[0]==`object`?{...e[0],address:e[0].address??r,port:e[0].port??n,callback:t}:{address:r,port:n,callback:t}},ze=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0];if(typeof e[2]==`number`)return{message:n,offset:e[1],length:e[2],port:typeof e[3]==`number`?e[3]:0,address:typeof e[4]==`string`?e[4]:void 0,callback:t};{let r=typeof e[1]==`number`?e[1]:0,i=typeof e[2]==`string`?e[2]:void 0;return{message:n,offset:0,length:n.length,port:r,address:i,callback:t}}};new TextEncoder,new TextDecoder;var Be=e.g({Server:()=>F,Socket:()=>P,_default:()=>I,connect:()=>Ve,createConnection:()=>He,createServer:()=>Ue,default:()=>I,isIP:()=>Ie,isIPv4:()=>M,isIPv6:()=>N}),P=class extends n.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super(e),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}__webvpn_tcp_socket_init__(e){if(this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);return this._webVPNTcpSocketPromise.then(e=>{e&&this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e),this._restartTimeoutTimer(),n()}).catch(n)}connect(...e){let t=Le(...e),n=this.__webvpn_tcp_socket_init__(j.then(e=>e.cloud.webvpn.tcpSocket({remoteAddress:t.host??`localhost`,remotePort:t.port})));return t.callback&&n.then(e=>{e&&t.callback.call(this)}),this}_end(...e){return this._webVPNTcpSocketPromise?(e.length!==0&&this.write(e[0],e[1],e[2]),this._webVPNTcpSocketPromise.then(async e=>{e&&await e.end()}),this):this}_destroy(e){return this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroy()}),this}destroySoon(){this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroySoon()})}resetAndDestroy(){return this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.resetAndDestroy()}),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}write(e,t,...n){return super.write(e,t,...n)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},F=class extends r.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;constructor(e,t){super(e),t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}__webvpn_tcp_socket_listener_init__(e){return this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e&&this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let t=Le(...e),n=e=>{let t=new P({connection:Promise.resolve(e)});this.emit(`connection`,t)},r=e=>j.then(r=>r.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:t.port,onConnection:n})),i=t.host?r(t.host):r(`::`).catch(()=>r(`0.0.0.0`)),a=this.__webvpn_tcp_socket_listener_init__(i);return t.callback&&a.then(e=>{e&&t.callback.call(this)}),this}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this.emit(`close`),e&&e()}catch(t){this._localAddress=void 0,this.emit(`close`),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},Ve=(e,t)=>new P().connect(e,t),He=(e,t)=>new P().connect(e,t),Ue=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new F(e);return t&&n.on(`connection`,t),n},I={Socket:P,Server:F,connect:Ve,createConnection:He,createServer:Ue,isIP:Ie,isIPv4:M,isIPv6:N},We=e.g({Socket:()=>Ge,createSocket:()=>Je}),Ge=class extends r.EventEmitter{_type;_localAddress;_remoteAddress;_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}_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)}})}_onDataPortBatch(e){let t=new DataView(e),n=0;for(;n+4<=e.byteLength;){let r=t.getUint32(n);n+=4;let i=n+r;if(i>e.byteLength)break;let o=n+4,s=t.getUint8(o);o+=1;let c,l,u;if(s===2){if(!this._remoteAddress){n=i;continue}c=this._remoteAddress.address,l=this._remoteAddress.family,u=this._remoteAddress.port}else{let n=new Uint8Array(e,o,s===0?4:16);if(s===0)l=`IPv4`,c=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`;else{l=`IPv6`;let e=[];for(let t=0;t<16;t+=2)e.push(((n[t]<<8|n[t+1])>>>0).toString(16));c=e.join(`:`)}o+=n.byteLength,u=t.getUint16(o),o+=2}let d=t.getUint32(o);o+=4,this.emit(`message`,a.Buffer.from(e.slice(o,o+d)),{address:c,family:l,port:u,size:d}),n=i}}_peerTail(e,t){if(e===void 0||t===void 0)return Ke;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let a=i.Address4.isValid(e)?L(e):R(e),o=new Uint8Array(1+a.byteLength+2);return o[0]=a.byteLength===4?0:1,o.set(a,1),new DataView(o.buffer).setUint16(1+a.byteLength,t),this._peerTailCache.set(n,o),o}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(i.Address4.isValid(e)){let n=L(e),r=t&&i.Address4.isValid(t)?L(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=R(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 t=Re(...e),n=this._type===`udp6`?`::`:`0.0.0.0`;return this._webVPNUdpSocketPromise=j.then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:t.address??n,port:t.port,dataPort:!0})).then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPort.onmessage=e=>this._onDataPortBatch(e.data);else{let t=e.dataReadableStream.getReader(),n=async()=>{let{value:e,done:r}=await t.read();r||(this.emit(`message`,a.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size}),n())};n()}return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{e&&this.emit(`listening`)}),t.callback&&this._webVPNUdpSocketPromise.then(e=>{e&&t.callback.call(this)}),this}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);this._dataPort?.close(),this._dataPort=void 0,await t.close(),e&&e(),this.emit(`close`)}),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;await t.connect({remotePort:n,remoteAddress:i}),this._remoteAddress={address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},a&&a()})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async e=>{if(!e)throw Error(`Socket not bound`);await e.connect({remotePort:0,remoteAddress:this._type===`udp4`?`0.0.0.0`:`::`})})}dropMembership(e,t){if(i.Address4.isValid(e)){let n=L(e),r=t&&i.Address4.isValid(t)?L(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=R(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=ze(...e),n=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 r=qe(t.message),a=t.callback,o=t.address??n,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||i.Address4.isValid(o)||i.Address6.isValid(o))){this._portSend(r,s?void 0:o,s?void 0:t.port),a?.call(this,null,r.byteLength);return}e.send({...t,address:o,message:r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}).then(()=>a?.call(this,null,r.byteLength),e=>a?a.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)})}},Ke=new Uint8Array([2]),qe=e=>{if(typeof e==`string`)return Fe.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(qe),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)},L=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)},R=e=>{let t=new i.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)))},Je=(e,t)=>{let n=new Ge(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},Ye=e.g({Agent:()=>Y,ClientRequest:()=>q,HTTPParser:()=>U,IncomingMessage:()=>W,METHODS:()=>Ze,STATUS_CODES:()=>z,Server:()=>J,ServerResponse:()=>K,_default:()=>ct,createServer:()=>st,default:()=>ct,get:()=>ot,globalAgent:()=>at,request:()=>X}),Xe=new TextDecoder(`latin1`),Ze=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),z={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},Qe=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),B=13,V=10,$e=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,H=(e,t)=>(e.code=t,e),et=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},tt=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===B&&e[n+1]===V)return n;return-1},nt=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===B&&e[t+1]===V&&e[t+2]===B&&e[t+3]===V)return t;return-1},U=class{buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=et(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=nt(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=Xe.decode(e).split(`\r
|
|
2
|
+
`),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],a={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(a,n,r)}let o={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:a,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);o.method=(e??`GET`).toUpperCase(),o.url=t??`/`,this.applyVersion(o,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);o.statusCode=parseInt(a,10)||0,o.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(o,t)}return o}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:Qe.has(r)||(e[r]=`${i}, ${n}`)}setupBody(e){if(this.skipBody){this.framing=`none`;return}let t=e.headers[`transfer-encoding`];if(typeof t==`string`&&t.toLowerCase().includes(`chunked`)){this.framing=`chunked`,this.chunkState=`size`;return}let n=e.headers[`content-length`];if(typeof n==`string`&&n!==``){let e=parseInt(n,10);e>0?(this.framing=`length`,this.bodyRemaining=e):this.framing=`none`;return}if(this.mode===`response`){let t=e.statusCode??0;t>=100&&t<200||t===204||t===304?this.framing=`none`:this.framing=`eof`}else this.framing=`none`}consumeBody(){if(this.framing===`length`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);return this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0}return this.framing===`eof`?(this.buf.length>0&&(this.handlers.onBody(this.buf),this.buf=new Uint8Array),!1):this.framing===`chunked`?this.consumeChunked():!0}consumeChunked(){for(;;)if(this.chunkState===`size`){let e=tt(this.buf,0);if(e===-1)return!1;let t=Xe.decode(this.buf.subarray(0,e)),n=parseInt(t.split(`;`)[0].trim(),16);if(this.buf=this.buf.subarray(e+2),Number.isNaN(n))return!0;n===0?this.chunkState=`trailer`:(this.bodyRemaining=n,this.chunkState=`data`)}else if(this.chunkState===`data`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0&&(this.chunkState=`dataCRLF`)}else if(this.chunkState===`dataCRLF`){if(this.buf.length<2)return!1;this.buf=this.buf.subarray(2),this.chunkState=`size`}else{let e=tt(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},rt=(e,t)=>a.Buffer.isBuffer(e)?e:typeof e==`string`?a.Buffer.from(e,t??`utf8`):e instanceof Uint8Array?a.Buffer.from(e):e instanceof ArrayBuffer?a.Buffer.from(new Uint8Array(e)):a.Buffer.from(String(e)),W=class extends n.Stream.Readable{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];trailers={};rawTrailers=[];method;url;statusCode;statusMessage;complete=!1;socket;constructor(e){super(),this.socket=e}get connection(){return this.socket}_applyHead(e){this.httpVersion=e.httpVersion,this.httpVersionMajor=e.httpVersionMajor,this.httpVersionMinor=e.httpVersionMinor,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.method=e.method,this.url=e.url,this.statusCode=e.statusCode,this.statusMessage=e.statusMessage}_read(){}setTimeout(e,t){return this.socket.setTimeout(e,t),this}},G=class extends n.Stream.Writable{_headerStore=new Map;headersSent=!1;chunkedEncoding=!1;finished=!1;_bodyWritten=!1;setHeader(e,t){if(this.headersSent)throw H(Error(`Cannot set headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);if(typeof e!=`string`||!$e.test(e))throw H(TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`),`ERR_INVALID_HTTP_TOKEN`);if(t===void 0)throw H(TypeError(`Invalid value "undefined" for header "${e}"`),`ERR_HTTP_INVALID_HEADER_VALUE`);return this._headerStore.set(e.toLowerCase(),[e,Array.isArray(t)?[...t]:t]),this}getHeader(e){return this._headerStore.get(e.toLowerCase())?.[1]}getHeaderNames(){return[...this._headerStore.values()].map(([e])=>e)}getHeaders(){let e={};for(let[t,n]of this._headerStore.values())e[t]=n;return e}hasHeader(e){return this._headerStore.has(e.toLowerCase())}removeHeader(e){if(this.headersSent)throw Error(`Cannot remove headers after they are sent to the client`);this._headerStore.delete(e.toLowerCase())}_storeHeader(e){let t=this.hasHeader(`content-length`),n=this.getHeader(`transfer-encoding`);typeof n==`string`&&n.toLowerCase().includes(`chunked`)?this.chunkedEncoding=!0:!t&&this._shouldSendBody()&&(this.chunkedEncoding=!0,this.setHeader(`Transfer-Encoding`,`chunked`));let r=e+`\r
|
|
3
3
|
`;for(let[e,t]of this._headerStore.values())if(Array.isArray(t))for(let n of t)r+=`${e}: ${n}\r\n`;else r+=`${e}: ${t}\r\n`;return r+=`\r
|
|
4
|
-
`,r}_writeToSocket(e,t){if(!this.socket){t(Error(`Socket is not available`));return}this.socket.write(e,t)}write(e,t,n){return this._bodyWritten=!0,super.write(e,t,n)}_write(e,t,n){let r=rt(e),i=[];if(this.headersSent||=(this._implicitHeader(),i.push(
|
|
5
|
-
`,`latin1`))):i.push(r),i.length===0){n();return}this._writeToSocket(
|
|
4
|
+
`,r}_writeToSocket(e,t){if(!this.socket){t(Error(`Socket is not available`));return}this.socket.write(e,t)}write(e,t,n){return this._bodyWritten=!0,super.write(e,t,n)}_write(e,t,n){let r=rt(e),i=[];if(this.headersSent||=(this._implicitHeader(),i.push(a.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding?r.length>0&&(i.push(a.Buffer.from(`${r.length.toString(16)}\r\n`,`latin1`)),i.push(r),i.push(a.Buffer.from(`\r
|
|
5
|
+
`,`latin1`))):i.push(r),i.length===0){n();return}this._writeToSocket(a.Buffer.concat(i),n)}_final(e){let t=[];if(this.headersSent||=(!this.chunkedEncoding&&!this.hasHeader(`content-length`)&&this.setHeader(`Content-Length`,0),this._implicitHeader(),t.push(a.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding&&t.push(a.Buffer.from(`0\r
|
|
6
6
|
\r
|
|
7
|
-
`,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(
|
|
7
|
+
`,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(a.Buffer.concat(t),e)}end(e,t,n){if(e!=null&&typeof e!=`function`&&!this._bodyWritten&&!this.headersSent&&!this.chunkedEncoding&&!this.hasHeader(`content-length`)){let n=typeof t==`string`?t:void 0;this.setHeader(`Content-Length`,rt(e,n).length)}return super.end(e,t,n)}_headBlock},K=class extends G{statusCode=200;statusMessage;_writeHeadCalled=!1;sendDate=!0;req;socket;_keepAlive=!0;constructor(e){super(),this.req=e,this.socket=e.socket}_shouldSendBody(){if(this.req.method===`HEAD`)return!1;let e=this.statusCode;return!(e>=100&&e<200||e===204||e===304)}writeHead(e,t,n){if(this._writeHeadCalled||this.headersSent)throw H(Error(`Cannot render headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);this._writeHeadCalled=!0,this.statusCode=e;let r=n;if(typeof t==`string`?this.statusMessage=t:t!=null&&(r=t),Array.isArray(r)){let e=Array.isArray(r[0])?r:Array.from({length:Math.floor(r.length/2)},(e,t)=>[r[t*2],r[t*2+1]]);for(let[t,n]of e)n!==void 0&&this._appendHeader(t,n)}else if(r)for(let[e,t]of Object.entries(r))t!==void 0&&this.setHeader(e,t);return this}_appendHeader(e,t){let n=this.getHeader(e);if(n===void 0)this.setHeader(e,t);else{let r=[...Array.isArray(n)?n:[n],...Array.isArray(t)?t:[t]].map(String);this.setHeader(e,r)}}_implicitHeader(){let e=this.statusMessage??z[this.statusCode]??`unknown`;this.sendDate&&!this.hasHeader(`date`)&&this.setHeader(`Date`,new Date().toUTCString()),this.hasHeader(`connection`)||this.setHeader(`Connection`,this._keepAlive?`keep-alive`:`close`),this._headBlock=this._storeHeader(`HTTP/1.1 ${this.statusCode} ${e}`)}writeContinue(){this._writeToSocket(a.Buffer.from(`HTTP/1.1 100 Continue\r
|
|
8
8
|
\r
|
|
9
|
-
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},it=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},
|
|
9
|
+
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},it=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},q=class extends G{method;path;host;protocol;socket;get connection(){return this.socket}res=null;aborted=!1;_aborted=!1;constructor(e,t){super(),this.method=(e.method??`GET`).toUpperCase(),this.path=e.path??`/`,this.protocol=e.protocol??`http:`;let n=e.hostname??e.host??`localhost`;this.host=n;let r=Number(e.port??(this.protocol===`https:`?443:80));if(t&&this.once(`response`,t),e.headers)for(let[t,n]of Object.entries(e.headers))n!==void 0&&this.setHeader(t,n);if(!this.hasHeader(`host`)){let e=this.protocol===`https:`&&r===443||this.protocol!==`https:`&&r===80;this.setHeader(`Host`,e?n:`${n}:${r}`)}e.auth&&!this.hasHeader(`authorization`)&&this.setHeader(`Authorization`,`Basic ${a.Buffer.from(e.auth).toString(`base64`)}`),this.socket=new P,this.emit(`socket`,this.socket),this.socket.on(`error`,e=>{this._aborted||this.emit(`error`,e)}),this._attachResponseParser(),this.socket.connect({host:n,port:r},()=>{this.emit(`connect`)})}_shouldSendBody(){return this.method!==`GET`&&this.method!==`HEAD`&&this.method!==`DELETE`}_implicitHeader(){this._headBlock=this._storeHeader(`${this.method} ${this.path} HTTP/1.1`)}_attachResponseParser(){let e=new W(this.socket),t=new U(`response`,{onHeaders:n=>{e._applyHead(n),this.method===`HEAD`&&(t.skipBody=!0),this.res=e,this.emit(`response`,e)},onBody:t=>{e.push(a.Buffer.from(t))},onComplete:()=>{e.complete=!0,e.push(null)}});this.socket.on(`data`,e=>{this._aborted||t.execute(e)}),this.socket.on(`end`,()=>{t.finish()}),this.socket.on(`close`,()=>{this.emit(`close`)})}abort(){this._aborted||(this._aborted=!0,this.aborted=!0,this.emit(`abort`),this.socket.destroy())}destroy(e){return this._aborted?this:(this._aborted=!0,this.socket.destroy(e),super.destroy(e),this)}end(e,t,n){return this._aborted?this:super.end(e,t,n)}_writeToSocket(e,t){if(this._aborted){t();return}super._writeToSocket(e,t)}setTimeout(e,t){return this.socket.setTimeout(e,t),this}setNoDelay(e){this.socket.setNoDelay(e)}setSocketKeepAlive(e,t){this.socket.setKeepAlive(e,t)}},J=new Proxy(class extends F{constructor(e,t){let n={},r=t;typeof e==`function`?r=e:e&&(n=e),super(n),r&&this.on(`request`,r),this.on(`connection`,e=>this._handleConnection(e))}_handleConnection(e){let t=null,n=new U(`request`,{onHeaders:r=>{t=new W(e),t._applyHead(r),r.method===`HEAD`&&(n.skipBody=!0);let i=new K(t),a=String(r.headers.connection??``).toLowerCase();i._keepAlive=r.httpVersionMinor>=1?a!==`close`:a===`keep-alive`,i.on(`finish`,()=>{i._keepAlive||e.end()}),this.emit(`request`,t,i)},onBody:e=>{t?.push(a.Buffer.from(e))},onComplete:()=>{t&&(t.complete=!0,t.push(null)),t=null}});e.on(`data`,e=>n.execute(e)),e.on(`end`,()=>{n.finish(),t&&t.push(null)}),e.on(`error`,t=>this.emit(`clientError`,t,e))}},{apply:(e,t,n)=>new e(...n)}),Y=class{maxSockets;maxFreeSockets;keepAlive;options;constructor(e={}){this.options=e,this.keepAlive=!!e.keepAlive,this.maxSockets=e.maxSockets??1/0,this.maxFreeSockets=e.maxFreeSockets??256}getName(e={}){return`${e.host??`localhost`}:${e.port??``}:${e.localAddress??``}`}destroy(){}},at=new Y,X=(...e)=>{let{options:t,callback:n}=it(...e);return new q(t,n)},ot=(...e)=>{let t=X(...e);return t.end(),t},st=(e,t)=>new J(e,t),ct={METHODS:Ze,STATUS_CODES:z,Agent:Y,globalAgent:at,Server:J,ServerResponse:K,IncomingMessage:W,ClientRequest:q,OutgoingMessage:G,createServer:st,request:X,get:ot},lt=e.g({available:()=>ut,dgram:()=>We,dns:()=>Ne,fetch:()=>je,http:()=>Ye,net:()=>Be,quota:()=>Me}),ut=()=>Oe,Z=async e=>{if(typeof window>`u`)return!1;if(u())return!0;let t=await j,n=null,r=new Promise(e=>{n=()=>{u()&&e(!0)},l.addEventListener(`statuschange`,n)}),i=t.installPrompt.show(e).then(()=>!1),a=await Promise.race([r,i]);return n&&l.removeEventListener(`statuschange`,n),await t.installPrompt.hide().catch(()=>{}),a},Q=null;f(()=>(Q||=Z().then(()=>void 0).finally(()=>{Q=null}),Q));var dt=e.g({available:()=>ft,dgram:()=>gt,dns:()=>mt,fetch:()=>pt,fs:()=>_t,net:()=>ht}),ft=()=>!1,$=e=>(...t)=>{throw Error(`The FKN desktop app is not connected, desktop.${e} is unavailable`)},pt=$(`fetch`),mt={lookup:$(`dns.lookup`)},ht={connect:$(`net.connect`),createConnection:$(`net.createConnection`),createServer:$(`net.createServer`)},gt={createSocket:$(`dgram.createSocket`)},_t={isLocalDirectorySupported:()=>!1,pickLocalDirectory:$(`fs.pickLocalDirectory`),queryDirectoryPermission:$(`fs.queryDirectoryPermission`),ensureDirectoryPermission:$(`fs.ensureDirectoryPermission`)},vt=()=>typeof document<`u`&&u(),yt=async(e,t)=>{if(Ae(e),t?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return y(e,t)}return vt()?y(e,{...t,credentials:`omit`}):ft()?pt(e,t):je(e,t)},bt=e.g({ATTACH_FRAME_EVENT_KEY:()=>b,assertAttachableFrameUrl:()=>S,assertFetchableUrl:()=>v,attachFrame:()=>ge,attachFramePermission:()=>pe,available:()=>vt,box:()=>e.u,cookies:()=>le,createVideoElementHandle:()=>e.d,evaluatePermission:()=>he,events:()=>l,extension:()=>l,fetch:()=>y,fetchCredentialedPermission:()=>te,fetchLocalPermission:()=>ne,fetchPermission:()=>ee,gotoPermission:()=>me,handleRevivableModules:()=>e.l,isBlockedFetchUrl:()=>_,isBlockedFrameUrl:()=>x,isExtensionExposed:()=>u,isLocalNetworkUrl:()=>ie,isType:()=>e.f,modifyRequestHeadersPermission:()=>ue,permissions:()=>_e,promptInstall:()=>Z,readCookiePermission:()=>ce,removeRequestHeaderRule:()=>fe,revive:()=>e.p,setMissingExtensionHandler:()=>f,setRequestHeaderRule:()=>de,type:()=>e.m,waitForExtensionExposure:()=>m}),xt=e.g({ensureDirectoryPermission:()=>Tt,isLocalDirectorySupported:()=>St,pickLocalDirectory:()=>Ct,queryDirectoryPermission:()=>wt}),St=()=>typeof window<`u`&&`showDirectoryPicker`in window,Ct=async(e={})=>{if(!St())return;let t=window.showDirectoryPicker;return t({mode:`readwrite`,...e}).catch(e=>{if(e?.name!==`AbortError`)throw e})},wt=async(e,t=`readwrite`)=>{let{queryPermission:n}=e;return await n?.call(e,{mode:t})??`granted`},Tt=async(e,t=`readwrite`)=>{if(await wt(e,t)===`granted`)return!0;let{requestPermission:n}=e;return await n?.call(e,{mode:t})===`granted`},Et=`https://fkn.app`,Dt=(e,n)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);if(!O?.contentWindow)throw Error(`FKN @fkn/lib: relayWorker called before the FKN iframe was injected`);(0,t.relay)({receive:window,emit:O.contentWindow},e,{key:`fkn-api`,originA:n?.originA??Et,originB:n?.originB??`*`,unregisterSignal:n?.unregisterSignal})},Ot=async()=>typeof window>`u`?!1:(await j).connect.prompt(location.origin).catch(()=>!1),kt=e.g({info:()=>Mt,login:()=>At,logout:()=>jt,onChange:()=>Nt}),At=async()=>typeof window>`u`?!1:(await j).account.login(location.origin).catch(()=>!1),jt=async()=>{typeof window>`u`||await(await j).account.logout().catch(()=>{})},Mt=async()=>{if(typeof window>`u`)return null;let e=await j.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},Nt=async e=>{if(typeof window>`u`)return()=>{};let t=await j.catch(()=>null);if(!t)return()=>{};let n=await t.account.onChange(e).catch(()=>null);return typeof n==`function`?n:()=>{}},Pt=`https://fkn.app`,Ft=(e=location.origin)=>`${Pt}/connect-button?origin=${encodeURIComponent(e)}`,It=({className:e,style:t}={})=>(0,o.createElement)(`iframe`,{src:Ft(),title:`Connect your FKN account`,className:e,style:{border:`none`,width:150,height:40,background:`transparent`,colorScheme:`normal`,...t}});exports.ATTACH_FRAME_EVENT_KEY=b,exports.ConnectButton=It,Object.defineProperty(exports,`account`,{enumerable:!0,get:function(){return kt}}),exports.assertAttachableFrameUrl=S,exports.assertFetchableUrl=v,exports.attachFrame=ge,exports.attachFramePermission=pe,exports.box=e.u,Object.defineProperty(exports,`cloud`,{enumerable:!0,get:function(){return lt}}),exports.connect=Ot,exports.connectButtonUrl=Ft,exports.cookies=le,exports.createVideoElementHandle=e.d,Object.defineProperty(exports,`desktop`,{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,`dgram`,{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,`dns`,{enumerable:!0,get:function(){return Ne}}),exports.evaluatePermission=he,Object.defineProperty(exports,`extension`,{enumerable:!0,get:function(){return bt}}),exports.fetch=yt,exports.fetchCredentialedPermission=te,exports.fetchLocalPermission=ne,exports.fetchPermission=ee,Object.defineProperty(exports,`fs`,{enumerable:!0,get:function(){return xt}}),exports.gotoPermission=me,exports.handleRevivableModules=e.l,Object.defineProperty(exports,`http`,{enumerable:!0,get:function(){return Ye}}),exports.isBlockedFetchUrl=_,exports.isBlockedFrameUrl=x,exports.isExtensionExposed=u,exports.isLocalNetworkUrl=ie,exports.isType=e.f,exports.modifyRequestHeadersPermission=ue,Object.defineProperty(exports,`net`,{enumerable:!0,get:function(){return Be}}),exports.permissions=_e,exports.promptInstall=Z,exports.readCookiePermission=ce,exports.relayWorker=Dt,exports.removeRequestHeaderRule=fe,exports.revive=e.p,exports.setMissingExtensionHandler=f,exports.setRequestHeaderRule=de,exports.type=e.m,exports.waitForExtensionExposure=m;
|
package/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { EventEmitter } from 'events';
|
|
|
33
33
|
import { Socket as Socket$3, SocketOptions, BindOptions, SocketType, RemoteInfo } from 'dgram';
|
|
34
34
|
import { Buffer } from 'buffer';
|
|
35
35
|
import { OutgoingHttpHeaders, IncomingHttpHeaders, RequestOptions } from 'http';
|
|
36
|
+
import { CSSProperties, ReactElement } from 'react';
|
|
36
37
|
|
|
37
38
|
declare const fetchPermission: {
|
|
38
39
|
readonly scope: "network.fetch";
|
|
@@ -575,19 +576,29 @@ declare const gotoPermission: {
|
|
|
575
576
|
readonly title: "Open a website inside this app";
|
|
576
577
|
readonly description: "Lets the app navigate to another site without leaving its window.";
|
|
577
578
|
};
|
|
579
|
+
declare const evaluatePermission: {
|
|
580
|
+
readonly scope: "embed.evaluate";
|
|
581
|
+
readonly category: "embed";
|
|
582
|
+
readonly severity: 0;
|
|
583
|
+
readonly title: "Run app code inside an embedded frame";
|
|
584
|
+
readonly description: "Lets the app execute its own code inside a page it embedded, to read back a computed result.";
|
|
585
|
+
};
|
|
578
586
|
type GotoOptions = {
|
|
579
587
|
waitUntil?: 'documentstart' | 'load';
|
|
580
588
|
domains?: string[];
|
|
581
589
|
};
|
|
582
590
|
type Frame = FrameLocator & {
|
|
583
591
|
goto(url: string, options?: GotoOptions): Promise<void>;
|
|
592
|
+
evaluate<T = unknown>(code: string, arg?: unknown): Promise<T>;
|
|
584
593
|
url(): string;
|
|
585
594
|
};
|
|
586
595
|
type AttachFrameOptions = {
|
|
587
596
|
iframe: HTMLIFrameElement;
|
|
588
597
|
domains?: string[];
|
|
598
|
+
syncCookies?: boolean;
|
|
599
|
+
lockdown?: boolean;
|
|
589
600
|
};
|
|
590
|
-
declare const attachFrame: ({ iframe, domains }: AttachFrameOptions) => Promise<Frame>;
|
|
601
|
+
declare const attachFrame: ({ iframe, domains, syncCookies, lockdown }: AttachFrameOptions) => Promise<Frame>;
|
|
591
602
|
|
|
592
603
|
declare const PERMISSIONS: readonly [{
|
|
593
604
|
readonly scope: "read.text";
|
|
@@ -668,6 +679,12 @@ declare const PERMISSIONS: readonly [{
|
|
|
668
679
|
readonly severity: 0;
|
|
669
680
|
readonly title: "Open a website inside this app";
|
|
670
681
|
readonly description: "Lets the app navigate to another site without leaving its window.";
|
|
682
|
+
}, {
|
|
683
|
+
readonly scope: "embed.evaluate";
|
|
684
|
+
readonly category: "embed";
|
|
685
|
+
readonly severity: 0;
|
|
686
|
+
readonly title: "Run app code inside an embedded frame";
|
|
687
|
+
readonly description: "Lets the app execute its own code inside a page it embedded, to read back a computed result.";
|
|
671
688
|
}, {
|
|
672
689
|
readonly scope: "network.fetch";
|
|
673
690
|
readonly category: "network";
|
|
@@ -1120,7 +1137,7 @@ type Quota = {
|
|
|
1120
1137
|
|
|
1121
1138
|
declare const resolvers: {
|
|
1122
1139
|
readonly cloud: {
|
|
1123
|
-
readonly fetch: (input: string |
|
|
1140
|
+
readonly fetch: (input: string | URL | Request, init?: (RequestInit | undefined) & {
|
|
1124
1141
|
render?: boolean;
|
|
1125
1142
|
}) => Promise<Response>;
|
|
1126
1143
|
readonly quota: () => Promise<Quota>;
|
|
@@ -1215,7 +1232,7 @@ declare const resolvers: {
|
|
|
1215
1232
|
readonly logout: () => void;
|
|
1216
1233
|
readonly onChange: (listener: () => void) => (() => void);
|
|
1217
1234
|
};
|
|
1218
|
-
readonly proxyFetch: (input: string |
|
|
1235
|
+
readonly proxyFetch: (input: string | URL | Request, init?: (RequestInit | undefined) & {
|
|
1219
1236
|
render?: boolean;
|
|
1220
1237
|
}) => Promise<Response>;
|
|
1221
1238
|
readonly webVpnTcpSocket: ({ remoteAddress: _remoteAddress, remotePort }: {
|
|
@@ -1825,6 +1842,7 @@ declare const extension_attachFramePermission: typeof attachFramePermission;
|
|
|
1825
1842
|
declare const extension_box: typeof box;
|
|
1826
1843
|
declare const extension_cookies: typeof cookies;
|
|
1827
1844
|
declare const extension_createVideoElementHandle: typeof createVideoElementHandle;
|
|
1845
|
+
declare const extension_evaluatePermission: typeof evaluatePermission;
|
|
1828
1846
|
declare const extension_fetchCredentialedPermission: typeof fetchCredentialedPermission;
|
|
1829
1847
|
declare const extension_fetchLocalPermission: typeof fetchLocalPermission;
|
|
1830
1848
|
declare const extension_fetchPermission: typeof fetchPermission;
|
|
@@ -1846,7 +1864,7 @@ declare const extension_setRequestHeaderRule: typeof setRequestHeaderRule;
|
|
|
1846
1864
|
declare const extension_type: typeof type;
|
|
1847
1865
|
declare const extension_waitForExtensionExposure: typeof waitForExtensionExposure;
|
|
1848
1866
|
declare namespace extension {
|
|
1849
|
-
export { extension_ATTACH_FRAME_EVENT_KEY as ATTACH_FRAME_EVENT_KEY, extension_assertAttachableFrameUrl as assertAttachableFrameUrl, extension_assertFetchableUrl as assertFetchableUrl, extension_attachFrame as attachFrame, extension_attachFramePermission as attachFramePermission, isExtensionAvailable as available, extension_box as box, extension_cookies as cookies, extension_createVideoElementHandle as createVideoElementHandle, extension$1 as events, extension$1 as extension, fetch$2 as fetch, extension_fetchCredentialedPermission as fetchCredentialedPermission, extension_fetchLocalPermission as fetchLocalPermission, extension_fetchPermission as fetchPermission, extension_gotoPermission as gotoPermission, extension_handleRevivableModules as handleRevivableModules, extension_isBlockedFetchUrl as isBlockedFetchUrl, extension_isBlockedFrameUrl as isBlockedFrameUrl, extension_isExtensionExposed as isExtensionExposed, extension_isLocalNetworkUrl as isLocalNetworkUrl, extension_isType as isType, extension_modifyRequestHeadersPermission as modifyRequestHeadersPermission, extension_permissions as permissions, extension_promptInstall as promptInstall, extension_readCookiePermission as readCookiePermission, extension_removeRequestHeaderRule as removeRequestHeaderRule, extension_revive as revive, extension_setMissingExtensionHandler as setMissingExtensionHandler, extension_setRequestHeaderRule as setRequestHeaderRule, extension_type as type, extension_waitForExtensionExposure as waitForExtensionExposure };
|
|
1867
|
+
export { extension_ATTACH_FRAME_EVENT_KEY as ATTACH_FRAME_EVENT_KEY, extension_assertAttachableFrameUrl as assertAttachableFrameUrl, extension_assertFetchableUrl as assertFetchableUrl, extension_attachFrame as attachFrame, extension_attachFramePermission as attachFramePermission, isExtensionAvailable as available, extension_box as box, extension_cookies as cookies, extension_createVideoElementHandle as createVideoElementHandle, extension_evaluatePermission as evaluatePermission, extension$1 as events, extension$1 as extension, fetch$2 as fetch, extension_fetchCredentialedPermission as fetchCredentialedPermission, extension_fetchLocalPermission as fetchLocalPermission, extension_fetchPermission as fetchPermission, extension_gotoPermission as gotoPermission, extension_handleRevivableModules as handleRevivableModules, extension_isBlockedFetchUrl as isBlockedFetchUrl, extension_isBlockedFrameUrl as isBlockedFrameUrl, extension_isExtensionExposed as isExtensionExposed, extension_isLocalNetworkUrl as isLocalNetworkUrl, extension_isType as isType, extension_modifyRequestHeadersPermission as modifyRequestHeadersPermission, extension_permissions as permissions, extension_promptInstall as promptInstall, extension_readCookiePermission as readCookiePermission, extension_removeRequestHeaderRule as removeRequestHeaderRule, extension_revive as revive, extension_setMissingExtensionHandler as setMissingExtensionHandler, extension_setRequestHeaderRule as setRequestHeaderRule, extension_type as type, extension_waitForExtensionExposure as waitForExtensionExposure };
|
|
1850
1868
|
export type { extension_AttachFrameOptions as AttachFrameOptions, extension_BoxedVideoElement as BoxedVideoElement, extension_CookieDetails as CookieDetails, extension_FetchInit as FetchInit, extension_Frame as Frame, extension_GotoOptions as GotoOptions, extension_HeaderOperation as HeaderOperation, extension_PermissionGrant as PermissionGrant, extension_PermissionRequest as PermissionRequest, extension_ProxyFetchRequest as ProxyFetchRequest, extension_RemoteVideoElement as RemoteVideoElement, extension_RequestHeaderRule as RequestHeaderRule, extension_SiteCookie as SiteCookie, extension_VideoElementState as VideoElementState };
|
|
1851
1869
|
}
|
|
1852
1870
|
|
|
@@ -1942,6 +1960,11 @@ declare namespace account {
|
|
|
1942
1960
|
}
|
|
1943
1961
|
|
|
1944
1962
|
declare const connectButtonUrl: (origin?: string) => string;
|
|
1963
|
+
type ConnectButtonProps = {
|
|
1964
|
+
className?: string;
|
|
1965
|
+
style?: CSSProperties;
|
|
1966
|
+
};
|
|
1967
|
+
declare const ConnectButton: ({ className, style }?: ConnectButtonProps) => ReactElement;
|
|
1945
1968
|
|
|
1946
|
-
export { ATTACH_FRAME_EVENT_KEY, account, assertAttachableFrameUrl, assertFetchableUrl, attachFrame, attachFramePermission, box, cloud, connect, connectButtonUrl, cookies, createVideoElementHandle, desktop, dgram$1 as dgram, dns$1 as dns, extension, fetch$1 as fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, fs, gotoPermission, handleRevivableModules, http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isType, modifyRequestHeadersPermission, net$1 as net, permissions, promptInstall, readCookiePermission, relayWorker, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
|
1947
|
-
export type { AttachFrameOptions, BoxedVideoElement, CookieDetails, FetchInit, Frame, GotoOptions, HeaderOperation, PermissionGrant, PermissionRequest, ProxyFetchRequest, RemoteVideoElement, RequestHeaderRule, SiteCookie, VideoElementState };
|
|
1969
|
+
export { ATTACH_FRAME_EVENT_KEY, ConnectButton, account, assertAttachableFrameUrl, assertFetchableUrl, attachFrame, attachFramePermission, box, cloud, connect, connectButtonUrl, cookies, createVideoElementHandle, desktop, dgram$1 as dgram, dns$1 as dns, evaluatePermission, extension, fetch$1 as fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, fs, gotoPermission, handleRevivableModules, http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isType, modifyRequestHeadersPermission, net$1 as net, permissions, promptInstall, readCookiePermission, relayWorker, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
|
1970
|
+
export type { AttachFrameOptions, BoxedVideoElement, ConnectButtonProps, CookieDetails, FetchInit, Frame, GotoOptions, HeaderOperation, PermissionGrant, PermissionRequest, ProxyFetchRequest, RemoteVideoElement, RequestHeaderRule, SiteCookie, VideoElementState };
|