photostructure 2026.4.9-beta → 2026.9.4-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/LICENSE.md +131 -80
  2. package/README.md +4 -0
  3. package/VERSION.json +6 -6
  4. package/bin/bootstrap.js +18 -4
  5. package/bin/docker-env.js +29 -0
  6. package/bin/doctor.js +884 -0
  7. package/bin/fix.js +869 -3
  8. package/bin/info.js +881 -3
  9. package/bin/list.js +857 -3
  10. package/bin/logcat.js +604 -3
  11. package/bin/logtail.js +604 -3
  12. package/bin/main.js +627 -3
  13. package/bin/photostructure.js +5 -4
  14. package/bin/sync.js +1028 -3
  15. package/bin/web.js +1067 -3
  16. package/bin/worker.js +705 -3
  17. package/data/migrations/models/20260812_asset_preview_fingerprint.sql +29 -0
  18. package/data/migrations/models/20260830_asset_file_coordinates.sql +1 -0
  19. package/data/migrations/models/20260830_asset_file_location_provenance.sql +1 -0
  20. package/data/migrations/models/20260830_assetfile_basename_index.sql +13 -0
  21. package/data/migrations/models/20260830_tag_display_path.sql +9 -0
  22. package/data/migrations/models/20260903_assetfile_recent_idx.sql +17 -0
  23. package/data/migrations/models/20260906_asset_file_hash_deterministic_row_ids.sql +17 -0
  24. package/data/migrations/models/20260913_dir_uri_native_path.sql +3 -0
  25. package/data/migrations/models/20260916_asset_file_hash0_columns.sql +3 -0
  26. package/data/models-schema.json +54 -6
  27. package/data/models-schema.sql +24 -4
  28. package/data/test/apple-photos/legacy-10.12.6.sql +1055 -0
  29. package/data/test/apple-photos/legacy-10.13.6.sql +1039 -0
  30. package/data/test/apple-photos/legacy-10.14.6.sql +1309 -0
  31. package/data/test/apple-photos/modern-10.15.1.sql +986 -0
  32. package/data/test/apple-photos/modern-12.0.0.dev-beta.sql +2128 -0
  33. package/data/test/apple-photos/provenance.json +120 -0
  34. package/defaults.env +731 -351
  35. package/package.json +25 -26
  36. package/public/3rd-party-licenses.html.gz +0 -0
  37. package/public/3rd-party-licenses.txt.gz +0 -0
  38. package/public/app/AnimatedNumber.js +8 -0
  39. package/public/app/AnimatedNumber.js.gz +0 -0
  40. package/public/app/Array.js +1 -1
  41. package/public/app/Array.js.gz +0 -0
  42. package/public/app/AssetGallery.js +8 -0
  43. package/public/app/DropDown.js +20 -0
  44. package/public/app/DropDown.js.gz +0 -0
  45. package/public/app/HealthChecks.js +1 -1
  46. package/public/app/HealthChecks.js.gz +0 -0
  47. package/public/app/Lazy.js +1 -1
  48. package/public/app/Lazy.js.gz +0 -0
  49. package/public/app/Modal.js +8 -0
  50. package/public/app/Modal.js.gz +0 -0
  51. package/public/app/NavMenuButton.js +8 -0
  52. package/public/app/NavMenuButton.js.gz +0 -0
  53. package/public/app/PageActionsMenu.js +8 -0
  54. package/public/app/PageActionsMenu.js.gz +0 -0
  55. package/public/app/ProgressState.js +1 -1
  56. package/public/app/ProgressState.js.gz +0 -0
  57. package/public/app/SSEChannels.js +1 -1
  58. package/public/app/SSEChannels.js.gz +0 -0
  59. package/public/app/Search.js +1 -1
  60. package/public/app/Search.js.gz +0 -0
  61. package/public/app/Spinner.js +10 -0
  62. package/public/app/Spinner.js.gz +0 -0
  63. package/public/app/StickyHeader.js +1 -1
  64. package/public/app/StickyHeader.js.gz +0 -0
  65. package/public/app/Tag.js +1 -1
  66. package/public/app/Tag.js.gz +0 -0
  67. package/public/app/_plugin-vue_export-helper.js +1 -1
  68. package/public/app/_plugin-vue_export-helper.js.gz +0 -0
  69. package/public/app/about.css +1 -1
  70. package/public/app/about.css.gz +0 -0
  71. package/public/app/about.js +1 -1
  72. package/public/app/about.js.gz +0 -0
  73. package/public/app/app.css +1 -1
  74. package/public/app/app.css.gz +0 -0
  75. package/public/app/app.js +5 -5
  76. package/public/app/app.js.gz +0 -0
  77. package/public/app/health.css +1 -1
  78. package/public/app/health.css.gz +0 -0
  79. package/public/app/health.js +2 -2
  80. package/public/app/health.js.gz +0 -0
  81. package/public/app/logs.css +1 -1
  82. package/public/app/logs.css.gz +0 -0
  83. package/public/app/logs.js +1 -1
  84. package/public/app/logs.js.gz +0 -0
  85. package/public/app/onReady.js +1 -1
  86. package/public/app/platform.js +1 -1
  87. package/public/app/roboto-mono-v22-latin-700.woff2.gz +0 -0
  88. package/public/app/roboto-mono-v22-latin-regular.woff2.gz +0 -0
  89. package/public/app/roboto-v51-latin-wght.woff2.gz +0 -0
  90. package/public/app/settings.css +1 -1
  91. package/public/app/settings.css.gz +0 -0
  92. package/public/app/settings.js +1 -1
  93. package/public/app/settings.js.gz +0 -0
  94. package/public/app/splash.css +1 -1
  95. package/public/app/splash.css.gz +0 -0
  96. package/public/app/splash.js +1 -1
  97. package/public/app/splash.js.gz +0 -0
  98. package/public/app/sse-worker.js +1 -1
  99. package/public/app/sse-worker.js.gz +0 -0
  100. package/public/app/sync.css +1 -1
  101. package/public/app/sync.css.gz +0 -0
  102. package/public/app/sync.js +3 -5
  103. package/public/app/sync.js.gz +0 -0
  104. package/public/app/useAnchorHighlight.js +1 -1
  105. package/public/eula.html +106 -57
  106. package/public/fonts/roboto-mono-v22-latin-700.woff2.gz +0 -0
  107. package/public/fonts/roboto-mono-v22-latin-regular.woff2.gz +0 -0
  108. package/public/fonts/roboto-v51-latin-wght.woff2.gz +0 -0
  109. package/public/images/1.png.gz +0 -0
  110. package/public/images/apple-maps.svg.gz +0 -0
  111. package/public/images/camera.svg.gz +0 -0
  112. package/public/images/google-maps.svg.gz +0 -0
  113. package/public/images/openstreetmap.svg.gz +0 -0
  114. package/public/images/photostructure-black.svg.gz +0 -0
  115. package/public/images/photostructure-white.svg.gz +0 -0
  116. package/public/images/splash.svg +1 -1
  117. package/tools/README.md +16 -0
  118. package/tools/build.sh +8 -5
  119. package/tools/download-rg.sh +2 -2
  120. package/tools/licenses/libjpeg-turbo/LICENSE.md +59 -45
  121. package/tools/licenses/libjpeg-turbo/README.ijg +260 -0
  122. package/tools/licenses/libraw/COPYRIGHT.txt +2 -3
  123. package/tools/licenses/libraw/LICENSE.CDDL.txt +339 -0
  124. package/tools/licenses/libraw/LICENSE.LGPL.txt +458 -0
  125. package/tools/licenses/recycle-bin/LICENSE.txt +9 -0
  126. package/tools/licenses/ripgrep/COPYING +3 -0
  127. package/tools/licenses/ripgrep/LICENSE-MIT +21 -0
  128. package/tools/licenses/ripgrep/UNLICENSE +24 -0
  129. package/tools/licenses/sharp-libvips/GPL-3.txt +674 -0
  130. package/tools/licenses/sharp-libvips/LGPL-3.txt +165 -0
  131. package/tools/licenses/sharp-libvips/PROVENANCE.md +18 -0
  132. package/tools/licenses/sharp-libvips/THIRD-PARTY-NOTICES.md +42 -0
  133. package/tools/linux-arm64/dcraw_emu +0 -0
  134. package/tools/linux-arm64/jpegtran +0 -0
  135. package/tools/linux-arm64/raw-identify +0 -0
  136. package/tools/linux-arm64/rg +0 -0
  137. package/tools/linux-arm64/rg-README.md +29 -0
  138. package/tools/linux-arm64/sqlite3 +0 -0
  139. package/tools/linux-x64/dcraw_emu +0 -0
  140. package/tools/linux-x64/jpegtran +0 -0
  141. package/tools/linux-x64/raw-identify +0 -0
  142. package/tools/linux-x64/rg +0 -0
  143. package/tools/linux-x64/rg-README.md +29 -0
  144. package/tools/linux-x64/sqlite3 +0 -0
  145. package/tools/mac-arm64/dcraw_emu +0 -0
  146. package/tools/mac-arm64/jpegtran +0 -0
  147. package/tools/mac-arm64/jpegtran-README.md +32 -23
  148. package/tools/mac-arm64/libraw-README.md +52 -29
  149. package/tools/mac-arm64/raw-identify +0 -0
  150. package/tools/mac-arm64/rg +0 -0
  151. package/tools/mac-arm64/rg-README.md +33 -0
  152. package/tools/mac-arm64/sqlite3 +0 -0
  153. package/tools/mac-arm64/sqlite3-README.md +28 -27
  154. package/tools/mac-x64/dcraw_emu +0 -0
  155. package/tools/mac-x64/jpegtran +0 -0
  156. package/tools/mac-x64/jpegtran-README.md +32 -22
  157. package/tools/mac-x64/libraw-README.md +60 -44
  158. package/tools/mac-x64/raw-identify +0 -0
  159. package/tools/mac-x64/rg +0 -0
  160. package/tools/mac-x64/rg-README.md +34 -0
  161. package/tools/mac-x64/sqlite3 +0 -0
  162. package/tools/mac-x64/sqlite3-README.md +31 -4
  163. package/tools/win-x64/dcraw_emu.exe +0 -0
  164. package/tools/win-x64/jpegtran-README.md +23 -0
  165. package/tools/win-x64/jpegtran.exe +0 -0
  166. package/tools/win-x64/libjpeg-62.dll +0 -0
  167. package/tools/win-x64/libraw-README.md +20 -5
  168. package/tools/win-x64/libraw.dll +0 -0
  169. package/tools/win-x64/raw-identify.exe +0 -0
  170. package/tools/win-x64/recycle-bin-README.md +18 -2
  171. package/tools/win-x64/recycle-bin.exe +0 -0
  172. package/tools/win-x64/rg-README.md +12 -0
  173. package/tools/win-x64/rg.exe +0 -0
  174. package/tools/win-x64/sqlite3-README.md +14 -4
  175. package/tools/win-x64/sqlite3.exe +0 -0
  176. package/views/_setting-override.ejs +15 -0
  177. package/views/docker-setup.ejs +63 -0
  178. package/views/eula.html +106 -57
  179. package/views/license-activation.ejs +49 -0
  180. package/views/settings.ejs +1418 -806
  181. package/views/spa.ejs +11 -1
  182. package/views/welcome-tools.ejs +54 -10
  183. package/views/welcome.ejs +9 -8
  184. package/data/cuss.txt.br +0 -0
  185. package/data/words.txt.br +0 -0
  186. package/public/app/BabyMarkdown.js +0 -14
  187. package/public/app/BabyMarkdown.js.gz +0 -0
  188. package/public/app/DropDown.vue_vue_type_script_setup_true_lang.js +0 -12
  189. package/public/app/DropDown.vue_vue_type_script_setup_true_lang.js.gz +0 -0
  190. package/public/app/PageActionsMenu.vue_vue_type_script_setup_true_lang.js +0 -8
  191. package/public/app/PageActionsMenu.vue_vue_type_script_setup_true_lang.js.gz +0 -0
  192. package/public/app/Random.js +0 -8
  193. package/public/app/roboto-v30-latin-700.woff2.gz +0 -0
  194. package/public/app/roboto-v30-latin-700italic.woff2.gz +0 -0
  195. package/public/app/roboto-v30-latin-italic.woff2.gz +0 -0
  196. package/public/app/roboto-v30-latin-regular.woff2.gz +0 -0
  197. package/public/app/toast.js +0 -9
  198. package/public/app/toast.js.gz +0 -0
  199. package/public/app/useSectionPersistence.js +0 -8
  200. package/public/app/useSectionPersistence.js.gz +0 -0
  201. package/public/fonts/roboto-v30-latin-700.woff2.gz +0 -0
  202. package/public/fonts/roboto-v30-latin-700italic.woff2.gz +0 -0
  203. package/public/fonts/roboto-v30-latin-italic.woff2.gz +0 -0
  204. package/public/fonts/roboto-v30-latin-regular.woff2.gz +0 -0
  205. package/public/images/logo-lite.svg.gz +0 -0
  206. package/public/images/logo-plus.svg.gz +0 -0
  207. package/server/bin/install-codec-tools.sh +0 -48
  208. package/server/sudoers.d/photostructure-codec-install +0 -18
