@themartiancompany/opfs 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AUTHORS.rst CHANGED
@@ -1,33 +1,35 @@
1
1
  ..
2
2
  SPDX-License-Identifier: AGPL-3.0-or-later
3
3
 
4
- ----------------------------------------------------------------------
5
- Copyright © 2024, 2025
6
- Jiang Jie
7
- Copyright © 2025
4
+ -------------------------------------------------------
5
+ Copyright © 2024, 2025, 2026
8
6
  Pellegrino Prevete
9
7
 
10
8
  All rights reserved
11
- ----------------------------------------------------------------------
9
+ -------------------------------------------------------
12
10
 
13
- This program is free software: you can redistribute it and/or modify
14
- it under the terms of the GNU Affero General Public License as published by
15
- the Free Software Foundation, either version 3 of the License, or
16
- (at your option) any later version.
11
+ This program is free software: you can redistribute it
12
+ and/or modify it under the terms of the
13
+ GNU Affero General Public License as published by
14
+ the Free Software Foundation, either version 3 of the
15
+ License, or (at your option) any later version.
17
16
 
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU Affero General Public License for more details.
17
+ This program is distributed in the hope that it will
18
+ be useful, but WITHOUT ANY WARRANTY; without even the
19
+ implied warranty of MERCHANTABILITY or FITNESS FOR A
20
+ PARTICULAR PURPOSE.
21
+ See the GNU Affero General Public License
22
+ for more details.
22
23
 
23
- You should have received a copy of the GNU Affero General Public License
24
- along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+ You should have received a copy of the
25
+ GNU Affero General Public License
26
+ along with this program.
27
+ If not, see <https://www.gnu.org/licenses/>.
25
28
 
26
29
 
27
30
  =====================================
28
- Happy OPFS Authors
31
+ OPFS Authors
29
32
  =====================================
30
33
 
31
- * Jiang Jie <jiang115jie@gmail.com>
32
34
  * Pellegrino Prevete <pellegrinoprevete@gmail.com>
33
35
  * Truocolo <truocolo@aol.com>
package/COPYING CHANGED
@@ -1,5 +1,5 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
3
 
4
4
  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
5
  Everyone is permitted to copy and distribute verbatim copies
@@ -7,17 +7,15 @@
7
7
 
8
8
  Preamble
9
9
 
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
12
13
 
13
14
  The licenses for most software and other practical works are designed
14
15
  to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
+ our General Public Licenses are intended to guarantee your freedom to
16
17
  share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
18
+ software for all its users.
21
19
 
22
20
  When we speak of free software, we are referring to freedom, not
23
21
  price. Our General Public Licenses are designed to make sure that you
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
26
24
  want it, that you can change the software or use pieces of it in new
27
25
  free programs, and that you know you can do these things.
28
26
 
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
67
55
 
68
56
  The precise terms and conditions for copying, distribution and
69
57
  modification follow.
@@ -72,7 +60,7 @@ modification follow.
72
60
 
73
61
  0. Definitions.
74
62
 
75
- "This License" refers to version 3 of the GNU General Public License.
63
+ "This License" refers to version 3 of the GNU Affero General Public License.
76
64
 
77
65
  "Copyright" also means copyright-like laws that apply to other kinds of
78
66
  works, such as semiconductor masks.
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
549
537
  the Program, the only way you could satisfy both those terms and this
550
538
  License would be to refrain entirely from conveying the Program.
551
539
 
552
- 13. Use with the GNU Affero General Public License.
540
+ 13. Remote Network Interaction; Use with the GNU General Public License.
541
+
542
+ Notwithstanding any other provision of this License, if you modify the
543
+ Program, your modified version must prominently offer all users
544
+ interacting with it remotely through a computer network (if your version
545
+ supports such interaction) an opportunity to receive the Corresponding
546
+ Source of your version by providing access to the Corresponding Source
547
+ from a network server at no charge, through some standard or customary
548
+ means of facilitating copying of software. This Corresponding Source
549
+ shall include the Corresponding Source for any work covered by version 3
550
+ of the GNU General Public License that is incorporated pursuant to the
551
+ following paragraph.
553
552
 
554
553
  Notwithstanding any other provision of this License, you have
555
554
  permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
555
+ under version 3 of the GNU General Public License into a single
557
556
  combined work, and to convey the resulting work. The terms of this
558
557
  License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
558
+ but the work with which it is combined will remain governed by version
559
+ 3 of the GNU General Public License.
562
560
 
563
561
  14. Revised Versions of this License.
564
562
 
565
563
  The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
564
+ the GNU Affero General Public License from time to time. Such new versions
565
+ will be similar in spirit to the present version, but may differ in detail to
568
566
  address new problems or concerns.
569
567
 
570
568
  Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
569
+ Program specifies that a certain numbered version of the GNU Affero General
572
570
  Public License "or any later version" applies to it, you have the
573
571
  option of following the terms and conditions either of that numbered
574
572
  version or of any later version published by the Free Software
575
573
  Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
574
+ GNU Affero General Public License, you may choose any version ever published
577
575
  by the Free Software Foundation.
578
576
 
579
577
  If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
578
+ versions of the GNU Affero General Public License can be used, that proxy's
581
579
  public statement of acceptance of a version permanently authorizes you
582
580
  to choose that version for the Program.
583
581
 
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
635
633
  Copyright (C) <year> <name of author>
636
634
 
637
635
  This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
636
+ it under the terms of the GNU Affero General Public License as published by
639
637
  the Free Software Foundation, either version 3 of the License, or
640
638
  (at your option) any later version.
641
639
 
642
640
  This program is distributed in the hope that it will be useful,
643
641
  but WITHOUT ANY WARRANTY; without even the implied warranty of
644
642
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
643
+ GNU Affero General Public License for more details.
646
644
 
647
- You should have received a copy of the GNU General Public License
645
+ You should have received a copy of the GNU Affero General Public License
648
646
  along with this program. If not, see <https://www.gnu.org/licenses/>.
649
647
 
650
648
  Also add information on how to contact you by electronic and paper mail.
651
649
 
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
650
+ If your software can interact with users remotely through a computer
651
+ network, you should also make sure that it provides a way for users to
652
+ get its source. For example, if your program is a web application, its
653
+ interface could display a "Source" link that leads users to an archive
654
+ of the code. There are many ways you could offer source, and different
655
+ solutions will be better for different programs; see section 13 for the
656
+ specific requirements.
663
657
 
664
658
  You should also get your employer (if you work as a programmer) or school,
665
659
  if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
660
+ For more information on this, and how to apply and follow the GNU AGPL, see
667
661
  <https://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <https://www.gnu.org/licenses/why-not-lgpl.html>.
package/README.md CHANGED
@@ -1,23 +1,24 @@
1
+
1
2
  [comment]: <> (SPDX-License-Identifier: AGPL-3.0)
2
3
 
3
- [comment]: <> (-------------------------------------------------------------)
4
- [comment]: <> (Copyright © 2024, 2025 Pellegrino Prevete)
4
+ [comment]: <> (----------------------------------------------------)
5
+ [comment]: <> (Copyright © 2024, 2025, 2026)
6
+ [comment]: <> ( Pellegrino Prevete)
5
7
  [comment]: <> (All rights reserved)
6
- [comment]: <> (-------------------------------------------------------------)
8
+ [comment]: <> (----------------------------------------------------)
7
9
 
8
10
  [comment]: <> (This program is free software: you can redistribute)
