@fkn/lib 0.9.40 → 0.9.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/account-generation-B-6Pn0b5.cjs +1 -0
  2. package/account-generation-XNWOvLea.js +28 -0
  3. package/account.cjs +1 -1
  4. package/account.d.ts +11 -0
  5. package/account.js +8 -20
  6. package/api--LOXTOpv.cjs +3 -0
  7. package/{api-Dp-2AT3u.js → api-DIgTslNb.js} +154 -114
  8. package/{api-BE5zPvFZ.d.ts → api-SwxtiYVU.d.ts} +38 -14
  9. package/api.cjs +1 -1
  10. package/api.d.ts +3 -3
  11. package/api.js +2 -2
  12. package/attach-policy.cjs +1 -1
  13. package/attach-policy.js +2 -2
  14. package/cloud/dns.d.ts +1 -1
  15. package/cloud/fetch.cjs +1 -1
  16. package/cloud/fetch.d.ts +1 -1
  17. package/cloud/fetch.js +1 -1
  18. package/cloud/fs/promises.d.ts +1 -1
  19. package/cloud/fs.cjs +1 -1
  20. package/cloud/fs.d.ts +4 -4
  21. package/cloud/fs.js +31 -24
  22. package/cloud/net.d.ts +1 -1
  23. package/cloud-868OlBKn.cjs +1 -0
  24. package/{cloud-5eldoFxK.d.ts → cloud-DUH-v10C.d.ts} +6 -4
  25. package/cloud-f3j4s8yZ.js +545 -0
  26. package/cloud.cjs +1 -1
  27. package/cloud.d.ts +4 -4
  28. package/cloud.js +2 -2
  29. package/{contract-Cvr_8gCL.d.ts → contract-CCxPKIC7.d.ts} +105 -13
  30. package/contract.d.ts +3 -2
  31. package/dgram.cjs +1 -1
  32. package/dgram.d.ts +2 -2
  33. package/dgram.js +1 -1
  34. package/dns.cjs +1 -1
  35. package/dns.d.ts +1 -1
  36. package/dns.js +1 -1
  37. package/extension-BOBuYwZc.js +92 -0
  38. package/extension-hoUs5yJ7.cjs +1 -0
  39. package/{extension-DMU-CwMw.d.ts → extension-yhwDSIiD.d.ts} +22 -3
  40. package/extension.cjs +1 -1
  41. package/extension.d.ts +3 -3
  42. package/extension.js +3 -3
  43. package/fs/promises.cjs +1 -1
  44. package/fs/promises.d.ts +1 -1
  45. package/fs/promises.js +1 -1
  46. package/fs-CVnmXRf7.js +513 -0
  47. package/{fs--NhtUyYa.d.ts → fs-D0MMRnHC.d.ts} +8 -4
  48. package/fs-p0bOOj5n.cjs +1 -0
  49. package/fs.cjs +1 -1
  50. package/fs.d.ts +4 -3
  51. package/fs.js +4 -2
  52. package/{hosts-9dYv63ud.cjs → hosts-GNBhZO3-.cjs} +1 -1
  53. package/{hosts-BzbzOhG8.js → hosts-t7CKGTRz.js} +4 -1
  54. package/http.d.ts +1 -1
  55. package/{index-D2CA-NX5.d.ts → index-BtFiGoVQ.d.ts} +465 -51
  56. package/{index-kuPqkS_-.d.ts → index-D2lvaQDs.d.ts} +28 -38
  57. package/index.cjs +1 -1
  58. package/index.d.ts +17 -17
  59. package/index.js +62 -59
  60. package/lib-CfdmsLoI.cjs +53 -0
  61. package/{lib-C4Eeg9eM.js → lib-DppqX10G.js} +470 -302
  62. package/{messages-C66ghz_A.d.ts → messages-CRcziTuC.d.ts} +17 -1
  63. package/messages.cjs +1 -1
  64. package/messages.d.ts +2 -2
  65. package/messages.js +2 -2
  66. package/{net-zThwNoA8.d.ts → net-DcLF-6E-.d.ts} +2 -2
  67. package/net.cjs +1 -1
  68. package/net.d.ts +1 -1
  69. package/net.js +1 -1
  70. package/{node-fs-BZy9bzKd.js → node-fs-CK2wWIYS.js} +140 -137
  71. package/node-fs-nfX7wisL.cjs +1 -0
  72. package/opfs.cjs +1 -1
  73. package/opfs.js +1 -1
  74. package/package.json +1 -1
  75. package/packages.cjs +1 -1
  76. package/packages.d.ts +1 -1
  77. package/packages.js +14 -14
  78. package/{proxy-Dc0gDOxz.d.ts → proxy-CE46SkyA.d.ts} +2 -2
  79. package/{proxy-DjoPtJH9.cjs → proxy-CFK-KiwE.cjs} +1 -1
  80. package/{proxy-DMTdQ4dN.js → proxy-Dixbk1WL.js} +1 -1
  81. package/rooms.cjs +1 -1
  82. package/rooms.d.ts +1 -1
  83. package/rooms.js +11 -11
  84. package/storage-BVr2Rb-d.d.ts +167 -0
  85. package/storage-D2cUJlVH.cjs +1 -0
  86. package/storage-Dn1gTLSZ.js +123 -0
  87. package/api-jOTOA-5n.cjs +0 -3
  88. package/cloud-BLv19j-W.js +0 -480
  89. package/cloud-D7aQY4GH.cjs +0 -1
  90. package/extension-B9v933cT.js +0 -89
  91. package/extension-D2zMdc2f.cjs +0 -1
  92. package/fs-CaQFRiIT.cjs +0 -1
  93. package/fs-D3IsGdnN.js +0 -360
  94. package/lib-BfAg9mHD.cjs +0 -53
  95. package/node-fs-BNTPsX5c.cjs +0 -1
  96. package/storage-BJd-mWHE.cjs +0 -1
  97. package/storage-DSvL-t80.js +0 -67
  98. package/storage-ZrY4Y4L5.d.ts +0 -88
