photostructure 2026.9.4-beta → 2026.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE.md +14 -15
  2. package/VERSION.json +6 -8
  3. package/bin/bootstrap.js +8 -3
  4. package/bin/docker-env.js +7 -2
  5. package/bin/doctor.js +78 -80
  6. package/bin/fix.js +65 -60
  7. package/bin/info.js +66 -68
  8. package/bin/list.js +65 -60
  9. package/bin/logcat.js +40 -35
  10. package/bin/logtail.js +38 -33
  11. package/bin/main.js +53 -48
  12. package/bin/photostructure.js +25 -4
  13. package/bin/sync.js +66 -66
  14. package/bin/web.js +99 -97
  15. package/bin/worker.js +39 -34
  16. package/defaults.env +31 -22
  17. package/package.json +10 -10
  18. package/photostructure.js +43 -0
  19. package/public/3rd-party-licenses.html.gz +0 -0
  20. package/public/3rd-party-licenses.txt.gz +0 -0
  21. package/public/app/AssetGallery.js +1 -1
  22. package/public/app/DropDown.js +11 -11
  23. package/public/app/DropDown.js.gz +0 -0
  24. package/public/app/HealthChecks.js +1 -1
  25. package/public/app/HealthChecks.js.gz +0 -0
  26. package/public/app/Lazy.js +1 -1
  27. package/public/app/Lazy.js.gz +0 -0
  28. package/public/app/Modal.js +1 -1
  29. package/public/app/Modal.js.gz +0 -0
  30. package/public/app/NavMenuButton.js +1 -1
  31. package/public/app/NavMenuButton.js.gz +0 -0
  32. package/public/app/ProgressState.js +1 -1
  33. package/public/app/ProgressState.js.gz +0 -0
  34. package/public/app/SSEChannels.js +1 -1
  35. package/public/app/SSEChannels.js.gz +0 -0
  36. package/public/app/Search.js +1 -1
  37. package/public/app/Search.js.gz +0 -0
  38. package/public/app/Spinner.js +1 -1
  39. package/public/app/Spinner.js.gz +0 -0
  40. package/public/app/Tag.js +1 -1
  41. package/public/app/Tag.js.gz +0 -0
  42. package/public/app/about.css +1 -1
  43. package/public/app/about.css.gz +0 -0
  44. package/public/app/about.js +1 -1
  45. package/public/app/about.js.gz +0 -0
  46. package/public/app/app.css +1 -1
  47. package/public/app/app.css.gz +0 -0
  48. package/public/app/app.js +4 -4
  49. package/public/app/app.js.gz +0 -0
  50. package/public/app/health.css +1 -1
  51. package/public/app/health.css.gz +0 -0
  52. package/public/app/logs.css +1 -1
  53. package/public/app/logs.css.gz +0 -0
  54. package/public/app/platform.js +1 -1
  55. package/public/app/roboto-mono-v22-latin-700.woff2.gz +0 -0
  56. package/public/app/roboto-mono-v22-latin-regular.woff2.gz +0 -0
  57. package/public/app/roboto-v51-latin-wght.woff2.gz +0 -0
  58. package/public/app/settings.css +1 -1
  59. package/public/app/settings.css.gz +0 -0
  60. package/public/app/settings.js +1 -1
  61. package/public/app/settings.js.gz +0 -0
  62. package/public/app/splash.css +1 -1
  63. package/public/app/splash.css.gz +0 -0
  64. package/public/app/sync.css +1 -1
  65. package/public/app/sync.css.gz +0 -0
  66. package/public/app/sync.js +3 -3
  67. package/public/app/sync.js.gz +0 -0
  68. package/public/eula.html +14 -15
  69. package/public/images/sheep.svg.gz +0 -0
  70. package/public/images/splash.svg +1 -1
  71. package/tools/README.md +1 -1
  72. package/tools/build.sh +6 -2
  73. package/tools/licenses/sharp-libvips/THIRD-PARTY-NOTICES.md +1 -1
  74. package/tools/linux-arm64/dcraw_emu +0 -0
  75. package/tools/linux-arm64/jpegtran +0 -0
  76. package/tools/linux-arm64/jpegtran-README.md +6 -0
  77. package/tools/linux-arm64/libraw-README.md +7 -0
  78. package/tools/linux-arm64/raw-identify +0 -0
  79. package/tools/linux-arm64/sqlite3 +0 -0
  80. package/tools/linux-arm64/sqlite3-README.md +7 -0
  81. package/tools/linux-x64/dcraw_emu +0 -0
  82. package/tools/linux-x64/jpegtran +0 -0
  83. package/tools/linux-x64/jpegtran-README.md +6 -0
  84. package/tools/linux-x64/libraw-README.md +7 -0
  85. package/tools/linux-x64/raw-identify +0 -0
  86. package/tools/linux-x64/sqlite3 +0 -0
  87. package/tools/linux-x64/sqlite3-README.md +7 -0
  88. package/tools/test-sqlite-nss.sh +18 -0
  89. package/views/eula.html +14 -15
  90. package/views/settings.ejs +353 -164
  91. package/views/welcome-tools.ejs +18 -10
  92. package/views/welcome.ejs +5 -7