9
- [comment]: <> (it and/or modify it under the terms of the GNU Affero)
10
- [comment]: <> (General Public License as published by the Free)
11
- [comment]: <> (Software Foundation, either version 3 of the License.)
12
-
13
- [comment]: <> (This program is distributed in the hope that it will be useful,)
14
- [comment]: <> (but WITHOUT ANY WARRANTY; without even the implied warranty of)
15
- [comment]: <> (MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the)
16
- [comment]: <> (GNU Affero General Public License for more details.)
17
-
18
- [comment]: <> (You should have received a copy of the GNU Affero General Public)
19
- [comment]: <> (License along with this program.)
20
- [comment]: <> (If not, see <https://www.gnu.org/licenses/>.)
11
+ [comment]: <> (it and/or modify it under the terms of the)
12
+ [comment]: <> (GNU Affero General Public License as published)
13
+ [comment]: <> (by the Free Software Foundation, either version)
14
+ [comment]: <> (3 of the License.)
15
+
16
+ [comment]: <> (This program is distributed in the hope that it)
17
+ [comment]: <> (will be useful, but WITHOUT ANY WARRANTY;)
18
+ [comment]: <> (without even the implied warranty of)
19
+ [comment]: <> (MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.)
20
+ [comment]: <> (See the GNU Affero General Public License)
21
+ [comment]: <> (for more details.)
21
22
 
22
23
  # OPFS Module (`@themartiancompany/opfs`)
23
24
 
package/fs-worker CHANGED
@@ -2,24 +2,27 @@
2
2
 
3
3
  // SPDX-License-Identifier: AGPL-3.0-or-later
4
4
 
5
- // ----------------------------------------------------------------------
6
- // Copyright © 2024, 2025 Pellegrino Prevete
7
- //
8
- // All rights reserved
9
- // ----------------------------------------------------------------------
10
- //
11
- // This program is free software: you can redistribute it and/or modify
12
- // it under the terms of the GNU Affero General Public License as published by
13
- // the Free Software Foundation, either version 3 of the License, or
14
- // (at your option) any later version.
15
- //
16
- // This program is distributed in the hope that it will be useful,
17
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- // GNU Affero General Public License for more details.
20
- //
21
- // You should have received a copy of the GNU Affero General Public License
22
- // along with this program. If not, see <https://www.gnu.org/licenses/>.
5
+ /** ----------------------------------------------------------------------
6
+ * Copyright ©
7
+ * Pellegrino Prevete
8
+ * 2025, 2026
9
+ *
10
+ * All rights reserved
11
+ * ----------------------------------------------------------------------
12
+ *
13
+ * This program is free software: you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation, either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
25
+ */
23
26
 
24
27
  const
25
28
  _fs =
package/fs-worker.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={12:function(e,t){!function(e){"use strict";var t,r,n,a,i,o,s,c,l,u,f,h,d=e=>{throw TypeError(e)},w=(e,t,r)=>t.has(e)||d("Cannot "+r),y=(e,t,r)=>(w(e,t,"read from private field"),r?r.call(e):t.get(e)),p=(e,t,r)=>t.has(e)?d("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),m=(e,t,r,n)=>(w(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const g="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHUobil7aWYobj09PSIvIilyZXR1cm57cGFyZW50Om51bGwsbmFtZToiIn07Y29uc3QgZT1uLnNwbGl0KCIvIikuZmlsdGVyKGk9PmkubGVuZ3RoPjApO2lmKGUubGVuZ3RoPT09MCl0aHJvdyBFcnJvcigiSW52YWxpZCBwYXRoIik7Y29uc3QgYT1lW2UubGVuZ3RoLTFdLHI9Ii8iK2Uuc2xpY2UoMCwtMSkuam9pbigiLyIpO3JldHVybntuYW1lOmEscGFyZW50OnJ9fWFzeW5jIGZ1bmN0aW9uIHcobixlKXtjb25zdHtwYXJlbnQ6YSxuYW1lOnJ9PXUobik7aWYoYT09bnVsbClyZXR1cm4gYXdhaXQgbmF2aWdhdG9yLnN0b3JhZ2UuZ2V0RGlyZWN0b3J5KCk7Y29uc3QgaT1hLnNwbGl0KCIvIikuZmlsdGVyKHQ9PnQubGVuZ3RoPjApO3RyeXtsZXQgdD1hd2FpdCBuYXZpZ2F0b3Iuc3RvcmFnZS5nZXREaXJlY3RvcnkoKTtmb3IoY29uc3QgcyBvZiBpKXQ9YXdhaXQgdC5nZXREaXJlY3RvcnlIYW5kbGUocyx7Y3JlYXRlOmUuY3JlYXRlfSk7aWYoZS5pc0ZpbGUpcmV0dXJuIGF3YWl0IHQuZ2V0RmlsZUhhbmRsZShyLHtjcmVhdGU6ZS5jcmVhdGV9KX1jYXRjaCh0KXtpZih0Lm5hbWU9PT0iTm90Rm91bmRFcnJvciIpcmV0dXJuIG51bGw7dGhyb3cgdH19Y29uc3QgZj17fTtzZWxmLm9ubWVzc2FnZT1hc3luYyBuPT57dmFyIGk7Y29uc3R7ZXZ0VHlwZTplLGFyZ3M6YX09bi5kYXRhO2xldCByPWZbYS5maWxlSWRdO3RyeXtsZXQgdDtjb25zdCBzPVtdO2lmKGU9PT0icmVnaXN0ZXIiKXtjb25zdCBsPWF3YWl0IHcoYS5maWxlUGF0aCx7Y3JlYXRlOiEwLGlzRmlsZTohMH0pO2lmKGw9PW51bGwpdGhyb3cgRXJyb3IoYG5vdCBmb3VuZCBmaWxlOiAke2EuZmlsZUlkfWApO3I9YXdhaXQgbC5jcmVhdGVTeW5jQWNjZXNzSGFuZGxlKHttb2RlOmEubW9kZX0pLGZbYS5maWxlSWRdPXJ9ZWxzZSBpZihlPT09ImNsb3NlIilhd2FpdCByLmNsb3NlKCksZGVsZXRlIGZbYS5maWxlSWRdO2Vsc2UgaWYoZT09PSJ0cnVuY2F0ZSIpYXdhaXQgci50cnVuY2F0ZShhLm5ld1NpemUpO2Vsc2UgaWYoZT09PSJ3cml0ZSIpe2NvbnN0e2RhdGE6bCxvcHRzOm99PW4uZGF0YS5hcmdzO3Q9YXdhaXQgci53cml0ZShsLG8pfWVsc2UgaWYoZT09PSJyZWFkIil7Y29uc3R7b2Zmc2V0Omwsc2l6ZTpvfT1uLmRhdGEuYXJncyxnPW5ldyBVaW50OEFycmF5KG8pLGQ9YXdhaXQgci5yZWFkKGcse2F0Omx9KSxjPWcuYnVmZmVyO3Q9ZD09PW8/YzooKGk9Yy50cmFuc2Zlcik9PW51bGw/dm9pZCAwOmkuY2FsbChjLGQpKT8/Yy5zbGljZSgwLGQpLHMucHVzaCh0KX1lbHNlIGU9PT0iZ2V0U2l6ZSI/dD1hd2FpdCByLmdldFNpemUoKTplPT09ImZsdXNoIiYmYXdhaXQgci5mbHVzaCgpO3NlbGYucG9zdE1lc3NhZ2Uoe2V2dFR5cGU6ImNhbGxiYWNrIixjYklkOm4uZGF0YS5jYklkLHJldHVyblZhbDp0fSxzKX1jYXRjaCh0KXtjb25zdCBzPXQ7c2VsZi5wb3N0TWVzc2FnZSh7ZXZ0VHlwZToidGhyb3dFcnJvciIsY2JJZDpuLmRhdGEuY2JJZCxlcnJNc2c6cy5uYW1lKyI6ICIrcy5tZXNzYWdlK2AKYCtKU09OLnN0cmluZ2lmeShuLmRhdGEpfSl9fX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPW9wZnMtd29ya2VyLUY0UldscWNfLmpzLm1hcAo=",v=typeof self<"u"&&self.Blob&&new Blob([(b=g,Uint8Array.from(atob(b),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var b;function E(e){let t;try{if(t=v&&(self.URL||self.webkitURL).createObjectURL(v),!t)throw"";const r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+g,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}async function T(e,t,r){const n=function(){if(S.length<3){const t=e();return S.push(t),t}{const e=S[k];return k=(k+1)%S.length,e}function e(){const e=new E;let t=0,r={};return e.onmessage=({data:e})=>{var t,n;"callback"===e.evtType?null==(t=r[e.cbId])||t.resolve(e.returnVal):"throwError"===e.evtType&&(null==(n=r[e.cbId])||n.reject(Error(e.errMsg))),delete r[e.cbId]},async function(n,a,i=[]){t+=1;const o=new Promise((e,n)=>{r[t]={resolve:e,reject:n}});return e.postMessage({cbId:t,evtType:n,args:a},i),o}}}();return await n("register",{fileId:e,filePath:t,mode:r}),{read:async(t,r)=>await n("read",{fileId:e,offset:t,size:r}),write:async(t,r)=>await n("write",{fileId:e,data:t,opts:r},[ArrayBuffer.isView(t)?t.buffer:t]),close:async()=>await n("close",{fileId:e}),truncate:async t=>await n("truncate",{fileId:e,newSize:t}),getSize:async()=>await n("getSize",{fileId:e}),flush:async()=>await n("flush",{fileId:e})}}const S=[];let k=0;function F(e){if("/"===e)return{parent:null,name:""};const t=e.split("/").filter(e=>e.length>0);if(0===t.length)throw Error("Invalid path");return{name:t[t.length-1],parent:"/"+t.slice(0,-1).join("/")}}async function O(e,t){const{parent:r,name:n}=F(e);if(null==r)return await navigator.storage.getDirectory();const a=r.split("/").filter(e=>e.length>0);try{let e=await navigator.storage.getDirectory();for(const r of a)e=await e.getDirectoryHandle(r,{create:t.create});return t.isFile?await e.getFileHandle(n,{create:t.create}):await e.getDirectoryHandle(n,{create:t.create})}catch(e){if("NotFoundError"===e.name)return null;throw e}}async function A(e){const{parent:t,name:r}=F(e);if(null==t){const e=await navigator.storage.getDirectory();for await(const t of e.keys())await e.removeEntry(t,{recursive:!0});return}const n=await O(t,{create:!1,isFile:!1});if(null!=n)try{await n.removeEntry(r,{recursive:!0})}catch(e){if("NotFoundError"===e.name)return;throw e}}function R(e,t){return`${e}/${t}`.replace("//","/")}function x(e){return new W(e)}t=new WeakMap,r=new WeakMap,n=new WeakMap;let W=class e{constructor(e){p(this,t),p(this,r),p(this,n),m(this,t,e);const{parent:a,name:i}=F(e);m(this,r,i),m(this,n,a)}get kind(){return"dir"}get name(){return y(this,r)}get path(){return y(this,t)}get parent(){return null==y(this,n)?null:x(y(this,n))}async create(){return await O(y(this,t),{create:!0,isFile:!1}),x(y(this,t))}async exists(){return await O(y(this,t),{create:!1,isFile:!1})instanceof FileSystemDirectoryHandle}async remove(e={}){for(const t of await this.children())try{await t.remove(e)}catch(e){console.warn(e)}try{await A(y(this,t))}catch(e){console.warn(e)}}async children(){const e=await O(y(this,t),{create:!1,isFile:!1});if(null==e)return[];const r=[];for await(const n of e.values())r.push(("file"===n.kind?L:x)(R(y(this,t),n.name)));return r}async copyTo(t){if(!await this.exists())throw Error(`dir ${this.path} not exists`);if(t instanceof e){const e=await t.exists()?x(R(t.path,this.name)):t;return await e.create(),await Promise.all((await this.children()).map(t=>t.copyTo(e))),e}if(t instanceof FileSystemDirectoryHandle)return await Promise.all((await this.children()).map(async e=>{"file"===e.kind?await e.copyTo(await t.getFileHandle(e.name,{create:!0})):await e.copyTo(await t.getDirectoryHandle(e.name,{create:!0}))})),null;throw Error("Illegal target type")}async moveTo(e){const t=await this.copyTo(e);return await this.remove(),t}};const Z=new Map;function L(e,t="rw"){if("rw"===t){const r=Z.get(e)??new Y(e,t);return Z.set(e,r),r}return new Y(e,t)}async function I(e,t,r={overwrite:!0}){if(t instanceof Y)return void await I(e,await t.stream(),r);const n=await(e instanceof Y?e:L(e,"rw")).createWriter();try{if(r.overwrite&&await n.truncate(0),t instanceof ReadableStream){const e=t.getReader();for(;;){const{done:t,value:r}=await e.read();if(t)break;await n.write(r)}}else await n.write(t)}catch(e){throw e}finally{await n.close()}}let U=0;a=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,f=new WeakMap,h=new WeakMap;let Y=class e{constructor(e,t){p(this,a),p(this,i),p(this,o),p(this,s),p(this,c),p(this,l,0),p(this,u,async()=>{}),p(this,f,(()=>{let e=null;return()=>(m(this,l,y(this,l)+1),null!=e||(e=new Promise(async(t,r)=>{try{const r=await T(y(this,c),y(this,a),y(this,s));m(this,u,async()=>{null!=e&&(e=null,m(this,l,0),await r.close().catch(console.error))}),t([r,async()=>{m(this,l,y(this,l)-1),!(y(this,l)>0)&&(e=null,await r.close())}])}catch(e){r(e)}})),e)})()),p(this,h,!1),m(this,c,++U),m(this,a,e),m(this,s,{r:"read-only",rw:"readwrite","rw-unsafe":"readwrite-unsafe"}[t]);const{parent:r,name:n}=F(e);if(null==r)throw Error("Invalid path");m(this,o,n),m(this,i,r)}get kind(){return"file"}get path(){return y(this,a)}get name(){return y(this,o)}get parent(){return null==y(this,i)?null:x(y(this,i))}async createWriter(){if("read-only"===y(this,s))throw Error("file is read-only");if(y(this,h))throw Error("Other writer have not been closed");m(this,h,!0);try{const e=new TextEncoder,[t,r]=await y(this,f).call(this);let n=await t.getSize(),a=!1;return{write:async(r,i={})=>{if(a)throw Error("Writer is closed");const o="string"==typeof r?e.encode(r):r,s=i.at??n,c=o.byteLength;return n=s+c,await t.write(o,{at:s})},truncate:async e=>{if(a)throw Error("Writer is closed");await t.truncate(e),n>e&&(n=e)},flush:async()=>{if(a)throw Error("Writer is closed");await t.flush()},close:async()=>{if(a)throw Error("Writer is closed");a=!0,m(this,h,!1),await r()}}}catch(e){throw m(this,h,!1),e}}async createReader(){const[e,t]=await y(this,f).call(this);let r=!1,n=0;return{read:async(t,a={})=>{if(r)throw Error("Reader is closed");const i=a.at??n,o=await e.read(i,t);return n=i+o.byteLength,o},getSize:async()=>{if(r)throw Error("Reader is closed");return await e.getSize()},close:async()=>{r||(r=!0,await t())}}}async text(){return(new TextDecoder).decode(await this.arrayBuffer())}async arrayBuffer(){const e=await O(y(this,a),{create:!1,isFile:!0});return null==e?new ArrayBuffer(0):(await e.getFile()).arrayBuffer()}async stream(){const e=await this.getOriginFile();return null==e?new ReadableStream({pull:e=>{e.close()}}):e.stream()}async getOriginFile(){var e;return null==(e=await O(y(this,a),{create:!1,isFile:!0}))?void 0:e.getFile()}async getSize(){const e=await O(y(this,a),{create:!1,isFile:!0});return null==e?0:(await e.getFile()).size}async exists(){return await O(y(this,a),{create:!1,isFile:!0})instanceof FileSystemFileHandle}async remove(e={}){if(!0===e.force)return await y(this,u).call(this),await A(y(this,a)),void Z.delete(y(this,a));if(y(this,l)>0)throw Error("exists unclosed reader/writer");await A(y(this,a))}async copyTo(t){if(t instanceof e)return t.path===this.path?this:(await I(t,this),t);if(t instanceof W){if(!await this.exists())throw Error(`file ${this.path} not exists`);return await this.copyTo(L(R(t.path,this.name)))}if(t instanceof FileSystemFileHandle)return await(await this.stream()).pipeTo(await t.createWritable()),null;throw Error("Illegal target type")}async moveTo(e){const t=await this.copyTo(e);return await this.remove(),t}};const z="/.opfs-tools-temp-dir";async function C(e){try{if("file"===e.kind){if(!await e.exists())return!0;const t=await e.createWriter();await t.truncate(0),await t.close(),await e.remove()}else await e.remove();return!0}catch(e){return console.warn(e),!1}}const P=[];let D=!1;(async function(){var e;!0!==globalThis.__opfs_tools_tmpfile_init__&&(globalThis.__opfs_tools_tmpfile_init__=!0,null!=globalThis.FileSystemDirectoryHandle&&null!=globalThis.FileSystemFileHandle&&null!=(null==(e=globalThis.navigator)?void 0:e.storage.getDirectory)&&(setInterval(async()=>{for(const e of await x(z).children()){const t=/^\d+-(\d+)$/.exec(e.name);(null==t||Date.now()-Number(t[1])>2592e5)&&await C(e)}},6e4),await async function(){if(null==globalThis.localStorage)return;const e="OPFS_TOOLS_EXPIRES_TMP_FILES";D||(D=!0,globalThis.addEventListener("unload",()=>{0!==P.length&&localStorage.setItem(e,`${localStorage.getItem(e)??""},${P.join(",")}`)}));let t=localStorage.getItem(e)??"";for(const e of t.split(","))0!==e.length&&await C(L(`${z}/${e}`))&&(t=t.replace(e,""));localStorage.setItem(e,t.replace(/,{2,}/g,","))}()))})(),e.dir=x,e.file=L,e.rollfile=function(e,t){let r=L(e),n=0,a=r.createWriter(),i=r.createReader();return{append:async e=>{const r=await a;n+=await r.write(e),n>=t&&await(async e=>{const t=await(await i).read(n,{at:Math.round(.3*n)});n=await e.write(t,{at:0}),await e.truncate(n)})(r)},text:r.text.bind(r),remove:async()=>{await(await i).close(),await(await a).close(),await r.remove()},getSize:async()=>n}},e.tmpfile=function(){const e=`${Math.random().toString().slice(2)}-${Date.now()}`;return P.push(e),L(`${z}/${e}`)},e.write=I,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}(t)},210:(e,t,r)=>{const n=r(805),a=r(597),i=r(12);function o(e){let t;return void 0===e&&(e="fs-worker.js"),t=new a(e),t}_file=i.file,_read_stream_create=function(e,t){return _file(e).createReader()},e.exports=n,e.exports.fsWorkerNew=o,e.exports.fsWorkerStart=async function(e,t,r){let n,a,i,s;return void 0===e&&(e="fs-worker.js"),"Number"!=typeof t&&(t=10485760),"Number"!=typeof t&&(r=10485760),a=_fs.connectSyncAgent,s=o(e),i={worker:s,bufferLength:t,opTimeout:r},n=a(i),n},e.exports.createReadStream=_read_stream_create,e.exports.createWriteStream=function(e,t){return _file(e).createWriter()}},234:(e,t,r)=>{const n=r(210);_sync_agent=n.startSyncAgent,e.exports={_sync_agent},_sync_agent()},597:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});const n="undefined"!=typeof Worker?Worker:void 0},805:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ABORT_ERROR:()=>A,CURRENT_DIR:()=>Qe,NOT_FOUND_ERROR:()=>Je,ROOT_DIR:()=>Ke,TIMEOUT_ERROR:()=>R,TMP_DIR:()=>qe,appendFile:()=>At,appendFileSync:()=>Ar,assertAbsolutePath:()=>et,assertFileUrl:()=>tt,connectSyncAgent:()=>wr,copy:()=>Rt,copySync:()=>Rr,createFile:()=>mt,createFileSync:()=>gr,deleteTemp:()=>zt,deleteTempSync:()=>Zr,downloadFile:()=>kt,emptyDir:()=>xt,emptyDirSync:()=>xr,exists:()=>Wt,existsSync:()=>Wr,generateTempPath:()=>ut,getFileDataByHandle:()=>pt,getSyncMessenger:()=>yr,isDirectoryHandle:()=>wt,isFileHandle:()=>dt,isFileHandleLike:()=>yt,isOPFSSupported:()=>Nt,isTempPath:()=>ft,mkTemp:()=>Yt,mkTempSync:()=>Lr,mkdir:()=>gt,mkdirSync:()=>vr,move:()=>Zt,moveSync:()=>br,pruneTemp:()=>Ct,pruneTempSync:()=>Ir,readBlobFile:()=>Lt,readBlobFileSync:()=>Ur,readDir:()=>vt,readDirSync:()=>Er,readFile:()=>bt,readFileSync:()=>Tr,readJsonFile:()=>It,readJsonFileSync:()=>Yr,readTextFile:()=>Ut,readTextFileSync:()=>zr,remove:()=>Et,removeSync:()=>Sr,setSyncMessenger:()=>pr,startSyncAgent:()=>dr,stat:()=>Tt,statSync:()=>kr,toFileSystemHandleLike:()=>ht,unzip:()=>Dt,unzipFromUrl:()=>Mt,unzipSync:()=>Cr,uploadFile:()=>Gt,writeFile:()=>St,writeFileSync:()=>Or,zip:()=>$t,zipFromUrl:()=>jt,zipSync:()=>Pr});var n=!0,a="Invariant failed";function i(e,t){if(!e){if(n)throw new Error(a);var r="function"==typeof t?t():t,i=r?"".concat(a,": ").concat(r):a;throw new Error(i)}}function o(e){if("string"!=typeof e)throw new TypeError(`Path must be a string, received "${JSON.stringify(e)}"`)}function s(e){return e=function(e){if("file:"!==(e=e instanceof URL?e:new URL(e)).protocol)throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function c(e,t){if(e.length<=1)return e;let r=e.length;for(let n=e.length-1;n>0&&t(e.charCodeAt(n));n--)r=n;return e.slice(0,r)}const l=46,u=47;function f(e){return e===u}function h(e,t=""){e instanceof URL&&(e=s(e)),function(e,t){if(o(e),0===e.length)return e;if("string"!=typeof t)throw new TypeError(`Suffix must be a string, received "${JSON.stringify(t)}"`)}(e,t);const r=function(e,t,r=0){let n=!1,a=e.length;for(let i=e.length-1;i>=r;--i)if(t(e.charCodeAt(i))){if(n){r=i+1;break}}else n||(n=!0,a=i+1);return e.slice(r,a)}(e,f),n=c(r,f);return t?function(e,t){if(t.length>=e.length)return e;const r=e.length-t.length;for(let n=t.length-1;n>=0;--n)if(e.charCodeAt(r+n)!==t.charCodeAt(n))return e;return e.slice(0,-t.length)}(n,t):n}const d="/";function w(e){e instanceof URL&&(e=s(e)),function(e){o(e),e.length}(e);let t=-1,r=!1;for(let n=e.length-1;n>=1;--n)if(f(e.charCodeAt(n))){if(r){t=n;break}}else r=!0;return-1===t?f(e.charCodeAt(0))?"/":".":c(e.slice(0,t),f)}function y(e){e instanceof URL&&(e=s(e)),o(e);let t=-1,r=0,n=-1,a=!0,i=0;for(let o=e.length-1;o>=0;--o){const s=e.charCodeAt(o);if(f(s)){if(!a){r=o+1;break}}else-1===n&&(a=!1,n=o+1),s===l?-1===t?t=o:1!==i&&(i=1):-1!==t&&(i=-1)}return-1===t||-1===n||0===i||1===i&&t===n-1&&t===r+1?"":e.slice(t,n)}function p(e,...t){if(void 0===e)return".";e instanceof URL&&(e=s(e)),(t=e?[e,...t]:t).forEach(e=>o(e));const r=t.filter(e=>e.length>0).join("/");return""===r?".":function(e){e instanceof URL&&(e=s(e)),function(e){o(e),e.length}(e);const t=f(e.charCodeAt(0)),r=f(e.charCodeAt(e.length-1));return e=function(e,t,r,n){let a,i="",o=0,s=-1,c=0;for(let f=0;f<=e.length;++f){if(f<e.length)a=e.charCodeAt(f);else{if(n(a))break;a=u}if(n(a)){if(s===f-1||1===c);else if(s!==f-1&&2===c){if(i.length<2||2!==o||i.charCodeAt(i.length-1)!==l||i.charCodeAt(i.length-2)!==l){if(i.length>2){const e=i.lastIndexOf(r);-1===e?(i="",o=0):(i=i.slice(0,e),o=i.length-1-i.lastIndexOf(r)),s=f,c=0;continue}if(2===i.length||1===i.length){i="",o=0,s=f,c=0;continue}}t&&(i.length>0?i+=`${r}..`:i="..",o=2)}else i.length>0?i+=r+e.slice(s+1,f):i=e.slice(s+1,f),o=f-s-1;s=f,c=0}else a===l&&-1!==c?++c:c=-1}return i}(e,!t,"/",f),0!==e.length||t||(e="."),e.length>0&&r&&(e+="/"),t?`/${e}`:e}(r)}const m=Symbol("Option kind"),g=Symbol("Result kind");function v(e){const t={[Symbol.toStringTag]:"Option",[m]:"Some",isSome:()=>!0,isNone:()=>!1,isSomeAnd:t=>t(e),isSomeAndAsync:t=>t(e),expect:t=>e,unwrap:()=>e,unwrapOr:t=>e,unwrapOrElse:t=>e,unwrapOrElseAsync:t=>Promise.resolve(e),okOr:t=>E(e),okOrElse:t=>E(e),transpose(){const t=e;return k(t),t.isOk()?E(v(t.unwrap())):T(t.unwrapErr())},filter:r=>r(e)?t:b,flatten(){const t=e;return S(t),t},map:t=>v(t(e)),mapOr:(t,r)=>r(e),mapOrElse:(t,r)=>r(e),zip:t=>(S(t),t.isSome()?v([e,t.unwrap()]):b),zipWith:(t,r)=>(S(t),t.isSome()?v(r(e,t.unwrap())):b),unzip(){const t=e;if(!Array.isArray(t)||2!==t.length)throw new TypeError("Unzip format is incorrect.");const[r,n]=t;return[v(r),v(n)]},and:e=>(S(e),e),andThen:t=>t(e),andThenAsync:t=>t(e),or:e=>t,orElse:e=>t,orElseAsync:e=>Promise.resolve(t),xor:e=>(S(e),e.isSome()?b:t),inspect:r=>(r(e),t),eq:t=>(S(t),t.isSome()&&t.unwrap()===e),toString:()=>`Some(${e})`};return t}const b=Object.freeze({[Symbol.toStringTag]:"Option",[m]:"None",isSome:()=>!1,isNone:()=>!0,isSomeAnd:e=>!1,isSomeAndAsync:e=>Promise.resolve(!1),expect(e){throw new TypeError(e)},unwrap(){throw new TypeError("Called `Option::unwrap()` on a `None` value")},unwrapOr:e=>e,unwrapOrElse:e=>e(),unwrapOrElseAsync:e=>e(),okOr:e=>T(e),okOrElse:e=>T(e()),transpose:()=>E(b),filter:e=>b,flatten:()=>b,map:e=>b,mapOr:(e,t)=>e,mapOrElse:(e,t)=>e(),zip:e=>b,zipWith:(e,t)=>b,unzip:()=>[b,b],and:e=>b,andThen:e=>b,andThenAsync:e=>Promise.resolve(b),or:e=>(S(e),e),orElse:e=>e(),orElseAsync:e=>e(),xor:e=>(S(e),e.isSome()?e:b),inspect:e=>b,eq:e=>(S(e),e===b),toString:()=>"None"});function E(e){const t={[Symbol.toStringTag]:"Result",[g]:"Ok",isOk:()=>!0,isErr:()=>!1,isOkAnd:t=>t(e),isOkAndAsync:t=>t(e),isErrAnd:e=>!1,isErrAndAsync:e=>Promise.resolve(!1),expect:t=>e,unwrap:()=>e,unwrapOr:t=>e,unwrapOrElse:t=>e,unwrapOrElseAsync:t=>Promise.resolve(e),expectErr(t){throw new TypeError(`${t}: ${e}`)},unwrapErr(){throw new TypeError("Called `Result::unwrapErr()` on an `Ok` value")},ok:()=>v(e),err:()=>b,transpose(){const t=e;return S(t),t.isSome()?v(E(t.unwrap())):b},map:t=>E(t(e)),mapErr:t=>E(e),mapOr:(t,r)=>r(e),mapOrElse:(t,r)=>r(e),flatten(){const t=e;return k(t),t},and:e=>(k(e),e),or:e=>t,andThen:t=>t(e),andThenAsync:t=>t(e),orElse:e=>t,orElseAsync:e=>Promise.resolve(t),inspect:r=>(r(e),t),inspectErr:e=>t,eq:t=>(k(t),t.isOk()&&t.unwrap()===e),asOk:()=>t,asErr(){throw new TypeError("Called `Result::asErr()` on an `Ok` value")},toString:()=>`Ok(${e})`};return t}function T(e){const t={[Symbol.toStringTag]:"Result",[g]:"Err",isOk:()=>!1,isErr:()=>!0,isOkAnd:e=>!1,isOkAndAsync:e=>Promise.resolve(!1),isErrAnd:t=>t(e),isErrAndAsync:t=>t(e),expect(t){throw new TypeError(`${t}: ${e}`)},unwrap(){throw new TypeError("Called `Result::unwrap()` on an `Err` value")},unwrapOr:e=>e,unwrapOrElse:t=>t(e),unwrapOrElseAsync:t=>t(e),expectErr:t=>e,unwrapErr:()=>e,ok:()=>b,err:()=>v(e),transpose:()=>v(t),map:t=>T(e),mapErr:t=>T(t(e)),mapOr:(e,t)=>e,mapOrElse:(t,r)=>t(e),flatten:()=>t,and:e=>t,or:e=>(k(e),e),andThen:e=>t,andThenAsync:e=>Promise.resolve(t),orElse:t=>t(e),orElseAsync:t=>t(e),inspect:e=>t,inspectErr:r=>(r(e),t),eq:t=>(k(t),t.isErr()&&t.unwrapErr()===e),asOk(){throw new TypeError("Called `Result::asOk()` on an `Err` value")},asErr:()=>t,toString:()=>`Err(${e})`};return t}function S(e){if(!function(e){return null!=e&&"object"==typeof e&&m in e}(e))throw new TypeError(`This(${e}) is not an Option`)}function k(e){if(!function(e){return null!=e&&"object"==typeof e&&g in e}(e))throw new TypeError(`This(${e}) is not a Result`)}E(!0);const F=E(!1),O=(E(0),E()),A="AbortError",R="TimeoutError";class x extends Error{name="FetchError";status=0;constructor(e,t){super(e),this.status=t}}function W(e,t){"string"!=typeof e&&i(e instanceof URL,()=>`Url must be a string or URL object but received ${e}.`);const{abortable:r=!1,responseType:n,timeout:a,onProgress:o,onChunk:s,...c}=t??{},l=null!=a;let u,f;l&&i("number"==typeof a&&a>0,()=>`Timeout must be a number greater than 0 but received ${a}.`),(r||l)&&(f=new AbortController,c.signal=f.signal);const h=fetch(e,c).then(async e=>{if(u?.(),!e.ok)return await(e.body?.cancel()),T(new x(e.statusText,e.status));if(e.body){const t="function"==typeof o,r="function"==typeof s;if(t||r){const[n,a]=e.body.tee(),i=n.getReader();let c=null,l=0;if(t){const t=e.headers.get("content-length")??e.headers.get("Content-Length");null==t?o(T(new Error("No content-length in response headers."))):c=parseInt(t,10)}i.read().then(function e({done:n,value:a}){n||(r&&s(a),t&&null!=c&&(l+=a.byteLength,o(E({totalByteLength:c,completedByteLength:l}))),i.read().then(e))}),e=new Response(a,{headers:e.headers,status:e.status,statusText:e.statusText})}}switch(n){case"arraybuffer":return E(await e.arrayBuffer());case"blob":return E(await e.blob());case"json":try{return E(await e.json())}catch{return T(new Error("Response is invalid json while responseType is json"))}case"text":return E(await e.text());default:return E(e)}}).catch(e=>(u?.(),T(e)));if(l){const e=setTimeout(()=>{if(!f.signal.aborted){const e=new Error;e.name=R,f.abort(e)}},a);u=()=>{e&&clearTimeout(e),u=null}}return r?{abort(e){u?.(),f.abort(e)},get aborted(){return f.signal.aborted},get response(){return h}}:h}var Z={},L=Uint8Array,I=Uint16Array,U=Int32Array,Y=new L([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),z=new L([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),C=new L([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),P=function(e,t){for(var r=new I(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new U(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return{b:r,r:a}},D=P(Y,2),M=D.b,G=D.r;M[28]=258,G[258]=28;for(var X=P(z,0),$=X.b,j=X.r,N=new I(32768),B=0;B<32768;++B){var V=(43690&B)>>1|(21845&B)<<1;V=(61680&(V=(52428&V)>>2|(13107&V)<<2))>>4|(3855&V)<<4,N[B]=((65280&V)>>8|(255&V)<<8)>>1}var _=function(e,t,r){for(var n=e.length,a=0,i=new I(t);a<n;++a)e[a]&&++i[e[a]-1];var o,s=new I(t);for(a=1;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){o=new I(1<<t);var c=15-t;for(a=0;a<n;++a)if(e[a])for(var l=a<<4|e[a],u=t-e[a],f=s[e[a]-1]++<<u,h=f|(1<<u)-1;f<=h;++f)o[N[f]>>c]=l}else for(o=new I(n),a=0;a<n;++a)e[a]&&(o[a]=N[s[e[a]-1]++]>>15-e[a]);return o},H=new L(288);for(B=0;B<144;++B)H[B]=8;for(B=144;B<256;++B)H[B]=9;for(B=256;B<280;++B)H[B]=7;for(B=280;B<288;++B)H[B]=8;var J=new L(32);for(B=0;B<32;++B)J[B]=5;var K=_(H,9,0),Q=_(H,9,1),q=_(J,5,0),ee=_(J,5,1),te=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},re=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&r},ne=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},ae=function(e){return(e+7)/8|0},ie=function(e,t,r){return(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length),new L(e.subarray(t,r))},oe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],se=function(e,t,r){var n=new Error(t||oe[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,se),!r)throw n;return n},ce=function(e,t,r,n){var a=e.length,i=n?n.length:0;if(!a||t.f&&!t.l)return r||new L(0);var o=!r,s=o||2!=t.i,c=t.i;o&&(r=new L(3*a));var l=function(e){var t=r.length;if(e>t){var n=new L(Math.max(2*t,e));n.set(r),r=n}},u=t.f||0,f=t.p||0,h=t.b||0,d=t.l,w=t.d,y=t.m,p=t.n,m=8*a;do{if(!d){u=re(e,f,1);var g=re(e,f+1,3);if(f+=3,!g){var v=e[(W=ae(f)+4)-4]|e[W-3]<<8,b=W+v;if(b>a){c&&se(0);break}s&&l(h+v),r.set(e.subarray(W,b),h),t.b=h+=v,t.p=f=8*b,t.f=u;continue}if(1==g)d=Q,w=ee,y=9,p=5;else if(2==g){var E=re(e,f,31)+257,T=re(e,f+10,15)+4,S=E+re(e,f+5,31)+1;f+=14;for(var k=new L(S),F=new L(19),O=0;O<T;++O)F[C[O]]=re(e,f+3*O,7);f+=3*T;var A=te(F),R=(1<<A)-1,x=_(F,A,1);for(O=0;O<S;){var W,Z=x[re(e,f,R)];if(f+=15&Z,(W=Z>>4)<16)k[O++]=W;else{var I=0,U=0;for(16==W?(U=3+re(e,f,3),f+=2,I=k[O-1]):17==W?(U=3+re(e,f,7),f+=3):18==W&&(U=11+re(e,f,127),f+=7);U--;)k[O++]=I}}var P=k.subarray(0,E),D=k.subarray(E);y=te(P),p=te(D),d=_(P,y,1),w=_(D,p,1)}else se(1);if(f>m){c&&se(0);break}}s&&l(h+131072);for(var G=(1<<y)-1,X=(1<<p)-1,j=f;;j=f){var N=(I=d[ne(e,f)&G])>>4;if((f+=15&I)>m){c&&se(0);break}if(I||se(2),N<256)r[h++]=N;else{if(256==N){j=f,d=null;break}var B=N-254;if(N>264){var V=Y[O=N-257];B=re(e,f,(1<<V)-1)+M[O],f+=V}var H=w[ne(e,f)&X],J=H>>4;if(H||se(3),f+=15&H,D=$[J],J>3&&(V=z[J],D+=ne(e,f)&(1<<V)-1,f+=V),f>m){c&&se(0);break}s&&l(h+131072);var K=h+B;if(h<D){var q=i-D,oe=Math.min(D,K);for(q+h<0&&se(3);h<oe;++h)r[h]=n[q+h]}for(;h<K;++h)r[h]=r[h-D]}}t.l=d,t.p=j,t.b=h,t.f=u,d&&(u=1,t.m=y,t.d=w,t.n=p)}while(!u);return h!=r.length&&o?ie(r,0,h):r.subarray(0,h)},le=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},ue=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},fe=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var a=r.length,i=r.slice();if(!a)return{t:ge,l:0};if(1==a){var o=new L(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var s=r[0],c=r[1],l=0,u=1,f=2;for(r[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=a-1;)s=r[r[l].f<r[f].f?l++:f++],c=r[l!=u&&r[l].f<r[f].f?l++:f++],r[u++]={s:-1,f:s.f+c.f,l:s,r:c};var h=i[0].s;for(n=1;n<a;++n)i[n].s>h&&(h=i[n].s);var d=new I(h+1),w=he(r[u-1],d,0);if(w>t){n=0;var y=0,p=w-t,m=1<<p;for(i.sort(function(e,t){return d[t.s]-d[e.s]||e.f-t.f});n<a;++n){var g=i[n].s;if(!(d[g]>t))break;y+=m-(1<<w-d[g]),d[g]=t}for(y>>=p;y>0;){var v=i[n].s;d[v]<t?y-=1<<t-d[v]++-1:++n}for(;n>=0&&y;--n){var b=i[n].s;d[b]==t&&(--d[b],++y)}w=t}return{t:new L(d),l:w}},he=function(e,t,r){return-1==e.s?Math.max(he(e.l,t,r+1),he(e.r,t,r+1)):t[e.s]=r},de=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new I(++t),n=0,a=e[0],i=1,o=function(e){r[n++]=e},s=1;s<=t;++s)if(e[s]==a&&s!=t)++i;else{if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(a);i=1,a=e[s]}return{c:r.subarray(0,n),n:t}},we=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},ye=function(e,t,r){var n=r.length,a=ae(t+2);e[a]=255&n,e[a+1]=n>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var i=0;i<n;++i)e[a+i+4]=r[i];return 8*(a+4+n)},pe=function(e,t,r,n,a,i,o,s,c,l,u){le(t,u++,r),++a[256];for(var f=fe(a,15),h=f.t,d=f.l,w=fe(i,15),y=w.t,p=w.l,m=de(h),g=m.c,v=m.n,b=de(y),E=b.c,T=b.n,S=new I(19),k=0;k<g.length;++k)++S[31&g[k]];for(k=0;k<E.length;++k)++S[31&E[k]];for(var F=fe(S,7),O=F.t,A=F.l,R=19;R>4&&!O[C[R-1]];--R);var x,W,Z,L,U=l+5<<3,P=we(a,H)+we(i,J)+o,D=we(a,h)+we(i,y)+o+14+3*R+we(S,O)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&U<=P&&U<=D)return ye(t,u,e.subarray(c,c+l));if(le(t,u,1+(D<P)),u+=2,D<P){x=_(h,d,0),W=h,Z=_(y,p,0),L=y;var M=_(O,A,0);for(le(t,u,v-257),le(t,u+5,T-1),le(t,u+10,R-4),u+=14,k=0;k<R;++k)le(t,u+3*k,O[C[k]]);u+=3*R;for(var G=[g,E],X=0;X<2;++X){var $=G[X];for(k=0;k<$.length;++k){var j=31&$[k];le(t,u,M[j]),u+=O[j],j>15&&(le(t,u,$[k]>>5&127),u+=$[k]>>12)}}}else x=K,W=H,Z=q,L=J;for(k=0;k<s;++k){var N=n[k];if(N>255){ue(t,u,x[257+(j=N>>18&31)]),u+=W[j+257],j>7&&(le(t,u,N>>23&31),u+=Y[j]);var B=31&N;ue(t,u,Z[B]),u+=L[B],B>3&&(ue(t,u,N>>5&8191),u+=z[B])}else ue(t,u,x[N]),u+=W[N]}return ue(t,u,x[256]),u+W[256]},me=new U([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ge=new L(0),ve=function(e,t,r,n,a,i){var o=i.z||e.length,s=new L(n+o+5*(1+Math.ceil(o/7e3))+a),c=s.subarray(n,s.length-a),l=i.l,u=7&(i.r||0);if(t){u&&(c[0]=i.r>>3);for(var f=me[t-1],h=f>>13,d=8191&f,w=(1<<r)-1,y=i.p||new I(32768),p=i.h||new I(w+1),m=Math.ceil(r/3),g=2*m,v=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<g)&w},b=new U(25e3),E=new I(288),T=new I(32),S=0,k=0,F=i.i||0,O=0,A=i.w||0,R=0;F+2<o;++F){var x=v(F),W=32767&F,Z=p[x];if(y[W]=Z,p[x]=W,A<=F){var C=o-F;if((S>7e3||O>24576)&&(C>423||!l)){u=pe(e,c,0,b,E,T,k,O,R,F-R,u),O=S=k=0,R=F;for(var P=0;P<286;++P)E[P]=0;for(P=0;P<30;++P)T[P]=0}var D=2,M=0,X=d,$=W-Z&32767;if(C>2&&x==v(F-$))for(var N=Math.min(h,C)-1,B=Math.min(32767,F),V=Math.min(258,C);$<=B&&--X&&W!=Z;){if(e[F+D]==e[F+D-$]){for(var _=0;_<V&&e[F+_]==e[F+_-$];++_);if(_>D){if(D=_,M=$,_>N)break;var H=Math.min($,_-2),J=0;for(P=0;P<H;++P){var K=F-$+P&32767,Q=K-y[K]&32767;Q>J&&(J=Q,Z=K)}}}$+=(W=Z)-(Z=y[W])&32767}if(M){b[O++]=268435456|G[D]<<18|j[M];var q=31&G[D],ee=31&j[M];k+=Y[q]+z[ee],++E[257+q],++T[ee],A=F+D,++S}else b[O++]=e[F],++E[e[F]]}}for(F=Math.max(F,A);F<o;++F)b[O++]=e[F],++E[e[F]];u=pe(e,c,l,b,E,T,k,O,R,F-R,u),l||(i.r=7&u|c[u/8|0]<<3,u-=7,i.h=p,i.p=y,i.i=F,i.w=A)}else{for(F=i.w||0;F<o+l;F+=65535){var te=F+65535;te>=o&&(c[u/8|0]=l,te=o),u=ye(c,u+1,e.subarray(F,te))}i.i=o}return ie(s,0,n+ae(u)+a)},be=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&-306674912)^r>>>1;e[t]=r}return e}(),Ee=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=be[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},Te=function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new L(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return ve(e,null==t.level?6:t.level,null==t.mem?a.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,r,n,a)},Se=function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r},ke=function(e,t,r){for(var n=e(),a=e.toString(),i=a.slice(a.indexOf("[")+1,a.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var s=n[o],c=i[o];if("function"==typeof s){t+=";"+c+"=";var l=s.toString();if(s.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;t+=l.slice(u,l.indexOf("(",u))}else for(var f in t+=l,s.prototype)t+=";"+c+".prototype."+f+"="+s.prototype[f].toString();else t+=l}else r[c]=s}return t},Fe=[],Oe=function(){return[L,I,U,Y,z,C,M,$,Q,ee,N,oe,_,te,re,ne,ae,ie,se,ce,ze,Re,xe]},Ae=function(){return[L,I,U,Y,z,C,G,j,K,H,q,J,N,me,ge,_,le,ue,fe,he,de,we,ye,pe,ae,ie,ve,Te,Ye,Re]},Re=function(e){return postMessage(e,[e.buffer])},xe=function(e){return e&&{out:e.size&&new L(e.size),dictionary:e.dictionary}},We=function(e,t,r,n,a,i){var o=function(e,t,r,n){if(!Fe[r]){for(var a="",i={},o=e.length-1,s=0;s<o;++s)a=ke(e[s],a,i);Fe[r]={c:ke(e[o],a,i),e:i}}var c=Se({},Fe[r].e);return function(e,t,r,n,a){var i=new Worker(Z[t]||(Z[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(e){var t=e.data,r=t.$e$;if(r){var n=new Error(r[0]);n.code=r[1],n.stack=r[2],a(n,null)}else a(null,t)},i.postMessage(r,n),i}(Fe[r].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,c,function(e){var t=[];for(var r in e)e[r].buffer&&t.push((e[r]=new e[r].constructor(e[r])).buffer);return t}(c),n)}(r,n,a,function(e,t){o.terminate(),i(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Ze=function(e,t){return e[t]|e[t+1]<<8},Le=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Ie=function(e,t){return Le(e,t)+4294967296*Le(e,t+4)},Ue=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function Ye(e,t){return Te(e,t||{},0,0)}function ze(e,t){return ce(e,{i:2},t&&t.out,t&&t.dictionary)}var Ce=function(e,t,r,n){for(var a in e){var i=e[a],o=t+a,s=n;Array.isArray(i)&&(s=Se(n,i[1]),i=i[0]),i instanceof L?r[o]=[i,s]:(r[o+="/"]=[new L(0),s],Ce(i,o,r,n))}},Pe="undefined"!=typeof TextEncoder&&new TextEncoder,De="undefined"!=typeof TextDecoder&&new TextDecoder;try{De.decode(ge,{stream:!0})}catch(e){}function Me(e,t){if(t){for(var r=new L(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Pe)return Pe.encode(e);var a=e.length,i=new L(e.length+(e.length>>1)),o=0,s=function(e){i[o++]=e};for(n=0;n<a;++n){if(o+5>i.length){var c=new L(o+8+(a-n<<1));c.set(i),i=c}var l=e.charCodeAt(n);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return ie(i,0,o)}function Ge(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}if(De)return De.decode(e);var a=function(e){for(var t="",r=0;;){var n=e[r++],a=(n>127)+(n>223)+(n>239);if(r+a>e.length)return{s:t,r:ie(e,r-1)};a?3==a?(n=((15&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=String.fromCharCode(55296|n>>10,56320|1023&n)):t+=1&a?String.fromCharCode((31&n)<<6|63&e[r++]):String.fromCharCode((15&n)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(n)}}(e),i=a.s;return(r=a.r).length&&se(8),i}var Xe=function(e,t){return t+30+Ze(e,t+26)+Ze(e,t+28)},$e=function(e,t,r){var n=Ze(e,t+28),a=Ge(e.subarray(t+46,t+46+n),!(2048&Ze(e,t+8))),i=t+46+n,o=Le(e,t+20),s=r&&4294967295==o?je(e,i):[o,Le(e,t+24),Le(e,t+42)],c=s[0],l=s[1],u=s[2];return[Ze(e,t+10),c,l,a,i+Ze(e,t+30)+Ze(e,t+32),u]},je=function(e,t){for(;1!=Ze(e,t);t+=4+Ze(e,t+2));return[Ie(e,t+12),Ie(e,t+4),Ie(e,t+20)]},Ne=function(e){var t=0;if(e)for(var r in e){var n=e[r].length;n>65535&&se(9),t+=n+4}return t},Be=function(e,t,r,n,a,i,o,s){var c=n.length,l=r.extra,u=s&&s.length,f=Ne(l);Ue(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=a&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var h=new Date(null==r.mtime?Date.now():r.mtime),d=h.getFullYear()-1980;if((d<0||d>119)&&se(10),Ue(e,t,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,-1!=i&&(Ue(e,t,r.crc),Ue(e,t+4,i<0?-i-2:i),Ue(e,t+8,r.size)),Ue(e,t+12,c),Ue(e,t+14,f),t+=16,null!=o&&(Ue(e,t,u),Ue(e,t+6,r.attrs),Ue(e,t+10,o),t+=14),e.set(n,t),t+=c,f)for(var w in l){var y=l[w],p=y.length;Ue(e,t,+w),Ue(e,t+2,p),e.set(y,t+4),t+=4+p}return u&&(e.set(s,t),t+=u),t},Ve=function(e,t,r,n,a){Ue(e,t,101010256),Ue(e,t+8,r),Ue(e,t+10,r),Ue(e,t+12,n),Ue(e,t+16,a)};var _e="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(e){e()};class He{resolve;reject;promise;constructor(){if("function"==typeof Promise.withResolvers){const{promise:e,resolve:t,reject:r}=Promise.withResolvers();this.promise=e,this.resolve=t,this.reject=r}else this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}const Je="NotFoundError",Ke="/",Qe=".",qe="/tmp";function et(e){i("string"==typeof e,()=>`Path must be a string but received ${e}`),i(e[0]===Ke,()=>`Path must start with / but received ${e}`)}function tt(e){i("string"==typeof e,()=>`File url must be a string but received ${e}`)}let rt;function nt(e){return e===Ke}async function at(e,t,r){try{return E(await e.getDirectoryHandle(t,r))}catch(r){const n=r,a=new Error(`${n.name}: ${n.message} When get child directory '${t}' from directory '${e.name||Ke}'.`);return a.name=n.name,T(a)}}async function it(e,t){let r=await async function(){return rt??=await navigator.storage.getDirectory(),rt}();if(nt(e))return E(r);let n=e.slice(1);for(;n;){let e="";const a=n.indexOf(d);if(-1===a)e=n,n="";else if(e=n.slice(0,a),n=n.slice(a+1),0===a)continue;const i=await at(r,e,t);if(i.isErr())return i;r=i.unwrap()}return E(r)}async function ot(e,t){const r=t?.create??!1,n=w(e),a=h(e);return(await it(n,{create:r})).andThenAsync(e=>async function(e,t,r){try{return E(await e.getFileHandle(t,r))}catch(r){const n=r,a=new Error(`${n.name}: ${n.message} When get child file '${t}' from directory '${e.name||Ke}'.`);return a.name=n.name,T(a)}}(e,a,{create:r}))}function st(e){return e.name===Je}async function ct(e){const t=(await Promise.all(e)).find(e=>e.isErr());return t??O}function lt(){const e=new Error;return e.name=A,e}function ut(e){const{isDirectory:t=!1,basename:r="tmp",extname:n=""}=e??{},a=t?"":n;return p(qe,`${r?`${r}-`:""}${crypto.randomUUID()}${a}`)}function ft(e){return e.startsWith(`${qe}${d}`)}async function ht(e){const{name:t,kind:r}=e;if(dt(e)){const n=await e.getFile(),{size:a,lastModified:i,type:o}=n;return{name:t,kind:r,type:o,size:a,lastModified:i}}return{name:t,kind:r}}function dt(e){return"file"===e.kind}function wt(e){return"directory"===e.kind}function yt(e){return"file"===e.kind}async function pt(e){const t=await e.getFile(),r=await t.arrayBuffer();return new Uint8Array(r)}async function mt(e){return et(e),(await ot(e,{create:!0})).and(O)}async function gt(e){return et(e),(await it(e,{create:!0})).and(O)}async function vt(e,t){async function*r(n,a){const i=n.entries();for await(const[o,s]of i){const i=a===e?o:p(a,o);yield{path:i,handle:s},wt(s)&&t?.recursive&&(yield*r(await n.getDirectoryHandle(o),i))}}return et(e),(await it(e)).andThen(t=>E(r(t,e)))}async function bt(e,t){return et(e),(await ot(e)).andThenAsync(async e=>{const r=await e.getFile();switch(t?.encoding){case"blob":return E(r);case"utf8":return E(await r.text());default:return E(await r.arrayBuffer())}})}async function Et(e){et(e);const t=w(e),r=h(e),n=await it(t);return(await n.andThenAsync(async e=>{try{nt(t)&&nt(r)?await e.remove({recursive:!0}):await e.removeEntry(r,{recursive:!0})}catch(e){return T(e)}return O})).orElse(e=>st(e)?O:T(e))}async function Tt(e){et(e);const t=w(e),r=h(e),n=await it(t);return r?n.andThenAsync(async t=>{for await(const[e,n]of t.entries())if(e===r)return E(n);const n=new Error(`${Je}: '${r}' does not exist. Full path is '${e}'.`);return n.name=Je,T(n)}):n}async function St(e,t,r){et(e);const{append:n=!1,create:a=!0}=r??{};return(await ot(e,{create:a})).andThenAsync(async e=>{const r=await e.createWritable({keepExistingData:n}),a={type:"write",data:t};if(n){const{size:t}=await e.getFile();a.position=t}return await r.write(a),await r.close(),O})}function kt(e,t,r){let n,a;tt(e),a=!1,"string"==typeof t?et(t):(r=t,t=ut({extname:y(e)}),a=!0),n=!1;const i=W(e,{redirect:"follow",...r,abortable:!0}),o=(async()=>(await i.response).andThenAsync(async e=>{const r=await e.blob();return n?T(lt()):(await St(t,r)).and(E(e))}))();return{abort(e){n=!0,i.abort(e)},get aborted(){return n},get response(){return a?o.then(e=>e.map(e=>({tempFilePath:t,rawResponse:e}))):o}}}async function Ft(e,t){const r=w(t);return(await it(r,{create:!0})).andThenAsync(async r=>{const n=h(t);try{return await e.move(r,n),O}catch(e){return T(e)}})}async function Ot(e,t,r,n=!0){return et(t),(await Tt(e)).andThenAsync(async a=>{let i;i=!1;const o=await Tt(t);if(o.isErr()){if(!st(o.unwrapErr()))return o.asErr()}else{i=!0;const e=o.unwrap();if(!(dt(a)&&dt(e)||wt(a)&&wt(e)))return T(new Error("Both 'srcPath' and 'destPath' must both be a file or directory."))}return dt(a)?n||!i?await r(a,t):O:(await vt(e,{recursive:!0})).andThenAsync(async e=>{const a=[gt(t)];for await(const{path:o,handle:s}of e){const e=p(t,o);let c=!1;if(i){const t=await Wt(e);if(t.isErr()){a.push(Promise.resolve(t.asErr()));continue}c=t.unwrap()}const l=dt(s)?n||!c?r(s,e):Promise.resolve(O):gt(e);a.push(l)}return ct(a)})})}function At(e,t){return St(e,t,{append:!0})}async function Rt(e,t,r){const{overwrite:n=!0}=r??{};return Ot(e,t,async(e,t)=>await St(t,await e.getFile()),n)}async function xt(e){const t=await vt(e);if(t.isErr())return st(t.unwrapErr())?gt(e):t.asErr();const r=[];for await(const{path:n}of t.unwrap())r.push(Et(p(e,n)));return ct(r)}async function Wt(e,t){const{isDirectory:r=!1,isFile:n=!1}=t??{};i(!(r&&n),()=>"ExistsOptions.isDirectory and ExistsOptions.isFile must not be true together.");const a=await Tt(e);return a.andThen(e=>E(!(r&&dt(e)||n&&wt(e)))).orElse(e=>st(e)?F:a.asErr())}async function Zt(e,t,r){const{overwrite:n=!0}=r??{};return(await Ot(e,t,Ft,n)).andThenAsync(()=>Et(e))}function Lt(e){return bt(e,{encoding:"blob"})}async function It(e){return(await Ut(e)).andThenAsync(async e=>{try{return E(JSON.parse(e))}catch(e){return T(e)}})}function Ut(e){return bt(e,{encoding:"utf8"})}async function Yt(e){const{isDirectory:t=!1}=e??{},r=ut(e);return(await(t?gt:mt)(r)).and(E(r))}function zt(){return Et(qe)}async function Ct(e){return i(e instanceof Date,()=>`Expired must be a Datebut received ${e}`),(await vt(qe,{recursive:!0})).andThenAsync(async t=>{try{for await(const{handle:r}of t)dt(r)&&(await r.getFile()).lastModified<=e.getTime()&&await r.remove()}catch(e){return T(e)}return O})}async function Pt(e,t){const r=new Uint8Array(e),n=new He;return function(e,t,r){r||(r=t,t={}),"function"!=typeof r&&se(7);var n=[],a=function(){for(var e=0;e<n.length;++e)n[e]()},i={},o=function(e,t){_e(function(){r(e,t)})};_e(function(){o=r});for(var s=e.length-22;101010256!=Le(e,s);--s)if(!s||e.length-s>65558)return o(se(13,0,1),null),a;var c=Ze(e,s+8);if(c){var l=c,u=Le(e,s+16),f=4294967295==u||65535==l;if(f){var h=Le(e,s-12);(f=101075792==Le(e,h))&&(l=c=Le(e,h+32),u=Le(e,h+48))}for(var d=t&&t.filter,w=function(t){var r=$e(e,u,f),s=r[0],l=r[1],h=r[2],w=r[3],y=r[4],p=r[5],m=Xe(e,p);u=y;var g=function(e,t){e?(a(),o(e,null)):(t&&(i[w]=t),--c||o(null,i))};if(!d||d({name:w,size:l,originalSize:h,compression:s}))if(s)if(8==s){var v=e.subarray(m,m+l);if(h<524288||l>.8*h)try{g(null,ze(v,{out:new L(h)}))}catch(e){g(e,null)}else n.push(function(e,t,r){return r||(r=t,t={}),"function"!=typeof r&&se(7),We(e,t,[Oe],function(e){return Re(ze(e.data[0],xe(e.data[1])))},1,r)}(v,{size:h},g))}else g(se(14,"unknown compression type "+s,1),null);else g(null,ie(e,m,m+l));else g(null,null)},y=0;y<l;++y)w()}else o(null,{})}(r,async(e,r)=>{if(e)return void n.resolve(T(e));const a=[];for(const e in r)e.at(-1)!==d&&a.push(St(p(t,e),r[e]));n.resolve(ct(a))}),await n.promise}async function Dt(e,t){return et(t),(await bt(e)).andThenAsync(e=>Pt(e,t))}async function Mt(e,t,r){return tt(e),et(t),(await W(e,{redirect:"follow",...r,responseType:"arraybuffer",abortable:!1})).andThenAsync(e=>Pt(e,t))}function Gt(e,t,r){let n,a;tt(t),n=!1;const i=(async()=>(await Lt(e)).andThenAsync(async i=>{if(n)return T(lt());const{filename:o=h(e),...s}=r??{},c=new FormData;return c.append(o,i,o),a=W(t,{method:"POST",...s,abortable:!0,body:c}),a.response}))();return{abort(e){n=!0,a?.abort(e)},get aborted(){return n},get response(){return i}}}async function Xt(e,t){const r=new He;return function(e,t,r){r||(r=t,t={}),"function"!=typeof r&&se(7);var n={};Ce(e,"",n,t);var a=Object.keys(n),i=a.length,o=0,s=0,c=i,l=new Array(i),u=[],f=function(){for(var e=0;e<u.length;++e)u[e]()},h=function(e,t){_e(function(){r(e,t)})};_e(function(){h=r});var d=function(){var e=new L(s+22),t=o,r=s-o;s=0;for(var n=0;n<c;++n){var a=l[n];try{var i=a.c.length;Be(e,s,a,a.f,a.u,i);var u=30+a.f.length+Ne(a.extra),f=s+u;e.set(a.c,f),Be(e,o,a,a.f,a.u,i,s,a.m),o+=16+u+(a.m?a.m.length:0),s=f+i}catch(e){return h(e,null)}}Ve(e,o,l.length,r,t),h(null,e)};i||d();for(var w=function(e){var t=a[e],r=n[t],c=r[0],w=r[1],y=Ee(),p=c.length;y.p(c);var m=Me(t),g=m.length,v=w.comment,b=v&&Me(v),E=b&&b.length,T=Ne(w.extra),S=0==w.level?0:8,k=function(r,n){if(r)f(),h(r,null);else{var a=n.length;l[e]=Se(w,{size:p,crc:y.d(),c:n,f:m,m:b,u:g!=t.length||b&&v.length!=E,compression:S}),o+=30+g+T+a,s+=76+2*(g+T)+(E||0)+a,--i||d()}};if(g>65535&&k(se(11,0,1),null),S)if(p<16e4)try{k(null,Ye(c,w))}catch(e){k(e,null)}else u.push(function(e,t,r){return r||(r=t,t={}),"function"!=typeof r&&se(7),We(e,t,[Ae],function(e){return Re(Ye(e.data[0],e.data[1]))},0,r)}(c,w,k));else k(null,c)},y=0;y<c;++y)w(y)}(e,{consume:!0},async(e,n)=>{if(e)r.resolve(T(e));else if(t){const e=await St(t,n);r.resolve(e)}else r.resolve(E(n))}),await r.promise}async function $t(e,t,r){return"string"==typeof t?et(t):(r=t,t=void 0),(await Tt(e)).andThenAsync(async n=>{const a=h(e),i={};if(dt(n)){const e=await pt(n);i[a]=e}else{const t=await vt(e,{recursive:!0});if(t.isErr())return t.asErr();const n=r?.preserveRoot??!0;for await(const{path:e,handle:r}of t.unwrap())if(dt(r)){const t=n?p(a,e):e,o=await pt(r);i[t]=o}}return Xt(i,t)})}async function jt(e,t,r){return tt(e),"string"==typeof t?et(t):(r=t,t=void 0),(await W(e,{redirect:"follow",...r,responseType:"arraybuffer",abortable:!1})).andThenAsync(r=>{const n={};return n[h(e)]=new Uint8Array(r),Xt(n,t)})}function Nt(){return"function"==typeof navigator?.storage?.getDirectory}function Bt(e){return e?{name:e.name,message:e.message}:e}async function Vt(e){const t=await e.arrayBuffer();return{name:e.name,type:e.type,lastModified:e.lastModified,size:t.byteLength,data:t}}let _t=1e3;var Ht=(e=>(e[e.createFile=0]="createFile",e[e.mkdir=1]="mkdir",e[e.move=2]="move",e[e.readDir=3]="readDir",e[e.remove=4]="remove",e[e.stat=5]="stat",e[e.writeFile=6]="writeFile",e[e.appendFile=7]="appendFile",e[e.copy=8]="copy",e[e.emptyDir=9]="emptyDir",e[e.exists=10]="exists",e[e.deleteTemp=11]="deleteTemp",e[e.mkTemp=12]="mkTemp",e[e.pruneTemp=13]="pruneTemp",e[e.readBlobFile=14]="readBlobFile",e[e.unzip=15]="unzip",e[e.zip=16]="zip",e))(Ht||{});const Jt=0,Kt=1,Qt=2,qt=1,er=0,tr=er,rr=qt;let nr,ar;function ir(e){const t=JSON.stringify(e);return(nr??=new TextEncoder,nr).encode(t)}function or(e){const t=sr(e);return JSON.parse(t)}function sr(e){return(ar??=new TextDecoder,ar).decode(e)}class cr{i32a;u8a;headerLength=16;maxDataLength;constructor(e){this.i32a=new Int32Array(e),this.u8a=new Uint8Array(e),this.maxDataLength=e.byteLength-this.headerLength}}async function lr(e,t){const{i32a:r,u8a:n,headerLength:a,maxDataLength:i}=e;for(;Atomics.load(r,Kt)!==rr;);const o=r[Qt],s=n.slice(a,a+o);let c=await t(s);const l=c.byteLength;if(l>i){const e=`Response is too large: ${l} > ${i}. Consider grow the size of SharedArrayBuffer.`;if(c=ir([{name:"RangeError",message:e}]),c.byteLength>i)throw Atomics.store(r,Kt,tr),new RangeError(e)}r[Qt]=c.byteLength,n.set(c,a),Atomics.store(r,Kt,tr),Atomics.store(r,Jt,er)}const ur={[Ht.createFile]:mt,[Ht.mkdir]:gt,[Ht.move]:Zt,[Ht.readDir]:vt,[Ht.remove]:Et,[Ht.stat]:Tt,[Ht.writeFile]:St,[Ht.appendFile]:At,[Ht.copy]:Rt,[Ht.emptyDir]:xt,[Ht.exists]:Wt,[Ht.deleteTemp]:zt,[Ht.mkTemp]:Yt,[Ht.pruneTemp]:Ct,[Ht.readBlobFile]:Lt,[Ht.unzip]:Dt,[Ht.zip]:$t};let fr,hr;function dr(){if("undefined"!=typeof window)throw new Error("Only can use in worker");if(fr)throw new Error("Worker messenger already started");addEventListener("message",e=>{const t=e.data;if(!(t instanceof SharedArrayBuffer))throw new TypeError("Only can post SharedArrayBuffer to Worker");fr=new cr(t),postMessage(!0),async function(){for(;;)try{await lr(fr,async e=>{const[t,...r]=or(e);let n;t===Ht.writeFile||t===Ht.appendFile?Array.isArray(r[1])&&(r[1]=new Uint8Array(r[1])):t===Ht.pruneTemp&&(r[0]=new Date(r[0]));const a=ur[t];try{const e=await a(...r);if(e.isErr())n=ir([Bt(e.unwrapErr())]);else{let r;if(t===Ht.readBlobFile){const t=e.unwrap(),n=await Vt(t);r={...n,data:[...new Uint8Array(n.data)]}}else if(t===Ht.readDir){const t=e.unwrap(),n=[];for await(const{path:e,handle:r}of t){const t=await ht(r);n.push({path:e,handle:t})}r=n}else if(t===Ht.stat){const t=e.unwrap();r=await ht(t)}else if(t===Ht.zip){const t=e.unwrap();r=t instanceof Uint8Array?[...t]:t}else r=e.unwrap();n=ir([null,r])}}catch(e){n=ir([Bt(e)])}return n})}catch(e){console.error(e instanceof Error?e.stack:e)}}()})}function wr(e){if("undefined"==typeof window)throw new Error("Only can use in main thread");if(hr)throw new Error("Main messenger already started");return new Promise(t=>{const{worker:r,bufferLength:n=1048576,opTimeout:a=1e3}=e;i(r instanceof Worker||r instanceof URL||"string"==typeof r&&r,()=>"Worker must be Worker or valid URL(string)."),i(n>16&&n%4==0,()=>"bufferLength must be a multiple of 4."),i(Number.isInteger(a)&&a>0,()=>"opTimeout must be integer and greater than 0."),_t=a;const o=r instanceof Worker?r:new Worker(r),s=new SharedArrayBuffer(n);o.addEventListener("message",e=>{e.data&&(hr=new cr(s),t())}),o.postMessage(s)})}function yr(){return hr}function pr(e){i(null!=e,()=>"syncMessenger is null or undefined."),hr=e}function mr(e,...t){if(!hr)return T(new Error("Worker not initialized. Come back later."));const r=ir([e,...t]);try{const e=or(function(e,t){const{i32a:r,u8a:n,headerLength:a,maxDataLength:i}=e,o=t.byteLength;if(o>i)throw new RangeError(`Request is too large: ${o} > ${i}. Consider grow the size of SharedArrayBuffer.`);Atomics.store(r,Jt,qt),r[Qt]=o,n.set(t,a),Atomics.store(r,Kt,rr),function(e){const t=Date.now();for(;!e();)if(Date.now()-t>_t){const e=new Error("Operating Timeout");throw e.name=R,e}}(()=>Atomics.load(r,Jt)===er);const s=r[Qt];return n.slice(a,a+s)}(hr,r)),t=e[0],n=t?T(function(e){const t=new Error(e.message);return t.name=e.name,t}(t)):E(e[1]??void 0);return n}catch(e){return T(e)}}function gr(e){return mr(Ht.createFile,e)}function vr(e){return mr(Ht.mkdir,e)}function br(e,t,r){return mr(Ht.move,e,t,r)}function Er(e,t){return mr(Ht.readDir,e,t)}function Tr(e,t){return mr(Ht.readBlobFile,e).map(e=>{const r=new Uint8Array(e.data);switch(e.data=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),t?.encoding){case"blob":return e;case"utf8":return sr(new Uint8Array(e.data));default:return e.data}})}function Sr(e){return mr(Ht.remove,e)}function kr(e){return mr(Ht.stat,e)}function Fr(e){return e instanceof ArrayBuffer?[...new Uint8Array(e)]:ArrayBuffer.isView(e)?[...new Uint8Array(e.buffer)]:e}function Or(e,t,r){return mr(Ht.writeFile,e,Fr(t),r)}function Ar(e,t){return mr(Ht.appendFile,e,Fr(t))}function Rr(e,t,r){return mr(Ht.copy,e,t,r)}function xr(e){return mr(Ht.emptyDir,e)}function Wr(e,t){return mr(Ht.exists,e,t)}function Zr(){return mr(Ht.deleteTemp)}function Lr(e){return mr(Ht.mkTemp,e)}function Ir(e){return mr(Ht.pruneTemp,e)}function Ur(e){return Tr(e,{encoding:"blob"})}function Yr(e){return zr(e).andThen(e=>{try{return E(JSON.parse(e))}catch(e){return T(e)}})}function zr(e){return Tr(e,{encoding:"utf8"})}function Cr(e,t){return mr(Ht.unzip,e,t)}function Pr(e,t,r){return mr(Ht.zip,e,t,r).map(e=>e?new Uint8Array(e):e)}}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(234)})();
1
+ (()=>{var e={234(e,r,t){const n=t(210);_sync_agent=n.startSyncAgent,e.exports={_sync_agent},_sync_agent()},210(e,r,t){const n=t(744),a=t(597),i=t(12);function o(e){let r;return void 0===e&&(e="fs-worker.js"),r=new a(e),r}_file=i.file,_read_stream_create=function(e,r){return _file(e).createReader()},e.exports=n,e.exports.fsWorkerNew=o,e.exports.fsWorkerStart=async function(e,r,t){let n,a,i,s;return void 0===e&&(e="fs-worker.js"),"Number"!=typeof r&&(r=10485760),"Number"!=typeof r&&(t=10485760),a=_fs.connectSyncAgent,s=o(e),i={worker:s,bufferLength:r,opTimeout:t},n=a(i),n},e.exports.createReadStream=_read_stream_create,e.exports.createWriteStream=function(e,r){return _file(e).createWriter()},e.exports.mkdtemp=n.mkTemp,e.exports.readdirSync=n.readDirSync},12(e,r){!function(e){"use strict";var r,t,n,a,i,o,s,c,l,u,f,y,h=e=>{throw TypeError(e)},d=(e,r,t)=>r.has(e)||h("Cannot "+t),w=(e,r,t)=>(d(e,r,"read from private field"),t?t.call(e):r.get(e)),p=(e,r,t)=>r.has(e)?h("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,t),m=(e,r,t,n)=>(d(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t);const g="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHUobil7aWYobj09PSIvIilyZXR1cm57cGFyZW50Om51bGwsbmFtZToiIn07Y29uc3QgZT1uLnNwbGl0KCIvIikuZmlsdGVyKGk9PmkubGVuZ3RoPjApO2lmKGUubGVuZ3RoPT09MCl0aHJvdyBFcnJvcigiSW52YWxpZCBwYXRoIik7Y29uc3QgYT1lW2UubGVuZ3RoLTFdLHI9Ii8iK2Uuc2xpY2UoMCwtMSkuam9pbigiLyIpO3JldHVybntuYW1lOmEscGFyZW50OnJ9fWFzeW5jIGZ1bmN0aW9uIHcobixlKXtjb25zdHtwYXJlbnQ6YSxuYW1lOnJ9PXUobik7aWYoYT09bnVsbClyZXR1cm4gYXdhaXQgbmF2aWdhdG9yLnN0b3JhZ2UuZ2V0RGlyZWN0b3J5KCk7Y29uc3QgaT1hLnNwbGl0KCIvIikuZmlsdGVyKHQ9PnQubGVuZ3RoPjApO3RyeXtsZXQgdD1hd2FpdCBuYXZpZ2F0b3Iuc3RvcmFnZS5nZXREaXJlY3RvcnkoKTtmb3IoY29uc3QgcyBvZiBpKXQ9YXdhaXQgdC5nZXREaXJlY3RvcnlIYW5kbGUocyx7Y3JlYXRlOmUuY3JlYXRlfSk7aWYoZS5pc0ZpbGUpcmV0dXJuIGF3YWl0IHQuZ2V0RmlsZUhhbmRsZShyLHtjcmVhdGU6ZS5jcmVhdGV9KX1jYXRjaCh0KXtpZih0Lm5hbWU9PT0iTm90Rm91bmRFcnJvciIpcmV0dXJuIG51bGw7dGhyb3cgdH19Y29uc3QgZj17fTtzZWxmLm9ubWVzc2FnZT1hc3luYyBuPT57dmFyIGk7Y29uc3R7ZXZ0VHlwZTplLGFyZ3M6YX09bi5kYXRhO2xldCByPWZbYS5maWxlSWRdO3RyeXtsZXQgdDtjb25zdCBzPVtdO2lmKGU9PT0icmVnaXN0ZXIiKXtjb25zdCBsPWF3YWl0IHcoYS5maWxlUGF0aCx7Y3JlYXRlOiEwLGlzRmlsZTohMH0pO2lmKGw9PW51bGwpdGhyb3cgRXJyb3IoYG5vdCBmb3VuZCBmaWxlOiAke2EuZmlsZUlkfWApO3I9YXdhaXQgbC5jcmVhdGVTeW5jQWNjZXNzSGFuZGxlKHttb2RlOmEubW9kZX0pLGZbYS5maWxlSWRdPXJ9ZWxzZSBpZihlPT09ImNsb3NlIilhd2FpdCByLmNsb3NlKCksZGVsZXRlIGZbYS5maWxlSWRdO2Vsc2UgaWYoZT09PSJ0cnVuY2F0ZSIpYXdhaXQgci50cnVuY2F0ZShhLm5ld1NpemUpO2Vsc2UgaWYoZT09PSJ3cml0ZSIpe2NvbnN0e2RhdGE6bCxvcHRzOm99PW4uZGF0YS5hcmdzO3Q9YXdhaXQgci53cml0ZShsLG8pfWVsc2UgaWYoZT09PSJyZWFkIil7Y29uc3R7b2Zmc2V0Omwsc2l6ZTpvfT1uLmRhdGEuYXJncyxnPW5ldyBVaW50OEFycmF5KG8pLGQ9YXdhaXQgci5yZWFkKGcse2F0Omx9KSxjPWcuYnVmZmVyO3Q9ZD09PW8/YzooKGk9Yy50cmFuc2Zlcik9PW51bGw/dm9pZCAwOmkuY2FsbChjLGQpKT8/Yy5zbGljZSgwLGQpLHMucHVzaCh0KX1lbHNlIGU9PT0iZ2V0U2l6ZSI/dD1hd2FpdCByLmdldFNpemUoKTplPT09ImZsdXNoIiYmYXdhaXQgci5mbHVzaCgpO3NlbGYucG9zdE1lc3NhZ2Uoe2V2dFR5cGU6ImNhbGxiYWNrIixjYklkOm4uZGF0YS5jYklkLHJldHVyblZhbDp0fSxzKX1jYXRjaCh0KXtjb25zdCBzPXQ7c2VsZi5wb3N0TWVzc2FnZSh7ZXZ0VHlwZToidGhyb3dFcnJvciIsY2JJZDpuLmRhdGEuY2JJZCxlcnJNc2c6cy5uYW1lKyI6ICIrcy5tZXNzYWdlK2AKYCtKU09OLnN0cmluZ2lmeShuLmRhdGEpfSl9fX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPW9wZnMtd29ya2VyLUY0UldscWNfLmpzLm1hcAo=",v=typeof self<"u"&&self.Blob&&new Blob([(b=g,Uint8Array.from(atob(b),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var b;function E(e){let r;try{if(r=v&&(self.URL||self.webkitURL).createObjectURL(v),!r)throw"";const t=new Worker(r,{name:null==e?void 0:e.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(r)}),t}catch{return new Worker("data:text/javascript;base64,"+g,{name:null==e?void 0:e.name})}finally{r&&(self.URL||self.webkitURL).revokeObjectURL(r)}}async function T(e,r,t){const n=function(){if(S.length<3){const r=e();return S.push(r),r}{const e=S[k];return k=(k+1)%S.length,e}function e(){const e=new E;let r=0,t={};return e.onmessage=({data:e})=>{var r,n;"callback"===e.evtType?null==(r=t[e.cbId])||r.resolve(e.returnVal):"throwError"===e.evtType&&(null==(n=t[e.cbId])||n.reject(Error(e.errMsg))),delete t[e.cbId]},async function(n,a,i=[]){r+=1;const o=new Promise((e,n)=>{t[r]={resolve:e,reject:n}});return e.postMessage({cbId:r,evtType:n,args:a},i),o}}}();return await n("register",{fileId:e,filePath:r,mode:t}),{read:async(r,t)=>await n("read",{fileId:e,offset:r,size:t}),write:async(r,t)=>await n("write",{fileId:e,data:r,opts:t},[ArrayBuffer.isView(r)?r.buffer:r]),close:async()=>await n("close",{fileId:e}),truncate:async r=>await n("truncate",{fileId:e,newSize:r}),getSize:async()=>await n("getSize",{fileId:e}),flush:async()=>await n("flush",{fileId:e})}}const S=[];let k=0;function A(e){if("/"===e)return{parent:null,name:""};const r=e.split("/").filter(e=>e.length>0);if(0===r.length)throw Error("Invalid path");return{name:r[r.length-1],parent:"/"+r.slice(0,-1).join("/")}}async function O(e,r){const{parent:t,name:n}=A(e);if(null==t)return await navigator.storage.getDirectory();const a=t.split("/").filter(e=>e.length>0);try{let e=await navigator.storage.getDirectory();for(const t of a)e=await e.getDirectoryHandle(t,{create:r.create});return r.isFile?await e.getFileHandle(n,{create:r.create}):await e.getDirectoryHandle(n,{create:r.create})}catch(e){if("NotFoundError"===e.name)return null;throw e}}async function F(e){const{parent:r,name:t}=A(e);if(null==r){const e=await navigator.storage.getDirectory();for await(const r of e.keys())await e.removeEntry(r,{recursive:!0});return}const n=await O(r,{create:!1,isFile:!1});if(null!=n)try{await n.removeEntry(t,{recursive:!0})}catch(e){if("NotFoundError"===e.name)return;throw e}}function R(e,r){return`${e}/${r}`.replace("//","/")}function x(e){return new W(e)}r=new WeakMap,t=new WeakMap,n=new WeakMap;let W=class e{constructor(e){p(this,r),p(this,t),p(this,n),m(this,r,e);const{parent:a,name:i}=A(e);m(this,t,i),m(this,n,a)}get kind(){return"dir"}get name(){return w(this,t)}get path(){return w(this,r)}get parent(){return null==w(this,n)?null:x(w(this,n))}async create(){return await O(w(this,r),{create:!0,isFile:!1}),x(w(this,r))}async exists(){return await O(w(this,r),{create:!1,isFile:!1})instanceof FileSystemDirectoryHandle}async remove(e={}){for(const r of await this.children())try{await r.remove(e)}catch(e){console.warn(e)}try{await F(w(this,r))}catch(e){console.warn(e)}}async children(){const e=await O(w(this,r),{create:!1,isFile:!1});if(null==e)return[];const t=[];for await(const n of e.values())t.push(("file"===n.kind?L:x)(R(w(this,r),n.name)));return t}async copyTo(r){if(!await this.exists())throw Error(`dir ${this.path} not exists`);if(r instanceof e){const e=await r.exists()?x(R(r.path,this.name)):r;return await e.create(),await Promise.all((await this.children()).map(r=>r.copyTo(e))),e}if(r instanceof FileSystemDirectoryHandle)return await Promise.all((await this.children()).map(async e=>{"file"===e.kind?await e.copyTo(await r.getFileHandle(e.name,{create:!0})):await e.copyTo(await r.getDirectoryHandle(e.name,{create:!0}))})),null;throw Error("Illegal target type")}async moveTo(e){const r=await this.copyTo(e);return await this.remove(),r}};const Z=new Map;function L(e,r="rw"){if("rw"===r){const t=Z.get(e)??new z(e,r);return Z.set(e,t),t}return new z(e,r)}async function P(e,r,t={overwrite:!0}){if(r instanceof z)return void await P(e,await r.stream(),t);const n=await(e instanceof z?e:L(e,"rw")).createWriter();try{if(t.overwrite&&await n.truncate(0),r instanceof ReadableStream){const e=r.getReader();for(;;){const{done:r,value:t}=await e.read();if(r)break;await n.write(t)}}else await n.write(r)}catch(e){throw e}finally{await n.close()}}let I=0;a=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,f=new WeakMap,y=new WeakMap;let z=class e{constructor(e,r){p(this,a),p(this,i),p(this,o),p(this,s),p(this,c),p(this,l,0),p(this,u,async()=>{}),p(this,f,(()=>{let e=null;return()=>(m(this,l,w(this,l)+1),null!=e||(e=new Promise(async(r,t)=>{try{const t=await T(w(this,c),w(this,a),w(this,s));m(this,u,async()=>{null!=e&&(e=null,m(this,l,0),await t.close().catch(console.error))}),r([t,async()=>{m(this,l,w(this,l)-1),!(w(this,l)>0)&&(e=null,await t.close())}])}catch(e){t(e)}})),e)})()),p(this,y,!1),m(this,c,++I),m(this,a,e),m(this,s,{r:"read-only",rw:"readwrite","rw-unsafe":"readwrite-unsafe"}[r]);const{parent:t,name:n}=A(e);if(null==t)throw Error("Invalid path");m(this,o,n),m(this,i,t)}get kind(){return"file"}get path(){return w(this,a)}get name(){return w(this,o)}get parent(){return null==w(this,i)?null:x(w(this,i))}async createWriter(){if("read-only"===w(this,s))throw Error("file is read-only");if(w(this,y))throw Error("Other writer have not been closed");m(this,y,!0);try{const e=new TextEncoder,[r,t]=await w(this,f).call(this);let n=await r.getSize(),a=!1;return{write:async(t,i={})=>{if(a)throw Error("Writer is closed");const o="string"==typeof t?e.encode(t):t,s=i.at??n,c=o.byteLength;return n=s+c,await r.write(o,{at:s})},truncate:async e=>{if(a)throw Error("Writer is closed");await r.truncate(e),n>e&&(n=e)},flush:async()=>{if(a)throw Error("Writer is closed");await r.flush()},close:async()=>{if(a)throw Error("Writer is closed");a=!0,m(this,y,!1),await t()}}}catch(e){throw m(this,y,!1),e}}async createReader(){const[e,r]=await w(this,f).call(this);let t=!1,n=0;return{read:async(r,a={})=>{if(t)throw Error("Reader is closed");const i=a.at??n,o=await e.read(i,r);return n=i+o.byteLength,o},getSize:async()=>{if(t)throw Error("Reader is closed");return await e.getSize()},close:async()=>{t||(t=!0,await r())}}}async text(){return(new TextDecoder).decode(await this.arrayBuffer())}async arrayBuffer(){const e=await O(w(this,a),{create:!1,isFile:!0});return null==e?new ArrayBuffer(0):(await e.getFile()).arrayBuffer()}async stream(){const e=await this.getOriginFile();return null==e?new ReadableStream({pull:e=>{e.close()}}):e.stream()}async getOriginFile(){var e;return null==(e=await O(w(this,a),{create:!1,isFile:!0}))?void 0:e.getFile()}async getSize(){const e=await O(w(this,a),{create:!1,isFile:!0});return null==e?0:(await e.getFile()).size}async exists(){return await O(w(this,a),{create:!1,isFile:!0})instanceof FileSystemFileHandle}async remove(e={}){if(!0===e.force)return await w(this,u).call(this),await F(w(this,a)),void Z.delete(w(this,a));if(w(this,l)>0)throw Error("exists unclosed reader/writer");await F(w(this,a))}async copyTo(r){if(r instanceof e)return r.path===this.path?this:(await P(r,this),r);if(r instanceof W){if(!await this.exists())throw Error(`file ${this.path} not exists`);return await this.copyTo(L(R(r.path,this.name)))}if(r instanceof FileSystemFileHandle)return await(await this.stream()).pipeTo(await r.createWritable()),null;throw Error("Illegal target type")}async moveTo(e){const r=await this.copyTo(e);return await this.remove(),r}};const U="/.opfs-tools-temp-dir";async function Y(e){try{if("file"===e.kind){if(!await e.exists())return!0;const r=await e.createWriter();await r.truncate(0),await r.close(),await e.remove()}else await e.remove();return!0}catch(e){return console.warn(e),!1}}const C=[];let D=!1;(async function(){var e;!0!==globalThis.__opfs_tools_tmpfile_init__&&(globalThis.__opfs_tools_tmpfile_init__=!0,null!=globalThis.FileSystemDirectoryHandle&&null!=globalThis.FileSystemFileHandle&&null!=(null==(e=globalThis.navigator)?void 0:e.storage.getDirectory)&&(setInterval(async()=>{for(const e of await x(U).children()){const r=/^\d+-(\d+)$/.exec(e.name);(null==r||Date.now()-Number(r[1])>2592e5)&&await Y(e)}},6e4),await async function(){if(null==globalThis.localStorage)return;const e="OPFS_TOOLS_EXPIRES_TMP_FILES";D||(D=!0,globalThis.addEventListener("unload",()=>{0!==C.length&&localStorage.setItem(e,`${localStorage.getItem(e)??""},${C.join(",")}`)}));let r=localStorage.getItem(e)??"";for(const e of r.split(","))0!==e.length&&await Y(L(`${U}/${e}`))&&(r=r.replace(e,""));localStorage.setItem(e,r.replace(/,{2,}/g,","))}()))})(),e.dir=x,e.file=L,e.rollfile=function(e,r){let t=L(e),n=0,a=t.createWriter(),i=t.createReader();return{append:async e=>{const t=await a;n+=await t.write(e),n>=r&&await(async e=>{const r=await(await i).read(n,{at:Math.round(.3*n)});n=await e.write(r,{at:0}),await e.truncate(n)})(t)},text:t.text.bind(t),remove:async()=>{await(await i).close(),await(await a).close(),await t.remove()},getSize:async()=>n}},e.tmpfile=function(){const e=`${Math.random().toString().slice(2)}-${Date.now()}`;return C.push(e),L(`${U}/${e}`)},e.write=P,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}(r)},744(e,r,t){"use strict";t.r(r),t.d(r,{ABORT_ERROR:()=>O,CURRENT_DIR:()=>Je,NOT_FOUND_ERROR:()=>_e,ROOT_DIR:()=>He,TIMEOUT_ERROR:()=>F,TMP_DIR:()=>Ke,appendFile:()=>Ar,appendFileSync:()=>gt,assertAbsolutePath:()=>Qe,assertFileUrl:()=>qe,connectSyncAgent:()=>it,copy:()=>Or,copySync:()=>vt,createFile:()=>wr,createFileSync:()=>lt,deleteTemp:()=>Ir,deleteTempSync:()=>Tt,downloadFile:()=>Tr,emptyDir:()=>Fr,emptyDirSync:()=>bt,exists:()=>Rr,existsSync:()=>Et,generateTempPath:()=>cr,getFileDataByHandle:()=>dr,getSyncMessenger:()=>ot,isDirectoryHandle:()=>yr,isFileHandle:()=>fr,isFileHandleLike:()=>hr,isOPFSSupported:()=>Xr,isTempPath:()=>lr,mkTemp:()=>Pr,mkTempSync:()=>St,mkdir:()=>pr,mkdirSync:()=>ut,move:()=>xr,moveSync:()=>ft,pruneTemp:()=>zr,pruneTempSync:()=>kt,readBlobFile:()=>Wr,readBlobFileSync:()=>At,readDir:()=>mr,readDirSync:()=>yt,readFile:()=>gr,readFileSync:()=>ht,readJsonFile:()=>Zr,readJsonFileSync:()=>Ot,readTextFile:()=>Lr,readTextFileSync:()=>Ft,remove:()=>vr,removeSync:()=>dt,setSyncMessenger:()=>st,startSyncAgent:()=>at,stat:()=>br,statSync:()=>wt,toFileSystemHandleLike:()=>ur,unzip:()=>Yr,unzipFromUrl:()=>Cr,unzipSync:()=>Rt,uploadFile:()=>Dr,writeFile:()=>Er,writeFileSync:()=>mt,zip:()=>jr,zipFromUrl:()=>Gr,zipSync:()=>xt});function n(e,r){if(!e)throw new Error("Invariant failed")}function a(e){if("string"!=typeof e)throw new TypeError(`Path must be a string, received "${JSON.stringify(e)}"`)}function i(e,r){if(e.length<=1)return e;let t=e.length;for(let n=e.length-1;n>0&&r(e.charCodeAt(n));n--)t=n;return e.slice(0,t)}function o(e){return 47===e}function s(e){return e=function(e){if("file:"!==(e=e instanceof URL?e:new URL(e)).protocol)throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function c(e){e instanceof URL&&(e=s(e)),function(e){a(e),e.length}(e);let r=-1,t=!1;for(let n=e.length-1;n>=1;--n)if(o(e.charCodeAt(n))){if(t){r=n;break}}else t=!0;return-1===r?o(e.charCodeAt(0))?"/":".":i(e.slice(0,r),o)}function l(e,r=""){e instanceof URL&&(e=s(e)),function(e,r){if(a(e),0===e.length)return e;if("string"!=typeof r)throw new TypeError(`Suffix must be a string, received "${JSON.stringify(r)}"`)}(e,r);const t=function(e,r,t=0){let n=!1,a=e.length;for(let i=e.length-1;i>=t;--i)if(r(e.charCodeAt(i))){if(n){t=i+1;break}}else n||(n=!0,a=i+1);return e.slice(t,a)}(e,o),n=i(t,o);return r?function(e,r){if(r.length>=e.length)return e;const t=e.length-r.length;for(let n=r.length-1;n>=0;--n)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return e;return e.slice(0,-r.length)}(n,r):n}function u(e,...r){if(void 0===e)return".";e instanceof URL&&(e=s(e)),(r=e?[e,...r]:r).forEach(e=>a(e));const t=r.filter(e=>e.length>0).join("/");return""===t?".":function(e){e instanceof URL&&(e=s(e)),function(e){a(e),e.length}(e);const r=o(e.charCodeAt(0)),t=o(e.charCodeAt(e.length-1));return e=function(e,r,t,n){let a,i="",o=0,s=-1,c=0;for(let l=0;l<=e.length;++l){if(l<e.length)a=e.charCodeAt(l);else{if(n(a))break;a=47}if(n(a)){if(s===l-1||1===c);else if(s!==l-1&&2===c){if(i.length<2||2!==o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2)){if(i.length>2){const e=i.lastIndexOf(t);-1===e?(i="",o=0):(i=i.slice(0,e),o=i.length-1-i.lastIndexOf(t)),s=l,c=0;continue}if(2===i.length||1===i.length){i="",o=0,s=l,c=0;continue}}r&&(i.length>0?i+=`${t}..`:i="..",o=2)}else i.length>0?i+=t+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,c=0}else 46===a&&-1!==c?++c:c=-1}return i}(e,!r,"/",o),0!==e.length||r||(e="."),e.length>0&&t&&(e+="/"),r?`/${e}`:e}(t)}function f(e){e instanceof URL&&(e=s(e)),a(e);let r=-1,t=0,n=-1,i=!0,c=0;for(let a=e.length-1;a>=0;--a){const s=e.charCodeAt(a);if(o(s)){if(!i){t=a+1;break}}else-1===n&&(i=!1,n=a+1),46===s?-1===r?r=a:1!==c&&(c=1):-1!==r&&(c=-1)}return-1===r||-1===n||0===c||1===c&&r===n-1&&r===t+1?"":e.slice(r,n)}const y=Symbol("Option kind"),h=Symbol("Result kind"),d=Promise.resolve(!0),w=Promise.resolve(!1);function p(e){const r=Object.freeze({[Symbol.toStringTag]:"Option",[y]:"Some",*[Symbol.iterator](){yield e},toString:()=>`Some(${e})`,isSome:()=>!0,isNone:()=>!1,isSomeAnd:r=>r(e),isSomeAndAsync:r=>Promise.resolve(r(e)),isNoneOr:r=>r(e),isNoneOrAsync:r=>Promise.resolve(r(e)),expect:r=>e,unwrap:()=>e,unwrapOr:r=>e,unwrapOrElse:r=>e,unwrapOrElseAsync:r=>Promise.resolve(e),okOr:r=>v(e),okOrElse:r=>v(e),transpose:()=>(S(e),e.isOk()?v(p(e.unwrap())):b(e.unwrapErr())),filter:t=>t(e)?r:m,flatten:()=>(T(e),e),map:r=>p(r(e)),mapOr:(r,t)=>t(e),mapOrElse:(r,t)=>t(e),zip:r=>(T(r),r.isSome()?p([e,r.unwrap()]):m),zipWith:(r,t)=>(T(r),r.isSome()?p(t(e,r.unwrap())):m),unzip(){const r=e;if(!Array.isArray(r)||2!==r.length)throw new TypeError("Option::unzip() requires a 2-element tuple, received "+(Array.isArray(r)?`array with ${r.length} elements`:typeof r));const[t,n]=r;return[p(t),p(n)]},reduce:(t,n)=>(T(t),t.isSome()?p(n(e,t.unwrap())):r),and:e=>(T(e),e),andThen:r=>r(e),andThenAsync:r=>Promise.resolve(r(e)),or:e=>r,orElse:e=>r,orElseAsync:e=>Promise.resolve(r),xor:e=>(T(e),e.isSome()?m:r),inspect:t=>(t(e),r),eq:r=>(T(r),r.isSome()&&r.unwrap()===e)});return r}const m=Object.freeze({[Symbol.toStringTag]:"Option",[y]:"None",*[Symbol.iterator](){},toString:()=>"None",isSome:()=>!1,isNone:()=>!0,isSomeAnd:e=>!1,isSomeAndAsync:e=>w,isNoneOr:e=>!0,isNoneOrAsync:e=>d,expect(e){throw new TypeError(e)},unwrap(){throw new TypeError("Option::unwrap() called on a `None` value")},unwrapOr:e=>e,unwrapOrElse:e=>e(),unwrapOrElseAsync:e=>Promise.resolve(e()),okOr:e=>b(e),okOrElse:e=>b(e()),transpose:()=>v(m),filter:e=>m,flatten:()=>m,map:e=>m,mapOr:(e,r)=>e,mapOrElse:(e,r)=>e(),zip:e=>m,zipWith:(e,r)=>m,unzip:()=>[m,m],reduce:(e,r)=>(T(e),e),and:e=>m,andThen:e=>m,andThenAsync:e=>g,or:e=>(T(e),e),orElse:e=>e(),orElseAsync:e=>Promise.resolve(e()),xor:e=>(T(e),e.isSome()?e:m),inspect:e=>m,eq:e=>(T(e),e===m)}),g=Promise.resolve(m);function v(e){const r=Object.freeze({[Symbol.toStringTag]:"Result",[h]:"Ok",*[Symbol.iterator](){yield e},toString:()=>`Ok(${e})`,isOk:()=>!0,isErr:()=>!1,isOkAnd:r=>r(e),isOkAndAsync:r=>Promise.resolve(r(e)),isErrAnd:e=>!1,isErrAndAsync:e=>w,expect:r=>e,unwrap:()=>e,unwrapOr:r=>e,unwrapOrElse:r=>e,unwrapOrElseAsync:r=>Promise.resolve(e),expectErr(r){throw new TypeError(`${r}: ${e}`)},unwrapErr(){throw new TypeError("Result::unwrapErr() called on an `Ok` value")},intoOk:()=>e,intoErr(){throw new TypeError("Result::intoErr() called on an `Ok` value")},ok:()=>p(e),err:()=>m,transpose:()=>(T(e),e.isSome()?p(v(e.unwrap())):m),map:r=>v(r(e)),mapErr:e=>r,mapOr:(r,t)=>t(e),mapOrElse:(r,t)=>t(e),flatten:()=>(S(e),e),and:e=>(S(e),e),or:e=>r,andThen:r=>r(e),andThenAsync:r=>Promise.resolve(r(e)),orElse:e=>r,orElseAsync:e=>Promise.resolve(r),inspect:t=>(t(e),r),inspectErr:e=>r,eq:r=>(S(r),r.isOk()&&r.unwrap()===e),asOk:()=>r,asErr(){throw new TypeError("Result::asErr() called on an `Ok` value")},andTryAsync(r){try{const t=r(e);return Promise.resolve(t).then(v,b)}catch(e){return Promise.resolve(b(e))}},orTryAsync:e=>Promise.resolve(r)});return r}function b(e){const r=Object.freeze({[Symbol.toStringTag]:"Result",[h]:"Err",*[Symbol.iterator](){},toString:()=>`Err(${e})`,isOk:()=>!1,isErr:()=>!0,isOkAnd:e=>!1,isOkAndAsync:e=>w,isErrAnd:r=>r(e),isErrAndAsync:r=>Promise.resolve(r(e)),expect(r){throw new TypeError(`${r}: ${e}`)},unwrap(){throw new TypeError("Result::unwrap() called on an `Err` value")},unwrapOr:e=>e,unwrapOrElse:r=>r(e),unwrapOrElseAsync:r=>Promise.resolve(r(e)),expectErr:r=>e,unwrapErr:()=>e,intoOk(){throw new TypeError("Result::intoOk() called on an `Err` value")},intoErr:()=>e,ok:()=>m,err:()=>p(e),transpose:()=>p(r),map:e=>r,mapErr:r=>b(r(e)),mapOr:(e,r)=>e,mapOrElse:(r,t)=>r(e),flatten:()=>r,and:e=>r,or:e=>(S(e),e),andThen:e=>r,andThenAsync:e=>Promise.resolve(r),orElse:r=>r(e),orElseAsync:r=>Promise.resolve(r(e)),inspect:e=>r,inspectErr:t=>(t(e),r),eq:r=>(S(r),r.isErr()&&r.unwrapErr()===e),asOk(){throw new TypeError("Result::asOk() called on an `Err` value")},asErr:()=>r,andTryAsync:e=>Promise.resolve(r),orTryAsync(r){try{const t=r(e);return Promise.resolve(t).then(v,b)}catch(e){return Promise.resolve(b(e))}}});return r}function E(e){try{return null===e?"null":void 0===e?"undefined":"object"==typeof e?Object.prototype.toString.call(e):String(e)}catch{return"[unable to stringify]"}}function T(e){if(!function(e){return null!=e&&"object"==typeof e&&y in e}(e))throw new TypeError(`Expected an Option, but received: ${E(e)}`)}function S(e){if(!function(e){return null!=e&&"object"==typeof e&&h in e}(e))throw new TypeError(`Expected a Result, but received: ${E(e)}`)}const k=v(!1),A=v(),O="AbortError",F="TimeoutError";var R=class extends Error{name="FetchError";status;constructor(e,r){super(e),this.status=r}};function x(e,r){const t=function(e){if(e instanceof URL)return e;try{return new URL(e,"undefined"!=typeof location?location.href:void 0)}catch{throw new TypeError(`Invalid URL: ${e}`)}}(e),n=r??{},{retries:a,delay:i,when:o,onRetry:s}=function(e){const{responseType:r,timeout:t,retry:n=0,onProgress:a,onChunk:i}=e;if(null!=r){const e=["text","arraybuffer","blob","json","bytes","stream"];if(!e.includes(r))throw new TypeError(`responseType must be one of ${e.join(", ")} but received ${r}`)}if(null!=t){if("number"!=typeof t)throw new TypeError("timeout must be a number but received "+typeof t);if(t<=0)throw new Error(`timeout must be a number greater than 0 but received ${t}`)}if(null!=a&&"function"!=typeof a)throw new TypeError("onProgress callback must be a function but received "+typeof a);if(null!=i&&"function"!=typeof i)throw new TypeError("onChunk callback must be a function but received "+typeof i);let o,s,c=0,l=0;if("number"==typeof n?c=n:n&&"object"==typeof n&&(c=n.retries??0,l=n.delay??0,o=n.when,s=n.onRetry),!Number.isInteger(c))throw new TypeError(`Retry count must be an integer but received ${c}`);if(c<0)throw new Error(`Retry count must be non-negative but received ${c}`);if("number"==typeof l){if(l<0)throw new Error(`Retry delay must be a non-negative number but received ${l}`)}else if("function"!=typeof l)throw new TypeError("Retry delay must be a number or a function but received "+typeof l);if(null!=o&&!Array.isArray(o)&&"function"!=typeof o)throw new TypeError("Retry when condition must be an array of status codes or a function but received "+typeof o);if(null!=s&&"function"!=typeof s)throw new TypeError("Retry onRetry callback must be a function but received "+typeof s);return{retries:c,delay:l,when:o,onRetry:s}}(n),{abortable:c=!1,responseType:l,timeout:u,onProgress:f,onChunk:y,...h}=n,d=h.signal;let w;c&&(w=new AbortController);const p=(e,r)=>"AbortError"!==e.name&&(o?Array.isArray(o)?e instanceof R&&o.includes(e.status):o(e,r):!(e instanceof R)),m=e=>"function"==typeof i?i(e):i,g=()=>{const e=[];d&&e.push(d),w&&e.push(w.signal),"number"==typeof u&&e.push(function(e){if("function"==typeof AbortSignal.timeout)return AbortSignal.timeout(e);const r=new AbortController,t=function(){const e="The operation timed out.";try{return new DOMException(e,F)}catch{const r=new Error(e);return r.name=F,r}}(),n=setTimeout(()=>{r.abort(t)},e);return"function"==typeof n?.unref&&n.unref(),r.signal}(u)),e.length>0&&(h.signal=1===e.length?e[0]:function(e){if("function"==typeof AbortSignal.any)return AbortSignal.any(e);const r=new AbortController;for(const t of e)if(t.aborted)return r.abort(t.reason),r.signal;const t=e=>{r.abort(e.target.reason)};for(const r of e)r.addEventListener("abort",t);return r.signal.addEventListener("abort",()=>{for(const r of e)r.removeEventListener("abort",t)}),r.signal}(e))},E=async()=>{g();try{const e=await fetch(t,h);return e.ok?await T(e):(e.body?.cancel().catch(()=>{}),b(new R(e.statusText,e.status)))}catch(e){return b(e instanceof Error?e:Z(e))}},T=async e=>{switch(e.body&&(f||y)&&(async e=>{let r,t=0;if(f){const t=e.headers.get("content-length");if(null==t)try{f(b(new Error("No content-length in response headers")))}catch{}else r=Number.parseInt(t,10)}const n=e.clone().body;try{for await(const e of n){if(y)try{y(e)}catch{}if(f&&null!=r){t+=e.byteLength;try{f(v({totalByteLength:r,completedByteLength:t}))}catch{}}}}catch{}})(e),l){case"json":if(null==e.body)return v(null);try{return v(await e.json())}catch{return b(new Error("Response is invalid json while responseType is json"))}case"text":return v(await e.text());case"bytes":return"function"==typeof e.bytes?v(await e.bytes()):v(new Uint8Array(await e.arrayBuffer()));case"arraybuffer":return v(await e.arrayBuffer());case"blob":return v(await e.blob());case"stream":return v(e.body);default:return v(e)}},S=(async()=>{let e,r=0;do{if(r>0){if(w?.signal.aborted)return b(w.signal.reason);const t=m(r);if(t>0&&(await W(t),w?.signal.aborted))return b(w.signal.reason);try{s?.(e,r)}catch{}}const t=await E();if(t.isOk())return t;e=t.unwrapErr(),r++}while(r<=a&&p(e,r));return b(e)})();return c&&w?{abort(e){e instanceof Error?w.abort(e):null!=e?w.abort(Z(e)):w.abort()},get aborted(){return w.signal.aborted},get result(){return S}}:S}function W(e){return new Promise(r=>setTimeout(r,e))}function Z(e){const r=new Error("string"==typeof e?e:String(e));return r.name=O,r.cause=e,r}var L={},P=Uint8Array,I=Uint16Array,z=Int32Array,U=new P([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Y=new P([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),C=new P([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),D=function(e,r){for(var t=new I(31),n=0;n<31;++n)t[n]=r+=1<<e[n-1];var a=new z(t[30]);for(n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)a[i]=i-t[n]<<5|n;return{b:t,r:a}},M=D(U,2),j=M.b,G=M.r;j[28]=258,G[258]=28;for(var X=D(Y,0),N=X.b,$=X.r,B=new I(32768),V=0;V<32768;++V){var _=(43690&V)>>1|(21845&V)<<1;_=(61680&(_=(52428&_)>>2|(13107&_)<<2))>>4|(3855&_)<<4,B[V]=((65280&_)>>8|(255&_)<<8)>>1}var H=function(e,r,t){for(var n=e.length,a=0,i=new I(r);a<n;++a)e[a]&&++i[e[a]-1];var o,s=new I(r);for(a=1;a<r;++a)s[a]=s[a-1]+i[a-1]<<1;if(t){o=new I(1<<r);var c=15-r;for(a=0;a<n;++a)if(e[a])for(var l=a<<4|e[a],u=r-e[a],f=s[e[a]-1]++<<u,y=f|(1<<u)-1;f<=y;++f)o[B[f]>>c]=l}else for(o=new I(n),a=0;a<n;++a)e[a]&&(o[a]=B[s[e[a]-1]++]>>15-e[a]);return o},J=new P(288);for(V=0;V<144;++V)J[V]=8;for(V=144;V<256;++V)J[V]=9;for(V=256;V<280;++V)J[V]=7;for(V=280;V<288;++V)J[V]=8;var K=new P(32);for(V=0;V<32;++V)K[V]=5;var Q=H(J,9,0),q=H(J,9,1),ee=H(K,5,0),re=H(K,5,1),te=function(e){for(var r=e[0],t=1;t<e.length;++t)e[t]>r&&(r=e[t]);return r},ne=function(e,r,t){var n=r/8|0;return(e[n]|e[n+1]<<8)>>(7&r)&t},ae=function(e,r){var t=r/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(7&r)},ie=function(e){return(e+7)/8|0},oe=function(e,r,t){return(null==r||r<0)&&(r=0),(null==t||t>e.length)&&(t=e.length),new P(e.subarray(r,t))},se=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ce=function(e,r,t){var n=new Error(r||se[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,ce),!t)throw n;return n},le=function(e,r,t,n){var a=e.length,i=n?n.length:0;if(!a||r.f&&!r.l)return t||new P(0);var o=!t,s=o||2!=r.i,c=r.i;o&&(t=new P(3*a));var l=function(e){var r=t.length;if(e>r){var n=new P(Math.max(2*r,e));n.set(t),t=n}},u=r.f||0,f=r.p||0,y=r.b||0,h=r.l,d=r.d,w=r.m,p=r.n,m=8*a;do{if(!h){u=ne(e,f,1);var g=ne(e,f+1,3);if(f+=3,!g){var v=e[(W=ie(f)+4)-4]|e[W-3]<<8,b=W+v;if(b>a){c&&ce(0);break}s&&l(y+v),t.set(e.subarray(W,b),y),r.b=y+=v,r.p=f=8*b,r.f=u;continue}if(1==g)h=q,d=re,w=9,p=5;else if(2==g){var E=ne(e,f,31)+257,T=ne(e,f+10,15)+4,S=E+ne(e,f+5,31)+1;f+=14;for(var k=new P(S),A=new P(19),O=0;O<T;++O)A[C[O]]=ne(e,f+3*O,7);f+=3*T;var F=te(A),R=(1<<F)-1,x=H(A,F,1);for(O=0;O<S;){var W,Z=x[ne(e,f,R)];if(f+=15&Z,(W=Z>>4)<16)k[O++]=W;else{var L=0,I=0;for(16==W?(I=3+ne(e,f,3),f+=2,L=k[O-1]):17==W?(I=3+ne(e,f,7),f+=3):18==W&&(I=11+ne(e,f,127),f+=7);I--;)k[O++]=L}}var z=k.subarray(0,E),D=k.subarray(E);w=te(z),p=te(D),h=H(z,w,1),d=H(D,p,1)}else ce(1);if(f>m){c&&ce(0);break}}s&&l(y+131072);for(var M=(1<<w)-1,G=(1<<p)-1,X=f;;X=f){var $=(L=h[ae(e,f)&M])>>4;if((f+=15&L)>m){c&&ce(0);break}if(L||ce(2),$<256)t[y++]=$;else{if(256==$){X=f,h=null;break}var B=$-254;if($>264){var V=U[O=$-257];B=ne(e,f,(1<<V)-1)+j[O],f+=V}var _=d[ae(e,f)&G],J=_>>4;if(_||ce(3),f+=15&_,D=N[J],J>3&&(V=Y[J],D+=ae(e,f)&(1<<V)-1,f+=V),f>m){c&&ce(0);break}s&&l(y+131072);var K=y+B;if(y<D){var Q=i-D,ee=Math.min(D,K);for(Q+y<0&&ce(3);y<ee;++y)t[y]=n[Q+y]}for(;y<K;++y)t[y]=t[y-D]}}r.l=h,r.p=X,r.b=y,r.f=u,h&&(u=1,r.m=w,r.d=d,r.n=p)}while(!u);return y!=t.length&&o?oe(t,0,y):t.subarray(0,y)},ue=function(e,r,t){t<<=7&r;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8},fe=function(e,r,t){t<<=7&r;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8,e[n+2]|=t>>16},ye=function(e,r){for(var t=[],n=0;n<e.length;++n)e[n]&&t.push({s:n,f:e[n]});var a=t.length,i=t.slice();if(!a)return{t:ve,l:0};if(1==a){var o=new P(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(e,r){return e.f-r.f}),t.push({s:-1,f:25001});var s=t[0],c=t[1],l=0,u=1,f=2;for(t[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=a-1;)s=t[t[l].f<t[f].f?l++:f++],c=t[l!=u&&t[l].f<t[f].f?l++:f++],t[u++]={s:-1,f:s.f+c.f,l:s,r:c};var y=i[0].s;for(n=1;n<a;++n)i[n].s>y&&(y=i[n].s);var h=new I(y+1),d=he(t[u-1],h,0);if(d>r){n=0;var w=0,p=d-r,m=1<<p;for(i.sort(function(e,r){return h[r.s]-h[e.s]||e.f-r.f});n<a;++n){var g=i[n].s;if(!(h[g]>r))break;w+=m-(1<<d-h[g]),h[g]=r}for(w>>=p;w>0;){var v=i[n].s;h[v]<r?w-=1<<r-h[v]++-1:++n}for(;n>=0&&w;--n){var b=i[n].s;h[b]==r&&(--h[b],++w)}d=r}return{t:new P(h),l:d}},he=function(e,r,t){return-1==e.s?Math.max(he(e.l,r,t+1),he(e.r,r,t+1)):r[e.s]=t},de=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new I(++r),n=0,a=e[0],i=1,o=function(e){t[n++]=e},s=1;s<=r;++s)if(e[s]==a&&s!=r)++i;else{if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(a);i=1,a=e[s]}return{c:t.subarray(0,n),n:r}},we=function(e,r){for(var t=0,n=0;n<r.length;++n)t+=e[n]*r[n];return t},pe=function(e,r,t){var n=t.length,a=ie(r+2);e[a]=255&n,e[a+1]=n>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var i=0;i<n;++i)e[a+i+4]=t[i];return 8*(a+4+n)},me=function(e,r,t,n,a,i,o,s,c,l,u){ue(r,u++,t),++a[256];for(var f=ye(a,15),y=f.t,h=f.l,d=ye(i,15),w=d.t,p=d.l,m=de(y),g=m.c,v=m.n,b=de(w),E=b.c,T=b.n,S=new I(19),k=0;k<g.length;++k)++S[31&g[k]];for(k=0;k<E.length;++k)++S[31&E[k]];for(var A=ye(S,7),O=A.t,F=A.l,R=19;R>4&&!O[C[R-1]];--R);var x,W,Z,L,P=l+5<<3,z=we(a,J)+we(i,K)+o,D=we(a,y)+we(i,w)+o+14+3*R+we(S,O)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&P<=z&&P<=D)return pe(r,u,e.subarray(c,c+l));if(ue(r,u,1+(D<z)),u+=2,D<z){x=H(y,h,0),W=y,Z=H(w,p,0),L=w;var M=H(O,F,0);for(ue(r,u,v-257),ue(r,u+5,T-1),ue(r,u+10,R-4),u+=14,k=0;k<R;++k)ue(r,u+3*k,O[C[k]]);u+=3*R;for(var j=[g,E],G=0;G<2;++G){var X=j[G];for(k=0;k<X.length;++k){var N=31&X[k];ue(r,u,M[N]),u+=O[N],N>15&&(ue(r,u,X[k]>>5&127),u+=X[k]>>12)}}}else x=Q,W=J,Z=ee,L=K;for(k=0;k<s;++k){var $=n[k];if($>255){fe(r,u,x[257+(N=$>>18&31)]),u+=W[N+257],N>7&&(ue(r,u,$>>23&31),u+=U[N]);var B=31&$;fe(r,u,Z[B]),u+=L[B],B>3&&(fe(r,u,$>>5&8191),u+=Y[B])}else fe(r,u,x[$]),u+=W[$]}return fe(r,u,x[256]),u+W[256]},ge=new z([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ve=new P(0),be=function(e,r,t,n,a,i){var o=i.z||e.length,s=new P(n+o+5*(1+Math.ceil(o/7e3))+a),c=s.subarray(n,s.length-a),l=i.l,u=7&(i.r||0);if(r){u&&(c[0]=i.r>>3);for(var f=ge[r-1],y=f>>13,h=8191&f,d=(1<<t)-1,w=i.p||new I(32768),p=i.h||new I(d+1),m=Math.ceil(t/3),g=2*m,v=function(r){return(e[r]^e[r+1]<<m^e[r+2]<<g)&d},b=new z(25e3),E=new I(288),T=new I(32),S=0,k=0,A=i.i||0,O=0,F=i.w||0,R=0;A+2<o;++A){var x=v(A),W=32767&A,Z=p[x];if(w[W]=Z,p[x]=W,F<=A){var L=o-A;if((S>7e3||O>24576)&&(L>423||!l)){u=me(e,c,0,b,E,T,k,O,R,A-R,u),O=S=k=0,R=A;for(var C=0;C<286;++C)E[C]=0;for(C=0;C<30;++C)T[C]=0}var D=2,M=0,j=h,X=W-Z&32767;if(L>2&&x==v(A-X))for(var N=Math.min(y,L)-1,B=Math.min(32767,A),V=Math.min(258,L);X<=B&&--j&&W!=Z;){if(e[A+D]==e[A+D-X]){for(var _=0;_<V&&e[A+_]==e[A+_-X];++_);if(_>D){if(D=_,M=X,_>N)break;var H=Math.min(X,_-2),J=0;for(C=0;C<H;++C){var K=A-X+C&32767,Q=K-w[K]&32767;Q>J&&(J=Q,Z=K)}}}X+=(W=Z)-(Z=w[W])&32767}if(M){b[O++]=268435456|G[D]<<18|$[M];var q=31&G[D],ee=31&$[M];k+=U[q]+Y[ee],++E[257+q],++T[ee],F=A+D,++S}else b[O++]=e[A],++E[e[A]]}}for(A=Math.max(A,F);A<o;++A)b[O++]=e[A],++E[e[A]];u=me(e,c,l,b,E,T,k,O,R,A-R,u),l||(i.r=7&u|c[u/8|0]<<3,u-=7,i.h=p,i.p=w,i.i=A,i.w=F)}else{for(A=i.w||0;A<o+l;A+=65535){var re=A+65535;re>=o&&(c[u/8|0]=l,re=o),u=pe(c,u+1,e.subarray(A,re))}i.i=o}return oe(s,0,n+ie(u)+a)},Ee=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,n=9;--n;)t=(1&t&&-306674912)^t>>>1;e[r]=t}return e}(),Te=function(e,r,t,n,a){if(!a&&(a={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),o=new P(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return be(e,null==r.level?6:r.level,null==r.mem?a.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+r.mem,t,n,a)},Se=function(e,r){var t={};for(var n in e)t[n]=e[n];for(var n in r)t[n]=r[n];return t},ke=function(e,r,t){for(var n=e(),a=e.toString(),i=a.slice(a.indexOf("[")+1,a.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var s=n[o],c=i[o];if("function"==typeof s){r+=";"+c+"=";var l=s.toString();if(s.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;r+=l.slice(u,l.indexOf("(",u))}else for(var f in r+=l,s.prototype)r+=";"+c+".prototype."+f+"="+s.prototype[f].toString();else r+=l}else t[c]=s}return r},Ae=[],Oe=function(){return[P,I,z,U,Y,C,j,N,q,re,B,se,H,te,ne,ae,ie,oe,ce,le,Ue,Re,xe]},Fe=function(){return[P,I,z,U,Y,C,G,$,Q,J,ee,K,B,ge,ve,H,ue,fe,ye,he,de,we,pe,me,ie,oe,be,Te,ze,Re]},Re=function(e){return postMessage(e,[e.buffer])},xe=function(e){return e&&{out:e.size&&new P(e.size),dictionary:e.dictionary}},We=function(e,r,t,n,a,i){var o=function(e,r,t,n){if(!Ae[t]){for(var a="",i={},o=e.length-1,s=0;s<o;++s)a=ke(e[s],a,i);Ae[t]={c:ke(e[o],a,i),e:i}}var c=Se({},Ae[t].e);return function(e,r,t,n,a){var i=new Worker(L[r]||(L[r]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(e){var r=e.data,t=r.$e$;if(t){var n=new Error(t[0]);n.code=t[1],n.stack=t[2],a(n,null)}else a(null,r)},i.postMessage(t,n),i}(Ae[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r.toString()+"}",t,c,function(e){var r=[];for(var t in e)e[t].buffer&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(c),n)}(t,n,a,function(e,r){o.terminate(),i(e,r)});return o.postMessage([e,r],r.consume?[e.buffer]:[]),function(){o.terminate()}},Ze=function(e,r){return e[r]|e[r+1]<<8},Le=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},Pe=function(e,r){return Le(e,r)+4294967296*Le(e,r+4)},Ie=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function ze(e,r){return Te(e,r||{},0,0)}function Ue(e,r){return le(e,{i:2},r&&r.out,r&&r.dictionary)}var Ye=function(e,r,t,n){for(var a in e){var i=e[a],o=r+a,s=n;Array.isArray(i)&&(s=Se(n,i[1]),i=i[0]),ArrayBuffer.isView(i)?t[o]=[i,s]:(t[o+="/"]=[new P(0),s],Ye(i,o,t,n))}},Ce="undefined"!=typeof TextEncoder&&new TextEncoder,De="undefined"!=typeof TextDecoder&&new TextDecoder;try{De.decode(ve,{stream:!0})}catch(e){}function Me(e,r){if(r){for(var t=new P(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}if(Ce)return Ce.encode(e);var a=e.length,i=new P(e.length+(e.length>>1)),o=0,s=function(e){i[o++]=e};for(n=0;n<a;++n){if(o+5>i.length){var c=new P(o+8+(a-n<<1));c.set(i),i=c}var l=e.charCodeAt(n);l<128||r?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return oe(i,0,o)}function je(e,r){if(r){for(var t="",n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(De)return De.decode(e);var a=function(e){for(var r="",t=0;;){var n=e[t++],a=(n>127)+(n>223)+(n>239);if(t+a>e.length)return{s:r,r:oe(e,t-1)};a?3==a?(n=((15&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,r+=String.fromCharCode(55296|n>>10,56320|1023&n)):r+=1&a?String.fromCharCode((31&n)<<6|63&e[t++]):String.fromCharCode((15&n)<<12|(63&e[t++])<<6|63&e[t++]):r+=String.fromCharCode(n)}}(e),i=a.s;return(t=a.r).length&&ce(8),i}var Ge=function(e,r,t,n,a,i,o){var s=4294967295==a,c=4294967295==i,l=4294967295==o,u=r+t;if(n&&s+c+l){for(;r+4<u;r+=4+Ze(e,r+2))if(1==Ze(e,r))return[s?Pe(e,r+4+8*c):a,c?Pe(e,r+4):i,l?Pe(e,r+4+8*(c+s)):o,1];n<2&&ce(13)}return[a,i,o,0]},Xe=function(e){var r=0;if(e)for(var t in e){var n=e[t].length;n>65535&&ce(9),r+=n+4}return r},Ne=function(e,r,t,n,a,i,o,s){var c=n.length,l=t.extra,u=s&&s.length,f=Xe(l);Ie(e,r,null!=o?33639248:67324752),r+=4,null!=o&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(i<0&&8),e[r++]=a&&8,e[r++]=255&t.compression,e[r++]=t.compression>>8;var y=new Date(null==t.mtime?Date.now():t.mtime),h=y.getFullYear()-1980;if((h<0||h>119)&&ce(10),Ie(e,r,h<<25|y.getMonth()+1<<21|y.getDate()<<16|y.getHours()<<11|y.getMinutes()<<5|y.getSeconds()>>1),r+=4,-1!=i&&(Ie(e,r,t.crc),Ie(e,r+4,i<0?-i-2:i),Ie(e,r+8,t.size)),Ie(e,r+12,c),Ie(e,r+14,f),r+=16,null!=o&&(Ie(e,r,u),Ie(e,r+6,t.attrs),Ie(e,r+10,o),r+=14),e.set(n,r),r+=c,f)for(var d in l){var w=l[d],p=w.length;Ie(e,r,+d),Ie(e,r+2,p),e.set(w,r+4),r+=4+p}return u&&(e.set(s,r),r+=u),r};function $e(e,r,t){t||(t=r,r={}),"function"!=typeof t&&ce(7);var n={};Ye(e,"",n,r);var a=Object.keys(n),i=a.length,o=0,s=0,c=i,l=new Array(i),u=[],f=function(){for(var e=0;e<u.length;++e)u[e]()},y=function(e,r){Be(function(){t(e,r)})};Be(function(){y=t});var h=function(){var e=new P(s+22),r=o,t=s-o;s=0;for(var n=0;n<c;++n){var a=l[n];try{var i=a.c.length;Ne(e,s,a,a.f,a.u,i);var u=30+a.f.length+Xe(a.extra),f=s+u;e.set(a.c,f),Ne(e,o,a,a.f,a.u,i,s,a.m),o+=16+u+(a.m?a.m.length:0),s=f+i}catch(e){return y(e,null)}}(function(e,r,t,n,a){Ie(e,r,101010256),Ie(e,r+8,t),Ie(e,r+10,t),Ie(e,r+12,n),Ie(e,r+16,a)})(e,o,l.length,t,r),y(null,e)};i||h();for(var d=function(e){var r=a[e],t=n[r],c=t[0],d=t[1],w=function(){var e=-1;return{p:function(r){for(var t=e,n=0;n<r.length;++n)t=Ee[255&t^r[n]]^t>>>8;e=t},d:function(){return~e}}}(),p=c.length;w.p(c);var m=Me(r),g=m.length,v=d.comment,b=v&&Me(v),E=b&&b.length,T=Xe(d.extra),S=0==d.level?0:8,k=function(t,n){if(t)f(),y(t,null);else{var a=n.length;l[e]=Se(d,{size:p,crc:w.d(),c:n,f:m,m:b,u:g!=r.length||b&&v.length!=E,compression:S}),o+=30+g+T+a,s+=76+2*(g+T)+(E||0)+a,--i||h()}};if(g>65535&&k(ce(11,0,1),null),S)if(p<16e4)try{k(null,ze(c,d))}catch(e){k(e,null)}else u.push(function(e,r,t){return t||(t=r,r={}),"function"!=typeof t&&ce(7),We(e,r,[Fe],function(e){return Re(ze(e.data[0],e.data[1]))},0,t)}(c,d,k));else k(null,c)},w=0;w<c;++w)d(w);return f}var Be="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(e){e()};class Ve{resolve;reject;promise;constructor(){if("function"==typeof Promise.withResolvers){const{promise:e,resolve:r,reject:t}=Promise.withResolvers();this.promise=e,this.resolve=r,this.reject=t}else this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}}const _e="NotFoundError",He="/",Je=".",Ke="/tmp";function Qe(e){n("string"==typeof e),n(e[0]===He)}function qe(e){n("string"==typeof e)}let er;function rr(e){return e===He}async function tr(e,r,t){try{return v(await e.getDirectoryHandle(r,t))}catch(t){const n=t,a=new Error(`${n.name}: ${n.message} When get child directory '${r}' from directory '${e.name||He}'.`);return a.name=n.name,b(a)}}async function nr(e,r){let t=await async function(){return er??=await navigator.storage.getDirectory(),er}();if(rr(e))return v(t);let n=e.slice(1);for(;n;){let e="";const a=n.indexOf("/");if(-1===a)e=n,n="";else if(e=n.slice(0,a),n=n.slice(a+1),0===a)continue;const i=await tr(t,e,r);if(i.isErr())return i;t=i.unwrap()}return v(t)}async function ar(e,r){const t=r?.create??!1,n=c(e),a=l(e);return(await nr(n,{create:t})).andThenAsync(e=>async function(e,r,t){try{return v(await e.getFileHandle(r,t))}catch(t){const n=t,a=new Error(`${n.name}: ${n.message} When get child file '${r}' from directory '${e.name||He}'.`);return a.name=n.name,b(a)}}(e,a,{create:t}))}function ir(e){return e.name===_e}async function or(e){const r=(await Promise.all(e)).find(e=>e.isErr());return r??A}function sr(){const e=new Error;return e.name=O,e}function cr(e){const{isDirectory:r=!1,basename:t="tmp",extname:n=""}=e??{},a=r?"":n;return u(Ke,`${t?`${t}-`:""}${crypto.randomUUID()}${a}`)}function lr(e){return e.startsWith(`${Ke}/`)}async function ur(e){const{name:r,kind:t}=e;if(fr(e)){const n=await e.getFile(),{size:a,lastModified:i,type:o}=n;return{name:r,kind:t,type:o,size:a,lastModified:i}}return{name:r,kind:t}}function fr(e){return"file"===e.kind}function yr(e){return"directory"===e.kind}function hr(e){return"file"===e.kind}async function dr(e){const r=await e.getFile(),t=await r.arrayBuffer();return new Uint8Array(t)}async function wr(e){return Qe(e),(await ar(e,{create:!0})).and(A)}async function pr(e){return Qe(e),(await nr(e,{create:!0})).and(A)}async function mr(e,r){async function*t(n,a){const i=n.entries();for await(const[o,s]of i){const i=a===e?o:u(a,o);yield{path:i,handle:s},yr(s)&&r?.recursive&&(yield*t(await n.getDirectoryHandle(o),i))}}return Qe(e),(await nr(e)).andThen(r=>v(t(r,e)))}async function gr(e,r){return Qe(e),(await ar(e)).andThenAsync(async e=>{const t=await e.getFile();switch(r?.encoding){case"blob":return v(t);case"utf8":return v(await t.text());default:return v(await t.arrayBuffer())}})}async function vr(e){Qe(e);const r=c(e),t=l(e),n=await nr(r);return(await n.andThenAsync(async e=>{try{rr(r)&&rr(t)?await e.remove({recursive:!0}):await e.removeEntry(t,{recursive:!0})}catch(e){return b(e)}return A})).orElse(e=>ir(e)?A:b(e))}async function br(e){Qe(e);const r=c(e),t=l(e),n=await nr(r);return t?n.andThenAsync(async r=>{for await(const[e,n]of r.entries())if(e===t)return v(n);const n=new Error(`${_e}: '${t}' does not exist. Full path is '${e}'.`);return n.name=_e,b(n)}):n}async function Er(e,r,t){Qe(e);const{append:n=!1,create:a=!0}=t??{};return(await ar(e,{create:a})).andThenAsync(async e=>{const t=await e.createWritable({keepExistingData:n}),a={type:"write",data:r};if(n){const{size:r}=await e.getFile();a.position=r}return await t.write(a),await t.close(),A})}function Tr(e,r,t){let n,a;qe(e),a=!1,"string"==typeof r?Qe(r):(t=r,r=cr({extname:f(e)}),a=!0),n=!1;const i=x(e,{redirect:"follow",...t,abortable:!0}),o=(async()=>(await i.response).andThenAsync(async e=>{const t=await e.blob();return n?b(sr()):(await Er(r,t)).and(v(e))}))();return{abort(e){n=!0,i.abort(e)},get aborted(){return n},get response(){return a?o.then(e=>e.map(e=>({tempFilePath:r,rawResponse:e}))):o}}}async function Sr(e,r){const t=c(r);return(await nr(t,{create:!0})).andThenAsync(async t=>{const n=l(r);try{return await e.move(t,n),A}catch(e){return b(e)}})}async function kr(e,r,t,n=!0){return Qe(r),(await br(e)).andThenAsync(async a=>{let i;i=!1;const o=await br(r);if(o.isErr()){if(!ir(o.unwrapErr()))return o.asErr()}else{i=!0;const e=o.unwrap();if(!(fr(a)&&fr(e)||yr(a)&&yr(e)))return b(new Error("Both 'srcPath' and 'destPath' must both be a file or directory."))}return fr(a)?n||!i?await t(a,r):A:(await mr(e,{recursive:!0})).andThenAsync(async e=>{const a=[pr(r)];for await(const{path:o,handle:s}of e){const e=u(r,o);let c=!1;if(i){const r=await Rr(e);if(r.isErr()){a.push(Promise.resolve(r.asErr()));continue}c=r.unwrap()}const l=fr(s)?n||!c?t(s,e):Promise.resolve(A):pr(e);a.push(l)}return or(a)})})}function Ar(e,r){return Er(e,r,{append:!0})}async function Or(e,r,t){const{overwrite:n=!0}=t??{};return kr(e,r,async(e,r)=>await Er(r,await e.getFile()),n)}async function Fr(e){const r=await mr(e);if(r.isErr())return ir(r.unwrapErr())?pr(e):r.asErr();const t=[];for await(const{path:n}of r.unwrap())t.push(vr(u(e,n)));return or(t)}async function Rr(e,r){const{isDirectory:t=!1,isFile:a=!1}=r??{};n(!(t&&a));const i=await br(e);return i.andThen(e=>v(!(t&&fr(e)||a&&yr(e)))).orElse(e=>ir(e)?k:i.asErr())}async function xr(e,r,t){const{overwrite:n=!0}=t??{};return(await kr(e,r,Sr,n)).andThenAsync(()=>vr(e))}function Wr(e){return gr(e,{encoding:"blob"})}async function Zr(e){return(await Lr(e)).andThenAsync(async e=>{try{return v(JSON.parse(e))}catch(e){return b(e)}})}function Lr(e){return gr(e,{encoding:"utf8"})}async function Pr(e){const{isDirectory:r=!1}=e??{},t=cr(e);return(await(r?pr:wr)(t)).and(v(t))}function Ir(){return vr(Ke)}async function zr(e){return n(e instanceof Date),(await mr(Ke,{recursive:!0})).andThenAsync(async r=>{try{for await(const{handle:t}of r)fr(t)&&(await t.getFile()).lastModified<=e.getTime()&&await t.remove()}catch(e){return b(e)}return A})}async function Ur(e,r){const t=new Uint8Array(e),n=new Ve;return function(e,r,t){t||(t=r,r={}),"function"!=typeof t&&ce(7);var n=[],a=function(){for(var e=0;e<n.length;++e)n[e]()},i={},o=function(e,r){Be(function(){t(e,r)})};Be(function(){o=t});for(var s=e.length-22;101010256!=Le(e,s);--s)if(!s||e.length-s>65558)return o(ce(13,0,1),null),a;var c=Ze(e,s+8);if(c){var l=c,u=Le(e,s+16),f=117853008==Le(e,s-20);if(f){var y=Le(e,s-12);(f=101075792==Le(e,y))&&(l=c=Le(e,y+32),u=Le(e,y+48))}for(var h=r&&r.filter,d=function(r){var t=function(e,r,t){var n=Ze(e,r+28),a=Ze(e,r+30),i=je(e.subarray(r+46,r+46+n),!(2048&Ze(e,r+8))),o=r+46+n,s=Ge(e,o,a,t,Le(e,r+20),Le(e,r+24),Le(e,r+42)),c=s[0],l=s[1],u=s[2];return[Ze(e,r+10),c,l,i,o+a+Ze(e,r+32),u]}(e,u,f),s=t[0],l=t[1],y=t[2],d=t[3],w=t[4],p=t[5],m=function(e,r){return r+30+Ze(e,r+26)+Ze(e,r+28)}(e,p);u=w;var g=function(e,r){e?(a(),o(e,null)):(r&&(i[d]=r),--c||o(null,i))};if(!h||h({name:d,size:l,originalSize:y,compression:s}))if(s)if(8==s){var v=e.subarray(m,m+l);if(y<524288||l>.8*y)try{g(null,Ue(v,{out:new P(y)}))}catch(e){g(e,null)}else n.push(function(e,r,t){return t||(t=r,r={}),"function"!=typeof t&&ce(7),We(e,r,[Oe],function(e){return Re(Ue(e.data[0],xe(e.data[1])))},1,t)}(v,{size:y},g))}else g(ce(14,"unknown compression type "+s,1),null);else g(null,oe(e,m,m+l));else g(null,null)},w=0;w<l;++w)d()}else o(null,{})}(t,async(e,t)=>{if(e)return void n.resolve(b(e));const a=[];for(const e in t)"/"!==e.at(-1)&&a.push(Er(u(r,e),t[e]));n.resolve(or(a))}),await n.promise}async function Yr(e,r){return Qe(r),(await gr(e)).andThenAsync(e=>Ur(e,r))}async function Cr(e,r,t){return qe(e),Qe(r),(await x(e,{redirect:"follow",...t,responseType:"arraybuffer",abortable:!1})).andThenAsync(e=>Ur(e,r))}function Dr(e,r,t){let n,a;qe(r),n=!1;const i=(async()=>(await Wr(e)).andThenAsync(async i=>{if(n)return b(sr());const{filename:o=l(e),...s}=t??{},c=new FormData;return c.append(o,i,o),a=x(r,{method:"POST",...s,abortable:!0,body:c}),a.response}))();return{abort(e){n=!0,a?.abort(e)},get aborted(){return n},get response(){return i}}}async function Mr(e,r){const t=new Ve;return $e(e,{consume:!0},async(e,n)=>{if(e)t.resolve(b(e));else if(r){const e=await Er(r,n);t.resolve(e)}else t.resolve(v(n))}),await t.promise}async function jr(e,r,t){return"string"==typeof r?Qe(r):(t=r,r=void 0),(await br(e)).andThenAsync(async n=>{const a=l(e),i={};if(fr(n)){const e=await dr(n);i[a]=e}else{const r=await mr(e,{recursive:!0});if(r.isErr())return r.asErr();const n=t?.preserveRoot??!0;for await(const{path:e,handle:t}of r.unwrap())if(fr(t)){const r=n?u(a,e):e,o=await dr(t);i[r]=o}}return Mr(i,r)})}async function Gr(e,r,t){return qe(e),"string"==typeof r?Qe(r):(t=r,r=void 0),(await x(e,{redirect:"follow",...t,responseType:"arraybuffer",abortable:!1})).andThenAsync(t=>{const n={};return n[l(e)]=new Uint8Array(t),Mr(n,r)})}function Xr(){return"function"==typeof navigator?.storage?.getDirectory}function Nr(e){return e?{name:e.name,message:e.message}:e}async function $r(e){const r=await e.arrayBuffer();return{name:e.name,type:e.type,lastModified:e.lastModified,size:r.byteLength,data:r}}let Br=1e3;var Vr=(e=>(e[e.createFile=0]="createFile",e[e.mkdir=1]="mkdir",e[e.move=2]="move",e[e.readDir=3]="readDir",e[e.remove=4]="remove",e[e.stat=5]="stat",e[e.writeFile=6]="writeFile",e[e.appendFile=7]="appendFile",e[e.copy=8]="copy",e[e.emptyDir=9]="emptyDir",e[e.exists=10]="exists",e[e.deleteTemp=11]="deleteTemp",e[e.mkTemp=12]="mkTemp",e[e.pruneTemp=13]="pruneTemp",e[e.readBlobFile=14]="readBlobFile",e[e.unzip=15]="unzip",e[e.zip=16]="zip",e))(Vr||{});let _r,Hr;function Jr(e){const r=JSON.stringify(e);return(_r??=new TextEncoder,_r).encode(r)}function Kr(e){const r=Qr(e);return JSON.parse(r)}function Qr(e){return(Hr??=new TextDecoder,Hr).decode(e)}class qr{i32a;u8a;headerLength=16;maxDataLength;constructor(e){this.i32a=new Int32Array(e),this.u8a=new Uint8Array(e),this.maxDataLength=e.byteLength-this.headerLength}}async function et(e,r){const{i32a:t,u8a:n,headerLength:a,maxDataLength:i}=e;for(;1!==Atomics.load(t,1););const o=t[2],s=n.slice(a,a+o);let c=await r(s);const l=c.byteLength;if(l>i){const e=`Response is too large: ${l} > ${i}. Consider grow the size of SharedArrayBuffer.`;if(c=Jr([{name:"RangeError",message:e}]),c.byteLength>i)throw Atomics.store(t,1,0),new RangeError(e)}t[2]=c.byteLength,n.set(c,a),Atomics.store(t,1,0),Atomics.store(t,0,0)}const rt={[Vr.createFile]:wr,[Vr.mkdir]:pr,[Vr.move]:xr,[Vr.readDir]:mr,[Vr.remove]:vr,[Vr.stat]:br,[Vr.writeFile]:Er,[Vr.appendFile]:Ar,[Vr.copy]:Or,[Vr.emptyDir]:Fr,[Vr.exists]:Rr,[Vr.deleteTemp]:Ir,[Vr.mkTemp]:Pr,[Vr.pruneTemp]:zr,[Vr.readBlobFile]:Wr,[Vr.unzip]:Yr,[Vr.zip]:jr};let tt,nt;function at(){if("undefined"!=typeof window)throw new Error("Only can use in worker");if(tt)throw new Error("Worker messenger already started");addEventListener("message",e=>{const r=e.data;if(!(r instanceof SharedArrayBuffer))throw new TypeError("Only can post SharedArrayBuffer to Worker");tt=new qr(r),postMessage(!0),async function(){for(;;)try{await et(tt,async e=>{const[r,...t]=Kr(e);let n;r===Vr.writeFile||r===Vr.appendFile?Array.isArray(t[1])&&(t[1]=new Uint8Array(t[1])):r===Vr.pruneTemp&&(t[0]=new Date(t[0]));const a=rt[r];try{const e=await a(...t);if(e.isErr())n=Jr([Nr(e.unwrapErr())]);else{let t;if(r===Vr.readBlobFile){const r=e.unwrap(),n=await $r(r);t={...n,data:[...new Uint8Array(n.data)]}}else if(r===Vr.readDir){const r=e.unwrap(),n=[];for await(const{path:e,handle:t}of r){const r=await ur(t);n.push({path:e,handle:r})}t=n}else if(r===Vr.stat){const r=e.unwrap();t=await ur(r)}else if(r===Vr.zip){const r=e.unwrap();t=r instanceof Uint8Array?[...r]:r}else t=e.unwrap();n=Jr([null,t])}}catch(e){n=Jr([Nr(e)])}return n})}catch(e){console.error(e instanceof Error?e.stack:e)}}()})}function it(e){if("undefined"==typeof window)throw new Error("Only can use in main thread");if(nt)throw new Error("Main messenger already started");return new Promise(r=>{const{worker:t,bufferLength:a=1048576,opTimeout:i=1e3}=e;n(t instanceof Worker||t instanceof URL||"string"==typeof t&&t),n(a>16&&a%4==0),n(Number.isInteger(i)&&i>0),Br=i;const o=t instanceof Worker?t:new Worker(t),s=new SharedArrayBuffer(a);o.addEventListener("message",e=>{e.data&&(nt=new qr(s),r())}),o.postMessage(s)})}function ot(){return nt}function st(e){n(null!=e),nt=e}function ct(e,...r){if(!nt)return b(new Error("Worker not initialized. Come back later."));const t=Jr([e,...r]);try{const e=Kr(function(e,r){const{i32a:t,u8a:n,headerLength:a,maxDataLength:i}=e,o=r.byteLength;if(o>i)throw new RangeError(`Request is too large: ${o} > ${i}. Consider grow the size of SharedArrayBuffer.`);Atomics.store(t,0,1),t[2]=o,n.set(r,a),Atomics.store(t,1,1),function(e){const r=Date.now();for(;!e();)if(Date.now()-r>Br){const e=new Error("Operating Timeout");throw e.name=F,e}}(()=>0===Atomics.load(t,0));const s=t[2];return n.slice(a,a+s)}(nt,t)),r=e[0],n=r?b(function(e){const r=new Error(e.message);return r.name=e.name,r}(r)):v(e[1]??void 0);return n}catch(e){return b(e)}}function lt(e){return ct(Vr.createFile,e)}function ut(e){return ct(Vr.mkdir,e)}function ft(e,r,t){return ct(Vr.move,e,r,t)}function yt(e,r){return ct(Vr.readDir,e,r)}function ht(e,r){return ct(Vr.readBlobFile,e).map(e=>{const t=new Uint8Array(e.data);switch(e.data=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),r?.encoding){case"blob":return e;case"utf8":return Qr(new Uint8Array(e.data));default:return e.data}})}function dt(e){return ct(Vr.remove,e)}function wt(e){return ct(Vr.stat,e)}function pt(e){return e instanceof ArrayBuffer?[...new Uint8Array(e)]:ArrayBuffer.isView(e)?[...new Uint8Array(e.buffer)]:e}function mt(e,r,t){return ct(Vr.writeFile,e,pt(r),t)}function gt(e,r){return ct(Vr.appendFile,e,pt(r))}function vt(e,r,t){return ct(Vr.copy,e,r,t)}function bt(e){return ct(Vr.emptyDir,e)}function Et(e,r){return ct(Vr.exists,e,r)}function Tt(){return ct(Vr.deleteTemp)}function St(e){return ct(Vr.mkTemp,e)}function kt(e){return ct(Vr.pruneTemp,e)}function At(e){return ht(e,{encoding:"blob"})}function Ot(e){return Ft(e).andThen(e=>{try{return v(JSON.parse(e))}catch(e){return b(e)}})}function Ft(e){return ht(e,{encoding:"utf8"})}function Rt(e,r){return ct(Vr.unzip,e,r)}function xt(e,r,t){return ct(Vr.zip,e,r,t).map(e=>e?new Uint8Array(e):e)}},597(e,r,t){"use strict";t.r(r),t.d(r,{default:()=>n});const n="undefined"!=typeof Worker?Worker:void 0}},r={};function t(n){var a=r[n];if(void 0!==a)return a.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t(234)})();
package/opfs CHANGED
@@ -5,7 +5,7 @@
5
5
  /** ----------------------------------------------------------------------
6
6
  * Copyright ©
7
7
  * Pellegrino Prevete
8
- * 2025
8
+ * 2025, 2026
9
9
  *
10
10
  * All rights reserved
11
11
  * ----------------------------------------------------------------------
@@ -137,3 +137,7 @@ module.exports.createReadStream =
137
137
  _read_stream_create;
138
138
  module.exports.createWriteStream =
139
139
  _write_stream_create;
140
+ module.exports.mkdtemp =
141
+ _happy_opfs.mkTemp;
142
+ module.exports.readdirSync =
143
+ _happy_opfs.readDirSync;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description":
5
5
  "Browser-compatible (OPFS) Node/Deno 'fs' module.",
6
6
  "version":
7
- "2.0.4",
7
+ "2.0.6",
8
8
  "homepage":
9
9
  "https://github.com/themartiancompany/opfs",
10
10
  "license":
@@ -77,7 +77,7 @@
77
77
  "@eslint/js":
78
78
  "^9.32.0",
79
79
  "eslint":
80
- "^9.32.0",
80
+ "^10.3.0",
81
81
  "webpack":
82
82
  "^5.102.1",
83
83
  "webpack-cli":