@fkn/lib 0.9.42 → 0.9.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{api-SwxtiYVU.d.ts → api-CFkZVr53.d.ts} +61 -30
- package/api.d.ts +2 -2
- package/attach-policy.d.ts +11 -15
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fs/promises.d.ts +1 -1
- package/cloud/fs.d.ts +3 -3
- package/cloud/net.d.ts +1 -1
- package/cloud-Bx64HSkQ.cjs +1 -0
- package/cloud-D-vDUzzx.js +552 -0
- package/{cloud-DUH-v10C.d.ts → cloud-DyOQPyUB.d.ts} +4 -4
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +1 -1
- package/{contract-CCxPKIC7.d.ts → contract-6Xfd_qel.d.ts} +173 -22
- package/contract.d.ts +4 -4
- package/dgram.d.ts +7 -14
- package/dns.d.ts +1 -1
- package/{extension-yhwDSIiD.d.ts → extension-BlEtNAYc.d.ts} +36 -37
- package/extension-CzZn0bY2.js +94 -0
- package/extension-DvFf7uoG.cjs +1 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.d.ts +1 -1
- package/{fs-D0MMRnHC.d.ts → fs-KA1Mgisv.d.ts} +2 -2
- package/fs.d.ts +3 -3
- package/http.d.ts +1 -1
- package/{index-BtFiGoVQ.d.ts → index-BOInGaEl.d.ts} +103 -62
- package/{index-D2lvaQDs.d.ts → index-DKr9L2RI.d.ts} +6 -11
- package/index.cjs +1 -1
- package/index.d.ts +36 -39
- package/index.js +55 -55
- package/{lib-DppqX10G.js → lib-C3UwxjVs.js} +560 -474
- package/lib-fqQfEPk6.cjs +53 -0
- package/messages-d7pvCXPn.d.ts +34 -0
- package/messages.d.ts +1 -1
- package/{net-DcLF-6E-.d.ts → net-CmMZgV2a.d.ts} +3 -19
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-CE46SkyA.d.ts → proxy-dOOmiMl4.d.ts} +2 -2
- package/rooms.cjs +1 -1
- package/rooms.d.ts +94 -15
- package/rooms.js +118 -90
- package/{storage-BVr2Rb-d.d.ts → storage-BLBsmkmp.d.ts} +14 -28
- package/{wire-Gbo-D74t.d.ts → wire-BwA4JjZH.d.ts} +6 -12
- package/wire.d.ts +1 -1
- package/cloud-868OlBKn.cjs +0 -1
- package/cloud-f3j4s8yZ.js +0 -545
- package/extension-BOBuYwZc.js +0 -92
- package/extension-hoUs5yJ7.cjs +0 -1
- package/lib-CfdmsLoI.cjs +0 -53
- package/messages-CRcziTuC.d.ts +0 -46
package/lib-fqQfEPk6.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-GNBhZO3-.cjs");let n=require("osra");var r=(e,t)=>{let n=new EventTarget,r=new Map,i=EventTarget.prototype.addEventListener.bind(n),a=EventTarget.prototype.removeEventListener.bind(n);return Object.defineProperty(n,"addEventListener",{configurable:!0,value:(a,o,s)=>{if(o!==null){if(!r.has(a)){let i=r=>{n.dispatchEvent(new CustomEvent(a,{detail:t(r,e),bubbles:r.bubbles,cancelable:r.cancelable,composed:r.composed}))};e.addEventListener(a,i),r.set(a,i)}i(a,o,s)}}}),Object.defineProperty(n,"removeEventListener",{configurable:!0,value:(t,n,i)=>{if(n===null)return;a(t,n,i);let o=r.get(t);o&&(e.removeEventListener(t,o),r.delete(t))}}),n},i=e=>typeof e==`boolean`?+!!e:+!!e?.capture,a=e=>{let t=new WeakMap;return{addEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r);if(s||(s=new Map,t.set(r,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let i=e.unenrich(t,n);typeof r==`function`?r.call(e.target,i):r.handleEvent(i)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},o=e.t({box:()=>S,createVideoElementHandle:()=>x,isType:()=>te,revive:()=>C,type:()=>s}),s=`videoElement`,c=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],l=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],u=[`buffered`,`seekable`],d=Symbol.for(`fkn.remoteVideoElement`),f=Symbol.for(`fkn.remoteVideoElement.state`),p=Symbol.for(`fkn.remoteVideoElement.controller`),m=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],h=e=>{let t={};for(let n of[...c,...l])t[n]=e[n];for(let n of u)t[n]=m(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},g=e=>{let t=t=>{if(!Number.isInteger(t)||t<0||t>=e.length)throw new DOMException(`Index or size is negative or greater than the allowed amount`,`IndexSizeError`)};return{get length(){return e.length},start(n){return t(n),e[n][0]},end(n){return t(n),e[n][1]}}},_=e=>e?{code:e.code,message:e.message,MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4}:null,v=e=>r(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:h(t)})),y=async(e,t)=>{switch(t){case`play`:return await e.play(),null;case`pause`:return e.pause(),null;case`load`:return e.load(),null;case`requestPictureInPicture`:if(typeof e.requestPictureInPicture!=`function`)throw Error(`requestPictureInPicture is not supported in this environment`);return await e.requestPictureInPicture(),null;case`exitPictureInPicture`:{let t=e.ownerDocument;if(typeof t?.exitPictureInPicture!=`function`)throw Error(`exitPictureInPicture is not supported in this environment`);return await t.exitPictureInPicture(),null}default:throw Error(`videoElement: unknown method "${t}"`)}},ee=e=>({call:async t=>y(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return h(e)},events:v(e)}),b=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,d,{value:!0}),Object.defineProperty(n,f,{value:e}),Object.defineProperty(n,p,{value:t});let r=a({target:n,remoteEvents:t.events,unenrich:(t,n)=>{if(!(t instanceof CustomEvent))return t;let r=t.detail;if(!r||!(`snapshot`in r))return t;Object.assign(e,r.snapshot);let i={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed};return r.originalDetail===null?new Event(n,i):new CustomEvent(n,{...i,detail:r.originalDetail})}}),i={addEventListener:{configurable:!0,value:r.addEventListener},removeEventListener:{configurable:!0,value:r.removeEventListener},dispatchEvent:{configurable:!0,value:r.dispatchEvent},error:{configurable:!0,enumerable:!0,get(){return _(e.error)}},play:{configurable:!0,value:()=>t.call(`play`,[])},pause:{configurable:!0,value:()=>{t.call(`pause`,[]).catch(()=>{})}},load:{configurable:!0,value:()=>{t.call(`load`,[]).catch(()=>{})}},requestPictureInPicture:{configurable:!0,value:()=>t.call(`requestPictureInPicture`,[])},exitPictureInPicture:{configurable:!0,value:()=>t.call(`exitPictureInPicture`,[])},HAVE_FUTURE_DATA:{enumerable:!0,value:3},HAVE_ENOUGH_DATA:{enumerable:!0,value:4}};for(let n of c)i[n]={configurable:!0,enumerable:!0,get(){return e[n]},set(r){e[n]=r,t.set(n,r).then(t=>{Object.assign(e,t)},()=>{})}};for(let t of l)i[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of u)i[t]={configurable:!0,enumerable:!0,get(){return g(e[t])}};return Object.defineProperties(n,i),n},x=e=>b(h(e),ee(e)),te=e=>typeof e==`object`&&!!e&&e[d]===!0,S=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},C=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return b({...e.initialState},r)},w=e=>[o,...e],ne=4,re=0,ie=`fknExtension`,ae=`fknExtensionAbi`,oe=`fknExtensionOps`,se=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],ce=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},le=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),ue=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=ce(e[ae]),r=le(e[oe]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},de=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,fe=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),T=class extends Error{abi;required;name=`ExtensionOutdatedError`;constructor(e,t){super(`The FKN WebExtension is installed but too old for this page: it speaks ABI ${e} and this page needs at least ${t}. Updating the extension fixes this.`),this.abi=e,this.required=t}},E=class extends Error{operation;abi;name=`ExtensionOperationUnsupportedError`;constructor(e,t,n){super(n??`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`),this.operation=e,this.abi=t}},pe=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,me=ie,he=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(pe,()=>{he.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:ge()}}))});var ge=()=>typeof document>`u`?!1:document.documentElement.dataset[me]===`true`,D=()=>typeof document>`u`?{status:`absent`}:ue(document.documentElement.dataset),_e=null,ve=e=>{_e=e},ye=150,O=(e=1e3)=>new Promise((t,n)=>{let r=()=>D().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=D();if(e.status===`outdated`)return n(new T(e.abi,e.required));if(_e){if(await _e().catch(()=>{}),r())return t();let e=D();if(e.status===`outdated`)return n(new T(e.abi,e.required))}n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),s=()=>{clearTimeout(i),i=setTimeout(()=>r()?a(t):o(),ye)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...se]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),be,k=new Proxy({},{get:(e,t)=>async(...e)=>{await O(),be??=(0,n.expose)({},{transport:window,revivableModules:w});let r=(await be)[t];return r(...e)}}),xe=[`origin`,`referer`,`cookie`],Se=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),Ce=e=>Se(e,`cookie`),we=(e,t)=>{if(t===`include`&&Ce(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Te=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!xe.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},Ee=[`fkn.app`,`fkn.dev`,`sdbx.app`],De=e=>e.replace(/\.+$/,``),Oe=e=>{let t=De(e);return Ee.some(e=>t===e||t.endsWith(`.${e}`))},ke={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.`},Ae={scope:`network.fetchCredentialed`,category:`network`,severity:3,chip:`load as you`,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},je={scope:`network.fetchLocal`,category:`network`,severity:3,chip:`local network`,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},Me=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},Ne=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:`):Me(n)},Pe=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Oe(t.hostname)},Fe=e=>{if(Pe(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Ie=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=xe.map(e=>{let n=t.get(e);return n===null||n===``?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},Le=async(e,t)=>{let n=new Request(e,t);Fe(n.url);let r=n.body?await n.arrayBuffer():null;return k.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:Ie(t),reason:t?.reason,signal:t?.signal??void 0})},Re={scope:`network.readCookie`,category:`network`,severity:3,chip:`read cookie`,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},ze={get:e=>k.getCookie(e)},Be={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,chip:`rewrite headers`,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},Ve=e=>k.setRequestHeaderRule(e),He=e=>k.removeRequestHeaderRule({ruleId:e}),Ue=class extends Error{reason;filename;line;column;source;constructor(e,t,n,r,i){super(`${e}:${n}:${r}: ${t}`),this.reason=t,this.filename=e,this.line=n,this.column=r,this.source=i}},We=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},A;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(A||={});var Ge=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},j=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=j(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=Ge(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=Ge(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},Ke=/\/\*[^]*?(?:\*\/|$)/g;function M(e){return e?e.trim():``}function N(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{N(e,r)}):n&&typeof n==`object`&&N(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var qe=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case A.stylesheet:return this.stylesheet(e);case A.rule:return this.rule(e);case A.declaration:return this.declaration(e);case A.comment:return this.comment(e);case A.container:return this.container(e);case A.charset:return this.charset(e);case A.counterStyle:return this.counterStyle(e);case A.document:return this.document(e);case A.customMedia:return this.customMedia(e);case A.fontFace:return this.fontFace(e);case A.fontFeatureValues:return this.fontFeatureValues(e);case A.host:return this.host(e);case A.import:return this.import(e);case A.keyframes:return this.keyframes(e);case A.keyframe:return this.keyframe(e);case A.layer:return this.layer(e);case A.media:return this.media(e);case A.namespace:return this.namespace(e);case A.page:return this.page(e);case A.pageMarginBox:return this.pageMarginBox(e);case A.positionTry:return this.positionTry(e);case A.property:return this.property(e);case A.scope:return this.scope(e);case A.startingStyle:return this.startingStyle(e);case A.supports:return this.supports(e);case A.viewTransition:return this.viewTransition(e);case A.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
|
|
2
|
+
|
|
3
|
+
`)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
4
|
+
|
|
5
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
6
|
+
|
|
7
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
8
|
+
|
|
9
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
10
|
+
|
|
11
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
12
|
+
|
|
13
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
14
|
+
|
|
15
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
|
|
16
|
+
`)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
|
|
17
|
+
`)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
|
|
18
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
19
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
20
|
+
}`)}pageMarginBox(e){return this.compress?this.emit(`@${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`${this.indent()}@${e.name} `,e.position)+this.emit(`{
|
|
21
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
22
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){return this.compress?this.emit(`@font-face`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@font-face `,e.position)+this.emit(`{
|
|
23
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
24
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
25
|
+
}`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
26
|
+
|
|
27
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){return this.compress?this.emit(`@property ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@property ${e.name} `,e.position)+this.emit(`{
|
|
28
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
29
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
30
|
+
}`)}counterStyle(e){return this.compress?this.emit(`@counter-style ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@counter-style ${e.name} `,e.position)+this.emit(`{
|
|
31
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
32
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
33
|
+
}`)}fontFeatureValues(e){return this.compress?this.emit(`@font-feature-values ${e.fontFamily}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
34
|
+
|
|
35
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;return this.compress?this.emit(`@scope${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@scope${t}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
36
|
+
|
|
37
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){return this.compress?this.emit(`@view-transition`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@view-transition `,e.position)+this.emit(`{
|
|
38
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
39
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
40
|
+
}`)}positionTry(e){return this.compress?this.emit(`@position-try ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@position-try ${e.name} `,e.position)+this.emit(`{
|
|
41
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
42
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
43
|
+
}`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==A.declaration&&e.type!==A.comment),r=n?`
|
|
44
|
+
|
|
45
|
+
`:`
|
|
46
|
+
`;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
|
|
47
|
+
`)+this.emit(n?``:this.indent(1))+this.mapVisit(e.rules,r)+this.emit(n?`\n${this.indent(-1)}${this.indent()}}`:`${this.indent(-1)}\n${this.indent()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
|
|
48
|
+
`),e.position)+this.emit(` {
|
|
49
|
+
`)+this.emit(this.indent(1))+this.mapVisit(t,`
|
|
50
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(`;`):e.property===`grid-template-areas`?this.emit(this.indent())+this.emit(e.property+`: `+e.value.split(`
|
|
51
|
+
`).join(`
|
|
52
|
+
`.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},Je=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new We(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ue(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
|
|
53
|
+
`);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:A.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=j(e,[`{`]);if(t===-1||t===0)return;let n=e.substring(0,t);return l([n]),((e,t)=>{let n=[],r=0;for(;r<e.length;){let i=j(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(M(n).replace(Ke,``),[`,`]).map(e=>M(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=M(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=j(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=M(s).replace(Ke,``));let u=t({type:A.declaration,property:r.replace(Ke,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function h(){let n=[];if(!s())return o(`missing '{'`);d(n);let r=m();for(;r;)n.push(r),d(n),r=m();for(;t?.silent&&e.length&&e.charAt(0)!==`}`;){let t=e.indexOf(`;`),i=e.indexOf(`}`);if(t===-1||!(i===-1||t<i))break;for(l([e.substring(0,t+1)]),u(),d(n),r=m();r;)n.push(r),d(n),r=m()}return c()?n:o(`missing '}'`)}function g(){let t=j(e,[`{`]);if(t===-1)return!1;let n=j(e,[`;`]),r=j(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function _(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return c()?n:o(`missing '}'`)}function v(){let n=[];for(u(),d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return n}function y(){let t=[],n=i(),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);for(;r;){let n=l(r);t.push(n[1]);let i=/^,\s*/.exec(e);i&&l(i),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e)}if(t.length)return n({type:A.keyframe,values:t,declarations:h()||[]})}let ee=RegExp(`^@(${[`top-left-corner`,`top-left`,`top-center`,`top-right`,`top-right-corner`,`bottom-left-corner`,`bottom-left`,`bottom-center`,`bottom-right`,`bottom-right-corner`,`left-top`,`left-middle`,`left-bottom`,`right-top`,`right-middle`,`right-bottom`].join(`|`)})(?![\\w-])\\s*`),b=S(`import`),x=S(`charset`),te=S(`namespace`);function S(t){let n=RegExp(`^@`+t+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{let r=i(),a=n.exec(e);if(!a)return;let o=l(a),s={type:t};return s[t]=o[1].trim(),r(s)}}function C(){if(e[0]===`@`)return function(){let t=i(),n=/^@([-\w]+)?keyframes\s*/.exec(e);if(!n)return;let r=l(n)[1],a=/^([-\w]+)\s*/.exec(e);if(!a)return o(`@keyframes missing name`);let u=l(a)[1];if(!s())return o(`@keyframes missing '{'`);let f=d(),p=y();for(;p;)f.push(p),f=f.concat(d()),p=y();return c()?t({type:A.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=M(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=v();return c()?t({type:A.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:A.customMedia,name:M(r[1]),media:M(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=M(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=v();return c()?t({type:A.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||b()||x()||te()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=M(r[1]),u=M(r[2]);if(!s())return o(`@document missing '{'`);let d=v();return c()?t({type:A.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:A.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=v();return c()?t({type:A.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:A.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=M(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=v();return c()?t({type:A.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=M(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=v();return c()?t({type:A.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=v();return c()?t({type:A.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=M(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:A.layer,layer:r})}let a=v();return c()?t({type:A.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=M(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=v();return c()?t({type:A.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:A.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=ee.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=j(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=M(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=v();return c()?t({type:A.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:A.atRule,name:r,prelude:a})}()}function w(){let e=i(),t=p();return t?(d(),e({type:A.rule,selectors:t,declarations:_()||[]})):o(`selector missing`)}return N(function(){let n=function(){let n,r=[];for(u(),d(r);e.length;){if(e.charAt(0)===`}`){if(t?.silent){o(`extra '}'`),l([`}`]),u(),d(r);continue}break}if(n=C()||w(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:A.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Ye=(e,t)=>new qe(t||{}).compile(e),Xe=Object.defineProperty,Ze=(e,t)=>{let n={};for(var r in e)Xe(n,r,{get:e[r],enumerable:!0});return t||Xe(n,Symbol.toStringTag,{value:`Module`}),n},Qe=`LocatorError`,P=`LocatorUnsupportedError`,F=`LocatorDeniedError`,I=`LocatorInvalidError`,L=e=>typeof e==`object`&&e?e.name:void 0,R=e=>Object.assign(Error(e),{name:Qe}),z=(e,t=``,n)=>Object.assign(Error(e),{name:P,operation:t,backend:n}),$e=(e,t)=>z(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),B=(e,t)=>Object.assign(Error(e),{name:F,operation:t}),et=(e,t)=>Object.assign(Error(e),{name:I,operation:t}),V=class extends Error{name=`TimeoutError`;constructor(e,t){super(e,t?.cause===void 0?void 0:{cause:t.cause})}},tt=e=>L(e)===P,nt=e=>L(e)===F,H=e=>L(e)===I,rt=e=>nt(e)||tt(e)||H(e),U=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw R(`the resolved element belongs to a document with no window`);return t},it=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},at=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return it(U(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=it(globalThis,t);return r&&e instanceof r?r:null},W=(e,t)=>at(e,t)!==null,G=e=>{if(e.length===0)throw R(`No elements found`);if(e.length>1)throw R(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},ot=(e,t)=>{if(!W(e,t))throw R(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},st=e=>e.tagName.toLowerCase(),ct=new Set,lt=e=>{ct.add(e)},ut=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,dt=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),ft=e=>!ut.test(dt(e.value)),pt=new Set([A.import,A.fontFace,A.namespace,A.charset,A.document,A.comment]),mt=e=>{if(pt.has(e.type))return null;if(e.type===A.declaration)return ft(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=ht(r))}return n},ht=e=>e.map(e=>mt(e)).filter(e=>e!==null),gt=e=>{let t;try{t=Je(e,{silent:!0})}catch{return``}return t.stylesheet.rules=ht(t.stylesheet.rules),Ye(t)},_t=(e,t)=>{let n=()=>{t.parentNode||(e.head??e.documentElement).appendChild(t)};if(n(),e.readyState===`complete`)return;let r=new MutationObserver(e=>{for(let r of e)for(let e of r.removedNodes)if(e===t||e.contains?.(t)){n();return}});r.observe(e.documentElement,{childList:!0,subtree:!0});let i=()=>r.disconnect(),a=e.defaultView;a?a.addEventListener(`load`,i,{once:!0}):setTimeout(i,3e4)},vt={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:gt(t.content);try{_t(e.document,n)}catch(e){console.error(e)}lt(n)}},yt=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},K={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw et(`fetch: url must be a string`,`fetch`);let r=U(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw et(`fetch: not a valid url: ${t}`,`fetch`)}let a=await r.fetch(i,{method:n.method??`GET`,headers:n.headers,body:n.body??null,redirect:n.redirect??`follow`,credentials:n.credentials??`include`});return{status:a.status,statusText:a.statusText,ok:a.ok,url:a.url,redirected:a.redirected,type:a.type,headers:yt(a.headers),body:await a.arrayBuffer()}}},q=Ze({click:()=>xt,count:()=>kt,exists:()=>At,fill:()=>Tt,getAttribute:()=>Dt,hover:()=>St,isVisible:()=>Ot,textContent:()=>Et}),bt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},xt={resolve:(e,t={})=>{let n=G(e.elements),r=U(n),i={bubbles:!0,cancelable:!0,composed:!0,...bt(n,t.position),button:0},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerdown`,{...a,buttons:1})),n.dispatchEvent(new r.MouseEvent(`mousedown`,{...i,buttons:1})),n.dispatchEvent(new r.PointerEvent(`pointerup`,{...a,buttons:0})),n.dispatchEvent(new r.MouseEvent(`mouseup`,{...i,buttons:0})),n.dispatchEvent(new r.MouseEvent(`click`,{...i,buttons:0}))}},St={resolve:(e,t={})=>{let n=G(e.elements),r=U(n),i={bubbles:!0,cancelable:!0,composed:!0,...bt(n,t.position)},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerover`,a)),n.dispatchEvent(new r.PointerEvent(`pointerenter`,{...a,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseenter`,{...i,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseover`,i)),n.dispatchEvent(new r.PointerEvent(`pointermove`,a)),n.dispatchEvent(new r.MouseEvent(`mousemove`,i))}},Ct=(e,t)=>{e._valueTracker?.setValue(``);let n=(at(e,`HTMLTextAreaElement`)??at(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},wt=(e,t)=>{if(e.type!==`range`)return null;let n=Number(e.min||0),r=Number(e.max||100);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)return null;let i=Number(t);if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(1,(i-n)/(r-n))),o=e.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width*a,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};return{pointerDown:{...c,buttons:1},pointerUp:{...c,buttons:0},mouseDown:{...s,buttons:1},mouseUp:{...s,buttons:0}}},Tt={resolve:(e,t,n={})=>{let r=G(e.elements),i=U(r),a=W(r,`HTMLInputElement`);if(a||W(r,`HTMLTextAreaElement`)){let e=r,n=a?wt(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),Ct(e,t),r.dispatchEvent(new i.Event(`input`,{bubbles:!0})),n&&(r.dispatchEvent(new i.PointerEvent(`pointerup`,n.pointerUp)),r.dispatchEvent(new i.MouseEvent(`mouseup`,n.mouseUp))),r.dispatchEvent(new i.Event(`change`,{bubbles:!0}));return}if(W(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${st(r)}> is not fillable`)}},Et={resolve:(e,t={})=>G(e.elements).textContent},Dt={resolve:(e,t,n={})=>G(e.elements).getAttribute(t)},Ot={resolve:(e,t={})=>{let n=G(e.elements);if(!W(n,`HTMLElement`))return!0;let r=U(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},kt={resolve:(e,t={})=>e.elements.length},At={resolve:(e,t={})=>e.elements.length>0},J=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),jt=e=>e.replaceAll(`"`,`\\"`),Mt={to:`element`,css:!0,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},Nt={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Pt={element:{selectors:{locator:Mt,frameLocator:Nt,getByRole:{to:`element`,resolve:(e,t)=>J(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${jt(e)}"]`:`[role]`})},getByText:{to:`element`,resolve:(e,t)=>e.elements.flatMap(e=>[e,...e.querySelectorAll(`*`)]).filter(e=>e.textContent?.includes(t)),render:e=>({fragment:typeof e==`string`?`:has-text("${jt(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>J(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${jt(e)}"]`:`[data-testid]`})},first:{to:`element`,resolve:e=>e.elements.slice(0,1),render:()=>({fragment:`:first`})},nth:{to:`element`,resolve:(e,t)=>{let n=e.elements.at(t);return n?[n]:[]},render:e=>({fragment:typeof e==`number`?`:nth(${e})`:`:nth(?)`})}},operations:{click:xt,fill:Tt,hover:St,textContent:Et,getAttribute:Dt,isVisible:Ot,count:kt,exists:At}},frame:{selectors:{locator:Mt,frameLocator:Nt,owner:{to:`frame`,barrier:`up`,resolve:e=>{throw Error(`owner: must be processed by the executor as an upward pivot`)},render:()=>({fragment:``,separator:`up`})}},operations:{addStyleTag:vt,fetch:K}}},Ft=(e,t=Pt)=>({element:{selectors:{...t.element.selectors,...e.element?.selectors},operations:{...t.element.operations,...e.element?.operations}},frame:{selectors:{...t.frame.selectors,...e.frame?.selectors},operations:{...t.frame.operations,...e.frame?.operations}}}),It=3e4,Lt=50,Rt=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},zt=e=>{let t=Rt(e)?.timeout;return typeof t==`number`?t:It},Bt=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),Vt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Bt(e))},Ht=(e,t)=>{if(t!==void 0&&typeof t==`number`&&!(Number.isFinite(t)&&t>0))throw TypeError(`${e}: timeout must be a positive number of milliseconds, not ${t}; every call ends at its deadline, so 0 does not turn it off`)},Ut=e=>typeof e==`object`&&e&&typeof e.message==`string`?e.message:String(e),Wt=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;Ht(i,Rt(a)?.timeout),n&&await n({parts:r,operation:i,args:a,phase:`execute`},Bt(e));let o=zt(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{for(;Date.now()<s;)try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(rt(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Lt,t)))}}finally{clearTimeout(d)}throw f===c?new V(c.message):new V(Ut(f),{cause:f})},Gt=(e,t,n,r,i)=>{let a={};for(let[o,s]of Object.entries(t[r].selectors))a[o]=(...a)=>Gt(e,t,n,s.to,[...i,{kind:r,name:o,args:a}]);for(let[n,o]of Object.entries(t[r].operations))a[n]=async(...t)=>Wt({...e,parts:i,operation:n,args:o.send?o.send(...t):t});for(let[o,{to:s,rewrite:c}]of Object.entries(n[r]??{}))a[o]=(...r)=>Gt(e,t,n,s,c(i,...r));return a.ensure=(n,a={})=>{let o=t[r].operations[n]?.ensureArgs;return Vt({...e,parts:i,operation:n,args:o?.(a)??[a]})},a},Kt=e=>Gt(e,e.modules??Pt,e.rewrites??{},`frame`,[]),qt=()=>{let e=D();return e.status===`ok`&&e.abi>=2},Jt=async()=>{await O();let e=D();if(e.status===`ok`&&e.abi<2)throw new T(e.abi,2)},Yt=e=>`Read the text, links and details ${e} shows.`,Xt=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,Zt=[{id:`interaction`,heading:`Interaction`,summary:`Allow the app to interact with the website (clicks, type in text, etc.)`,title:e=>`Interact with ${e}`,description:(e,t)=>t?`Click, type and hover on ${e} for you. If you are signed in there, this happens as you.`:`Click, type and hover on ${e} for you, in a signed-out view.`,cloudTitle:e=>`Click and type on ${e}`,cloudDescription:e=>`Clicks, types and scrolls on ${e} for you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:Yt,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:Yt},{id:`network`,heading:`Network`,summary:`Make requests on behalf of the website (using your cookies, etc.)`,title:e=>`Make requests to ${e} as you`,description:e=>`Load pages and data from ${e} and send changes there with your signed-in session.`,cloudTitle:e=>`Load and send data on ${e}`,cloudDescription:e=>`Loads pages and data from ${e} and sends changes there.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:Xt,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:Xt}],Qt=e=>t=>{if(typeof t!=`object`||!t)return t===void 0?[]:[t];if(t.position!==void 0)throw TypeError(`${e}: position is Playwright's offset in pixels, which no backend serves yet; pass relativePosition, a 0..1 fraction of the box`);let{relativePosition:n,...r}=t;return[n===void 0?r:{...r,position:n}]},$t=Ft({element:{operations:{click:{resolve:(e,t={})=>q.click.resolve(e,t),send:Qt(`click`)},hover:{resolve:(e,t={})=>q.hover.resolve(e,t),send:Qt(`hover`)},fill:{resolve:(e,t,n={})=>q.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>q.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>q.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>q.isVisible.resolve(e)},count:{resolve:(e,t={})=>q.count.resolve(e)},exists:{resolve:(e,t={})=>q.exists.resolve(e)},videoElement:{resolve:(e,t={})=>x(ot(G(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>vt.resolve(e,t)},fetch:{resolve:(e,t,n={})=>K.resolve(e,t,n),kind:K.kind,ensureArgs:K.ensureArgs},evaluate:{kind:`frame`,typed:!1,resolve:(e,t,n)=>{throw $e(`evaluate`,`this realm`)}}}}}),en=e=>e[e.length-1],tn={element:{last:{to:`element`,rewrite:e=>[...e,{kind:`element`,name:`nth`,args:[-1]}]},contentFrame:{to:`frame`,rewrite:e=>{let t=en(e);if(t?.name!==`locator`)throw TypeError(`locator.contentFrame: only a locator that ends in locator(selector) can enter its frame; use frameLocator(selector)`);return[...e.slice(0,-1),{...t,name:`frameLocator`}]}}},frame:{owner:{to:`element`,rewrite:e=>{let t=en(e);if(t?.name!==`frameLocator`)throw TypeError(`frameLocator.owner: this frame was not entered through frameLocator(selector)`);return[...e.slice(0,-1),{...t,name:`locator`}]}},getByTestId:{to:`element`,rewrite:(e,t)=>[...e,{kind:`element`,name:`getByTestId`,args:[t]}]}}},nn=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||t.protocol!==`about:`&&Oe(t.hostname)},Y=e=>{if(nn(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},rn=({src:e,domains:t,lockdown:n})=>{if(n&&!t.length&&e&&e!==`about:blank`)throw Error(`attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto`)},an={scope:`embed.iframe`,category:`interaction`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},on={scope:`embed.open`,category:`interaction`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},sn=[`load`,`commit`],cn=e=>{if(`timeoutMs`in e)throw TypeError(`frame.goto: pass timeout, in milliseconds; timeoutMs is not an option`);let{waitUntil:t,timeout:n}=e;if(t!==void 0&&!sn.includes(t))throw TypeError(`frame.goto: waitUntil must be 'load' or 'commit', not ${JSON.stringify(t)}`);if(n!==void 0&&typeof n!=`number`)throw TypeError(`frame.goto: timeout must be a number of milliseconds`);Ht(`frame.goto`,n)},ln=class extends Error{name=`FrameWindowBlockedError`;constructor(){super(`attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page`)}},un=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),dn=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=un.has(e)?e:`unknown`;super(t===`opaque-opener`?`attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened`:`attachFrame: the window refused to attach (${t}), and loaded nothing`),this.reason=t}},fn=[`message`,`document`],pn=e=>{if(e===`*`)return`*`;let t=()=>TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);if(typeof e!=`string`)throw t();let n;try{n=new URL(e).origin}catch{throw t()}if(n===`null`)throw t();return n},mn=(e,t)=>{let n=typeof e==`object`&&!!e;if(n&&t!==void 0)throw TypeError(`frame.postMessage: pass transfer inside the options object, not after it`);let r=n?e.targetOrigin??`*`:e??`*`,i=n?e.transfer:t;if(i!==void 0&&!Array.isArray(i))throw TypeError(`frame.postMessage: transfer must be an array`);return{targetOrigin:pn(r),transfer:i===void 0?[]:[...i]}},hn=[`url`,`path`,`type`],gn=[`content`,`sourceUrl`],_n=/[\n\r\u2028\u2029]/,vn=e=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`frame.addScriptTag: options must be an object { content }`);let t=Object.keys(e),n=t.find(e=>hn.includes(e));if(n!==void 0)throw TypeError(`frame.addScriptTag: "${n}" is not served; it runs content as a classic inline script`);let r=t.find(e=>!gn.includes(e));if(r!==void 0)throw TypeError(`frame.addScriptTag: unknown option "${r}"`);let{content:i,sourceUrl:a}=e;if(typeof i!=`string`)throw TypeError(`frame.addScriptTag: content must be a string`);if(a!==void 0&&(typeof a!=`string`||a===``||_n.test(a)))throw TypeError(`frame.addScriptTag: sourceUrl must be a non-empty string with no line break`);return a===void 0?{content:i}:{content:i,sourceUrl:a}},yn=[`name`,`domain`,`path`],bn=e=>e instanceof RegExp||Object.prototype.toString.call(e)===`[object RegExp]`,xn=e=>{if(e===void 0)return{};if(Object.prototype.toString.call(e)!==`[object Object]`)throw TypeError(`frame.clearCookies: options must be an object`);let t=e,n=Object.keys(t).find(e=>!yn.includes(e));if(n!==void 0)throw TypeError(`frame.clearCookies: unknown option "${n}"`);let r=yn.flatMap(e=>{let n=t[e];return n===void 0?[]:[{key:e,value:n}]}),i=r.find(({value:e})=>bn(e));if(i!==void 0)throw TypeError(`frame.clearCookies: ${i.key} is a RegExp, and clearCookies takes strings for name, domain and path for now`);let a=r.find(({value:e})=>typeof e!=`string`);if(a!==void 0)throw TypeError(`frame.clearCookies: ${a.key} must be a string`);let o=r.find(({value:e})=>e===``);if(o!==void 0)throw TypeError(`frame.clearCookies: ${o.key} must not be empty; leave it out to match every ${o.key}`);let s={};for(let{key:e,value:t}of r)s[e]={equals:t};return s},Sn=e=>{typeof globalThis.reportError==`function`?globalThis.reportError(e):console.error(e)},Cn=e=>{let{owner:t,...n}=Kt({executor:e.executor,modules:$t,rewrites:tn,gate:e.gate}),r=async(t,n={})=>(Y(t),cn(n),e.goto(t,n)),i=()=>e.url(),a=async t=>{let n=e.requestPermissions;if(!n)throw Error(`frame.requestPermissions: this backend cannot ask for permission categories`);return n(t)},o=async(t,n)=>{let r=e.evaluate;if(!r)throw Error(`frame.evaluate: this backend cannot run code in the attached frame`);let i=typeof t==`function`?t.toString():t;if(typeof i!=`string`)throw TypeError(`frame.evaluate: pass a function or a source string`);return r(i,structuredClone(n))},s=async t=>{let{content:n,...r}=vn(t),i=e.addScriptTag;if(!i)throw Error(`frame.addScriptTag: this backend cannot run scripts in the attached frame`);await i(n,r)},c=async t=>{let n=xn(t),r=e.clearCookies;if(!r)throw Error(`frame.clearCookies: this backend cannot clear cookies`);await r(n)},l=((t,n,r)=>{try{let i=e.postMessage;if(!i)throw Error(`frame.postMessage: this backend cannot message the attached frame`);let a=mn(n,r);return i(t,a.targetOrigin,a.transfer)}catch(e){return Promise.reject(e)}}),u={message:new Set,document:new Set},d=null,f=(e,t)=>{if(!fn.includes(e))throw TypeError(`frame.${t}: the event type must be ${fn.map(e=>`'${e}'`).join(` or `)}, not ${JSON.stringify(e)}`);return u[e]},p=e=>{let t=e.type===`message`?Object.freeze({type:`message`,data:e.data,origin:e.origin,ports:Object.freeze([...e.ports]),source:_}):Object.freeze({type:`document`,origin:e.origin});for(let n of[...u[e.type]])try{n(t)}catch(e){Sn(e)}},m=(e,t)=>{if(f(e,`off`).delete(t),d!==null&&!u.message.size&&!u.document.size){let e=d;d=null,e()}},h=(t,n,r={})=>{let i=f(t,`on`);if(typeof n!=`function`)throw TypeError(`frame.on: the listener must be a function`);let{signal:a}=r;if(!(a?.aborted||i.has(n))){if(d===null){let t=e.listen;if(!t)throw Error(`frame.on: this backend cannot relay the page's messages`);d=t(p)}i.add(n),a?.addEventListener(`abort`,()=>m(t,n),{once:!0})}},g=()=>e.backend,_={...n,goto:r,url:i,backend:g,requestPermissions:a,evaluate:o,addScriptTag:s,clearCookies:c,postMessage:l,on:h,off:m};return _},wn=[t.v,t._,t.y,t.h,t.g,t.n,t.i,t.r,t.f,t.a,t.o,t.s,t.p,an,on,t.u,t.d,ke,Ae,je,Re,Be],Tn=Zt.map(e=>e.id),En={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},Dn=e=>e===0?`auto`:e===4?`critical`:`bundled`,On=wn,X=new Map,kn={};(()=>{X=new Map(On.map(e=>[e.scope,e])),kn=Object.fromEntries(X),On.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>On.filter(t=>t.category===e&&Dn(t.severity)===`bundled`);Object.fromEntries(Tn.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(Tn.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var An=e=>X.get(e)?.category,jn=e=>{let t=X.get(e);return t&&Dn(t.severity)},Mn=e=>{let t=X.get(e);if(t)return Dn(t.severity)===`critical`?t.scope:t.category},Nn=e=>En[e],Pn=({category:e,key:t})=>{let n=t??(e&&Nn(e));return n!==void 0&&An(n)!==void 0?n:void 0},Fn=(e,t)=>{for(let{category:n,key:r}of t)if(Pn({category:n,key:r})===void 0)throw TypeError(r===void 0?n===void 0?`${e}: name a category or a permission key`:`${e}: unknown permission category "${n}"`:`${e}: unknown permission key "${r}"`)},In=(e,t={})=>{let n=[],r=e.map(e=>{let r=Pn(e),i=[];if(r!==void 0)for(let a of e.hosts)i.push(n.length),n.push({...t,key:r,scope:``,site:a,hosts:e.hosts,reason:e.reason});return{key:r!==void 0&&jn(r)===`critical`?r:void 0,category:r===void 0?e.category??`interaction`:kn[r].category,hosts:e.hosts,indexes:i}});return{items:n,answer:e=>r.map(({key:t,category:n,hosts:r,indexes:i})=>({category:n,...t===void 0?{}:{key:t},hosts:r,allow:i.length>0&&i.every(t=>e[t]?.allow===!0)}))}},Ln=e=>typeof e==`object`&&!!e,Rn=typeof chrome<`u`&&!!chrome.runtime?.id,zn=e=>Ln(e)&&e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY===!0&&typeof e.frameId==`string`&&typeof e.document==`string`,Bn=new WeakMap,Vn=new WeakMap,Hn=new WeakMap,Un=new Set;typeof window<`u`&&Rn&&window.addEventListener(`message`,e=>{if(!zn(e.data))return;e.stopImmediatePropagation();let t=e.source;if(!t||typeof t!=`object`)return;let n=t,r=Bn.get(n),i=e.data.frameId,a=e.data.document;if(Bn.set(n,i),Vn.set(n,a),r)for(let e of Un)e(r);let o=Hn.get(n);if(o){for(let e of[...o])(e.notDocument===void 0||e.notDocument!==a)&&(o.delete(e),e.resolve(i));o.size||Hn.delete(n)}},{capture:!0});var Wn=3e4,Gn=`frame.evaluate: the code did not settle within ${Wn}ms`,Kn=()=>new V(Gn),qn=e=>H(e)&&e.message===Gn?Kn():e,Jn=[/^frame load timed out after \d+ms for /,/^frame goto: documentstart timed out$/,/^navigation to .+ did not commit a document within \d+ms$/s],Yn=e=>{if(e instanceof V)return e;let t=typeof e?.message==`string`?e.message:``;return Jn.some(e=>e.test(t))?new V(t):e},Xn=e=>{let t=e;if(t.window===void 0)return`iframe`;if(t.iframe!==void 0)throw TypeError(`attachFrame: pass either iframe or window, not both`);if(t.lockdown)throw TypeError(`attachFrame: lockdown applies to an iframe, never to a window`);if(t.blank!==void 0)throw TypeError(`attachFrame: blank does not apply to a window`);if(typeof t.window!=`object`||t.window===null)throw TypeError(`attachFrame: window must be an object`);return`window`},Zn=(e,t,n)=>{if(e===void 0)return t;if(typeof e!=`number`||!Number.isFinite(e)||e<=0)throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);return Math.round(e)},Qn=({url:e,width:t,height:n})=>{let r=(()=>{if(e===void 0||e===``||e===`about:blank`)return``;if(typeof e!=`string`)throw TypeError(`attachFrame: window.url must be a string`);let t=(()=>{try{return new URL(e,location.href)}catch{throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`)}})();if(t.protocol!==`http:`&&t.protocol!==`https:`)throw TypeError(`attachFrame: window.url must be an http or https address`);return t.href})();return r&&Y(r),{url:r,width:Zn(t,500,`width`),height:Zn(n,700,`height`)}},$n=`attachFrame: storageState seeds a fresh jar, so it needs cookies: 'ephemeral'`,er=1e11,tr=[`name`,`value`,`domain`,`path`,`expires`,`httpOnly`,`secure`,`sameSite`],nr=[`Strict`,`Lax`,`None`],rr=/[;\x00-\x1f\x7f]/,Z=(e,t)=>TypeError(`attachFrame: storageState${e} ${t}`),Q=e=>Object.prototype.toString.call(e)===`[object Object]`,ir=e=>{let t=e.startsWith(`.`)?e.slice(1):e;if(t===``)return null;try{return new URL(`http://${t}/`).hostname===t.toLowerCase()?t.toLowerCase():null}catch{return null}},ar=(e,t)=>{if(!Q(e))throw Z(t,`must be an object`);let n=Object.keys(e).find(e=>!tr.includes(e));if(n!==void 0)throw Z(`${t}.${n}`,`is not a cookie field`);let{name:r,value:i,domain:a,path:o,expires:s,httpOnly:c,secure:l,sameSite:u}=e;if(typeof r!=`string`||r===``||r.includes(`=`)||rr.test(r))throw Z(`${t}.name`,`must be a non-empty string with no "=", ";" or control character`);if(typeof i!=`string`||rr.test(i))throw Z(`${t}.value`,`must be a string with no ";" or control character`);if(typeof a!=`string`||ir(a)===null)throw Z(`${t}.domain`,`must be a host: ".youtube.com" for a cookie its subdomains also receive, "www.youtube.com" for a host-only one`);if(o!==void 0&&(typeof o!=`string`||!o.startsWith(`/`)||rr.test(o)))throw Z(`${t}.path`,`must be a string starting with "/"`);if(s!==void 0&&(typeof s!=`number`||!Number.isFinite(s)||s<=0&&s!==-1))throw Z(`${t}.expires`,`must be -1 for a session cookie, or milliseconds since the epoch`);if(c!==void 0&&typeof c!=`boolean`)throw Z(`${t}.httpOnly`,`must be a boolean`);if(l!==void 0&&typeof l!=`boolean`)throw Z(`${t}.secure`,`must be a boolean`);if(u!==void 0&&!nr.includes(u))throw Z(`${t}.sameSite`,`must be 'Strict', 'Lax' or 'None', not ${JSON.stringify(u)}`);let d=r.toLowerCase();if(u===`None`&&l!==!0)throw Z(t,`is SameSite=None, which needs secure: true`);if(d.startsWith(`__secure-`)&&l!==!0)throw Z(t,`is a __Secure- cookie, which needs secure: true`);if(d.startsWith(`__host-`)&&(l!==!0||a.startsWith(`.`)||(o??`/`)!==`/`))throw Z(t,`is a __Host- cookie, which needs secure: true, a host-only domain and path "/"`);let f={name:r,value:i,domain:a};return o!==void 0&&(f.path=o),s!==void 0&&(f.expires=s),c!==void 0&&(f.httpOnly=c),l!==void 0&&(f.secure=l),u!==void 0&&(f.sameSite=u),f},or=(e,t)=>{if(!Q(e))throw Z(t,`must be an object { origin, localStorage }`);let n=Object.keys(e).find(e=>e!==`origin`&&e!==`localStorage`);if(n!==void 0)throw Z(`${t}.${n}`,`is not an origin field`);let{origin:r,localStorage:i}=e,a=(()=>{try{return typeof r==`string`?new URL(r):null}catch{return null}})();if(a===null||a.protocol!==`http:`&&a.protocol!==`https:`||a.origin!==r)throw Z(`${t}.origin`,`must be an absolute http or https origin, not ${JSON.stringify(r)}`);if(!Array.isArray(i))throw Z(`${t}.localStorage`,`must be an array`);return{origin:r,localStorage:i.map((e,n)=>{let{name:r,value:i}=Q(e)&&Object.keys(e).every(e=>e===`name`||e===`value`)?e:{};if(typeof r!=`string`||typeof i!=`string`)throw Z(`${t}.localStorage[${n}]`,`must be { name, value } strings`);return{name:r,value:i}})}},sr=e=>{if(!Q(e))throw Z(``,`must be an object { cookies?, origins? }`);let t=Object.keys(e).find(e=>e!==`cookies`&&e!==`origins`);if(t!==void 0)throw Z(`.${t}`,`is not a storageState key; it takes cookies and origins`);let{cookies:n=[],origins:r=[]}=e;if(!Array.isArray(n))throw Z(`.cookies`,`must be an array`);if(!Array.isArray(r))throw Z(`.origins`,`must be an array`);let i=n.map((e,t)=>ar(e,`.cookies[${t}]`)),a=r.map((e,t)=>or(e,`.origins[${t}]`));return i.forEach(({expires:e},t)=>{if(e!==void 0&&e>0&&e<er)throw Z(`.cookies[${t}].expires`,`is milliseconds since the epoch, and ${e} reads as a date before 1974; a Playwright storageState gives seconds, so multiply it by 1000`)}),{cookies:i,origins:a}},cr=[`persistent`,`ephemeral`,`native`],lr=`attachFrame: syncCookies was replaced by cookies. true is cookies: 'persistent', or 'native' for the person's own browser cookies on the extension; false is cookies: 'ephemeral'`,ur=e=>{if(`syncCookies`in e)throw TypeError(lr);let{cookies:t=`persistent`}=e;if(!cr.includes(t))throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);if(e.storageState!==void 0&&t!==`ephemeral`)throw TypeError($n);let n=e.storageState===void 0?void 0:sr(e.storageState),r=Xn(e);if(r===`iframe`&&e.lockdown&&t!==`native`)throw TypeError(`attachFrame: lockdown runs on the extension, which serves only cookies: 'native'`);return n===void 0?{kind:r,cookies:t}:{kind:r,cookies:t,storageState:n}},dr=e=>{try{return new URL(e).hostname}catch{return``}},fr=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,pr=!1,mr=()=>{pr||(pr=!0,console.warn(`[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this.`))},hr=`frame: this frame no longer holds the document the app attached it to`,gr=`frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin`,_r=()=>{let e=D();if(e.status===`ok`&&e.abi>=1)return;let t=e.status===`absent`?0:e.abi;throw new E(`lockdown`,t,`attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`)},vr=e=>{try{return new URL(e,location.href).hostname}catch{return``}},$=()=>{let e=D();return e.status===`absent`?0:e.abi},yr=`attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame`,br=`frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame`,xr=`frame.clearCookies: an extension frame runs on the browser's own cookies (cookies: 'native'), which FKN does not clear; attach with cookies: 'persistent' to clear the app's jar`,Sr=async({iframe:e,domains:n=[],lockdown:r=!1,permissions:i,blank:a})=>{if(a!==void 0)throw new E(`blank`,$(),yr);let o=crypto.randomUUID();if(Y(e.src),rn({src:e.src,domains:n,lockdown:r}),await O(),r&&_r(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(fr,{detail:o}));let{executeLocator:s,highlightLocator:c,ensureLocatorPermission:l,requestCategories:u,evaluateFrame:d,goto:f}=await k.attachFrame({marker:o,domains:n,syncCookies:!0,lockdown:r}),p=new Set(t.t([...n,vr(e.src)],{ipv6:!0})),m=e=>p.has(t.t([dr(e)],{ipv6:!0})[0]??``),h=Cn({backend:`extension`,executor:{execute:s,highlight:c},gate:e=>l(e.parts,e.operation,e.args),requestPermissions:async e=>(Fn(`frame.requestPermissions`,e),await Jt(),u(e)),evaluate:async(e,t)=>{if(!fe(D(),`evaluate`)){let e=D();throw new E(`evaluate`,e.status===`ok`?e.abi:0)}return d({source:e,arg:t}).catch(e=>{throw qn(e)})},addScriptTag:async()=>{throw new E(`addScriptTag`,$(),br)},clearCookies:async()=>{throw new E(`clearCookies`,$(),xr)},postMessage:(t,n,r)=>{if(n===`*`)throw z(gr,`postMessage`,`extension`);if(!m(n))throw B(hr,`postMessage`);let i=e.contentWindow;if(i===null)throw B(`frame: navigate the frame before postMessage`,`postMessage`);return i.postMessage(t,n,r),Promise.resolve()},listen:t=>{let n=n=>{n.source!==null&&n.source===e.contentWindow&&!zn(n.data)&&m(n.origin)&&t({type:`message`,data:n.data,origin:n.origin,ports:n.ports})},r=()=>t({type:`document`,origin:``});return window.addEventListener(`message`,n),e.addEventListener(`load`,r),()=>{window.removeEventListener(`message`,n),e.removeEventListener(`load`,r)}},goto:(e,{waitUntil:n,timeout:r,...i}={})=>{for(let n of t.t([vr(e)],{ipv6:!0}))p.add(n);return f({url:e,...i,...n===void 0?{}:{waitUntil:n===`commit`?`documentstart`:n},...r===void 0?{}:{timeoutMs:r}}).catch(e=>{throw Yn(e)})},url:()=>e.src});return i?.length&&(qt()?await h.requestPermissions(i):mr()),h},Cr=`attachFrame: a window on cookies: 'native' is not served yet; a window runs on the cloud render proxy, which has no browser cookies`,wr=e=>`attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`,Tr=async e=>{throw Qn(e.window),new E(`attachWindow`,$(),Cr)},Er=(async e=>{let{kind:t,cookies:n}=ur(e);if(n!==`native`)throw new E(`cookies`,$(),wr(n));return t===`window`?Tr(e):Sr(e)}),Dr=`permissions.request: pass hosts, the sites the grant applies to`,Or={request:async e=>{let n=e.map(e=>{let{category:n,key:r,scope:i,reason:a,hosts:o}=e;if(!(`hosts`in e)&&!(`category`in e))return{legacy:{key:r,scope:i??``,reason:a}};let s=t.t(o??[],{ipv6:!0});if(!s.length)throw TypeError(Dr);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);Fn(`permissions.request`,r),r.length&&await Jt();let{items:i,answer:a}=In(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await k.requestPermissions(s):[],l=a(c.slice(0,i.length)),u=c.slice(i.length),d=0,f=0;return n.map(e=>`ask`in e?l[d++]:u[f++])}},kr=`PermissionDeniedError`,Ar=e=>e instanceof Error?e.name===kr:Ln(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return on}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Yn}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ln}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Fn}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Mn}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return An}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return an}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Ve}});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/messages.d.ts
|
|
2
|
+
declare const E2E_LOCKED_MESSAGE = "fkn:e2e-locked";
|
|
3
|
+
declare const E2E_STALE_EPOCH_MESSAGE = "fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset";
|
|
4
|
+
declare const E2E_INTEGRITY_MESSAGE = "fkn:e2e-integrity: stored data failed its integrity check";
|
|
5
|
+
/** sealed in an envelope older than v3; distinct from integrity, since the bytes are intact */
|
|
6
|
+
declare const E2E_RETIRED_FORMAT_MESSAGE = "fkn:e2e-retired-format: stored data is in a format this version no longer opens";
|
|
7
|
+
/**
|
|
8
|
+
* The error code for "there is no object at this path", so a caller tests absence instead of parsing
|
|
9
|
+
* a message. osra drops custom codes at the SharedWorker boundary, so storage.ts's rethrow re-mints
|
|
10
|
+
* it from the message on the app side.
|
|
11
|
+
*/
|
|
12
|
+
declare const STORAGE_NOT_FOUND = "FKN_STORAGE_NOT_FOUND";
|
|
13
|
+
/**
|
|
14
|
+
* The error code for "the api never answered". A caller that relaxes anything when the server is
|
|
15
|
+
* unreachable must never relax it on an answered error: an answered 500 lands exactly when a key
|
|
16
|
+
* rotation or a setting flip may be propagating. Across the SharedWorker hop the message prefix is
|
|
17
|
+
* the wire contract, since osra drops the code; same-realm callers can test the code.
|
|
18
|
+
*/
|
|
19
|
+
declare const STORAGE_UNREACHABLE = "FKN_API_UNREACHABLE";
|
|
20
|
+
/**
|
|
21
|
+
* The account pin's refusals, as message prefixes the broker throws. `ACCOUNT_CHANGED_MESSAGE`: the
|
|
22
|
+
* signed-in account is not the one the pin was taken under. `ACCOUNT_PIN_INVALID_MESSAGE`: the api
|
|
23
|
+
* could not read the pin. `ACCOUNT_PIN_UNSUPPORTED_MESSAGE`: a hop (the broker document or its shared
|
|
24
|
+
* worker) predates the pin, so the call was refused rather than sent unpinned. None is a sign-out.
|
|
25
|
+
*/
|
|
26
|
+
declare const ACCOUNT_CHANGED_MESSAGE = "fkn:account-changed";
|
|
27
|
+
declare const ACCOUNT_PIN_INVALID_MESSAGE = "fkn:account-pin-invalid";
|
|
28
|
+
declare const ACCOUNT_PIN_UNSUPPORTED_MESSAGE = "fkn:account-pin-unsupported";
|
|
29
|
+
/** The code of `StorageAccountChangedError`: a call made under one account was refused under another. */
|
|
30
|
+
declare const STORAGE_ACCOUNT_CHANGED = "FKN_ACCOUNT_CHANGED";
|
|
31
|
+
/** The code of `StorageAccountPinUnsupportedError`: the broker cannot pin calls, so none was sent. */
|
|
32
|
+
declare const STORAGE_ACCOUNT_PIN_UNSUPPORTED = "FKN_ACCOUNT_PIN_UNSUPPORTED";
|
|
33
|
+
//#endregion
|
|
34
|
+
export { E2E_LOCKED_MESSAGE as a, STORAGE_ACCOUNT_CHANGED as c, STORAGE_UNREACHABLE as d, E2E_INTEGRITY_MESSAGE as i, STORAGE_ACCOUNT_PIN_UNSUPPORTED as l, ACCOUNT_PIN_INVALID_MESSAGE as n, E2E_RETIRED_FORMAT_MESSAGE as o, ACCOUNT_PIN_UNSUPPORTED_MESSAGE as r, E2E_STALE_EPOCH_MESSAGE as s, ACCOUNT_CHANGED_MESSAGE as t, STORAGE_NOT_FOUND as u };
|
package/messages.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as E2E_LOCKED_MESSAGE, c as STORAGE_ACCOUNT_CHANGED, d as STORAGE_UNREACHABLE, i as E2E_INTEGRITY_MESSAGE, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, n as ACCOUNT_PIN_INVALID_MESSAGE, o as E2E_RETIRED_FORMAT_MESSAGE, r as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, s as E2E_STALE_EPOCH_MESSAGE, t as ACCOUNT_CHANGED_MESSAGE, u as STORAGE_NOT_FOUND } from "./messages-
|
|
1
|
+
import { a as E2E_LOCKED_MESSAGE, c as STORAGE_ACCOUNT_CHANGED, d as STORAGE_UNREACHABLE, i as E2E_INTEGRITY_MESSAGE, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, n as ACCOUNT_PIN_INVALID_MESSAGE, o as E2E_RETIRED_FORMAT_MESSAGE, r as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, s as E2E_STALE_EPOCH_MESSAGE, t as ACCOUNT_CHANGED_MESSAGE, u as STORAGE_NOT_FOUND } from "./messages-d7pvCXPn.js";
|
|
2
2
|
export { ACCOUNT_CHANGED_MESSAGE, ACCOUNT_PIN_INVALID_MESSAGE, ACCOUNT_PIN_UNSUPPORTED_MESSAGE, E2E_INTEGRITY_MESSAGE, E2E_LOCKED_MESSAGE, E2E_RETIRED_FORMAT_MESSAGE, E2E_STALE_EPOCH_MESSAGE, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, STORAGE_NOT_FOUND, STORAGE_UNREACHABLE };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
1
|
+
import { Ct as TcpSocketListenerResult, K as Resolvers, Tt as TcpSocketResult } from "./contract-6Xfd_qel.js";
|
|
2
|
+
import { o as TcpSocketOption } from "./wire-BwA4JjZH.js";
|
|
3
|
+
import "./api-CFkZVr53.js";
|
|
4
4
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
5
5
|
import { DuplexOptions, Stream } from "stream";
|
|
6
6
|
import { EventEmitter } from "events";
|
|
@@ -32,19 +32,6 @@ declare class Socket$2 extends Stream.Duplex implements Socket {
|
|
|
32
32
|
constructor(options?: SocketConstructorOpts & DuplexOptions & {
|
|
33
33
|
connection?: ReturnType<WebVpnTcpSocket>;
|
|
34
34
|
});
|
|
35
|
-
/**
|
|
36
|
-
* `endpoints` publishes the four addresses SYNCHRONOUSLY, for a socket whose connection is
|
|
37
|
-
* already in hand.
|
|
38
|
-
*
|
|
39
|
-
* Node fills an accepted socket's endpoints in before it emits 'connection', and consumers read
|
|
40
|
-
* them right there in the handler. Without this the values only land in the `.then()` below, one
|
|
41
|
-
* microtask after the emit, and until then every address getter on this class THROWS
|
|
42
|
-
* `Socket is not connected` rather than answering undefined, so a caller reading them the way
|
|
43
|
-
* Node allows gets an exception and, if it wrapped all four in one try block, loses every one of
|
|
44
|
-
* them. libtorrent-wasm's socket shim does exactly that on accept, and libtorrent drops a peer it
|
|
45
|
-
* cannot name with no alert and no reply, which reads from outside as the relay never delivering
|
|
46
|
-
* the connection at all.
|
|
47
|
-
*/
|
|
48
35
|
_busyRelease?: () => void;
|
|
49
36
|
__webvpn_tcp_socket_init__(connection: ReturnType<WebVpnTcpSocket>, endpoints?: Awaited<ReturnType<WebVpnTcpSocket>>): Promise<(TcpSocketResult & {
|
|
50
37
|
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
@@ -95,9 +82,6 @@ declare class Socket$2 extends Stream.Duplex implements Socket {
|
|
|
95
82
|
timeout?: number | undefined;
|
|
96
83
|
}
|
|
97
84
|
interface EventEmitterOptions {
|
|
98
|
-
/**
|
|
99
|
-
* Enables automatic capturing of promise rejection.
|
|
100
|
-
*/
|
|
101
85
|
captureRejections?: boolean | undefined;
|
|
102
86
|
}
|
|
103
87
|
declare class Server$1 extends EventEmitter implements Server {
|
package/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-CmMZgV2a.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/package.json
CHANGED
package/packages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as InstalledPackage, F as PackageResult, G as Radii, I as PackagesErrorCode, P as PackageQuery, R as PickOptions, T as InstallOptions, m as ConnectOptions, xt as SurfaceRect, z as Placement } from "./contract-
|
|
1
|
+
import { E as InstalledPackage, F as PackageResult, G as Radii, I as PackagesErrorCode, P as PackageQuery, R as PickOptions, T as InstallOptions, m as ConnectOptions, xt as SurfaceRect, z as Placement } from "./contract-6Xfd_qel.js";
|
|
2
2
|
import { Remote } from "osra";
|
|
3
3
|
declare namespace packages_d_exports {
|
|
4
4
|
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as Resolvers } from "./contract-
|
|
2
|
-
import "./api-
|
|
1
|
+
import { K as Resolvers } from "./contract-6Xfd_qel.js";
|
|
2
|
+
import "./api-CFkZVr53.js";
|
|
3
3
|
//#region src/proxy.d.ts
|
|
4
4
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
5
|
type FetchParameters = Parameters<ProxyFetch>;
|
package/rooms.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api--LOXTOpv.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./contract.cjs");var i=e.t({available:()=>
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api--LOXTOpv.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./contract.cjs");var i=e.t({available:()=>h,create:()=>_,join:()=>v,open:()=>g}),a={wrongKey:`rooms: wrong room key`,inviteNoKey:`rooms: the invite carries no key`,badName:`rooms: the name is not one a room can have`,badKeyOption:`rooms: the key is not 32 bytes base64url`,noSuchMember:`rooms: no such member`,noSuchMessage:`rooms: no such message`,roomFull:`rooms: the room is full`,tooManyConnections:`rooms: too many connections`,tooManyBlocks:`rooms: too many blocks`,tooManyClaims:`rooms: too many claims`,mailboxFull:`rooms: the mailbox is full`,outOfStorage:`rooms: the owner is out of storage`,outOfQuota:`rooms: out of daily bandwidth`,blocked:`rooms: you are blocked from this room`,cannotSend:`rooms: you cannot send here`,permissionDenied:`rooms: permission denied`,notOwner:`rooms: not the room owner`,ownerNotRemovable:`rooms: the owner cannot be removed`,ownerKeepsEvery:`rooms: the owner keeps every permission`,removeYourself:`rooms: you cannot remove yourself`,needsAccount:`rooms: claiming needs an account`,needsPremium:`rooms: claiming needs premium`,nameClaimed:`rooms: the name is claimed`,notClaimed:`rooms: the room is not claimed`,noMailbox:`rooms: the room keeps no messages`,badLimit:`rooms: the limit is out of range`,badDescription:`rooms: the description is not one a claim can carry`,notClaimer:`rooms: only the app that claimed the room can describe it`,notReleaser:`rooms: only the app that claimed the room can release it`,notClaimingApp:`rooms: only the app that claimed the room can change it`,badTemporary:`rooms: the temporary duration is not one a claim can carry`,notTemporaryClaimer:`rooms: only the app that claimed the room can set when it expires`,temporaryUnavailable:`rooms: temporary claims are not available`,mailboxUnavailable:`rooms: the mailbox switch is not available`,tooFast:`rooms: sending too fast`,tooLarge:`rooms: the message is too large`,unavailable:`rooms: rooms are unavailable`,notEnabled:`rooms: rooms are not available`,alreadyJoined:`rooms: already joined`,notJoined:`rooms: not joined`,malformed:`rooms: malformed frame`,ended:`rooms: the room has ended`},o=(e,t)=>Object.assign(Error(t),{code:e}),s=e=>e instanceof Error&&typeof e.code==`string`,c={send:!0,receive:!0,maxMessageBytes:262144},l=()=>({messages:0,bytes:0,cap:5e8,archived:!1}),u=async()=>{if(!t.l)return;let e=(await t.s(`a room`).catch(()=>void 0))?.rooms;return typeof e?.open==`function`?e:void 0},d=()=>{throw o(`unavailable`,a.unavailable)},f=e=>e===`blocked`?`blocked`:e===`not-found`?`ended`:`unavailable`,p=e=>{if(e!==void 0&&e!==!1)return e===!0?r.ROOM_TEMPORARY_MS.default:typeof e!=`number`||!Number.isInteger(e)?null:e>=r.ROOM_TEMPORARY_MS.min&&e<=r.ROOM_TEMPORARY_MS.max?e:null},m=async e=>{let r=e.invite,i=e,u=0,d=e.self,m=e.owner,h=e.claimed,g=e.mailbox,_=0,v=await e.defaults().catch(()=>c),y=!1,b=new Set,x=new Set,S=n.t(`room`),C=()=>{},w=()=>{},T=new Promise(e=>{w=e}),E=e=>{let t=[...x];x.clear();for(let n of t)try{n(e)}catch{}},D=e=>{y||(y=!0,C(),b.clear(),S(),E(o(`closed`,a.ended)),w({reason:e}))},O=e=>{if(y)return;let t=e;if(t.type===`defaults`&&(v=t.defaults),t.type===`permissions`&&t.id===d.id&&(d={id:d.id,permissions:t.permissions,maxMessageBytes:t.maxMessageBytes}),t.type===`claim`){_+=1;let e=t.claimed&&t.mailbox!==!1;t={type:`claim`,claimed:t.claimed,owner:t.owner,mailbox:e},h=t.claimed,m=t.owner,g=e?l():null}for(let e of[...b])try{e(t)}catch{}},k=(e,t)=>{Promise.resolve(e.on(O)).catch(()=>{}),Promise.resolve(e.closed).then(e=>{t===u&&D(e.reason)},()=>{})},A=async(e,t)=>{if(typeof e?.join!=`function`)return D(`unavailable`);let n=await e.join(r).catch(()=>void 0);if(y||t!==u)return;if(!n)return D(`unavailable`);if(`error`in n)return D(f(n.error));if(n.self.id!==d.id)return Promise.resolve(n.leave()).catch(()=>{}),D(`unavailable`);i=n,d=n.self,m=n.owner,h=n.claimed,g=n.mailbox,k(n,t);let a=await n.defaults().catch(()=>void 0);a&&!y&&t===u&&(v=a)};C=t.u((e,t)=>{let n=u;u=t,!(y||n===0||n===t)&&(E(o(`unavailable`,a.unavailable)),A(e.rooms,t))}),k(e,u);let j=async e=>{if(y)throw o(`closed`,a.ended);let t=()=>{},n=new Promise((e,n)=>{t=n});x.add(t);try{return await Promise.race([Promise.resolve(e(i)),n])}catch(e){throw s(e)?e:o(`unavailable`,a.unavailable)}finally{x.delete(t)}},M=async e=>{let t=await j(e);if(`error`in t)throw o(t.error,t.message)},N=async e=>{let t=await j(e);if(typeof t==`object`&&t&&`error`in t)throw o(t.error,t.message);return t};return{id:e.id,name:e.name,key:e.key,invite:r,get self(){return d},get owner(){return m},get claimed(){return h},get mailbox(){return g},defaults:()=>v,members:()=>j(e=>e.members()),send:e=>M(t=>t.send(e)),edit:(e,t)=>M(n=>n.edit(e,t)),delete:(e,t)=>M(n=>n.delete(e,t)),backlog:(e,t)=>N(n=>n.backlog(e,t)),setDefault:(e,t)=>M(n=>n.setDefault(e,t)),limit:(e,t)=>M(n=>n.limit(e,t)),grant:(e,t)=>M(n=>n.grant(e,t)),revoke:(e,t)=>M(n=>n.revoke(e,t)),remove:e=>M(t=>t.remove(e)),block:e=>M(t=>t.block(e)),unblock:e=>M(t=>t.unblock(e)),claim:async e=>{let t=e?.description;if(t!==void 0&&typeof t!=`string`)throw o(`invalid`,a.badDescription);let n=p(e?.temporary);if(n===null)throw o(`invalid`,a.badTemporary);let r=e?.mailbox;if(r!==void 0&&typeof r!=`boolean`)throw o(`invalid`,a.malformed);let i={...t===void 0?{}:{description:t},...n===void 0?{}:{temporary:n},...r===void 0?{}:{mailbox:r}};return Object.keys(i).length===0?M(e=>e.claim()):M(e=>{if(n!==void 0&&e.temporaryClaims!==!0)throw o(`unavailable`,a.temporaryUnavailable);if(r===!1&&e.mailboxSwitch!==!0)throw o(`unavailable`,a.mailboxUnavailable);return e.claim(i)})},setMailbox:async e=>{if(typeof e!=`boolean`)throw o(`invalid`,a.malformed);let t=_;await M(t=>{if(t.mailboxSwitch!==!0)throw o(`unavailable`,a.mailboxUnavailable);return t.setMailbox(e)}),_===t&&(e?g===null&&(g=l()):g=null)},release:()=>M(e=>e.release()),usage:async()=>{let e=await N(e=>e.usage());return g=e,e},on:async e=>y?()=>{}:(b.add(e),()=>{b.delete(e)}),leave:async()=>{await Promise.resolve(i.leave()).catch(()=>{}),D(`left`)},closed:T}},h=async()=>{let e=await u();return e?e.available().catch(()=>!1):!1},g=async(e,t)=>{if(typeof e!=`string`||e.length===0||e.length>72)throw o(`invalid`,a.badName);let n=await u();if(!n)throw o(`unavailable`,a.unavailable);let r=await n.open(e,t).catch(d);if(`error`in r)throw o(r.error,r.message);return m(r)},_=async e=>{let t=await u();if(!t)throw o(`unavailable`,a.unavailable);let n=await t.create(e).catch(d);if(`error`in n)throw o(n.error,n.message);return m(n)},v=async(e,t)=>{let n=typeof e==`string`?e.indexOf(`.`):-1;if(n<=0||n===e.length-1)throw o(`invalid`,a.inviteNoKey);let r=await u();if(!r)throw o(`unavailable`,a.unavailable);let i=await r.join(e,t).catch(d);if(`error`in i)throw o(i.error,i.message);return m(i)};exports.available=h,exports.create=_,exports.join=v,exports.open=g,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
package/rooms.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as RoomClaimOptions, Q as RoomEvent, X as RoomDefaults, Y as RoomCreateOptions, Z as RoomEnd, at as RoomPermission, et as RoomJoinOptions, it as RoomOpenOptions, nt as RoomMember, ot as RoomPermissions, q as RoomBacklog, rt as RoomMessage, st as RoomsErrorCode, tt as RoomMailbox } from "./contract-
|
|
1
|
+
import { J as RoomClaimOptions, Q as RoomEvent, X as RoomDefaults, Y as RoomCreateOptions, Z as RoomEnd, at as RoomPermission, et as RoomJoinOptions, it as RoomOpenOptions, nt as RoomMember, ot as RoomPermissions, q as RoomBacklog, rt as RoomMessage, st as RoomsErrorCode, tt as RoomMailbox } from "./contract-6Xfd_qel.js";
|
|
2
2
|
declare namespace rooms_d_exports {
|
|
3
3
|
export { RoomClaimOptions as ClaimOptions, RoomCreateOptions as CreateOptions, RoomJoinOptions as JoinOptions, RoomOpenOptions as OpenOptions, Room, RoomBacklog, RoomDefaults, RoomEnd, RoomEvent, RoomMailbox, RoomMember, RoomMessage, RoomPermission, RoomPermissions, RoomsError, RoomsErrorCode, available, create, join, open };
|
|
4
4
|
}
|
|
@@ -22,44 +22,87 @@ export type Room = {
|
|
|
22
22
|
readonly self: RoomMember;
|
|
23
23
|
/** the owner's member id, or '' while a claimed room's owner has never joined */
|
|
24
24
|
readonly owner: string;
|
|
25
|
-
/** whether a premium account keeps this name
|
|
25
|
+
/** whether a premium account keeps this name. Whether it keeps the messages too is `mailbox`. */
|
|
26
26
|
readonly claimed: boolean;
|
|
27
27
|
/**
|
|
28
|
-
* what the mailbox holds, as the room last said. Null
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* what the mailbox holds, as the room last said. Null while the room keeps no messages: nobody has
|
|
29
|
+
* claimed it, or its claim keeps none. The account can clear the room, unclaim it, turn its messages
|
|
30
|
+
* off or on, or set a lower `cap` from its fkn.app settings, which the app hears as a `deleted` or a
|
|
31
|
+
* `claim` event; `usage()` reads the figures again.
|
|
31
32
|
*/
|
|
32
33
|
readonly mailbox: RoomMailbox | null;
|
|
33
34
|
defaults: () => RoomDefaults;
|
|
34
35
|
members: () => Promise<RoomMember[]>;
|
|
35
36
|
/** sealed before it leaves the browser. Rejects `too-large` past `self.maxMessageBytes` on the wire, never truncates. */
|
|
36
37
|
send: (text: string) => Promise<void>;
|
|
37
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* replaces a stored message's text: one of your own, or any as the owner. On a room claimed under an
|
|
40
|
+
* app's scope, from another app of the claim's account, it is refused `denied` (`rooms: only the app
|
|
41
|
+
* that claimed the room can change it`), the account's own messages included, as `claim` says.
|
|
42
|
+
*/
|
|
38
43
|
edit: (seq: number, text: string) => Promise<void>;
|
|
39
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* drops stored messages: one of your own, or any range as the owner. On a room claimed under an app's
|
|
46
|
+
* scope, from another app of the claim's account, it is refused `denied` (`rooms: only the app that
|
|
47
|
+
* claimed the room can change it`), the account's own messages included, as `claim` says.
|
|
48
|
+
*/
|
|
40
49
|
delete: (from: number, to?: number) => Promise<void>;
|
|
41
50
|
/** replays stored messages above `after` as `message` events marked `replayed`, one page at a time */
|
|
42
51
|
backlog: (after: number, limit?: number) => Promise<RoomBacklog>;
|
|
52
|
+
/**
|
|
53
|
+
* whether a member with no override may send or receive, from the owner only (`denied`, `rooms: not
|
|
54
|
+
* the room owner`). On a room claimed under an app's scope, from another app of the claim's account,
|
|
55
|
+
* it is refused `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
|
|
56
|
+
*/
|
|
43
57
|
setDefault: (permission: 'send' | 'receive', value: boolean) => Promise<void>;
|
|
44
58
|
/**
|
|
45
59
|
* the message size cap, from 1 to 33,554,432. With no id it sets the room default, which is always
|
|
46
|
-
* a number. With an id it sets that member's override, and null clears the override.
|
|
60
|
+
* a number. With an id it sets that member's override, and null clears the override. From the owner
|
|
61
|
+
* only (`denied`, `rooms: not the room owner`); on a room claimed under an app's scope, from another
|
|
62
|
+
* app of the claim's account, it is refused `denied` (`rooms: only the app that claimed the room can
|
|
63
|
+
* change it`), as `claim` says.
|
|
47
64
|
*/
|
|
48
65
|
limit: {
|
|
49
66
|
(maxMessageBytes: number, id?: string): Promise<void>;
|
|
50
67
|
(maxMessageBytes: number | null, id: string): Promise<void>;
|
|
51
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* gives a member a permission over the room default, from the owner only (`denied`, `rooms: not the
|
|
71
|
+
* room owner`). On a room claimed under an app's scope, from another app of the claim's account, it is
|
|
72
|
+
* refused `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
|
|
73
|
+
*/
|
|
52
74
|
grant: (id: string, permission: RoomPermission) => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* takes a permission from a member over the room default, from the owner only (`denied`, `rooms: not
|
|
77
|
+
* the room owner`). On a room claimed under an app's scope, from another app of the claim's account, it
|
|
78
|
+
* is refused `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
|
|
79
|
+
*/
|
|
53
80
|
revoke: (id: string, permission: RoomPermission) => Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* sends a member out of the room, which they may join again, with the `remove` permission (`denied`,
|
|
83
|
+
* `rooms: permission denied`). On a room claimed under an app's scope, from another app of the claim's
|
|
84
|
+
* account, it is refused `denied` (`rooms: only the app that claimed the room can change it`), as
|
|
85
|
+
* `claim` says.
|
|
86
|
+
*/
|
|
54
87
|
remove: (id: string) => Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* sends a member out of the room and keeps them out, with the `block` permission (`denied`, `rooms:
|
|
90
|
+
* permission denied`). On a room claimed under an app's scope, from another app of the claim's account,
|
|
91
|
+
* it is refused `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
|
|
92
|
+
*/
|
|
55
93
|
block: (id: string) => Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* lets a blocked member join again, with the `block` permission (`denied`, `rooms: permission denied`).
|
|
96
|
+
* On a room claimed under an app's scope, from another app of the claim's account, it is refused
|
|
97
|
+
* `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
|
|
98
|
+
*/
|
|
56
99
|
unblock: (id: string) => Promise<void>;
|
|
57
100
|
/**
|
|
58
|
-
* keeps the name
|
|
59
|
-
* buys. `description` says what the room is for, shown to the account in its
|
|
60
|
-
* permanent claim with an unchanged one on every open is free. Claiming on every
|
|
61
|
-
* room again after the account unclaims it from fkn.app, so claim when the person
|
|
62
|
-
* or make it `temporary`.
|
|
101
|
+
* keeps the name for the signed-in premium account, and a mailbox unless asked not to. The only thing
|
|
102
|
+
* in rooms that premium buys. `description` says what the room is for, shown to the account in its
|
|
103
|
+
* fkn.app settings; a permanent claim with an unchanged one on every open is free. Claiming on every
|
|
104
|
+
* open also claims the room again after the account unclaims it from fkn.app, so claim when the person
|
|
105
|
+
* wants the room kept, or make it `temporary`.
|
|
63
106
|
*
|
|
64
107
|
* `temporary` makes the claim end by itself, in milliseconds (`true` is 7 days), that long after its
|
|
65
108
|
* last claim: a temporary claim goes to the account's ledger every time, which is what restarts its
|
|
@@ -67,6 +110,22 @@ export type Room = {
|
|
|
67
110
|
* from fkn.app, and the stored messages are gone. A broker too old to carry it refuses the call
|
|
68
111
|
* `unavailable` (`rooms: temporary claims are not available`) rather than make the claim permanent.
|
|
69
112
|
*
|
|
113
|
+
* `mailbox: false` keeps the name and stores nothing: the room relays as an unclaimed one does. It is
|
|
114
|
+
* read only when the call starts the claim and ignored on a room the account already holds, so claiming
|
|
115
|
+
* on every open never undoes the owner's choice.
|
|
116
|
+
*
|
|
117
|
+
* Who changes a claimed room depends on its scope. A room under an app's scope, which is every room
|
|
118
|
+
* but a `global` one, is changed by the claim's account only through the app that claimed it (the
|
|
119
|
+
* same app once it is verified): from another app of the account `setDefault`, `limit`, `grant`,
|
|
120
|
+
* `revoke`, `remove`, `block`, `unblock`, `setMailbox`, `edit` and `delete` are refused `denied`
|
|
121
|
+
* (`rooms: only the app that claimed the room can change it`), the account's own messages included,
|
|
122
|
+
* and nothing changes. That other app, which reaches the room through its invite, still joins, reads
|
|
123
|
+
* and sends. A claimed `global` room is changed by any app of the account, which also describes it,
|
|
124
|
+
* sets its `temporary` and releases it. The account changes every room it claimed
|
|
125
|
+
* from its fkn.app settings, whichever app claimed it, and members of other accounts are answered as
|
|
126
|
+
* in any room. While the room cannot tell whether two apps are one, such a change is refused
|
|
127
|
+
* `unavailable` (`rooms: rooms are unavailable`) and can be sent again.
|
|
128
|
+
*
|
|
70
129
|
* Past the account's room limit the call waits while fkn.app shows the person their claimed rooms over
|
|
71
130
|
* your app, with Unclaim on each: it resolves once one is unclaimed and this claim is made, and rejects
|
|
72
131
|
* `full` (`rooms: too many claims`) when they close the card or when fkn.app cannot show it. Nothing
|
|
@@ -74,8 +133,28 @@ export type Room = {
|
|
|
74
133
|
*/
|
|
75
134
|
claim: (options?: RoomClaimOptions) => Promise<void>;
|
|
76
135
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
136
|
+
* turns a claimed room's mailbox off or on, from the room's owner only, which in a claimed room is the
|
|
137
|
+
* claim's account. Off deletes every stored message at once, the archive included, and the room then
|
|
138
|
+
* relays as an unclaimed one does while keeping its claim; whoever is present hears a `claim` event
|
|
139
|
+
* with `mailbox: false` and no `deleted`, so what an app shows stays. On starts an empty mailbox that
|
|
140
|
+
* keeps messages from the next `seq`, and nothing deleted comes back. Turning it on needs premium, as a
|
|
141
|
+
* claim does (`denied`, `rooms: claiming needs premium`); turning it off never does. Setting what it
|
|
142
|
+
* already is changes nothing. Resolves once the room answered, with `mailbox` reading the new state,
|
|
143
|
+
* or a newer one when a release or the account's own switch landed before the answer.
|
|
144
|
+
*
|
|
145
|
+
* Refused `invalid` (`rooms: the room is not claimed`) on an unclaimed room, `denied` (`rooms: not the
|
|
146
|
+
* room owner`) from anyone else, `denied` (`rooms: only the app that claimed the room can change it`)
|
|
147
|
+
* from another app of the claim's account on a room claimed under an app's scope, as `claim` says, and
|
|
148
|
+
* `invalid` (`rooms: malformed frame`) for anything but a boolean. A broker too old to carry it refuses
|
|
149
|
+
* `unavailable` (`rooms: the mailbox switch is not available`). The account can do the same from its
|
|
150
|
+
* fkn.app settings, whichever app claimed the room.
|
|
151
|
+
*/
|
|
152
|
+
setMailbox: (on: boolean) => Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* gives the claim back: the mailbox is deleted and whoever is present stays in an ordinary room. On a
|
|
155
|
+
* room under an app's scope, the app that claimed it only (the same app once it is verified), and from
|
|
156
|
+
* another app it is refused `denied` (`rooms: only the app that claimed the room can release it`); on a
|
|
157
|
+
* `global` room, any app of the account. The account can also unclaim it from its fkn.app settings.
|
|
79
158
|
*/
|
|
80
159
|
release: () => Promise<void>;
|
|
81
160
|
usage: () => Promise<RoomMailbox | null>;
|