@@ -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:()=>C,createVideoElementHandle:()=>x,isType:()=>S,revive:()=>w,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)),S=e=>typeof e==`object`&&!!e&&e[d]===!0,C=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},w=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return b({...e.initialState},r)},T=e=>[o,...e],te=3,ne=0,re=`fknExtension`,ie=`fknExtensionAbi`,ae=`fknExtensionOps`,oe=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],se=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},ce=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),le=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=se(e[ie]),r=ce(e[ae]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},ue=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,de=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),E=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}},D=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}},fe=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,pe=re,me=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(fe,()=>{me.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:he()}}))});var he=()=>typeof document>`u`?!1:document.documentElement.dataset[pe]===`true`,O=()=>typeof document>`u`?{status:`absent`}:le(document.documentElement.dataset),k=null,ge=e=>{k=e},_e=150,A=(e=1e3)=>new Promise((t,n)=>{let r=()=>O().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=O();if(e.status===`outdated`)return n(new E(e.abi,e.required));if(k){if(await k().catch(()=>{}),r())return t();let e=O();if(e.status===`outdated`)return n(new E(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(),_e)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...oe]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),ve,j=new Proxy({},{get:(e,t)=>async(...e)=>{await A(),ve??=(0,n.expose)({},{transport:window,revivableModules:T});let r=(await ve)[t];return r(...e)}}),ye=[`origin`,`referer`,`cookie`],be=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),xe=e=>be(e,`cookie`),Se=(e,t)=>{if(t===`include`&&xe(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Ce=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!ye.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},we=[`fkn.app`,`fkn.dev`,`sdbx.app`],Te=e=>e.replace(/\.+$/,``),Ee=e=>{let t=Te(e);return we.some(e=>t===e||t.endsWith(`.${e}`))},De={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.`},Oe={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.`},ke={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.`},Ae=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},je=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:`):Ae(n)},Me=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Ee(t.hostname)},Ne=e=>{if(Me(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Pe=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=ye.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},Fe=async(e,t)=>{let n=new Request(e,t);Ne(n.url);let r=n.body?await n.arrayBuffer():null;return j.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:Pe(t),reason:t?.reason,signal:t?.signal??void 0})},Ie={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.`},Le={get:e=>j.getCookie(e)},Re={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.`},ze=e=>j.setRequestHeaderRule(e),Be=e=>j.removeRequestHeaderRule({ruleId:e}),Ve=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}},He=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},M;(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`})(M||={});var Ue=(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`)},N=(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=N(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=Ue(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=Ue(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},P=/\/\*[^]*?(?:\*\/|$)/g;function F(e){return e?e.trim():``}function I(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=>{I(e,r)}):n&&typeof n==`object`&&I(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var We=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 M.stylesheet:return this.stylesheet(e);case M.rule:return this.rule(e);case M.declaration:return this.declaration(e);case M.comment:return this.comment(e);case M.container:return this.container(e);case M.charset:return this.charset(e);case M.counterStyle:return this.counterStyle(e);case M.document:return this.document(e);case M.customMedia:return this.customMedia(e);case M.fontFace:return this.fontFace(e);case M.fontFeatureValues:return this.fontFeatureValues(e);case M.host:return this.host(e);case M.import:return this.import(e);case M.keyframes:return this.keyframes(e);case M.keyframe:return this.keyframe(e);case M.layer:return this.layer(e);case M.media:return this.media(e);case M.namespace:return this.namespace(e);case M.page:return this.page(e);case M.pageMarginBox:return this.pageMarginBox(e);case M.positionTry:return this.positionTry(e);case M.property:return this.property(e);case M.scope:return this.scope(e);case M.startingStyle:return this.startingStyle(e);case M.supports:return this.supports(e);case M.viewTransition:return this.viewTransition(e);case M.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!==M.declaration&&e.type!==M.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(`;`)}},Ge=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new He(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ve(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:M.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=N(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=N(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(F(n).replace(P,``),[`,`]).map(e=>F(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=F(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=N(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=F(s).replace(P,``));let u=t({type:M.declaration,property:r.replace(P,``),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=N(e,[`{`]);if(t===-1)return!1;let n=N(e,[`;`]),r=N(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=w();if(e){n.push(e),d(n);continue}}if(g()){let e=T();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=w();if(e){n.push(e),d(n);continue}}if(g()){let e=T();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:M.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=C(`import`),x=C(`charset`),S=C(`namespace`);function C(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 w(){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:M.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=v();return c()?t({type:M.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:M.customMedia,name:F(r[1]),media:F(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=v();return c()?t({type:M.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||b()||x()||S()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=F(r[1]),u=F(r[2]);if(!s())return o(`@document missing '{'`);let d=v();return c()?t({type:M.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=w();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:M.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:M.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:M.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=v();return c()?t({type:M.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=v();return c()?t({type:M.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:M.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:M.layer,layer:r})}let a=v();return c()?t({type:M.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:M.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:M.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=v();return c()?t({type:M.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:M.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:M.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:M.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=N(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=F(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=v();return c()?t({type:M.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:M.atRule,name:r,prelude:a})}()}function T(){let e=i(),t=p();return t?(d(),e({type:M.rule,selectors:t,declarations:_()||[]})):o(`selector missing`)}return I(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=w()||T(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:M.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Ke=(e,t)=>new We(t||{}).compile(e),qe=Object.defineProperty,Je=(e,t)=>{let n={};for(var r in e)qe(n,r,{get:e[r],enumerable:!0});return t||qe(n,Symbol.toStringTag,{value:`Module`}),n},Ye=`LocatorError`,L=`LocatorUnsupportedError`,R=`LocatorDeniedError`,Xe=`LocatorInvalidError`,Ze=e=>typeof e==`object`&&e?e.name:void 0,z=e=>Object.assign(Error(e),{name:Ye}),Qe=(e,t=``,n)=>Object.assign(Error(e),{name:L,operation:t,backend:n}),$e=(e,t)=>Qe(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),B=(e,t)=>Object.assign(Error(e),{name:R,operation:t}),et=(e,t)=>Object.assign(Error(e),{name:Xe,operation:t}),V=class extends Error{name=`TimeoutError`;constructor(e,t){super(e,t?.cause===void 0?void 0:{cause:t.cause})}},tt=e=>Ze(e)===L,nt=e=>Ze(e)===R,H=e=>Ze(e)===Xe,rt=e=>nt(e)||tt(e)||H(e),U=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw z(`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},W=(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},G=(e,t)=>W(e,t)!==null,K=e=>{if(e.length===0)throw z(`No elements found`);if(e.length>1)throw z(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},at=(e,t)=>{if(!G(e,t))throw z(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},ot=e=>e.tagName.toLowerCase(),st=new Set,ct=e=>{st.add(e)},lt=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ut=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),dt=e=>!lt.test(ut(e.value)),ft=new Set([M.import,M.fontFace,M.namespace,M.charset,M.document,M.comment]),pt=e=>{if(ft.has(e.type))return null;if(e.type===M.declaration)return dt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=mt(r))}return n},mt=e=>e.map(e=>pt(e)).filter(e=>e!==null),ht=e=>{let t;try{t=Ge(e,{silent:!0})}catch{return``}return t.stylesheet.rules=mt(t.stylesheet.rules),Ke(t)},gt=(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)},_t={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:ht(t.content);try{gt(e.document,n)}catch(e){console.error(e)}ct(n)}},vt=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},q={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:vt(a.headers),body:await a.arrayBuffer()}}},J=Je({click:()=>bt,count:()=>Ot,exists:()=>kt,fill:()=>wt,getAttribute:()=>Et,hover:()=>xt,isVisible:()=>Dt,textContent:()=>Tt}),yt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},bt={resolve:(e,t={})=>{let n=K(e.elements),r=U(n),i={bubbles:!0,cancelable:!0,composed:!0,...yt(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}))}},xt={resolve:(e,t={})=>{let n=K(e.elements),r=U(n),i={bubbles:!0,cancelable:!0,composed:!0,...yt(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))}},St=(e,t)=>{e._valueTracker?.setValue(``);let n=(W(e,`HTMLTextAreaElement`)??W(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Ct=(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}}},wt={resolve:(e,t,n={})=>{let r=K(e.elements),i=U(r),a=G(r,`HTMLInputElement`);if(a||G(r,`HTMLTextAreaElement`)){let e=r,n=a?Ct(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),St(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(G(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${ot(r)}> is not fillable`)}},Tt={resolve:(e,t={})=>K(e.elements).textContent},Et={resolve:(e,t,n={})=>K(e.elements).getAttribute(t)},Dt={resolve:(e,t={})=>{let n=K(e.elements);if(!G(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}},Ot={resolve:(e,t={})=>e.elements.length},kt={resolve:(e,t={})=>e.elements.length>0},Y=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),X=e=>e.replaceAll(`"`,`\\"`),At={to:`element`,css:!0,resolve:(e,t)=>Y(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},jt={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>Y(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Mt={element:{selectors:{locator:At,frameLocator:jt,getByRole:{to:`element`,resolve:(e,t)=>Y(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${X(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("${X(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>Y(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${X(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:bt,fill:wt,hover:xt,textContent:Tt,getAttribute:Et,isVisible:Dt,count:Ot,exists:kt}},frame:{selectors:{locator:At,frameLocator:jt,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:_t,fetch:q}}},Nt=(e,t=Mt)=>({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}}}),Pt=3e4,Ft=50,It=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Lt=e=>{let t=It(e)?.timeout;return typeof t==`number`?t:Pt},Rt=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),zt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Rt(e))},Bt=(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`)},Vt=e=>typeof e==`object`&&e&&typeof e.message==`string`?e.message:String(e),Ht=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;Bt(i,It(a)?.timeout),n&&await n({parts:r,operation:i,args:a,phase:`execute`},Rt(e));let o=Lt(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(Ft,t)))}}finally{clearTimeout(d)}throw f===c?new V(c.message):new V(Vt(f),{cause:f})},Ut=(e,t,n,r,i)=>{let a={};for(let[o,s]of Object.entries(t[r].selectors))a[o]=(...a)=>Ut(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)=>Ht({...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)=>Ut(e,t,n,s,c(i,...r));return a.ensure=(n,a={})=>{let o=t[r].operations[n]?.ensureArgs;return zt({...e,parts:i,operation:n,args:o?.(a)??[a]})},a},Wt=e=>Ut(e,e.modules??Mt,e.rewrites??{},`frame`,[]),Gt=()=>{let e=O();return e.status===`ok`&&e.abi>=2},Kt=async()=>{await A();let e=O();if(e.status===`ok`&&e.abi<2)throw new E(e.abi,2)},qt=e=>`Read the text, links and details ${e} shows.`,Jt=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,Yt=[{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:qt,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:qt},{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:Jt,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:Jt}],Xt=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}]},Zt=Nt({element:{operations:{click:{resolve:(e,t={})=>J.click.resolve(e,t),send:Xt(`click`)},hover:{resolve:(e,t={})=>J.hover.resolve(e,t),send:Xt(`hover`)},fill:{resolve:(e,t,n={})=>J.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>J.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>J.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>J.isVisible.resolve(e)},count:{resolve:(e,t={})=>J.count.resolve(e)},exists:{resolve:(e,t={})=>J.exists.resolve(e)},videoElement:{resolve:(e,t={})=>x(at(K(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>_t.resolve(e,t)},fetch:{resolve:(e,t,n={})=>q.resolve(e,t,n),kind:q.kind,ensureArgs:q.ensureArgs},evaluate:{kind:`frame`,typed:!1,resolve:(e,t,n)=>{throw $e(`evaluate`,`this realm`)}}}}}),Qt=e=>e[e.length-1],$t={element:{last:{to:`element`,rewrite:e=>[...e,{kind:`element`,name:`nth`,args:[-1]}]},contentFrame:{to:`frame`,rewrite:e=>{let t=Qt(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=Qt(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]}]}}},en=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:`&&Ee(t.hostname)},Z=e=>{if(en(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},tn=({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`)},nn={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.`},rn={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.`},an=[`load`,`commit`],on=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&&!an.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`);Bt(`frame.goto`,n)},sn=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`)}},cn=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),ln=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=cn.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}},un=[`message`,`document`],dn=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},fn=(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:dn(r),transfer:i===void 0?[]:[...i]}},pn=[`url`,`path`,`type`],mn=[`content`,`sourceUrl`],hn=/[\n\r\u2028\u2029]/,gn=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=>pn.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=>!mn.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===``||hn.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}},_n=[`name`,`domain`,`path`],vn=e=>e instanceof RegExp||Object.prototype.toString.call(e)===`[object RegExp]`,yn=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=>!_n.includes(e));if(n!==void 0)throw TypeError(`frame.clearCookies: unknown option "${n}"`);let r=_n.flatMap(e=>{let n=t[e];return n===void 0?[]:[{key:e,value:n}]}),i=r.find(({value:e})=>vn(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},bn=e=>{typeof globalThis.reportError==`function`?globalThis.reportError(e):console.error(e)},xn=e=>{let{owner:t,...n}=Wt({executor:e.executor,modules:Zt,rewrites:$t,gate:e.gate}),r=async(t,n={})=>(Z(t),on(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}=gn(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=yn(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=fn(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(!un.includes(e))throw TypeError(`frame.${t}: the event type must be ${un.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){bn(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 _},Sn=[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,nn,rn,t.u,t.d,De,Oe,ke,Ie,Re],Cn=Yt.map(e=>e.id),wn={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},Tn=e=>e===0?`auto`:e===4?`critical`:`bundled`,En=Sn,Q=new Map,Dn={};(()=>{Q=new Map(En.map(e=>[e.scope,e])),Dn=Object.fromEntries(Q),En.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>En.filter(t=>t.category===e&&Tn(t.severity)===`bundled`);Object.fromEntries(Cn.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(Cn.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var On=e=>Q.get(e)?.category,kn=e=>{let t=Q.get(e);return t&&Tn(t.severity)},An=e=>{let t=Q.get(e);if(t)return Tn(t.severity)===`critical`?t.scope:t.category},jn=e=>wn[e],Mn=({category:e,key:t})=>{let n=t??(e&&jn(e));return n!==void 0&&On(n)!==void 0?n:void 0},Nn=(e,t)=>{for(let{category:n,key:r}of t)if(Mn({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}"`)},Pn=(e,t={})=>{let n=[],r=e.map(e=>{let r=Mn(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&&kn(r)===`critical`?r:void 0,category:r===void 0?e.category??`interaction`:Dn[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)}))}},Fn=e=>typeof e==`object`&&!!e,In=typeof chrome<`u`&&!!chrome.runtime?.id,Ln=e=>Fn(e)&&e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY===!0&&typeof e.frameId==`string`&&typeof e.document==`string`,Rn=new WeakMap,zn=new WeakMap,Bn=new WeakMap,Vn=new Set;typeof window<`u`&&In&&window.addEventListener(`message`,e=>{if(!Ln(e.data))return;e.stopImmediatePropagation();let t=e.source;if(!t||typeof t!=`object`)return;let n=t,r=Rn.get(n),i=e.data.frameId,a=e.data.document;if(Rn.set(n,i),zn.set(n,a),r)for(let e of Vn)e(r);let o=Bn.get(n);if(o){for(let e of[...o])(e.notDocument===void 0||e.notDocument!==a)&&(o.delete(e),e.resolve(i));o.size||Bn.delete(n)}},{capture:!0});var Hn=3e4,Un=`frame.evaluate: the code did not settle within ${Hn}ms`,Wn=()=>new V(Un),Gn=e=>H(e)&&e.message===Un?Wn():e,Kn=[/^frame load timed out after \d+ms for /,/^frame goto: documentstart timed out$/,/^navigation to .+ did not commit a document within \d+ms$/s],qn=e=>{if(e instanceof V)return e;let t=typeof e?.message==`string`?e.message:``;return Kn.some(e=>e.test(t))?new V(t):e},Jn=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`},Yn=(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)},Xn=({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&&Z(r),{url:r,width:Yn(t,500,`width`),height:Yn(n,700,`height`)}},Zn=[`persistent`,`ephemeral`,`native`],Qn=`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'`,$n=e=>{if(`syncCookies`in e)throw TypeError(Qn);let{cookies:t=`persistent`}=e;if(!Zn.includes(t))throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);if(`storageState`in e)throw TypeError(`attachFrame: storageState is not available yet`);let n=Jn(e);if(n===`iframe`&&e.lockdown&&t!==`native`)throw TypeError(`attachFrame: lockdown runs on the extension, which serves only cookies: 'native'`);return{kind:n,cookies:t}},er=e=>{try{return new URL(e).hostname}catch{return``}},tr=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,nr=!1,rr=()=>{nr||(nr=!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.`))},ir=`frame: this frame no longer holds the document the app attached it to`,ar=`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`,or=()=>{let e=O();if(e.status===`ok`&&e.abi>=1)return;let t=e.status===`absent`?0:e.abi;throw new D(`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.`)},sr=e=>{try{return new URL(e,location.href).hostname}catch{return``}},$=()=>{let e=O();return e.status===`absent`?0:e.abi},cr=`attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame`,lr=`frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame`,ur=`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`,dr=async({iframe:e,domains:n=[],lockdown:r=!1,permissions:i,blank:a})=>{if(a!==void 0)throw new D(`blank`,$(),cr);let o=crypto.randomUUID();if(Z(e.src),tn({src:e.src,domains:n,lockdown:r}),await A(),r&&or(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(tr,{detail:o}));let{executeLocator:s,highlightLocator:c,ensureLocatorPermission:l,requestCategories:u,evaluateFrame:d,goto:f}=await j.attachFrame({marker:o,domains:n,syncCookies:!0,lockdown:r}),p=new Set(t.t([...n,sr(e.src)],{ipv6:!0})),m=e=>p.has(t.t([er(e)],{ipv6:!0})[0]??``),h=xn({backend:`extension`,executor:{execute:s,highlight:c},gate:e=>l(e.parts,e.operation,e.args),requestPermissions:async e=>(Nn(`frame.requestPermissions`,e),await Kt(),u(e)),evaluate:async(e,t)=>{if(!de(O(),`evaluate`)){let e=O();throw new D(`evaluate`,e.status===`ok`?e.abi:0)}return d({source:e,arg:t}).catch(e=>{throw Gn(e)})},addScriptTag:async()=>{throw new D(`addScriptTag`,$(),lr)},clearCookies:async()=>{throw new D(`clearCookies`,$(),ur)},postMessage:(t,n,r)=>{if(n===`*`)throw Qe(ar,`postMessage`,`extension`);if(!m(n))throw B(ir,`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&&!Ln(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([sr(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 qn(e)})},url:()=>e.src});return i?.length&&(Gt()?await h.requestPermissions(i):rr()),h},fr=`attachFrame: a window on cookies: 'native' is not served yet; a window runs on the cloud render proxy, which has no browser cookies`,pr=e=>`attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`,mr=async e=>{throw Xn(e.window),new D(`attachWindow`,$(),fr)},hr=(async e=>{let{kind:t,cookies:n}=$n(e);if(n!==`native`)throw new D(`cookies`,$(),pr(n));return t===`window`?mr(e):dr(e)}),gr=`permissions.request: pass hosts, the sites the grant applies to`,_r={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(gr);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);Nn(`permissions.request`,r),r.length&&await Kt();let{items:i,answer:a}=Pn(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await j.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++])}},vr=`PermissionDeniedError`,yr=e=>e instanceof Error?e.name===vr:Fn(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return en}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return $n}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return An}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return vr}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Le}});