/**
 * Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.
 * Original file: /npm/smol-toml@1.4.2/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
function Z(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function j(e,n,i){let l=e.split(/\r\n|\n|\r/g),t="",r=(Math.log10(n+1)|0)+1;for(let f=n-1;f<=n+1;f++){let o=l[f-1];o&&(t+=f.toString().padEnd(r," "),t+=":  ",t+=o,t+=`
`,f===n&&(t+=" ".repeat(r+i+2),t+=`^
`))}return t}class c extends Error{line;column;codeblock;constructor(n,i){const[l,t]=Z(i.toml,i.ptr),r=j(i.toml,l,t);super(`Invalid TOML document: ${n}

${r}`,i),this.line=l,this.column=t,this.codeblock=r}}function z(e,n){let i=0;for(;e[n-++i]==="\\";);return--i&&i%2}function y(e,n=0,i=e.length){let l=e.indexOf(`
`,n);return e[l-1]==="\r"&&l--,l<=i?l:-1}function b(e,n){for(let i=n;i<e.length;i++){let l=e[i];if(l===`
`)return i;if(l==="\r"&&e[i+1]===`
`)return i+1;if(l<" "&&l!=="	"||l==="\x7F")throw new c("control characters are not allowed in comments",{toml:e,ptr:n})}return e.length}function s(e,n,i,l){let t;for(;(t=e[n])===" "||t==="	"||!i&&(t===`
`||t==="\r"&&e[n+1]===`
`);)n++;return l||t!=="#"?n:s(e,b(e,n),i)}function I(e,n,i,l,t=!1){if(!l)return n=y(e,n),n<0?e.length:n;for(let r=n;r<e.length;r++){let f=e[r];if(f==="#")r=y(e,r);else{if(f===i)return r+1;if(f===l||t&&(f===`
`||f==="\r"&&e[r+1]===`
`))return r}}throw new c("cannot find end of structure",{toml:e,ptr:n})}function N(e,n){let i=e[n],l=i===e[n+1]&&e[n+1]===e[n+2]?e.slice(n,n+3):i;n+=l.length-1;do n=e.indexOf(l,++n);while(n>-1&&i!=="'"&&z(e,n));return n>-1&&(n+=l.length,l.length>1&&(e[n]===i&&n++,e[n]===i&&n++)),n}let V=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class h extends Date{#n=!1;#i=!1;#e=null;constructor(n){let i=!0,l=!0,t="Z";if(typeof n=="string"){let r=n.match(V);r?(r[1]||(i=!1,n=`0000-01-01T${n}`),l=!!r[2],l&&n[10]===" "&&(n=n.replace(" ","T")),r[2]&&+r[2]>23?n="":(t=r[3]||null,n=n.toUpperCase(),!t&&l&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#n=i,this.#i=l,this.#e=t)}isDateTime(){return this.#n&&this.#i}isLocal(){return!this.#n||!this.#i||!this.#e}isDate(){return this.#n&&!this.#i}isTime(){return this.#i&&!this.#n}isValid(){return this.#n||this.#i}toISOString(){let n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(this.#e===null)return n.slice(0,-1);if(this.#e==="Z")return n;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(n,i="Z"){let l=new h(n);return l.#e=i,l}static wrapAsLocalDateTime(n){let i=new h(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new h(n);return i.#i=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new h(n);return i.#n=!1,i.#e=null,i}}let v=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,M=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,G=/^[+-]?0[0-9_]/,K=/^[0-9a-f]{4,8}$/i,k={b:"\b",t:"	",n:`
`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function A(e,n=0,i=e.length){let l=e[n]==="'",t=e[n++]===e[n]&&e[n]===e[n+1];t&&(i-=2,e[n+=2]==="\r"&&n++,e[n]===`
`&&n++);let r=0,f,o="",u=n;for(;n<i-1;){let a=e[n++];if(a===`
`||a==="\r"&&e[n]===`
`){if(!t)throw new c("newlines are not allowed in strings",{toml:e,ptr:n-1})}else if(a<" "&&a!=="	"||a==="\x7F")throw new c("control characters are not allowed in strings",{toml:e,ptr:n-1});if(f){if(f=!1,a==="u"||a==="U"){let d=e.slice(n,n+=a==="u"?4:8);if(!K.test(d))throw new c("invalid unicode escape",{toml:e,ptr:r});try{o+=String.fromCodePoint(parseInt(d,16))}catch{throw new c("invalid unicode escape",{toml:e,ptr:r})}}else if(t&&(a===`
`||a===" "||a==="	"||a==="\r")){if(n=s(e,n-1,!0),e[n]!==`
`&&e[n]!=="\r")throw new c("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:r});n=s(e,n)}else if(a in k)o+=k[a];else throw new c("unrecognized escape sequence",{toml:e,ptr:r});u=n}else!l&&a==="\\"&&(r=n-1,f=!0,o+=e.slice(u,r))}return o+e.slice(u,i-1)}function U(e,n,i,l){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return l?0n:0;let t=v.test(e);if(t||M.test(e)){if(G.test(e))throw new c("leading zeroes are not allowed",{toml:n,ptr:i});e=e.replace(/_/g,"");let f=+e;if(isNaN(f))throw new c("invalid number",{toml:n,ptr:i});if(t){if((t=!Number.isSafeInteger(f))&&!l)throw new c("integer value cannot be represented losslessly",{toml:n,ptr:i});(t||l===!0)&&(f=BigInt(e))}return f}const r=new h(e);if(!r.isValid())throw new c("invalid value",{toml:n,ptr:i});return r}function X(e,n,i,l){let t=e.slice(n,i),r=t.indexOf("#");r>-1&&(b(e,r),t=t.slice(0,r));let f=t.trimEnd();if(!l){let o=t.indexOf(`
`,f.length);if(o>-1)throw new c("newlines are not allowed in inline tables",{toml:e,ptr:n+o})}return[f,r]}function E(e,n,i,l,t){if(l===0)throw new c("document contains excessively nested structures. aborting.",{toml:e,ptr:n});let r=e[n];if(r==="["||r==="{"){let[u,a]=r==="["?F(e,n,l,t):q(e,n,l,t),d=i?I(e,a,",",i):a;if(a-d&&i==="}"){let w=y(e,a,d);if(w>-1)throw new c("newlines are not allowed in inline tables",{toml:e,ptr:w})}return[u,d]}let f;if(r==='"'||r==="'"){f=N(e,n);let u=A(e,n,f);if(i){if(f=s(e,f,i!=="]"),e[f]&&e[f]!==","&&e[f]!==i&&e[f]!==`
`&&e[f]!=="\r")throw new c("unexpected character encountered",{toml:e,ptr:f});f+=+(e[f]===",")}return[u,f]}f=I(e,n,",",i);let o=X(e,n,f-+(e[f-1]===","),i==="]");if(!o[0])throw new c("incomplete key-value declaration: no value specified",{toml:e,ptr:n});return i&&o[1]>-1&&(f=s(e,n+o[1]),f+=+(e[f]===",")),[U(o[0],e,n,t),f]}let Y=/^[a-zA-Z0-9-_]+[ \t]*$/;function x(e,n,i="="){let l=n-1,t=[],r=e.indexOf(i,n);if(r<0)throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:n});do{let f=e[n=++l];if(f!==" "&&f!=="	")if(f==='"'||f==="'"){if(f===e[n+1]&&f===e[n+2])throw new c("multiline strings are not allowed in keys",{toml:e,ptr:n});let o=N(e,n);if(o<0)throw new c("unfinished string encountered",{toml:e,ptr:n});l=e.indexOf(".",o);let u=e.slice(o,l<0||l>r?r:l),a=y(u);if(a>-1)throw new c("newlines are not allowed in keys",{toml:e,ptr:n+l+a});if(u.trimStart())throw new c("found extra tokens after the string part",{toml:e,ptr:o});if(r<o&&(r=e.indexOf(i,o),r<0))throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:n});t.push(A(e,n,o))}else{l=e.indexOf(".",n);let o=e.slice(n,l<0||l>r?r:l);if(!Y.test(o))throw new c("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:n});t.push(o.trimEnd())}}while(l+1&&l<r);return[t,s(e,r+1,!0,!0)]}function q(e,n,i,l){let t={},r=new Set,f,o=0;for(n++;(f=e[n++])!=="}"&&f;){let u={toml:e,ptr:n-1};if(f===`
`)throw new c("newlines are not allowed in inline tables",u);if(f==="#")throw new c("inline tables cannot contain comments",u);if(f===",")throw new c("expected key-value, found comma",u);if(f!==" "&&f!=="	"){let a,d=t,w=!1,[S,C]=x(e,n-1);for(let g=0;g<S.length;g++){if(g&&(d=w?d[a]:d[a]={}),a=S[g],(w=Object.hasOwn(d,a))&&(typeof d[a]!="object"||r.has(d[a])))throw new c("trying to redefine an already defined value",{toml:e,ptr:n});!w&&a==="__proto__"&&Object.defineProperty(d,a,{enumerable:!0,configurable:!0,writable:!0})}if(w)throw new c("trying to redefine an already defined value",{toml:e,ptr:n});let[$,R]=E(e,C,"}",i-1,l);r.add($),d[a]=$,n=R,o=e[n-1]===","?n-1:0}}if(o)throw new c("trailing commas are not allowed in inline tables",{toml:e,ptr:o});if(!f)throw new c("unfinished table encountered",{toml:e,ptr:n});return[t,n]}function F(e,n,i,l){let t=[],r;for(n++;(r=e[n++])!=="]"&&r;){if(r===",")throw new c("expected value, found comma",{toml:e,ptr:n-1});if(r==="#")n=b(e,n);else if(r!==" "&&r!=="	"&&r!==`
`&&r!=="\r"){let f=E(e,n-1,"]",i-1,l);t.push(f[0]),n=f[1]}}if(!r)throw new c("unfinished array encountered",{toml:e,ptr:n});return[t,n]}function D(e,n,i,l){let t=n,r=i,f,o=!1,u;for(let a=0;a<e.length;a++){if(a){if(t=o?t[f]:t[f]={},r=(u=r[f]).c,l===0&&(u.t===1||u.t===2))return null;if(u.t===2){let d=t.length-1;t=t[d],r=r[d].c}}if(f=e[a],(o=Object.hasOwn(t,f))&&r[f]?.t===0&&r[f]?.d)return null;o||(f==="__proto__"&&(Object.defineProperty(t,f,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(r,f,{enumerable:!0,configurable:!0,writable:!0})),r[f]={t:a<e.length-1&&l===2?3:l,d:!1,i:0,c:{}})}if(u=r[f],u.t!==l&&!(l===1&&u.t===3)||(l===2&&(u.d||(u.d=!0,t[f]=[]),t[f].push(t={}),u.c[u.i++]=u={t:1,d:!1,i:0,c:{}}),u.d))return null;if(u.d=!0,l===1)t=o?t[f]:t[f]={};else if(l===0&&o)return null;return[f,t,u.c]}function L(e,{maxDepth:n=1e3,integersAsBigInt:i}={}){let l={},t={},r=l,f=t;for(let o=s(e,0);o<e.length;){if(e[o]==="["){let u=e[++o]==="[",a=x(e,o+=+u,"]");if(u){if(e[a[1]-1]!=="]")throw new c("expected end of table declaration",{toml:e,ptr:a[1]-1});a[1]++}let d=D(a[0],l,t,u?2:1);if(!d)throw new c("trying to redefine an already defined table or value",{toml:e,ptr:o});f=d[2],r=d[1],o=a[1]}else{let u=x(e,o),a=D(u[0],r,f,0);if(!a)throw new c("trying to redefine an already defined table or value",{toml:e,ptr:o});let d=E(e,u[1],void 0,n,i);a[1][a[0]]=d[0],o=d[1]}if(o=s(e,o,!0),e[o]&&e[o]!==`
`&&e[o]!=="\r")throw new c("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:o});o=s(e,o)}return l}let P=/^[a-z0-9-_]+$/i;function m(e){let n=typeof e;if(n==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return n}function J(e){for(let n=0;n<e.length;n++)if(m(e[n])!=="object")return!1;return e.length!=0}function O(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function T(e,n,i,l){if(i===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(n==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":l&&Number.isInteger(e)?e.toFixed(1):e.toString();if(n==="bigint"||n==="boolean")return e.toString();if(n==="string")return O(e);if(n==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(n==="object")return H(e,i,l);if(n==="array")return Q(e,i,l)}function H(e,n,i){let l=Object.keys(e);if(l.length===0)return"{}";let t="{ ";for(let r=0;r<l.length;r++){let f=l[r];r&&(t+=", "),t+=P.test(f)?f:O(f),t+=" = ",t+=T(e[f],m(e[f]),n-1,i)}return t+" }"}function Q(e,n,i){if(e.length===0)return"[]";let l="[ ";for(let t=0;t<e.length;t++){if(t&&(l+=", "),e[t]===null||e[t]===void 0)throw new TypeError("arrays cannot contain null or undefined values");l+=T(e[t],m(e[t]),n-1,i)}return l+" ]"}function W(e,n,i,l){if(i===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let t="";for(let r=0;r<e.length;r++)t+=`[[${n}]]
`,t+=_(e[r],n,i,l),t+=`

`;return t}function _(e,n,i,l){if(i===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let t="",r="",f=Object.keys(e);for(let o=0;o<f.length;o++){let u=f[o];if(e[u]!==null&&e[u]!==void 0){let a=m(e[u]);if(a==="symbol"||a==="function")throw new TypeError(`cannot serialize values of type '${a}'`);let d=P.test(u)?u:O(u);if(a==="array"&&J(e[u]))r+=W(e[u],n?`${n}.${d}`:d,i-1,l);else if(a==="object"){let w=n?`${n}.${d}`:d;r+=`[${w}]
`,r+=_(e[u],w,i-1,l),r+=`

`}else t+=d,t+=" = ",t+=T(e[u],a,i,l),t+=`
`}}return`${t}
${r}`.trim()}function p(e,{maxDepth:n=1e3,numbersAsFloat:i=!1}={}){if(m(e)!=="object")throw new TypeError("stringify can only be called with an object");return _(e,"",n,i)}var B={parse:L,stringify:p,TomlDate:h,TomlError:c};export{h as TomlDate,c as TomlError,B as default,L as parse,p as stringify};
//# sourceMappingURL=/sm/552188522977b9fe255cff8a05722a2ea9019429c329a1948ed2c19bdf4f53ba.map