package/LICENSE.md CHANGED
@@ -1,80 +1,131 @@
1
-
2
- ### PLEASE READ CAREFULLY BEFORE USING THIS PRODUCT
3
-
4
- This End-User License Agreement ("EULA") is a legal agreement between (a) You
5
- (either an individual or a single entity) and (b) PhotoStructure, Inc. (the
6
- authors and copyright holders) that governs your use of the Product (any
7
- software or hardware installed or made available by PhotoStructure, Inc.).
8
-
9
- **If you do not agree to the following terms of this license, please <a
10
- href="/guide/uninstall/" target="_blank">uninstall</a>
11
- the Product.**
12
-
13
- ### Copyright
14
-
15
- The Product is protected by copyright and other intellectual property laws and
16
- treaties. PhotoStructure, Inc. retains the title, copyright, and all
17
- intellectual property rights in the Product.
18
-
19
- ### License
20
-
21
- You may not separately publish, sell, market, distribute, lend, lease, rent, or
22
- sublicense the Product, software code, or license keys. The Product is licensed,
23
- not sold.
24
-
25
- ### Limitation of liability
26
-
27
- In no event and under no legal theory, whether in tort (including negligence),
28
- contract, or otherwise, unless required by applicable law (such as deliberate
29
- and grossly negligent acts) or agreed to in writing, shall any authors or
30
- copyright holders be liable to you for damages, including any direct, indirect,
31
- special, incidental, or consequential damages of any character arising as a
32
- result of this license or out of the use or inability to use the Product
33
- (including but not limited to damages for loss of goodwill, work stoppage,
34
- computer failure or malfunction, or any and all other commercial damages or
35
- losses).
36
-
37
- ### Disclaimer of warranty
38
-
39
- The Product is provided "as is," without warranty of any kind, express or
40
- implied, including but not limited to the warranties of merchantability, fitness
41
- for a particular purpose and noninfringement. In no event shall the authors or
42
- copyright holders be liable for any claim, damages or other liability, whether
43
- in an action of contract, tort or otherwise, arising from, out of or in
44
- connection with the Product or the use or other dealings in the Product.
45
-
46
- ### Limitation on derivative works
47
-
48
- Except to the extent that such restriction is not permitted under applicable
49
- law, you are not permitted (and you agree not to) create or redistribute
50
- derivative works of the Product.
51
-
52
- ### Privacy and consent to use data
53
-
54
- **The Product does not send your photos or videos to PhotoStructure, Inc.**
55
-
56
- The Product may periodically download and install updates. These updates may
57
- include bug fixes, security updates, and new features. Automatic updates may be
58
- disabled by the user via <a
59
- href="/getting-started/advanced-settings/"
60
- target="_blank">settings</a>.
61
-
62
- The Product may send error reports that contain limited file metadata via a
63
- third party (such as Sentry). Error reports may be <a
64
- href="/guide/error-reports/#how-to-opt-out-of-sending-error-reports"
65
- target="_blank">disabled by the user</a>.
66
-
67
- [//]: # "The URL above must be fully-qualified, as the EULA is included in the welcome page."
68
-
69
- ### Amendments to this Agreement
70
-
71
- PhotoStructure, Inc. reserves the right, at its sole discretion, to modify or
72
- replace this Agreement at any time. If a revision is material we will provide at
73
- least 30 days' notice prior to any new terms taking effect. What constitutes a
74
- material change will be determined at our sole discretion.
75
-
76
- ### Termination of use
77
-
78
- Your rights under this EULA will terminate automatically if you fail to comply
79
- with any of its terms, in which case you must destroy all copies of the Product
80
- and return any component parts.
1
+ **Version: September 16, 2026.** Effective when you accept it. See "Changes and
2
+ other terms" below for later revisions.
3
+
4
+ This agreement is between you and PhotoStructure, Inc. ("we" or "us") for the
5
+ PhotoStructure application and documentation (the "Software"). You agree by
6
+ accepting during setup, or installing or using the Software after receiving
7
+ notice that doing so means acceptance. If you disagree, do not use it;
8
+ [uninstall it](https://photostructure.com/guide/uninstall/).
9
+
10
+ ## Your license and content
11
+
12
+ We grant you a non-exclusive license (we may license the Software to others) to
13
+ install and run the Software on computers you own or control and keep backup
14
+ copies. This license covers your household's use and your own individual
15
+ business work, but not shared use by an organization's staff. Your household
16
+ includes people living with you and family away temporarily, such as at school.
17
+
18
+ PhotoStructure Lite is free. Plus adds features and requires an active
19
+ subscription, a Lifetime Plus license (no recurring payments), or a trial. One
20
+ Plus license covers one household and multiple computers. Keep your Plus license
21
+ and other credentials that activate or renew Plus within that household. When a
22
+ subscription or trial ends, you can still open your library with Lite; Plus-only
23
+ features may become unavailable. The
24
+ [subscription terms](https://photostructure.com/legal/subscription-terms/)
25
+ control billing, renewal, cancellation, and refunds; this agreement controls
26
+ software use.
27
+
28
+ The Software is licensed, not sold. We retain our rights to it; you retain your
29
+ rights to your photos, videos, tags, and other library content. You may not
30
+ sell, rent, lend, sublicense, or distribute the Software or license credentials,
31
+ or distribute modified versions, except for household sharing, our written
32
+ permission, or rights under law or separate licenses.
33
+
34
+ ## Third-party software
35
+
36
+ Other authors' components and tools retain their separate licenses, which take
37
+ precedence for that software. You may modify the Software for your own use and
38
+ reverse engineer it to debug those modifications to the extent required by
39
+ applicable law or included components' licenses. See the
40
+ [third-party notices](https://photostructure.com/legal/3rd-party-licenses.txt)
41
+ and notices with your installation for copying, modification, and redistribution
42
+ rights.
43
+
44
+ ## Privacy and updates
45
+
46
+ **PhotoStructure does not send your photos or videos to us.** Application error
47
+ reporting is optional and controlled in Settings. Reports go to our
48
+ error-tracking provider (currently Sentry) and may include system information,
49
+ file paths, logs, error details, and your library-settings or Plus-account email
50
+ address, but no photos or videos. See
51
+ [report contents and controls](https://photostructure.com/guide/error-reports/)
52
+ and our [privacy policy](https://photostructure.com/legal/privacy/).
53
+
54
+ Depending on your installation and settings, PhotoStructure may check for
55
+ updates. The macOS and Windows desktop apps may download and install them; the
56
+ Node edition may update and restart at startup. Use Settings for in-app checks
57
+ and the
58
+ [Node startup controls](https://photostructure.com/server/photostructure-for-node/#advanced-settings-in-startsh--bootstrapjs)
59
+ for Node startup updates.
60
+
61
+ We may update the Software at no extra charge to fix bugs, maintain security or
62
+ compatibility, or improve features. Where required by law, we will give advance
63
+ notice by email or another format you can keep, explaining the change, timing,
64
+ and your options, and provide the required remedies. These terms cover updates
65
+ unless you accept a replacement agreement.
66
+
67
+ ## Warranties and liability
68
+
69
+ **Nothing here limits consumer rights or remedies that cannot legally be
70
+ waived,** including applicable repair, replacement, and refund rights.
71
+
72
+ Keep
73
+ [separate, restorable backups](https://photostructure.com/guide/raid-is-not-a-backup/).
74
+ Software and storage can fail.
75
+
76
+ **Residents of Québec: the following warranty disclaimers and liability limits
77
+ do not apply to you to the extent prohibited by Québec's Consumer Protection
78
+ Act.**
79
+
80
+ Subject to these rights, we provide the Software "as is" and disclaim express
81
+ and implied warranties, including merchantability, fitness for a particular
82
+ purpose, and noninfringement. We do not promise error-free operation or
83
+ compatibility with every system.
84
+
85
+ Subject to these rights, we are not liable for indirect or consequential losses
86
+ or lost profits. Our total liability for all claims arising from the Software or
87
+ this agreement is capped at:
88
+
89
+ - **Subscriptions:** the greater of US $50 or the fees you paid for
90
+ PhotoStructure in the 12 months before the event giving rise to the claim.
91
+ - **Lifetime Plus:** the greater of US $50 or what you paid for that license.
92
+ - **Free Lite or trials:** US $50.
93
+
94
+ For these calculations, include payments for PhotoStructure to us, Stripe, or
95
+ another seller we authorize. If more than one cap applies, the highest applies.
96
+ The limits apply to contract, negligence, and other claims, but not fraud,
97
+ intentional misconduct, gross negligence, death or personal injury caused by our
98
+ or our employees' or agents' negligence, or other liability the law prohibits us
99
+ from limiting.
100
+
101
+ ## Ending the agreement
102
+
103
+ You may end this agreement by stopping use and removing your copies.
104
+ **Uninstalling does not cancel renewal:** cancel through your
105
+ [account](https://account.photostructure.com/) or by emailing us.
106
+
107
+ We may end this agreement for a material breach, with notice explaining it and
108
+ 30 days to correct a correctable breach. Deliberate unauthorized distribution of
109
+ the Software or license credentials may result in immediate termination.
110
+
111
+ If we terminate, stop using and remove the Software; we will stop future
112
+ subscription renewals. You keep your content, separate third-party license
113
+ rights, and refund rights. An expired subscription does not, by itself, end this
114
+ agreement or your right to use Lite. Ownership, warranty, and liability
115
+ provisions survive for prior use.
116
+
117
+ ## Changes and other terms
118
+
119
+ We keep dated versions, including the
120
+ [previous agreement](https://photostructure.com/legal/eula-before-2026-09-16.txt).
121
+ Before asking existing users to accept material changes, we will give at least
122
+ 30 days' notice on our website and, if we have your email address, by email. The
123
+ notice will explain what changes and when. Revised terms apply going forward
124
+ upon acceptance, with any consent required by law. Posting alone does not change
125
+ your agreement. If you decline, you may keep using your existing version under
126
+ the terms you accepted, subject to your license status, or stop using it and
127
+ cancel renewal.
128
+
129
+ If part of this agreement cannot be enforced, the rest still applies.
130
+
131
+ Contact [hello@photostructure.com](mailto:hello@photostructure.com).
package/README.md CHANGED
@@ -9,6 +9,10 @@ PhotoStructure for Servers requires:
9
9
  - a 64-bit Intel or AMD CPU
10
10
  - At least Ubuntu LTS 22.04, macOS Sequoia (15), or Windows 10
11
11
 
12
+ PhotoStructure for Docker does not support Windows hosts, including Docker
13
+ Desktop. On Windows, use PhotoStructure for Node.js or PhotoStructure for
14
+ Desktops.
15
+
12
16
  ## Instructions
13
17
 
14
18
  1. Read and accept the [end-user license agreement](https://photostructure.com/eula), then
package/VERSION.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
- "version": "2026.4.9-beta",
2
+ "version": "2026.9.4-beta",
3
3
  "versionMajor": 2026,
4
- "versionMinor": 4,
5
- "versionPatch": 9,
4
+ "versionMinor": 9,
5
+ "versionPatch": 4,
6
6
  "versionPrerelease": [
7
7
  "beta"
8
8
  ],
9
- "release": "2026.4.9-beta+20260428003034",
10
- "gitSha": "2b5dc62059306c8ecaaf593ef2041391e030951e",
11
- "gitDate": "2026-04-28T07:30:34.000Z"
9
+ "release": "2026.9.4-beta+20260916164230",
10
+ "gitSha": "2c5a1c9dd844fc23e67b4468d7c788d9f99baeef",
11
+ "gitDate": "2026-09-16T23:42:30.000Z"
12
12
  }
package/bin/bootstrap.js CHANGED
@@ -1,9 +1,23 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  // Copyright © 2026, PhotoStructure Inc. All rights reserved.
4
-
5
3
  // BY USING THIS SOFTWARE, YOU ACCEPT ALL OF THE TERMS IN
6
4
  // https://photostructure.com/eula
7
5
  // IF YOU DO NOT ACCEPT THESE TERMS, DO NOT USE THIS SOFTWARE
8
-
9
- (()=>{"use strict";var e={92778(e,t,r){var o,n=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(o=function(e){return o=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},o(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=o(e),s=0;s<r.length;s++)"default"!==r[s]&&n(t,e,r[s]);return i(t,e),t}),u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.configDir=t.HOME=t.ROOT=t.isBrew=t.isMac=t.isWin=t.isNetworkDisabled=t.dbg=void 0,t.defer=h,t.toS=v,t.die=function(e,t){for(const r of[v(e),`Please refer to ${t??"https://photostructure.com/server/photostructure-for-node/"}`,"You can also visit https://forum.photostructure.com for help.",""])console.error(r);p.default.exit(1)},t.toNotBlank=m,t.isTrue=g,t.setDnsLookup=function(e){b=e,t.isNetworkDisabled.reset()},t.run=function(e,r,o){const n=performance.now();t.isWin&&e.includes(" ")&&(e='"'+e+'"');const i=(0,l.spawnSync)(e,r,{cwd:t.ROOT,timeout:1e4,...o,encoding:"utf8",shell:t.isWin});if(0!==i.status||null!=i.error)throw new Error(`"${e} ${r.join(" ")}" failed: ${v(i.error)} ${i.stderr}`);return(0,t.dbg)("run("+e+")",{args:r,result:i,elapsedMs:(s=performance.now()-n,Math.round(10*s)/10)}),i;var s},t.readPackageVersion=function(){return JSON.parse((0,c.readFileSync)((0,f.join)(t.ROOT,"package.json"),"utf8")).version},t.priorVersionFile=function(){return(0,f.join)((0,t.configDir)(),"prior-version.json")};const l=r(31421),a=r(71553),c=r(73024),d=r(48161),f=s(r(76760)),p=u(r(1708));function h(e){let t,r,o=!1;const n=function(){if(o){if(null!=r)throw r;return t}try{return o=!0,t=e()}catch(e){throw r=e,r}};return n.reset=()=>{t=void 0,r=void 0,o=!1},n}function v(e){return null==e?"":String(e)}function _(e){return null==e||0===v(e).trim().length}function m(e){return _(e)?void 0:v(e)}function g(e){if("boolean"==typeof e)return e;if(null==e)return!1;if(1===e)return!0;{const t=String(e).toLowerCase().trim();return["true","1"].includes(t)}}t.dbg=/\bdebug\b/.test(p.default.env.PS_LOG_LEVEL??"")||p.default.argv.includes("--debug")?console.log:()=>{};let b=a.lookup;t.isNetworkDisabled=h(async()=>{if(!_(p.default.env.PS_NO_NETWORK))return g(p.default.env.PS_NO_NETWORK);try{return await Promise.race([b("account.photostructure.com",{family:4}),new Promise((e,t)=>setTimeout(()=>t(new Error("Network timeout")),7e3))]),!1}catch(e){return(0,t.dbg)("Network disabled: "+e),!0}}),t.isWin="win32"===p.default.platform,t.isMac="darwin"===p.default.platform,t.isBrew=t.isMac&&!g(p.default.env.NOBREW)&&(0,c.existsSync)("/usr/local/bin/brew"),t.ROOT=f.default.resolve(f.default.join(__dirname,"..")),t.HOME=p.default.env.HOME??(0,d.homedir)(),t.configDir=h(()=>{const e=t.isWin?m(p.default.env.PS_CONFIG_DIR)??(0,f.join)(p.default.env.APPDATA,"PhotoStructure"):m(p.default.env.PS_CONFIG_DIR)??(0,f.join)(t.HOME,".config","PhotoStructure");return(0,c.mkdirSync)(e,{recursive:!0,mode:448}),e})},11610(e,t,r){e=r.nmd(e);var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isNpmInstall=void 0,t.bootstrapMain=d;const n=r(73024),i=r(76760),s=o(r(1708)),u=r(92778),l=r(93249),a=r(69071),c=r(69772);async function d(){if((0,a.assertNodeVersion)(),!t.isNpmInstall)if(await(0,u.isNetworkDisabled)()){(0,n.existsSync)((0,u.priorVersionFile)())||(0,u.die)("Network access is disabled.\nPlease enable your WAN during your first run to download PhotoStructure's dependencies.","https://photostructure.com/server/photostructure-for-node/#troubleshooting-network");const e=(0,c.readJsonMaybe)((0,u.priorVersionFile)());(e?.node!==s.default.versions.node||(0,c.needsNpmInstall)())&&(0,c.npmInstall)()}else(0,l.gitPullAndMaybeBounce)().bounced||(0,c.prepAndInstall)()}t.isNpmInstall=!(0,n.existsSync)((0,i.join)(u.ROOT,".git")),r.c[r.s]===e&&(s.default.on("unhandledRejection",e=>{(0,u.die)("Unexpected rejection: "+e,"https://photostructure.com/server/photostructure-for-node/#troubleshooting-unexpected")}),s.default.on("uncaughtException",e=>{(0,u.die)("Unexpected error: "+e,"https://photostructure.com/server/photostructure-for-node/#troubleshooting-unexpected")}),d())},93249(e,t,r){var o,n=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(o=function(e){return o=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},o(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=o(e),s=0;s<r.length;s++)"default"!==r[s]&&n(t,e,r[s]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.gitPullAndMaybeBounce=t.EnvOnBounce=void 0;const u=s(r(1708)),l=r(92778),a=r(14325);t.EnvOnBounce={PS_BOUNCED:"1",PS_REINSTALL:"1"},t.gitPullAndMaybeBounce=(0,l.defer)(()=>{const e=(0,l.readPackageVersion)();(0,l.dbg)({version_before_pull:e});const r=(0,l.isTrue)(u.default.env.NOGIT),o=(0,l.isTrue)(u.default.env.PS_NO_GIT);if(!r&&!o&&"none"!==u.default.env.PS_CHECK_UPDATES){try{(0,l.run)((0,a.git)(),["stash","--include-untracked"])}catch(e){console.warn("warn: git stash failed: "+e)}try{(0,l.run)((0,a.git)(),["pull"],{timeout:3e4})}catch(e){console.warn("warn: git failed: "+e)}}const n=(0,l.readPackageVersion)();return(0,l.dbg)({version_after_pull:n}),(0,l.isTrue)(u.default.env.PS_BOUNCED)||!(0,l.isTrue)(u.default.env.PS_DEV_FORCE_BOUNCE)&&e===n?{bounced:!1,version_before_pull:e,version_after_pull:n}:((0,l.run)(u.execPath,u.execArgv,{env:{...u.default.env,...t.EnvOnBounce},stdio:"inherit",timeout:void 0}),{bounced:!0,version_before_pull:e,version_after_pull:n})})},69071(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OldNodeError=void 0,t.assertNodeVersion=function(){const[e,r]=n.default.versions.node.split(".").map(e=>parseInt(e));(0,i.dbg)({node_version:n.default.versions.node,major:e,minor:r}),e<22||22===e&&r<3?(0,i.die)(t.OldNodeError,"https://photostructure.com/server/photostructure-for-node/#troubleshooting-node-version"):(0,i.dbg)("Node.js version: "+n.default.versions.node)};const n=o(r(1708)),i=r(92778);t.OldNodeError="PhotoStructure v2026.2+ requires Node.js v22.3 or later (v25 recommended)"},69772(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.npmCacheClean=c,t.readJsonMaybe=d,t.needsNpmInstall=f,t.prepAndInstall=function(){const e=(0,s.gitPullAndMaybeBounce)(),t={node:process.versions.node,photostructure:e.version_after_pull},r=process.argv.includes("--reinstall")||(0,i.isTrue)(process.env.PS_REINSTALL),n=d((0,i.priorVersionFile)()),l=n?.photostructure!==t.photostructure||n?.node!==t.node,a=e.version_before_pull!==e.version_after_pull,h=f();(0,i.dbg)("cleanup?",{reinstall:r,mismatchedInstalledVersion:l,mismatchedRunningVersions:a,missingNodeModules:h,priorInstalledJson:n,expectedVersionJson:t,configDir:(0,i.configDir)()}),(r||l||a||h)&&(console.log("Cleaning up any prior builds..."),c(),(0,o.writeFileSync)((0,i.priorVersionFile)(),JSON.stringify(t)),(0,u.assertPythonSetuptools)(),p())},t.npmInstall=p;const o=r(73024),n=r(76760),i=r(92778),s=r(93249),u=r(58789),l=r(14325);function a(...e){if(0===e.length)throw new Error("rm(): no args");const t=(0,n.join)(...e);try{(0,i.dbg)("rm("+t+")"),(0,o.rmSync)(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:500})}catch(e){console.warn("warn: failed to rm "+t+": "+e)}}function c(){a(i.ROOT,"node_modules"),i.isWin?(a(process.env.APPDATA,"npm-cache","_libvips"),a(process.env.LOCALAPPDATA,"node-gyp")):(a(i.HOME,".npm","_libvips"),a(i.HOME,".node-gyp"))}function d(e){try{return JSON.parse((0,o.readFileSync)(e,{encoding:"utf8"}))}catch{return}}function f(){return!(0,o.existsSync)((0,n.join)(i.ROOT,"node_modules"))}function p(e){(0,i.run)((0,l.npm)(),["install"],{timeout:e})}},58789(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.assertPythonSetuptools=function(){try{(0,i.dbg)("Checking python..."),(0,i.run)((0,s.python)(),["-c",'"import distutils"'])}catch(e){if(!(0,i.toS)(e).includes("No module named 'distutils'"))throw e;(0,i.dbg)("Installing setuptools...");try{i.isBrew?(0,i.run)("brew",["install","-q","python","python-setuptools"]):i.isWin?(0,i.run)((0,s.pathToTool_)((0,i.toNotBlank)(n.default.env.PIP)??"pip.exe"),["install","setuptools"]):(0,i.run)((0,s.python)(),["-m","pip","install","setuptools"])}catch(e){(0,i.die)(`Failed to install Python setuptools: ${(0,i.toS)(e)}`,"https://photostructure.com/server/photostructure-for-node/#troubleshooting-python")}}};const n=o(r(1708)),i=r(92778),s=r(14325)},14325(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.python=t.npm=t.git=void 0,t.pathToTool_=function(e){const t=l(e);return null==t&&(0,u.die)(`Please install ${e}`,"https://photostructure.com/server/photostructure-for-node/#troubleshooting-prerequisites"),t};const n=r(73024),i=o(r(76760)),s=o(r(1708)),u=r(92778);function l(e){if(null!=e&&0!==(0,u.toS)(e).trim().length){if(i.default.isAbsolute(e)&&t(e))return e;for(const r of(0,u.toS)(s.default.env.PATH).split(i.default.delimiter)){const o=i.default.join(r,e);if(t(o))return(0,u.dbg)("pathToTool("+e+"): "+o),o}(0,u.dbg)("pathToTool("+e+"): not found")}function t(e){try{return(0,n.accessSync)(e,n.constants.R_OK|(u.isWin?0:n.constants.X_OK)),!0}catch{return!1}}}function a({envName:e,posixName:t,winName:r,desc:o}){return(0,u.defer)(()=>{const n=(0,u.toNotBlank)(s.default.env[e])??(u.isWin?r:t),i=l(n);if(null!=i)return i;(0,u.die)(`Please reinstall ${o} (missing ${n})`,"https://photostructure.com/server/photostructure-for-node/#troubleshooting-prerequisites")})}t.git=a({desc:"Git",envName:"GIT",posixName:"git",winName:"git.exe"}),t.npm=a({desc:"Node.js",envName:"NPM",posixName:"npm",winName:"npm.cmd"}),t.python=a({desc:"Python",envName:"PYTHON",posixName:"python3",winName:"py.exe"})},31421(e){e.exports=require("node:child_process")},71553(e){e.exports=require("node:dns/promises")},73024(e){e.exports=require("node:fs")},48161(e){e.exports=require("node:os")},76760(e){e.exports=require("node:path")},1708(e){e.exports=require("node:process")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={id:o,loaded:!1,exports:{}};return e[o].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.c=t,r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var o=r(r.s=11610);module.exports=o})();
6
+ "use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJS=(e,t)=>function(){try{return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of __getOwnPropNames(t))!__hasOwnProp.call(e,i)&&i!==n&&__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:__create(__getProtoOf(e)),__copyProps(t||!e||!e.__esModule?__defProp(n,`default`,{value:e,enumerable:!0}):n,e)),__toCommonJS=e=>__copyProps(__defProp({},`__esModule`,{value:!0}),e),require_parser=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js"(e,t){var n=1114112,r=class e extends Error{constructor(t,n,r){super(`[ParserError] `+t,n,r),this.name=`ParserError`,this.code=`ParserError`,Error.captureStackTrace&&Error.captureStackTrace(this,e)}},i=class{constructor(e){this.parser=e,this.buf=``,this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}},a=class{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf=``,this.char=null,this.ii=0,this.state=new i(this.parseStart)}parse(e){if(e.length===0||e.length==null)return;this._buf=String(e),this.ii=-1,this.char=-1;let t;for(;t===!1||this.nextChar();)t=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=n;let e;do e=this.state.parser,this.runOne();while(this.state.parser!==e);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(e){if(typeof e!=`function`)throw new r(`Tried to set state to non-existent state: `+JSON.stringify(e));this.state.parser=e}goto(e){return this.next(e),this.runOne()}call(e,t){t&&this.next(t),this.stack.push(this.state),this.state=new i(e)}callNow(e,t){return this.call(e,t),this.runOne()}return(e){if(this.stack.length===0)throw this.error(new r(`Stack underflow`));e===void 0&&(e=this.state.buf),this.state=this.stack.pop(),this.state.returned=e}returnNow(e){return this.return(e),this.runOne()}consume(){if(this.char===n)throw this.error(new r(`Unexpected end-of-buffer`));this.state.buf+=this._buf[this.ii]}error(e){return e.line=this.line,e.col=this.col,e.pos=this.pos,e}parseStart(){throw new r(`Must declare a parseStart method`)}};a.END=n,a.Error=r,t.exports=a}}),require_create_datetime=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js"(e,t){t.exports=e=>{let t=new Date(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_format_num=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js"(e,t){t.exports=(e,t)=>{for(t=String(t);t.length<e;)t=`0`+t;return t}}}),require_create_datetime_float=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js"(e,t){var n=require_format_num(),r=class extends Date{constructor(e){super(e+`Z`),this.isFloating=!0}toISOString(){return`${`${this.getUTCFullYear()}-${n(2,this.getUTCMonth()+1)}-${n(2,this.getUTCDate())}`}T${`${n(2,this.getUTCHours())}:${n(2,this.getUTCMinutes())}:${n(2,this.getUTCSeconds())}.${n(3,this.getUTCMilliseconds())}`}`}};t.exports=e=>{let t=new r(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_create_date=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js"(e,t){var n=require_format_num(),r=global.Date,i=class extends r{constructor(e){super(e),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${n(2,this.getUTCMonth()+1)}-${n(2,this.getUTCDate())}`}};t.exports=e=>{let t=new i(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_create_time=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js"(e,t){var n=require_format_num(),r=class extends Date{constructor(e){super(`0000-01-01T${e}Z`),this.isTime=!0}toISOString(){return`${n(2,this.getUTCHours())}:${n(2,this.getUTCMinutes())}:${n(2,this.getUTCSeconds())}.${n(3,this.getUTCMilliseconds())}`}};t.exports=e=>{let t=new r(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_toml_parser=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js"(exports,module){module.exports=makeParserClass(require_parser()),module.exports.makeParserClass=makeParserClass;var TomlError=class e extends Error{constructor(t){super(t),this.name=`TomlError`,Error.captureStackTrace&&Error.captureStackTrace(this,e),this.fromTOML=!0,this.wrapped=null}};TomlError.wrap=e=>{let t=new TomlError(e.message);return t.code=e.code,t.wrapped=e,t},module.exports.TomlError=TomlError;var createDateTime=require_create_datetime(),createDateTimeFloat=require_create_datetime_float(),createDate=require_create_date(),createTime=require_create_time(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:`\b`,[CHAR_t]:` `,[CHAR_n]:`
7
+ `,[CHAR_f]:`\f`,[CHAR_r]:`\r`,[CHAR_QUOT]:`"`,[CHAR_BSOL]:`\\`};function isDigit(e){return e>=CHAR_0&&e<=CHAR_9}function isHexit(e){return e>=CHAR_A&&e<=CHAR_F||e>=CHAR_a&&e<=CHAR_f||e>=CHAR_0&&e<=CHAR_9}function isBit(e){return e===CHAR_1||e===CHAR_0}function isOctit(e){return e>=CHAR_0&&e<=CHAR_7}function isAlphaNumQuoteHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_APOS||e===CHAR_QUOT||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function isAlphaNumHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_LOWBAR||e===CHAR_HYPHEN}var _type=Symbol(`type`),_declared=Symbol(`declared`),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(e,t){return hasOwnProperty.call(e,t)?!0:(t===`__proto__`&&defineProperty(e,`__proto__`,descriptor),!1)}var INLINE_TABLE=Symbol(`inline-table`);function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(e){return typeof e!=`object`||!e?!1:e[_type]===INLINE_TABLE}var TABLE=Symbol(`table`);function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(e){return typeof e!=`object`||!e?!1:e[_type]===TABLE}var _contentType=Symbol(`content-type`),INLINE_LIST=Symbol(`inline-list`);function InlineList(e){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:e}})}function isInlineList(e){return typeof e!=`object`||!e?!1:e[_type]===INLINE_LIST}var LIST=Symbol(`list`);function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(e){return typeof e!=`object`||!e?!1:e[_type]===LIST}var _custom;try{const utilInspect=eval(`require('util').inspect`);_custom=utilInspect.custom}catch{}var _inspect=_custom||`inspect`,BoxedBigInt=class{constructor(e){try{this.value=global.BigInt.asIntN(64,e)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}},INTEGER=Symbol(`integer`);function Integer(e){let t=Number(e);return Object.is(t,-0)&&(t=0),global.BigInt&&!Number.isSafeInteger(t)?new BoxedBigInt(e):Object.defineProperties(new Number(t),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${e}]`}})}function isInteger(e){return typeof e!=`object`||!e?!1:e[_type]===INTEGER}var FLOAT=Symbol(`float`);function Float(e){return Object.defineProperties(new Number(e),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${e}]`}})}function isFloat(e){return typeof e!=`object`||!e?!1:e[_type]===FLOAT}function tomlType(e){let t=typeof e;if(t===`object`){if(e===null)return`null`;if(e instanceof Date)return`datetime`;if(_type in e)switch(e[_type]){case INLINE_TABLE:return`inline-table`;case INLINE_LIST:return`inline-list`;case TABLE:return`table`;case LIST:return`list`;case FLOAT:return`float`;case INTEGER:return`integer`}}return t}function makeParserClass(e){class t extends e{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===e.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===e.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===e.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError(`Unexpected character, expected only whitespace or comments till end of line`))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(e){let t=this.ctx,n=e.key.pop();for(let n of e.key){if(hasKey(t,n)&&(!isTable(t[n])||t[n][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));t=t[n]=t[n]||Table()}if(hasKey(t,n))throw this.error(new TomlError(`Can't redefine existing key`));return isInteger(e.value)||isFloat(e.value)?t[n]=e.value.valueOf():t[n]=e.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(e){return this.state.resultTable?this.state.resultTable.push(e):this.state.resultTable=[e],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError(`Invalid character, expected "="`))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(e){return this.returnNow({key:this.state.resultTable,value:e})}parseComment(){do if(this.char===e.END||this.char===CTRL_J)return this.return();while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)&&(!isTable(this.ctx[e])||this.ctx[e][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));return this.ctx=this.ctx[e]=this.ctx[e]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else throw this.error(new TomlError(`Can't redefine existing key`));return this.next(this.parseTableNext)}throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)||(this.ctx[e]=List()),isInlineList(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline array`));if(isList(this.ctx[e])){let t=Table();this.ctx[e].push(t),this.ctx=t}else throw this.error(new TomlError(`Can't redefine an existing key`));return this.next(this.parseListEnd)}if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isInlineList(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline array`));else if(isInlineTable(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline table`));else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else throw this.error(new TomlError(`Can't redefine an existing key`));return this.next(this.parseListNext)}throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseListEnd(e){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseValue(){if(this.char===e.END)throw this.error(new TomlError(`Key without value`));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError(`Unexpected character, expecting string, number, datetime, boolean, inline array or inline table`))}recordValue(e){return this.returnNow(e)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError(`Unexpected character, expected "inf", "+inf" or "-inf"`))}parseInf2(){if(this.char===CHAR_f)return this.state.buf===`-`?this.return(-1/0):this.return(1/0);throw this.error(new TomlError(`Unexpected character, expected "inf", "+inf" or "-inf"`))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError(`Unexpected character, expected "nan"`))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError(`Unexpected character, expected "nan"`))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===e.END)throw this.error(new TomlError(`Key ended without value`));if(isAlphaNumHyphen(this.char))this.consume();else if(this.state.buf.length===0)throw this.error(new TomlError(`Empty bare keys are not allowed`));else return this.returnNow()}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError(`Unterminated string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===e.END)throw this.error(new TomlError(`Unterminated multi-line string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+=`'`,this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.return():(this.state.buf+=`''`,this.goto(this.parseLiteralMultiStringContent))}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError(`Unterminated string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}recordEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===e.END)throw this.error(new TomlError(`Unterminated multi-line string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}errorControlCharInString(){let e=`\\u00`;return this.char<16&&(e+=`0`),e+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${e} instead`))}recordMultiEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+=`"`,this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.return():(this.state.buf+=`""`,this.goto(this.parseMultiStringContent))}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError(`Can't escape whitespace`))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError(`Unknown escape character: `+this.char))}parseUnicodeReturn(e){try{let t=parseInt(e,16);if(t>=SURROGATE_FIRST&&t<=SURROGATE_LAST)throw this.error(new TomlError(`Invalid unicode, character in range 0xD800 - 0xDFFF is reserved`));return this.returnNow(String.fromCodePoint(t))}catch(e){throw this.error(TomlError.wrap(e))}}parseSmallUnicode(){if(!isHexit(this.char))throw this.error(new TomlError(`Invalid character in unicode sequence, expected hex`));if(this.consume(),this.state.buf.length>=4)return this.return()}parseLargeUnicode(){if(!isHexit(this.char))throw this.error(new TomlError(`Invalid character in unicode sequence, expected hex`));if(this.consume(),this.state.buf.length>=8)return this.return()}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError(`Unexpected character, expected digit`));if(this.atEndOfWord())throw this.error(new TomlError(`Incomplete number`));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError(`Unexpected character, expected digit`));if(this.atEndOfWord())throw this.error(new TomlError(`Incomplete number`));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else return this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError(`Unexpected character, expected -, + or digit`))}parseNumberExponent(){if(isDigit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);else return this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);else if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);else return this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError(`Expected digit while parsing year part of a date`))}if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError(`Expected hyphen (-) while parsing year part of date`))}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseIntegerOct(){if(isOctit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseIntegerBin(){if(isBit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError(`Years less than 1000 must be zero padded to four characters`));return this.state.result=this.state.buf,this.state.buf=``,this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError(`Months less than 10 must be zero padded to two characters`));return this.state.result+=`-`+this.state.buf,this.state.buf=``,this.next(this.parseDateDay)}if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError(`Days less than 10 must be zero padded to two characters`));return this.state.result+=`-`+this.state.buf,this.state.buf=``,this.next(this.parseStartTimeHour)}if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+`-`+this.state.buf));if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError(`Hours less than 10 must be zero padded to two characters`));return this.state.result+=`T`+this.state.buf,this.state.buf=``,this.next(this.parseTimeMin)}if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseTimeSec);else throw this.error(new TomlError(`Incomplete datetime`))}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError(`Incomplete datetime`))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError(`Hours less than 10 must be zero padded to two characters`));return this.state.result=this.state.buf,this.state.buf=``,this.next(this.parseOnlyTimeMin)}throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseOnlyTimeSec);else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeFractionMaybe(){if(this.state.result+=`:`+this.state.buf,this.char===CHAR_PERIOD)this.state.buf=``,this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError(`Expected digit in milliseconds`));return this.returnNow(createTime(this.state.result+`.`+this.state.buf))}else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else if(this.state.buf.length===1)throw this.error(new TomlError(`Expected digit in milliseconds`));else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError(`Unexpected character in datetime, expected digit`))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError(`Unexpected character in datetime, expected colon`))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError(`Unexpected character in datetime, expected digit`))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===e.END)throw this.error(new TomlError(`Unterminated inline array`));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(e){if(this.state.resultArr){let t=this.state.resultArr[_contentType],n=tomlType(e);if(t!==n)throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${t} and ${n}`))}else this.state.resultArr=InlineList(tomlType(e));return isFloat(e)||isInteger(e)?this.state.resultArr.push(e.valueOf()):this.state.resultArr.push(e),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError(`Invalid character, expected whitespace, comma (,) or close bracket (])`))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError(`Unterminated inline array`));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(e){let t=this.state.resultTable,n=e.key.pop();for(let n of e.key){if(hasKey(t,n)&&(!isTable(t[n])||t[n][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));t=t[n]=t[n]||Table()}if(hasKey(t,n))throw this.error(new TomlError(`Can't redefine existing key`));return isInteger(e.value)||isFloat(e.value)?t[n]=e.value.valueOf():t[n]=e.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError(`Unterminated inline array`));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTable);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError(`Invalid character, expected whitespace, comma (,) or close bracket (])`))}}return t}}}),require_parse_pretty_error=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js"(e,t){t.exports=n;function n(e,t){if(e.pos==null||e.line==null)return e;let n=e.message;if(n+=` at row ${e.line+1}, col ${e.col+1}, pos ${e.pos}:
8
+ `,t&&t.split){let r=t.split(/\n/),i=String(Math.min(r.length,e.line+3)).length,a=` `;for(;a.length<i;)a+=` `;for(let t=Math.max(0,e.line-1);t<Math.min(r.length,e.line+2);++t){let o=String(t+1);if(o.length<i&&(o=` `+o),e.line===t){n+=o+`> `+r[t]+`
9
+ `,n+=a+` `;for(let t=0;t<e.col;++t)n+=` `;n+=`^
10
+ `}else n+=o+`: `+r[t]+`
11
+ `}}return e.message=n+`
12
+ `,e}}}),require_parse_string=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js"(e,t){t.exports=i;var n=require_toml_parser(),r=require_parse_pretty_error();function i(e){global.Buffer&&global.Buffer.isBuffer(e)&&(e=e.toString(`utf8`));let t=new n;try{return t.parse(e),t.finish()}catch(t){throw r(t,e)}}}}),require_parse_async=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js"(e,t){t.exports=i;var n=require_toml_parser(),r=require_parse_pretty_error();function i(e,t){t||={};let i=0,a=t.blocksize||40960,o=new n;return new Promise((e,t)=>{setImmediate(s,0,a,e,t)});function s(t,n,i,a){if(t>=e.length)try{return i(o.finish())}catch(t){return a(r(t,e))}try{o.parse(e.slice(t,t+n)),setImmediate(s,t+n,n,i,a)}catch(t){a(r(t,e))}}}}}),require_parse_stream=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js"(e,t){t.exports=i;var n=require("stream"),r=require_toml_parser();function i(e){return e?a(e):o(e)}function a(e){let t=new r;return e.setEncoding(`utf8`),new Promise((n,r)=>{let i,a=!1,o=!1;function s(){if(a=!0,!i)try{n(t.finish())}catch(e){r(e)}}function c(e){o=!0,r(e)}e.once(`end`,s),e.once(`error`,c),l();function l(){i=!0;let n;for(;(n=e.read())!==null;)try{t.parse(n)}catch(e){return c(e)}if(i=!1,a)return s();o||e.once(`readable`,l)}})}function o(){let e=new r;return new n.Transform({objectMode:!0,transform(t,n,r){try{e.parse(t.toString(n))}catch(e){this.emit(`error`,e)}r()},flush(t){try{this.push(e.finish())}catch(e){this.emit(`error`,e)}t()}})}}}),require_parse=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js"(e,t){t.exports=require_parse_string(),t.exports.async=require_parse_async(),t.exports.stream=require_parse_stream(),t.exports.prettyError=require_parse_pretty_error()}}),require_stringify=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js"(e,t){t.exports=n,t.exports.value=v;function n(e){if(e===null)throw r(`null`);if(e===void 0)throw r(`undefined`);if(typeof e!=`object`)throw r(typeof e);if(typeof e.toJSON==`function`&&(e=e.toJSON()),e==null)return null;let t=u(e);if(t!==`table`)throw r(t);return c(``,``,e)}function r(e){return Error(`Can only stringify objects, not `+e)}function i(){return Error(`Array values can't have mixed types`)}function a(e){return Object.keys(e).filter(t=>l(e[t]))}function o(e){return Object.keys(e).filter(t=>!l(e[t]))}function s(e){let t=Array.isArray(e)?[]:Object.prototype.hasOwnProperty.call(e,`__proto__`)?{["__proto__"]:void 0}:{};for(let n of Object.keys(e))t[n]=e[n]&&typeof e[n].toJSON==`function`&&!(`toISOString`in e[n])?e[n].toJSON():e[n];return t}function c(e,t,n){n=s(n);var r=a(n),i=o(n),c=[],l=t||``;r.forEach(e=>{var t=u(n[e]);t!==`undefined`&&t!==`null`&&c.push(l+d(e)+` = `+_(n[e],!0))}),c.length>0&&c.push(``);var f=e&&r.length>0?t+` `:``;return i.forEach(t=>{c.push(O(e,f,t,n[t]))}),c.join(`
13
+ `)}function l(e){switch(u(e)){case`undefined`:case`null`:case`integer`:case`nan`:case`float`:case`boolean`:case`string`:case`datetime`:return!0;case`array`:return e.length===0||u(e[0])!==`table`;case`table`:return Object.keys(e).length===0;default:return!1}}function u(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`bigint`||Number.isInteger(e)&&!Object.is(e,-0)?`integer`:typeof e==`number`?`float`:typeof e==`boolean`?`boolean`:typeof e==`string`?`string`:`toISOString`in e?isNaN(e)?`undefined`:`datetime`:Array.isArray(e)?`array`:`table`}function d(e){var t=String(e);return/^[-A-Za-z0-9_]+$/.test(t)?t:f(t)}function f(e){return`"`+h(e).replace(/"/g,`\\"`)+`"`}function p(e){return`'`+e+`'`}function m(e,t){for(;t.length<e;)t=`0`+t;return t}function h(e){return e.replace(/\\/g,`\\\\`).replace(/[\b]/g,`\\b`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\f/g,`\\f`).replace(/\r/g,`\\r`).replace(/([\u0000-\u001f\u007f])/,e=>`\\u`+m(4,e.codePointAt(0).toString(16)))}function g(e){let t=e.split(/\n/).map(e=>h(e).replace(/"(?="")/g,`\\"`)).join(`
14
+ `);return t.slice(-1)===`"`&&(t+=`\\
15
+ `),`"""
16
+ `+t+`"""`}function _(e,t){let n=u(e);return n===`string`&&(t&&/\n/.test(e)?n=`string-multiline`:!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(n=`string-literal`)),v(e,n)}function v(e,t){switch(t||=u(e),t){case`string-multiline`:return g(e);case`string`:return f(e);case`string-literal`:return p(e);case`integer`:return y(e);case`float`:return b(e);case`boolean`:return x(e);case`datetime`:return S(e);case`array`:return E(e.filter(e=>u(e)!==`null`&&u(e)!==`undefined`&&u(e)!==`nan`));case`table`:return D(e);default:throw r(t)}}function y(e){return String(e).replace(/\B(?=(\d{3})+(?!\d))/g,`_`)}function b(e){if(e===1/0)return`inf`;if(e===-1/0)return`-inf`;if(Object.is(e,NaN))return`nan`;if(Object.is(e,-0))return`-0.0`;var t=String(e).split(`.`),n=t[0],r=t[1]||0;return y(n)+`.`+r}function x(e){return String(e)}function S(e){return e.toISOString()}function C(e){return e===`float`||e===`integer`}function w(e){var t=u(e[0]);return e.every(e=>u(e)===t)?t:e.every(e=>C(u(e)))?`float`:`mixed`}function T(e){let t=w(e);if(t===`mixed`)throw i();return t}function E(e){e=s(e);let t=T(e);var n=`[`,r=e.map(e=>v(e,t));return r.join(`, `).length>60||/\n/.test(r)?n+=`
17
+ `+r.join(`,
18
+ `)+`
19
+ `:n+=` `+r.join(`, `)+(r.length>0?` `:``),n+`]`}function D(e){e=s(e);var t=[];return Object.keys(e).forEach(n=>{t.push(d(n)+` = `+_(e[n],!1))}),`{ `+t.join(`, `)+(t.length>0?` `:``)+`}`}function O(e,t,n,i){var a=u(i);if(a===`array`)return k(e,t,n,i);if(a===`table`)return A(e,t,n,i);throw r(a)}function k(e,t,n,i){i=s(i),T(i);var a=u(i[0]);if(a!==`table`)throw r(a);var o=e+d(n),l=``;return i.forEach(e=>{l.length>0&&(l+=`
20
+ `),l+=t+`[[`+o+`]]
21
+ `,l+=c(o+`.`,t,e)}),l}function A(e,t,n,r){var i=e+d(n),o=``;return a(r).length>0&&(o+=t+`[`+i+`]
22
+ `),o+c(i+`.`,t,r)}}}),require_toml=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js"(e){e.parse=require_parse(),e.stringify=require_stringify()}}),bootstrap_exports={};__export(bootstrap_exports,{bootstrapMain:()=>bootstrapMain,isNpmInstall:()=>isNpmInstall}),module.exports=__toCommonJS(bootstrap_exports);var import_node_fs5=require("node:fs"),import_node_path6=require("node:path"),import_node_process6=__toESM(require("node:process")),import_node_child_process=require("node:child_process"),import_promises=require("node:dns/promises"),import_node_fs2=require("node:fs"),import_node_os=require("node:os"),import_node_path3=__toESM(require("node:path")),import_node_process=__toESM(require("node:process"));function toBoolean(e){if(typeof e==`boolean`)return e;if(e==null)return;if(e===1)return!0;if(e===0)return!1;if(typeof e!=`string`)return;let t=e.toLowerCase().trim();if([`true`,`1`].includes(t))return!0;if([`false`,`0`].includes(t))return!1}function isTrue(e){return toBoolean(e)===!0}function isError(e){return e!=null&&e instanceof Error}function toError(e){return e==null?void 0:isError(e)?e:Error(String(e))}var deferredComputations=new WeakSet;function defer(e){let t,n,r=!1,i=function(){if(r){if(n!=null)throw n;return t}try{return r=!0,t=e()}catch(e){throw n=toError(e),n}};return i.prior=()=>t,i.hasPrior=()=>r,i.applied=()=>r,i.reset=()=>{let e=t;return t=void 0,n=void 0,r=!1,e},deferredComputations.add(i),i}var import_node_path=require("node:path");function nativeConfigDirs(e){let{appName:t,home:n}=e;return(e.os===`win`?[e.appData,(0,import_node_path.join)(n,`AppData`,`Roaming`),e.localAppData]:e.os===`mac`?[(0,import_node_path.join)(n,`Library`,`Application Support`)]:[notBlank(e.xdgConfigHome)??(0,import_node_path.join)(n,`.config`)]).map(e=>notBlank(e)).filter(e=>e!=null).map(e=>({dir:(0,import_node_path.join)(e,t),preexistingDir:e}))}function notBlank(e){return e!=null&&e.trim().length>0?e:void 0}var import_node_fs=require("node:fs"),import_node_path2=require("node:path"),SettingsToml=`settings.toml`,import_toml=__toESM(require_toml()),ByteOrderMarks=[{bom:[239,187,191],encoding:`utf8`},{bom:[255,254],encoding:`utf16le`}];function debom(e){for(let{bom:t,encoding:n}of ByteOrderMarks)if(t.every((t,n)=>e[n]===t))return e.subarray(t.length).toString(n);return e.toString()}var Smart2Dumb=[[/[‘’]/g,`'`],[/[“”„«»〃]/g,`"`]];function dumbquote(e){return Smart2Dumb.reduce((e,[t,n])=>e.replace(t,n),e).normalize()}function parseTomlBuffer(e){let t=debom(e);if(t.trim().length!==0)try{return(0,import_toml.parse)(dumbquote(t))}catch(e){throw tomlErrorWithoutSource(e)}}function tomlErrorForLog(e){if(typeof e!=`object`||!e)return e;let t=e;return t.fromTOML===!0?{name:typeof t.name==`string`?t.name:`TomlError`,...typeof t.line==`number`?{row:t.line+1}:{},...typeof t.col==`number`?{column:t.col+1}:{}}:e}function tomlErrorWithoutSource(e){let t=tomlErrorForLog(e);if(t===e)return e;let{row:n,column:r}=t,i=typeof n==`number`?` at row ${n}`:``,a=typeof r==`number`?`${i===``?` at`:`,`} column ${r}`:``,o=Error(`Invalid TOML${i}${a}`);return Object.assign(o,t),o}function lazyConfigSettings(e){return defer(()=>{let t=(0,import_node_path2.join)(e(),SettingsToml);try{return parseTomlBuffer((0,import_node_fs.readFileSync)(t))}catch(e){if(e.code===`ENOENT`)return;throw Error(`Cannot read ${t}: ${e}`,{cause:e})}})}var defer2=defer,toBoolean2=toBoolean,isTrue2=isTrue;function roundMs(e){return Math.round(e*10)/10}function toS(e){return e==null?``:String(e)}var defaultHref=`https://photostructure.com/server/photostructure-for-node/`;function die(e,t){for(let n of[toS(e),`Please refer to ${t??defaultHref}`,`You can also visit https://forum.photostructure.com for help.`,``])console.error(n);import_node_process.default.exit(1)}var dbg=/\bdebug\b/.test(import_node_process.default.env.PS_LOG_LEVEL??``)||import_node_process.default.argv.includes(`--debug`)?console.log:()=>void 0;function blank(e){return e==null||toS(e).trim().length===0}function toNotBlank(e){return blank(e)?void 0:toS(e)}var dnsLookup=import_promises.lookup,isNetworkDisabled=defer2(async()=>{if(!blank(import_node_process.default.env.PS_NO_NETWORK))return isTrue2(import_node_process.default.env.PS_NO_NETWORK);try{return await Promise.race([dnsLookup(`account.photostructure.com`,{family:4}),new Promise((e,t)=>setTimeout(()=>t(Error(`Network timeout`)),7e3))]),!1}catch(e){return dbg(`Network disabled: `+e),!0}}),isWin=import_node_process.default.platform===`win32`,isMac=import_node_process.default.platform===`darwin`,BrewPaths=[`/opt/homebrew/bin/brew`,`/usr/local/bin/brew`],brewPath=defer2(()=>isMac&&!isTrue2(import_node_process.default.env.NOBREW)?BrewPaths.find(e=>(0,import_node_fs2.existsSync)(e)):void 0);function run(e,t,n){let r=performance.now();isWin&&e.includes(` `)&&(e=`"`+e+`"`);let i=(0,import_node_child_process.spawnSync)(e,t,{cwd:ROOT,timeout:1e4,...n,encoding:`utf8`,shell:isWin});if(i.status!==0||i.error!=null)throw Error(`"${e} ${t.join(` `)}" failed: ${toS(i.error)} ${i.stderr}`);return dbg(`run(`+e+`)`,{args:t,result:i,elapsedMs:roundMs(performance.now()-r)}),i}var ROOT=import_node_path3.default.resolve(import_node_path3.default.join(__dirname,`..`)),HOME=import_node_process.default.env.HOME??(0,import_node_os.homedir)();function readPackageVersion(){return JSON.parse((0,import_node_fs2.readFileSync)((0,import_node_path3.join)(ROOT,`package.json`),`utf8`)).version}var AppName=`PhotoStructure`,configDir=defer2(()=>{let e=toNotBlank(import_node_process.default.env.PS_CONFIG_DIR)??firstNativeConfigDir();return(0,import_node_fs2.mkdirSync)(e,{recursive:!0,mode:448}),e}),configSettings=lazyConfigSettings(()=>configDir());function nativeConfigDirCandidates(){return nativeConfigDirs({appName:AppName,home:HOME,os:isWin?`win`:isMac?`mac`:`linux`,appData:import_node_process.default.env.APPDATA,localAppData:import_node_process.default.env.LOCALAPPDATA,xdgConfigHome:import_node_process.default.env.XDG_CONFIG_HOME})}function firstNativeConfigDir(){let e=nativeConfigDirCandidates();return(e.find(e=>(0,import_node_fs2.existsSync)(e.dir))??e.find(e=>(0,import_node_fs2.existsSync)(e.preexistingDir))??e[0]).dir}function priorVersionFile(){return(0,import_node_path3.join)(configDir(),`prior-version.json`)}function existingPriorVersionFile(){let e=[priorVersionFile()];return toNotBlank(import_node_process.default.env.PS_CONFIG_DIR)??e.push((0,import_node_path3.join)(HOME,`.config`,AppName,`prior-version.json`)),e.find(e=>(0,import_node_fs2.existsSync)(e))}var import_node_process3=__toESM(require("node:process")),import_node_fs3=require("node:fs"),import_node_path4=__toESM(require("node:path")),import_node_process2=__toESM(require("node:process"));function pathToTool(e){if(e==null||toS(e).trim().length===0)return;function t(e){try{return(0,import_node_fs3.accessSync)(e,import_node_fs3.constants.R_OK|(isWin?0:import_node_fs3.constants.X_OK)),!0}catch{return!1}}if(import_node_path4.default.isAbsolute(e)&&t(e))return e;for(let n of toS(import_node_process2.default.env.PATH).split(import_node_path4.default.delimiter)){let r=import_node_path4.default.join(n,e);if(t(r))return dbg(`pathToTool(`+e+`): `+r),r}dbg(`pathToTool(`+e+`): not found`)}function pathToTool_(e){let t=pathToTool(e);return t??die(`Please install ${e}`,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-prerequisites`),t}function deferredTool({envName:e,posixName:t,winName:n,desc:r}){return defer2(()=>{let i=toNotBlank(import_node_process2.default.env[e])??(isWin?n:t),a=pathToTool(i);if(a==null)die(`Please reinstall ${r} (missing ${i})`,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-prerequisites`);else return a})}var git=deferredTool({desc:`Git`,envName:`GIT`,posixName:`git`,winName:`git.exe`}),npm=deferredTool({desc:`Node.js`,envName:`NPM`,posixName:`npm`,winName:`npm.cmd`}),python=deferredTool({desc:`Python`,envName:`PYTHON`,posixName:`python3`,winName:`py.exe`}),EnvOnBounce={PS_BOUNCED:`1`,PS_REINSTALL:`1`};function autoUpdateCheckDisabled(){let e=toBoolean2(import_node_process3.default.env.PS_AUTO_UPDATE_CHECK)??toBoolean2(import_node_process3.default.env.autoUpdateCheck);if(e!=null)return e===!1;try{let e=configSettings();return toBoolean2(e?.PS_AUTO_UPDATE_CHECK??e?.autoUpdateCheck)===!1}catch(e){return console.warn(`warn: skipping startup git update: ${e}`),!0}}var gitPullAndMaybeBounce=defer2(()=>{let e=readPackageVersion();dbg({version_before_pull:e});let t=isTrue2(import_node_process3.default.env.NOGIT),n=isTrue2(import_node_process3.default.env.PS_NO_GIT);if(!(t||n)&&import_node_process3.default.env.PS_CHECK_UPDATES!==`none`&&!autoUpdateCheckDisabled()){try{run(git(),[`stash`,`--include-untracked`])}catch(e){console.warn(`warn: git stash failed: `+e)}try{run(git(),[`pull`],{timeout:3e4})}catch(e){console.warn(`warn: git failed: `+e)}}let r=readPackageVersion();return dbg({version_after_pull:r}),!isTrue2(import_node_process3.default.env.PS_BOUNCED)&&(isTrue2(import_node_process3.default.env.PS_DEV_FORCE_BOUNCE)||e!==r)?(run(import_node_process3.execPath,import_node_process3.execArgv,{env:{...import_node_process3.default.env,...EnvOnBounce},stdio:`inherit`,timeout:void 0}),{bounced:!0,version_before_pull:e,version_after_pull:r}):{bounced:!1,version_before_pull:e,version_after_pull:r}}),import_node_process4=__toESM(require("node:process")),OldNodeError=`PhotoStructure v2026.2+ requires Node.js v22.3 or later (v25 recommended)`;function assertNodeVersion(){let[e,t]=import_node_process4.default.versions.node.split(`.`).map(e=>parseInt(e));dbg({node_version:import_node_process4.default.versions.node,major:e,minor:t}),e<22||e===22&&t<3?die(OldNodeError,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-node-version`):dbg(`Node.js version: `+import_node_process4.default.versions.node)}var import_node_fs4=require("node:fs"),import_node_path5=require("node:path"),import_node_process5=__toESM(require("node:process"));function assertPythonSetuptools(){try{dbg(`Checking python...`),run(python(),[`-c`,`"import distutils"`])}catch(e){if(toS(e).includes(`No module named 'distutils'`)){dbg(`Installing setuptools...`);try{let e=brewPath();e==null?isWin?run(pathToTool_(toNotBlank(import_node_process5.default.env.PIP)??`pip.exe`),[`install`,`setuptools`]):run(python(),[`-m`,`pip`,`install`,`setuptools`]):run(e,[`install`,`-q`,`python`,`python-setuptools`])}catch(e){die(`Failed to install Python setuptools: ${toS(e)}`,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-python`)}}else throw e}}function rm(...e){if(e.length===0)throw Error(`rm(): no args`);let t=(0,import_node_path5.join)(...e);try{dbg(`rm(`+t+`)`),(0,import_node_fs4.rmSync)(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:500})}catch(e){console.warn(`warn: failed to rm `+t+`: `+e)}}function npmCacheClean(){rm(ROOT,`node_modules`),isWin?(rm(process.env.APPDATA,`npm-cache`,`_libvips`),rm(process.env.LOCALAPPDATA,`node-gyp`)):(rm(HOME,`.npm`,`_libvips`),rm(HOME,`.node-gyp`))}function readJsonMaybe(e){try{return JSON.parse((0,import_node_fs4.readFileSync)(e,{encoding:`utf8`}))}catch{return}}function needsNpmInstall(){return!(0,import_node_fs4.existsSync)((0,import_node_path5.join)(ROOT,`node_modules`))}function prepAndInstall(){let e=gitPullAndMaybeBounce(),t={node:process.versions.node,photostructure:e.version_after_pull},n=process.argv.includes(`--reinstall`)||isTrue2(process.env.PS_REINSTALL),r=existingPriorVersionFile(),i=r==null?void 0:readJsonMaybe(r),a=i?.photostructure!==t.photostructure||i?.node!==t.node,o=e.version_before_pull!==e.version_after_pull,s=needsNpmInstall();dbg(`cleanup?`,{reinstall:n,mismatchedInstalledVersion:a,mismatchedRunningVersions:o,missingNodeModules:s,priorInstalledJson:i,expectedVersionJson:t,configDir:configDir()}),(n||a||o||s)&&(console.log(`Cleaning up any prior builds...`),npmCacheClean(),(0,import_node_fs4.writeFileSync)(priorVersionFile(),JSON.stringify(t)),assertPythonSetuptools(),npmCi())}function npmInstall(){run(npm(),[`install`],{timeout:void 0})}function npmCi(){run(npm(),[`ci`],{timeout:void 0})}var isNpmInstall=!(0,import_node_fs5.existsSync)((0,import_node_path6.join)(ROOT,`.git`));async function bootstrapMain(){if(!import_node_process6.default.argv.slice(2).includes(`--stop`)&&(assertNodeVersion(),!isNpmInstall)){if(await isNetworkDisabled()){let e=existingPriorVersionFile();e??die(`Network access is disabled.
23
+ Please enable your WAN during your first run to download PhotoStructure's dependencies.`,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-network`),(readJsonMaybe(e)?.node!==import_node_process6.default.versions.node||needsNpmInstall())&&npmInstall()}else gitPullAndMaybeBounce().bounced||prepAndInstall()}}require.main===module&&(import_node_process6.default.on(`unhandledRejection`,e=>{die(`Unexpected rejection: `+e,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-unexpected`)}),import_node_process6.default.on(`uncaughtException`,e=>{die(`Unexpected error: `+e,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-unexpected`)}),bootstrapMain()),0&&(module.exports={bootstrapMain,isNpmInstall});
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ // Copyright © 2026, PhotoStructure Inc. All rights reserved.
3
+ // BY USING THIS SOFTWARE, YOU ACCEPT ALL OF THE TERMS IN
4
+ // https://photostructure.com/eula
5
+ // IF YOU DO NOT ACCEPT THESE TERMS, DO NOT USE THIS SOFTWARE
6
+ "use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJS=(e,t)=>function(){try{return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of __getOwnPropNames(t))!__hasOwnProp.call(e,i)&&i!==n&&__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:__create(__getProtoOf(e)),__copyProps(t||!e||!e.__esModule?__defProp(n,`default`,{value:e,enumerable:!0}):n,e)),require_parser=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js"(e,t){var n=1114112,r=class e extends Error{constructor(t,n,r){super(`[ParserError] `+t,n,r),this.name=`ParserError`,this.code=`ParserError`,Error.captureStackTrace&&Error.captureStackTrace(this,e)}},i=class{constructor(e){this.parser=e,this.buf=``,this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}},a=class{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf=``,this.char=null,this.ii=0,this.state=new i(this.parseStart)}parse(e){if(e.length===0||e.length==null)return;this._buf=String(e),this.ii=-1,this.char=-1;let t;for(;t===!1||this.nextChar();)t=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=n;let e;do e=this.state.parser,this.runOne();while(this.state.parser!==e);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(e){if(typeof e!=`function`)throw new r(`Tried to set state to non-existent state: `+JSON.stringify(e));this.state.parser=e}goto(e){return this.next(e),this.runOne()}call(e,t){t&&this.next(t),this.stack.push(this.state),this.state=new i(e)}callNow(e,t){return this.call(e,t),this.runOne()}return(e){if(this.stack.length===0)throw this.error(new r(`Stack underflow`));e===void 0&&(e=this.state.buf),this.state=this.stack.pop(),this.state.returned=e}returnNow(e){return this.return(e),this.runOne()}consume(){if(this.char===n)throw this.error(new r(`Unexpected end-of-buffer`));this.state.buf+=this._buf[this.ii]}error(e){return e.line=this.line,e.col=this.col,e.pos=this.pos,e}parseStart(){throw new r(`Must declare a parseStart method`)}};a.END=n,a.Error=r,t.exports=a}}),require_create_datetime=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js"(e,t){t.exports=e=>{let t=new Date(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_format_num=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js"(e,t){t.exports=(e,t)=>{for(t=String(t);t.length<e;)t=`0`+t;return t}}}),require_create_datetime_float=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js"(e,t){var n=require_format_num(),r=class extends Date{constructor(e){super(e+`Z`),this.isFloating=!0}toISOString(){return`${`${this.getUTCFullYear()}-${n(2,this.getUTCMonth()+1)}-${n(2,this.getUTCDate())}`}T${`${n(2,this.getUTCHours())}:${n(2,this.getUTCMinutes())}:${n(2,this.getUTCSeconds())}.${n(3,this.getUTCMilliseconds())}`}`}};t.exports=e=>{let t=new r(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_create_date=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js"(e,t){var n=require_format_num(),r=global.Date,i=class extends r{constructor(e){super(e),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${n(2,this.getUTCMonth()+1)}-${n(2,this.getUTCDate())}`}};t.exports=e=>{let t=new i(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_create_time=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js"(e,t){var n=require_format_num(),r=class extends Date{constructor(e){super(`0000-01-01T${e}Z`),this.isTime=!0}toISOString(){return`${n(2,this.getUTCHours())}:${n(2,this.getUTCMinutes())}:${n(2,this.getUTCSeconds())}.${n(3,this.getUTCMilliseconds())}`}};t.exports=e=>{let t=new r(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}}}),require_toml_parser=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js"(exports,module){module.exports=makeParserClass(require_parser()),module.exports.makeParserClass=makeParserClass;var TomlError=class e extends Error{constructor(t){super(t),this.name=`TomlError`,Error.captureStackTrace&&Error.captureStackTrace(this,e),this.fromTOML=!0,this.wrapped=null}};TomlError.wrap=e=>{let t=new TomlError(e.message);return t.code=e.code,t.wrapped=e,t},module.exports.TomlError=TomlError;var createDateTime=require_create_datetime(),createDateTimeFloat=require_create_datetime_float(),createDate=require_create_date(),createTime=require_create_time(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:`\b`,[CHAR_t]:` `,[CHAR_n]:`
7
+ `,[CHAR_f]:`\f`,[CHAR_r]:`\r`,[CHAR_QUOT]:`"`,[CHAR_BSOL]:`\\`};function isDigit(e){return e>=CHAR_0&&e<=CHAR_9}function isHexit(e){return e>=CHAR_A&&e<=CHAR_F||e>=CHAR_a&&e<=CHAR_f||e>=CHAR_0&&e<=CHAR_9}function isBit(e){return e===CHAR_1||e===CHAR_0}function isOctit(e){return e>=CHAR_0&&e<=CHAR_7}function isAlphaNumQuoteHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_APOS||e===CHAR_QUOT||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function isAlphaNumHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_LOWBAR||e===CHAR_HYPHEN}var _type=Symbol(`type`),_declared=Symbol(`declared`),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(e,t){return hasOwnProperty.call(e,t)?!0:(t===`__proto__`&&defineProperty(e,`__proto__`,descriptor),!1)}var INLINE_TABLE=Symbol(`inline-table`);function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(e){return typeof e!=`object`||!e?!1:e[_type]===INLINE_TABLE}var TABLE=Symbol(`table`);function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(e){return typeof e!=`object`||!e?!1:e[_type]===TABLE}var _contentType=Symbol(`content-type`),INLINE_LIST=Symbol(`inline-list`);function InlineList(e){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:e}})}function isInlineList(e){return typeof e!=`object`||!e?!1:e[_type]===INLINE_LIST}var LIST=Symbol(`list`);function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(e){return typeof e!=`object`||!e?!1:e[_type]===LIST}var _custom;try{const utilInspect=eval(`require('util').inspect`);_custom=utilInspect.custom}catch{}var _inspect=_custom||`inspect`,BoxedBigInt=class{constructor(e){try{this.value=global.BigInt.asIntN(64,e)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}},INTEGER=Symbol(`integer`);function Integer(e){let t=Number(e);return Object.is(t,-0)&&(t=0),global.BigInt&&!Number.isSafeInteger(t)?new BoxedBigInt(e):Object.defineProperties(new Number(t),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${e}]`}})}function isInteger(e){return typeof e!=`object`||!e?!1:e[_type]===INTEGER}var FLOAT=Symbol(`float`);function Float(e){return Object.defineProperties(new Number(e),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${e}]`}})}function isFloat(e){return typeof e!=`object`||!e?!1:e[_type]===FLOAT}function tomlType(e){let t=typeof e;if(t===`object`){if(e===null)return`null`;if(e instanceof Date)return`datetime`;if(_type in e)switch(e[_type]){case INLINE_TABLE:return`inline-table`;case INLINE_LIST:return`inline-list`;case TABLE:return`table`;case LIST:return`list`;case FLOAT:return`float`;case INTEGER:return`integer`}}return t}function makeParserClass(e){class t extends e{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===e.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===e.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===e.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError(`Unexpected character, expected only whitespace or comments till end of line`))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(e){let t=this.ctx,n=e.key.pop();for(let n of e.key){if(hasKey(t,n)&&(!isTable(t[n])||t[n][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));t=t[n]=t[n]||Table()}if(hasKey(t,n))throw this.error(new TomlError(`Can't redefine existing key`));return isInteger(e.value)||isFloat(e.value)?t[n]=e.value.valueOf():t[n]=e.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(e){return this.state.resultTable?this.state.resultTable.push(e):this.state.resultTable=[e],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError(`Invalid character, expected "="`))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(e){return this.returnNow({key:this.state.resultTable,value:e})}parseComment(){do if(this.char===e.END||this.char===CTRL_J)return this.return();while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)&&(!isTable(this.ctx[e])||this.ctx[e][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));return this.ctx=this.ctx[e]=this.ctx[e]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else throw this.error(new TomlError(`Can't redefine existing key`));return this.next(this.parseTableNext)}throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)||(this.ctx[e]=List()),isInlineList(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline array`));if(isList(this.ctx[e])){let t=Table();this.ctx[e].push(t),this.ctx=t}else throw this.error(new TomlError(`Can't redefine an existing key`));return this.next(this.parseListEnd)}if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isInlineList(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline array`));else if(isInlineTable(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline table`));else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else throw this.error(new TomlError(`Can't redefine an existing key`));return this.next(this.parseListNext)}throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseListEnd(e){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseValue(){if(this.char===e.END)throw this.error(new TomlError(`Key without value`));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError(`Unexpected character, expecting string, number, datetime, boolean, inline array or inline table`))}recordValue(e){return this.returnNow(e)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError(`Unexpected character, expected "inf", "+inf" or "-inf"`))}parseInf2(){if(this.char===CHAR_f)return this.state.buf===`-`?this.return(-1/0):this.return(1/0);throw this.error(new TomlError(`Unexpected character, expected "inf", "+inf" or "-inf"`))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError(`Unexpected character, expected "nan"`))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError(`Unexpected character, expected "nan"`))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===e.END)throw this.error(new TomlError(`Key ended without value`));if(isAlphaNumHyphen(this.char))this.consume();else if(this.state.buf.length===0)throw this.error(new TomlError(`Empty bare keys are not allowed`));else return this.returnNow()}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError(`Unterminated string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===e.END)throw this.error(new TomlError(`Unterminated multi-line string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+=`'`,this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.return():(this.state.buf+=`''`,this.goto(this.parseLiteralMultiStringContent))}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError(`Unterminated string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}recordEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===e.END)throw this.error(new TomlError(`Unterminated multi-line string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}errorControlCharInString(){let e=`\\u00`;return this.char<16&&(e+=`0`),e+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${e} instead`))}recordMultiEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+=`"`,this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.return():(this.state.buf+=`""`,this.goto(this.parseMultiStringContent))}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError(`Can't escape whitespace`))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError(`Unknown escape character: `+this.char))}parseUnicodeReturn(e){try{let t=parseInt(e,16);if(t>=SURROGATE_FIRST&&t<=SURROGATE_LAST)throw this.error(new TomlError(`Invalid unicode, character in range 0xD800 - 0xDFFF is reserved`));return this.returnNow(String.fromCodePoint(t))}catch(e){throw this.error(TomlError.wrap(e))}}parseSmallUnicode(){if(!isHexit(this.char))throw this.error(new TomlError(`Invalid character in unicode sequence, expected hex`));if(this.consume(),this.state.buf.length>=4)return this.return()}parseLargeUnicode(){if(!isHexit(this.char))throw this.error(new TomlError(`Invalid character in unicode sequence, expected hex`));if(this.consume(),this.state.buf.length>=8)return this.return()}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError(`Unexpected character, expected digit`));if(this.atEndOfWord())throw this.error(new TomlError(`Incomplete number`));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError(`Unexpected character, expected digit`));if(this.atEndOfWord())throw this.error(new TomlError(`Incomplete number`));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else return this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError(`Unexpected character, expected -, + or digit`))}parseNumberExponent(){if(isDigit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);else return this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);else if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);else return this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError(`Expected digit while parsing year part of a date`))}if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError(`Expected hyphen (-) while parsing year part of date`))}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseIntegerOct(){if(isOctit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseIntegerBin(){if(isBit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError(`Years less than 1000 must be zero padded to four characters`));return this.state.result=this.state.buf,this.state.buf=``,this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError(`Months less than 10 must be zero padded to two characters`));return this.state.result+=`-`+this.state.buf,this.state.buf=``,this.next(this.parseDateDay)}if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError(`Days less than 10 must be zero padded to two characters`));return this.state.result+=`-`+this.state.buf,this.state.buf=``,this.next(this.parseStartTimeHour)}if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+`-`+this.state.buf));if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError(`Hours less than 10 must be zero padded to two characters`));return this.state.result+=`T`+this.state.buf,this.state.buf=``,this.next(this.parseTimeMin)}if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseTimeSec);else throw this.error(new TomlError(`Incomplete datetime`))}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError(`Incomplete datetime`))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError(`Hours less than 10 must be zero padded to two characters`));return this.state.result=this.state.buf,this.state.buf=``,this.next(this.parseOnlyTimeMin)}throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseOnlyTimeSec);else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeFractionMaybe(){if(this.state.result+=`:`+this.state.buf,this.char===CHAR_PERIOD)this.state.buf=``,this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError(`Expected digit in milliseconds`));return this.returnNow(createTime(this.state.result+`.`+this.state.buf))}else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else if(this.state.buf.length===1)throw this.error(new TomlError(`Expected digit in milliseconds`));else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError(`Unexpected character in datetime, expected digit`))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError(`Unexpected character in datetime, expected colon`))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError(`Unexpected character in datetime, expected digit`))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===e.END)throw this.error(new TomlError(`Unterminated inline array`));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(e){if(this.state.resultArr){let t=this.state.resultArr[_contentType],n=tomlType(e);if(t!==n)throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${t} and ${n}`))}else this.state.resultArr=InlineList(tomlType(e));return isFloat(e)||isInteger(e)?this.state.resultArr.push(e.valueOf()):this.state.resultArr.push(e),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError(`Invalid character, expected whitespace, comma (,) or close bracket (])`))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError(`Unterminated inline array`));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(e){let t=this.state.resultTable,n=e.key.pop();for(let n of e.key){if(hasKey(t,n)&&(!isTable(t[n])||t[n][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));t=t[n]=t[n]||Table()}if(hasKey(t,n))throw this.error(new TomlError(`Can't redefine existing key`));return isInteger(e.value)||isFloat(e.value)?t[n]=e.value.valueOf():t[n]=e.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError(`Unterminated inline array`));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTable);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError(`Invalid character, expected whitespace, comma (,) or close bracket (])`))}}return t}}}),require_parse_pretty_error=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js"(e,t){t.exports=n;function n(e,t){if(e.pos==null||e.line==null)return e;let n=e.message;if(n+=` at row ${e.line+1}, col ${e.col+1}, pos ${e.pos}:
8
+ `,t&&t.split){let r=t.split(/\n/),i=String(Math.min(r.length,e.line+3)).length,a=` `;for(;a.length<i;)a+=` `;for(let t=Math.max(0,e.line-1);t<Math.min(r.length,e.line+2);++t){let o=String(t+1);if(o.length<i&&(o=` `+o),e.line===t){n+=o+`> `+r[t]+`
9
+ `,n+=a+` `;for(let t=0;t<e.col;++t)n+=` `;n+=`^
10
+ `}else n+=o+`: `+r[t]+`
11
+ `}}return e.message=n+`
12
+ `,e}}}),require_parse_string=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js"(e,t){t.exports=i;var n=require_toml_parser(),r=require_parse_pretty_error();function i(e){global.Buffer&&global.Buffer.isBuffer(e)&&(e=e.toString(`utf8`));let t=new n;try{return t.parse(e),t.finish()}catch(t){throw r(t,e)}}}}),require_parse_async=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js"(e,t){t.exports=i;var n=require_toml_parser(),r=require_parse_pretty_error();function i(e,t){t||={};let i=0,a=t.blocksize||40960,o=new n;return new Promise((e,t)=>{setImmediate(s,0,a,e,t)});function s(t,n,i,a){if(t>=e.length)try{return i(o.finish())}catch(t){return a(r(t,e))}try{o.parse(e.slice(t,t+n)),setImmediate(s,t+n,n,i,a)}catch(t){a(r(t,e))}}}}}),require_parse_stream=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js"(e,t){t.exports=i;var n=require("stream"),r=require_toml_parser();function i(e){return e?a(e):o(e)}function a(e){let t=new r;return e.setEncoding(`utf8`),new Promise((n,r)=>{let i,a=!1,o=!1;function s(){if(a=!0,!i)try{n(t.finish())}catch(e){r(e)}}function c(e){o=!0,r(e)}e.once(`end`,s),e.once(`error`,c),l();function l(){i=!0;let n;for(;(n=e.read())!==null;)try{t.parse(n)}catch(e){return c(e)}if(i=!1,a)return s();o||e.once(`readable`,l)}})}function o(){let e=new r;return new n.Transform({objectMode:!0,transform(t,n,r){try{e.parse(t.toString(n))}catch(e){this.emit(`error`,e)}r()},flush(t){try{this.push(e.finish())}catch(e){this.emit(`error`,e)}t()}})}}}),require_parse=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js"(e,t){t.exports=require_parse_string(),t.exports.async=require_parse_async(),t.exports.stream=require_parse_stream(),t.exports.prettyError=require_parse_pretty_error()}}),require_stringify=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js"(e,t){t.exports=n,t.exports.value=v;function n(e){if(e===null)throw r(`null`);if(e===void 0)throw r(`undefined`);if(typeof e!=`object`)throw r(typeof e);if(typeof e.toJSON==`function`&&(e=e.toJSON()),e==null)return null;let t=u(e);if(t!==`table`)throw r(t);return c(``,``,e)}function r(e){return Error(`Can only stringify objects, not `+e)}function i(){return Error(`Array values can't have mixed types`)}function a(e){return Object.keys(e).filter(t=>l(e[t]))}function o(e){return Object.keys(e).filter(t=>!l(e[t]))}function s(e){let t=Array.isArray(e)?[]:Object.prototype.hasOwnProperty.call(e,`__proto__`)?{["__proto__"]:void 0}:{};for(let n of Object.keys(e))t[n]=e[n]&&typeof e[n].toJSON==`function`&&!(`toISOString`in e[n])?e[n].toJSON():e[n];return t}function c(e,t,n){n=s(n);var r=a(n),i=o(n),c=[],l=t||``;r.forEach(e=>{var t=u(n[e]);t!==`undefined`&&t!==`null`&&c.push(l+d(e)+` = `+_(n[e],!0))}),c.length>0&&c.push(``);var f=e&&r.length>0?t+` `:``;return i.forEach(t=>{c.push(O(e,f,t,n[t]))}),c.join(`
13
+ `)}function l(e){switch(u(e)){case`undefined`:case`null`:case`integer`:case`nan`:case`float`:case`boolean`:case`string`:case`datetime`:return!0;case`array`:return e.length===0||u(e[0])!==`table`;case`table`:return Object.keys(e).length===0;default:return!1}}function u(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`bigint`||Number.isInteger(e)&&!Object.is(e,-0)?`integer`:typeof e==`number`?`float`:typeof e==`boolean`?`boolean`:typeof e==`string`?`string`:`toISOString`in e?isNaN(e)?`undefined`:`datetime`:Array.isArray(e)?`array`:`table`}function d(e){var t=String(e);return/^[-A-Za-z0-9_]+$/.test(t)?t:f(t)}function f(e){return`"`+h(e).replace(/"/g,`\\"`)+`"`}function p(e){return`'`+e+`'`}function m(e,t){for(;t.length<e;)t=`0`+t;return t}function h(e){return e.replace(/\\/g,`\\\\`).replace(/[\b]/g,`\\b`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\f/g,`\\f`).replace(/\r/g,`\\r`).replace(/([\u0000-\u001f\u007f])/,e=>`\\u`+m(4,e.codePointAt(0).toString(16)))}function g(e){let t=e.split(/\n/).map(e=>h(e).replace(/"(?="")/g,`\\"`)).join(`
14
+ `);return t.slice(-1)===`"`&&(t+=`\\
15
+ `),`"""
16
+ `+t+`"""`}function _(e,t){let n=u(e);return n===`string`&&(t&&/\n/.test(e)?n=`string-multiline`:!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(n=`string-literal`)),v(e,n)}function v(e,t){switch(t||=u(e),t){case`string-multiline`:return g(e);case`string`:return f(e);case`string-literal`:return p(e);case`integer`:return y(e);case`float`:return b(e);case`boolean`:return x(e);case`datetime`:return S(e);case`array`:return E(e.filter(e=>u(e)!==`null`&&u(e)!==`undefined`&&u(e)!==`nan`));case`table`:return D(e);default:throw r(t)}}function y(e){return String(e).replace(/\B(?=(\d{3})+(?!\d))/g,`_`)}function b(e){if(e===1/0)return`inf`;if(e===-1/0)return`-inf`;if(Object.is(e,NaN))return`nan`;if(Object.is(e,-0))return`-0.0`;var t=String(e).split(`.`),n=t[0],r=t[1]||0;return y(n)+`.`+r}function x(e){return String(e)}function S(e){return e.toISOString()}function C(e){return e===`float`||e===`integer`}function w(e){var t=u(e[0]);return e.every(e=>u(e)===t)?t:e.every(e=>C(u(e)))?`float`:`mixed`}function T(e){let t=w(e);if(t===`mixed`)throw i();return t}function E(e){e=s(e);let t=T(e);var n=`[`,r=e.map(e=>v(e,t));return r.join(`, `).length>60||/\n/.test(r)?n+=`
17
+ `+r.join(`,
18
+ `)+`
19
+ `:n+=` `+r.join(`, `)+(r.length>0?` `:``),n+`]`}function D(e){e=s(e);var t=[];return Object.keys(e).forEach(n=>{t.push(d(n)+` = `+_(e[n],!1))}),`{ `+t.join(`, `)+(t.length>0?` `:``)+`}`}function O(e,t,n,i){var a=u(i);if(a===`array`)return k(e,t,n,i);if(a===`table`)return A(e,t,n,i);throw r(a)}function k(e,t,n,i){i=s(i),T(i);var a=u(i[0]);if(a!==`table`)throw r(a);var o=e+d(n),l=``;return i.forEach(e=>{l.length>0&&(l+=`
20
+ `),l+=t+`[[`+o+`]]
21
+ `,l+=c(o+`.`,t,e)}),l}function A(e,t,n,r){var i=e+d(n),o=``;return a(r).length>0&&(o+=t+`[`+i+`]
22
+ `),o+c(i+`.`,t,r)}}}),require_toml=__commonJS({"../core/node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js"(e){e.parse=require_parse(),e.stringify=require_stringify()}}),import_node_process=__toESM(require("node:process")),CliDesc=Object.freeze({main:`PhotoStructure's main process manager. Runs and manages web and sync services.`,desktop:`PhotoStructure for Desktops. Manages web and sync services.`,fix:`PhotoStructure's library settings and database check and repair tool.`,info:`PhotoStructure's configuration, file metadata and aggregation diagnostics tool.`,doctor:`Report PhotoStructure's health checks.`,list:`List items in a PhotoStructure Library.`,logcat:`Chronologically sort and pretty-print PhotoStructure's log files.`,logtail:"View the log messages of currently-running PhotoStructure processes as they are emitted. (Like `tail -f`).",web:`PhotoStructure's web service. Automatically started by main. For more details see https://photostructure.com/tools`,sync:`PhotoStructure's directory synchronization service. Automatically started by main, but can be run manually. For more details see https://photostructure.com/go/sync`,"docker-env":`PhotoStructure for Docker's startup environment resolver. For internal use.`,test:`Test harness. For internal use.`,worker:`PhotoStructure's worker process. For internal use.`}),version=`2026.9.4-beta`,import_node_fs2=require("node:fs"),import_node_os=require("node:os"),import_node_path4=require("node:path"),import_node_path=require("node:path");function dockerConfigDirs(e){return[{dir:`/ps/config`,preexistingDir:`/ps/config`},{dir:e+`/.photostructure/docker-config`,preexistingDir:e}]}function notBlank(e){return e!=null&&e.trim().length>0?e:void 0}var CacheDirSettingEnvKeys=[`PS_CACHE_DIR`,`PS_TMP_DIR`,`PS_TEMP_DIR`,`cacheDir`];function environmentCacheDir(){for(let e of CacheDirSettingEnvKeys){let t=notBlank(process.env[e]);if(t!=null)return t}let e=notBlank(process.env.XDG_CACHE_HOME);return e==null?void 0:import_node_path.posix.join(e,`photostructure`)}var import_node_fs=require("node:fs"),import_node_path2=require("node:path");function isError(e){return e!=null&&e instanceof Error}function toError(e){return e==null?void 0:isError(e)?e:Error(String(e))}var deferredComputations=new WeakSet;function defer(e){let t,n,r=!1,i=function(){if(r){if(n!=null)throw n;return t}try{return r=!0,t=e()}catch(e){throw n=toError(e),n}};return i.prior=()=>t,i.hasPrior=()=>r,i.applied=()=>r,i.reset=()=>{let e=t;return t=void 0,n=void 0,r=!1,e},deferredComputations.add(i),i}var SettingsToml=`settings.toml`,import_toml=__toESM(require_toml()),ByteOrderMarks=[{bom:[239,187,191],encoding:`utf8`},{bom:[255,254],encoding:`utf16le`}];function debom(e){for(let{bom:t,encoding:n}of ByteOrderMarks)if(t.every((t,n)=>e[n]===t))return e.subarray(t.length).toString(n);return e.toString()}var Smart2Dumb=[[/[‘’]/g,`'`],[/[“”„«»〃]/g,`"`]];function dumbquote(e){return Smart2Dumb.reduce((e,[t,n])=>e.replace(t,n),e).normalize()}function parseTomlBuffer(e){let t=debom(e);if(t.trim().length!==0)try{return(0,import_toml.parse)(dumbquote(t))}catch(e){throw tomlErrorWithoutSource(e)}}function tomlErrorForLog(e){if(typeof e!=`object`||!e)return e;let t=e;return t.fromTOML===!0?{name:typeof t.name==`string`?t.name:`TomlError`,...typeof t.line==`number`?{row:t.line+1}:{},...typeof t.col==`number`?{column:t.col+1}:{}}:e}function tomlErrorWithoutSource(e){let t=tomlErrorForLog(e);if(t===e)return e;let{row:n,column:r}=t,i=typeof n==`number`?` at row ${n}`:``,a=typeof r==`number`?`${i===``?` at`:`,`} column ${r}`:``,o=Error(`Invalid TOML${i}${a}`);return Object.assign(o,t),o}function lazyConfigSettings(e){return defer(()=>{let t=(0,import_node_path2.join)(e(),SettingsToml);try{return parseTomlBuffer((0,import_node_fs.readFileSync)(t))}catch(e){if(e.code===`ENOENT`)return;throw Error(`Cannot read ${t}: ${e}`,{cause:e})}})}var DefaultDockerLibraryDir=`/ps/library`,LibraryDirSettingNames=[`libraryDir`,`libraryPath`,`library`],DockerLibraryDirEnvKeys=[`PS_LIBRARY_DIR`,`PS_LIBRARY_PATH`,`PS_LIBRARY`],LibraryDirSettingEnvKeys=[...DockerLibraryDirEnvKeys,...LibraryDirSettingNames],import_promises=require("node:fs/promises"),import_node_path3=require("node:path");function parseEnvTokenPairs(e){let t={},n=e.replace(/\r\n?/g,`
23
+ `),r=/\s*#.*$|(?:export[\t ]*)?(?<key>[\w.-]+)[\t ]*[:=](?:(?<quote>["'`])(?<qval>(?:\\.|(?!\2)[\s\S])*)\2|(?<val>[^\s#]*))(?:[\t ]*#.*$)?(?:$|\s)/gim,i;for(;(i=r.exec(n))!=null;){let e=i.groups?.key;if(e==null)continue;let n=(i.groups?.qval??i.groups?.val??``).trim();i.groups?.quote===`"`&&(n=n.replace(/\\n/g,`
24
+ `).replace(/\\r/g,`\r`).replace(/\\"/g,`"`)),t[e]=n}return t}var PsEnvKeys=[`PS_ENV_FILE`,`PSENVFILE`,`PS_ENV`,`PSENV`];function psEnvFilesFor(e,t){let n=[`/.psenv`,(0,import_node_path3.join)(t,`.psenv`),...PsEnvKeys.flatMap(t=>(e[t]??``).split(import_node_path3.delimiter))],r=[],i=new Set;for(let e of n){let t=e.trim();t.length>0&&!i.has(t)&&(i.add(t),r.push(t))}return r}function mergePsEnv(e,t){for(let[n,r]of Object.entries(e))t[n]=r;return t}async function mergePsEnvFiles(e,t){let n=new Set(Object.keys(e));for await(let n of readPsEnvFiles(t))mergePsEnv(n,e);return Object.keys(e).filter(e=>!n.has(e))}async function*readPsEnvFiles(e){for(let t of e)try{yield parseEnvTokenPairs(debom(await(0,import_promises.readFile)(t)))}catch{}}function firstNonEmpty(...e){return e.find(e=>e!=null&&e.length>0)}function firstLibraryDirEnvValue(){for(let e of LibraryDirSettingEnvKeys){let t=process.env[e];if(t!=null)return t}}function unsetBlankDockerLibraryDirAliases(){let e=[];for(let t of DockerLibraryDirEnvKeys){let n=process.env[t];n!=null&&notBlank(n)==null&&(delete process.env[t],e.push(t))}return e}function stat(e){try{return(0,import_node_fs2.statSync)(e,{throwIfNoEntry:!1})}catch{return}}function dockerHomeDir(){let e=process.env.HOME?.trim();return e!=null&&stat(e)?.isDirectory()===!0?(0,import_node_path4.resolve)(e):(0,import_node_os.homedir)()}function dockerConfigDir(e){let t=dockerConfigDirs(notBlank(e)??DefaultDockerLibraryDir);return firstNonEmpty(process.env.PS_CONFIG_DIR)??(stat(t[0].dir)?.isDirectory()===!0?t[0].dir:t[1].dir)}function errorMessage(e){return e instanceof Error?e.message:String(e)}function persistedSettingDir(e,t){try{let n=e(),r;for(let[e,i]of Object.entries(n??{}))t.some(t=>t.toLowerCase()===e.toLowerCase())&&typeof i==`string`&&(r=i);return r!=null&&(0,import_node_path4.isAbsolute)(r)?r:void 0}catch(e){process.stderr.write(`${errorMessage(e)}
25
+ `);return}}function ownerIds(e,t){for(let n of[(0,import_node_path4.join)(e,SettingsToml),(0,import_node_path4.join)(t,`.photostructure`,SettingsToml),(0,import_node_path4.join)(t,`.photostructure`),e,t]){let e=stat(n);if(e!=null)return{uid:e.uid.toString(),gid:e.gid.toString()}}return{uid:`0`,gid:`0`}}function dockerEntrypointDropPrivileges({puid:e,realUid:t}){return t===0&&e!==`0`?`1`:``}async function resolveDockerEntrypointEnv(e={}){await mergePsEnvFiles(process.env,e.psEnvFiles??psEnvFilesFor(process.env,dockerHomeDir()));let t=unsetBlankDockerLibraryDirAliases(),n=firstLibraryDirEnvValue(),r=dockerConfigDir(n),i=lazyConfigSettings(()=>r),a=notBlank(n)??persistedSettingDir(i,LibraryDirSettingEnvKeys)??DefaultDockerLibraryDir,o=environmentCacheDir()??persistedSettingDir(i,CacheDirSettingEnvKeys),s=ownerIds(r,a),c=firstNonEmpty(process.env.PUID,process.env.puid)??s.uid;return{PS_LIBRARY_DIR:a,PS_CONFIG_DIR:r,PUID:c,PGID:firstNonEmpty(process.env.PGID,process.env.pgid)??s.gid,DROP_PRIVILEGES:dockerEntrypointDropPrivileges({puid:c,realUid:process.getuid?.()}),CHOWN_CACHE_DIR:o!=null&&(0,import_node_path4.isAbsolute)(o)&&!containsDir(o,a)?o:``,unset:t}}function containsDir(e,t){let n=(0,import_node_path4.relative)(e,t);return n===``||!n.startsWith(`..`)&&!(0,import_node_path4.isAbsolute)(n)}function shellQuote(e){return`'${e.replace(/'/g,`'\\''`)}'`}function renderDockerEntrypointEnv(e){return[...e.unset.map(e=>`unset ${e}`),`export PS_LIBRARY_DIR=${shellQuote(e.PS_LIBRARY_DIR)}`,`export PS_CONFIG_DIR=${shellQuote(e.PS_CONFIG_DIR)}`,`export PUID=${shellQuote(e.PUID)}`,`export PGID=${shellQuote(e.PGID)}`,`DROP_PRIVILEGES=${shellQuote(e.DROP_PRIVILEGES)}`,`CHOWN_CACHE_DIR=${shellQuote(e.CHOWN_CACHE_DIR)}`,``].join(`
26
+ `)}function printHelp(){import_node_process.default.stdout.write([`Usage: docker-env [options]`,``,CliDesc[`docker-env`],``,`Options:`,` -V, --version output the version number`,` -h, --help display help for command`,``].join(`
27
+ `))}async function main(){if(import_node_process.default.argv.includes(`--help`)||import_node_process.default.argv.includes(`-h`)){printHelp();return}if(import_node_process.default.argv.includes(`--version`)||import_node_process.default.argv.includes(`-V`)){import_node_process.default.stdout.write(version+`
28
+ `);return}try{import_node_process.default.stdout.write(renderDockerEntrypointEnv(await resolveDockerEntrypointEnv()))}catch(e){import_node_process.default.stderr.write((e instanceof Error?e.stack??e.message:String(e))+`
29
+ `),import_node_process.default.exitCode=1}}main();