@volter/browser-substrate 0.1.115 → 0.1.116

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 (25) hide show
  1. package/dist/cli/package-packs.js +4 -4
  2. package/dist/cli/package-packs.js.map +1 -1
  3. package/dist/shell/assets/browser-opfs-filesystem-worker-CivfnvV7.js +3 -0
  4. package/dist/shell/assets/{browser-sandbox-bridge-CmMlTDpO.js → browser-sandbox-bridge-BOyO6Vq0.js} +2 -2
  5. package/dist/shell/assets/filesystem-host-B-fDKRNE.js +3 -0
  6. package/dist/shell/assets/{filesystem-host-D98WfBoD.js → filesystem-host-Cngy2ePX.js} +1 -1
  7. package/dist/shell/assets/filesystem-worker-BQAYsjDk.js +5 -0
  8. package/dist/shell/assets/{fork-worker-hBikLg_q.js → fork-worker-BOu5dHuR.js} +1 -1
  9. package/dist/shell/assets/{node-execution-worker-714dbca4282e90ae.js → node-execution-worker-e4ab9bf7f09262f8.js} +2 -2
  10. package/dist/shell/assets/{sandbox-qgjYY5Gr.js → sandbox-C41DorhH.js} +1 -1
  11. package/dist/shell/assets/{shell-C0qfPTpQ.js → shell-CdIq-SFl.js} +4 -4
  12. package/dist/shell/assets/worker-BCIFrV5h.js +816 -0
  13. package/dist/shell/assets/worker-program-worker-BEQYJYct.js +27 -0
  14. package/dist/shell/index.html +2 -2
  15. package/dist/shell/node-execution-worker.js +25 -9
  16. package/dist/shell/python-execution-worker.js +24 -8
  17. package/dist/shell/python-runtime-snapshot.bin +0 -0
  18. package/dist/shell/python-runtime-snapshot.json +1 -1
  19. package/dist/shell/sandbox.html +2 -2
  20. package/package.json +1 -1
  21. package/dist/shell/assets/browser-opfs-filesystem-worker-TLQsaODy.js +0 -3
  22. package/dist/shell/assets/filesystem-host-EfkgP9Jh.js +0 -3
  23. package/dist/shell/assets/filesystem-worker-51BLqPs5.js +0 -5
  24. package/dist/shell/assets/worker-BZ-Txq9L.js +0 -816
  25. package/dist/shell/assets/worker-program-worker-B_u8gbzh.js +0 -27