package/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- **Version: September 16, 2026.** Effective when you accept it. See "Changes and
1
+ **Version: September 17, 2026.** Effective when you accept it. See "Changes and
2
2
  other terms" below for later revisions.
3
3
 
4
4
  This agreement is between you and PhotoStructure, Inc. ("we" or "us") for the
@@ -84,19 +84,19 @@ compatibility with every system.
84
84
 
85
85
  Subject to these rights, we are not liable for indirect or consequential losses
86
86
  or lost profits. Our total liability for all claims arising from the Software or
87
- this agreement is capped at:
87
+ this agreement is limited as follows:
88
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.
89
+ - **Subscriptions:** capped at the fees you paid for PhotoStructure in the 12
90
+ months before the event giving rise to the claim.
91
+ - **Lifetime Plus:** capped at what you paid for that license.
92
+ - **Free use, including Lite and trials:** we exclude liability for damages.
93
93
 
94
94
  For these calculations, include payments for PhotoStructure to us, Stripe, or
95
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.
96
+ These exclusions and limits apply to contract, negligence, and other claims, but
97
+ not fraud, intentional misconduct, gross negligence, death or personal injury
98
+ caused by our or our employees' or agents' negligence, or other liability the
99
+ law prohibits us from limiting.
100
100
 
101
101
  ## Ending the agreement
102
102
 
@@ -116,8 +116,8 @@ provisions survive for prior use.
116
116
 
117
117
  ## Changes and other terms
118
118
 
119
- We keep dated versions, including the
120
- [previous agreement](https://photostructure.com/legal/eula-before-2026-09-16.txt).
119
+ If part of this agreement cannot be enforced, the rest still applies.
120
+
121
121
  Before asking existing users to accept material changes, we will give at least
122
122
  30 days' notice on our website and, if we have your email address, by email. The
123
123
  notice will explain what changes and when. Revised terms apply going forward
@@ -126,6 +126,5 @@ your agreement. If you decline, you may keep using your existing version under
126
126
  the terms you accepted, subject to your license status, or stop using it and
127
127
  cancel renewal.
128
128
 
129
- If part of this agreement cannot be enforced, the rest still applies.
130
-
131
- Contact [hello@photostructure.com](mailto:hello@photostructure.com).
129
+ For questions about this agreement, email
130
+ [hello@photostructure.com](mailto:hello@photostructure.com).
package/VERSION.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
- "version": "2026.9.4-beta",
2
+ "version": "2026.9.6",
3
3
  "versionMajor": 2026,
4
4
  "versionMinor": 9,
5
- "versionPatch": 4,
6
- "versionPrerelease": [
7
- "beta"
8
- ],
9
- "release": "2026.9.4-beta+20260916164230",
10
- "gitSha": "2c5a1c9dd844fc23e67b4468d7c788d9f99baeef",
11
- "gitDate": "2026-09-16T23:42:30.000Z"
5
+ "versionPatch": 6,
6
+ "versionPrerelease": [],
7
+ "release": "2026.9.6+20260925115726",
8
+ "gitSha": "c9f96e737d4283c66aed9e7d5a9ea0ef39f1752d",
9
+ "gitDate": "2026-09-25T18:57:26.000Z"
12
10
  }
