function D(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function I(e,n,i){let l=e.split(/\r\n|\n|\r/g),o="",f=(Math.log10(n+1)|0)+1;for(let t=n-1;t<=n+1;t++){let r=l[t-1];r&&(o+=t.toString().padEnd(f," "),o+=": ",o+=r,o+=` `,t===n&&(o+=" ".repeat(f+i+2),o+=`^ `))}return o}class c extends Error{line;column;codeblock;constructor(n,i){const[l,o]=D(i.toml,i.ptr),f=I(i.toml,l,o);super(`Invalid TOML document: ${n} ${f}`,i),this.line=l,this.column=o,this.codeblock=f}}function L(e,n){let i=0;for(;e[n-++i]==="\\";);return--i&&i%2}function g(e,n=0,i=e.length){let l=e.indexOf(` `,n);return e[l-1]==="\r"&&l--,l<=i?l:-1}function m(e,n){for(let i=n;i-1&&i!=="'"&&L(e,n));return n>-1&&(n+=l.length,l.length>1&&(e[n]===i&&n++,e[n]===i&&n++)),n}let p=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class w extends Date{#n=!1;#i=!1;#e=null;constructor(n){let i=!0,l=!0,o="Z";if(typeof n=="string"){let f=n.match(p);f?(f[1]||(i=!1,n=`0000-01-01T${n}`),l=!!f[2],l&&n[10]===" "&&(n=n.replace(" ","T")),f[2]&&+f[2]>23?n="":(o=f[3]||null,n=n.toUpperCase(),!o&&l&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#n=i,this.#i=l,this.#e=o)}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 w(n);return l.#e=i,l}static wrapAsLocalDateTime(n){let i=new w(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new w(n);return i.#i=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new w(n);return i.#n=!1,i.#e=null,i}}let v=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,N=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,k=/^[+-]?0[0-9_]/,$=/^[0-9a-f]{2,8}$/i,y={b:"\b",t:" ",n:` `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function _(e,n=0,i=e.length){let l=e[n]==="'",o=e[n++]===e[n]&&e[n]===e[n+1];o&&(i-=2,e[n+=2]==="\r"&&n++,e[n]===` `&&n++);let f=0,t,r="",u=n;for(;n-1&&(m(e,o),l=l.slice(0,o)),[l.trimEnd(),o]}function x(e,n,i,l,o){if(l===0)throw new c("document contains excessively nested structures. aborting.",{toml:e,ptr:n});let f=e[n];if(f==="["||f==="{"){let[u,a]=f==="["?M(e,n,l,o):j(e,n,l,o);if(i){if(a=h(e,a),e[a]===",")a++;else if(e[a]!==i)throw new c("expected comma or end of structure",{toml:e,ptr:a})}return[u,a]}let t;if(f==='"'||f==="'"){t=T(e,n);let u=_(e,n,t);if(i){if(t=h(e,t),e[t]&&e[t]!==","&&e[t]!==i&&e[t]!==` `&&e[t]!=="\r")throw new c("unexpected character encountered",{toml:e,ptr:t});t+=+(e[t]===",")}return[u,t]}t=P(e,n,",",i);let r=R(e,n,t-+(e[t-1]===","));if(!r[0])throw new c("incomplete key-value declaration: no value specified",{toml:e,ptr:n});return i&&r[1]>-1&&(t=h(e,n+r[1]),t+=+(e[t]===",")),[C(r[0],e,n,o),t]}let Z=/^[a-zA-Z0-9-_]+[ \t]*$/;function b(e,n,i="="){let l=n-1,o=[],f=e.indexOf(i,n);if(f<0)throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:n});do{let t=e[n=++l];if(t!==" "&&t!==" ")if(t==='"'||t==="'"){if(t===e[n+1]&&t===e[n+2])throw new c("multiline strings are not allowed in keys",{toml:e,ptr:n});let r=T(e,n);if(r<0)throw new c("unfinished string encountered",{toml:e,ptr:n});l=e.indexOf(".",r);let u=e.slice(r,l<0||l>f?f:l),a=g(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:r});if(ff?f:l);if(!Z.test(r))throw new c("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:n});o.push(r.trimEnd())}}while(l+1&&l