@@ -25,10 +25,10 @@ import { existsSync, lstatSync, readdirSync, readFileSync, rmSync, statSync, uti
25
25
  import { tmpdir } from "node:os";
26
26
  import { join } from "node:path";
27
27
  import { fileURLToPath } from "node:url";
28
- import { checkHostPreparationMemory, hostPreparationNodeArguments } from "@volter/browser-node/host-preparation-limits.js";
29
- /** The CLI admits module preparation below this current RSS. Measured on Rallly's preparation (ADR-0092): the CLI held
30
- * 3,330.4 MiB current / 3,485.5 MiB high-water when its builder started, on a 36 GiB host at memory pressure 1. */
31
- const CLI_ADMISSION_MIB = 4096;
28
+ import { checkHostPreparationMemory, hostMemoryShareMiB, hostPreparationNodeArguments } from "@volter/browser-node/host-preparation-limits.js";
29
+ /** The CLI admits module preparation below its share of this host's memory (ADR-0092; Rallly's CLI held 3,330.4 MiB
30
+ * current when its builder started, on a 36 GiB host). */
31
+ const CLI_ADMISSION_MIB = hostMemoryShareMiB();
32
32
  import { materializeInstallTree } from "./dependency-plan-build.js";
33
33
  /** A change to how a pack is built or keyed is another cache entry. */
34
34
  const PACKS_FORMAT = "image-packs-8";
@@ -1 +1 @@
1
- {"version":3,"file":"package-packs.js","sourceRoot":"","sources":["../../src/cli/package-packs.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,oBAAoB;AACpB,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,4EAA4E;AAC5E,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,uBAAuB;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;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9D,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,3 @@
1
+ const Kt=["file","directory","symlink"],Tn=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u,Pn=new TextEncoder,Fn=new TextDecoder;function Lr(m){let o=2166136261;for(let c=0;c<m.length;c+=1)o^=m.charCodeAt(c),o=Math.imul(o,16777619);return o>>>0}function Or(m,o){const c=[...m.keys()];for(const M of c)if(Tn.test(M))throw new Error("A path in the store is not well-formed UTF-16.");const d=new Map;for(let M=0;M<c.length;M+=1)d.set(c[M],M);for(const M of o.keys())d.has(M)||(d.set(M,c.length),c.push(M));const u=c.length,A=new Map,y=new Uint32Array(u);let p=0;for(let M=0;M<u;M+=1){const P=c[M];let G=!0;for(let W=0;W<P.length;W+=1)if(P.charCodeAt(W)>=128){G=!1;break}G||A.set(M,Pn.encode(P)),y[M]=G?P.length:A.get(M).length,p+=y[M]}let S=0;for(const M of o.values())S+=M.size;let I=1;for(;I<u*2;)I<<=1;const B=24,O=Jt(B+u*6*4,8),x=O+u*3*8,U=x+I*4,$=U+S*4,T=new SharedArrayBuffer(Jt($+p,8));new Uint32Array(T,0,6).set([2019846480,u,I,S,p,m.size]);const C=new Uint32Array(T,B,u*6),R=new Float64Array(T,O,u*3),J=new Uint32Array(T,x,I),N=new Uint32Array(T,U,S),ve=new Uint8Array(T,$,p);let Ee=0,ue=0;for(let M=0;M<u;M+=1){const P=c[M],G=M*6,W=A.get(M);if(W)ve.set(W,Ee);else for(let j=0;j<P.length;j+=1)ve[Ee+j]=P.charCodeAt(j);const Se=y[M];C[G+0]=Ee,C[G+1]=Se,Ee+=Se;let De=W?0:32;const b=m.get(P);if(b){De|=1|Kt.indexOf(b.type)<<3,b.pack&&(De|=4),C[G+3]=b.mode;const j=M*3;R[j+0]=b.mtimeMs,R[j+1]=b.offset,R[j+2]=b.length}const X=o.get(P);if(X){De|=2,C[G+4]=ue,C[G+5]=X.size;for(const j of X){const Le=d.get(`${P}/${j}`);if(Le===void 0)throw new Error(`The store's children name ${P}/${j}, which its index does not hold.`);N[ue++]=Le}}C[G+2]=De;let se=Lr(P)&I-1;for(;J[se]!==0;)se=se+1&I-1;J[se]=M+1}if(ue!==S)throw new Error("The shared index's children did not add up.");return T}function Jt(m,o){return Math.ceil(m/o)*o}class xe{buffer;count;entryCount;records;numbers;table;childList;strings;mask;constructor(o){const c=new Uint32Array(o,0,6);if(c[0]!==2019846480)throw new Error("Not a shared store index.");const[,d,u,A,y,p]=c;this.buffer=o,this.count=d,this.entryCount=p;const S=24,I=Jt(S+d*6*4,8),B=I+d*3*8,O=B+u*4,x=O+A*4;this.records=new Uint32Array(o,S,d*6),this.numbers=new Float64Array(o,I,d*3),this.table=new Uint32Array(o,B,u),this.childList=new Uint32Array(o,O,A),this.strings=new Uint8Array(o,x,y),this.mask=u-1}find(o){let c=Lr(o)&this.mask;for(;;){const d=this.table[c];if(d===0)return-1;if(this.pathIs(d-1,o))return d-1;c=c+1&this.mask}}entry(o){const c=o*6,d=this.records[c+2];if(!(d&1))return;const u=o*3,A={type:Kt[d>>>3&3],mode:this.records[c+3],mtimeMs:this.numbers[u+0],offset:this.numbers[u+1],length:this.numbers[u+2]};return d&4&&(A.pack="packages"),A}typeAt(o){const c=this.records[o*6+2];return c&1?Kt[c>>>3&3]:void 0}hasEntry(o){return(this.records[o*6+2]&1)!==0}childNames(o){const c=o*6;if(!(this.records[c+2]&2))return;const d=this.records[c+4],u=this.records[c+1]+1,A=[];for(let y=0;y<this.records[c+5];y+=1){const p=this.childList[d+y]*6;A.push(this.decode(this.records[p+0]+u,this.records[p+1]-u,(this.records[p+2]&32)!==0))}return A}path(o){const c=o*6;return this.decode(this.records[c+0],this.records[c+1],(this.records[c+2]&32)!==0)}decode(o,c,d){if(!d)return Fn.decode(this.strings.slice(o,o+c));let u="";for(let A=o,y=o+c;A<y;A+=4096)u+=String.fromCharCode.apply(null,this.strings.subarray(A,Math.min(y,A+4096)));return u}pathIs(o,c){const d=o*6,u=this.records[d+0],A=this.records[d+1];if(!(this.records[d+2]&32))return this.path(o)===c;if(A!==c.length)return!1;for(let y=0;y<A;y+=1)if(this.strings[u+y]!==c.charCodeAt(y))return!1;return!0}}const ie=Symbol("deleted");function Br(m,o){return m===o||!!m&&!!o&&m.type===o.type&&m.offset===o.offset&&m.length===o.length&&m.pack===o.pack&&m.mode===o.mode&&m.mtimeMs===o.mtimeMs&&m.capacity===o.capacity}class Ge{base;overlay=new Map;delta=0;constructor(o){this.base=o}get[Symbol.toStringTag](){return"Map"}get size(){return this.base.entryCount+this.delta}get(o){const c=this.overlay.get(o);if(c!==void 0)return c===ie?void 0:c;const d=this.base.find(o);return d<0?void 0:this.base.entry(d)}typeOf(o){const c=this.overlay.get(o);if(c!==void 0)return c===ie?void 0:c.type;const d=this.base.find(o);return d<0?void 0:this.base.typeAt(d)}has(o){const c=this.overlay.get(o);if(c!==void 0)return c!==ie;const d=this.base.find(o);return d>=0&&this.base.hasEntry(d)}set(o,c){this.has(o)||(this.delta+=1);const d=this.base.find(o);return d>=0&&Br(this.base.entry(d),c)?this.overlay.delete(o):this.overlay.set(o,c),this}delete(o){if(!this.has(o))return!1;const c=this.base.find(o);return c>=0&&this.base.hasEntry(c)?this.overlay.set(o,ie):this.overlay.delete(o),this.delta-=1,!0}clear(){throw new Error("A reader's index is not cleared; it is replaced.")}*entries(){for(const[o,c]of this.overlay)c!==ie&&(yield[o,c]);for(let o=0;o<this.base.count;o+=1){if(!this.base.hasEntry(o))continue;const c=this.base.path(o);this.overlay.has(c)||(yield[c,this.base.entry(o)])}}*keys(){for(const[o]of this.entries())yield o}*values(){for(const[,o]of this.entries())yield o}[Symbol.iterator](){return this.entries()}forEach(o,c){for(const[d,u]of this.entries())o.call(c,u,d,this)}*changed(){for(const[o,c]of this.overlay)c!==ie&&(yield[o,c])}*changes(){for(const[o,c]of this.overlay)yield[o,c===ie?null:c]}get overlaid(){return this.overlay.size}boundedChanges(){if(this.overlay.size>65536)return;const o=[];let c=0;for(const[d,u]of this.changes()){if(c+=d.length*2+128,c>8*1024*1024)return;o.push([d,u])}return o}}class bt{base;overlay=new Map;constructor(o){this.base=o}get(o){const c=this.overlay.get(o);if(c!==void 0)return c===ie?void 0:c;const d=this.base.find(o),u=d<0?void 0:this.base.childNames(d);return u?new Set(u):void 0}mutable(o){const c=this.overlay.get(o);if(c!==void 0&&c!==ie)return c;const d=new Set(c===ie?[]:this.get(o)??[]);return this.overlay.set(o,d),d}delete(o){this.overlay.set(o,ie)}}const In="supercode-browser-filesystems",Me="packages",xn="state.json",Tr="/image-range-worker.js",Pr="image-ranges.json",Mn=2;function Gt(m){const o=m;if(!o||o.version!==1||!Number.isSafeInteger(o.bytes)||o.bytes<0||!Array.isArray(o.parts)||o.image!==void 0&&(typeof o.image!="string"||!/^[a-f0-9]{16,64}$/u.test(o.image))||o.parts.length>1e5)throw new Error("Invalid immutable image ranges.");let c=0;for(const d of o.parts){if(!d||d.offset!==c||!Number.isSafeInteger(d.raw)||d.raw<0||!Number.isSafeInteger(d.bytes)||d.bytes<0||d.bytes>1024*1024*1024||d.raw>1024*1024*1024||typeof d.sha256!="string"||!/^[a-f0-9]{64}$/u.test(d.sha256)||typeof d.url!="string"||!/^\/substrate\/[A-Za-z0-9._/-]+$/u.test(d.url)||d.url.split("/").some(u=>u==="."||u===".."))throw new Error("Invalid immutable image part.");if(c+=d.raw,!Number.isSafeInteger(c))throw new Error("Immutable image ranges exceed the offset limit.")}if(c!==o.bytes)throw new Error("Immutable image ranges do not cover their reservation.");return o}const Fr=new Map;class Rn{ranges;directory;identity;receiptKey;client;worker;port;prefetchers=[];state;completed;firstRead;closed=!1;ready=!1;startup;cancelStartup;sharedCompletion;constructor(o,c,d,u,A,y){if(this.ranges=o,this.directory=c,this.identity=d,this.receiptKey=A,this.client=y,typeof Worker>"u"||typeof SharedArrayBuffer>"u")throw new Error("This browser cannot materialize an immutable image during a synchronous read.");if(this.state=new Int32Array(y?.state??new SharedArrayBuffer(o.parts.length*Int32Array.BYTES_PER_ELEMENT)),this.state.length!==o.parts.length)throw new Error("The image reader's line has the wrong range count.");const p=o.parts.length,S=u??new SharedArrayBuffer((2*p+1)*Int32Array.BYTES_PER_ELEMENT);if(S.byteLength!==p*Int32Array.BYTES_PER_ELEMENT&&S.byteLength!==(2*p+1)*Int32Array.BYTES_PER_ELEMENT)throw new Error("The image completion seed has the wrong range count.");this.completed=new Int32Array(S,0,p),this.firstRead=S.byteLength>p*Int32Array.BYTES_PER_ELEMENT?new Int32Array(S,p*Int32Array.BYTES_PER_ELEMENT,p+1):void 0,this.sharedCompletion=u!==void 0;for(const I of o.parts)Object.freeze(I);Object.freeze(o.parts),Object.freeze(o)}get completionBuffer(){return this.completed.buffer}get verifiedRanges(){return this.ranges}async initialize(){if(this.closed)throw new Error("This immutable image reader is closed.");if(this.ready)return;if(this.startup)return this.startup;let o=!1;for(let c=0;c<this.completed.length;c+=1)if(Atomics.load(this.completed,c)!==2){o=!0;break}if(!o){this.ready=!0,this.client?.port.close();return}if(this.client){const c=this.port=this.client.port;c.onmessage=d=>{d.data?.type!=="closing"||this.port!==c||(c.close(),this.port=void 0,this.closed||this.startMaterializer().catch(u=>console.warn("This process's image reader could not start its own materializer after its line closed.",u)))},c.start(),this.ready=!0;return}return this.startMaterializer()}startMaterializer(){const o=Date.now(),c=new Worker(Tr,{type:"module",name:"immutable-image-materializer"}),d=this.ready;return d||(this.worker=c),c.addEventListener("error",()=>this.fail()),c.addEventListener("messageerror",()=>this.fail()),this.startup=new Promise((u,A)=>{const y=()=>{clearTimeout(B),c.removeEventListener("message",I),c.removeEventListener("error",p),c.removeEventListener("messageerror",p),this.cancelStartup=void 0},p=()=>S(new Error("The immutable image materializer could not initialize; reload to retry.")),S=O=>{y(),c.terminate(),d||(this.closed=!0,this.fail()),A(O)},I=O=>{if(O.data?.identity===this.identity){if(O.data.type==="init-error"){S(new Error(`The immutable image materializer could not initialize: ${String(O.data.error)}`));return}O.data.type==="ready"&&(console.log(`[boot-trace] ${JSON.stringify({event:"materializer-ready",at:Date.now(),ms:Date.now()-o})}`),y(),this.ready=!0,this.worker=c,u())}},B=setTimeout(()=>S(new Error("The immutable image materializer did not initialize within 10 seconds; reload to retry.")),1e4);this.cancelStartup=S,c.addEventListener("message",I),c.addEventListener("error",p),c.addEventListener("messageerror",p);try{c.postMessage({type:"init",ranges:this.ranges,directory:this.directory,identity:this.identity,state:this.state.buffer,completed:this.completed.buffer,sharedCompletion:this.sharedCompletion,...this.receiptKey?{receiptKey:this.receiptKey}:{}})}catch(O){S(O instanceof Error?O:new Error(String(O)))}}),this.startup}readDigests(){const o=this.firstRead;if(!o)return;const c=this.ranges.parts.length,d=[];for(let u=0;u<c;u+=1){const A=Atomics.load(o,u),y=this.ranges.parts[u];A>0&&y.raw>0&&d.push([A,y.sha256])}return d.sort((u,A)=>u[0]-A[0]).map(([,u])=>u)}completedDigests(){const o=[];for(let c=0;c<this.completed.length;c+=1){const d=this.ranges.parts[c];d.raw>0&&Atomics.load(this.completed,c)===2&&o.push(d.sha256)}return o}prefetch(o,c=[]){if(this.closed||!this.ready||!this.worker)return{queued:0,done:Promise.resolve()};const d=new Map;for(let p=0;p<this.ranges.parts.length;p+=1){const S=this.ranges.parts[p];if(S.raw===0)continue;const I=d.get(S.sha256);I?I.push(p):d.set(S.sha256,[p])}const u=[];for(const p of new Set(o))for(const S of d.get(p)??[])Atomics.load(this.completed,S)!==2&&u.push(S);const A=c.length>0&&u.length>0?Math.min(c.length,8):Math.min(Mn,Math.ceil(u.length/32)),y=[];for(let p=0;p<A;p+=1){const S=u.filter((x,U)=>U%A===p),I=new Worker(Tr,{type:"module",name:"immutable-image-prefetch"});this.prefetchers.push(I);let B;y.push(new Promise(x=>{B=x}));const O=()=>{I.terminate(),this.prefetchers=this.prefetchers.filter(x=>x!==I),B()};I.addEventListener("error",O),I.addEventListener("messageerror",O),I.addEventListener("message",x=>{x.data?.identity===this.identity&&(x.data.type==="ready"?I.postMessage(c.length>0?{type:"prefetch-stream",url:c[p]}:{type:"prefetch",indices:S}):(x.data.type==="prefetched"||x.data.type==="init-error")&&O())}),I.postMessage({type:"init",ranges:this.ranges,directory:this.directory,identity:this.identity,state:new SharedArrayBuffer(this.state.byteLength),completed:this.completed.buffer,sharedCompletion:!0,...this.receiptKey?{receiptKey:this.receiptKey}:{}})}return{queued:u.length,done:Promise.all(y).then(()=>{})}}ensure(o,c){if(this.closed)throw new Error("This immutable image reader is closed.");if(!this.ready)throw new Error("This immutable image reader has not finished asynchronous initialization.");if(c===0||o>=this.ranges.bytes)return;const d=Math.min(o+c,this.ranges.bytes);let u=0,A=this.ranges.parts.length;for(;u<A;){const y=u+A>>>1,p=this.ranges.parts[y];p.offset+p.raw<=o?u=y+1:A=y}for(let y=u;y<this.ranges.parts.length;y+=1){const p=this.ranges.parts[y];if(p.offset>=d)break;const S=this.firstRead;if(S&&Atomics.load(S,y)===0&&Atomics.compareExchange(S,y,0,Atomics.add(S,this.ranges.parts.length,1)+1),Atomics.load(this.completed,y)===2)continue;const I=this.worker??this.port;if(!I)throw new Error("This immutable image reader's line closed and its own materializer is still starting; retry the read.");I.postMessage({type:"read",index:y});const B=performance.now(),O=B+3e4;for(;Atomics.load(this.state,y)===0;){const $=O-performance.now();if($<=0||Atomics.wait(this.state,y,0,$)==="timed-out")throw this.close(),new Error(`The image's immutable part ${p.url} did not arrive within 30 seconds; reload to retry.`)}const x=performance.now()-B,U=Fr.get(this.identity)??{ranges:0,ms:0};if(U.ranges+=1,U.ms+=x,Fr.set(this.identity,U),console.log(`[boot-trace] ${JSON.stringify({event:"image-blocked",at:Date.now(),reader:this.identity,index:y,range:p.sha256.slice(0,16),ms:Math.round(x)})}`),Atomics.load(this.state,y)!==2)throw new Error(`The image's immutable part ${p.url} could not be verified or stored; see the worker error and reload to retry.`)}}lineForReader(){const o=this.worker??this.port;if(this.closed||!this.ready||!o)return;const c=new MessageChannel,d=new SharedArrayBuffer(this.ranges.parts.length*Int32Array.BYTES_PER_ELEMENT);return o.postMessage({type:"client",port:c.port1,state:d},[c.port1]),{port:c.port2,state:d}}fail(){for(let o=0;o<this.state.length;o+=1)Atomics.compareExchange(this.state,o,0,-1)===0&&Atomics.notify(this.state,o)}close(){if(this.closed)return;if(this.closed=!0,this.cancelStartup){this.cancelStartup(new Error("This immutable image reader closed during initialization."));return}this.fail(),this.port?.close();const o=this.worker;o&&(o.postMessage({type:"closing"}),setTimeout(()=>o.terminate(),250));for(const c of this.prefetchers)c.dispatchEvent(new Event("error"));this.prefetchers=[]}}const Wt="/packages",kt="supercode-browser-packages",Re=new TextEncoder,We=new TextDecoder("utf-8",{fatal:!0}),_n=In,At="generations",Ir="atomic-staging",je=xn,oe="index.json",jt="index-log.bin",Ye="pack.bin",Ot=8,xr=64*1024*1024,ee=1024*1024*1024,vn=.95,Dn=["/workspace","/home","/opt"],_e=0,Mr=1,Yt=1e6,Rr=8*1024*1024,_r=250,Ln=64*1024*1024,Bn=256*1024*1024,vr=4*1024*1024,Ke=493,Tt=420;function Cn(m,o={}){const c=o.limits?.maxBytes,d=o.limits?.maxEntries??Yt;if(c!==void 0&&(!Number.isSafeInteger(c)||c<1)||!Number.isSafeInteger(d)||d<1||d>Yt)throw new Error("Invalid OPFS workspace limits.");let u=Number.MAX_SAFE_INTEGER,A,y,p=!1,S=!1,I=!1,B,O=0,x=0,U,$,T,h=new Map,C=new Pt,R,J,N,ve,Ee,ue,M=0,P,G=0;const W=new Map,Se=256*1024,De=32;let b=0,X,se=-1/0,j=0,Le=0,F=0,_=0,Y=0,be=0,ke=0,re,rt,ae,Be=!1,Je,qt=Promise.resolve(),Ce=0,z=!1,ze=!1,H,Ae=0,ce=!1;function nt(){if(!(!H||ce)){if(F>2147483647){it();return}Atomics.store(H,Mr,F)}}function it(){!H||ce||(ce=!0,(Atomics.load(H,_e)&1)===0&&Atomics.add(H,_e,1))}function qe(){Ae+=1,Ae===1&&H&&!ce&&Atomics.add(H,_e,1)}function Ve(){Ae-=1,!(Ae>0||!H||ce)&&(nt(),ce||Atomics.add(H,_e,1))}function Vt(){if(S)throw new Error("A store open for reading follows its owner's clock; it has none of its own.");return H||(H=new Int32Array(new SharedArrayBuffer(2*Int32Array.BYTES_PER_ELEMENT)),H[_e]=Ae>0||ce?1:0,nt()),H.buffer}let Q;const Cr=8*1024*1024;let Xt=!1;function zr(e){if(S||!H||!T||Be||Ae>0||ce||z)return;const t=Atomics.load(H,_e);if(t&1)return;if(e?.overlays&&h instanceof Ge){const i=h.boundedChanges();if(i)return It({generation:T,index:h.base.buffer,changes:i,packBytes:b,logBytes:F,epoch:t,liveBytes:_,linked:O,linkedBytes:x})}if(Q&&Q.generation===T&&Q.epoch===t&&F>=Q.logBytes&&F-Q.logBytes<=(e?.current?0:Cr))return It(Q);let r;try{r=Or(h,Hr())}catch(i){console.warn(`[pack-store] no reader seed: ${i instanceof Error?i.message:String(i)}`);return}return Q={generation:T,index:r,packBytes:b,logBytes:F,epoch:t,liveBytes:_,linked:O,linkedBytes:x},$r(r),It(Q)}function It(e){const t=o.packages?.imageCompletionSeed();return t?{...e,packagesImage:t}:e}function Nr(){if(!(!N||!J||!T||Be||Ae>0||z))return{generation:T,rangesDigest:J,completed:N.completionBuffer,...N.receiptKey?{metadata:{ranges:N.verifiedRanges,receiptKey:N.receiptKey}}:{}}}function $r(e){const t=[];if(h instanceof Ge)for(const[i,n]of h.changed())n.capacity!==void 0&&t.push([i,n]);else for(const[i,n]of h)n.capacity!==void 0&&t.push([i,n]);const r=new xe(e);h=new Ge(r),C=new bt(r);for(const[i,n]of t)h.set(i,n)}function Hr(){if(C instanceof Pt)return C.map;const e=new Map;for(const t of h.keys()){const r=Fe(t);if(r===t)continue;let i=e.get(r);i||(i=new Set,e.set(r,i)),i.add(t.slice(r.length+1))}return e}function Ur(){!S||I||z||!P||ft(F)}async function ot(e){if(z)throw new Error("This OPFS workspace is closing.");Ce+=1;let t,r=!1;try{return await e()}catch(i){throw r=!0,t=i,i}finally{if(Ce-=1,z&&Ce===0)try{br()}catch(i){throw r?new AggregateError([t,i],"OPFS operation and deferred close both failed."):i}}}async function st(e){return ye(),Ce!==0?Promise.reject(new Error("Wait for the current OPFS storage operation before replacing its generation.")):(ze=!0,ot(async()=>{try{return await e()}finally{ze=!1}}))}function Gr(e){if(z)throw new Error("This OPFS workspace is closing.");const t=h.get(e);if(!t||t.type==="directory")throw new Error(`OPFS workspace file does not exist: ${e}`);return at(t)}function Wr(e,t,r){if(z)throw new Error("This OPFS workspace is closing.");const i=h.get(e);if(!i||i.type==="directory")throw new Error(`OPFS workspace file does not exist: ${e}`);const n=Math.min(Math.max(0,t),i.length),s=Math.min(Math.max(0,r),i.length-n);if(i.pack){const a=o.packages;if(!a)throw new Error("This store has no shared package store to read from.");return a.readExtent(i.offset+n,s)}return ct(i.offset+n,s)}function at(e){if(e.pack){const t=o.packages;if(!t)throw new Error("This store has no shared package store to read from.");return t.readExtent(e.offset,e.length)}return ct(e.offset,e.length)}function ct(e,t){if(z)throw new Error("This OPFS workspace is closing.");const r=R;if(!r)throw new Error("OPFS filesystem worker is not initialized.");const i=new Uint8Array(t);if(t>0&&t<=Se&&e>=0&&e+t<=G){let n=0;for(;n<t;){const s=e+n,a=Math.floor(s/Se)*Se;let f=W.get(a);if(!f&&(f=new Uint8Array(Math.min(Se,G-a)),N?.ensure(a,f.byteLength),r.read(f,{at:a})!==f.byteLength))throw new Error("An OPFS package range could not be read completely.");W.delete(a),W.set(a,f),W.size>De&&W.delete(W.keys().next().value);const l=s-a,w=Math.min(t-n,f.byteLength-l);i.set(f.subarray(l,l+w),n),n+=w}return i}if(N?.ensure(e,t),t>0&&r.read(i,{at:e})!==t)throw new Error("An OPFS workspace file could not be read completely.");return i}async function jr(e,t={}){if(z&&y||!y&&Ce!==0)throw new Error("Wait for this OPFS workspace to finish closing before opening it again.");if(Be)throw new Error("This OPFS store is already opening a workspace.");if(y){if($!==er(e))throw new Error("Close this OPFS store before opening another workspace.");return h.size>0}Be=!0,z=!1;const r=new AbortController;Je=r;try{h=new Map,C=new Pt,T=void 0,J=void 0,B=void 0,re=void 0,ae=void 0,b=F=_=Y=O=x=0,le=void 0,be=ke=j=Le=0,se=-1/0,$=er(e),S=t.readOnly===!0,Ee=S?t.imageCompletion:void 0,ue=S?t.imageLine:void 0,I=S&&t.extentsOnly===!0,p=t.shared===!0||S,A=void 0;try{const a=await m.navigator.storage.estimate?.();a?.quota&&(u=Math.max(0,Math.floor(a.quota*vn)-(a.usage??0)))}catch{}p||await Vr(r.signal),r.signal.throwIfAborted();const i=await Kr();r.signal.throwIfAborted();try{const a=await i.getDirectoryHandle(_n,{create:!S});r.signal.throwIfAborted(),y=await a.getDirectoryHandle($,{create:!S})}catch(a){if(r.signal.throwIfAborted(),S&&Ue(a))return!1;throw a}r.signal.throwIfAborted();let n=Et(await Pe(y,je));if(r.signal.throwIfAborted(),!n&&S)return await Mt(),!1;if(!n&&p&&(await m.navigator.locks.request(kt,{mode:"exclusive",signal:r.signal},async()=>{r.signal.throwIfAborted(),n=Et(await Pe(y,je)),r.signal.throwIfAborted(),n||(await Mt(),await cr({files:[],pack:new ArrayBuffer(0)}),await Nn(y))}),r.signal.throwIfAborted(),!n))return B=await fe(T,!1),r.signal.throwIfAborted(),!1;if(!n)return await Mt(),r.signal.throwIfAborted(),!1;const s=async a=>{let f;try{f=await fe(a.generation,!1)}catch(E){throw r.signal.throwIfAborted(),Ue(E)?new Error("The committed OPFS workspace generation is missing. Stored generations were retained.",{cause:E}):E}if(r.signal.throwIfAborted(),T=a.generation,M=a.initializedAt,J=a.imageRanges,B=f,I)return $===Me&&m.navigator.locks?await m.navigator.locks.request(kt,{mode:"shared",signal:r.signal},async()=>{await Ne(f),G=R.getSize()}):await Ne(f),r.signal.throwIfAborted(),!0;const l=S?t.seed:void 0;if(l&&l.generation===a.generation){const E=new xe(l.index);return h=new Ge(E),C=new bt(E),b=l.packBytes,l.changes&&Zt({packBytes:l.packBytes,changes:l.changes}),await Ne(f),r.signal.throwIfAborted(),F=l.logBytes,{liveBytes:_,linked:O,linkedBytes:x}=l,Y=Math.max(0,b-_),Xt=!0,h.size>0}const w=S?void 0:await gn(f);if(r.signal.throwIfAborted(),w){const E=new xe(w.index);h=new Ge(E),C=new bt(E),{packBytes:b,liveBytes:_,linked:O,linkedBytes:x}=w;const g=Atomics.load(new Int32Array(Vt()),_e);Q={generation:T,index:w.index,packBytes:b,liveBytes:_,linked:O,linkedBytes:x,logBytes:0,epoch:g}}else h=$t(await Pe(f,oe)),r.signal.throwIfAborted(),He(),b=xt(h);await Ne(f),r.signal.throwIfAborted();const k=w?await mn(w):0;return r.signal.throwIfAborted(),k&&(le={generation:T,bytes:k},Q&&(Q.logBytes=k)),ft(k,!!w),w?Y=Math.max(0,b-_):Xe(),sr(),p&&!S&&!w&&h.size>=1e4&&(ge(),await et(f,h,{access:P,bytes:F,packBytes:b})),p||(R.truncate(b),await hr(y,Ir,!0),await Rt(T),r.signal.throwIfAborted(),Y>Ln&&Y>_&&await an()),r.signal.throwIfAborted(),h.size>0};return p&&!S?await m.navigator.locks.request(kt,{mode:"exclusive",signal:r.signal},async()=>{if(n=Et(await Pe(y,je)),!n)throw new Error("The committed package store state is missing. Stored data was retained.");return s(n)}):await s(n)}catch(i){const n=[i];try{$e()}catch(s){n.push(s)}try{U?.()}catch(s){n.push(s)}throw U=void 0,y=void 0,n.length>1?new AggregateError(n,"OPFS workspace open and cleanup failed."):i}finally{Be=!1,Je=void 0}}function Yr(e){return ot(()=>Qt(e?.whole===!0))}async function Qt(e=!1){if(I)throw new Error("A store opened for its extents alone has no index to follow.");if(S&&y){const s=Et(await Pe(y,je));if(!s)throw new Error("The committed OPFS workspace state is missing. Stored data was retained.");if(s.generation!==T||e){const a=await fe(s.generation,!1),f=$t(await Pe(a,oe));b=xt(f),s.generation!==T&&(T=s.generation,M=s.initializedAt,J=s.imageRanges,await Ne(a)),T=s.generation,B=a,h=f,He(),ft(),Xe();return}}const t=P;if(!t||!B)return;const r=t.getSize();let i=!1;r<F&&(h=$t(await Pe(B,oe)),He(),b=xt(h),F=0,i=!0);const n=F;ft(F),(i||F!==n)&&Xe()}async function Kr(){let e;for(let t=0;t<10;t+=1){Je?.signal.throwIfAborted();try{return await m.navigator.storage.getDirectory()}catch(r){e=r,await new Promise(i=>setTimeout(i,200))}}throw e instanceof Error?e:new Error("This browser workspace's storage is unavailable.")}const Jr=1e4;async function q(e,t){let r;const i=Je?.signal;for(let s=0;s<2;s+=1){i?.throwIfAborted();const a=e.createSyncAccessHandle({mode:"readwrite-unsafe"});let f,l,w=!1;try{const k=new Promise((g,D)=>{l=()=>D(i?.reason??new DOMException("Workspace open was cancelled.","AbortError")),i?.addEventListener("abort",l,{once:!0}),i?.aborted&&l()}),E=await Promise.race([a.then(g=>({access:g})).catch(g=>{r=g}),new Promise(g=>{f=setTimeout(()=>g(void 0),Jr)}),k]);if(i?.throwIfAborted(),E)return w=!0,E.access}finally{f!==void 0&&clearTimeout(f),l&&i?.removeEventListener("abort",l),w||a.then(k=>k.close(),()=>{}).catch(k=>console.error("Late workspace handle cleanup failed.",k))}if(r instanceof TypeError)throw new Error(`This browser cannot share a workspace's files between pages: its file access handles have no readwrite-unsafe mode (Chrome 121 or newer has one). ${r.message}`);await new Promise(k=>setTimeout(k,500))}const n=r instanceof Error?` (${r.message})`:"";throw new Error(`This browser workspace's ${t} is held by another page${n}.`)}async function Ne(e){$e();const t=await e.getFileHandle(Ye);R=await q(t,"store");try{if(R.getSize()<b)throw new Error("The committed OPFS workspace pack is incomplete. Stored data was retained.");const r=await e.getFileHandle(jt);if(P=await q(r,"record of changes"),F=P.getSize(),J){const i=Ee,n=i&&i.generation===T&&i.rangesDigest===J?i:void 0;let s,a;if(n?.metadata){if(s=Gt(n.metadata.ranges),a=n.metadata.receiptKey,!/^[a-f0-9]{64}$/u.test(a))throw new Error("The owner's immutable receipt key is invalid.")}else{const l=await(await e.getFileHandle(Pr)).getFile(),w=new Uint8Array(await l.arrayBuffer());if(await he(w)!==J)throw new Error("The committed immutable image ranges have changed. Stored data was retained.");s=Gt(JSON.parse(We.decode(w))),a=await he(Re.encode(JSON.stringify(s)))}if(s.bytes>R.getSize())throw new Error("The immutable image reservation is incomplete. Stored data was retained.");const f=n?ue:void 0;f||ue?.port.close(),ue=void 0,N=new Rn(s,e,`${$}.${T}`,n?.completed,a,f),console.log(`[boot-trace] ${JSON.stringify({event:"image-reader-open",at:Date.now(),reader:`${$}.${T}`,offered:i!==void 0,shared:n!==void 0,...i&&!n?{offeredGeneration:i.generation,generation:T,rangesMatch:i.rangesDigest===J}:{}})}`),await N.initialize(),ve=s.image}}catch(r){throw $e(),r}}function $e(){N?.close(),N=void 0,ve=void 0;const e=R,t=P;R=void 0,P=void 0,F=0,G=0,W.clear();try{e?.close()}finally{t?.close()}}function ft(e=0,t=!1){const r=P;if(!r)throw new Error("OPFS filesystem worker is not initialized.");const i=r.getSize();if(i<=e){F=i;return}const n=new Uint8Array(i-e);if(r.read(n,{at:e})!==n.byteLength)throw new Error("The OPFS workspace index log could not be read.");const s=R?.getSize()??1/0,a=new DataView(n.buffer);let f=0;const l=n.byteLength;for(;f+Ot<=l;){const w=a.getUint32(f,!0),k=a.getUint32(f+4,!0),E=f+Ot;if(w===0||w>xr||E+w>l)break;const g=n.subarray(E,E+w);if(mr(g)!==k)break;let D;try{D=bn(JSON.parse(We.decode(g)))}catch{break}if(D.packBytes>s)break;Zt(D,t),f=E+w}f!==l&&!p&&r.truncate(e+f),F=e+f}function Zt(e,t=!1){for(const[r,i]of e.changes){const n=h.get(r);if(i&&Br(n,i)){dt(r);continue}t&&(n?.pack?(O-=1,x-=n.length):n&&(_-=n.length),i?.pack?(O+=1,x+=i.length):i&&(_+=i.length)),i===null?(h.delete(r),rr(r)):(h.set(r,i),dt(r))}b=Math.max(b,e.packBytes)}function Xe(){_=0,O=0,x=0;for(const e of h.values())e.pack?(O+=1,x+=e.length):_+=e.length;Y=Math.max(0,b-_)}function xt(e){let t=0;for(const r of e.values())r.pack||(t=Math.max(t,r.offset+r.length));return t}const qr=5e3;async function Vr(e){if(!m.navigator.locks)return;if(!$)throw new Error("OPFS filesystem project is not initialized.");const t=new AbortController,r=setTimeout(()=>t.abort(),qr);try{await new Promise((i,n)=>{m.navigator.locks.request(`supercode-browser-filesystem-${$}`,{mode:"exclusive",signal:e?AbortSignal.any([e,t.signal]):t.signal},async()=>{clearTimeout(r),i(),await new Promise(s=>{U=s})}).catch(()=>n(e?.aborted?e.reason:new Error("This browser workspace is already open in another tab.")))})}finally{clearTimeout(r)}}function er(e){if(typeof e!="string"||!/^[a-z0-9](?:[a-z0-9._-]{0,62}[a-z0-9])?$/u.test(e))throw new Error("OPFS filesystem projectId is invalid.");return e}async function Oe(){if(!y)throw new Error("OPFS filesystem worker is not initialized.");return y}async function fe(e,t){return(await(await Oe()).getDirectoryHandle(At,{create:t})).getDirectoryHandle(e,{create:t})}async function Mt(){let e;try{e=await(await Oe()).getDirectoryHandle(At)}catch(t){if(Ue(t))return;throw t}for await(const t of e.entries())throw new Error("OPFS workspace state is missing but stored generations exist. Stored data was retained.")}async function Rt(e){const t=await Oe();let r;try{r=await t.getDirectoryHandle(At)}catch(i){if(Ue(i))return;throw i}for await(const[i]of r.entries())i!==e&&await wr(r,i)}function ye(){if(z)throw new Error("This OPFS workspace is closing.");if(ze)throw new Error("This OPFS workspace is replacing its generation; wait for that operation before writing.");if(S)throw new Error("This store is open for reading; its owner writes it.");if(ae)throw ae}async function Xr(e){Er(e)}let _t=!1,lt=0,le,vt=!1;function tr(){if(lt>0)return;const e=le&&le.generation===T&&le.bytes<=F?le.bytes:0;F-e>Rr&&!_t&&(_t=!0,(p?m.navigator.locks.request(kt,{mode:"exclusive"},async()=>{if(!y||z)return;await Qt();const r=le,i=r&&r.generation===T&&r.bytes<=F?r.bytes:0;F-i>Rr&&await yt()}):yt()).catch(r=>console.error("The workspace's log could not be checkpointed; it is replayed at the next open.",r)).finally(()=>{_t=!1})),!p&&!vt&&Y>Bn&&Y>_&&(vt=!0,ot(cn).catch(t=>console.error("The workspace could not be compacted; it keeps its generation.",t)).finally(()=>{vt=!1}))}async function Qr(e){ye(),lt+=1;try{return await e()}finally{lt-=1,lt===0&&!z&&y&&tr()}}function Zr(e,t){const r=we(e.path);if(e.operation==="write"){if(h.get(r)?.type==="directory")throw new Error(`OPFS write target is a directory: ${r}`);if(!(e.content instanceof Uint8Array))throw new Error("OPFS write requires file content.");const n=e.content;if(n.byteLength>ee)throw new Error(`${r} is ${n.byteLength} bytes; an OPFS workspace file holds at most ${ee}.`);ht(r,n.byteLength),Te(r,t);const s=ut(n);V(r,{type:e.symlink?"symlink":"file",mode:e.mode??h.get(r)?.mode??Tt,mtimeMs:e.mtimeMs??Date.now(),offset:s,length:n.byteLength},t);return}if(e.operation==="append"){const n=h.get(r);if(n&&n.type!=="file")throw new Error(`OPFS append target is not a file: ${r}`);if(!(e.content instanceof Uint8Array))throw new Error("OPFS append requires file content.");const s=e.content,a=(n?.length??0)+s.byteLength;if(a>ee)throw new Error(`${r} is ${a} bytes; an OPFS workspace file holds at most ${ee}.`);ht(r,a),Te(r,t);const f=e.mode??n?.mode??Tt,l=e.mtimeMs??Date.now(),w=n&&!n.pack?n.capacity??n.length:0;if($!==Me&&n&&!n.pack&&n.length>0&&(a<=w||n.offset+w===b)){wt(n.offset+n.length,s),V(r,{...n,mode:f,mtimeMs:l,length:a,capacity:Math.max(w,a)},t),Y-=Math.max(n.length,n.capacity??0),be-=1,ke-=n.length;return}const k=new Uint8Array(a);n&&n.length>0&&k.set(at(n),0),k.set(s,a-s.byteLength);const E=ut(k),g=Math.min(ee,Math.max(a,a*2,64*1024));g>a&&ar(E+g),V(r,{type:"file",mode:f,mtimeMs:l,offset:E,length:a,capacity:g},t);return}if(e.operation==="write-at"){const n=h.get(r);if(n&&n.type!=="file")throw new Error(`OPFS write target is not a file: ${r}`);if(!(e.content instanceof Uint8Array))throw new Error("OPFS write requires file content.");const s=e.content,a=e.position,f=n?.length??0;if(s.byteLength===0&&n)return;const l=s.byteLength===0?f:Math.max(f,a+s.byteLength);if(l>ee)throw new Error(`${r} is ${l} bytes; an OPFS workspace file holds at most ${ee}.`);ht(r,l),Te(r,t);const w=e.mode??n?.mode??Tt,k=e.mtimeMs??Date.now(),E=n&&!n.pack?n.capacity??n.length:0;if($!==Me&&n&&!n.pack&&f>0&&(l<=E||n.offset+E===b)){if(a>f&&wt(n.offset+f,new Uint8Array(a-f)),rt&&a<f){const Z=Math.min(f,a+s.byteLength);rt.push([n.offset+a,ct(n.offset+a,Z-a)])}wt(n.offset+a,s),V(r,{...n,mode:w,mtimeMs:k,length:l,capacity:Math.max(E,l)},t),l!==f&&(Y-=Math.max(n.length,n.capacity??0),be-=1,ke-=n.length);return}const g=new Uint8Array(l);n&&f>0&&g.set(at(n),0),s.byteLength>0&&g.set(s,a);const D=ut(g),L=Math.min(ee,Math.max(l,l*2,64*1024));L>l&&ar(D+L),V(r,{type:"file",mode:w,mtimeMs:k,offset:D,length:l,capacity:L},t);return}if(e.operation==="mkdir"){Te(r,t);const n=h.get(r);if(n&&n.type!=="directory")throw new Error(`OPFS path is a file: ${r}`);V(r,{type:"directory",mode:e.mode??n?.mode??Ke,mtimeMs:e.mtimeMs??n?.mtimeMs??Date.now(),offset:0,length:0},t);return}if(e.operation==="remove"){Lt(r,t),pe().includes(r)&&V(r,{type:"directory",mode:Ke,mtimeMs:Date.now(),offset:0,length:0},t);return}if(e.operation==="link"){en(r,or(e.source),t);return}if(e.operation==="rename"){tn(r,we(e.destination),t);return}const i=h.get(r);if(!i)throw new Error(`OPFS metadata target does not exist: ${r}`);V(r,{...i,mode:e.mode??i.mode,mtimeMs:e.mtimeMs??i.mtimeMs},t)}function V(e,t,r){const i=h.get(e);re&&!re.has(e)&&re.set(e,i);const n=i!==void 0&&i.type===t.type&&i.offset===t.offset&&i.length===t.length&&i.pack===t.pack;i&&!n&&(nr(i),i.type!=="directory"&&t.type!=="directory"&&i.length>0&&!i.pack&&(be+=1,ke+=i.length)),h.set(e,t),dt(e),n||(t.pack?(O+=1,x+=t.length):_+=t.length),r.push([e,t])}function dt(e){const t=Fe(e);t!==e&&C.mutable(t).add(e.slice(t.length+1))}function rr(e){const t=Fe(e);C.get(t)?.has(e.slice(t.length+1))&&C.mutable(t).delete(e.slice(t.length+1)),C.delete(e)}function He(){C=new Pt;for(const e of h.keys())dt(e)}function Dt(e){const t=[],r=i=>{const n=h.get(i);if(!n)return;t.push([i,n]);const s=C.get(i);if(s)for(const a of s)r(`${i}/${a}`)};return r(e),t}function nr(e,t){if(e.pack){O-=1,x-=e.length;return}_-=e.length,Y+=Math.max(e.length,e.capacity??0)}function ir(e,t){const r=h.get(e);r&&(re&&!re.has(e)&&re.set(e,r),h.delete(e),rr(e),nr(r),t.push([e,null]))}function en(e,t,r){const i=o.packages;if(!i)throw new Error("This store has no shared package store to link from.");const n=or(t),s=i.descendants(n);if(s.length===0)throw new Error(`The shared package store does not hold ${t}.`);Te(e,r),Lt(e,r),de(h.size+s.length);for(const[a,f]of s){const l=a===n?e:`${e}${a.slice(n.length)}`;V(l,f.type==="directory"?{type:"directory",mode:f.mode,mtimeMs:f.mtimeMs,offset:0,length:0}:{type:f.type,mode:f.mode,mtimeMs:f.mtimeMs,offset:f.offset,length:f.length,pack:Me},r)}}function Te(e,t){const r=Fe(e);if(r!==e&&h.get(r)?.type==="directory"){de(h.size+(h.has(e)?0:1));return}const i=[];let n=Qe(e)??pe()[0];if(h.has(n)||i.push(n),e!==n)for(const a of Ht(pr(Fe(e)))){n=`${n}/${a}`;const f=h.get(n);if(f&&f.type!=="directory")throw new Error(`OPFS path parent is a file: ${n}`);f||i.push(n)}de(h.size+i.length+(h.has(e)?0:1));const s=Date.now();for(const a of i)V(a,{type:"directory",mode:Ke,mtimeMs:s,offset:0,length:0},t)}function Lt(e,t){for(const[r]of Dt(e))ir(r,t)}function tn(e,t,r){if(e===t)return;if(t.startsWith(`${e}/`))throw new Error("An OPFS rename cannot move a directory into itself.");const i=Dt(e);if(i.length===0){if(h.has(t))return;throw new Error(`OPFS rename source does not exist: ${e}`)}Te(t,r),Lt(t,r);for(const[n]of i)ir(n,r);for(const[n,s]of i)V(`${t}${n.slice(e.length)}`,s,r);de(h.size)}function or(e){if(typeof e!="string"||!e.startsWith(`${Wt}/`)||e.includes("\0")||e.length>4096)throw new Error("Invalid shared store path.");return Ht(e.slice(Wt.length+1)),e}function pe(){return $===Me?[Wt]:Dn}function Qe(e){return pe().find(t=>e===t||e.startsWith(`${t}/`))}function Bt(){return c!==void 0?c:(A??=_,Math.min(Number.MAX_SAFE_INTEGER,A+u))}function Ct(){return c!==void 0?"its configured limit":"the origin's storage quota"}function ht(e,t){const r=h.get(e),i=r&&!r.pack?r.length:0,n=Bt();if(_-i+t>n){const s=p?"the origin's shared packages":"the project's own files";throw new Error(`OPFS workspace exceeds ${Ct()}: writing ${e} (${t} bytes) would take ${s} past ${n} bytes (${_} bytes held, ${i} replaced).`)}}function de(e){if(e>d)throw new Error("OPFS workspace exceeds its entry limit.")}function sr(){de(h.size);const e=Bt();if(_>e)throw new Error(`OPFS workspace exceeds ${Ct()}: ${p?"the origin's shared packages":"the project's own files"} hold ${_} bytes, past ${e}.`)}function wt(e,t){const r=R;if(!r)throw new Error("OPFS filesystem worker is not initialized.");let i=0;for(;i<t.byteLength;){const n=r.write(t.subarray(i),{at:e+i});if(n<=0)throw new Error("An OPFS workspace file could not be written completely.");i+=n}b=Math.max(b,e+t.byteLength)}function ar(e){const t=R;if(!t)throw new Error("OPFS filesystem worker is not initialized.");e<=b||(t.truncate(e),b=e)}function ut(e){const t=R;if(!t)throw new Error("OPFS filesystem worker is not initialized.");const r=b;let i=0;for(;i<e.byteLength;){const n=t.write(e.subarray(i),{at:r+i});if(n<=0)throw new Error("An OPFS workspace file could not be written completely.");i+=n}return b=r+e.byteLength,r}function rn(e){const t=R;if(t.getSize()>=b&&e.getSize()>=F)return;t.flush(),e.flush();const r=t.getSize(),i=e.getSize();if(!(r>=b&&i>=F))throw Object.assign(new Error(`This browser is keeping less than the tab wrote (the store's pack holds ${r} of ${b} bytes, its log ${i} of ${F}): its storage is full, as a private window's is well below its quota.`),{name:"QuotaExceededError",code:"ENOSPC"})}function nn(e,t={}){const r=P;if(!r||!R)throw new Error("OPFS filesystem worker is not initialized.");if(e.length===0)return;const i=Re.encode(JSON.stringify({packBytes:b,changes:e}));if(i.byteLength>xr)throw new Error("An OPFS workspace index record exceeds its size limit.");const n=new Uint8Array(Ot+i.byteLength),s=new DataView(n.buffer);s.setUint32(0,i.byteLength,!0),s.setUint32(4,mr(i),!0),n.set(i,Ot);let a=0;for(;a<n.byteLength;){const f=r.write(n.subarray(a),{at:F+a});if(f<=0)throw new Error("The OPFS workspace index log could not be written completely.");a+=f}F+=n.byteLength,rn(r),t.publish!==!1&&nt(),performance.now()-se>=_r?ge():X===void 0&&(X=setTimeout(ge,_r))}function ge(){if(X!==void 0&&(clearTimeout(X),X=void 0),ae)throw ae;const e=performance.now();R?.flush(),P?.flush(),se=performance.now(),j+=1,Le+=se-e}function yt(){const e=qt,t=ot(()=>e.catch(()=>{}).then(on));return qt=t,t}async function on(){if(ye(),!T)return;const e=T,t=P,r=await fe(e,!1);if(!t||t!==P||e!==T)throw new Error("OPFS workspace changed generations before its checkpoint could start.");ge();const i=F;if(await et(r,h,{access:t,bytes:i,packBytes:b}),e===T&&(le={generation:e,bytes:i}),t===P&&e===T&&i===F){qe();try{t.truncate(0),t.flush(),F=0,le={generation:e,bytes:0}}finally{Ve()}}}function cr(e){return st(()=>sn(zt(e)))}async function sn(e){const t=crypto.randomUUID(),r=await fe(t,!0),i=await r.getFileHandle(Ye,{create:!0}),n=await q(i,"store"),s=new Map;let a=0;try{for(const l of e.files){let w=0,k=0;if(l.type!=="directory"){const E=new Uint8Array(e.pack,l.offset??0,l.length??0);w=a,k=E.byteLength;let g=0;for(;g<k;){const D=n.write(E.subarray(g),{at:w+g});if(D<=0)throw new Error("An OPFS workspace file could not be written completely.");g+=D}a+=k}s.set(l.path,{type:l.type,mode:l.mode??(l.type==="directory"?Ke:Tt),mtimeMs:l.mtimeMs??Date.now(),offset:w,length:k})}for(const l of pe())s.has(l)||s.set(l,{type:"directory",mode:Ke,mtimeMs:Date.now(),offset:0,length:0});de(s.size),n.truncate(a),n.flush()}finally{n.close()}const f=await et(r,s);await pt(t,r,s,a,f)}async function an(){await fr(()=>!0)}async function cn(){let e=!1,t=!1,r=!1;try{await fn(()=>{e=!0},()=>{t=!0},()=>{r=!0})}finally{e&&(t||r)?Ve():e&&it()}}async function fn(e,t,r){const i=crypto.randomUUID(),n=await fe(i,!0),s=await q(await n.getFileHandle(Ye,{create:!0}),"store");let a,f=!1;try{a=await q(await n.getFileHandle(jt,{create:!0}),"record of changes"),a.truncate(0);const l=new Uint8Array(vr);let w=0;const k=v=>{if(v.pack)return{...v};if(v.type==="directory"||v.length===0)return{...v,offset:0,length:0};const K=R;if(!K)throw new Error("OPFS filesystem worker is not initialized.");const Ie=w;let ne=0;for(;ne<v.length;){const tt=Math.min(l.byteLength,v.length-ne),kr=l.subarray(0,tt);if(N?.ensure(v.offset+ne,tt),K.read(kr,{at:v.offset+ne})!==tt)throw new Error("An OPFS workspace file could not be read completely.");let St=0;for(;St<tt;){const Ar=s.write(kr.subarray(St),{at:Ie+ne+St});if(Ar<=0)throw new Error("An OPFS workspace file could not be written completely.");St+=Ar}ne+=tt}w+=v.length;const{capacity:Ut,...On}=v;return{...On,offset:Ie}},E=new Map;let g=performance.now();for(const[v,K]of[...h]){if(z||ze)return;h.get(v)===K&&(E.set(K,k(K)),performance.now()-g>8&&(await new Promise(Ie=>setTimeout(Ie,0)),g=performance.now()))}if(z||ze||!R||!P)return;qe(),e();const D=new Map;for(const[v,K]of h)D.set(v,E.get(K)??k(K));s.truncate(w),s.flush(),a.flush(),ge();const L={pack:R,log:P};R=s,P=a,F=0,h=D,He(),b=w,T=i,B=n,Xe(),f=!0;const Z=new Map(D);try{L.pack.close()}finally{L.log.close()}try{await et(n,Z);const v={storageVersion:4,generation:i,initializedAt:Date.now()};await Ze(await Oe(),je,v)}catch(v){throw ae=new Error("The workspace moved to a compacted generation it could not record; it takes no more writes, which its next open would discard.",{cause:v}),ae}t(),await Rt(i)}finally{if(!f){r();try{s.close()}finally{a?.close()}await wr(await(await Oe()).getDirectoryHandle(At),i)}}}async function ln(e){ye(),qe();try{await dn(e)}finally{Ve()}}async function dn(e){let t=!1;for(const[r,i]of h){if(!i.pack||i.length===0)continue;const n=e.get(i.offset);if(n===void 0)throw new Error(`The shared store no longer holds the bytes of ${r}.`);n!==i.offset&&(h.set(r,{...i,offset:n}),t=!0)}t&&await yt()}function fr(e){return st(()=>hn(e))}async function hn(e){const t=R;if(!t)throw new Error("OPFS filesystem worker is not initialized.");const r=new Map,i=crypto.randomUUID(),n=await fe(i,!0),s=await n.getFileHandle(Ye,{create:!0}),a=await q(s,"store"),f=new Map,l=new Uint8Array(vr);let w=0;try{for(const[E,g]of h){if(!e(E,g))continue;if(g.pack){f.set(E,{...g});continue}if(g.type==="directory"||g.length===0){f.set(E,{...g,offset:0,length:0});continue}const D=w;r.set(g.offset,D);let L=0;for(;L<g.length;){const K=Math.min(l.byteLength,g.length-L),Ie=l.subarray(0,K);if(N?.ensure(g.offset+L,K),t.read(Ie,{at:g.offset+L})!==K)throw new Error("An OPFS workspace file could not be read completely.");let ne=0;for(;ne<K;){const Ut=a.write(Ie.subarray(ne),{at:D+L+ne});if(Ut<=0)throw new Error("An OPFS workspace file could not be written completely.");ne+=Ut}L+=K}w+=g.length;const{capacity:Z,...v}=g;f.set(E,{...v,offset:D,length:g.length})}a.truncate(w),a.flush()}finally{a.close()}const k=await et(n,f);return await pt(i,n,f,w,k),r}async function pt(e,t,r,i,n,s){qe();try{await wn(e,t,r,i,n,s)}finally{Ve()}}async function wn(e,t,r,i,n,s){const a=await t.getFileHandle(jt,{create:!0}),f=await q(a,"record of changes");try{f.truncate(0),f.flush()}finally{f.close()}const l={storageVersion:s?5:4,generation:e,initializedAt:Date.now(),...s?{imageRanges:s}:{}};if(await Ze(await Oe(),je,l),$e(),T=e,M=l.initializedAt,J=s,n){const w=new xe(n.index);h=new Ge(w),C=new bt(w),Q=void 0}else h=r,He();b=i,B=t,await Ne(t),n?({liveBytes:_,linked:O,linkedBytes:x}=n,Y=Math.max(0,b-_)):Xe(),p||await Rt(e)}async function un(e,t,r,i,n=!1){if(ye(),!p||$!==Me)throw new Error("Only the shared package store can reserve immutable image extents.");if(b!==0||[...h.values()].some(E=>E.type!=="directory"))return!1;const s=Gt(i);if(s.bytes!==e.packBytes||e.entries>Yt||e.liveBytes>e.packBytes||t.byteLength!==e.json.raw||r.byteLength!==e.binary.raw||!await mt(t,e.json.sha256,n)||!await mt(r,e.binary.sha256,n))throw new Error("The image's prepared metadata does not match its document.");const a=t.subarray(0,4096).indexOf(10);if(a<0)throw new Error("The prepared index has no bounded retained header.");const f=JSON.parse(`${We.decode(t.subarray(0,a-1))}}`),l={packBytes:e.packBytes,liveBytes:e.liveBytes,linked:0,linkedBytes:0},w=f.retainedIndex;if(w.version!==1||w.digest!==await lr(e.binary.sha256,l)||w.packBytes!==l.packBytes||w.liveBytes!==l.liveBytes||w.linked!==0||w.linkedBytes!==0)throw new Error("The prepared index's retained measures are inconsistent.");const k=new SharedArrayBuffer(r.byteLength);if(new Uint8Array(k).set(r),new xe(k).entryCount!==e.entries)throw new Error("The prepared index has the wrong number of entries.");return st(async()=>{const E=crypto.randomUUID(),g=await fe(E,!0),D=await g.getFileHandle(Ye,{create:!0}),L=await q(D,"immutable image reservation");try{L.truncate(e.packBytes),L.flush()}finally{L.close()}const Z=Re.encode(JSON.stringify(s));return await me(g,Pr,Z),await me(g,gt,r),await me(g,oe,t),await pt(E,g,new Map,e.packBytes,{index:k,...l},await he(Z)),!0})}async function yn(e,t,r,i=!1,n){if(ye(),p||!o.packages||!n&&!o.packages.deferredImage)throw new Error("Prepared project paths require a verified shared image.");if(b!==0||[...h.values()].some(w=>w.type!=="directory"))return!1;if(t.byteLength!==e.json.raw||r.byteLength!==e.binary.raw||!await mt(t,e.json.sha256,i)||!await mt(r,e.binary.sha256,i))throw new Error("The image's prepared project does not match its descriptor.");const s=t.subarray(0,4096).indexOf(10);if(s<0)throw new Error("The prepared project has no bounded retained header.");const a=JSON.parse(`${We.decode(t.subarray(0,s-1))}}`).retainedIndex,f={packBytes:0,liveBytes:0,linked:e.linked,linkedBytes:e.linkedBytes};if(a.version!==1||a.digest!==await lr(e.binary.sha256,f)||a.packBytes!==0||a.liveBytes!==0||a.linked!==e.linked||a.linkedBytes!==e.linkedBytes)throw new Error("The prepared project's retained measures are inconsistent.");const l=new SharedArrayBuffer(r.byteLength);if(new Uint8Array(l).set(r),new xe(l).entryCount!==e.entries||e.entries>d)throw new Error("The prepared project has invalid entry bounds.");return st(async()=>{const w=crypto.randomUUID(),k=await fe(w,!0),E=await k.getFileHandle(Ye,{create:!0}),g=await q(E,"prepared project");try{g.truncate(0),g.flush()}finally{g.close()}if(await me(k,gt,r),await me(k,oe,t),n&&!await n)return!1;if(!o.packages?.deferredImage)throw new Error("Prepared project paths require a verified shared image.");return await pt(w,k,new Map,0,{index:l,...f}),!0})}async function pn(){if(z)throw new Error("This OPFS workspace is closing.");if(!R)throw new Error("OPFS filesystem worker is not initialized.");const e=[],t=[...h.keys()].sort((a,f)=>gr(a)-gr(f)||(a<f?-1:1));let r=0;for(const a of h.values())a.type!=="directory"&&(r+=a.length);const i=new ArrayBuffer(r),n=new Uint8Array(i);let s=0;for(const a of t){const f=h.get(a);if(f.type==="directory"){e.push({path:a,type:"directory",mode:f.mode,mtimeMs:f.mtimeMs});continue}f.length>0&&n.set(at(f),s),e.push({path:a,type:f.type,offset:s,length:f.length,mode:f.mode,mtimeMs:f.mtimeMs}),s+=f.length}for(const a of[...pe()].reverse())h.has(a)||e.unshift({path:a,type:"directory",mode:Ke,mtimeMs:Date.now()});return zt({files:e,pack:i})}async function Ze(e,t,r){await me(e,t,Re.encode(JSON.stringify(r)))}async function me(e,t,r){const i=await(await Oe()).getDirectoryHandle(Ir,{create:!0}),n=crypto.randomUUID(),s=await i.getFileHandle(n,{create:!0}),a=await q(s,"index");try{let f=0;for(;f<r.byteLength;){const l=a.write(r.subarray(f),{at:f});if(l<=0)throw new Error("An OPFS workspace file could not be written completely.");f+=l}a.truncate(r.byteLength),a.flush()}finally{a.close()}try{await s.move(e,t)}finally{await hr(i,n,!1)}}const gt="index.shared";async function he(e){const t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t),r=>r.toString(16).padStart(2,"0")).join("")}async function mt(e,t,r){return r||await he(e)===t}function lr(e,t){const{packBytes:r,liveBytes:i,linked:n,linkedBytes:s,journalPrefix:a}=t;return he(Re.encode(`${JSON.stringify({packBytes:r,liveBytes:i,linked:n,linkedBytes:s,...a?{journalPrefix:a}:{}})}:${e}`))}async function dr(e,t){const{packBytes:r,liveBytes:i,linked:n,linkedBytes:s,journalPrefix:a}=t;return he(Re.encode(`${JSON.stringify({packBytes:r,liveBytes:i,linked:n,linkedBytes:s,...a?{journalPrefix:a}:{}})}:${await he(e)}`))}async function et(e,t,r){const i=Sn(t);if(typeof SharedArrayBuffer>"u"||t.size<1e4){await Ze(e,oe,i);return}const n=new Map(i.entries),s=new Map,a={packBytes:r?.packBytes??0,liveBytes:0,linked:0,linkedBytes:0};for(const[D,L]of n){const Z=Fe(D);if(Z!==D){let v=s.get(Z);v||(v=new Set,s.set(Z,v)),v.add(D.slice(Z.length+1))}L.pack?(a.linked+=1,a.linkedBytes+=L.length):(a.liveBytes+=L.length,a.packBytes=Math.max(a.packBytes,L.offset+L.length))}let f;try{f=Or(n,s)}catch{await Ze(e,oe,i);return}const l=JSON.stringify(i.entries),w=r?new Uint8Array(r.bytes):void 0;if(w&&r.access.read(w,{at:0})!==w.byteLength)throw new Error("The checkpoint's journal prefix could not be read completely.");const k=w?{bytes:w.byteLength,digest:await he(w)}:void 0,E=new Uint8Array(f).slice(),g={version:k?2:1,digest:await dr(E,{...a,...k?{journalPrefix:k}:{}}),...a,...k?{journalPrefix:k}:{}};try{await me(e,gt,E)}catch{await Ze(e,oe,{entries:JSON.parse(l)});return}return await me(e,oe,Re.encode(`{"retainedIndex":${JSON.stringify(g)},
2
+ "entries":${l}}`)),{index:f,...a}}async function gn(e){if(!(typeof SharedArrayBuffer>"u"))try{const t=await e.getFileHandle(oe),r=await q(t,"index");let i;try{const E=new Uint8Array(Math.min(512,r.getSize())),g=r.read(E,{at:0});i=We.decode(E.subarray(0,g))}finally{r.close()}const n=i.split(`
3
+ `,1)[0];if(!n.startsWith('{"retainedIndex":')||!n.endsWith(","))return;const s=JSON.parse(n.slice(0,-1)+"}").retainedIndex;if(s.version!==1&&s.version!==2||!/^[a-f0-9]{64}$/u.test(s.digest)||![s.packBytes,s.liveBytes,s.linked,s.linkedBytes].every(E=>Number.isSafeInteger(E)&&E>=0)||s.version===1&&s.journalPrefix!==void 0||s.version===2&&(!s.journalPrefix||!Number.isSafeInteger(s.journalPrefix.bytes)||s.journalPrefix.bytes<0||!/^[a-f0-9]{64}$/u.test(s.journalPrefix.digest)))return;const a=await e.getFileHandle(gt),f=await q(a,"index");let l;try{const E=f.getSize();if(E>256*1024*1024||(l=new Uint8Array(E),f.read(l,{at:0})!==E))return}finally{f.close()}if(await dr(l,s)!==s.digest)return;const w=new SharedArrayBuffer(l.byteLength);new Uint8Array(w).set(l);const k=new xe(w);return de(k.entryCount),{...s,index:w}}catch{return}}async function mn(e){const t=e.journalPrefix;if(!t||!P||!R||t.bytes>P.getSize()||e.packBytes>R.getSize())return 0;const r=new Uint8Array(t.bytes);return P.read(r,{at:0})!==r.byteLength?0:await he(r)===t.digest?t.bytes:0}async function Pe(e,t){let r;try{r=await e.getFileHandle(t)}catch(s){if(Ue(s))return;throw s}let i;if(S){i=await(await r.getFile()).text();try{return JSON.parse(i)}catch(s){throw new Error(`Invalid OPFS workspace metadata (${t}). Stored data was retained.`,{cause:s})}}const n=await q(r,"index");try{const s=n.getSize(),a=new Uint8Array(s);if(s>0&&n.read(a,{at:0})!==s)throw new Error("An OPFS workspace file could not be read completely.");i=We.decode(a)}finally{n.close()}try{return JSON.parse(i)}catch(s){throw new Error(`Invalid OPFS workspace metadata (${t}). Stored data was retained.`,{cause:s})}}async function hr(e,t,r){try{await e.removeEntry(t,{recursive:r})}catch(i){if(!Ue(i))throw i}}async function wr(e,t){try{await e.removeEntry(t,{recursive:!0})}catch{}}function ur(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid OPFS filesystem mutation.");if(e.operation!=="write"&&e.operation!=="append"&&e.operation!=="write-at"&&e.operation!=="mkdir"&&e.operation!=="remove"&&e.operation!=="rename"&&e.operation!=="metadata"&&e.operation!=="link")throw new Error("Invalid OPFS filesystem mutation.");if(we(e.path),e.operation==="rename"&&we(e.destination),(e.operation==="write"||e.operation==="append"||e.operation==="write-at")&&!(e.content instanceof Uint8Array))throw new Error("Invalid OPFS file content.");if(e.operation==="write-at"&&(!Number.isSafeInteger(e.position)||e.position<0))throw new Error("Invalid OPFS write position.");return Nt(e),e}function En(e){if(!Array.isArray(e)||e.length===0||e.length>128)throw new Error("Invalid OPFS filesystem mutation batch.");return e.map(t=>ur(t))}function zt(e){if(!e||!Array.isArray(e.files)||e.files.length>d||!(e.pack instanceof ArrayBuffer))throw new Error("Invalid OPFS workspace snapshot.");const t=new Set,r=new Map(pe().map(n=>[n,"directory"]));let i=0;for(const n of e.files){if(!n||typeof n!="object")throw new Error("Invalid OPFS workspace snapshot entry.");if(we(n.path),n.type!=="file"&&n.type!=="directory"&&n.type!=="symlink"||t.has(n.path))throw new Error("Invalid or duplicate OPFS workspace entry.");if(t.add(n.path),r.set(n.path,n.type),pe().includes(n.path)&&n.type!=="directory")throw new Error("The OPFS workspace root must be a directory.");if(n.type!=="directory"){const s=n.offset??0,a=n.length??0;if(!Number.isSafeInteger(s)||!Number.isSafeInteger(a)||s<0||a<0||a>ee||s+a>e.pack.byteLength)throw new Error("Invalid OPFS workspace file.");if(i+=a,i>Bt())throw new Error(`OPFS workspace exceeds ${Ct()}.`)}else if((n.offset??0)!==0||(n.length??0)!==0)throw new Error("An OPFS workspace directory cannot contain file bytes.");Nt(n)}de(r.size);for(const n of e.files)if(!pe().includes(n.path)&&r.get(Fe(n.path))!=="directory")throw new Error(`An OPFS workspace snapshot has no directory parent for ${n.path}.`);return e}function Nt(e){if(e.mode!==void 0&&(!Number.isSafeInteger(e.mode)||e.mode<0||e.mode>4095))throw new Error("Invalid OPFS file mode.");if(e.mtimeMs!==void 0&&(typeof e.mtimeMs!="number"||!Number.isFinite(e.mtimeMs)||e.mtimeMs<0))throw new Error("Invalid OPFS modification time.")}function Sn(e){return{entries:[...e]}}function $t(e){const t=new Map;if(e===void 0)throw new Error("The committed OPFS workspace index is missing. Stored data was retained.");if(!e||typeof e!="object"||!Array.isArray(e.entries))throw new Error("Invalid OPFS workspace index.");const r=e.entries;de(r.length);for(const i of r){if(!Array.isArray(i)||i.length!==2)throw new Error("Invalid OPFS workspace index entry.");const n=we(i[0]);if(t.has(n))throw new Error("Duplicate OPFS workspace index entry.");t.set(n,yr(i[1]))}return t}function yr(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid OPFS workspace index entry.");const t=e;if(t.type!=="file"&&t.type!=="directory"&&t.type!=="symlink")throw new Error("Invalid OPFS workspace index entry.");if(Nt(t),t.mode===void 0||t.mtimeMs===void 0)throw new Error("Invalid OPFS workspace index entry.");if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length<0||t.length>ee)throw new Error("Invalid OPFS workspace index extent.");if(t.pack!==void 0&&t.pack!==Me)throw new Error("Invalid OPFS workspace index entry.");return{type:t.type,mode:t.mode,mtimeMs:t.mtimeMs,offset:t.offset,length:t.length,...t.pack?{pack:t.pack}:{}}}function bn(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid OPFS workspace index record.");const t=e;if(!Number.isSafeInteger(t.packBytes)||t.packBytes<0||!Array.isArray(t.changes))throw new Error("Invalid OPFS workspace index record.");const r=[];for(const i of t.changes){if(!Array.isArray(i)||i.length!==2)throw new Error("Invalid OPFS workspace index record.");r.push([we(i[0]),i[1]===null?null:yr(i[1])])}return{packBytes:t.packBytes,changes:r}}function Et(e){if(e===void 0)return;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid OPFS workspace state. Stored data was retained.");const t=e;if(t.storageVersion!==4&&t.storageVersion!==5||t.storageVersion===5&&(typeof t.imageRanges!="string"||!/^[a-f0-9]{64}$/u.test(t.imageRanges))||t.storageVersion===4&&t.imageRanges!==void 0||typeof t.generation!="string"||!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(t.generation)||typeof t.initializedAt!="number"||!Number.isFinite(t.initializedAt))throw new Error("Invalid or unsupported OPFS workspace state. Stored data was retained.");return t}function we(e){if(typeof e!="string"||Qe(e)===void 0||e.includes("\0")||e.length>4096)throw new Error("Invalid OPFS workspace path.");return pr(e),e}function pr(e){const t=Qe(e);if(t===void 0)throw new Error("Invalid OPFS workspace path.");const r=e===t?"":e.slice(t.length+1);return Ht(r),r}function Ht(e){const t=e===""?[]:e.split("/");if(t.some(r=>!r||r==="."||r===".."||r.includes("\0")))throw new Error("Invalid OPFS workspace path segment.");return t}function Fe(e){const t=e.slice(0,e.lastIndexOf("/"));return t===""||Qe(t)===void 0?Qe(e)??e:t}function gr(e){let t=1;for(let r=0;r<e.length;r+=1)e.charCodeAt(r)===47&&(t+=1);return t}function Ue(e){return e instanceof DOMException&&e.name==="NotFoundError"}function mr(e){let t=2166136261;for(let r=0;r<e.byteLength;r+=1)t^=e[r],t=Math.imul(t,16777619);return t>>>0}typeof addEventListener=="function"&&addEventListener("close",()=>{R?.flush(),P?.flush(),$e(),U?.()});function Er(e,t={}){if(ye(),re)throw new Error("An OPFS mutation batch cannot be nested.");for(const r of e)ur(r);return e.length?Sr(r=>{for(const i of e)Zr(i,r)},t):[]}function kn(e,t,r={}){if(ye(),re)throw new Error("An OPFS mutation batch cannot be nested.");for(const i of t){if(we(i.path),i.type!=="file"&&i.type!=="directory"&&i.type!=="symlink")throw new Error(`OPFS extent ${i.path} has no valid type.`);if(i.type==="directory")continue;const{offset:n,length:s}=i;if(n===void 0||s===void 0||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<0||s<0||n+s>e.byteLength)throw new Error(`OPFS extent ${i.path} lies outside its bytes.`);if(s>ee)throw new Error(`${i.path} is ${s} bytes; an OPFS workspace file holds at most ${ee}.`)}return t.length?Sr(i=>{const n=e.byteLength>0?ut(e):b;for(const s of t){const a=we(s.path);Te(a,i);const f=h.get(a);if(s.type==="directory"){if(f&&f.type!=="directory")throw new Error(`OPFS path is a file: ${a}`);V(a,{type:"directory",mode:s.mode,mtimeMs:s.mtimeMs,offset:0,length:0},i);continue}if(f?.type==="directory")throw new Error(`OPFS write target is a directory: ${a}`);ht(a,s.length),V(a,{type:s.type,mode:s.mode,mtimeMs:s.mtimeMs,offset:n+s.offset,length:s.length},i)}},r):[]}function Sr(e,t){if(!R||!P)throw new Error("OPFS filesystem worker is not initialized.");const r={packBytes:b,logBytes:F,liveBytes:_,deadBytes:Y,rewrites:be,rewrittenBytes:ke,linked:O,linkedBytes:x},i=new Map;re=i;const n=[];rt=n;const s=[];try{return e(s),sr(),nn(s,{publish:!t.durable}),t.durable&&(ge(),nt()),tr(),s}catch(a){const f=H!==void 0&&!ce&&Atomics.load(H,Mr)!==r.logBytes;f&&qe();for(const[l,w]of i)w===void 0?h.delete(l):h.set(l,w);He();try{for(let l=n.length-1;l>=0;l-=1)wt(n[l][0],n[l][1])}catch(l){a=new AggregateError([a,l],"OPFS could not restore bytes a failed batch wrote over.")}({packBytes:b,logBytes:F,liveBytes:_,deadBytes:Y,rewrites:be,rewrittenBytes:ke,linked:O,linkedBytes:x}=r),X!==void 0&&(clearTimeout(X),X=void 0);try{P.truncate(F),P.flush(),R.truncate(b),R.flush()}catch(l){throw it(),ae=new AggregateError([a,l],"OPFS could not roll back a failed batch; reopen this workspace before writing again."),ae}throw f&&Ve(),a}finally{re=void 0,rt=void 0}}function An(){if(Be){Je?.abort(new DOMException("The workspace was closed while opening.","AbortError"));return}z||(z=!0,Ce===0&&br())}function br(){it();try{ge()}finally{try{$e()}finally{const e=U;U=void 0,y=void 0;try{e?.()}finally{o.ownsPackages&&o.packages?.close()}}}}return{initialize:jr,opened:()=>y!==void 0&&!z,stats:()=>({entries:h.size,liveBytes:_,deadBytes:Y,packBytes:b,rewrites:be,rewrittenBytes:ke,linked:O,linkedBytes:x,flushes:j,flushMs:Le}),applyNow:Er,applyExtentsNow:kn,close:An,readExtent:ct,descendants:Dt,retain:fr,remapLinks:ln,childrenOf:e=>[...C.get(e)??[]].sort(),refresh:Yr,follow:Ur,clock:Vt,readerSeed:zr,imageCompletionSeed:Nr,imageLine:()=>N?.lineForReader()??o.packages?.imageLine(),imageStartupSet:()=>N?.readDigests()??N?.completedDigests()??[],prefetchImage:(e,t)=>N?.prefetch(e,t)??{queued:0,done:Promise.resolve()},seeded:()=>Xt,get logBytes(){return F},checkpoint:yt,deferMaintenance:Qr,installPreparedImage:un,installPreparedProject:yn,get deferredImage(){return ve},get imagePlacedAt(){return y&&J?M:void 0},get entries(){return h},get packBytes(){return b},read:Gr,readRange:Wr,snapshot:pn,replace:cr,apply:Xr,flush:()=>{if(z||!y)throw new Error("This OPFS workspace is not open.");if(ze)throw new Error("Wait for the OPFS generation replacement before flushing it.");ge()},validateSnapshot:zt,validateMutationBatch:En}}const zn="sweep.json";async function Nn(m){const c=await(await m.getFileHandle(zn,{create:!0})).createWritable();await c.write(JSON.stringify({at:Date.now()})),await c.close()}class Pt{map=new Map;get(o){return this.map.get(o)}mutable(o){let c=this.map.get(o);return c||(c=new Set,this.map.set(o,c)),c}delete(o){this.map.delete(o)}}const Ft=globalThis,te=Cn({navigator:Ft.navigator});let Dr=Promise.resolve();Ft.onmessage=m=>{Dr=Dr.catch(()=>{}).then(async()=>{try{const o=Date.now(),c=await $n(m.data),d=Date.now()-o;if(d>5e3){const u=m.data.operation==="batch"?` of ${m.data.mutations?.length??0}`:"";console.warn(`The OPFS workspace worker took ${Math.round(d/1e3)} s on ${m.data.operation}${u}; the store holds ${te.entries.size} entries and ${Math.round(te.packBytes/1048576)} MiB.`)}Ft.postMessage({id:m.data.id,ok:!0,...c},c.snapshot?[c.snapshot.pack]:[])}catch(o){const c=o instanceof Error?o:new Error(String(o));console.error(`The OPFS workspace worker failed on ${m.data.operation}: ${c.message}`),Ft.postMessage({id:m.data.id,ok:!1,error:c.message,...c.stack?{errorStack:c.stack}:{}})}}).catch(()=>{})};async function $n(m){if(m.operation==="initialize")return await te.initialize(m.projectId)?{initialized:!0,snapshot:await te.snapshot()}:{initialized:!1};if(!te.opened())throw new Error("OPFS filesystem worker is not initialized.");if(m.operation==="flush")return te.flush(),{};if(m.operation==="replace"){if(!m.snapshot)throw new Error("OPFS filesystem replacement requires a snapshot.");return await te.replace(te.validateSnapshot(m.snapshot)),{}}return m.operation==="batch"?(await te.apply(te.validateMutationBatch(m.mutations)),{}):(await te.apply(te.validateMutationBatch([m])),{})}