package/bin/bootstrap.js CHANGED
@@ -3,7 +3,9 @@
3
3
  // BY USING THIS SOFTWARE, YOU ACCEPT ALL OF THE TERMS IN
4
4
  // https://photostructure.com/eula
5
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}},__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]:`
6
+ "use strict";
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0ff5e419-a99f-5659-b1f3-0dc3f46204d5")}catch(e){}}();
8
+ 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
9
  `,[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
10
  `,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
11
  `,n+=a+` `;for(let t=0;t<e.col;++t)n+=` `;n+=`^
@@ -19,5 +21,8 @@
19
21
  `: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
22
  `),l+=t+`[[`+o+`]]
21
23
  `,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});
24
+ `),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}),module.exports=__toCommonJS(bootstrap_exports);var import_node_fs5=require("node:fs"),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(),i=n?.shell??isWin;i===!0&&e.includes(` `)&&(e=`"`+e+`"`);let a=(0,import_node_child_process.spawnSync)(e,t,{cwd:ROOT,timeout:1e4,...n,encoding:`utf8`,shell:i});if(a.status!==0||a.error!=null)throw Error(`"${e} ${t.join(` `)}" failed: ${toS(a.error)} ${a.stderr}`);return dbg(`run(`+e+`)`,{args:t,result:a,elapsedMs:roundMs(performance.now()-r)}),a}var ROOT=import_node_path3.default.resolve(import_node_path3.default.join(__dirname,`..`)),isNpmInstall=!(0,import_node_fs2.existsSync)((0,import_node_path3.join)(ROOT,`.git`)),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,...import_node_process3.default.argv.slice(1)],{env:{...import_node_process3.default.env,...EnvOnBounce},stdio:`inherit`,shell:!1,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 requires Node.js v24 or later`;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<24?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 isStaleInstall(e){let t=existingPriorVersionFile(),n=t==null?void 0:readJsonMaybe(t);return dbg(`isStaleInstall()`,{priorInstalledJson:n,expected:e}),n?.photostructure!==e.photostructure||n?.node!==e.node||needsNpmInstall()}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=e.version_before_pull!==e.version_after_pull,i=isStaleInstall(t);dbg(`cleanup?`,{reinstall:n,mismatchedRunningVersions:r,staleInstall:i,expectedVersionJson:t,configDir:configDir()}),(n||r||i)&&(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})}async function bootstrapMain(){if(!import_node_process6.default.argv.slice(2).includes(`--stop`)&&(assertNodeVersion(),!isNpmInstall)){if(await isNetworkDisabled()){existingPriorVersionFile()??die(`Network access is disabled.
25
+ Please enable your WAN during your first run to download PhotoStructure's dependencies.`,`https://photostructure.com/server/photostructure-for-node/#troubleshooting-network`);let e={node:import_node_process6.default.versions.node,photostructure:readPackageVersion()};isStaleInstall(e)&&(npmInstall(),(0,import_node_fs5.writeFileSync)(priorVersionFile(),JSON.stringify(e)))}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});
26
+
27
+
28
+ //# debugId=0ff5e419-a99f-5659-b1f3-0dc3f46204d5
package/bin/docker-env.js CHANGED
@@ -3,7 +3,9 @@
3
3
  // BY USING THIS SOFTWARE, YOU ACCEPT ALL OF THE TERMS IN
4
4
  // https://photostructure.com/eula
5
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]:`
6
+ "use strict";
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="db117d8c-417d-5595-86b4-a397a28cb11a")}catch(e){}}();
8
+ 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
9
  `,[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
10
  `,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
11
  `,n+=a+` `;for(let t=0;t<e.col;++t)n+=` `;n+=`^
@@ -19,7 +21,7 @@
19
21
  `: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
22
  `),l+=t+`[[`+o+`]]
21
23
  `,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,`
24
+ `),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.6`,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
25
  `),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
26
  `).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
27
  `);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(`
@@ -27,3 +29,6 @@
27
29
  `))}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
30
  `);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
31
  `),import_node_process.default.exitCode=1}}main();
32
+
33
+
34
+ //# debugId=db117d8c-417d-5595-86b4-a397a28cb11a